mirror of
https://github.com/leptos-rs/leptos.git
synced 2025-12-27 07:34:35 -05:00
chore: publish stores (#3110)
This commit is contained in:
@@ -3,7 +3,6 @@ use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use chrono::{Local, NaiveDate};
|
||||
use leptos::prelude::*;
|
||||
use reactive_stores::{Field, Patch, Store};
|
||||
use reactive_stores_macro::{Patch, Store};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
// ID starts higher than 0 because we have a few starting todos by default
|
||||
|
||||
@@ -52,10 +52,22 @@ axum = ["server_fn_macro/axum"]
|
||||
[package.metadata.cargo-all-features]
|
||||
denylist = ["nightly", "tracing", "trace-component-props"]
|
||||
skip_feature_sets = [
|
||||
["csr", "hydrate"],
|
||||
["hydrate", "csr"],
|
||||
["hydrate", "ssr"],
|
||||
["actix", "axum"]
|
||||
[
|
||||
"csr",
|
||||
"hydrate",
|
||||
],
|
||||
[
|
||||
"hydrate",
|
||||
"csr",
|
||||
],
|
||||
[
|
||||
"hydrate",
|
||||
"ssr",
|
||||
],
|
||||
[
|
||||
"actix",
|
||||
"axum",
|
||||
],
|
||||
]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
[package]
|
||||
name = "reactive_stores"
|
||||
version = "0.1.0-gamma3"
|
||||
authors = ["Greg Johnston"]
|
||||
license = "MIT"
|
||||
readme = "../README.md"
|
||||
repository = "https://github.com/leptos-rs/leptos"
|
||||
description = "Stores for holding deeply-nested reactive state while maintaining fine-grained reactive tracking."
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
@@ -11,10 +16,10 @@ or_poisoned = { workspace = true }
|
||||
paste = "1.0"
|
||||
reactive_graph = { workspace = true }
|
||||
rustc-hash = "2.0"
|
||||
reactive_stores_macro = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { version = "1.39", features = ["rt-multi-thread", "macros"] }
|
||||
tokio-test = { version = "0.4.4" }
|
||||
any_spawner = { workspace = true, features = ["futures-executor", "tokio"] }
|
||||
reactive_stores_macro = { workspace = true }
|
||||
reactive_graph = { workspace = true, features = ["effects"] }
|
||||
|
||||
15
reactive_stores/README.md
Normal file
15
reactive_stores/README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Stores
|
||||
|
||||
Stores are a data structure for nested reactivity.
|
||||
|
||||
The [`reactive_graph`](https://crates.io/crates/reactive_graph) crate provides primitives for fine-grained reactivity
|
||||
via signals, memos, and effects.
|
||||
|
||||
This crate extends that reactivity to support reactive access to nested dested, without the need to create nested signals.
|
||||
|
||||
Using the `#[derive(Store)]` macro on a struct creates a series of getters that allow accessing each field. Individual fields
|
||||
can then be read as if they were signals. Changes to parents will notify their children, but changing one sibling field will
|
||||
not notify any of the others, nor will it require diffing those sibling fields (unlike earlier solutions using memoized “slices”).
|
||||
|
||||
This is published for use with the Leptos framework but can be used in any scenario where `reactive_graph` is being used
|
||||
for reactivity.
|
||||
@@ -10,6 +10,7 @@ use reactive_graph::{
|
||||
Write,
|
||||
},
|
||||
};
|
||||
pub use reactive_stores_macro::*;
|
||||
use rustc_hash::FxHashMap;
|
||||
use std::{
|
||||
any::Any,
|
||||
@@ -444,7 +445,6 @@ mod tests {
|
||||
effect::Effect,
|
||||
traits::{Read, ReadUntracked, Set, Update, Write},
|
||||
};
|
||||
use reactive_stores_macro::{Patch, Store};
|
||||
use std::sync::{
|
||||
atomic::{AtomicUsize, Ordering},
|
||||
Arc,
|
||||
|
||||
@@ -51,7 +51,6 @@ mod tests {
|
||||
effect::Effect,
|
||||
traits::{Get, Read, ReadUntracked, Set, Write},
|
||||
};
|
||||
use reactive_stores_macro::Store;
|
||||
use std::sync::{
|
||||
atomic::{AtomicUsize, Ordering},
|
||||
Arc,
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
[package]
|
||||
name = "reactive_stores_macro"
|
||||
version = "0.1.0-gamma3"
|
||||
authors = ["Greg Johnston"]
|
||||
license = "MIT"
|
||||
readme = "../README.md"
|
||||
repository = "https://github.com/leptos-rs/leptos"
|
||||
description = "Stores for holding deeply-nested reactive state while maintaining fine-grained reactive tracking."
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
|
||||
1
reactive_stores_macro/README.md
Normal file
1
reactive_stores_macro/README.md
Normal file
@@ -0,0 +1 @@
|
||||
This crate provides macro that are helpful or required when using the `reactive_stores` crate.
|
||||
@@ -180,6 +180,4 @@ tracing = ["dep:tracing"]
|
||||
|
||||
[package.metadata.cargo-all-features]
|
||||
denylist = ["tracing", "sledgehammer"]
|
||||
skip_feature_sets = [
|
||||
["ssr", "hydrate"],
|
||||
]
|
||||
skip_feature_sets = [["ssr", "hydrate"]]
|
||||
|
||||
Reference in New Issue
Block a user