ludic.ui: no number made text to be read back - a style handler returns before any text for a key not its own, grow/alpha/animations/scroll read numbers as numbers, el_secs split once per text, a tooltip translated when its title changes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5f2900ffda
commit
706c7abc55
9 changed files with 39 additions and 9 deletions
|
|
@ -1,5 +1,7 @@
|
|||
# attr_edge.ludic - border-radius, outline (and its width, colour and offset), scrollbar-color
|
||||
const EL_KEYS_EDGE: string = " animation background-image border-image border-radius box-shadow outline outline-color outline-offset outline-width scrollbar-color transition "
|
||||
function el_edge(ui_st: mut UiState, n: UiNode, key: string, v: Val) -> bool {
|
||||
if not lk_in(EL_KEYS_EDGE, key) { return false } # not one of its keys: no text made for it
|
||||
let s = vl_text_u(ui_st, v)
|
||||
if key == "border-radius" { n.radius = el_len(ui_st, v) } else if key == "outline" { el_outline(ui_st, n, s) } else if key == "outline-width" { n.outline_w = el_len(ui_st, v) } else if key == "outline-offset" { n.outline_off = el_len(ui_st, v) } else if key == "outline-color" {
|
||||
n.outline_c = ui_color(ui_st, s)
|
||||
|
|
@ -8,7 +10,7 @@ function el_edge(ui_st: mut UiState, n: UiNode, key: string, v: Val) -> bool {
|
|||
let parts = mm_split(ui_st, s, 32)
|
||||
if len(parts) > 0 { n.bar_c = ui_color(ui_st, parts[0]) }
|
||||
if len(parts) > 1 { n.bar_track = ui_color(ui_st, parts[1]) }
|
||||
} else if key == "background-image" and gr_is(tw(ui_st, s)) { nx(n).grad = gr_parse(ui_st, s) } else if key == "background-image" { n.bg_img = el_url_u(ui_st, s) } else if key == "border-image" { el_border_image(ui_st, n, s) } else if key == "box-shadow" { el_shadow(ui_st, n, s) } else if key == "animation" { el_animation(ui_st, n, s) } else if key == "transition" { n.tr_dur = el_secs(s) } else { return false }
|
||||
} else if key == "background-image" and gr_is(tw(ui_st, s)) { nx(n).grad = gr_parse(ui_st, s) } else if key == "background-image" { n.bg_img = el_url_u(ui_st, s) } else if key == "border-image" { el_border_image(ui_st, n, s) } else if key == "box-shadow" { el_shadow(ui_st, n, s) } else if key == "animation" { el_animation(ui_st, n, s) } else if key == "transition" { n.tr_dur = el_secs(ui_st, s) } else { return false }
|
||||
return true
|
||||
}
|
||||
# url(path) or url("path") -> path
|
||||
|
|
@ -77,12 +79,12 @@ function el_animation(ui_st: mut UiState, n: UiNode, s: string) -> void {
|
|||
n.anim = ""
|
||||
for i in 0 .. len(parts) {
|
||||
let p = parts[i]
|
||||
if p == "infinite" { n.anim_loop = true } else if p == "alternate" { n.anim_alt = true } else if len(p) > 0 and ((p[0] >= 48 and p[0] <= 57) or p[0] == 46) { n.anim_dur = el_secs(p) } else if len(p) > 0 and n.anim == "" and p != "none" { n.anim = p }
|
||||
if p == "infinite" { n.anim_loop = true } else if p == "alternate" { n.anim_alt = true } else if len(p) > 0 and ((p[0] >= 48 and p[0] <= 57) or p[0] == 46) { n.anim_dur = el_secs(ui_st, p) } else if len(p) > 0 and n.anim == "" and p != "none" { n.anim = p }
|
||||
}
|
||||
}
|
||||
# the first time in `0.25s` or `250ms`
|
||||
function el_secs(s: string) -> float {
|
||||
let parts = lss_split(s, 32)
|
||||
function el_secs(ui_st: mut UiState, s: string) -> float {
|
||||
let parts = mm_split(ui_st, s, 32)
|
||||
for i in 0 .. len(parts) {
|
||||
let p = parts[i]
|
||||
if len(p) > 1 and p[0] >= 48 and p[0] <= 57 or len(p) > 1 and p[0] == 46 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue