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

@ -6,6 +6,8 @@ export const UI_BUTTON: int = 3
export const UI_SCROLL: int = 4
export const UI_IMAGE: int = 5
export const UI_RULE: int = 6 # <hr>: a line across
export const UI_NATIVE: int = 7 # an element the host draws itself (ui_native)
export const UI_AUTO: float = -1000000.0 # an inset that is not set
export const UI_COL: int = 0
export const UI_ROW: int = 1
export const UI_FILL: float = -1.0
@ -69,15 +71,30 @@ export property UiNode {
min_h: float = 0.0
max_h: float = 0.0
hidden: bool = false # display: none, or hidden
pos: int = 0 # position: 0 static, 1 relative, 2 absolute, 3 fixed
top: float = -1000000.0 # the insets a positioned element is placed by (UI_AUTO: unset)
right: float = -1000000.0
bottom: float = -1000000.0
left: float = -1000000.0
z: int = 0
nowrap: bool = false # white-space: nowrap
ellipsis: bool = false # text-overflow: ellipsis
lines: []string = null # a wrapped text's lines
var_names: []string = null # its custom properties (--name), which its descendants inherit
var_vals: []string = null
fg: int = -1
bg: int = -2
alpha: float = 1.0
enabled: bool = true
act: UiAct = null
act: UiAct = null # on-press, which the pointer and the renderer's button fire
on_names: []string = null # every on-* it answers
on_acts: []UiAct = null
native: UiNative = null
env: UiEnv = null
children: []UiNode = null
mw: float = 0.0
mh: float = 0.0
content_h: float = 0.0 # what a scroll box holds, however tall the box itself is
x: float = 0.0
y: float = 0.0
cw: float = 0.0