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:
Sameh Khamis authored and GitHub committed 2026-11-23 08:06:48 -08:00
1 parent ec2f7d8ca7
commit 1f105a68af
31 files changed
+1445 -102

No files matched your search

+28 -1
View File
@@ -629,7 +629,12 @@ slot whenever its view is drawn.
store, which IntelHUD publishes to through its `publish` option: the
readouts, the typing summary, the REC blink, visibility, layout variant
and style colors; the vessel layer presents the selected vessel's
readout through `src/hudReadouts.js` instead of writing into the HUD),
readout through `src/hudReadouts.js` instead of writing into the HUD;
the view reports through the store whether `#intel-hud` is displayed
(not displayed once it is unmounted), and while it is not IntelHUD runs
no timers and publishes only the root's `active`, variant and colors,
then shows current readouts as soon as it is; the readouts that change many times a
second keep their text node through `v-text-data`),
the first-run mission launcher (the welcome view renders the card's
visibility, busy state, status line, copy and scroll fade from the
`gev-first-run` store that `initFirstRunExperience` publishes to, and its
@@ -700,6 +705,28 @@ slot whenever its view is drawn.
hosts to register panels and rail items is deferred until a host needs
one.
## Page-root state classes
A stylesheet that styles one surface by the state of another, in a different
view (the dock and credits while the Omnibar is on the page, the Stories
entry while the loading screen shows), selects a class on `<html>` rather
than `body:has(...)`. Chrome checks a `:has()` on body again after every node
added or removed anywhere on the page and restyles the whole page when it
does; a class changes only with the state it names. `src/ui/rail/rootClass.js`
holds them: `v-root-class` on the element whose presence or state it names
(the Omnibar, the voice control in the dock, `#intel-hud`, the first-run
launcher, the World Timeline, the language picker), its hooks running inside
Vue's patch so the class changes with the element; `followSelectorRootClass()`
for markup Vue does not render (the loading screen, followed by the Stories
view wherever in body it is added, removed or shown, as `:has()` would); and
`followRootClass()` for nodes that move at run time (the left panel stack's
own panels, followed by the layer panels view). They live on `<html>`, not
`<body>`, whose class changes several owners follow to lay the page out
again. A rule selects one as `body:is(.has-omnibar *, #gev-omnibar)`: the
second argument never matches body and keeps the specificity the
`:has(#gev-omnibar)` it replaced had. `src/ui/pageRootClasses.test.mjs`
holds each class to its state and every stylesheet to the pattern.
## Verification
- Unit tests: stores and components run under `npm test`. Single-file