feat(ui): tree-owned scroll gestures and geometry hit-testing

Drag, flick and tap-vs-scroll now live on the scrollX/scrollY flag in
ui.lua, so any scroll box pans with no app code. tree.hit returns the
deepest node by geometry and dispatch bubbles to the nearest handler,
dropping the now-unused CAPTURE flag. keyboard moves in as ui.keyboard,
and embed compiles nested lib dirs to dotted module names.
This commit is contained in:
2026-08-06 17:07:56 -04:00
parent e5ed980294
commit 2046938d32
9 changed files with 479 additions and 45 deletions
+8 -4
View File
@@ -35,7 +35,9 @@ def main():
lib_dir = pathlib.Path(lib_dir)
out_path = pathlib.Path(out_path)
sources = sorted(lib_dir.glob("*.lua"))
# Recurse so ui/keyboard.lua embeds as the module require("ui.keyboard") asks for: the
# module name is the path with dots, the C array identifier the same with underscores.
sources = sorted(lib_dir.rglob("*.lua"))
arrays = []
rows = []
for src in sources:
@@ -45,10 +47,12 @@ def main():
subprocess.run([luac32, str(src), tmp_path], check=True)
bytecode = pathlib.Path(tmp_path).read_bytes()
pathlib.Path(tmp_path).unlink()
name = src.stem
parts = src.relative_to(lib_dir).with_suffix("").parts
name = ".".join(parts)
ident = "_".join(parts)
comma = ", ".join(f"0x{b:02x}" for b in bytecode)
arrays.append(f"static const unsigned char {name}[] = {{{comma}}};\n")
rows.append(f' {{"{name}", {name}, sizeof({name})}},')
arrays.append(f"static const unsigned char {ident}[] = {{{comma}}};\n")
rows.append(f' {{"{name}", {ident}, sizeof({ident})}},')
footer = "const EmbeddedModule embedded_modules[] = {{\n{rows}\n}};\nconst size_t embedded_modules_count = {count};\n"
generated = HEADER + "".join(arrays) + footer.format(rows="\n".join(rows), count=len(sources)) + FOOTER