[package]
name = "canvas"
version.workspace = true
edition.workspace = true
license = "MIT OR Apache-2.0"
authors.workspace = true
description = "Form/textarea for TUI"
readme.workspace = true
repository.workspace = true
categories.workspace = true

[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.41"
tracing-subscriber = "0.3.19"
async-trait.workspace = true
regex = { workspace = true, optional = true }
ropey = { version = "1.6.1", optional = true }
once_cell = "1.21.3"
syntect = { version = "5.2.0", optional = true, default-features = false, features = ["default-fancy"] }

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

[features]
default = ["textmode-vim"]
gui = ["ratatui", "crossterm"]
suggestions = ["tokio"]
cursor-style = ["crossterm"]
validation = ["regex"]
computed = []
textarea = ["dep:ropey","gui"]
syntect = ["dep:syntect", "gui", "textarea"]
keymap = ["gui"]

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

all-nontextmodes = [
    "gui",
    "suggestions",
    "cursor-style",
    "validation",
    "computed",
    "textarea",
    "keymap"
]

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

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

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

[[example]]
name = "validation_1"
required-features = ["gui", "validation", "cursor-style"]

[[example]]
name = "validation_2"
required-features = ["gui", "validation", "cursor-style"]

[[example]]
name = "validation_3"
required-features = ["gui", "validation", "cursor-style"]

[[example]]
name = "validation_4"
required-features = ["gui", "validation", "cursor-style"]

[[example]]
name = "validation_5"
required-features = ["gui", "validation", "cursor-style"]

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

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

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

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

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