Move the document trait into a separate crate (#3035)

* add a default head method through eval
* remove the old document trait
* implement document for each platform
* pull out document into a dedicated crate to cut down on shared dependencies
---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
Evan AlmloffandJonathan Kelley authored and GitHub committed 2024-10-14 10:33:37 -07:00
1 parent 2b219c826c
commit 519ec9d294
91 files changed
+1113 -1044

No files matched your search

+2 -1
View File
@@ -22,7 +22,8 @@ tokio-stream = { version = "0.1.11", features = ["net"] }
tokio-util = { version = "0.7.4", features = ["rt"] }
serde = { version = "1.0.151", features = ["derive"] }
serde_json = "1.0.91"
dioxus-html = { workspace = true, features = ["serialize", "document", "mounted"] }
dioxus-html = { workspace = true, features = ["serialize", "mounted"] }
dioxus-document = { workspace = true }
rustc-hash = { workspace = true }
dioxus-core = { workspace = true, features = ["serialize"] }
dioxus-interpreter-js = { workspace = true, features = ["binary-protocol"] }
+3 -7
View File
@@ -1,5 +1,5 @@
use dioxus_core::ScopeId;
use dioxus_html::document::{Document, EvalError, Evaluator};
use dioxus_document::{Document, Eval, EvalError, Evaluator};
use generational_box::{AnyStorage, GenerationalBox, UnsyncStorage};
use std::rc::Rc;
@@ -18,12 +18,8 @@ pub struct LiveviewDocument {
}
impl Document for LiveviewDocument {
fn new_evaluator(&self, js: String) -> GenerationalBox<Box<dyn Evaluator>> {
LiveviewEvaluator::create(self.query.clone(), js)
}
fn as_any(&self) -> &dyn std::any::Any {
self
fn eval(&self, js: String) -> Eval {
Eval::new(LiveviewEvaluator::create(self.query.clone(), js))
}
}