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
use *;
use cratePREVIEW_JS;
/// The preview server's port, injected into the Dioxus context by
/// [`PreviewServer::register_with`](crate::PreviewServer::register_with).
///
/// Crate-private because `register_with` is the only intended entry point:
/// users should not have to know the context type name.
pub u16);
/// A `<canvas>` bound to the preview server for `id`.
///
/// Reads the preview port from context (see
/// [`PreviewServer::register_with`](crate::PreviewServer::register_with)),
/// emits the `data-stream-id` and `data-preview-url` attributes that
/// [`PREVIEW_JS`](crate::PREVIEW_JS) scans for, and applies the
/// `chimeras-preview-canvas` class so that user CSS can target it.
///
/// Wrap it in your own sized container, the JS renderer resizes to the
/// parent's bounding rect.
///
/// # Panics
///
/// Panics at render time if called outside an app that has been wired up with
/// [`PreviewServer::register_with`](crate::PreviewServer::register_with).
/// Injects the WebGL2 preview renderer script once into the page.
///
/// Render this exactly once, typically as the last child of your root
/// component. Every [`StreamPreview`] in the DOM is discovered and driven by
/// this script; without it the preview canvases stay blank.
///
/// Equivalent to:
///
/// ```ignore
/// rsx! { script { dangerous_inner_html: "{PREVIEW_JS}" } }
/// ```