clean up prelude (#4416)

* clear away prelude on dioxus

* clippy

* wip - drop prelude from dioxus-html

* docs clippy

* wip

* more fixe

* delete all preludes

* doc...

* better export

* merge some imports

* fewer global imports

* global incremental renderer

* fix cargo doc
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2025-07-16 16:04:13 -07:00
1 parent 54d465a7b5
commit 4f1d039bad
139 files changed
+350 -453

No files matched your search

+1 -1
View File
@@ -9,7 +9,7 @@ use axum_session::{SessionConfig, SessionLayer, SessionStore};
use axum_session_auth::*; use axum_session_auth::*;
use axum_session_sqlx::SessionSqlitePool; use axum_session_sqlx::SessionSqlitePool;
use core::pin::Pin; use core::pin::Pin;
use dioxus_fullstack::prelude::*; use dioxus::prelude::*;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use sqlx::sqlite::{SqliteConnectOptions, SqlitePool, SqlitePoolOptions}; use sqlx::sqlite::{SqliteConnectOptions, SqlitePool, SqlitePoolOptions};
use std::error::Error; use std::error::Error;
-1
View File
@@ -4,7 +4,6 @@
mod auth; mod auth;
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_fullstack::prelude::*;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
fn main() { fn main() {
+1 -1
View File
@@ -4,7 +4,7 @@ use dioxus::prelude::*;
fn main() { fn main() {
// Set the url of the server where server functions are hosted. // Set the url of the server where server functions are hosted.
#[cfg(not(feature = "server"))] #[cfg(not(feature = "server"))]
dioxus::fullstack::prelude::server_fn::client::set_server_url("http://127.0.0.1:8080"); dioxus::fullstack::set_server_url("http://127.0.0.1:8080");
dioxus::launch(app); dioxus::launch(app);
} }
+1 -1
View File
@@ -9,7 +9,7 @@ use dioxus::prelude::*;
fn main() { fn main() {
dioxus::LaunchBuilder::new() dioxus::LaunchBuilder::new()
.with_cfg(server_only!(ServeConfig::builder().incremental( .with_cfg(server_only!(ServeConfig::builder().incremental(
IncrementalRendererConfig::default() dioxus::fullstack::IncrementalRendererConfig::default()
.invalidate_after(std::time::Duration::from_secs(120)), .invalidate_after(std::time::Duration::from_secs(120)),
))) )))
.launch(app); .launch(app);
+27 -27
View File
@@ -544,7 +544,7 @@ fn extract_inner_type_from_segment(segment: &PathSegment) -> Option<&Type> {
mod struct_info { mod struct_info {
use convert_case::{Case, Casing}; use convert_case::{Case, Casing};
use proc_macro2::TokenStream; use proc_macro2::TokenStream;
use quote::quote; use quote::{quote, ToTokens};
use syn::parse::Error; use syn::parse::Error;
use syn::punctuated::Punctuated; use syn::punctuated::Punctuated;
use syn::spanned::Spanned; use syn::spanned::Spanned;
@@ -884,7 +884,7 @@ Finally, call `.build()` to create the instance of `{name}`.
_phantom: (#( #phantom_generics ),*), _phantom: (#( #phantom_generics ),*),
} }
impl #impl_generics dioxus_core::prelude::Properties for #name #ty_generics impl #impl_generics dioxus_core::Properties for #name #ty_generics
#b_generics_where #b_generics_where
{ {
type Builder = #builder_name #generics_with_empty; type Builder = #builder_name #generics_with_empty;
@@ -1024,22 +1024,19 @@ Finally, call `.build()` to create the instance of `{name}`.
Ok(quote! { Ok(quote! {
#[allow(dead_code, non_camel_case_types, missing_docs)] #[allow(dead_code, non_camel_case_types, missing_docs)]
impl #impl_generics dioxus_core::prelude::HasAttributes for #builder_name < #( #ty_generics ),* > #where_clause { impl #impl_generics dioxus_core::HasAttributes for #builder_name < #( #ty_generics ),* > #where_clause {
fn push_attribute<L>( fn push_attribute<L>(
mut self, mut self,
____name: &'static str, ____name: &'static str,
____ns: Option<&'static str>, ____ns: Option<&'static str>,
____attr: impl dioxus_core::prelude::IntoAttributeValue<L>, ____attr: impl dioxus_core::IntoAttributeValue<L>,
____volatile: bool ____volatile: bool
) -> Self { ) -> Self {
let ( #(#descructuring,)* ) = self.fields; let ( #(#descructuring,)* ) = self.fields;
self.#field_name.push( self.#field_name.push(
dioxus_core::Attribute::new( dioxus_core::Attribute::new(
____name, ____name,
{ dioxus_core::IntoAttributeValue::<L>::into_value(____attr),
use dioxus_core::prelude::IntoAttributeValue;
____attr.into_value()
},
____ns, ____ns,
____volatile, ____volatile,
) )
@@ -1150,16 +1147,16 @@ Finally, call `.build()` to create the instance of `{name}`.
let marker_ident = syn::Ident::new("__Marker", proc_macro2::Span::call_site()); let marker_ident = syn::Ident::new("__Marker", proc_macro2::Span::call_site());
marker = Some(marker_ident.clone()); marker = Some(marker_ident.clone());
( (
quote!(impl dioxus_core::prelude::SuperInto<#arg_type, #marker_ident>), quote!(impl dioxus_core::SuperInto<#arg_type, #marker_ident>),
// If this looks like a signal type, we automatically convert it with SuperInto and use the props struct as the owner // If this looks like a signal type, we automatically convert it with SuperInto and use the props struct as the owner
quote!(with_owner(self.owner.clone(), move || dioxus_core::prelude::SuperInto::super_into(#field_name))), quote!(dioxus_core::with_owner(self.owner.clone(), move || dioxus_core::SuperInto::super_into(#field_name))),
) )
} else if field.builder_attr.auto_into || field.builder_attr.strip_option { } else if field.builder_attr.auto_into || field.builder_attr.strip_option {
let marker_ident = syn::Ident::new("__Marker", proc_macro2::Span::call_site()); let marker_ident = syn::Ident::new("__Marker", proc_macro2::Span::call_site());
marker = Some(marker_ident.clone()); marker = Some(marker_ident.clone());
( (
quote!(impl dioxus_core::prelude::SuperInto<#arg_type, #marker_ident>), quote!(impl dioxus_core::SuperInto<#arg_type, #marker_ident>),
quote!(dioxus_core::prelude::SuperInto::super_into(#field_name)), quote!(dioxus_core::SuperInto::super_into(#field_name)),
) )
} else if field.builder_attr.from_displayable { } else if field.builder_attr.from_displayable {
( (
@@ -1419,24 +1416,27 @@ Finally, call `.build()` to create the instance of `{name}`.
// If this is a signal type, we use super_into and the props struct as the owner // If this is a signal type, we use super_into and the props struct as the owner
let is_child_owned_type = child_owned_type(field.ty); let is_child_owned_type = child_owned_type(field.ty);
let mut into = quote!{};
if !is_default { let body = if !is_default {
if is_child_owned_type { if is_child_owned_type {
into = quote!{ .super_into() } quote!{ dioxus_core::SuperInto::super_into(#default) }
} else if field.builder_attr.auto_into { } else if field.builder_attr.auto_into {
into = quote!{ .into() } quote!{ (#default).into() }
} else if field.builder_attr.auto_to_string { } else if field.builder_attr.auto_to_string {
into = quote!{ .to_string() } quote!{ (#default).to_string() }
} } else {
default.to_token_stream()
} }
} else {
default.to_token_stream()
};
if field.builder_attr.skip { if field.builder_attr.skip {
quote!(let #name = #default #into;) quote!(let #name = #body;)
} else if is_child_owned_type { } else if is_child_owned_type {
quote!(let #name = #helper_trait_name::into_value(#name, || with_owner(self.owner.clone(), move || (#default) #into));) quote!(let #name = #helper_trait_name::into_value(#name, || dioxus_core::with_owner(self.owner.clone(), move || #body));)
} else { } else {
quote!(let #name = #helper_trait_name::into_value(#name, || #default #into);) quote!(let #name = #helper_trait_name::into_value(#name, || #body);)
} }
} else { } else {
quote!(let #name = #name.0;) quote!(let #name = #name.0;)
@@ -1484,15 +1484,15 @@ Finally, call `.build()` to create the instance of `{name}`.
/// Create a component from the props. /// Create a component from the props.
pub fn into_vcomponent<M: 'static>( pub fn into_vcomponent<M: 'static>(
self, self,
render_fn: impl dioxus_core::prelude::ComponentFunction<#original_name #ty_generics, M>, render_fn: impl dioxus_core::ComponentFunction<#original_name #ty_generics, M>,
) -> dioxus_core::VComponent { ) -> dioxus_core::VComponent {
use dioxus_core::prelude::ComponentFunction; use dioxus_core::ComponentFunction;
let component_name = ::std::any::type_name_of_val(&render_fn); let component_name = ::std::any::type_name_of_val(&render_fn);
dioxus_core::VComponent::new(move |wrapper: Self| render_fn.rebuild(wrapper.inner), self, component_name) dioxus_core::VComponent::new(move |wrapper: Self| render_fn.rebuild(wrapper.inner), self, component_name)
} }
} }
impl #original_impl_generics dioxus_core::prelude::Properties for #name #ty_generics #where_clause { impl #original_impl_generics dioxus_core::Properties for #name #ty_generics #where_clause {
type Builder = (); type Builder = ();
fn builder() -> Self::Builder { fn builder() -> Self::Builder {
unreachable!() unreachable!()
@@ -1742,7 +1742,7 @@ fn child_owned_type(ty: &Type) -> bool {
fn looks_like_signal_type(ty: &Type) -> bool { fn looks_like_signal_type(ty: &Type) -> bool {
match extract_base_type_without_generics(ty) { match extract_base_type_without_generics(ty) {
Some(path_without_generics) => { Some(path_without_generics) => {
path_without_generics == parse_quote!(dioxus_core::prelude::ReadOnlySignal) path_without_generics == parse_quote!(dioxus_core::ReadOnlySignal)
|| path_without_generics == parse_quote!(prelude::ReadOnlySignal) || path_without_generics == parse_quote!(prelude::ReadOnlySignal)
|| path_without_generics == parse_quote!(ReadOnlySignal) || path_without_generics == parse_quote!(ReadOnlySignal)
} }
@@ -1754,10 +1754,10 @@ fn looks_like_callback_type(ty: &Type) -> bool {
let type_without_option = remove_option_wrapper(ty.clone()); let type_without_option = remove_option_wrapper(ty.clone());
match extract_base_type_without_generics(&type_without_option) { match extract_base_type_without_generics(&type_without_option) {
Some(path_without_generics) => { Some(path_without_generics) => {
path_without_generics == parse_quote!(dioxus_core::prelude::EventHandler) path_without_generics == parse_quote!(dioxus_core::EventHandler)
|| path_without_generics == parse_quote!(prelude::EventHandler) || path_without_generics == parse_quote!(prelude::EventHandler)
|| path_without_generics == parse_quote!(EventHandler) || path_without_generics == parse_quote!(EventHandler)
|| path_without_generics == parse_quote!(dioxus_core::prelude::Callback) || path_without_generics == parse_quote!(dioxus_core::Callback)
|| path_without_generics == parse_quote!(prelude::Callback) || path_without_generics == parse_quote!(prelude::Callback)
|| path_without_generics == parse_quote!(Callback) || path_without_generics == parse_quote!(Callback)
} }
@@ -1,4 +1,7 @@
use dioxus::prelude::*; use dioxus::{
core::{generation, needs_update},
prelude::*,
};
use dioxus_core::ElementId; use dioxus_core::ElementId;
use std::{any::Any, rc::Rc}; use std::{any::Any, rc::Rc};
@@ -136,6 +139,8 @@ fn TakesSignal(sig: ReadOnlySignal<usize>, number: usize) -> Element {
// Regression test for https://github.com/DioxusLabs/dioxus/issues/2582 // Regression test for https://github.com/DioxusLabs/dioxus/issues/2582
#[test] #[test]
fn spreads_memorize_in_place() { fn spreads_memorize_in_place() {
use dioxus_core::Properties;
#[derive(Props, Clone, PartialEq)] #[derive(Props, Clone, PartialEq)]
struct CompProps { struct CompProps {
#[props(extends = GlobalAttributes)] #[props(extends = GlobalAttributes)]
+1 -2
View File
@@ -4,8 +4,7 @@
```rust, no_run ```rust, no_run
# tokio::runtime::Runtime::new().unwrap().block_on(async { # tokio::runtime::Runtime::new().unwrap().block_on(async {
use dioxus_core::prelude::*; use dioxus_core::{VirtualDom, Event, Element, Mutations};
use dioxus_core::*;
let mut vdom = VirtualDom::new(app); let mut vdom = VirtualDom::new(app);
let real_dom = SomeRenderer::new(); let real_dom = SomeRenderer::new();
+1 -2
View File
@@ -10,10 +10,9 @@ use crate::{
VComponent, WriteMutations, VComponent, WriteMutations,
}, },
nodes::{AsVNode, VNode}, nodes::{AsVNode, VNode},
prelude::SuspenseContext,
scopes::ScopeId, scopes::ScopeId,
virtual_dom::VirtualDom, virtual_dom::VirtualDom,
Element, Element, SuspenseContext,
}; };
impl VirtualDom { impl VirtualDom {
+5 -7
View File
@@ -1,6 +1,4 @@
use crate::{ use crate::{current_scope_id, properties::SuperFrom, runtime::RuntimeGuard, Runtime, ScopeId};
prelude::current_scope_id, properties::SuperFrom, runtime::RuntimeGuard, Runtime, ScopeId,
};
use generational_box::GenerationalBox; use generational_box::GenerationalBox;
use std::{any::Any, cell::RefCell, marker::PhantomData, panic::Location, rc::Rc}; use std::{any::Any, cell::RefCell, marker::PhantomData, panic::Location, rc::Rc};
@@ -337,7 +335,7 @@ impl<Ret> SpawnIfAsync<(), Ret> for Ret {
pub struct AsyncMarker; pub struct AsyncMarker;
impl<F: std::future::Future<Output = ()> + 'static> SpawnIfAsync<AsyncMarker> for F { impl<F: std::future::Future<Output = ()> + 'static> SpawnIfAsync<AsyncMarker> for F {
fn spawn(self) { fn spawn(self) {
crate::prelude::spawn(async move { crate::spawn(async move {
self.await; self.await;
}); });
} }
@@ -353,9 +351,9 @@ where
{ {
#[inline] #[inline]
fn spawn(self) { fn spawn(self) {
crate::prelude::spawn(async move { crate::spawn(async move {
if let Err(err) = self.await { if let Err(err) = self.await {
crate::prelude::throw_error(err) crate::throw_error(err)
} }
}); });
} }
@@ -366,7 +364,7 @@ impl SpawnIfAsync<()> for crate::Result<()> {
#[inline] #[inline]
fn spawn(self) { fn spawn(self) {
if let Err(err) = self { if let Err(err) = self {
crate::prelude::throw_error(err) crate::throw_error(err)
} }
} }
} }
+5 -3
View File
@@ -1,6 +1,8 @@
use crate::prelude::SuspenseContext;
use crate::runtime::RuntimeError; use crate::runtime::RuntimeError;
use crate::{innerlude::SuspendedFuture, runtime::Runtime, CapturedError, Element, ScopeId, Task}; use crate::{
innerlude::SuspendedFuture, runtime::Runtime, CapturedError, Element, ScopeId, SuspenseContext,
Task,
};
use std::future::Future; use std::future::Future;
use std::sync::Arc; use std::sync::Arc;
@@ -18,7 +20,7 @@ pub fn vdom_is_rendering() -> bool {
Runtime::with(|rt| rt.rendering.get()).unwrap_or_default() Runtime::with(|rt| rt.rendering.get()).unwrap_or_default()
} }
/// Throw a [`CapturedError`] into the current scope. The error will bubble up to the nearest [`crate::prelude::ErrorBoundary()`] or the root of the app. /// Throw a [`CapturedError`] into the current scope. The error will bubble up to the nearest [`crate::ErrorBoundary()`] or the root of the app.
/// ///
/// # Examples /// # Examples
/// ```rust, no_run /// ```rust, no_run
+14 -26
View File
@@ -77,32 +77,20 @@ pub(crate) mod innerlude {
} }
pub use crate::innerlude::{ pub use crate::innerlude::{
fc_to_builder, generation, schedule_update, schedule_update_any, use_hook, vdom_is_rendering, consume_context, consume_context_from_scope, current_owner, current_scope_id, fc_to_builder,
AnyValue, Attribute, AttributeValue, CapturedError, Component, ComponentFunction, DynamicNode, force_all_dirty, generation, has_context, needs_update, needs_update_any, parent_scope,
Element, ElementId, Event, Fragment, HasAttributes, IntoDynNode, LaunchConfig, provide_context, provide_error_boundary, provide_root_context, queue_effect, remove_future,
ListenerCallback, MarkerWrapper, Mutation, Mutations, NoOpMutations, Ok, Properties, Result, schedule_update, schedule_update_any, spawn, spawn_forever, spawn_isomorphic, suspend,
Runtime, ScopeId, ScopeState, SpawnIfAsync, Task, Template, TemplateAttribute, TemplateNode, suspense_context, throw_error, try_consume_context, use_after_render, use_before_render,
VComponent, VNode, VNodeInner, VPlaceholder, VText, VirtualDom, WriteMutations, use_drop, use_hook, use_hook_with_cleanup, vdom_is_rendering, with_owner, AnyValue, Attribute,
AttributeValue, Callback, CapturedError, Component, ComponentFunction, Context, DynamicNode,
Element, ElementId, ErrorBoundary, ErrorContext, Event, EventHandler, Fragment, HasAttributes,
IntoAttributeValue, IntoDynNode, LaunchConfig, ListenerCallback, MarkerWrapper, Mutation,
Mutations, NoOpMutations, Ok, OptionStringFromMarker, Properties, ReactiveContext, RenderError,
Result, Runtime, RuntimeGuard, ScopeId, ScopeState, SpawnIfAsync, SuperFrom, SuperInto,
SuspendedFuture, SuspenseBoundary, SuspenseBoundaryProps, SuspenseContext, SuspenseExtension,
Task, Template, TemplateAttribute, TemplateNode, VComponent, VNode, VNodeInner, VPlaceholder,
VText, VirtualDom, WriteMutations,
}; };
/// The purpose of this module is to alleviate imports of many common types
///
/// This includes types like [`Element`], and [`Component`].
pub mod prelude {
pub use crate::innerlude::{
consume_context, consume_context_from_scope, current_owner, current_scope_id,
fc_to_builder, force_all_dirty, generation, has_context, needs_update, needs_update_any,
parent_scope, provide_context, provide_error_boundary, provide_root_context, queue_effect,
remove_future, spawn, spawn_forever, spawn_isomorphic, suspend, suspense_context,
throw_error, try_consume_context, use_after_render, use_before_render, use_drop, use_hook,
use_hook_with_cleanup, with_owner, AnyValue, Attribute, Callback, Component,
ComponentFunction, Context, Element, ErrorBoundary, ErrorContext, Event, EventHandler,
Fragment, HasAttributes, IntoAttributeValue, IntoDynNode, OptionStringFromMarker,
Properties, ReactiveContext, RenderError, Runtime, RuntimeGuard, ScopeId, ScopeState,
SuperFrom, SuperInto, SuspendedFuture, SuspenseBoundary, SuspenseBoundaryProps,
SuspenseContext, SuspenseExtension, Task, Template, TemplateAttribute, TemplateNode, VNode,
VNodeInner, VirtualDom,
};
}
pub use const_format; pub use const_format;
+6 -9
View File
@@ -1,15 +1,12 @@
use dioxus_core_types::DioxusFormattable;
use crate::events::ListenerCallback;
use crate::innerlude::VProps;
use crate::prelude::RenderError;
use crate::{any_props::BoxedAnyProps, innerlude::ScopeState};
use crate::{arena::ElementId, Element, Event};
use crate::{ use crate::{
innerlude::{ElementRef, MountId}, any_props::BoxedAnyProps,
arena::ElementId,
events::ListenerCallback,
innerlude::{ElementRef, MountId, ScopeState, VProps},
properties::ComponentFunction, properties::ComponentFunction,
Element, Event, Properties, RenderError, ScopeId, VirtualDom,
}; };
use crate::{Properties, ScopeId, VirtualDom}; use dioxus_core_types::DioxusFormattable;
use std::ops::Deref; use std::ops::Deref;
use std::rc::Rc; use std::rc::Rc;
use std::vec; use std::vec;
+1 -6
View File
@@ -1,9 +1,4 @@
use crate::{ use crate::{current_scope_id, scope_context::Scope, tasks::SchedulerMsg, Runtime, ScopeId};
prelude::{current_scope_id, ScopeId},
scope_context::Scope,
tasks::SchedulerMsg,
Runtime,
};
use futures_channel::mpsc::UnboundedReceiver; use futures_channel::mpsc::UnboundedReceiver;
use generational_box::{BorrowMutError, GenerationalBox, SyncStorage}; use generational_box::{BorrowMutError, GenerationalBox, SyncStorage};
use std::{ use std::{
+4 -1
View File
@@ -1,4 +1,7 @@
use crate::{prelude::*, properties::RootProps, DynamicNode, VComponent}; use crate::{
fc_to_builder, properties::RootProps, DynamicNode, Element, ErrorBoundary, Properties,
SuspenseBoundary, Template, TemplateNode, VComponent, VNode,
};
// We wrap the root scope in a component that renders it inside a default ErrorBoundary and SuspenseBoundary // We wrap the root scope in a component that renders it inside a default ErrorBoundary and SuspenseBoundary
#[allow(non_snake_case)] #[allow(non_snake_case)]
+4 -6
View File
@@ -1,13 +1,11 @@
use crate::innerlude::{throw_error, RenderError, ScopeOrder};
use crate::nodes::AsVNode;
use crate::prelude::ReactiveContext;
use crate::scope_context::SuspenseLocation;
use crate::{ use crate::{
any_props::{AnyProps, BoxedAnyProps}, any_props::{AnyProps, BoxedAnyProps},
innerlude::ScopeState, innerlude::{throw_error, RenderError, ScopeOrder, ScopeState},
scope_context::Scope, nodes::AsVNode,
scope_context::{Scope, SuspenseLocation},
scopes::ScopeId, scopes::ScopeId,
virtual_dom::VirtualDom, virtual_dom::VirtualDom,
ReactiveContext,
}; };
use crate::{Element, VNode}; use crate::{Element, VNode};
+5 -6
View File
@@ -1,8 +1,7 @@
use crate::runtime::RuntimeError;
use crate::{innerlude::SchedulerMsg, Runtime, ScopeId, Task};
use crate::{ use crate::{
innerlude::{throw_into, CapturedError}, innerlude::{throw_into, CapturedError, SchedulerMsg, SuspenseContext},
prelude::SuspenseContext, runtime::RuntimeError,
Runtime, ScopeId, Task,
}; };
use generational_box::{AnyStorage, Owner}; use generational_box::{AnyStorage, Owner};
use rustc_hash::FxHashSet; use rustc_hash::FxHashSet;
@@ -159,7 +158,7 @@ impl Scope {
/// Schedule an update for any component given its [`ScopeId`]. /// Schedule an update for any component given its [`ScopeId`].
/// ///
/// A component's [`ScopeId`] can be obtained from `use_hook` or the [`current_scope_id`](crate::prelude::current_scope_id) method. /// A component's [`ScopeId`] can be obtained from `use_hook` or the [`current_scope_id`](crate::current_scope_id) method.
/// ///
/// This method should be used when you want to schedule an update for a component. /// This method should be used when you want to schedule an update for a component.
/// ///
@@ -612,7 +611,7 @@ impl ScopeId {
.on_scope(self, f) .on_scope(self, f)
} }
/// Throw a [`CapturedError`] into a scope. The error will bubble up to the nearest [`ErrorBoundary`](crate::prelude::ErrorBoundary) or the root of the app. /// Throw a [`CapturedError`] into a scope. The error will bubble up to the nearest [`ErrorBoundary`](crate::ErrorBoundary) or the root of the app.
/// ///
/// # Examples /// # Examples
/// ```rust, no_run /// ```rust, no_run
+2 -2
View File
@@ -33,7 +33,7 @@ impl std::fmt::Debug for ScopeId {
} }
impl ScopeId { impl ScopeId {
/// The ScopeId of the main scope passed into [`crate::prelude::VirtualDom::new`]. /// The ScopeId of the main scope passed into [`crate::VirtualDom::new`].
/// ///
/// This scope will last for the entire duration of your app, making it convenient for long-lived state /// This scope will last for the entire duration of your app, making it convenient for long-lived state
/// that is created dynamically somewhere down the component tree. /// that is created dynamically somewhere down the component tree.
@@ -51,7 +51,7 @@ impl ScopeId {
pub const APP: ScopeId = ScopeId(3); pub const APP: ScopeId = ScopeId(3);
/// The ScopeId of the topmost scope in the tree. /// The ScopeId of the topmost scope in the tree.
/// This will be higher up in the tree than [`ScopeId::APP`] because dioxus inserts a default [`crate::prelude::SuspenseBoundary`] and [`crate::prelude::ErrorBoundary`] at the root of the tree. /// This will be higher up in the tree than [`ScopeId::APP`] because dioxus inserts a default [`crate::SuspenseBoundary`] and [`crate::ErrorBoundary`] at the root of the tree.
// ScopeId(0) is the root scope wrapper // ScopeId(0) is the root scope wrapper
pub const ROOT: ScopeId = ScopeId(0); pub const ROOT: ScopeId = ScopeId(0);
+1 -1
View File
@@ -2,8 +2,8 @@
//! //!
//! This tests to ensure we clean it up //! This tests to ensure we clean it up
use dioxus::dioxus_core::{ElementId, Mutation::*};
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_core::{generation, ElementId, IntoAttributeValue, Mutation::*};
#[test] #[test]
fn attrs_cycle() { fn attrs_cycle() {
+1
View File
@@ -1,4 +1,5 @@
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_core::TemplateNode;
/// Make sure that rsx! is parsing templates and their attributes properly /// Make sure that rsx! is parsing templates and their attributes properly
#[test] #[test]
+1
View File
@@ -1,6 +1,7 @@
//! we should properly bubble up errors from components //! we should properly bubble up errors from components
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_core::generation;
fn app() -> Element { fn app() -> Element {
let raw = match generation() % 2 { let raw = match generation() % 2 {
@@ -3,6 +3,7 @@
use std::{sync::atomic::AtomicUsize, time::Duration}; use std::{sync::atomic::AtomicUsize, time::Duration};
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_core::generation;
#[tokio::test] #[tokio::test]
async fn child_futures_drop_first() { async fn child_futures_drop_first() {
+1
View File
@@ -1,5 +1,6 @@
use dioxus::dioxus_core::{ElementId, Mutation::*}; use dioxus::dioxus_core::{ElementId, Mutation::*};
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_core::generation;
#[test] #[test]
fn state_shares() { fn state_shares() {
+1
View File
@@ -1,5 +1,6 @@
use dioxus::dioxus_core::{ElementId, Mutation::*}; use dioxus::dioxus_core::{ElementId, Mutation::*};
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_core::generation;
/// As we clean up old templates, the ID for the node should cycle /// As we clean up old templates, the ID for the node should cycle
#[test] #[test]
+1
View File
@@ -1,5 +1,6 @@
use dioxus::dioxus_core::{ElementId, Mutation::*}; use dioxus::dioxus_core::{ElementId, Mutation::*};
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_core::generation;
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
#[test] #[test]
+1
View File
@@ -1,6 +1,7 @@
use dioxus::dioxus_core::Mutation::*; use dioxus::dioxus_core::Mutation::*;
use dioxus::dioxus_core::{AttributeValue, ElementId, NoOpMutations}; use dioxus::dioxus_core::{AttributeValue, ElementId, NoOpMutations};
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_core::generation;
#[test] #[test]
fn text_diff() { fn text_diff() {
+1
View File
@@ -6,6 +6,7 @@
use dioxus::dioxus_core::{ElementId, Mutation::*}; use dioxus::dioxus_core::{ElementId, Mutation::*};
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_core::generation;
/// Should result in moves, but not removals or additions /// Should result in moves, but not removals or additions
#[test] #[test]
+1 -1
View File
@@ -2,7 +2,7 @@ use std::collections::HashSet;
use dioxus::dioxus_core::{ElementId, Mutation::*}; use dioxus::dioxus_core::{ElementId, Mutation::*};
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_core::Mutation; use dioxus_core::{generation, Mutation};
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
#[test] #[test]
+1
View File
@@ -1,5 +1,6 @@
use dioxus::dioxus_core::{ElementId, Mutation}; use dioxus::dioxus_core::{ElementId, Mutation};
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_core::IntoAttributeValue;
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
fn basic_syntax_is_a_template() -> Element { fn basic_syntax_is_a_template() -> Element {
+1
View File
@@ -1,4 +1,5 @@
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_core::generation;
#[test] #[test]
fn app_drops() { fn app_drops() {
+1 -1
View File
@@ -3,7 +3,7 @@
use std::rc::Rc; use std::rc::Rc;
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_core::NoOpMutations; use dioxus_core::{generation, NoOpMutations};
/// This test checks that we should release all memory used by the virtualdom when it exits. /// This test checks that we should release all memory used by the virtualdom when it exits.
/// ///
+1 -1
View File
@@ -1,5 +1,5 @@
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_core::{AttributeValue, ElementId, Mutation}; use dioxus_core::{generation, AttributeValue, ElementId, Mutation};
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
use std::future::poll_fn; use std::future::poll_fn;
use std::task::Poll; use std::task::Poll;
+1
View File
@@ -3,6 +3,7 @@
use std::{sync::atomic::AtomicUsize, time::Duration}; use std::{sync::atomic::AtomicUsize, time::Duration};
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_core::{generation, needs_update, spawn_forever};
async fn run_vdom(app: fn() -> Element) { async fn run_vdom(app: fn() -> Element) {
let mut dom = VirtualDom::new(app); let mut dom = VirtualDom::new(app);
+1 -1
View File
@@ -1,6 +1,6 @@
use dioxus::html::SerializedHtmlEventConverter; use dioxus::html::SerializedHtmlEventConverter;
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_core::ElementId; use dioxus_core::{ElementId, Event};
use std::{any::Any, rc::Rc}; use std::{any::Any, rc::Rc};
use tracing_fluent_assertions::{AssertionRegistry, AssertionsLayer}; use tracing_fluent_assertions::{AssertionRegistry, AssertionsLayer};
use tracing_subscriber::{layer::SubscriberExt, Registry}; use tracing_subscriber::{layer::SubscriberExt, Registry};
+1 -1
View File
@@ -1,4 +1,4 @@
use dioxus_core::prelude::Callback; use dioxus_core::Callback;
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use std::{cell::RefCell, rc::Rc}; use std::{cell::RefCell, rc::Rc};
use wry::{http::Request, RequestAsyncResponder}; use wry::{http::Request, RequestAsyncResponder};
+2 -2
View File
@@ -8,7 +8,7 @@ use crate::{
webview::PendingWebview, webview::PendingWebview,
AssetRequest, Config, WindowCloseBehaviour, WryEventHandler, AssetRequest, Config, WindowCloseBehaviour, WryEventHandler,
}; };
use dioxus_core::{prelude::Callback, VirtualDom}; use dioxus_core::{Callback, VirtualDom};
use std::{ use std::{
cell::Cell, cell::Cell,
future::{Future, IntoFuture}, future::{Future, IntoFuture},
@@ -31,7 +31,7 @@ use tao::platform::ios::WindowExtIOS;
/// ///
/// This function will panic if it is called outside of the context of a Dioxus App. /// This function will panic if it is called outside of the context of a Dioxus App.
pub fn window() -> DesktopContext { pub fn window() -> DesktopContext {
dioxus_core::prelude::consume_context() dioxus_core::consume_context()
} }
/// A handle to the [`DesktopService`] that can be passed around. /// A handle to the [`DesktopService`] that can be passed around.
+1 -1
View File
@@ -1,5 +1,5 @@
use crate::{query::Query, DesktopContext, WeakDesktopContext}; use crate::{query::Query, DesktopContext, WeakDesktopContext};
use dioxus_core::prelude::queue_effect; use dioxus_core::queue_effect;
use dioxus_document::{ use dioxus_document::{
create_element_in_head, Document, Eval, EvalError, Evaluator, LinkProps, MetaProps, create_element_in_head, Document, Eval, EvalError, Evaluator, LinkProps, MetaProps,
ScriptProps, StyleProps, ScriptProps, StyleProps,
+3 -3
View File
@@ -11,8 +11,8 @@ use dioxus_html::{
point_interaction::{ point_interaction::{
InteractionElementOffset, InteractionLocation, ModifiersInteraction, PointerInteraction, InteractionElementOffset, InteractionLocation, ModifiersInteraction, PointerInteraction,
}, },
prelude::{SerializedMouseData, SerializedPointInteraction}, FileEngine, HasDragData, HasFileData, HasFormData, HasMouseData, SerializedMouseData,
FileEngine, HasDragData, HasFileData, HasFormData, HasMouseData, SerializedPointInteraction,
}; };
use serde::Deserialize; use serde::Deserialize;
@@ -233,7 +233,7 @@ impl InteractionElementOffset for DesktopFileDragEvent {
} }
impl ModifiersInteraction for DesktopFileDragEvent { impl ModifiersInteraction for DesktopFileDragEvent {
fn modifiers(&self) -> dioxus_html::prelude::Modifiers { fn modifiers(&self) -> dioxus_html::Modifiers {
self.mouse.modifiers() self.mouse.modifiers()
} }
} }
+2 -5
View File
@@ -4,10 +4,7 @@ use crate::{
assets::*, ipc::UserWindowEvent, shortcut::IntoAccelerator, window, DesktopContext, assets::*, ipc::UserWindowEvent, shortcut::IntoAccelerator, window, DesktopContext,
HotKeyState, ShortcutHandle, ShortcutRegistryError, WryEventHandler, HotKeyState, ShortcutHandle, ShortcutRegistryError, WryEventHandler,
}; };
use dioxus_core::{ use dioxus_core::{consume_context, use_hook, use_hook_with_cleanup, Runtime};
prelude::{consume_context, use_hook_with_cleanup},
use_hook, Runtime,
};
use dioxus_hooks::use_callback; use dioxus_hooks::use_callback;
use tao::{event::Event, event_loop::EventLoopWindowTarget}; use tao::{event::Event, event_loop::EventLoopWindowTarget};
@@ -22,7 +19,7 @@ pub fn use_window() -> DesktopContext {
pub fn use_wry_event_handler( pub fn use_wry_event_handler(
mut handler: impl FnMut(&Event<UserWindowEvent>, &EventLoopWindowTarget<UserWindowEvent>) + 'static, mut handler: impl FnMut(&Event<UserWindowEvent>, &EventLoopWindowTarget<UserWindowEvent>) + 'static,
) -> WryEventHandler { ) -> WryEventHandler {
use dioxus_core::prelude::current_scope_id; use dioxus_core::current_scope_id;
// Capture the current runtime and scope ID. // Capture the current runtime and scope ID.
let runtime = Runtime::current().unwrap(); let runtime = Runtime::current().unwrap();
+1 -4
View File
@@ -1,9 +1,6 @@
//! tray icon //! tray icon
use dioxus_core::{ use dioxus_core::{provide_context, try_consume_context, use_hook};
prelude::{provide_context, try_consume_context},
use_hook,
};
#[cfg(not(any(target_os = "ios", target_os = "android")))] #[cfg(not(any(target_os = "ios", target_os = "android")))]
pub use tray_icon::*; pub use tray_icon::*;
+1 -1
View File
@@ -44,7 +44,7 @@ pub fn try_apply_changes(dom: &VirtualDom, msg: &HotReloadMsg) -> Result<(), Pat
if msg.for_pid == our_pid { if msg.for_pid == our_pid {
unsafe { subsecond::apply_patch(jump_table) }?; unsafe { subsecond::apply_patch(jump_table) }?;
dioxus_core::prelude::force_all_dirty(); dioxus_core::force_all_dirty();
ctx.clear::<Signal<Option<HotReloadedTemplate>>>(); ctx.clear::<Signal<Option<HotReloadedTemplate>>>();
} }
} }
+12 -5
View File
@@ -3,6 +3,8 @@
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/79236386")] #![doc(html_logo_url = "https://avatars.githubusercontent.com/u/79236386")]
#![doc(html_favicon_url = "https://avatars.githubusercontent.com/u/79236386")] #![doc(html_favicon_url = "https://avatars.githubusercontent.com/u/79236386")]
pub use dioxus_core as core;
#[cfg(feature = "hooks")] #[cfg(feature = "hooks")]
pub use dioxus_hooks as hooks; pub use dioxus_hooks as hooks;
@@ -10,8 +12,8 @@ pub use dioxus_hooks as hooks;
pub use dioxus_signals as signals; pub use dioxus_signals as signals;
pub mod events { pub mod events {
#[cfg(feature = "html")] // #[cfg(feature = "html")]
pub use dioxus_html::prelude::*; // pub use dioxus_html::prelude::*;
} }
#[cfg(feature = "html")] #[cfg(feature = "html")]
@@ -43,8 +45,6 @@ pub mod prelude {
#[cfg(feature = "signals")] #[cfg(feature = "signals")]
pub use dioxus_signals::*; pub use dioxus_signals::*;
pub use dioxus_core::prelude::*;
#[cfg(feature = "macro")] #[cfg(feature = "macro")]
#[allow(deprecated)] #[allow(deprecated)]
pub use dioxus_core_macro::{component, rsx, Props}; pub use dioxus_core_macro::{component, rsx, Props};
@@ -56,7 +56,14 @@ pub mod prelude {
pub use dioxus_html as dioxus_elements; pub use dioxus_html as dioxus_elements;
#[cfg(feature = "html")] #[cfg(feature = "html")]
pub use dioxus_elements::{global_attributes, prelude::*, svg_attributes}; pub use dioxus_elements::{events::*, global_attributes, svg_attributes, traits::*};
pub use dioxus_core; pub use dioxus_core;
pub use dioxus_core::{
consume_context, provide_context, spawn, suspend, try_consume_context, use_hook, Attribute,
Callback, Component, Context, Element, ErrorBoundary, ErrorContext, Event, EventHandler,
Fragment, HasAttributes, IntoDynNode, RenderError, ScopeId, SuspenseBoundary,
SuspenseContext, SuspenseExtension, VNode, VirtualDom,
};
} }
+2 -2
View File
@@ -1,7 +1,7 @@
#![allow(clippy::new_without_default)] #![allow(clippy::new_without_default)]
#![allow(unused)] #![allow(unused)]
use dioxus_config_macro::*; use dioxus_config_macro::*;
use dioxus_core::LaunchConfig; use dioxus_core::{Element, LaunchConfig};
use std::any::Any; use std::any::Any;
use crate::prelude::*; use crate::prelude::*;
@@ -299,7 +299,7 @@ impl LaunchBuilder {
// Set any flags if we're running under fullstack // Set any flags if we're running under fullstack
#[cfg(feature = "fullstack")] #[cfg(feature = "fullstack")]
{ {
use dioxus_fullstack::prelude::server_fn::client::{get_server_url, set_server_url}; use dioxus_fullstack::server_fn::client::{get_server_url, set_server_url};
// Make sure to set the server_fn endpoint if the user specified the fullstack feature // Make sure to set the server_fn endpoint if the user specified the fullstack feature
// We only set this on native targets // We only set this on native targets
+27 -6
View File
@@ -32,6 +32,8 @@ pub use dioxus_core::{CapturedError, Ok, Result};
#[cfg_attr(docsrs, doc(cfg(feature = "launch")))] #[cfg_attr(docsrs, doc(cfg(feature = "launch")))]
mod launch; mod launch;
pub use dioxus_core as core;
#[cfg(feature = "launch")] #[cfg(feature = "launch")]
#[cfg_attr(docsrs, doc(cfg(feature = "launch")))] #[cfg_attr(docsrs, doc(cfg(feature = "launch")))]
pub use crate::launch::*; pub use crate::launch::*;
@@ -47,7 +49,7 @@ pub use dioxus_signals as signals;
pub mod events { pub mod events {
#[cfg(feature = "html")] #[cfg(feature = "html")]
#[cfg_attr(docsrs, doc(cfg(feature = "html")))] #[cfg_attr(docsrs, doc(cfg(feature = "html")))]
pub use dioxus_html::prelude::*; pub use dioxus_html::events::*;
} }
#[cfg(feature = "document")] #[cfg(feature = "document")]
@@ -143,8 +145,6 @@ pub mod prelude {
#[cfg_attr(docsrs, doc(cfg(feature = "signals")))] #[cfg_attr(docsrs, doc(cfg(feature = "signals")))]
pub use dioxus_signals::*; pub use dioxus_signals::*;
pub use dioxus_core::prelude::*;
#[cfg(feature = "macro")] #[cfg(feature = "macro")]
#[cfg_attr(docsrs, doc(cfg(feature = "macro")))] #[cfg_attr(docsrs, doc(cfg(feature = "macro")))]
#[allow(deprecated)] #[allow(deprecated)]
@@ -160,7 +160,10 @@ pub mod prelude {
#[cfg(feature = "html")] #[cfg(feature = "html")]
#[cfg_attr(docsrs, doc(cfg(feature = "html")))] #[cfg_attr(docsrs, doc(cfg(feature = "html")))]
pub use dioxus_elements::{global_attributes, prelude::*, svg_attributes}; pub use dioxus_elements::{
events::*, extensions::*, global_attributes, keyboard_types, svg_attributes, traits::*,
Code, GlobalAttributesExtension, Key, Location, Modifiers, SvgAttributesExtension,
};
#[cfg(feature = "devtools")] #[cfg(feature = "devtools")]
#[cfg_attr(docsrs, doc(cfg(feature = "devtools")))] #[cfg_attr(docsrs, doc(cfg(feature = "devtools")))]
@@ -170,7 +173,15 @@ pub mod prelude {
#[cfg(feature = "fullstack")] #[cfg(feature = "fullstack")]
#[cfg_attr(docsrs, doc(cfg(feature = "fullstack")))] #[cfg_attr(docsrs, doc(cfg(feature = "fullstack")))]
pub use dioxus_fullstack::prelude::*; pub use dioxus_fullstack::{
server, server_fn, use_server_cached, use_server_future, ServerFnError, ServerFnResult,
};
#[cfg(feature = "server")]
#[cfg_attr(docsrs, doc(cfg(feature = "server")))]
pub use dioxus_server::{
extract, DioxusRouterExt, DioxusRouterFnExt, FromContext, ServeConfig,
};
#[cfg(feature = "router")] #[cfg(feature = "router")]
#[cfg_attr(docsrs, doc(cfg(feature = "router")))] #[cfg_attr(docsrs, doc(cfg(feature = "router")))]
@@ -178,7 +189,10 @@ pub mod prelude {
#[cfg(feature = "router")] #[cfg(feature = "router")]
#[cfg_attr(docsrs, doc(cfg(feature = "router")))] #[cfg_attr(docsrs, doc(cfg(feature = "router")))]
pub use dioxus_router::prelude::*; pub use dioxus_router::{
hooks::*, navigator, use_navigator, GoBackButton, GoForwardButton, Link, NavigationTarget,
Outlet, Routable, Router,
};
#[cfg(feature = "asset")] #[cfg(feature = "asset")]
#[cfg_attr(docsrs, doc(cfg(feature = "asset")))] #[cfg_attr(docsrs, doc(cfg(feature = "asset")))]
@@ -187,4 +201,11 @@ pub mod prelude {
#[cfg(feature = "wasm-split")] #[cfg(feature = "wasm-split")]
#[cfg_attr(docsrs, doc(cfg(feature = "wasm-split")))] #[cfg_attr(docsrs, doc(cfg(feature = "wasm-split")))]
pub use wasm_splitter as wasm_split; pub use wasm_splitter as wasm_split;
pub use dioxus_core::{
consume_context, provide_context, spawn, suspend, try_consume_context, use_hook, Attribute,
Callback, Component, Context, Element, ErrorBoundary, ErrorContext, Event, EventHandler,
Fragment, HasAttributes, IntoDynNode, RenderError, ScopeId, SuspenseBoundary,
SuspenseContext, SuspenseExtension, VNode, VirtualDom,
};
} }
+1
View File
@@ -1,5 +1,6 @@
use super::*; use super::*;
use crate::document; use crate::document;
use dioxus_core::{use_hook, VNode};
use dioxus_html as dioxus_elements; use dioxus_html as dioxus_elements;
#[non_exhaustive] #[non_exhaustive]
+1
View File
@@ -1,5 +1,6 @@
use super::*; use super::*;
use crate::document; use crate::document;
use dioxus_core::{use_hook, VNode};
use dioxus_html as dioxus_elements; use dioxus_html as dioxus_elements;
#[non_exhaustive] #[non_exhaustive]
+3 -1
View File
@@ -2,7 +2,7 @@
use std::{cell::RefCell, collections::HashSet, rc::Rc}; use std::{cell::RefCell, collections::HashSet, rc::Rc};
use dioxus_core::{prelude::*, DynamicNode}; use dioxus_core::{Attribute, DynamicNode, Element, RenderError, ScopeId, Template, TemplateNode};
use dioxus_core_macro::*; use dioxus_core_macro::*;
mod link; mod link;
@@ -23,6 +23,8 @@ pub use title::*;
fn use_update_warning<T: PartialEq + Clone + 'static>(value: &T, name: &'static str) { fn use_update_warning<T: PartialEq + Clone + 'static>(value: &T, name: &'static str) {
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
{ {
use dioxus_core::use_hook;
let cloned_value = value.clone(); let cloned_value = value.clone();
let initial = use_hook(move || value.clone()); let initial = use_hook(move || value.clone());
+1
View File
@@ -1,5 +1,6 @@
use super::*; use super::*;
use crate::document; use crate::document;
use dioxus_core::{use_hook, VNode};
use dioxus_html as dioxus_elements; use dioxus_html as dioxus_elements;
#[non_exhaustive] #[non_exhaustive]
+1
View File
@@ -1,5 +1,6 @@
use super::*; use super::*;
use crate::document; use crate::document;
use dioxus_core::{use_hook, VNode};
use dioxus_html as dioxus_elements; use dioxus_html as dioxus_elements;
#[non_exhaustive] #[non_exhaustive]
+2
View File
@@ -1,3 +1,5 @@
use dioxus_core::{use_hook, VNode};
use crate::document; use crate::document;
use super::*; use super::*;
+1 -1
View File
@@ -12,7 +12,7 @@ pub use eval::*;
/// Get the document provider for the current platform or a no-op provider if the platform doesn't document functionality. /// Get the document provider for the current platform or a no-op provider if the platform doesn't document functionality.
pub fn document() -> Rc<dyn Document> { pub fn document() -> Rc<dyn Document> {
match dioxus_core::prelude::try_consume_context::<Rc<dyn Document>>() { match dioxus_core::try_consume_context::<Rc<dyn Document>>() {
Some(document) => document, Some(document) => document,
None => { None => {
tracing::error!( tracing::error!(
+1 -1
View File
@@ -2,7 +2,7 @@
use std::cell::OnceCell; use std::cell::OnceCell;
use dioxus_core::{prelude::queue_effect, schedule_update}; use dioxus_core::{queue_effect, schedule_update};
use dioxus_fullstack_protocol::is_hydrating; use dioxus_fullstack_protocol::is_hydrating;
use dioxus_history::History; use dioxus_history::History;
@@ -1,4 +1,4 @@
use dioxus_core::prelude::use_hook; use dioxus_core::use_hook;
use dioxus_fullstack_protocol::SerializeContextEntry; use dioxus_fullstack_protocol::SerializeContextEntry;
use serde::{de::DeserializeOwned, Serialize}; use serde::{de::DeserializeOwned, Serialize};
@@ -1,4 +1,4 @@
use dioxus_core::prelude::{suspend, use_hook, RenderError}; use dioxus_core::{suspend, use_hook, RenderError};
use dioxus_hooks::*; use dioxus_hooks::*;
use dioxus_signals::Readable; use dioxus_signals::Readable;
use serde::{de::DeserializeOwned, Serialize}; use serde::{de::DeserializeOwned, Serialize};
-4
View File
@@ -5,9 +5,5 @@ pub mod history;
mod hooks; mod hooks;
mod streaming; mod streaming;
pub mod prelude {
//! A prelude of commonly used items in dioxus-fullstack-hooks.
pub use crate::hooks::*; pub use crate::hooks::*;
pub use crate::streaming::*; pub use crate::streaming::*;
}
+1 -1
View File
@@ -1,4 +1,4 @@
use dioxus_core::prelude::try_consume_context; use dioxus_core::try_consume_context;
use dioxus_signals::{Readable, Signal, Writable}; use dioxus_signals::{Readable, Signal, Writable};
/// The status of the streaming response /// The status of the streaming response
+2 -2
View File
@@ -174,8 +174,8 @@ pub fn serialize_context() -> HydrationContext {
#[cfg(not(feature = "web"))] #[cfg(not(feature = "web"))]
{ {
// On the server each scope creates the context lazily // On the server each scope creates the context lazily
dioxus_core::prelude::has_context() dioxus_core::has_context()
.unwrap_or_else(|| dioxus_core::prelude::provide_context(HydrationContext::default())) .unwrap_or_else(|| dioxus_core::provide_context(HydrationContext::default()))
} }
} }
+1 -1
View File
@@ -4,7 +4,7 @@ use std::{
str::FromStr, str::FromStr,
}; };
use dioxus_lib::prelude::{dioxus_core::CapturedError, RenderError}; use dioxus_lib::core::{CapturedError, RenderError};
use serde::{de::DeserializeOwned, Serialize}; use serde::{de::DeserializeOwned, Serialize};
use server_fn::{ use server_fn::{
codec::JsonEncoding, codec::JsonEncoding,
+9 -12
View File
@@ -12,19 +12,16 @@ mod error;
#[cfg(all(feature = "web", feature = "document"))] #[cfg(all(feature = "web", feature = "document"))]
pub use web::FullstackWebDocument; pub use web::FullstackWebDocument;
#[cfg(feature = "server")]
pub use dioxus_server::*;
pub use dioxus_fullstack_hooks::history::FullstackHistory; pub use dioxus_fullstack_hooks::history::FullstackHistory;
/// A prelude of commonly used items in dioxus-fullstack.
pub mod prelude {
pub use dioxus_fullstack_hooks::prelude::*;
pub use crate::error::{ServerFnError, ServerFnResult}; pub use crate::error::{ServerFnError, ServerFnResult};
pub use dioxus_server_macro::*; pub use dioxus_fullstack_hooks::*;
pub use server_fn::{self, ServerFn as _};
#[cfg(feature = "server")] #[cfg(feature = "server")]
pub use dioxus_server::prelude::*; pub use dioxus_server::*;
} pub use dioxus_server_macro::*;
pub use server_fn::{
self, client,
client::{get_server_url, set_server_url},
codec, server, BoxedStream, ContentType, Decodes, Encodes, Format, FormatType, ServerFn as _,
ServerFn, Websocket,
};
+2 -2
View File
@@ -1,4 +1,4 @@
use dioxus_core::prelude::{provide_context, provide_root_context}; use dioxus_core::{provide_context, provide_root_context};
use std::{rc::Rc, sync::Arc}; use std::{rc::Rc, sync::Arc};
mod memory; mod memory;
@@ -6,7 +6,7 @@ pub use memory::*;
/// Get the history provider for the current platform if the platform doesn't implement a history functionality. /// Get the history provider for the current platform if the platform doesn't implement a history functionality.
pub fn history() -> Rc<dyn History> { pub fn history() -> Rc<dyn History> {
match dioxus_core::prelude::try_consume_context::<Rc<dyn History>>() { match dioxus_core::try_consume_context::<Rc<dyn History>>() {
Some(history) => history, Some(history) => history,
None => { None => {
tracing::error!("Unable to find a history provider in the renderer. Make sure your renderer supports the Router. Falling back to the in-memory history provider."); tracing::error!("Unable to find a history provider in the renderer. Make sure your renderer supports the Router. Falling back to the in-memory history provider.");
@@ -1,4 +1,4 @@
use dioxus_core::{prelude::suspense_context, use_hook}; use dioxus_core::{suspense_context, use_hook};
/// Run a closure after the suspense boundary this is under is resolved. The /// Run a closure after the suspense boundary this is under is resolved. The
/// closure will be run immediately if the suspense boundary is already resolved /// closure will be run immediately if the suspense boundary is already resolved
+1 -2
View File
@@ -1,5 +1,4 @@
use dioxus_core::prelude::use_hook; use dioxus_core::{use_hook, Callback};
use dioxus_core::prelude::Callback;
/// Create a callback that's always up to date. Whenever this hook is called the inner callback will be replaced with the new callback but the handle will remain. /// Create a callback that's always up to date. Whenever this hook is called the inner callback will be replaced with the new callback but the handle will remain.
/// ///
+1 -4
View File
@@ -1,7 +1,4 @@
use dioxus_core::{ use dioxus_core::{consume_context, provide_context, try_consume_context, use_hook};
prelude::{consume_context, provide_context, try_consume_context},
use_hook,
};
/// Consume some context in the tree, providing a sharable handle to the value /// Consume some context in the tree, providing a sharable handle to the value
/// ///
+1 -1
View File
@@ -1,6 +1,6 @@
use crate::{use_context_provider, use_future, UseFuture}; use crate::{use_context_provider, use_future, UseFuture};
use dioxus_core::prelude::{consume_context, use_hook};
use dioxus_core::Task; use dioxus_core::Task;
use dioxus_core::{consume_context, use_hook};
use dioxus_signals::*; use dioxus_signals::*;
pub use futures_channel::mpsc::{UnboundedReceiver, UnboundedSender}; pub use futures_channel::mpsc::{UnboundedReceiver, UnboundedSender};
use std::future::Future; use std::future::Future;
+1 -1
View File
@@ -1,6 +1,6 @@
use std::{cell::Cell, rc::Rc}; use std::{cell::Cell, rc::Rc};
use dioxus_core::prelude::*; use dioxus_core::*;
use futures_util::StreamExt; use futures_util::StreamExt;
use crate::use_callback; use crate::use_callback;
+3 -3
View File
@@ -1,6 +1,6 @@
#![allow(missing_docs)] #![allow(missing_docs)]
use crate::{use_callback, use_hook_did_run, use_signal}; use crate::{use_callback, use_hook_did_run, use_signal};
use dioxus_core::prelude::*; use dioxus_core::{use_hook, Callback, Task};
use dioxus_signals::*; use dioxus_signals::*;
use std::future::Future; use std::future::Future;
use std::ops::Deref; use std::ops::Deref;
@@ -8,7 +8,7 @@ use std::ops::Deref;
/// A hook that allows you to spawn a future the first time you render a component. /// A hook that allows you to spawn a future the first time you render a component.
/// ///
/// ///
/// This future will **not** run on the server. To run a future on the server, you should use [`spawn_isomorphic`] directly. /// This future will **not** run on the server. To run a future on the server, you should use [`dioxus_core::spawn_isomorphic`] directly.
/// ///
/// ///
/// `use_future` **won't return a value**. If you want to return a value from a future, use [`crate::use_resource()`] instead. /// `use_future` **won't return a value**. If you want to return a value from a future, use [`crate::use_resource()`] instead.
@@ -50,7 +50,7 @@ where
let callback = use_callback(move |_| { let callback = use_callback(move |_| {
let fut = future(); let fut = future();
spawn(async move { dioxus_core::spawn(async move {
state.set(UseFutureState::Pending); state.set(UseFutureState::Pending);
fut.await; fut.await;
state.set(UseFutureState::Ready); state.set(UseFutureState::Ready);
+1 -1
View File
@@ -1,4 +1,4 @@
use dioxus_core::prelude::*; use dioxus_core::{use_after_render, use_before_render, use_hook};
use dioxus_signals::{CopyValue, Writable}; use dioxus_signals::{CopyValue, Writable};
/// A hook that uses before/after lifecycle hooks to determine if the hook was run /// A hook that uses before/after lifecycle hooks to determine if the hook was run
+1 -1
View File
@@ -1,5 +1,5 @@
use crate::use_callback; use crate::use_callback;
use dioxus_core::prelude::*; use dioxus_core::use_hook;
use dioxus_signals::Memo; use dioxus_signals::Memo;
#[doc = include_str!("../docs/derived_state.md")] #[doc = include_str!("../docs/derived_state.md")]
+1 -1
View File
@@ -1,4 +1,4 @@
use dioxus_core::prelude::use_drop; use dioxus_core::use_drop;
#[deprecated(note = "Use `use_drop` instead, which has the same functionality.")] #[deprecated(note = "Use `use_drop` instead, which has the same functionality.")]
pub fn use_on_unmount<D: FnOnce() + 'static>(destroy: D) { pub fn use_on_unmount<D: FnOnce() + 'static>(destroy: D) {
+5 -1
View File
@@ -1,7 +1,11 @@
#![allow(missing_docs)] #![allow(missing_docs)]
use crate::{use_callback, use_signal}; use crate::{use_callback, use_signal};
use dioxus_core::prelude::*;
use dioxus_core::{
spawn, use_hook, Callback, IntoAttributeValue, IntoDynNode, ReactiveContext, RenderError,
SuspendedFuture, Task,
};
use dioxus_signals::*; use dioxus_signals::*;
use futures_util::{future, pin_mut, FutureExt, StreamExt}; use futures_util::{future, pin_mut, FutureExt, StreamExt};
use std::ops::Deref; use std::ops::Deref;
+1 -1
View File
@@ -1,4 +1,4 @@
use dioxus_core::{prelude::provide_root_context, prelude::try_consume_context, use_hook}; use dioxus_core::{provide_root_context, try_consume_context, use_hook};
/// Try to get a value from the root of the virtual dom, if it doesn't exist, create a new one with the closure provided. /// Try to get a value from the root of the virtual dom, if it doesn't exist, create a new one with the closure provided.
/// ///
+2 -3
View File
@@ -1,7 +1,6 @@
use std::hash::Hash; use dioxus_core::use_hook;
use dioxus_core::prelude::*;
use dioxus_signals::{ReadOnlySignal, SetCompare}; use dioxus_signals::{ReadOnlySignal, SetCompare};
use std::hash::Hash;
/// Creates a new SetCompare which efficiently tracks when a value changes to check if it is equal to a set of values. /// Creates a new SetCompare which efficiently tracks when a value changes to check if it is equal to a set of values.
/// ///
+1 -1
View File
@@ -1,4 +1,4 @@
use dioxus_core::prelude::*; use dioxus_core::use_hook;
use dioxus_signals::{Signal, SignalData, Storage, SyncStorage, UnsyncStorage}; use dioxus_signals::{Signal, SignalData, Storage, SyncStorage, UnsyncStorage};
/// Creates a new Signal. Signals are a Copy state management solution with automatic dependency tracking. /// Creates a new Signal. Signals are a Copy state management solution with automatic dependency tracking.
+1 -1
View File
@@ -30,7 +30,7 @@ async fn effects_rerun() {
println!("Signal: {:?}", signal); println!("Signal: {:?}", signal);
// Stop the wait for work manually // Stop the wait for work manually
needs_update(); dioxus_core::needs_update();
} }
}); });
signal += 1; signal += 1;
+2
View File
@@ -1,3 +1,5 @@
use dioxus_core::generation;
#[tokio::test] #[tokio::test]
async fn memo_updates() { async fn memo_updates() {
use std::cell::RefCell; use std::cell::RefCell;
+1 -1
View File
@@ -1,8 +1,8 @@
#![allow(non_upper_case_globals)] #![allow(non_upper_case_globals)]
#![allow(deprecated)] #![allow(deprecated)]
use dioxus_core::prelude::IntoAttributeValue;
use dioxus_core::HasAttributes; use dioxus_core::HasAttributes;
use dioxus_core::IntoAttributeValue;
use dioxus_html_internal_macro::impl_extension_attributes; use dioxus_html_internal_macro::impl_extension_attributes;
use crate::AttributeDescription; use crate::AttributeDescription;
+1 -1
View File
@@ -1,7 +1,7 @@
#![allow(non_upper_case_globals)] #![allow(non_upper_case_globals)]
use dioxus_core::prelude::IntoAttributeValue;
use dioxus_core::HasAttributes; use dioxus_core::HasAttributes;
use dioxus_core::IntoAttributeValue;
#[cfg(feature = "hot-reload-context")] #[cfg(feature = "hot-reload-context")]
use dioxus_core_types::HotReloadingContext; use dioxus_core_types::HotReloadingContext;
use dioxus_html_internal_macro::impl_extension_attributes; use dioxus_html_internal_macro::impl_extension_attributes;
+1 -1
View File
@@ -1,6 +1,6 @@
use crate::geometry::{ClientPoint, Coordinates, ElementPoint, PagePoint, ScreenPoint}; use crate::geometry::{ClientPoint, Coordinates, ElementPoint, PagePoint, ScreenPoint};
use crate::input_data::{MouseButton, MouseButtonSet}; use crate::input_data::{MouseButton, MouseButtonSet};
use crate::prelude::*; use crate::*;
use dioxus_core::Event; use dioxus_core::Event;
use keyboard_types::Modifiers; use keyboard_types::Modifiers;
+1 -1
View File
@@ -2,7 +2,7 @@ use dioxus_core::Event;
use keyboard_types::{Code, Key, Location, Modifiers}; use keyboard_types::{Code, Key, Location, Modifiers};
use std::fmt::Debug; use std::fmt::Debug;
use crate::prelude::ModifiersInteraction; use crate::ModifiersInteraction;
#[cfg(feature = "serialize")] #[cfg(feature = "serialize")]
fn resilient_deserialize_code<'de, D>(deserializer: D) -> Result<Code, D::Error> fn resilient_deserialize_code<'de, D>(deserializer: D) -> Result<Code, D::Error>
+1 -1
View File
@@ -25,7 +25,7 @@ macro_rules! impl_event {
#[doc(alias = $js_name)] #[doc(alias = $js_name)]
)? )?
#[inline] #[inline]
pub fn $name<__Marker>(mut _f: impl ::dioxus_core::prelude::SuperInto<::dioxus_core::ListenerCallback<$data>, __Marker>) -> ::dioxus_core::Attribute { pub fn $name<__Marker>(mut _f: impl ::dioxus_core::SuperInto<::dioxus_core::ListenerCallback<$data>, __Marker>) -> ::dioxus_core::Attribute {
let event_handler = _f.super_into(); let event_handler = _f.super_into();
::dioxus_core::Attribute::new( ::dioxus_core::Attribute::new(
impl_event!(@name $name $($js_name)?), impl_event!(@name $name $($js_name)?),
+1 -1
View File
@@ -1,6 +1,6 @@
use crate::geometry::{ClientPoint, Coordinates, ElementPoint, PagePoint, ScreenPoint}; use crate::geometry::{ClientPoint, Coordinates, ElementPoint, PagePoint, ScreenPoint};
use crate::input_data::{MouseButton, MouseButtonSet}; use crate::input_data::{MouseButton, MouseButtonSet};
use crate::prelude::*; use crate::*;
use dioxus_core::Event; use dioxus_core::Event;
use keyboard_types::Modifiers; use keyboard_types::Modifiers;
+1 -1
View File
@@ -1,7 +1,7 @@
use dioxus_core::Event; use dioxus_core::Event;
use keyboard_types::Modifiers; use keyboard_types::Modifiers;
use crate::{geometry::*, input_data::*, prelude::*}; use crate::{geometry::*, input_data::*, *};
/// A synthetic event that wraps a web-style [`PointerEvent`](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent) /// A synthetic event that wraps a web-style [`PointerEvent`](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent)
pub type PointerEvent = Event<PointerData>; pub type PointerEvent = Event<PointerData>;
+1 -1
View File
@@ -2,7 +2,7 @@ use dioxus_core::Event;
use keyboard_types::Modifiers; use keyboard_types::Modifiers;
use crate::geometry::*; use crate::geometry::*;
use crate::prelude::{InteractionLocation, ModifiersInteraction}; use crate::{InteractionLocation, ModifiersInteraction};
pub type TouchEvent = Event<TouchData>; pub type TouchEvent = Event<TouchData>;
pub struct TouchData { pub struct TouchData {
+6 -3
View File
@@ -1,9 +1,12 @@
use dioxus_core::Event; use dioxus_core::Event;
use keyboard_types::Modifiers;
use std::fmt::Formatter; use std::fmt::Formatter;
use crate::geometry::*; use crate::{geometry::*, InteractionLocation, ModifiersInteraction, PointerInteraction};
use crate::input_data::{MouseButton, MouseButtonSet}; use crate::{
use crate::prelude::*; input_data::{MouseButton, MouseButtonSet},
InteractionElementOffset,
};
use super::HasMouseData; use super::HasMouseData;
+10 -8
View File
@@ -41,15 +41,17 @@ pub use elements::*;
pub use events::*; pub use events::*;
pub use render_template::*; pub use render_template::*;
pub use crate::attribute_groups::{GlobalAttributesExtension, SvgAttributesExtension};
pub use crate::elements::extensions::*;
pub use crate::point_interaction::*;
pub use keyboard_types::{self, Code, Key, Location, Modifiers};
pub mod traits {
pub use crate::events::*;
pub use crate::point_interaction::*;
}
pub mod extensions { pub mod extensions {
pub use crate::attribute_groups::{GlobalAttributesExtension, SvgAttributesExtension}; pub use crate::attribute_groups::{GlobalAttributesExtension, SvgAttributesExtension};
pub use crate::elements::extensions::*; pub use crate::elements::extensions::*;
} }
pub mod prelude {
pub use crate::attribute_groups::{GlobalAttributesExtension, SvgAttributesExtension};
pub use crate::elements::extensions::*;
pub use crate::events::*;
pub use crate::point_interaction::*;
pub use keyboard_types::{self, Code, Key, Location, Modifiers};
}
@@ -41,7 +41,7 @@ impl LiveviewRouter for Router {
fn with_virtual_dom( fn with_virtual_dom(
self, self,
route: &str, route: &str,
app: impl Fn() -> dioxus_core::prelude::VirtualDom + Send + Sync + 'static, app: impl Fn() -> dioxus_core::VirtualDom + Send + Sync + 'static,
) -> Self { ) -> Self {
let view = crate::LiveViewPool::new(); let view = crate::LiveViewPool::new();
+1 -1
View File
@@ -33,7 +33,7 @@ impl<R: LiveviewRouter> Config<R> {
} }
/// Create a new configuration for the LiveView server. /// Create a new configuration for the LiveView server.
pub fn with_app(mut self, app: fn() -> dioxus_core::prelude::Element) -> Self { pub fn with_app(mut self, app: fn() -> dioxus_core::Element) -> Self {
self.router = self.router.with_app(&self.route, app); self.router = self.router.with_app(&self.route, app);
self self
} }
+1 -1
View File
@@ -1,4 +1,4 @@
use dioxus_core::prelude::queue_effect; use dioxus_core::queue_effect;
use dioxus_core::ScopeId; use dioxus_core::ScopeId;
use dioxus_document::{ use dioxus_document::{
create_element_in_head, Document, Eval, EvalError, Evaluator, LinkProps, MetaProps, create_element_in_head, Document, Eval, EvalError, Evaluator, LinkProps, MetaProps,
+1 -1
View File
@@ -1,4 +1,4 @@
use dioxus_core::prelude::spawn; use dioxus_core::spawn;
use dioxus_document::Eval; use dioxus_document::Eval;
use dioxus_history::History; use dioxus_history::History;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
+2 -1
View File
@@ -5,7 +5,8 @@ use crate::{
query::{QueryEngine, QueryResult}, query::{QueryEngine, QueryResult},
LiveViewError, LiveViewError,
}; };
use dioxus_core::prelude::*;
use dioxus_core::{provide_context, Element, Event, ScopeId, VirtualDom};
use dioxus_html::{EventData, HtmlEvent, PlatformEventData}; use dioxus_html::{EventData, HtmlEvent, PlatformEventData};
use dioxus_interpreter_js::MutationState; use dioxus_interpreter_js::MutationState;
use futures_util::{pin_mut, SinkExt, StreamExt}; use futures_util::{pin_mut, SinkExt, StreamExt};
+1 -1
View File
@@ -10,7 +10,7 @@ pub use anyrender_vello::{
}; };
pub fn use_wgpu<T: CustomPaintSource>(create_source: impl FnOnce() -> T) -> u64 { pub fn use_wgpu<T: CustomPaintSource>(create_source: impl FnOnce() -> T) -> u64 {
use dioxus_core::prelude::{consume_context, use_hook_with_cleanup}; use dioxus_core::{consume_context, use_hook_with_cleanup};
let (_renderer, id) = use_hook_with_cleanup( let (_renderer, id) = use_hook_with_cleanup(
|| { || {
@@ -5,10 +5,8 @@
// - Hydration // - Hydration
#![allow(non_snake_case)] #![allow(non_snake_case)]
use dioxus::prelude::{ use dioxus::fullstack::{codec::JsonEncoding, commit_initial_chunk, BoxedStream, Websocket};
server_fn::{codec::JsonEncoding, BoxedStream, Websocket}, use dioxus::prelude::*;
*,
};
use futures::{channel::mpsc, SinkExt, StreamExt}; use futures::{channel::mpsc, SinkExt, StreamExt};
fn main() { fn main() {
@@ -77,6 +75,7 @@ fn DefaultServerFnCodec() -> Element {
#[cfg(feature = "server")] #[cfg(feature = "server")]
async fn assert_server_context_provided() { async fn assert_server_context_provided() {
use dioxus::server::{extract, FromContext};
let FromContext(i): FromContext<u32> = extract().await.unwrap(); let FromContext(i): FromContext<u32> = extract().await.unwrap();
assert_eq!(i, 1234u32); assert_eq!(i, 1234u32);
} }
@@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize};
pub fn app() -> Element { pub fn app() -> Element {
// Start streaming immediately // Start streaming immediately
use_hook(commit_initial_chunk); use_hook(dioxus::fullstack::commit_initial_chunk);
rsx! { rsx! {
SuspenseBoundary { SuspenseBoundary {
@@ -9,7 +9,7 @@ fn main() {
.with_cfg(server_only! { .with_cfg(server_only! {
ServeConfig::builder() ServeConfig::builder()
.incremental( .incremental(
IncrementalRendererConfig::new() dioxus::server::IncrementalRendererConfig::new()
.static_dir( .static_dir(
std::env::current_exe() std::env::current_exe()
.unwrap() .unwrap()
@@ -5,7 +5,7 @@
// - Server futures // - Server futures
#![allow(non_snake_case, unused)] #![allow(non_snake_case, unused)]
use dioxus::prelude::*; use dioxus::{fullstack::commit_initial_chunk, prelude::*};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
fn app() -> Element { fn app() -> Element {
@@ -134,7 +134,7 @@ async fn add_body_element() {
let output_box = document.get_element_by_id("output-box").unwrap_throw(); let output_box = document.get_element_by_id("output-box").unwrap_throw();
output_box.append_child(&output).unwrap_throw(); output_box.append_child(&output).unwrap_throw();
dioxus::prelude::queue_effect(move || { dioxus::core::queue_effect(move || {
web_sys::console::log_1(&"add body async internal!".into()); web_sys::console::log_1(&"add body async internal!".into());
*GLOBAL_COUNTER.write() += 2; *GLOBAL_COUNTER.write() += 2;
}); });
@@ -146,7 +146,7 @@ async fn gzip_it() {
let reader = Box::pin(futures::io::BufReader::new(DATA)); let reader = Box::pin(futures::io::BufReader::new(DATA));
let reader: Pin<Box<dyn futures::io::AsyncBufRead>> = reader; let reader: Pin<Box<dyn futures::io::AsyncBufRead>> = reader;
dioxus::prelude::spawn(async move { dioxus::core::spawn(async move {
let mut fut = Box::pin(async_compression::futures::bufread::GzipDecoder::new( let mut fut = Box::pin(async_compression::futures::bufread::GzipDecoder::new(
reader, reader,
)); ));
@@ -177,7 +177,7 @@ async fn brotli_it(data: &'static [u8]) {
let reader = Box::pin(futures::io::BufReader::new(data)); let reader = Box::pin(futures::io::BufReader::new(data));
let reader: Pin<Box<dyn futures::io::AsyncBufRead>> = reader; let reader: Pin<Box<dyn futures::io::AsyncBufRead>> = reader;
dioxus::prelude::spawn(async move { dioxus::core::spawn(async move {
let mut fut = Box::pin(async_compression::futures::bufread::BrotliDecoder::new( let mut fut = Box::pin(async_compression::futures::bufread::BrotliDecoder::new(
reader, reader,
)); ));
@@ -274,7 +274,7 @@ fn ChildSplit() -> Element {
button { button {
onclick: move |_| { onclick: move |_| {
set_stars("stars".to_string(), num + 1); set_stars("stars".to_string(), num + 1);
dioxus::prelude::needs_update(); dioxus::core::needs_update();
}, },
"Add Star" "Add Star"
} }
+3 -1
View File
@@ -30,7 +30,9 @@ impl RouteSegment {
write!(f, "/{}", dioxus_router::exports::percent_encoding::utf8_percent_encode(&as_string, dioxus_router::exports::PATH_ASCII_SET))?; write!(f, "/{}", dioxus_router::exports::percent_encoding::utf8_percent_encode(&as_string, dioxus_router::exports::PATH_ASCII_SET))?;
} }
}, },
Self::CatchAll(ident, _) => quote! { #ident.display_route_segments(f)?; }, Self::CatchAll(ident, _) => quote! {
dioxus_router::ToRouteSegments::display_route_segments(#ident,f)?;
},
} }
} }
@@ -2,7 +2,7 @@
/// to the child router that maps child routes to root routes and vice versa. /// to the child router that maps child routes to root routes and vice versa.
use dioxus_lib::prelude::*; use dioxus_lib::prelude::*;
use crate::prelude::Routable; use crate::Routable;
/// Maps a child route into the root router and vice versa /// Maps a child route into the root router and vice versa
// NOTE: Currently child routers only support simple static prefixes, but this // NOTE: Currently child routers only support simple static prefixes, but this
+1 -1
View File
@@ -1,4 +1,4 @@
use crate::prelude::{outlet::OutletContext, *}; use crate::{outlet::OutletContext, *};
use dioxus_lib::prelude::*; use dioxus_lib::prelude::*;
/// An outlet for the current content. /// An outlet for the current content.
+3 -7
View File
@@ -1,10 +1,6 @@
use dioxus_lib::prelude::*; use dioxus_lib::prelude::*;
use crate::{ use crate::{provide_router_context, routable::Routable, router_cfg::RouterConfig, Outlet};
prelude::{provide_router_context, Outlet},
routable::Routable,
router_cfg::RouterConfig,
};
/// The props for [`Router`]. /// The props for [`Router`].
#[derive(Props)] #[derive(Props)]
@@ -38,7 +34,7 @@ impl<R: Clone> PartialEq for RouterProps<R> {
/// A component that renders the current route. /// A component that renders the current route.
pub fn Router<R: Routable + Clone>(props: RouterProps<R>) -> Element { pub fn Router<R: Routable + Clone>(props: RouterProps<R>) -> Element {
use crate::prelude::{outlet::OutletContext, RouterContext}; use crate::{outlet::OutletContext, RouterContext};
use_hook(|| { use_hook(|| {
provide_router_context(RouterContext::new(props.config.call(()))); provide_router_context(RouterContext::new(props.config.call(())));
@@ -46,7 +42,7 @@ pub fn Router<R: Routable + Clone>(props: RouterProps<R>) -> Element {
#[cfg(feature = "streaming")] #[cfg(feature = "streaming")]
use_after_suspense_resolved(|| { use_after_suspense_resolved(|| {
dioxus_fullstack_hooks::prelude::commit_initial_chunk(); dioxus_fullstack_hooks::commit_initial_chunk();
}); });
use_hook(|| { use_hook(|| {
+2 -2
View File
@@ -1,4 +1,4 @@
use crate::prelude::{ExternalNavigationFailure, NavigationTarget, RouterContext}; use crate::{ExternalNavigationFailure, NavigationTarget, RouterContext};
/// Acquire the navigator without subscribing to updates. /// Acquire the navigator without subscribing to updates.
/// ///
@@ -9,7 +9,7 @@ use crate::prelude::{ExternalNavigationFailure, NavigationTarget, RouterContext}
/// Panics if there is no router present. /// Panics if there is no router present.
pub fn navigator() -> Navigator { pub fn navigator() -> Navigator {
Navigator( Navigator(
dioxus_lib::prelude::try_consume_context::<RouterContext>() dioxus_lib::core::try_consume_context::<RouterContext>()
.expect("A router must be present to use navigator"), .expect("A router must be present to use navigator"),
) )
} }
Loaded 100 of 139 files, more files were not shown because too many files have changed in this diff. Show more