352 Commits

Author SHA1 Message Date
Heng
fbda559e2b
Fix TodoMVC example bugs (#1468) 2020-08-06 21:05:57 +02:00
Simon
72d0b2fbaa
Update Game of Life example (#1462)
* update game_of_life example
2020-08-02 20:52:54 +02:00
Simon
b57b8f83d6
Rewrite the README file for the examples (#1440)
* rewrite examples readme

* update the readme

* add a table describing each example

* reword line

* Apply suggestions from code review

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-24 17:30:34 +02:00
Алексей Пастухов
fb27791332
Example build hardening (#1430)
* run_example.sh checks example existens

the script exits if without example name parameter
or if example directory doesn't exist

* Update examples/run_example.sh

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

* Update examples/run_example.sh

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

Co-authored-by: Simon <simon@siku2.io>
2020-07-22 16:30:36 +02:00
Simon
7f6543a1b9
only add charset for text mime types (#1436) 2020-07-22 14:38:13 +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
Jonas Platte
105422b987
Make more service's methods static (#1382) 2020-07-09 13:40:12 +08:00
Thomas Lacroix
429d9674af
Fix keyed list ordering issue (#1231)
* New example to showcase keyed elems reordering issue

* Allow building examples in release mode

* Fix ordering issue with keyed virtual nodes

* review comments for build.sh

* review comments for examples/keyed_list

* fix style.css to keyed_list example

* remove ahash

* Add GitHub issue to TODO in key.rs

* Address some review comments in virtual_dom

* New diffing algorithm for keyed vlists

* Add forgotten dependency for yew-stdweb

* Add tests for vlist diffing

* Removed VDiffNodePosition

* Fix usage of next_sibling for vlist

* Fix tests for stdweb

* Mitigate issue with moving VLists when children are all VLists

Note: The new UT is failing, I now. I want to discuss that before
maybe fixing it (moving all VList children?).

* Fix issue with inserting into vlist that is not last child

* Refactor VDiff trait to make way for keyed list fixes

* Fix quote_spanned macro invocations

* Revert some minor changes (style, Debug)

* Revert some minor changes (style, Debug)

* Fix self-referencing NodeRef issue

* All VList tests pass

* Fix algorithm choice in degenerated case

* Remove stdweb and non keyed tests

* Key from finite list of types

* WIP moving VList tests to diff_layouts

* Removed unnecessary Vec

* Fix VComp NodeRef self linking issue

* Add logs to diff_layouts tests

* WIP moving VList tests to diff_layouts

* WIP Failing test moving VComp

* Add VComp move_before

* Fix list component change method

* Fix bad merge

* Add more protection against node ref cycles

* Remove commented tests

* Feedback and clippy

* Failing test

* tests pass

Co-authored-by: Justin Starry <justin.starry@icloud.com>
2020-06-29 00:52:59 +08:00
Martin Matusiak
7ce0bd8d3a
Fix broken examples (#1289) - batch #1 (#1340)
* Update run instructions

`python3 -m http.server --directory` flag was added in Python 3.7.
Change instructions to cd into static and skip the flag instead -
makes it work with earlier Pythons too.

* Add visual feedback for button click

The minimal example has a button, but clicking it does nothing. This
makes it hard to tell whether the example works or not.

This adds a label that is update when the button is clicked.

* Small improvements to crm example

* Add a heading to each scene to make it more obvious what the page is
for.

* Improve layout of input form by stack the inputs vertically.

* Add a little space between entries when displaying the list.

* Add a hint to the Description input that Markdown can be used.

* Add an explanation to the file_upload example

* Clarify purpose of var in fragments example

* Improve futures_wp example

* Add a second button that demonstrates an unsuccessful fetch.

* Render the markdown document (since we're fetching markdown after
all).

* Remove vague comment that's not really helping.

* Improve inner_html example

* Include a textual explanation of what the example is doing.

* Run cargo fmt

* Remove 'static lifetime for constant

* Improve suggestion in inner_html example

* move markdown.rs to a common crate

* add description to common Cargo.toml

* PR feedback

* PR feedback

* remove static lifetime annotation
2020-06-26 20:29:58 +08:00
Jens Getreu
996574437a
Fix game of life (#1339)
* follow changes in rand crate

`wasm-bindgen` feature is not forwarded any more. See:
0aa461715b

* update index.html to new template

See:
https://yew.rs/docs/getting-started/build-a-sample-app

* correct dimensions of playground

tested with Firefox 77.0.1

* Update examples/game_of_life/src/lib.rs

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

Co-authored-by: Jens Getreu <getreu@saar1.lan>
Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
2020-06-22 15:32:41 +08:00
Teymour Aldridge
e0aec40fe0
Make methods static. (#1313)
* Make methods static.

* Fix a call.

* Fix examples.

* Fix examples.

* Fix rest of examples.

* Fix yew-functional.

* Fix interval service example.

* Fix webgl example.

* Fix dialogue service example.

* Use `Default` trait instead of `new()` in `npm_and_rest` example.

* Use `Default` trait instead of `new()` in `npm_and_rest` example.

* Remove use of the `Option` algebraic data type.

* Fix clippy warnings.
2020-06-22 15:32:04 +08:00
Simon
d792e37bff
Unify and change children logic in the html macro (#1275)
* add test to assert iterators work

* update test

* a few minor adjustments

* remove redundant wrappers around htmltree

* we're going down the rabbit hole

* components are broken but everything else works

* we're getting there

* working prototype

* test vector as children method for all containers

* more appropriate names and some comments

* ChildrenRenderer handling

* update tests to include ChildrenRenderer

* trigger tests to re-run

* improve error messages for invaid iterables

* improve html_nested!
2020-06-09 09:34:23 +08:00
Arif Driessen
92c38b07ea
accept trailing / from argument (#1293) 2020-06-09 00:53:06 +08:00
silvioprog
8629f25e48
Added wasm-bindgen-cli to documentation (examples) as suggested by @Christopher-St (Fix #1288) (#1290) 2020-06-06 17:44:25 +08:00
Maciek Talaśka
1c3d67f45c
wasm-bindgen-cli is required now for examples to compile (#1273) 2020-05-31 10:22:29 +08:00
Michal Kawalec
9130f814af
A stateful agent (#1247)
* first sketch of a stateful agent

* share the data with listeners only immutably

* rename the stateful agent to Store

* moved stuff around, fixed missing parts

* removed a useless directory

* fmt fixes

* added missing comments
2020-05-21 22:21:41 +08:00
Teymour Aldridge
6583b38c17
Fix a typo in build.sh (#1253) 2020-05-21 21:41:26 +08: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
Michal Kawalec
6e418ae9ae
added a simple send_message in Agent example (#1234)
* added a simple send_message in Agent example

* missing comma
2020-05-16 14:13:49 +08:00
Teymour Aldridge
5f7e03be31
Make fetch service methods static. (#1235)
* Make fetch methods static.

* Update `FetchService.fetch_binary`

* Updated documentation.

* Update examples.

* Added explicit lifetimes.

* Reformat code.

* Update a reference from `fetch_service` to `FetchService`.

* Reformat yew-stdweb example.

* Update a doc comment.
2020-05-16 14:08:25 +08:00
Thomas Lacroix
6ef7cecbfe
Enable Agents to send messages to themselves. (#1215)
* Agents can now send messages to themselves

* Agents callbacks now accept Into<Message>

* Clean old comment

* Remove AgentLink's send_message_batch
2020-05-14 11:22:58 +08:00
stoically
a90885cedb
Update examples (#1196) 2020-05-13 10:52:33 +08:00
Michal Kawalec
eb841bb7cf
Conditially require serialize (#1195)
* conditially require serialize

* we're using a trait alias and a clearer implementation of the constraints

* after merging with separated agent

* no trait aliases :(

* specialized the types for Drop a bit

* added an additional constraint on an agent

* emitted with fmt fixes

* dropped the useless debug constraint on the input

* fix stdweb examples

* dropped unneeded debug constraints

* linter
2020-05-12 16:43:21 +08:00
Teymour Aldridge
3474b54bca
Don't store FetchService as a struct field. (#1204) 2020-05-11 22:35:23 +08:00
Teymour Aldridge
860460b318
Make examples/README.md clearer (#1200) 2020-05-10 23:23:23 +08:00
Justin Starry
d5bb263b84
Update props properly in nested list example (#1189) 2020-05-06 15:53:05 +08:00
Nikita
1025000feb
Remove Bulk from counter examples (#1184) 2020-05-04 10:13:35 +08:00
Stig Johan Berggren
d7156eee99
Replace web_logger with wasm-logger in examples (#1181)
* Replace web_logger with wasm-logger in examples

Examples in yew-stdweb should still use web_logger

* Use hyphen in package name
2020-05-03 17:17:44 +08:00
Stig Johan Berggren
41a661fc12
Add README for Custom components example (#1170)
* Add readme for custom_components

* Markdown link and consistent header style

* Remove trailing space, consistent file name
2020-05-03 12:19:38 +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
Liquidblock
d42119251d
Do not set empty classes and support option wrapped class names (#1085)
* Prevent setting empty class string in DOM

* Use the className property for setting classes in DOM

* Update documentation of VTag::diff_classes

* Add test cases for checking if the class_name is not set for empty class attributes

* Add class to SVG g element in the supports_svg test

* Revert "Use the className property for setting classes in DOM"

This reverts commit 41bfbc3218ce17310d7b9fa6ac99cb0049a34911.

* Use patches for the class attribute and remove classes with remove_attribute

* Set classes directly as class attribute

* Fix markdown example

* Remove set_classes and classes from VTag
Add possibility to use different types in the class tuple
Add convertion to Classes from Option<T> where T: AsRef<str>

* Remove mut from variable that does not need to be
Add `::` to create an absolute path to std

* Use helper methods for classes in tests

* Add test case for Option<&'static str> variable

* Remove unnecessary map in test
2020-04-29 08:59:47 +08:00
Justin Starry
8423b1e9b9
Update README.md 2020-04-27 22:04:34 +08:00
Justin Starry
037d18c46f
Remove old cargo file (#1130) 2020-04-25 17:23:58 +08:00
Justin Starry
a91e7f6512
Replace mounted with rendered lifecycle method (#1072)
* Replace mounted with rendered lifecycle method

* Cleanup
2020-04-25 17:00:20 +08:00
Sebastian Zivota
3b669fab70
Make examples compile with wasm-pack (#1124)
Co-authored-by: Sebastian Zivota <sebastian.zivota@mailbox.org>
2020-04-24 16:17:59 +08:00
Luke Randall
ce020d6eb8
Update pulldown cmark (#1120)
* Update to version 0.7.0

* Use new Options struct

* Fix rule support

* Fix link tag

* Remove code tag

* Fix code block tag

* Fix image tag

* Fix heading tag

* Add strikethrough tag

* Run cargo fmt
2020-04-23 08:43:26 +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]
94ae9c7765
Update rand requirement from 0.6.5 to 0.7.3 (#1111)
Updates the requirements on [rand](https://github.com/rust-random/rand) to permit the latest version.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/0.6.5...0.7.3)

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:11:01 +08:00
dependabot-preview[bot]
56160ee76d
Update tungstenite requirement from 0.5.2 to 0.10.1 (#1113)
Updates the requirements on [tungstenite](https://github.com/snapview/tungstenite-rs) to permit the latest version.
- [Release notes](https://github.com/snapview/tungstenite-rs/releases)
- [Commits](https://github.com/snapview/tungstenite-rs/compare/v0.5.2...v0.10.1)

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:44 +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
Bill
6c16c8c134
Fix examples (#1093)
* ci: verify all examples build.

Using examples/showcase masked breakages in multiple examples.

* examples/future: add change implementation.

* examples/minimal: add change implementation.

* examples/nested_list: add change implementation.

* ci: add block lists to skip some examples.
2020-04-20 15:42:50 +08:00
Sebastian Zivota
b62e4daf47
Fixed library types in Cargo.toml (for wasm-pack) (#1088)
Also added some missing implementations of Component::change

Co-authored-by: Sebastian Zivota <sebastian.zivota@mailbox.org>
2020-04-19 22:53:38 +08:00
Bryan J Swift
9651d07e83
Fix errors in the TwoApps showcase example (#1078)
* Use the `Msg::SetOpposite` in `two_apps` example

b4d5227e625640ee2aca548ee06499dfe90c8acf changed the name of
`Msg::SetScope` to `Msg::SetOpposite` but the usages in the `main`
functions of the `two_apps` examples were not updated.

* Use new `TwoModels` struct as the `TwoApps` scene

`TwoModels` is a `Component` that does not respond to changes but which
creates two instances of the `Model` and mounts them as separate
`yew::App<Model>` instances in the body. This is done to mimic the
behavior of `two_apps/src/main.rs` which uses a static `index.html` file
containing the `div.first-app` and `div.second-app` elements.
`TwoModels::mounted` is responsible for replacing the `<div>` nodes it
creates during the initial render with the `Model` components.
2020-04-13 22:31:23 +08:00
Teymour Aldridge
d716dd010a
Added missing Component::change impl for pub_sub example. (#1083) 2020-04-13 20:33:25 +08:00
Justin Starry
8edf136da6
Make Component::change impl mandatory (#1071) 2020-04-04 16:12:07 +08:00
Justin Starry
0bf364a9fc
Update wasm-bindgen to 0.2.60 (#1056) 2020-03-28 12:03:43 +08:00
Andrew Straw
f69da6b7c5
Make web sys version of webgl example (#1050)
* move webgl example to std_web subdir

* create web-sys port of webgl example

* cleanup stdweb webgl example

* fix web-sys webgl readme
2020-03-23 23:44:51 +08:00