frontend: remove the stylix overlay and add hyperhive and Catppuccin light and dark themes
This commit is contained in:
parent
989d1d578c
commit
91e2d26133
3 changed files with 486 additions and 413 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/* Standalone base16 palette — re-exports the shared base16 slots so
|
||||
esbuild emits its own `dist/static/colors.css`, linked first by every
|
||||
swarm-ui page (before theme.css). This is the theme swap contract: a
|
||||
stylix-generated variant replaces only this file. See
|
||||
swarm-ui page (before theme.css). This is the theme contract: the
|
||||
themes' palettes live in this one file. See
|
||||
@hive/shared/colors.css + docs/4-implementation/web-ui/css-vars.md. */
|
||||
@import "@hive/shared/colors.css";
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
// Network-first for the shell, not cache-first: most assets below are
|
||||
// content-hashed (a fresh URL per deploy, so a normal visit always gets
|
||||
// the current bundle regardless of this SW), but `colors.css` stays
|
||||
// deliberately unhashed for the host-side stylix theme swap, so this
|
||||
// unhashed (the swagger page links it by its fixed name), so this
|
||||
// SW's own cached copy of it can only ever refresh via a real network
|
||||
// round-trip. This SW only ever serves its cache on a FAILED fetch
|
||||
// (offline/flaky network), never in preference to a live response.
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@
|
|||
// `useApplyMotionOverride`), but that is after the page has painted, so a light
|
||||
// OS showed a light flash before the dark default took over. This runs from a
|
||||
// blocking script in the head, as the page's policy allows no inline script. The
|
||||
// keys and the fallbacks ("dark" for the theme, "system" for motion) are those of
|
||||
// `shell/Shell.tsx`; `test/theme-boot.test.mjs` keeps them in step.
|
||||
// keys and the fallbacks (hyperhive dark for the theme, "system" for motion) are
|
||||
// those of `shell/Shell.tsx`, and the theme ids and the values from before
|
||||
// themes existed are those of `@hive/shared`'s `settings/themes.ts`;
|
||||
// `test/theme-boot.test.mjs` keeps them in step.
|
||||
(function () {
|
||||
function read(key, fallback) {
|
||||
try {
|
||||
|
|
@ -15,8 +17,17 @@
|
|||
}
|
||||
}
|
||||
var root = document.documentElement;
|
||||
var theme = read("swarm-ui:theme-override", "dark");
|
||||
if (theme === "light" || theme === "dark") root.dataset.theme = theme;
|
||||
var themes = [
|
||||
"hyperhive-light",
|
||||
"hyperhive-dark",
|
||||
"catppuccin-latte-mauve",
|
||||
"catppuccin-mocha-mauve",
|
||||
"catppuccin-mocha-mara",
|
||||
];
|
||||
var theme = read("swarm-ui:theme-override", "hyperhive-dark");
|
||||
if (theme === "light") theme = "hyperhive-light";
|
||||
if (theme === "dark") theme = "hyperhive-dark";
|
||||
if (themes.indexOf(theme) >= 0) root.dataset.theme = theme;
|
||||
var motion = read("swarm-ui:motion-override", "system");
|
||||
if (motion === "reduce" || motion === "allow") root.dataset.motion = motion;
|
||||
})();
|
||||
|
|
|
|||
Loading…
Reference in a new issue