Fix cargo check on examples
This commit is contained in:
42 files changed
+95
-145
No files matched your search
@@ -1,5 +1,4 @@
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_html::{FocusData, KeyboardData, MouseData, WheelData};
|
||||
use std::{fmt::Debug, rc::Rc};
|
||||
|
||||
fn main() {
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
use dioxus::dioxus_core::RenderReturn;
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_tui::DioxusElementToNodeId;
|
||||
use dioxus_tui::Query;
|
||||
use dioxus_tui::Size;
|
||||
|
||||
fn main() {
|
||||
dioxus_tui::launch(app);
|
||||
}
|
||||
|
||||
fn app() -> Element {
|
||||
let mut hue = use_signal(|| 0.0);
|
||||
let mut brightness = use_signal(|| 0.0);
|
||||
let tui_query: Query = consume_context();
|
||||
let mapping: DioxusElementToNodeId = consume_context();
|
||||
|
||||
// disable templates so that every node has an id and can be queried
|
||||
rsx! {
|
||||
div {
|
||||
width: "100%",
|
||||
background_color: "hsl({hue}, 70%, {brightness}%)",
|
||||
onmousemove: move |evt| {
|
||||
todo!()
|
||||
// if let RenderReturn::Ready(node) = root_node() {
|
||||
// if let Some(id) = node.root_ids.borrow().first().cloned() {
|
||||
// let node = tui_query.get(mapping.get_node_id(id).unwrap());
|
||||
// let Size { width, height } = node.size().unwrap();
|
||||
// let pos = evt.inner().element_coordinates();
|
||||
// hue.set((pos.x as f32 / width as f32) * 255.0);
|
||||
// brightness.set((pos.y as f32 / height as f32) * 100.0);
|
||||
// }
|
||||
// }
|
||||
},
|
||||
"hsl({hue}, 70%, {brightness}%)"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ fn app() -> Element {
|
||||
let mut buttons = use_signal(|| "".to_string());
|
||||
let mut modifiers = use_signal(|| "".to_string());
|
||||
|
||||
let mut update_data = move |event: Event<MouseData>| {
|
||||
let update_data = move |event: Event<MouseData>| {
|
||||
page_coordinates.set(format!("{:?}", event.page_coordinates()));
|
||||
element_coordinates.set(format!("{:?}", event.element_coordinates()));
|
||||
|
||||
|
||||
@@ -5,12 +5,19 @@ use dioxus_tui::{Config, TuiContext};
|
||||
fn main() {
|
||||
for size in 1..=20usize {
|
||||
for _ in 0..10 {
|
||||
todo!()
|
||||
// dioxus_tui::launch_cfg(app, vec![size], Config::default().with_headless())
|
||||
let dom = VirtualDom::new(app).with_root_context(size);
|
||||
dioxus_tui::launch_vdom_cfg(dom, Config::default().with_headless())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn app() -> Element {
|
||||
let size = use_context::<usize>();
|
||||
rsx! {
|
||||
div { width: "100%", height: "100%", Grid { size } }
|
||||
}
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn Box(x: usize, y: usize, hue: f32, alpha: f32) -> Element {
|
||||
let count = use_signal(|| 0);
|
||||
@@ -87,13 +94,3 @@ fn Grid(size: usize) -> Element {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn app(props: usize) -> Element {
|
||||
rsx! {
|
||||
div{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
Grid{ size: props }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,10 @@ pub fn launch(app: fn() -> Element) {
|
||||
}
|
||||
|
||||
pub fn launch_cfg(app: fn() -> Element, cfg: Config) {
|
||||
launch_vdom_cfg(VirtualDom::new(app), cfg)
|
||||
}
|
||||
|
||||
pub fn launch_vdom_cfg(vdom: VirtualDom, cfg: Config) {
|
||||
dioxus_html::set_event_converter(Box::new(events::SerializedHtmlEventConverter));
|
||||
|
||||
render(cfg, |rdom, taffy, event_tx| {
|
||||
@@ -34,7 +38,7 @@ pub fn launch_cfg(app: fn() -> Element, cfg: Config) {
|
||||
DioxusState::create(&mut rdom)
|
||||
};
|
||||
let dioxus_state = Rc::new(RwLock::new(dioxus_state));
|
||||
let mut vdom = VirtualDom::new(app)
|
||||
let vdom = vdom
|
||||
.with_root_context(TuiContext::new(event_tx))
|
||||
.with_root_context(Query::new(rdom.clone(), taffy.clone()))
|
||||
.with_root_context(DioxusElementToNodeId {
|
||||
|
||||
@@ -33,7 +33,7 @@ fn key_down() {
|
||||
dioxus_tui::launch_cfg(app, dioxus_tui::Config::new().with_headless());
|
||||
|
||||
fn app() -> Element {
|
||||
let mut render_count = use_signal(|| 0);
|
||||
let render_count = use_signal(|| 0);
|
||||
let mut render_count_handle = render_count.clone();
|
||||
let tui_ctx: TuiContext = consume_context();
|
||||
|
||||
@@ -75,7 +75,7 @@ fn mouse_down() {
|
||||
dioxus_tui::launch_cfg(app, dioxus_tui::Config::new().with_headless());
|
||||
|
||||
fn app() -> Element {
|
||||
let mut render_count = use_signal(|| 0);
|
||||
let render_count = use_signal(|| 0);
|
||||
let tui_ctx: TuiContext = consume_context();
|
||||
let mut render_count_handle = render_count.clone();
|
||||
spawn(async move {
|
||||
@@ -111,7 +111,7 @@ fn mouse_up() {
|
||||
dioxus_tui::launch_cfg(app, dioxus_tui::Config::new().with_headless());
|
||||
|
||||
fn app() -> Element {
|
||||
let mut render_count = use_signal(|| 0);
|
||||
let render_count = use_signal(|| 0);
|
||||
let tui_ctx: TuiContext = consume_context();
|
||||
let mut render_count_handle = render_count.clone();
|
||||
spawn(async move {
|
||||
@@ -150,7 +150,7 @@ fn mouse_enter() {
|
||||
dioxus_tui::launch_cfg(app, dioxus_tui::Config::new().with_headless());
|
||||
|
||||
fn app() -> Element {
|
||||
let mut render_count = use_signal(|| 0);
|
||||
let render_count = use_signal(|| 0);
|
||||
let mut render_count_handle = render_count.clone();
|
||||
let tui_ctx: TuiContext = consume_context();
|
||||
spawn(async move {
|
||||
@@ -189,7 +189,7 @@ fn mouse_exit() {
|
||||
dioxus_tui::launch_cfg(app, dioxus_tui::Config::new().with_headless());
|
||||
|
||||
fn app() -> Element {
|
||||
let mut render_count = use_signal(|| 0);
|
||||
let render_count = use_signal(|| 0);
|
||||
let tui_ctx: TuiContext = consume_context();
|
||||
let mut render_count_handle = render_count.clone();
|
||||
spawn(async move {
|
||||
@@ -228,7 +228,7 @@ fn mouse_move() {
|
||||
dioxus_tui::launch_cfg(app, dioxus_tui::Config::new().with_headless());
|
||||
|
||||
fn app() -> Element {
|
||||
let mut render_count = use_signal(|| 0);
|
||||
let render_count = use_signal(|| 0);
|
||||
let tui_ctx: TuiContext = consume_context();
|
||||
let mut render_count_handle = render_count.clone();
|
||||
spawn(async move {
|
||||
@@ -267,7 +267,7 @@ fn wheel() {
|
||||
dioxus_tui::launch_cfg(app, dioxus_tui::Config::new().with_headless());
|
||||
|
||||
fn app() -> Element {
|
||||
let mut render_count = use_signal(|| 0);
|
||||
let render_count = use_signal(|| 0);
|
||||
let tui_ctx: TuiContext = consume_context();
|
||||
let mut render_count_handle = render_count.clone();
|
||||
spawn(async move {
|
||||
@@ -307,7 +307,7 @@ fn click() {
|
||||
dioxus_tui::launch_cfg(app, dioxus_tui::Config::new().with_headless());
|
||||
|
||||
fn app() -> Element {
|
||||
let mut render_count = use_signal(|| 0);
|
||||
let render_count = use_signal(|| 0);
|
||||
let tui_ctx: TuiContext = consume_context();
|
||||
let mut render_count_handle = render_count.clone();
|
||||
spawn(async move {
|
||||
@@ -346,7 +346,7 @@ fn context_menu() {
|
||||
dioxus_tui::launch_cfg(app, dioxus_tui::Config::new().with_headless());
|
||||
|
||||
fn app() -> Element {
|
||||
let mut render_count = use_signal(|| 0);
|
||||
let render_count = use_signal(|| 0);
|
||||
let tui_ctx: TuiContext = consume_context();
|
||||
let mut render_count_handle = render_count.clone();
|
||||
spawn(async move {
|
||||
|
||||
Reference in new issue
Block a user