Skip to main content

Module signals

Module signals 

Source
Expand description

Reactive named-value store backing bind-text="..." markup attributes and <for each="..."> iteration.

Wave-D status: Signals is now a thin #[deprecated] wrapper kept for external embedders that still hold Res<Signals> references. Internal lumen systems (apply_text_bindings, apply_checked_bindings, …) read and write through PropertyStore directly - that’s the canonical typed reactive store. The wrapper’s set mirrors writes into PropertyStore via push_external_property so the next tick’s crate::property_store::drain_external_properties pass commits them, and get reads from the local HashMap populated by mirror-back when an external write lands.

  • Signals holds scalar String values keyed by name (back-compat only).
  • ArraySignals holds ordered vectors of record-shaped maps keyed by name.
  • Scripts populate both via signal_set / signal_array_set, stringified at the boundary.
  • Each tick, the Bind* and reconciler systems pull from PropertyStore (post wave-D) and copy into bound components or spawn/despawn <for> children.

Structs§

ArraySignals
Reactive array store paired with Signals; ordered vectors of ArrayItem keyed by name. Written through ScriptCommand::SetArray; the reconciler system spawns/despawns markup children to match the stored vector.
SignalsDeprecated
Legacy reactive named-value store. Deprecated as of wave-D - internal lumen systems now read/write through PropertyStore keyed on PropertyKey::Global.

Enums§

ExternalMutation
One enqueued mutation applied by drain_external_signals on the next tick. Values are pre-stringified.

Functions§

apply_checked_bindings
Copies PropertyStore[Global(name)] into Toggleable::checked for every BindChecked entity. Recognises Bool directly plus the canonical "true" / "1" string aliases for back-compat.
apply_disabled_bindings
Copies PropertyStore[Global(name)] into the presence of the Disabled marker for every BindDisabled entity: truthy inserts, falsy removes. Recognises Bool plus the canonical "true" / "1" string aliases via get_global_bool. A missing signal leaves the entity untouched (its spawn-time disabled attribute keeps authority until the signal exists).
apply_scroll_bindings
Parses PropertyStore[Global(name)] as f32 and writes it into the vertical ScrollOffset of every BindScroll + Scroll entity (W6 T6).
apply_text_bindings
Copies PropertyStore[Global(name)] into TextContent for every BindText entity. Entities whose property has no entry keep their existing text.
apply_theme_class_to_rootDeprecated
Legacy theme application path - superseded by the W1.6 split of style_manager_to_signal (producer) + apply_theme_signal_to_root_classes (consumer). Retained as a #[deprecated] thin wrapper so external callers that explicitly registered this system keep compiling; new registrations should use the split pair instead.
apply_theme_signal_to_root_classes
Consumer half of the W1.6 theme-notify path: reads PropertyStore::dirty_peek for PropertyKey::Global("__theme__") and applies theme-light / theme-dark to every root entity’s crate::components::LumenClasses.
apply_value_bindings
Parses PropertyStore[Global(name)] as f32 and writes it into SliderValue::value (clamped to [min, max]) for every BindValue entity. Unparseable values are skipped.
clear_signal_dirty
Clears the legacy Signals::dirty set at the end of crate::tick::TickStage::A11ySync. Argument is Option<ResMut<Signals>> so the system no-ops when the Signals resource is absent. Post wave-D the canonical dirty queue lives on PropertyStore and is cleared by crate::property_store::clear_property_store_dirty.
drain_external_signals
Per-tick system that drains queued external Array / Clear mutations into ArraySignals. Scalar signal writes were routed through push_external_property in wave-D and are committed to PropertyStore by crate::property_store::drain_external_properties; only the legacy Array path remains here.
init_external_signals
Idempotently initialises the external signal channel. Safe to call multiple times.
mirror_property_store_globals_to_signals
Per-tick mirror that copies the latest PropertyStore global string cells back into the legacy Signals map. Runs in crate::tick::TickStage::Systems after drain_external_properties so any write that landed on PropertyStore directly (typed setters, ECS-side writes, FFI typed pushes) is visible to readers that still consult Res<Signals>.
os_theme_to_signalDeprecated
Pre-W4.6 alias retained as a thin wrapper so any external scheduler that explicitly named the system keeps compiling. New callers should use style_manager_to_signal.
push_external_array
Sends an array mutation from any thread. Returns false when the channel has disconnected. Array signals stay on the legacy ExternalMutation path until ArraySignals migrates to PropertyStore.
push_external_clear
Sends a clear mutation from any thread. Returns false when the channel has disconnected. The scalar half routes through push_external_property (empty string); the array half stays on the legacy channel.
push_external_signal
Sends a scalar signal write from any thread. Wave-D: routes through push_external_property so the value lands typed in PropertyStore under PropertyKey::Global(name) on the next tick.
push_scroll_to_signal
Pushes the settled vertical ScrollOffset back into the matching PropertyStore entry for every BindScroll entity (W6 T6, the two-way half).
push_slider_to_signal
Pushes SliderValue::value back into the matching PropertyStore entry for every BindValue entity with Changed<SliderValue>. Writes the stringified value so the existing <if> / interpolation paths keep working.
push_textinput_to_signal
Pushes the latest TextContent back into the matching PropertyStore entry for every entity carrying both BindText and crate::components::TextInput. Filtered by Changed<TextContent> so the push only fires on user edits.
push_toggle_to_signal
Pushes Toggleable::checked back into the matching PropertyStore entry for every BindChecked entity with Changed<Toggleable>. Writes the canonical "true" / "false" string variant so the wave-D <if eq="true"> body comparator and Signals::get_bool callers keep recognising it. Spawn-tick rows (is_added()) are skipped: the freshly-inserted component carries the widget’s spawn default, not a user edit, and pushing it would clobber a script’s signal(name, default) initial publish (authored markup attrs seed the store separately, if-absent, at spawn).
style_manager_to_signal
Producer half of the W1.6 theme-notify path: on every Changed<StyleManager> tick, writes "dark" / "light" into PropertyStore under the __theme__ global key based on crate::components::StyleManager::effective_dark.

Type Aliases§

ArrayItem
One row of a reactive array; field name -> stringified value.