mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 02:02:21 +00:00
Merge pull request #1854 from bilawalsidhu/samehkhamis/kit-doc-claims
Vue kit: the docs' every-control claims hold, and a scan of every view pins them
This commit is contained in:
26 files changed
+384
-116
No files matched your search
@@ -0,0 +1,3 @@
|
||||
- The remaining selects, pressed toggles and close buttons in the views are
|
||||
kit controls, and a test now keeps every view that way (manjunath22466,
|
||||
samehkhamis, #1854).
|
||||
+58
-34
@@ -37,9 +37,12 @@ one-panel rule too. Share links continue to record which panels are open.
|
||||
## Component kit
|
||||
|
||||
`src/ui/kit/` holds the generic components: `UiRail`, `UiTooltip`, `UiIcon`,
|
||||
`UiButton`, `UiCloseButton`, `UiPanel`, `UiSegmented`, `UiSlider`, `UiChip`,
|
||||
`UiSelect`, `UiSearchField`, `UiCheckbox`, `UiDialog`, `UiBadge` and `UiEmpty` so far, with more
|
||||
joining as the controls they serve are converted. One component
|
||||
`UiButton`, `UiCloseButton`, `UiPanel`, `UiPanelToggle` (a panel's collapse
|
||||
button, which `UiPanel` and `PanelCollapseButton` draw), `UiPanelEdge` (a
|
||||
panel header's edge switch), `UiSegmented`, `UiSlider`, `UiChip`,
|
||||
`UiSelect`, `UiSearchField`, `UiCheckbox`, `UiDialog`, `UiBadge` and
|
||||
`UiEmpty` so far, with more joining as the controls they serve are
|
||||
converted. One component
|
||||
serves every use of a control, with props for the differences (`UiPanel`'s
|
||||
`sideways`, `glow`, `scroll`), rather than a copy per panel. The components
|
||||
are styled by the existing stylesheet and custom properties, and they contain
|
||||
@@ -83,14 +86,20 @@ 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. 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.
|
||||
code adds (a voice highlight) survives a press. Every pressed toggle (a
|
||||
control with `aria-pressed`) in the views is a `UiButton` with `pressed`
|
||||
except two that keep their own `aria-pressed`: Bhote Koshi's cinematic
|
||||
button, whose state the event layer writes into the attributes its panel
|
||||
renders, and Explore's story cards, which are `role="button"` elements,
|
||||
not buttons (`src/ui/kit/viewControls.test.mjs` pins it). Where the
|
||||
converted buttons draw Material symbols (the tilt-map button, the Context
|
||||
header's search and expand, the imported files' row actions and the rail
|
||||
chips' icons), the glyphs are `UiIcon`s with `:size="null"`, so the site
|
||||
rules still size them. Core's pressable chips and pills (the rail cards'
|
||||
chips and action chips, Recent Imagery's day chips, SWAP and ZOOM IN, map
|
||||
sources, cities and places) are `UiButton`s too; the view context's place
|
||||
and layer chips and the key setup chip are still plain buttons. `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`
|
||||
@@ -106,11 +115,13 @@ Story screen's Context button and the timeline's Expand map are pressed
|
||||
toggles, with no pressed class since their skins read `aria-pressed`;
|
||||
Explore's story cards are `role="button"` elements and keep their own
|
||||
`aria-pressed`. Their glyphs are inline SVG drawn for Stories, which no
|
||||
Material symbol the page loads draws the same, so they stay SVG; the two
|
||||
search fields keep their own markup, since `UiSearchField`'s Material
|
||||
magnifier would replace their SVG one, and their clear buttons, which draw
|
||||
an SVG cross, are ghost `UiButton`s rather than `UiCloseButton`s
|
||||
(`src/ui/kit/storiesControls.test.mjs` pins it).
|
||||
Material symbol the page loads draws the same, so they stay SVG; the three
|
||||
search fields (Explore's two and the Story context sheet's story search, a
|
||||
combobox) keep their own markup, since `UiSearchField`'s Material
|
||||
magnifier would replace their SVG one, and Explore's two clear buttons,
|
||||
which draw an SVG cross, are ghost `UiButton`s rather than
|
||||
`UiCloseButton`s (`src/ui/kit/storiesControls.test.mjs` pins it).
|
||||
Explore's sort is a `UiSelect`.
|
||||
The Omnibar's mic (a pressed toggle with `active`) and its suggestion
|
||||
strip's chips (options, so `aria-current` rather than `pressed`) are
|
||||
ghost `UiButton`s, and its search, row and chip glyphs are `UiIcon`s with
|
||||
@@ -153,7 +164,12 @@ options that carry their own attributes come through the slot, a caller's
|
||||
`@change` still reaches the select, and `hold` works as in `UiSlider`.
|
||||
Without `hold`, a select takes its model back after its own change renders,
|
||||
so a pick its owner refuses goes back; an owner that answers later (the SDR
|
||||
gain) takes `hold`. Every select in the views is a `UiSelect`.
|
||||
gain) takes `hold`. A layer row's range ends are repainted on a later frame
|
||||
and may come back reordered (a start picked after the end swaps them), so
|
||||
they take a plain `value` instead of a model: a pick stays until the owner
|
||||
publishes a different value, which shows at once, focused or not
|
||||
(`src/ui/layerPanel/rowRange.test.mjs`). Every select in the views is a
|
||||
`UiSelect` (`src/ui/kit/viewControls.test.mjs` pins it).
|
||||
`UiBadge` takes a `tone` and carries Core's `gev-status-badge`; its
|
||||
density variants and colours stay caller classes, and it renders the CCTV
|
||||
source and calibration badges and the rail card badges. `UiEmpty` takes
|
||||
@@ -165,13 +181,16 @@ empty rows stay a paragraph and table cells.
|
||||
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 that draws a cross is one
|
||||
(`src/ui/kit/closeButtons.test.mjs` pins it) except Story Explore's two
|
||||
search clears, whose SVG cross is neither of its glyphs; the Story context
|
||||
(`src/ui/kit/closeButtons.test.mjs` and `viewControls.test.mjs` pin it,
|
||||
for a bare × or one in a span) except Story Explore's two search clears,
|
||||
whose SVG cross is neither of its glyphs, and an imported file's
|
||||
Remove, one of the row's icon `UiButton`s (show or hide, fly to, remove)
|
||||
that draw the icon the file import names for each. The Story context
|
||||
sheet's Close is a text button, a plain `UiButton`. Street Level's and the
|
||||
space mission's keep `bare`, since their skins set their own padding and
|
||||
border, and so does the credits list's. The
|
||||
Quebec CCTV overlay's close is one too, and so is the Omnibar guide's,
|
||||
which keeps its feature class and tip.
|
||||
space mission's (its deselect and the replay's Cancel) keep `bare`, since
|
||||
their skins set their own padding and border, and so does the credits
|
||||
list's. The Quebec CCTV overlay's close is one too, and so is the Omnibar
|
||||
guide's, which keeps its feature class and tip.
|
||||
`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
|
||||
@@ -215,7 +234,8 @@ classes, styles and listeners go to the dialog, and `element` is exposed.
|
||||
The Data Library and the scene sharing dialogs are `UiDialog`s
|
||||
(`src/ui/kit/dialogs.test.mjs` pins it); the panels drawn as
|
||||
`role="dialog"` (key setup, the welcome launcher, the CCTV popup, Story
|
||||
Explore's filter, the credits) and the render failure's `alertdialog` are
|
||||
Explore's filter, the credits, the Omnibar guide's callout) and the render
|
||||
failure's `alertdialog` are
|
||||
other controls. The two dialogs share no declarations, so it has no kit
|
||||
rules.
|
||||
`UiSlider` keeps the native range input rather than drawing a
|
||||
@@ -227,9 +247,12 @@ are, without Core's slider surface). A caller's own input, change and blur
|
||||
handlers still reach the input, and a null model leaves it as it is. It is
|
||||
a functional render-function component, so the portable `./ui/input` rows
|
||||
use it without a component compiler. Every range in the views is a
|
||||
`UiSlider` except the radio tuner's: its owner moves the handle back to the
|
||||
`UiSlider` except two. The radio tuner's owner moves the handle back to the
|
||||
selected station on a drag's first input without changing the slot, which
|
||||
a functional component would not render again.
|
||||
a functional component would not render again. The world timeline's
|
||||
scrubber is a bare range inside its own gesture track: its `step="any"`
|
||||
bounds follow the zoomed view, and a pinch puts the input back on the
|
||||
handle itself.
|
||||
|
||||
Controls share one skin, so every panel reads the same. Every scrolling
|
||||
surface carries the kit's `.ui-scroll`, which draws the thin
|
||||
@@ -500,14 +523,15 @@ once passes the locale itself as a prop or key, as the credits line does.
|
||||
records surface by surface; [Building UI](../CONTRIBUTING.md#building-ui)
|
||||
now requires the pattern for new UI. The page-level markup tests read
|
||||
`renderApplicationHtml()`, the real views rendered on the server, and new
|
||||
tests mount components; two tests still read a `.vue` file's source
|
||||
(`panelStorageDocs`, `geoFileImport`). The views translate with `t()`
|
||||
while rendering, and vue-i18n holds the locale they read; the attribute
|
||||
translation pass is left for static page markup (the loading screen and a
|
||||
host's own markup). An explicit API for hosts to register panels and rail items is
|
||||
deferred until a host adds one: no host does today (the hosted
|
||||
application's account interface is its own markup), and the first such
|
||||
panel, the hosted timeline, will shape it.
|
||||
tests mount components. Many tests still read `.vue` sources: the kit's
|
||||
control scans in `src/ui/kit/` (`viewControls`, `closeButtons`,
|
||||
`checkboxes`, `dialogs` and the per-surface ones) and markup checks such
|
||||
as `contextTabKeyboard`, `geoFileImport` and `panelStorageDocs`. The
|
||||
views translate with `t()` while rendering, and vue-i18n holds the
|
||||
locale they read; the attribute translation pass is left for static page
|
||||
markup (the loading screen and a host's own markup). An explicit API for
|
||||
hosts to register panels and rail items is deferred until a host needs
|
||||
one.
|
||||
|
||||
## Verification
|
||||
|
||||
|
||||
@@ -1332,6 +1332,7 @@
|
||||
"src/ui/kit/UiCloseButton.vue",
|
||||
"src/ui/kit/UiCloseButton.test.mjs",
|
||||
"src/ui/kit/closeButtons.test.mjs",
|
||||
"src/ui/kit/viewControls.test.mjs",
|
||||
"src/ui/styles/close-button.css",
|
||||
"src/ui/kit/UiSearchField.vue",
|
||||
"src/ui/kit/UiSearchField.test.mjs",
|
||||
@@ -1424,6 +1425,7 @@
|
||||
"src/data/firmsIntensity.test.mjs",
|
||||
"src/ui/layerPanel/RowSwitch.vue",
|
||||
"src/ui/layerPanel/RowRange.vue",
|
||||
"src/ui/layerPanel/rowRange.test.mjs",
|
||||
"src/ui/layerPanel/RowSlider.vue",
|
||||
"src/sources/phaseTiming.test.mjs",
|
||||
"scripts/build-census-places.mjs",
|
||||
|
||||
@@ -557,7 +557,7 @@ test('the imported files render what the file import publishes and keep focus',
|
||||
assert.equal(name.textContent, '<b>a</b>.geojson');
|
||||
assert.equal(name.children.length, 0, 'the name is text');
|
||||
assert.match(name.title, /GEOJSON, 2 map objects$/);
|
||||
assert.equal(toggle.className, 'geo-import-action');
|
||||
assert.ok(toggle.classList.contains('geo-import-action'));
|
||||
assert.equal(toggle.getAttribute('type'), 'button');
|
||||
assert.equal(toggle.getAttribute('aria-pressed'), 'true');
|
||||
assert.equal(toggle.getAttribute('aria-label'), 'Hide <b>a</b>.geojson');
|
||||
|
||||
@@ -162,7 +162,7 @@ export function initGeoFileImport({
|
||||
? t('Hide {name}', { name: item.name })
|
||||
: t('Show {name}', { name: item.name }),
|
||||
action: 'toggle',
|
||||
pressed: String(item.visible),
|
||||
pressed: Boolean(item.visible),
|
||||
},
|
||||
{
|
||||
icon: 'my_location',
|
||||
|
||||
@@ -220,7 +220,7 @@ test('row buttons hide, show, fly to and remove a file', async () => {
|
||||
shapes: [],
|
||||
});
|
||||
assert.equal(t.tool.list()[0].visible, false);
|
||||
assert.equal(action(rows(t)[0], 'toggle').pressed, 'false');
|
||||
assert.equal(action(rows(t)[0], 'toggle').pressed, false);
|
||||
assert.equal(action(rows(t)[0], 'toggle').icon, 'visibility_off');
|
||||
assert.equal(action(rows(t)[0], 'toggle').label, 'Show a.gpx');
|
||||
glyphClick('fly');
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Every close, dismiss and clear button in a Vue view is a UiCloseButton: no
|
||||
// SFC template hand-writes a button whose only content is × or the Material
|
||||
// `close` symbol. Buttons built in script are not read here.
|
||||
// SFC template hand-writes a button whose only content is × (bare or in a
|
||||
// span) or the Material `close` symbol. Buttons built in script are not read
|
||||
// here.
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync, readdirSync } from 'node:fs';
|
||||
@@ -30,8 +31,10 @@ function template(source) {
|
||||
// An opening tag's attributes, quoted values may hold `>` (`() => x`).
|
||||
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
|
||||
const BUTTON = String.raw`(button|UiButton)`;
|
||||
const TIMES = String.raw`×|×|×|×`;
|
||||
const CLOSE_GLYPH = [
|
||||
String.raw`×|×|×|×`,
|
||||
TIMES,
|
||||
String.raw`<span\b${ATTRS}>\s*(?:${TIMES})\s*</span\s*>`,
|
||||
String.raw`<span\b[^>]*\bmaterial-symbols-outlined\b[^>]*>\s*close\s*</span\s*>`,
|
||||
String.raw`<UiIcon${ATTRS}\bname="close"${ATTRS}/>`,
|
||||
].join('|');
|
||||
@@ -54,11 +57,14 @@ test('the scan finds each hand-written close glyph', () => {
|
||||
'<template><UiButton class="x" :label="l">×</UiButton></template>',
|
||||
'<template><button type="button" class="x">\n <span class="material-symbols-outlined" aria-hidden="true">close</span>\n</button></template>',
|
||||
'<template><UiButton class="x"><UiIcon name="close" :size="14" /></UiButton></template>',
|
||||
'<template><button type="button" :aria-label="l"><span aria-hidden="true">×</span></button></template>',
|
||||
'<template><UiButton class="x">\n <span class="glyph">×</span>\n</UiButton></template>',
|
||||
])
|
||||
assert.equal(handWrittenCloses(markup).length, 1, markup);
|
||||
for (const markup of [
|
||||
'<template><UiCloseButton class="x" :label="l" /></template>',
|
||||
'<template><button type="button">{{ name }} ×</button></template>',
|
||||
'<template><button type="button"><span>{{ name }}</span> ×</button></template>',
|
||||
'<template><button type="button">On<span class="material-symbols-outlined">close</span></button></template>',
|
||||
'<template><button type="button"><span class="material-symbols-outlined">close_fullscreen</span></button></template>',
|
||||
])
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// Every modal dialog in a Vue view is a UiDialog: no SFC template hand-writes
|
||||
// `<dialog>`. Panels drawn as `role="dialog"` (key setup, the welcome
|
||||
// launcher, the CCTV popup, Story Explore's filter) and the render failure's
|
||||
// `alertdialog` are other controls.
|
||||
// launcher, the CCTV popup, Story Explore's filter, the credits, the Omnibar
|
||||
// guide's callout) and the render failure's `alertdialog` are other
|
||||
// controls.
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync, readdirSync } from 'node:fs';
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
// `<input type="checkbox">`. Their glyphs are inline SVG drawn for Stories
|
||||
// (play, pause, back, filter, search, clear, expand, the GEV eye); no
|
||||
// Material symbol the page loads draws any of them the same, so they stay
|
||||
// SVG, and no view hand-writes a Material Symbols span. The two search
|
||||
// fields keep their own markup rather than UiSearchField, whose Material
|
||||
// magnifier would replace their SVG one, and their clear buttons stay ghost
|
||||
// UiButtons with an SVG cross rather than UiCloseButtons, whose glyph is ×
|
||||
// or the Material `close` symbol.
|
||||
// SVG, and no view hand-writes a Material Symbols span. The three search
|
||||
// fields (Explore's two and the Story context sheet's) keep their own markup
|
||||
// rather than UiSearchField, whose Material magnifier would replace their
|
||||
// SVG one, and Explore's two clear buttons stay ghost UiButtons with an SVG
|
||||
// cross rather than UiCloseButtons, whose glyph is × or the Material `close`
|
||||
// symbol.
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
// The kit's every-control claims in docs/VUE-MIGRATION.md, read from every
|
||||
// SFC outside the kit: every select is a UiSelect, every pressed toggle a
|
||||
// UiButton with `pressed` (no template hand-writes `aria-pressed` on any
|
||||
// element, as an attribute or inside a `v-bind` object, apart from the
|
||||
// exceptions below), and every close, dismiss and clear button a
|
||||
// UiCloseButton.
|
||||
// Controls built in script are not read here.
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync, readdirSync } from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const SRC_ROOT = fileURLToPath(new URL('../../', import.meta.url));
|
||||
const KIT_ROOT = fileURLToPath(new URL('./', import.meta.url));
|
||||
const REPO_ROOT = path.resolve(SRC_ROOT, '..');
|
||||
|
||||
// The pressed toggles that still hand-write `aria-pressed`, by file: each
|
||||
// pattern matches exactly one of the file's tags, and no other tag may.
|
||||
const HAND_WRITTEN_PRESSED = {
|
||||
// The cinematic button renders the attributes the Bhote Koshi layer
|
||||
// writes for it, `aria-pressed` among them.
|
||||
'src/ui/views/panels/BhoteKoshiPanel.vue': [/^<button\b[^]*\bcinematic/],
|
||||
// Explore's story cards are `role="button"` elements, not buttons.
|
||||
'src/ui/views/stories/ExploreScreen.vue': [
|
||||
/^<div class="card" role="button"/,
|
||||
],
|
||||
};
|
||||
|
||||
/** Every SFC under src, outside the kit. */
|
||||
function sfcFiles(directory = SRC_ROOT) {
|
||||
const files = [];
|
||||
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
||||
const absolute = path.join(directory, entry.name);
|
||||
if (entry.isDirectory()) {
|
||||
if (path.relative(KIT_ROOT, absolute) !== '')
|
||||
files.push(...sfcFiles(absolute));
|
||||
} else if (entry.isFile() && entry.name.endsWith('.vue'))
|
||||
files.push(absolute);
|
||||
}
|
||||
return files.sort();
|
||||
}
|
||||
|
||||
/** The template block: everything outside script, style and comments. */
|
||||
function template(source) {
|
||||
return source
|
||||
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
|
||||
.replace(/<!--[\s\S]*?-->/g, '');
|
||||
}
|
||||
|
||||
// An opening tag's attributes, quoted values may hold `>` (`() => x`).
|
||||
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
|
||||
const RAW_SELECT = /<select\b/gi;
|
||||
const ANY_TAG = new RegExp(String.raw`<[A-Za-z][\w-]*\b(${ATTRS})>`, 'g');
|
||||
// An attribute's name, outside the quoted values.
|
||||
const names = (attrs) => attrs.replace(/"[^"]*"|'[^']*'/g, '""');
|
||||
const PRESSED = /(?:^|\s)(?::|v-bind:)?aria-pressed(?=[\s=/]|$)/;
|
||||
// A `v-bind` object that names aria-pressed.
|
||||
const BOUND_PRESSED =
|
||||
/(?:^|\s)(?:v-bind|:)=(?:"[^"]*aria-?pressed[^"]*"|'[^']*aria-?pressed[^']*')/i;
|
||||
const TIMES = String.raw`×|×|×|×`;
|
||||
const CLOSE_GLYPH = [
|
||||
TIMES,
|
||||
String.raw`<span\b${ATTRS}>\s*(?:${TIMES})\s*</span\s*>`,
|
||||
String.raw`<span\b[^>]*\bmaterial-symbols-outlined\b[^>]*>\s*close\s*</span\s*>`,
|
||||
String.raw`<UiIcon${ATTRS}\bname="close"${ATTRS}/>`,
|
||||
].join('|');
|
||||
const HAND_WRITTEN_CLOSE = new RegExp(
|
||||
String.raw`<(button|UiButton)\b${ATTRS}>\s*(?:${CLOSE_GLYPH})\s*</\1\s*>`,
|
||||
'gi',
|
||||
);
|
||||
|
||||
const tidy = (markup) => markup.replace(/\s+/g, ' ');
|
||||
|
||||
/** Raw selects in an SFC's template. */
|
||||
const rawSelects = (source) =>
|
||||
[...template(source).matchAll(RAW_SELECT)].map((m) => m[0]);
|
||||
|
||||
/** Tags that hand-write aria-pressed. */
|
||||
function handWrittenPressed(source) {
|
||||
const found = [];
|
||||
for (const m of template(source).matchAll(ANY_TAG))
|
||||
if (PRESSED.test(names(m[1])) || BOUND_PRESSED.test(m[1]))
|
||||
found.push(tidy(m[0]));
|
||||
return found;
|
||||
}
|
||||
|
||||
/** Hand-written close buttons in an SFC's template. */
|
||||
const handWrittenCloses = (source) =>
|
||||
[...template(source).matchAll(HAND_WRITTEN_CLOSE)].map((m) => tidy(m[0]));
|
||||
|
||||
const views = sfcFiles().map((file) => ({
|
||||
file: path.relative(REPO_ROOT, file).split(path.sep).join('/'),
|
||||
source: readFileSync(file, 'utf8'),
|
||||
}));
|
||||
|
||||
test('the scans find each hand-written control', () => {
|
||||
for (const markup of [
|
||||
'<template><select id="x" v-model="a"><option>1</option></select></template>',
|
||||
'<template><SELECT\n class="x"></SELECT></template>',
|
||||
])
|
||||
assert.equal(rawSelects(markup).length, 1, markup);
|
||||
for (const markup of [
|
||||
'<template><UiSelect id="x" v-model="a" /></template>',
|
||||
'<script>const html = "<select>";</script><template><p /></template>',
|
||||
'<template><!-- a <select> once sat here --><p /></template>',
|
||||
])
|
||||
assert.equal(rawSelects(markup).length, 0, markup);
|
||||
|
||||
for (const markup of [
|
||||
'<template><button type="button" :aria-pressed="String(on)">A</button></template>',
|
||||
'<template><UiButton\n class="x"\n :title="a > b ? 1 : 2"\n aria-pressed="true"\n>A</UiButton></template>',
|
||||
'<template><button v-bind:aria-pressed="on">A</button></template>',
|
||||
'<template><div class="card" role="button" tabindex="0" :aria-pressed="on" /></template>',
|
||||
'<template><li role="option" :aria-pressed="on" /></template>',
|
||||
'<template><a :role="\'button\'" :aria-pressed="on">A</a></template>',
|
||||
'<template><UiButton v-bind="{ \'aria-pressed\': on }">A</UiButton></template>',
|
||||
])
|
||||
assert.equal(handWrittenPressed(markup).length, 1, markup);
|
||||
for (const markup of [
|
||||
'<template><UiButton :pressed="Boolean(on)" pressed-class="active">A</UiButton></template>',
|
||||
'<template><button :title="\'aria-pressed\'" @click="q(\'[aria-pressed=true]\')">A</button></template>',
|
||||
'<template><li role="option" :aria-selected="on" /></template>',
|
||||
])
|
||||
assert.equal(handWrittenPressed(markup).length, 0, markup);
|
||||
|
||||
for (const markup of [
|
||||
'<template><button type="button" @click="close">×</button></template>',
|
||||
'<template><button type="button" :aria-label="l"><span aria-hidden="true">×</span></button></template>',
|
||||
'<template><UiButton class="x"><UiIcon name="close" :size="null" /></UiButton></template>',
|
||||
])
|
||||
assert.equal(handWrittenCloses(markup).length, 1, markup);
|
||||
for (const markup of [
|
||||
'<template><UiCloseButton class="x" :label="l" /></template>',
|
||||
'<template><UiButton :label="l"><UiIcon :name="item.icon" :size="null" /></UiButton></template>',
|
||||
])
|
||||
assert.equal(handWrittenCloses(markup).length, 0, markup);
|
||||
});
|
||||
|
||||
test('the views are read: the scan reaches the views and skips the kit', () => {
|
||||
const files = views.map((view) => view.file);
|
||||
assert.ok(files.includes('src/ui/views/panels/ChatPanel.vue'));
|
||||
assert.ok(files.includes('src/ui/layerPanel/RowRange.vue'));
|
||||
assert.ok(!files.some((file) => file.startsWith('src/ui/kit/')));
|
||||
});
|
||||
|
||||
test('every select in the views is a UiSelect', () => {
|
||||
const found = [];
|
||||
for (const { file, source } of views)
|
||||
for (const markup of rawSelects(source)) found.push(`${file}: ${markup}`);
|
||||
assert.deepEqual(found, []);
|
||||
});
|
||||
|
||||
test('no view hand-writes aria-pressed on a button outside the documented exceptions', () => {
|
||||
const unexpected = [];
|
||||
for (const { file, source } of views) {
|
||||
const allowed = [...(HAND_WRITTEN_PRESSED[file] ?? [])];
|
||||
for (const markup of handWrittenPressed(source)) {
|
||||
const at = allowed.findIndex((pattern) => pattern.test(markup));
|
||||
if (at === -1) unexpected.push(`${file}: ${markup}`);
|
||||
else allowed.splice(at, 1);
|
||||
}
|
||||
assert.deepEqual(allowed, [], `${file}: an exception no longer matches`);
|
||||
}
|
||||
assert.deepEqual(unexpected, []);
|
||||
});
|
||||
|
||||
test('no view hand-writes a close button; each is a UiCloseButton', () => {
|
||||
const found = [];
|
||||
for (const { file, source } of views)
|
||||
for (const markup of handWrittenCloses(source))
|
||||
found.push(`${file}: ${markup}`);
|
||||
assert.deepEqual(found, []);
|
||||
});
|
||||
@@ -1,7 +1,13 @@
|
||||
<script setup>
|
||||
import UiSelect from '../kit/UiSelect.js';
|
||||
|
||||
// A row's start and end pickers on one line (e.g. the Shipwrecks period).
|
||||
// Both ends share one option list; `onSelect` reports which end moved
|
||||
// ('from' or 'to') and the chosen option value.
|
||||
// ('from' or 'to') and the chosen option value. The owner repaints the row
|
||||
// on a later frame and may reorder the ends (a start picked after the end
|
||||
// swaps them), so each select is given its end's value as a plain `value`
|
||||
// rather than a model: the pick stays until the owner publishes a different
|
||||
// value, which then shows at once, even on the focused select.
|
||||
defineProps({
|
||||
range: { type: Object, required: true },
|
||||
onSelect: { type: Function, default: () => {} },
|
||||
@@ -21,18 +27,18 @@ defineProps({
|
||||
:key="end"
|
||||
class="data-toggle-range-end"
|
||||
><span class="data-toggle-range-caption">{{ range[end].label }}</span
|
||||
><select
|
||||
><UiSelect
|
||||
class="data-toggle-range-select"
|
||||
:data-range-end="end"
|
||||
:aria-label="range[end].ariaLabel || undefined"
|
||||
:value="String(range[end].value)"
|
||||
@change="onSelect(end, $event.target.value)"
|
||||
@update:model-value="onSelect(end, $event)"
|
||||
><option
|
||||
v-for="option in range.options"
|
||||
:key="option.value"
|
||||
:value="String(option.value)"
|
||||
>{{ option.label }}</option
|
||||
></select
|
||||
></UiSelect
|
||||
></label
|
||||
></div
|
||||
></div
|
||||
|
||||
@@ -241,7 +241,7 @@ test('a Data Library row names its entry and draws icon action chips', () => {
|
||||
assert.equal(element.dataset.libraryEntry, 'nasa-black-marble');
|
||||
const button = element.querySelector('[data-chip-id="zoom"]');
|
||||
const glyph = button.children[0];
|
||||
assert.equal(glyph.className, 'material-symbols-outlined');
|
||||
assert.ok(glyph.classList.contains('material-symbols-outlined'));
|
||||
assert.equal(glyph.textContent, 'zoom_in_map');
|
||||
assert.equal(glyph.getAttribute('aria-hidden'), 'true');
|
||||
assert.equal(button.getAttribute('aria-label'), 'Zoom to layer');
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
import { after, before, test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { installVueDom } from '../../testSupport/vueDom.mjs';
|
||||
|
||||
let mount;
|
||||
let RowRange;
|
||||
let uninstall;
|
||||
before(async () => {
|
||||
uninstall = installVueDom();
|
||||
({ mount } = await import('@vue/test-utils'));
|
||||
RowRange = (await import('./RowRange.vue')).default;
|
||||
});
|
||||
after(() => uninstall());
|
||||
|
||||
const range = (from, to) => ({
|
||||
id: 'period',
|
||||
label: 'Period',
|
||||
valueText: `${from}–${to}`,
|
||||
from: { label: 'From', value: from },
|
||||
to: { label: 'To', value: to },
|
||||
options: [1900, 1950, 1960, 2000].map((value) => ({
|
||||
value,
|
||||
label: String(value),
|
||||
})),
|
||||
});
|
||||
|
||||
test('a range end keeps a pick until the owner repaints, then shows the owner’s ends', async () => {
|
||||
const picks = [];
|
||||
const wrapper = mount(RowRange, {
|
||||
attachTo: document.body,
|
||||
props: {
|
||||
range: range(1900, 1950),
|
||||
onSelect: (end, value) => picks.push([end, value]),
|
||||
},
|
||||
});
|
||||
const [from, to] = wrapper.findAll('select').map((w) => w.element);
|
||||
assert.equal(from.value, '1900');
|
||||
assert.equal(to.value, '1950');
|
||||
// A start picked after the end: the owner swaps the ends on a later frame.
|
||||
from.focus();
|
||||
from.value = '1960';
|
||||
from.dispatchEvent(new Event('change'));
|
||||
assert.deepEqual(picks, [['from', '1960']]);
|
||||
await wrapper.vm.$nextTick();
|
||||
assert.equal(from.value, '1960');
|
||||
await wrapper.setProps({ range: range(1950, 1960) });
|
||||
assert.equal(document.activeElement, from);
|
||||
assert.equal(from.value, '1950');
|
||||
assert.equal(to.value, '1960');
|
||||
wrapper.unmount();
|
||||
});
|
||||
@@ -2,6 +2,7 @@
|
||||
import { onBeforeUnmount } from 'vue';
|
||||
import { t } from '../../i18n/index.js';
|
||||
import { formatScaleRange } from '../unitLabels.js';
|
||||
import UiButton from '../kit/UiButton.vue';
|
||||
import UiCloseButton from '../kit/UiCloseButton.vue';
|
||||
import RailCardSetting from './RailCardSetting.vue';
|
||||
import RailChips from './RailChips.vue';
|
||||
@@ -166,28 +167,23 @@ function legendView(legend) {
|
||||
:title="action.title || undefined"
|
||||
@click="dispatch(action, block)"
|
||||
>{{ action.label }}</a
|
||||
><button
|
||||
><UiButton
|
||||
v-else
|
||||
:class="[
|
||||
'data-toggle-chip',
|
||||
{ active: action.pressed, 'is-reserved': action.reserved },
|
||||
]"
|
||||
type="button"
|
||||
:class="['data-toggle-chip', { 'is-reserved': action.reserved }]"
|
||||
:data-action-id="action.id"
|
||||
:title="action.title || undefined"
|
||||
:disabled="Boolean(action.disabled)"
|
||||
:aria-pressed="
|
||||
action.pressed === undefined
|
||||
? undefined
|
||||
: String(Boolean(action.pressed))
|
||||
:pressed="
|
||||
action.pressed === undefined ? undefined : Boolean(action.pressed)
|
||||
"
|
||||
pressed-class="active"
|
||||
:aria-hidden="
|
||||
action.reserved === undefined
|
||||
? undefined
|
||||
: String(Boolean(action.reserved))
|
||||
"
|
||||
@click="dispatch(action, block)"
|
||||
>{{ action.label }}</button
|
||||
>{{ action.label }}</UiButton
|
||||
><span class="rail-card-action-hint" :hidden="!action.hint">{{
|
||||
action.hint || ''
|
||||
}}</span></template
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup>
|
||||
import UiButton from '../kit/UiButton.vue';
|
||||
import UiIcon from '../kit/UiIcon.vue';
|
||||
|
||||
// Keyed chips shared by rail cards; the owner decides what a click does.
|
||||
// An `icon` chip shows a Material Symbol (named in index.html's `icon_names`
|
||||
@@ -29,11 +30,9 @@ const chipClass = (chip) =>
|
||||
:disabled="Boolean(chip.disabled)"
|
||||
:aria-busy="String(Boolean(chip.busy))"
|
||||
@click="onSelect(chip)"
|
||||
><span
|
||||
v-if="chip.icon"
|
||||
class="material-symbols-outlined"
|
||||
aria-hidden="true"
|
||||
>{{ chip.icon }}</span
|
||||
><template v-else>{{ chip.label }}</template></UiButton
|
||||
><UiIcon v-if="chip.icon" :name="chip.icon" :size="null" /><template
|
||||
v-else
|
||||
>{{ chip.label }}</template
|
||||
></UiButton
|
||||
>
|
||||
</template>
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup>
|
||||
import { onMounted, onUpdated, ref } from 'vue';
|
||||
import UiButton from '../kit/UiButton.vue';
|
||||
|
||||
// An ordered list whose rows keep their identity, so a focused row stays.
|
||||
const props = defineProps({
|
||||
@@ -10,7 +11,7 @@ const props = defineProps({
|
||||
const root = ref(null);
|
||||
|
||||
const rowClass = (item) =>
|
||||
`data-row-list-item${item.disabled ? ' note' : ''}${item.active ? ' active' : ''}${item.current ? ' current' : ''}`;
|
||||
`data-row-list-item${item.disabled ? ' note' : ''}${item.current ? ' current' : ''}`;
|
||||
|
||||
// Follow the flight, but never steal a scroll the reader is making
|
||||
// themselves: only when the step actually changed.
|
||||
@@ -43,19 +44,19 @@ onUpdated(followCurrent);
|
||||
v-for="item in list?.items ?? []"
|
||||
:key="item.id"
|
||||
:data-list-item-id="item.id"
|
||||
><button
|
||||
type="button"
|
||||
><UiButton
|
||||
:class="rowClass(item)"
|
||||
:data-list-item-id="item.id"
|
||||
:disabled="Boolean(item.disabled)"
|
||||
:aria-current="item.current ? 'step' : 'false'"
|
||||
:aria-pressed="item.active ? 'true' : 'false'"
|
||||
:pressed="Boolean(item.active)"
|
||||
pressed-class="active"
|
||||
:title="String(item.text ?? '')"
|
||||
@click="onSelect(item)"
|
||||
><span class="data-row-list-lead">{{ String(item.lead ?? '') }}</span
|
||||
><span class="data-row-list-text">{{
|
||||
String(item.text ?? '')
|
||||
}}</span></button
|
||||
}}</span></UiButton
|
||||
></li
|
||||
></ol
|
||||
>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup>
|
||||
import { t } from '../../i18n/index.js';
|
||||
import UiButton from '../kit/UiButton.vue';
|
||||
|
||||
// One imagery day in the strip. The owner computes every value; clicks reach
|
||||
// it through the readout's delegated listener.
|
||||
@@ -46,21 +47,18 @@ defineProps({
|
||||
><div class="ri-card-sensor">{{ card.sensor }}</div
|
||||
><div class="ri-card-cloud">{{ card.cloud }}</div
|
||||
><div class="ri-card-chips"
|
||||
><button
|
||||
><UiButton
|
||||
v-for="chip in card.chips"
|
||||
:key="chip.slot"
|
||||
type="button"
|
||||
:class="[
|
||||
'data-toggle-chip ri-chip',
|
||||
{ active: chip.active, 'is-reserved': chip.reserved },
|
||||
]"
|
||||
:class="['data-toggle-chip ri-chip', { 'is-reserved': chip.reserved }]"
|
||||
tabindex="-1"
|
||||
:data-slot="chip.slot"
|
||||
:disabled="chip.disabled"
|
||||
:aria-pressed="String(chip.active)"
|
||||
:disabled="Boolean(chip.disabled)"
|
||||
:pressed="Boolean(chip.active)"
|
||||
pressed-class="active"
|
||||
:aria-hidden="String(chip.reserved)"
|
||||
:aria-label="chip.ariaLabel"
|
||||
>{{ chip.label }}</button
|
||||
>{{ chip.label }}</UiButton
|
||||
></div
|
||||
></div
|
||||
>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { t } from '../../i18n/index.js';
|
||||
import UiButton from '../kit/UiButton.vue';
|
||||
import UiCloseButton from '../kit/UiCloseButton.vue';
|
||||
import UiSegmented from '../kit/UiSegmented.vue';
|
||||
import RailCardBlocks from '../rail/RailCardBlocks.vue';
|
||||
@@ -51,17 +52,16 @@ const modeOptions = computed(() =>
|
||||
aria-live="polite"
|
||||
:title="view.notice.text"
|
||||
>{{ view.notice.text }}</span
|
||||
><button
|
||||
><UiButton
|
||||
id="ri-zoom-in"
|
||||
:class="[
|
||||
'data-toggle-chip ri-zoom-in',
|
||||
{ 'is-reserved': !view.notice.fit },
|
||||
]"
|
||||
type="button"
|
||||
:title="t('Fly in until the view fits the 1,000 km limit')"
|
||||
:disabled="!view.notice.fit"
|
||||
:aria-hidden="String(!view.notice.fit)"
|
||||
>{{ t('ZOOM IN') }}</button
|
||||
>{{ t('ZOOM IN') }}</UiButton
|
||||
></div
|
||||
><div
|
||||
id="ri-strip"
|
||||
@@ -131,21 +131,18 @@ const modeOptions = computed(() =>
|
||||
max="100"
|
||||
step="1"
|
||||
:aria-label="t('Imagery opacity')"
|
||||
:disabled="!view.opacityEnabled" /><button
|
||||
:disabled="!view.opacityEnabled" /><UiButton
|
||||
id="ri-swap"
|
||||
:class="[
|
||||
'data-toggle-chip ri-swap',
|
||||
{
|
||||
'is-reserved': !view.swap.live,
|
||||
active: view.swap.pressed,
|
||||
},
|
||||
{ 'is-reserved': !view.swap.live },
|
||||
]"
|
||||
type="button"
|
||||
:title="t('Trade the two sides of the divider')"
|
||||
:disabled="!view.swap.live"
|
||||
:aria-hidden="String(!view.swap.live)"
|
||||
:aria-pressed="String(view.swap.pressed)"
|
||||
>{{ t('SWAP') }}</button
|
||||
:pressed="Boolean(view.swap.pressed)"
|
||||
pressed-class="active"
|
||||
>{{ t('SWAP') }}</UiButton
|
||||
><div class="ri-exports"
|
||||
><RailCardBlocks
|
||||
:blocks="view.exports"
|
||||
|
||||
@@ -17,6 +17,7 @@ import ViewContext from './panels/ViewContext.vue';
|
||||
import SpaceMissionsPanel from './panels/SpaceMissionsPanel.vue';
|
||||
import RadioPanel from './panels/RadioPanel.vue';
|
||||
import UiButton from '../kit/UiButton.vue';
|
||||
import UiIcon from '../kit/UiIcon.vue';
|
||||
import UiSearchField from '../kit/UiSearchField.vue';
|
||||
import { cockpitEntryFace } from '../cockpitPresentation.js';
|
||||
import { LAYER_TABS, TAB_AFFECTS, activeTab, availableTabs, contextReady, enabledLayerIds, setEnabledLayers, tabTarget } from '../contextLayerTabs.js';
|
||||
@@ -182,12 +183,12 @@ watch(
|
||||
</RailPanel>
|
||||
<RailPanel id="global-context-panel" start-collapsed v-class-toggle="{ ...(ctx && { 'context-enabled': ctx.enabled }) }" :data-context-mode="ctx?.mode" :data-context-tab="activeTab" :title="t('CONTEXT')" sideways scroll rail-scroller>
|
||||
<template #actions>
|
||||
<button type="button" class="context-dock-btn" :aria-pressed="String(contextSearchOpen)" :aria-label="contextSearchOpen ? t('Close Context search') : t('Search in Context')" :title="contextSearchOpen ? t('Close search') : t('Search in Context')" @click="toggleSearch">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">search</span>
|
||||
</button>
|
||||
<button type="button" class="context-dock-btn" :aria-pressed="String(docked)" :aria-label="docked ? t('Shrink Context back to a panel') : t('Expand Context to a full-height column')" :title="docked ? t('Shrink') : t('Expand')" @click="setDocked(!docked)">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">{{ docked ? 'close_fullscreen' : 'open_in_full' }}</span>
|
||||
</button>
|
||||
<UiButton class="context-dock-btn" :pressed="Boolean(contextSearchOpen)" :aria-label="contextSearchOpen ? t('Close Context search') : t('Search in Context')" :title="contextSearchOpen ? t('Close search') : t('Search in Context')" @click="toggleSearch">
|
||||
<UiIcon name="search" :size="null" />
|
||||
</UiButton>
|
||||
<UiButton class="context-dock-btn" :pressed="docked" :aria-label="docked ? t('Shrink Context back to a panel') : t('Expand Context to a full-height column')" :title="docked ? t('Shrink') : t('Expand')" @click="setDocked(!docked)">
|
||||
<UiIcon :name="docked ? 'close_fullscreen' : 'open_in_full'" :size="null" />
|
||||
</UiButton>
|
||||
</template>
|
||||
<div class="cyber-panel-body ui-scroll" data-rail-scroller>
|
||||
<UiSearchField v-if="contextSearchOpen" ref="searchInput" v-model="contextSearchText" class="context-search" role="search" input-class="context-search__input" :label="searchHint" :placeholder="searchHint" autocomplete="off" spellcheck="false" :clear-label="t('Clear search')" clear-class="context-search__clear" @escape="closeContextSearch" />
|
||||
|
||||
@@ -6,6 +6,7 @@ import { useVoiceStore } from '../../stores/voice.js';
|
||||
import { ASSISTANT_NAME } from '../../../voice/control.js';
|
||||
import PanelLayoutButtons from './PanelLayoutButtons.vue';
|
||||
import UiCloseButton from '../../kit/UiCloseButton.vue';
|
||||
import UiSelect from '../../kit/UiSelect.js';
|
||||
|
||||
// The typed chat in the command dock, as its owner (src/voice/chatControl.js)
|
||||
// writes the voice control presenter. Messages arrive apart from the view, so
|
||||
@@ -15,7 +16,6 @@ const store = useVoiceStore();
|
||||
const { controls, chat: messages } = storeToRefs(store);
|
||||
const emit = (name, ...args) => controls.value?.emit(name, ...args);
|
||||
const list = ref(null);
|
||||
const layerSelect = ref(null);
|
||||
const layerChoice = ref('');
|
||||
|
||||
// The input holds what the person types until its owner writes it (history
|
||||
@@ -55,7 +55,6 @@ watch(messages, (next, previous) => {
|
||||
function attachLayer() {
|
||||
const value = layerChoice.value;
|
||||
layerChoice.value = '';
|
||||
if (layerSelect.value) layerSelect.value.value = '';
|
||||
if (value) emit('chat-layer', value);
|
||||
}
|
||||
|
||||
@@ -92,10 +91,10 @@ const quickPrompts = () => [t('Fly to Tokyo'), t('Show live flights')];
|
||||
<div id="gev-chat-attach-menu" :hidden="!props.view.chat.attachMenuOpen" @keydown="emit('chat-attach-keydown', $event)">
|
||||
<label for="gev-chat-layer">{{ t('Attach a map layer') }}</label>
|
||||
<div id="gev-chat-layer-row">
|
||||
<select id="gev-chat-layer" ref="layerSelect" :disabled="props.view.chat.locked" @change="layerChoice = $event.target.value" @keydown.enter.prevent="attachLayer()">
|
||||
<UiSelect id="gev-chat-layer" v-model="layerChoice" :disabled="props.view.chat.locked" @keydown.enter.prevent="attachLayer()">
|
||||
<option value="">{{ t('Choose a layer…') }}</option>
|
||||
<option v-for="layer in props.view.chat.layers" :key="layer.value" :value="layer.value">{{ layer.label }}</option>
|
||||
</select>
|
||||
</UiSelect>
|
||||
<button id="gev-chat-layer-attach" type="button" :disabled="props.view.chat.locked || !layerChoice" @click="attachLayer()">{{ t('Attach layer') }}</button>
|
||||
</div>
|
||||
<button id="gev-chat-file-button" type="button" :disabled="props.view.chat.locked" @click="emit('chat-file-button')">{{ t('Attach a file') }}</button>
|
||||
|
||||
@@ -4,13 +4,17 @@ import { computed, ref } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { vFocusSafeChildren } from '../../rail/focusSafeChildren.js';
|
||||
import { useDisplayStore } from '../../stores/display.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiIcon from '../../kit/UiIcon.vue';
|
||||
|
||||
// DISPLAY ▸ Import: the button, the hidden picker, the imported files and
|
||||
// the hint. The file import publishes the rows and hint; until it does, the
|
||||
// list is empty. A pick and the row buttons call its actions. Before the
|
||||
// row holding keyboard focus goes, focus moves to the next row's same
|
||||
// button, else the previous row's, else the Import button. The list's
|
||||
// template is one line: templates keep whitespace.
|
||||
// button, else the previous row's, else the Import button. Each row's
|
||||
// actions (show or hide, fly to, remove) are icon buttons the file import
|
||||
// describes, Show/Hide a pressed toggle. The list's template is one line:
|
||||
// templates keep whitespace.
|
||||
const display = useDisplayStore();
|
||||
const { geoImport } = storeToRefs(display);
|
||||
const rows = computed(() => geoImport.value?.rows ?? []);
|
||||
@@ -63,7 +67,7 @@ function leave() {
|
||||
<span class="pp-label">{{ t('Import') }}</span>
|
||||
</button>
|
||||
<input ref="picker" type="file" id="geo-import-input" accept=".geojson,.json,.kml,.kmz,.gpx" multiple hidden @change="pick" :aria-label="t('Choose GeoJSON, KML, KMZ or GPX files')">
|
||||
<ul class="geo-import-list" :class="{ visible: listed }" id="geo-import-list" v-focus-safe-children="leave" :aria-label="t('Imported files')"><li v-for="row in rows" :key="row.id" class="geo-import-row" :data-import-id="row.id"><span :class="['geo-import-swatch', { 'own-styles': row.ownStyles }]" :style="row.ownStyles ? null : { background: row.color }"></span><span class="geo-import-name" :title="row.title">{{ row.name }}</span><button v-for="item in row.actions" :key="item.action" type="button" class="geo-import-action" :data-action="item.action" :title="item.label" :aria-label="item.label" :aria-pressed="item.pressed" @click="display.act(ROW_ACTIONS[item.action], row.id)"><span class="material-symbols-outlined" aria-hidden="true">{{ item.icon }}</span></button></li></ul>
|
||||
<ul class="geo-import-list" :class="{ visible: listed }" id="geo-import-list" v-focus-safe-children="leave" :aria-label="t('Imported files')"><li v-for="row in rows" :key="row.id" class="geo-import-row" :data-import-id="row.id"><span :class="['geo-import-swatch', { 'own-styles': row.ownStyles }]" :style="row.ownStyles ? null : { background: row.color }"></span><span class="geo-import-name" :title="row.title">{{ row.name }}</span><UiButton v-for="item in row.actions" :key="item.action" class="geo-import-action" :data-action="item.action" :label="item.label" :pressed="item.pressed" @click="display.act(ROW_ACTIONS[item.action], row.id)"><UiIcon :name="item.icon" :size="null" /></UiButton></li></ul>
|
||||
<span class="draw-hint geo-import-hint" id="geo-import-hint" aria-live="polite">{{ geoImport?.hint ?? '' }}</span>
|
||||
</div>
|
||||
</template>
|
||||
@@ -4,6 +4,8 @@ import { computed } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { useGlobeActionsStore } from '../../stores/globeActions.js';
|
||||
import GlobeCompass from './GlobeCompass.vue';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiIcon from '../../kit/UiIcon.vue';
|
||||
|
||||
// The top-center camera and share actions. The shell answers the buttons
|
||||
// through the store and publishes a clear under way, which keeps the button
|
||||
@@ -24,9 +26,9 @@ const tilted = computed(() => Boolean(camera.value?.tilted));
|
||||
<button id="share-btn" type="button" :aria-label="t('Copy share link')" :title="t('Copy share link')" @click="act('share')">
|
||||
<span class="share-icon" aria-hidden="true">🔗</span>
|
||||
</button>
|
||||
<button id="tilt-map-view" type="button" :aria-label="tilted ? t('Return map to straight-down view') : t('Tilt map to oblique view')" :aria-pressed="String(tilted)" :title="t('Toggle straight-down and tilted map views')" @click="act('tilt')">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">view_in_ar</span>
|
||||
</button>
|
||||
<UiButton id="tilt-map-view" :aria-label="tilted ? t('Return map to straight-down view') : t('Tilt map to oblique view')" :pressed="tilted" :title="t('Toggle straight-down and tilted map views')" @click="act('tilt')">
|
||||
<UiIcon name="view_in_ar" :size="null" />
|
||||
</UiButton>
|
||||
<GlobeCompass @click="act('northUp')" />
|
||||
<button id="reset-globe-view" type="button" :aria-label="resetBusy ? t('Resetting to full globe view') : t('Reset to full globe view')" :title="t('Reset camera and return to full globe view')" @click="act('reset')">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">public</span>
|
||||
|
||||
@@ -72,7 +72,7 @@ watch(
|
||||
<UiButton class="mission-replay-button" data-mission-replay :pressed="m?.replay.active ?? false" :title="t('Replay the estimated ascent with a following camera')" :hidden="m && (m.replay.active || !m.replay.available)" :disabled="m && !m.replay.available" @click="layer?.startSelectedReplay()">{{ t('REPLAY ASCENT') }}</UiButton>
|
||||
<div class="mission-replay-transport" :class="{ 'is-paused': m?.replay.paused }" data-mission-replay-transport :hidden="!m?.replay.active" :aria-label="m?.replay.transportLabel">
|
||||
<button type="button" data-mission-replay-toggle :title="m ? m.replay.toggleLabel : t('Pause replay')" :aria-label="m ? m.replay.toggleLabel : t('Pause replay')" :disabled="m && !m.replay.active" @click="layer?.toggleReplayPause()">{{ m ? m.replay.toggleText : 'Ⅱ' }}</button>
|
||||
<button type="button" class="cancel" data-mission-replay-cancel :title="t('Cancel replay')" :aria-label="t('Cancel replay')" @click="layer?.cancelReplay()"><span aria-hidden="true">×</span></button>
|
||||
<UiCloseButton class="cancel" data-mission-replay-cancel bare :title="t('Cancel replay')" :label="t('Cancel replay')" @click="layer?.cancelReplay()" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="space-mission-nav">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup>
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
|
||||
// Dock and minimize for an assistant panel (chat or voice). The owner
|
||||
// (src/voice/panelLayout.js) places the panel; this reports the choice.
|
||||
@@ -12,7 +13,7 @@ defineEmits(['dock', 'minimize']);
|
||||
|
||||
<template>
|
||||
<div class="gev-panel-layout" role="group" :aria-label="t('Panel position')">
|
||||
<button type="button" data-layout-dock :aria-pressed="String(props.docked)" :aria-label="props.docked ? t('Move above the dock') : t('Dock to the right')" :title="props.docked ? t('Move above the dock') : t('Dock to the right')" @click="$emit('dock')"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path :d="props.docked ? 'M4 5h16v14H4ZM4 14h16' : 'M4 5h16v14H4ZM14 5v14'"></path></svg></button>
|
||||
<button type="button" data-layout-minimize :aria-label="props.minimized ? t('Expand panel') : t('Minimize panel')" :title="props.minimized ? t('Expand panel') : t('Minimize panel')" @click="$emit('minimize')"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path :d="props.minimized ? 'M6 6h12v12H6Z' : 'M6 12h12'"></path></svg></button>
|
||||
<UiButton data-layout-dock :pressed="props.docked" :label="props.docked ? t('Move above the dock') : t('Dock to the right')" @click="$emit('dock')"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path :d="props.docked ? 'M4 5h16v14H4ZM4 14h16' : 'M4 5h16v14H4ZM14 5v14'"></path></svg></UiButton>
|
||||
<UiButton data-layout-minimize :label="props.minimized ? t('Expand panel') : t('Minimize panel')" @click="$emit('minimize')"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path :d="props.minimized ? 'M6 6h12v12H6Z' : 'M6 12h12'"></path></svg></UiButton>
|
||||
</div>
|
||||
</template>
|
||||
@@ -2,6 +2,7 @@
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { useSceneInteractionsStore } from '../../stores/sceneInteractions.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
|
||||
// The active shot's Scene actions panel, inside the viewer's container, as
|
||||
// the scene interactions owner (src/scenes/interactions.js) presents it.
|
||||
@@ -45,6 +46,6 @@ const outline = (id) => ({
|
||||
|
||||
<template>
|
||||
<Teleport v-if="panel" :to="panel.container">
|
||||
<section :key="panel.id" data-director-interactions="" :aria-label="t('Scene actions')" :style="panelStyle"><strong>{{ t('Scene actions') }}</strong><p role="status">{{ panel.status }}</p><button v-for="item in panel.items" :key="item.id" type="button" :data-director-action="item.id" :disabled="panel.busy" :aria-pressed="String(panel.selected === item.id)" :style="outline(item.id)" :onClick="onClick(panel.owner, item.id)">{{ item.label }}</button><div data-director-action-card=""><template v-if="panel.card"><p>{{ panel.card.text }}</p><a v-if="panel.card.url" :href="panel.card.url" target="_blank" rel="noopener noreferrer" style="color: #6eeaff">{{ t('Source') }}</a></template></div></section>
|
||||
<section :key="panel.id" data-director-interactions="" :aria-label="t('Scene actions')" :style="panelStyle"><strong>{{ t('Scene actions') }}</strong><p role="status">{{ panel.status }}</p><UiButton v-for="item in panel.items" :key="item.id" :data-director-action="item.id" :disabled="panel.busy" :pressed="panel.selected === item.id" :style="outline(item.id)" :onClick="onClick(panel.owner, item.id)">{{ item.label }}</UiButton><div data-director-action-card=""><template v-if="panel.card"><p>{{ panel.card.text }}</p><a v-if="panel.card.url" :href="panel.card.url" target="_blank" rel="noopener noreferrer" style="color: #6eeaff">{{ t('Source') }}</a></template></div></section>
|
||||
</Teleport>
|
||||
</template>
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
import StoriesHeader from './StoriesHeader.vue';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiCheckbox from '../../kit/UiCheckbox.vue';
|
||||
import UiSelect from '../../kit/UiSelect.js';
|
||||
|
||||
/**
|
||||
* Explore (prototype `.scr-explore`): the feed beside GEV's Cesium globe,
|
||||
@@ -446,11 +447,11 @@ defineExpose({
|
||||
>
|
||||
<div class="fh-tools">
|
||||
<label class="sr" for="exSort">{{ t('Sort stories') }}</label>
|
||||
<select id="exSort" v-model="sort" class="fh-sort">
|
||||
<UiSelect id="exSort" v-model="sort" class="fh-sort">
|
||||
<option value="new">{{ t('Newest') }}</option>
|
||||
<option value="long">{{ t('Longest') }}</option>
|
||||
<option value="az">{{ t('A–Z') }}</option>
|
||||
</select>
|
||||
</UiSelect>
|
||||
<UiButton
|
||||
id="exFilterBtn"
|
||||
ref="filterBtn"
|
||||
|
||||
Reference in new issue
Block a user