feat(yahweh-widget-theme-switcher): control para ciclar themes en runtime

Iter 6. Cierra el ciclo del theme: ya teníamos paleta themed +
widgets que la consumen, faltaba el control UI para rotar entre
presets en vivo. Ahora hay un botón yahweh que muestra el theme
actual y al click avanza al siguiente.

crates/modules/ui_engine/widgets/theme-switcher/:
- pub fn theme_switcher(cx: &mut App) -> impl IntoElement: botón
  clickable con bg=panel_alt, hover=row_hover, label "Tema: <name> ▸".
  Al click hace Theme::set(cx, Theme::next_after(current.name)).
- 2 tests #[gpui::test]: smoke + verificación de cambio de global.
- Dev-dep gpui con test-support.

Migración:
- nakui-explorer: header pasa a flex_row con label flex_grow + switcher
  alineado derecha.
- yahweh-widget-meta-form (sidebar): mismo pattern en el header
  "Nakui" del sidebar.

Tests stack: 115 → 117.

Beneficio: click cambia toda la paleta en vivo. 6 presets disponibles
(Nebula, Aurora, Sunset, Flat Dark, Solarized Light, High Contrast)
ciclables circularmente.

Limitación: TextInput entities tienen colors hardcoded; migrar
text_input al theme es iter futura.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Sergio
2026-05-10 10:37:49 +00:00
parent 5885457628
commit 8fdef818cc
9 changed files with 188 additions and 2 deletions
@@ -13,6 +13,7 @@ yahweh-meta-runtime = { path = "../../libs/meta-runtime" }
yahweh-meta-schema = { path = "../../libs/meta-schema" }
yahweh-theme = { path = "../../libs/theme" }
yahweh-widget-banner = { path = "../banner" }
yahweh-widget-theme-switcher = { path = "../theme-switcher" }
yahweh-widget-text-input = { path = "../text_input" }
[dev-dependencies]
@@ -37,6 +37,7 @@ use yahweh_meta_schema::{Action, FieldKind, FieldSpec, FormView, ListView, Modul
use yahweh_theme::Theme;
use yahweh_widget_banner::{banner_themed, themed_colors, Banner};
use yahweh_widget_text_input::TextInput;
use yahweh_widget_theme_switcher::theme_switcher;
/// Estado del runtime de UI. Toda la persistencia/ejecución está
/// detrás del trait [`MetaBackend`]; este struct sólo conoce GPUI
@@ -633,13 +634,18 @@ impl<B: MetaBackend> MetaApp<B> {
.flex()
.flex_col();
// Sidebar header: título + theme switcher en una row.
sidebar = sidebar.child(
div()
.flex()
.flex_row()
.items_center()
.px(px(12.))
.py(px(10.))
.text_color(text)
.text_size(px(13.))
.child("Nakui"),
.child(div().flex_grow().child("Nakui"))
.child(theme_switcher(cx)),
);
if self.modules.is_empty() {