ludic.ui: ui_override(path, text), ui_override_clear(path | "") and ui_overridden(path) - a template's or a stylesheet's text given from outside, its component shown again with its state kept and its own text brought back when let go; lib_text answers a copy of the override, and the dev poll leaves an overridden component alone; examples/library/ui_override

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 22:48:48 +03:00
parent 9f07fc8a62
commit aad3f8ca27
8 changed files with 144 additions and 0 deletions

View file

@ -24,6 +24,8 @@ function lib_blank(path: string) -> UiFile {
return f
}
function lib_text(ui_st: UiState, path: string) -> string {
let o = ov_find(ui_st, path)
if o >= 0 { return `{ui_st.ov_text[o]}` } # a copy: a caller may give back what it read (rl_let_go)
var src = ""
if ui_st.ui_be != null and ui_st.ui_be.read != null { src = ui_st.ui_be.read(path) } else { src = Fs.read_text(path) }
if src == null { return "" }