v0.4.0-alpha

This commit is contained in:
luoxiao 2024-07-28 13:00:01 +08:00
parent 35a6ff309f
commit f15f74168e
7 changed files with 30 additions and 18 deletions

View file

@ -11,10 +11,10 @@ members = [
exclude = ["examples"]
[workspace.dependencies]
thaw = { version = "0.3.1", path = "./thaw" }
thaw_components = { version = "0.1.1", path = "./thaw_components" }
thaw_macro = { version = "0.1.0", path = "./thaw_macro" }
thaw_utils = { version = "0.0.3", path = "./thaw_utils" }
thaw = { version = "0.4.0-alpha", path = "./thaw" }
thaw_components = { version = "0.2.0-alpha", path = "./thaw_components" }
thaw_macro = { version = "0.1.0-alpha", path = "./thaw_macro" }
thaw_utils = { version = "0.1.0-alpha", path = "./thaw_utils" }
leptos = "0.7.0-beta"
leptos_meta = "0.7.0-beta"

View file

@ -1,6 +1,6 @@
[package]
name = "thaw"
version = "0.3.1"
version = "0.4.0-alpha"
edition = "2021"
keywords = ["web", "leptos", "ui", "thaw", "component"]
readme = "../README.md"

View file

@ -1,6 +1,6 @@
[package]
name = "thaw_components"
version = "0.1.1"
version = "0.2.0-alpha"
edition = "2021"
keywords = ["leptos", "thaw", "components"]
readme = "../README.md"

View file

@ -1,7 +1,13 @@
[package]
name = "thaw_macro"
version = "0.1.0"
version = "0.1.0-alpha"
edition = "2021"
keywords = ["leptos", "thaw", "macro"]
readme = "../README.md"
authors = ["luoxiaozero"]
description = "Shared Thaw internal macro"
repository = "https://github.com/thaw-ui/thaw"
license = "MIT"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -1,6 +1,6 @@
[package]
name = "thaw_utils"
version = "0.0.3"
version = "0.1.0-alpha"
edition = "2021"
keywords = ["leptos", "thaw", "utils"]
readme = "../README.md"

View file

@ -1,14 +1,19 @@
use super::get_scroll_parent;
use cfg_if::cfg_if;
use web_sys::HtmlElement;
pub fn scroll_into_view(el: &HtmlElement) {
if let Some(parent) = get_scroll_parent(el) {
let parent_rect = parent.get_bounding_client_rect();
let el_rect = el.get_bounding_client_rect();
if el_rect.y() < parent_rect.y() {
el.scroll_into_view_with_bool(true);
} else if el_rect.y() + el_rect.height() > parent_rect.y() + parent_rect.height() {
el.scroll_into_view_with_bool(false);
cfg_if! { if #[cfg(all(target_arch = "wasm32", any(feature = "csr", feature = "hydrate")))] {
use super::get_scroll_parent;
if let Some(parent) = get_scroll_parent(el) {
let parent_rect = parent.get_bounding_client_rect();
let el_rect = el.get_bounding_client_rect();
if el_rect.y() < parent_rect.y() {
el.scroll_into_view_with_bool(true);
} else if el_rect.y() + el_rect.height() > parent_rect.y() + parent_rect.height() {
el.scroll_into_view_with_bool(false);
}
}
}
} else {
let _ = el;
}}
}

View file

@ -1,9 +1,10 @@
use leptos::{ev, html::Div, prelude::*};
use leptos::{html::Div, prelude::*};
use tachys::reactive_graph::node_ref::NodeRef;
pub fn call_on_click_outside(element: NodeRef<Div>, on_click: Callback<()>) {
#[cfg(any(feature = "csr", feature = "hydrate"))]
{
use leptos::ev;
let handle = window_event_listener(ev::click, move |ev| {
use leptos::wasm_bindgen::__rt::IntoJsResult;
let el = ev.target();