mirror of
https://github.com/adoyle0/leptos-use.git
synced 2025-01-23 00:59:22 -05:00
Merge remote-tracking branch 'origin/main'
# Conflicts: # CHANGELOG.md
This commit is contained in:
commit
b6529bcb3b
9 changed files with 16 additions and 22 deletions
5
.github/workflows/book.yml
vendored
5
.github/workflows/book.yml
vendored
|
@ -21,8 +21,6 @@ jobs:
|
||||||
profile: minimal
|
profile: minimal
|
||||||
override: true
|
override: true
|
||||||
components: rust-src
|
components: rust-src
|
||||||
- name: Cache
|
|
||||||
uses: Swatinem/rust-cache@v2
|
|
||||||
- name: Install mdbook I
|
- name: Install mdbook I
|
||||||
uses: taiki-e/install-action@v2
|
uses: taiki-e/install-action@v2
|
||||||
with:
|
with:
|
||||||
|
@ -32,6 +30,8 @@ jobs:
|
||||||
cargo binstall -y mdbook-cmdrun
|
cargo binstall -y mdbook-cmdrun
|
||||||
cargo binstall -y trunk@0.17.5
|
cargo binstall -y trunk@0.17.5
|
||||||
rustup target add wasm32-unknown-unknown
|
rustup target add wasm32-unknown-unknown
|
||||||
|
- name: Cache
|
||||||
|
uses: Swatinem/rust-cache@v2
|
||||||
- name: Setup Pages
|
- name: Setup Pages
|
||||||
id: pages
|
id: pages
|
||||||
uses: actions/configure-pages@v3
|
uses: actions/configure-pages@v3
|
||||||
|
@ -46,4 +46,5 @@ jobs:
|
||||||
path: ./docs/book/book
|
path: ./docs/book/book
|
||||||
- name: Deploy book to github pages
|
- name: Deploy book to github pages
|
||||||
id: deployment
|
id: deployment
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
uses: actions/deploy-pages@v2
|
uses: actions/deploy-pages@v2
|
||||||
|
|
|
@ -11,13 +11,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- `use_clipboard`
|
- `use_clipboard`
|
||||||
- `use_timeout_fn`
|
- `use_timeout_fn`
|
||||||
|
|
||||||
## [0.10.1] - 2024-010-31
|
## [0.10.1] - 2024-01-31
|
||||||
|
|
||||||
### Fix 🍕
|
### Fix 🍕
|
||||||
|
|
||||||
- Fixed docs.rs build
|
- Fixed docs.rs build
|
||||||
|
|
||||||
## [0.10.0] - 2024-010-31
|
## [0.10.0] - 2024-01-31
|
||||||
|
|
||||||
### New Functions 🚀
|
### New Functions 🚀
|
||||||
|
|
||||||
|
|
|
@ -208,8 +208,7 @@ macro_rules! impl_from_signal_string {
|
||||||
Self::Dynamic(Signal::derive(|| None))
|
Self::Dynamic(Signal::derive(|| None))
|
||||||
} else {
|
} else {
|
||||||
Self::Dynamic(
|
Self::Dynamic(
|
||||||
create_memo(move |_| document().query_selector(&signal.get()).unwrap_or_default())
|
Signal::derive(move || document().query_selector(&signal.get()).unwrap_or_default()),
|
||||||
.into(),
|
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,7 +216,7 @@ macro_rules! impl_from_signal_string {
|
||||||
fn from(signal: $ty) -> Self {
|
fn from(signal: $ty) -> Self {
|
||||||
cfg_if! { if #[cfg(feature = "ssr")] {
|
cfg_if! { if #[cfg(feature = "ssr")] {
|
||||||
Self::Dynamic(
|
Self::Dynamic(
|
||||||
create_memo(move |_| {
|
Signal::derive(move || {
|
||||||
if let Ok(node_list) = document().query_selector_all(&signal.get()) {
|
if let Ok(node_list) = document().query_selector_all(&signal.get()) {
|
||||||
let mut list = Vec::with_capacity(node_list.length() as usize);
|
let mut list = Vec::with_capacity(node_list.length() as usize);
|
||||||
for i in 0..node_list.length() {
|
for i in 0..node_list.length() {
|
||||||
|
@ -227,8 +227,7 @@ macro_rules! impl_from_signal_string {
|
||||||
} else {
|
} else {
|
||||||
vec![]
|
vec![]
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
.into(),
|
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
let _ = signal;
|
let _ = signal;
|
||||||
|
|
|
@ -13,7 +13,7 @@ macro_rules! use_partial_cmp {
|
||||||
{
|
{
|
||||||
let container = container.into();
|
let container = container.into();
|
||||||
|
|
||||||
create_memo(move |_| {
|
Signal::derive(move || {
|
||||||
container.with(|container| {
|
container.with(|container| {
|
||||||
if container.into_iter().count() == 0 {
|
if container.into_iter().count() == 0 {
|
||||||
return None;
|
return None;
|
||||||
|
@ -34,7 +34,6 @@ macro_rules! use_partial_cmp {
|
||||||
.cloned()
|
.cloned()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.into()
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -264,14 +264,13 @@ impl<K: Eq + Hash + Debug + Clone> UseBreakpointsReturn<K> {
|
||||||
|
|
||||||
let signals: Vec<_> = keys.iter().map(ge.clone()).collect();
|
let signals: Vec<_> = keys.iter().map(ge.clone()).collect();
|
||||||
|
|
||||||
create_memo(move |_| {
|
Signal::derive(move || {
|
||||||
keys.iter()
|
keys.iter()
|
||||||
.cloned()
|
.cloned()
|
||||||
.zip(signals.iter().cloned())
|
.zip(signals.iter().cloned())
|
||||||
.filter_map(|(key, signal)| signal.get().then_some(key))
|
.filter_map(|(key, signal)| signal.get().then_some(key))
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
})
|
})
|
||||||
.into()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ where
|
||||||
let index = {
|
let index = {
|
||||||
let list = list.clone();
|
let list = list.clone();
|
||||||
|
|
||||||
create_memo(move |_| {
|
Signal::derive(move || {
|
||||||
list.with(|list| {
|
list.with(|list| {
|
||||||
let index = get_position(&state.get(), list);
|
let index = get_position(&state.get(), list);
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ where
|
||||||
UseCycleListReturn {
|
UseCycleListReturn {
|
||||||
state,
|
state,
|
||||||
set_state,
|
set_state,
|
||||||
index: index.into(),
|
index,
|
||||||
set_index: set,
|
set_index: set,
|
||||||
next,
|
next,
|
||||||
prev,
|
prev,
|
||||||
|
|
|
@ -108,7 +108,7 @@ where
|
||||||
let (is_loading, set_loading) = create_signal(false);
|
let (is_loading, set_loading) = create_signal(false);
|
||||||
|
|
||||||
let el = el.into();
|
let el = el.into();
|
||||||
let observed_element = create_memo(move |_| {
|
let observed_element = Signal::derive(move || {
|
||||||
let el = el.get();
|
let el = el.get();
|
||||||
|
|
||||||
el.map(|el| {
|
el.map(|el| {
|
||||||
|
|
|
@ -81,12 +81,11 @@ where
|
||||||
{
|
{
|
||||||
let iterable = iterable.into();
|
let iterable = iterable.into();
|
||||||
|
|
||||||
create_memo(move |_| {
|
Signal::derive(move || {
|
||||||
let mut iterable = iterable.get();
|
let mut iterable = iterable.get();
|
||||||
iterable.sort();
|
iterable.sort();
|
||||||
iterable
|
iterable
|
||||||
})
|
})
|
||||||
.into()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Version of [`use_sorted`] with a compare function.
|
/// Version of [`use_sorted`] with a compare function.
|
||||||
|
@ -98,12 +97,11 @@ where
|
||||||
{
|
{
|
||||||
let iterable = iterable.into();
|
let iterable = iterable.into();
|
||||||
|
|
||||||
create_memo(move |_| {
|
Signal::derive(move || {
|
||||||
let mut iterable = iterable.get();
|
let mut iterable = iterable.get();
|
||||||
iterable.sort_by(cmp_fn.clone());
|
iterable.sort_by(cmp_fn.clone());
|
||||||
iterable
|
iterable
|
||||||
})
|
})
|
||||||
.into()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Version of [`use_sorted`] by key.
|
/// Version of [`use_sorted`] by key.
|
||||||
|
@ -116,10 +114,9 @@ where
|
||||||
{
|
{
|
||||||
let iterable = iterable.into();
|
let iterable = iterable.into();
|
||||||
|
|
||||||
create_memo(move |_| {
|
Signal::derive(move || {
|
||||||
let mut iterable = iterable.get();
|
let mut iterable = iterable.get();
|
||||||
iterable.sort_by_key(key_fn.clone());
|
iterable.sort_by_key(key_fn.clone());
|
||||||
iterable
|
iterable
|
||||||
})
|
})
|
||||||
.into()
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue