diff --git a/README.md b/README.md index b438738..3d39ded 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,8 @@ Abra **http://127.0.0.1:8000**, cole a pasta dos repos — a detecção é autom │ ├── updater.py # download, troca, backup, rollback │ └── state.py # mapping / state / config por pasta (.alldown/) ├── static/ # front vanilla: index.html, tokens.css, components.css, -│ # shell.css, app.js, theme.js, contract/openapi.json +│ # components-optional.css (fora do crítico), shell.css, +│ # app.js, theme.js, contract/openapi.json ├── tests/js/ # testes do frontend (node --test, sem build) ├── pyproject.toml # lint e pytest └── requirements.txt @@ -109,7 +110,7 @@ Execute estes comandos antes de abrir pull request: ```bash .venv/bin/python -m pytest tests/ -q # 169 testes (backend + contrato) -node --test tests/js/*.test.mjs # 23 testes do frontend +node --test tests/js/*.test.mjs # 38 testes do frontend node --check static/app.js uvx --from ruff==0.16.8 ruff check app.py core tray.py tests/ uvx --from pyright==1.1.414 pyright --pythonpath .venv/bin/python app.py core tray.py diff --git a/STYLEGUIDE.md b/STYLEGUIDE.md index b926c69..d834ffa 100644 --- a/STYLEGUIDE.md +++ b/STYLEGUIDE.md @@ -11,11 +11,16 @@ Nenhum valor foi inventado. Se não está no CSS-fonte, não está aqui. | Arquivo | Conteúdo | |---|---| | `static/tokens.css` | Rampas, alfa, cores de estado, semânticos light/dark, elevação, raios, tipografia, movimento | -| `static/components.css` | Primitives com `data-component` / `data-slot` | +| `static/components.css` | Primitives em uso no caminho crítico (`button`, `input`, `switch`, `tag`, `segmented`, `avatar`, `card`, `toast`, `data-table`, `scroll-view`, …) | +| `static/components-optional.css` | Primitives fora do caminho crítico (`textarea`, `select`, `checkbox`, `tooltip`, `drawer`, `dialog`, `menu`) — **não** carregado por padrão, ~7KB gzip poupados | | `static/shell.css` | Grid do app, sidebar, header, page shell, as três telas | +| `static/theme.js` | Aplica o tema antes da primeira pintura (bloqueante, por causa da CSP) | +| `static/index.html` | Markup das três telas e a ordem de carga | | `STYLEGUIDE.md` | Este documento | -Ordem de carga no HTML: `tokens.css` → `components.css` → `shell.css`. +Ordem de carga no HTML: `theme.js` → `tokens.css` → `components.css` → `shell.css`. +Versão única `?v=3` nos quatro assets + `theme.js` (antes `?v=1`/`?v=2`/sem versão, +sempre inconsistente). `Cache-Control: immutable` no servidor para `?v=`. ## Convenção de atributos @@ -52,25 +57,49 @@ Estados de interação são dirigidos por `:hover` **e** por `[data-state=…]`, | `--v2-background-bg-accent` | `#3b5cf6` | `#3b5cf6` | | `--v2-text-text-base` | `#161616` | `#fafafa` | | `--v2-text-text-muted` | `#5c5c5c` | `#aeaeae` | -| `--v2-text-text-faint` | `#808080` | `#808080` | +| `--v2-text-text-faint` | `#6b6b6b` | `#999999` | | `--v2-text-text-accent` | `#3b5cf6` | `#a2bcff` | | `--v2-icon-icon-base` | `#3a3a3a` | `#dbdbdb` | | `--v2-icon-icon-muted` | `#808080` | `#808080` | | `--v2-border-border-muted` | `rgba(0,0,0,.08)` | `rgba(255,255,255,.08)` | | `--v2-border-border-base` | `rgba(0,0,0,.10)` | `rgba(255,255,255,.10)` | | `--v2-border-border-strong` | `rgba(0,0,0,.20)` | `rgba(255,255,255,.20)` | -| `--v2-border-border-focus` | `#7698fd` | `#7698fd` | +| `--v2-border-border-focus` | `#3250df` | `#c3d4fd` | | `--v2-overlay-simple-overlay-hover` | `rgba(0,0,0,.04)` | `rgba(255,255,255,.06)` | | `--v2-overlay-simple-overlay-pressed` | `rgba(0,0,0,.08)` | `rgba(255,255,255,.10)` | | `--v2-overlay-simple-overlay-scrim` | `rgba(0,0,0,.4)` | `rgba(0,0,0,.6)` | -| `--v2-state-bg-success` / `fg` | `#e7f9ea` / `#198b43` | `#14361d` / `#6bd586` | -| `--v2-state-bg-warning` / `fg` | `#fefaec` / `#cb9f34` | `#4b4025` / `#f2cf76` | +| `--v2-state-bg-success` / `fg` | `#e7f9ea` / `#1d783c` | `#14361d` / `#6bd586` | +| `--v2-state-bg-warning` / `fg` | `#fefaec` / `#68552b` | `#4b4025` / `#f2cf76` | | `--v2-state-bg-danger` / `fg` | `#fceceb` / `#b82d35` | `#461516` / `#f17471` | | `--v2-state-bg-info` / `fg` | `#ecf1fe` / `#2c47c8` | `#1b2852` / `#7698fd` | -O tema vive em `[data-color-scheme="light" | "dark"]` no ``. Um script inline -antes da primeira pintura lê `localStorage["alldown.theme"]` e cai para -`prefers-color-scheme` — não há flash. +O tema vive em `[data-color-scheme="light" | "dark"]` no ``. O arquivo +`static/theme.js` roda **externo e bloqueante** no `
` (sem `defer`), antes da +primeira pintura: lê `localStorage["alldown.theme"]` e cai para `prefers-color-scheme` +— não há flash. + +> **Não mova isso para um ` + + + + + + + +