You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mogwai-macros bumped from 0.2.0 to 0.2.2. The mogwai-macros dependency
in mogwai/Cargo.toml now requires >= 0.2.1.
web-sys feature: "console" added to the required web-sys features
list. If your downstream Cargo.toml pins web-sys features explicitly,
add "console".
New features
Listener and Callback — a generic JS callback bridge
(mogwai::web::event)
A new low-level event primitive that generalizes the existing EventListener
pattern beyond DOM events. Listener<I, O> and Callback<Params> let you
wrap any JavaScript callback — not just addEventListener-style DOM events
— and await it as a Rust future. The input type I is a tuple matching the JS
callback's arity (0 through 8):
let(callback, listener) = Listener::new(|(v,):(JsValue,)| v.as_f64().unwrap_or(0.0));// Give callback.function() to any JS API that expects a function.
some_js_obj.set_on_event(Some(callback.function()));let value:f64 = listener.next().await;
Multiple calls to listener.next() before the next callback invocation all
resolve simultaneously (fan-out). Each next() call returns a fresh,
independent future. Callback is Clone and must be kept alive for as long
as JS might invoke it.
EventListener is now a thin convenience wrapper around Listener<(JsValue,), web_sys::Event>.
#[derive(ViewProperties)]
(mogwai-macros)
A new derive macro that proxies all ViewProperties trait methods to a field
annotated with #[properties]. Works alongside the existing #[derive(ViewChild)] with #[child]:
#[derive(ViewChild,ViewProperties)]structMyComponent<V:View>{#[child]#[properties]wrapper:V::Element,}// component.set_property("class", "active") now delegates to wrapper.
The #[child] and #[properties] annotations can be on the same field or
separate fields.
ViewProperties::add_class / remove_class
(mogwai::view)
Convenience methods on the ViewProperties trait for adding/removing CSS
classes by string. Idempotent — adding a class that already exists is a no-op,
removing a class that isn't present is a no-op.
mogwai::future::merge_all
(mogwai::future)
Run all futures concurrently and collect their outputs into a Vec<T>.
Companion to the existing race_all (which returns the first to resolve):
let results = merge_all([run(10),run(100),run(200)]).await;assert_eq!(results.len(),3);
Bug fixes
SSR output no longer contains stray whitespace or println! output.
Removed debug println!("appending node...") and println!("setting proxy") / println!("proxy is unchanged") / println!("modifying proxy") from ssr.rs and proxy.rs. Added a test
(ssr::tests::no_whitespace) verifying SSR output has no extraneous
whitespace between elements.
DOM operations no longer panic on error.web_sys::Node::append_child, remove_child, replace_child, and insert_before in web.rs now
silently discard errors (let _ = ...) instead of unwrap_throw(). This
prevents panics when, e.g., a node is moved between documents or the DOM is
in an unexpected state.
SSR style merging: the let ... else pattern is now used for the
style-merge logic in SsrElement::set_style, fixing a clippy lint and making
the control flow clearer.
Improvements
Documentation overhaul for mogwai::web::event: new module-level docs
with architecture diagram, "when to use which" guidance (EventListener vs Listener/Callback), lifecycle warnings for Callback, arity table, and
usage examples.
Doc comment line wrapping across web.rs, view.rs, time.rs, ssr.rs, and macro docs for consistent rendering on docs.rs.
mogwai-macros Cargo.toml: added license, description, documentation, repository, readme, keywords, and categories fields
for crates.io metadata.
Internal
Cookbook build commented out until ported to the new API.
Dependency updates.
New impl_parameters_tuples! proc macro in mogwai-macros that generates Parameters trait impls for tuple arities 2 through 8, used by the new Listener/Callback system.
Migration guide
If you were using EventListener directly, no changes needed — it's the
same API, now built on Listener internally.
If you have custom components that manually implement ViewProperties by
delegating to an inner V::Element, you can replace the manual impl with #[derive(ViewProperties)] and a #[properties] field annotation.
If you pin web-sys features in your downstream crate, add "console" to
the features list.
If you were working around stray println! output in SSR, those are now
gone — remove any whitespace-stripping workarounds.
This discussion was created from the release v0.7.5.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
mogwai 0.7.5
Released 2026-07-15.
Breaking changes
mogwai-macrosbumped from 0.2.0 to 0.2.2. Themogwai-macrosdependencyin
mogwai/Cargo.tomlnow requires>= 0.2.1.web-sysfeature:"console"added to the requiredweb-sysfeatureslist. If your downstream
Cargo.tomlpinsweb-sysfeatures explicitly,add
"console".New features
ListenerandCallback— a generic JS callback bridge(
mogwai::web::event)A new low-level event primitive that generalizes the existing
EventListenerpattern beyond DOM events.
Listener<I, O>andCallback<Params>let youwrap any JavaScript callback — not just
addEventListener-style DOM events— and await it as a Rust future. The input type
Iis a tuple matching the JScallback's arity (0 through 8):
Multiple calls to
listener.next()before the next callback invocation allresolve simultaneously (fan-out). Each
next()call returns a fresh,independent future.
CallbackisCloneand must be kept alive for as longas JS might invoke it.
EventListeneris now a thin convenience wrapper aroundListener<(JsValue,), web_sys::Event>.#[derive(ViewProperties)](
mogwai-macros)A new derive macro that proxies all
ViewPropertiestrait methods to a fieldannotated with
#[properties]. Works alongside the existing#[derive(ViewChild)]with#[child]:The
#[child]and#[properties]annotations can be on the same field orseparate fields.
ViewProperties::add_class/remove_class(
mogwai::view)Convenience methods on the
ViewPropertiestrait for adding/removing CSSclasses by string. Idempotent — adding a class that already exists is a no-op,
removing a class that isn't present is a no-op.
mogwai::future::merge_all(
mogwai::future)Run all futures concurrently and collect their outputs into a
Vec<T>.Companion to the existing
race_all(which returns the first to resolve):Bug fixes
println!output.Removed debug
println!("appending node...")andprintln!("setting proxy")/println!("proxy is unchanged")/println!("modifying proxy")fromssr.rsandproxy.rs. Added a test(
ssr::tests::no_whitespace) verifying SSR output has no extraneouswhitespace between elements.
web_sys::Node::append_child,remove_child,replace_child, andinsert_beforeinweb.rsnowsilently discard errors (
let _ = ...) instead ofunwrap_throw(). Thisprevents panics when, e.g., a node is moved between documents or the DOM is
in an unexpected state.
let ... elsepattern is now used for thestyle-merge logic in
SsrElement::set_style, fixing a clippy lint and makingthe control flow clearer.
Improvements
mogwai::web::event: new module-level docswith architecture diagram, "when to use which" guidance (
EventListenervsListener/Callback), lifecycle warnings forCallback, arity table, andusage examples.
web.rs,view.rs,time.rs,ssr.rs, and macro docs for consistent rendering on docs.rs.mogwai-macrosCargo.toml: addedlicense,description,documentation,repository,readme,keywords, andcategoriesfieldsfor crates.io metadata.
Internal
impl_parameters_tuples!proc macro inmogwai-macrosthat generatesParameterstrait impls for tuple arities 2 through 8, used by the newListener/Callbacksystem.Migration guide
EventListenerdirectly, no changes needed — it's thesame API, now built on
Listenerinternally.ViewPropertiesbydelegating to an inner
V::Element, you can replace the manual impl with#[derive(ViewProperties)]and a#[properties]field annotation.web-sysfeatures in your downstream crate, add"console"tothe features list.
println!output in SSR, those are nowgone — remove any whitespace-stripping workarounds.
This discussion was created from the release v0.7.5.
All reactions