diff --git a/changelog.d/1852-kit-sweep-stories.md b/changelog.d/1852-kit-sweep-stories.md new file mode 100644 index 0000000000..ea55506827 --- /dev/null +++ b/changelog.d/1852-kit-sweep-stories.md @@ -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). diff --git a/docs/VUE-MIGRATION.md b/docs/VUE-MIGRATION.md index 0c073a082d..cd8c9078c9 100644 --- a/docs/VUE-MIGRATION.md +++ b/docs/VUE-MIGRATION.md @@ -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 `` 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 diff --git a/scripts/format-scope.json b/scripts/format-scope.json index c59828ba6e..e86ae6c4ea 100644 --- a/scripts/format-scope.json +++ b/scripts/format-scope.json @@ -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", diff --git a/scripts/package-boundaries.json b/scripts/package-boundaries.json index ad73b786c3..31245c7cf2 100644 --- a/scripts/package-boundaries.json +++ b/scripts/package-boundaries.json @@ -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", diff --git a/src/ui/kit/checkboxes.test.mjs b/src/ui/kit/checkboxes.test.mjs index 5ee5508551..8494fd9805 100644 --- a/src/ui/kit/checkboxes.test.mjs +++ b/src/ui/kit/checkboxes.test.mjs @@ -1,5 +1,5 @@ // Every checkbox in a Vue view is a UiCheckbox: no SFC template hand-writes -// ``. Story Explore's filters are not converted yet. +// ``. 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) { diff --git a/src/ui/kit/storiesControls.test.mjs b/src/ui/kit/storiesControls.test.mjs new file mode 100644 index 0000000000..4524e5ee80 --- /dev/null +++ b/src/ui/kit/storiesControls.test.mjs @@ -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 + >

{{ t('GEV Stories') }}

{{ t('Longest') }} - +
@@ -503,9 +504,8 @@ defineExpose({ autocomplete="off" @keydown="onSearchKey" /> - + /
@@ -533,21 +533,19 @@ defineExpose({ role="group" :aria-label="t('Topics')" > - {{ t('All') }} - {{ t(c) }}
@@ -561,25 +559,25 @@ defineExpose({ >
{{ t(label) }} - +
- - +
@@ -598,9 +596,9 @@ defineExpose({
  • {{ t('No stories match') }} {{ t('Try another word or clear the filters.') }} - + }}
  • {{ fmtDur(s.durationMs) }} - + {{ titleOf(s) }} {{ s.creator }} · {{ windowText(s) }} @@ -640,9 +637,8 @@ defineExpose({ >{{ l }} - +
  • @@ -664,14 +660,13 @@ defineExpose({
    - +
    - +
    {{ t('Pick a story or a pin to preview it here') diff --git a/src/ui/views/stories/StoriesHeader.vue b/src/ui/views/stories/StoriesHeader.vue index 412f8454d6..f4715c5825 100644 --- a/src/ui/views/stories/StoriesHeader.vue +++ b/src/ui/views/stories/StoriesHeader.vue @@ -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()); diff --git a/src/ui/views/stories/StoryContext.vue b/src/ui/views/stories/StoryContext.vue index 256d883a7d..adb53a2a17 100644 --- a/src/ui/views/stories/StoryContext.vue +++ b/src/ui/views/stories/StoryContext.vue @@ -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" > - +
    • - +
    • {{ t('Nothing in this story matches.') @@ -334,12 +332,11 @@ defineExpose({ dragging });
      {{ t('About') }} - {{ t('Close') }}

      @@ -356,8 +353,7 @@ defineExpose({ dragging });

      {{ t('Key moments') }}
      • - +
      @@ -391,10 +387,9 @@ defineExpose({ dragging });
      {{ t('Related stories') }}
    diff --git a/src/ui/views/stories/StoryRail.vue b/src/ui/views/stories/StoryRail.vue index 5687a61c94..6cf5360918 100644 --- a/src/ui/views/stories/StoryRail.vue +++ b/src/ui/views/stories/StoryRail.vue @@ -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() { diff --git a/src/ui/views/stories/StoryScreen.vue b/src/ui/views/stories/StoryScreen.vue index ad32f837fe..c5b94bdeca 100644 --- a/src/ui/views/stories/StoryScreen.vue +++ b/src/ui/views/stories/StoryScreen.vue @@ -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));
    1. - +
    @@ -445,16 +446,15 @@ watch([k, page], () => nextTick(sizeCard)); - - +
    - + >
    @@ -532,9 +530,8 @@ watch([k, page], () => nextTick(sizeCard)); id="ovPlay" class="ov ov-play" > - + - +
    {{ hint }}
    diff --git a/src/ui/views/stories/StoryTimeline.vue b/src/ui/views/stories/StoryTimeline.vue index 070a6af83f..6a2ca5915e 100644 --- a/src/ui/views/stories/StoryTimeline.vue +++ b/src/ui/views/stories/StoryTimeline.vue @@ -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 });