fold tui under main crate

This commit is contained in:
same mf who else 2026-02-21 16:18:52 +02:00
parent c1011ddb7f
commit 85ccb0737f
11 changed files with 66 additions and 79 deletions

View file

@ -17,13 +17,9 @@ version = "0.14.0"
edition = "2024" edition = "2024"
[workspace.dependencies] [workspace.dependencies]
dizzle = { path = "../dizzle" } dizzle = { path = "../dizzle" }
tengri = { path = "./tengri" }
tengri = { path = "./tengri" } tengri_proc = { path = "./proc" }
tengri_input = { path = "./input" }
tengri_output = { path = "./output" }
tengri_tui = { path = "./tui" }
tengri_proc = { path = "./proc" }
anyhow = { version = "1.0" } anyhow = { version = "1.0" }
atomic_float = { version = "1" } atomic_float = { version = "1" }

View file

@ -881,3 +881,18 @@ impl<E: Engine, S, C: Command<S>> MenuItem<E, S, C> {
//} //}
//self //self
//} //}
//#[test] fn test_parse_key () {
////use KeyModifiers as Mods;
//let _test = |x: &str, y|assert_eq!(KeyMatcher::new(x).build(), Some(Event::Key(y)));
////test(":x",
////KeyEvent::new(KeyCode::Char('x'), Mods::NONE));
////test(":ctrl-x",
////KeyEvent::new(KeyCode::Char('x'), Mods::CONTROL));
////test(":alt-x",
////KeyEvent::new(KeyCode::Char('x'), Mods::ALT));
////test(":shift-x",
////KeyEvent::new(KeyCode::Char('x'), Mods::SHIFT));
////test(":ctrl-alt-shift-x",
////KeyEvent::new(KeyCode::Char('x'), Mods::CONTROL | Mods::ALT | Mods::SHIFT ));
//}

View file

@ -47,3 +47,10 @@ it expresses the following notions:
* sizing: `Fill`, `Fixed`, `Expand`, `Shrink`, `Min`, `Max` * sizing: `Fill`, `Fixed`, `Expand`, `Shrink`, `Min`, `Max`
* implement custom components (that may be backend-dependent): * implement custom components (that may be backend-dependent):
[see `tui_content` in `tengri_tui`](../tui/src/tui_content) [see `tui_content` in `tengri_tui`](../tui/src/tui_content)
## TUI
***tengri_tui*** implements [tengri_output](../output) and [tengri_input](../input)
on top of [ratatui](https://ratatui.rs/) and [crossterm](https://github.com/crossterm-rs/crossterm).
tengri is published under [**AGPL3**](../LICENSE).

View file

@ -10,43 +10,52 @@
#![feature(trait_alias)] #![feature(trait_alias)]
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
#![feature(type_changing_struct_update)] #![feature(type_changing_struct_update)]
//#![feature(non_lifetime_binders)]
//pub(crate) use quanta::Clock;
pub extern crate atomic_float;
pub(crate) use atomic_float::AtomicF64;
pub extern crate ratatui; pub(crate) use ::ratatui::{
prelude::{Color, Style, Buffer, Position},
style::{Stylize, Modifier, Color::*},
backend::{Backend, CrosstermBackend, ClearType},
layout::{Size, Rect},
buffer::Cell
};
pub extern crate crossterm;
pub(crate) use ::crossterm::{
ExecutableCommand,
terminal::{EnterAlternateScreen, LeaveAlternateScreen, enable_raw_mode, disable_raw_mode},
event::{poll, read, Event, KeyEvent, KeyCode, KeyModifiers, KeyEventKind, KeyEventState},
};
pub extern crate palette;
pub(crate) use ::palette::{*, convert::*, okhsl::*};
pub extern crate better_panic;
pub(crate) use better_panic::{Settings, Verbosity};
pub extern crate unicode_width;
pub(crate) use unicode_width::*;
//#[cfg(test)] extern crate tengri_proc;
mod tengri_impl; mod tengri_impl;
mod tengri_type; pub use self::tengri_type::*; mod tengri_type; pub use self::tengri_type::*;
mod tengri_trait; pub use self::tengri_trait::*; mod tengri_trait; pub use self::tengri_trait::*;
mod tengri_struct; pub use self::tengri_struct::*; mod tengri_struct; pub use self::tengri_struct::*;
//pub(crate) use quanta::Clock;
pub extern crate atomic_float; pub(crate) use atomic_float::AtomicF64; #[macro_export] pub extern crate dizzle;
pub extern crate ratatui; pub use dizzle::*;
pub extern crate crossterm;
pub extern crate palette;
pub extern crate better_panic;
extern crate dizzle; pub use dizzle::*;
#[cfg(test)] extern crate tengri_proc;
use std::{time::Duration, thread::{spawn, JoinHandle}, io::Write}; use std::{time::Duration, thread::{spawn, JoinHandle}, io::Write};
use unicode_width::*; pub(crate) use ::std::{
pub(crate) use ::{ io::{stdout, Stdout},
std::{ sync::{Arc, RwLock, atomic::{AtomicBool, AtomicUsize, Ordering::*}},
io::{stdout, Stdout}, fmt::{Debug, Display},
sync::{Arc, RwLock, atomic::{AtomicBool, AtomicUsize, Ordering::*}}, ops::{Add, Sub, Mul, Div},
fmt::{Debug, Display}, marker::PhantomData,
ops::{Add, Sub, Mul, Div},
marker::PhantomData,
},
better_panic::{Settings, Verbosity},
palette::{*, convert::*, okhsl::*},
ratatui::{
prelude::{Color, Style, Buffer, Position},
style::{Stylize, Modifier, Color::*},
backend::{Backend, CrosstermBackend, ClearType},
layout::{Size, Rect},
buffer::Cell
},
crossterm::{
ExecutableCommand,
terminal::{EnterAlternateScreen, LeaveAlternateScreen, enable_raw_mode, disable_raw_mode},
event::{poll, read, Event, KeyEvent, KeyCode, KeyModifiers, KeyEventKind, KeyEventState},
}
}; };
// Define macros first, so that private macros are available in private modules: // Define macros first, so that private macros are available in private modules:

View file

@ -1,20 +0,0 @@
[package]
name = "tengri_tui"
description = "UI metaframework, Ratatui backend."
version = { workspace = true }
edition = { workspace = true }
[features]
dsl = [ "tengri_output/dsl" ]
bumpalo = [ "dep:bumpalo" ]
[dependencies]
dizzle = { workspace = true }
tengri_input = { workspace = true }
tengri_output = { workspace = true }
[dev-dependencies]
tengri = { workspace = true, features = [ "dsl" ] }
tengri_proc = { workspace = true }

View file

@ -1,4 +0,0 @@
***tengri_tui*** is an implementation of [tengri_output](../output) and [tengri_input](../input)
on top of [ratatui](https://ratatui.rs/) and [crossterm](https://github.com/crossterm-rs/crossterm).
tengri is published under [**AGPL3**](../LICENSE).

View file

View file

View file

@ -1,16 +0,0 @@
use crate::*;
//#[test] fn test_parse_key () {
////use KeyModifiers as Mods;
//let _test = |x: &str, y|assert_eq!(KeyMatcher::new(x).build(), Some(Event::Key(y)));
////test(":x",
////KeyEvent::new(KeyCode::Char('x'), Mods::NONE));
////test(":ctrl-x",
////KeyEvent::new(KeyCode::Char('x'), Mods::CONTROL));
////test(":alt-x",
////KeyEvent::new(KeyCode::Char('x'), Mods::ALT));
////test(":shift-x",
////KeyEvent::new(KeyCode::Char('x'), Mods::SHIFT));
////test(":ctrl-alt-shift-x",
////KeyEvent::new(KeyCode::Char('x'), Mods::CONTROL | Mods::ALT | Mods::SHIFT ));
//}