Adopt component macro 0.5.0: required props, Into setters, composed apply - #28
Draft
JedimEmO wants to merge 1 commit into
Draft
Adopt component macro 0.5.0: required props, Into setters, composed apply#28JedimEmO wants to merge 1 commit into
JedimEmO wants to merge 1 commit into
Conversation
…pply
Bumps futures-signals-component-macro to 0.5.0 (via a temporary
[patch.crates-io] path override until it is published) and adopts its
new opt-in features across dwui and the webpage:
- card.content, heading.content, and virtual_scroll.render_item are now
#[required], so omitting them is a compile error instead of a silent
empty render; render fns drop the Option handling and render_item
loses its fake |_| html!("div") default.
- #[into] on all Option<Dom>, String, and optional-scalar props across
26 components. Call sites shed 50 .content(Some(...)) wrappers and 86
literal .to_string() calls, and the four .content(x.into()) args that
would have become ambiguous now pass the Dom directly.
- The two card! call sites that injected children through .apply()
instead of setting content (caught by the new compile-time
enforcement) now pass real content nodes.
- The composed apply fixes the components-page spotlight: the second
.apply() call no longer discards fx::spotlight, so section cards
light up under the cursor again (verified in headless Chrome: all 24
cards carry the --sx/--sy vars, layout unchanged, no console errors).
The [patch.crates-io] override must be dropped once 0.5.0 is on
crates.io.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adopts futures-signals-component-macro 0.5.0 across dwui and the webpage. Depends on that PR — see the merge checklist below.
Required props, enforced at compile time
card.content,heading.content, andvirtual_scroll.render_itemare now#[required]. Omitting them was previously a silent empty render (or a placeholderdivfor the virtual scroller); it is now a targeted compile error:The enforcement immediately caught two real bugs:
card!call sites incomponents_page.rsandexample_small.rsthat injected children through.apply()and never set content — both now pass real content nodes.#[into]ergonomicsAll
Option<Dom>,String, and optional-scalar props across 26 components takeimpl Into<T>now. Call-site cleanup: 50.content(Some(...))→.content(...), 86 literal.to_string()args dropped, and the four.content(html!(...).into())sites that would have become ambiguous pass theDomdirectly.Spotlight bug fixed by composed
applysection_cardcalls.apply(crate::fx::spotlight)followed by a second.apply(...); under 0.4 the second call silently discarded the first, so the gallery spotlight effect was dead code. With composing apply it works again — verified in headless Chrome: all 24 section cards carry the--sx/--syspotlight vars on hover, layout is unchanged, zero console errors, and the restructured modal example opens with its focus trap intact.Render-fn
applyhandling is untouched (the prop keeps itsOption<Box<dyn FnOnce>>type) — dwui compiled with zero source edits against the new macro before any of this adoption, which was verified explicitly.Test plan
cargo check --workspace --all-targets,cargo test(native)wasm-pack test --headless --firefox crates/dwui— 51 component + 19 styling browser tests greencargo clippy— zero new warnings vs baseline;cargo fmt --checkat exact parity with pre-existing statetrunk build+ headless-Chrome visual verification of the components page (spotlight vars, layout, modal open/close)cargo doc -p dwui— generated macro doc tables now mark[required]andimpl Into<T>settersMerge checklist
v0.5.0, publish to crates.io[patch.crates-io]path override from the rootCargo.toml(CI cannot resolve the local path; this PR stays draft until then)🤖 Generated with Claude Code