mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-24 04:02:19 +00:00
Page state is kept in classes on the page root; the HUD rests while not displayed (#1911)
* Page state is kept in classes on the page root; the HUD rests while not displayed Rules that selected on `body:has(...)` now select on classes on <html> that the components owning that state hold, as `body:is(.flag *, <old condition>)`, which keeps each rule's specificity and so its place in the cascade. Chrome checks a `:has()` on body again after every node added or removed anywhere, and restyles the whole page when it does; a class changes only when its state does. The Intel HUD does no readout work and writes nothing while #intel-hud is not displayed, and shows current readouts as soon as it is displayed again. Its changing readouts update their text nodes in place. * The HUD runs no timers while not displayed; the loading screen is followed wherever it comes and goes While #intel-hud is not displayed the Intel HUD stops its timers and any reply typing out, drops a summary it was working out (asked again when it is back) and publishes only its own active, variant and colors, which stylesheets and layout elsewhere read. The vessel and language readouts wait too. Displayed again, it starts its timers and shows current readouts, and the whole reply, at once. A view that is unmounted leaves the HUD at rest until a mounted view reports it displayed. The loading-screen class now follows #loading-screen being added, removed, renamed or shown anywhere in body, as body:has() did, not only its class. * Changelog fragment for #1911 * The first-run launcher's page class follows the element, and is named launcher-shown A page that clears the first-run dialog by removing every element whose class contains first-run removed <html> itself once it carried has-first-run-launcher. The class is now launcher-shown, and it follows #first-run-launcher wherever it comes and goes, so a launcher removed by anything clears it, as body:has(#first-run-launcher) did.
This commit is contained in:
1 parent
ec2f7d8ca7
commit
1f105a68af
31 files changed
+1445
-102
No files matched your search
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, onUpdated, ref, watch } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { getLocale, t, tn } from '../../../i18n/index.js';
|
||||
import { EXCLUSIVE_SURFACE_CLASSES } from '../../../exclusiveSurfaces.js';
|
||||
@@ -18,6 +18,7 @@ import { useOmnibarStore } from '../../stores/omnibar.js';
|
||||
import { useVoiceStore } from '../../stores/voice.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiIcon from '../../kit/UiIcon.vue';
|
||||
import { vRootClass } from '../../rail/rootClass.js';
|
||||
|
||||
// One field for places, layers and questions. Places run through the location
|
||||
// controls, layers through the shell's omnibar actions, and anything else can
|
||||
@@ -1012,6 +1013,21 @@ function onMic(supersede = false) {
|
||||
|
||||
const shortcut = computed(() => (isMac ? '⌘K' : 'Ctrl K'));
|
||||
|
||||
// The dock's stylesheet selects on the field being on the page, on its
|
||||
// results and on focus inside it through classes on the page root
|
||||
// (src/ui/rail/rootClass.js). Removing a focused row sends no focusout, so
|
||||
// every render checks the focus again.
|
||||
const root = ref(null);
|
||||
const focusWithin = ref(false);
|
||||
function followFocus(event) {
|
||||
const el = root.value;
|
||||
if (!el) return;
|
||||
if (event?.type === 'focusin') focusWithin.value = true;
|
||||
else if (event?.type === 'focusout') focusWithin.value = el.contains(event.relatedTarget);
|
||||
else focusWithin.value = el.matches(':focus-within');
|
||||
}
|
||||
onUpdated(() => followFocus());
|
||||
|
||||
|
||||
// Chips come and go as the text changes; the arrow keys stay on one that is
|
||||
// there, and leave the strip when it empties.
|
||||
@@ -1027,7 +1043,7 @@ watch(
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section id="gev-omnibar" :class="{ 'has-results': showResults }" :aria-label="t('Search')">
|
||||
<section id="gev-omnibar" ref="root" :class="{ 'has-results': showResults }" v-root-class="{ 'has-omnibar': true, 'omnibar-has-results': showResults, 'omnibar-focus-within': focusWithin }" :aria-label="t('Search')" @focusin="followFocus" @focusout="followFocus">
|
||||
<div class="omnibar-field">
|
||||
<span class="omnibar-edge" aria-hidden="true"></span>
|
||||
<UiIcon class="omnibar-search-icon" name="search" :size="null" />
|
||||
@@ -1351,13 +1367,14 @@ small {
|
||||
width: auto;
|
||||
transform: none;
|
||||
}
|
||||
/* The language picker sits at the right edge beside the field; the field leaves it room. */
|
||||
:global(body.mobile-shell:has(#locale-picker) #gev-omnibar) {
|
||||
/* The language picker sits at the right edge beside the field; the field leaves it room.
|
||||
`.has-locale-picker`, `.has-world-timeline` and `.has-omnibar` are page-root classes (src/ui/rail/rootClass.js). */
|
||||
:global(body.mobile-shell:is(.has-locale-picker *, #locale-picker) #gev-omnibar) {
|
||||
inset-inline: 16px 60px;
|
||||
}
|
||||
/* A lifted timeline leaves less map above the credits on short phones. */
|
||||
@media (max-height: 480px) {
|
||||
:global(body.mobile-shell:has(#world-timeline) #gev-omnibar) {
|
||||
:global(body.mobile-shell:is(.has-world-timeline *, #world-timeline) #gev-omnibar) {
|
||||
--omnibar-top: calc(var(--mobile-top-inset, 0px) + 48px);
|
||||
--omnibar-field-room: 34px;
|
||||
--omnibar-field-height: 34px;
|
||||
@@ -1368,7 +1385,7 @@ small {
|
||||
--omnibar-item-padding: 2px;
|
||||
}
|
||||
/* The field takes the HUD readout's row (48-82px): the readout sits under it. */
|
||||
:global(body.mobile-shell:has(#world-timeline):has(#gev-omnibar) #intel-hud .hud-bottom-left) {
|
||||
:global(body.mobile-shell:is(.has-world-timeline *, #world-timeline):is(.has-omnibar *, #gev-omnibar) #intel-hud .hud-bottom-left) {
|
||||
top: calc(var(--mobile-top-inset, 0px) + 88px);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user