Expand description
The prop schema: the one table of node props, elements, events and readings that every kui binding is generated from or checked against.
A Rust app does not read this module; it builds a NodeSpec with its
methods. The tables here are for the bindings and for tooling. Each
PROPS row names a prop (camelCase, with the snake_case spelling
derived), its wire id, its value kind, how it applies to a NodeSpec
and its documentation: kui-node parses JSON and its binary stream by
kind and generates the TypeScript types from the rows, kui-lua looks
each table key up by name, and kui-ffi mirrors the rows in a C struct
that a parity test pins to this table. CUSTOM lists the composite
props a binding extracts itself (padding shorthands, border, overflow,
floats), ELEMENTS the props each element lowers, DOORS the
verbs (calls rather than props) with their spelling in every binding,
and known_prop answers whether a name is any of these, which is
what an unknown-prop warning checks against.
use kui_core::schema::{PROPS, P_WIDTH};
let width = PROPS.iter().find(|p| p.id == P_WIDTH).expect("a core prop");
assert_eq!(width.name, "width");
assert!(!width.doc.is_empty());Adding a simple prop is one row here (plus npm run gen for the TS
types, and a field in the C struct when the parity test says so).
Composite props need per-binding extraction but not per-binding
decisions: what a shorthand means lives in one place in spec, and
crate::conformance makes every binding agree on behaviour.
Structs§
- Custom
Prop - A prop every binding handles by hand (a composite with real logic, or a constructor-order special), with its wire id so transports agree on identity and its per-binding spelling so the docs can say so.
- Door
- One verb.
- Element
Def - An element (node type) and its spelling in each binding. Elements are hand-lowered per binding (their shapes differ: JSX children, Lua tables, C calls with body callbacks), so this table is documentation and a checklist, not a code generator’s input.
- EnvFacts
- Everything an env reading is taken from: the stored
Envand the frame’s own facts beside it (Core::env_facts). - EnvField
- One value in the host-environment reading a view gets —
ui.env()in Rust,view(env)in Lua,ctx.env()/win.env()in Node — and the key each binding puts it under. C has no reading: a C host is the frame driver, so it is the writer (kui_env_set,kui_env_set_window), and its column names the argument that carries the fact in. - Event
Def - An event kind hosts receive, with its payload shape.
- Metric
Role - One size the stock widgets are built from (
crate::metrics::Metrics), pinned the wayThemeRolepins a colour: a binding iterates the rows to read or write a set, so a field added toMetricsis one row here and nothing anywhere else. The test below destructures the struct exhaustively. - Platform
Value - A metric’s value per platform (see
MetricRole::platform). - PropDef
- Props
Out - Everything a prop list can carry; elements pick the parts they use.
- Resource
Def - A host-registered resource and how each binding registers it.
- Theme
Role - One colour role in a
crate::theme::Theme, with the spelling each binding reads it under and the reading itself.
Enums§
- Apply
- Where a parsed value lands.
PropDef::targetderives from this. - Cell
- One binding’s cell.
- Identity
- Which key a prop list opens its node under: the next auto key, the
keylabel, or — beating the label when a binding is handed both — theindexa virtual list opens its rows by. - Kind
- How a prop’s value is parsed (per transport) and encoded (binary slots).
- Parsed
- A parsed prop value, transport-independent.
- Spelling
- The spelling a binding writes prop names in: JSX’s camelCase rows, or the
snake_case ones a Lua table takes. The allow-list below is per spelling,
so
hover_bgin JSX andhoverBgin Lua are each as unknown as a typo — which is what they are: neither binding reads the other’s spelling. - Target
Constants§
- ALIGNS
- The
mainAlign/crossAlignrows and a float’s attach points, inAlign’s order. Append-only: the Lua and Node wires carry the index, and C’sKUI_ALIGN_*is it. The spreads mean something onmainAlignandbaselineon a row’scrossAlignonly. - APPEARANCES
- The OS light/dark setting (
crate::env::Appearance::namespellings, inAppearance::ALLorder — anenv.rstest pins the two together). LikeORIENTATIONSthis is not a prop’s enum: it is a fact a host pushes and every binding spells the same way. Index 0 isunknown, so a zeroed C call reports what it actually knows. - ASSISTIVE
- Whether assistive technology is listening (
crate::env::Assistive::namespellings, inAssistive::ALLorder),unknownfirst for the same reason: a host with no bridge reports that it cannot tell. - AUDIO_
DEVICES - The audio output device’s state (
crate::env::AudioDevice::namespellings, inAudioDevice::ALLorder),closedfirst so a zeroed C call reports the default. - BACKDROPS
- What is behind a window’s transparent pixels
(
crate::window::Backdrop::namespellings, inBackdrop::ALLorder),opaquefirst so a zeroed C call reports the default. - BUTTON_
ROWS_ JSX - The rows the stock button reads (
ElementDef::jsx_rows/lua_rows): the click, the identity (key, orindexin a virtual list — declared besidekeythe index wins, as on a box), the access rows — what a button is and what a reader says of it — and the one paint row it takes,accent, which is not a colour but a question put to the OS. The two lists are the same rows in each spelling, index for index. - BUTTON_
ROWS_ LUA - CURSORS
- The pointer shapes a view can declare (
CursorShape::namespellings, inCursorShape::ALLorder — acursor.rstest pins the two together). - CUSTOM
- C_
FIELDS - Where a schema row lands in C when it is not simply the
KuiSpec/KuiTextStylefield of the row’s snake_case name (c_field). - DERIVED_
ONLY - The roles no view can declare, because the core derives them itself,
with what derives each one. Every
Role::ALLvariant is on this list or inROLES, andevery_role_is_declarable_or_derivedkeeps both halves honest: a role exempted here has to be one a frame really does derive, so the list cannot absorb a variant that was simply forgotten fromROLES. - DOORS
- EASINGS
- The easing curves (
Easing::namespellings, inEasing::ALLorder — the test below pins the two together, asCURSORSis pinned). - ELEMENTS
- ENV_
FIELDS - EVENTS
- EXPANDED
expandednames its state rather than being a flag: a disclosure that is shut has to say “collapsed”, and an absent flag cannot — absent has to keep meaning “this node does not expand” (AccessKit’sexpanded, ARIA’saria-expanded, are three-state for the same reason).- FAMILIES
- The stock families (
FontFamily::namespellings, inFontFamily::ALLorder); a registered font travels as thefontrow’s handle instead. - GUEST
- The reason most of Lua’s column is
No: a script’s env is a reading the host hands it for oneview, not a handle on the host. It declares a tree and answers events; what it registers, drives, times or reads back is the host’s. - LIVE
- How urgently a reader should read a change it was not asked to read
(
crate::access::Live::namespellings, in wire order — a binding sends the index).offis the default and means “not a live region”. - LUA_
ALIASES - A name one binding takes for a row it cannot spell the usual way, with
the row’s own snake_case name:
repeatis a Lua keyword, so that row also answers to CSS’s own name for it. The Lua binding remaps through this table, and the check below accepts both sides of it. - METRIC_
ROLES - MOTIONS
- The OS reduce-motion setting (
crate::env::MotionPref::namespellings, inMotionPref::ALLorder),unknownfirst for the same reason. - ORIENTATIONS
- How a composite container arranges its items
(
crate::access::Orientation::namespellings), in wire order. Derived from the container’sdirand reported on its access node, never declared — so unlikeROLESthis is not a prop’s enum, only a list the C header restates. - OVERSCROLLS
- The
overscrollrow, inOverscroll::ALL’s order: a scroll gesture starting over a scroller at its limit goes on to the one around it, or stays. C spells it as the index plus one (KUI_OVERSCROLL_*), a zeroed field beingauto. - PROPS
- P_
ACCENT - P_
ALWAYS_ ON_ TOP - P_
ANCHOR - P_
ANIMATE - P_
ASPECT_ RATIO - P_
BACKDROP_ BLUR - P_BG
- P_
BORDER - P_
BOUNCE - P_
BUTTONS - P_CARET
- P_
CARET_ SOLID - P_
CENTER - P_
CHECKED - P_
CLICK_ SOUND - P_COLOR
- P_
CROSS_ ALIGN - P_
CROSS_ GAP - P_
CURSOR - P_DELAY
- P_
DESCRIPTION - P_DIR
- P_
DISABLED - P_
DROP_ BG - P_
EASING - P_
ELLIPSIS - P_ENTER
- P_EXIT
- P_
EXPANDED - P_
FAMILY - P_
FEATURES - P_FLOAT
- P_
FOCUSABLE - P_
FOCUS_ BG - P_
FOCUS_ REGION - P_FONT
- P_GAP
- P_
GRADIENT - P_
HEIGHT - P_
HOVERABLE - P_
HOVER_ BG - P_
HOVER_ GROUP - P_
HOVER_ SOUND - P_
IME_ OFF - P_INDEX
- P_
INITIAL_ FOCUS - P_
KEEP_ FOCUS - P_KEY
- P_
KEYFRAMES - P_
KEY_ FOCUS - P_
KEY_ UP - P_LABEL
- P_
LINE_ HEIGHT - P_LIVE
- P_
MAIN_ ALIGN - P_MAX_H
- P_
MAX_ LINES - P_MAX_W
- P_MIN_H
- P_MIN_W
- P_MIXED
- P_MODAL
- P_
MODIFIER_ KEYS - P_
ON_ BUTTON - P_
ON_ CHANGE - P_
ON_ CLICK - P_
ON_ CONTEXT_ MENU - P_
ON_ DRAG - P_
ON_ DROP - P_
ON_ FOCUS - P_
ON_ FORCE_ CLICK - P_
ON_ HOVER - P_
ON_ KEY - P_
ON_ LAYOUT - P_
ON_ SCROLL - P_
OPACITY - P_
OPTION_ AS_ ALT - P_
OVERFLOW - P_
OVERSCROLL - P_PAD
- P_
PIXEL_ SNAP - P_
PRESSED_ BG - P_
RADIUS - P_
RADIUS_ BL - P_
RADIUS_ BR - P_
RADIUS_ TL - P_
RADIUS_ TR - P_
REPEAT - P_ROLE
- P_
ROW_ COUNT - P_RULES
- P_
RULE_ WIDTH - P_
SCROLLBAR - P_
SCROLLBAR_ ACTIVE_ COLOR - P_
SCROLLBAR_ COLOR - P_
SCROLLBAR_ WIDTH - P_
SCROLL_ AXES - P_
SCROLL_ MODS - P_
SECURE_ INPUT - P_
SELECTABLE - P_
SELECTED - P_
SELECTION_ ANCHOR - P_
SHADOW_ BLUR - P_
SHADOW_ COLOR - P_
SHADOW_ SPREAD - P_
SHADOW_ X - P_
SHADOW_ Y - P_SIZE
- P_SLIDE
- P_
STRIKETHROUGH - P_TITLE
- P_
TOOLTIP - P_
TRANSITION - P_
UNDERLINE - P_
UNDERLINE_ COLOR - P_
UNDERLINE_ STYLE - P_
VALUE_ MAX - P_
VALUE_ MIN - P_
VALUE_ NOW - P_
VALUE_ STEP - P_
VALUE_ TEXT - P_WIDTH
- P_
WINDOW - P_
WINDOWS - P_WRAP
- P_
WRAP_ CHILDREN - REPEATS
- CSS’s
animation-directionvalues, inRepeat::ALL’s order. - RESOURCES
- ROLES
- The roles a view can declare (
crate::access::Role::namespellings), in wire order — a binding sends the index. The purely derived roles are the onesDERIVED_ONLYnames, and every otherRole::ALLvariant is here;textInput,multilineTextInputandlineare, because an app that draws its own text declares them. - SCROLLBARS
- The
scrollbarrow, inScrollbarMode::ALL’s order: the stock overlay bar, none, or one that fades out when the scroll state has not changed. C spells it as the index plus one (KUI_SCROLLBAR_*), so a zeroed field is “unset”. - SCROLL_
AXES - The
scrollAxesrow, inScrollAxes::ALL’s order: the axes anonScrollnode takes. C spells it as the index plus one (KUI_SCROLL_AXES_*), a zeroed field beingboth. - SIZE_
MODE_ CALC - The mode a sizing’s, a min’s or a max’s first binary slot holds for a size expression, whose spelling follows as a strref (v19).
- SIZE_
MODE_ TREE - The mode for a size expression as data: a count of slots follows,
then the expression in prefix code (
crate::calc::from_code) — what the Node encoder sends for{ clamp: [...] }, so the addon reads numbers and parses no text (v19). - SLIDER_
ROWS_ JSX - The rows the stock slider reads (
widgets::slider_with): the value rows, its change tag, the access rows, and its width — the one piece of its look an app sizes. - SLIDER_
ROWS_ LUA - TEXT_
ROWS_ JSX - The rows a
textreads (ElementDef::jsx_rows/lua_rows): theTextStylerows andsize, the composite the style is built from — and nothing else, because every door lowers a text as content plus a style and no spec (Core::text_node), so a container or access row on it reaches no tree. Before AR13 the element admitted every shared row, and<text live="polite">,<text role="heading">,<text label>and<text onClick>were dropped silently by all four bindings — nounknown-prop, andlive-region-without-namecould never fire for them. Pinned equal to theTarget::Stylerows by a test, so a style row added toPROPSis a row here or a red test. - TEXT_
ROWS_ LUA - THEME_
ROLES - TOGGLE_
ROWS_ JSX - The rows a stock toggle —
checkbox,radio,switch— reads (widgets::toggle_with): the button’s access rows, its state and no layout or paint row, since its look is its spec.mixedmeans something on a checkbox alone. - TOGGLE_
ROWS_ LUA - UNDERLINE_
STYLES underlineStyle/underline_style;UnderlineStyle::NAMES.- WINDOW_
ROLES - WRAPS
Functions§
- align_
idx - apply
- Applies one parsed value through its row. Errors on a kind mismatch,
which can only come from a transport bug (each transport parses by the
same
Kind). - by_id
- by_name
- by_
snake_ name - c_field
- The C spelling of a schema row, for docs.
- color_
hex_ str #rgb/#rrggbb/#rrggbbaa.- color_
num - 0 = transparent, anything else 0xRRGGBBAA.
- cursor_
idx - easing_
idx - element_
own - The props only this element takes, in
spelling. An element the table does not know has none. - element_
rows - The schema rows
elementreads, inspelling, when it does not read them all (ElementDef::jsx_rows);Nonefor an element that takes every row, and for one the table does not know. - enum_
index - Looks an enum name up in its row’s list.
- known_
prop - Is
namea propelementreads — a schema row, a composite, an alias, or one of the element’s own? A binding drops everything else on the floor, so everything else is adiag::UNKNOWN_PROPwarning. An element that names its rows reads those and its own, and nothing else. - lua_
alias direction→repeat: the schema name a Lua table key stands for, when it is not the name itself.- max_str
- The string forms of a max: a size expression.
- min_num
- Binary min or max decode: (mode, value) → a clamp, the first two
sizing modes (
SIZE_MODE_CALCis read by the transport, which holds the strref). - min_str
- The string forms of a min:
"fit", or a size expression (crate::calc). A number arrives as a number. - odin_
field - The Odin spelling of a schema row: the
SpecorText_Stylefield of its snake_case name, which is what the Odin generator names every field. - odin_
from_ c - A C cell in Odin’s words, for the rows where Odin’s door is C’s: the
binding’s procedures are kui.h’s functions under
kui.without theirkui_, and its node and text fields areSpec./Text_Style..RESOURCESandENV_FIELDStake their Odin column from here, and the Odin generator checks each name it produces. - repeat_
idx - role_
idx - The role at wire index
i—ROLES’ order is the protocol, so this andROLESare pinned to each other byevery_declarable_role_name_is_a_real_role. - shared_
prop - Is
namea row every element reads — a schema row, a composite, an alias — as opposed to a misspelling? Whatknown_propanswers for an element that admits only some rows still depends on this: a row the element does not read is dropped like a misspelling, but the warning can say so instead of hunting for a nearer spelling. - sizing_
num - Binary sizing decode: (mode, value) → Sizing.
- sizing_
str - The string forms of a sizing: “fit” | “grow” | “N%” | a size
expression (
crate::calc). - snake_
case minWidth→min_width,radiusTL→radius_tl(a run of capitals is one word); names without capitals pass through.- suggest
- The name an unknown one was probably meant to be: the same word in the
other convention (
hoverBgforhover_bg,onClickforonclick), which is what a wrong spelling almost always is. Nothing fuzzier — a confident suggestion or none.