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
{{ message }}
Repository navigation
Identified nodes: drop the positional draw closure; attach handlers with .on_click / .draw on a returned handle #66
Decided by the user: identified nodes lose the positional draw-closure argument. Today it's div_id(key, tw, draw, body), span(key, tw, text, draw), icon(key, tw, icon, draw) and so on, and most call sites pass bullseye::none (47 uses). Examples wrap clicks in a common::on_click adapter. Those nodes are identified for identity (animation, scope, focus), not for handling anything.
Shape
The node is added immediately, as today, so the common case needs no terminating call. The call returns a small handle that can attach behaviour to the node just added:
b.div_id(key,row_style(&t), |b| { … });// common case: nothing to attach
b.span("up", tw,"Up").on_click(move |s| s.shift(key,Up));// click handler
b.div_id(key, tw, |b| { … }).draw(|app, ui| { … });// escape hatch: own Ui at draw time
b.span(k, tw,"x").on_response(|app, response| { … });// hover etc., like the widgets
The handle borrows the builder mutably for the statement and fills the node's draw slot when a method is called. It is not#[must_use]: dropping it means "no handler".
At most one draw closure per node. Calling .draw/.on_click/.on_response twice is a debug panic; or they compose. Decide in the PR and justify the choice.
bullseye::none and examples/common::on_click are removed.
Applies to every identified-node builder: div_id, span, icon, image, leaf and the rest. Check whether leaf's measure argument should become a handle method too, or whether custom(..) already covers it.
Constraints
Behaviour-preserving: every golden is unchanged. Breaking change to the builder API (undeployed; note it in the PR).
Activity
Merge pull request #67 from samitbasu/node-handles