Fix the router and stub out a number of crates to get compiling
This commit is contained in:
226 files changed
+1057
-1482
No files matched your search
@@ -1,8 +1,8 @@
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let state = use_state(cx, || 0);
|
||||
use_future(cx, (), |_| {
|
||||
fn app() -> Element {
|
||||
let state = use_state(|| 0);
|
||||
use_future((), |_| {
|
||||
to_owned![state];
|
||||
async move {
|
||||
loop {
|
||||
|
||||
@@ -28,10 +28,10 @@ pub fn main() {
|
||||
check_app_exits(app);
|
||||
}
|
||||
|
||||
fn mock_event(cx: &ScopeState, id: &'static str, value: &'static str) {
|
||||
fn mock_event(id: &'static str, value: &'static str) {
|
||||
let eval_provider = use_eval(cx).clone();
|
||||
|
||||
use_effect(cx, (), move |_| async move {
|
||||
use_effect(move |_| async move {
|
||||
tokio::time::sleep(std::time::Duration::from_millis(100)).await;
|
||||
let js = format!(
|
||||
r#"
|
||||
@@ -50,13 +50,12 @@ fn mock_event(cx: &ScopeState, id: &'static str, value: &'static str) {
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
fn app(cx: Scope) -> Element {
|
||||
fn app() -> Element {
|
||||
let desktop_context: DesktopContext = cx.consume_context().unwrap();
|
||||
let received_events = use_state(cx, || 0);
|
||||
let received_events = use_state(|| 0);
|
||||
|
||||
// button
|
||||
mock_event(
|
||||
cx,
|
||||
"button",
|
||||
r#"new MouseEvent("click", {
|
||||
view: window,
|
||||
@@ -67,7 +66,6 @@ fn app(cx: Scope) -> Element {
|
||||
);
|
||||
// mouse_move_div
|
||||
mock_event(
|
||||
cx,
|
||||
"mouse_move_div",
|
||||
r#"new MouseEvent("mousemove", {
|
||||
view: window,
|
||||
@@ -78,7 +76,6 @@ fn app(cx: Scope) -> Element {
|
||||
);
|
||||
// mouse_click_div
|
||||
mock_event(
|
||||
cx,
|
||||
"mouse_click_div",
|
||||
r#"new MouseEvent("click", {
|
||||
view: window,
|
||||
@@ -90,7 +87,6 @@ fn app(cx: Scope) -> Element {
|
||||
);
|
||||
// mouse_dblclick_div
|
||||
mock_event(
|
||||
cx,
|
||||
"mouse_dblclick_div",
|
||||
r#"new MouseEvent("dblclick", {
|
||||
view: window,
|
||||
@@ -102,7 +98,6 @@ fn app(cx: Scope) -> Element {
|
||||
);
|
||||
// mouse_down_div
|
||||
mock_event(
|
||||
cx,
|
||||
"mouse_down_div",
|
||||
r#"new MouseEvent("mousedown", {
|
||||
view: window,
|
||||
@@ -114,7 +109,6 @@ fn app(cx: Scope) -> Element {
|
||||
);
|
||||
// mouse_up_div
|
||||
mock_event(
|
||||
cx,
|
||||
"mouse_up_div",
|
||||
r#"new MouseEvent("mouseup", {
|
||||
view: window,
|
||||
@@ -126,7 +120,6 @@ fn app(cx: Scope) -> Element {
|
||||
);
|
||||
// wheel_div
|
||||
mock_event(
|
||||
cx,
|
||||
"wheel_div",
|
||||
r#"new WheelEvent("wheel", {
|
||||
view: window,
|
||||
@@ -139,7 +132,6 @@ fn app(cx: Scope) -> Element {
|
||||
);
|
||||
// key_down_div
|
||||
mock_event(
|
||||
cx,
|
||||
"key_down_div",
|
||||
r#"new KeyboardEvent("keydown", {
|
||||
key: "a",
|
||||
@@ -161,7 +153,6 @@ fn app(cx: Scope) -> Element {
|
||||
);
|
||||
// key_up_div
|
||||
mock_event(
|
||||
cx,
|
||||
"key_up_div",
|
||||
r#"new KeyboardEvent("keyup", {
|
||||
key: "a",
|
||||
@@ -183,7 +174,6 @@ fn app(cx: Scope) -> Element {
|
||||
);
|
||||
// key_press_div
|
||||
mock_event(
|
||||
cx,
|
||||
"key_press_div",
|
||||
r#"new KeyboardEvent("keypress", {
|
||||
key: "a",
|
||||
@@ -205,13 +195,11 @@ fn app(cx: Scope) -> Element {
|
||||
);
|
||||
// focus_in_div
|
||||
mock_event(
|
||||
cx,
|
||||
"focus_in_div",
|
||||
r#"new FocusEvent("focusin", {bubbles: true})"#,
|
||||
);
|
||||
// focus_out_div
|
||||
mock_event(
|
||||
cx,
|
||||
"focus_out_div",
|
||||
r#"new FocusEvent("focusout",{bubbles: true})"#,
|
||||
);
|
||||
|
||||
@@ -26,11 +26,11 @@ fn main() {
|
||||
check_app_exits(check_html_renders);
|
||||
}
|
||||
|
||||
fn use_inner_html(cx: &ScopeState, id: &'static str) -> Option<String> {
|
||||
fn use_inner_html(d: &'static str) -> Option<String> {
|
||||
let eval_provider = use_eval(cx);
|
||||
|
||||
let value: &UseRef<Option<String>> = use_ref(cx, || None);
|
||||
use_effect(cx, (), |_| {
|
||||
let value: &UseRef<Option<String>> = use_ref(|| None);
|
||||
use_effect((), |_| {
|
||||
to_owned![value, eval_provider];
|
||||
async move {
|
||||
tokio::time::sleep(std::time::Duration::from_millis(100)).await;
|
||||
@@ -51,8 +51,8 @@ fn use_inner_html(cx: &ScopeState, id: &'static str) -> Option<String> {
|
||||
|
||||
const EXPECTED_HTML: &str = r#"<div id="5" style="width: 100px; height: 100px; color: rgb(0, 0, 0);"><input type="checkbox"><h1>text</h1><div><p>hello world</p></div></div>"#;
|
||||
|
||||
fn check_html_renders(cx: Scope) -> Element {
|
||||
let inner_html = use_inner_html(cx, "main_div");
|
||||
fn check_html_renders() -> Element {
|
||||
let inner_html = use_inner_html("main_div");
|
||||
|
||||
let desktop_context: DesktopContext = cx.consume_context().unwrap();
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ impl EditQueue {
|
||||
// }
|
||||
|
||||
// pub fn add_template(
|
||||
// template: &Template<'static>,
|
||||
// template: &Template,
|
||||
// channel: &mut Channel,
|
||||
// templates: &mut FxHashMap<String, u16>,
|
||||
// max_template_count: &AtomicU16,
|
||||
|
||||
@@ -6,7 +6,7 @@ use tao::{event::Event, event_loop::EventLoopWindowTarget};
|
||||
use wry::RequestAsyncResponder;
|
||||
|
||||
// /// Get an imperative handle to the current window
|
||||
// pub fn use_window(cx: &ScopeState) -> &DesktopContext {
|
||||
// pub fn use_window() -> &DesktopContext {
|
||||
// cx.use_hook(|| cx.consume_context::<DesktopContext>())
|
||||
// .as_ref()
|
||||
// .unwrap()
|
||||
@@ -14,7 +14,7 @@ use wry::RequestAsyncResponder;
|
||||
|
||||
// /// Get a closure that executes any JavaScript in the WebView context.
|
||||
// pub fn use_wry_event_handler(
|
||||
// cx: &ScopeState,
|
||||
// ,
|
||||
// handler: impl FnMut(&Event<UserWindowEvent>, &EventLoopWindowTarget<UserWindowEvent>) + 'static,
|
||||
// ) -> &WryEventHandler {
|
||||
// cx.use_hook(move || {
|
||||
@@ -34,7 +34,7 @@ use wry::RequestAsyncResponder;
|
||||
// /// The callback takes a path as requested by the web view, and it should return `Some(response)`
|
||||
// /// if you want to load the asset, and `None` if you want to fallback on the default behavior.
|
||||
// pub fn use_asset_handler(
|
||||
// cx: &ScopeState,
|
||||
// ,
|
||||
// name: &str,
|
||||
// handler: impl Fn(AssetRequest, RequestAsyncResponder) + 'static,
|
||||
// ) {
|
||||
@@ -59,7 +59,7 @@ use wry::RequestAsyncResponder;
|
||||
|
||||
// /// Get a closure that executes any JavaScript in the WebView context.
|
||||
// pub fn use_global_shortcut(
|
||||
// cx: &ScopeState,
|
||||
// ,
|
||||
// accelerator: impl IntoAccelerator,
|
||||
// handler: impl FnMut() + 'static,
|
||||
// ) -> &Result<ShortcutHandle, ShortcutRegistryError> {
|
||||
|
||||
@@ -17,7 +17,7 @@ use tao::event::{Event, StartCause, WindowEvent};
|
||||
/// dioxus_desktop::launch(app);
|
||||
/// }
|
||||
///
|
||||
/// fn app(cx: Scope) -> Element {
|
||||
/// fn app() -> Element {
|
||||
/// cx.render(rsx!{
|
||||
/// h1 {"hello world!"}
|
||||
/// })
|
||||
@@ -41,7 +41,7 @@ pub fn launch(root: Component) {
|
||||
/// dioxus_desktop::launch_cfg(app, Config::default().with_window(WindowBuilder::new().with_title("My App")));
|
||||
/// }
|
||||
///
|
||||
/// fn app(cx: Scope) -> Element {
|
||||
/// fn app() -> Element {
|
||||
/// cx.render(rsx!{
|
||||
/// h1 {"hello world!"}
|
||||
/// })
|
||||
|
||||
@@ -34,7 +34,7 @@ fn main() {
|
||||
dioxus_desktop::launch(app);
|
||||
}
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
fn app() -> Element {
|
||||
cx.render(rsx!{
|
||||
div {
|
||||
"hello world!"
|
||||
|
||||
Reference in new issue
Block a user