feat: design system with light/dark themes and icon-first UI

Adds a real design system to replace the per-route ad-hoc styling:

- docs/design-system.md is the contract. Semantic CSS custom-property
  tokens (color/type/spacing/radii/shadows/z-index) with verified WCAG
  AA/AAA contrast ratios for both themes.
- frontend/src/lib/styles/tokens.css defines :root tokens + a
  [data-theme="dark"] override + base element resets, a .form-field
  helper, and a global prefers-reduced-motion rule.
- frontend/src/lib/theme.svelte.ts is a Svelte 5 runes store backing
  the theme state machine (system | light | dark). localStorage key
  'mangalord-theme'; matchMedia subscription that re-resolves on OS
  theme change while in 'system' mode; init() / destroy() lifecycle
  wired from +layout.svelte.
- frontend/src/app.html runs a synchronous inline script before
  %sveltekit.head% to set [data-theme] before first paint. No FOUC.
- /settings gains a System / Light / Dark radiogroup (real fieldset +
  legend + radios with lucide icons).
- Every route's <style> block is rewritten to consume tokens — home,
  auth, upload (drop-zone + page list), bookmarks, manga overview,
  reader.
- @lucide/svelte icons replace ad-hoc text controls per the spec:
  Search (icon-only primary), LogOut (icon-only muted), Upload /
  Bookmarks / Settings nav inline icons, ChevronLeft/Right for the
  reader, ArrowUp/Down/Trash2 for the upload page list. The bookmark
  toggle keeps its '☆ Bookmark' / '★ Bookmarked' text verbatim.
- Home search controls split into two rows: input + Search CTA on
  row 1, Sort (and future filters) on row 2.

Accessibility: every icon-only button carries aria-label, every
decorative SVG aria-hidden; existing image alt text preserved;
focus-visible rings reach every interactive element including the
visually-hidden theme radios; color is never the sole conveyor.

Version bump 0.12.0 → 0.13.0 across backend/Cargo.toml and
frontend/package.json (feat: → minor per CLAUDE.md).

Bars: svelte-check 0/0, vitest 51/51, playwright 18/18, cargo test
88/88, clippy -D warnings clean. Two rounds of independent review;
verdict ship-ready.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-05-17 11:52:58 +02:00
parent f0e57b0615
commit 567d56bfa1
17 changed files with 1271 additions and 237 deletions

View File

@@ -1,5 +1,6 @@
<script lang="ts">
import { fileUrl } from '$lib/api/client';
import BookImage from '@lucide/svelte/icons/book-image';
let { data } = $props();
const authenticated = $derived(data.authenticated);
@@ -14,15 +15,15 @@
<h1>Bookmarks</h1>
{#if error}
<p role="alert" data-testid="bookmarks-error">
<p class="error" role="alert" data-testid="bookmarks-error">
Couldn't load bookmarks: {error}
</p>
{:else if !authenticated}
<p data-testid="bookmarks-signin">
<p class="hint" data-testid="bookmarks-signin">
<a href="/login">Sign in</a> to see your bookmarks.
</p>
{:else if bookmarks.length === 0}
<p data-testid="bookmarks-empty">No bookmarks yet.</p>
<p class="hint" data-testid="bookmarks-empty">No bookmarks yet.</p>
{:else}
<ul class="bookmark-list" data-testid="bookmark-list">
{#each bookmarks as b (b.id)}
@@ -36,7 +37,9 @@
loading="lazy"
/>
{:else}
<div class="cover cover-placeholder">📖</div>
<div class="cover cover-placeholder">
<BookImage size={22} aria-hidden="true" />
</div>
{/if}
</a>
<div class="meta">
@@ -75,52 +78,74 @@
.bookmark-list {
list-style: none;
padding: 0;
margin: 0;
}
.bookmark {
display: grid;
grid-template-columns: 64px 1fr;
gap: 1rem;
gap: var(--space-4);
align-items: start;
padding: 0.75rem 0;
border-bottom: 1px solid #eee;
padding: var(--space-3) 0;
border-bottom: 1px solid var(--border);
}
.cover-link {
display: block;
line-height: 0;
}
.cover {
width: 64px;
height: 96px;
object-fit: cover;
border-radius: 4px;
background: #f0f0f0;
border-radius: var(--radius-md);
background: var(--surface);
}
.cover-placeholder {
display: flex;
align-items: center;
justify-content: center;
font-size: 1.5rem;
color: #999;
color: var(--text-muted);
user-select: none;
}
.meta {
display: flex;
flex-direction: column;
gap: 0.15rem;
gap: var(--space-1);
min-width: 0;
}
.title {
font-weight: 600;
font-size: 1rem;
font-weight: var(--weight-semibold);
font-size: var(--font-base);
color: var(--text);
}
.title:hover {
color: var(--primary);
}
.target {
font-size: 0.95rem;
font-size: var(--font-sm);
}
.muted {
color: #888;
color: var(--text-muted);
}
.created {
color: #888;
font-size: 0.85rem;
color: var(--text-muted);
font-size: var(--font-xs);
}
.error {
color: var(--danger);
}
.hint {
color: var(--text-muted);
}
</style>