Feat: move the rsx macro around
This commit is contained in:
1 parent
1919f88f03
commit
50c8b93aad
23 files changed
+886
-617
No files matched your search
@@ -8,7 +8,13 @@ use crate::{
|
||||
innerlude::{Context, Properties, Scope, ScopeIdx, FC},
|
||||
};
|
||||
use bumpalo::Bump;
|
||||
use std::{any::Any, cell::RefCell, fmt::Debug, marker::PhantomData, rc::Rc};
|
||||
use std::{
|
||||
any::Any,
|
||||
cell::RefCell,
|
||||
fmt::{Arguments, Debug},
|
||||
marker::PhantomData,
|
||||
rc::Rc,
|
||||
};
|
||||
|
||||
/// Tools for the base unit of the virtual dom - the VNode
|
||||
/// VNodes are intended to be quickly-allocated, lightweight enum values.
|
||||
@@ -22,6 +28,8 @@ pub enum VNode<'src> {
|
||||
/// A text node (node type `TEXT_NODE`).
|
||||
Text(VText<'src>),
|
||||
|
||||
Fragment(&'src VFragment<'src>),
|
||||
|
||||
/// A "suspended component"
|
||||
/// This is a masqeurade over an underlying future that needs to complete
|
||||
/// When the future is completed, the VNode will then trigger a render
|
||||
@@ -37,6 +45,7 @@ impl<'a> Clone for VNode<'a> {
|
||||
match self {
|
||||
VNode::Element(el) => VNode::Element(el),
|
||||
VNode::Text(origi) => VNode::Text(VText { text: origi.text }),
|
||||
VNode::Fragment(frag) => VNode::Fragment(frag),
|
||||
VNode::Suspended => VNode::Suspended,
|
||||
VNode::Component(c) => VNode::Component(c),
|
||||
}
|
||||
@@ -77,6 +86,10 @@ impl<'a> VNode<'a> {
|
||||
VNode::Text(VText { text })
|
||||
}
|
||||
|
||||
pub fn text_args(b: &'a Bump, f: Arguments) -> VNode<'a> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn key(&self) -> NodeKey {
|
||||
match &self {
|
||||
@@ -85,9 +98,7 @@ impl<'a> VNode<'a> {
|
||||
VNode::Suspended => {
|
||||
todo!()
|
||||
}
|
||||
// Self::PhantomChild { id } => {
|
||||
// todo!()
|
||||
// }
|
||||
VNode::Fragment(frag) => frag.key,
|
||||
VNode::Component(c) => c.key,
|
||||
}
|
||||
}
|
||||
@@ -315,3 +326,8 @@ impl<'a> VComponent<'a> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct VFragment<'src> {
|
||||
pub key: NodeKey<'src>,
|
||||
pub children: &'src [VNode<'src>],
|
||||
}
|
||||
Reference in new issue
Block a user