feat(ui): ludic.ui grows toward HTML, CSS and React (Phase 0.U1-U4)

- Natives: ui_native(tag, measure, draw) makes an element the program draws itself; ui_fire
  runs its on-<event> with event.value. input, select and textarea have simple defaults.
- React:
  - keyed <each>, <let>, <provide> context through components, <fragment>;
  - named slots, default props on <component>;
  - on-mount / on-unmount;
  - inline text inside text elements.
- CSS:
  - custom properties and var();
  - position relative/absolute/fixed with insets and z-index;
  - em/rem/vw/vh and @media;
  - wrapping text and ellipsis, overflow;
  - + and ~ combinators, :nth-child(an+b), :checked, :active.
- Developing: errors with file:line, ui_errors(), ui_reload() keeping state, and an
  inspector-style ui_dump.
- view fields infer the type of a literal or a named function's result.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-24 16:17:25 +03:00
parent 66a2bc2214
commit 637d07400e
39 changed files with 42012 additions and 40795 deletions

View file

@ -21,6 +21,7 @@ property Xml {
akeys: []pointer # attribute names
avals: []pointer # attribute values (entity-decoded)
kids: []Xml # child elements, in document order
at: int = 0 # where its '<' is in the text, for an error that names a line
}
function xml_new(tag: pointer) -> Xml {
@ -243,9 +244,11 @@ function xp_attrs(p: XP, node: Xml) -> void {
# parse one element (cursor on its opening '<'). Recurses for children.
function xp_element(p: XP) -> Xml {
let at = p.i
p.i += 1 # skip '<'
let name = xp_name(p)
let node = xml_new(name)
node.at = at
xp_attrs(p, node)
# self-closing '/>'
if p.i < p.n and p.s[p.i] == '/' { # '/'