Skip to content

Commit ece4ca5

Browse files
committed
v0.3.2 release
1 parent 3360a62 commit ece4ca5

File tree

10 files changed

+54
-45
lines changed

10 files changed

+54
-45
lines changed

CHANGELOG.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
# Changelog
22

3+
## v0.3.2
4+
- Top level view functions can now return `Vec<El<Ms>>`, `El<Ms>`, or something else implementing
5+
the new ElContainer trait
6+
37
## v0.3.1
4-
- `Top level view functions now return `Vec<El<Ms>>` instead of `El<Ms>`, mounted directly to
8+
- Top level view functions now return `Vec<El<Ms>>` instead of `El<Ms>`, mounted directly to
59
the mount point. (Breaking)
6-
- `push_route()` can now accept a `Vec<&str>`, depreciating `push_path()`.
10+
- `push_route()` can now accept a `Vec<&str>`, depreciating `push_path()`
711
- Fixed a bug where window events couldn't be enabled on initialization
812

913
## v0.3.0
1014
- `update` function now takes a mutable ref of the model. (Breaking)
1115
- `Update` (update's return type) is now a struct. (Breaking)
1216
- Async, etc events are now handled through messages, instead of passing `App`
13-
through the view func. (breaking)
17+
through the view func. (Breaking)
1418
- Fixed some bugs with empty elements
1519
- Internal code cleanup
1620
- Added commented-out release command to example build files
@@ -44,9 +48,9 @@ them in a single span.
4448

4549
## v0.2.5
4650
- Attributes and Events now can use `At` and `Ev` enums
47-
- Routing overhauled; modelled after react-reason. Cleaner syntax, and more flexible.
51+
- Routing overhauled; modelled after react-reason. Cleaner syntax, and more flexible
4852
- Input, Textarea, and Select elements are now "controlled" - they always
49-
stay in sync with the model.
53+
stay in sync with the model
5054
- index.html file updated in examples and quickstart to use relative paths,
5155
which fixes landing-page routing
5256

@@ -57,7 +61,7 @@ which fixes landing-page routing
5761
- Routing refactored; now works dynamically
5862
- Update function now returns an enum that returns Render or Skip,
5963
to allow conditional rendering (Breaking)
60-
- Elements can now store more than 1 text node.
64+
- Elements can now store more than 1 text node
6165

6266
## V0.2.3
6367
- Fixed a bug where initially-empty text won't update

Cargo.toml

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "seed"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
description = "A Rust framework for creating web apps, using WebAssembly"
55
authors = ["DavidOConnor <[email protected]>"]
66
license = "MIT"
@@ -16,24 +16,23 @@ edition = "2018"
1616
crate-type = ["cdylib", "rlib"]
1717

1818
[dev-dependencies]
19-
wasm-bindgen-test = "^0.2.40" # NOTE: keep in sync with wasm-bindgen version
19+
wasm-bindgen-test = "^0.2.42" # NOTE: keep in sync with wasm-bindgen version
2020

2121
[dependencies]
2222
# NOTE: keep in sync with wasm-bindgen-test version
23-
wasm-bindgen = {version = "^0.2.40", features = ["serde-serialize"]}
23+
wasm-bindgen = {version = "^0.2.42", features = ["serde-serialize"]}
2424
js-sys = "0.3.6"
2525
console_error_panic_hook = "^0.1.5"
2626
serde = { version = "^1.0.85", features = ['derive'] }
2727
serde_json = "^1.0.36"
2828
futures = "^0.1.20"
29-
wasm-bindgen-futures = "^0.3.6"
30-
#either = "^1.5.1"
29+
wasm-bindgen-futures = "^0.3.19"
3130

3231
# Markdown conversion
3332
pulldown-cmark = "^0.2.0"
3433

3534
[dependencies.web-sys]
36-
version = "0.3.10"
35+
version = "^0.3.19"
3736
features = [
3837
"AbortController",
3938
"AbortSignal",

README.md

+25-24
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ fn success_level(clicks: i32) -> El<Msg> {
145145
}
146146

147147
/// The top-level component we pass to the virtual dom.
148-
fn view(model: &Model) -> Vec<El<Msg>> {
148+
fn view(model: &Model) -> El<Msg> {
149149
let plural = if model.count == 1 {""} else {"s"};
150150

151151
// Attrs, Style, Events, and children may be defined separately.
@@ -155,29 +155,27 @@ fn view(model: &Model) -> Vec<El<Msg>> {
155155
"text-align" => "center"
156156
};
157157

158-
vec![
159-
div![ outer_style,
160-
h1![ "The Grand Total" ],
161-
div![
162-
style!{
163-
// Example of conditional logic in a style.
164-
"color" => if model.count > 4 {"purple"} else {"gray"};
165-
// When passing numerical values to style!, "px" is implied.
166-
"border" => "2px solid #004422"; "padding" => 20
167-
},
168-
// We can use normal Rust code and comments in the view.
169-
h3![ format!("{} {}{} so far", model.count, model.what_we_count, plural) ],
170-
button![ simple_ev(Ev::Click, Msg::Increment), "+" ],
171-
button![ simple_ev(Ev::Click, Msg::Decrement), "-" ],
172-
173-
// Optionally-displaying an element
174-
if model.count >= 10 { h2![ style!{"padding" => 50}, "Nice!" ] } else { seed::empty() }
175-
],
176-
success_level(model.count), // Incorporating a separate component
177-
178-
h3![ "What precisely is it we're counting?" ],
179-
input![ attrs!{At::Value => model.what_we_count}, input_ev(Ev::Input, Msg::ChangeWWC) ]
180-
]
158+
div![ outer_style,
159+
h1![ "The Grand Total" ],
160+
div![
161+
style!{
162+
// Example of conditional logic in a style.
163+
"color" => if model.count > 4 {"purple"} else {"gray"};
164+
// When passing numerical values to style!, "px" is implied.
165+
"border" => "2px solid #004422"; "padding" => 20
166+
},
167+
// We can use normal Rust code and comments in the view.
168+
h3![ format!("{} {}{} so far", model.count, model.what_we_count, plural) ],
169+
button![ simple_ev(Ev::Click, Msg::Increment), "+" ],
170+
button![ simple_ev(Ev::Click, Msg::Decrement), "-" ],
171+
172+
// Optionally-displaying an element
173+
if model.count >= 10 { h2![ style!{"padding" => 50}, "Nice!" ] } else { seed::empty() }
174+
],
175+
success_level(model.count), // Incorporating a separate component
176+
177+
h3![ "What precisely is it we're counting?" ],
178+
input![ attrs!{At::Value => model.what_we_count}, input_ev(Ev::Input, Msg::ChangeWWC) ]
181179
]
182180
}
183181

@@ -214,6 +212,9 @@ For development, you can view your app using a shimmed Python dev server, as des
214212
(Set up [this mime-type shim](https://github.com/David-OConnor/seed-quickstart/blob/master/serve.py)
215213
from the quickstart repo, and run `python serve.py`).
216214

215+
For a more robust quickstart repo, check out Martin Kavik's [seed-quickstart-webpack repo]
216+
(https://github.com/MartinKavik/seed-quickstart-webpack).
217+
217218
In the future, the build script and commands above may be replaced by [wasm-pack](https://github.com/rustwasm/wasm-pack).
218219
You may use it now if you wish, but may run into issues running the examples, enabling no-modules mode,
219220
and syntax-highlighting in the compile logs.

examples/counter/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ crate-type = ["cdylib"]
99

1010
[dependencies]
1111
seed = {path = "../../"}
12-
wasm-bindgen = "^0.2.40"
13-
web-sys = "^0.3.17"
12+
wasm-bindgen = "0.2.42"
13+
web-sys = "^0.3.19"

examples/counter/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn success_level(clicks: i32) -> El<Msg> {
5555

5656
/// The top-level component we pass to the virtual dom. Must accept the model as its
5757
/// only argument, and output has to implement trait ElContainer.
58-
fn view(model: &Model) -> impl ElContainer<Msg> {
58+
fn view(model: &Model) -> El<Msg> {
5959
let plural = if model.count == 1 { "" } else { "s" };
6060
let text = format!("{} {}{} so far", model.count, model.what_we_count, plural);
6161

examples/window_events/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ crate-type = ["cdylib"]
1010

1111
[dependencies]
1212
seed = {path = "../../"}
13-
wasm-bindgen = "^0.2.37"
13+
wasm-bindgen = "^0.2.40"
1414
web-sys = "^0.3.6"

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub mod prelude {
8181
pub use crate::{
8282
dom_types::{
8383
did_mount, did_update, input_ev, keyboard_ev, mouse_ev, pointer_ev, raw_ev, simple_ev,
84-
will_unmount, At, El, Ev, Optimize::Key, Tag, UpdateEl, ElContainer,
84+
will_unmount, At, El, ElContainer, Ev, Optimize::Key, Tag, UpdateEl,
8585
},
8686
shortcuts::*, // appears not to work.
8787
vdom::{ShouldRender, ShouldRender::*, Update},

src/routing.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ fn clean_url(mut url: Url) -> Url {
177177
///
178178
/// # Refenences
179179
/// * [MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/History_API)
180-
pub fn push_route<U: Into<Url>>(url3: U) {
181-
let mut url = url3.into();
180+
pub fn push_route<U: Into<Url>>(url: U) {
181+
let mut url = url.into();
182182
// Purge leading / from each part, if it exists, eg passed by user.
183183
url = clean_url(url);
184184

src/vdom.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ pub struct App<Ms: Clone + 'static, Mdl: 'static, ElC: ElContainer<Ms>> {
197197
pub data: Rc<AppData<Ms, Mdl>>,
198198
}
199199

200-
impl<Ms: Clone + 'static, Mdl: 'static, ElC: ElContainer<Ms>> ::std::fmt::Debug for App<Ms, Mdl, ElC> {
200+
impl<Ms: Clone + 'static, Mdl: 'static, ElC: ElContainer<Ms>> ::std::fmt::Debug
201+
for App<Ms, Mdl, ElC>
202+
{
201203
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
202204
write!(f, "App")
203205
}

src/websys_bridge.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,10 @@ pub fn make_websys_el<Ms: Clone>(
155155
}
156156

157157
/// Similar to attach_el_and_children, but assumes we've already attached the parent.
158-
pub fn attach_children<Ms: Clone, Mdl, ElC: ElContainer<Ms>>(el_vdom: &mut El<Ms>, app: &App<Ms, Mdl, ElC>) {
158+
pub fn attach_children<Ms: Clone, Mdl, ElC: ElContainer<Ms>>(
159+
el_vdom: &mut El<Ms>,
160+
app: &App<Ms, Mdl, ElC>,
161+
) {
159162
let el_ws = el_vdom
160163
.el_ws
161164
.take()

0 commit comments

Comments
 (0)