feat(ui): Styleguide-Tokens und Theme-Auswahl, Playground mit festen Einstellungen und Eingabe (#1075, #1089, #1098)

- tokens.css und theme.js des Styleguides eingebettet (/ui/stil/), app.css ohne eigene Farbwerte; Darstellung System, Dunkel, Hell in der Fußzeile.
- Wortmarke nutzt --accent-strong, im hellen Theme dunkler (Kontrast).
- Playground: Einstellungen oben, Eingabe unten, nur der Verlauf scrollt.
- Test für die Einbindung und das Layout; im Browser lokal geprüft. Klicktests browser2stil.1 bis .3 angelegt.
- components.css bewusst nicht übernommen (andere Klassennamen).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 16:12:04 +01:00
parent 43f3008e52
commit 034d759e0a
7 changed files with 342 additions and 8 deletions

View File

@ -155,6 +155,8 @@ pub fn routes() -> Router<Arc<AppState>> {
.route("/ui/teil/uebersicht", get(overview_fragment))
.route("/ui/app.js", get(app_js))
.route("/ui/tabellen.js", get(tabellen_js))
.route("/ui/stil/tokens.css", get(stil_tokens))
.route("/ui/stil/theme.js", get(stil_theme))
.route("/ui/app.css", get(app_css))
.route("/ui/favicon.svg", get(favicon))
// PWA (→ #1062): Manifest und Symbole sind ohne Anmeldung lesbar, enthalten
@ -435,7 +437,7 @@ fn head(title: &str) -> String {
<link rel=\"apple-touch-icon\" href=\"/ui/icons/icon-192.png\">\
<meta name=\"theme-color\" content=\"#0f1115\" media=\"(prefers-color-scheme: dark)\">\
<meta name=\"theme-color\" content=\"#f6f3ef\" media=\"(prefers-color-scheme: light)\">\
<link rel=\"stylesheet\" href=\"/ui/app.css\"></head>",
<script src=\"/ui/stil/theme.js\"></script><link rel=\"stylesheet\" href=\"/ui/stil/tokens.css\"><link rel=\"stylesheet\" href=\"/ui/app.css\"></head>",
esc(title)
)
}
@ -486,7 +488,7 @@ pub(crate) fn layout(title: &str, active: &str, viewer: &Viewer, body: &str) ->
<form method=\"post\" action=\"/ui/logout\"><a class=\"chip konto\" href=\"/ui/konto\" title=\"Mein Konto\">{key}</a>{role}\
<button class=\"sm\" type=\"submit\">Abmelden</button></form></div></header>\
<main><h1>{title}</h1>{body}</main>\
<footer>{WORTMARKE} {version} · {mode} · Zeiten in Ortszeit (ohne JavaScript UTC)</footer>\
<footer>{WORTMARKE} {version} · {mode} · Zeiten in Ortszeit (ohne JavaScript UTC) · <label>Darstellung <select data-theme-wahl aria-label=\"Darstellung\"><option value=\"system\">System</option><option value=\"dark\">Dunkel</option><option value=\"light\">Hell</option></select></label></footer>\
<script src=\"/ui/tabellen.js\"></script><script src=\"/ui/app.js\"></script></body></html>",
head = head(title),
title = esc(title),
@ -1098,8 +1100,7 @@ document.addEventListener("click", function (e) {
"#;
const APP_CSS: &str = r#"/* Design nach llm-arena: dunkel als Standard, hell nach Systemeinstellung, Akzent Orange. */
:root{color-scheme:dark;--bg:#0f1115;--bg-glow:rgba(255,155,69,.10);--surface:#181b21;--surface-2:#222630;--text:#eceff4;--muted:#9099a8;--border:#2b303a;--accent:#ff9b45;--accent-soft:rgba(255,155,69,.14);--accent-text:#1a1005;--danger:#ff7b72;--ok:#6fd18a;--warn:#ffcf5c;--radius:14px;--shadow:0 6px 24px rgba(0,0,0,.35);font-family:Inter,"Segoe UI",system-ui,-apple-system,sans-serif;font-size:15px;line-height:1.5;color:var(--text);background:var(--bg);-webkit-text-size-adjust:100%}
@media (prefers-color-scheme:light){:root{color-scheme:light;--bg:#f6f3ef;--bg-glow:rgba(255,155,69,.16);--surface:#fff;--surface-2:#f0ebe4;--text:#1d1a17;--muted:#6b645c;--border:#e2dbd2;--accent:#f08a2c;--accent-soft:rgba(240,138,44,.14);--accent-text:#fff;--danger:#c0392b;--ok:#2e8b57;--warn:#b07d00;--shadow:0 6px 20px rgba(60,40,20,.10)}}
:root{--radius:var(--radius-card);font-family:var(--font-sans);font-size:var(--font-size-base);line-height:var(--line-height-base);color:var(--text);background:var(--bg);-webkit-text-size-adjust:100%}
*{box-sizing:border-box}
body{margin:0;min-height:100vh;background:radial-gradient(ellipse 70rem 28rem at 50% -8rem,var(--bg-glow),transparent),var(--bg);color:var(--text)}
h1,h2,h3{line-height:1.25;margin:0 0 .6rem}h1{font-size:1.5rem;letter-spacing:-.01em;margin:.4rem 0 1.1rem}h2{font-size:1.1rem;letter-spacing:-.01em}
@ -1107,7 +1108,7 @@ a{color:var(--accent)}
header{background:color-mix(in srgb,var(--bg) 82%,transparent);backdrop-filter:blur(10px);border-bottom:1px solid var(--border);position:sticky;top:0;z-index:5}
header .innen{max-width:76rem;margin:0 auto;padding:.7rem 1rem;display:flex;flex-wrap:wrap;align-items:center;gap:.7rem 1.2rem}
.logo{display:inline-flex;align-items:center;gap:.55rem;font-weight:700;font-size:1.1rem;letter-spacing:-.01em;color:var(--text);text-decoration:none}
.wordmark{color:var(--text);font-weight:700}.wordmark-accent{color:var(--accent)}
.wordmark{color:var(--text);font-weight:700}.wordmark-accent{color:var(--accent-strong)}
.logo.gross{font-size:1.5rem;margin-bottom:.8rem}.logo.gross .zeichen{width:40px;height:40px}
header nav{display:flex;flex-wrap:wrap;gap:.3rem;background:var(--surface);border:1px solid var(--border);border-radius:999px;padding:.25rem}
header nav a{border-radius:999px;padding:.35rem .65rem;color:var(--muted);text-decoration:none}
@ -1190,9 +1191,15 @@ dl.daten dd{margin:0;overflow-wrap:anywhere}dl.daten .breit-zeile{grid-column:1/
pre.befehl{margin:0;padding:.6rem .8rem;background:var(--bg);border:1px solid var(--border);border-radius:10px;font-family:ui-monospace,"JetBrains Mono",Menlo,monospace;font-size:.82rem;white-space:pre-wrap;overflow-wrap:anywhere}
.engine h2{margin:0}.chips{display:flex;flex-wrap:wrap;gap:.35rem;margin:.7rem 0 .2rem}
.engine .zeile{gap:.5rem .7rem}
footer label{display:inline-flex;gap:.35rem;align-items:center}footer select{padding:.15rem .4rem;font-size:.8rem}
.tabellenleiste{display:flex;flex-wrap:wrap;gap:.5rem .7rem;align-items:center;margin:0 0 .7rem}.tabellenleiste input[type=search]{min-width:12rem}
th.sortierbar{cursor:pointer;user-select:none}th.sortierbar:hover{color:var(--text)}
th[aria-sort=ascending]::after{content:" ▲";color:var(--accent)}th[aria-sort=descending]::after{content:" ▼";color:var(--accent)}
/* Playground (#1098): Einstellungen fest oben, Eingabe fest unten, nur der Verlauf scrollt. */
#chat{display:flex;flex-direction:column;height:calc(100vh - 13rem);height:calc(100dvh - 13rem);min-height:22rem;margin-bottom:.6rem}
#chat .verlauf{flex:1 1 auto;min-height:0;overflow-y:auto;margin:.8rem 0}
#chat>.zeile,#chat>form{flex:0 0 auto}
@media (max-width:40rem){#chat{height:calc(100vh - 10.5rem);height:calc(100dvh - 10.5rem)}}
@media (max-width:40rem){header .innen{gap:.6rem 1rem}header form{margin-left:auto}header nav{order:3;width:100%;flex-wrap:nowrap;overflow-x:auto}
header nav a{padding:.3rem .8rem;white-space:nowrap}h1{font-size:1.3rem}.card{padding:.9rem 1rem}}
"#;
@ -1200,6 +1207,24 @@ header nav a{padding:.3rem .8rem;white-space:nowrap}h1{font-size:1.3rem}.card{pa
/// Ortszeit und Filtern/Sortieren der Tabellen (#1082, #1085), Quelle in `assets/tabellen.js`.
const TABELLEN_JS: &str = include_str!("../assets/tabellen.js");
/// Design-Tokens und Theme-Auswahl aus dem gemeinsamen Styleguide (`wlkns-dev/stylguide`, #1075, #1089).
const STIL_TOKENS: &str = include_str!("../assets/stil/tokens.css");
const STIL_THEME: &str = include_str!("../assets/stil/theme.js");
async fn stil_tokens() -> Response {
secure(Response::builder())
.header(CONTENT_TYPE, "text/css; charset=utf-8")
.body(Body::from(STIL_TOKENS))
.unwrap_or_default()
}
async fn stil_theme() -> Response {
secure(Response::builder())
.header(CONTENT_TYPE, "text/javascript; charset=utf-8")
.body(Body::from(STIL_THEME))
.unwrap_or_default()
}
async fn tabellen_js() -> Response {
secure(Response::builder())
.header(CONTENT_TYPE, "text/javascript; charset=utf-8")