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:
parent
0876ff4de8
commit
c205c6115b
54 changed files with 143 additions and 109 deletions
|
|
@ -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
|
||||
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
|
||||
|
||||
The Catppuccin colour names **don't** map 1:1 to the variable names.
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ body.screen-shell {
|
|||
background: var(--border);
|
||||
color: var(--subtext0);
|
||||
border: 1px solid var(--purple-dim);
|
||||
border-radius: 4px;
|
||||
border-radius: var(--radius-sm);
|
||||
cursor: pointer;
|
||||
}
|
||||
.tbtn.active {
|
||||
|
|
@ -78,7 +78,7 @@ body.screen-shell {
|
|||
font-size: 0.72rem;
|
||||
font-family: ui-monospace, monospace;
|
||||
padding: 0.4rem 0.6rem;
|
||||
z-index: 100;
|
||||
z-index: var(--z-popover);
|
||||
display: none; /* toggled by the debug button */
|
||||
}
|
||||
#debug-log .dbg-line {
|
||||
|
|
@ -131,7 +131,7 @@ body.screen-shell {
|
|||
transform: translateX(-50%);
|
||||
background: var(--border);
|
||||
color: var(--yellow);
|
||||
border-radius: 6px;
|
||||
border-radius: var(--radius-md);
|
||||
padding: 0.4rem 0.9rem;
|
||||
font-size: 0.8rem;
|
||||
opacity: 0;
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ body.dashboard-shell {
|
|||
.container-row {
|
||||
padding: 0.6em 0.8em;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 4px;
|
||||
border-radius: var(--radius-sm);
|
||||
background: color-mix(in srgb, var(--bg-elev) 55%, transparent);
|
||||
transition:
|
||||
opacity 200ms ease,
|
||||
|
|
@ -127,7 +127,7 @@ body.dashboard-shell {
|
|||
flex: none;
|
||||
width: 5em;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 6px;
|
||||
border-radius: var(--radius-md);
|
||||
background-color: color-mix(in srgb, var(--crust) 60%, transparent);
|
||||
cursor: pointer;
|
||||
transition:
|
||||
|
|
@ -513,7 +513,7 @@ footer .banner-thin {
|
|||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 40;
|
||||
z-index: var(--z-bar);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
background: transparent;
|
||||
color: inherit;
|
||||
border: 1px solid currentColor;
|
||||
border-radius: 0.3em;
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 0.1em 0.6em;
|
||||
font: inherit;
|
||||
font-size: 0.85em;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
backdrop-filter: var(--glass-filter);
|
||||
position: sticky;
|
||||
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,
|
||||
so the brand's accent and glow (on the span inside) are all that show. */
|
||||
|
|
@ -189,9 +189,9 @@
|
|||
position: absolute;
|
||||
left: 0.5em;
|
||||
top: -4em;
|
||||
z-index: 100;
|
||||
z-index: var(--z-skip);
|
||||
padding: 0.5em 1em;
|
||||
border-radius: 0.3em;
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--bg-elev);
|
||||
color: var(--fg);
|
||||
border: 1px solid var(--purple);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
cursor: pointer;
|
||||
min-height: 2.75em;
|
||||
padding-inline: 0.8em;
|
||||
border-radius: 999px;
|
||||
border-radius: var(--radius-pill);
|
||||
}
|
||||
.ui-badge-interactive:hover {
|
||||
background: var(--border);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
input sitting next to it. Colours are the shared base16-derived vars
|
||||
(../../theme.css). */
|
||||
.ui-button {
|
||||
border-radius: 0.3em;
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 0.5em 1.2em;
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
|
|
|
|||
|
|
@ -20,15 +20,15 @@
|
|||
position: absolute;
|
||||
top: calc(100% + 0.25em);
|
||||
left: 0;
|
||||
z-index: 20;
|
||||
z-index: var(--z-popover);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 12em;
|
||||
padding: 0.25em;
|
||||
background: var(--bg-elev);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 0.5em;
|
||||
box-shadow: 0 0.4em 1em rgba(0, 0, 0, 0.35);
|
||||
border-radius: var(--radius-md);
|
||||
box-shadow: var(--shadow-pop);
|
||||
}
|
||||
.ui-dropdown-item {
|
||||
display: flex;
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
min-height: 2.75em;
|
||||
padding: 0.4em 0.7em;
|
||||
border: none;
|
||||
border-radius: 0.35em;
|
||||
border-radius: var(--radius-sm);
|
||||
background: transparent;
|
||||
color: var(--fg);
|
||||
font: inherit;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
:host {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 1000;
|
||||
z-index: var(--z-modal);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@
|
|||
position: absolute;
|
||||
right: 0;
|
||||
top: calc(100% + 2px);
|
||||
z-index: 50;
|
||||
z-index: var(--z-popover);
|
||||
background: var(--bg-elev);
|
||||
border: 1px solid var(--purple-dim);
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
|
||||
border-radius: var(--radius-md);
|
||||
box-shadow: var(--shadow-pop);
|
||||
min-width: 10em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
line-height: 1;
|
||||
cursor: pointer;
|
||||
padding: 0.1em 0.4em;
|
||||
border-radius: 4px;
|
||||
border-radius: var(--radius-sm);
|
||||
opacity: var(--menu-btn-opacity, 0);
|
||||
transition:
|
||||
opacity 120ms,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
:host {
|
||||
display: block;
|
||||
border: 1px solid var(--amber);
|
||||
border-radius: 4px;
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 0.5em 0.8em;
|
||||
margin-bottom: 0.6em;
|
||||
color: var(--amber);
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@
|
|||
background: transparent;
|
||||
border: 1px solid var(--muted);
|
||||
color: var(--muted);
|
||||
border-radius: 999px;
|
||||
border-radius: var(--radius-pill);
|
||||
width: 1.4em;
|
||||
height: 1.4em;
|
||||
font-size: 0.8em;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
color: var(--amber);
|
||||
padding: 0.45em 0.8em;
|
||||
margin-bottom: 0.6em;
|
||||
border-radius: 4px;
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
.jqr-summary strong {
|
||||
color: var(--amber);
|
||||
|
|
|
|||
|
|
@ -10,15 +10,15 @@
|
|||
position: absolute;
|
||||
top: calc(100% + 0.4em);
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
z-index: var(--z-popover);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 10em;
|
||||
padding: 0.4em;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 0.5em;
|
||||
border-radius: var(--radius-md);
|
||||
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;
|
||||
}
|
||||
/* Mount-triggered, not a state transition — the popover only exists in
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
gap: 0.5em;
|
||||
min-height: 2.75em;
|
||||
padding: 0.4em 0.6em;
|
||||
border-radius: 0.35em;
|
||||
border-radius: var(--radius-sm);
|
||||
color: var(--fg);
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ export function themedToast(message, opts = {}) {
|
|||
position: "fixed",
|
||||
top: "1em",
|
||||
right: "1em",
|
||||
zIndex: "1100",
|
||||
zIndex: "var(--z-toast)",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: "0.5em",
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
.hive-pill-sm {
|
||||
display: inline-block;
|
||||
border: 1px solid;
|
||||
border-radius: 999px;
|
||||
border-radius: var(--radius-pill);
|
||||
}
|
||||
|
||||
.hive-pill {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
top: calc(100% + 0.25em);
|
||||
right: 0;
|
||||
left: auto;
|
||||
z-index: 20;
|
||||
z-index: var(--z-popover);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.15em;
|
||||
|
|
@ -23,8 +23,8 @@
|
|||
padding: 0.5em;
|
||||
background: var(--bg-elev);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 0.5em;
|
||||
box-shadow: 0 0.4em 1em rgba(0, 0, 0, 0.35);
|
||||
border-radius: var(--radius-md);
|
||||
box-shadow: var(--shadow-pop);
|
||||
}
|
||||
.settings-menu-row {
|
||||
display: flex;
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
min-height: 2.75em;
|
||||
padding: 0 0.4em;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 0.35em;
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--bg);
|
||||
color: var(--fg);
|
||||
font: inherit;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
backdrop-filter: var(--glass-filter);
|
||||
border: 1px solid var(--purple-dim);
|
||||
box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.7);
|
||||
border-radius: 4px;
|
||||
border-radius: var(--radius-sm);
|
||||
font-family:
|
||||
"JetBrains Mono", "Fira Code", "Cascadia Code", "Source Code Pro", monospace;
|
||||
font-size: 0.92em;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,22 @@
|
|||
--purple: var(--base0E); /* accent — active tabs, links, highlights */
|
||||
--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
|
||||
a swap. Each is pixel-identical to its prior literal under the
|
||||
default palette: --crust is a darkened bg; --muted / --subtext0 are
|
||||
|
|
|
|||
|
|
@ -24,15 +24,15 @@
|
|||
position: absolute;
|
||||
top: calc(100% + 0.4em);
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
z-index: var(--z-popover);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 12em;
|
||||
padding: 0.4em;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 0.5em;
|
||||
border-radius: var(--radius-md);
|
||||
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;
|
||||
}
|
||||
/* Mount-triggered, same shape as `LinksMenu.css`'s own version — see
|
||||
|
|
@ -74,7 +74,7 @@
|
|||
align-items: center;
|
||||
min-height: 2.75em;
|
||||
padding: 0.4em 0.6em;
|
||||
border-radius: 0.35em;
|
||||
border-radius: var(--radius-sm);
|
||||
color: var(--fg);
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue