Form CSS style + dev panel (WIP)

This commit is contained in:
Greg Burri 2025-04-15 11:34:18 +02:00
parent 9daa852add
commit f2e0aa3b43
18 changed files with 154 additions and 34 deletions

View file

@ -3,15 +3,18 @@ use web_sys::{Element, HtmlDialogElement};
use crate::{
on_click,
utils::{by_id, selector_and_clone, SelectorExt},
utils::{SelectorExt, by_id, selector_and_clone},
};
/// Show a modal dialog with a copy of the given HTML element as content.
pub async fn show(element_selector: &str) -> bool {
show_and_initialize(element_selector, async |_| Some(()))
.await
.is_some()
}
/// Show a modal dialog with a copy of the given HTML element as content and execute an initilizer
/// to modify the given content.
pub async fn show_and_initialize<T, U>(element_selector: &str, initializer: T) -> Option<U>
where
T: AsyncFn(Element) -> U,
@ -19,6 +22,9 @@ where
show_and_initialize_with_ok(element_selector, initializer, |_, result| result).await
}
/// Show a modal dialog with a copy of the given HTML element as content and execute an initilizer
/// to modify the given content.
/// Call the given function when OK is pressed.
pub async fn show_and_initialize_with_ok<T, V, W, U>(
element_selector: &str,
initializer: T,