Seregon/StratoSDK

StratoSDK is a framework with a declarative approach similar to Flutter/React, written and designed entirely for Rust.

Rust/27.3 KB/No license
docs/INSPECTOR.md
StratoSDK / docs / INSPECTOR.md
1# StratoSDK Inspector Overlay
2 
3The inspector provides an in-app panel that visualizes the widget hierarchy, recent state snapshots, layout boxes, and frame timelines so you can debug rendering behavior without leaving the running app.
4 
5## Toggling the overlay
6- Press **Ctrl+Shift+I** (configurable when constructing `InspectorOverlay`) to toggle the panel at runtime.
7- You can also enable/disable programmatically with `strato_core::inspector::inspector().set_enabled(bool)`.
8 
9## Development vs. production defaults
10- In **debug/development builds** (`cfg!(debug_assertions)`), the inspector is enabled by default. Instrumentation hooks capture layout and state changes automatically.
11- In **release/production builds**, disable the inspector to remove overhead:
12 - Call `inspector().configure(InspectorConfig { enabled: false, ..Default::default() })` during startup, or
13 - Wrap your root widget in `InspectorOverlay` only for debug builds (`#[cfg(debug_assertions)]`).
14 
15## Adding the overlay to your UI
16```rust
17use strato_widgets::InspectorOverlay;
18 
19let app = build_app_ui();
20let instrumented = InspectorOverlay::new(app);
21```
22 
23The overlay renders a compact panel with:
24- **Component hierarchy**: per-widget IDs and depth.
25- **State snapshots**: the latest serialized signal updates.
26- **Layout boxes**: highlighted rectangles overlaying the current frame.
27- **Performance timeline**: per-frame CPU/GPU timings from the renderer profiler.
28 
29No additional plumbing is required—the overlay pulls data from the shared inspector instrumentation in `strato-core` and `strato-renderer`.
30