code wiki / (root) / nx_ui_lib.nx

nx_ui_lib.nx

buildroot/runtime/nx_ui_lib.nx

5609 B122 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind librarytopic ui
docsdependenciesstructsconstsfunctions

about

nx_ui_lib.nx -- sovereign INTERACTIVE-FRONTEND render lib (fd-based, no main). The REUSABLE core: writes interactive HTML/SVG to ANY fd (stdout, an HTTP connection, a buffer) so the SAME render serves live, prints, or buffers. Composed by nx_ui (demo), nx_ui_serve (live server), and any future frontend. COMPOSABLE: the page is split into open / svg / controls / close so a server can inject extra content (e.g. a pain tally) between the map and </body> WITHOUT forking the renderer. ui_emit_region_map() composes them for the simple case. Clickable regions + highlight + zoom + query parse. Zero JS. license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_ui_lib.nx nx_ui.nx nx_ui_serve.nx

imports: nx_syscalls.nx

imported by: nx_ui.nxnx_ui_serve.nx

structs

none

consts

26const UI_NREG: i64 = 5

functions

15func ui_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != 0 as u8 { n = n + 1 } sys_write(fd, s, n); return 0 }
16func ui_wn(fd: i64, n: i64) -> i64
28func ui_rx(i: i64) -> i64 { if i == 0 { return 80 } if i == 1 { return 70 } if i == 2 { return 40 } if i == 3 { return 135 } return 75 }
called by 1: ui_region
29func ui_ry(i: i64) -> i64 { if i == 0 { return 10 } if i == 1 { return 55 } if i == 2 { return 55 } if i == 3 { return 55 } return 160 }
called by 1: ui_region
30func ui_rw(i: i64) -> i64 { if i == 0 { return 40 } if i == 1 { return 60 } if i == 2 { return 25 } if i == 3 { return 25 } return 50 }
called by 1: ui_region
31func ui_rh(i: i64) -> i64 { if i == 0 { return 40 } if i == 1 { return 100 } if i == 2 { return 90 } if i == 3 { return 90 } return 120 }
called by 1: ui_region
32func ui_label(i: i64) -> *u8
40func ui_region(fd: i64, i: i64, selected: i64, zoom: i64) -> i64
51func ui_emit_region_map_open(fd: i64, selected: i64, zoom: i64) -> i64
67func ui_emit_page_close(fd: i64) -> i64 { ui_w(fd, "</body></html>\n"); return 0 }
called by 1: ui_emit_region_map calls 1: ui_w
70func ui_emit_region_map(fd: i64, selected: i64, zoom: i64) -> i64
77func ui_qval(qs: *u8, key: *u8, deflt: i64) -> i64
called by 1: ui_handle_query
103func ui_qhas(qs: *u8, key: *u8) -> i64
118func ui_handle_query(fd: i64, qs: *u8) -> i64
called by 1: main calls 2: ui_qvalui_emit_region_map