From 85ccb0737f63df4c1d8d7274e904aa28d4dfe6a0 Mon Sep 17 00:00:00 2001 From: same mf who else Date: Sat, 21 Feb 2026 16:18:52 +0200 Subject: [PATCH] fold tui under main crate --- Cargo.toml | 10 ++-- tengri/.scratch.rs | 15 ++++++ tengri/README.md | 7 +++ {tui => tengri}/examples/tui_00.rs | 0 {tui => tengri}/examples/tui_01.rs | 0 tengri/tengri.rs | 73 +++++++++++++++++------------- tui/Cargo.toml | 20 -------- tui/README.md | 4 -- tui/src/.scratch.rs | 0 tui/src/lib.rs | 0 tui/src/tui_test.rs | 16 ------- 11 files changed, 66 insertions(+), 79 deletions(-) rename {tui => tengri}/examples/tui_00.rs (100%) rename {tui => tengri}/examples/tui_01.rs (100%) delete mode 100644 tui/Cargo.toml delete mode 100644 tui/README.md delete mode 100644 tui/src/.scratch.rs delete mode 100644 tui/src/lib.rs delete mode 100644 tui/src/tui_test.rs diff --git a/Cargo.toml b/Cargo.toml index a3a6d54..34b703a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,13 +17,9 @@ version = "0.14.0" edition = "2024" [workspace.dependencies] -dizzle = { path = "../dizzle" } - -tengri = { path = "./tengri" } -tengri_input = { path = "./input" } -tengri_output = { path = "./output" } -tengri_tui = { path = "./tui" } -tengri_proc = { path = "./proc" } +dizzle = { path = "../dizzle" } +tengri = { path = "./tengri" } +tengri_proc = { path = "./proc" } anyhow = { version = "1.0" } atomic_float = { version = "1" } diff --git a/tengri/.scratch.rs b/tengri/.scratch.rs index 55af234..0d0f833 100644 --- a/tengri/.scratch.rs +++ b/tengri/.scratch.rs @@ -881,3 +881,18 @@ impl> MenuItem { //} //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 )); +//} diff --git a/tengri/README.md b/tengri/README.md index 0aec24e..41cfef5 100644 --- a/tengri/README.md +++ b/tengri/README.md @@ -47,3 +47,10 @@ it expresses the following notions: * sizing: `Fill`, `Fixed`, `Expand`, `Shrink`, `Min`, `Max` * implement custom components (that may be backend-dependent): [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). diff --git a/tui/examples/tui_00.rs b/tengri/examples/tui_00.rs similarity index 100% rename from tui/examples/tui_00.rs rename to tengri/examples/tui_00.rs diff --git a/tui/examples/tui_01.rs b/tengri/examples/tui_01.rs similarity index 100% rename from tui/examples/tui_01.rs rename to tengri/examples/tui_01.rs diff --git a/tengri/tengri.rs b/tengri/tengri.rs index 87951d3..b1f8b58 100644 --- a/tengri/tengri.rs +++ b/tengri/tengri.rs @@ -10,43 +10,52 @@ #![feature(trait_alias)] #![feature(type_alias_impl_trait)] #![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_type; pub use self::tengri_type::*; mod tengri_trait; pub use self::tengri_trait::*; mod tengri_struct; pub use self::tengri_struct::*; -//pub(crate) use quanta::Clock; -pub extern crate atomic_float; pub(crate) use atomic_float::AtomicF64; -pub extern crate ratatui; -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; + +#[macro_export] pub extern crate dizzle; +pub use dizzle::*; + use std::{time::Duration, thread::{spawn, JoinHandle}, io::Write}; -use unicode_width::*; -pub(crate) use ::{ - std::{ - io::{stdout, Stdout}, - sync::{Arc, RwLock, atomic::{AtomicBool, AtomicUsize, Ordering::*}}, - fmt::{Debug, Display}, - 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}, - } +pub(crate) use ::std::{ + io::{stdout, Stdout}, + sync::{Arc, RwLock, atomic::{AtomicBool, AtomicUsize, Ordering::*}}, + fmt::{Debug, Display}, + ops::{Add, Sub, Mul, Div}, + marker::PhantomData, }; // Define macros first, so that private macros are available in private modules: diff --git a/tui/Cargo.toml b/tui/Cargo.toml deleted file mode 100644 index 51706b2..0000000 --- a/tui/Cargo.toml +++ /dev/null @@ -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 } diff --git a/tui/README.md b/tui/README.md deleted file mode 100644 index 8e227d8..0000000 --- a/tui/README.md +++ /dev/null @@ -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). diff --git a/tui/src/.scratch.rs b/tui/src/.scratch.rs deleted file mode 100644 index e69de29..0000000 diff --git a/tui/src/lib.rs b/tui/src/lib.rs deleted file mode 100644 index e69de29..0000000 diff --git a/tui/src/tui_test.rs b/tui/src/tui_test.rs deleted file mode 100644 index 53b9afe..0000000 --- a/tui/src/tui_test.rs +++ /dev/null @@ -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 )); -//}