feat(yahweh): theme integration en banner + card + nakui-explorer consume themed

Iter 4 de integración nakui↔yahweh. Los widgets banner y card
ofrecen variants _themed(cx, ...) que leen Theme::global(cx).
Versiones sin theme preservadas para apps sin theme global.

yahweh-widget-card:
- Nueva dep yahweh-theme.
- pub fn card_themed(cx: &App) -> Div: card() + bg(theme.bg_panel).

yahweh-widget-banner:
- Nueva dep yahweh-theme.
- pub fn banner_themed(cx, kind, msg) -> Div: deriva (bg, fg) según
  kind + theme.is_dark. Info usa accent del theme; Success/Warning/
  Error usan hue fijo (verde/amber/rojo) + lightness flippeada.
- pub fn themed_colors(kind, theme) -> (Background, Hsla) helper.
- 3 tests nuevos del derivation.

nakui-explorer:
- Nueva dep yahweh-theme.
- main() instala Theme::install_default antes de open_window.
- render: 5 vars rgb() locales → theme slots (bg_app/fg_text/etc).
- card() → card_themed(cx). banner() → banner_themed(cx).
- Accents semánticos del log (seed azul, morphism verde) quedan
  locales: son señales del dominio, no chrome.

Tests: 112 → 115 (+3). Stack intacto.

Beneficio: cambiar de Theme refleja en nakui-explorer automático.
Próximo candidato: migrar MetaApp (paleta hardcoded de 6 colors).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Sergio
2026-05-10 10:11:29 +00:00
parent 1be7bf9b1e
commit 9632d8c4a7
8 changed files with 200 additions and 25 deletions
+67
View File
@@ -6,6 +6,73 @@ ratio/diff ver `git show <sha>`.
## 2026-05-10
### feat(yahweh): theme integration en `banner` + `card` + `nakui-explorer` consume themed
Iter 4 de la integración. Los widgets `banner` y `card` ahora
ofrecen variants `_themed(cx, ...)` que leen `Theme::global(cx)`.
Las versiones sin theme se preservan para apps sin theme global.
`nakui-explorer` migra a versiones themed + `Theme::install_default`
al boot — el chrome hardcoded del explorer (5 variables `let bg =
rgb(...)`) sale del theme.
Cambios en `yahweh-widget-card`:
- **Nueva dep**: `yahweh-theme`.
- **`pub fn card_themed(cx: &App) -> Div`**: devuelve [`card`]
pre-aplicado con `bg(theme.bg_panel)`. El caller sigue componiendo
con borders, accents, children.
Cambios en `yahweh-widget-banner`:
- **Nueva dep**: `yahweh-theme`.
- **`pub fn banner_themed(cx: &App, kind, message) -> Div`**:
deriva `(bg, fg)` según `kind` + `theme.is_dark`:
- `Info`: `theme.bg_panel_alt` + `theme.accent`.
- `Success` / `Warning` / `Error`: hue fijo (verde/amber/rojo)
+ lightness flippeada según `is_dark` (dark = bg low, fg high;
light = invertido).
- **`pub fn themed_colors(kind, theme) -> (Background, Hsla)`**:
helper público para callers que quieren computar el par sin
construir el div.
- 3 tests nuevos del derivation: dark/light lightness contrast,
kinds distinguidos por hue.
Migración de `nakui-explorer`:
- Nueva dep `yahweh-theme`.
- `main()` llama `Theme::install_default(cx)` antes de open_window
(el theme default es Nebula).
- `render`:
- 5 `let bg/text/text_dim/card_bg/border = rgb(...)` colors
locales → `theme.bg_app/fg_text/fg_muted/bg_panel/border`.
- `card().bg(card_bg)``card_themed(cx)` (borra los locales).
- `banner(Banner::Error, ...)``banner_themed(cx, Banner::Error, ...)`.
- Los accents `accent_seed` / `accent_morphism` se preservan
locales: son **señales semánticas del log** (azul=seed,
verde=morphism), no chrome del app.
Distribución de tests: 112 → **115** (+3 del banner derivation).
Workspace stack pasó por la migración sin errores.
Beneficio operativo:
- Cambiar de Theme (Nebula → Aurora → Solarized Light, etc.) ahora
refleja en `nakui-explorer` automáticamente. Antes había que
buscar y reemplazar los hex codes uno a uno.
- Apps que adopten el patrón `_themed` heredan el switcher de
theme cuando emerja.
Decisiones:
- **Hue fijo por kind**: Success siempre verde, Error siempre rojo,
etc. La lightness se ajusta al theme; el hue se mantiene como
invariante semántico cross-theme.
- **API dual**: `banner` (defaults) + `banner_themed` (theme).
Apps sin theme global pueden seguir con la versión simple.
- **Acentos semánticos del explorer (seed/morphism) NO migran**:
pertenecen al dominio del log, no al chrome.
Próximas integraciones pendientes:
- `MetaApp` (en `yahweh-widget-meta-form`) tiene su propia paleta
hardcoded de 6 colors que podría migrarse al theme. Scope mayor
que esta iter; queda como candidato.
- Theme switcher widget (botón/menú en chrome para ciclar themes).
Cuando emerja la necesidad real.
### feat(yahweh-widget-card): container card-shape compartido para timeline entries
Iteración 3 de la integración nakui ↔ yahweh. El "card visual"
pattern (padding consistente + rounded + flex_col + gap) que vivía