From fda5387cccbc598088d83064721ba51998f69eb5 Mon Sep 17 00:00:00 2001 From: Leo dev Date: Sun, 19 Jan 2025 23:24:55 +0100 Subject: [PATCH] few changes --- Cargo.toml | 5 +++-- src/console.rs | 7 ++++++- src/{widgets.rs => elements.rs} | 0 src/lib.rs | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) rename src/{widgets.rs => elements.rs} (100%) diff --git a/Cargo.toml b/Cargo.toml index b8ebace..4dedff9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,9 +9,10 @@ homepage = "https://osui.netlify.app" documentation = "https://osui.netlify.app/docs/" [features] -rsx = [] -frontend = ["rsx"] +no_rsx = [] portable = [] +engine = [] +no_elem = [] [lib] name = "osui" diff --git a/src/console.rs b/src/console.rs index dfed29b..ae3749c 100644 --- a/src/console.rs +++ b/src/console.rs @@ -28,6 +28,7 @@ impl Console { ui(&mut self.0, event) } + #[cfg(not(feature = "engine"))] pub fn run(&mut self, ui: Element) -> crate::Result<()> { self.draw(ui.clone(), None)?; loop { @@ -42,12 +43,16 @@ impl Console { pub fn end(&self) -> crate::Result<()> { if self.1 { - crossterm::execute!(std::io::stdout(), crossterm::event::EnableMouseCapture)?; + crossterm::execute!(std::io::stdout(), crossterm::event::DisableMouseCapture)?; } crossterm::terminal::disable_raw_mode()?; crate::utils::clear()?; crate::utils::show_cursor() } + + pub fn size(&self) -> (u16, u16) { + (self.0.width, self.0.height) + } } pub fn read() -> crate::Result { diff --git a/src/widgets.rs b/src/elements.rs similarity index 100% rename from src/widgets.rs rename to src/elements.rs diff --git a/src/lib.rs b/src/lib.rs index 715968f..0c1ce2f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,10 @@ pub mod console; +#[cfg(not(feature = "no_elem"))] +pub mod elements; +#[cfg(not(feature = "no_rsx"))] pub mod rsx; pub mod state; pub mod utils; -pub mod widgets; pub mod prelude { pub use crate::*;