Show the whole nav tree without :has(), raise text contrast to 4.5:1, drop unused auth rules #182
@@ -6,6 +6,25 @@ at boot. Entries start at 0.3.0.
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### The whole nav tree shows on engines without `:has()`
|
||||||
|
|
||||||
|
On Chromium below 105 (webOS TV 22 and 23) every nested nav entry was hidden with nothing to open
|
||||||
|
it. Now the tree folds only where `:has()` works and stays fully open elsewhere. The theme switch,
|
||||||
|
which also needs `:has()`, is hidden there.
|
||||||
|
|
||||||
|
### Text meets 4.5:1 contrast
|
||||||
|
|
||||||
|
The primary button and the current page button take their text colour from the new `--on-accent`
|
||||||
|
token: white in light mode, near-black in dark mode, where white on the accent was 2.7:1. The
|
||||||
|
light-mode success, warning and info badge text is darker. A plugin that overrides `--accent` or
|
||||||
|
`--l-accent` should set `--l-on-accent` and `--d-on-accent` to match.
|
||||||
|
|
||||||
|
### Unused auth stylesheet rules are gone
|
||||||
|
|
||||||
|
`public/css/auth.css` no longer holds the `.auth-view` screen switch, `.tpl-*` preview controls,
|
||||||
|
`.forgot-alert`, `.register-alert`, `.remember` and `.auth-foot`; no core view used them. A plugin
|
||||||
|
view that did must carry its own rules.
|
||||||
|
|
||||||
### Colours render on engines without `oklch()`
|
### Colours render on engines without `oklch()`
|
||||||
|
|
||||||
The theme palette in `public/css/styles.css` is hex, not `oklch()`. On an engine older than
|
The theme palette in `public/css/styles.css` is hex, not `oklch()`. On an engine older than
|
||||||
|
|||||||
@@ -16,3 +16,17 @@ Read most (opens and searches):
|
|||||||
- `ci.sh` 1
|
- `ci.sh` 1
|
||||||
- `examples/plugins/scheduling/views/shifts.ejs` 1
|
- `examples/plugins/scheduling/views/shifts.ejs` 1
|
||||||
- `src/auth/csrf.ts` 1
|
- `src/auth/csrf.ts` 1
|
||||||
|
|
||||||
|
## Reading cost, chunk df5e30a4db5f, finished 2026-10-31T00:22:00Z
|
||||||
|
|
||||||
|
80251 new input tokens before the first commit.
|
||||||
|
|
||||||
|
Read most (opens and searches):
|
||||||
|
|
||||||
|
- `todo.md` 5
|
||||||
|
- `README.md` 3
|
||||||
|
- `CHANGELOG.md` 2
|
||||||
|
- `public/css/styles.css` 2
|
||||||
|
- `AGENTS.md` 1
|
||||||
|
- `src/ui/stylesheet-floor.test.ts` 1
|
||||||
|
- `src/ui/theme-switch.test.ts` 1
|
||||||
|
|||||||
@@ -4,3 +4,9 @@
|
|||||||
.scheduling-page .table-wrap {
|
.scheduling-page .table-wrap {
|
||||||
margin-top: var(--space-3, 0.75rem);
|
margin-top: var(--space-3, 0.75rem);
|
||||||
}
|
}
|
||||||
|
/* Inset the elements that sit directly in the pane like the filter bar, table and pager around them. */
|
||||||
|
.scheduling-page > p,
|
||||||
|
.scheduling-page > .alert,
|
||||||
|
.scheduling-page > .btn {
|
||||||
|
margin-inline: var(--pad-x);
|
||||||
|
}
|
||||||
|
|||||||
+2
-114
@@ -1,9 +1,6 @@
|
|||||||
/* =============================================================
|
/* =============================================================
|
||||||
Auth flow — login / register / forgot password
|
Auth flow — login / register / forgot password
|
||||||
Built on the shared tokens in styles.css. Pure HTML/CSS:
|
Built on the shared tokens in styles.css. Pure HTML/CSS.
|
||||||
- screens switch via :target (no JS)
|
|
||||||
- SSO is a config section toggled by a class/checkbox; providers
|
|
||||||
are a <ul> you extend by adding one <li class="sso-item">.
|
|
||||||
============================================================= */
|
============================================================= */
|
||||||
|
|
||||||
.auth-stage {
|
.auth-stage {
|
||||||
@@ -34,13 +31,6 @@
|
|||||||
.landing-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 4px; }
|
.landing-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 4px; }
|
||||||
.landing-actions .btn { height: 40px; padding: 0 20px; font-size: var(--fz); }
|
.landing-actions .btn { height: 40px; padding: 0 20px; font-size: var(--fz); }
|
||||||
|
|
||||||
/* ---- screen switching via :target (login is the default) ---- */
|
|
||||||
.auth-view { display: none; }
|
|
||||||
#login { display: block; }
|
|
||||||
#register:target, #forgot:target { display: block; }
|
|
||||||
body:has(#register:target) #login,
|
|
||||||
body:has(#forgot:target) #login { display: none; }
|
|
||||||
|
|
||||||
/* card */
|
/* card */
|
||||||
.auth-card {
|
.auth-card {
|
||||||
background: var(--surface);
|
background: var(--surface);
|
||||||
@@ -123,8 +113,6 @@ body:has(#forgot:target) #login { display: none; }
|
|||||||
|
|
||||||
.field-hint { font-size: var(--fz-xs); color: var(--text-faint); }
|
.field-hint { font-size: var(--fz-xs); color: var(--text-faint); }
|
||||||
|
|
||||||
.remember { margin-top: 2px; }
|
|
||||||
|
|
||||||
/* full-width primary button (extends .btn / .btn-primary from styles.css) */
|
/* full-width primary button (extends .btn / .btn-primary from styles.css) */
|
||||||
.btn-block { width: 100%; justify-content: center; height: 40px; font-size: var(--fz); }
|
.btn-block { width: 100%; justify-content: center; height: 40px; font-size: var(--fz); }
|
||||||
|
|
||||||
@@ -138,74 +126,7 @@ body:has(#forgot:target) #login { display: none; }
|
|||||||
.auth-aside a { color: var(--accent); }
|
.auth-aside a { color: var(--accent); }
|
||||||
.auth-aside a:hover { text-decoration: underline; }
|
.auth-aside a:hover { text-decoration: underline; }
|
||||||
|
|
||||||
/* legal footnote */
|
/* field-level error, shown under a field the server marked .has-error */
|
||||||
.auth-foot { margin: 0; text-align: center; font-size: var(--fz-xs); color: var(--text-faint); }
|
|
||||||
.auth-foot a { color: var(--text-muted); text-decoration: underline; }
|
|
||||||
|
|
||||||
/* =============================================================
|
|
||||||
Template preview controls (delete this block + its markup for
|
|
||||||
production). Drives theme + SSO on/off with zero JS.
|
|
||||||
============================================================= */
|
|
||||||
.tpl-controls {
|
|
||||||
position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
|
|
||||||
z-index: 50;
|
|
||||||
display: flex; align-items: center; gap: 12px;
|
|
||||||
padding: 6px 8px 6px 14px;
|
|
||||||
background: var(--surface); border: 1px solid var(--border);
|
|
||||||
border-radius: 99px; box-shadow: 0 6px 22px rgba(0,0,0,.12);
|
|
||||||
}
|
|
||||||
.tpl-label { font-size: var(--fz-xs); color: var(--text-faint);
|
|
||||||
text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
|
|
||||||
.tpl-sep { width: 1px; height: 20px; background: var(--border); }
|
|
||||||
.tpl-controls .theme-switch { width: 156px; }
|
|
||||||
|
|
||||||
/* on/off switch */
|
|
||||||
.tpl-toggle { display: inline-flex; align-items: center; gap: 8px;
|
|
||||||
font-size: var(--fz-sm); color: var(--text-muted); cursor: pointer; }
|
|
||||||
.tpl-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
|
|
||||||
.tpl-track { width: 32px; height: 18px; border-radius: 99px;
|
|
||||||
background: var(--border-2); position: relative; transition: background .15s ease; }
|
|
||||||
.tpl-track::after { content: ""; position: absolute; top: 2px; left: 2px;
|
|
||||||
width: 14px; height: 14px; border-radius: 50%; background: #fff;
|
|
||||||
box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s ease; }
|
|
||||||
.tpl-toggle:has(input:checked) .tpl-track { background: var(--accent); }
|
|
||||||
.tpl-toggle:has(input:checked) .tpl-track::after { transform: translateX(14px); }
|
|
||||||
.tpl-toggle:has(input:focus-visible) .tpl-track {
|
|
||||||
outline: 2px solid var(--focus); outline-offset: 2px; }
|
|
||||||
|
|
||||||
@media (max-width: 520px) {
|
|
||||||
.tpl-label { display: none; }
|
|
||||||
.tpl-controls { gap: 10px; padding: 6px 10px; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* =============================================================
|
|
||||||
Forgot-password feedback (Post/Redirect/Get, no JS).
|
|
||||||
The form POSTs to its own URL; on the redirect-GET the server
|
|
||||||
re-renders #forgot with a state class so the matching alert shows:
|
|
||||||
<section id="forgot" class="auth-view state-sent"> … </section>
|
|
||||||
(state-sent | state-error). No extra view is added.
|
|
||||||
The preview radios below demonstrate the same states live.
|
|
||||||
============================================================= */
|
|
||||||
.forgot-alert { display: none; }
|
|
||||||
#forgot.state-sent .forgot-alert.is-sent,
|
|
||||||
body:has(#fstate-sent:checked) #forgot .forgot-alert.is-sent { display: flex; }
|
|
||||||
#forgot.state-error .forgot-alert.is-error,
|
|
||||||
body:has(#fstate-error:checked) #forgot .forgot-alert.is-error { display: flex; }
|
|
||||||
|
|
||||||
/* the Forgot-state control only appears while the forgot view is open */
|
|
||||||
.tpl-forgot { display: none; }
|
|
||||||
body:has(#forgot:target) .tpl-forgot { display: flex; }
|
|
||||||
.tpl-controls .segmented { padding: 1px; }
|
|
||||||
.tpl-controls .segmented label { padding: 3px 8px; }
|
|
||||||
|
|
||||||
/* =============================================================
|
|
||||||
Field-level errors (e.g. "email already used"), server-driven.
|
|
||||||
The server re-renders the field's form with a state class and
|
|
||||||
adds aria-invalid="true" to the input:
|
|
||||||
<section id="register" class="auth-view state-email-taken"> … </section>
|
|
||||||
Reusable: drop a <p class="field-error"> under any field and gate
|
|
||||||
it on whatever state your server sets.
|
|
||||||
============================================================= */
|
|
||||||
.field-error {
|
.field-error {
|
||||||
display: none; align-items: center; gap: 6px; margin: 0;
|
display: none; align-items: center; gap: 6px; margin: 0;
|
||||||
font-size: var(--fz-xs); color: var(--neg);
|
font-size: var(--fz-xs); color: var(--neg);
|
||||||
@@ -213,36 +134,3 @@ body:has(#forgot:target) .tpl-forgot { display: flex; }
|
|||||||
.field.has-error .field-error { display: flex; } /* server-rendered field shows its own error */
|
.field.has-error .field-error { display: flex; } /* server-rendered field shows its own error */
|
||||||
.field-error > .ico { flex: 0 0 auto; color: var(--neg); }
|
.field-error > .ico { flex: 0 0 auto; color: var(--neg); }
|
||||||
.field-error a { color: var(--neg); font-weight: 600; text-decoration: underline; }
|
.field-error a { color: var(--neg); font-weight: 600; text-decoration: underline; }
|
||||||
|
|
||||||
/* register form-level error banner (pairs with field-level errors) */
|
|
||||||
.register-alert { display: none; }
|
|
||||||
|
|
||||||
/* --- state A: email already taken — field-level error only --- */
|
|
||||||
#register.state-email-taken .err-email,
|
|
||||||
body:has(#rstate-taken:checked) #register .err-email { display: flex; }
|
|
||||||
#register.state-email-taken #reg-email,
|
|
||||||
body:has(#rstate-taken:checked) #register #reg-email { border-color: var(--neg); }
|
|
||||||
|
|
||||||
/* --- state B: multiple errors — banner + several field errors together --- */
|
|
||||||
#register.state-invalid .register-alert,
|
|
||||||
body:has(#rstate-combined:checked) #register .register-alert { display: flex; }
|
|
||||||
#register.state-invalid .err-email,
|
|
||||||
#register.state-invalid .err-password,
|
|
||||||
body:has(#rstate-combined:checked) #register .err-email,
|
|
||||||
body:has(#rstate-combined:checked) #register .err-password { display: flex; }
|
|
||||||
#register.state-invalid #reg-email,
|
|
||||||
#register.state-invalid #reg-password,
|
|
||||||
body:has(#rstate-combined:checked) #register #reg-email,
|
|
||||||
body:has(#rstate-combined:checked) #register #reg-password { border-color: var(--neg); }
|
|
||||||
|
|
||||||
/* red focus ring on any invalid register input */
|
|
||||||
#register.state-email-taken #reg-email:focus,
|
|
||||||
#register.state-invalid #reg-email:focus,
|
|
||||||
#register.state-invalid #reg-password:focus,
|
|
||||||
body:has(#rstate-taken:checked) #register #reg-email:focus,
|
|
||||||
body:has(#rstate-combined:checked) #register #reg-email:focus,
|
|
||||||
body:has(#rstate-combined:checked) #register #reg-password:focus { box-shadow: 0 0 0 2px var(--neg-bg); }
|
|
||||||
|
|
||||||
/* the Register-state control only appears while the register view is open */
|
|
||||||
.tpl-register { display: none; }
|
|
||||||
body:has(#register:target) .tpl-register { display: flex; }
|
|
||||||
|
|||||||
+21
-17
@@ -28,18 +28,18 @@
|
|||||||
--l-border:#e5e5e8; --l-border-2:#d6d6da;
|
--l-border:#e5e5e8; --l-border-2:#d6d6da;
|
||||||
--l-text:#18181b; --l-text-muted:#6b6b73; --l-text-faint:#9a9aa2;
|
--l-text:#18181b; --l-text-muted:#6b6b73; --l-text-faint:#9a9aa2;
|
||||||
--l-accent:#3669ac; --l-accent-bg:#e5f3ff;
|
--l-accent:#3669ac; --l-accent-bg:#e5f3ff;
|
||||||
--l-accent-bd:#a7c7f2; --l-focus:#2a68b7;
|
--l-accent-bd:#a7c7f2; --l-focus:#2a68b7; --l-on-accent:#ffffff;
|
||||||
--l-pos:#258343; --l-pos-bg:#e1f5e4; --l-pos-bd:#a8d5b0;
|
--l-pos:#1f7a3d; --l-pos-bg:#e1f5e4; --l-pos-bd:#a8d5b0;
|
||||||
--l-neg:#c53637; --l-neg-bg:#ffebe8; --l-neg-bd:#febab4;
|
--l-neg:#c53637; --l-neg-bg:#ffebe8; --l-neg-bd:#febab4;
|
||||||
--l-warn:#9a6500; --l-warn-bg:#fef0d4; --l-warn-bd:#e3c78e;
|
--l-warn:#8f5d00; --l-warn-bg:#fef0d4; --l-warn-bd:#e3c78e;
|
||||||
--l-info:#2274af;--l-info-bg:#e2f5ff;--l-info-bd:#a2cdf2;
|
--l-info:#1d6aa5;--l-info-bg:#e2f5ff;--l-info-bd:#a2cdf2;
|
||||||
|
|
||||||
/* ---- raw DARK palette ---- */
|
/* ---- raw DARK palette ---- */
|
||||||
--d-bg:#0d0d0f; --d-surface:#161619; --d-surface-2:#1d1d22; --d-surface-3:#1a1a1e;
|
--d-bg:#0d0d0f; --d-surface:#161619; --d-surface-2:#1d1d22; --d-surface-3:#1a1a1e;
|
||||||
--d-border:#2a2a31; --d-border-2:#3a3a43;
|
--d-border:#2a2a31; --d-border-2:#3a3a43;
|
||||||
--d-text:#ededf0; --d-text-muted:#9b9ba6; --d-text-faint:#6a6a74;
|
--d-text:#ededf0; --d-text-muted:#9b9ba6; --d-text-faint:#6a6a74;
|
||||||
--d-accent:#6ba0e8; --d-accent-bg:#1d3351;
|
--d-accent:#6ba0e8; --d-accent-bg:#1d3351;
|
||||||
--d-accent-bd:#3f5f8a; --d-focus:#72adfb;
|
--d-accent-bd:#3f5f8a; --d-focus:#72adfb; --d-on-accent:#0d0d0f;
|
||||||
--d-pos:#62c37a; --d-pos-bg:#1a3520; --d-pos-bd:#376040;
|
--d-pos:#62c37a; --d-pos-bg:#1a3520; --d-pos-bd:#376040;
|
||||||
--d-neg:#ff7e76; --d-neg-bg:#4b1d1b; --d-neg-bd:#8a423d;
|
--d-neg:#ff7e76; --d-neg-bg:#4b1d1b; --d-neg-bd:#8a423d;
|
||||||
--d-warn:#e4b750; --d-warn-bg:#3e2d10; --d-warn-bd:#72592c;
|
--d-warn:#e4b750; --d-warn-bg:#3e2d10; --d-warn-bd:#72592c;
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
--bg:var(--l-bg); --surface:var(--l-surface); --surface-2:var(--l-surface-2); --surface-3:var(--l-surface-3);
|
--bg:var(--l-bg); --surface:var(--l-surface); --surface-2:var(--l-surface-2); --surface-3:var(--l-surface-3);
|
||||||
--border:var(--l-border); --border-2:var(--l-border-2);
|
--border:var(--l-border); --border-2:var(--l-border-2);
|
||||||
--text:var(--l-text); --text-muted:var(--l-text-muted); --text-faint:var(--l-text-faint);
|
--text:var(--l-text); --text-muted:var(--l-text-muted); --text-faint:var(--l-text-faint);
|
||||||
--accent:var(--l-accent); --accent-bg:var(--l-accent-bg); --accent-bd:var(--l-accent-bd); --focus:var(--l-focus);
|
--accent:var(--l-accent); --accent-bg:var(--l-accent-bg); --accent-bd:var(--l-accent-bd); --focus:var(--l-focus); --on-accent:var(--l-on-accent);
|
||||||
--pos:var(--l-pos); --pos-bg:var(--l-pos-bg); --pos-bd:var(--l-pos-bd);
|
--pos:var(--l-pos); --pos-bg:var(--l-pos-bg); --pos-bd:var(--l-pos-bd);
|
||||||
--neg:var(--l-neg); --neg-bg:var(--l-neg-bg); --neg-bd:var(--l-neg-bd);
|
--neg:var(--l-neg); --neg-bg:var(--l-neg-bg); --neg-bd:var(--l-neg-bd);
|
||||||
--warn:var(--l-warn); --warn-bg:var(--l-warn-bg); --warn-bd:var(--l-warn-bd);
|
--warn:var(--l-warn); --warn-bg:var(--l-warn-bg); --warn-bd:var(--l-warn-bd);
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
--bg:var(--d-bg); --surface:var(--d-surface); --surface-2:var(--d-surface-2); --surface-3:var(--d-surface-3);
|
--bg:var(--d-bg); --surface:var(--d-surface); --surface-2:var(--d-surface-2); --surface-3:var(--d-surface-3);
|
||||||
--border:var(--d-border); --border-2:var(--d-border-2);
|
--border:var(--d-border); --border-2:var(--d-border-2);
|
||||||
--text:var(--d-text); --text-muted:var(--d-text-muted); --text-faint:var(--d-text-faint);
|
--text:var(--d-text); --text-muted:var(--d-text-muted); --text-faint:var(--d-text-faint);
|
||||||
--accent:var(--d-accent); --accent-bg:var(--d-accent-bg); --accent-bd:var(--d-accent-bd); --focus:var(--d-focus);
|
--accent:var(--d-accent); --accent-bg:var(--d-accent-bg); --accent-bd:var(--d-accent-bd); --focus:var(--d-focus); --on-accent:var(--d-on-accent);
|
||||||
--pos:var(--d-pos); --pos-bg:var(--d-pos-bg); --pos-bd:var(--d-pos-bd);
|
--pos:var(--d-pos); --pos-bg:var(--d-pos-bg); --pos-bd:var(--d-pos-bd);
|
||||||
--neg:var(--d-neg); --neg-bg:var(--d-neg-bg); --neg-bd:var(--d-neg-bd);
|
--neg:var(--d-neg); --neg-bg:var(--d-neg-bg); --neg-bd:var(--d-neg-bd);
|
||||||
--warn:var(--d-warn); --warn-bg:var(--d-warn-bg); --warn-bd:var(--d-warn-bd);
|
--warn:var(--d-warn); --warn-bg:var(--d-warn-bg); --warn-bd:var(--d-warn-bd);
|
||||||
@@ -90,7 +90,7 @@ html:has(#theme-dark:checked) {
|
|||||||
--bg:var(--d-bg); --surface:var(--d-surface); --surface-2:var(--d-surface-2); --surface-3:var(--d-surface-3);
|
--bg:var(--d-bg); --surface:var(--d-surface); --surface-2:var(--d-surface-2); --surface-3:var(--d-surface-3);
|
||||||
--border:var(--d-border); --border-2:var(--d-border-2);
|
--border:var(--d-border); --border-2:var(--d-border-2);
|
||||||
--text:var(--d-text); --text-muted:var(--d-text-muted); --text-faint:var(--d-text-faint);
|
--text:var(--d-text); --text-muted:var(--d-text-muted); --text-faint:var(--d-text-faint);
|
||||||
--accent:var(--d-accent); --accent-bg:var(--d-accent-bg); --accent-bd:var(--d-accent-bd); --focus:var(--d-focus);
|
--accent:var(--d-accent); --accent-bg:var(--d-accent-bg); --accent-bd:var(--d-accent-bd); --focus:var(--d-focus); --on-accent:var(--d-on-accent);
|
||||||
--pos:var(--d-pos); --pos-bg:var(--d-pos-bg); --pos-bd:var(--d-pos-bd);
|
--pos:var(--d-pos); --pos-bg:var(--d-pos-bg); --pos-bd:var(--d-pos-bd);
|
||||||
--neg:var(--d-neg); --neg-bg:var(--d-neg-bg); --neg-bd:var(--d-neg-bd);
|
--neg:var(--d-neg); --neg-bg:var(--d-neg-bg); --neg-bd:var(--d-neg-bd);
|
||||||
--warn:var(--d-warn); --warn-bg:var(--d-warn-bg); --warn-bd:var(--d-warn-bd);
|
--warn:var(--d-warn); --warn-bg:var(--d-warn-bg); --warn-bd:var(--d-warn-bd);
|
||||||
@@ -103,7 +103,7 @@ html:has(#theme-light:checked) {
|
|||||||
--bg:var(--l-bg); --surface:var(--l-surface); --surface-2:var(--l-surface-2); --surface-3:var(--l-surface-3);
|
--bg:var(--l-bg); --surface:var(--l-surface); --surface-2:var(--l-surface-2); --surface-3:var(--l-surface-3);
|
||||||
--border:var(--l-border); --border-2:var(--l-border-2);
|
--border:var(--l-border); --border-2:var(--l-border-2);
|
||||||
--text:var(--l-text); --text-muted:var(--l-text-muted); --text-faint:var(--l-text-faint);
|
--text:var(--l-text); --text-muted:var(--l-text-muted); --text-faint:var(--l-text-faint);
|
||||||
--accent:var(--l-accent); --accent-bg:var(--l-accent-bg); --accent-bd:var(--l-accent-bd); --focus:var(--l-focus);
|
--accent:var(--l-accent); --accent-bg:var(--l-accent-bg); --accent-bd:var(--l-accent-bd); --focus:var(--l-focus); --on-accent:var(--l-on-accent);
|
||||||
--pos:var(--l-pos); --pos-bg:var(--l-pos-bg); --pos-bd:var(--l-pos-bd);
|
--pos:var(--l-pos); --pos-bg:var(--l-pos-bg); --pos-bd:var(--l-pos-bd);
|
||||||
--neg:var(--l-neg); --neg-bg:var(--l-neg-bg); --neg-bd:var(--l-neg-bd);
|
--neg:var(--l-neg); --neg-bg:var(--l-neg-bg); --neg-bd:var(--l-neg-bd);
|
||||||
--warn:var(--l-warn); --warn-bg:var(--l-warn-bg); --warn-bd:var(--l-warn-bd);
|
--warn:var(--l-warn); --warn-bg:var(--l-warn-bg); --warn-bd:var(--l-warn-bd);
|
||||||
@@ -171,9 +171,9 @@ summary { list-style: none; cursor: pointer; }
|
|||||||
.brand-mark {
|
.brand-mark {
|
||||||
width: 22px; height: 22px; border-radius: 5px; flex: 0 0 auto;
|
width: 22px; height: 22px; border-radius: 5px; flex: 0 0 auto;
|
||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
display: grid; place-items: center; color: #fff;
|
display: grid; place-items: center; color: var(--on-accent);
|
||||||
}
|
}
|
||||||
.brand-mark .ico { stroke: #fff; }
|
.brand-mark .ico { stroke: var(--on-accent); }
|
||||||
.brand-logo { width: 22px; height: 22px; border-radius: 5px; flex: 0 0 auto; object-fit: contain; }
|
.brand-logo { width: 22px; height: 22px; border-radius: 5px; flex: 0 0 auto; object-fit: contain; }
|
||||||
.brand-name { font-weight: 650; letter-spacing: -.01em; }
|
.brand-name { font-weight: 650; letter-spacing: -.01em; }
|
||||||
.brand-sub { color: var(--text-faint); font-size: var(--fz-xs); margin-left: auto; }
|
.brand-sub { color: var(--text-faint); font-size: var(--fz-xs); margin-left: auto; }
|
||||||
@@ -191,9 +191,10 @@ summary { list-style: none; cursor: pointer; }
|
|||||||
• CLICKABLE = label is <a href> → navigates on click.
|
• CLICKABLE = label is <a href> → navigates on click.
|
||||||
STATIC = label is <span> → not a navigation target.
|
STATIC = label is <span> → not a navigation target.
|
||||||
So "header" and "clickable" are independent: any combination works.
|
So "header" and "clickable" are independent: any combination works.
|
||||||
Children sit in a sibling <ul class="nav-children">, revealed by
|
Children sit in a sibling <ul class="nav-children">. Where :has() works, it
|
||||||
:has() on THIS row's own <details open> (scoped with > so a node
|
folds them unless THIS row's own <details open> (scoped with > so a node
|
||||||
only ever controls its own subtree — infinite depth, no JS).
|
only ever controls its own subtree — infinite depth, no JS); elsewhere
|
||||||
|
every branch stays open, since nothing could reopen one.
|
||||||
============================================================ */
|
============================================================ */
|
||||||
.nav-row { display: flex; align-items: center; gap: 2px; }
|
.nav-row { display: flex; align-items: center; gap: 2px; }
|
||||||
|
|
||||||
@@ -237,8 +238,10 @@ span.nav-self { cursor: default; } /* static / non-clickable */
|
|||||||
.nav-self[aria-current="page"] .ico { color: var(--accent); }
|
.nav-self[aria-current="page"] .ico { color: var(--accent); }
|
||||||
|
|
||||||
/* children + infinite indentation with a guide line per level */
|
/* children + infinite indentation with a guide line per level */
|
||||||
|
@supports selector(:has(a)) {
|
||||||
.nav-node > .nav-children { display: none; }
|
.nav-node > .nav-children { display: none; }
|
||||||
.nav-node:has(> .nav-row > .nav-disc[open]) > .nav-children { display: block; }
|
.nav-node:has(> .nav-row > .nav-disc[open]) > .nav-children { display: block; }
|
||||||
|
}
|
||||||
.nav-children { padding-left: 22px; position: relative; }
|
.nav-children { padding-left: 22px; position: relative; }
|
||||||
.nav-children::before {
|
.nav-children::before {
|
||||||
content: ""; position: absolute; left: 10px; top: 2px; bottom: 2px;
|
content: ""; position: absolute; left: 10px; top: 2px; bottom: 2px;
|
||||||
@@ -259,7 +262,8 @@ span.nav-self { cursor: default; } /* static / non-clickable */
|
|||||||
padding: 8px; display: flex; flex-direction: column; gap: 6px;
|
padding: 8px; display: flex; flex-direction: column; gap: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* theme segmented control */
|
/* theme segmented control — every theme rule is a :has(), so without it the switch is inert */
|
||||||
|
@supports not selector(:has(a)) { .theme-switch { display: none; } }
|
||||||
.theme-switch {
|
.theme-switch {
|
||||||
display: grid; grid-template-columns: repeat(3, 1fr);
|
display: grid; grid-template-columns: repeat(3, 1fr);
|
||||||
gap: 2px; padding: 2px;
|
gap: 2px; padding: 2px;
|
||||||
@@ -311,7 +315,7 @@ span.nav-self { cursor: default; } /* static / non-clickable */
|
|||||||
}
|
}
|
||||||
.btn:hover { background: var(--surface-2); }
|
.btn:hover { background: var(--surface-2); }
|
||||||
.btn-primary { background: var(--accent); border-color: var(--accent);
|
.btn-primary { background: var(--accent); border-color: var(--accent);
|
||||||
color: #fff; font-weight: 550; }
|
color: var(--on-accent); font-weight: 550; }
|
||||||
.btn-primary:hover { filter: brightness(1.06); }
|
.btn-primary:hover { filter: brightness(1.06); }
|
||||||
.btn-ghost { background: transparent; border-color: transparent; }
|
.btn-ghost { background: transparent; border-color: transparent; }
|
||||||
.btn-ghost:hover { background: var(--surface-2); }
|
.btn-ghost:hover { background: var(--surface-2); }
|
||||||
@@ -665,7 +669,7 @@ th[aria-sort="descending"] .sort-ico { transform: rotate(180deg); }
|
|||||||
}
|
}
|
||||||
.page-btn:hover { background: var(--surface-2); color: var(--text); }
|
.page-btn:hover { background: var(--surface-2); color: var(--text); }
|
||||||
.page-btn[aria-current="page"] { background: var(--accent); border-color: var(--accent);
|
.page-btn[aria-current="page"] { background: var(--accent); border-color: var(--accent);
|
||||||
color: #fff; font-weight: 600; }
|
color: var(--on-accent); font-weight: 600; }
|
||||||
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
|
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
|
||||||
|
|
||||||
/* ---------- 11. RESPONSIVE / HAMBURGER --------------------- */
|
/* ---------- 11. RESPONSIVE / HAMBURGER --------------------- */
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import assert from "node:assert/strict";
|
||||||
|
import { readFileSync } from "node:fs";
|
||||||
|
import { dirname, join } from "node:path";
|
||||||
|
import { test } from "node:test";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
|
||||||
|
const css = readFileSync(join(dirname(fileURLToPath(import.meta.url)), "..", "..", "public", "css", "styles.css"), "utf8");
|
||||||
|
|
||||||
|
const token = (name: string): string => {
|
||||||
|
const hex = new RegExp(`--${name}:\\s*(#[0-9a-f]{6})\\b`, "i").exec(css)?.[1];
|
||||||
|
assert.ok(hex, `--${name} is not a six-digit hex colour`);
|
||||||
|
return hex;
|
||||||
|
};
|
||||||
|
|
||||||
|
const luminance = (hex: string): number => {
|
||||||
|
const [r = 0, g = 0, b = 0] = [1, 3, 5].map((i) => {
|
||||||
|
const c = Number.parseInt(hex.slice(i, i + 2), 16) / 255;
|
||||||
|
return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
||||||
|
});
|
||||||
|
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
||||||
|
};
|
||||||
|
|
||||||
|
const contrast = (a: string, b: string): number => {
|
||||||
|
const [hi = 0, lo = 0] = [luminance(a), luminance(b)].sort((x, y) => y - x);
|
||||||
|
return (hi + 0.05) / (lo + 0.05);
|
||||||
|
};
|
||||||
|
|
||||||
|
// WCAG AA for normal text.
|
||||||
|
for (const theme of ["l", "d"]) {
|
||||||
|
for (const tone of ["pos", "neg", "warn", "info"]) {
|
||||||
|
test(`${tone} badge text reaches 4.5:1 in ${theme === "l" ? "light" : "dark"} mode`, () => {
|
||||||
|
assert.ok(contrast(token(`${theme}-${tone}`), token(`${theme}-${tone}-bg`)) >= 4.5);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
test(`text on the accent reaches 4.5:1 in ${theme === "l" ? "light" : "dark"} mode`, () => {
|
||||||
|
assert.ok(contrast(token(`${theme}-on-accent`), token(`${theme}-accent`)) >= 4.5);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
test("the primary button and the current page button use --on-accent", () => {
|
||||||
|
assert.match(css, /\.btn-primary\s*\{[^}]*color:\s*var\(--on-accent\)/);
|
||||||
|
assert.match(css, /\.page-btn\[aria-current="page"\]\s*\{[^}]*color:\s*var\(--on-accent\)/);
|
||||||
|
});
|
||||||
@@ -13,3 +13,20 @@ for (const file of readdirSync(cssDir).filter((f) => f.endsWith(".css"))) {
|
|||||||
assert.ok(!/oklch\(/i.test(readFileSync(join(cssDir, file), "utf8")));
|
assert.ok(!/oklch\(/i.test(readFileSync(join(cssDir, file), "utf8")));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const stylesheet = readFileSync(join(cssDir, "styles.css"), "utf8").replace(/\/\*[\s\S]*?\*\//g, "");
|
||||||
|
|
||||||
|
// Below Chromium 105 nothing but `:has()` reveals a folded branch, so the fold may only exist where
|
||||||
|
// the engine can undo it.
|
||||||
|
test("styles.css hides .nav-children only inside @supports selector(:has(a))", () => {
|
||||||
|
const guard = stylesheet.indexOf("@supports selector(:has(a))");
|
||||||
|
assert.ok(guard >= 0, "no @supports selector(:has(a)) guard");
|
||||||
|
const hide = /\.nav-node\s*>\s*\.nav-children\s*\{\s*display:\s*none/.exec(stylesheet);
|
||||||
|
assert.ok(hide && hide.index > guard, "the fold rule is missing or precedes the guard");
|
||||||
|
const between = stylesheet.slice(guard, hide.index);
|
||||||
|
assert.equal(between.split("{").length - between.split("}").length, 1, "the guard closes before the fold rule");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("styles.css hides the theme switch where :has() is missing", () => {
|
||||||
|
assert.match(stylesheet, /@supports not selector\(:has\(a\)\)\s*\{\s*\.theme-switch\s*\{\s*display:\s*none/);
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user