Watch
0
0
Fork
You've already forked hyperhive
0

frontend: one scale for z-index, corner radius and the floating-box shadow

z-index ran through eleven values (1 to 1100), border-radius through about
twenty and floating boxes had six different shadows, with no names, so each new
box picked its own. theme.css now defines --z-bar, --z-popover, --z-skip,
--z-modal, --z-toast, --radius-sm, --radius-md, --radius-pill and --shadow-pop,
and every stylesheet and the toast host use them. Corners and shadows move by
a pixel or two at most; the stacking order is unchanged. css-vars.md lists them.
This commit is contained in:
iris 2026-11-25 21:29:08 +01:00
commit c205c6115b
54 changed files with 143 additions and 109 deletions

View file

@ -99,6 +99,24 @@ The light palette sets `--palette-glass-clear` and `--palette-glass-filter` in `
and the dark palette resets them; the solid-backgrounds setting sets the two derived and the dark palette resets them; the solid-backgrounds setting sets the two derived
variables itself. A new glass surface uses the two variables and needs no theme rules of its own. variables itself. A new glass surface uses the two variables and needs no theme rules of its own.
## Layering, corners and shadow
`theme.css` also holds the scale for the three things every page repeats, so a
stylesheet names a role and never a number:
| Variable | Value | Use |
| --------------------------------------------- | ------------------------ | ---------------------------------------------- |
| `--z-bar` | 10 | sticky bars: the header, the selection bars |
| `--z-popover` | 20 | every floating box: menus, dropdowns, popovers |
| `--z-skip` | 100 | the skip link |
| `--z-modal` | 1000 | dialogs |
| `--z-toast` | 1100 | toasts, above dialogs |
| `--radius-sm`, `--radius-md`, `--radius-pill` | 0.35em, 0.5em, 999px | chips and inputs, boxes and cards, pills |
| `--shadow-pop` | `0 0.3em 1em`, 40% black | the shadow of every floating box |
Stacking inside one component (1 or 2) stays a plain number. A new floating box
uses `--z-popover` and `--shadow-pop`.
## Common mistakes ## Common mistakes
The Catppuccin colour names **don't** map 1:1 to the variable names. The Catppuccin colour names **don't** map 1:1 to the variable names.

View file

@ -40,7 +40,7 @@ body.screen-shell {
background: var(--border); background: var(--border);
color: var(--subtext0); color: var(--subtext0);
border: 1px solid var(--purple-dim); border: 1px solid var(--purple-dim);
border-radius: 4px; border-radius: var(--radius-sm);
cursor: pointer; cursor: pointer;
} }
.tbtn.active { .tbtn.active {
@ -78,7 +78,7 @@ body.screen-shell {
font-size: 0.72rem; font-size: 0.72rem;
font-family: ui-monospace, monospace; font-family: ui-monospace, monospace;
padding: 0.4rem 0.6rem; padding: 0.4rem 0.6rem;
z-index: 100; z-index: var(--z-popover);
display: none; /* toggled by the debug button */ display: none; /* toggled by the debug button */
} }
#debug-log .dbg-line { #debug-log .dbg-line {
@ -131,7 +131,7 @@ body.screen-shell {
transform: translateX(-50%); transform: translateX(-50%);
background: var(--border); background: var(--border);
color: var(--yellow); color: var(--yellow);
border-radius: 6px; border-radius: var(--radius-md);
padding: 0.4rem 0.9rem; padding: 0.4rem 0.9rem;
font-size: 0.8rem; font-size: 0.8rem;
opacity: 0; opacity: 0;

View file

@ -110,7 +110,7 @@ body.dashboard-shell {
.container-row { .container-row {
padding: 0.6em 0.8em; padding: 0.6em 0.8em;
border: 1px solid var(--border); border: 1px solid var(--border);
border-radius: 4px; border-radius: var(--radius-sm);
background: color-mix(in srgb, var(--bg-elev) 55%, transparent); background: color-mix(in srgb, var(--bg-elev) 55%, transparent);
transition: transition:
opacity 200ms ease, opacity 200ms ease,
@ -127,7 +127,7 @@ body.dashboard-shell {
flex: none; flex: none;
width: 5em; width: 5em;
aspect-ratio: 1; aspect-ratio: 1;
border-radius: 6px; border-radius: var(--radius-md);
background-color: color-mix(in srgb, var(--crust) 60%, transparent); background-color: color-mix(in srgb, var(--crust) 60%, transparent);
cursor: pointer; cursor: pointer;
transition: transition:
@ -513,7 +513,7 @@ footer .banner-thin {
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
z-index: 40; z-index: var(--z-bar);
display: flex; display: flex;
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;

View file

@ -22,7 +22,7 @@
background: transparent; background: transparent;
color: inherit; color: inherit;
border: 1px solid currentColor; border: 1px solid currentColor;
border-radius: 0.3em; border-radius: var(--radius-sm);
padding: 0.1em 0.6em; padding: 0.1em 0.6em;
font: inherit; font: inherit;
font-size: 0.85em; font-size: 0.85em;

View file

@ -38,7 +38,7 @@
backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 10; z-index: var(--z-bar);
} }
/* The swarm name links to the start page; the link adds no look of its own, /* The swarm name links to the start page; the link adds no look of its own,
so the brand's accent and glow (on the span inside) are all that show. */ so the brand's accent and glow (on the span inside) are all that show. */
@ -189,9 +189,9 @@
position: absolute; position: absolute;
left: 0.5em; left: 0.5em;
top: -4em; top: -4em;
z-index: 100; z-index: var(--z-skip);
padding: 0.5em 1em; padding: 0.5em 1em;
border-radius: 0.3em; border-radius: var(--radius-sm);
background: var(--bg-elev); background: var(--bg-elev);
color: var(--fg); color: var(--fg);
border: 1px solid var(--purple); border: 1px solid var(--purple);

View file

@ -44,7 +44,7 @@
cursor: pointer; cursor: pointer;
min-height: 2.75em; min-height: 2.75em;
padding-inline: 0.8em; padding-inline: 0.8em;
border-radius: 999px; border-radius: var(--radius-pill);
} }
.ui-badge-interactive:hover { .ui-badge-interactive:hover {
background: var(--border); background: var(--border);

View file

@ -4,7 +4,7 @@
input sitting next to it. Colours are the shared base16-derived vars input sitting next to it. Colours are the shared base16-derived vars
(../../theme.css). */ (../../theme.css). */
.ui-button { .ui-button {
border-radius: 0.3em; border-radius: var(--radius-sm);
padding: 0.5em 1.2em; padding: 0.5em 1.2em;
font: inherit; font: inherit;
cursor: pointer; cursor: pointer;

View file

@ -20,15 +20,15 @@
position: absolute; position: absolute;
top: calc(100% + 0.25em); top: calc(100% + 0.25em);
left: 0; left: 0;
z-index: 20; z-index: var(--z-popover);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
min-width: 12em; min-width: 12em;
padding: 0.25em; padding: 0.25em;
background: var(--bg-elev); background: var(--bg-elev);
border: 1px solid var(--border); border: 1px solid var(--border);
border-radius: 0.5em; border-radius: var(--radius-md);
box-shadow: 0 0.4em 1em rgba(0, 0, 0, 0.35); box-shadow: var(--shadow-pop);
} }
.ui-dropdown-item { .ui-dropdown-item {
display: flex; display: flex;
@ -38,7 +38,7 @@
min-height: 2.75em; min-height: 2.75em;
padding: 0.4em 0.7em; padding: 0.4em 0.7em;
border: none; border: none;
border-radius: 0.35em; border-radius: var(--radius-sm);
background: transparent; background: transparent;
color: var(--fg); color: var(--fg);
font: inherit; font: inherit;

View file

@ -10,7 +10,7 @@
:host { :host {
position: fixed; position: fixed;
inset: 0; inset: 0;
z-index: 1000; z-index: var(--z-modal);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;

View file

@ -23,11 +23,11 @@
position: absolute; position: absolute;
right: 0; right: 0;
top: calc(100% + 2px); top: calc(100% + 2px);
z-index: 50; z-index: var(--z-popover);
background: var(--bg-elev); background: var(--bg-elev);
border: 1px solid var(--purple-dim); border: 1px solid var(--purple-dim);
border-radius: 6px; border-radius: var(--radius-md);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4); box-shadow: var(--shadow-pop);
min-width: 10em; min-width: 10em;
white-space: nowrap; white-space: nowrap;
} }
@ -43,7 +43,7 @@
line-height: 1; line-height: 1;
cursor: pointer; cursor: pointer;
padding: 0.1em 0.4em; padding: 0.1em 0.4em;
border-radius: 4px; border-radius: var(--radius-sm);
opacity: var(--menu-btn-opacity, 0); opacity: var(--menu-btn-opacity, 0);
transition: transition:
opacity 120ms, opacity 120ms,

View file

@ -19,7 +19,7 @@
:host { :host {
display: block; display: block;
border: 1px solid var(--amber); border: 1px solid var(--amber);
border-radius: 4px; border-radius: var(--radius-sm);
padding: 0.5em 0.8em; padding: 0.5em 0.8em;
margin-bottom: 0.6em; margin-bottom: 0.6em;
color: var(--amber); color: var(--amber);

View file

@ -156,7 +156,7 @@
background: transparent; background: transparent;
border: 1px solid var(--muted); border: 1px solid var(--muted);
color: var(--muted); color: var(--muted);
border-radius: 999px; border-radius: var(--radius-pill);
width: 1.4em; width: 1.4em;
height: 1.4em; height: 1.4em;
font-size: 0.8em; font-size: 0.8em;

View file

@ -12,7 +12,7 @@
color: var(--amber); color: var(--amber);
padding: 0.45em 0.8em; padding: 0.45em 0.8em;
margin-bottom: 0.6em; margin-bottom: 0.6em;
border-radius: 4px; border-radius: var(--radius-sm);
} }
.jqr-summary strong { .jqr-summary strong {
color: var(--amber); color: var(--amber);

View file

@ -10,15 +10,15 @@
position: absolute; position: absolute;
top: calc(100% + 0.4em); top: calc(100% + 0.4em);
right: 0; right: 0;
z-index: 10; z-index: var(--z-popover);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
min-width: 10em; min-width: 10em;
padding: 0.4em; padding: 0.4em;
border: 1px solid var(--border); border: 1px solid var(--border);
border-radius: 0.5em; border-radius: var(--radius-md);
background: var(--bg-elev); background: var(--bg-elev);
box-shadow: 0 0.25em 0.75em rgba(0, 0, 0, 0.3); box-shadow: var(--shadow-pop);
animation: links-menu-popover-enter 140ms ease; animation: links-menu-popover-enter 140ms ease;
} }
/* Mount-triggered, not a state transition — the popover only exists in /* Mount-triggered, not a state transition — the popover only exists in
@ -53,7 +53,7 @@
gap: 0.5em; gap: 0.5em;
min-height: 2.75em; min-height: 2.75em;
padding: 0.4em 0.6em; padding: 0.4em 0.6em;
border-radius: 0.35em; border-radius: var(--radius-sm);
color: var(--fg); color: var(--fg);
text-decoration: none; text-decoration: none;
white-space: nowrap; white-space: nowrap;

View file

@ -124,7 +124,7 @@ export function themedToast(message, opts = {}) {
position: "fixed", position: "fixed",
top: "1em", top: "1em",
right: "1em", right: "1em",
zIndex: "1100", zIndex: "var(--z-toast)",
display: "flex", display: "flex",
flexDirection: "column", flexDirection: "column",
gap: "0.5em", gap: "0.5em",

View file

@ -24,7 +24,7 @@
.hive-pill-sm { .hive-pill-sm {
display: inline-block; display: inline-block;
border: 1px solid; border: 1px solid;
border-radius: 999px; border-radius: var(--radius-pill);
} }
.hive-pill { .hive-pill {

View file

@ -15,7 +15,7 @@
top: calc(100% + 0.25em); top: calc(100% + 0.25em);
right: 0; right: 0;
left: auto; left: auto;
z-index: 20; z-index: var(--z-popover);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 0.15em; gap: 0.15em;
@ -23,8 +23,8 @@
padding: 0.5em; padding: 0.5em;
background: var(--bg-elev); background: var(--bg-elev);
border: 1px solid var(--border); border: 1px solid var(--border);
border-radius: 0.5em; border-radius: var(--radius-md);
box-shadow: 0 0.4em 1em rgba(0, 0, 0, 0.35); box-shadow: var(--shadow-pop);
} }
.settings-menu-row { .settings-menu-row {
display: flex; display: flex;
@ -39,7 +39,7 @@
min-height: 2.75em; min-height: 2.75em;
padding: 0 0.4em; padding: 0 0.4em;
border: 1px solid var(--border); border: 1px solid var(--border);
border-radius: 0.35em; border-radius: var(--radius-sm);
background: var(--bg); background: var(--bg);
color: var(--fg); color: var(--fg);
font: inherit; font: inherit;

View file

@ -27,7 +27,7 @@
backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
border: 1px solid var(--purple-dim); border: 1px solid var(--purple-dim);
box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.7); box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.7);
border-radius: 4px; border-radius: var(--radius-sm);
font-family: font-family:
"JetBrains Mono", "Fira Code", "Cascadia Code", "Source Code Pro", monospace; "JetBrains Mono", "Fira Code", "Cascadia Code", "Source Code Pro", monospace;
font-size: 0.92em; font-size: 0.92em;

View file

@ -25,6 +25,22 @@
--purple: var(--base0E); /* accent — active tabs, links, highlights */ --purple: var(--base0E); /* accent — active tabs, links, highlights */
--pink: var(--base0F); /* thinking events */ --pink: var(--base0F); /* thinking events */
/* Layering: one scale for every page. Local stacking inside a component
(1, 2) stays a plain number. */
--z-bar: 10; /* sticky bars: the header, selection bars */
--z-popover: 20; /* every floating box: menus, dropdowns, popovers, filters */
--z-skip: 100; /* the skip link, above everything but dialogs */
--z-modal: 1000; /* dialogs */
--z-toast: 1100; /* toasts, above dialogs */
/* Corners: small (chips, inputs), medium (boxes, cards), pill. */
--radius-sm: 0.35em;
--radius-md: 0.5em;
--radius-pill: 999px;
/* The shadow of every floating box. */
--shadow-pop: 0 0.3em 1em rgba(0, 0, 0, 0.4);
/* Off-base16 (no exact slot) — derived from base16 so they still track /* Off-base16 (no exact slot) — derived from base16 so they still track
a swap. Each is pixel-identical to its prior literal under the a swap. Each is pixel-identical to its prior literal under the
default palette: --crust is a darkened bg; --muted / --subtext0 are default palette: --crust is a darkened bg; --muted / --subtext0 are

View file

@ -24,15 +24,15 @@
position: absolute; position: absolute;
top: calc(100% + 0.4em); top: calc(100% + 0.4em);
right: 0; right: 0;
z-index: 10; z-index: var(--z-popover);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
min-width: 12em; min-width: 12em;
padding: 0.4em; padding: 0.4em;
border: 1px solid var(--border); border: 1px solid var(--border);
border-radius: 0.5em; border-radius: var(--radius-md);
background: var(--bg-elev); background: var(--bg-elev);
box-shadow: 0 0.25em 0.75em rgba(0, 0, 0, 0.3); box-shadow: var(--shadow-pop);
animation: user-menu-popover-enter 140ms ease; animation: user-menu-popover-enter 140ms ease;
} }
/* Mount-triggered, same shape as `LinksMenu.css`'s own version — see /* Mount-triggered, same shape as `LinksMenu.css`'s own version — see
@ -74,7 +74,7 @@
align-items: center; align-items: center;
min-height: 2.75em; min-height: 2.75em;
padding: 0.4em 0.6em; padding: 0.4em 0.6em;
border-radius: 0.35em; border-radius: var(--radius-sm);
color: var(--fg); color: var(--fg);
text-decoration: none; text-decoration: none;
white-space: nowrap; white-space: nowrap;

Some files were not shown because too many files have changed in this diff Show more