refactor(shared-tailwind): rewrite themes.css to single-layer shadcn convention

Pre-launch theme system audit found multiple parallel layers in themes.css
(--theme-X full hsl strings, --X partial shadcn aliases, --color-X populated
by runtime store with raw channels) plus dead-code companion files. The
inconsistency caused light-mode regressions when scoped-CSS consumers
wrote `var(--color-X)` standalone — the variable holds raw HSL channels
which is invalid as a color value, browser fell back to inherited (white).

Rewrite to one consistent layer:

  - Source of truth: --color-X defined as raw HSL channels (e.g.
    `0 0% 17%`) in :root, .dark, and all variant [data-theme="..."]
    blocks. Matches the format the runtime store
    (@mana/shared-theme/src/utils.ts) writes, eliminating the
    static-fallback-vs-runtime mismatch and the corresponding flash
    of unstyled content on hydration.

  - @theme inline uses self-reference + Tailwind v4 <alpha-value>
    placeholder so utility classes generate correctly AND opacity
    modifiers work: `text-foreground/50` → `hsl(var(--color-foreground) / 0.5)`.

  - @layer components (.btn-primary, .card, .badge, etc.) wraps
    var(--color-X) refs with hsl() — they were broken in light mode
    too for the same reason.

Convention going forward (also documented in the file header):

  1. Markup: use Tailwind utility classes (text-foreground, bg-card, …)
  2. Scoped CSS: hsl(var(--color-X)) — always wrap with hsl()
  3. NEVER raw var(--color-X) in CSS — that's the bug pattern

Net file: 692 → 580 LOC. Single source layer, no indirection.

Also delete dead companion files (zero imports anywhere):
  - tailwind-v4.css (had broken self-reference, never imported)
  - theme-variables.css (legacy hex-based palette)
  - components.css (legacy component utilities)
  - index.js / preset.js / colors.js (Tailwind v3 preset format,
    irrelevant under Tailwind v4)

package.json exports map shrinks accordingly to just `./themes.css`.

Consumers using `hsl(var(--color-X))` (~379 files across mana-web,
manavoxel-web, arcade-web) keep working unchanged — the public API
name `--color-X` is preserved. Only the broken pattern `var(--color-X)`
(~61 files) needs a follow-up sweep, handled in a separate commit.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-04-09 01:13:06 +02:00
parent 3a3cd126cf
commit 919fcca4b7
63 changed files with 1072 additions and 5398 deletions

View file

@ -1,67 +1,17 @@
# News Hub — AI News Reader & Personal Library
# News Hub — consolidated into the unified Mana app
## Architecture
This product was migrated into the unified Mana monorepo. The legacy
per-product `apps/news/apps/server/` and `apps/news/apps/web/` directories
have been removed. Active code now lives in:
Local-first for saved articles, Hono/Bun server for content extraction and AI feed.
- **Backend compute routes**: [`apps/api/src/modules/news/routes.ts`](../api/src/modules/news/routes.ts) (Mozilla Readability extraction, AI feed)
- **Frontend module** (local-first): [`apps/mana/apps/web/src/lib/modules/news/`](../mana/apps/web/src/lib/modules/news/)
- **Web route**: [`apps/mana/apps/web/src/routes/(app)/news/`](../mana/apps/web/src/routes/(app)/news/)
- **Landing page** (still standalone): [`apps/news/apps/landing/`](apps/landing/)
```
Browser → IndexedDB (Saved Articles, Categories)
↕ sync
mana-sync → PostgreSQL
For monorepo-wide patterns (auth, sync, encryption, services), see the
[root `CLAUDE.md`](../../CLAUDE.md) and [`apps/mana/CLAUDE.md`](../mana/CLAUDE.md).
Browser → Hono Server → Content Extraction (Mozilla Readability)
→ AI Feed (from sync_changes)
```
## Project Structure
```
apps/news/
├── apps/
│ ├── web/ # SvelteKit web app (local-first)
│ ├── server/ # Hono/Bun (extraction, feed API)
│ └── landing/ # Astro marketing page
└── package.json
```
## Tech Stack
| Layer | Technology |
|-------|-----------|
| **Web** | SvelteKit 2, Svelte 5 (runes), Tailwind CSS 4 |
| **Server** | Hono + Bun, Mozilla Readability, JSDOM |
| **Data** | Local-first (Dexie.js + mana-sync) |
| **Auth** | mana-auth (Better Auth + EdDSA JWT) |
## Commands
```bash
pnpm dev:news:web # SvelteKit dev server
pnpm dev:news:server # Hono/Bun server (port 3071)
pnpm dev:news:local # Web + Sync + Server (no auth)
pnpm dev:news:full # Everything incl. auth
```
## Hono Server Routes
| Route | Auth | Description |
|-------|------|-------------|
| `GET /health` | No | Health check |
| `GET /api/v1/feed` | No | AI article feed (type, categoryId, limit, offset) |
| `GET /api/v1/feed/:id` | No | Single article |
| `POST /api/v1/extract/preview` | No | Preview URL content extraction |
| `POST /api/v1/extract/save` | JWT | Extract + return article data |
## Local-First Collections
| Collection | Purpose |
|-----------|---------|
| `articles` | Saved articles (user_saved) + AI feed cache |
| `categories` | Article categories |
## Key Patterns
- **Content Extraction**: Mozilla Readability + JSDOM for robust HTML parsing
- **Saved Articles**: Local-first via IndexedDB, sync to server
- **AI Feed**: Loaded from Hono server, not local-first (server-generated)
- **Auth**: Guest mode allowed, sync starts on login
The previous standalone "News Hub" guide was deleted in the audit cleanup
of 2026-04-09 — it had been inaccurate since the consolidation.
Pre-consolidation reference is in git history.

View file

@ -1,8 +1,5 @@
{
"name": "@mana/news",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "turbo run dev"
}
"private": true
}