ludic ui-preview: ludic.ui components previewed for a studio over stdio (R5)
A prebuilt tool, bin/ludic-ui-preview (built by ludic-dev build, shipped beside ludic-lsp, run as `ludic ui-preview [--font DIR]`): ludic.ui with a backend that records every draw call as a line, and mock component classes the studio describes (load / model / calls). frame t runs ui_show at interface time t; text is measured on the CPU with the game's font.json metrics; locale goes through ludic.i18n; tree / box / rules inspect the frame. No game code, no GPU, no network. The wire protocol is frozen as tools/ui-preview/protocol-v1.md; smoke.txt is a transcript to run. ludic.ui gains, all additive: UiClass.make_of, UiBackend.said / emitted, UiRule.text / at (with comment line breaks kept so rule lines count true, and a class's styles read under its .lss path), and ui_root, ui_find, ui_rules_of, ui_rule_value, ui_building, ui_class, ui_class_load, ui_file_forget, ui_errors_clear; ui_nine_cuts_into exported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
28f7b4666b
commit
49b5e80af5
38 changed files with 1986 additions and 16 deletions
|
|
@ -1,10 +1,10 @@
|
|||
# style_rule.ludic - a rule read, the cascade a file sees, and a node's rules applied to it
|
||||
function lss_rule(f: UiFile, sels: string, body: string, err: []string) -> void {
|
||||
function lss_rule(f: UiFile, sels: string, body: string, err: []string, line: int) -> void {
|
||||
let decls = lss_decls(body, err)
|
||||
let each = lss_split(sels, 44)
|
||||
for i in 0 .. len(each) {
|
||||
let sel = tpl_words(each[i])
|
||||
if len(sel) > 0 { lss_rule_add(f, decls, sel, err) }
|
||||
if len(sel) > 0 { lss_rule_add(f, decls, sel, err, line) }
|
||||
unsafe { # a selector keeps its parsed parts, never its text
|
||||
if not tpl_clean(each[i]) { free(sel) }
|
||||
free(each[i])
|
||||
|
|
@ -15,10 +15,12 @@ function lss_rule(f: UiFile, sels: string, body: string, err: []string) -> void
|
|||
free(decls) # the holder only: each rule keeps its keys and values lists
|
||||
}
|
||||
}
|
||||
function lss_rule_add(f: UiFile, decls: UiRule, sel: string, err: []string) -> void {
|
||||
function lss_rule_add(f: UiFile, decls: UiRule, sel: string, err: []string, line: int) -> void {
|
||||
let r = new UiRule
|
||||
r.keys = decls.keys
|
||||
r.vals = decls.vals
|
||||
r.text = `{sel}` # a copy: the selector's text is given back below
|
||||
r.at = `{f.path}:{line}`
|
||||
r.sel = sel_parse(sel, err)
|
||||
if r.sel != null {
|
||||
r.spec = sel_spec(r.sel)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue