Skip to content

Commit

Permalink
update(dependency): Dioxus update (#1229)
Browse files Browse the repository at this point in the history
Co-authored-by: Flemmli97 <Flemmli97@users.noreply.github.com>
Co-authored-by: Darius Clark <dariusc93@users.noreply.github.com>
Co-authored-by: Darius <darius.clark@proton.me>
  • Loading branch information
4 people authored Sep 22, 2023
1 parent 86465fc commit f6c095f
Show file tree
Hide file tree
Showing 16 changed files with 80 additions and 72 deletions.
79 changes: 40 additions & 39 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ version = "0.1.6"
rust-version = "1.70"

[workspace.dependencies]
dioxus = { version = "0.4" }
dioxus-hooks = { version = "0.4" }
dioxus-html = { version = "0.4" }
dioxus-router = { version = "0.4" }
dioxus-desktop = { version = "0.4", features = ["transparent"] }
dioxus = { git = "https://github.com/DioxusLabs/dioxus", rev = "60ee829" }
dioxus-hooks = { git = "https://github.com/DioxusLabs/dioxus", rev = "60ee829" }
dioxus-html = { git = "https://github.com/DioxusLabs/dioxus", rev = "60ee829" }
dioxus-router = { git = "https://github.com/DioxusLabs/dioxus", rev = "60ee829" }
dioxus-desktop = { git = "https://github.com/DioxusLabs/dioxus", rev = "60ee829", features = ["transparent"] }
raw-window-handle = "0.5"
dioxus-core = { version = "0.4" }
fermi = { version = "0.4" }
dioxus-core = { git = "https://github.com/DioxusLabs/dioxus", rev = "60ee829" }
fermi = { git = "https://github.com/DioxusLabs/dioxus", rev = "60ee829" }
tokio-util = { version = "0.7", features = ["full"] }
arboard = "3.2"
humansize = "2.1.3"
Expand Down
10 changes: 5 additions & 5 deletions extensions/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub static FILE_EXT: &str = "dll";
pub trait Extension {
fn details(&self) -> Details;
fn stylesheet(&self) -> String;
fn render<'a>(&self, cx: &'a ScopeState) -> Element<'a>;
fn render<'a>(&self, cx: &'a ScopeState, runtime: std::rc::Rc<Runtime>) -> Element<'a>;
fn rustc_version(&self) -> &'static str {
RUSTC_VERSION
}
Expand Down Expand Up @@ -44,8 +44,8 @@ macro_rules! export_extension {

#[doc(hidden)]
#[no_mangle]
pub extern "C" fn render(cx: &ScopeState) -> Element {
$a.render(cx)
pub extern "C" fn render(cx: &ScopeState, runtime: std::rc::Rc<Runtime>) -> Element {
$a.render(cx, runtime)
}

#[doc(hidden)]
Expand Down Expand Up @@ -104,9 +104,9 @@ impl UplinkExtension {
unsafe {
let res = self
.lib
.get::<unsafe extern "C" fn(cx: &ScopeState) -> Element>(b"render\0");
.get::<unsafe extern "C" fn(cx: &ScopeState, runtime: std::rc::Rc<Runtime>) -> Element>(b"render\0");
match res {
Ok(f) => f(cx),
Ok(f) => f(cx, Runtime::current().unwrap()),
Err(_) => None,
}
}
Expand Down
3 changes: 2 additions & 1 deletion icons/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::type_complexity)]
//! Dioxus components for [heroicons](https://heroicons.com/)
//
// MIT License
Expand Down Expand Up @@ -32,7 +33,7 @@
//! use dioxus::prelude::*;
//! use dioxus_heroicons::{Icon, IconButton, solid::Shape};
//!
//! #[inline_props]
//! #[component]
//! fn DeleteButton(cx: Scope, foo: u8) -> Element {
//! let onclick = move |evt| {
//! // Delete a thing
Expand Down
4 changes: 4 additions & 0 deletions kit/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
//TODO: Look into complex types from clippy in regards to props attr macro.
// Low priority and can be ignored

#![allow(clippy::type_complexity)]
use components::indicator::{Platform, Status};

pub mod components;
Expand Down
3 changes: 2 additions & 1 deletion native_extensions/clear_all/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ impl Extension for ClearAll {
".clear-all_container, .clear-all_container .btn-wrap, .clear-all_container .btn { width: 100% }".into()
}

fn render<'a>(&self, cx: &'a ScopeState) -> Element<'a> {
fn render<'a>(&self, cx: &'a ScopeState, runtime: std::rc::Rc<Runtime>) -> Element<'a> {
cx.use_hook(|| RuntimeGuard::new(runtime.clone()));
let styles = self.stylesheet();

