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
//! Page components: a component whose view renders the whole document.
//!
//! An embedded component is mounted from a page template with `{{ livewire(..) }}`. A page
//! component has no page template: its own `.livewire` view extends the application layout, and the
//! route answers with the component's rendered markup.
//!
//! ```text
//! {# resources/views/livewire/post-browser.livewire #}
//! {% extends "layouts.app" %}
//! {% block content %}<h1>Posts</h1>{% endblock %}
//! ```
//!
//! The route then mounts it exactly as a page would:
//!
//! ```no_run
//! # use std::sync::Arc;
//! # use livewire::ComponentRegistry;
//! # use livewire::component::Params;
//! # fn run(registry: Arc<ComponentRegistry>) -> livewire::Result<()> {
//! let html = livewire::page::render_page(®istry, "post-browser", Params::default())?;
//! # let _ = html;
//! # Ok(())
//! # }
//! ```
//!
//! # What a component gains, and does not
//!
//! The mount lifecycle, props, and the update endpoint are the same as an embedded component's; only
//! the surrounding document comes from the component. Route parameters and persistent middleware
//! belong to the application's routing layer, which passes them as props.
use Arc;
use Map;
use crateParams;
use crateLivewireError;
use crateComponentRegistry;
/// Mounts `name` as a page and returns the markup the route answers with.
///
/// # Errors
///
/// Fails when the component is not registered, when its mount fails, or when its view renders no
/// single root element — the same failures an embedded mount reports.