From 06f8ed3ae3a5d0458036ba816f244df11c6b1277 Mon Sep 17 00:00:00 2001 From: same mf who else Date: Sat, 21 Feb 2026 19:34:07 +0200 Subject: [PATCH] remove workspace --- Cargo.lock | 51 +++-------------- Cargo.toml | 74 ++++++++++++++----------- README.md | 57 ++++++++++++++++++- {tengri/examples => examples}/tui_00.rs | 0 {tengri/examples => examples}/tui_01.rs | 0 {tengri => src}/.scratch.rs | 0 {tengri => src}/README.md | 0 {tengri => src}/tengri.rs | 38 +++++++++---- {tengri => src}/tengri_impl.rs | 0 {tengri => src}/tengri_struct.rs | 0 {tengri => src}/tengri_trait.rs | 0 {tengri => src}/tengri_type.rs | 0 tengri/Cargo.toml | 38 ------------- 13 files changed, 133 insertions(+), 125 deletions(-) mode change 120000 => 100644 README.md rename {tengri/examples => examples}/tui_00.rs (100%) rename {tengri/examples => examples}/tui_01.rs (100%) rename {tengri => src}/.scratch.rs (100%) rename {tengri => src}/README.md (100%) rename {tengri => src}/tengri.rs (95%) rename {tengri => src}/tengri_impl.rs (100%) rename {tengri => src}/tengri_struct.rs (100%) rename {tengri => src}/tengri_trait.rs (100%) rename {tengri => src}/tengri_type.rs (100%) delete mode 100644 tengri/Cargo.toml diff --git a/Cargo.lock b/Cargo.lock index dd54cd4..177e248 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1166,35 +1166,20 @@ dependencies = [ name = "tengri" version = "0.14.0" dependencies = [ + "atomic_float", + "better-panic", + "bumpalo", "crossterm 0.29.0", "dizzle", - "tengri", - "tengri_input", - "tengri_output", - "tengri_proc", - "tengri_tui", -] - -[[package]] -name = "tengri_input" -version = "0.14.0" -dependencies = [ - "dizzle", - "tengri_tui", -] - -[[package]] -name = "tengri_output" -version = "0.14.0" -dependencies = [ - "atomic_float", - "bumpalo", - "dizzle", + "palette", "proptest", "proptest-derive", "quanta", + "rand 0.8.5", + "ratatui", "tengri", - "tengri_tui", + "tengri_proc", + "unicode-width 0.2.0", ] [[package]] @@ -1208,26 +1193,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tengri_tui" -version = "0.14.0" -dependencies = [ - "atomic_float", - "better-panic", - "bumpalo", - "crossterm 0.29.0", - "dizzle", - "palette", - "quanta", - "rand 0.8.5", - "ratatui", - "tengri", - "tengri_input", - "tengri_output", - "tengri_proc", - "unicode-width 0.2.0", -] - [[package]] name = "thiserror" version = "2.0.18" diff --git a/Cargo.toml b/Cargo.toml index 34b703a..e9e0667 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,43 @@ +[package] +name = "tengri" +edition = "2024" +version = "0.15.0" +description = "UI metaframework." + +[features] +default = [ "input", "output", "tui" ] +bumpalo = [ "dep:bumpalo" ] +input = [ ] +output = [ ] +tui = [ ] +dsl = [ ] + +[dependencies] +anyhow = { version = "1.0" } +atomic_float = { version = "1" } +better-panic = { version = "0.3.0" } +bumpalo = { version = "3.19.0", optional = true } +crossterm = { version = "0.29.0" } +heck = { version = "0.5" } +palette = { version = "0.7.6", features = [ "random" ] } +proc-macro2 = { version = "1", features = ["span-locations"] } +quanta = { version = "0.12.3" } +quote = { version = "1" } +rand = { version = "0.8.5" } +ratatui = { version = "0.29.0", features = [ "unstable-widget-ref", "underline-color" ] } +syn = { version = "2", features = ["full", "extra-traits"] } +unicode-width = { version = "0.2" } +dizzle = { path = "../dizzle" } + +[dev-dependencies] +proptest = { version = "^1" } +proptest-derive = { version = "^0.5.1" } +tengri = { path = ".", features = [ "dsl" ] } +tengri_proc = { path = "./proc" } + +[lib] +path = "src/tengri.rs" + [profile.release] lto = true @@ -5,35 +45,5 @@ lto = true inherits = "test" lto = false -[workspace] -resolver = "2" -members = [ - "./tengri", - "./proc", -] - -[workspace.package] -version = "0.14.0" -edition = "2024" - -[workspace.dependencies] -dizzle = { path = "../dizzle" } -tengri = { path = "./tengri" } -tengri_proc = { path = "./proc" } - -anyhow = { version = "1.0" } -atomic_float = { version = "1" } -better-panic = { version = "0.3.0" } -bumpalo = { version = "3.19.0" } -crossterm = { version = "0.29.0" } -heck = { version = "0.5" } -palette = { version = "0.7.6", features = [ "random" ] } -proc-macro2 = { version = "1", features = ["span-locations"] } -proptest = { version = "^1" } -proptest-derive = { version = "^0.5.1" } -quanta = { version = "0.12.3" } -quote = { version = "1" } -rand = { version = "0.8.5" } -ratatui = { version = "0.29.0", features = [ "unstable-widget-ref", "underline-color" ] } -syn = { version = "2", features = ["full", "extra-traits"] } -unicode-width = { version = "0.2" } +[target.'cfg(target_os = "linux")'] +rustflags = ["-C", "link-arg=-fuse-ld=mold"] diff --git a/README.md b/README.md deleted file mode 120000 index 7cad1cb..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -tengri/README.md \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..41cfef5 --- /dev/null +++ b/README.md @@ -0,0 +1,56 @@ +***tengri*** is a metaframework for building interactive applications with rust. (aren't we all?) + +tengri is developed as part of [***tek***](https://codeberg.org/unspeaker/tek), +a music program for terminals. + +tengri contains: +* [***dizzle***](./dsl), a framework for defining domain-specific languages +* [***output***](./output), an abstract UI layout framework +* [***input***](./input), an abstract UI event framework +* [***tui***](./tui), an implementation of tengri over [***ratatui***](https://ratatui.rs/). + +as well as: +* [***core***](./core), the shared definitions ("utils") module +* [***proc***](./proc), the space for procedural macros +* [***tengri***](./tengri), the top-level reexport crate + +tengri is published under [**AGPL3**](./LICENSE). + +## Input + +***tengri_input*** is where tengri's input handling is defined. + +the following items are provided: +* `Input` trait, for defining for input sources +* `Handle` trait and `handle!` macro, for defining input handlers +* `Command` trait and the `command!` macro, for defining commands that inputs may result in + +## Output + +***tengri_output*** is an abstract interface layout framework. + +it expresses the following notions: + +* [**space:**](./src/space.rs) `Direction`, `Coordinate`, `Area`, `Size`, `Measure` + +* [**output:**](./src/output.rs) `Out`, `Draw`, `Content` + * the layout operators are generic over `Draw` and/or `Content` + * the traits `Draw` and `Content` are generic over `Out` + * implement `Out` to bring a layout to a new backend: + [see `TuiOut` in `tengri_tui`](../tui/src/tui_engine/tui_output.rs) + +* [**layout:**](./src/layout.rs) + * conditionals: `When`, `Either` + * iteration: `Map` + * concatenation: `Bsp` + * positioning: `Align`, `Push`, `Pull` + * 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/tengri/examples/tui_00.rs b/examples/tui_00.rs similarity index 100% rename from tengri/examples/tui_00.rs rename to examples/tui_00.rs diff --git a/tengri/examples/tui_01.rs b/examples/tui_01.rs similarity index 100% rename from tengri/examples/tui_01.rs rename to examples/tui_01.rs diff --git a/tengri/.scratch.rs b/src/.scratch.rs similarity index 100% rename from tengri/.scratch.rs rename to src/.scratch.rs diff --git a/tengri/README.md b/src/README.md similarity index 100% rename from tengri/README.md rename to src/README.md diff --git a/tengri/tengri.rs b/src/tengri.rs similarity index 95% rename from tengri/tengri.rs rename to src/tengri.rs index e3310ec..76fc703 100644 --- a/tengri/tengri.rs +++ b/src/tengri.rs @@ -453,6 +453,22 @@ pub fn tui_input + Send + Sync + 'static> ( }) } +/// Should be impl something or other... +/// +/// ``` +/// struct State; +/// impl<'b> Namespace<'b, bool> for State {} +/// impl<'b> Namespace<'b, u16> for State {} +/// impl<'b> Namespace<'b, Color> for State {} +/// impl Understand for State {} +/// let state = State; +/// let out = TuiOut::default(); +/// tengri::evaluate_output_expression_tui(&state, &mut out, "")?; +/// tengri::evaluate_output_expression_tui(&state, &mut out, "text Hello world!")?; +/// tengri::evaluate_output_expression_tui(&state, &mut out, "fg (g 0) (text Hello world!)")?; +/// tengri::evaluate_output_expression_tui(&state, &mut out, "bg (g 2) (text Hello world!)")?; +/// tengri::evaluate_output_expression_tui(&state, &mut out, "(bg (g 3) (fg (g 4) (text Hello world!)))")?; +/// ``` #[cfg(feature = "dsl")] pub fn evaluate_output_expression_tui <'a, S> ( state: &S, output: &mut TuiOut, expr: impl Expression + 'a ) -> Usually where @@ -472,22 +488,22 @@ pub fn tui_input + Send + Sync + 'static> ( let _arg2 = tail1.head(); match frags.next() { - Some("text") => if let Some(src) = args?.src()? { output.place(&src) }, + Some("text") => { + if let Some(src) = args?.src()? { output.place(&src) } + }, Some("fg") => { - let arg0 = arg0?.expect("fg: expected arg 0 (color)"); - output.place(&Tui::fg( - Namespace::::namespace(state, arg0)?.unwrap_or_else(||panic!("fg: {arg0:?}: not a color")), - Thunk::new(move|output: &mut TuiOut|state.understand(output, &arg1).unwrap()), - )) + let arg0 = arg0?.expect("fg: expected arg 0 (color)"); + let color = Namespace::namespace(state, arg0)?.unwrap_or_else(||panic!("fg: {arg0:?}: not a color")); + let thunk = Thunk::new(move|output: &mut TuiOut|state.understand(output, &arg1).unwrap()); + output.place(&Tui::fg(color, thunk)) }, Some("bg") => { - let arg0 = arg0?.expect("bg: expected arg 0 (color)"); - output.place(&Tui::bg( - Namespace::::namespace(state, arg0)?.unwrap_or_else(||panic!("bg: {arg0:?}: not a color")), - Thunk::new(move|output: &mut TuiOut|state.understand(output, &arg1).unwrap()), - )) + let arg0 = arg0?.expect("bg: expected arg 0 (color)"); + let color = Namespace::namespace(state, arg0)?.unwrap_or_else(||panic!("bg: {arg0:?}: not a color")); + let thunk = Thunk::new(move|output: &mut TuiOut|state.understand(output, &arg1).unwrap()); + output.place(&Tui::bg(color, thunk)) }, _ => return Ok(false) diff --git a/tengri/tengri_impl.rs b/src/tengri_impl.rs similarity index 100% rename from tengri/tengri_impl.rs rename to src/tengri_impl.rs diff --git a/tengri/tengri_struct.rs b/src/tengri_struct.rs similarity index 100% rename from tengri/tengri_struct.rs rename to src/tengri_struct.rs diff --git a/tengri/tengri_trait.rs b/src/tengri_trait.rs similarity index 100% rename from tengri/tengri_trait.rs rename to src/tengri_trait.rs diff --git a/tengri/tengri_type.rs b/src/tengri_type.rs similarity index 100% rename from tengri/tengri_type.rs rename to src/tengri_type.rs diff --git a/tengri/Cargo.toml b/tengri/Cargo.toml deleted file mode 100644 index f5927cb..0000000 --- a/tengri/Cargo.toml +++ /dev/null @@ -1,38 +0,0 @@ -[package] -name = "tengri" -edition = "2024" -description = "UI metaframework." -version = { workspace = true } - -[features] -default = [ "input", "output", "tui" ] -bumpalo = [ "dep:bumpalo" ] -input = [ ] -output = [ ] -tui = [ ] -dsl = [ ] - -[dependencies] -atomic_float = { workspace = true } -better-panic = { workspace = true } -bumpalo = { workspace = true, optional = true } -crossterm = { workspace = true } -dizzle = { workspace = true } -palette = { workspace = true } -quanta = { workspace = true } -rand = { workspace = true } -ratatui = { workspace = true } -unicode-width = { workspace = true } - -[dev-dependencies] -tengri_proc = { workspace = true } -tengri = { workspace = true, features = [ "dsl" ] } -crossterm = { workspace = true } -proptest = { workspace = true } -proptest-derive = { workspace = true } - -[lib] -path = "tengri.rs" - -[target.'cfg(target_os = "linux")'] -rustflags = ["-C", "link-arg=-fuse-ld=mold"]