README

mizchi/tui/core does not have a README file

#
BorderChars

pub(all) struct BorderChars {
top_left : Char
top_right : Char
bottom_left : Char
bottom_right : Char
horizontal : Char
vertical : Char
}

Border characters for box drawing

#
BorderChars::ascii

fn BorderChars::ascii() -> BorderChars

#
BorderChars::double

fn BorderChars::double() -> BorderChars

#
BorderChars::rounded

fn BorderChars::rounded() -> BorderChars

#
BorderChars::single

fn BorderChars::single() -> BorderChars

#
ClickHandler

pub(all) struct ClickHandler(() -> Unit)

Click handler type for component-level event handling

#
ClickHandler::invoke

fn ClickHandler::invoke(self : ClickHandler) -> Unit

Invoke click handler

#
ClickHandler::new

fn ClickHandler::new(handler : () -> Unit) -> ClickHandler

Create a new click handler

#
ClickHandlers

pub(all) struct ClickHandlers(Map[String, ClickHandler])

Click handlers map (component ID -> handler)

#
ClickHandlers::get

fn ClickHandlers::get(self : ClickHandlers, id : String) -> ClickHandler?

#
ClickHandlers::iter

fn ClickHandlers::iter(self : ClickHandlers) -> Iter[(String, ClickHandler)]

#
ClickHandlers::new

#
ClickHandlers::set

fn ClickHandlers::set(self : ClickHandlers, id : String, handler : ClickHandler) -> Unit

#
Color

pub(all) struct Color {
r : Int
g : Int
b : Int
a : Double
}

TUI Color type (RGBA)
impl Eq for Color

#
Color::black

fn Color::black() -> Color

#
Color::blue

fn Color::blue() -> Color

#
Color::cyan

fn Color::cyan() -> Color

#
Color::from_crater

fn Color::from_crater(c :
Color
) -> Color

Convert from crater Color

#
Color::green

fn Color::green() -> Color

#
Color::is_transparent

fn Color::is_transparent(self : Color) -> Bool

#
Color::magenta

fn Color::magenta() -> Color

#
Color::red

fn Color::red() -> Color

#
Color::rgb

fn Color::rgb(r : Int, g : Int, b : Int) -> Color

#
Color::rgba

fn Color::rgba(r : Int, g : Int, b : Int, a : Double) -> Color

#
Color::transparent

fn Color::transparent() -> Color

#
Color::white

fn Color::white() -> Color

#
Color::yellow

fn Color::yellow() -> Color

#
Component

pub struct Component {
node :
Node

styles : RenderStyleMap
texts : TextContentMap
click_handlers : ClickHandlers
roles : RoleMap
}

Component represents a renderable UI element with its layout, style, and content Note: Fields are internal implementation details. Use accessor methods for external access.

#
Component::get_click_handlers

fn Component::get_click_handlers(self : Component) -> ClickHandlers

Get click handlers (internal use)

#
Component::get_node

Get the layout node (internal use)

#
Component::get_role

fn Component::get_role(self : Component, id : String) -> Role?

Check if component has a specific role

#
Component::get_roles

fn Component::get_roles(self : Component) -> RoleMap

Get roles map (internal use)

#
Component::get_styles

fn Component::get_styles(self : Component) -> RenderStyleMap

Get the styles map (internal use)

#
Component::get_text

fn Component::get_text(self : Component, id : String) -> String?

Get text content by ID

#
Component::get_texts

fn Component::get_texts(self : Component) -> TextContentMap

Get the text content map (internal use)

#
Component::id

fn Component::id(self : Component) -> String

Get the component's ID

#
GridRect

pub struct GridRect {
x : Int
y : Int
width : Int
height : Int
} derive(Eq,
Debug
)

impl Show for GridRect

#
RenderStyle

pub(all) struct RenderStyle {
fg : Color
bg : Color
bold : Bool
underline : Bool
border : BorderChars?
border_fg : Color
}

Rendering options for a node

#
RenderStyle::default

fn RenderStyle::default() -> RenderStyle

#
RenderStyleMap

pub struct RenderStyleMap(Map[String, RenderStyle])

Map from node ID to render style

#
RenderStyleMap::get

fn RenderStyleMap::get(self : RenderStyleMap, id : String) -> RenderStyle

#
RenderStyleMap::new

#
RenderStyleMap::set

fn RenderStyleMap::set(self : RenderStyleMap, id : String, style : RenderStyle) -> Unit

#
Role

