A `view Name { field = x; function q(..); on e(..) }` declaration is the one bridge between a
program and its UI: it writes view_<name>() -> UiView, whose model is a Value of every field and
whose call runs a query or an event by name.
ludic.ui is a template runtime:
- HTML-shaped XML screens and components, loaded at run time;
- {expression} bindings, if/else/each, props, slots, per-instance state;
- on-press / onclick actions (event, set, emit);
- component libraries (export="true", <import src as>).
Styling:
- stylesheets in <style> or importable .lss files (@import);
- CSS selectors (#id, .class, [attr=v], descendant and > combinators, :hover, :disabled,
:first-child, :last-child, :nth-child, :not) weighed by specificity;
- the box model and flex under CSS's property names.
Also:
- default parameters, and positional-then-named calls;
- Value gains a float kind;
- a function shadowing a runtime one is refused;
- an index is evaluated before the slice is read;
- runtime errors name the right file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
19 lines
698 B
Text
19 lines
698 B
Text
# layout_wrap.ludic - a wrapping row, line by line: each line is as tall as its tallest child
|
|
function ly_place_wrap(n: UiNode, top0: float, inner_w: float) -> void {
|
|
var top = top0
|
|
var from = 0
|
|
while from < len(n.children) {
|
|
var to = from
|
|
var line_w = 0.0
|
|
var line_h = 0.0
|
|
while to < len(n.children) and (to == from or line_w + n.gap + ly_main(n.children[to], UI_ROW) <= inner_w) {
|
|
if to > from { line_w = line_w + n.gap }
|
|
line_w = line_w + ly_main(n.children[to], UI_ROW)
|
|
line_h = Math.max(line_h, ly_cross(n.children[to], UI_ROW))
|
|
to += 1
|
|
}
|
|
ly_place_line(n, from, to, top, inner_w, line_h)
|
|
top = top + line_h + n.gap
|
|
from = to
|
|
}
|
|
}
|