1:- module(tui,
2 [
3 op(601, xfy, '.>'),
4 op(601, xfy, '.<'),
5 op(601, xfy, '.\\/'),
6 op(601, xfy, './\\')
7 ]).
22'#imports'. 23 24:- reexport(library(tui/utils), [direction/1, limits_direction_from_to/4]). 25:- reexport(library(tui/drawable), [drawable//5, drawable_raw/2]). 26:- reexport(library(tui/events), [stack_event_is/3]). 27:- reexport(library(tui/loop), [app/4, app/5]). 28:- reexport(library(tui/subscriptions), [port_send/2]). 29 30 31'#hooks'.
40:- multifile alias_drawable/2.
A cursor movement bubbles as moved(Direction) from where the cursor
was, and, for an arrow key no component claimed, as arrived(Direction)
where it lands. The cursor moves regardless; what they are rewritten
to is handled with the cursor moved. A mouse event bubbles where it
happened (see app/5).
Besides events for update, a component may produce a direction, which
moves the cursor one cell, or cursor_by(DX-DY), which moves it by an
offset; e.g. to keep the cursor after an edit, or, answering
arrived(Direction), on a cell where it belongs. noop takes the event
to do nothing: it bubbles no further, and update never sees it.
66:- multifile at_event_is/3.
Text User Interface framework
A TUI framework for SWI-Prolog, inspired by TEA (The Elm Architecture). Components are defined via the multifile hooks alias_drawable/2 and at_event_is/3.
This module gives the event loop and the core drawables. Ready-made, styled components are opt-in: load
library(tui/components).