Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Dioxus 0.6 support #810

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
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
41 changes: 20 additions & 21 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ members = ["crates/renderer", "crates/state", "crates/freya", "crates/elements",
tracing-subscriber = ["freya/tracing-subscriber"]
devtools = ["freya/devtools"]
use_camera = ["freya/use_camera"]
hot-reload = ["freya/hot-reload"]
custom-tokio-rt = ["freya/custom-tokio-rt"]
performance-overlay = ["freya/performance-overlay"]
fade-cached-incremental-areas = ["freya/fade-cached-incremental-areas"]
disable-zoom-shortcuts = ["freya/disable-zoom-shortcuts"]

[patch.crates-io]
# dioxus = { git = "https://github.com/DioxusLabs/dioxus", rev = "7beacdf9c76ae5412d3c2bcd55f7c5d87f486a0f" }
# dioxus-rsx = { git = "https://github.com/DioxusLabs/dioxus", rev = "7beacdf9c76ae5412d3c2bcd55f7c5d87f486a0f" }
# dioxus-core-macro = { git = "https://github.com/DioxusLabs/dioxus", rev = "7beacdf9c76ae5412d3c2bcd55f7c5d87f486a0f" }
# dioxus-hooks = { git = "https://github.com/DioxusLabs/dioxus", rev = "7beacdf9c76ae5412d3c2bcd55f7c5d87f486a0f" }
# dioxus-signals = { git = "https://github.com/DioxusLabs/dioxus", rev = "7beacdf9c76ae5412d3c2bcd55f7c5d87f486a0f" }
# dioxus-core = { git = "https://github.com/DioxusLabs/dioxus", rev = "7beacdf9c76ae5412d3c2bcd55f7c5d87f486a0f" }
# dioxus-hot-reload = { git = "https://github.com/DioxusLabs/dioxus", rev = "7beacdf9c76ae5412d3c2bcd55f7c5d87f486a0f" }
# dioxus-router = { git = "https://github.com/DioxusLabs/dioxus", rev = "7beacdf9c76ae5412d3c2bcd55f7c5d87f486a0f" }
# [patch.crates-io]
# dioxus = { git = "https://github.com/DioxusLabs/dioxus", tag = "v0.6.0" }
# dioxus-rsx = { git = "https://github.com/DioxusLabs/dioxus", tag = "v0.6.0" }
# dioxus-core-macro = { git = "https://github.com/DioxusLabs/dioxus", tag = "v0.6.0" }
# dioxus-hooks = { git = "https://github.com/DioxusLabs/dioxus", tag = "v0.6.0" }
# dioxus-signals = { git = "https://github.com/DioxusLabs/dioxus", tag = "v0.6.0" }
# dioxus-core = { git = "https://github.com/DioxusLabs/dioxus", tag = "v0.6.0" }
# dioxus-router = { git = "https://github.com/DioxusLabs/dioxus", tag = "v0.6.0" }
# dioxus-lib = { git = "https://github.com/DioxusLabs/dioxus", tag = "v0.6.0" }
# generational-box = { git = "https://github.com/DioxusLabs/dioxus", tag = "v0.6.0" }

[workspace.dependencies]
freya = { path = "crates/freya", version = "0.2" }
Expand All @@ -39,19 +39,18 @@ freya-components = { path = "crates/components", version = "0.2" }
freya-testing = { path = "crates/testing", version = "0.2" }
freya-engine = { path = "crates/engine", version = "0.2" }
torin = { path = "crates/torin", version = "0.2" }
dioxus-clipboard = "0.2.0"

freya-native-core-macro = { path = "crates/native-core-macro", version = "0.2" }
freya-native-core = { path = "crates/native-core", version = "0.2" }

dioxus = { version = "0.5", default-features = false, features = ["macro", "signals", "hooks"]}
dioxus-rsx = { version = "0.5", features = ["hot_reload"] }
dioxus-core-macro = { version = "0.5" }
dioxus-hooks = { version = "0.5" }
dioxus-signals = { version = "0.5" }
dioxus-core = { version = "0.5" }
dioxus-hot-reload = { version = "0.5", features = ["file_watcher"], default-features = false }
dioxus-router = { version = "0.5", default-features = false }
dioxus-clipboard = "0.1"
dioxus = { version = "0.6.0", default-features = false, features = ["macro", "signals", "hooks"] }
dioxus-rsx = { version = "0.6.0" }
dioxus-core-macro = { version = "0.6.0" }
dioxus-hooks = { version = "0.6.0" }
dioxus-signals = { version = "0.6.0" }
dioxus-core = { version = "0.6.0" }
dioxus-router = { version = "0.6.0", default-features = false }

skia-safe = { version = "0.80.0", features = ["gl", "textlayout", "svg"] }

Expand Down Expand Up @@ -84,12 +83,12 @@ freya-core = { workspace = true }
freya-testing = { workspace = true }
reqwest = { version = "0.12.0", features = ["json"] }
serde = "1.0.189"
dioxus-i18n = "0.2"
dioxus-i18n = "0.3"
rand = "0.8.5"
dioxus-router = { workspace = true }
itertools = "0.13.0"
home = "0.5.9"
dioxus-query = "0.5.1"
dioxus-query = "0.6.0"
gilrs = "0.10.8"
gl = { workspace = true }
tree-sitter-highlight = "0.23.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/components/src/accordion.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dioxus::prelude::*;
use freya_elements::{
elements as dioxus_elements,
self as dioxus_elements,
events::MouseEvent,
};
use freya_hooks::{
Expand Down
2 changes: 1 addition & 1 deletion crates/components/src/animated_position.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::time::Duration;

use dioxus::prelude::*;
use freya_elements::elements as dioxus_elements;
use freya_elements as dioxus_elements;
use freya_hooks::{
use_animation_with_dependencies,
use_node_signal_with_prev,
Expand Down
2 changes: 1 addition & 1 deletion crates/components/src/body.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use dioxus::prelude::*;
use freya_elements::elements as dioxus_elements;
use freya_elements as dioxus_elements;
use freya_hooks::{
use_applied_theme,
BodyTheme,
Expand Down
2 changes: 1 addition & 1 deletion crates/components/src/button.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dioxus::prelude::*;
use freya_elements::{
elements as dioxus_elements,
self as dioxus_elements,
events::{
KeyboardEvent,
PointerEvent,
Expand Down
2 changes: 1 addition & 1 deletion crates/components/src/canvas.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use dioxus::prelude::*;
use freya_elements::elements as dioxus_elements;
use freya_elements as dioxus_elements;
use freya_hooks::{
use_applied_theme,
CanvasTheme,
Expand Down
12 changes: 6 additions & 6 deletions crates/components/src/checkbox.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dioxus::prelude::*;
use freya_elements::{
elements as dioxus_elements,
self as dioxus_elements,
events::KeyboardEvent,
};
use freya_hooks::{
Expand Down Expand Up @@ -42,7 +42,7 @@ use crate::TickIcon;
/// leading: rsx!(
/// Checkbox {
/// selected: selected.read().contains(&Choice::First),
/// },
/// }
/// ),
/// label { "First choice" }
/// }
Expand All @@ -57,7 +57,7 @@ use crate::TickIcon;
/// leading: rsx!(
/// Checkbox {
/// selected: selected.read().contains(&Choice::Second),
/// },
/// }
/// ),
/// label { "Second choice" }
/// }
Expand Down Expand Up @@ -145,7 +145,7 @@ mod test {
leading: rsx!(
Checkbox {
selected: selected.read().contains(&Choice::First),
},
}
),
label { "First choice" }
}
Expand All @@ -160,7 +160,7 @@ mod test {
leading: rsx!(
Checkbox {
selected: selected.read().contains(&Choice::Second),
},
}
),
label { "Second choice" }
}
Expand All @@ -175,7 +175,7 @@ mod test {
leading: rsx!(
Checkbox {
selected: selected.read().contains(&Choice::Third),
},
}
),
label { "Third choice" }
}
Expand Down
2 changes: 1 addition & 1 deletion crates/components/src/cursor_area.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use dioxus::prelude::*;
use freya_elements::elements as dioxus_elements;
use freya_elements as dioxus_elements;
use freya_hooks::use_platform;
pub use winit::window::CursorIcon;

Expand Down
4 changes: 2 additions & 2 deletions crates/components/src/drag_drop.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dioxus::prelude::*;
use freya_elements::{
elements as dioxus_elements,
self as dioxus_elements,
events::MouseEvent,
};
use freya_hooks::use_node_signal;
Expand Down Expand Up @@ -175,7 +175,7 @@ mod test {
"Move"
}
}
},
}
DropZone {
ondrop: move |data: bool| {
state.set(data);
Expand Down
2 changes: 1 addition & 1 deletion crates/components/src/dropdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::fmt::Display;

use dioxus::prelude::*;
use freya_elements::{
elements as dioxus_elements,
self as dioxus_elements,
events::{
keyboard::Key,
KeyboardEvent,
Expand Down
4 changes: 2 additions & 2 deletions crates/components/src/gesture_area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{

use dioxus::prelude::*;
use freya_elements::{
elements as dioxus_elements,
self as dioxus_elements,
events::{
touch::TouchPhase,
TouchEvent,
Expand Down Expand Up @@ -65,7 +65,7 @@ type EventsQueue = VecDeque<(Instant, TouchEvent)>;
#[allow(non_snake_case)]
pub fn GestureArea(props: GestureAreaProps) -> Element {
let event_emitter = use_coroutine(
|mut rx: UnboundedReceiver<(Instant, TouchEvent)>| async move {
move |mut rx: UnboundedReceiver<(Instant, TouchEvent)>| async move {
let mut touch_events = VecDeque::<(Instant, TouchEvent)>::new();

while let Some(new_event) = rx.next().await {
Expand Down
2 changes: 1 addition & 1 deletion crates/components/src/graph.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use dioxus::prelude::*;
use freya_elements::elements as dioxus_elements;
use freya_elements as dioxus_elements;
use freya_engine::prelude::*;
use freya_hooks::{
use_applied_theme,
Expand Down
2 changes: 1 addition & 1 deletion crates/components/src/hooks/use_form.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl<Id: Clone + Hash + Eq + Display> UseForm<Id> {
onpress: Some(EventHandler::new(move |_| {
(submit.peek())(&data.read());
})),
children: None,
children: Ok(VNode::placeholder()),
onclick: None,
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/components/src/icons/arrow.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use dioxus::prelude::*;
use freya_elements::elements as dioxus_elements;
use freya_elements as dioxus_elements;
use freya_hooks::{
use_applied_theme,
IconTheme,
Expand Down
2 changes: 1 addition & 1 deletion crates/components/src/icons/cross.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use dioxus::prelude::*;
use freya_elements::elements as dioxus_elements;
use freya_elements as dioxus_elements;
use freya_hooks::{
use_applied_theme,
IconTheme,
Expand Down
2 changes: 1 addition & 1 deletion crates/components/src/icons/tick.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use dioxus::prelude::*;
use freya_elements::elements as dioxus_elements;
use freya_elements as dioxus_elements;
use freya_hooks::{
use_applied_theme,
IconTheme,
Expand Down
4 changes: 2 additions & 2 deletions crates/components/src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ macro_rules! import_image {
rsx!(image {
width,
height,
image_data
image_data,
})
}
};
Expand All @@ -50,7 +50,7 @@ macro_rules! import_image {
rsx!(image {
width,
height,
image_data
image_data,
})
}
};
Expand Down
4 changes: 2 additions & 2 deletions crates/components/src/input.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dioxus::prelude::*;
use freya_elements::{
elements as dioxus_elements,
self as dioxus_elements,
events::{
keyboard::Key,
KeyboardData,
Expand Down Expand Up @@ -275,7 +275,7 @@ mod test {
onchange: move |new_value| {
value.set(new_value);
}
},)
})
}

let mut utils = launch_test(input_app);
Expand Down
16 changes: 9 additions & 7 deletions crates/components/src/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use std::borrow::Cow;
use dioxus::prelude::*;
use dioxus_router::prelude::{
navigator,
IntoRoutable,
NavigationTarget,
};
use freya_elements::{
elements as dioxus_elements,
self as dioxus_elements,
events::MouseEvent,
};
use freya_hooks::{
Expand Down Expand Up @@ -49,7 +49,7 @@ pub enum LinkTooltip {
/// ```rust
/// # use dioxus::prelude::*;
/// # use dioxus_router::prelude::*;
/// # use freya_elements::elements as dioxus_elements;
/// # use freya_elements as dioxus_elements;
/// # use freya_components::Link;
/// # #[derive(Routable, Clone)]
/// # #[rustfmt::skip]
Expand Down Expand Up @@ -77,7 +77,7 @@ pub enum LinkTooltip {
///
/// ```rust
/// # use dioxus::prelude::*;
/// # use freya_elements::elements as dioxus_elements;
/// # use freya_elements as dioxus_elements;
/// # use freya_components::Link;
/// # fn link_example_good() -> Element {
/// rsx! {
Expand All @@ -96,7 +96,7 @@ pub fn Link(
theme: Option<LinkThemeWith>,
/// The route or external URL string to navigate to.
#[props(into)]
to: IntoRoutable,
to: NavigationTarget,
/// Inner children for the Link.
children: Element,
/// This event will be fired if opening an external link fails.
Expand All @@ -112,7 +112,7 @@ pub fn Link(
let theme = use_applied_theme!(&theme, link);
let mut is_hovering = use_signal(|| false);

let url = if let IntoRoutable::FromStr(ref url) = to {
let url = if let NavigationTarget::External(ref url) = to {
Some(url.clone())
} else {
None
Expand Down Expand Up @@ -144,7 +144,9 @@ pub fn Link(

// TODO(marc2332): Log unhandled errors
} else {
println!("111");
let router = navigator();
println!("222");
router.push(to.clone());
}
}
Expand Down Expand Up @@ -179,7 +181,7 @@ pub fn Link(
Tooltip {
text: tooltip
}
)
),
{link}
}
)
Expand Down
2 changes: 1 addition & 1 deletion crates/components/src/loader.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use dioxus::prelude::*;
use freya_elements::elements as dioxus_elements;
use freya_elements as dioxus_elements;
use freya_hooks::{
use_animation,
use_applied_theme,
Expand Down
8 changes: 4 additions & 4 deletions crates/components/src/menu.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dioxus::prelude::*;
use freya_elements::{
elements as dioxus_elements,
self as dioxus_elements,
events::MouseEvent,
};
use freya_hooks::{
Expand Down Expand Up @@ -237,7 +237,7 @@ pub fn SubMenu(
close_menus_until(&mut menus, parent_menu_id);
push_menu(&mut menus, submenu_id);
},
{children},
{children}
if show_submenu {
rect {
position_top: "-12",
Expand Down Expand Up @@ -275,7 +275,7 @@ pub fn MenuButton(
if let Some(onclick) = &onclick {
onclick.call(e)
}
}
},
{children}
}
)
Expand Down Expand Up @@ -323,7 +323,7 @@ mod test {
Button {
onpress: move |_| show_menu.toggle(),
label { "Open Menu" }
},
}
if *show_menu.read() {
Menu {
onclose: move |_| show_menu.set(false),
Expand Down
Loading
Loading