8000 GitHub - akonwi/cooper: A TUI library · GitHub
[go: up one dir, main page]

Skip to content
akonwiPublic

About

A TUI library

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

248 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
< 8000 a title="website" aria-label="website, (Directory)" class="Link--primary" href="/akonwi/cooper/tree/main/website" data-discover="true">website
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cooper

An imperative retained-mode TUI framework powered by Vaxis.

Cooper is heavily influenced by OpenTUI. A lot of TUI libraries are immediate mode or use heavy functional paradigms, and I wanted a retained mode library that provided a similar imperative API to the DOM because that is intuitive to me, when building UIs. Also, I just wanted to build TUIs with my programming language, Ard.

Cooper operations dashboard example

Six spring presets responding to shared targets

Installation

ard add github.com/akonwi/cooper@latest

Quickstart

use cooper
use cooper/ui

fn main() {
  let application = cooper::app().expect("could not create app")
  defer application.destroy()
  
  let field = ui::input(
    application.context,
    placeholder: "Type here, then press Ctrl+C to quit",
    styles: ui::style(
      width: ui::percent(100.0),
      height: ui::cells(1),
    ),
  )

  application.root.add(field)
  field.focus()
  application.run().expect("run Cooper")
}

cooper is the application namespace for App, Runtime, and events. cooper/ui is the view-construction namespace for controls, layout, colors, geometry, selection, and rich text.

Features

  • Controls — Box, Text, Image, Input, TextArea, ScrollBox, Scrollbar, Select, TabSelect. See the controls list and examples.
  • Structural dividers — A ui::divider occupies one normal layout row; its bordered Box parent paints the connected ├──┤, ╠══╣, or ┣━━┫ junctions. This avoids fragile overdraw and inset-rule gaps in framed dialogs; cui::divider() provides the declarative form.
  • Animation — Runtime-owned timelines and springs with easing, looping, and momentum-preserving retargeting. See ADR 0014, ADR 0021, and the spring lab example.
  • Terminal screen modes< 66E3 /strong> — Alternate screen, main buffer, inline, and split-footer configurations. See ADR 0023 and the screen modes example.
  • Declarative components — Opt-in cooper/cui layer with persistent component structs, keyed reconciliation, and lifecycle hooks. (Feels like the good days of Backbone.js or React class components). See the framework guide.
  • Keymaps — Typed commands, scoped bindings, control remapping, and discoverable shortcut labels. See the keymap guide.
  • Clipboard, notifications, progress, program status, title — Runtime-exposed terminal services. See ADR 0006, ADR 0009, ADR 0010, ADR 0012, ADR 0027.

Examples

The runnable examples exercise the public application and control APIs. See examples/README.md for the full gallery, behavior descriptions, and PTY smoke tests.

Documentation

License

BSD 3-Clause.

About

A TUI library

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages

0