gizweb:region
the live parts of a page of GHTML. The compiler puts a range around each part of a route file that reads a table, and a keyed list around each each over a table whose rows are one element. A range is the HTML between the comments <!--g:ID--> and <!--/g:ID-->; a row of a list is the element whose data-k is ID:KEY. When rows of a table change, the long poll (Pages) runs the page again with a Focus (gizweb:table) that names the table and the changed keys. Then nothing renders but what read that table: a range renders again whole; a list reads the changed rows only and sends those rows, the place of each, and the rows that left. The browser puts the patches in.
import * as Region from "gizweb:region";Functions
range
function range(ctx: Table.Context, id: string, own: Vec<string>, inner: Vec<string>, body: () => Html): HtmlA part of the page that reads the tables OWN in its own code and contains parts that read INNER (names of tables, Shape.name). Rendered for a
person, it is BODY between its two comments. When a table of OWN changed, it renders again whole; when only a table of INNER changed, BODY runs to
reach the parts inside; otherwise it renders nothing.
Effects: fail, read, write, console, io.
title
function title(ctx: Table.Context, own: Vec<string>, body: () => Html): HtmlThe <title> of the page, when its text reads the tables OWN. It is BODY (the element) as it is; the head of the document holds it, so a change
is the title patch.
Effects: fail, read, write, console, io.
list
function list<T>(table: Table.Table<T>, id: string, own: Vec<string>, local: bool, items: () => Vec<T>, row: (item: T, mark: string) => Html): HtmlThe rows of ITEMS of the table TABLE, each the element that ROW renders (MARK is the value of its data-k, ID:KEY).
OWN are the tables that the list reads. LOCAL is true when a row depends on its own record only (the compiler checks that the list has no
limit, no index, and no read of the table in its rows). A change of a table of OWN renders the list again whole, except a change of the
table of the list when LOCAL: the list reads the rows of the changed keys alone, and sends them with the place of each.