Skip to content

Commit 0dcd86c

Browse files
committed
Initial commit: cTUI - High-performance Rust TUI framework
cTUI is a complete, production-ready TUI framework in pure Rust featuring: Features: - 8 workspace crates (core, layout, components, animate, theme, macros, cli, tests) - 25+ pre-built widgets (Block, Input, List, Table, Chart, etc.) - Flexbox-inspired layout engine - Spring physics and keyframe animations - 31 easing functions - 16 built-in themes (Dracula, Nord, Tokyo Night, Catppuccin, etc.) - Comprehensive documentation (48 files) - CI with Blacksmith runners Performance: - 64-136% faster than ratatui on Buffer operations - Zero unsafe code - Async-first with Tokio runtime Components: Block, Paragraph, List, Table, Input, Editor, Form, Modal, Tabs, ProgressBar, Spinner, Gauge, Chart, Sparkline, Canvas, Checkbox, Radio, Select, Slider, Tree, Code, Markdown, Diff, Link, Scrollable Test Coverage: 1200+ tests across workspace Documentation: API reference, gallery, tutorials, examples
0 parents  commit 0dcd86c

File tree

306 files changed

+63071
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

306 files changed

+63071
-0
lines changed

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
7+
[*.rs]
8+
max_line_length = 100
9+
indent_style = space
10+
indent_size = 4

.github/FUNDING.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# These are supported funding model platforms
2+
3+
github: ji-devs
4+
# patreon: # Replace with your Patreon username
5+
# open_collective: # Replace with your Open Collective username
6+
# ko_fi: # Replace with your Ko-fi username
7+
# tidelift: # Replace with npm package name for Tidelift
8+
# community_bridge: # Replace with project slug for Community Bridge
9+
# liberapay: # Replace with your Liberapay username
10+
# issuehunt: # Replace with your IssueHunt username
11+
# lfx_crowdfunding: # Replace with your LFX Crowdfunding project name
12+
# polar: # Replace with your Polar username
13+
# buy_me_a_coffee: # Replace with your Buy Me a Coffee username
14+
# thanks_dev: # Replace with your thanks.dev username
15+
# custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
name: Bug report
3+
about: Report a bug you encountered
4+
title: ''
5+
labels: 'Type: Bug'
6+
assignees: ''
7+
---
8+
9+
## Description
10+
11+
A clear and concise description of what the bug is.
12+
13+
## To Reproduce
14+
15+
Steps to reproduce the behavior:
16+
17+
1. Use this component '...'
18+
2. With these props '...'
19+
3. Run the command '...'
20+
4. See error
21+
22+
If possible, include a minimal code sample that exhibits the bug:
23+
24+
```rust
25+
// Minimal reproduction code
26+
```
27+
28+
## Expected behavior
29+
30+
A clear and concise description of what you expected to happen.
31+
32+
## Screenshots
33+
34+
If applicable, add screenshots or GIFs to help explain your problem.
35+
36+
## Are you willing to contribute a fix?
37+
38+
- [ ] I am willing to open a PR for this bug.
39+
- [ ] I can try to investigate, but I will need guidance.
40+
- [ ] I am not able to work on a fix right now.
41+
42+
## Environment
43+
44+
- OS:
45+
- Terminal Emulator:
46+
- Font:
47+
- Rust version:
48+
- cTUI version:
49+
- Backend:
50+
51+
## Additional context
52+
53+
Add any other context about the problem here. If you already looked into the issue, include any findings or leads you have explored.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: Feature request
3+
about: Suggest a new feature or enhancement
4+
title: ''
5+
labels: 'Type: Enhancement'
6+
assignees: ''
7+
---
8+
9+
## Is your feature request related to a problem?
10+
11+
A clear and concise description of what the problem is. For example: "I'm always frustrated when [...]"
12+
13+
## Describe the solution you'd like
14+
15+
A clear and concise description of what you want to happen.
16+
17+
## Describe alternatives you've considered
18+
19+
A clear and concise description of any alternative solutions or features you've considered.
20+
21+
## Additional context
22+
23+
Add any other context, code examples, or screenshots about the feature request here.
24+
25+
## Are you willing to contribute?
26+
27+
- [ ] I am willing to open a PR implementing this feature.
28+
- [ ] I can help with design and documentation.
29+
- [ ] I am not able to work on this right now.

