package mosaic
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=9e4e90d17f9b2af1b07071fe425bc2c519c849c4f1d1ab73cde512be2d874849
sha512=06e9c4a741590942e81a27738d0b5c0413fafec8cf3b7dae047ad69f155e7b718aa4223818dc161b7d028efffcfd3365905e264d6fd31d453910ddfa91dcf9b9
doc/mosaic/Mosaic/index.html
Module MosaicSource
TEA (The Elm Architecture) runtime for terminal UIs.
Mosaic implements the Model-View-Update loop: the application maintains an immutable model, produces a t describing the UI from that model, and reacts to events by running an update function that returns a new model together with optional Cmd side-effects. Subscriptions (Sub) let the application express ongoing event interests such as timers, key presses, and terminal resize events.
- Geometry types and dimension helpers
- Layout enums and the Grid module
- Widget types
- UI elements
- Views, Commands, and Subscriptions
- Application and Running
The entry point is run.
Re-exports
Terminal ANSI escape sequences: colors (Ansi.Color), styles (Ansi.Style), and attributes (Ansi.Attr).
Border character sets for box-drawing. Provides Border.single, Border.rounded, Border.heavy, Border.double, and Border.ascii.
Input event types for keyboard, mouse, and paste events.
Geometry types
The type for 2-dimensional points.
The type for line segments with start and end values. Used by Grid.line_range and Grid.span_range for grid placement.
A contiguous run of text with a single visual style. Used by code for syntax highlighting via its ~spans argument.
Layout enum modules
CSS display property controlling box generation and child layout algorithm.
CSS box-sizing property.
CSS text-align property for block layout.
CSS flex-direction property.
Alignment along the cross/block axis (align-items, align-self, justify-items, justify-self).
Distribution of space between and around content items (align-content, justify-content).
CSS grid-auto-flow property.
Grid module
Widget types
Companion types for the tab_select widget.
Companion types for the scroll_bar widget.
Companion types for the line_number widget.
Syntax themes: maps capture-group names to terminal styles.
Views
The type for view nodes parameterized by message type 'msg. Event handlers embedded in a node return 'msg option: Some msg dispatches the message into the update loop; None ignores the event.
Build values of this type with the element constructors (box, text, input, etc.) and compose them with fragment.
map f view is view with every message transformed by f.
Use map to embed a child component whose message type differs from the parent's.
Commands
Subscriptions
Application
type ('model, 'msg) app = {init : unit -> 'model * 'msg Cmd.t;(*
*)init ()is the initial model and any startup commands. Called once before the first render.update : 'msg -> 'model -> 'model * 'msg Cmd.t;(*
*)update msg modelis the new model and any side-effects produced in response tomsg. Called once per dispatched message.view : 'model -> 'msg t;(*
*)view modelis the UI description formodel. Called on every render cycle when the model has changed.subscriptions : 'model -> 'msg Sub.t;(*
*)subscriptions modelis the set of events the application wants to receive givenmodel. Re-evaluated after every update.
}The type for a Mosaic application. Provide a value of this type to run.
Running
val run :
?matrix:Matrix.app ->
?process_perform:((unit -> unit) -> unit) ->
('model, 'msg) app ->
unitrun ?matrix ?process_perform app starts app and blocks until the application exits (via Cmd.quit or an OS signal).
matrix-- the low-level terminal backend. Defaults to a backend withtarget_fps = Some 60.and a hidden cursor.process_perform-- controls howCmd.t.Performcallbacks are executed. Receives a thunk that wraps the user callback with the dispatch function already wired in. The default spawns a nativeThreadper callback so that long-running operations (e.g. HTTP requests) never block the UI loop.
Eio integration. Pass a matrix and process_perform built with the matrix_eio library:
Eio_main.run @@ fun env ->
Eio.Switch.run @@ fun sw ->
let matrix =
Matrix_eio.create ~sw ~clock:(Eio.Stdenv.clock env) ~stdin:env#stdin
~stdout:env#stdout ()
in
let process_perform thunk =
Eio.Fiber.fork_daemon ~sw (fun () ->
thunk ();
`Stop_daemon)
in
Mosaic.run ~matrix ~process_perform { init; update; view; subscriptions }Daemon fibers are cancelled when the switch completes, so long-running perform operations do not block application shutdown.
Dimension helpers
auto is the automatic dimension, letting the layout engine determine the size.
size ~width ~height is a fixed size with the given width and height measured in terminal cells.
size_wh w h is a size with the given w width and h height dimensions.
gap n is a uniform gap of n cells applied to both axes of a flex or grid container.
gap_xy x y is a gap of x cells on the horizontal axis and y cells on the vertical axis.
padding n is a uniform padding of n cells on all four sides.
padding_xy x y is padding of x cells on the left and right sides and y cells on the top and bottom sides.
padding_lrtb l r t b is padding of l cells on the left, r on the right, t on the top, and b on the bottom.
margin n is a uniform margin of n cells on all four sides.
margin_xy x y is margin of x cells on the left and right sides and y cells on the top and bottom sides.
margin_lrtb l r t b is margin of l cells on the left, r on the right, t on the top, and b on the bottom.
inset n is a uniform inset of n cells on all four sides, used with position = `Absolute or position = `Fixed.
inset_lrtb l r t b is inset of l cells on the left, r on the right, t on the top, and b on the bottom.
UI elements
Every element constructor accepts a large set of optional layout and styling arguments that mirror CSS flexbox and grid properties. Arguments shared across all elements are listed once here; only element-specific arguments are documented on each constructor.
Common layout arguments
key-- reconciler identity hint for list items.id-- unique identifier used byCmd.focus.display-- layout mode (Display.t.Flex,Display.t.Grid,Display.t.Block, ...).box_sizing-- whethersizeincludes padding and border.position-- positioning scheme (Position.t.Relative,Position.t.Absolute).overflow-- how overflowing content is handled per axis.scrollbar_width-- width reserved for overflow scrollbars.text_align-- text alignment within the element.inset-- position offsets for absolutely-positioned elements.flex_direction,flex_wrap,justify_content,align_items,align_content,align_self,flex_grow,flex_shrink,flex_basis-- flexbox properties.justify_items,justify_self-- grid alignment properties.size,min_size,max_size-- element dimensions.aspect_ratio-- width-to-height ratio constraint.gap-- spacing between flex or grid children.padding-- inner spacing between border and content.margin-- outer spacing outside the border.border_width-- widths of each border side in cells.grid_template_rows,grid_template_columns,grid_auto_rows,grid_auto_columns,grid_auto_flow,grid_template_areas,grid_template_column_names,grid_template_row_names,grid_row,grid_column-- CSS grid properties.visible-- whenfalsethe element takes no space and is not rendered. Defaults totrue.z_index-- stacking order for overlapping elements.opacity-- alpha in [0.;1.];1.is fully opaque.focusable-- whentruethe element can receive keyboard focus. Defaults tofalse.autofocus-- whentruethe element receives focus on mount. Defaults tofalse.buffered-- whentruerenders to an off-screen buffer. Defaults tofalse.live-- whentruethe element re-renders every frame even when the model has not changed. Defaults tofalse.ref-- callback invoked with the renderedMosaic_ui.Renderable.tafter each frame.on_mouse-- mouse event handler for this element.on_key-- key event handler for this element.on_paste-- paste event handler for this element.
empty is the empty view that renders nothing and occupies no space. Useful as a placeholder.
fragment views groups views into a single view node without introducing a wrapping container element. Layout is applied to each child independently within the parent.
embed r wraps a pre-rendered Mosaic_ui.Renderable.t as a view node. Use this to integrate non-TEA rendering into the view tree.
val box :
?key:string ->
?id:string ->
?display:Display.t ->
?box_sizing:Box_sizing.t ->
?position:Position.t ->
?overflow:Overflow.t point ->
?scrollbar_width:float ->
?text_align:Text_align.t ->
?inset:length_percentage_auto rect ->
?flex_direction:Flex_direction.t ->
?flex_wrap:Flex_wrap.t ->
?justify_content:Justify.t ->
?align_items:Align.t ->
?size:dimension size ->
?min_size:dimension size ->
?max_size:dimension size ->
?aspect_ratio:float ->
?gap:length_percentage size ->
?padding:length_percentage rect ->
?margin:length_percentage_auto rect ->
?border_width:length_percentage rect ->
?align_self:Align.t ->
?align_content:Justify.t ->
?justify_items:Align.t ->
?justify_self:Align.t ->
?flex_grow:float ->
?flex_shrink:float ->
?flex_basis:dimension ->
?grid_template_rows:Grid.template list ->
?grid_template_columns:Grid.template list ->
?grid_auto_rows:Grid.track list ->
?grid_auto_columns:Grid.track list ->
?grid_auto_flow:Grid_auto_flow.t ->
?grid_template_areas:Grid.area list ->
?grid_template_column_names:string list list ->
?grid_template_row_names:string list list ->
?grid_row:Grid.placement line ->
?grid_column:Grid.placement line ->
?visible:bool ->
?z_index:int ->
?opacity:float ->
?focusable:bool ->
?autofocus:bool ->
?buffered:bool ->
?live:bool ->
?ref:(Mosaic_ui.Renderable.t -> unit) ->
?on_mouse:(Event.mouse -> 'msg option) ->
?on_key:(Event.key -> 'msg option) ->
?on_paste:(Event.paste -> 'msg option) ->
?border:bool ->
?border_style:Border.t ->
?border_sides:Border.side list ->
?border_color:Ansi.Color.t ->
?focused_border_color:Ansi.Color.t ->
?background:Ansi.Color.t ->
?fill:bool ->
?title:string ->
?title_alignment:[ `Left | `Center | `Right ] ->
'msg t list ->
'msg tbox children is a generic container element that lays out children according to the common layout arguments (see UI elements).
Box-specific optional arguments:
border-- whentruedraws a border usingborder_style. Defaults tofalse.border_style-- the border character set. Defaults toBorder.single.border_sides-- which sides to draw. Defaults to all four.border_color-- color of the border when unfocused. Defaults to white.focused_border_color-- color of the border when the element has focus. Defaults to bright cyan.background-- background fill color. Defaults to transparent.fill-- whentruefills the background over the entire allocated area. Defaults totrue.title-- text drawn in the top border. Has no effect whenborderisfalse.title_alignment-- alignment oftitlewithin the top border. Defaults to`Left.
val text :
?key:string ->
?id:string ->
?display:Display.t ->
?box_sizing:Box_sizing.t ->
?position:Position.t ->
?overflow:Overflow.t point ->
?scrollbar_width:float ->
?text_align:Text_align.t ->
?inset:length_percentage_auto rect ->
?flex_direction:Flex_direction.t ->
?flex_wrap:Flex_wrap.t ->
?justify_content:Justify.t ->
?align_items:Align.t ->
?size:dimension size ->
?min_size:dimension size ->
?max_size:dimension size ->
?aspect_ratio:float ->
?gap:length_percentage size ->
?padding:length_percentage rect ->
?margin:length_percentage_auto rect ->
?border_width:length_percentage rect ->
?align_self:Align.t ->
?align_content:Justify.t ->
?justify_items:Align.t ->
?justify_self:Align.t ->
?flex_grow:float ->
?flex_shrink:float ->
?flex_basis:dimension ->
?grid_template_rows:Grid.template list ->
?grid_template_columns:Grid.template list ->
?grid_auto_rows:Grid.track list ->
?grid_auto_columns:Grid.track list ->
?grid_auto_flow:Grid_auto_flow.t ->
?grid_template_areas:Grid.area list ->
?grid_template_column_names:string list list ->
?grid_template_row_names:string list list ->
?grid_row:Grid.placement line ->
?grid_column:Grid.placement line ->
?style:Ansi.Style.t ->
?visible:bool ->
?z_index:int ->
?opacity:float ->
?focusable:bool ->
?autofocus:bool ->
?buffered:bool ->
?live:bool ->
?ref:(Mosaic_ui.Renderable.t -> unit) ->
?on_mouse:(Event.mouse -> 'msg option) ->
?on_key:(Event.key -> 'msg option) ->
?on_paste:(Event.paste -> 'msg option) ->
?text_style:Ansi.Style.t ->
?wrap:Text_surface.wrap ->
?selectable:bool ->
?selection_bg:Ansi.Color.t ->
?selection_fg:Ansi.Color.t ->
?tab_width:int ->
?truncate:bool ->
string ->
'msg ttext s is a text element that renders the string s.
Text-specific optional arguments:
style-- ANSI style applied to the whole element. Defaults toAnsi.Style.default.text_style-- ANSI style applied to the text content only, composing withstyle. Defaults toAnsi.Style.default.wrap-- line-wrapping mode. Defaults to`None.selectable-- whentruethe user can select text with the mouse. Defaults totrue.selection_bg-- background color of selected text. Defaults to the terminal default.selection_fg-- foreground color of selected text. Defaults to the terminal default.tab_width-- number of cells a tab character expands to. Defaults to2.truncate-- whentrueclips content that overflows the allocated area instead of wrapping. Defaults tofalse.
val slider :
?key:string ->
?id:string ->
?display:Display.t ->
?box_sizing:Box_sizing.t ->
?position:Position.t ->
?overflow:Overflow.t point ->
?scrollbar_width:float ->
?text_align:Text_align.t ->
?inset:length_percentage_auto rect ->
?flex_direction:Flex_direction.t ->
?flex_wrap:Flex_wrap.t ->
?justify_content:Justify.t ->
?align_items:Align.t ->
?size:dimension size ->
?min_size:dimension size ->
?max_size:dimension size ->
?aspect_ratio:float ->
?gap:length_percentage size ->
?padding:length_percentage rect ->
?margin:length_percentage_auto rect ->
?border_width:length_percentage rect ->
?align_self:Align.t ->
?align_content:Justify.t ->
?justify_items:Align.t ->
?justify_self:Align.t ->
?flex_grow:float ->
?flex_shrink:float ->
?flex_basis:dimension ->
?grid_template_rows:Grid.template list ->
?grid_template_columns:Grid.template list ->
?grid_auto_rows:Grid.track list ->
?grid_auto_columns:Grid.track list ->
?grid_auto_flow:Grid_auto_flow.t ->
?grid_template_areas:Grid.area list ->
?grid_template_column_names:string list list ->
?grid_template_row_names:string list list ->
?grid_row:Grid.placement line ->
?grid_column:Grid.placement line ->
?visible:bool ->
?z_index:int ->
?opacity:float ->
?focusable:bool ->
?autofocus:bool ->
?buffered:bool ->
?live:bool ->
?ref:(Mosaic_ui.Renderable.t -> unit) ->
?on_mouse:(Event.mouse -> 'msg option) ->
?on_key:(Event.key -> 'msg option) ->
?on_paste:(Event.paste -> 'msg option) ->
?orientation:Slider.orientation ->
?value:float ->
?min:float ->
?max:float ->
?viewport_size:float ->
?track_color:Ansi.Color.t ->
?thumb_color:Ansi.Color.t ->
?on_value_change:(float -> 'msg option) ->
unit ->
'msg tslider () is an interactive range slider.
Slider-specific optional arguments:
orientation--`Horizontalor`Vertical. Defaults to`Horizontal.value-- current thumb position. Defaults to0..min-- minimum value of the range. Defaults to0..max-- maximum value of the range. Defaults to1..viewport_size-- size of the visible viewport relative to the total range; used to size the thumb proportionally.track_color-- color of the slider track.thumb_color-- color of the slider thumb.on_value_change-- callback fired when the value changes; receives the new value and returns an optional message.
val input :
?key:string ->
?id:string ->
?display:Display.t ->
?box_sizing:Box_sizing.t ->
?position:Position.t ->
?overflow:Overflow.t point ->
?scrollbar_width:float ->
?text_align:Text_align.t ->
?inset:length_percentage_auto rect ->
?flex_direction:Flex_direction.t ->
?flex_wrap:Flex_wrap.t ->
?justify_content:Justify.t ->
?align_items:Align.t ->
?size:dimension size ->
?min_size:dimension size ->
?max_size:dimension size ->
?aspect_ratio:float ->
?gap:length_percentage size ->
?padding:length_percentage rect ->
?margin:length_percentage_auto rect ->
?border_width:length_percentage rect ->
?align_self:Align.t ->
?align_content:Justify.t ->
?justify_items:Align.t ->
?justify_self:Align.t ->
?flex_grow:float ->
?flex_shrink:float ->
?flex_basis:dimension ->
?grid_template_rows:Grid.template list ->
?grid_template_columns:Grid.template list ->
?grid_auto_rows:Grid.track list ->
?grid_auto_columns:Grid.track list ->
?grid_auto_flow:Grid_auto_flow.t ->
?grid_template_areas:Grid.area list ->
?grid_template_column_names:string list list ->
?grid_template_row_names:string list list ->
?grid_row:Grid.placement line ->
?grid_column:Grid.placement line ->
?visible:bool ->
?z_index:int ->
?opacity:float ->
?focusable:bool ->
?autofocus:bool ->
?buffered:bool ->
?live:bool ->
?ref:(Mosaic_ui.Renderable.t -> unit) ->
?on_mouse:(Event.mouse -> 'msg option) ->
?on_key:(Event.key -> 'msg option) ->
?on_paste:(Event.paste -> 'msg option) ->
?value:string ->
?cursor:int ->
?selection:(int * int) option ->
?placeholder:string ->
?max_length:int ->
?text_color:Ansi.Color.t ->
?background_color:Ansi.Color.t ->
?focused_text_color:Ansi.Color.t ->
?focused_background_color:Ansi.Color.t ->
?placeholder_color:Ansi.Color.t ->
?selection_color:Ansi.Color.t ->
?selection_fg:Ansi.Color.t ->
?cursor_style:[ `Block | `Line | `Underline ] ->
?cursor_color:Ansi.Color.t ->
?cursor_blinking:bool ->
?on_input:(string -> 'msg option) ->
?on_change:(string -> 'msg option) ->
?on_submit:(string -> 'msg option) ->
?on_cursor:(cursor:int -> selection:(int * int) option -> 'msg option) ->
unit ->
'msg tinput () is a single-line text input field.
See textarea for the multi-line variant.
Input-specific optional arguments:
value-- current content of the field. Defaults to"".cursor-- optional controlled cursor grapheme offset.selection-- optional controlled selection range.placeholder-- hint text shown when the field is empty. Defaults to"".max_length-- maximum number of characters accepted. Defaults to1000.text_color-- foreground color of the text. Defaults to white.background_color-- background color of the field. Defaults to the terminal default.focused_text_color-- foreground color when focused. Defaults to white.focused_background_color-- background color when focused. Defaults to the terminal default.placeholder_color-- color of the placeholder text. Defaults to bright black (dark gray).selection_color-- background color of selected text. Defaults to blue.selection_fg-- foreground color of selected text. Defaults to the terminal default.cursor_style-- cursor shape:`Block,`Line, or`Underline. Defaults to`Block.cursor_color-- color of the cursor. Defaults to white.cursor_blinking-- whentruethe cursor blinks. Defaults totrue.on_input-- fired on every keystroke; receives the full current value after the change.on_change-- fired when the value changes after editing; semantics may differ fromon_inputdepending on the component.on_submit-- fired when the user presses Enter; receives the current value.on_cursor-- fired when cursor position or selection changes.
val select :
?key:string ->
?id:string ->
?display:Display.t ->
?box_sizing:Box_sizing.t ->
?position:Position.t ->
?overflow:Overflow.t point ->
?scrollbar_width:float ->
?text_align:Text_align.t ->
?inset:length_percentage_auto rect ->
?flex_direction:Flex_direction.t ->
?flex_wrap:Flex_wrap.t ->
?justify_content:Justify.t ->
?align_items:Align.t ->
?size:dimension size ->
?min_size:dimension size ->
?max_size:dimension size ->
?aspect_ratio:float ->
?gap:length_percentage size ->
?padding:length_percentage rect ->
?margin:length_percentage_auto rect ->
?border_width:length_percentage rect ->
?align_self:Align.t ->
?align_content:Justify.t ->
?justify_items:Align.t ->
?justify_self:Align.t ->
?flex_grow:float ->
?flex_shrink:float ->
?flex_basis:dimension ->
?grid_template_rows:Grid.template list ->
?grid_template_columns:Grid.template list ->
?grid_auto_rows:Grid.track list ->
?grid_auto_columns:Grid.track list ->
?grid_auto_flow:Grid_auto_flow.t ->
?grid_template_areas:Grid.area list ->
?grid_template_column_names:string list list ->
?grid_template_row_names:string list list ->
?grid_row:Grid.placement line ->
?grid_column:Grid.placement line ->
?visible:bool ->
?z_index:int ->
?opacity:float ->
?focusable:bool ->
?autofocus:bool ->
?buffered:bool ->
?live:bool ->
?ref:(Mosaic_ui.Renderable.t -> unit) ->
?on_mouse:(Event.mouse -> 'msg option) ->
?on_key:(Event.key -> 'msg option) ->
?on_paste:(Event.paste -> 'msg option) ->
?selected_index:int ->
?background:Ansi.Color.t ->
?text_color:Ansi.Color.t ->
?focused_background:Ansi.Color.t ->
?focused_text_color:Ansi.Color.t ->
?selected_background:Ansi.Color.t ->
?selected_text_color:Ansi.Color.t ->
?description_color:Ansi.Color.t ->
?selected_description_color:Ansi.Color.t ->
?show_description:bool ->
?show_scroll_indicator:bool ->
?wrap_selection:bool ->
?item_spacing:int ->
?fast_scroll_step:int ->
?on_change:(int -> 'msg option) ->
?on_activate:(int -> 'msg option) ->
Select.item list ->
'msg tselect items is a vertical list from which the user can choose one item.
See tab_select for a horizontal tab-bar variant.
Select-specific optional arguments:
selected_index-- zero-based index of the highlighted item. Defaults to0.background-- background color of unselected items.text_color-- foreground color of unselected items.focused_background-- background when the widget has focus.focused_text_color-- foreground when the widget has focus.selected_background-- background of the selected item.selected_text_color-- foreground of the selected item.description_color-- color of item description text.selected_description_color-- description color for the selected item.show_description-- whentrueshows item descriptions. Defaults totrue.show_scroll_indicator-- whentrueshows a scroll indicator when the list overflows. Defaults tofalse.wrap_selection-- whentruewraps the selection from the last item back to the first and vice versa. Defaults tofalse.item_spacing-- number of blank lines between items. Defaults to0.fast_scroll_step-- number of items skipped per fast-scroll action (e.g. Page Down). Defaults to5.on_change-- fired when the highlighted index changes; receives the new index.on_activate-- fired when the user confirms the selection (e.g. by pressing Enter); receives the confirmed index.
val tab_select :
?key:string ->
?id:string ->
?display:Display.t ->
?box_sizing:Box_sizing.t ->
?position:Position.t ->
?overflow:Overflow.t point ->
?scrollbar_width:float ->
?text_align:Text_align.t ->
?inset:length_percentage_auto rect ->
?flex_direction:Flex_direction.t ->
?flex_wrap:Flex_wrap.t ->
?justify_content:Justify.t ->
?align_items:Align.t ->
?size:dimension size ->
?min_size:dimension size ->
?max_size:dimension size ->
?aspect_ratio:float ->
?gap:length_percentage size ->
?padding:length_percentage rect ->
?margin:length_percentage_auto rect ->
?border_width:length_percentage rect ->
?align_self:Align.t ->
?align_content:Justify.t ->
?justify_items:Align.t ->
?justify_self:Align.t ->
?flex_grow:float ->
?flex_shrink:float ->
?flex_basis:dimension ->
?grid_template_rows:Grid.template list ->
?grid_template_columns:Grid.template list ->
?grid_auto_rows:Grid.track list ->
?grid_auto_columns:Grid.track list ->
?grid_auto_flow:Grid_auto_flow.t ->
?grid_template_areas:Grid.area list ->
?grid_template_column_names:string list list ->
?grid_template_row_names:string list list ->
?grid_row:Grid.placement line ->
?grid_column:Grid.placement line ->
?visible:bool ->
?z_index:int ->
?opacity:float ->
?focusable:bool ->
?autofocus:bool ->
?buffered:bool ->
?live:bool ->
?ref:(Mosaic_ui.Renderable.t -> unit) ->
?on_mouse:(Event.mouse -> 'msg option) ->
?on_key:(Event.key -> 'msg option) ->
?on_paste:(Event.paste -> 'msg option) ->
?selected:int ->
?tab_width:int ->
?background:Ansi.Color.t ->
?text_color:Ansi.Color.t ->
?focused_background:Ansi.Color.t ->
?focused_text_color:Ansi.Color.t ->
?selected_background:Ansi.Color.t ->
?selected_text_color:Ansi.Color.t ->
?description_color:Ansi.Color.t ->
?selected_description_color:Ansi.Color.t ->
?show_underline:bool ->
?show_description:bool ->
?show_scroll_arrows:bool ->
?wrap_selection:bool ->
?on_change:(int -> 'msg option) ->
?on_activate:(int -> 'msg option) ->
Tab_select.item list ->
'msg ttab_select items is a horizontal tab-bar selector.
See select for the vertical list variant.
Tab-select-specific optional arguments:
selected-- zero-based index of the active tab. Defaults to0.tab_width-- fixed width for each tab in cells. Defaults to12.background-- background color of inactive tabs.text_color-- foreground color of inactive tabs.focused_background-- background when the widget has focus.focused_text_color-- foreground when the widget has focus.selected_background-- background of the active tab.selected_text_color-- foreground of the active tab.description_color-- color of tab description text.selected_description_color-- description color for the active tab.show_underline-- whentruedraws an underline below tabs. Defaults totrue.show_description-- whentrueshows tab descriptions. Defaults tofalse.show_scroll_arrows-- whentrueshows arrows when tabs overflow the available width. Defaults totrue.wrap_selection-- whentruewraps from the last tab to the first and vice versa. Defaults tofalse.on_change-- fired when the active tab index changes.on_activate-- fired when the user confirms the tab selection.
val canvas :
?key:string ->
?id:string ->
?display:Display.t ->
?box_sizing:Box_sizing.t ->
?position:Position.t ->
?overflow:Overflow.t point ->
?scrollbar_width:float ->
?text_align:Text_align.t ->
?inset:length_percentage_auto rect ->
?flex_direction:Flex_direction.t ->
?flex_wrap:Flex_wrap.t ->
?justify_content:Justify.t ->
?align_items:Align.t ->
?size:dimension size ->
?min_size:dimension size ->
?max_size:dimension size ->
?aspect_ratio:float ->
?gap:length_percentage size ->
?padding:length_percentage rect ->
?margin:length_percentage_auto rect ->
?border_width:length_percentage rect ->
?align_self:Align.t ->
?align_content:Justify.t ->
?justify_items:Align.t ->
?justify_self:Align.t ->
?flex_grow:float ->
?flex_shrink:float ->
?flex_basis:dimension ->
?grid_template_rows:Grid.template list ->
?grid_template_columns:Grid.template list ->
?grid_auto_rows:Grid.track list ->
?grid_auto_columns:Grid.track list ->
?grid_auto_flow:Grid_auto_flow.t ->
?grid_template_areas:Grid.area list ->
?grid_template_column_names:string list list ->
?grid_template_row_names:string list list ->
?grid_row:Grid.placement line ->
?grid_column:Grid.placement line ->
?visible:bool ->
?z_index:int ->
?opacity:float ->
?focusable:bool ->
?autofocus:bool ->
?buffered:bool ->
?live:bool ->
?ref:(Mosaic_ui.Renderable.t -> unit) ->
?on_mouse:(Event.mouse -> 'msg option) ->
?on_key:(Event.key -> 'msg option) ->
?on_paste:(Event.paste -> 'msg option) ->
?respect_alpha:bool ->
(Canvas.t -> delta:float -> unit) ->
'msg tcanvas draw is a free-form drawing surface. draw c ~delta is called on every frame with a fresh Canvas.t c and the elapsed time delta in seconds since the previous frame. The canvas fills its allocated layout area.
Canvas-specific optional arguments:
respect_alpha-- whentruethe canvas composites with alpha blending. Defaults totrue.
val spinner :
?key:string ->
?id:string ->
?display:Display.t ->
?box_sizing:Box_sizing.t ->
?position:Position.t ->
?overflow:Overflow.t point ->
?scrollbar_width:float ->
?text_align:Text_align.t ->
?inset:length_percentage_auto rect ->
?flex_direction:Flex_direction.t ->
?flex_wrap:Flex_wrap.t ->
?justify_content:Justify.t ->
?align_items:Align.t ->
?size:dimension size ->
?min_size:dimension size ->
?max_size:dimension size ->
?aspect_ratio:float ->
?gap:length_percentage size ->
?padding:length_percentage rect ->
?margin:length_percentage_auto rect ->
?border_width:length_percentage rect ->
?align_self:Align.t ->
?align_content:Justify.t ->
?justify_items:Align.t ->
?justify_self:Align.t ->
?flex_grow:float ->
?flex_shrink:float ->
?flex_basis:dimension ->
?grid_template_rows:Grid.template list ->
?grid_template_columns:Grid.template list ->
?grid_auto_rows:Grid.track list ->
?grid_auto_columns:Grid.track list ->
?grid_auto_flow:Grid_auto_flow.t ->
?grid_template_areas:Grid.area list ->
?grid_template_column_names:string list list ->
?grid_template_row_names:string list list ->
?grid_row:Grid.placement line ->
?grid_column:Grid.placement line ->
?visible:bool ->
?z_index:int ->
?opacity:float ->
?focusable:bool ->
?autofocus:bool ->
?buffered:bool ->
?live:bool ->
?ref:(Mosaic_ui.Renderable.t -> unit) ->
?on_mouse:(Event.mouse -> 'msg option) ->
?on_key:(Event.key -> 'msg option) ->
?on_paste:(Event.paste -> 'msg option) ->
?frame_set:Spinner.frame_set ->
?color:Ansi.Color.t ->
unit ->
'msg tspinner () is an animated activity indicator.
Spinner-specific optional arguments:
frame_set-- the animation frame sequence. Defaults toSpinner.dots.color-- foreground color of the spinner character. Defaults to white.
val progress_bar :
?key:string ->
?id:string ->
?display:Display.t ->
?box_sizing:Box_sizing.t ->
?position:Position.t ->
?overflow:Overflow.t point ->
?scrollbar_width:float ->
?text_align:Text_align.t ->
?inset:length_percentage_auto rect ->
?flex_direction:Flex_direction.t ->
?flex_wrap:Flex_wrap.t ->
?justify_content:Justify.t ->
?align_items:Align.t ->
?size:dimension size ->
?min_size:dimension size ->
?max_size:dimension size ->
?aspect_ratio:float ->
?gap:length_percentage size ->
?padding:length_percentage rect ->
?margin:length_percentage_auto rect ->
?border_width:length_percentage rect ->
?align_self:Align.t ->
?align_content:Justify.t ->
?justify_items:Align.t ->
?justify_self:Align.t ->
?flex_grow:float ->
?flex_shrink:float ->
?flex_basis:dimension ->
?grid_template_rows:Grid.template list ->
?grid_template_columns:Grid.template list ->
?grid_auto_rows:Grid.track list ->
?grid_auto_columns:Grid.track list ->
?grid_auto_flow:Grid_auto_flow.t ->
?grid_template_areas:Grid.area list ->
?grid_template_column_names:string list list ->
?grid_template_row_names:string list list ->
?grid_row:Grid.placement line ->
?grid_column:Grid.placement line ->
?visible:bool ->
?z_index:int ->
?opacity:float ->
?focusable:bool ->
?autofocus:bool ->
?buffered:bool ->
?live:bool ->
?ref:(Mosaic_ui.Renderable.t -> unit) ->
?on_mouse:(Event.mouse -> 'msg option) ->
?on_key:(Event.key -> 'msg option) ->
?on_paste:(Event.paste -> 'msg option) ->
?value:float ->
?min:float ->
?max:float ->
?orientation:[ `Horizontal | `Vertical ] ->
?filled_color:Ansi.Color.t ->
?empty_color:Ansi.Color.t ->
unit ->
'msg tprogress_bar () is a read-only progress indicator.
Progress-bar-specific optional arguments:
value-- current progress value. Defaults to0..min-- value representing 0% progress. Defaults to0..max-- value representing 100% progress. Defaults to1..orientation--`Horizontalor`Vertical. Defaults to`Horizontal.filled_color-- color of the filled portion of the bar. Defaults to medium gray.empty_color-- color of the unfilled portion of the bar. Defaults to dark gray.
val scroll_bar :
?key:string ->
?id:string ->
?display:Display.t ->
?box_sizing:Box_sizing.t ->
?position:Position.t ->
?overflow:Overflow.t point ->
?scrollbar_width:float ->
?text_align:Text_align.t ->
?inset:length_percentage_auto rect ->
?flex_direction:Flex_direction.t ->
?flex_wrap:Flex_wrap.t ->
?justify_content:Justify.t ->
?align_items:Align.t ->
?size:dimension size ->
?min_size:dimension size ->
?max_size:dimension size ->
?aspect_ratio:float ->
?gap:length_percentage size ->
?padding:length_percentage rect ->
?margin:length_percentage_auto rect ->
?border_width:length_percentage rect ->
?align_self:Align.t ->
?align_content:Justify.t ->
?justify_items:Align.t ->
?justify_self:Align.t ->
?flex_grow:float ->
?flex_shrink:float ->
?flex_basis:dimension ->
?grid_template_rows:Grid.template list ->
?grid_template_columns:Grid.template list ->
?grid_auto_rows:Grid.track list ->
?grid_auto_columns:Grid.track list ->
?grid_auto_flow:Grid_auto_flow.t ->
?grid_template_areas:Grid.area list ->
?grid_template_column_names:string list list ->
?grid_template_row_names:string list list ->
?grid_row:Grid.placement line ->
?grid_column:Grid.placement line ->
?visible:bool ->
?z_index:int ->
?opacity:float ->
?focusable:bool ->
?autofocus:bool ->
?buffered:bool ->
?live:bool ->
?ref:(Mosaic_ui.Renderable.t -> unit) ->
?on_mouse:(Event.mouse -> 'msg option) ->
?on_key:(Event.key -> 'msg option) ->
?on_paste:(Event.paste -> 'msg option) ->
?orientation:Scroll_bar.orientation ->
?show_arrows:bool ->
?track_color:Ansi.Color.t ->
?thumb_color:Ansi.Color.t ->
?arrow_fg:Ansi.Color.t ->
?arrow_bg:Ansi.Color.t ->
?on_change:(int -> 'msg option) ->
unit ->
'msg tscroll_bar () is a standalone scroll-bar widget. Use this when you manage scroll state externally; for automatic scrolling consider scroll_box instead.
Scroll-bar-specific optional arguments:
orientation--`Horizontalor`Vertical. Defaults to`Vertical.show_arrows-- whentruerenders arrow buttons at each end. Defaults tofalse.track_color-- color of the scroll track. Defaults to dark gray.thumb_color-- color of the scroll thumb. Defaults to medium gray.arrow_fg-- foreground color of the arrow buttons. Defaults to white.arrow_bg-- background color of the arrow buttons. Defaults to the terminal default.on_change-- fired when the scroll position changes; receives the new position in scroll units.
val scroll_box :
?key:string ->
?id:string ->
?display:Display.t ->
?box_sizing:Box_sizing.t ->
?position:Position.t ->
?overflow:Overflow.t point ->
?scrollbar_width:float ->
?text_align:Text_align.t ->
?inset:length_percentage_auto rect ->
?flex_direction:Flex_direction.t ->
?flex_wrap:Flex_wrap.t ->
?justify_content:Justify.t ->
?align_items:Align.t ->
?size:dimension size ->
?min_size:dimension size ->
?max_size:dimension size ->
?aspect_ratio:float ->
?gap:length_percentage size ->
?padding:length_percentage rect ->
?margin:length_percentage_auto rect ->
?border_width:length_percentage rect ->
?align_self:Align.t ->
?align_content:Justify.t ->
?justify_items:Align.t ->
?justify_self:Align.t ->
?flex_grow:float ->
?flex_shrink:float ->
?flex_basis:dimension ->
?grid_template_rows:Grid.template list ->
?grid_template_columns:Grid.template list ->
?grid_auto_rows:Grid.track list ->
?grid_auto_columns:Grid.track list ->
?grid_auto_flow:Grid_auto_flow.t ->
?grid_template_areas:Grid.area list ->
?grid_template_column_names:string list list ->
?grid_template_row_names:string list list ->
?grid_row:Grid.placement line ->
?grid_column:Grid.placement line ->
?visible:bool ->
?z_index:int ->
?opacity:float ->
?focusable:bool ->
?autofocus:bool ->
?buffered:bool ->
?live:bool ->
?ref:(Mosaic_ui.Renderable.t -> unit) ->
?on_mouse:(Event.mouse -> 'msg option) ->
?on_key:(Event.key -> 'msg option) ->
?on_paste:(Event.paste -> 'msg option) ->
?scroll_x:bool ->
?scroll_y:bool ->
?sticky_scroll:bool ->
?sticky_start:[ `Top | `Bottom | `Left | `Right ] ->
?background:Ansi.Color.t ->
?on_scroll:(x:int -> y:int -> 'msg option) ->
'msg t list ->
'msg tscroll_box children is a scrollable container. It clips its children to the allocated area and manages scroll state internally.
Scroll-box-specific optional arguments:
scroll_x-- whentrueenables horizontal scrolling. Defaults tofalse.scroll_y-- whentrueenables vertical scrolling. Defaults totrue.sticky_scroll-- whentruethe viewport follows new content appended at the sticky edge. Defaults tofalse.sticky_start-- the edge to which sticky scrolling anchors. Defaults to`Bottom.background-- background fill color of the scroll area.on_scroll-- fired after a scroll event; receives the new scroll position~xand~yin cells.
val textarea :
?key:string ->
?id:string ->
?display:Display.t ->
?box_sizing:Box_sizing.t ->
?position:Position.t ->
?overflow:Overflow.t point ->
?scrollbar_width:float ->
?text_align:Text_align.t ->
?inset:length_percentage_auto rect ->
?flex_direction:Flex_direction.t ->
?flex_wrap:Flex_wrap.t ->
?justify_content:Justify.t ->
?align_items:Align.t ->
?size:dimension size ->
?min_size:dimension size ->
?max_size:dimension size ->
?aspect_ratio:float ->
?gap:length_percentage size ->
?padding:length_percentage rect ->
?margin:length_percentage_auto rect ->
?border_width:length_percentage rect ->
?align_self:Align.t ->
?align_content:Justify.t ->
?justify_items:Align.t ->
?justify_self:Align.t ->
?flex_grow:float ->
?flex_shrink:float ->
?flex_basis:dimension ->
?grid_template_rows:Grid.template list ->
?grid_template_columns:Grid.template list ->
?grid_auto_rows:Grid.track list ->
?grid_auto_columns:Grid.track list ->
?grid_auto_flow:Grid_auto_flow.t ->
?grid_template_areas:Grid.area list ->
?grid_template_column_names:string list list ->
?grid_template_row_names:string list list ->
?grid_row:Grid.placement line ->
?grid_column:Grid.placement line ->
?visible:bool ->
?z_index:int ->
?opacity:float ->
?focusable:bool ->
?autofocus:bool ->
?buffered:bool ->
?live:bool ->
?ref:(Mosaic_ui.Renderable.t -> unit) ->
?on_mouse:(Event.mouse -> 'msg option) ->
?on_key:(Event.key -> 'msg option) ->
?on_paste:(Event.paste -> 'msg option) ->
?value:string ->
?cursor:int ->
?selection:(int * int) option ->
?spans:span list ->
?ghost_text:string ->
?ghost_text_color:Ansi.Color.t ->
?placeholder:string ->
?wrap:Text_surface.wrap ->
?text_color:Ansi.Color.t ->
?background_color:Ansi.Color.t ->
?focused_text_color:Ansi.Color.t ->
?focused_background_color:Ansi.Color.t ->
?placeholder_color:Ansi.Color.t ->
?selection_color:Ansi.Color.t ->
?selection_fg:Ansi.Color.t ->
?cursor_style:[ `Block | `Line | `Underline ] ->
?cursor_color:Ansi.Color.t ->
?cursor_blinking:bool ->
?on_input:(string -> 'msg option) ->
?on_change:(string -> 'msg option) ->
?on_submit:(string -> 'msg option) ->
?on_cursor:(cursor:int -> selection:(int * int) option -> 'msg option) ->
unit ->
'msg ttextarea () is a multi-line text editing area. It shares its optional argument set with input; see that entry for argument descriptions.
Textarea-specific optional arguments not present on input:
cursor-- optional controlled cursor grapheme offset.selection-- optional controlled selection range.spans-- optional styled spans used for syntax highlighting. When provided, the span text must matchvalue.ghost_text-- optional inline ghost completion rendered at the cursor.ghost_text_color-- color used forghost_text.wrap-- line-wrapping mode within the editing area. Defaults to the surface default.on_cursor-- fired when cursor position or selection changes.
val code :
?key:string ->
?id:string ->
?display:Display.t ->
?box_sizing:Box_sizing.t ->
?position:Position.t ->
?overflow:Overflow.t point ->
?scrollbar_width:float ->
?text_align:Text_align.t ->
?inset:length_percentage_auto rect ->
?flex_direction:Flex_direction.t ->
?flex_wrap:Flex_wrap.t ->
?justify_content:Justify.t ->
?align_items:Align.t ->
?size:dimension size ->
?min_size:dimension size ->
?max_size:dimension size ->
?aspect_ratio:float ->
?gap:length_percentage size ->
?padding:length_percentage rect ->
?margin:length_percentage_auto rect ->
?border_width:length_percentage rect ->
?align_self:Align.t ->
?align_content:Justify.t ->
?justify_items:Align.t ->
?justify_self:Align.t ->
?flex_grow:float ->
?flex_shrink:float ->
?flex_basis:dimension ->
?grid_template_rows:Grid.template list ->
?grid_template_columns:Grid.template list ->
?grid_auto_rows:Grid.track list ->
?grid_auto_columns:Grid.track list ->
?grid_auto_flow:Grid_auto_flow.t ->
?grid_template_areas:Grid.area list ->
?grid_template_column_names:string list list ->
?grid_template_row_names:string list list ->
?grid_row:Grid.placement line ->
?grid_column:Grid.placement line ->
?visible:bool ->
?z_index:int ->
?opacity:float ->
?focusable:bool ->
?autofocus:bool ->
?buffered:bool ->
?live:bool ->
?ref:(Mosaic_ui.Renderable.t -> unit) ->
?on_mouse:(Event.mouse -> 'msg option) ->
?on_key:(Event.key -> 'msg option) ->
?on_paste:(Event.paste -> 'msg option) ->
?spans:span list ->
?text_style:Ansi.Style.t ->
?wrap:Text_surface.wrap ->
?tab_width:int ->
?selectable:bool ->
?selection_bg:Ansi.Color.t ->
?selection_fg:Ansi.Color.t ->
?on_selection:((int * int) option -> 'msg option) ->
string ->
'msg tcode s is a read-only code display element that renders s with optional syntax highlighting spans.
Wrap with line_number to add a gutter with line numbers.
Code-specific optional arguments:
spans-- list ofspanvalues that apply syntax-highlighting styles to ranges of the text.text_style-- base ANSI style applied to unstyled text.wrap-- line-wrapping mode. Defaults to no wrap.tab_width-- number of cells a tab character expands to. Defaults to4.selectable-- whentruethe user can select text with the mouse. Defaults totrue.selection_bg-- background color of selected text.selection_fg-- foreground color of selected text.on_selection-- fired when the current selection changes.
val line_number :
?key:string ->
?id:string ->
?display:Display.t ->
?box_sizing:Box_sizing.t ->
?position:Position.t ->
?overflow:Overflow.t point ->
?scrollbar_width:float ->
?text_align:Text_align.t ->
?inset:length_percentage_auto rect ->
?flex_direction:Flex_direction.t ->
?flex_wrap:Flex_wrap.t ->
?justify_content:Justify.t ->
?align_items:Align.t ->
?size:dimension size ->
?min_size:dimension size ->
?max_size:dimension size ->
?aspect_ratio:float ->
?gap:length_percentage size ->
?padding:length_percentage rect ->
?margin:length_percentage_auto rect ->
?border_width:length_percentage rect ->
?align_self:Align.t ->
?align_content:Justify.t ->
?justify_items:Align.t ->
?justify_self:Align.t ->
?flex_grow:float ->
?flex_shrink:float ->
?flex_basis:dimension ->
?grid_template_rows:Grid.template list ->
?grid_template_columns:Grid.template list ->
?grid_auto_rows:Grid.track list ->
?grid_auto_columns:Grid.track list ->
?grid_auto_flow:Grid_auto_flow.t ->
?grid_template_areas:Grid.area list ->
?grid_template_column_names:string list list ->
?grid_template_row_names:string list list ->
?grid_row:Grid.placement line ->
?grid_column:Grid.placement line ->
?visible:bool ->
?z_index:int ->
?opacity:float ->
?focusable:bool ->
?autofocus:bool ->
?buffered:bool ->
?live:bool ->
?ref:(Mosaic_ui.Renderable.t -> unit) ->
?on_mouse:(Event.mouse -> 'msg option) ->
?on_key:(Event.key -> 'msg option) ->
?on_paste:(Event.paste -> 'msg option) ->
?fg:Ansi.Color.t ->
?bg:Ansi.Color.t ->
?min_width:int ->
?padding_right:int ->
?show_line_numbers:bool ->
?line_number_offset:int ->
?line_colors:(int * Line_number.line_color) list ->
?line_signs:(int * Line_number.line_sign) list ->
?hidden_line_numbers:int list ->
'msg t ->
'msg tline_number child wraps child with a gutter that displays line numbers alongside each line of child's content. Commonly used with code or textarea as the child.
Line-number-specific optional arguments:
fg-- foreground color of the line-number gutter.bg-- background color of the line-number gutter.min_width-- minimum width of the gutter in cells. Widens automatically as the line count grows. Defaults to3.padding_right-- cells of padding between the gutter and the content. Defaults to1.show_line_numbers-- whenfalsehides the numeric labels but keeps the gutter structure. Defaults totrue.line_number_offset-- added to each displayed line number. Useful when the content is a slice of a larger document. Defaults to0.line_colors-- per-line foreground color overrides, given as(line_index, color)pairs.line_signs-- per-line sign icons shown in the gutter, given as(line_index, sign)pairs.hidden_line_numbers-- line indices whose number labels are suppressed.
val markdown :
?key:string ->
?id:string ->
?display:Display.t ->
?box_sizing:Box_sizing.t ->
?position:Position.t ->
?overflow:Overflow.t point ->
?scrollbar_width:float ->
?text_align:Text_align.t ->
?inset:length_percentage_auto rect ->
?flex_direction:Flex_direction.t ->
?flex_wrap:Flex_wrap.t ->
?justify_content:Justify.t ->
?align_items:Align.t ->
?size:dimension size ->
?min_size:dimension size ->
?max_size:dimension size ->
?aspect_ratio:float ->
?gap:length_percentage size ->
?padding:length_percentage rect ->
?margin:length_percentage_auto rect ->
?border_width:length_percentage rect ->
?align_self:Align.t ->
?align_content:Justify.t ->
?justify_items:Align.t ->
?justify_self:Align.t ->
?flex_grow:float ->
?flex_shrink:float ->
?flex_basis:dimension ->
?grid_template_rows:Grid.template list ->
?grid_template_columns:Grid.template list ->
?grid_auto_rows:Grid.track list ->
?grid_auto_columns:Grid.track list ->
?grid_auto_flow:Grid_auto_flow.t ->
?grid_template_areas:Grid.area list ->
?grid_template_column_names:string list list ->
?grid_template_row_names:string list list ->
?grid_row:Grid.placement line ->
?grid_column:Grid.placement line ->
?visible:bool ->
?z_index:int ->
?opacity:float ->
?focusable:bool ->
?autofocus:bool ->
?buffered:bool ->
?live:bool ->
?ref:(Mosaic_ui.Renderable.t -> unit) ->
?on_mouse:(Event.mouse -> 'msg option) ->
?on_key:(Event.key -> 'msg option) ->
?on_paste:(Event.paste -> 'msg option) ->
?md_style:Markdown.style ->
?conceal:bool ->
?streaming:bool ->
string ->
'msg tmarkdown s is a rendered Markdown view of the string s.
Markdown-specific optional arguments:
md_style-- theme controlling heading, code, and emphasis colors. Defaults to the built-in style.conceal-- whentruehides Markdown syntax characters (asterisks, backticks, etc.) from the rendered output. Defaults tofalse.streaming-- whentruethe renderer tolerates incomplete Markdown (e.g. an unclosed code fence) as it arrives from a streaming source. Defaults tofalse.
val table :
?key:string ->
?id:string ->
?display:Display.t ->
?box_sizing:Box_sizing.t ->
?position:Position.t ->
?overflow:Overflow.t point ->
?scrollbar_width:float ->
?text_align:Text_align.t ->
?inset:length_percentage_auto rect ->
?flex_direction:Flex_direction.t ->
?flex_wrap:Flex_wrap.t ->
?justify_content:Justify.t ->
?align_items:Align.t ->
?size:dimension size ->
?min_size:dimension size ->
?max_size:dimension size ->
?aspect_ratio:float ->
?gap:length_percentage size ->
?padding:length_percentage rect ->
?margin:length_percentage_auto rect ->
?border_width:length_percentage rect ->
?align_self:Align.t ->
?align_content:Justify.t ->
?justify_items:Align.t ->
?justify_self:Align.t ->
?flex_grow:float ->
?flex_shrink:float ->
?flex_basis:dimension ->
?grid_template_rows:Grid.template list ->
?grid_template_columns:Grid.template list ->
?grid_auto_rows:Grid.track list ->
?grid_auto_columns:Grid.track list ->
?grid_auto_flow:Grid_auto_flow.t ->
?grid_template_areas:Grid.area list ->
?grid_template_column_names:string list list ->
?grid_template_row_names:string list list ->
?grid_row:Grid.placement line ->
?grid_column:Grid.placement line ->
?visible:bool ->
?z_index:int ->
?opacity:float ->
?focusable:bool ->
?autofocus:bool ->
?buffered:bool ->
?live:bool ->
?ref:(Mosaic_ui.Renderable.t -> unit) ->
?on_mouse:(Event.mouse -> 'msg option) ->
?on_key:(Event.key -> 'msg option) ->
?on_paste:(Event.paste -> 'msg option) ->
?columns:Table.column list ->
?rows:Table.cell array list ->
?selected_row:int ->
?border:bool ->
?border_style:Border.t ->
?show_header:bool ->
?show_column_separator:bool ->
?show_row_separator:bool ->
?cell_padding:int ->
?header_color:Ansi.Color.t ->
?header_background:Ansi.Color.t ->
?text_color:Ansi.Color.t ->
?background:Ansi.Color.t ->
?selected_text_color:Ansi.Color.t ->
?selected_background:Ansi.Color.t ->
?focused_selected_text_color:Ansi.Color.t ->
?focused_selected_background:Ansi.Color.t ->
?row_styles:Ansi.Style.t list ->
?wrap_selection:bool ->
?fast_scroll_step:int ->
?on_change:(int -> 'msg option) ->
?on_activate:(int -> 'msg option) ->
unit ->
'msg ttable () is a scrollable data table.
Table-specific optional arguments:
columns-- column definitions (Table.column), including headers and sizing. Defaults to[].rows-- table data as a list of cell arrays. Each array must have the same length ascolumns. Defaults to[].selected_row-- zero-based index of the highlighted row. Defaults to0.border-- whentruedraws an outer border. Defaults totrue.border_style-- character set for the outer border. Defaults toBorder.single.show_header-- whentruerenders a header row. Defaults totrue.show_column_separator-- whentruedraws vertical lines between columns. Defaults tofalse.show_row_separator-- whentruedraws horizontal lines between rows. Defaults tofalse.cell_padding-- horizontal padding in cells within each cell. Defaults to0.header_color-- foreground color of the header row.header_background-- background color of the header row.text_color-- foreground color of body cells.background-- background color of body cells.selected_text_color-- foreground of the selected row.selected_background-- background of the selected row.focused_selected_text_color-- foreground of the selected row when the table has focus.focused_selected_background-- background of the selected row when the table has focus.row_styles-- repeating list of styles applied to body rows, useful for alternating row colors.wrap_selection-- whentruewraps selection past the last or first row. Defaults tofalse.fast_scroll_step-- rows skipped per fast-scroll action. Defaults to5.on_change-- fired when the selected row index changes.on_activate-- fired when the user confirms the selected row (e.g. by pressing Enter).
val tree :
?key:string ->
?id:string ->
?display:Display.t ->
?box_sizing:Box_sizing.t ->
?position:Position.t ->
?overflow:Overflow.t point ->
?scrollbar_width:float ->
?text_align:Text_align.t ->
?inset:length_percentage_auto rect ->
?flex_direction:Flex_direction.t ->
?flex_wrap:Flex_wrap.t ->
?justify_content:Justify.t ->
?align_items:Align.t ->
?size:dimension size ->
?min_size:dimension size ->
?max_size:dimension size ->
?aspect_ratio:float ->
?gap:length_percentage size ->
?padding:length_percentage rect ->
?margin:length_percentage_auto rect ->
?border_width:length_percentage rect ->
?align_self:Align.t ->
?align_content:Justify.t ->
?justify_items:Align.t ->
?justify_self:Align.t ->
?flex_grow:float ->
?flex_shrink:float ->
?flex_basis:dimension ->
?grid_template_rows:Grid.template list ->
?grid_template_columns:Grid.template list ->
?grid_auto_rows:Grid.track list ->
?grid_auto_columns:Grid.track list ->
?grid_auto_flow:Grid_auto_flow.t ->
?grid_template_areas:Grid.area list ->
?grid_template_column_names:string list list ->
?grid_template_row_names:string list list ->
?grid_row:Grid.placement line ->
?grid_column:Grid.placement line ->
?visible:bool ->
?z_index:int ->
?opacity:float ->
?focusable:bool ->
?autofocus:bool ->
?buffered:bool ->
?live:bool ->
?ref:(Mosaic_ui.Renderable.t -> unit) ->
?on_mouse:(Event.mouse -> 'msg option) ->
?on_key:(Event.key -> 'msg option) ->
?on_paste:(Event.paste -> 'msg option) ->
?items:Tree.item list ->
?selected_index:int ->
?expand_depth:int ->
?indent_size:int ->
?show_guides:bool ->
?guide_style:Border.t ->
?expand_icon:string ->
?collapse_icon:string ->
?leaf_icon:string ->
?background:Ansi.Color.t ->
?text_color:Ansi.Color.t ->
?selected_background:Ansi.Color.t ->
?selected_text_color:Ansi.Color.t ->
?focused_selected_background:Ansi.Color.t ->
?focused_selected_text_color:Ansi.Color.t ->
?guide_color:Ansi.Color.t ->
?icon_color:Ansi.Color.t ->
?wrap_selection:bool ->
?fast_scroll_step:int ->
?on_change:(int -> 'msg option) ->
?on_activate:(int -> 'msg option) ->
?on_expand:(int -> bool -> 'msg option) ->
unit ->
'msg ttree () is an interactive collapsible tree view.
Tree-specific optional arguments:
items-- the root-levelTree.itemnodes. Defaults to[].selected_index-- zero-based flat index of the highlighted item. Defaults to0.expand_depth-- number of levels expanded on first render.0collapses all; usemax_intto expand everything. Defaults to0.indent_size-- cells of indentation per nesting level. Defaults to2.show_guides-- whentruedraws vertical guide lines. Defaults tofalse.guide_style-- border character set used for guide lines.expand_icon-- string shown next to collapsible nodes when collapsed. Defaults to"▶".collapse_icon-- string shown next to collapsible nodes when expanded. Defaults to"▼".leaf_icon-- string shown next to leaf nodes. Defaults to" ".background-- background color of unselected items.text_color-- foreground color of unselected items.selected_background-- background of the selected item.selected_text_color-- foreground of the selected item.focused_selected_background-- background of the selected item when the widget has focus.focused_selected_text_color-- foreground of the selected item when the widget has focus.guide_color-- color of the vertical guide lines.icon_color-- color of the expand/collapse/leaf icons.wrap_selection-- whentruewraps selection past the last or first visible item. Defaults tofalse.fast_scroll_step-- items skipped per fast-scroll action. Defaults to5.on_change-- fired when the selected index changes.on_activate-- fired when the user confirms the selection.on_expand-- fired when a node is expanded or collapsed; receives the flat index andtrueif expanded,falseif collapsed.
Internal modules
The virtual-DOM reconciler used by run.