├── .envrc
├── .gitignore
├── .rustfmt.toml
├── Cargo.toml
├── assets
├── demo.png
├── hstack.png
├── section.png
├── vstack.png
└── watch.png
├── changelog.md
├── examples
├── Cargo.toml
├── examples
│ └── watch.rs
├── readme.md
└── src
│ └── lib.rs
├── intuitive
├── Cargo.toml
├── notes.md
├── readme.md
└── src
│ ├── components
│ ├── any.rs
│ ├── centered.rs
│ ├── children.rs
│ ├── embed.rs
│ ├── empty.rs
│ ├── experimental_components
│ │ ├── input.rs
│ │ ├── mod.rs
│ │ ├── modal
│ │ │ ├── hook.rs
│ │ │ └── mod.rs
│ │ ├── scroll
│ │ │ └── mod.rs
│ │ └── table
│ │ │ ├── alignment.rs
│ │ │ ├── mod.rs
│ │ │ └── widget.rs
│ ├── mod.rs
│ ├── section.rs
│ ├── stack
│ │ ├── flex.rs
│ │ ├── horizontal.rs
│ │ ├── mod.rs
│ │ └── vertical.rs
│ └── text
│ │ └── mod.rs
│ ├── element.rs
│ ├── error.rs
│ ├── event
│ ├── channel.rs
│ ├── handler.rs
│ └── mod.rs
│ ├── lib.rs
│ ├── state
│ ├── hook.rs
│ ├── manager.rs
│ ├── mod.rs
│ └── state.rs
│ ├── style.rs
│ ├── terminal.rs
│ └── text.rs
├── macros
├── Cargo.toml
├── readme.md
└── src
│ ├── component.rs
│ ├── lib.rs
│ ├── on_key.rs
│ ├── render.rs
│ └── utils.rs
├── readme.md
└── shell.nix
/.envrc:
--------------------------------------------------------------------------------
1 | use nix
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .direnv
2 |
3 | target/
4 | Cargo.lock
5 |
--------------------------------------------------------------------------------
/.rustfmt.toml:
--------------------------------------------------------------------------------
1 | group_imports = "StdExternalCrate"
2 | imports_granularity = "Crate"
3 | max_width = 140
4 | reorder_imports = true
5 | tab_spaces = 2
6 |
--------------------------------------------------------------------------------
/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 |
3 | members = [
4 | "intuitive",
5 | "macros",
6 | "examples"
7 | ]
8 |
--------------------------------------------------------------------------------
/assets/demo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/enricozb/intuitive/c7428c7c137f45ad152dc2f81823272361675deb/assets/demo.png
--------------------------------------------------------------------------------
/assets/hstack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/enricozb/intuitive/c7428c7c137f45ad152dc2f81823272361675deb/assets/hstack.png
--------------------------------------------------------------------------------
/assets/section.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/enricozb/intuitive/c7428c7c137f45ad152dc2f81823272361675deb/assets/section.png
--------------------------------------------------------------------------------
/assets/vstack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/enricozb/intuitive/c7428c7c137f45ad152dc2f81823272361675deb/assets/vstack.png
--------------------------------------------------------------------------------
/assets/watch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/enricozb/intuitive/c7428c7c137f45ad152dc2f81823272361675deb/assets/watch.png
--------------------------------------------------------------------------------
/changelog.md:
--------------------------------------------------------------------------------
1 | # 0.6.2
2 | - better `KeyHandler` docs
3 | - bring `Propagate` into scope in `on_key!` macro
4 |
5 | # 0.6.1
6 | - fix relative links in docs
7 | - add docs for generics in `#[component]`
8 |
9 | # 0.6.0
10 | - remove unstable feature
11 | - add experimental `Scroll` and `Input` components
12 | - add `Span`, `Spans`, and `Lines` for text styling
13 | - add generics to `#[component]` attribute macro
14 |
--------------------------------------------------------------------------------
/examples/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "intuitive_examples"
3 | version = "0.1.0"
4 | edition = "2021"
5 | publish = false
6 |
7 | [dependencies]
8 | chrono = "0.4.22"
9 | clap = { version = "3.2.20", features = ["derive"] }
10 | intuitive = { path = "../intuitive", features = ["experimental"] }
11 |
--------------------------------------------------------------------------------
/examples/examples/watch.rs:
--------------------------------------------------------------------------------
1 | use std::{
2 | process::{Command, Output},
3 | thread,
4 | time::Duration,
5 | };
6 |
7 | use chrono::Local;
8 | use clap::Parser;
9 | use intuitive::{
10 | component,
11 | components::{stack::Flex::*, HStack, Section, Text, VStack},
12 | error::Result,
13 | on_key, render,
14 | state::State,
15 | style::Color,
16 | terminal::Terminal,
17 | text::Span,
18 | };
19 |
20 | #[component(Top)]
21 | fn render(interval: u64, command: String) {
22 | let date = Local::now().format("%Y-%m-%d %H:%M:%S").to_string();
23 |
24 | render! {
25 | HStack(flex: [Block(10), Grow(1), Block(21)]) {
26 | Section(title: "Every", border: Color::DarkGray) {
27 | Text(text: format!("{}s", interval))
28 | }
29 | Section(title: "Command", border: Color::DarkGray) {
30 | Text(text: command)
31 | }
32 | Section(title: "Time", border: Color::DarkGray) {
33 | Text(text: date)
34 | }
35 | }
36 | }
37 | }
38 |
39 | #[component(CommandOutput)]
40 | fn render(output: State