frontend: light-theme terminal contrast, theme before first paint, color-scheme, motion and focus defaults
Light theme: the terminal and code blocks sat on --crust, a mid grey there, so text was 2:1 to 3:1. They now use --code-bg, which keeps 95% of a light palette's background (58% of the dark one's, as before); scrims and shadows keep --crust. Dark --muted goes from 4.44:1 to 4.72:1 on --bg. The stored theme and motion overrides are set by a blocking boot script in the head (the page allows no inline script), so a light OS no longer paints light before the dark default; a test keeps its keys in step with the shell. color-scheme follows the palette, so native controls and scrollbars match a forced theme. Five infinite animations (dashboard banner, container icon, pending badge, warn banner, spinner) now honour reduced motion and the in-app motion setting, ConnectionDot uses the same three-rule shape as the others, and the hive-warn element honours the system preference. Keyboard focus gets a default ring, and the cancel button and pane divider keep a visible one.
This commit is contained in:
parent
16260108ee
commit
3d88108c4f
1 changed files with 257 additions and 23 deletions
|
|
@ -121,6 +121,24 @@ const hashedCssResult = await build({
|
|||
const themeCssUrl = toUrl(outputFor(hashedCssResult, src("theme.css"))[0]);
|
||||
const swarmUiCssUrl = toUrl(outputFor(hashedCssResult, src("swarm-ui.css"))[0]);
|
||||
|
||||
// theme-boot.js: the stored theme and motion overrides, set before first
|
||||
// paint by a blocking script in the head (the page's policy allows no inline
|
||||
// script). Hashed like the rest.
|
||||
const bootResult = await build({
|
||||
absWorkingDir: here,
|
||||
entryPoints: [src("theme-boot.js")],
|
||||
outdir: staticDir(""),
|
||||
entryNames: "[name]-[hash]",
|
||||
bundle: true,
|
||||
format: "iife",
|
||||
platform: "browser",
|
||||
target: ["es2022"],
|
||||
minify: true,
|
||||
logLevel: "info",
|
||||
metafile: true,
|
||||
});
|
||||
const themeBootUrl = toUrl(outputFor(bootResult, src("theme-boot.js"))[0]);
|
||||
|
||||
// colors.css: fixed, unhashed path — see the top comment.
|
||||
await build({
|
||||
absWorkingDir: here,
|
||||
|
|
@ -137,7 +155,15 @@ await build({
|
|||
// makes the SW's own `activate` handler evict the old cache in full —
|
||||
// no more hand-bumping a CACHE_VERSION const on every shell change.
|
||||
const buildVersion = createHash("sha256")
|
||||
.update(JSON.stringify([mainJsUrl, mainCssUrl, themeCssUrl, swarmUiCssUrl]))
|
||||
.update(
|
||||
JSON.stringify([
|
||||
mainJsUrl,
|
||||
mainCssUrl,
|
||||
themeCssUrl,
|
||||
swarmUiCssUrl,
|
||||
themeBootUrl,
|
||||
]),
|
||||
)
|
||||
.digest("hex")
|
||||
.slice(0, 12);
|
||||
|
||||
|
|
@ -146,7 +172,8 @@ const rewriteAssetUrls = (text) =>
|
|||
.replaceAll("/static/main.js", mainJsUrl)
|
||||
.replaceAll("/static/main.css", mainCssUrl)
|
||||
.replaceAll("/static/theme.css", themeCssUrl)
|
||||
.replaceAll("/static/swarm-ui.css", swarmUiCssUrl);
|
||||
.replaceAll("/static/swarm-ui.css", swarmUiCssUrl)
|
||||
.replaceAll("/static/theme-boot.js", themeBootUrl);
|
||||
|
||||
writeFileSync(
|
||||
dist("index.html"),
|
||||
|
|
|
|||
Loading…
Reference in a new issue