- 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>
40 lines
1.7 KiB
Text
40 lines
1.7 KiB
Text
# node_more.ludic - what only some elements say, kept apart from UiNode so the common node stays
|
|
# small: made the first time a property needs it (nx), and null everywhere else
|
|
# a component user's styles for the root it passed class, style and id down to
|
|
export property UiPass {
|
|
sheet: UiSheet = null # the sheet of the file the component's tag was written in
|
|
style: UiRule = null # the tag's style="..."
|
|
env: UiEnv = null # where the tag's values are read
|
|
}
|
|
export property UiNodeX {
|
|
shrink: float = -1.0 # flex-shrink; -1: a scroll box's 1, anything else's 0 (or 1 in a column)
|
|
order: int = 0 # flex's order
|
|
w_off: float = 0.0 # calc(): the lengths added to a percentage width or height
|
|
h_off: float = 0.0
|
|
mh_min: float = 0.0 # how short a column can be pressed: its scroll boxes give way
|
|
has_min: bool = false
|
|
tsh_set: bool = false # text-shadow, inherited as CSS's is; tsh_c -2 is none
|
|
tsh_x: float = 0.0
|
|
tsh_y: float = 0.0
|
|
tsh_c: int = -2
|
|
tsh_a: float = 1.0
|
|
}
|
|
function nx(n: UiNode) -> UiNodeX {
|
|
if n.ex == null { n.ex = new UiNodeX }
|
|
return n.ex
|
|
}
|
|
function ly_woff(n: UiNode) -> float {
|
|
if n.ex == null { return 0.0 }
|
|
return n.ex.w_off
|
|
}
|
|
function ly_hoff(n: UiNode) -> float {
|
|
if n.ex == null { return 0.0 }
|
|
return n.ex.h_off
|
|
}
|
|
# a percentage width or height in `room`, with what calc() added to it
|
|
function ly_pw(n: UiNode, room: float) -> float { return room * n.w_pct / 100.0 + ly_woff(n) }
|
|
function ly_ph(n: UiNode, room: float) -> float { return room * n.h_pct / 100.0 + ly_hoff(n) }
|
|
function ly_order(n: UiNode) -> int {
|
|
if n.ex == null { return 0 }
|
|
return n.ex.order
|
|
}
|