code wiki / _hdl_build / nx_brand_aesthetic.nx

nx_brand_aesthetic.nx source

↩ module page · 30 lines · 1976 B

1// nx_brand_aesthetic.nx -- a MEASURED objective design-quality score (the measurable subset of NN/g + Fogg 2// credibility heuristics). NOT a subjective "is it beautiful" claim -- it counts OBJECTIVE, HTML-observable signals 3// a quality page exhibits. A high score = "meets the objective design-quality bar"; subjective parity with 4// Nike/Apple stays the HONEST-BEHIND axis measured in R6, never claimed here. 10 signals: 5// 1 token-driven (var(--nx-*)) 2 design tokens declared (:root{) 3 type hierarchy (<h1 + <h2) 6// 4 responsive (viewport + @media) 5 accessible motion (prefers-reduced-motion) 6 keyboard a11y (:focus-visible) 7// 7 zero off-token colour drift 8 semantic landmarks (<header + <footer) 9 interaction polish (:hover) 8// 10 whitespace/rhythm (padding) 9// REUSE: nx_brand_tokens (bt_find), nx_brand_book (ba_audit). Library. 100% sovereign. license_tier: ORIGINAL 10import "nx_syscalls.nx" 11import "nx_brand_tokens.nx" 12import "nx_brand_book.nx" 13 14func bq_has(s: *u8, n: i64, lit: *u8) -> i64 { if bt_find(s, n, lit, bt_len(lit)) >= 0 { return 1 } return 0 } 15 16// objective design-quality score 0..10 of a built page. 17func bq_score(html: *u8, n: i64) -> i64 { 18 var s: i64 = 0 19 if bq_has(html, n, "var(--nx-" as *u8) == 1 { s = s + 1 } 20 if bq_has(html, n, ":root{" as *u8) == 1 { s = s + 1 } 21 if bq_has(html, n, "<h1" as *u8) == 1 { if bq_has(html, n, "<h2" as *u8) == 1 { s = s + 1 } } 22 if bq_has(html, n, "viewport" as *u8) == 1 { if bq_has(html, n, "@media(max-width" as *u8) == 1 { s = s + 1 } } 23 if bq_has(html, n, "prefers-reduced-motion" as *u8) == 1 { s = s + 1 } 24 if bq_has(html, n, ":focus-visible" as *u8) == 1 { s = s + 1 } 25 if ba_audit(html, n) == 0 { s = s + 1 } 26 if bq_has(html, n, "<header" as *u8) == 1 { if bq_has(html, n, "<footer" as *u8) == 1 { s = s + 1 } } 27 if bq_has(html, n, ":hover" as *u8) == 1 { s = s + 1 } 28 if bq_has(html, n, "padding:" as *u8) == 1 { s = s + 1 } 29 return s 30}