extract tui support code to tek_tui

This commit is contained in:
🪞👃🪞 2025-01-05 10:50:32 +01:00
parent 1a9077427c
commit 1faf5bb6df
22 changed files with 477 additions and 450 deletions

View file

@ -5,39 +5,34 @@
#![feature(impl_trait_in_assoc_type)]
#![feature(associated_type_defaults)]
pub use ::tek_layout;
pub use ::tek_layout::tek_engine;
pub(crate) use ::tek_layout::{
pub use ::tek_tui::{self, tek_engine, tek_layout};
pub(crate) use ::tek_tui::{
*,
tek_edn::*,
tek_layout::*,
tek_engine::{
from,
Usually, Perhaps,
Output, Content, Render, Thunk, render, Engine, Size, Area,
Input, handle, Handle, command, Command, input_to_command, InputToCommand,
keymap, kexp, kpat, EventMap,
tui::{
Tui,
TuiIn, key, ctrl, shift, alt,
TuiOut,
crossterm::{
self,
event::{
Event, KeyEvent, KeyEventKind, KeyEventState, KeyModifiers,
KeyCode::{self, *},
}
},
ratatui::{
self,
prelude::{Color, Style, Stylize, Buffer, Modifier},
buffer::Cell,
}
Input, handle, Handle, command, Command, input_to_command, InputToCommand, keymap, EventMap,
},
Tui,
TuiIn, key, ctrl, shift, alt, kexp, kpat,
TuiOut,
crossterm::{
self,
event::{
Event, KeyEvent, KeyEventKind, KeyEventState, KeyModifiers,
KeyCode::{self, *},
}
},
ratatui::{
self,
prelude::{Color, Style, Stylize, Buffer, Modifier},
buffer::Cell,
}
};
pub use ::tek_edn;
pub(crate) use ::tek_edn::*;
pub(crate) use std::cmp::{Ord, Eq, PartialEq};
pub(crate) use std::collections::BTreeMap;
pub(crate) use std::error::Error;
@ -53,9 +48,7 @@ pub(crate) use std::thread::{spawn, JoinHandle};
pub(crate) use std::time::Duration;
pub mod arranger; pub use self::arranger::*;
pub mod border; pub use self::border::*;
pub mod clock; pub use self::clock::*;
pub mod color; pub use self::color::*;
pub mod field; pub use self::field::*;
pub mod file; pub use self::file::*;
pub mod focus; pub use self::focus::*;
@ -70,8 +63,6 @@ pub mod pool; pub use self::pool::*;
pub mod sampler; pub use self::sampler::*;
pub mod sequencer; pub use self::sequencer::*;
pub mod status; pub use self::status::*;
pub mod style; pub use self::style::*;
pub mod theme; pub use self::theme::*;
pub use ::atomic_float;
pub(crate) use atomic_float::*;
@ -84,13 +75,6 @@ pub(crate) use ::midly::{
live::LiveEvent,
};
pub use ::palette;
pub(crate) use ::palette::{
*,
convert::*,
okhsl::*
};
testmod! { test }
/// Define test modules.
@ -98,16 +82,6 @@ testmod! { test }
($($name:ident)*) => { $(#[cfg(test)] mod $name;)* };
}
/// Prototypal case of implementor macro.
/// Saves 4loc per data pats.
#[macro_export] macro_rules! from {
($(<$($lt:lifetime),+>)?|$state:ident:$Source:ty|$Target:ty=$cb:expr) => {
impl $(<$($lt),+>)? From<$Source> for $Target {
fn from ($state:$Source) -> Self { $cb }
}
};
}
pub trait Gettable<T> {
/// Returns current value
fn get (&self) -> T;