readme updated

This commit is contained in:
Priec
2025-08-19 01:12:59 +02:00
parent 8ed2fbbe34
commit 49b31c6e92
2 changed files with 30 additions and 26 deletions

View File

@@ -2,9 +2,9 @@
name = "canvas" name = "canvas"
version.workspace = true version.workspace = true
edition.workspace = true edition.workspace = true
license.workspace = true license = "MIT OR Apache-2.0"
authors.workspace = true authors.workspace = true
description.workspace = true description = "Form/textarea for TUI"
readme.workspace = true readme.workspace = true
repository.workspace = true repository.workspace = true
categories.workspace = true categories.workspace = true

View File

@@ -1,6 +1,6 @@
# Canvas # Canvas
Canvas is a Rust library for building formbased and textareadriven terminal user interfaces. Canvas is a Rust library for building formbased and textareadriven terminal user interfaces.
It provides the core logic for text editing, validation, suggestions, and cursor management. It provides the core logic for text editing, validation, suggestions, and cursor management.
The library does not enforce a specific terminal UI framework: The library does not enforce a specific terminal UI framework:
@@ -12,15 +12,16 @@ The library does not enforce a specific terminal UI framework:
## Overview ## Overview
Canvas is designed for applications that require structured text input in a terminal environment. Canvas is designed for applications that require structured text input in a terminal environment.
It provides: It provides:
- Text editing modes (Vimlike or normal) - Text editing modes (Vimlike or normal)
- Validation (regex, masks, limits, formatting) - Validation (regex, masks, limits, formatting)
- Suggestions (asynchronous dropdowns) - Suggestions (asynchronous dropdowns)
- Computed fields (derived values) - Computed fields (derived values)
- Textarea widget with cursor management - Textarea widget with cursor management
- Extensible architecture for custom behaviors - Syntax highlighting (via syntect)
- Extensible architecture for custom behaviors
--- ---
@@ -29,7 +30,7 @@ It provides:
Add the dependency to your `Cargo.toml`: Add the dependency to your `Cargo.toml`:
```toml ```toml
[dependedsncies] [dependencies]
canvas = { version = "0.x", features = ["gui", "cursor-style", "textarea", "validation"] } canvas = { version = "0.x", features = ["gui", "cursor-style", "textarea", "validation"] }
``` ```
@@ -39,14 +40,15 @@ canvas = { version = "0.x", features = ["gui", "cursor-style", "textarea", "vali
The library is featuregated. Enable only what you need: The library is featuregated. Enable only what you need:
- `gui` terminal rendering support (ratatui + crossterm) - `gui` terminal rendering support (ratatui + crossterm)
- `cursor-style` styled cursor support - `cursor-style` styled cursor support
- `validation` regex, masks, limits, formatting - `validation` regex, masks, limits, formatting
- `suggestions` asynchronous suggestions dropdowns - `suggestions` asynchronous suggestions dropdowns
- `computed` derived fields - `computed` derived fields
- `textarea` textarea widget - `textarea` textarea widget
- `textmode-vim` Vimlike editing (default) - `syntect` syntax highlighting support
- `textmode-normal` normal editing mode - `textmode-vim` Vimlike editing (default)
- `textmode-normal` normal editing mode
**Note:** `textmode-vim` and `textmode-normal` are mutually exclusive. Enable exactly one. **Note:** `textmode-vim` and `textmode-normal` are mutually exclusive. Enable exactly one.
@@ -56,7 +58,7 @@ The default feature set is `["textmode-vim"]`.
## Running Examples ## Running Examples
The repository includes several examples. Each requires specific feature flags. The repository includes several examples. Each requires specific feature flags.
Use the following commands to run them: Use the following commands to run them:
```bash ```bash
@@ -66,6 +68,9 @@ cargo run --example textarea_vim --features "gui cursor-style textarea textmode-
# Textarea with Normal mode # Textarea with Normal mode
cargo run --example textarea_normal --features "gui cursor-style textarea textmode-normal" cargo run --example textarea_normal --features "gui cursor-style textarea textmode-normal"
# Textarea with syntax highlighting
cargo run --example textarea_syntax --features "gui cursor-style textarea syntect textmode-normal"
# Validation examples # Validation examples
cargo run --example validation_1 --features "gui validation cursor-style" cargo run --example validation_1 --features "gui validation cursor-style"
cargo run --example validation_2 --features "gui validation cursor-style" cargo run --example validation_2 --features "gui validation cursor-style"
@@ -88,16 +93,16 @@ cargo run --example computed_fields --features "gui computed"
## Documentation ## Documentation
- API documentation: `cargo doc --open` - API documentation: `cargo doc --open`
- Migration notes: `CANVAS_MIGRATION.md` - Migration notes: `CANVAS_MIGRATION.md`
--- ---
## License ## License
Licensed under either of: Licensed under either of:
- Apache License, Version 2.0 - Apache License, Version 2.0
- MIT License - MIT License
at your option. at your option.
@@ -106,4 +111,3 @@ at your option.
## Contributing ## Contributing
Contributions are welcome. Please follow the existing code structure and featuregating conventions. Contributions are welcome. Please follow the existing code structure and featuregating conventions.