@@ -11,32 +11,32 @@ use web_sys::{Element, Node};
1111/// The bundle implementation to [VNode].
1212pub enum BNode {
1313 /// A bind between `VTag` and `Element`.
14- BTag ( Box < BTag > ) ,
14+ Tag ( Box < BTag > ) ,
1515 /// A bind between `VText` and `TextNode`.
16- BText ( BText ) ,
16+ Text ( BText ) ,
1717 /// A bind between `VComp` and `Element`.
18- BComp ( BComp ) ,
18+ Comp ( BComp ) ,
1919 /// A holder for a list of other nodes.
20- BList ( BList ) ,
20+ List ( BList ) ,
2121 /// A portal to another part of the document
22- BPortal ( BPortal ) ,
22+ Portal ( BPortal ) ,
2323 /// A holder for any `Node` (necessary for replacing node).
24- BRef ( Node ) ,
24+ Ref ( Node ) ,
2525 /// A suspendible document fragment.
26- BSuspense ( Box < BSuspense > ) ,
26+ Suspense ( Box < BSuspense > ) ,
2727}
2828
2929impl BNode {
3030 /// Get the key of the underlying node
3131 pub ( super ) fn key ( & self ) -> Option < & Key > {
3232 match self {
33- Self :: BComp ( bsusp) => bsusp. key ( ) ,
34- Self :: BList ( blist) => blist. key ( ) ,
35- Self :: BRef ( _) => None ,
36- Self :: BTag ( btag) => btag. key ( ) ,
37- Self :: BText ( _) => None ,
38- Self :: BPortal ( bportal) => bportal. key ( ) ,
39- Self :: BSuspense ( bsusp) => bsusp. key ( ) ,
33+ Self :: Comp ( bsusp) => bsusp. key ( ) ,
34+ Self :: List ( blist) => blist. key ( ) ,
35+ Self :: Ref ( _) => None ,
36+ Self :: Tag ( btag) => btag. key ( ) ,
37+ Self :: Text ( _) => None ,
38+ Self :: Portal ( bportal) => bportal. key ( ) ,
39+ Self :: Suspense ( bsusp) => bsusp. key ( ) ,
4040 }
4141 }
4242}
@@ -45,34 +45,34 @@ impl DomBundle for BNode {
4545 /// Remove VNode from parent.
4646 fn detach ( self , parent : & Element , parent_to_detach : bool ) {
4747 match self {
48- Self :: BTag ( vtag) => vtag. detach ( parent, parent_to_detach) ,
49- Self :: BText ( btext) => btext. detach ( parent, parent_to_detach) ,
50- Self :: BComp ( bsusp) => bsusp. detach ( parent, parent_to_detach) ,
51- Self :: BList ( blist) => blist. detach ( parent, parent_to_detach) ,
52- Self :: BRef ( ref node) => {
48+ Self :: Tag ( vtag) => vtag. detach ( parent, parent_to_detach) ,
49+ Self :: Text ( btext) => btext. detach ( parent, parent_to_detach) ,
50+ Self :: Comp ( bsusp) => bsusp. detach ( parent, parent_to_detach) ,
51+ Self :: List ( blist) => blist. detach ( parent, parent_to_detach) ,
52+ Self :: Ref ( ref node) => {
5353 // Always remove user-defined nodes to clear possible parent references of them
5454 if parent. remove_child ( node) . is_err ( ) {
5555 console:: warn!( "Node not found to remove VRef" ) ;
5656 }
5757 }
58- Self :: BPortal ( bportal) => bportal. detach ( parent, parent_to_detach) ,
59- Self :: BSuspense ( bsusp) => bsusp. detach ( parent, parent_to_detach) ,
58+ Self :: Portal ( bportal) => bportal. detach ( parent, parent_to_detach) ,
59+ Self :: Suspense ( bsusp) => bsusp. detach ( parent, parent_to_detach) ,
6060 }
6161 }
6262
6363 fn shift ( & self , next_parent : & Element , next_sibling : NodeRef ) {
6464 match self {
65- Self :: BTag ( ref vtag) => vtag. shift ( next_parent, next_sibling) ,
66- Self :: BText ( ref btext) => btext. shift ( next_parent, next_sibling) ,
67- Self :: BComp ( ref bsusp) => bsusp. shift ( next_parent, next_sibling) ,
68- Self :: BList ( ref vlist) => vlist. shift ( next_parent, next_sibling) ,
69- Self :: BRef ( ref node) => {
65+ Self :: Tag ( ref vtag) => vtag. shift ( next_parent, next_sibling) ,
66+ Self :: Text ( ref btext) => btext. shift ( next_parent, next_sibling) ,
67+ Self :: Comp ( ref bsusp) => bsusp. shift ( next_parent, next_sibling) ,
68+ Self :: List ( ref vlist) => vlist. shift ( next_parent, next_sibling) ,
69+ Self :: Ref ( ref node) => {
7070 next_parent
7171 . insert_before ( node, next_sibling. get ( ) . as_ref ( ) )
7272 . unwrap ( ) ;
7373 }
74- Self :: BPortal ( ref vportal) => vportal. shift ( next_parent, next_sibling) ,
75- Self :: BSuspense ( ref vsuspense) => vsuspense. shift ( next_parent, next_sibling) ,
74+ Self :: Portal ( ref vportal) => vportal. shift ( next_parent, next_sibling) ,
75+ Self :: Suspense ( ref vsuspense) => vsuspense. shift ( next_parent, next_sibling) ,
7676 }
7777 }
7878}
@@ -105,7 +105,7 @@ impl Reconcilable for VNode {
105105 }
106106 VNode :: VRef ( node) => {
107107 super :: insert_node ( & node, parent, next_sibling. get ( ) . as_ref ( ) ) ;
108- ( NodeRef :: new ( node. clone ( ) ) , BNode :: BRef ( node) )
108+ ( NodeRef :: new ( node. clone ( ) ) , BNode :: Ref ( node) )
109109 }
110110 VNode :: VPortal ( vportal) => {
111111 let ( node_ref, portal) = vportal. attach ( parent_scope, parent, next_sibling) ;
@@ -142,7 +142,7 @@ impl Reconcilable for VNode {
142142 VNode :: VList ( vlist) => vlist. reconcile_node ( parent_scope, parent, next_sibling, bundle) ,
143143 VNode :: VRef ( node) => {
144144 let _existing = match bundle {
145- BNode :: BRef ( ref n) if & node == n => n,
145+ BNode :: Ref ( ref n) if & node == n => n,
146146 _ => {
147147 return VNode :: VRef ( node) . replace (
148148 parent_scope,
@@ -167,55 +167,55 @@ impl Reconcilable for VNode {
167167impl From < BText > for BNode {
168168 #[ inline]
169169 fn from ( btext : BText ) -> Self {
170- Self :: BText ( btext)
170+ Self :: Text ( btext)
171171 }
172172}
173173
174174impl From < BList > for BNode {
175175 #[ inline]
176176 fn from ( blist : BList ) -> Self {
177- Self :: BList ( blist)
177+ Self :: List ( blist)
178178 }
179179}
180180
181181impl From < BTag > for BNode {
182182 #[ inline]
183183 fn from ( btag : BTag ) -> Self {
184- Self :: BTag ( Box :: new ( btag) )
184+ Self :: Tag ( Box :: new ( btag) )
185185 }
186186}
187187
188188impl From < BComp > for BNode {
189189 #[ inline]
190190 fn from ( bcomp : BComp ) -> Self {
191- Self :: BComp ( bcomp)
191+ Self :: Comp ( bcomp)
192192 }
193193}
194194
195195impl From < BPortal > for BNode {
196196 #[ inline]
197197 fn from ( bportal : BPortal ) -> Self {
198- Self :: BPortal ( bportal)
198+ Self :: Portal ( bportal)
199199 }
200200}
201201
202202impl From < BSuspense > for BNode {
203203 #[ inline]
204204 fn from ( bsusp : BSuspense ) -> Self {
205- Self :: BSuspense ( Box :: new ( bsusp) )
205+ Self :: Suspense ( Box :: new ( bsusp) )
206206 }
207207}
208208
209209impl fmt:: Debug for BNode {
210210 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
211211 match * self {
212- Self :: BTag ( ref vtag) => vtag. fmt ( f) ,
213- Self :: BText ( ref btext) => btext. fmt ( f) ,
214- Self :: BComp ( ref bsusp) => bsusp. fmt ( f) ,
215- Self :: BList ( ref vlist) => vlist. fmt ( f) ,
216- Self :: BRef ( ref vref) => write ! ( f, "VRef ( \" {}\" )" , crate :: utils:: print_node( vref) ) ,
217- Self :: BPortal ( ref vportal) => vportal. fmt ( f) ,
218- Self :: BSuspense ( ref bsusp) => bsusp. fmt ( f) ,
212+ Self :: Tag ( ref vtag) => vtag. fmt ( f) ,
213+ Self :: Text ( ref btext) => btext. fmt ( f) ,
214+ Self :: Comp ( ref bsusp) => bsusp. fmt ( f) ,
215+ Self :: List ( ref vlist) => vlist. fmt ( f) ,
216+ Self :: Ref ( ref vref) => write ! ( f, "VRef ( \" {}\" )" , crate :: utils:: print_node( vref) ) ,
217+ Self :: Portal ( ref vportal) => vportal. fmt ( f) ,
218+ Self :: Suspense ( ref bsusp) => bsusp. fmt ( f) ,
219219 }
220220 }
221221}
0 commit comments