code wiki / _hdl_build / nx_editor_render_gate.nx
nx_editor_render_gate.nx source
↩ module page · 59 lines · 3421 B
1// nx_editor_render_gate.nx -- the editor surface is rendered NO-JS (CSS absolute positioning), token-driven, and
2// the SOVEREIGN-NO-JS-EDITOR axis is refereed. Honest framing per the doctrine: a JS drag-drop canvas (Webflow/Wix)
3// is the JS-heavy approach we REJECT, NOT a maturity bar we chase -- so this is a measured exceed on the axis we
4// actually care about, with the drag-drop-UI explicitly out of scope. 100% sovereign. expect_exit: 0
5import "nx_syscalls.nx"
6import "nx_sitegate_emit_lib.nx"
7import "nx_editor_canvas.nx"
8import "nx_cms_exceed.nx"
9import "nx_brand_tokens.nx"
10
11
12func g_has(s: *u8, n: i64, lit: *u8) -> i64 { if bt_find(s, n, lit, bt_len(lit)) >= 0 { return 1 } return 0 }
13func put(c: *i64, i: i64, k: i64, x: i64, y: i64, w: i64, h: i64) -> i64 { c[i*5+0]=k; c[i*5+1]=x; c[i*5+2]=y; c[i*5+3]=w; c[i*5+4]=h; return 0 }
14func axis_ahead(name: *u8, our: i64, inc: i64, n: i64, tot: *i64) -> i64 {
15 let v: i64 = xcd_verdict(our, inc); let ok: i64 = xcd_referee_ok(v, our, n)
16 var pass: i64 = 0; if v == XCD_AHEAD { if ok == 1 { pass = 1 } }
17 if pass == 1 { gw(" PASS " as *u8); tot[0]=tot[0]+1 } else { gw(" FAIL " as *u8); tot[1]=tot[1]+1 }
18 gw(name); gw(" -> " as *u8); gw(xcd_vname(v)); gw(" (ours=" as *u8); gn(our); gw("/" as *u8); gn(n); gw(" vs documented=" as *u8); gn(inc); gw("/" as *u8); gn(n); gw(")\n" as *u8)
19 return pass
20}
21
22func main() -> i64 {
23 let tot: *i64 = sys_mmap(32) as *i64
24 tot[0]=0; tot[1]=0
25 let c: *i64 = sys_mmap(512) as *i64
26 gw("=== nx_editor_render_gate -- NO-JS sovereign editor surface ===\n" as *u8)
27
28 put(c, 0, 1, 40, 8, 200, 48) // heading
29 put(c, 1, 3, 40, 80, 160, 44) // button
30 put(c, 2, 2, 40, 140, 360, 80) // text
31 let fd: i64 = sys_openat_wr("/tmp/nx_editor.html" as *u8, 0x1a4)
32 ec_render(c, 3, fd)
33 sys_close(fd)
34 let lp: *i64 = sys_mmap(16) as *i64
35 let pg: *u8 = sys_read_file("/tmp/nx_editor.html" as *u8, lp)
36 let pn: i64 = lp[0]
37
38 var t1: i64 = 0
39 if g_has(pg, pn, "position:absolute;left:40px;top:8px;width:200px" as *u8) == 1 { if g_has(pg, pn, "heading" as *u8) == 1 { if g_has(pg, pn, "button" as *u8) == 1 { t1 = 1 } } }
40 t_row("E1 canvas renders as CSS-positioned elements (the engine coords)" as *u8, t1, tot)
41
42 var jsfree: i64 = 0
43 if g_has(pg, pn, "<script" as *u8) == 0 { jsfree = 1 }
44 t_row("E2 the editor surface carries ZERO JavaScript (no <script)" as *u8, jsfree, tot)
45
46 t_row("E3 token-driven (CSS uses var(--nx-color-line))" as *u8, g_has(pg, pn, "var(--nx-color-line)" as *u8), tot)
47
48 // the axis we actually care about: a SOVEREIGN NO-JS editor surface. ours = 0-JS render. Webflow/Wix editors are
49 // JS-client apps (a canvas that REQUIRES JavaScript) -> 0 on "no-JS editor". (drag-drop-UI polish is NOT this axis.)
50 axis_ahead("E4 SOVEREIGN NO-JS editor surface vs JS-client-required builders (drag-drop-UI is NOT this axis)" as *u8, jsfree, 0, 1, tot)
51
52 var st1: i64 = 0; if xcd_referee_ok(XCD_AHEAD, 0, 1) == 0 { st1 = 1 }
53 t_row("E5 self-test: referee rejects a no-measurement claim" as *u8, st1, tot)
54
55 gw("\nrows pass=" as *u8); gn(tot[0]); gw(" fail=" as *u8); gn(tot[1]); gw("\n" as *u8)
56 if tot[1] == 0 { gw("VERDICT=GREEN -- sovereign NO-JS editor surface (engine + CSS render + governed). The Nishi ecosystem emits it, hardware-up, 0 JS.\n" as *u8); return 0 }
57 gw("VERDICT=RED\n" as *u8)
58 return 1
59}