-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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:tm: * clean up multi_thread * fix format * boids part 1 * boids part 2 * add workflow See: <siku2#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
- Loading branch information
Showing
247 changed files
with
6,315 additions
and
6,110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Publish Examples | ||
on: | ||
push: | ||
branches: [master] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
env: | ||
# leave empty for / | ||
PUBLIC_URL_PREFIX: "" | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
target: wasm32-unknown-unknown | ||
override: true | ||
profile: minimal | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
target | ||
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }} | ||
restore-keys: | | ||
cargo-${{ runner.os }}- | ||
- name: Install trunk | ||
run: cargo install trunk wasm-bindgen-cli | ||
|
||
- name: Build examples | ||
run: | | ||
output="$(pwd)/dist" | ||
for path in examples/*; do | ||
if [[ ! -d $path ]]; then | ||
continue | ||
fi | ||
example=$(basename "$path") | ||
# multi_thread doesn't work yet. See <https://github.com/thedodd/trunk/issues/40>. | ||
if [[ "$example" == "multi_thread" ]]; then | ||
continue | ||
fi | ||
echo "building: $example" | ||
( | ||
cd "$path" | ||
dist_dir="$output/$example" | ||
export PUBLIC_URL="$PUBLIC_URL_PREFIX/$example" | ||
trunk build --release --dist "$dist_dir" --public-url "$PUBLIC_URL" | ||
) | ||
done | ||
- name: Deploy | ||
uses: peaceiris/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
*/static/package.json | ||
*/static/wasm_bg.wasm | ||
*/static/wasm_bg.d.ts | ||
*/static/wasm.d.ts | ||
*/static/wasm.js | ||
*/dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,8 @@ authors = ["motoki saito <[email protected]>"] | |
edition = "2018" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
[dependencies] | ||
rand = { version = "0.7.3", features = ["wasm-bindgen"] } | ||
anyhow = "1.0" | ||
rand = { version = "0.7", features = ["wasm-bindgen"] } | ||
serde = { version = "1.0", features = ["derive"] } | ||
yew = { path = "../../yew" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Boids Example | ||
|
||
A version of [Boids](https://en.wikipedia.org/wiki/Boids) implemented in Yew. | ||
|
||
This example doesn't make use of a [Canvas](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API), | ||
instead, each boid has its own element demonstrating the performance of Yew's virtual DOM. | ||
|
||
## Running | ||
|
||
You should run this example with the `--release` flag: | ||
|
||
```bash | ||
trunk serve --release | ||
``` | ||
|
||
## Concepts | ||
|
||
The example uses [`IntervalService`] to drive the game loop. | ||
|
||
## Improvements | ||
|
||
- Add the possibility to switch the behaviour from flocking to scattering by inverting the cohesion rule so that boids avoid each other. | ||
This should also invert the color adaption to restore some variety. | ||
- Add keyboard shortcuts (using the `KeyboardService`) for the actions. | ||
- Make it possible to hide the settings panel entirely | ||
- Bigger boids should accelerate slower than smaller ones | ||
- Share settings by encoding them into the URL | ||
- Resize the boids when "Spacing" is changed. | ||
The setting should then also be renamed to something like "Size". | ||
|
||
[`intervalservice`]: https://docs.rs/yew/latest/yew/services/struct.IntervalService.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Yew • Boids</title> | ||
|
||
<link rel="stylesheet" href="index.scss" /> | ||
</head> | ||
|
||
<body></body> | ||
</html> |
Oops, something went wrong.