1142 Commits

Author SHA1 Message Date
Justin Starry
0e78f7aafb Update example 2019-08-25 16:53:14 -04:00
Justin Starry
599e4d0764 Support generic components 2019-08-25 00:10:57 -04:00
Justin Starry
bd2fc4254f Use holder to avoid box paren wrapping 2019-08-25 00:10:57 -04:00
Justin Starry
8e4a7eda36 Add default implementation for children prop 2019-08-25 00:10:57 -04:00
Justin Starry
bddb2f0b8e Props 2019-08-25 00:10:57 -04:00
Justin Starry
a7e251cdb0 First pass at component children 2019-08-25 00:10:57 -04:00
king6cong
d6917443fb Fix typo 2019-08-25 10:44:13 +08:00
bors[bot]
41c8a1dffc
Merge #612
612: Add support for optional callbacks to component properties r=jstarry a=Wodann

Added transformer for conversion of a closure to an optional callback, as requested in issue #609.

Co-authored-by: Wodann <remco.kuijper@gmail.com>
2019-08-23 21:05:31 +00:00
bors[bot]
08bb49e862
Merge #611
611: Fixed typo r=jstarry a=UnHumbleBen



Co-authored-by: Benjamin Lee <bnllee@ucdavis.edu>
2019-08-23 20:14:23 +00:00
Wodann
bc447ad22d Add tests for a component with optional callback 2019-08-23 21:46:47 +02:00
Wodann
f3179f2e9c Add support for optional callbacks to component properties 2019-08-23 20:45:59 +02:00
Benjamin Lee
695c91984e
Fixed typo 2019-08-22 21:18:27 -07:00
bors[bot]
ec41e9d795
Merge #608
608: Update proc-macro2, syn and quote to 1.0 r=jstarry a=hobofan

CLOSES #590

I also tried to lift the recursion limits in the examples, but it looks like they are still required (maybe due to macros from stdweb?).

Co-authored-by: Maximilian Goisser <goisser94@gmail.com>
2019-08-21 17:39:19 +00:00
Maximilian Goisser
c97d23cb40 Update proc-macro2, syn and quote to 1.0
CLOSES #590
2019-08-21 09:18:06 +02:00
bors[bot]
4f0b9cce20
Merge #591
591: Remove allocation in vtag diff r=jstarry a=tafia

**Disclaimer**: I couldn't test it on my system yet.

This PR attempts to remove all allocations (`String`, `Vec` and `HashSet`) used in various vtag diff functions.

I believe this should have an impact both in terms of performance and memory.



Co-authored-by: Johann Tuffe <tafia973@gmail.com>
2019-08-21 00:15:27 +00:00
Johann Tuffe
048865f703 apply suggestions 2019-08-19 09:10:55 +08:00
Johann Tuffe
2f1a46be1c more cleaning 2019-08-19 09:10:55 +08:00
Johann Tuffe
02771be405 clean apply_diff 2019-08-19 09:10:55 +08:00
Johann Tuffe
bd4659a399 rustfmt on vtags 2019-08-19 09:10:54 +08:00
Johann Tuffe
a3bda76f26 return iterator for diff_classes and diff_attributes 2019-08-19 09:10:54 +08:00
Johann Tuffe
2d466f9052 simplify diff_attributes and avoid allocations 2019-08-19 09:10:54 +08:00
Johann Tuffe
b3024efd91 avoid allocating for diff_value 2019-08-19 09:10:54 +08:00
Johann Tuffe
b2dfe0dc37 avoid allocating for diff_kind 2019-08-19 09:10:54 +08:00
Johann Tuffe
1163bf662c avoid allocating in diff_classes 2019-08-19 09:10:54 +08:00
bors[bot]
007cc77720
Merge #597
597: Fix typo r=DenisKolodin a=king6cong



Co-authored-by: king6cong <king6cong@gmail.com>
2019-08-17 06:30:04 +00:00
bors[bot]
de9ae1176a
Merge #598
598: Require fmt in CI r=DenisKolodin a=DenisKolodin



Co-authored-by: Denis Kolodin <deniskolodin@gmail.com>
2019-08-17 01:17:53 +00:00
Denis Kolodin
adfd385bca Apply cargo format to all modules 2019-08-17 09:39:04 +09:00
Denis Kolodin
25a4047735 Require fmt in travis script 2019-08-17 09:38:26 +09:00
king6cong
77285745af Fix typo 2019-08-17 01:37:34 +08:00
bors[bot]
aeff169c91
Merge #594
594: Fix typo r=jstarry a=king6cong



Co-authored-by: king6cong <king6cong@gmail.com>
2019-08-15 21:25:21 +00:00
king6cong
59936f1b24 Fix typo 2019-08-15 23:07:56 +08:00
bors[bot]
701132bfed Merge #570
570: Applied clippy feedback r=jstarry a=VictorKoenders

Clippy had some small changes that it preferred

`fn unpack(data: &[u8]) -> Self;`: https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
Because `&Vec<u8>` and `&[u8]` are identical enough, and this doesn't break code, Clippy likes the slice more because it's flexible

