Widget Structure Conventions
This page defines how stateful widgets should be organized inside crates/univis_ui_widgets/src/widget/.
Public Surface
- each widget exposes one public authored component such as
USelect,UTextField, orUPanel - each widget exposes one plugin named
Univis<Name>Plugin - outward-facing messages live in
eventswhen the widget emits them
Internal Split
Use these responsibilities when a widget grows beyond a small single-file implementation:
model: authored data, normalization helpers, and public configuration typesruntime: generated child-tree markers, runtime resources, and setup helpersinteraction: input handling and state transitionsvisuals: syncing colors, labels, geometry, and other rendered outputevents: emitted messages after state settles
Schedule Rules
Build: spawn or repair runtime child treesLogic: respond to input and mutate widget stateVisual: synchronize the live visual tree from the latest stateEvents: emit outward-facing messages after logic and visuals settle
Typical Patterns
select/usesmodel,runtime,interaction,visuals, andeventspanel/splits resize math, cursor logic, runtime resize state, and visualstext_label/usesmeasure/andrender/because text is both a layout and rendering subsystem
Visibility Rules
- public authored components stay public and documented
- runtime markers and bookkeeping types should usually remain
pub(super) - tests should sit next to the widget they validate so structural refactors stay local