1142 Commits

Author SHA1 Message Date
Henry Zimmerman
0ae9cd52fd Add keyboard service (#647)
* Add keyboard service

* fix not working implementation; run cargo fmt

* make callback to keyboard event use KeyPressEvent instead of String

* add key_down and key_up events as well

* link to documentation and provide compatibility notice
2019-09-27 10:46:19 -04:00
Kevin Tan
9faefde9d1 Add a method to emit multiple messages in one callback (#660)
* feat: add create_effect method to help create effect callback

* style: fmt code with rustfmt

* feat: support bunch update in one render loop

* typo: change bunch to batch

* style: fmt with cargo
2019-09-26 22:04:53 -04:00
serzhiio
dfc4968203 Early msgs queue for Public worker (#596)
* Early msgs queue for Public worker

* Early msgs queue for Public worker

* update (#1)

* Fix typo

* Require fmt in travis script

* Apply cargo format to all modules

* ??

* Merge (#2)

* Fix typo

* Require fmt in travis script

* Apply cargo format to all modules

* avoid allocating in diff_classes

* avoid allocating for diff_kind

* avoid allocating for diff_value

* simplify diff_attributes and avoid allocations

* return iterator for diff_classes and diff_attributes

* rustfmt on vtags

* clean apply_diff

* more cleaning

* apply suggestions

* Update proc-macro2, syn and quote to 1.0

CLOSES #590

* Fixed typo

* Add support for optional callbacks to component properties

* Add tests for a component with optional callback

* Fix typo

* Add `Classes` to prelude

* binary ser/de issue fix

* merge (#3)

* Fix typo

* Require fmt in travis script

* Apply cargo format to all modules

* avoid allocating in diff_classes

* avoid allocating for diff_kind

* avoid allocating for diff_value

* simplify diff_attributes and avoid allocations

* return iterator for diff_classes and diff_attributes

* rustfmt on vtags

* clean apply_diff

* more cleaning

* apply suggestions

* Update proc-macro2, syn and quote to 1.0

CLOSES #590

* Fixed typo

* Add support for optional callbacks to component properties

* Add tests for a component with optional callback

* Fix typo

* Add `Classes` to prelude

* added bincode type for data ser de

* fixed Into func

* Update (#5)

* in yewstack org

* Initial implementation using an iterator adaptor to provide a coherent struct to implement Into<VNode> (via From<>) for

* update large table example to demonstrate new .html() method instead of 'for'

* ran cargo fmt

* Add a section for project templates to the README

* Change org to YewStack

* Implement FromIterator instead of wrapping iterator

* remove dead code

* ran fmt

* Add extend method to Classes

* change to union

* renamed union back to extend

* removed unused import of RangeFull

* update

* Fix touch events (#656)

* Update changelog for v0.9 release (#657)

* Implement Debug for ChildRenderer<T> (#655)

* Implement Debug for ChildRenderer<T>

* fix formatter type lifetime

* remove fmt

* cargo fmt

* Emit initial route to router subscribers (#634)

* Fix typo in RenderService (#658)

* Add From<&String> for Classes implementation

* @jstarry feedback

- cargo fmt
- rename DEDICATED_WORKERS_* to REMOTE_AGENTS_*
- remove unrelated changes

* TypeId ask key instead &str

* Remove .gitignore changes

* Update agent.rs

* Update agent.rs

* Fix merge conflict
2019-09-26 11:28:09 -04:00
Justin Starry
58495a1e5b Add a few more items to changelog for 0.9 2019-09-25 22:17:45 -04:00
Thomas Gotwig
9757adf42b Fix comment-typo in agent (#644)
Closes #628
2019-09-25 22:07:12 -04:00
Henry Zimmerman
97f5aa3812 Add Dispatchers (#639)
* Add Dispatchers, which act like bridges, but don't require a callback to create; updated router example

* cargo fmt

* improve comment

* Another approach

* add newtype around dispatcher bridges

* added debug impl, run cargo fmt

* fix example

* make button on routing example start on loading variant

* revert singleton_id changes

* actually revert singleton_id changes

* slabs own option<callback>

* cargo fmt

* remove dead lines

* address bad doc comment

* fix router example

* fix handler id initialization in local agent

* add appropriate error message when id is not associated with callback

* remove misleading comment

* use a type alias to the shared output slab
2019-09-25 21:42:36 -04:00
bors[bot]
0c2f2ac10a
Merge #659
659: Add From<&String> for Classes implementation r=jstarry a=jstarry

We used to support using `&String`s as classes so adding that functionality back in

Co-authored-by: Justin Starry <jstarry@users.noreply.github.com>
2019-09-25 12:22:50 +00:00
Justin Starry
ff41a69c70 Add From<&String> for Classes implementation 2019-09-24 23:31:04 -04:00
Justin Starry
f794d555e3
Fix typo in RenderService (#658) 2019-09-24 23:01:45 -04:00
Terry Raimondo
dd59cf0392 Emit initial route to router subscribers (#634) 2019-09-24 22:53:31 -04:00
Henry Zimmerman
0d96d5b9dd Implement Debug for ChildRenderer<T> (#655)
* Implement Debug for ChildRenderer<T>

* fix formatter type lifetime

* remove fmt

* cargo fmt
2019-09-24 22:53:13 -04:00
Justin Starry
66b036b372
Update changelog for v0.9 release (#657) 2019-09-24 22:52:35 -04:00
Justin Starry
567a945ba1
Fix touch events (#656) 2019-09-24 22:21:10 -04:00
bors[bot]
1375714339
Merge #651
651: Fix VNode orphaning inside of VTags r=jstarry a=hgzimmerman

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

VTags now recursively detach their children when they are detached themselves. This means that Components nested within `<div>`s or other elements will now properly run their `destroy` function and be dropped by the framework.

Its nice to finally squash a bug that's bothered me for more than a year.

Co-authored-by: Henry Zimmerman <zimhen7@gmail.com>
2019-09-23 01:31:07 +00:00
bors[bot]
9bd9d521da
Merge #640
640: Properly handle where clause in derive props macro r=jstarry a=astraw

This fixes #638.

So far, I was not able to the test suite to run, so I wasn't able to write a test for this.

Co-authored-by: Andrew Straw <strawman@astraw.com>
Co-authored-by: Justin Starry <jstarry@users.noreply.github.com>
2019-09-22 22:58:12 +00:00
Henry Zimmerman
07a30d713f update readme (#646) 2019-09-22 12:57:26 -10:00
Henry Zimmerman
258ed838ac Implement Debug for ComponentLink and AgentLink (#652) 2019-09-22 09:29:32 -10:00
Henry Zimmerman
30e67d06d4 derive Debug for Classes (#650) 2019-09-22 09:28:22 -10:00
Justin Starry
f8d07237cc Add test 2019-09-22 09:15:41 -10:00
Henry Zimmerman
109504d517 improve naming 2019-09-21 08:18:20 -04:00
Henry Zimmerman
5dc34e6e27 cargo fmt 2019-09-21 08:09:46 -04:00
Henry Zimmerman
2256c04288 Fix VNode orphaning inside of VTags 2019-09-20 23:35:05 -04:00
Andrew Straw
16c7864d63 fix #638 2019-09-15 11:42:04 +02:00
bors[bot]
24d39f97e3
Merge #589
589: Allow components to accept children elements r=jstarry a=jstarry

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

#### Terminology
- (B) Base component that renders components nested inside each other
- (P) Parent component that has a `children` property and can render those children
- (C) Child component that is nested inside parent and included inside the Parent's `children`

#### Todo
- [x] Add example for nested components
- [x] Support arbitrary html nested inside component tags
- [x] Support nested components inside component tags
- [x] Allow modifying & accessing (C) props when rendering (P)
- [x] Allow filtering (C) components when rendering (P)
- [x] Children prop be required or optional
- [x] Clean up nested component example
- [x] Fix parser for generic component type
- [x] Write tests
- [x] Update documentation and README
- [x] ~~Investigate passing required properties from (P) -> (C)~~
- [x] ~~Allow sending messages from (C) -> (B)~~


Co-authored-by: Justin Starry <jstarry@users.noreply.github.com>
2019-09-10 14:53:24 +00:00
bors[bot]
c627946c14
Merge #626
626: Add extend method to Classes r=jstarry a=hgzimmerman

Also implement Clone.

Addresses https://github.com/yewstack/yew/issues/621

----
I'm a little off-put by the use of `format!()` having to be used to concatenate strings that are later used as classes.

This change allows for usages like:
```rust
html!{
    <div class=Classes::new().union("some-class").union("other-class") />
}
```
or 
```rust
html!{
    <div class=self.class.clone().union("other-class") />
}
```


Co-authored-by: Henry Zimmerman <zimhen7@gmail.com>
2019-09-05 03:45:34 +00:00
Henry Zimmerman
7ae0c0efa5 removed unused import of RangeFull 2019-09-04 23:37:21 -04:00
bors[bot]
088310831f
Merge #622
622: Remove special 'for' syntax (WIP) r=jstarry a=hgzimmerman

Attempts to address https://github.com/yewstack/yew/issues/606

I'm running into coherence issues and conflicting implementations with `ToString` and `IntoIterator` when I try to do a blanket impl for `impl <T: IntoIterator<etc...> From<T> for VNode<COMP>`. If I replace the `ToString` blanket impl with concrete impls for `String` and `&str`, I still run into coherence issues where downstream crates might provide a conflicting impl.

I figured that the easiest path forward is to create my own iterator and implement `Into<VNode<COMP>>` for it via an impl for `From`.

So this PR thusfar gets us from:
#### Before
```rust
html! {
   for self.props.items.iter().map(renderItem)
}
```

#### To the start of this PR.
 ```rust
html! {
   self.props.items.iter().map(renderItem).html()
}
```

#### To now
 ```rust
html! {
   self.props.items.iter().map(renderItem).collect::<Html<Self>>()
}
```

Which strictly speaking, is _better_, as it frees up a keyword, but isn't anywhere near what you ideally want:
#### Ideal
```rust
html! {
   self.props.items.iter().map(renderItem)
}
```
-------
Any feedback on how to achieve this design goal would be appreciated.


Co-authored-by: Henry Zimmerman <zimhen7@gmail.com>
2019-09-05 03:13:40 +00:00
Justin Starry
429ab739c1 cargo fmt 2019-09-04 22:29:42 -04:00
Justin Starry
563807a861 Implement Renderable trait and add docs 2019-09-04 21:26:36 -04:00
Justin Starry
527cb9865e Add is_empty and len methods to ChildrenRenderer 2019-09-04 20:16:37 -04:00
Henry Zimmerman
7965123db8 renamed union back to extend 2019-09-01 12:35:30 -04:00
Henry Zimmerman
77958489ee change to union 2019-09-01 11:13:39 -04:00
Henry Zimmerman
db52aa40bf Add extend method to Classes 2019-09-01 10:22:21 -04:00
Henry Zimmerman
87f1b82d2e ran fmt 2019-08-31 19:23:22 -04:00
Henry Zimmerman
b1849d00e7 remove dead code 2019-08-31 17:17:36 -04:00
Henry Zimmerman
c1628e70d2 Implement FromIterator instead of wrapping iterator 2019-08-31 17:17:15 -04:00
bors[bot]
5421c22d07
Merge #620
620: in yewstack org r=DenisKolodin a=ctaggart



Co-authored-by: Cameron Taggart <cameron.taggart@gmail.com>
Co-authored-by: Denis Kolodin <deniskolodin@gmail.com>
2019-08-31 16:18:20 +00:00
bors[bot]
6b56491e2d
Merge #625
625: Add a section for project templates to the README r=DenisKolodin a=kellytk



Co-authored-by: Kelly Thomas Kline <kellytk@sw-e.org>
2019-08-31 15:06:44 +00:00
Denis Kolodin
c4fa17004b Change org to YewStack 2019-09-01 00:02:24 +09:00
Kelly Thomas Kline
c976e1afb3
Add a section for project templates to the README 2019-08-31 01:07:42 -07:00
Henry Zimmerman
4a9a4af6ab ran cargo fmt 2019-08-29 20:15:41 -04:00
Henry Zimmerman
b6b55ab5f5 update large table example to demonstrate new .html() method instead of 'for' 2019-08-29 19:25:01 -04:00
Henry Zimmerman
107fcaf506 Initial implementation using an iterator adaptor to provide a coherent struct to implement Into<VNode> (via From<>) for 2019-08-29 19:18:58 -04:00
Cameron Taggart
d574a2ca7b
in yewstack org 2019-08-29 16:47:22 +02:00
bors[bot]
56de63802c
Merge #615
615: Add `Classes` to prelude r=jstarry a=kellytk



Co-authored-by: Kelly Thomas Kline <kellytk@sw-e.org>
2019-08-26 02:40:48 +00:00
Kelly Thomas Kline
14954571f7
Add Classes to prelude 2019-08-25 19:28:12 -07:00
Justin Starry
5c367d2c6a Update tests 2019-08-25 21:54:58 -04:00
bors[bot]
352e3cf853
Merge #614
614: Fix typo r=jstarry a=king6cong



Co-authored-by: king6cong <king6cong@gmail.com>
2019-08-25 22:30:47 +00:00
Justin Starry
23c23d74ec Cleanup 2019-08-25 18:28:51 -04:00
Justin Starry
7ae088647b Add tests 2019-08-25 18:12:14 -04:00