fix: Kontrast im hellen Theme (Text und Hauptknöpfe mit --accent-strong, Fokusring); Prüfskripte für die Oberfläche (#1174)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -47,7 +47,7 @@
|
||||
--border: #e2dbd2;
|
||||
--border-field: #8a8378;
|
||||
--accent: #f08a2c;
|
||||
--accent-strong: #a8530a;
|
||||
--accent-strong: #9a4b09;
|
||||
--accent-soft: rgba(240, 138, 44, .14);
|
||||
--accent-text: #ffffff;
|
||||
--ok: #217346;
|
||||
@ -77,7 +77,7 @@
|
||||
--border: #e2dbd2;
|
||||
--border-field: #8a8378;
|
||||
--accent: #f08a2c;
|
||||
--accent-strong: #a8530a;
|
||||
--accent-strong: #9a4b09;
|
||||
--accent-soft: rgba(240, 138, 44, .14);
|
||||
--accent-text: #ffffff;
|
||||
--ok: #217346;
|
||||
|
||||
@ -1197,7 +1197,7 @@ const APP_CSS: &str = r#"/* Design nach llm-arena: dunkel als Standard, hell nac
|
||||
*{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}
|
||||
a{color:var(--accent)}
|
||||
a{color:var(--accent-strong)}
|
||||
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}
|
||||
@ -1206,16 +1206,16 @@ header .innen{max-width:76rem;margin:0 auto;padding:.7rem 1rem;display:flex;flex
|
||||
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}
|
||||
header nav a:hover{color:var(--text)}
|
||||
header nav a[aria-current]{background:var(--accent-soft);color:var(--accent);font-weight:600}
|
||||
header nav a[aria-current]{background:var(--accent-soft);color:var(--accent-strong);font-weight:600}
|
||||
header form{margin-left:auto;display:flex;gap:.6rem;align-items:center}
|
||||
main{max-width:76rem;margin:0 auto;padding:1.2rem 1rem 2rem}
|
||||
footer{max-width:76rem;margin:0 auto;padding:0 1rem 2rem;color:var(--muted);font-size:.8rem;text-align:center}
|
||||
button{font:inherit;padding:.45rem .9rem;border-radius:10px;border:1px solid var(--border);background:var(--surface-2);color:var(--text);cursor:pointer;transition:border-color .12s,background .12s}
|
||||
button:hover{border-color:var(--accent)}
|
||||
button.primary{background:linear-gradient(180deg,color-mix(in srgb,var(--accent) 88%,white),var(--accent));color:var(--accent-text);border-color:var(--accent);font-weight:600}
|
||||
button.primary{background:linear-gradient(180deg,color-mix(in srgb,var(--accent-strong) 94%,black),var(--accent-strong));color:var(--accent-text);border-color:var(--accent-strong);font-weight:600}
|
||||
button.sm{padding:.25rem .7rem;font-size:.85rem;border-radius:8px;white-space:nowrap}
|
||||
input{font:inherit;padding:.5rem .65rem;border-radius:8px;border:1px solid var(--border);background:var(--surface);color:var(--text);min-width:0}
|
||||
input:focus{outline:2px solid var(--accent);outline-offset:-1px}
|
||||
input:focus{outline:2px solid var(--accent-strong);outline-offset:-1px}
|
||||
code{font-family:ui-monospace,"JetBrains Mono",Menlo,monospace;font-size:.88em}
|
||||
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:1.1rem 1.3rem;margin-bottom:1.1rem;box-shadow:var(--shadow)}
|
||||
.muted,.leer{color:var(--muted)}.leer{margin:0}.error{color:var(--danger)}.ok{color:var(--ok)}
|
||||
@ -1224,7 +1224,7 @@ code{font-family:ui-monospace,"JetBrains Mono",Menlo,monospace;font-size:.88em}
|
||||
.chip.ok{background:color-mix(in srgb,var(--ok) 16%,transparent);border-color:transparent;color:var(--ok)}
|
||||
.chip.error{background:color-mix(in srgb,var(--danger) 16%,transparent);border-color:transparent;color:var(--danger)}
|
||||
.chip.warn{background:color-mix(in srgb,var(--warn) 18%,transparent);border-color:transparent;color:var(--warn)}
|
||||
.chip.accent{background:var(--accent-soft);border-color:transparent;color:var(--accent);font-weight:600}
|
||||
.chip.accent{background:var(--accent-soft);border-color:transparent;color:var(--accent-strong);font-weight:600}
|
||||
table{width:100%;border-collapse:collapse}
|
||||
th,td{text-align:left;padding:.45rem .6rem;border-bottom:1px solid var(--border);vertical-align:middle}
|
||||
tbody tr:last-child td{border-bottom:none}
|
||||
@ -1246,7 +1246,7 @@ td.zeit{white-space:nowrap;font-variant-numeric:tabular-nums;color:var(--muted);
|
||||
.fehler{border:1px solid color-mix(in srgb,var(--danger) 45%,var(--border));background:color-mix(in srgb,var(--danger) 10%,transparent);border-radius:10px;padding:.55rem .85rem;color:var(--danger)}
|
||||
.hinweis{border:1px solid color-mix(in srgb,var(--ok) 45%,var(--border));background:color-mix(in srgb,var(--ok) 10%,transparent);border-radius:10px;padding:.55rem .85rem;color:var(--ok)}
|
||||
select,textarea{font:inherit;padding:.5rem .65rem;border-radius:8px;border:1px solid var(--border);background:var(--surface);color:var(--text);min-width:0}
|
||||
textarea{width:100%;resize:vertical}select:focus,textarea:focus{outline:2px solid var(--accent);outline-offset:-1px}
|
||||
textarea{width:100%;resize:vertical}select:focus,textarea:focus{outline:2px solid var(--accent-strong);outline-offset:-1px}
|
||||
button:disabled{opacity:.5;cursor:not-allowed}button.danger:hover{border-color:var(--danger);color:var(--danger)}
|
||||
td.aktionen{white-space:nowrap}td.aktionen{position:sticky;right:0;background:var(--surface);box-shadow:-.6rem 0 .6rem -.6rem rgba(0,0,0,.35)}td.aktionen form{display:inline-block;margin:0 .15rem 0 0}
|
||||
.formular{display:grid;grid-template-columns:repeat(auto-fit,minmax(13rem,1fr));gap:.8rem 1rem;align-items:end}
|
||||
@ -1291,7 +1291,7 @@ td.faehig{white-space:nowrap}.fenster{display:inline-flex;vertical-align:middle;
|
||||
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)}
|
||||
th[aria-sort=ascending]::after{content:" ▲";color:var(--accent-strong)}th[aria-sort=descending]::after{content:" ▼";color:var(--accent-strong)}
|
||||
/* 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}
|
||||
@ -1317,7 +1317,7 @@ header nav a{padding:.3rem .8rem;white-space:nowrap}h1{font-size:1.3rem}.card{pa
|
||||
/* CHAT-03: Seitenleiste mit Verlauf neben dem Chat, auf schmalen Fenstern ausgeblendet. */
|
||||
/* Reiter nach Art (Modelle): Links, der aktive ist hervorgehoben. */
|
||||
.pruefzeile{min-height:1.6rem;margin:0 0 .4rem}
|
||||
.reiter{display:flex;flex-wrap:wrap;gap:.3rem;margin:0 0 1rem}.reiter a{padding:.4rem .9rem;border-radius:8px;color:var(--muted);text-decoration:none;border:1px solid transparent}.reiter a:hover{border-color:var(--line,rgba(127,127,127,.3));color:var(--text,inherit)}.reiter a[aria-current]{background:var(--accent-soft);color:var(--accent);font-weight:600}
|
||||
.reiter{display:flex;flex-wrap:wrap;gap:.3rem;margin:0 0 1rem}.reiter a{padding:.4rem .9rem;border-radius:8px;color:var(--muted);text-decoration:none;border:1px solid transparent}.reiter a:hover{border-color:var(--line,rgba(127,127,127,.3));color:var(--text,inherit)}.reiter a[aria-current]{background:var(--accent-soft);color:var(--accent-strong);font-weight:600}
|
||||
.chat-rahmen{display:flex;gap:1rem;align-items:stretch;min-width:0}
|
||||
.chat-rahmen>#chat{flex:1 1 auto;min-width:0}
|
||||
.chat-seite{flex:0 0 14rem;display:flex;flex-direction:column;gap:.6rem;min-height:0;overflow-y:auto;padding-right:.8rem;border-right:1px solid var(--line,rgba(127,127,127,.25))}
|
||||
|
||||
@ -61,6 +61,7 @@ Farben werden nach ihrer Funktion benannt und über gemeinsame Tokens verwendet.
|
||||
| `--muted` | `#9099a8` | `#6b645c` | Ergänzende Angaben und Beschriftungen |
|
||||
| `--border` | `#2b303a` | `#e2dbd2` | Rahmen und Trennlinien |
|
||||
| `--accent` | `#ff9b45` | `#f08a2c` | Markenakzent, aktive Navigation, Aktionen |
|
||||
| `--accent-strong` | `#ff9b45` | `#9a4b09` | Orange als Text (Links, aktive Reiter) und als Knopffläche mit weißem Text; erreicht auf hellem Grund mindestens 4,5:1 |
|
||||
| `--accent-soft` | `rgba(255,155,69,.14)` | `rgba(240,138,44,.14)` | Zurückhaltende Akzentflächen |
|
||||
| `--accent-text` | `#1a1005` | `#ffffff` | Text und Zeichen auf Akzentflächen |
|
||||
| `--ok` | `#6fd18a` | `#2e8b57` | Erfolg und positiver Status |
|
||||
@ -96,8 +97,11 @@ Aus den deckenden Ausgangsfarben berechnete Kontrastverhältnisse:
|
||||
| Hell: Haupttext auf Weiß | 17,32:1 |
|
||||
| Hell: Orange auf Weiß | 2,51:1 |
|
||||
| Hell: weißer Akzenttext auf Orange | 2,51:1 |
|
||||
| Hell: `--accent-strong` auf Weiß | 6,20:1 |
|
||||
| Hell: `--accent-strong` auf Seitenhintergrund | 5,61:1 |
|
||||
| Hell: weißer Text auf `--accent-strong` (Hauptknopf) | 6,20:1 |
|
||||
|
||||
**Offener Punkt:** Die helle Akzentfarbe und weiße Schrift auf Orange brauchen vor einer Freigabe als barrierefrei eine Überprüfung. Insbesondere kleine Links, Buttontexte und Fokusmarkierungen benötigen passende Kombinationen. Eine mögliche Anpassung der hellen Palette ist mit diesem Guide nicht entschieden.
|
||||
**Stand 21.11.2026 (#1174):** `--accent` bleibt die Markenfarbe für Flächen, Zeichen und Verzierung; für Text und für Knöpfe mit weißer Schrift gilt im hellen Theme `--accent-strong`. In der Weboberfläche von neXus wurden alle Seiten in beiden Themes gemessen (Textfarbe gegen den wirksamen Hintergrund, Verlaufsstopps einzeln): kein sichtbarer Text unter 4,5:1.
|
||||
|
||||
Die Werte berücksichtigen keine Verläufe, Bilder oder transparenten Mischflächen. Sie ersetzen keine Prüfung einer fertigen Ansicht.
|
||||
|
||||
@ -285,7 +289,7 @@ Eine gemeinsame Gestaltung ist erst dann belastbar, wenn die tatsächlichen Ansi
|
||||
- Bei Websites die unterstützten Browser, bei Apps die vorgesehenen Plattformen prüfen.
|
||||
- Bei Bewegung die entsprechende Systemeinstellung berücksichtigen.
|
||||
|
||||
Die offenen Kontrastfragen der hellen Akzentfarbe gehören vor eine Zusage zur Barrierefreiheit geklärt.
|
||||
Die Kontrastfrage der hellen Akzentfarbe ist für die Weboberfläche mit `--accent-strong` geklärt (siehe Abschnitt 4); für andere Produkte gilt dieselbe Regel.
|
||||
|
||||
## 13. Einführung und Pflege
|
||||
|
||||
|
||||
16
scripts/ui-pruefung/README.md
Normal file
16
scripts/ui-pruefung/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
# Prüfskripte für die Oberfläche (Chromium über das DevTools-Protokoll)
|
||||
|
||||
Diese Skripte starten ein eigenes Chromium (`/usr/bin/chromium`, headless, eigenes Profil) und steuern es mit dem
|
||||
eingebauten WebSocket von Node (kein Paket, keine Installation). Sie laufen gegen eine **Testinstanz** (Standard
|
||||
`http://127.0.0.1:18112`, überschreibbar mit `NEXUS_BASE`) und melden sich mit einem Testbenutzer an
|
||||
(Aufruf: `node skript.mjs <Testpasswort> [...]`, Benutzername `claude`). Gegen die Produktion nicht verwenden.
|
||||
|
||||
| Skript | Prüft | Test |
|
||||
| --- | --- | --- |
|
||||
| `ueberlagerung.mjs` | Chat bei 390×844, 320×568, Querformat, Tastatur-Höhen, 200 % Zoom, Seitenleiste an/aus: Ist jedes Bedienelement erreichbar (nichts liegt darüber), liegt der Hinweis unter der Karte | `browser2bedienung.1` |
|
||||
| `streaming-scroll.mjs` | Beim Streaming nicht weggescrollt werden, Markierung bleibt, Rücksprung-Knopf (braucht `fake_llama_lang.py` als `llama_cpp.binary`) | `browser2bedienung.2` |
|
||||
| `fokus-aktualisierung.mjs`, `fokus-aktualisierung-knopf.mjs` | Fokus und Cursor bei der Aktualisierung der Modellseite (zweites Modell `zweit` nötig) | `browser2bedienung.3` |
|
||||
| `kontrast.mjs` | Textkontrast aller sichtbaren Texte auf allen Seiten, hell und dunkel, Verläufe einzeln (Grenze 4,5:1, großer Text 3:1) | `browser2bedienung.4` |
|
||||
| `fokusring.mjs` | Fokusring von Knopf, Link, Feld und Auswahl in beiden Themes | `browser2bedienung.4` |
|
||||
|
||||
`lib.mjs` ist der kleine Treiber. Die Skripte sind Prüfwerkzeuge, kein Teil des Programms.
|
||||
107
scripts/ui-pruefung/fake_llama_lang.py
Executable file
107
scripts/ui-pruefung/fake_llama_lang.py
Executable file
@ -0,0 +1,107 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Attrappe für llama-server, nur für Tests von nexus-adapter.
|
||||
|
||||
Versteht die Argumente, die der Adapter übergibt (-m, --host, --port, ...),
|
||||
und verhält sich nach FAKE_LLAMA_MODE:
|
||||
ok antwortet auf /health zuerst mit 503, nach FAKE_LLAMA_LOAD_SECONDS mit 200
|
||||
crash schreibt einen Fehler nach stderr und endet mit Exit-Code 3
|
||||
hang wird nie bereit (immer 503)
|
||||
stubborn wie ok, ignoriert aber SIGTERM (zwingt den Adapter zum harten Beenden)
|
||||
|
||||
Antwortet außerdem auf GET /v1/models und POST /v1/chat/completions (mit und
|
||||
ohne SSE-Streaming) im OpenAI-Format, damit SDK-Tests das Gateway prüfen können.
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import signal
|
||||
import sys
|
||||
import time
|
||||
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||
|
||||
args = sys.argv[1:]
|
||||
|
||||
|
||||
def opt(name):
|
||||
return args[args.index(name) + 1] if name in args else None
|
||||
|
||||
|
||||
mode = os.environ.get("FAKE_LLAMA_MODE", "ok")
|
||||
print("fake-llama: pid", os.getpid(), flush=True)
|
||||
print("fake-llama: args", " ".join(args), flush=True)
|
||||
print("fake-llama: CUDA_VISIBLE_DEVICES=" + os.environ.get("CUDA_VISIBLE_DEVICES", "<unset>"), flush=True)
|
||||
|
||||
if mode == "crash":
|
||||
print("fake-llama: error: failed to load model", file=sys.stderr, flush=True)
|
||||
sys.exit(3)
|
||||
|
||||
if mode == "stubborn":
|
||||
signal.signal(signal.SIGTERM, signal.SIG_IGN)
|
||||
else:
|
||||
signal.signal(signal.SIGTERM, lambda *_: os._exit(0))
|
||||
|
||||
started = time.time()
|
||||
load_seconds = float(os.environ.get("FAKE_LLAMA_LOAD_SECONDS", "1"))
|
||||
|
||||
|
||||
ANSWER = []
|
||||
for i in range(1, 401):
|
||||
ANSWER.append(("Wort%d" % i) + (chr(10) if i % 8 == 0 else " "))
|
||||
|
||||
|
||||
class Handler(BaseHTTPRequestHandler):
|
||||
def log_message(self, *_):
|
||||
pass
|
||||
|
||||
def _send_json(self, code, payload):
|
||||
body = json.dumps(payload).encode()
|
||||
self.send_response(code)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
self.send_header("Content-Length", str(len(body)))
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
|
||||
def do_GET(self):
|
||||
if self.path == "/health":
|
||||
ready = mode in ("ok", "stubborn") and time.time() - started >= load_seconds
|
||||
if ready:
|
||||
self._send_json(200, {"status": "ok"})
|
||||
else:
|
||||
self._send_json(503, {"error": {"message": "Loading model"}})
|
||||
elif self.path == "/v1/models":
|
||||
alias = opt("--alias") or "modell"
|
||||
self._send_json(200, {"object": "list", "data": [{"id": alias, "object": "model", "created": 0, "owned_by": "fake"}]})
|
||||
else:
|
||||
self._send_json(404, {})
|
||||
|
||||
def do_POST(self):
|
||||
length = int(self.headers.get("Content-Length", "0"))
|
||||
request = json.loads(self.rfile.read(length) or b"{}")
|
||||
if self.path != "/v1/chat/completions":
|
||||
self._send_json(404, {})
|
||||
return
|
||||
model = request.get("model", "modell")
|
||||
if request.get("stream"):
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "text/event-stream")
|
||||
self.send_header("Cache-Control", "no-cache")
|
||||
self.end_headers()
|
||||
for i, part in enumerate(ANSWER):
|
||||
chunk = {"id": "chatcmpl-fake", "object": "chat.completion.chunk", "created": 1, "model": model,
|
||||
"choices": [{"index": 0, "delta": {"role": "assistant", "content": part} if i == 0 else {"content": part}, "finish_reason": None}]}
|
||||
self.wfile.write(("data: " + json.dumps(chunk) + "\n\n").encode())
|
||||
self.wfile.flush()
|
||||
time.sleep(0.08)
|
||||
last = {"id": "chatcmpl-fake", "object": "chat.completion.chunk", "created": 1, "model": model,
|
||||
"choices": [{"index": 0, "delta": {}, "finish_reason": "stop"}]}
|
||||
self.wfile.write(("data: " + json.dumps(last) + "\n\ndata: [DONE]\n\n").encode())
|
||||
self.wfile.flush()
|
||||
else:
|
||||
self._send_json(200, {
|
||||
"id": "chatcmpl-fake", "object": "chat.completion", "created": 1, "model": model,
|
||||
"choices": [{"index": 0, "finish_reason": "stop",
|
||||
"message": {"role": "assistant", "content": "".join(ANSWER)}}],
|
||||
"usage": {"prompt_tokens": 3, "completion_tokens": 4, "total_tokens": 7},
|
||||
})
|
||||
|
||||
|
||||
ThreadingHTTPServer((opt("--host"), int(opt("--port"))), Handler).serve_forever()
|
||||
23
scripts/ui-pruefung/fokus-aktualisierung-knopf.mjs
Normal file
23
scripts/ui-pruefung/fokus-aktualisierung-knopf.mjs
Normal file
@ -0,0 +1,23 @@
|
||||
import { start } from './lib.mjs';
|
||||
const BASE = process.env.NEXUS_BASE || 'http://127.0.0.1:18112';
|
||||
const pw = process.argv[2];
|
||||
const b = await start();
|
||||
const aendern = a => `(async () => { const cs = document.body.getAttribute('data-csrf'); await fetch('/ui/modelle/${a}', {method:'POST', redirect:'manual', headers:{'content-type':'application/x-www-form-urlencoded'}, body:new URLSearchParams({csrf: cs, name: 'zweit'})}); return 1; })()`;
|
||||
const aktiv = `JSON.stringify({tag: document.activeElement.tagName, text: (document.activeElement.textContent || '').trim().slice(0, 14), titel: document.activeElement.title || '', zeile: (document.activeElement.closest('tr') || {textContent: ''}).textContent.trim().slice(0, 10), wert: document.activeElement.value || ''})`;
|
||||
try {
|
||||
await b.login(BASE, 'claude', pw);
|
||||
await b.viewport(1200, 800, { dsf: 1, mobile: false });
|
||||
await b.goto(BASE + '/ui/modelle');
|
||||
await b.eval(aendern('entladen')); await new Promise(r => setTimeout(r, 5000));
|
||||
await b.goto(BASE + '/ui/modelle');
|
||||
// Fall 1: Knopf „Bearbeiten“ der Zeile testmodell
|
||||
await b.eval(`(() => { const k = Array.from(document.querySelectorAll('button[data-dialog]')).find(x => x.closest('tr').textContent.includes('testmodell')); k.focus(); return 1; })()`);
|
||||
console.log('Knopf fokussiert:', await b.eval(aktiv));
|
||||
await b.eval(aendern('laden')); await new Promise(r => setTimeout(r, 9000));
|
||||
console.log('9 s später :', await b.eval(aktiv));
|
||||
// Fall 2: Auswahlfeld „Alle: Engine“
|
||||
await b.eval(`(() => { const s = document.querySelector('select'); s.focus(); return 1; })()`);
|
||||
console.log('Auswahl fokussiert:', await b.eval(aktiv));
|
||||
await b.eval(aendern('entladen')); await new Promise(r => setTimeout(r, 9000));
|
||||
console.log('9 s später :', await b.eval(aktiv));
|
||||
} finally { b.close(); }
|
||||
26
scripts/ui-pruefung/fokus-aktualisierung.mjs
Normal file
26
scripts/ui-pruefung/fokus-aktualisierung.mjs
Normal file
@ -0,0 +1,26 @@
|
||||
import { start } from './lib.mjs';
|
||||
const BASE = process.env.NEXUS_BASE || 'http://127.0.0.1:18112';
|
||||
const pw = process.argv[2]; const tag = process.argv[3] || 'vorher';
|
||||
const b = await start();
|
||||
const lade = n => `(async () => { const cs = document.body.getAttribute('data-csrf'); const r = await fetch('/ui/modelle/${n}', {method:'POST', redirect:'manual', headers:{'content-type':'application/x-www-form-urlencoded'}, body:new URLSearchParams({csrf: cs, name: 'zweit'})}); return r.type; })()`;
|
||||
try {
|
||||
await b.login(BASE, 'claude', pw);
|
||||
await b.viewport(1200, 800, { dsf: 1, mobile: false });
|
||||
// Teil 1: offener Dialog mit ungesendetem Wert
|
||||
await b.goto(BASE + '/ui/modelle');
|
||||
await b.eval(`(() => { const k = Array.from(document.querySelectorAll('button[data-dialog]')).find(x => x.closest('tr') && x.closest('tr').textContent.includes('testmodell')); k.click(); const d = document.querySelector('dialog[open]'); const i = d.querySelector('input[name=vram_mb]'); i.focus(); i.value = '4321'; window.__dlg = d.id; return d.id; })()`);
|
||||
console.log('Dialog offen, Wert getippt:', await b.eval(`JSON.stringify({offen: !!document.querySelector('dialog[open]'), wert: document.querySelector('dialog[open] input[name=vram_mb]').value})`));
|
||||
await b.eval(lade('laden'));
|
||||
await new Promise(r => setTimeout(r, 9000));
|
||||
console.log('9 s nach Änderung einer anderen Zeile:', await b.eval(`JSON.stringify({offen: !!document.querySelector('dialog[open]'), wert: (document.getElementById(window.__dlg) && document.getElementById(window.__dlg).querySelector('input[name=vram_mb]').value), zeileZweit: (Array.from(document.querySelectorAll('tbody tr')).find(t => t.textContent.includes('zweit')) || {textContent: ''}).textContent.replace(/\\s+/g, ' ').slice(-70)})`));
|
||||
// Teil 2: Filter mit Cursor mitten im Text
|
||||
await b.eval(`(() => { const d = document.querySelector('dialog[open]'); if (d) d.close(); return 1; })()`);
|
||||
await b.eval(`(async () => { const cs = document.body.getAttribute('data-csrf'); await fetch('/ui/modelle/entladen', {method:'POST', redirect:'manual', headers:{'content-type':'application/x-www-form-urlencoded'}, body:new URLSearchParams({csrf: cs, name: 'zweit'})}); return 1; })()`);
|
||||
await new Promise(r => setTimeout(r, 5000));
|
||||
await b.goto(BASE + '/ui/modelle');
|
||||
await b.eval(`(() => { const f = document.querySelector('input[placeholder^="Name"]'); f.focus(); f.value = 'testmodel'; f.dispatchEvent(new Event('input', {bubbles: true})); f.setSelectionRange(4, 4); window.__f = 1; return 1; })()`);
|
||||
console.log('Filter fokussiert, Cursor an Position 4:', await b.eval(`JSON.stringify({aktiv: document.activeElement.tagName + '/' + (document.activeElement.type || ''), wert: document.activeElement.value, cursor: document.activeElement.selectionStart})`));
|
||||
await b.eval(lade('laden'));
|
||||
await new Promise(r => setTimeout(r, 9000));
|
||||
console.log('9 s nach Änderung einer anderen Zeile:', await b.eval(`JSON.stringify({aktiv: document.activeElement.tagName + '/' + (document.activeElement.type || ''), wert: document.activeElement.value, cursor: document.activeElement.selectionStart, filterWert: (document.querySelector('input[placeholder^="Name"]') || {}).value})`));
|
||||
} finally { b.close(); }
|
||||
18
scripts/ui-pruefung/fokusring.mjs
Normal file
18
scripts/ui-pruefung/fokusring.mjs
Normal file
@ -0,0 +1,18 @@
|
||||
import { start } from './lib.mjs';
|
||||
const BASE = process.env.NEXUS_BASE || 'http://127.0.0.1:18112';
|
||||
const pw = process.argv[2]; const S = process.argv[3];
|
||||
const b = await start();
|
||||
try {
|
||||
await b.login(BASE, 'claude', pw);
|
||||
await b.viewport(1200, 800, { dsf: 2, mobile: false });
|
||||
for (const theme of ['light', 'dark']) {
|
||||
await b.send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-color-scheme', value: theme }] });
|
||||
await b.goto(BASE + '/ui/chat');
|
||||
for (const [name, sel] of [['Knopf', '#chat button[type=submit]'], ['Link', 'header nav a'], ['Feld', '#chat textarea'], ['Auswahl', '#chat select']]) {
|
||||
await b.send('Input.dispatchKeyEvent', { type: 'keyDown', key: 'Tab', code: 'Tab' }); await b.send('Input.dispatchKeyEvent', { type: 'keyUp', key: 'Tab', code: 'Tab' });
|
||||
const r = await b.eval(`(() => { const e = document.querySelector(${JSON.stringify(sel)}); e.focus(); const cs = getComputedStyle(e); return JSON.stringify({ trifft: e.matches(':focus-visible'), outline: cs.outlineStyle + ' ' + cs.outlineWidth + ' ' + cs.outlineColor, boxShadow: cs.boxShadow.slice(0, 40) }); })()`);
|
||||
console.log(theme, name.padEnd(8), r);
|
||||
}
|
||||
await b.shot(`${S}/cdp/fokus-${theme}.png`);
|
||||
}
|
||||
} finally { b.close(); }
|
||||
64
scripts/ui-pruefung/kontrast.mjs
Normal file
64
scripts/ui-pruefung/kontrast.mjs
Normal file
@ -0,0 +1,64 @@
|
||||
import { start } from './lib.mjs';
|
||||
const BASE = process.env.NEXUS_BASE || 'http://127.0.0.1:18112';
|
||||
const pw = process.argv[2]; const tag = process.argv[3] || 'vorher';
|
||||
const b = await start();
|
||||
const mess = `(() => {
|
||||
const parse = c => { const m = c.match(/rgba?\\(([^)]+)\\)/); if (!m) return null; const p = m[1].split(/[ ,\\/]+/).filter(Boolean).map(Number); return { r: p[0], g: p[1], b: p[2], a: p.length > 3 ? p[3] : 1 }; };
|
||||
const lin = v => { v /= 255; return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4); };
|
||||
const lum = c => 0.2126 * lin(c.r) + 0.7152 * lin(c.g) + 0.0722 * lin(c.b);
|
||||
const mix = (top, bot) => ({ r: top.r * top.a + bot.r * (1 - top.a), g: top.g * top.a + bot.g * (1 - top.a), b: top.b * top.a + bot.b * (1 - top.a), a: 1 });
|
||||
const ratio = (f, bg) => { const F = mix(f, bg); const l1 = lum(F), l2 = lum(bg); return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05); };
|
||||
const seiten = getComputedStyle(document.body).backgroundColor;
|
||||
function hintergruende(e) { // Liste möglicher Hintergrundfarben (Verlaufsstopps zählen einzeln)
|
||||
let ketten = [{ r: 246, g: 243, b: 239, a: 1 }];
|
||||
const alle = []; for (let x = e; x; x = x.parentElement) alle.push(x);
|
||||
let basis = parse(getComputedStyle(document.documentElement).backgroundColor); if (!basis || basis.a === 0) basis = null;
|
||||
const bodyBg = parse(getComputedStyle(document.body).backgroundColor); if (bodyBg && bodyBg.a > 0) basis = bodyBg;
|
||||
let stack = [basis || { r: 255, g: 255, b: 255, a: 1 }];
|
||||
for (const x of alle.reverse()) {
|
||||
const cs = getComputedStyle(x); const bc = parse(cs.backgroundColor); const bi = cs.backgroundImage;
|
||||
const neu = [];
|
||||
const stops = bi && bi !== 'none' ? (bi.match(/rgba?\\([^)]*\\)/g) || []).map(parse).filter(Boolean) : [];
|
||||
for (const s of stack) {
|
||||
let g = s; if (bc && bc.a > 0) g = mix(bc, s);
|
||||
if (stops.length) { for (const st of stops) neu.push(mix(st, g)); } else { neu.push(g); }
|
||||
}
|
||||
stack = neu.length > 8 ? neu.slice(0, 8) : neu;
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
const sicht = e => { const r = e.getBoundingClientRect(); const s = getComputedStyle(e); return r.width > 0 && r.height > 0 && s.visibility !== 'hidden' && s.display !== 'none' && parseFloat(s.opacity) > 0.05; };
|
||||
const treffer = {}; const gesamt = {};
|
||||
document.querySelectorAll('body *').forEach(e => {
|
||||
if (!sicht(e)) return;
|
||||
const direkt = Array.from(e.childNodes).filter(n => n.nodeType === 3 && n.textContent.trim().length > 1).map(n => n.textContent.trim()).join(' ');
|
||||
if (!direkt) return;
|
||||
if (e.closest('svg,script,style')) return;
|
||||
const cs = getComputedStyle(e); const f = parse(cs.color); if (!f) return;
|
||||
const gross = parseFloat(cs.fontSize) >= 24 || (parseFloat(cs.fontSize) >= 18.66 && parseInt(cs.fontWeight, 10) >= 700);
|
||||
const grenze = gross ? 3 : 4.5;
|
||||
let min = 99; let bgMin = null;
|
||||
for (const bg of hintergruende(e)) { const q = ratio(f, bg); if (q < min) { min = q; bgMin = bg; } }
|
||||
const schl = e.tagName.toLowerCase() + (e.className && typeof e.className === 'string' ? '.' + e.className.trim().split(/\\s+/).slice(0, 2).join('.') : '') + (e.closest('a') && e.tagName !== 'A' ? '(in a)' : '') ;
|
||||
gesamt[schl] = (gesamt[schl] || 0) + 1;
|
||||
if (min < grenze) { const k = schl; if (!treffer[k] || treffer[k].q > min) treffer[k] = { q: Math.round(min * 100) / 100, grenze, text: direkt.slice(0, 22), fg: cs.color, bg: 'rgb(' + Math.round(bgMin.r) + ',' + Math.round(bgMin.g) + ',' + Math.round(bgMin.b) + ')', n: 0 }; treffer[k].n = (treffer[k].n || 0) + 1; }
|
||||
});
|
||||
return JSON.stringify({ elemente: Object.values(gesamt).reduce((a, c) => a + c, 0), unter: Object.entries(treffer).sort((a, c) => a[1].q - c[1].q).map(([k, v]) => k + ' ' + v.q + ' (min ' + v.grenze + ') "' + v.text + '" ' + v.fg + ' auf ' + v.bg + ' x' + v.n) });
|
||||
})()`;
|
||||
const seiten = ['/ui', '/ui/modelle', '/ui/modelle?art=sprache', '/ui/engines', '/ui/chat', '/ui/personas', '/ui/keys', '/ui/warteschlange', '/ui/anfragen', '/ui/audit', '/ui/benutzer', '/ui/konto'];
|
||||
try {
|
||||
await b.login(BASE, 'claude', pw);
|
||||
await b.viewport(1200, 900, { dsf: 1, mobile: false });
|
||||
for (const theme of ['light', 'dark']) {
|
||||
await b.send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-color-scheme', value: theme }] });
|
||||
const alle = {};
|
||||
for (const p of seiten) {
|
||||
await b.goto(BASE + p);
|
||||
const r = JSON.parse(await b.eval(mess));
|
||||
r.unter.forEach(u => { const k = u.replace(/ x\d+$/, ''); alle[k] = (alle[k] || []).concat(p); });
|
||||
if (p === '/ui/modelle') await b.shot(`${process.argv[4] || '/tmp'}/kontrast-${tag}-${theme}.png`);
|
||||
}
|
||||
console.log('=== ' + theme + ' (' + Object.keys(alle).length + ' Befunde)');
|
||||
Object.entries(alle).slice(0, 40).forEach(([k, v]) => console.log(k, ' ← ' + [...new Set(v)].join(', ')));
|
||||
}
|
||||
} finally { b.close(); }
|
||||
29
scripts/ui-pruefung/lib.mjs
Normal file
29
scripts/ui-pruefung/lib.mjs
Normal file
@ -0,0 +1,29 @@
|
||||
// Kleiner Treiber für Chromium über das DevTools-Protokoll (nur lokal, für UI-Tests).
|
||||
import { spawn } from 'node:child_process';
|
||||
import fs from 'node:fs';
|
||||
export async function start({ port = 9333 } = {}) {
|
||||
const dir = fs.mkdtempSync('/tmp/cdp-prof-');
|
||||
const proc = spawn('/usr/bin/chromium', ['--headless=new', '--no-sandbox', '--disable-gpu', `--remote-debugging-port=${port}`, `--user-data-dir=${dir}`, 'about:blank'], { stdio: 'ignore' });
|
||||
let info;
|
||||
for (let i = 0; i < 50; i++) {
|
||||
try { info = await (await fetch(`http://127.0.0.1:${port}/json`)).json(); if (info.length) break; } catch { /* warten */ }
|
||||
await new Promise(r => setTimeout(r, 200));
|
||||
}
|
||||
const page = info.find(t => t.type === 'page');
|
||||
const ws = new WebSocket(page.webSocketDebuggerUrl);
|
||||
await new Promise(r => ws.addEventListener('open', r));
|
||||
let id = 0; const wait = new Map(); const events = [];
|
||||
ws.addEventListener('message', m => { const d = JSON.parse(m.data); if (d.id && wait.has(d.id)) { wait.get(d.id)(d); wait.delete(d.id); } else if (d.method) events.push(d); });
|
||||
const send = (method, params = {}) => new Promise((res, rej) => { const i = ++id; wait.set(i, d => d.error ? rej(new Error(JSON.stringify(d.error))) : res(d.result)); ws.send(JSON.stringify({ id: i, method, params })); });
|
||||
await send('Page.enable'); await send('Runtime.enable');
|
||||
const api = {
|
||||
send, events,
|
||||
async viewport(width, height, { dsf = 1, mobile = true } = {}) { await send('Emulation.setDeviceMetricsOverride', { width, height, deviceScaleFactor: dsf, mobile }); },
|
||||
async goto(url) { await send('Page.navigate', { url }); await new Promise(r => setTimeout(r, 1500)); },
|
||||
async eval(expr) { const r = await send('Runtime.evaluate', { expression: expr, awaitPromise: true, returnByValue: true }); if (r.exceptionDetails) throw new Error(JSON.stringify(r.exceptionDetails.exception?.description || r.exceptionDetails)); return r.result.value; },
|
||||
async shot(file, { full = false } = {}) { const r = await send('Page.captureScreenshot', { format: 'png', captureBeyondViewport: full }); fs.writeFileSync(file, Buffer.from(r.data, 'base64')); },
|
||||
async login(base, name, pw) { await api.goto(base + '/ui/login'); await api.eval(`fetch('/ui/login',{method:'POST',headers:{'content-type':'application/x-www-form-urlencoded'},body:new URLSearchParams({name:${JSON.stringify(name)},passwort:${JSON.stringify(pw)}}),redirect:'manual'}).then(r=>r.type)`); },
|
||||
close() { try { ws.close(); } catch {} proc.kill('SIGKILL'); fs.rmSync(dir, { recursive: true, force: true }); },
|
||||
};
|
||||
return api;
|
||||
}
|
||||
29
scripts/ui-pruefung/streaming-scroll.mjs
Normal file
29
scripts/ui-pruefung/streaming-scroll.mjs
Normal file
@ -0,0 +1,29 @@
|
||||
import { start } from './lib.mjs';
|
||||
const BASE = process.env.NEXUS_BASE || 'http://127.0.0.1:18112';
|
||||
const S = process.argv[2]; const pw = process.argv[3]; const tag = process.argv[4] || 'vorher';
|
||||
const b = await start();
|
||||
const senden = txt => `(() => { const ta = document.querySelector('#chat textarea'); ta.value = ${JSON.stringify(txt)}; document.querySelector('#chat button[type=submit]').click(); return 1; })()`;
|
||||
const mess = `(() => { const v = document.getElementById('chat-verlauf'); const sel = getSelection(); return JSON.stringify({scrollTop: Math.round(v.scrollTop), max: Math.round(v.scrollHeight - v.clientHeight), amEnde: Math.round(v.scrollHeight - v.clientHeight - v.scrollTop) < 5, markiert: sel.toString().length, bubbles: v.querySelectorAll('.blase').length, button: !!Array.from(document.querySelectorAll('#chat button')).find(x => /aktuell/i.test(x.textContent) && x.offsetParent !== null)}); })()`;
|
||||
try {
|
||||
await b.login(BASE, 'claude', pw);
|
||||
await b.viewport(1100, 700, { dsf: 1, mobile: false });
|
||||
await b.goto(BASE + '/ui/chat');
|
||||
await b.eval(senden('Erste Frage'));
|
||||
await new Promise(r => setTimeout(r, 38000));
|
||||
console.log('nach Antwort 1:', await b.eval(mess));
|
||||
await b.eval(senden('Zweite Frage'));
|
||||
await new Promise(r => setTimeout(r, 6000));
|
||||
console.log('Antwort 2 streamt (6 s), am Ende:', await b.eval(mess));
|
||||
// bewusst nach oben scrollen und Text der ersten Antwort markieren
|
||||
await b.eval(`(() => { const v = document.getElementById('chat-verlauf'); v.scrollTop = 0; const a = v.querySelector('.blase.assistant span'); const r = document.createRange(); r.setStart(a.firstChild, 0); r.setEnd(a.firstChild, 30); const s = getSelection(); s.removeAllRanges(); s.addRange(r); return 1; })()`);
|
||||
console.log('nach Hochscrollen + Markieren:', await b.eval(mess));
|
||||
await new Promise(r => setTimeout(r, 6000));
|
||||
console.log('6 s später (Streaming läuft):', await b.eval(mess));
|
||||
await b.shot(`${S}/cdp/stream-${tag}.png`);
|
||||
// Rücksprung per Knopf, danach folgt die Ansicht wieder
|
||||
await b.eval(`(() => { const k = Array.from(document.querySelectorAll('#chat button')).find(x => /aktuell/i.test(x.textContent)); if (k) k.click(); return 1; })()`);
|
||||
await new Promise(r => setTimeout(r, 3000));
|
||||
console.log('nach Klick auf den Rücksprung-Knopf, 3 s später:', await b.eval(mess));
|
||||
await new Promise(r => setTimeout(r, 18000));
|
||||
console.log('nach Ende des Streams:', await b.eval(mess));
|
||||
} finally { b.close(); }
|
||||
34
scripts/ui-pruefung/ueberlagerung.mjs
Normal file
34
scripts/ui-pruefung/ueberlagerung.mjs
Normal file
@ -0,0 +1,34 @@
|
||||
import { start } from './lib.mjs';
|
||||
const BASE = process.env.NEXUS_BASE || 'http://127.0.0.1:18112';
|
||||
const S = process.argv[2]; const pw = process.argv[3]; const tag = process.argv[4];
|
||||
const b = await start();
|
||||
const pruefen = `(async () => {
|
||||
const sicht = e => { const s = getComputedStyle(e); const r = e.getBoundingClientRect(); return s.visibility !== 'hidden' && s.display !== 'none' && r.width > 0 && r.height > 0; };
|
||||
const ziele = Array.from(document.querySelectorAll('#chat button, #chat select, #chat textarea, #chat input, .chat-seite button, .chat-seite input, header a, header button')).filter(sicht);
|
||||
const probleme = []; let n = 0;
|
||||
for (const e of ziele) {
|
||||
e.scrollIntoView({ block: 'center', inline: 'nearest' });
|
||||
await new Promise(r => setTimeout(r, 15));
|
||||
const r = e.getBoundingClientRect(); const cx = Math.min(Math.max(r.left + r.width / 2, 1), innerWidth - 1), cy = Math.min(Math.max(r.top + r.height / 2, 1), innerHeight - 1);
|
||||
const top = document.elementFromPoint(cx, cy); n++;
|
||||
if (!(top === e || e.contains(top) || (top && top.closest('label') && top.closest('label').contains(e)))) probleme.push((e.id || e.tagName) + ':' + (e.textContent || e.name || '').trim().slice(0, 14) + ' verdeckt von ' + (top ? top.tagName + (top.id ? '#' + top.id : '') + '.' + String(top.className).slice(0, 20) : 'nichts'));
|
||||
}
|
||||
const hint = Array.from(document.querySelectorAll('main p')).find(e => e.textContent.trim().startsWith('Der Chat läuft mit den Rechten'));
|
||||
const karte = document.getElementById('chat');
|
||||
const hr = hint.getBoundingClientRect(), kr = karte.getBoundingClientRect();
|
||||
const hinweisUeberKarte = hr.top + scrollY < kr.bottom + scrollY - 1;
|
||||
const querScroll = document.documentElement.scrollWidth > innerWidth + 1;
|
||||
return JSON.stringify({vp: [innerWidth, innerHeight], elemente: n, verdeckt: probleme, hinweisUeberKarte, querScroll});
|
||||
})()`;
|
||||
const fall = [[390,844,false,'390x844'],[390,844,true,'390x844 + Verlauf an'],[320,568,false,'320x568'],[320,568,true,'320x568 + Verlauf an'],[844,390,false,'Querformat 844x390'],[844,390,true,'Querformat + Verlauf an'],[390,380,false,'Tastatur 390x380'],[320,320,false,'Tastatur 320x320'],[195,422,false,'200% Zoom von 390x844'],[160,284,false,'200% Zoom von 320x568'],[1290,952,false,'Desktop 1290x952'],[1290,952,true,'Desktop, Verlauf aus']];
|
||||
try {
|
||||
await b.login(BASE, 'claude', pw);
|
||||
for (const [w, h, sidebar, name] of fall) {
|
||||
await b.viewport(w, h, { dsf: 1, mobile: w < 700 });
|
||||
await b.goto(BASE + '/ui/chat');
|
||||
// Seitenleiste: mobil ist sie standardmäßig zu (display:none ohne Klasse), „Verlauf ein/aus“ schaltet; Desktop: offen, true = zuklappen
|
||||
if (sidebar) await b.eval(`document.getElementById('chat-seite-knopf').click(); 1`);
|
||||
await new Promise(r => setTimeout(r, 200));
|
||||
console.log(name.padEnd(28), await b.eval(pruefen));
|
||||
}
|
||||
} finally { b.close(); }
|
||||
Reference in New Issue
Block a user