code wiki / _hdl_build / nx_editor_canvas.nx

nx_editor_canvas.nx

buildroot/runtime/_hdl_build/nx_editor_canvas.nx

5191 B102 linesdepth 3pulls 3 transitivereach 7 importersview sourcekind librarytopic editor
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_brand_snap.nx nx_editor_canvas.nx nx_editor_canvas_gate.nx nx_editor_loop.nx nx_editor_render_gate.nx nx_editor_validate.nx nx_exceed_standard_gate.nx

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

11const EC_STRIDE: i64 = 5 // [kind, x, y, w, h]

functions

14func ec_snap_all(c: *i64, n: i64, grid: i64) -> i64
called by 2: mainel_apply calls 1: bs_snap
25func ec_align(c: *i64, n: i64, mode: i64) -> i64
called by 2: mainel_apply
52func ec_distribute_h(c: *i64, n: i64) -> i64
called by 2: mainel_apply
63func ec_nudge(c: *i64, idx: i64, dx: i64, dy: i64) -> i64
called by 1: main
69func 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
70func 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
75func 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 }
called by 2: ec_renderel_emit_form calls 1: sys_write
76func ec_wn(fd: i64, v: i64) -> i64
called by 1: ec_render calls 2: sys_writesys_mmap
85func 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
87func ec_render(c: *i64, n: i64, fd: i64) -> i64