mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
Yewtil 3.0 (#1283)
* first attempt to upgrade * respond to feedback * update to newest yew * Update yewtil/examples/function_component/Cargo.toml Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com> * update changelog * alter changelog to include deprecation of Lrc Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
This commit is contained in:
parent
cab176dd1b
commit
5ab94c7192
@ -13,7 +13,7 @@
|
||||
|
||||
END TEMPLATE-->
|
||||
|
||||
## ✨ **0.3.0** *(DATE)*
|
||||
## ✨ **0.3.0** *6/30/20*
|
||||
|
||||
- #### ⚡️ Features
|
||||
- Sample
|
||||
@ -21,6 +21,11 @@ END TEMPLATE-->
|
||||
- Sample
|
||||
- #### 🚨 Breaking changes
|
||||
- `FetchAction::Success` has been renamed to `FetchAction::Fetched`
|
||||
- #### Deprecations
|
||||
- module `effect`
|
||||
- module `pure`
|
||||
- macro `function_component`
|
||||
- struct `ptr::Lrc<T>`
|
||||
|
||||
## ✨ **v0.2.0** *11/18/19*
|
||||
- #### ⚡️ Features
|
||||
|
||||
@ -1,32 +1,31 @@
|
||||
[package]
|
||||
name = "yewtil"
|
||||
version = "0.2.0"
|
||||
version = "0.3.0"
|
||||
authors = ["Henry Zimmerman <zimhen7@gmail.com>"]
|
||||
edition = "2018"
|
||||
description = "Utility crate for Yew"
|
||||
license = "MIT/Apache-2.0"
|
||||
repository = "https://github.com/yewstack/yew"
|
||||
readme = "Readme.md"
|
||||
readme = "README.md"
|
||||
|
||||
[features]
|
||||
default = ["stable"] # Only stable is included by default.
|
||||
all = ["stable", "experimental"]
|
||||
|
||||
# Broad features
|
||||
## All features MUST be stable or experimental
|
||||
stable = ["neq", "pure", "history", "mrc_irc", "effect", "future", "store"]
|
||||
experimental = ["dsl", "lrc", "with_callback", "fetch"]
|
||||
## All features MUST be stable or experimental or soft_depricated
|
||||
stable = ["neq", "history", "mrc_irc", "future", "store"]
|
||||
experimental = ["fetch", "pure", "effect", "lrc"]
|
||||
|
||||
|
||||
# Some pointers are stable, some experimental.
|
||||
# This makes sure you get all the pointers
|
||||
# This feature pulls in all pointer types.
|
||||
ptr = ["lrc", "mrc_irc"]
|
||||
|
||||
# Misc features
|
||||
neq = []
|
||||
pure = ["neq", "yewtil-macro"]
|
||||
with_callback = []
|
||||
history = []
|
||||
dsl = []
|
||||
effect = []
|
||||
fetch = ["serde", "serde_json", "neq", "future", "web-sys"]
|
||||
future = ["wasm-bindgen-futures", "wasm-bindgen", "futures"]
|
||||
@ -43,8 +42,8 @@ serde = {version= "1.0.102", optional = true}
|
||||
serde_json = { version = "1.0.41", optional = true }
|
||||
wasm-bindgen = {version = "0.2.51", features=["serde-serialize"], optional = true}
|
||||
wasm-bindgen-futures = {version = "0.4.3", optional = true}
|
||||
yew = { path = "../yew" }
|
||||
yewtil-macro = { path = "../yewtil-macro", optional = true }
|
||||
yew = { version = "0.17.0", path = "../yew" }
|
||||
yewtil-macro = { version = "0.1.0", path = "../yewtil-macro", optional = true }
|
||||
|
||||
[dependencies.stdweb]
|
||||
version = "0.4.20"
|
||||
|
||||
@ -16,11 +16,13 @@ This should make it much easier to define simple components that don't hold stat
|
||||
* `Mrc`/`Irc` smart pointers - Rc-like pointers that are more ergonomic to use within Yew.
|
||||
* `History` - A wrapper that holds the history of values that have been assigned to it.
|
||||
* `Effect` - A way to update component state by defining what to change inside of `html!` callbacks
|
||||
instead of handling messages in `Component::update()`.
|
||||
instead of handling messages in `Component::update()`. (Deprecated)
|
||||
|
||||
|
||||
This crate also has feature flags which will enable the following **experimental** features:
|
||||
* `Lrc` smart pointer - an Rc-like pointer implemented on top of a linked list which allows for novel state update mechanics
|
||||
and traversal over linked shared pointers. <sup><sub>(This needs to be fuzz tested to make sure it doesn't leak.)</sub></sup>
|
||||
(Deprecated)
|
||||
|
||||
These experimental features are either not sufficiently vetted and may change significantly or be removed.
|
||||
|
||||
@ -94,6 +96,6 @@ Components are welcome as well, but they must not have external dependencies, sh
|
||||
Common UI elements like modals or dropdowns are best be left to component libraries, as they are often coupled to external CSS used to display them. The [Yewtify](https://github.com/yewstack/yewtify) crate is one such component library.
|
||||
|
||||
### Stability
|
||||
Since this crate aims to provide a variety of helper types, traits, and functions, where the utility of each may be unknown at the time the feature is added, newer additions may be not be included in the default feature set, and may be kept behind a feature flag.
|
||||
Since this crate aims to provide a variety of helper types, traits, and functions, where the utility of each may be unknown at the time the feature is added, newer additions may be not be included in the default feature set, and may be kept behind a feature flag.
|
||||
|
||||
While in early development, features marked as `experimental` may be changed frequently or even entirely removed, while those marked as `stable` will not be removed and can be relied upon to not change significantly.
|
||||
|
||||
@ -8,7 +8,7 @@ edition = "2018"
|
||||
log = "0.4.8"
|
||||
wasm-logger = "0.2.0"
|
||||
yew = { path = "../../../yew" }
|
||||
yewtil = { path = "../.." }
|
||||
yewtil = { path = "../..", features = ["pure"] }
|
||||
|
||||
[target.'cfg(all(target_arch = "wasm32", not(cargo_web)))'.dependencies]
|
||||
wasm-bindgen = "0.2.51"
|
||||
|
||||
@ -12,9 +12,6 @@
|
||||
//! * "store" - Global state with easy binding
|
||||
// //! * "dsl" - Use functions instead of Yew's `html!` macro.
|
||||
|
||||
//#[cfg(feature = "dsl")]
|
||||
//pub mod dsl;
|
||||
|
||||
#[cfg(feature = "neq")]
|
||||
mod not_equal_assign;
|
||||
|
||||
@ -33,9 +30,11 @@ pub use history::History;
|
||||
#[cfg(feature = "neq")]
|
||||
pub use not_equal_assign::NeqAssign;
|
||||
|
||||
#[deprecated]
|
||||
#[cfg(feature = "pure")]
|
||||
pub use pure::{Pure, PureComponent};
|
||||
|
||||
#[deprecated]
|
||||
#[cfg(feature = "pure")]
|
||||
pub use yewtil_macro::function_component;
|
||||
|
||||
@ -44,6 +43,7 @@ pub mod fetch;
|
||||
|
||||
#[cfg(feature = "effect")]
|
||||
mod effect;
|
||||
#[deprecated]
|
||||
#[cfg(feature = "effect")]
|
||||
pub use effect::{effect, Effect};
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ mod takeable;
|
||||
|
||||
#[cfg(feature = "mrc_irc")]
|
||||
pub use irc::Irc;
|
||||
#[deprecated]
|
||||
#[cfg(feature = "lrc")]
|
||||
pub use lrc::Lrc;
|
||||
#[cfg(feature = "mrc_irc")]
|
||||
|
||||
@ -41,7 +41,7 @@ pub trait Store: Sized + 'static {
|
||||
/// the boring data wrangling logic
|
||||
#[derive(Debug)]
|
||||
pub struct StoreWrapper<S: Store> {
|
||||
/// Currently subscibed components and agents
|
||||
/// Currently subscribed components and agents
|
||||
pub handlers: HashSet<HandlerId>,
|
||||
/// Link to itself so Store::handle_input can send actions to reducer
|
||||
pub link: AgentLink<Self>,
|
||||
@ -107,14 +107,14 @@ impl<S: Store> Agent for StoreWrapper<S> {
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_input(&mut self, msg: Self::Input, _id: HandlerId) {
|
||||
self.state.borrow().handle_input(self.link.clone(), msg);
|
||||
}
|
||||
|
||||
fn connected(&mut self, id: HandlerId) {
|
||||
self.handlers.insert(id);
|
||||
}
|
||||
|
||||
fn handle_input(&mut self, msg: Self::Input, _id: HandlerId) {
|
||||
self.state.borrow().handle_input(self.link.clone(), msg);
|
||||
}
|
||||
|
||||
fn disconnected(&mut self, id: HandlerId) {
|
||||
self.handlers.remove(&id);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user