Skip to content

UpdateEl refactor + updates #373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
- [BREAKING] Changed `perform_cmd` and `fetch` return type to `T` instead of `Result<T, T>`.
- Added Aria attributes.
- Added example `tea_component`.
- [BREAKING] `UpdateEl<T>` changed to `UpdateEl<Ms>` and `fn update(self, el: &mut T);` to `fn update_el(self, el: &mut El<Ms>);` (#370).
- Added trait `UpdateElForIterator<Ms>`.
- Added support for all `Iterator`s, `Option`, `u32`, `i32`, `usize`, `f64` and references in element creation macros (#365, #128).
- [BREAKING] `String` implements `UpdateEl<T>`. (References are now required for `String` properties, e.g. `div![&model.title]`.)

## v0.6.0
- Implemented `UpdateEl` for `Filter` and `FilterMap`.
Expand Down
2 changes: 1 addition & 1 deletion examples/orders/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fn view(model: &Model) -> impl View<Msg> {
St::Height => vmin(50),
],
if model.greet_clicked {
h1![model.title]
h1![&model.title]
} else {
div![
style![
Expand Down
2 changes: 1 addition & 1 deletion examples/todomvc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ fn view_todo(
Ev::DblClick,
enc!((todo_id) move |_| Msg::StartTodoEdit(todo_id))
),
todo.title
&todo.title
],
button![
class!["destroy"],
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub mod prelude {
shortcuts::*,
virtual_dom::{
el_ref::el_ref, AsAtValue, At, AtValue, CSSValue, El, ElRef, Ev, EventHandler, Node,
St, Tag, UpdateEl, View,
St, Tag, UpdateEl, UpdateElForIterator, View,
},
};
pub use indexmap::IndexMap; // for attrs and style to work.
Expand Down
6 changes: 3 additions & 3 deletions src/shortcuts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ macro_rules! element {
#[allow(unused_mut)]
let mut el = El::empty($crate::virtual_dom::Tag::$Tag_camel);
$d (
$d part.update(&mut el);
$d part.update_el(&mut el);
)*
$crate::virtual_dom::Node::Element(el)
}
Expand All @@ -55,7 +55,7 @@ macro_rules! element_svg {
{
#[allow(unused_mut)]
let mut el = El::empty_svg($crate::virtual_dom::Tag::$Tag_camel);
$d ( $d part.update(&mut el); )*
$d ( $d part.update_el(&mut el); )*
$crate::virtual_dom::Node::Element(el)
}
};
Expand Down Expand Up @@ -186,7 +186,7 @@ macro_rules! custom {
{
let default_tag_name = "missing-tag-name";
let mut el = El::empty($crate::virtual_dom::Tag::from(default_tag_name));
$ ( $part.update(&mut el); )*
$ ( $part.update_el(&mut el); )*

if let $crate::virtual_dom::Tag::Custom(tag_name) = &el.tag {
let tag_changed = tag_name != default_tag_name;
Expand Down
2 changes: 1 addition & 1 deletion src/virtual_dom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub use event_handler_manager::{EventHandler, EventHandlerManager, Listener};
pub use mailbox::Mailbox;
pub use node::{El, IntoNodes, Node, Text};
pub use style::Style;
pub use update_el::UpdateEl;
pub use update_el::{UpdateEl, UpdateElForIterator};
pub use values::{AsAtValue, AtValue, CSSValue};
pub use view::View;

Expand Down
Loading