Liking cljdoc? Tell your friends :D

charm.ansi.parser

ANSI escape sequence parsing.

Parses ANSI escape sequences into structured data for processing.

ANSI escape sequence parsing.

Parses ANSI escape sequences into structured data for processing.
raw docstring

charm.ansi.width

Text width calculation for terminal display.

Handles:

  • ANSI escape sequences (zero width)
  • Wide characters (CJK, emojis = 2 cells)
  • Combining characters (zero width)
  • Grapheme clusters (emoji sequences)
Text width calculation for terminal display.

Handles:
- ANSI escape sequences (zero width)
- Wide characters (CJK, emojis = 2 cells)
- Combining characters (zero width)
- Grapheme clusters (emoji sequences)
raw docstring

charm.components.help

Help component for displaying key bindings.

Usage: (def bindings [{:key "j/k" :desc "up/down"} {:key "q" :desc "quit"}]) (def my-help (help bindings))

;; In view function: (help-view my-help)

Help component for displaying key bindings.

Usage:
  (def bindings [{:key "j/k" :desc "up/down"}
                 {:key "q" :desc "quit"}])
  (def my-help (help bindings))

  ;; In view function:
  (help-view my-help)
raw docstring

charm.components.list

Scrollable list component with item selection.

Usage: (def my-list (item-list ["Apple" "Banana" "Cherry"]))

;; In update function: (list-update my-list msg)

;; In view function: (list-view my-list)

Scrollable list component with item selection.

Usage:
  (def my-list (item-list ["Apple" "Banana" "Cherry"]))

  ;; In update function:
  (list-update my-list msg)

  ;; In view function:
  (list-view my-list)
raw docstring

charm.components.paginator

Pagination component for displaying page indicators.

Usage: (def pager (paginator :total-pages 5))

;; In update function: (paginator-update pager msg)

;; In view function: (paginator-view pager)

Pagination component for displaying page indicators.

Usage:
  (def pager (paginator :total-pages 5))

  ;; In update function:
  (paginator-update pager msg)

  ;; In view function:
  (paginator-view pager)
raw docstring

charm.components.progress

Progress bar component.

Usage: (def my-progress (progress-bar :width 40))

;; Update progress (0.0 to 1.0): (set-progress my-progress 0.5)

;; In view function: (progress-view my-progress)

Progress bar component.

Usage:
  (def my-progress (progress-bar :width 40))

  ;; Update progress (0.0 to 1.0):
  (set-progress my-progress 0.5)

  ;; In view function:
  (progress-view my-progress)
raw docstring

charm.components.spinner

Animated spinner component.

Usage: (def my-spinner (spinner :dots))

;; In update function: (spinner-update my-spinner msg)

;; In view function: (spinner-view my-spinner)

Animated spinner component.

Usage:
  (def my-spinner (spinner :dots))

  ;; In update function:
  (spinner-update my-spinner msg)

  ;; In view function:
  (spinner-view my-spinner)
raw docstring

charm.components.text-input

Text input component with cursor movement and editing.

Usage: (def my-input (text-input :prompt "Name: "))

;; In update function: (text-input-update my-input msg)

;; In view function: (text-input-view my-input)

Text input component with cursor movement and editing.

Usage:
  (def my-input (text-input :prompt "Name: "))

  ;; In update function:
  (text-input-update my-input msg)

  ;; In view function:
  (text-input-view my-input)
raw docstring

charm.components.timer

Countdown timer component.

Usage: (def my-timer (timer :timeout 60000)) ; 60 seconds

;; In update function: (timer-update my-timer msg)

;; In view function: (timer-view my-timer)

Countdown timer component.

Usage:
  (def my-timer (timer :timeout 60000))  ; 60 seconds

  ;; In update function:
  (timer-update my-timer msg)

  ;; In view function:
  (timer-view my-timer)
raw docstring

charm.core

charm.clj - A Clojure TUI library inspired by Bubble Tea.

This is the main entry point for charm.clj applications.

Example usage:

