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>
35 lines
894 B
Text
35 lines
894 B
Text
# select_parts.ludic - a compound's [attribute] and :pseudo-class parts
|
|
function sel_attr(r: UiRd, s: UiSel) -> void {
|
|
r.i += 1
|
|
push(s.akeys, sel_name(r))
|
|
if not rd_op(r, "=") {
|
|
push(s.aops, 0)
|
|
push(s.avals, "")
|
|
} else {
|
|
push(s.aops, 1)
|
|
rd_ws(r)
|
|
let q = rd_c(r, 0)
|
|
if q == 34 or q == 39 { push(s.avals, Value.as_str(px_string(r, q).v)) } else { push(s.avals, sel_name(r)) }
|
|
}
|
|
if not rd_op(r, "]") { rd_fail(r, "']'") }
|
|
}
|
|
function sel_pseudo(r: UiRd, s: UiSel) -> void {
|
|
r.i += 1
|
|
let name = sel_name(r)
|
|
var arg = ""
|
|
if rd_c(r, 0) == 40 {
|
|
r.i += 1
|
|
let at = r.i
|
|
while r.i < len(r.s) and r.s[r.i] != 41 { r.i += 1 }
|
|
arg = r.s[at..r.i]
|
|
r.i += 1
|
|
}
|
|
if name == "not" {
|
|
let inner = new UiRd
|
|
inner.s = tpl_words(arg)
|
|
push(s.nots, sel_compound(inner))
|
|
return
|
|
}
|
|
push(s.pseudos, name)
|
|
push(s.pargs, tpl_words(arg))
|
|
}
|