diff --git a/README.md b/README.md index 28d624c..ddb6734 100644 --- a/README.md +++ b/README.md @@ -15,20 +15,36 @@ Tablet und Desktop. - Termine & Schließzeiten, gruppiert nach Monat, mit Kalender-Abo (`/termine.ics`) - Ansprechpartner-Verzeichnis, Kontaktformular, Volltextsuche - **Barrierearm:** klare Schrift (Montserrat, selbst gehostet), 3 Schriftgrößen, Hell/Dunkel, - **Vorlesen**-Funktion, **Leichte Sprache** pro Seite/Meldung + **Leichte Sprache** pro Seite/Meldung +- **Vorlesen** jeder Seite (Knopf in der Kopfzeile) oder eines Artikels: satzweise, der gelesene Satz + wird markiert und mitgescrollt, mit Pause, Satz vor/zurück und langsamem Tempo - Merkliste (lokal auf dem Gerät), Teilen, offline lesbar, als App installierbar - Keine Werbung, kein Tracking, keine externen Schriften oder CDNs **Redaktion (`/admin`)** -- Übersicht, Meldungen (Entwurf, geplante Veröffentlichung, anheften), Seitenbaum, Termine, - Startseiten-Kacheln, Ansprechpartner, Mediathek, Postfach +- **Redaktionskalender** fürs Team: Planungen mit Status (Idee → In Arbeit → Zur Freigabe → Geplant → + Erledigt), Zuständigkeit, Frist, Notizen und Kommentaren; Monatsansicht mit Meldungen und Terminen, + Board nach Status, Liste; Ziehen & Ablegen (mit Tastatur-Alternative), Ideenspeicher, + „Meldung daraus erstellen“, „Meine Aufgaben“ auf der Übersicht +- **Ansprechpartner** einmal anlegen und in beliebig vielen Seiten und Meldungen verwenden – mit Suche, + Reihenfolge, Anlegen direkt aus dem Auswahlfeld und „Verwendet in“ +- Meldungen (Entwurf, geplante Veröffentlichung, anheften), Seitenbaum, Termine, + Startseiten-Bereiche, Mediathek, Postfach - Text-Editor mit Formatierungen, Links und Bildern - Bilder werden automatisch gedreht, verkleinert und als WebP gespeichert - Rollen: **Redakteur** (Inhalte) und **Administrator** (zusätzlich Benutzer & Einstellungen) - Einstellungen: App-Name, Logo, Farbpaar (Haupt- und Akzentfarbe), Titelbild, Texte, Impressum, Datenschutz – das App-Symbol wird daraus automatisch erzeugt +## Barrierefreiheit + +App und Redaktion werden mit [axe-core](https://github.com/dequelabs/axe-core) gegen WCAG 2.2 AA geprüft +(hell und dunkel, Handy und Desktop) – aktuell ohne Befund. Dazu u. a.: Sprunglinks zum Inhalt, +sichtbarer Tastaturfokus, beschriftete Bedienelemente, Ansagen für Screenreader bei Änderungen, +Tastatur-Alternativen zu Ziehen & Ablegen, `prefers-reduced-motion`, Kontrast ≥ 4,5 : 1. +Schriftgröße und Farbschema lassen sich auch in der Redaktion einstellen (Mein Konto). + ## Technik SvelteKit 2 (Svelte 5) · Tailwind CSS 4 · SQLite (better-sqlite3) mit Drizzle ORM · sharp · Tiptap. diff --git a/src/app.css b/src/app.css index 02c1181..d8ebc2a 100644 --- a/src/app.css +++ b/src/app.css @@ -15,8 +15,9 @@ /* ruhige Flächen: Lavendel, aus der Markenfarbe abgeleitet */ --surface-2: color-mix(in oklab, var(--brand) 8%, white); --ink: color-mix(in oklab, var(--brand) 92%, black); - --ink-2: color-mix(in oklab, var(--brand) 40%, #5d6073); - --ink-3: color-mix(in oklab, var(--brand) 22%, #7f84a3); + --ink-2: color-mix(in oklab, var(--brand) 40%, #50536a); + /* Hilfstext: mindestens 4,5:1 auch auf Lavendel-Flächen (WCAG AA) */ + --ink-3: color-mix(in oklab, var(--brand) 25%, #5f6386); --line: color-mix(in oklab, var(--brand) 13%, white); --shadow: 0 1px 2px rgb(20 16 60 / 0.05), 0 8px 24px -12px rgb(20 16 60 / 0.14); --shadow-lg: 0 2px 6px rgb(20 16 60 / 0.06), 0 24px 48px -20px rgb(20 16 60 / 0.3); @@ -35,7 +36,7 @@ --surface-2: #242050; --ink: #efedfb; --ink-2: #bdb9dc; - --ink-3: #8f8bb8; + --ink-3: #a19dc9; --line: #302b63; --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px -12px rgb(0 0 0 / 0.6); --shadow-lg: 0 2px 6px rgb(0 0 0 / 0.3), 0 24px 48px -20px rgb(0 0 0 / 0.75); @@ -54,7 +55,7 @@ --surface-2: #242050; --ink: #efedfb; --ink-2: #bdb9dc; - --ink-3: #8f8bb8; + --ink-3: #a19dc9; --line: #302b63; --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px -12px rgb(0 0 0 / 0.6); --shadow-lg: 0 2px 6px rgb(0 0 0 / 0.3), 0 24px 48px -20px rgb(0 0 0 / 0.75); @@ -113,8 +114,9 @@ .tone-slate { --tone: #56647a; } [class*='tone-'] { - --tone-soft: color-mix(in oklab, var(--tone) 12%, var(--surface)); - --tone-ink: color-mix(in oklab, var(--tone) 85%, var(--ink)); + --tone-soft: color-mix(in oklab, var(--tone) 10%, var(--surface)); + /* dunkel genug für 4,5:1 auf der hellen Tönung */ + --tone-ink: color-mix(in oklab, var(--tone) 68%, #120f2e); } :root[data-theme='dark'] [class*='tone-'] { --tone-soft: color-mix(in oklab, var(--tone) 26%, var(--surface)); @@ -284,6 +286,14 @@ } } +/* Satz, der gerade vorgelesen wird */ +::highlight(vorlesen) { + background-color: var(--accent-soft); + color: var(--ink); + text-decoration: underline 3px var(--accent); + text-underline-offset: 4px; +} + @utility safe-bottom { padding-bottom: env(safe-area-inset-bottom); } diff --git a/src/lib/admin/EditForm.svelte b/src/lib/admin/EditForm.svelte index b5af9b5..b3aec00 100644 --- a/src/lib/admin/EditForm.svelte +++ b/src/lib/admin/EditForm.svelte @@ -45,7 +45,7 @@ >
{@render children()}
- {#if aside}{/if} + {#if aside}{/if}
diff --git a/src/lib/admin/GalleryField.svelte b/src/lib/admin/GalleryField.svelte index e197630..d63240e 100644 --- a/src/lib/admin/GalleryField.svelte +++ b/src/lib/admin/GalleryField.svelte @@ -34,8 +34,8 @@
{/each} - diff --git a/src/lib/admin/IconTonePicker.svelte b/src/lib/admin/IconTonePicker.svelte index f72db75..231a262 100644 --- a/src/lib/admin/IconTonePicker.svelte +++ b/src/lib/admin/IconTonePicker.svelte @@ -32,7 +32,7 @@ {/each} - diff --git a/src/lib/admin/RichEditor.svelte b/src/lib/admin/RichEditor.svelte index 5040425..b28c9e8 100644 --- a/src/lib/admin/RichEditor.svelte +++ b/src/lib/admin/RichEditor.svelte @@ -47,7 +47,14 @@ ], content: value, editorProps: { - attributes: { class: 'rich focus:outline-none px-4 py-3', style: `min-height:${minHeight}` } + attributes: { + class: 'rich focus:outline-none px-4 py-3', + style: `min-height:${minHeight}`, + role: 'textbox', + 'aria-multiline': 'true', + 'aria-label': label, + ...(hint ? { 'aria-description': hint } : {}) + } }, onTransaction: () => tick++, onUpdate: ({ editor }) => { diff --git a/src/lib/admin/calendar/BoardView.svelte b/src/lib/admin/calendar/BoardView.svelte index 69954bf..479218f 100644 --- a/src/lib/admin/calendar/BoardView.svelte +++ b/src/lib/admin/calendar/BoardView.svelte @@ -36,11 +36,11 @@ } -
+
{#each columns as col (col.status)}
{ if (!e.dataTransfer?.types.includes('application/x-redaktion')) return; e.preventDefault(); diff --git a/src/lib/admin/calendar/EntryChip.svelte b/src/lib/admin/calendar/EntryChip.svelte index 084933f..85ad4f4 100644 --- a/src/lib/admin/calendar/EntryChip.svelte +++ b/src/lib/admin/calendar/EntryChip.svelte @@ -51,10 +51,10 @@ ondragstart={dragstart} onclick={() => onopen(entry)} aria-label={label} - class="tone-{STATUS_TONE[entry.status]} group w-full text-left rounded-lg bg-surface border border-line border-l-4 border-l-tone px-2 py-1.5 hover:border-brand/40 hover:shadow-card transition cursor-grab active:cursor-grabbing {entry.status === 'done' ? 'opacity-60' : ''}" + class="tone-{STATUS_TONE[entry.status]} group w-full text-left rounded-lg bg-surface border border-line border-l-4 border-l-tone px-2 py-1.5 hover:border-brand/40 hover:shadow-card transition cursor-grab active:cursor-grabbing {entry.status === 'done' ? 'bg-surface-2' : ''}" > - {entry.title} + {entry.title} {#if assignee} {/if} diff --git a/src/lib/components/ArticleActions.svelte b/src/lib/components/ArticleActions.svelte index ee4a467..f75670c 100644 --- a/src/lib/components/ArticleActions.svelte +++ b/src/lib/components/ArticleActions.svelte @@ -1,43 +1,21 @@
- {#if canSpeak} - {/if} {#if favorite} diff --git a/src/lib/components/HomeHero.svelte b/src/lib/components/HomeHero.svelte index f1a73ee..bca7c6c 100644 --- a/src/lib/components/HomeHero.svelte +++ b/src/lib/components/HomeHero.svelte @@ -18,7 +18,7 @@ {:else}
-

+

Platzhalter für das Titelbild

diff --git a/src/lib/components/PostCard.svelte b/src/lib/components/PostCard.svelte index d2d89f3..8cb3504 100644 --- a/src/lib/components/PostCard.svelte +++ b/src/lib/components/PostCard.svelte @@ -4,7 +4,8 @@ import { relative } from '$lib/dates'; import type { PostCard } from '$lib/types'; - let { post, variant = 'card' }: { post: PostCard; variant?: 'card' | 'row' } = $props(); + /** level: Überschriften-Ebene passend zur Seite (h2 in Listen direkt unter dem h1, sonst h3) */ + let { post, variant = 'card', level = 3 }: { post: PostCard; variant?: 'card' | 'row'; level?: 2 | 3 } = $props(); {#if variant === 'card'} @@ -25,7 +26,7 @@ {#if post.pinned}{/if} {relative(post.publishedAt)}

-

{post.title}

+ {post.title} {#if post.teaser}

{post.teaser}

{/if} {:else} @@ -39,7 +40,7 @@

{relative(post.publishedAt)}

-

{post.title}

+ {post.title} {#if post.teaser}

{post.teaser}

{/if}
diff --git a/src/lib/components/PrefsControls.svelte b/src/lib/components/PrefsControls.svelte index 7e7483f..38bae15 100644 --- a/src/lib/components/PrefsControls.svelte +++ b/src/lib/components/PrefsControls.svelte @@ -5,7 +5,7 @@ import BookHeart from '@lucide/svelte/icons/book-heart'; import { prefs } from '$lib/prefs.svelte'; - let { compact = false }: { compact?: boolean } = $props(); + let { compact = false, easy = true }: { compact?: boolean; easy?: boolean } = $props(); const themes = [ { value: 'light', label: 'Hell', icon: Sun }, @@ -22,6 +22,7 @@
+ {#if easy} + {/if}
Schriftgröße diff --git a/src/lib/components/ReadAloudBar.svelte b/src/lib/components/ReadAloudBar.svelte new file mode 100644 index 0000000..7cd665b --- /dev/null +++ b/src/lib/components/ReadAloudBar.svelte @@ -0,0 +1,54 @@ + + +{#if speech.active} +
+

+ {speech.paused ? 'Pausiert' : 'Liest vor …'} + Satz {speech.index + 1} von {speech.total} +

+ + + + + +
+{/if} diff --git a/src/lib/speech.svelte.ts b/src/lib/speech.svelte.ts new file mode 100644 index 0000000..4ea61ba --- /dev/null +++ b/src/lib/speech.svelte.ts @@ -0,0 +1,189 @@ +/** + * Vorlesen mit der Sprachausgabe des Geräts (Web Speech API). + * Liest einen Bereich satzweise vor und markiert den aktuellen Satz + * (CSS Custom Highlight API), damit man mitlesen kann. + */ + +type Sentence = { text: string; range: Range | null }; + +const RATE_KEY = 'wa_speech_rate'; +const HIGHLIGHT = 'vorlesen'; + +/** Text-Knoten, die vorgelesen werden (ohne versteckte Elemente und Bedienelemente) */ +function textNodes(root: Element): Text[] { + const skip = 'script, style, noscript, button, nav, [aria-hidden="true"], [hidden], .sr-only, [data-nicht-vorlesen]'; + const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, { + acceptNode: (n) => { + const el = n.parentElement; + if (!el || el.closest(skip) || !n.textContent?.trim()) return NodeFilter.FILTER_REJECT; + const style = getComputedStyle(el); + return style.display === 'none' || style.visibility === 'hidden' ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT; + } + }); + const nodes: Text[] = []; + while (walker.nextNode()) nodes.push(walker.currentNode as Text); + return nodes; +} + +/** Zerlegt den Bereich in Sätze inkl. Textbereich (Range) für die Markierung */ +function sentencesOf(root: Element): Sentence[] { + const nodes = textNodes(root); + // Alles, was auf dem Bildschirm als eigener Block erscheint, endet mit einer Satzgrenze + const blockOf = (n: Text) => { + for (let el = n.parentElement; el && el !== root; el = el.parentElement) { + if (!getComputedStyle(el).display.startsWith('inline')) return el; + } + return root; + }; + let full = ''; + const map: { node: Text; start: number }[] = []; + let prevBlock: Element | null = null; + for (const node of nodes) { + const block = blockOf(node); + if (prevBlock && block !== prevBlock) full += '\n'; + prevBlock = block; + map.push({ node, start: full.length }); + full += node.textContent; + } + + const locate = (pos: number) => { + let i = map.length - 1; + while (i > 0 && map[i].start > pos) i--; + const { node, start } = map[i]; + return { node, offset: Math.min(Math.max(pos - start, 0), node.length) }; + }; + + const out: Sentence[] = []; + const re = /[^.!?\n]+(?:[.!?]+["“”»)]*|\n|$)/g; + let m: RegExpExecArray | null; + while ((m = re.exec(full))) { + const raw = m[0]; + const text = raw.replace(/\s+/g, ' ').trim(); + if (!text) { + if (m.index === re.lastIndex) re.lastIndex++; + continue; + } + const lead = raw.length - raw.trimStart().length; + const s = m.index + lead; + const e = m.index + raw.trimEnd().length; + let range: Range | null = null; + try { + const a = locate(s); + const b = locate(e); + range = document.createRange(); + range.setStart(a.node, a.offset); + range.setEnd(b.node, b.offset); + } catch { + range = null; + } + out.push({ text, range }); + } + return out; +} + +class Speech { + supported = $state(false); + active = $state(false); + paused = $state(false); + index = $state(0); + total = $state(0); + slow = $state(false); + label = $state(''); + #sentences: Sentence[] = []; + #run = 0; + + init() { + this.supported = typeof window !== 'undefined' && 'speechSynthesis' in window; + try { + this.slow = localStorage.getItem(RATE_KEY) === 'slow'; + } catch { + /* ohne Speicher */ + } + } + + /** Liest das Element mit der ID `targetId` vor (Standard: Hauptinhalt) */ + start(targetId = 'inhalt', label = 'Seite') { + const root = document.getElementById(targetId); + if (!root || !this.supported) return; + this.stop(); + this.#sentences = sentencesOf(root); + if (!this.#sentences.length) return; + this.label = label; + this.total = this.#sentences.length; + this.active = true; + this.paused = false; + this.#speakFrom(0); + } + + #speakFrom(i: number) { + const run = ++this.#run; + speechSynthesis.cancel(); + const voice = speechSynthesis.getVoices().find((v) => v.lang.startsWith('de')); + for (let k = i; k < this.#sentences.length; k++) { + const u = new SpeechSynthesisUtterance(this.#sentences[k].text); + u.lang = 'de-DE'; + u.rate = this.slow ? 0.75 : 0.95; + if (voice) u.voice = voice; + u.onstart = () => { + if (run !== this.#run) return; + this.index = k; + this.#highlight(k); + }; + if (k === this.#sentences.length - 1) u.onend = () => run === this.#run && this.stop(); + speechSynthesis.speak(u); + } + } + + #highlight(k: number) { + const range = this.#sentences[k]?.range; + if (!range) return; + if ('highlights' in CSS) CSS.highlights.set(HIGHLIGHT, new Highlight(range)); + const r = range.getBoundingClientRect(); + const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches; + if (r.top < 90 || r.bottom > innerHeight - 140) + scrollBy({ top: r.top - innerHeight / 3, behavior: reduce ? 'auto' : 'smooth' }); + } + + togglePause() { + if (!this.active) return; + if (this.paused) { + // Neu ab aktuellem Satz – zuverlässiger als resume() auf allen Geräten + this.paused = false; + this.#speakFrom(this.index); + } else { + this.paused = true; + this.#run++; + speechSynthesis.cancel(); + } + } + + step(delta: number) { + if (!this.active) return; + const next = Math.min(Math.max(this.index + delta, 0), this.total - 1); + this.index = next; + this.#highlight(next); + if (!this.paused) this.#speakFrom(next); + } + + toggleRate() { + this.slow = !this.slow; + try { + localStorage.setItem(RATE_KEY, this.slow ? 'slow' : 'normal'); + } catch { + /* ohne Speicher */ + } + if (this.active && !this.paused) this.#speakFrom(this.index); + } + + stop() { + this.#run++; + if (this.supported) speechSynthesis.cancel(); + if (typeof CSS !== 'undefined' && 'highlights' in CSS) CSS.highlights.delete(HIGHLIGHT); + this.active = false; + this.paused = false; + this.index = 0; + this.total = 0; + } +} + +export const speech = new Speech(); diff --git a/src/routes/(app)/+error.svelte b/src/routes/(app)/+error.svelte index b02b19e..d85b9e3 100644 --- a/src/routes/(app)/+error.svelte +++ b/src/routes/(app)/+error.svelte @@ -3,6 +3,8 @@ import CircleHelp from '@lucide/svelte/icons/circle-help'; +{page.status === 404 ? 'Nicht gefunden' : 'Fehler'} +

{page.status === 404 ? 'Nicht gefunden' : 'Hoppla!'}

diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index 9e2b801..ad5316c 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -7,6 +7,9 @@ import Bookmark from '@lucide/svelte/icons/bookmark'; import Menu from '@lucide/svelte/icons/menu'; import Search from '@lucide/svelte/icons/search'; + import Volume2 from '@lucide/svelte/icons/volume-2'; + import ReadAloudBar from '$lib/components/ReadAloudBar.svelte'; + import { speech } from '$lib/speech.svelte'; import MenuSheet from '$lib/components/MenuSheet.svelte'; import { favorites } from '$lib/favorites.svelte'; @@ -67,6 +70,17 @@ {/each} + {#if speech.supported} + + {/if} @@ -120,4 +134,6 @@
+ + diff --git a/src/routes/(app)/meldungen/+page.svelte b/src/routes/(app)/meldungen/+page.svelte index ffc3703..29cbee7 100644 --- a/src/routes/(app)/meldungen/+page.svelte +++ b/src/routes/(app)/meldungen/+page.svelte @@ -14,7 +14,7 @@ {#if data.items.length}
{#each data.items as p (p.id)} - + {/each}
diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte new file mode 100644 index 0000000..5c266c2 --- /dev/null +++ b/src/routes/+error.svelte @@ -0,0 +1,13 @@ + + +{page.status === 404 ? 'Nicht gefunden' : 'Fehler'} + +
+
+

{page.status === 404 ? 'Nicht gefunden' : 'Da ist etwas schiefgelaufen'}

+

{page.error?.message ?? 'Bitte versuche es noch einmal.'}

+ Zur Startseite +
+
diff --git a/src/routes/admin/(panel)/+error.svelte b/src/routes/admin/(panel)/+error.svelte new file mode 100644 index 0000000..1cd4a06 --- /dev/null +++ b/src/routes/admin/(panel)/+error.svelte @@ -0,0 +1,13 @@ + + +{page.status === 404 ? 'Nicht gefunden' : 'Fehler'} · Redaktion + +
+ +

{page.status === 404 ? 'Nicht gefunden' : 'Da ist etwas schiefgelaufen'}

+

{page.error?.message ?? 'Bitte versuche es noch einmal.'}

+ Zur Übersicht +
diff --git a/src/routes/admin/(panel)/+layout.svelte b/src/routes/admin/(panel)/+layout.svelte index c060a2d..4d62a1d 100644 --- a/src/routes/admin/(panel)/+layout.svelte +++ b/src/routes/admin/(panel)/+layout.svelte @@ -65,6 +65,8 @@ Redaktion · {data.brand.appName} +Zum Inhalt springen +
@@ -77,6 +79,7 @@ {/if} -
+
{@render children()}
diff --git a/src/routes/admin/(panel)/konto/+page.svelte b/src/routes/admin/(panel)/konto/+page.svelte index 42740bd..1655ef7 100644 --- a/src/routes/admin/(panel)/konto/+page.svelte +++ b/src/routes/admin/(panel)/konto/+page.svelte @@ -2,12 +2,19 @@ import PageHeader from '$lib/admin/PageHeader.svelte'; import EditForm from '$lib/admin/EditForm.svelte'; import Panel from '$lib/admin/Panel.svelte'; + import PrefsControls from '$lib/components/PrefsControls.svelte'; let { data } = $props(); +
+

Anzeige

+

Gilt für dieses Gerät – in der Redaktion und in der App. Wird sofort übernommen.

+ +
+