.github/ISSUE_TEMPLATE/question.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: Question
3+
about: Ask a question about cTUI
4+
title: ''
5+
labels: 'Type: Question'
6+
assignees: ''
7+
---
8+
9+
## Question
10+
11+
A clear and concise description of your question.
12+
13+
## What I've tried
14+
15+
Describe what you've already tried to resolve your question:
16+
17+
- Checked documentation at [docs.rs](https://docs.rs/ctui)
18+
- Searched existing issues
19+
- Looked at examples in the repository
20+
21+
## Code sample
22+
23+
If relevant, include the code you're working with:
24+
25+
```rust
26+
// Your code here
27+
```
28+
29+
## Additional context
30+
31+
Add any other context about your question here.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
## Description
2+
3+
<!-- Provide a brief description of the changes in this PR -->
4+
5+
## Related Issue
6+
7+
<!-- Link to any related issues. Use "Fixes #123" or "Closes #456" to auto-close issues -->
8+
9+
## Type of Change
10+
11+
<!-- Mark the relevant option with an 'x' -->
12+
13+
- [ ] Bug fix (non-breaking change which fixes an issue)
14+
- [ ] New feature (non-breaking change which adds functionality)
15+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
16+
- [ ] Documentation update
17+
- [ ] Refactoring (no functional changes)
18+
- [ ] Performance improvement
19+
- [ ] Test addition or update
20+
21+
## Checklist
22+
23+
<!-- Mark completed items with an 'x' -->
24+
25+
- [ ] I have read the [Contributing Guidelines](CONTRIBUTING.md)
26+
- [ ] My code follows the project's style guidelines
27+
- [ ] I have added tests that prove my fix is effective or that my feature works
28+
- [ ] New and existing unit tests pass locally with my changes
29+
- [ ] I have updated the documentation accordingly
30+
- [ ] My changes generate no new warnings
31+
- [ ] I have added a changelog entry if appropriate
32+
33+
## AI Generated Content Disclosure
34+
35+
<!-- If this PR contains AI-generated content, check the box below and provide details -->
36+
37+
- [ ] This PR contains AI-generated content (describe below if checked)
38+
39+
<!-- If checked, briefly describe what AI tools were used and what content was generated -->
40+
41+
## Testing
42+
43+
<!-- Describe the tests you ran to verify your changes -->
44+
45+
```bash
46+
# Commands to run tests
47+
cargo test --all
48+
cargo clippy --all-targets --all-features
49+
cargo fmt --all -- --check
50+
```
51+
52+
## Screenshots
53+
54+
<!-- If applicable, add screenshots or GIFs showing the changes -->
55+
56+
## Additional Notes
57+
58+
<!-- Add any additional notes or context about the PR here -->

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
check:
11+
name: Check
12+
runs-on: blacksmith-4cpu-ubuntu-2204
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: dtolnay/rust-toolchain@stable
16+
- run: cargo check --workspace --all-features
17+
18+
test:
19+
name: Test
20+
runs-on: blacksmith-4cpu-ubuntu-2204
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: dtolnay/rust-toolchain@stable
24+
- run: cargo test --workspace --all-features
25+
26+
fmt:
27+
name: Rustfmt
28+
runs-on: blacksmith-4cpu-ubuntu-2204
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: dtolnay/rust-toolchain@stable
32+
with:
33+
components: rustfmt
34+
- run: cargo fmt --all -- --check
35+
36+
clippy:
37+
name: Clippy
38+
runs-on: blacksmith-4cpu-ubuntu-2204
39+
steps:
40+
- uses: actions/checkout@v4
41+
- uses: dtolnay/rust-toolchain@stable
42+
with:
43+
components: clippy
44+
- run: cargo clippy --workspace --all-features -- -D warnings
45+
46+
docs:
47+
name: Docs
48+
runs-on: blacksmith-4cpu-ubuntu-2204
49+
steps:
50+
- uses: actions/checkout@v4
51+
- uses: dtolnay/rust-toolchain@stable
52+
- run: cargo doc --workspace --all-features --no-deps

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Build artifacts
2+
/target/
3+
Cargo.lock
4+
5+
# Backup files
6+
**/*.rs.bk
7+
*.snap.new
8+
9+
# IDE/Editor
10+
.idea/
11+
.vscode/
12+
*.iml
13+
14+
# Debug files
15+
*.pdb
16+
17+
# OS
18+
.DS_Store
19+
.sisyphus/

AGENTS.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# cTUI - AGENTS.md
2+
3+
## OVERVIEW
4+
5+
High-performance Rust TUI framework with React-style declarative components. Pure Rust, zero unsafe code. Async-first with Tokio runtime.
6+
7+
## STRUCTURE
8+
9+
```
10+
cTUI/
11+
├── ctui-core/ # Rendering primitives, Buffer, Cell, Component trait
12+
├── ctui-components/ # 27 pre-built widgets (Block, Input, List, Table...)
13+
├── ctui-layout/ # Flexbox-inspired layout engine
14+
├── ctui-animate/ # Easing, keyframes, spring physics
15+
├── ctui-theme/ # Built-in themes + theming system
16+
├── ctui-macros/ # #[component] proc-macro
17+
├── ctui-cli/ # Project scaffolding CLI
18+
├── ctui-tests/ # Integration test harness
19+
├── benches/ # Criterion benchmarks
20+
└── examples/ # counter, todo, dashboard, file_explorer, animation
21+
```
22+
23+
## WHERE TO LOOK
24+
25+
| Need | Location |
26+
|------|----------|
27+
| Component trait / lifecycle | `ctui-core/src/component.rs` |
28+
| Buffer rendering | `ctui-core/src/buffer/` |
29+
| Input handling | `ctui-core/src/event.rs` |
30+
| Widget implementations | `ctui-components/src/{widget}.rs` |
31+
| Layout algorithms | `ctui-layout/src/flex.rs`, `grid.rs` |
32+
| Animation easing | `ctui-animate/src/easing.rs` |
33+
| Theme presets | `ctui-theme/src/theme.rs` |
34+
| Benchmarks | `benches/ratatui_baseline.rs` |
35+
36+
## KEY ABSTRACTIONS
37+
38+
### Component Trait (Elm Architecture)
39+
```rust
40+
trait Component {
41+
type Props; // Configuration (builder pattern)
42+
type State; // Internal state
43+
fn create(props: Self::Props) -> Self;
44+
fn render(&self, area: Rect, buf: &mut Buffer);
45+
fn update(&mut self, msg: Box<dyn Msg>) -> Cmd;
46+
fn on_mount(&mut self) {}
47+
fn on_unmount(&mut self) {}
48+
}
49+
```
50+
51+
### Widget Trait (Stateless)
52+
```rust
53+
trait Widget {
54+
fn render(&self, area: Rect, buf: &mut Buffer);
55+
}
56+
```
57+
58+
### Layout Snippet
59+
```rust
60+
Layout::flex()
61+
.direction(FlexDirection::Row)
62+
.justify_content(JustifyContent::SpaceBetween)
63+
.gap(1)
64+
.split(area, &constraints)
65+
```
66+
67+
### Animation Snippet
68+
```rust
69+
KeyframeAnimation::new()
70+
.keyframe(Keyframe::new(0.0, 0.0))
71+
.keyframe(Keyframe::new(1.0, 100.0))
72+
.duration_ms(1000)
73+
.playback_mode(PlaybackMode::Loop)
74+
```
75+
76+
## COMMANDS
77+
78+
```bash
79+
cargo test --workspace --all-features # Run all 1079 tests
80+
cargo clippy --workspace -- -D warnings # Lint check
81+
cargo bench # Criterion benchmarks
82+
cargo run --example counter # Run example
83+
cargo doc --workspace --open # View docs
84+
ctui new my-app --template counter # Scaffold project
85+
```
86+
87+
## BENCHMARKS
88+
89+
Target: >=10% faster than ratatui baseline
90+
- Buffer operations: 64-136% improvement
91+
- Buffer diff: 35% faster
92+
- Paragraph render: 20% faster
93+
94+
## CRATE DEPENDENCY GRAPH
95+
96+
```
97+
ctui-core (foundation, no deps)
98+
├── ctui-components -> ctui-core
99+
├── ctui-layout -> ctui-core
100+
├── ctui-animate -> ctui-core
101+
├── ctui-theme -> ctui-core
102+
└── ctui-macros (proc-macro, standalone)
103+
```
104+
105+
## NOTES
106+
107+
- ~43k lines Rust, 1079 tests across workspace
108+
- CI: blacksmith-4cpu-ubuntu-2204 runner
109+
- Lints: `#![deny(unsafe_code)]`, clippy pedantic + nursery
110+
- Release profile: LTO + opt-level 3
111+
- Snapshot testing via insta crate

0 commit comments

Comments
 (0)