diff --git a/.vscode/settings.json b/.vscode/settings.json
index 8538873..4e81bac 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,9 +1,10 @@
{
"rust-analyzer.check.command": "clippy",
+ "rust-analyzer.check.targets": [
+ "wasm32-unknown-unknown",
+ "x86_64-unknown-linux-gnu"
+ ],
"rust-analyzer.cargo.target": "wasm32-unknown-unknown",
"rust-analyzer.diagnostics.enable": false,
- "rust-analyzer.procMacro.ignored": {
- "leptos_macro": ["component"]
- },
"rust-analyzer.rustfmt.overrideCommand": ["leptosfmt", "--stdin", "--rustfmt"]
}
diff --git a/Cargo.lock b/Cargo.lock
index 00ca23a..7d86910 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -507,7 +507,6 @@ dependencies = [
name = "leptos_animated_for"
version = "0.4.7"
dependencies = [
- "cfg-if",
"futures",
"leptos",
"wasm-bindgen",
diff --git a/Cargo.toml b/Cargo.toml
index 21ace65..89076ea 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,7 +8,6 @@ description = " component utilizing FLIP position transitions for
keywords = ["leptos", "animations", "dom", "web", "wasm"]
[dependencies]
-cfg-if = "1.0.0"
futures = "0.3.30"
leptos = { version = "0.6.13" }
wasm-bindgen = { version = "0.2.92" }
diff --git a/examples/csr/Cargo.lock b/examples/csr/Cargo.lock
index a8a8a96..a5fe42f 100644
--- a/examples/csr/Cargo.lock
+++ b/examples/csr/Cargo.lock
@@ -672,7 +672,6 @@ dependencies = [
name = "leptos_animated_for"
version = "0.4.7"
dependencies = [
- "cfg-if",
"futures",
"leptos",
"wasm-bindgen",
diff --git a/examples/ssr/Cargo.lock b/examples/ssr/Cargo.lock
index 3fcd0fa..6d9f9d9 100644
--- a/examples/ssr/Cargo.lock
+++ b/examples/ssr/Cargo.lock
@@ -1012,7 +1012,6 @@ dependencies = [
name = "leptos_animated_for"
version = "0.4.7"
dependencies = [
- "cfg-if",
"futures",
"leptos",
"wasm-bindgen",
diff --git a/justfile b/justfile
index d87f183..36db240 100644
--- a/justfile
+++ b/justfile
@@ -47,15 +47,15 @@ fmt-check-examples:
# Lints source with Clippy
lint:
- cargo clippy -- -D warnings
+ cargo clippy --lib -- -D warnings
+ cargo clippy --lib --target wasm32-unknown-unknown -- -D warnings
# Lints examples with Clippy
lint-examples:
#!/usr/bin/env sh
- # FIXME: as of Leptos 0.6.9, `#[component]` macro triggers `clippy::empty_docs`
- (cd examples/csr && cargo clippy -- -D warnings -A clippy::empty_docs)
- (cd examples/ssr && cargo clippy --features ssr -- -D warnings -A clippy::empty_docs)
- (cd examples/ssr && cargo clippy --lib --features hydrate -- -D warnings -A clippy::empty_docs)
+ (cd examples/csr && cargo clippy)
+ (cd examples/ssr && cargo clippy --features ssr)
+ (cd examples/ssr && cargo clippy --lib --features hydrate)
ci:
just fmt-check
diff --git a/rust-toolchain.toml b/rust-toolchain.toml
index cce28f0..7969106 100644
--- a/rust-toolchain.toml
+++ b/rust-toolchain.toml
@@ -1,5 +1,5 @@
[toolchain]
channel = "nightly-2024-07-29"
components = ["rustfmt", "clippy"]
-targets = ["wasm32-unknown-unknown"]
+targets = ["wasm32-unknown-unknown", "x86_64-unknown-linux-gnu"]
profile = "minimal"
diff --git a/src/lib.rs b/src/lib.rs
index abb0f92..8b71dad 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,50 +1,52 @@
-cfg_if::cfg_if! {
- if #[cfg(target_arch = "wasm32")] {
- mod animated_el;
- mod animator;
- mod untracked_classes;
- mod utils;
-
- use std::{
- collections::{HashMap, HashSet},
- hash::Hash,
- };
+mod animated_el;
+mod animator;
+mod untracked_classes;
- use leptos::{
- component,
- leptos_dom::Each,
- spawn_local,
- update,
- with,
- IntoView,
- MaybeProp,
- StoredValue,
- View,
- };
- use web_sys::DomRect;
-
- use crate::{
- animator::Animator,
- utils::{
- check_if_moved_and_lock_previous_position,
- extract_el_from_view,
- force_reflow,
- next_tick,
- prepare_leave,
- },
- };
- } else {
- use std::hash::Hash;
-
- use leptos::{
- component,
- leptos_dom::Each,
- IntoView,
- MaybeProp,
- };
- }
+#[cfg(target_arch = "wasm32")]
+mod utils;
+
+#[cfg(target_arch = "wasm32")]
+mod prelude {
+
+ pub use std::{
+ collections::{HashMap, HashSet},
+ hash::Hash,
+ };
+
+ pub use leptos::{
+ component,
+ leptos_dom::Each,
+ spawn_local,
+ update,
+ with,
+ IntoView,
+ MaybeProp,
+ StoredValue,
+ View,
+ };
+ pub use web_sys::DomRect;
+
+ pub use crate::{
+ animator::Animator,
+ utils::{
+ check_if_moved_and_lock_previous_position,
+ extract_el_from_view,
+ force_reflow,
+ next_tick,
+ prepare_leave,
+ },
+ };
+}
+
+#[cfg(not(target_arch = "wasm32"))]
+mod prelude {
+ pub use std::hash::Hash;
+
+ pub use leptos::{component, leptos_dom::Each, IntoView, MaybeProp};
}
+use prelude::*;
+
#[cfg(target_arch = "wasm32")]
fn use_entering_children- (
key_fn: StoredValue,