Expand description
The wire protocol shared between the JS reconciler and the Bevy side.
Everything here derives serde so deno_core’s serde_v8 can convert
directly between the plain JS objects the reconciler builds and these Rust
types — no JSON strings on the hot path. Ops only ever flow JS -> Rust, so
they need Deserialize only; UiEvent flows Rust -> JS and is Serialize.
Wire strings are decoded once, here at the serde boundary — never
re-parsed on apply. The unit-bearing types (Length/Angle/Time/
FontSize) parse into their own wire types, and the enum-like style fields
(display/align*/flex*/grid tracks/…) decode directly into the
bevy_ui/bevy_text values they drive, via field-level deserialize_with
(which sidesteps the orphan rule), so applying a style in [crate::ui_map]
is a plain field copy. A malformed string must not fail the whole batch
(one typo would abort the entire commit and trigger a reload), so every
deserializer falls back to the bevy default and emits a
tracing::warn! naming the bad value (tracing reaches the same log sink
bevy_log drains). In dev builds with devtools those fallbacks are also
collected as structured crate::diag entries (decode_warn +
op::OpBatch’s per-op attribution) so the inspector can flag the offending
style/prop rows.
Modules§
- animatable
Animatable<T>— the{ animated }wrapper every animatable style/attr field decodes through — and theAnimatableFieldread helpers.- background_
image - The
backgroundImagestyle wire types and their totalizing decoder. - grid
- CSS grid track/template/placement string parsing, decoding straight into
bevy_uigrid types via thegrid_fields!deserializers. - keywords
- Keyword-valued style fields: the
keyword_fields!table decodes each wire keyword straight into thebevy_ui/bevy_textenum it drives. - op
- JS→Bevy mutation ops: the
Opbatch the reconciler flushes per commit, plusOpBatch’s decode-warning attribution wrapper. - outbound
- Everything Bevy sends to JS:
UiEventand theOutboundenvelope. - props
Props— the content/attribute level of a host element — and its dirty/event bookkeeping (PropsDirty,UpdateEvents).- style
- The
Styleobject, its dirty-group partition (style_groups,StyleDirty), and thewith_style_fields!table every style field is registered in. - transform
- The static
transform/transform3dwire types mirroring the animated transform channels. - units
- The unit-bearing wire types:
Length,Angle,Time,FontSize,Rect— parsed once at the serde boundary. - visual
- Visual spec wire types: outline, shadows, line metrics, gradients, and per-side border colors.
Constants§
Type Aliases§
- NodeId
- Stable identity for a node, assigned by the JS reconciler.
0is reserved for the root container (the Bevy UI root entity).