Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ version = "0.7.0-alpha.1"
# dependencies that are shared across packages
[workspace.dependencies]
dioxus = { path = "packages/dioxus", version = "0.7.0-alpha.1" }
dioxus-lib = { path = "packages/dioxus-lib", version = "0.7.0-alpha.1" }
dioxus-lib = { path = "packages/dioxus-lib", version = "0.7.0-alpha.1", default-features = false }
dioxus-core = { path = "packages/core", version = "0.7.0-alpha.1" }
dioxus-core-types = { path = "packages/core-types", version = "0.7.0-alpha.1" }
dioxus-core-macro = { path = "packages/core-macro", version = "0.7.0-alpha.1" }
Expand Down
5 changes: 3 additions & 2 deletions packages/router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ homepage = "https://dioxuslabs.com"
keywords = ["dom", "ui", "gui", "react", "wasm"]

[dependencies]
dioxus-lib = { workspace = true }
dioxus-lib = { workspace = true, default-features = false, features = ["signals", "macro", "hooks"] }
dioxus-history = { workspace = true }
dioxus-router-macro = { workspace = true }
dioxus-fullstack-hooks = { workspace = true, optional = true }
Expand All @@ -21,9 +21,10 @@ dioxus-cli-config = { workspace = true }
rustversion = { workspace = true }

[features]
default = []
default = ["html"]
streaming = ["dep:dioxus-fullstack-hooks"]
wasm-split = []
html = ["dioxus-lib/html"]

[dev-dependencies]
axum = { workspace = true, features = ["ws"] }
Expand Down
11 changes: 9 additions & 2 deletions packages/router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ pub mod routable;

/// Components interacting with the router.
pub mod components {
#[cfg(feature = "html")]
mod default_errors;
#[cfg(feature = "html")]
pub use default_errors::*;

#[cfg(feature = "html")]
mod history_buttons;
#[cfg(feature = "html")]
pub use history_buttons::*;

#[cfg(feature = "html")]
mod link;
#[cfg(feature = "html")]
pub use link::*;

mod outlet;
Expand Down Expand Up @@ -60,10 +66,11 @@ pub use hooks::router;

/// A collection of useful items most applications might need.
pub mod prelude {
#[cfg(feature = "html")]
pub use crate::components::{
GoBackButton, GoForwardButton, HistoryButtonProps, Link, LinkProps, Outlet, Router,
RouterProps,
GoBackButton, GoForwardButton, HistoryButtonProps, Link, LinkProps,
};
pub use crate::components::{Outlet, Router, RouterProps};
pub use crate::contexts::*;
pub use crate::hooks::*;
pub use crate::navigation::*;
Expand Down
20 changes: 17 additions & 3 deletions packages/router/src/router_cfg.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{components::FailureExternalNavigation, prelude::*};
use crate::prelude::*;
use dioxus_lib::prelude::*;
use std::sync::Arc;

Expand Down Expand Up @@ -31,10 +31,21 @@ pub struct RouterConfig<R> {
pub(crate) on_update: Option<RoutingCallback<R>>,
}

#[cfg(not(feature = "html"))]
impl<R> Default for RouterConfig<R> {
fn default() -> Self {
Self {
failure_external_navigation: FailureExternalNavigation,
failure_external_navigation: || VNode::empty(),
on_update: None,
}
}
}

#[cfg(feature = "html")]
impl<R> Default for RouterConfig<R> {
fn default() -> Self {
Self {
failure_external_navigation: crate::components::FailureExternalNavigation,
on_update: None,
}
}
Expand Down Expand Up @@ -69,7 +80,10 @@ where

/// A component to render when an external navigation fails.
///
/// Defaults to a router-internal component called [`FailureExternalNavigation`]
#[cfg_attr(
feature = "html",
doc = "Defaults to [`crate::components::FailureExternalNavigation`]."
)]
pub fn failure_external_navigation(self, component: fn() -> Element) -> Self {
Self {
failure_external_navigation: component,
Expand Down
Loading