ferroui_designer_support/lib.rs
1//! Designer support: what an IDE needs to preview the XAML documents of an
2//! application.
3//!
4//! - [`DesignWindowLoader`] loads the text of a document into the window
5//! that is previewed: a window as it is, a control as the content of a
6//! window, a style, a resource dictionary or a data template inside the
7//! control the document names with `Design.PreviewWith`.
8//! - [`remote::RemoteDesignerEntryPoint`] is the previewer: it connects to
9//! the IDE over the remote protocol, receives the text of the document
10//! whenever it changes, and sends back frames of the previewed window
11//! and the errors of the document. With the `html` method
12//! ([`remote::html_transport::HtmlWebSocketTransport`]) the frames go to
13//! a web page the previewer serves, which sends back the mouse input.
14//!
15//! An application of the port is linked into its binary, so there is no
16//! separate host process that loads the application: the binary of the
17//! application is the host of its own previewer. It registers the run-time
18//! XAML loader and calls [`remote::RemoteDesignerEntryPoint::main`] with
19//! the arguments the IDE gave it and the function that builds its
20//! application builder:
21//!
22//! ```ignore
23//! fn main() {
24//! let args: Vec<String> = std::env::args().skip(1).collect();
25//! if args.iter().any(|arg| arg == "--transport") {
26//! FerroRuntimeXamlLoader::register();
27//! RemoteDesignerEntryPoint::main(&args, build_app);
28//! }
29//! // ... otherwise start the application as usual.
30//! }
31//! ```
32
33mod design_window_loader;
34
35pub mod remote;
36
37pub use design_window_loader::DesignWindowLoader;