code wiki / _hdl_build / nx_brand_polish_gate.nx

nx_brand_polish_gate.nx source

↩ module page · 60 lines · 3016 B

1// nx_brand_polish_gate.nx -- R7 gate: the builder's pages now carry token-driven motion + micro-interactions, 2// reduced-motion-safe, JS-free. Tests the BUILT page (via wb_doc_open_branded) -> proves both the polish mechanism 3// AND its wiring into the builder. 100% sovereign. license_tier: ORIGINAL expect_exit: 0 4import "nx_syscalls.nx" 5import "nx_sitegate_emit_lib.nx" 6import "nx_web_builder.nx" 7import "nx_brand_tokens.nx" 8 9 10func g_has(s: *u8, n: i64, lit: *u8) -> i64 { if bt_find(s, n, lit, bt_len(lit)) >= 0 { return 1 } return 0 } 11 12func main() -> i64 { 13 let tot: *i64 = sys_mmap(32) as *i64 14 tot[0]=0; tot[1]=0 15 let d: *u8 = bt_default_brand() 16 let bn: i64 = bt_len(d) 17 let lp: *i64 = sys_mmap(16) as *i64 18 gw("=== nx_brand_polish_gate -- R7 motion + micro-interactions (token-driven, reduced-motion-safe, JS-free) ===\n" as *u8) 19 20 let fd: i64 = sys_openat_wr("/tmp/nx_polish.html" as *u8, 0x1a4) 21 wb_doc_open_branded(fd, "Polish" as *u8, d, bn) 22 wb_w(fd, "<p>x</p>\n" as *u8) 23 wb_doc_close(fd) 24 sys_close(fd) 25 let p: *u8 = sys_read_file("/tmp/nx_polish.html" as *u8, lp) 26 let pn: i64 = lp[0] 27 28 var t1: i64 = 0 29 if g_has(p, pn, "transition:transform var(--nx-motion-fast) var(--nx-motion-ease)" as *u8) == 1 { if g_has(p, pn, "@keyframes nx-rise" as *u8) == 1 { t1 = 1 } } 30 t_row("P1 motion is token-driven (transition/animation via var(--nx-motion-*))" as *u8, t1, tot) 31 32 var t2: i64 = 0 33 if g_has(p, pn, ".cta:hover" as *u8) == 1 { if g_has(p, pn, ":focus-visible" as *u8) == 1 { if g_has(p, pn, ".card:hover" as *u8) == 1 { t2 = 1 } } } 34 t_row("P2 micro-interactions present (hover / active / focus-visible)" as *u8, t2, tot) 35 36 var t3: i64 = 0 37 if g_has(p, pn, "@media(prefers-reduced-motion:no-preference)" as *u8) == 1 { t3 = 1 } 38 t_row("P3 accessible motion BY CONSTRUCTION (wrapped in prefers-reduced-motion)" as *u8, t3, tot) 39 40 var t4: i64 = 0 41 if g_has(p, pn, "outline:3px solid var(--nx-color-accent)" as *u8) == 1 { if g_has(p, pn, "<script" as *u8) == 0 { t4 = 1 } } 42 t_row("P4 on-brand token focus ring + 0 third-party JS (sovereign)" as *u8, t4, tot) 43 44 // determinism 45 let fd2: i64 = sys_openat_wr("/tmp/nx_polish2.html" as *u8, 0x1a4) 46 wb_doc_open_branded(fd2, "Polish" as *u8, d, bn) 47 wb_w(fd2, "<p>x</p>\n" as *u8) 48 wb_doc_close(fd2) 49 sys_close(fd2) 50 let p2: *u8 = sys_read_file("/tmp/nx_polish2.html" as *u8, lp) 51 let pn2: i64 = lp[0] 52 var t5: i64 = 0 53 if pn == pn2 { if pn > 0 { var eq: i64 = 1; var i: i64 = 0; while i < pn { if p[i] != p2[i] { eq = 0 } i = i + 1 } t5 = eq } } 54 t_row("P5 determinism: polished page emits byte-identical (reproducible)" as *u8, t5, tot) 55 56 gw("\nrows pass=" as *u8); gn(tot[0]); gw(" fail=" as *u8); gn(tot[1]); gw("\n" as *u8) 57 if tot[1] == 0 { gw("VERDICT=GREEN -- token-driven motion + micro-interactions, accessible + sovereign (mechanism; look stays human-judged)\n" as *u8); return 0 } 58 gw("VERDICT=RED\n" as *u8) 59 return 1 60}