aura-gui 0.2.1

UI nativa acelerada por GPU para escritorio, Android e iOS, en un solo crate: estilo tipo Tailwind, componentes, sombras, animaciones y agentes de IA. Reposo a cero. Licencia AGPL-3.0 o comercial.
//! El ejemplo del README debe compilar y comportarse como dice.

use aura_ui::core::{InputEvent, MouseButton};
use aura_ui::view::prelude::*;
use aura_ui::widgets::{Button, ButtonVariant};

struct Contador {
    clics: u32,
}

impl Render for Contador {
    fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement {
        div()
            .size_full()
            .flex_col()
            .items_center()
            .justify_center()
            .gap_4()
            .bg(Token::Canvas)
            .child(
                div()
                    .p_6()
                    .rounded_lg()
                    .border_1()
                    .bg(Token::ElevatedSurface)
                    .shadow_md()
                    .text_lg()
                    .child(format!("Clics: {}", self.clics)),
            )
            .child(Button::new("Sumar").variant(ButtonVariant::Primary).on_click(cx.listener(
                |this: &mut Contador, _: &ClickEvent, cx| {
                    this.clics += 1;
                    cx.notify();
                },
            )))
            .into_element()
    }
}

#[test]
fn readme_counter_is_centered_and_clickable() {
    let mut window = Window::new(Theme::dark(), Size::new(px(400.0), px(300.0)), 1.0);
    let handle = window.set_root(Contador { clics: 0 });
    window.draw(None);

    let scene = window.scene();
    assert_eq!(scene.shadows.len(), 1, "shadow_md genera una sombra SDF");
    let button = scene.quads.last().expect("el botón pinta un quad");
    let [x, y, width, height] = button.bounds;
    assert!((x + width / 2.0 - 200.0).abs() < 1.0, "el botón está centrado en horizontal");

    let center = Point::new(px(x + width / 2.0), px(y + height / 2.0));
    window.handle_event(&InputEvent::MouseDown { position: center, button: MouseButton::Left });
    window.handle_event(&InputEvent::MouseUp { position: center, button: MouseButton::Left });
    assert_eq!(window.entities.read(handle).map(|view| view.clics), Some(1));
}