mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-02-22 10:59:02 +01:00
fold tui under main crate
This commit is contained in:
parent
c1011ddb7f
commit
85ccb0737f
11 changed files with 66 additions and 79 deletions
10
Cargo.toml
10
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" }
|
||||
|
|
|
|||
|
|
@ -881,3 +881,18 @@ impl<E: Engine, S, C: Command<S>> MenuItem<E, S, C> {
|
|||
//}
|
||||
//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 ));
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -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).
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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 }
|
||||
|
|
@ -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).
|
||||
|
|
@ -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 ));
|
||||
//}
|
||||
Loading…
Add table
Add a link
Reference in a new issue