diff --git a/public/neu/basis.css b/public/neu/basis.css new file mode 100644 index 0000000..07691ad --- /dev/null +++ b/public/neu/basis.css @@ -0,0 +1,157 @@ +/* Kundenansicht neu: Basis und Bausteine im weißen Stil (Maße des Ticketsystems, global.css). + Die Grundregeln gelten am Desktop; die Handy-Abfrage am Dateiende überschreibt für das Handy. */ + +/* ---------- Grundlage (Spezifität 0, damit Bausteinklassen gewinnen) ---------- */ + +:where(.kn) { margin: 0; font-family: var(--kn-font); font-size: 14px; line-height: 20px; color: var(--kn-text); background: var(--kn-bg); -webkit-font-smoothing: antialiased; } +:where(.kn) *, :where(.kn) *::before, :where(.kn) *::after { box-sizing: border-box; } +:where(.kn) a { color: inherit; text-decoration: none; } +:where(.kn) a:not([class]) { text-decoration: underline; text-decoration-color: var(--kn-line-strong); text-underline-offset: 3px; } +:where(.kn) a:not([class]):hover { text-decoration-color: currentColor; } +:where(.kn) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; } +:where(.kn) input, :where(.kn) select, :where(.kn) textarea { font: inherit; color: inherit; } +:where(.kn) h1, :where(.kn) h2, :where(.kn) h3, :where(.kn) p { margin: 0; } +:where(.kn) :focus-visible { outline: 2px solid #111; outline-offset: 2px; } +:where(.kn) :disabled { opacity: .55; cursor: not-allowed; } +:where(.kn) [readonly] { background: var(--kn-bg-subtle); } +.kn [hidden] { display: none !important; } + +.kn-num { font-variant-numeric: tabular-nums; } + +/* ---------- Überschriften ---------- */ + +.kn-titel { font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -.02em; } +.kn-abschnitt { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin: 36px 0 12px; font-size: 16px; line-height: 24px; font-weight: 600; } + +/* ---------- Knöpfe und Links ---------- */ + +.kn-knopf, .kn-knopf-primaer, .kn-knopf-zweit, .kn-textknopf { + display: inline-flex; align-items: center; justify-content: center; gap: 6px; + height: 32px; padding: 0 12px; border-radius: var(--kn-radius); + font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--kn-text); + background: var(--kn-bg); box-shadow: var(--kn-ring); cursor: pointer; + transition: background-color .12s, box-shadow .12s; +} +.kn-knopf:hover, .kn-knopf-zweit:hover { background: var(--kn-bg-hover); } +.kn-knopf-primaer { background: var(--kn-accent); color: #fff; box-shadow: var(--kn-shadow-btn); } +.kn-knopf-primaer:hover { background: var(--kn-accent-hover); } +.kn-textknopf { box-shadow: none; color: var(--kn-text-2); padding: 0 8px; background: none; } +.kn-textknopf:hover { color: var(--kn-text); background: none; } +.kn-link-danger { color: var(--kn-danger); font-weight: 500; cursor: pointer; } +.kn-link-danger:hover { text-decoration: underline; text-underline-offset: 3px; } + +/* ---------- Felder ---------- */ + +.kn-feld { display: flex; flex-direction: column; gap: 6px; } +.kn-feld > label { font-weight: 500; } +.kn-feld-hinweis { font-size: 13px; color: var(--kn-text-2); } + +.kn-input, .kn-select, .kn-textarea { + height: 32px; min-width: 0; padding: 0 10px; border: 0; border-radius: var(--kn-radius); + background: var(--kn-bg); box-shadow: var(--kn-ring); outline: none; transition: box-shadow .12s; +} +.kn-textarea { height: auto; min-height: 96px; padding: 8px 10px; resize: vertical; line-height: 20px; } +.kn-select { + padding-right: 28px; appearance: none; -webkit-appearance: none; + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235e6678' stroke-width='1.5'/%3E%3C/svg%3E"); + background-repeat: no-repeat; background-position: right 10px center; +} +.kn-input:focus, .kn-select:focus, .kn-textarea:focus { box-shadow: 0 0 0 1px var(--kn-accent), 0 0 0 4px var(--kn-accent-ring); } +.kn-input[aria-invalid="true"], .kn-select[aria-invalid="true"], .kn-textarea[aria-invalid="true"] { box-shadow: 0 0 0 1px var(--kn-danger), 0 0 0 4px var(--kn-danger-ring); } +.kn-input::placeholder, .kn-textarea::placeholder { color: var(--kn-text-3); } + +.kn-check { display: inline-flex; align-items: center; gap: 8px; color: var(--kn-text-2); cursor: pointer; user-select: none; } +.kn-check input { accent-color: var(--kn-accent); width: 15px; height: 15px; margin: 0; } + +/* ---------- Unterstrich-Reiter ---------- */ + +.kn-reiter { display: flex; gap: 24px; border-bottom: 1px solid var(--kn-line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; } +.kn-reiter::-webkit-scrollbar { display: none; } +.kn-reiter-t { + padding: 8px 0 10px; margin-bottom: -1px; color: var(--kn-text-2); font-weight: 500; white-space: nowrap; + border-bottom: 2px solid transparent; font-variant-numeric: tabular-nums; cursor: pointer; +} +.kn-reiter-t:hover { color: var(--kn-text); } +.kn-reiter-t:focus-visible { outline-offset: -2px; } +.kn-reiter-t.aktiv, .kn-reiter-t[aria-selected="true"] { color: var(--kn-accent); border-bottom-color: var(--kn-accent); font-weight: 600; } + +/* ---------- Status-Pillen ---------- */ + +.kn-pille { + display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 4px; + font-size: 12px; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; + background: var(--kn-grau-bg); color: var(--kn-grau-fg); +} +.kn-pille-grau { background: var(--kn-grau-bg); color: var(--kn-grau-fg); } +.kn-pille-blau { background: var(--kn-blau-bg); color: var(--kn-blau-fg); } +.kn-pille-orange { background: var(--kn-orange-bg); color: var(--kn-orange-fg); } +.kn-pille-violett { background: var(--kn-violett-bg); color: var(--kn-violett-fg); } +.kn-pille-gruen { background: var(--kn-gruen-bg); color: var(--kn-gruen-fg); } +.kn-pille-rot { background: var(--kn-rot-bg); color: var(--kn-rot-fg); } +.kn-pille-schlicht { background: none; color: var(--kn-text-2); padding: 0; } + +/* ---------- Listen: Haarlinien statt Karten ---------- */ + +.kn-liste { list-style: none; margin: 0; padding: 0; } +.kn-zeile { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--kn-line); } +.kn-zeile:first-child { border-top: 1px solid var(--kn-line); } +.kn-zeile-titel { font-weight: 500; min-width: 0; overflow-wrap: anywhere; } +.kn-zeile-sub { font-size: 13px; color: var(--kn-text-2); } +.kn-zeile-link { color: inherit; text-decoration: none; cursor: pointer; } +.kn-zeile-link:hover .kn-zeile-titel { color: var(--kn-accent); } + +/* ---------- Dialog und Sheet (schließen nur per × und Esc) ---------- */ + +.kn-ueberlagerung { + position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; + padding: 10vh 16px 16px; background: var(--kn-overlay); animation: kn-einblenden .12s ease-out; +} +.kn-dialog, .kn-sheet { + display: flex; flex-direction: column; width: 100%; max-width: 520px; max-height: 84vh; + background: var(--kn-bg); border-radius: var(--kn-radius-lg); box-shadow: var(--kn-shadow-pop); + animation: kn-aufpoppen .14s ease-out; +} +.kn-dialog:focus, .kn-sheet:focus { outline: none; } +.kn-dialog-kopf { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 4px; } +.kn-dialog-kopf h3 { font-size: 18px; line-height: 26px; font-weight: 600; } +.kn-dialog-zu { width: 28px; height: 28px; border-radius: var(--kn-radius); color: var(--kn-text-2); font-size: 20px; line-height: 1; } +.kn-dialog-zu:hover { background: var(--kn-bg-hover); color: var(--kn-text); } +.kn-dialog-inhalt { display: flex; flex-direction: column; gap: 16px; padding: 16px 24px 8px; overflow-y: auto; } +.kn-dialog-fuss { display: flex; align-items: center; gap: 8px; padding: 16px 24px 20px; } +@keyframes kn-einblenden { from { opacity: 0; } } +@keyframes kn-aufpoppen { from { opacity: 0; transform: translateY(4px) scale(.985); } } + +/* ---------- Leerzustände und Meldungen (ohne Kasten, Text) ---------- */ + +.kn-leer { padding: 56px 0; text-align: center; color: var(--kn-text-2); } +.kn-leer strong { display: block; margin-bottom: 4px; color: var(--kn-text); font-weight: 600; } +.kn-meldung { font-size: 13px; } +.kn-meldung-ok { color: var(--kn-gruen-fg); } +.kn-meldung-warn { color: var(--kn-orange-fg); } +.kn-fehler { font-size: 13px; color: var(--kn-rot-fg); } + +/* ---------- Reduzierte Bewegung: höchstens kurzes Überblenden ---------- */ + +@media (prefers-reduced-motion: reduce) { + .kn-ueberlagerung { animation-duration: .12s; } + .kn-dialog, .kn-sheet { animation: kn-einblenden .12s ease-out; } + .kn-knopf, .kn-knopf-primaer, .kn-knopf-zweit, .kn-textknopf, .kn-input, .kn-select, .kn-textarea { transition: none; } +} + +/* ---------- Handy: Tap-Ziele 44 px, Textfelder 16 px, Dialoge unten verankert ---------- */ + +@media (max-width: 880px), (pointer: coarse) and (max-height: 500px) { + .kn-titel { font-size: 24px; line-height: 30px; } + .kn-knopf, .kn-knopf-primaer, .kn-knopf-zweit, .kn-textknopf { height: auto; min-height: 44px; padding-left: 16px; padding-right: 16px; } + .kn-textknopf { padding-left: 12px; padding-right: 12px; } + .kn-link-danger { display: inline-flex; align-items: center; min-height: 44px; } + .kn-input, .kn-select, .kn-textarea { height: auto; min-height: 44px; font-size: 16px; } + .kn-textarea { min-height: 96px; } + .kn-check { min-height: 44px; } + .kn-check input { width: 20px; height: 20px; } + .kn-reiter-t { display: inline-flex; align-items: center; min-height: 44px; padding-top: 0; padding-bottom: 0; } + .kn-zeile-link { min-height: 44px; } + .kn-dialog-zu { width: 44px; height: 44px; } + .kn-ueberlagerung { align-items: flex-end; padding: 16px; } + .kn-dialog, .kn-sheet { max-height: 92vh; padding-bottom: env(safe-area-inset-bottom, 0px); } +} diff --git a/public/neu/tokens.css b/public/neu/tokens.css new file mode 100644 index 0000000..a3c1a5e --- /dev/null +++ b/public/neu/tokens.css @@ -0,0 +1,66 @@ +/* Kundenansicht neu: Tokens im weißen Stil. + Werte wörtlich aus dem Ticketsystem (src/styles/global.css:7-51) und der Übersicht. Kein Dunkelmodus. */ +.kn { + color-scheme: light; + + /* Flächen und Text */ + --kn-bg: #fff; + --kn-bg-hover: #f6f8fa; + --kn-bg-subtle: #f8f9fb; + --kn-text: #1a1f36; + --kn-text-2: #5e6678; + --kn-text-3: #8a93a3; /* nur für Nebensächliches */ + + /* Linien */ + --kn-line: #ebeef1; + --kn-line-strong: #d8dde3; + + /* Akzent: Schwarz */ + --kn-accent: #111; + --kn-accent-hover: #2b2b2b; + --kn-accent-soft: rgba(17,17,17,.06); + --kn-accent-ring: rgba(17,17,17,.14); + + /* Status-Pillen (Fläche / Schrift) */ + --kn-grau-bg: #ebeef1; + --kn-grau-fg: #414552; + --kn-blau-bg: #e0f2fe; + --kn-blau-fg: #075985; + --kn-orange-bg: #fcedb9; + --kn-orange-fg: #a82c00; + --kn-violett-bg: #efeafe; + --kn-violett-fg: #5b21b6; + --kn-gruen-bg: #d7f7c2; + --kn-gruen-fg: #006908; + --kn-rot-bg: #ffe7f2; + --kn-rot-fg: #b3093c; + + /* Fehler */ + --kn-danger: #c0123c; + --kn-danger-ring: rgba(192,18,60,.18); + + /* Radien, Schatten, Abdunklung */ + --kn-radius: 6px; + --kn-radius-lg: 12px; + --kn-ring: 0 0 0 1px rgba(60,66,87,.16), 0 1px 1px rgba(0,0,0,.06); + --kn-shadow-btn: 0 1px 1px rgba(0,0,0,.12), 0 2px 5px rgba(60,66,87,.08); + --kn-shadow-pop: 0 0 0 1px rgba(60,66,87,.06), 0 12px 32px rgba(26,31,54,.14), 0 2px 6px rgba(26,31,54,.06); + --kn-overlay: rgba(26,31,54,.32); + + /* Abstände und Maße */ + --kn-sp-1: 4px; + --kn-sp-2: 8px; + --kn-sp-3: 12px; + --kn-sp-4: 16px; + --kn-sp-5: 24px; + --kn-sp-6: 32px; + --kn-sidebar-w: 232px; + --kn-zeile-h: 56px; + + /* Bewegung: Federn für Balken, Bremse für Blatt und Reel */ + --kn-feder: cubic-bezier(.3,1.25,.4,1); + --kn-bremse: cubic-bezier(.2,.8,.2,1); + + /* Schrift */ + --kn-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; +} diff --git a/test/knHuelleCss.test.js b/test/knHuelleCss.test.js new file mode 100644 index 0000000..50e2012 --- /dev/null +++ b/test/knHuelleCss.test.js @@ -0,0 +1,36 @@ +import { test } from 'node:test' +import assert from 'node:assert/strict' +import { lies, da, handyTeil } from './support/knHuelle.js' + +const tokens = (css) => Object.fromEntries([...css.matchAll(/(--kn-[\w-]+)\s*:\s*([^;]+);/g)].map((m) => [m[1], m[2].trim()])) + +test('tokens.css: Werte wörtlich aus der Übersicht und global.css:7-51', () => { + const t = tokens(lies('tokens.css')) + const soll = { + '--kn-bg': '#fff', '--kn-bg-hover': '#f6f8fa', '--kn-bg-subtle': '#f8f9fb', + '--kn-text': '#1a1f36', '--kn-text-2': '#5e6678', '--kn-text-3': '#8a93a3', + '--kn-line': '#ebeef1', '--kn-line-strong': '#d8dde3', '--kn-accent': '#111', + '--kn-grau-bg': '#ebeef1', '--kn-grau-fg': '#414552', '--kn-blau-bg': '#e0f2fe', '--kn-blau-fg': '#075985', + '--kn-orange-bg': '#fcedb9', '--kn-orange-fg': '#a82c00', '--kn-violett-bg': '#efeafe', '--kn-violett-fg': '#5b21b6', + '--kn-gruen-bg': '#d7f7c2', '--kn-gruen-fg': '#006908', '--kn-rot-bg': '#ffe7f2', '--kn-rot-fg': '#b3093c', + '--kn-danger': '#c0123c', '--kn-radius': '6px', '--kn-radius-lg': '12px', '--kn-sidebar-w': '232px', + '--kn-ring': '0 0 0 1px rgba(60,66,87,.16), 0 1px 1px rgba(0,0,0,.06)', + '--kn-font': '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif', + } + for (const [name, wert] of Object.entries(soll)) assert.equal(t[name], wert, name) +}) + +const VERBOTEN = [/gradient\(/i, /backdrop-filter/i, /filter:\s*blur/i, /prefers-color-scheme/i, /#9d3dfe|#d4b4ff|rgba\(157/i, /font-weight:\s*[89]00/, /dot-pattern|aurora/i] +test('keine verbotenen Muster (Verläufe, Glas, Dunkelmodus, Lila, Gewicht 800)', () => { + for (const datei of ['tokens.css', 'basis.css', 'huelle.css'].filter(da)) for (const m of VERBOTEN) assert.doesNotMatch(lies(datei), m, `${datei} ${m}`) +}) + +test('basis.css: Bausteine, Maße des Ticketsystems, 44 px und 16 px am Handy', () => { + const css = lies('basis.css') + for (const k of ['.kn-knopf', '.kn-knopf-primaer', '.kn-knopf-zweit', '.kn-textknopf', '.kn-link-danger', '.kn-feld', '.kn-input', '.kn-select', '.kn-textarea', '.kn-check', '.kn-reiter-t', '.kn-pille-gruen', '.kn-liste', '.kn-zeile-link', '.kn-ueberlagerung', '.kn-dialog', '.kn-sheet', '.kn-leer', '.kn-meldung-warn', '.kn-fehler', '.kn-titel', '.kn-abschnitt']) assert.ok(css.includes(k), k) + assert.match(css, /\.kn-pille\s*\{(?=[^}]*height:\s*20px)(?=[^}]*border-radius:\s*4px)/s) + assert.match(css, /\.kn-titel\s*\{(?=[^}]*font-size:\s*28px)(?=[^}]*line-height:\s*34px)(?=[^}]*font-weight:\s*700)/s) + assert.match(css, /:focus-visible\s*\{(?=[^}]*outline:\s*2px solid #111)(?=[^}]*outline-offset:\s*2px)/s) + assert.match(css, /:disabled[^{]*\{[^}]*opacity:\s*\.55/s) + assert.match(handyTeil(css), /min-height:\s*44px/); assert.match(handyTeil(css), /font-size:\s*16px/) +}) diff --git a/test/support/knHuelle.js b/test/support/knHuelle.js new file mode 100644 index 0000000..e907eb6 --- /dev/null +++ b/test/support/knHuelle.js @@ -0,0 +1,23 @@ +// Testhilfen der Kundenansicht-Hülle (P1): Quelltext aus public/neu/ lesen, ohne Browser. +import { existsSync, readFileSync } from 'node:fs' +import { fileURLToPath } from 'node:url' +import path from 'node:path' + +const NEU = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'public', 'neu') + +// Die Handy-Abfrage steht im CSS genau so (und in JS einmal als HANDY_ABFRAGE in leiste.js). +export const HANDY = '@media (max-width: 880px), (pointer: coarse) and (max-height: 500px)' + +export function lies(datei) { + return readFileSync(path.join(NEU, datei), 'utf8') +} + +export function da(datei) { + return existsSync(path.join(NEU, datei)) +} + +// Text ab der ersten Handy-Abfrage, sonst ''. +export function handyTeil(css) { + const i = css.indexOf(HANDY) + return i === -1 ? '' : css.slice(i) +}