moar flat

This commit is contained in:
facile pop culture reference 2026-08-01 17:52:37 +03:00
parent fc01fd6ad3
commit a27dacff93
29 changed files with 649 additions and 582 deletions

View file

@ -2,7 +2,7 @@
use ::tengri::{
*,
lang::*,
dizzle::*,
crossterm::event::{KeyEvent, Event::*, KeyCode::*},
ratatui::style::Color,
};
@ -13,8 +13,8 @@ tui_app!(State {
});
tui_view!(self: State {
thunk(|to: &mut Tui|{
let _ = "DEMO [MODE 00]".align_sw().draw(to);
draw(|to: &mut Tui|{
let _ = "Demo [Mode 00]".align_sw().draw(to);
let _ = ShowSize.align_se().draw(to);
let _ = format!("Counter:\n{}", self.counter).align_c().draw(to);
Ok(Some(to.area()))

View file

@ -1,9 +1,8 @@
//! Mode 01: Direct view, actions with history
use itertools::Itertools;
use ::tengri::{
*,
lang::*,
dizzle::{*, itertools::Itertools},
crossterm::event::{Event::*, KeyEvent, KeyCode::*},
ratatui::style::Color,
};
@ -28,7 +27,7 @@ tui_keys!(self: State, input {
});
tui_view!(self: State {
let title = "Demo Mode 00";
let title = "Demo [Mode 01]";
let items = self.history.iter().take(10).map(|x|format!("{x:?}")).join("\n");
let history = format!("History: {}\n{items}", self.history.len());
let cursor = format!("Counter: {}", self.cursor);

View file

@ -2,7 +2,7 @@
use ::tengri::{
*,
lang::*,
dizzle::*,
crossterm::event::{Event::*, KeyEvent, KeyCode::*},
ratatui::style::Color,
};
@ -20,11 +20,15 @@ tui_view!(self: State {
let index = self.cursor + 1;
let wh = (self.size.w(), self.size.h());
let src = VIEWS.get(self.cursor).unwrap_or(&"");
let heading = format!("State {}/{} in {:?}", index, VIEWS.len(), &wh);
let title = bg(Color::Rgb(60, 10, 10), heading.align_n().push_xy(2, 1)).exact_h(3);
let code = bg(Color::Rgb(10, 60, 10), format!("Source:\n{}", src).align_n().push_xy(2, 1)).min_h(4);
let widget = thunk(move|to: &mut Tui|self.interpret(to, &src));
self.size.of(east(south(title, code).max_w(40), widget))
let heading = format!("Demo [Mode 02]\nExample {}/{}\nSize {:?}", index, VIEWS.len(), &wh);
let title = bg(Color::Rgb(60, 10, 10), heading);
let code = bg(Color::Rgb(10, 60, 10), format!("Source:\n{}", src).max_h(10));
let widget = draw(move|to: &mut Tui|self.interpret(to, &src)); // FIXME this forcefills
let sidebar = bg(Color::Rgb(20, 20, 20), north(code, title)).max_w(40);
let content = bg(Color::Rgb(64, 64, 64), widget);
east(sidebar, content)
//self.size.of(bg(Color::Rgb(10, 10, 10), south(east(sidebar, content), code)).full_w())
//self.size.of(bg(Color::Rgb(10, 10, 10), east(sidebar, content)).full_w())
});
impl Interpret<Tui, Option<XYWH<u16>>> for State {