pub(all) enum Role {
Button
Checkbox
Link
Menuitem
Option
Radio
Slider
Switch
Tab
Textbox
Listbox
Menu
Menubar
Radiogroup
Tablist
Tree
Treegrid
Article
Cell
Columnheader
Definition
Directory
Document
Group
Heading
Img
List
Listitem
Row
Rowgroup
Rowheader
Separator
Table
Term
Banner
Complementary
Contentinfo
Form
Main
Navigation
Region
Search
Alert
Log
Marquee
Status
Timer
Alertdialog
Dialog
Custom(String)
} derive(Eq,
Debug
)

ARIA role for accessibility Based on WAI-ARIA 1.2 roles
impl Show for Role

#
RoleMap

pub(all) struct RoleMap(Map[String, Role])

Role map (component ID -> role)

#
RoleMap::get

fn RoleMap::get(self : RoleMap, id : String) -> Role?

#
RoleMap::iter

fn RoleMap::iter(self : RoleMap) -> Iter[(String, Role)]

#
RoleMap::new

fn RoleMap::new() -> RoleMap

#
RoleMap::set

fn RoleMap::set(self : RoleMap, id : String, role : Role) -> Unit

#
TextContentMap

pub struct TextContentMap(Map[String, String])

Map from node ID to text content

#
TextContentMap::get

fn TextContentMap::get(self : TextContentMap, id : String) -> String?

#
TextContentMap::new

#
TextContentMap::set

fn TextContentMap::set(self : TextContentMap, id : String, text : String) -> Unit

#
box

fn box(children : Array[Component], id? : String, width? :
Dimension
, height? :
Dimension
, min_width? :
Dimension
, min_height? :
Dimension
, max_width? :
Dimension
, max_height? :
Dimension
, flex_grow? : Double, flex_shrink? : Double, flex_basis? :
Dimension
, flex_direction? :
FlexDirection
, flex_wrap? :
FlexWrap
, justify_content? :
Alignment
, align_items? :
Alignment
, align_content? :
Alignment
, gap? : Double, padding? : Double, padding_x? : Double, padding_y? : Double, margin? : Double, margin_x? : Double, margin_y? : Double, position? :
Position
, inset_top? :
Dimension
, inset_right? :
Dimension
, inset_bottom? :
Dimension
, inset_left? :
Dimension
, border? : BorderChars?, border_color? : Color, bg? : Color, fg? : Color, on_click? : () -> Unit?, role? : Role?) -> Component

Create a box component

#
char_display_width

fn char_display_width(c : Char) -> Int

Get display width of a character (1 for normal, 2 for wide/CJK)

#
normalize_grid_rect

fn normalize_grid_rect(abs_x : Double, abs_y : Double, width : Double, height : Double) -> GridRect

Normalize a rectangle by snapping both start and end edges. Width/height are derived from snapped edges to keep geometry consistent.

#
normalize_grid_rect_with_inset

fn normalize_grid_rect_with_inset(abs_x : Double, abs_y : Double, width : Double, height : Double, inset_left : Double, inset_top : Double, inset_right : Double, inset_bottom : Double) -> GridRect

Normalize an inner rectangle by applying insets before edge snapping.

#
snap_to_grid

fn snap_to_grid(value : Double) -> Int

Snap a floating-point coordinate to the nearest terminal cell.

#
spacer

fn spacer(flex_grow? : Double) -> Component

Spacer component - flexible empty space

#
string_display_width

fn string_display_width(s : String) -> Int

Calculate display width of a string

#
styled_text

fn styled_text(content : String, fg? : Color, bg? : Color, bold? : Bool, underline? : Bool) -> Component

Create a styled text (alias for text with labeled arguments)

#
text

fn text(content : String, fg? : Color, bg? : Color, bold? : Bool, underline? : Bool) -> Component

Create a text component

#
text_box

fn text_box(content : String, id? : String, width? :
Dimension
, height? :
Dimension
, min_width? :
Dimension
, min_height? :
Dimension
, max_width? :
Dimension
, max_height? :
Dimension
, flex_grow? : Double, flex_shrink? : Double, flex_basis? :
Dimension
, padding? : Double, padding_x? : Double, padding_y? : Double, margin? : Double, margin_x? : Double, margin_y? : Double, border? : BorderChars?, border_color? : Color, bg? : Color, fg? : Color, bold? : Bool, underline? : Bool) -> Component

Create a box with text content that wraps within the box's bounds Unlike text(), this renders the text directly within the box's layout dimensions

#
text_measure_func

fn text_measure_func(text : String) ->
MeasureFunc

Create a MeasureFunc for text that uses character width

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io