`fn raw_id(self) -> usize {`: https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref
`HandlerId` is small enough (8 bytes) that Clippy thinks it's trivially copied, rather than passing a pointer around (this might be not relevant because it's WASM)

`AgentUpdate::Connected(bridge.id);`: https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion
`bridge.id` is already a `HandlerId` so no point in using `.into()`

`v.to_str().unwrap_or_else(|_| {`: https://rust-lang.github.io/rust-clippy/master/index.html#expect_fun_call
With the `expect`, the error string is always allocated, even when the error doesn't occur. Using an `unwrap_or_else` makes sure the error string only gets allocated when it fails

`duration.subsec_millis();`: https://rust-lang.github.io/rust-clippy/master/index.html#duration_subsec
Stable since rust 1.27

`self.ws.send_text(&body).is_err()`: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
The `Err` is not used, so `.is_err()` is more concise

`scope as *mut Scope<CHILD>;`: https://rust-lang.github.io/rust-clippy/master/index.html#transmute_ptr_to_ptr
A cast can be used instead of a transmute


Co-authored-by: Trangar <victor.koenders@gmail.com>
2019-08-14 13:44:15 +00:00
Trangar
4bf750e216 Added a impl Default for App, Scope and VList 2019-08-14 22:41:28 +09:00
Trangar
8e01a59a27 Added an early return to put_and_try_run 2019-08-14 22:37:01 +09:00
Trangar
53136b8fa9 Applied clippy feedback 2019-08-14 22:37:01 +09:00
bors[bot]
84db98ccde Merge #585
585: Add own Classes struct implementation r=DenisKolodin a=DenisKolodin

Hide details of Classes set implementation and add a feature to produce that struct from variety of sources like `&str`, `String` and `Vec<T> where T: AsRef<str>`.

I need this to have an effective way to construct complex classes set for https://github.com/yewstack/facade. With this PR we can do something like:

```rust
let mut classes = vec!["container"];
classes.push("fluid");
// or
let mut classes = Classes::new();
classes.append("container");
if fluid_flag {
    container.append("fluid");
}

html! {
    <div classes=classes />
}
```

In the future we can implement `impl Info<Classes> for (tuple)` and  simplify macro by delegating **tuples to classes** conversion to type system (instead of macro).

Let's give a chance to CI to check it 🤞 

Also I applied `cargo fmt` to the root crate sources.

Co-authored-by: Denis Kolodin <deniskolodin@gmail.com>
2019-08-13 13:52:35 +00:00
Boyd Johnson
76336b3940 Add touch events (#584)
This adds:
   - TouchCancel
   - TouchEnd
   - TouchEnter
   - TouchMove
   - TouchStart
2019-08-13 09:31:30 -04:00
bors[bot]
104c6b2543 Merge #583
583: Add default mounted() method to Component trait r=jstarry a=hgzimmerman

Fixes https://github.com/yewstack/yew/issues/572

I made the choice to have `on_mount()` not return a `ShouldRender` bool, because I don't think there is a situation where altering parts of a component state relevant to the `view()` should ever take place in `on_mount()` instead of `create()`. Let me know your thoughts, because its an easy enough change to make.

Co-authored-by: Henry Zimmerman <zimhen7@gmail.com>
2019-08-13 03:39:18 +00:00
Henry Zimmerman
1ef1b1a5b2 changed on_mount to mounted, clean up update's self return, support rerendering on mounted 2019-08-12 22:28:20 -04:00
David Knaack
b9894dc291 Add additional options to fetch (#579) 2019-08-12 22:16:06 -04:00
cyrtophora
8500f75ad8 Fixed html class name typo (#582) 2019-08-12 21:20:57 -04:00
Denis Kolodin
46ae317926 Add own Classes struct implementation
Hide details of Classes set implementation and add a feature to produce that struct
from variety of sources like `&str`, `String` and `Vec<T> where T: AsRef<str>`.
2019-08-13 00:56:00 +09:00
Justin Starry
e42b4ce65e
Update README.md 2019-08-12 10:22:36 -04:00
Justin Starry
e8d6911046
Add logo and update readme (#581) 2019-08-12 10:22:04 -04:00
Henry Zimmerman
617d5693da use spread operator in CreatedState::update 2019-08-12 08:43:57 -04:00
Henry Zimmerman
6adfa74000 add on_mount 2019-08-12 07:43:09 -04:00
Justin Starry
bb7c042da4 Update CHANGELOG.md 2019-08-11 21:59:13 -04:00
bors[bot]
4127a2477c Merge #562
562: Reorganize html module r=jstarry a=jstarry

This splits the html module so that it now has two submodules: `scope` and `listener`

Co-authored-by: Justin Starry <jstarry@users.noreply.github.com>
2019-08-12 00:47:51 +00:00
Justin Starry
cf3e9351b4 Split out scope code from html module 2019-08-11 20:46:58 -04:00
Justin Starry
2020944f49 Split out listener code from html module 2019-08-11 20:46:58 -04:00