refactor: leptos_dom library

This commit is contained in:
luoxiao 2023-10-10 15:48:51 +08:00
parent ed2501d2d2
commit c6d7a77eaa
7 changed files with 33 additions and 13 deletions

View file

@ -15,7 +15,6 @@ license = "MIT"
[dependencies]
leptos = { version = "0.5.0", features = ["csr"] }
web-sys = { version = "0.3.62", features = ["DomRect"] }
leptos_dom = { version = "0.5.0" }
wasm-bindgen = "0.2.85"
icondata = { version = "0.0.7", features = [
"AiCloseOutlined",

View file

@ -1,15 +1,32 @@
use crate::components::{Demo, DemoCode};
use leptos::*;
use melt_ui::*;
use prisms::highlight_str;
#[component]
pub fn ColorPickerPage() -> impl IntoView {
let value = create_rw_signal(RGBA::default());
view! {
<div style="width: 896px; margin: 0 auto;">
<h1>"Color Picker"</h1>
<Demo>
<ColorPicker/>
<DemoCode slot>""</DemoCode>
<ColorPicker value/>
<DemoCode
slot
html=highlight_str!(
r#"
let value = RGBA::default();
view! {
<ColorPicker value/>
}
"#,
"rust"
)
>
""
</DemoCode>
</Demo>
</div>
}

View file

@ -10,16 +10,20 @@ pub fn InputPage() -> impl IntoView {
<div style="width: 896px; margin: 0 auto;">
<h1>"Input"</h1>
<Demo>
<Space vertical=true>
<Input value/>
<Input value variant=InputVariant::PASSWORD/>
</Space>
<DemoCode
slot
html=highlight_str!(
r#"
let value = create_rw_signal(String::from("o"));
view! {
<Input value/>
<Input value variant=InputVariant::PASSWORD />
}
"#,
"rust"
)

View file

@ -1,5 +1,5 @@
use leptos::*;
use crate::utils::mount_style::mount_style;
use leptos::*;
#[component]
pub fn Code(children: Children) -> impl IntoView {

View file

@ -2,8 +2,8 @@ mod color;
use crate::{mount_style, teleport::Teleport, utils::maybe_rw_signal::MaybeRwSignal};
pub use color::*;
use leptos::leptos_dom::helpers::WindowListenerHandle;
use leptos::*;
use leptos_dom::helpers::WindowListenerHandle;
use wasm_bindgen::__rt::IntoJsResult;
#[component]

View file

@ -17,7 +17,7 @@ pub fn show_toast(options: ToastOptions) {
#[cfg(all(target_arch = "wasm32"))]
{
use leptos_dom::Mountable;
use leptos::leptos_dom::Mountable;
let node = node.get_mountable_node();
parent.append_child(&node).unwrap();
set_timeout(

View file

@ -15,7 +15,7 @@ pub fn Teleport(#[prop(optional)] to: Option<&'static str>, children: Children)
#[cfg(all(target_arch = "wasm32"))]
{
use leptos_dom::Mountable;
use leptos::leptos_dom::Mountable;
let node = children().into_view();
let node = node.get_mountable_node();
parent.append_child(&node).unwrap();