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
@@ -7,3 +7,4 @@ description = "Yahweh — widget card: container con padding + rounded + flex_co
[dependencies]
gpui = { workspace = true }
yahweh-theme = { path = "../../libs/theme" }
@@ -30,7 +30,8 @@
#![forbid(unsafe_code)]
use gpui::{div, prelude::*, px, Div};
use gpui::{div, prelude::*, px, App, Div};
use yahweh_theme::Theme;
/// Container card-shape: `flex_col` con padding `12/8`, `rounded(4)`,
/// `gap(2)` interno entre children y `mb(4)` para separación
@@ -52,6 +53,18 @@ pub fn card() -> Div {
.gap(px(2.))
}
/// Variante themed: igual que [`card`] pero pre-aplica `bg(panel)`
/// del [`Theme`] global. El caller no necesita conocer la paleta —
/// el bg sigue al theme actual cuando éste cambia.
///
/// Si la app no instaló un Theme, esta función panicea (gpui's
/// `cx.global::<Theme>()` requiere el global instalado). Para apps
/// sin theme, usar [`card`] directo.
pub fn card_themed(cx: &App) -> Div {
let theme = Theme::global(cx);
card().bg(theme.bg_panel.clone())
}
#[cfg(test)]
mod tests {
use super::*;