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
72
73
74
75
76
use web_sys::Node;
use crate::stores::{StoreConsEnd, StoresList};
use super::{
component::ComponentConstruction,
hole::{NoHoleNode, YesHoleNode},
};
impl<EntireStores> ComponentConstruction<StoreConsEnd, EntireStores, NoHoleNode, NoHoleNode>
where
EntireStores: StoresList,
{
/** Mark this component as a base container component.
This is for creating your own base component.
If you stick with the ones provided by the `consecuit_html` crate, you won't need this.
Look at `consecuit_html`'s source code for example on how to create base components.
Note that when creating base components,
you are stepping outside the "functional" model, and some rules apply:
* Nodes should be created on initial render.
* You can create nodes in later renders, but they must be descendant of the nodes created on initial render.
* The node you pass to `bare_container_node` should be the same node in all render.
*/
pub fn bare_container_node(
self,
node: Node,
) -> ComponentConstruction<StoreConsEnd, EntireStores, NoHoleNode, YesHoleNode> {
let ComponentConstruction {
hook_stores,
parent_node,
..
} = self;
ComponentConstruction {
hook_stores,
parent_node,
last_node: NoHoleNode,
ret_node: YesHoleNode(node),
}
}
/** Mark this component as a base leaf (childless) component.
This is for creating your own base component.
If you stick with the ones provided by the `consecuit_html` crate, you won't need this.
Look at `consecuit_html`'s source code for example on how to create base components.
Note that when creating base components,
you are stepping outside the "functional" model, and some rules apply:
* Nodes should be created on initial render.
* You can create nodes in later renders, but they must be descendant of the nodes created on initial render.
*/
pub fn bare_leaf_node(
self,
) -> ComponentConstruction<StoreConsEnd, EntireStores, NoHoleNode, NoHoleNode> {
let ComponentConstruction {
hook_stores,
parent_node,
..
} = self;
ComponentConstruction {
hook_stores,
parent_node,
last_node: NoHoleNode,
ret_node: NoHoleNode,
}
}
}