Skip to content

Commit 61a64aa

Browse files
committed
Fixed a bug in window events. Top-level children now mount direclty to the mount point instead of an intermediate element
1 parent 5476109 commit 61a64aa

File tree

17 files changed

+96
-327
lines changed

17 files changed

+96
-327
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## v0.3.1
4+
- `Top level view functions now return `Vec<El<Ms>>` instead of `El<Ms>`, mounted directly to
5+
the mount point. (Breaking)
6+
- `push_route()` can now accept a `Vec<&str>`, depreciating `push_path()`.
7+
- Fixed a bug where window events couldn't be enabled on initialization
8+
39
## v0.3.0
410
- `update` function now takes a mutable ref of the model. (Breaking)
511
- `Update` (update's return type) is now a struct. (Breaking)

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "seed"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
description = "A Rust framework for creating web apps, using WebAssembly"
55
authors = ["DavidOConnor <[email protected]>"]
66
license = "MIT"
@@ -79,7 +79,6 @@ members = [
7979
"examples/todomvc",
8080
"examples/window_events",
8181
"examples/websocket",
82-
"proc_macros",
8382
]
8483

8584
exclude = [

README.md

Lines changed: 24 additions & 22 deletions
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) -> El<Msg> {
148+
fn view(model: &Model) -> Vec<El<Msg>> {
149149
let plural = if model.count == 1 {""} else {"s"};
150150

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

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) ]
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+
]
179181
]
180182
}
181183

examples/layered_structure/Cargo.toml

Lines changed: 0 additions & 13 deletions
This file was deleted.

examples/layered_structure/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/layered_structure/build.ps1

Lines changed: 0 additions & 5 deletions
This file was deleted.

examples/layered_structure/build.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

examples/layered_structure/index.html

Lines changed: 0 additions & 36 deletions
This file was deleted.

examples/layered_structure/pkg/.keep

Whitespace-only changes.

examples/layered_structure/serve.py

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)