gioser

tawasuyu/llimphi

Sovereign retained-mode GPU UI framework in Rust (wgpu+vello+taffy+parley), Elm loop, 40+ widgets.

Rust 660Markdown 302TOML 157RON 312382 Sutichaykuna

⎇ dba855e446ca2bd4e7d146bdc168fb232cad15a4 widgets/wawa-mark/examples/wawa_mark_demo.rs Rust · 85 siq'ikuna · 2.4 KB Ñawpa willay Pi imata llamkarqan ch'uya

feat: llimphi standalone — framework UI soberano extraído del monorepo e65e9cc62 · Sergio ·

1//! Demo del sello wawa. Tres tamaños sobre fondo oscuro neutro.
2//!
3//! `cargo run -p llimphi-widget-wawa-mark --example wawa_mark_demo --release`
4
5use llimphi_ui::llimphi_layout::taffy::{
6    prelude::{length, percent, FlexDirection, Size, Style},
7    AlignItems, JustifyContent, Rect,
8};
9use llimphi_ui::llimphi_raster::peniko::Color;
10use llimphi_ui::{App, Handle, View};
11use llimphi_widget_wawa_mark::{wawa_mark_view, WawaMarkPalette};
12
13struct Demo;
14
15impl App for Demo {
16    type Model = ();
17    type Msg = ();
18
19    fn title() -> &'static str {
20        "wawa · sello"
21    }
22
23    fn initial_size() -> (u32, u32) {
24        (820, 420)
25    }
26
27    fn init(_: &Handle<Self::Msg>) {}
28    fn update(model: Self::Model, _: Self::Msg, _: &Handle<Self::Msg>) -> Self::Model {
29        model
30    }
31
32    fn view(_: &Self::Model) -> View<Self::Msg> {
33        let palette = WawaMarkPalette::default();
34
35        let frame = |side: f32| -> View<()> {
36            View::new(Style {
37                size: Size {
38                    width: length(side),
39                    height: length(side),
40                },
41                align_items: Some(AlignItems::Center),
42                justify_content: Some(JustifyContent::Center),
43                ..Default::default()
44            })
45            .children(vec![wawa_mark_view(&palette)])
46        };
47
48        let row = View::new(Style {
49            flex_direction: FlexDirection::Row,
50            size: Size {
51                width: percent(1.0_f32),
52                height: percent(1.0_f32),
53            },
54            align_items: Some(AlignItems::Center),
55            justify_content: Some(JustifyContent::SpaceEvenly),
56            gap: Size {
57                width: length(24.0_f32),
58                height: length(0.0_f32),
59            },
60            ..Default::default()
61        })
62        .children(vec![frame(72.0), frame(160.0), frame(288.0)]);
63
64        View::new(Style {
65            size: Size {
66                width: percent(1.0_f32),
67                height: percent(1.0_f32),
68            },
69            padding: Rect {
70                left: length(32.0_f32),
71                right: length(32.0_f32),
72                top: length(32.0_f32),
73                bottom: length(32.0_f32),
74            },
75            ..Default::default()
76        })
77        // Fondo grafito neutro para que el rombo destaque sin competir.
78        .fill(Color::from_rgba8(18, 18, 22, 255))
79        .children(vec![row])
80    }
81}
82
83fn main() {
84    llimphi_ui::run::<Demo>();
85}