This commit is contained in:
🪞👃🪞 2025-09-09 01:07:19 +03:00
parent ca862b9802
commit 90fc869e14
42 changed files with 645 additions and 1158 deletions

View file

@ -28,19 +28,18 @@ impl ExampleCommand {
}
}
tui_draw!(|self: Example, to|{
to.place(&self.content());
});
content!(TuiOut: |self: Example|{
let index = self.0 + 1;
let wh = self.1.wh();
let src = Self::VIEWS.get(self.0).unwrap_or(&"");
let heading = format!("Example {}/{} in {:?}", index, Self::VIEWS.len(), &wh);
let title = Tui::bg(Color::Rgb(60, 10, 10), Push::y(1, Align::n(heading)));
let code = Tui::bg(Color::Rgb(10, 60, 10), Push::y(2, Align::n(format!("{}", src))));
let content = ();//Tui::bg(Color::Rgb(10, 10, 60), View(self, CstIter::new(src)));
self.1.of(Bsp::s(title, Bsp::n(""/*code*/, content)))
});
impl Draw<TuiOut> for Example {
fn content (&self) -> impl Draw<TuiOut> {
let index = self.0 + 1;
let wh = self.1.wh();
let src = Self::VIEWS.get(self.0).unwrap_or(&"");
let heading = format!("Example {}/{} in {:?}", index, Self::VIEWS.len(), &wh);
let title = Tui::bg(Color::Rgb(60, 10, 10), Push::y(1, Align::n(heading)));
let code = Tui::bg(Color::Rgb(10, 60, 10), Push::y(2, Align::n(format!("{}", src))));
let content = ();//Tui::bg(Color::Rgb(10, 10, 60), View(self, CstIter::new(src)));
self.1.of(Bsp::s(title, Bsp::n(""/*code*/, content)))
}
}
impl View<TuiOut, ()> for Example {
fn view_expr <'a> (&'a self, to: &mut TuiOut, expr: &'a impl DslExpr) -> Usually<()> {
if evaluate_output_expression(self, to, expr)?

View file

@ -12,25 +12,25 @@ fn main () {}
//#[tengri_proc::view(TuiOut)]
//impl Example {
//pub fn title (&self) -> impl Draw<TuiOut> + use<'_> {
//pub fn title (&self) -> impl Content<TuiOut> + use<'_> {
//Tui::bg(Color::Rgb(60, 10, 10), Push::y(1, Align::n(format!("Example {}/{}:", self.0 + 1, VIEWS.len())))).boxed()
//}
//pub fn code (&self) -> impl Draw<TuiOut> + use<'_> {
//pub fn code (&self) -> impl Content<TuiOut> + use<'_> {
//Tui::bg(Color::Rgb(10, 60, 10), Push::y(2, Align::n(format!("{}", VIEWS[self.0])))).boxed()
//}
//pub fn hello (&self) -> impl Draw<TuiOut> + use<'_> {
//pub fn hello (&self) -> impl Content<TuiOut> + use<'_> {
//Tui::bg(Color::Rgb(10, 100, 10), "Hello").boxed()
//}
//pub fn world (&self) -> impl Draw<TuiOut> + use<'_> {
//pub fn world (&self) -> impl Content<TuiOut> + use<'_> {
//Tui::bg(Color::Rgb(100, 10, 10), "world").boxed()
//}
//pub fn hello_world (&self) -> impl Draw<TuiOut> + use<'_> {
//pub fn hello_world (&self) -> impl Content<TuiOut> + use<'_> {
//"Hello world!".boxed()
//}
//pub fn map_e (&self) -> impl Draw<TuiOut> + use<'_> {
//pub fn map_e (&self) -> impl Content<TuiOut> + use<'_> {
//Map::east(5u16, ||0..5u16, |n, _i|format!("{n}")).boxed()
//}
//pub fn map_s (&self) -> impl Draw<TuiOut> + use<'_> {
//pub fn map_s (&self) -> impl Content<TuiOut> + use<'_> {
//Map::south(5u16, ||0..5u16, |n, _i|format!("{n}")).boxed()
//}
//}