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 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
10dedd9
feat: Dioxus 0.6 support
marc2332 Aug 9, 2024
78d7550
chore: Clean up the rest of rsx!()
marc2332 Aug 10, 2024
bbedfe2
chore: Update SDK and clean up
marc2332 Aug 10, 2024
3230a55
fix: Update test
marc2332 Aug 10, 2024
274bd3c
feat: Use alpha 5
marc2332 Nov 24, 2024
61feeeb
chore: Fix image element usage
marc2332 Nov 24, 2024
adb2b24
chore: clean up and fixes
marc2332 Nov 24, 2024
4fb6491
fix: Update the Text Editors example
marc2332 Nov 24, 2024
28aeef1
chore: clean up
marc2332 Nov 24, 2024
ef915d7
chore: Remove hotreload
marc2332 Nov 24, 2024
6e7c957
fix: Return empty vnodes instead of None
marc2332 Nov 24, 2024
92b0144
fix:VNode::empty()
marc2332 Nov 24, 2024
e7f52ad
fix: comma
marc2332 Nov 24, 2024
80efc25
fix: missing VNode::empty()
marc2332 Nov 24, 2024
fa3922b
Merge branch 'main' into feat/dioxus-0.6
marc2332 Dec 10, 2024
585815d
feat: 0.6 support
marc2332 Dec 10, 2024
83d41f6
update definitions
marc2332 Dec 15, 2024
6efc0ad
chore: Fix autocompletion
marc2332 Dec 15, 2024
f69186e
Merge branch 'main' into feat/dioxus-0.6
marc2332 Dec 15, 2024
efd284c
Merge branch 'main' into feat/dioxus-0.6
marc2332 Dec 17, 2024
7ac127b
Merge branch 'main' into feat/dioxus-0.6
marc2332 Dec 21, 2024
c64c6ad
resolve conflicts
marc2332 Dec 21, 2024
875dd6e
Merge branch 'main' into feat/dioxus-0.6
marc2332 Jan 8, 2025
36f9cae
chore: Fix memory leak of event handlers in the dioxus event macro de…
marc2332 Jan 8, 2025
89e0917
chore: Hide elements events autocompletion modules in doc
marc2332 Jan 8, 2025
d3f6090
docs: Fix links
marc2332 Jan 8, 2025
7998341
docs: Replace Option::None with Ok(VNode::placeholder())
marc2332 Jan 8, 2025
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
42 changes: 21 additions & 21 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ 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"]
docs = ["freya/docs"]

[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.1" }
# dioxus-rsx = { git = "https://github.com/DioxusLabs/dioxus", tag = "v0.6.1" }
# dioxus-core-macro = { git = "https://github.com/DioxusLabs/dioxus", tag = "v0.6.1" }
# dioxus-hooks = { git = "https://github.com/DioxusLabs/dioxus", tag = "v0.6.1" }
# dioxus-signals = { git = "https://github.com/DioxusLabs/dioxus", tag = "v0.6.1" }
# dioxus-core = { git = "https://github.com/DioxusLabs/dioxus", tag = "v0.6.1" }
# dioxus-router = { git = "https://github.com/DioxusLabs/dioxus", tag = "v0.6.1" }
# dioxus-lib = { git = "https://github.com/DioxusLabs/dioxus", tag = "v0.6.1" }
# generational-box = { git = "https://github.com/DioxusLabs/dioxus", tag = "v0.6.1" }

[workspace.dependencies]
freya = { path = "crates/freya", version = "0.3.0-rc.0" }
Expand All @@ -41,20 +41,20 @@ freya-components = { path = "crates/components", version = "0.3.0-rc.0" }
freya-testing = { path = "crates/testing", version = "0.3.0-rc.0" }
freya-engine = { path = "crates/engine", version = "0.3.0-rc.0" }
torin = { path = "crates/torin", version = "0.3.0-rc.0" }
dioxus-clipboard = "0.2.0"
dioxus-i18n = "0.3"

freya-native-core-macro = { path = "crates/native-core-macro", version = "0.3.0-rc.0" }
freya-native-core = { path = "crates/native-core", version = "0.3.0-rc.0" }

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-i18n = "0.3"
dioxus = { version = "0.6.1", default-features = false, features = ["macro", "signals", "hooks"] }
dioxus-rsx = { version = "0.6.1" }
dioxus-core-macro = { version = "0.6.1" }
dioxus-hooks = { version = "0.6.1" }
dioxus-signals = { version = "0.6.1" }
dioxus-core = { version = "0.6.1" }
generational-box = { version = "0.6.1" }
dioxus-router = { version = "0.6.1", default-features = false }

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

Expand Down Expand Up @@ -92,7 +92,7 @@ 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
20 changes: 11 additions & 9 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 All @@ -20,7 +20,7 @@ use crate::{
TooltipContainer,
};

/// Tooltip configuration for the [`Link`] component.
/// Tooltip configuration for the [`Link()`] component.
#[derive(Clone, PartialEq)]
pub enum LinkTooltip {
/// No tooltip at all.
Expand All @@ -34,7 +34,7 @@ pub enum LinkTooltip {
Custom(String),
}

/// Similar to [`Link`](dioxus_router::components::Link), but you can use it in Freya.
/// Similar to [`Link`](dioxus_router::components::Link()), but you can use it in Freya.
/// Both internal routes (dioxus-router) and external links are supported. When using internal routes
/// make sure the Link is descendant of a [`Router`](dioxus_router::components::Router) component.
///
Expand All @@ -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
Loading
Loading