mirror of
https://github.com/DioxusLabs/dioxus
synced 2025-02-18 06:38:26 +00:00
chore: clean up some clippy warnings and add clippy lints to CI
This commit is contained in:
parent
e5b39bb61f
commit
c4a18bc24d
12 changed files with 36 additions and 313 deletions
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
@ -104,7 +104,7 @@ jobs:
|
||||||
- uses: actions-rs/cargo@v1
|
- uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: clippy
|
command: clippy
|
||||||
args: --workspace -- -D warnings
|
args: --workspace --examples --tests -- -D warnings
|
||||||
|
|
||||||
# Coverage is disabled until we can fix it
|
# Coverage is disabled until we can fix it
|
||||||
# coverage:
|
# coverage:
|
||||||
|
|
|
@ -10,7 +10,7 @@ fn main() {
|
||||||
|
|
||||||
fn app(cx: Scope) -> Element {
|
fn app(cx: Scope) -> Element {
|
||||||
let window = use_window(cx);
|
let window = use_window(cx);
|
||||||
let emails_sent = use_ref(cx, || vec![]);
|
let emails_sent = use_ref(cx, Vec::new);
|
||||||
|
|
||||||
let tx = use_coroutine(cx, |mut rx: UnboundedReceiver<String>| {
|
let tx = use_coroutine(cx, |mut rx: UnboundedReceiver<String>| {
|
||||||
to_owned![emails_sent];
|
to_owned![emails_sent];
|
||||||
|
@ -56,7 +56,7 @@ struct ComposeProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compose(cx: Scope<ComposeProps>) -> Element {
|
fn compose(cx: Scope<ComposeProps>) -> Element {
|
||||||
let user_input = use_state(cx, || String::new());
|
let user_input = use_state(cx, String::new);
|
||||||
let window = use_window(cx);
|
let window = use_window(cx);
|
||||||
|
|
||||||
cx.render(rsx! {
|
cx.render(rsx! {
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
//! This example shows to wrap a webcomponent / custom element with a component.
|
|
||||||
//!
|
|
||||||
//! Oftentimes, a third party library will provide a webcomponent that you want
|
|
||||||
//! to use in your application. This example shows how to create that custom element
|
|
||||||
//! directly with the raw_element method on NodeFactory.
|
|
||||||
|
|
||||||
use dioxus::prelude::*;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let mut dom = VirtualDom::new(app);
|
|
||||||
let _ = dom.rebuild();
|
|
||||||
|
|
||||||
let output = dioxus_ssr::render(&dom);
|
|
||||||
|
|
||||||
println!("{}", output);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn app(cx: Scope) -> Element {
|
|
||||||
let g = cx.component(component, (), "component");
|
|
||||||
let c = cx.make_node(g);
|
|
||||||
cx.render(rsx! {
|
|
||||||
div { c }
|
|
||||||
})
|
|
||||||
|
|
||||||
// let nf = NodeFactory::new(cx);
|
|
||||||
|
|
||||||
// let mut attrs = dioxus::core::exports::bumpalo::collections::Vec::new_in(nf.bump());
|
|
||||||
|
|
||||||
// attrs.push(nf.attr("client-id", format_args!("abc123"), None, false));
|
|
||||||
|
|
||||||
// attrs.push(nf.attr("name", format_args!("bob"), None, false));
|
|
||||||
|
|
||||||
// attrs.push(nf.attr("age", format_args!("47"), None, false));
|
|
||||||
|
|
||||||
// Some(nf.raw_element("my-element", None, &[], attrs.into_bump_slice(), &[], None))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn component(cx: Scope) -> Element {
|
|
||||||
todo!()
|
|
||||||
}
|
|
|
@ -10,7 +10,7 @@ fn main() {
|
||||||
static NAME: Atom<String> = |_| "world".to_string();
|
static NAME: Atom<String> = |_| "world".to_string();
|
||||||
|
|
||||||
fn app(cx: Scope) -> Element {
|
fn app(cx: Scope) -> Element {
|
||||||
use_init_atom_root(&cx);
|
use_init_atom_root(cx);
|
||||||
let name = use_read(cx, NAME);
|
let name = use_read(cx, NAME);
|
||||||
|
|
||||||
cx.render(rsx! {
|
cx.render(rsx! {
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
use dioxus_desktop::{use_window, WindowBuilder};
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
dioxus_desktop::launch(app);
|
dioxus_desktop::launch(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn app(cx: Scope) -> Element {
|
fn app(cx: Scope) -> Element {
|
||||||
let window = use_window(cx);
|
let window = dioxus_desktop::use_window(cx);
|
||||||
|
|
||||||
cx.render(rsx! {
|
cx.render(rsx! {
|
||||||
div {
|
div {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
use dioxus_desktop::{tao::dpi::PhysicalPosition, use_window, Config, LogicalSize, WindowBuilder};
|
use dioxus_desktop::{tao::dpi::PhysicalPosition, use_window, LogicalSize, WindowBuilder};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
dioxus_desktop::launch_cfg(app, make_config());
|
dioxus_desktop::launch_cfg(app, make_config());
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
use dioxus_router::*;
|
use dioxus_router::*;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
use bumpalo::Bump;
|
use bumpalo::Bump;
|
||||||
use dioxus::core::{ElementId, Mutation::*};
|
use dioxus::core::{ElementId, Mutation::*};
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
use dioxus_core::{AttributeValue, BorrowedAttributeValue};
|
use dioxus_core::BorrowedAttributeValue;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn attrs_cycle() {
|
fn attrs_cycle() {
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
use futures_util::Future;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn catches_panic() {
|
fn catches_panic() {
|
||||||
let mut dom = VirtualDom::new(app);
|
let mut dom = VirtualDom::new(app);
|
||||||
|
_ = dom.rebuild();
|
||||||
let a = dom.rebuild();
|
|
||||||
|
|
||||||
dbg!(a);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn app(cx: Scope) -> Element {
|
fn app(cx: Scope) -> Element {
|
||||||
|
@ -16,43 +14,21 @@ fn app(cx: Scope) -> Element {
|
||||||
h1 { "Title" }
|
h1 { "Title" }
|
||||||
|
|
||||||
NoneChild {}
|
NoneChild {}
|
||||||
|
ThrowChild {}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn NoneChild(cx: Scope) -> Element {
|
fn NoneChild(_cx: Scope) -> Element {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn PanicChild(cx: Scope) -> Element {
|
|
||||||
panic!("Rendering panicked for whatever reason");
|
|
||||||
|
|
||||||
cx.render(rsx! {
|
|
||||||
h1 { "It works!" }
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn ThrowChild(cx: Scope) -> Element {
|
fn ThrowChild(cx: Scope) -> Element {
|
||||||
cx.throw(std::io::Error::new(std::io::ErrorKind::AddrInUse, "asd"))?;
|
cx.throw(std::io::Error::new(std::io::ErrorKind::AddrInUse, "asd"))?;
|
||||||
|
|
||||||
let g: i32 = "123123".parse().throw(cx)?;
|
let _g: i32 = "123123".parse().throw(cx)?;
|
||||||
|
|
||||||
cx.render(rsx! {
|
cx.render(rsx! {
|
||||||
div {}
|
div {}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn custom_allocator(cx: Scope) -> Element {
|
|
||||||
let g = String::new();
|
|
||||||
|
|
||||||
let p = g.as_str();
|
|
||||||
|
|
||||||
let g2 = cx.use_hook(|| 123);
|
|
||||||
// cx.spawn(async move {
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // println!("Thig is {p}");
|
|
||||||
// });
|
|
||||||
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
|
@ -143,15 +143,15 @@ fn supports_async() {
|
||||||
use tokio::time::sleep;
|
use tokio::time::sleep;
|
||||||
|
|
||||||
fn app(cx: Scope) -> Element {
|
fn app(cx: Scope) -> Element {
|
||||||
let colors = use_state(&cx, || vec!["green", "blue", "red"]);
|
let colors = use_state(cx, || vec!["green", "blue", "red"]);
|
||||||
let padding = use_state(&cx, || 10);
|
let padding = use_state(cx, || 10);
|
||||||
|
|
||||||
use_effect(&cx, colors, |colors| async move {
|
use_effect(cx, colors, |colors| async move {
|
||||||
sleep(Duration::from_millis(1000)).await;
|
sleep(Duration::from_millis(1000)).await;
|
||||||
colors.with_mut(|colors| colors.reverse());
|
colors.with_mut(|colors| colors.reverse());
|
||||||
});
|
});
|
||||||
|
|
||||||
use_effect(&cx, padding, |padding| async move {
|
use_effect(cx, padding, |padding| async move {
|
||||||
sleep(Duration::from_millis(10)).await;
|
sleep(Duration::from_millis(10)).await;
|
||||||
padding.with_mut(|padding| {
|
padding.with_mut(|padding| {
|
||||||
if *padding < 65 {
|
if *padding < 65 {
|
||||||
|
@ -206,220 +206,9 @@ fn supports_async() {
|
||||||
let mut dom = VirtualDom::new(app);
|
let mut dom = VirtualDom::new(app);
|
||||||
let _ = dom.rebuild();
|
let _ = dom.rebuild();
|
||||||
|
|
||||||
for x in 0..10 {
|
for _ in 0..10 {
|
||||||
let _ = dom.wait_for_work().await;
|
dom.wait_for_work().await;
|
||||||
let edits = dom.render_immediate();
|
let _edits = dom.render_immediate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[test]
|
|
||||||
// fn old_props_arent_stale() {
|
|
||||||
// fn app(cx: Scope) -> Element {
|
|
||||||
// dbg!("rendering parent");
|
|
||||||
// let cnt = cx.use_hook(|| 0);
|
|
||||||
// *cnt += 1;
|
|
||||||
|
|
||||||
// if *cnt == 1 {
|
|
||||||
// render!(div { Child { a: "abcdef".to_string() } })
|
|
||||||
// } else {
|
|
||||||
// render!(div { Child { a: "abcdef".to_string() } })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// #[derive(Props, PartialEq)]
|
|
||||||
// struct ChildProps {
|
|
||||||
// a: String,
|
|
||||||
// }
|
|
||||||
// fn Child(cx: Scope<ChildProps>) -> Element {
|
|
||||||
// dbg!("rendering child", &cx.props.a);
|
|
||||||
// render!(div { "child {cx.props.a}" })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// let mut dom = new_dom(app, ());
|
|
||||||
// let _ = dom.rebuild();
|
|
||||||
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(0)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(0)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(0)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
|
|
||||||
// dbg!("forcing update to child");
|
|
||||||
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(1)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(1)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(1)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// #[test]
|
|
||||||
// fn basic() {
|
|
||||||
// fn app(cx: Scope) -> Element {
|
|
||||||
// render!(div {
|
|
||||||
// Child { a: "abcdef".to_string() }
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// #[derive(Props, PartialEq)]
|
|
||||||
// struct ChildProps {
|
|
||||||
// a: String,
|
|
||||||
// }
|
|
||||||
|
|
||||||
// fn Child(cx: Scope<ChildProps>) -> Element {
|
|
||||||
// dbg!("rendering child", &cx.props.a);
|
|
||||||
// render!(div { "child {cx.props.a}" })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// let mut dom = new_dom(app, ());
|
|
||||||
// let _ = dom.rebuild();
|
|
||||||
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(0)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(0)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// #[test]
|
|
||||||
// fn leak_thru_children() {
|
|
||||||
// fn app(cx: Scope) -> Element {
|
|
||||||
// cx.render(rsx! {
|
|
||||||
// Child {
|
|
||||||
// name: "asd".to_string(),
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// cx.render(rsx! {
|
|
||||||
// div {}
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// #[inline_props]
|
|
||||||
// fn Child(cx: Scope, name: String) -> Element {
|
|
||||||
// render!(div { "child {name}" })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// let mut dom = new_dom(app, ());
|
|
||||||
// let _ = dom.rebuild();
|
|
||||||
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(0)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(0)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// #[test]
|
|
||||||
// fn test_pass_thru() {
|
|
||||||
// #[inline_props]
|
|
||||||
// fn NavContainer<'a>(cx: Scope, children: Element<'a>) -> Element {
|
|
||||||
// cx.render(rsx! {
|
|
||||||
// header {
|
|
||||||
// nav { children }
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// fn NavMenu(cx: Scope) -> Element {
|
|
||||||
// render!( NavBrand {}
|
|
||||||
// div {
|
|
||||||
// NavStart {}
|
|
||||||
// NavEnd {}
|
|
||||||
// }
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
|
|
||||||
// fn NavBrand(cx: Scope) -> Element {
|
|
||||||
// render!(div {})
|
|
||||||
// }
|
|
||||||
|
|
||||||
// fn NavStart(cx: Scope) -> Element {
|
|
||||||
// render!(div {})
|
|
||||||
// }
|
|
||||||
|
|
||||||
// fn NavEnd(cx: Scope) -> Element {
|
|
||||||
// render!(div {})
|
|
||||||
// }
|
|
||||||
|
|
||||||
// #[inline_props]
|
|
||||||
// fn MainContainer<'a>(
|
|
||||||
// cx: Scope,
|
|
||||||
// nav: Element<'a>,
|
|
||||||
// body: Element<'a>,
|
|
||||||
// footer: Element<'a>,
|
|
||||||
// ) -> Element {
|
|
||||||
// cx.render(rsx! {
|
|
||||||
// div {
|
|
||||||
// class: "columns is-mobile",
|
|
||||||
// div {
|
|
||||||
// class: "column is-full",
|
|
||||||
// nav,
|
|
||||||
// body,
|
|
||||||
// footer,
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// fn app(cx: Scope) -> Element {
|
|
||||||
// let nav = cx.render(rsx! {
|
|
||||||
// NavContainer {
|
|
||||||
// NavMenu {}
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// let body = cx.render(rsx! {
|
|
||||||
// div {}
|
|
||||||
// });
|
|
||||||
// let footer = cx.render(rsx! {
|
|
||||||
// div {}
|
|
||||||
// });
|
|
||||||
|
|
||||||
// cx.render(rsx! {
|
|
||||||
// MainContainer {
|
|
||||||
// nav: nav,
|
|
||||||
// body: body,
|
|
||||||
// footer: footer,
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// let mut dom = new_dom(app, ());
|
|
||||||
// let _ = dom.rebuild();
|
|
||||||
|
|
||||||
// for _ in 0..40 {
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(0)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(0)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(0)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(1)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(1)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(1)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(2)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(2)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(2)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(3)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(3)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
// dom.handle_message(SchedulerMsg::Immediate(ScopeId(3)));
|
|
||||||
// dom.work_with_deadline(|| false);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
use dioxus_native_core::*;
|
|
||||||
use dioxus_native_core::{
|
use dioxus_native_core::{
|
||||||
node_ref::{AttributeMask, NodeView},
|
node_ref::{AttributeMask, NodeView},
|
||||||
real_dom::RealDom,
|
real_dom::RealDom,
|
||||||
|
@ -7,13 +6,10 @@ use dioxus_native_core::{
|
||||||
NodeMask, SendAnyMap,
|
NodeMask, SendAnyMap,
|
||||||
};
|
};
|
||||||
use dioxus_native_core_macro::{sorted_str_slice, State};
|
use dioxus_native_core_macro::{sorted_str_slice, State};
|
||||||
use std::{
|
use std::sync::{Arc, Mutex};
|
||||||
sync::{Arc, Mutex},
|
|
||||||
time::Duration,
|
|
||||||
};
|
|
||||||
use tokio::time::sleep;
|
use tokio::time::sleep;
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
||||||
pub struct BlablaState {}
|
pub struct BlablaState {}
|
||||||
|
|
||||||
/// Font style are inherited by default if not specified otherwise by some of the supported attributes.
|
/// Font style are inherited by default if not specified otherwise by some of the supported attributes.
|
||||||
|
@ -88,15 +84,15 @@ fn native_core_is_okay() {
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
fn app(cx: Scope) -> Element {
|
fn app(cx: Scope) -> Element {
|
||||||
let colors = use_state(&cx, || vec!["green", "blue", "red"]);
|
let colors = use_state(cx, || vec!["green", "blue", "red"]);
|
||||||
let padding = use_state(&cx, || 10);
|
let padding = use_state(cx, || 10);
|
||||||
|
|
||||||
use_effect(&cx, colors, |colors| async move {
|
use_effect(cx, colors, |colors| async move {
|
||||||
sleep(Duration::from_millis(1000)).await;
|
sleep(Duration::from_millis(1000)).await;
|
||||||
colors.with_mut(|colors| colors.reverse());
|
colors.with_mut(|colors| colors.reverse());
|
||||||
});
|
});
|
||||||
|
|
||||||
use_effect(&cx, padding, |padding| async move {
|
use_effect(cx, padding, |padding| async move {
|
||||||
sleep(Duration::from_millis(10)).await;
|
sleep(Duration::from_millis(10)).await;
|
||||||
padding.with_mut(|padding| {
|
padding.with_mut(|padding| {
|
||||||
if *padding < 65 {
|
if *padding < 65 {
|
||||||
|
@ -107,9 +103,9 @@ fn native_core_is_okay() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
let big = colors[0];
|
let _big = colors[0];
|
||||||
let mid = colors[1];
|
let _mid = colors[1];
|
||||||
let small = colors[2];
|
let _small = colors[2];
|
||||||
|
|
||||||
cx.render(rsx! {
|
cx.render(rsx! {
|
||||||
blabla {}
|
blabla {}
|
||||||
|
@ -128,17 +124,15 @@ fn native_core_is_okay() {
|
||||||
let muts = dom.rebuild();
|
let muts = dom.rebuild();
|
||||||
let (to_update, _diff) = rdom.lock().unwrap().apply_mutations(muts);
|
let (to_update, _diff) = rdom.lock().unwrap().apply_mutations(muts);
|
||||||
|
|
||||||
let ctx = SendAnyMap::new();
|
|
||||||
let ctx = SendAnyMap::new();
|
let ctx = SendAnyMap::new();
|
||||||
rdom.lock().unwrap().update_state(to_update, ctx);
|
rdom.lock().unwrap().update_state(to_update, ctx);
|
||||||
|
|
||||||
for x in 0..10 {
|
for _ in 0..10 {
|
||||||
dom.wait_for_work().await;
|
dom.wait_for_work().await;
|
||||||
|
|
||||||
let mutations = dom.render_immediate();
|
let mutations = dom.render_immediate();
|
||||||
let (to_update, _diff) = rdom.lock().unwrap().apply_mutations(mutations);
|
let (to_update, _diff) = rdom.lock().unwrap().apply_mutations(mutations);
|
||||||
|
|
||||||
let ctx = SendAnyMap::new();
|
|
||||||
let ctx = SendAnyMap::new();
|
let ctx = SendAnyMap::new();
|
||||||
rdom.lock().unwrap().update_state(to_update, ctx);
|
rdom.lock().unwrap().update_state(to_update, ctx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,7 +234,10 @@ pub fn virtual_event_from_websys_event(event: web_sys::Event, target: Element) -
|
||||||
Rc::new(MouseData::from(event))
|
Rc::new(MouseData::from(event))
|
||||||
}
|
}
|
||||||
"drag" | "dragend" | "dragenter" | "dragexit" | "dragleave" | "dragover" | "dragstart"
|
"drag" | "dragend" | "dragenter" | "dragexit" | "dragleave" | "dragover" | "dragstart"
|
||||||
| "drop" => Rc::new(DragData::from(event)),
|
| "drop" => {
|
||||||
|
let mouse = MouseData::from(event);
|
||||||
|
Rc::new(DragData { mouse })
|
||||||
|
}
|
||||||
|
|
||||||
"pointerdown" | "pointermove" | "pointerup" | "pointercancel" | "gotpointercapture"
|
"pointerdown" | "pointermove" | "pointerup" | "pointercancel" | "gotpointercapture"
|
||||||
| "lostpointercapture" | "pointerenter" | "pointerleave" | "pointerover" | "pointerout" => {
|
| "lostpointercapture" | "pointerenter" | "pointerleave" | "pointerover" | "pointerout" => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue