ludic/packages/ludic.ui/node.ludic

112 lines
4.9 KiB
Text

# node.ludic - what a template becomes each frame, the view it reads, and the renderer seam
export property UiNode {
kind: int = 0
dir: int = 0
text: string = ""
key: string = ""
tag: string = "" # what it is called in the template, and what a selector names
id: string = ""
classes: []string = null
akeys: []string = null # its attributes, as text, for [attr=value] selectors
avals: []string = null
vals: []Val = null # the same, as values, applied after every rule
style: UiRule = null # its style="..." declarations
sheet: UiSheet = null # the stylesheets of the file it was written in
ups: []UiPass = null # a component's root: each user's sheet and style="...", inner first
parent: UiNode = null
index: int = 0 # its place among its parent's children, for :first-child and the rest
src: string = "" # an <img>'s picture
size: float = 0.0
w: float = -1000000.0 # a fixed width or height (0 is 0); UI_AUTO: none, UI_FILL: fill
h: float = -1000000.0
w_pct: float = 0.0 # a width or height as a percentage of the parent's room
h_pct: float = 0.0
pt: float = 0.0 # padding, top right bottom left
pr: float = 0.0
pb: float = 0.0
pl: float = 0.0
mt: float = 0.0 # margin
mr: float = 0.0
mb: float = 0.0
ml: float = 0.0
border: float = 0.0 # border-width, all four sides; bt br bb bl are each side's own
bt: float = 0.0
br: float = 0.0
bb: float = 0.0
bl: float = 0.0
border_c: int = -2
gap: float = 0.0
align: int = 0
justify: int = 0
talign: int = 0 # text-align
self: int = -1 # align-self; -1 takes the parent's align
grow: float = 0.0 # a share of the spare room along the parent's direction
wrap: bool = false # a row breaks into lines where it runs out of room
min_w: float = 0.0
max_w: float = 0.0 # 0 is no limit
min_h: float = 0.0
max_h: float = 0.0
hidden: bool = false # display: none, or hidden
pos: int = 0 # position: 0 static, 1 relative, 2 absolute, 3 fixed
top: float = -1000000.0 # the insets a positioned element is placed by (UI_AUTO: unset)
right: float = -1000000.0
bottom: float = -1000000.0
left: float = -1000000.0
z: int = 0
nowrap: bool = false # white-space: nowrap
ellipsis: bool = false # text-overflow: ellipsis
lines: []string = null # a wrapped text's lines: the memo's (ly_wrap), not the node's
none: Val = Value.null() # what ui_attr answers for an attribute it lacks: made with the node, read only
var_names: []string = null # its custom properties (--name), which its descendants inherit
var_vals: []string = null
fg: int = -1 # a colour is 0xRRGGBB with its alpha beside it; -1 inherits
fg_a: float = 1.0
bg: int = -2 # -2: no background
bg_a: float = 1.0
border_a: float = 1.0
rfg_a: float = 1.0
alpha: float = 1.0
enabled: bool = true
act: UiAct = null # on-press, which the pointer and the renderer's button fire
on_names: []string = null # every on-* it answers
on_acts: []UiAct = null
native: UiNative = null
env: UiEnv = null
children: []UiNode = null
mw: float = 0.0
mh: float = 0.0
content_h: float = 0.0 # what a scroll box holds, however tall the box itself is
x: float = 0.0
y: float = 0.0
cw: float = 0.0
ch: float = 0.0
rsize: float = 0.0
rfg: int = 0
hovered: bool = false
focusable: bool = false # a control, or anything with a tabindex: the keyboard reaches it
radius: float = 0.0 # border-radius
outline_w: float = 0.0 # outline: drawn outside the box, where a focus ring goes
outline_c: int = -1
outline_a: float = 1.0
outline_off: float = 0.0
scroll_y: float = 0.0 # how far a scroll box is scrolled
bar_c: int = -1 # scrollbar-color: its thumb, and its track
bar_track: int = -2
opts: []UiNode = null # a select's options
bg_img: string = "" # background-image: url(...), stretched over the box
bi_src: string = "" # border-image: a nine-slice drawn instead of the background, tinted by it
bi_slice: float = 0.0
bi_width: float = 0.0
sh_x: float = 0.0 # box-shadow: an offset copy of the box, drawn under it
sh_y: float = 0.0
sh_c: int = -2
sh_a: float = 1.0
anim: string = "" # animation: its @keyframes, how long, looping, back and forth
anim_dur: float = 0.0
anim_loop: bool = false
anim_alt: bool = false
tr_dur: float = 0.0 # transition: how long a change of opacity takes
popover: bool = false # drawn on the top layer; a press outside it or Esc closes it
ex: UiNodeX = null # what fewer elements say (node_more.ludic), made when one does
}