mirror of
https://github.com/adoyle0/thaw.git
synced 2025-01-22 22:09:22 -05:00
v0.4.0-alpha
This commit is contained in:
parent
35a6ff309f
commit
f15f74168e
7 changed files with 30 additions and 18 deletions
|
@ -11,10 +11,10 @@ members = [
|
||||||
exclude = ["examples"]
|
exclude = ["examples"]
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
thaw = { version = "0.3.1", path = "./thaw" }
|
thaw = { version = "0.4.0-alpha", path = "./thaw" }
|
||||||
thaw_components = { version = "0.1.1", path = "./thaw_components" }
|
thaw_components = { version = "0.2.0-alpha", path = "./thaw_components" }
|
||||||
thaw_macro = { version = "0.1.0", path = "./thaw_macro" }
|
thaw_macro = { version = "0.1.0-alpha", path = "./thaw_macro" }
|
||||||
thaw_utils = { version = "0.0.3", path = "./thaw_utils" }
|
thaw_utils = { version = "0.1.0-alpha", path = "./thaw_utils" }
|
||||||
|
|
||||||
leptos = "0.7.0-beta"
|
leptos = "0.7.0-beta"
|
||||||
leptos_meta = "0.7.0-beta"
|
leptos_meta = "0.7.0-beta"
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "thaw"
|
name = "thaw"
|
||||||
version = "0.3.1"
|
version = "0.4.0-alpha"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
keywords = ["web", "leptos", "ui", "thaw", "component"]
|
keywords = ["web", "leptos", "ui", "thaw", "component"]
|
||||||
readme = "../README.md"
|
readme = "../README.md"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "thaw_components"
|
name = "thaw_components"
|
||||||
version = "0.1.1"
|
version = "0.2.0-alpha"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
keywords = ["leptos", "thaw", "components"]
|
keywords = ["leptos", "thaw", "components"]
|
||||||
readme = "../README.md"
|
readme = "../README.md"
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
[package]
|
[package]
|
||||||
name = "thaw_macro"
|
name = "thaw_macro"
|
||||||
version = "0.1.0"
|
version = "0.1.0-alpha"
|
||||||
edition = "2021"
|
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
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "thaw_utils"
|
name = "thaw_utils"
|
||||||
version = "0.0.3"
|
version = "0.1.0-alpha"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
keywords = ["leptos", "thaw", "utils"]
|
keywords = ["leptos", "thaw", "utils"]
|
||||||
readme = "../README.md"
|
readme = "../README.md"
|
||||||
|
|
|
@ -1,14 +1,19 @@
|
||||||
use super::get_scroll_parent;
|
use cfg_if::cfg_if;
|
||||||
use web_sys::HtmlElement;
|
use web_sys::HtmlElement;
|
||||||
|
|
||||||
pub fn scroll_into_view(el: &HtmlElement) {
|
pub fn scroll_into_view(el: &HtmlElement) {
|
||||||
if let Some(parent) = get_scroll_parent(el) {
|
cfg_if! { if #[cfg(all(target_arch = "wasm32", any(feature = "csr", feature = "hydrate")))] {
|
||||||
let parent_rect = parent.get_bounding_client_rect();
|
use super::get_scroll_parent;
|
||||||
let el_rect = el.get_bounding_client_rect();
|
if let Some(parent) = get_scroll_parent(el) {
|
||||||
if el_rect.y() < parent_rect.y() {
|
let parent_rect = parent.get_bounding_client_rect();
|
||||||
el.scroll_into_view_with_bool(true);
|
let el_rect = el.get_bounding_client_rect();
|
||||||
} else if el_rect.y() + el_rect.height() > parent_rect.y() + parent_rect.height() {
|
if el_rect.y() < parent_rect.y() {
|
||||||
el.scroll_into_view_with_bool(false);
|
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;
|
||||||
|
}}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
use leptos::{ev, html::Div, prelude::*};
|
use leptos::{html::Div, prelude::*};
|
||||||
use tachys::reactive_graph::node_ref::NodeRef;
|
use tachys::reactive_graph::node_ref::NodeRef;
|
||||||
|
|
||||||
pub fn call_on_click_outside(element: NodeRef<Div>, on_click: Callback<()>) {
|
pub fn call_on_click_outside(element: NodeRef<Div>, on_click: Callback<()>) {
|
||||||
#[cfg(any(feature = "csr", feature = "hydrate"))]
|
#[cfg(any(feature = "csr", feature = "hydrate"))]
|
||||||
{
|
{
|
||||||
|
use leptos::ev;
|
||||||
let handle = window_event_listener(ev::click, move |ev| {
|
let handle = window_event_listener(ev::click, move |ev| {
|
||||||
use leptos::wasm_bindgen::__rt::IntoJsResult;
|
use leptos::wasm_bindgen::__rt::IntoJsResult;
|
||||||
let el = ev.target();
|
let el = ev.target();
|
||||||
|
|
Loading…
Add table
Reference in a new issue