cx.render(rsx! (
Expand Down
11 changes: 6 additions & 5 deletions native_extensions/emoji_selector/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ fn group_to_str(group: emojis::Group) -> String {
}
}

#[inline_props]
fn build_nav(cx: Scope) -> Element<'a> {
#[component(no_case_check)]
fn build_nav(cx: Scope<'_>) -> Element<'_> {
let routes = vec![
Route {
to: "Smileys & Emotion",
Expand Down Expand Up @@ -126,7 +126,7 @@ enum Command {
React(Uuid, Uuid, String),
}

#[inline_props]
#[component(no_case_check)]
fn render_selector<'a>(
cx: Scope,
mouse_over_emoji_button: UseRef<bool>,
Expand Down Expand Up @@ -269,7 +269,7 @@ fn render_selector<'a>(
}

// this avoid a BorrowMut error. needs an argument to make the curly braces syntax work
#[inline_props]
#[component(no_case_check)]
fn render_1(cx: Scope, _unused: bool) -> Element {
let state = use_shared_state::<State>(cx)?;
let mouse_over_emoji_button = use_ref(cx, || false);
Expand Down Expand Up @@ -338,7 +338,8 @@ impl Extension for EmojiSelector {
include_str!("./style.css").to_string()
}

fn render<'a>(&self, cx: &'a ScopeState) -> Element<'a> {
fn render<'a>(&self, cx: &'a ScopeState, runtime: std::rc::Rc<Runtime>) -> Element<'a> {
cx.use_hook(|| RuntimeGuard::new(runtime.clone()));
let styles = self.stylesheet();
cx.render(rsx!(
style { "{styles}" },
Expand Down
2 changes: 1 addition & 1 deletion ui/src/auth_guard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub enum AuthPages {
}

/// Guard the app's router with the login flow
#[inline_props]
#[component]
pub fn AuthGuard(cx: Scope, page: UseState<AuthPages>) -> Element {
log::trace!("rendering auth guard");

Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/debug_logger/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::logger;
const STYLE: &str = include_str!("./style.scss");
const SCRIPT: &str = include_str!("./script.js");

#[inline_props]
#[component]
#[allow(non_snake_case)]
pub fn DebugLogger(cx: Scope) -> Element {
let logs_to_show = use_state(cx, logger::load_debug_log);
Expand Down
3 changes: 1 addition & 2 deletions ui/src/components/media/popout_player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ use crate::{utils::WindowDropHandler, window_manager::WindowManagerCmd, WINDOW_C
#[allow(dead_code)]
pub const SCRIPT: &str = include_str!("./script.js");

#[inline_props]
#[allow(non_snake_case)]
#[component]
pub fn PopoutPlayer(cx: Scope, _drop_handler: WindowDropHandler) -> Element {
let cmd_tx = WINDOW_CMD_CH.tx.clone();

Expand Down
2 changes: 1 addition & 1 deletion ui/src/layouts/chats/presentation/messages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub struct NewelyFetchedMessages {
/// tell group_messages to flag the first X messages.
/// if onmouseout triggers over any of those messages, load Y more.
const DEFAULT_NUM_TO_TAKE: usize = 20;
#[inline_props]
#[component(no_case_check)]
pub fn get_messages(cx: Scope, data: Rc<ChatData>) -> Element {
log::trace!("get_messages");
use_shared_state_provider(cx, || -> DownloadTracker { HashMap::new() });
Expand Down
3 changes: 1 addition & 2 deletions ui/src/layouts/create_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ use crate::AuthPages;
pub const MIN_USERNAME_LEN: i32 = 4;
pub const MAX_USERNAME_LEN: i32 = 32;

#[inline_props]
#[allow(non_snake_case)]
#[component]
pub fn CreateAccountLayout(cx: Scope, page: UseState<AuthPages>, pin: UseRef<String>) -> Element {
log::trace!("rendering create account layout");
let username = use_state(cx, String::new);
Expand Down
2 changes: 1 addition & 1 deletion ui/src/layouts/storage/files_layout/file_modal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use dioxus::prelude::*;
use kit::layout::modal::Modal;
use warp::constellation::file::File;

#[inline_props]
#[component(no_case_check)]
pub fn get_file_modal<'a>(
cx: Scope<'a>,
on_dismiss: EventHandler<'a, ()>,
Expand Down
Loading

0 comments on commit f6c095f

Please sign in to comment.