Merge pull request #1852 from bilawalsidhu/samehkhamis/kit-sweep-stories

Vue kit: the Stories views' buttons are UiButtons and Explore's filters UiCheckboxes
This commit is contained in:
Sameh Khamis authored and GitHub committed 2026-11-19 05:24:33 -08:00
commit 5dbd73b4e9
13 files changed
+248 -150

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
- The Stories views' buttons and Explore's filter checkbox are now kit
controls, with the same look and behaviour (manjunath22466, samehkhamis,
#1852).
+24 -8
View File
@@ -84,8 +84,8 @@ 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,
the Stories screens and a few panel buttons still hand-write theirs, and
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)
@@ -99,6 +99,18 @@ 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
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).
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
@@ -152,9 +164,12 @@ empty rows stay a paragraph and table cells.
`UiCloseButton` is a `UiButton` with a fixed glyph, a required `label` and
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
set their own padding and border, and so does the credits list's. The
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
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.
`UiSearchField` takes `v-model`, a required `label` (the input's
@@ -181,9 +196,10 @@ a refused change. Attributes and classes go to the label; `inputId` and
`inputAttrs` (such as `aria-describedby` or a data hook) to the box. The
Visual panel's Scope, sky and application toggles, the voice and chat
preferences, the Data Library's filter and the welcome card's box are
`UiCheckbox`es (`src/ui/kit/checkboxes.test.mjs` pins it); Story Explore's
filters are not converted yet. Its kit rule holds the centred row the
checkbox-only labels drew, moved rather than copied.
`UiCheckbox`es, and so are Story Explore's filter options, whose label
keeps its `fopt` class (`src/ui/kit/checkboxes.test.mjs` pins it). Its kit
rule holds the centred row the checkbox-only labels drew, moved rather than
copied.
`UiDialog` is a native `<dialog>` its owner opens and closes with `open`:
true opens it with `showModal()` (on mount, for one mounted open), false
closes it, and unmounting closes it. Each change is applied once the content
+1
View File
@@ -1348,6 +1348,7 @@
"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",
"src/ui/styles/empty-state.css",
"src/ui/rail/RailChips.vue",
+1
View File
@@ -5385,6 +5385,7 @@
"src/ui/kit/UiEmpty.vue",
"src/ui/kit/UiBadge.vue",
"src/ui/kit/UiCloseButton.vue",
"src/ui/kit/UiCheckbox.vue",
"src/ui/stores/globeActions.js",
"src/ui/stores/recording.js",
"src/ui/i18n.js",
+2 -5
View File
@@ -1,5 +1,5 @@
// Every checkbox in a Vue view is a UiCheckbox: no SFC template hand-writes
// `<input type="checkbox">`. Story Explore's filters are not converted yet.
// `<input type="checkbox">`.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync, readdirSync } from 'node:fs';
@@ -8,10 +8,7 @@ import { fileURLToPath } from 'node:url';
const SRC_ROOT = fileURLToPath(new URL('../../', import.meta.url));
const REPO_ROOT = path.resolve(SRC_ROOT, '..');
const NOT_YET = new Set([
'src/ui/kit/UiCheckbox.vue',
'src/ui/views/stories/ExploreScreen.vue',
]);
const NOT_YET = new Set(['src/ui/kit/UiCheckbox.vue']);
/** Every SFC under src. */
function sfcFiles(directory = SRC_ROOT) {
+107
View File
@@ -0,0 +1,107 @@
// The Stories views' buttons and checkboxes are the kit's: neither the
// Stories entry nor any Explore or Story screen hand-writes a <button> or an
// `<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.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
/** A view's template block: everything outside script and style. */
function template(file) {
const source = readFileSync(
new URL(`../views/${file}`, import.meta.url),
'utf8',
);
return source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
}
const views = {
// The Stories entry, the popup's Browse stories and Not now, and the
// toast's Back to story.
'StoriesView.vue': { buttons: 4, svgs: 2 },
// The list grip, Filter, the two search clears, the topic chips (All and
// each topic), the filter's Clear and Show, Clear all, a card's thumbnail
// play and Play story, the map pins and the preview's Play story.
'stories/ExploreScreen.vue': { buttons: 13, svgs: 8 },
// Back, the logo, the breadcrumb's link, search, Share and Back to GEV or
// GEV Stories.
'stories/StoriesHeader.vue': { buttons: 8, svgs: 5 },
// The sheet handle, voice search, the search results, Close, the key
// moments and the related stories.
'stories/StoryContext.vue': { buttons: 6, svgs: 3 },
// Open in GEV and Share.
'stories/StoryRail.vue': { buttons: 2, svgs: 1 },
// A chapter, Minimise, Expand, the card's page dots, the big Play and
// Context.
'stories/StoryScreen.vue': { buttons: 6, svgs: 5 },
// Play, the key moment pips and Expand map.
'stories/StoryTimeline.vue': { buttons: 3, svgs: 2 },
};
// A tag's attributes, read past quoted values so a handler's `=>` does not
// end the tag early.
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const tag = (pattern, flags = '') =>
new RegExp(pattern.replaceAll('ATTRS', ATTRS), flags);
const markup = Object.fromEntries(
Object.keys(views).map((file) => [file, template(file)]),
);
test('the Stories views hand-write no button; each is a UiButton', () => {
for (const [file, { buttons }] of Object.entries(views)) {
assert.deepEqual(markup[file].match(/<button\b/gi) ?? [], [], file);
assert.equal(markup[file].match(/<UiButton\b/g)?.length, buttons, file);
}
});
test('the pressed toggles take the kit pressed state', () => {
for (const view of Object.values(markup))
assert.doesNotMatch(view, tag(String.raw`<UiButton\bATTRS\saria-pressed`));
const explore = markup['stories/ExploreScreen.vue'];
// All, each topic and the map pins; the cards are role="button" divs that
// keep their own aria-pressed.
assert.equal(
explore.match(tag(String.raw`<UiButton\bATTRS\s:pressed=`, 'g'))?.length,
3,
);
assert.match(
explore,
tag(String.raw`class="card"\s+role="button"ATTRS\s:aria-pressed=`),
);
assert.match(
markup['stories/StoryScreen.vue'],
tag(String.raw`<UiButton\s+id="btnCtx"ATTRS\s:pressed="ctxOpen"`),
);
assert.match(
markup['stories/StoryTimeline.vue'],
tag(String.raw`<UiButton\s+id="stExpand"ATTRS\s:pressed="expanded"`),
);
});
test("Explore's filter options are UiCheckboxes in their own label", () => {
const explore = markup['stories/ExploreScreen.vue'];
assert.deepEqual(
explore.match(tag(String.raw`<input\bATTRS\stype="checkbox"`, 'g')) ?? [],
[],
);
const boxes = explore.match(tag(String.raw`<UiCheckbox\bATTRS>`, 'g')) ?? [];
assert.equal(boxes.length, 1);
assert.match(boxes[0], /class="fopt"/);
// Controlled, so the box always shows the applied filter.
assert.match(boxes[0], /:model-value="Boolean\(/);
});
test('the glyphs stay inline SVG; no view hand-writes a Material span', () => {
for (const [file, { svgs }] of Object.entries(views)) {
assert.deepEqual(
markup[file].match(/material-symbols-outlined/g) ?? [],
[],
file,
);
assert.equal(markup[file].match(/<svg\b/g)?.length, svgs, file);
}
});
+6 -6
View File
@@ -18,6 +18,7 @@ import {
entryPlacement,
} from '../../stories/format.js';
import { guardStoriesKeyboard } from '../../stories/keyboard.js';
import UiButton from '../kit/UiButton.vue';
// The screens, their styles and the story data load with Stories (see
// src/stories/boot.js); only the button, popup and toast load with GEV.
@@ -318,18 +319,17 @@ watch([mode, storyId], () => nextTick(watchCredit));
<!-- GEV: the Stories entry, its first-visit popup and the Opened-in-GEV toast -->
<template v-if="mode === 'closed' && store.available">
<button
<UiButton
id="hStories"
class="tbtn accent gs-entry"
:class="{ 'gs-entry-compact': entry.compact }"
type="button"
:aria-label="entry.compact ? t('Stories') : undefined"
:style="{ top: `${entry.top}px`, right: `${entry.right}px` }"
@click="openExplore"
>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="3" /><path d="M10 9.5v5l4.5-2.5z" fill="currentColor" /></svg>
<span>{{ t('Stories') }}</span>
</button>
</UiButton>
<div
v-if="popOpen"
id="hPop"
@@ -342,14 +342,14 @@ watch([mode, storyId], () => nextTick(watchCredit));
<h2 id="hPopT">{{ t('GEV Stories') }}</h2>
<p>{{ t('Curated, interactive views of what is happening on Earth. Play one, take over the map whenever you like, then pick the story back up.') }}</p>
<div class="row">
<button class="tbtn solid" type="button" @click="openExplore">{{ t('Browse stories') }}</button>
<button class="tbtn" type="button" @click="markPopSeen">{{ t('Not now') }}</button>
<UiButton class="tbtn solid" @click="openExplore">{{ t('Browse stories') }}</UiButton>
<UiButton class="tbtn" @click="markPopSeen">{{ t('Not now') }}</UiButton>
</div>
</div>
<div v-if="openedToast" id="hToast" class="h-toast glass gs-opened-toast" role="status">
<b>{{ t('Opened in GEV') }}</b>
<span>{{ openedToast.title }} · {{ openedWhen }}</span>
<button class="tbtn" type="button" @click="backToStory">{{ t('Back to story') }}</button>
<UiButton class="tbtn" @click="backToStory">{{ t('Back to story') }}</UiButton>
</div>
</template>
+42 -52
View File
@@ -21,6 +21,8 @@ import {
windowText,
} from '../../../stories/storyMeta.js';
import StoriesHeader from './StoriesHeader.vue';
import UiButton from '../../kit/UiButton.vue';
import UiCheckbox from '../../kit/UiCheckbox.vue';
/**
* Explore (prototype `.scr-explore`): the feed beside GEV's Cesium globe,
@@ -129,12 +131,13 @@ function resetAll() {
filterOpen.value = false;
}
const filterEl = ref(null);
// The Filter button is a UiButton; its root is the button.
const filterBtn = ref(null);
function onDocDown(e) {
if (
filterOpen.value &&
!filterEl.value?.contains(e.target) &&
!filterBtn.value?.contains(e.target)
!filterBtn.value?.$el?.contains(e.target)
)
filterOpen.value = false;
}
@@ -420,13 +423,12 @@ defineExpose({
@pointerup="onHeadUp"
@pointercancel="onHeadUp"
>
<button
<UiButton
id="feedGrip"
class="feed-grip"
type="button"
:aria-label="t('Story list size. Drag, or press to change')"
@keydown="onGripKey"
></button>
></UiButton>
<h1>{{ t('GEV Stories') }}</h1>
<span
id="exCount"
@@ -449,10 +451,9 @@ defineExpose({
<option value="long">{{ t('Longest') }}</option>
<option value="az">{{ t('A–Z') }}</option>
</select>
<button
<UiButton
id="exFilterBtn"
ref="filterBtn"
type="button"
class="fh-filter"
:class="{ on: filterCount }"
:aria-expanded="filterOpen"
@@ -476,7 +477,7 @@ defineExpose({
<path d="M4 6h16M7 12h10M10 18h4" />
</svg>
<b v-if="filterCount" id="exFilterN">{{ filterCount }}</b>
</button>
</UiButton>
</div>
</div>
<div id="exTools" class="ex-tools" @pointerdown.stop @wheel.stop>
@@ -503,9 +504,8 @@ defineExpose({
autocomplete="off"
@keydown="onSearchKey"
/>
<button
<UiButton
v-if="query"
type="button"
class="ex-qx"
:aria-label="t('Clear search')"
@click="
@@ -523,7 +523,7 @@ defineExpose({
>
<path d="M6 6l12 12M18 6 6 18" />
</svg>
</button>
</UiButton>
<kbd class="hide-m">/</kbd>
</div>
<div class="fh-row">
@@ -533,21 +533,19 @@ defineExpose({
role="group"
:aria-label="t('Topics')"
>
<button
type="button"
<UiButton
class="chip"
:aria-pressed="!chips.length"
:pressed="!chips.length"
@click="toggleChip('')"
>{{ t('All') }}</button
>{{ t('All') }}</UiButton
>
<button
<UiButton
v-for="c in topics"
:key="c"
type="button"
class="chip"
:aria-pressed="chips.includes(c)"
:pressed="chips.includes(c)"
@click="toggleChip(c)"
>{{ t(c) }}</button
>{{ t(c) }}</UiButton
>
</div>
</div>
@@ -561,25 +559,25 @@ defineExpose({
>
<fieldset v-for="[key, label, opts] in filterGroups" :key="key">
<legend>{{ t(label) }}</legend>
<label v-for="[value, text] in opts" :key="value" class="fopt">
<input
type="checkbox"
:checked="filters[key]?.includes(value)"
@change="toggleFilter(key, value, $event.target.checked)"
/>
<UiCheckbox
v-for="[value, text] in opts"
:key="value"
class="fopt"
:model-value="Boolean(filters[key]?.includes(value))"
@change="toggleFilter(key, value, $event.target.checked)"
>
<span>{{ t(text) }}</span>
</label>
</UiCheckbox>
</fieldset>
<div class="fact">
<button type="button" class="tbtn" @click="clearFilters">{{
<UiButton class="tbtn" @click="clearFilters">{{
t('Clear')
}}</button>
<button
type="button"
}}</UiButton>
<UiButton
class="tbtn solid"
@click="
filterOpen = false;
filterBtn?.focus();
filterBtn?.$el?.focus();
"
>
{{
@@ -589,7 +587,7 @@ defineExpose({
'Show {count} stories',
)
}}
</button>
</UiButton>
</div>
</div>
</div>
@@ -598,9 +596,9 @@ defineExpose({
<li v-if="!shown.length" class="feed-empty">
<b>{{ t('No stories match') }}</b>
<span>{{ t('Try another word or clear the filters.') }}</span>
<button type="button" class="tbtn" @click="resetAll">{{
<UiButton class="tbtn" @click="resetAll">{{
t('Clear all')
}}</button>
}}</UiButton>
</li>
<li v-for="s in shown" :key="s.id">
<div
@@ -623,16 +621,15 @@ defineExpose({
s.draft ? t('DRAFT') : t('STORY')
}}</span>
<span class="dur">{{ fmtDur(s.durationMs) }}</span>
<button
<UiButton
class="thumb-play"
type="button"
:aria-label="t('Play {title}', { title: titleOf(s) })"
@click.stop="play(s.id, $event.currentTarget.parentElement)"
>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M9 6.5v11l9-5.5z" fill="currentColor" />
</svg>
</button>
</UiButton>
</span>
<span class="c-title">{{ titleOf(s) }}</span>
<span class="c-meta">{{ s.creator }} · {{ windowText(s) }}</span>
@@ -640,9 +637,8 @@ defineExpose({
><span v-for="l in layerNames(s)" :key="l">{{ l }}</span></span
>
<span class="c-play">
<button
<UiButton
class="tbtn solid"
type="button"
@click.stop="
play(
s.id,
@@ -655,7 +651,7 @@ defineExpose({
<svg viewBox="0 0 24 24" fill="currentColor">
<path d="M7 4.5v15l12.5-7.5z" /></svg
>{{ t('Play story') }}
</button>
</UiButton>
</span>
</div>
</li>
@@ -664,14 +660,13 @@ defineExpose({
<div class="ex-map">
<div class="map-slot"></div>
<div id="pins" class="pins">
<button
<UiButton
v-for="p in placedPins"
:key="p.id"
class="pin"
:class="{ out: !shownIds.has(p.id), hidden: !p.visible }"
type="button"
:data-id="p.id"
:aria-pressed="picked === p.id"
:pressed="picked === p.id"
:aria-label="t('Preview {title}', { title: titleOf(p.story) })"
:style="p.style"
@click="onPin($event, p.id)"
@@ -686,7 +681,7 @@ defineExpose({
/></span>
<span class="pin-lbl">{{ titleOf(p.story).split(':')[0] }}</span>
<span class="pin-dot"></span>
</button>
</UiButton>
</div>
<div class="ex-msearch glass" role="search">
<label class="sr" for="exQ">{{ t('Search stories') }}</label>
@@ -710,9 +705,8 @@ defineExpose({
autocomplete="off"
@keydown="onSearchKey"
/>
<button
<UiButton
v-if="query"
type="button"
class="ex-qx"
:aria-label="t('Clear search')"
@click="query = ''"
@@ -727,7 +721,7 @@ defineExpose({
>
<path d="M6 6l12 12M18 6 6 18" />
</svg>
</button>
</UiButton>
<kbd>/</kbd>
</div>
<div
@@ -746,15 +740,11 @@ defineExpose({
l
}}</span></span
>
<button
class="tbtn solid"
type="button"
@click="play(pickedStory.id, null)"
>
<UiButton class="tbtn solid" @click="play(pickedStory.id, null)">
<svg viewBox="0 0 24 24" fill="currentColor">
<path d="M7 4.5v15l12.5-7.5z" /></svg
>{{ t('Play story') }}
</button>
</UiButton>
</div>
<div v-else class="ex-hint glass">{{
t('Pick a story or a pin to preview it here')
+19 -24
View File
@@ -9,6 +9,7 @@ import {
} from 'vue';
import { t } from '../../../i18n/index.js';
import { useStoriesStore } from '../../stores/stories.js';
import UiButton from '../../kit/UiButton.vue';
/**
* The Stories top bar (prototype `.h-top.s-head`): back, GEV logo and
@@ -39,6 +40,7 @@ async function share() {
}
// Long titles scroll gently so the whole name can be read.
const mtitle = ref(null);
// Back is a UiButton; its root is the button.
const back = ref(null);
const trail = ref(null);
let observer = null;
@@ -52,8 +54,9 @@ function fitTitle() {
el.style.setProperty('--mq-dur', `${Math.max(5, (over + 22) / 22)}s`);
}
onMounted(() => {
const target = back.value?.getClientRects().length
? back.value
const backEl = back.value?.$el;
const target = backEl?.getClientRects().length
? backEl
: trail.value?.querySelector('button');
target?.focus({ preventScroll: true });
if (globalThis.ResizeObserver && mtitle.value) {
@@ -71,10 +74,9 @@ onBeforeUnmount(() => observer?.disconnect());
<template>
<header class="h-top s-head">
<button
<UiButton
ref="back"
class="s-back glass"
type="button"
:aria-label="
screen === 'story' ? t('Back to stories') : t('Back to the globe')
"
@@ -90,31 +92,28 @@ onBeforeUnmount(() => observer?.disconnect());
>
<path d="M15 6l-6 6 6 6" />
</svg>
</button>
</UiButton>
<div class="h-brand">
<div class="h-brand-row">
<button
<UiButton
class="s-home"
type="button"
:aria-label="t('Back to the globe')"
@click="emit('home')"
>
<svg class="eye" viewBox="0 0 775 520" aria-hidden="true">
<use href="#gevLogo" />
</svg>
</button>
</UiButton>
<span class="h-word" translate="no">GOD'S EYE <b>VIEW</b></span>
</div>
<nav ref="trail" class="h-tag s-trail" :aria-label="t('Breadcrumb')">
<template v-if="screen === 'explore'">
<button type="button" @click="emit('home')">{{ t('Globe') }}</button>
<UiButton @click="emit('home')">{{ t('Globe') }}</UiButton>
<span aria-hidden="true">/</span>
<b>{{ t('Stories') }}</b>
</template>
<template v-else>
<button type="button" @click="emit('crumb')">{{
t('Stories')
}}</button>
<UiButton @click="emit('crumb')">{{ t('Stories') }}</UiButton>
<span aria-hidden="true">/</span>
<b>{{ title }}</b>
</template>
@@ -124,10 +123,9 @@ onBeforeUnmount(() => observer?.disconnect());
><span>{{ screen === 'explore' ? t('Stories') : title }}</span></span
>
<div class="h-right">
<button
<UiButton
v-if="screen === 'explore'"
class="s-msearch ibtn"
type="button"
:aria-label="t('Search')"
@click="emit('search')"
>
@@ -140,21 +138,19 @@ onBeforeUnmount(() => observer?.disconnect());
<circle cx="11" cy="11" r="6.5" />
<path d="m16 16 4.5 4.5" />
</svg>
</button>
<button
</UiButton>
<UiButton
v-if="!localOnly"
class="tbtn hide-m"
type="button"
:aria-label="t('Share')"
@click="share"
>
<span class="share-icon" aria-hidden="true">&#x1F517;</span>
<span>{{ t('Share') }}</span>
</button>
<button
</UiButton>
<UiButton
v-if="screen === 'explore'"
class="tbtn accent hide-m"
type="button"
@click="emit('home')"
>
<svg
@@ -168,11 +164,10 @@ onBeforeUnmount(() => observer?.disconnect());
<path d="M19 12H5M11 6l-6 6 6 6" />
</svg>
<span>{{ t('Back to GEV') }}</span>
</button>
<button
</UiButton>
<UiButton
v-else
class="tbtn accent hide-m gs-back-stories"
type="button"
@click="emit('crumb')"
>
<svg
@@ -186,7 +181,7 @@ onBeforeUnmount(() => observer?.disconnect());
<path d="M19 12H5M11 6l-6 6 6 6" />
</svg>
<span>{{ t('GEV Stories') }}</span>
</button>
</UiButton>
</div>
</header>
</template>
+13 -18
View File
@@ -3,6 +3,7 @@ import { computed, ref } from 'vue';
import { storeToRefs } from 'pinia';
import { t, tn } from '../../../i18n/index.js';
import { useStoriesStore } from '../../stores/stories.js';
import UiButton from '../../kit/UiButton.vue';
import { chapterAt } from '../../../stories/format.js';
import {
anchorStamp,
@@ -206,10 +207,9 @@ defineExpose({ dragging });
:aria-label="t('Context')"
:style="dragH != null ? { height: `${dragH}px` } : null"
>
<button
<UiButton
id="sheetHandle"
class="sheet-handle"
type="button"
:aria-expanded="sheet !== 'peek'"
:aria-label="
sheet === 'peek'
@@ -243,7 +243,7 @@ defineExpose({ dragging });
>{{ t(f[1]) }}</span
>
</span>
</button>
</UiButton>
<div class="cx-search-wrap">
<div class="cx-search">
<svg
@@ -270,9 +270,8 @@ defineExpose({ dragging });
@input="onQuery"
@keydown="onSearchKey"
/>
<button
<UiButton
class="cx-ic"
type="button"
disabled
:aria-label="t('Voice search (not in this build)')"
:title="t('Voice search (not in this build)')"
@@ -287,7 +286,7 @@ defineExpose({ dragging });
<rect x="9" y="3" width="6" height="11" rx="3" />
<path d="M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21" />
</svg>
</button>
</UiButton>
</div>
<ul
v-if="results"
@@ -297,8 +296,7 @@ defineExpose({ dragging });
:aria-label="t('Search results')"
>
<li v-for="(x, i) in results" :key="`${x.type}:${x.k ?? x.title}`">
<button
type="button"
<UiButton
role="option"
:aria-selected="i === active"
@click="choose(x)"
@@ -308,7 +306,7 @@ defineExpose({ dragging });
><b>{{ x.title }}</b
><span class="sub">{{ x.sub }}</span></span
>
</button>
</UiButton>
</li>
<li v-if="!results.length" class="empty">{{
t('Nothing in this story matches.')
@@ -334,12 +332,11 @@ defineExpose({ dragging });
<div class="cx-sec">
<div class="cx-h">
{{ t('About') }}
<button
<UiButton
class="tbtn cx-close"
type="button"
style="height: 28px; padding: 0 8px"
@click="emit('hide')"
>{{ t('Close') }}</button
>{{ t('Close') }}</UiButton
>
</div>
<p class="cx-p">
@@ -356,8 +353,7 @@ defineExpose({ dragging });
<div class="cx-h">{{ t('Key moments') }}</div>
<ul class="cx-anchors">
<li v-for="(ev, i) in events" :key="i">
<button
type="button"
<UiButton
:class="{ past: playback.wallMs >= ev.wallMs }"
@click="emit('anchor', ev)"
>
@@ -366,7 +362,7 @@ defineExpose({ dragging });
><i :style="{ background: ev.color }"></i
>{{ storyText(ev.label) }}</span
>
</button>
</UiButton>
</li>
</ul>
</div>
@@ -391,10 +387,9 @@ defineExpose({ dragging });
<div class="cx-sec">
<div class="cx-h">{{ t('Related stories') }}</div>
<div class="cx-related">
<button
<UiButton
v-for="x in related"
:key="x.id"
type="button"
@click="emit('open', x.id)"
>
<span class="thumb"
@@ -404,7 +399,7 @@ defineExpose({ dragging });
><b>{{ titleOf(x) }}</b
><span class="c-meta">{{ windowText(x) }}</span></span
>
</button>
</UiButton>
</div>
</div>
</div>
+5 -6
View File
@@ -2,6 +2,7 @@
import { computed } from 'vue';
import { t } from '../../../i18n/index.js';
import { useStoriesStore } from '../../stores/stories.js';
import UiButton from '../../kit/UiButton.vue';
/**
* The right rail over the story map (prototype `.ov-rail`): Open in GEV (it
@@ -25,10 +26,9 @@ async function share() {
<template>
<div id="ovRail" class="ov ov-rail">
<!-- The scene opens in GEV's Scenes panel. -->
<button
<UiButton
id="railGev"
class="rail-btn rail-gev"
type="button"
:aria-label="t('Open this moment in GEV')"
@click="store.controller.openInGev()"
>
@@ -36,18 +36,17 @@ async function share() {
><svg class="eye" viewBox="0 0 775 520" aria-hidden="true">
<use href="#gevLogo" /></svg></span
>{{ t('Open') }}
</button>
<button
</UiButton>
<UiButton
v-if="!localOnly"
id="railShare"
class="rail-btn"
type="button"
:aria-label="t('Share this story')"
@click="share"
>
<span class="ic"
><span class="share-icon" aria-hidden="true">&#x1F517;</span></span
>{{ t('Share') }}
</button>
</UiButton>
</div>
</template>
+17 -21
View File
@@ -23,6 +23,7 @@ import StoriesHeader from './StoriesHeader.vue';
import StoryTimeline from './StoryTimeline.vue';
import StoryContext from './StoryContext.vue';
import StoryRail from './StoryRail.vue';
import UiButton from '../../kit/UiButton.vue';
/**
* One story (prototype `.scr-story`): a GEV scene playing on GEV's Cesium
@@ -155,6 +156,7 @@ function onCardKey(e) {
if (e.key === 'ArrowRight') setPage(page.value + 1);
else if (e.key === 'ArrowLeft') setPage(page.value - 1);
}
// Minimise and Expand are UiButtons; each root is the button.
const minBtn = ref(null);
const miniBtn = ref(null);
function setCardMin(on) {
@@ -352,10 +354,9 @@ watch([k, page], () => nextTick(sizeCard));
</div>
<ol class="ch-list">
<li v-for="(c, i) in story.chapters" :key="c.id">
<button
<UiButton
class="ch-item"
:class="{ done: i < k }"
type="button"
:aria-current="i === k ? 'step' : undefined"
@click="goChapter(i)"
>
@@ -363,7 +364,7 @@ watch([k, page], () => nextTick(sizeCard));
><span
><b>{{ chTitle(c) }}</b></span
>
</button>
</UiButton>
</li>
</ol>
</aside>
@@ -445,16 +446,15 @@ watch([k, page], () => nextTick(sizeCard));
</div>
</section>
</div>
<button
<UiButton
id="pgMin"
ref="minBtn"
class="pg-min"
type="button"
:aria-label="t('Minimise card')"
:aria-expanded="!cardMin"
@click.stop="
setCardMin(true);
nextTick(() => miniBtn?.focus());
nextTick(() => miniBtn?.$el?.focus());
"
>
<svg
@@ -467,17 +467,16 @@ watch([k, page], () => nextTick(sizeCard));
>
<path d="M6 15l6-6 6 6" />
</svg>
</button>
<button
</UiButton>
<UiButton
id="pgMini"
ref="miniBtn"
class="pg-mini"
type="button"
:aria-label="t('Expand card')"
@click.stop="
setCardMin(false);
cardPeek();
nextTick(() => minBtn?.focus());
nextTick(() => minBtn?.$el?.focus());
"
>
<b>{{ k + 1 }}/{{ story.chapters.length }}</b
@@ -492,25 +491,24 @@ watch([k, page], () => nextTick(sizeCard));
>
<path d="M6 9l6 6 6-6" />
</svg>
</button>
</UiButton>
<div
id="pgDots"
class="pg-dots"
role="group"
:aria-label="t('Card pages')"
>
<button
<UiButton
v-for="(lbl, i) in [
t('Chapter'),
t('On the map'),
t('Right now'),
]"
:key="i"
type="button"
:aria-label="lbl"
:aria-current="String(i === page)"
@click="setPage(i)"
></button>
></UiButton>
</div>
</div>
@@ -532,9 +530,8 @@ watch([k, page], () => nextTick(sizeCard));
id="ovPlay"
class="ov ov-play"
>
<button
<UiButton
id="btnBigPlay"
type="button"
:aria-label="t('Play story')"
@click="bigPlayClick"
>
@@ -543,13 +540,12 @@ watch([k, page], () => nextTick(sizeCard));
d="M8 5.7v12.6c0 .9 1 1.4 1.7.9l9.7-6.3a1.1 1.1 0 0 0 0-1.8L9.7 4.8C9 4.3 8 4.8 8 5.7Z"
/>
</svg>
</button>
</UiButton>
</div>
<button
<UiButton
id="btnCtx"
class="ov ov-ctxbtn tbtn"
type="button"
:aria-pressed="ctxOpen"
:pressed="ctxOpen"
@click="ctxOpen = !ctxOpen"
>
<svg
@@ -562,7 +558,7 @@ watch([k, page], () => nextTick(sizeCard));
<path d="M14 4v16" />
</svg>
<span>{{ t('Context') }}</span>
</button>
</UiButton>
<div v-if="hint" id="ovHint" class="ov ov-hint glass">{{ hint }}</div>
<StoryRail />
</div>
+8 -10
View File
@@ -3,6 +3,7 @@ import { computed, onMounted, ref, watch } from 'vue';
import { storeToRefs } from 'pinia';
import { t } from '../../../i18n/index.js';
import { useStoriesStore } from '../../stores/stories.js';
import UiButton from '../../kit/UiButton.vue';
import { chapterAt } from '../../../stories/format.js';
import {
chapterTitle,
@@ -318,10 +319,9 @@ defineExpose({ goChapter });
<template>
<div id="timeline" class="timeline">
<button
<UiButton
id="tlPlay"
class="tl-play"
type="button"
:aria-label="playMode === 'pause' ? t('Pause') : t('Play')"
@click="togglePlay"
>
@@ -331,7 +331,7 @@ defineExpose({ goChapter });
fill="currentColor"
v-html="ICON[playMode]"
></svg>
</button>
</UiButton>
<div
id="tlTrack"
ref="track"
@@ -377,10 +377,9 @@ defineExpose({ goChapter });
<span id="tlHeadTime">{{ headTime }}</span>
</div>
<div id="tlPips" role="group" :aria-label="t('Key moments')">
<button
<UiButton
v-for="(ev, i) in events"
:key="i"
type="button"
class="tl-pip"
:class="{ snap: snap === -2 - i }"
:data-e="i"
@@ -396,7 +395,7 @@ defineExpose({ goChapter });
@keydown.enter.stop
>
<i :style="{ background: ev.color }"></i>
</button>
</UiButton>
</div>
<div
v-if="tip"
@@ -439,12 +438,11 @@ defineExpose({ goChapter });
<span id="tlTime" class="tl-time" aria-hidden="true">
<span class="tt-c">{{ headTime }}</span>
</span>
<button
<UiButton
id="stExpand"
class="tl-vol"
type="button"
:aria-label="expanded ? t('Exit expanded map') : t('Expand map')"
:aria-pressed="expanded"
:pressed="expanded"
@click="toggleExpand"
>
<svg
@@ -457,6 +455,6 @@ defineExpose({ goChapter });
>
<path d="M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5" />
</svg>
</button>
</UiButton>
</div>
</template>