(require '[charm.core :as charm])

(defn update-fn [state msg]
  (cond
    (charm/key-match? msg "k") [(update state :count inc) nil]
    (charm/key-match? msg "j") [(update state :count dec) nil]
    (charm/key-match? msg "q") [state charm/quit-cmd]
    :else [state nil]))

(defn view [state]
  (str "Count: " (:count state) "\n\n(j/k to change, q to quit)"))

(charm/run {:init {:count 0}
            :update update-fn
            :view view})
charm.clj - A Clojure TUI library inspired by Bubble Tea.

This is the main entry point for charm.clj applications.

Example usage:
```clojure
(require '[charm.core :as charm])

(defn update-fn [state msg]
  (cond
    (charm/key-match? msg "k") [(update state :count inc) nil]
    (charm/key-match? msg "j") [(update state :count dec) nil]
    (charm/key-match? msg "q") [state charm/quit-cmd]
    :else [state nil]))

(defn view [state]
  (str "Count: " (:count state) "\n\n(j/k to change, q to quit)"))

(charm/run {:init {:count 0}
            :update update-fn
            :view view})
```
raw docstring

charm.input.handler

Terminal input handling.

Reads raw terminal input and converts it to structured key and mouse events.

Terminal input handling.

Reads raw terminal input and converts it to structured
key and mouse events.
raw docstring

charm.input.keymap

JLine KeyMap-based escape sequence handling.

Uses JLine's KeyMap for efficient O(1) escape sequence lookup with terminal capability awareness.

JLine KeyMap-based escape sequence handling.

Uses JLine's KeyMap for efficient O(1) escape sequence lookup
with terminal capability awareness.
raw docstring

charm.input.keys

Key sequence definitions and parsing.

Maps terminal escape sequences to key types and provides utilities for key identification.

For escape sequence lookup, see charm.input.keymap which uses JLine's KeyMap for efficient terminal-aware sequence matching.

Key sequence definitions and parsing.

Maps terminal escape sequences to key types and provides
utilities for key identification.

For escape sequence lookup, see charm.input.keymap which uses
JLine's KeyMap for efficient terminal-aware sequence matching.
raw docstring

charm.input.mouse

Mouse event parsing for terminal input.

Supports:

  • X10 mouse encoding (CSI M followed by 3 bytes)
  • SGR mouse encoding (CSI < params M/m)
Mouse event parsing for terminal input.

Supports:
- X10 mouse encoding (CSI M followed by 3 bytes)
- SGR mouse encoding (CSI < params M/m)
raw docstring

charm.message

Message types for charm.clj TUI applications.

Messages are plain maps with a :type key for easy pattern matching. Use factory functions to create messages and predicates to check types.

Message types for charm.clj TUI applications.

Messages are plain maps with a :type key for easy pattern matching.
Use factory functions to create messages and predicates to check types.
raw docstring

charm.program

The Elm Architecture event loop for TUI applications.

A program consists of:

  • init: Initial state and optional startup command
  • update: (state, msg) -> [new-state, cmd]
  • view: state -> string

Commands are functions that produce messages asynchronously.

The Elm Architecture event loop for TUI applications.

A program consists of:
- init: Initial state and optional startup command
- update: (state, msg) -> [new-state, cmd]
- view: state -> string

Commands are functions that produce messages asynchronously.
raw docstring

charm.render.core

Terminal renderer using JLine's Display for efficient diffing.

Provides a high-level rendering API that efficiently updates the terminal by only redrawing changed content.

Terminal renderer using JLine's Display for efficient diffing.

Provides a high-level rendering API that efficiently updates
the terminal by only redrawing changed content.
raw docstring

charm.render.screen

ANSI control sequences for terminal features without JLine capability equivalents.

For cursor movement, screen clearing, and alt screen, use charm.terminal which uses JLine's capability-based approach for better terminal compatibility.

ANSI control sequences for terminal features without JLine capability equivalents.

For cursor movement, screen clearing, and alt screen, use charm.terminal
which uses JLine's capability-based approach for better terminal compatibility.
raw docstring

charm.style.border

Border rendering for styled boxes.

Provides predefined border styles and functions for rendering borders around text content.

Border rendering for styled boxes.

Provides predefined border styles and functions for
rendering borders around text content.
raw docstring

charm.style.color

Terminal color handling.

Supports:

  • ANSI 16 basic colors (0-15)
  • ANSI 256 extended palette (0-255)
  • True color RGB (24-bit)
Terminal color handling.

Supports:
- ANSI 16 basic colors (0-15)
- ANSI 256 extended palette (0-255)
- True color RGB (24-bit)
raw docstring

charm.style.core

Main styling API.

Create styles as maps and apply them to text.

Example: (def my-style (style :fg (rgb 255 0 0) :bold true :padding [1 2])) (render my-style "Hello!") ; => styled text

Main styling API.

Create styles as maps and apply them to text.

Example:
  (def my-style (style :fg (rgb 255 0 0) :bold true :padding [1 2]))
  (render my-style "Hello!")  ; => styled text
raw docstring

charm.style.layout

Layout utilities: padding, margin, alignment, and joining.

Layout utilities: padding, margin, alignment, and joining.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close