[package]
name = "tui-canvas"
# version = "0.8.12"
version.workspace = true
edition.workspace = true
authors.workspace = true
license = "MIT"
description = "Form/textarea/input for TUI"
readme = "README.md"
repository = "https://gitlab.com/filipriec/tui-canvas"
keywords = ["tui", "terminal", "ratatui", "keyboard", "ui"]
categories = ["command-line-interface"]
exclude = [".claude/", ".forge/"]



[dependencies]
ratatui = { workspace = true, optional = true }
crossterm = { workspace = true, optional = true }
anyhow.workspace = true
tokio = { workspace = true, optional = true }
toml = { workspace = true }
serde.workspace = true
unicode-width.workspace = true
thiserror = { workspace = true }

tracing = "0.1.44"
tracing-subscriber = "0.3.23"
async-trait.workspace = true
regex = { workspace = true, optional = true }
ropey = { version = "1.6.1", optional = true }
once_cell = "1.21.4"
syntect = { version = "5.3.0", optional = true, default-features = false, features = ["default-fancy"] }
derivative = "2.2.0"
validation-core = { path = "tui-canvas-validation-core", package = "tui-canvas-validation-core", version = "0.8.1", optional = true }
arboard = { version = "3.6", optional = true }

[dev-dependencies]
tokio-test = "0.4.5"

[features]
default = ["textmode-vim", "clipboard"]
gui = ["ratatui", "crossterm"]
suggestions = ["tokio"]
cursor-style = ["crossterm"]
validation = ["regex", "validation-core", "validation-core/regex"]
computed = []
textarea = ["dep:ropey","gui"]
textinput = ["gui"]
commandline = ["textinput"]
syntect = ["dep:syntect", "gui", "textarea"]
keybindings = ["gui"]
# Mirror yanks into the OS clipboard: native via `arboard`, OSC 52 as fallback.
clipboard = ["dep:arboard"]

# text modes (mutually exclusive; default to vim)
textmode-vim = []
textmode-normal = []

full = [
    "gui",
    "suggestions",
    "cursor-style",
    "validation",
    "computed",
    "textarea",
    "textinput",
    "commandline",
    "keybindings",
    "clipboard"
]

[[example]]
name = "canvas_cursor_auto"
required-features = ["gui", "cursor-style"]
path = "examples/canvas_cursor_auto.rs"

[[example]]
name = "canvas_keybindings"
required-features = ["gui", "keybindings", "cursor-style"]
path = "examples/canvas_keybindings.rs"

[[example]]
name = "computed_fields"
required-features = ["gui", "computed"]

[[example]]
name = "validation_1"
required-features = ["gui", "validation", "cursor-style"]
path = "examples/validation/validation_1.rs"

[[example]]
name = "validation_2"
required-features = ["gui", "validation", "cursor-style"]
path = "examples/validation/validation_2.rs"

[[example]]
name = "validation_3"
required-features = ["gui", "validation", "cursor-style"]
path = "examples/validation/validation_3.rs"

[[example]]
name = "validation_4"
required-features = ["gui", "validation", "cursor-style"]
path = "examples/validation/validation_4.rs"

[[example]]
name = "validation_5"
required-features = ["gui", "validation", "cursor-style"]
path = "examples/validation/validation_5.rs"

[[example]]
name = "suggestions"
required-features = ["suggestions", "gui", "cursor-style"]
path = "examples/suggestions/suggestions.rs"

[[example]]
name = "suggestions2"
required-features = ["suggestions", "gui", "cursor-style"]
path = "examples/suggestions/suggestions2.rs"

[[example]]
name = "textarea_vim"
required-features = ["gui", "cursor-style", "textarea", "textmode-vim", "keybindings"]
path = "examples/textarea/textarea_vim.rs"

[[example]]
name = "textarea_normal"
required-features = ["gui", "cursor-style", "textarea", "textmode-normal", "keybindings", "commandline"]
path = "examples/textarea/textarea_normal.rs"

[[example]]
name = "textarea_syntax"
required-features = ["gui", "cursor-style", "textarea", "textmode-normal", "keybindings", "syntect"]
path = "examples/textarea/textarea_syntax.rs"

[[example]]
name = "textinput_normal"
required-features = ["gui", "cursor-style", "textinput", "textmode-normal"]
path = "examples/textarea/textinput_normal.rs"

[[example]]
name = "undo_redo"
required-features = ["gui", "cursor-style", "textinput"]
path = "examples/default/undo_redo.rs"

[[example]]
name = "form_vim"
required-features = ["gui", "keybindings", "cursor-style"]
path = "examples/minimal/form_vim.rs"

[[example]]
name = "form_helix"
required-features = ["gui", "keybindings", "cursor-style"]
path = "examples/minimal/form_helix.rs"

[[example]]
name = "textarea_vim_minimal"
required-features = ["textarea", "keybindings", "cursor-style", "commandline"]
path = "examples/minimal/textarea_vim_minimal.rs"

[[example]]
name = "textarea_helix_minimal"
required-features = ["textarea", "keybindings", "cursor-style", "commandline"]
path = "examples/minimal/textarea_helix_minimal.rs"

[[example]]
name = "textarea_vscode_minimal"
required-features = ["textarea", "keybindings", "cursor-style", "commandline", "textmode-normal"]
path = "examples/minimal/textarea_vscode_minimal.rs"

[[example]]
name = "textinput_helix_minimal"
required-features = ["gui", "textinput", "keybindings", "cursor-style"]
path = "examples/minimal/textinput_helix_minimal.rs"

[[example]]
name = "textinput_vim_minimal"
required-features = ["gui", "textinput", "keybindings", "cursor-style"]
path = "examples/minimal/textinput_vim_minimal.rs"
