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:
1 parent
2b219c826c
commit
519ec9d294
91 files changed
+1113
-1044
No files matched your search
@@ -4,9 +4,8 @@
|
||||
|
||||
use std::cell::RefCell;
|
||||
|
||||
use dioxus_lib::{html::document::*, prelude::*};
|
||||
use dioxus_lib::{document::*, prelude::*};
|
||||
use dioxus_ssr::Renderer;
|
||||
use generational_box::GenerationalBox;
|
||||
use once_cell::sync::Lazy;
|
||||
use parking_lot::RwLock;
|
||||
|
||||
@@ -71,8 +70,8 @@ impl ServerDocument {
|
||||
}
|
||||
|
||||
impl Document for ServerDocument {
|
||||
fn new_evaluator(&self, js: String) -> GenerationalBox<Box<dyn Evaluator>> {
|
||||
NoOpDocument.new_evaluator(js)
|
||||
fn eval(&self, js: String) -> Eval {
|
||||
NoOpDocument.eval(js)
|
||||
}
|
||||
|
||||
fn set_title(&self, title: String) {
|
||||
@@ -151,7 +150,7 @@ impl Document for ServerDocument {
|
||||
}
|
||||
}
|
||||
|
||||
fn create_link(&self, props: head::LinkProps) {
|
||||
fn create_link(&self, props: LinkProps) {
|
||||
self.warn_if_streaming();
|
||||
self.serialize_for_hydration();
|
||||
self.0.borrow_mut().link.push(rsx! {
|
||||
@@ -173,8 +172,4 @@ impl Document for ServerDocument {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn std::any::Any {
|
||||
self
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user