feat(ui): flex-shrink, text that wraps beside its siblings, calc(), order, and 0 as a size
- flex-shrink: a line whose children want more room than it has takes it back from those that shrink, in proportion to shrink times size and never below a min size, a fixed size or the content. A scroll box shrinks (and scrolls), and a box in a column shrinks as far as the scroll boxes inside it let it, so a list in a column takes the room its siblings leave with no height. `flex: grow shrink`, and `flex-shrink` by name. - A row wider than its room measures its texts (and boxes without a width) again in the room the rest leave them, so a line wraps beside an icon. - calc() with + - * / and brackets over px, %, em, rem, vw, vh, plain numbers and var(); a width or height keeps its percentage, taken of the room it is given. Lengths lists (padding, margin) keep a calc()'s spaces. - `order` places a box's children without touching the tree. - width: 0 and height: 0 are 0: an unset size is UI_AUTO now, not 0. - A component root that is itself a component takes each user's class, style and id in turn (the outermost's id wins), and the rules of all their sheets are weighed by specificity together; a user's rule wins a tie. The parent's sheet used to override the child's whatever its specificity, and a middle component's sheet was lost. - The default sheet lays .ui-track out as a row, so a range's fill is as tall as its track and a checked box's knob goes right; a range's thumb is centred on the fill's end. - ui_boxes.ludic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9ad6347044
commit
7d8f34de17
23 changed files with 609 additions and 94 deletions
|
|
@ -24,9 +24,9 @@ var el_s3: float = 0.0
|
|||
function el_sides(v: Val) -> void {
|
||||
let parts = new []float
|
||||
if vl_num(v) { push(parts, ui_px(Value.as_float(v))) } else {
|
||||
let words = lss_split(vl_text(v), 32)
|
||||
let words = el_words(vl_text(v))
|
||||
for i in 0 .. len(words) {
|
||||
if len(words[i]) > 0 { push(parts, el_unit(words[i])) }
|
||||
if len(words[i]) > 0 { push(parts, el_word_len(words[i])) }
|
||||
}
|
||||
}
|
||||
while len(parts) < 4 {
|
||||
|
|
@ -37,11 +37,12 @@ function el_sides(v: Val) -> void {
|
|||
el_s2 = parts[2]
|
||||
el_s3 = parts[3]
|
||||
}
|
||||
# a length: a number, 10px, 1.5em, 2rem, 50vw, fill, fit or auto (a percentage is el_pct's)
|
||||
# a length: a number, 10px, 1.5em, 2rem, 50vw, calc(...), fill, fit or auto (a percentage is el_pct's)
|
||||
function el_len(v: Val) -> float {
|
||||
if vl_num(v) { return ui_px(Value.as_float(v)) }
|
||||
let s = vl_text(v)
|
||||
if s == "fill" { return UI_FILL }
|
||||
if ca_is(s) { return el_calc_len(s) }
|
||||
if s == "fit" or s == "auto" or (len(s) > 0 and s[len(s) - 1] == 37) { return 0.0 }
|
||||
return el_unit(s)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue