graphix-package-tui 0.9.0

A dataflow language for UIs and network programming, TUI package
Documentation
/// The type of a Tui, return this type from a shell expression to draw a Tui
type Tui = [
  `Text(text::Text),
  `Paragraph(paragraph::Paragraph),
  `Block(block::Block),
  `Scrollbar(scrollbar::Scrollbar),
  `Layout(layout::Layout),
  `Tabs(tabs::Tabs),
  `BarChart(barchart::BarChart),
  `Chart(chart::Chart),
  `Sparkline(sparkline::Sparkline),
  `LineGauge(line_gauge::LineGauge),
  `Gauge(gauge::Gauge),
  `InputHandler(input_handler::InputHandler),
  `List(list::List),
  `Table(table::Table),
  `Calendar(calendar::Calendar),
  `Canvas(canvas::Canvas)
];

type Color = [
  `Reset,
  `Black,
  `Red,
  `Green,
  `Yellow,
  `Blue,
  `Magenta,
  `Cyan,
  `Gray,
  `DarkGray,
  `LightRed,
  `LightGreen,
  `LightYellow,
  `LightBlue,
  `LightMagenta,
  `LightCyan,
  `White,
  `Rgb({ r: i64, g: i64, b: i64 }),
  `Indexed(i64)
];

type Modifier = [
  `Bold,
  `Italic
];

type Alignment = [
  `Left,
  `Center,
  `Right
];

type Style = {
  fg: [Color, null],
  bg: [Color, null],
  underline_color: [Color, null],
  add_modifier: [Array<Modifier>, null],
  sub_modifier: [Array<Modifier>, null]
};

val style: fn(
  ?#fg: [Color, null],
  ?#bg: [Color, null],
  ?#underline_color: [Color, null],
  ?#add_modifier: [Array<Modifier>, null],
  ?#sub_modifier: [Array<Modifier>, null]
) -> Style;

type Span = {
  style: Style,
  content: string
};

val span: fn(?#style: Style, content: string) -> Span;

type Line = {
  style: Style,
  alignment: [Alignment, null],
  spans: [Array<Span>, string]
};

val line: fn(?#style: Style, ?#alignment: [Alignment, null], spans: [Array<Span>, string]) -> Line;

type Direction = [
  `Horizontal,
  `Vertical
];

type Flex = [
  `Legacy,
  `Start,
  `End,
  `Center,
  `SpaceBetween,
  `SpaceEvenly,
  `SpaceAround
];

type HighlightSpacing = [
  `Always,
  `Never,
  `WhenSelected
];

type Constraint = [
  `Min(i64),
  `Max(i64),
  `Length(i64),
  `Percentage(i64),
  `Ratio(i64, i64),
  `Fill(i64)
];

type Marker = [
  `Dot,
  `Block,
  `Bar,
  `Braille,
  `HalfBlock,
  `Quadrant,
  `Sextant,
  `Octant
];

type Size = { width: i64, height: i64 };

/// The size of the terminal window. Setting this can't change
/// the terminal window size.
val size: Size;

mod input_handler;

/// The raw event stream from the terminal. Use input_handlers
/// to route events to widets in a more ergonomic way.
val event: input_handler::Event;

/// True if mouse input is enabled (and supported by the
/// terminal). Set this to true to enable mouse input.
val mouse: bool;

mod text;
mod paragraph;
mod block;
mod scrollbar;
mod layout;
mod tabs;
mod barchart;
mod chart;
mod sparkline;
mod line_gauge;
mod gauge;
mod list;
mod table;
mod calendar;
mod canvas;
mod browser;