Builtin Library
README.md
edui.widgets.fields
Inspector field rows for edui — a two-column (label + control) row whose control is chosen by the field's declared TYPE (from the component's backing schema), falling back to the value's shape when no type is given.
The label column carries the field name and a per-type badge (num/str/bool/enum/rgb/vec3/rot/ref/obj, each in its own hue) so a row's type reads at a glance. The control column maps:
number→ drag-scrub numeric field (controls.numberField); a spec carryingmin/maxshows its bounds beside the input (1 – 16, an open side as…)bool→ toggle switch (controls.boolToggle)string→ framed text inputenum→ a value button that opens a menu of memberscolor→ swatch + native colour pickervec3→ three axis-coloured (x/y/z) numeric cellsquat→ an editable euler (X/Y/Z degrees), read back to a quaternionassetRef→ a live-asset chip- nested table → a recursing disclosure
Each editable leaf fires onChange(newValue) (vec3/quat fire the full new
table). A row spec's description is the label's tooltip, and its error is
drawn beneath the row in the danger colour. Every committed edit is one
undoable operation named after the field.
schemaField — a row from a Field descriptor
edui.schemaField{ label, desc, value, key, onChange?, readOnly?, error?, errors?, nameOf? } is the one place a Field.* descriptor becomes its
control. The descriptor decides the control:
| Descriptor | Control |
|---|---|
Field.enum (string with an enum constraint) | dropdown of its members |
Field.number / Field.range / Field.integer / Field.bitmask | number; a range or an integer shows min – max, a bitmask 0 – 2^bits-1 |
Field.bool / Field.string | toggle / text input |
Field.color | swatch + picker; an edit keeps the value's alpha |
Field.vec2 | two axis cells (x/y), each edit emits { x, y } |
Field.vec3 / Field.quat | axis triple / editable euler |
Field.assetRef / Field.resource / Field.dataRef | asset chip accepting the descriptor's category |
Field.instantiableRef | asset chip accepting the spawnable kinds ("*" is the wildcard category and narrows nothing; the scene-instantiable constraint does) |
Field.taggedRef | asset chip accepting any kind, reading "accepts assets tagged <tag>" — the field's own constraint checks the tag |
Field.entityRef | entity chip, named through nameOf |
Field.struct (and Field.settingsOf) | a disclosure of its subfields, each a schemaField in declaration order (Settings.orderedNames); an edit emits the whole struct |
Field.list | a disclosure of its elements, each a schemaField, with Add, Remove, Move up and Move down; every action emits the whole new list. The first element has no Move up and the last no Move down; Add appends the element descriptor's default |
Field.table / Field.componentRef | the value-shaped control field would choose |
A value stored as an array ({ 1, 0, 0, 1 }) reads as its map form
({ r, g, b, a }), and a missing value shows the descriptor's default.
error is this row's own message. errors maps paths relative to this
field to messages — "filter", "[2]", "[2].name" — and each nested row
of a struct or list receives the part under its own name
(edui.widgets.subErrors(errors, head) does the re-keying). The descriptor's
description is the label's tooltip.
Callback keys, for a row keyed k: the disclosure k:disc; a subfield or
element k/<name> / k/<i>; list Add k:add; Remove k:rm:<i>; Move up
k:up:<i>; Move down k:down:<i>; a vec2 axis k:x / k:y.
Fields.make(W) binds these to the widgets barrel; the barrel exposes
edui.field, edui.schemaField and edui.section, and
edui.widgets.subErrors.