From 1798a00e1408baabac333696dfcedd0620c5cb61 Mon Sep 17 00:00:00 2001 From: Jovansonlee Cesar Date: Thu, 4 Apr 2024 00:41:20 +0800 Subject: [PATCH] prepare for 0.61.0 release --- Changelog.md | 14 ++++++++++++++ README.md | 9 ++++++--- crates/core/Cargo.toml | 2 +- crates/html-parser/Cargo.toml | 4 ++-- crates/macro/Cargo.toml | 4 ++-- docs/migration_guide.md | 25 +++++++++++++++++++++++++ 6 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 docs/migration_guide.md diff --git a/Changelog.md b/Changelog.md index 9a87b10f4..10f7e8cfb 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,19 @@ # Changelog +## 0.61.0 +- add template system, skip_diff +- web_sys::Node is now wrapped with DomNode, the event listeners + is now managed from its containing DomNode, instead of from the Program. + when a DomNode is removed and goes out of scope, so does its associated event closures are dropped +- `Cmd` can now be mapped into `Effects` and vice versa +- The `mt-dom` crate is now part of `core` in the `vdom` module. This change is necessary + to improve code coherence and simplicity, lesser number of generic types has to be passed arround. +- remove `inner_html` as a function to set html via html attributes. + - This cause breakage in tracking the DOMTree as new nodes could be inserted dynamically without the runtime knowing it. +- Rename `safe_html` to `symbol` as its usage is intended for html entities such as ` ` `"e;` etc. +- A `safe_html` function is added and use `html-parser` to parse dynamic html and convert it into a safe dom-tree. + + ## 0.60.7 - feat: add selectionchange event and document_event_listener diff --git a/README.md b/README.md index 1cb6b0418..bab2b6f80 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,10 @@ impl App { } } -impl Application for App { +impl Application for App { + + type MSG = Msg; + fn view(&self) -> Node { node! {
@@ -82,7 +85,7 @@ impl Application for App { } } - fn update(&mut self, msg: Msg) -> Cmd { + fn update(&mut self, msg: Msg) -> Cmd { match msg { Msg::Increment => self.count += 1, Msg::Decrement => self.count -= 1, @@ -147,7 +150,7 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -sauron = "0.60.0" +sauron = "0.61.0" ``` #### Prerequisite: diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index c3db0473d..4c8411806 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sauron-core" -version = "0.60.7" +version = "0.61.0" authors = [ "Jovansonlee Cesar " ] license = "MIT" description = "An html library for building client side webapps" diff --git a/crates/html-parser/Cargo.toml b/crates/html-parser/Cargo.toml index d9e8353b5..3a68affbf 100644 --- a/crates/html-parser/Cargo.toml +++ b/crates/html-parser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sauron-html-parser" -version = "0.60.7" +version = "0.61.0" edition = "2021" authors = [ "Jovansonlee Cesar " ] license = "MIT" @@ -12,6 +12,6 @@ keywords = ["html", "parser", "web"] [dependencies] rphtml = "0.5.9" -sauron-core = { version = "0.60", path = "../core", default-features = false, features = ["with-lookup"] } +sauron-core = { version = "0.61", path = "../core", default-features = false, features = ["with-lookup"] } log = "0.4" thiserror = "1.0.48" diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index f4b4376be..d927cb1d1 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sauron-macro" -version = "0.60.7" +version = "0.61.0" authors = ["John-John Tedro ", "Jovansonlee Cesar "] license = "MIT" description = "An html library for building client side webapps" @@ -16,7 +16,7 @@ rstml = { version = "0.11" } quote = { version = "1"} proc-macro2 = { version = "1" } once_cell = "1.8" -sauron-core = {version = "0.60", path = "../core", features = ["with-lookup"] } +sauron-core = {version = "0.61", path = "../core", features = ["with-lookup"] } phf = { version = "0.11.2", features = ["macros"] } [dev-dependencies] diff --git a/docs/migration_guide.md b/docs/migration_guide.md new file mode 100644 index 000000000..674c10b2e --- /dev/null +++ b/docs/migration_guide.md @@ -0,0 +1,25 @@ +## Migration guide from 0.60.0 to 0.61.0 + +- `MSG` is now an associated type to `Application` +- `Cmd` should now be just `Cmd` + +old: +```rust +impl Application for App{ + + fn update(&mut self, msg: Msg) -> Cmd { + ... + } +} +``` +new: +```rust +impl Application for App { + type MSG = Msg; + + fn update(&mut self, msg: Msg) -> Cmd{ + ... + } +} +``` +