wip: fix(dsl): maybe getting somewhere?
Some checks are pending
/ build (push) Waiting to run

This commit is contained in:
🪞👃🪞 2025-06-21 13:48:45 +03:00
parent 91dc77cfea
commit 11f686650f
19 changed files with 964 additions and 918 deletions

View file

@ -33,23 +33,23 @@ const EXAMPLES: &'static [&'static str] = &[
];
handle!(TuiIn: |self: Example, input|{
Ok(if let Some(command) = SourceIter::new(KEYMAP).command::<_, ExampleCommand, _>(self, input) {
Ok(None)/*if let Some(command) = CstIter::new(KEYMAP).command::<_, ExampleCommand, _>(self, input) {
command.execute(self)?;
Some(true)
} else {
None
})
})*/
});
#[tengri_proc::expose]
impl Example {
fn _todo_u16_stub (&self) -> u16 { todo!() }
fn _todo_bool_stub (&self) -> bool { todo!() }
fn _todo_usize_stub (&self) -> usize { todo!() }
//[bool] => {}
//[u16] => {}
//[usize] => {}
}
//#[tengri_proc::expose]
//impl Example {
//fn _todo_u16_stub (&self) -> u16 { todo!() }
//fn _todo_bool_stub (&self) -> bool { todo!() }
//fn _todo_usize_stub (&self) -> usize { todo!() }
////[bool] => {}
////[u16] => {}
////[usize] => {}
//}
#[tengri_proc::command(Example)]
impl ExampleCommand {
@ -70,31 +70,31 @@ content!(TuiOut: |self: Example|{
let heading = format!("Example {}/{} in {:?}", index, EXAMPLES.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, TokenIter::new(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)))
});
#[tengri_proc::view(TuiOut)]
impl Example {
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, EXAMPLES.len())))).boxed()
}
pub fn code (&self) -> impl Content<TuiOut> + use<'_> {
Tui::bg(Color::Rgb(10, 60, 10), Push::y(2, Align::n(format!("{}", EXAMPLES[self.0])))).boxed()
}
pub fn hello (&self) -> impl Content<TuiOut> + use<'_> {
Tui::bg(Color::Rgb(10, 100, 10), "Hello").boxed()
}
pub fn world (&self) -> impl Content<TuiOut> + use<'_> {
Tui::bg(Color::Rgb(100, 10, 10), "world").boxed()
}
pub fn hello_world (&self) -> impl Content<TuiOut> + use<'_> {
"Hello world!".boxed()
}
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 Content<TuiOut> + use<'_> {
Map::south(5u16, ||0..5u16, |n, _i|format!("{n}")).boxed()
}
}
//#[tengri_proc::view(TuiOut)]
//impl Example {
//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, EXAMPLES.len())))).boxed()
//}
//pub fn code (&self) -> impl Content<TuiOut> + use<'_> {
//Tui::bg(Color::Rgb(10, 60, 10), Push::y(2, Align::n(format!("{}", EXAMPLES[self.0])))).boxed()
//}
//pub fn hello (&self) -> impl Content<TuiOut> + use<'_> {
//Tui::bg(Color::Rgb(10, 100, 10), "Hello").boxed()
//}
//pub fn world (&self) -> impl Content<TuiOut> + use<'_> {
//Tui::bg(Color::Rgb(100, 10, 10), "world").boxed()
//}
//pub fn hello_world (&self) -> impl Content<TuiOut> + use<'_> {
//"Hello world!".boxed()
//}
//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 Content<TuiOut> + use<'_> {
//Map::south(5u16, ||0..5u16, |n, _i|format!("{n}")).boxed()
//}
//}