code wiki / _hdl_build / nx_editor_canvas.nx
nx_editor_canvas.nx
buildroot/runtime/_hdl_build/nx_editor_canvas.nx
about
nx_editor_canvas.nx -- the EDITOR engine: the sovereign, gateable CORE of a visual editor, as data+logic so it can
be PROVEN without a browser. A canvas is a flat i64 array of N elements, 5 fields each: [kind, x, y, w, h].
Operations: snap-all-to-grid, align (L/R/T/B/center-h/middle-v), distribute-horizontally (even left edges), nudge,
and one-deep undo (snapshot/restore). The surface is rendered NO-JS (ec_render); editing = server ops (apply an op,
re-render), never a client-side JS canvas -- a JS drag-drop canvas is the JS-heavy approach the Nishi ecosystem
REJECTS, not a maturity bar to chase. SOVEREIGN + no-JS + governed. REUSE: nx_brand_snap (bs_snap).
license_tier: ORIGINAL
dependencies 2 imports · 5 importers
imports: nx_syscalls.nxnx_brand_snap.nx
imported by: nx_editor_canvas_gate.nxnx_editor_loop.nxnx_editor_render_gate.nxnx_editor_validate.nxnx_exceed_standard_gate.nx
structs
| none |
consts
| 11 | const EC_STRIDE: i64 = 5 // [kind, x, y, w, h] |
functions
| 14 | func ec_snap_all(c: *i64, n: i64, grid: i64) -> i64 |
| 25 | func ec_align(c: *i64, n: i64, mode: i64) -> i64 |
| 52 | func ec_distribute_h(c: *i64, n: i64) -> i64 |
| 63 | func ec_nudge(c: *i64, idx: i64, dx: i64, dy: i64) -> i64 called by 1: main |
| 69 | func ec_save(c: *i64, n: i64, hist: *i64) -> i64 { var i: i64 = 0; while i < n*EC_STRIDE { hist[i] = c[i]; i = i + 1 } return 0 } called by 1: main |
| 70 | func ec_undo(c: *i64, n: i64, hist: *i64) -> i64 { var i: i64 = 0; while i < n*EC_STRIDE { c[i] = hist[i]; i = i + 1 } return 0 } called by 1: main |
| 75 | func ec_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 } |
| 76 | func ec_wn(fd: i64, v: i64) -> i64 |
| 85 | func ec_kindlabel(k: i64) -> *u8 { if k==1 { return "heading" as *u8 } if k==2 { return "text" as *u8 } if k==3 { return "button" as *u8 } if k==4 { return "image" as *u8 } return "block" as *u8 } called by 1: ec_render |
| 87 | func ec_render(c: *i64, n: i64, fd: i64) -> i64 |