149 Commits

Author SHA1 Message Date
Simon
66d506e133
Update documentation for the new examples (#1586)
* fix todomvc example

* update READMEs now that we're hosting the examples

* update documentation

* add trunk template

* Improve wording
2020-09-23 03:47:28 +02:00
Simon
41af85e6c5
Host examples on Firebase (#1582)
* remove getrandom from game_of_life

I know the wasm-bindgen feature is deprecated but this is more convenient for now
and all the other examples use it this way as well.
We can update all of them in one go when rand 0.8 rolls around

* update todomvc README

* clean up yew-macro makefile

See: https://github.com/yewstack/yew/pull/1541#discussion_r488747622

* Use Firebase Hosting
2020-09-22 18:04:32 +02:00
Simon
c946b99610
Overhaul examples (#1559)
* remove old files

* update counter

* update crm example

* Add readme for counter

* update custom_components

* update webgl example

* update two_apps

* update todomvc

* mark special case multithread

* update dashboard

* update examples readme

* file_upload example

* fragments example

* futures example

* game_of_life example

* inner_html example

* js_callback example

* keyed_list example

* remove large_table

* remove minimal

* mount_point example

* I can't count apparently

* nested_list example

* node_refs example

* timer example

* store example

* pub_sub example

* rip npm_and_my_sanity

* use a title™️

* clean up multi_thread

* fix format

* boids part 1

* boids part 2

* add workflow

See: <https://github.com/siku2/yew/pull/13>

* remove my little scratchpad again

* add boids to examples table

* runtime-generated list in  nested_list example

* update workflow

* first batch of yewtil examples

* clippy "futures"

* remove old yew-router examples

* add a new router example to the main examples

* remove remaining yewtil examples

* more progress

* update for testing purposes

* author list

* improve content generation

* revert this mistake

I thought it would be great to use `unimplemented!()` in case the component doesn't have any properties.
This helps avoid the mistake of forgetting to update the change method when adding props later on.
What I didn't consider is that just because the props are () that doesn't mean that Yew isn't going to call it...
So yeah, it's still a good idea for update, but certainly not for change.

* missed a few

* turn router switch example into test

* seems to be working

* make it possible to host the router example on a sub-path

* create a 404 file for SPA

* remove the three examples and update table

* remove the 404 file because it isn't working anyway

* fix small router issue relating to the sub-path hack
2020-09-22 00:17:48 +02:00
Jani Mustonen
d19a1990c2
extend batch_callback for options (#1525)
* extend batch_callback for options

* fix callback documentation

* expand on the "callbacks" documentation

* Apply suggestions from code review

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

Co-authored-by: Simon <simon@siku2.io>
Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
2020-08-29 22:49:34 +02:00
bakape
2b584ca37b
Optimise vtag (#1447)
* yew/vtag: remove needless indirection

* yew/vtag: reduce VTag memory footprint

* Revert "yew/vtag: remove needless indirection"

This reverts commit 7c59c61e0e6b32261fe79d9b48f786bd880aed29.

* yew/vtag,yew-macro: optimise attribute setting and memory usage

* yew/vtag,yew-macro: reduce string memory footprint and use static strings more

* yew,yew-macro: opportunistically use static memory for VText

* yew/vtag: use String instead of Box<str>

* yew-macro: remove one extra iteration

* yew/vtag: remove API extension for textarea

* yew/vtag: remove extra calls

* yew-macro: preconstruct StringRef for class literals

* yew-macro: construct non-dynamic VTags in-place

* yew-macro: Insert class and href into attrs in-place

* *: run stable checks

* yew/vtag: use key-pair vector for attributes

* yew/macro,yew: use trait associated methods with paths, where possible

* Update yew/src/virtual_dom/vtag.rs

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Update yew/src/virtual_dom/vtag.rs

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Update yew/src/virtual_dom/vtag.rs

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Update yew/src/virtual_dom/vtag.rs

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Update yew/src/virtual_dom/vtag.rs

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Update yew/src/virtual_dom/vtag.rs

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* yew/vtag: comment clarification

as suggested by @teymour-aldridge

* yew/vtag: fix added test failing

* yew/vlist: revert removing key

* yew/vtag,yew-macro: stash VTagInner changes for later

* yew/vtag: restore diff_attributes() generating a patch list + add bechmarks

* yew: fix becnhmarks running with std_web

* yew: remove Href

* yew/vtag: fix comment changes

* examples: fix trait impl

* yew: swap Stringref with Cow

* examples: remove redundant clone

* ci: fix stable check

* yew/VText: remove needless constructor

* *: remove needless trait full paths

* yew/benchmarks: add IndexMap attribute diff becnhmark

* yew-macro: fix stderr regressions

* yew: convert Attributes to enum

with variants optimised for both the html! macro and the VTag API

* yew/benchmarks: move feature guard

* Update examples/common/src/markdown.rs

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>

* Update examples/common/src/markdown.rs

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>

* Update examples/common/src/markdown.rs

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>

* Update examples/common/src/markdown.rs

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>

* Update examples/common/src/markdown.rs

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>

* examples: remove unused import

* Apply suggestions from code review

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>

* yew-macro: rebuild stderr

* yew-macro: accept Into<Cow> for dynamic tags

* yew-macro: remove unneeded {} wrapping

* yew: revert doc comment

* yew/vtag: clean up attribute type conversion

* yew-macro: remove now supported literal failures

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
Co-authored-by: Justin Starry <justin.starry@icloud.com>
Co-authored-by: Justin Starry <justin.m.starry@gmail.com>
2020-08-22 18:45:02 +08:00
dependabot[bot]
db26269081
Update strum_macros requirement from 0.18 to 0.19 (#1473)
Updates the requirements on [strum_macros](https://github.com/Peternator7/strum) to permit the latest version.
- [Release notes](https://github.com/Peternator7/strum/releases)
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Peternator7/strum/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-08-15 16:53:20 +08:00
dependabot[bot]
c49e3aff9f
Update strum requirement from 0.18 to 0.19 (#1472)
Updates the requirements on [strum](https://github.com/Peternator7/strum) to permit the latest version.
- [Release notes](https://github.com/Peternator7/strum/releases)
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Peternator7/strum/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-08-15 16:49:45 +08:00
Heng
aa1a7c4e96
Fix TodoMVC example issues (#1471)
* Fix TodoMVC example bugs

* Fix TodoMVC example issue #221

* Fix TodoMVC example issue #221

* Update examples/todomvc/src/lib.rs

Co-authored-by: Simon <simon@siku2.io>

* Update examples/todomvc/src/lib.rs

Co-authored-by: Simon <simon@siku2.io>

* Update examples/todomvc/src/lib.rs

Co-authored-by: Simon <simon@siku2.io>

* Update lib.rs

Delete empty entries

* Update lib.rs

fix toggle all button

Co-authored-by: Simon <simon@siku2.io>
2020-08-08 16:30:36 +02:00
Heng
fbda559e2b
Fix TodoMVC example bugs (#1468) 2020-08-06 21:05:57 +02:00
Philip Peterson
309dbcba00
Update main yew examples (remove static dir) (#1417)
* remove static directory, move script to run_example.sh

* gitignore

* server infra

* Support --build-only

* fix npm_and_rest example

* Fix various static index.html's

* Fix spacing

* newlines at the end

* Cleanup

* tabs -> spaces

* line ending

* remove build_examples.sh

* Apply suggestions from code review

Co-authored-by: Simon <simon@siku2.io>

* format file and improve EXIT trap

Co-authored-by: Simon <simon@siku2.io>
2020-07-22 13:29:55 +02:00
hamza1311
60fe59e901
Update TodoMVC example's README (#1429) 2020-07-20 20:56:30 +02:00
Алексей Пастухов
d3708a2e6e
amendment of todomvc example (#1409)
* amendment of todomvc example

- makes it ready for wasm-pack build

mentioned in issues #1079 and #1016

* Update examples/todomvc/README.md

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Update examples/todomvc/README.md

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Update examples/todomvc/README.md

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
2020-07-20 14:37:05 +02:00
Simon
02b22d1737
Allow all global event handlers to be used as listeners (#1244)
* list all listener attributes

* add handlers for web_sys

* implement for stdweb

* update list of event handlers

* rename doubleclick to dblclick

* add error for unsupported listeners (stdweb)

* remove cfg-if dependency
2020-05-19 20:27:28 +08:00
fbucek
528ec66fbc
updated examples, added build script (#1165)
* script for building examples

minimal example updated to work with wasm-pack
minimal_wb exampel to be used with wasm-bindgen directly

* minimal is wasm-bindgen as default ( wp wasm-pack )

* examples updated to work with wasm-bindgen

* script to run all yew/examples

* upated example doc, added script to multi-thread

* cargo fmt, disabled build_examples.sh

* one build.sh for examples, updated doc

* removed build size optimalization

* wasm-pack requirement info in lib.rs

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/build.sh

Co-Authored-By: Justin Starry <justin.m.starry@gmail.com>

* Update examples/build.sh exit trap

Co-Authored-By: Justin Starry <justin.m.starry@gmail.com>

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>
2020-04-29 22:57:55 +08:00
Justin Starry
8423b1e9b9
Update README.md 2020-04-27 22:04:34 +08:00
dependabot-preview[bot]
6eaedf71e6
Update strum requirement from 0.13 to 0.18 (#1114)
Updates the requirements on [strum](https://github.com/Peternator7/strum) to permit the latest version.
- [Release notes](https://github.com/Peternator7/strum/releases)
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Peternator7/strum/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-04-22 11:20:10 +08:00
dependabot-preview[bot]
a497987eb6
Update strum_macros requirement from 0.13 to 0.18 (#1110)
Updates the requirements on [strum_macros](https://github.com/Peternator7/strum) to permit the latest version.
- [Release notes](https://github.com/Peternator7/strum/releases)
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Peternator7/strum/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-04-21 22:10:12 +08:00
Justin Starry
fa8a1d9f00
Reorganize examples and general repo layout (#1092)
* Reorganize crates

* Remove symlink

* Check examples

* Cleanup CI scripts

* nits

* cleanup

* cargo fmt

* Fix yew-stdweb

* cargo clippy --all

* stdweb-examples

* run_emscripten_checks.sh

* Fix typo

* fix typo

* yew-stdweb

* Run tests from yew-stdweb

* fix webgl script
2020-04-20 22:22:24 +08:00
Justin Starry
d38ce422f9
Add support for building with web-sys (#961)
* Enable travis

* `web-sys` general conversion (#826)

* Moved patches from different PRs.

* Add bits & pieces and some services.

* Rename `stdweb` feature to `std_web`.

* Move tests and examples to different PR.

* Revert some `cargo_web` handling removal.

* Missed something.

* Implement `console_error_panic_hook`.

* Update Cargo.toml

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>

* Move document creation to util convenience method (#855)

* `web-sys` listener conversion (#813)

* `web-sys` listener initial try.

* Improve macros?

* Remove generic from `EventListenerHandle`.

* Fix build.

* A cleaner solution?

* Even cleaner.

* Fix `build.rs`.

* Minor improvements.

* Following the yew toml style.

* Fixing visibility.

* Fix `rustfmt`.

* Add `web-sys` re-exports.

* Move general changes to different PR.

* Remove compat.

* Actually remove `compat.rs`.

* Rename `stdweb` feature to `std_web`.

* Move to gloo's `EventListener` and some polish.

* Remove outdated comment.

* Change `EventHandler` to be cancelled on drop.

* `web-sys` html conversion (#817)

* Converting all `html` parts.

* Format.

* Move general changes to different PR.

* Removed compat.

* Rename `stdweb` feature to `std_web`.

* Remove redudant function copy.

* Some polish.

* Move to gloo's `EventListener`.

* Replace `unwrap`s with `expect`s.

* `web-sys` agent conversion (#818)

* Converting `agent`.

* Remove wrong `cfg` in imports.

* Move general changes to different PR.

* Some optimisations.

* Rename `stdweb` feature to `std_web`.

* Fix `ArrayBuffer` to `Uint8Array` conversions.

* Add js module worker.

* Use `cfg-if`` and `cfg-match` to make things clearer.

* Fix `std_web` build.

* Add some polish.

* Add build guards for invalid build configs (#866)

* `web_sys` cfg conversion (#862)

* Use `cfg-if` and `cfg-match` and some polish.

* Mistakes were made.

* Missed line during rebasing.

* Mistakes were undone.

* Remove global.

* Remove part of `global!`.

* `web-sys` services conversion (#827)

* Convert `console`.

* Finish services.

* Some polish.

* Fix `ArrayBuffer` to `Uint8Array` conversions.

* Fix aborting fetch leading to error and some polish.

* Replaced some `unwrap`s with `expect`s.

* Use `cfg_if` and `cfg_match` and do some polish.

* Proper scoping.

* Some fixes.

* Move fetch and reader services to different PR.

* Revert split.

* Fix CI builds (#877)

* Fix derive_props_test

* Move tests (#897) (#898)

* `web-sys` fetch service conversion (#867)

* Split implementation.

* Import global.

* Import global.

* Revert split.

* Make fetch available again.

* Revert "Revert split."

This reverts commit 6e3f101dbedde2142f041467a8ae40ef5e3920c5.

* Re-revert split.

* Some polish.

* Move to `wasm_bindgen_futures`.

* Switch to `thiserror`.

* wip

* Update src/services/fetch/web_sys.rs

Co-Authored-By: daxpedda <daxpedda@gmail.com>

* Some more polish.

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>

* `web-sys` reader service conversion (#868)

* Split reader implementation.

* Revert split.

* Remove leftover files.

* Make reader available again.

* Revert "Revert split."

This reverts commit 8abdc9cf2b014ab61fef2c48d1af8927d9a5a330.

* Revert "Remove leftover files."

This reverts commit 188c6eb9693881c9987061de8deb29c6f4c613a4.

* Re-revert split.

* Polish.

* Forgot some part.

* Some polish.

* Some polish.

* `web-sys` examples/tests conversion (#841)

* Fix examples/tests to work with `web_sys`.

* Update `StorageService` usage.

* Split `stdweb` and `web-sys` examples.

* Fixing the shell script.

* Trying to reset file permissions.

* Update to new reader API.

* Update to new fetch API.

* Update to new fetch API.

* Re-enable examples CI.

* Deleted duplicate example.

* Some fixes.

* Fix rand build.

* Fix spawning workers in combination with `wasm-bindgen`. (#901)

* Fix component rendering process (#913)

* wip

* Fix component rendering process

* Simplify yew-macro a bit (#902)

* yew-macro: Simplify Properties validation

* Fix most clippy warnings

* Fix clippy warnings (#912)

* Import Task trait in dashboard example

* Remove duplicate vtag tests

* Fix prevent_default() by non-passive (#958)

* Fix prevent_default() by non-passive

* Fix cargo fmt

* Remove `Option` from most services.

* Remove `Option` from resize service.

* Apply fetch changes.

* Apply reader service changes.

* Fix `node_refs` example.

* Remove web-sys travis branch

Co-authored-by: daxpedda <daxpedda@gmail.com>
Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
Co-authored-by: Jet Li <jing.i.qin@icloud.com>
2020-02-29 17:25:42 +08:00
Justin Starry
f61667be97
Remove generics from virtual dom (#783)
* Fix tests

* Remove generics from virtual dom

* Prep for degenerify

* Fix examples

* Remove props cloning

* Fix tests
2019-12-08 10:47:51 -08:00
Justin Starry
f48bc90edb
Use callbacks in examples (#781) 2019-12-07 16:56:26 -08:00
Justin Starry
43e9347269
Add render method to Component and auto implement Renderable (#563)
* Add render method to Component and auto implement Renderable

* More cleanup

* Rename Renderable method from view to render

* Doc fixes

* fix

* Update CHANGELOG.md
2019-09-30 22:23:25 -04:00
Justin Starry
38300e6597 cargo fmt --all 2019-07-30 00:51:18 -04:00
Justin Starry
fe3d6249d3 Use updated jsx syntax in examples and documentation 2019-07-05 21:49:12 -04:00
Justin Starry
3963dc3dea Remove old html macro, default to new proc macro 2019-07-02 14:38:35 -04:00
Justin Starry
f9cf5ea47f Bump example recursion limits 2019-06-13 10:29:53 -04:00
etisdew
f6ac60fd1e
grammatical edit
I feel like this would be a small improvement. I'll patch this request with build steps while slightly redundant if you like as well.
2019-05-01 14:35:58 -07:00
Denis Kolodin
23f728aff9 Fix styles of TodoMVC example 2019-02-02 19:12:38 +03:00
Denis Kolodin
19dd9e719a Update strum 2019-02-02 18:07:43 +03:00
Denis Kolodin
2a1903cb4d Update all examples to Rust 2018 2019-02-02 16:03:07 +03:00
Denis Kolodin
fc7f7a97ea Add start_app method 2019-02-02 01:26:04 +03:00
Denis Kolodin
126f847d34 Remove CTX type of examples 2018-06-08 09:44:20 +03:00
Denis Kolodin
e73f025b09 Remove context argument from examples 2018-06-08 09:44:20 +03:00
Denis Kolodin
a8dd243d09 Add component's link to all examples 2018-06-08 09:44:20 +03:00
Denis Kolodin
4de5c1223b Set types for events of html macro 2018-05-22 08:03:08 +03:00
sainth
44d82caaa4 Use raw stdweb events for key- and mousevents 2018-05-18 22:55:29 +02:00
Limira
bea2fcfde0 Add onchange event and example 2018-05-06 15:20:45 +03:00
Denis Kolodin
ffd8a9890c Rename Msg type of Component to Message 2018-04-26 15:47:33 +03:00
Denis Kolodin
4eb37aed55 Adapt examples to a new loop with a scheduler 2018-04-25 11:52:13 +03:00
Denis Kolodin
deb838b2e1 Fix examples for the new context reference 2018-04-23 22:54:24 +03:00
Denis Kolodin
8f227f949b Move examplef out of showcase 2018-04-15 09:41:51 +03:00
Denis Kolodin
86af2b9d1c Move demos into the showcase 2018-04-09 22:04:57 +03:00
Denis Kolodin
1cec52140f Set properties on component creation
Fixes bug with initial value in custom_components example
2018-02-08 22:05:37 +03:00
Denis Kolodin
e38164bce2 Store todo entries only
Don't save full model
2018-01-21 18:24:24 +03:00
Denis Kolodin
daed071e6d
Merge pull request #91 from DenisKolodin/components
Components implementation
2018-01-15 21:00:50 +03:00
Denis Kolodin
daf1ddd51d Add Renderable trait, remove redundant App struct, rename ScopeRef to Env 2018-01-15 02:07:47 +03:00
CYBAI
92666dda11 Use peekable to check if filtered iterator is none or not 2018-01-13 23:59:23 +08:00
CYBAI
c667ffc454 Use all method to prevent allocating vector 2018-01-13 19:03:49 +08:00
Denis Kolodin
4618497bf7 Merge branch 'master' into components 2018-01-12 22:43:20 +03:00
Denis Kolodin
8a6f387eac Fix missing docs 2018-01-12 10:57:24 +03:00