1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
//! Dev-mode tooling: file watcher, renderer live-reload, in-tree
//! rebuild overlay.
//!
//! Everything in this module is gated behind the `dev` Cargo feature
//! so production builds carry none of the extra dependencies
//! (`notify`, `cargo_metadata`) or code paths.
//!
//! Enable it in your app's `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! plushie = { version = "0", features = ["dev"] }
//! ```
//!
//! ...and wire the watcher into your `main`:
//!
//! ```ignore
//! fn main() -> plushie::Result {
//! plushie::dev::watch_renderer::<MyApp>()
//! }
//! ```
//!
//! # What's dev-mode?
//!
//! - **Widget-crate watcher**: reads `[package.metadata.plushie]`
//! from the app's cargo metadata, watches each widget crate's
//! `src/` directory and `Cargo.toml`, and rebuilds the custom
//! renderer (via `cargo plushie build`) when sources change.
//! - **Rebuilding overlay**: a slim in-tree status bar injected at
//! the top of every window so the app can see build status
//! without hunting through terminal logs. See [`overlay`].
//!
//! # App-source watching
//!
//! This module does **not** watch the app's own source. The running
//! binary would need to be replaced for those changes to take effect,
//! which the SDK can't do from inside. Use `cargo-watch` outside the
//! process, or the `cargo plushie run --watch` convenience wrapper,
//! for app-src live reload.
pub
pub use ;
pub use ;
use ;
/// Control signal sent from dev-mode components to the wire runner's
/// event loop.
///
/// Currently carries a single variant; the enum shape leaves room
/// for future out-of-band commands (pause, unpause, log-level bump)
/// without reshaping the API.
/// Process-global queue of pending control signals. The wire runner
/// drains this via `drain_control_signals` once per event-loop
/// iteration.
static CONTROL_QUEUE: = new;
/// Publish a control signal.
///
/// Callable from any thread. Delivery latency is bounded by the
/// wire runner's heartbeat interval, or the next inbound renderer
/// message in the common case.
/// Drain the control-signal queue. Exposed for the wire runner; not
/// intended for app code.
/// Process-global dev-overlay handle. Registered once (ideally before
/// `plushie::run` starts) so the runtime's tree walker can read the
/// current overlay snapshot on each frame without passing the handle
/// through every layer. `None` when no handle is registered, which is
/// the production default; the runtime treats the absence as "no
/// overlay" and skips the injection pass entirely.
static GLOBAL_OVERLAY: = new;
/// Register a dev-overlay handle with the runtime.
///
/// Once registered, the handle cannot be swapped out (OnceLock
/// semantics); a second call is a no-op. Typically called by the
/// watcher before handing off to [`crate::run`], but library code
/// that wants to build its own watcher can register a handle here
/// and push status to it directly.
/// Best-effort read of the current overlay snapshot, dismissing
/// expired `Success` states so the auto-dismiss timer fires the
/// next time the tree gets rebuilt.
///
/// `crate::runtime::prepare_tree` calls this once per view cycle;
/// production builds don't compile this path at all.
pub
/// Try to route an event to the dev overlay. Returns `true` when the
/// event was consumed and should not reach `A::update`. Runner code
/// calls this once per incoming event before dispatch.
///
/// Events outside the overlay's namespace pass through (returns
/// `false`). When no overlay handle is registered, every event
/// passes through too.
pub
/// Install a fresh overlay snapshot via the shared runtime helper.
/// Handles the Success -> schedule_dismiss transition so callers
/// can push status without managing the timer themselves.