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
@@ -13,6 +13,7 @@ rust-version = "1.79.0"
[dependencies]
dioxus-core = { workspace = true }
dioxus-html = { workspace = true, default-features = false, optional = true }
dioxus-document = { workspace = true, optional = true }
dioxus-core-macro = { workspace = true, optional = true }
dioxus-config-macro = { workspace = true, optional = true }
dioxus-hooks = { workspace = true, optional = true }
@@ -44,7 +45,7 @@ devtools = ["dep:dioxus-devtools", "dioxus-web?/devtools", "dioxus-fullstack?/de
mounted = ["dioxus-web?/mounted", "dioxus-html?/mounted"]
file_engine = ["dioxus-web?/file_engine"]
asset = ["dep:manganis", "dioxus-core/manganis"]
document = ["dioxus-web?/document", "dioxus-html?/document"]
document = ["dioxus-web?/document", "dioxus-document"]
launch = ["dep:dioxus-config-macro"]
router = ["dep:dioxus-router"]
+1 -1
View File
@@ -330,7 +330,7 @@ fn web_launch(
#[cfg(all(feature = "static-generation", not(feature = "fullstack")))]
use dioxus_static_site_generation::document;
let document = std::rc::Rc::new(document::web::FullstackWebDocument)
as std::rc::Rc<dyn crate::prelude::Document>;
as std::rc::Rc<dyn crate::prelude::document::Document>;
vdom.provide_root_context(document);
}
vdom
+11
View File
@@ -50,6 +50,10 @@ pub mod events {
pub use dioxus_html::prelude::*;
}
#[cfg(feature = "document")]
#[cfg_attr(docsrs, doc(cfg(feature = "document")))]
pub use dioxus_document as document;
#[cfg(feature = "html")]
#[cfg_attr(docsrs, doc(cfg(feature = "html")))]
pub use dioxus_html as html;
@@ -59,6 +63,13 @@ pub use dioxus_html as html;
pub use dioxus_core_macro as core_macro;
pub mod prelude {
#[cfg(feature = "document")]
#[cfg_attr(docsrs, doc(cfg(feature = "document")))]
pub use dioxus_document as document;
#[cfg(feature = "launch")]
#[cfg_attr(docsrs, doc(cfg(feature = "launch")))]
pub use crate::launch::*;
#[cfg(feature = "hooks")]
#[cfg_attr(docsrs, doc(cfg(feature = "hooks")))]