# drafter v0.4.0 - Table of Contents An Elixir Terminal User Interface framework ## Pages - [Drafter](readme.md) - [Changelog](changelog.md) - [Remote TUI](remote_tui.md) - [Writing Widgets & Libraries](writing_widgets.md) - [Large Text](large_text.md) - [Design Notes](design_notes.md) ## Modules - [Drafter.Accounts](Drafter.Accounts.md): A file-backed store of user accounts for a served application. - [Drafter.Accounts.RegisterApp](Drafter.Accounts.RegisterApp.md): The form a new user fills in to create an account. - [Drafter.Accounts.Throttle](Drafter.Accounts.Throttle.md): Failed-login bookkeeping per peer address. - [Drafter.ActionHandler](Drafter.ActionHandler.md): Behaviour for handling application action return values. - [Drafter.ActionRegistry](Drafter.ActionRegistry.md): Per-session registry for `Drafter.ActionHandler` modules. - [Drafter.AppRegistry](Drafter.AppRegistry.md): Registry of running application loops, keyed by session. - [Drafter.CellSession.Driver](Drafter.CellSession.Driver.md): A terminal driver that holds a screen size and discards everything written to it. - [Drafter.CharacterWidth.Default](Drafter.CharacterWidth.Default.md): Drafter's own width tables, and the default `Drafter.CharacterWidth`. - [Drafter.Compositor](Drafter.Compositor.md): Holds one session's screen as rows of styled cells and writes changed rows to its terminal. - [Drafter.Draw.BoxDrawing](Drafter.Draw.BoxDrawing.md): Unicode box drawing characters, and functions that assemble them into lines, boxes and borders. - [Drafter.Event.Manager](Drafter.Event.Manager.md): Fans events out from the terminal driver to the processes that want them. - [Drafter.EventHandler](Drafter.EventHandler.md): Dispatches events to registered callback functions, in registration levels. - [Drafter.EventResult](Drafter.EventResult.md): Normalises what a widget's `handle_event/2` returned into the triple the router uses. - [Drafter.LayerCompositor](Drafter.LayerCompositor.md): Composites independently rendered layers into a single list of strips. - [Drafter.Render.Writer](Drafter.Render.Writer.md): The one process that writes a session's terminal, for `Drafter.Compositor`. - [Drafter.RenderCache](Drafter.RenderCache.md): Process-dictionary cache for incremental rendering. - [Drafter.RingBuffer](Drafter.RingBuffer.md): A bounded circular buffer backed by an integer-keyed map. - [Drafter.Runtime](Drafter.Runtime.md): Behaviour for pluggable application runtime backends. - [Drafter.Runtime.AppLoop](Drafter.Runtime.AppLoop.md): The Drafter application event loop. - [Drafter.Runtime.Callback](Drafter.Runtime.Callback.md): Default LiveView-style runtime backend. - [Drafter.Runtime.FrameClock](Drafter.Runtime.FrameClock.md): Converts an application's `:refresh_rate` setting into a frame interval. - [Drafter.Runtime.Reducer](Drafter.Runtime.Reducer.md): Elm-style reducer runtime backend. - [Drafter.Runtime.Renderer](Drafter.Runtime.Renderer.md): Rendering pipeline for Drafter applications. - [Drafter.Runtime.Shared](Drafter.Runtime.Shared.md): Runtime backend for shared multi-user sessions (e.g. an SSH chat served to many clients). - [Drafter.Style.CSSParser](Drafter.Style.CSSParser.md): Parses a CSS-like stylesheet into a `Drafter.Style.Stylesheet`. - [Drafter.Style.Computed](Drafter.Style.Computed.md): Resolves a widget's final style: stylesheet cascade, then inline overrides, then theme colour lookup. - [Drafter.Style.Selector](Drafter.Style.Selector.md): A parsed CSS-like selector, and the rules for matching one against a widget. - [Drafter.Style.Stylesheet](Drafter.Style.Stylesheet.md): An ordered list of `{selectors, style}` rules, and the cascade that resolves them. - [Drafter.Style.StylesheetLoader](Drafter.Style.StylesheetLoader.md): Loads and caches the stylesheet an app renders against. - [Drafter.Style.WidgetStyles](Drafter.Style.WidgetStyles.md): The built-in stylesheet every app starts from. - [Drafter.Syntax.TSFeatures](Drafter.Syntax.TSFeatures.md): Parses Tree-sitter-style captures into structured highlight, fold, symbol, and textobject data. - [Drafter.TableOwner](Drafter.TableOwner.md): Owns the framework's shared ETS tables. - [Drafter.Terminal.ANSI](Drafter.Terminal.ANSI.md): Decodes terminal input bytes into events and builds terminal output sequences. - [Drafter.Terminal.Driver](Drafter.Terminal.Driver.md): Owns the local terminal: raw mode, alternate screen, mouse reporting, input decoding. - [Drafter.Terminal.InputBuffer](Drafter.Terminal.InputBuffer.md): Carries partially-received terminal input across reads. - [Drafter.Terminal.KittyKeyboard](Drafter.Terminal.KittyKeyboard.md): The kitty keyboard protocol: the sequences that switch it on and off, and the parsing of the key reports a terminal sends while it is on. - [Drafter.Terminal.Reports](Drafter.Terminal.Reports.md): Replies to the questions a driver asks a terminal at startup, other than the graphics and keyboard ones. - [Drafter.Terminal.SignalWatcher](Drafter.Terminal.SignalWatcher.md): Forwards `SIGWINCH` to the terminal driver. - [Drafter.Terminal.TermiosNif](Drafter.Terminal.TermiosNif.md): Terminal and pseudoterminal control through the `termios_nif` native library. - [Drafter.Visualization](Drafter.Visualization.md): Numeric helpers shared across Drafter widgets for data visualization. - [Drafter.Visualization.LTTB](Drafter.Visualization.LTTB.md): Largest Triangle Three Buckets downsampling algorithm. - [Drafter.Widget.Callback](Drafter.Widget.Callback.md): Wraps atom event names or functions into closures for widget callback wiring. - [Drafter.Widget.Chart.Pixel](Drafter.Widget.Chart.Pixel.md): Renders chart data as terminal graphics via the frozen `french_curve` library. - [Drafter.Widget.DataChannel](Drafter.Widget.DataChannel.md): Buffered data ingestion channel for a single widget. - [Drafter.Widget.Digits.Bitmap](Drafter.Widget.Digits.Bitmap.md): The glyph shapes behind the rasterised fonts in `Drafter.Widget.Digits.Font`. - [Drafter.Widget.Digits.Image](Drafter.Widget.Digits.Image.md): Draws `Drafter.Widget.Digits` text as a transmitted terminal image. - [Drafter.Widget.Digits.Raster](Drafter.Widget.Digits.Raster.md): Rasterises `Drafter.Widget.Digits.Bitmap` glyphs into terminal cells. - [Drafter.Widget.EventRouter](Drafter.Widget.EventRouter.md): Turns an event tuple into the right callback on a widget module. - [Drafter.Widget.Slider.Pixel](Drafter.Widget.Slider.Pixel.md): Draws `Drafter.Widget.Slider` through the `french_curve` rasteriser. - [Drafter.Widget.Slider.Scale](Drafter.Widget.Slider.Scale.md): Value arithmetic for `Drafter.Widget.Slider`. - [Drafter.Widget.Trait.Animatable](Drafter.Widget.Trait.Animatable.md): Trait that provides render timestamp for animation frames. - [Drafter.Widget.Trait.Collapsible](Drafter.Widget.Trait.Collapsible.md): Trait that adds expand/collapse capability. - [Drafter.Widget.Trait.Draggable](Drafter.Widget.Trait.Draggable.md): Trait that adds drag-and-drop capability. - [Drafter.Widget.Trait.Editable](Drafter.Widget.Trait.Editable.md): Trait that adds text editing capability. - [Drafter.Widget.Trait.Focusable](Drafter.Widget.Trait.Focusable.md): Trait that makes a widget focusable. - [Drafter.Widget.Trait.Pipeline](Drafter.Widget.Trait.Pipeline.md): Runs the trait event pipeline for a widget. - [Drafter.Widget.Trait.Resizable](Drafter.Widget.Trait.Resizable.md): Trait that adds resize capability via drag handles. - [Drafter.Widget.Trait.Scrollable](Drafter.Widget.Trait.Scrollable.md): Trait that adds scrolling capability to a widget. - [Drafter.Widget.Trait.Selectable](Drafter.Widget.Trait.Selectable.md): Trait that adds item selection capability. - [Drafter.WidgetHierarchy.EventRouter](Drafter.WidgetHierarchy.EventRouter.md): Routes an event through a widget hierarchy and collects the actions it produced. - [Drafter.WidgetPidRegistry](Drafter.WidgetPidRegistry.md): Maps widget ids to their server processes, scoped to the owning session. - [Drafter.WidgetValue](Drafter.WidgetValue.md): Reads and writes a widget's primary value by the shape of its state. - Remote Servers - [Drafter.Server](Drafter.Server.md): Start SSH and Telnet servers for hosting TUI applications over the network. - Core - [Drafter](Drafter.md): Entry point of the Drafter terminal UI framework. - [Drafter.App](Drafter.App.md): Declarative API for building a Drafter terminal application. - [Drafter.Layout](Drafter.Layout.md): Pure layout calculation for the component tree. - [Drafter.Screen](Drafter.Screen.md): Behaviour and data structure for screens in a TUI application. - [Drafter.Widget](Drafter.Widget.md): Behaviour for a Drafter widget: a component that owns state, draws itself into a rect, and handles events. - [Drafter.Widget.Trait](Drafter.Widget.Trait.md): Behaviour for composable widget traits. - [Drafter.WidgetLibrary](Drafter.WidgetLibrary.md): Macro for packaging and registering collections of Drafter widgets. - Events - [Drafter.Event](Drafter.Event.md): The event vocabulary: the tagged tuples an application and a widget receive. - [Drafter.Event.Delegation](Drafter.Event.Delegation.md): Routes an event to widgets related to a given widget in the hierarchy. - [Drafter.Event.Object](Drafter.Event.Object.md): Rich event struct with DOM-like three-phase dispatch and propagation control. - Theming - [Drafter.CharacterSet](Drafter.CharacterSet.md): Named character lookup for TUI rendering. - [Drafter.Color](Drafter.Color.md): Color representation and parsing for terminal styling. - [Drafter.SkinManager](Drafter.SkinManager.md): Per-session GenServer that holds the active rendering skin and notifies the running application on change. - [Drafter.Style](Drafter.Style.md): Color and style utilities for widget rendering. - [Drafter.Theme](Drafter.Theme.md): Theme definition and built-in theme library for TUI applications. - [Drafter.ThemeManager](Drafter.ThemeManager.md): GenServer that holds the active theme and notifies the running application on change. - Terminal - [Drafter.CharacterWidth](Drafter.CharacterWidth.md): Terminal display width of text, in columns. - [Drafter.Clipboard](Drafter.Clipboard.md): Read and write the user's clipboard. - [Drafter.Pty](Drafter.Pty.md): Runs a program on a pseudoterminal and hands its byte stream to the caller. - [Drafter.Terminal.Probe](Drafter.Terminal.Probe.md): Asks the connected terminal which graphics protocol it supports. - Sessions - [Drafter.CellSession](Drafter.CellSession.md): Drives a Drafter app to an in-memory cell grid instead of a terminal. - [Drafter.Session.Context](Drafter.Session.Context.md): Resolves the per-session services a process is operating on behalf of. - Utilities - [Drafter.Format](Drafter.Format.md): Number formatting that produces strings suitable for the `digits` widget. - [Drafter.ScrollMath](Drafter.ScrollMath.md): Scroll offset and viewport calculations for list-like widgets. - [Drafter.Text](Drafter.Text.md): Unicode-aware text layout for terminal rendering. - [Drafter.Validation](Drafter.Validation.md): Input validation for TUI widgets. - Drawing - [Drafter.Draw.Canvas](Drafter.Draw.Canvas.md): Coordinate-based drawing surface for terminal primitives. - [Drafter.Draw.Segment](Drafter.Draw.Segment.md): The fundamental rendering unit: a string of text with a single style applied. - [Drafter.Draw.Strip](Drafter.Draw.Strip.md): A horizontal line of `Drafter.Draw.Segment` structs representing one terminal row. - Display Widgets - [Drafter.Widget.Breadcrumb](Drafter.Widget.Breadcrumb.md): Renders a horizontal breadcrumb trail with keyboard and mouse navigation. - [Drafter.Widget.CodeView](Drafter.Widget.CodeView.md): Renders a scrollable, syntax-highlighted code viewer with keyboard and drag navigation. - [Drafter.Widget.Digits](Drafter.Widget.Digits.md): Renders text as large characters, drawn with box outlines or with pixels packed into braille, quadrant, or half-block cells. - [Drafter.Widget.Digits.Figlet](Drafter.Widget.Digits.Figlet.md): Reads FIGlet fonts (`.flf`) into the glyph maps `Drafter.Widget.Digits.Font` serves. - [Drafter.Widget.Digits.Font](Drafter.Widget.Digits.Font.md): The font catalogue for `Drafter.Widget.Digits`. - [Drafter.Widget.Gauge](Drafter.Widget.Gauge.md): A semi-circular gauge chart rendered using Unicode braille characters. - [Drafter.Widget.Label](Drafter.Widget.Label.md): Renders a single line or multi-line string of styled text. - [Drafter.Widget.LoadingIndicator](Drafter.Widget.LoadingIndicator.md): Renders an animated spinner with an optional label. - [Drafter.Widget.Log](Drafter.Widget.Log.md): Renders a scrollable plain-text log panel that accepts streamed line output. - [Drafter.Widget.Markdown](Drafter.Widget.Markdown.md): Renders a subset of Markdown to the terminal with themed styling. - [Drafter.Widget.Meter](Drafter.Widget.Meter.md): Renders a horizontal or vertical meter with threshold-based color zones. - [Drafter.Widget.Placeholder](Drafter.Widget.Placeholder.md): Renders a coloured placeholder block useful during development and layout design. - [Drafter.Widget.Pretty](Drafter.Widget.Pretty.md): Renders an Elixir term with syntax-highlighted pretty-printing. - [Drafter.Widget.ProgressBar](Drafter.Widget.ProgressBar.md): Renders a horizontal progress bar with optional percentage, value, and ETA display. - [Drafter.Widget.RichLog](Drafter.Widget.RichLog.md): Renders a scrollable log panel where each line can carry per-line style metadata. - [Drafter.Widget.Rule](Drafter.Widget.Rule.md): Renders a horizontal or vertical divider line, optionally with an embedded title. - [Drafter.Widget.Sparkline](Drafter.Widget.Sparkline.md): Renders a compact sparkline chart using Unicode block characters. - Input Widgets - [Drafter.Widget.Button](Drafter.Widget.Button.md): A clickable button widget that triggers a callback when pressed or activated via keyboard. - [Drafter.Widget.Calendar](Drafter.Widget.Calendar.md): A monthly calendar grid widget with date selection and keyboard navigation. - [Drafter.Widget.Checkbox](Drafter.Widget.Checkbox.md): A boolean toggle widget that renders an `X` mark inside a box next to an optional label. - [Drafter.Widget.FilePicker](Drafter.Widget.FilePicker.md): A modal file picker screen for selecting files or directories. - [Drafter.Widget.Link](Drafter.Widget.Link.md): An inline hyperlink widget that opens a URL in the system browser when activated. - [Drafter.Widget.MaskedInput](Drafter.Widget.MaskedInput.md): A single-line text input that enforces a character-by-character format mask. - [Drafter.Widget.OptionList](Drafter.Widget.OptionList.md): A scrollable, single-selection list widget with keyboard, mouse, and scroll wheel navigation. - [Drafter.Widget.RadioSet](Drafter.Widget.RadioSet.md): A mutually exclusive radio button group where exactly one option can be selected at a time. - [Drafter.Widget.SelectionList](Drafter.Widget.SelectionList.md): A scrollable list widget that supports single or multiple item selection with checkbox-style indicators. - [Drafter.Widget.Slider](Drafter.Widget.Slider.md): A draggable value slider: a track, a fill up to the current value, a thumb, and an optional label and value readout. - [Drafter.Widget.Switch](Drafter.Widget.Switch.md): An animated toggle switch widget with on/off states. - [Drafter.Widget.TextArea](Drafter.Widget.TextArea.md): A multi-line text editor widget with cursor navigation, scrolling, and optional syntax highlighting. - [Drafter.Widget.TextInput](Drafter.Widget.TextInput.md): A single-line text input widget with cursor navigation, text selection, and clipboard support. - Data Widgets - [Drafter.Widget.Chart](Drafter.Widget.Chart.md): Renders time-series and financial data as interactive charts with multiple styles. - [Drafter.Widget.DataTable](Drafter.Widget.DataTable.md): A full-featured tabular data widget with column headers, sorting, row selection, and scrolling. - [Drafter.Widget.DirectoryTree](Drafter.Widget.DirectoryTree.md): A live file-system tree widget that reads directories lazily as nodes are expanded. - [Drafter.Widget.PieChart](Drafter.Widget.PieChart.md): Renders a circular pie chart using Unicode block and braille characters. - [Drafter.Widget.Tree](Drafter.Widget.Tree.md): A hierarchical tree widget that renders nested nodes with expand/collapse controls. - Layout Widgets - [Drafter.Widget.Box](Drafter.Widget.Box.md): Draws a titled border around a region; children render inside the border. - [Drafter.Widget.Card](Drafter.Widget.Card.md): Renders a bordered panel with an optional title and text content lines. - [Drafter.Widget.Collapsible](Drafter.Widget.Collapsible.md): Renders an expandable section with a title row and collapsible content. - [Drafter.Widget.Container](Drafter.Widget.Container.md): Holds and arranges child widgets using vertical, horizontal, or stack layouts. - [Drafter.Widget.Footer](Drafter.Widget.Footer.md): Renders a single-row key-binding bar, typically anchored to the bottom of a screen. - [Drafter.Widget.Grid](Drafter.Widget.Grid.md): Arranges child widgets in a uniform column grid, wrapping into multiple rows. - [Drafter.Widget.Header](Drafter.Widget.Header.md): Renders a single-row application header bar with a centred title and optional live clock. - [Drafter.Widget.ScrollableContainer](Drafter.Widget.ScrollableContainer.md): Tracks the scroll position of a viewport and renders its scrollbars. - [Drafter.Widget.SplitPaneDivider](Drafter.Widget.SplitPaneDivider.md): Renders a resizable divider between two panes in a split layout. - [Drafter.Widget.TabbedContent](Drafter.Widget.TabbedContent.md): Renders a bordered tabbed panel where each tab displays independent content. - Testing - [Drafter.Test](Drafter.Test.md): Headless testing of Drafter applications under ExUnit. - [Drafter.Test.Harness](Drafter.Test.Harness.md): Manages the lifecycle of a headless TUI app instance for testing. - [Drafter.WidgetHierarchy](Drafter.WidgetHierarchy.md): The mounted widget tree of a running application. - Animation - [Drafter.Animation](Drafter.Animation.md): GenServer that manages timed property animations for widgets.