ludic.ui, ludic.i18n: frame_allocs to 0 - a wrap, an ellipsis, a tooltip's lines, a text-shadow's colour and a range's value kept by what made them; pointer events from a ring; inline text joined through the memo; the pool's and the state's lists through ui_kept; parse, memo miss, pool miss, lazy start and template errors declared; the translation cache clears in place

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 16:41:47 +03:00
parent 629579123a
commit 429e419327
71 changed files with 365 additions and 155 deletions

View file

@ -24,7 +24,7 @@ function bd_elem(ui_st: mut UiState, k: UiTpl, e: UiEnv, key: string) -> UiNode
if say == "no" { ui_st.tr_no = true } else if say == "yes" { ui_st.tr_no = false }
bd_kids(ui_st, k.kids, e, key, n.children)
if k.text != null { el_text(ui_st, n, ui_tr(ui_st, ui_eval_text(ui_st, k.text, e))) }
el_inline(n)
el_inline(ui_st, n)
if k.tag == "input" or k.tag == "select" or k.tag == "progress" or k.tag == "meter" { ct_build(ui_st, n) }
ui_st.tr_no = was_no
return n
@ -37,7 +37,7 @@ function el_kind(ui_st: mut UiState, n: UiNode, tag: string) -> void {
} else if lk_in(EL_TEXTS, tag) { n.kind = UI_TEXT } else if tag == "row" { n.dir = UI_ROW } else if tag == "button" {
n.dir = UI_ROW
n.focusable = true
} else if tag == "input" or tag == "select" { n.focusable = true } else if tag == "spacer" { n.kind = UI_SPACER } else if tag == "scroll" { n.kind = UI_SCROLL } else if tag == "img" { n.kind = UI_IMAGE } else if tag == "hr" { n.kind = UI_RULE } else if not lk_in(EL_BOXES, tag) { ui_err(ui_st, `<{tag}>: there is no such element`) }
} else if tag == "input" or tag == "select" { n.focusable = true } else if tag == "spacer" { n.kind = UI_SPACER } else if tag == "scroll" { n.kind = UI_SCROLL } else if tag == "img" { n.kind = UI_IMAGE } else if tag == "hr" { n.kind = UI_RULE } else if not lk_in(EL_BOXES, tag) { el_unknown(ui_st, tag) }
}
# a box with words in it holds them as a text of its own, as <div>words</div> does
function el_text(ui_st: mut UiState, n: UiNode, s: string) -> void {
@ -49,7 +49,7 @@ function el_text(ui_st: mut UiState, n: UiNode, s: string) -> void {
t.kind = UI_TEXT
t.text = s
t.env = n.env
push(n.children, t)
ui_kept(n.children, t)
}
# id, class, hidden, disabled and src say what the element is; the rest are applied after the rules
# an attribute's text is worked out only where it is read as text (the rest keep their Value; a selector
@ -58,18 +58,21 @@ function el_keep(ui_st: mut UiState, n: UiNode, key: string, v: Val) -> void {
if key == "id" { n.id = vl_text_u(ui_st, v) } else if key == "class" {
let parts = mm_split(ui_st, vl_text_u(ui_st, v), 32)
for i in 0 .. len(parts) {
if len(parts[i]) > 0 { push(n.classes, parts[i]) }
if len(parts[i]) > 0 { ui_kept(n.classes, parts[i]) }
}
} else if key == "popover" {
n.popover = true
n.pos = 2
push(n.akeys, key)
push(n.avals, "")
push(n.vals, v)
ui_kept(n.akeys, key)
ui_kept(n.avals, "")
ui_kept(n.vals, v)
} else if key == "tabindex" { n.focusable = vl_text_u(ui_st, v) != "-1" } else if key == "hidden" { n.hidden = el_flag(v) } else if key == "disabled" { n.enabled = not el_flag(v) } else if key == "src" { n.src = vl_text_u(ui_st, v) } else {
if key == "enabled" { n.enabled = el_flag(v) }
push(n.akeys, key)
push(n.avals, "")
push(n.vals, v)
ui_kept(n.akeys, key)
ui_kept(n.avals, "")
ui_kept(n.vals, v)
}
}
@alloc_ok("only when a template is wrong: a broken screen, never a working one")
function el_unknown(ui_st: mut UiState, tag: string) -> void { ui_err(ui_st, `<{tag}>: there is no such element`) }