Răsfoiți Sursa

wip: move more stuff out

Jonathan Kelley 3 ani în urmă
părinte
comite
464b457

+ 0 - 6
packages/core/src/lib.rs

@@ -16,7 +16,6 @@ pub(crate) mod component;
 pub(crate) mod diff;
 pub(crate) mod diff_stack;
 pub(crate) mod hooklist;
-pub(crate) mod hooks;
 pub(crate) mod lazynodes;
 pub(crate) mod mutations;
 pub(crate) mod nodes;
@@ -26,15 +25,11 @@ pub(crate) mod test_dom;
 pub(crate) mod util;
 pub(crate) mod virtual_dom;
 
-#[cfg(feature = "debug_vdom")]
-pub mod debug_dom;
-
 pub(crate) mod innerlude {
     pub use crate::component::*;
     pub(crate) use crate::diff::*;
     pub use crate::diff_stack::*;
     pub(crate) use crate::hooklist::*;
-    pub use crate::hooks::*;
     pub use crate::lazynodes::*;
     pub use crate::mutations::*;
     pub use crate::nodes::*;
@@ -56,7 +51,6 @@ pub use crate::innerlude::{
 
 pub mod prelude {
     pub use crate::component::{fc_to_builder, Fragment, Properties, Scope};
-    pub use crate::hooks::*;
     pub use crate::innerlude::Context;
     pub use crate::innerlude::{DioxusElement, Element, LazyNodes, NodeFactory, ScopeChildren, FC};
     pub use crate::nodes::VNode;

+ 0 - 0
packages/core/src/debug_dom.rs → packages/core/src/old/debug_dom.rs


+ 0 - 0
packages/core/src/hooks.rs → packages/core/src/old/hooks.rs


+ 3 - 16
packages/core/src/virtual_dom.rs

@@ -69,8 +69,6 @@ use std::{
 pub struct VirtualDom {
     base_scope: ScopeId,
 
-    root_fc: Box<dyn Any>,
-
     root_props: Rc<dyn Any>,
 
     // we need to keep the allocation around, but we don't necessarily use it
@@ -85,8 +83,6 @@ pub struct VirtualDom {
     pending_futures: FxHashSet<ScopeId>,
     pending_messages: VecDeque<SchedulerMsg>,
     dirty_scopes: IndexSet<ScopeId>,
-
-    in_progress: bool,
 }
 
 // Methods to create the VirtualDom
@@ -179,21 +175,15 @@ impl VirtualDom {
             receiver,
             sender,
 
-            root_fc: todo!(),
             root_props: todo!(),
             _root_caller: todo!(),
 
             pending_messages: VecDeque::new(),
             pending_futures: Default::default(),
             dirty_scopes: Default::default(),
-
-            in_progress: false,
         }
     }
-}
 
-// Public utility methods
-impl VirtualDom {
     /// Get the [`ScopeState`] for the root component.
     ///
     /// This is useful for traversing the tree from the root for heuristics or alternsative renderers that use Dioxus
@@ -233,10 +223,7 @@ impl VirtualDom {
     pub fn has_any_work(&self) -> bool {
         !(self.dirty_scopes.is_empty() && self.pending_messages.is_empty())
     }
-}
 
-// Methods to actually run the VirtualDOM
-impl VirtualDom {
     /// Waits for the scheduler to have work
     /// This lets us poll async tasks during idle periods without blocking the main thread.
     pub async fn wait_for_work(&mut self) {
@@ -532,7 +519,7 @@ impl VirtualDom {
         }
     }
 
-    pub fn run_scope(&self, id: &ScopeId) -> bool {
+    fn run_scope(&self, id: &ScopeId) -> bool {
         let scope = self
             .scopes
             .get_scope(id)
@@ -571,11 +558,11 @@ impl VirtualDom {
 
         // Todo: see if we can add stronger guarantees around internal bookkeeping and failed component renders.
         if let Some(key) = render(scope) {
-            todo!("attach the niode");
+            // todo!("attach the niode");
             // let new_head = builder.into_vnode(NodeFactory {
             //     bump: &scope.frames.wip_frame().bump,
             // });
-            log::debug!("Render is successful");
+            // log::debug!("Render is successful");
 
             // the user's component succeeded. We can safely cycle to the next frame
             // scope.frames.wip_frame_mut().head_node = unsafe { std::mem::transmute(new_head) };