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
//! Designer support: what an IDE needs to preview the XAML documents of an
//! application.
//!
//! - [`DesignWindowLoader`] loads the text of a document into the window
//! that is previewed: a window as it is, a control as the content of a
//! window, a style, a resource dictionary or a data template inside the
//! control the document names with `Design.PreviewWith`.
//! - [`remote::RemoteDesignerEntryPoint`] is the previewer: it connects to
//! the IDE over the remote protocol, receives the text of the document
//! whenever it changes, and sends back frames of the previewed window
//! and the errors of the document. With the `html` method
//! ([`remote::html_transport::HtmlWebSocketTransport`]) the frames go to
//! a web page the previewer serves, which sends back the mouse input.
//!
//! An application of the port is linked into its binary, so there is no
//! separate host process that loads the application: the binary of the
//! application is the host of its own previewer. It registers the run-time
//! XAML loader and calls [`remote::RemoteDesignerEntryPoint::main`] with
//! the arguments the IDE gave it and the function that builds its
//! application builder:
//!
//! ```ignore
//! fn main() {
//! let args: Vec<String> = std::env::args().skip(1).collect();
//! if args.iter().any(|arg| arg == "--transport") {
//! FerroRuntimeXamlLoader::register();
//! RemoteDesignerEntryPoint::main(&args, build_app);
//! }
//! // ... otherwise start the application as usual.
//! }
//! ```
pub use DesignWindowLoader;