diff --git a/README.md b/README.md index 3278eba98..e0926d345 100644 --- a/README.md +++ b/README.md @@ -81,9 +81,9 @@ If you know React, then you already know Dioxus. ## Examples: -| File Navigator (Desktop) | Bluetooth scanner (Desktop) | TodoMVC (All platforms) | Tailwind (Liveview) | -| --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -| [![asd](https://github.com/DioxusLabs/file-explorer-example/raw/master/image.png)](https://github.com/DioxusLabs/file-explorer-example) | [![asd](https://github.com/DioxusLabs/file-explorer-example/raw/master/image.png)](https://github.com/DioxusLabs/file-explorer-example) | [![asd](https://github.com/DioxusLabs/todomvc/raw/master/example.png)](https://github.com/dioxusLabs/todomvc/) | [![asd](https://github.com/DioxusLabs/file-explorer-example/raw/master/image.png)](https://github.com/DioxusLabs/file-explorer-example) | +| File Navigator (Desktop) | WiFi scanner (Desktop) | TodoMVC (All platforms) | Tailwind (Liveview) | +| --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | +| [![asd](https://github.com/DioxusLabs/file-explorer-example/raw/master/image.png)](https://github.com/DioxusLabs/file-explorer-example) | [![Wifi Scanner Demo](https://github.com/DioxusLabs/wifi-scanner/raw/master/demo.png)](https://github.com/DioxusLabs/file-explorer-example) | [![asd](https://github.com/DioxusLabs/todomvc/raw/master/example.png)](https://github.com/dioxusLabs/todomvc/) | [![asd](https://github.com/DioxusLabs/file-explorer-example/raw/master/image.png)](https://github.com/DioxusLabs/file-explorer-example) | See the awesome-dioxus page for a curated list of content in the Dioxus Ecosystem. diff --git a/packages/core/examples/handler_thru_props.rs b/packages/core/examples/handler_thru_props.rs deleted file mode 100644 index cb22bb9d7..000000000 --- a/packages/core/examples/handler_thru_props.rs +++ /dev/null @@ -1,30 +0,0 @@ -#![allow(non_snake_case)] - -use dioxus::prelude::*; -use dioxus_core as dioxus; -use dioxus_core_macro::*; -use dioxus_html as dioxus_elements; - -fn main() { - let _ = VirtualDom::new(App); -} - -fn App(cx: Scope<()>) -> Element { - // - cx.render(rsx!( - div { - Child {} - } - )) -} - -fn Child(cx: Scope<()>) -> Element { - // - cx.render(rsx!( - div { - h1 { - "Hello, World!" - } - } - )) -} diff --git a/packages/core/examples/handlerror.rs b/packages/core/examples/handlerror.rs deleted file mode 100644 index 0de55333e..000000000 --- a/packages/core/examples/handlerror.rs +++ /dev/null @@ -1,17 +0,0 @@ -//! Handling errors and early aborts -//! -//! -//! -//! - -use dioxus_core::prelude::*; -use thiserror::Error; - -fn main() { - - /* - If a component returns None, do we leave it the same way it was before? - We spent all this time wiping the component - - */ -} diff --git a/packages/core/examples/hooks.rs b/packages/core/examples/hooks.rs deleted file mode 100644 index 131aae0e6..000000000 --- a/packages/core/examples/hooks.rs +++ /dev/null @@ -1,6 +0,0 @@ -use dioxus::prelude::*; -use dioxus_core as dioxus; -use dioxus_core_macro::*; -use dioxus_html as dioxus_elements; - -fn main() {} diff --git a/packages/core/examples/props_expand.rs b/packages/core/examples/props_expand.rs deleted file mode 100644 index 29d41129e..000000000 --- a/packages/core/examples/props_expand.rs +++ /dev/null @@ -1,9 +0,0 @@ -use dioxus_core as dioxus; -use dioxus_core_macro::*; - -fn main() {} - -#[derive(Props)] -struct ChildProps<'a> { - name: &'a str, -} diff --git a/packages/core/examples/rows.rs b/packages/core/examples/rows.rs deleted file mode 100644 index f0b8e57ec..000000000 --- a/packages/core/examples/rows.rs +++ /dev/null @@ -1,120 +0,0 @@ -#![allow(non_snake_case, non_upper_case_globals)] -//! This benchmark tests just the overhead of Dioxus itself. -//! -//! For the JS Framework Benchmark, both the framework and the browser is benchmarked together. Dioxus prepares changes -//! to be made, but the change application phase will be just as performant as the vanilla wasm_bindgen code. In essence, -//! we are measuring the overhead of Dioxus, not the performance of the "apply" phase. -//! -//! On my MBP 2019: -//! - Dioxus takes 3ms to create 1_000 rows -//! - Dioxus takes 30ms to create 10_000 rows -//! -//! As pure "overhead", these are amazing good numbers, mostly slowed down by hitting the global allocator. -//! These numbers don't represent Dioxus with the heuristic engine installed, so I assume it'll be even faster. - -use criterion::{criterion_group, criterion_main, Criterion}; -use dioxus_core as dioxus; -use dioxus_core::prelude::*; -use dioxus_core_macro::*; -use dioxus_html as dioxus_elements; -use rand::prelude::*; - -fn main() { - static App: Component = |cx| { - let mut rng = SmallRng::from_entropy(); - let rows = (0..10_000_usize).map(|f| { - let label = Label::new(&mut rng); - rsx! { - Row { - row_id: f, - label: label - } - } - }); - cx.render(rsx! { - table { - tbody { - {rows} - } - } - }) - }; - - let mut dom = VirtualDom::new(App); - let g = dom.rebuild(); - assert!(g.edits.len() > 1); -} - -#[derive(PartialEq, Props)] -struct RowProps { - row_id: usize, - label: Label, -} -fn Row(cx: Scope) -> Element { - let [adj, col, noun] = cx.props.label.0; - cx.render(rsx! { - tr { - td { class:"col-md-1", "{cx.props.row_id}" } - td { class:"col-md-1", onclick: move |_| { /* run onselect */ } - a { class: "lbl", "{adj}" "{col}" "{noun}" } - } - td { class: "col-md-1" - a { class: "remove", onclick: move |_| {/* remove */} - span { class: "glyphicon glyphicon-remove remove" aria_hidden: "true" } - } - } - td { class: "col-md-6" } - } - }) -} - -#[derive(PartialEq)] -struct Label([&'static str; 3]); - -impl Label { - fn new(rng: &mut SmallRng) -> Self { - Label([ - ADJECTIVES.choose(rng).unwrap(), - COLOURS.choose(rng).unwrap(), - NOUNS.choose(rng).unwrap(), - ]) - } -} - -static ADJECTIVES: &[&str] = &[ - "pretty", - "large", - "big", - "small", - "tall", - "short", - "long", - "handsome", - "plain", - "quaint", - "clean", - "elegant", - "easy", - "angry", - "crazy", - "helpful", - "mushy", - "odd", - "unsightly", - "adorable", - "important", - "inexpensive", - "cheap", - "expensive", - "fancy", -]; - -static COLOURS: &[&str] = &[ - "red", "yellow", "blue", "green", "pink", "brown", "purple", "brown", "white", "black", - "orange", -]; - -static NOUNS: &[&str] = &[ - "table", "chair", "house", "bbq", "desk", "car", "pony", "cookie", "sandwich", "burger", - "pizza", "mouse", "keyboard", -]; diff --git a/packages/core/examples/works.rs b/packages/core/examples/works.rs index d8e171042..f521dcc42 100644 --- a/packages/core/examples/works.rs +++ b/packages/core/examples/works.rs @@ -52,12 +52,3 @@ fn great_grandchild<'a>(cx: Scope<'a, Grandchild>) -> Element<'a> { } }) } - -/* -can we implement memoization as a wrapper or something? Like we just intercept the -render function? - - - - -*/