Skip to content

Commit

Permalink
Merge branch 'yewstack:master' into update-docusaurus
Browse files Browse the repository at this point in the history
  • Loading branch information
moyeah authored Sep 23, 2023
2 parents 2e2a442 + 30e2d54 commit 9a1aeb8
Show file tree
Hide file tree
Showing 83 changed files with 3,064 additions and 658 deletions.
709 changes: 509 additions & 200 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ As an example, check out the TodoMVC example here: <https://examples.yew.rs/todo
| [timer_functional](timer_functional) | [F] | Demonstrates the use of the interval and timeout services using function components |
| [todomvc](todomvc) | [S] | Implementation of [TodoMVC](http://todomvc.com/). |
| [two_apps](two_apps) | [S] | Runs two separate Yew apps which can communicate with each other. |
| [web_worker_fib](web_worker_fib) | [S] | Calculate Fibonacci numbers in a web worker thread using [`gloo-worker`](https://docs.rs/gloo-worker/latest/gloo_worker/). |
| [web_worker_fib](web_worker_fib) | [F] | Calculate Fibonacci numbers in a web worker thread using [`yew-agent`](https://docs.rs/yew-agent/latest/yew_agent/). |
| [web_worker_prime](web_worker_prime) | [F] | Calculate Prime numbers in a web worker thread using [`yew-agent`](https://docs.rs/yew-agent/latest/yew_agent/). |
| [webgl](webgl) | [S] | Controls a [WebGL canvas](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Getting_started_with_WebGL) from Yew. |

[CT]: ## "Component Type"
Expand Down
2 changes: 1 addition & 1 deletion examples/async_clock/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ license = "MIT OR Apache-2.0"
yew = { path = "../../packages/yew", features = ["csr"] }
chrono = "0.4"
futures = "0.3"
gloo-net = "0.3"
gloo-net = "0.4"
2 changes: 1 addition & 1 deletion examples/boids/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ getrandom = { version = "0.2", features = ["js"] }
rand = "0.8"
serde = { version = "1.0", features = ["derive"] }
yew = { path = "../../packages/yew", features = ["csr"] }
gloo = "0.8"
gloo = "0.10"

[dependencies.web-sys]
version = "0.3"
Expand Down
1 change: 0 additions & 1 deletion examples/contexts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ edition = "2021"
license = "MIT OR Apache-2.0"

[dependencies]
serde = { version = "1.0", features = ["derive"] }
yew = { path = "../../packages/yew", features = ["csr"] }
yew-agent = { path = "../../packages/yew-agent" }
3 changes: 3 additions & 0 deletions examples/contexts/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
mod msg_ctx;
mod producer;
mod struct_component_producer;
mod struct_component_subscriber;
mod subscriber;

use msg_ctx::MessageProvider;
use producer::Producer;
use struct_component_producer::StructComponentProducer;
use struct_component_subscriber::StructComponentSubscriber;
use subscriber::Subscriber;
use yew::prelude::*;
Expand All @@ -14,6 +16,7 @@ pub fn App() -> Html {
html! {
<MessageProvider>
<Producer />
<StructComponentProducer />
<Subscriber />
<StructComponentSubscriber />
</MessageProvider>
Expand Down
4 changes: 1 addition & 3 deletions examples/contexts/src/producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ use super::msg_ctx::MessageContext;
pub fn Producer() -> Html {
let msg_ctx = use_context::<MessageContext>().unwrap();

let onclick = Callback::from(move |_| msg_ctx.dispatch("Message Received.".to_string()));

html! {
<button {onclick}>
<button onclick={move |_| msg_ctx.dispatch("Message Received.".to_string())}>
{"PRESS ME"}
</button>
}
Expand Down
27 changes: 27 additions & 0 deletions examples/contexts/src/struct_component_producer.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
use yew::prelude::*;

use super::msg_ctx::MessageContext;

pub struct StructComponentProducer;

impl Component for StructComponentProducer {
type Message = ();
type Properties = ();

fn create(_ctx: &Context<Self>) -> Self {
Self
}

fn view(&self, ctx: &Context<Self>) -> Html {
let (msg_ctx, _) = ctx
.link()
.context::<MessageContext>(Callback::noop())
.expect("No Message Context Provided");

html! {
<button onclick={move |_| msg_ctx.dispatch("Other message received.".to_owned())}>
{"OR ME"}
</button>
}
}
}
2 changes: 1 addition & 1 deletion examples/counter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
license = "MIT OR Apache-2.0"

[dependencies]
gloo = "0.8"
gloo = "0.10"
js-sys = "0.3"
yew = { path = "../../packages/yew", features = ["csr"] }
wasm-bindgen = "0.2"
4 changes: 2 additions & 2 deletions examples/dyn_create_destroy_apps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ license = "MIT OR Apache-2.0"
[dependencies]
js-sys = "0.3"
yew = { path = "../../packages/yew", features = ["csr"] }
slab = "0.4.8"
gloo = "0.8"
slab = "0.4.9"
gloo = "0.10"
wasm-bindgen = "0.2"

[dependencies.web-sys]
Expand Down
4 changes: 2 additions & 2 deletions examples/file_upload/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ license = "MIT OR Apache-2.0"
[dependencies]
js-sys = "0.3"
yew = { path = "../../packages/yew", features = ["csr"] }
base64 = "0.21.2"
gloo = "0.8"
base64 = "0.21.4"
gloo = "0.10"

[dependencies.web-sys]
version = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion examples/function_memory_game/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0"
serde = { version = "1.0", features = ["derive"] }
strum = "0.25"
strum_macros = "0.25"
gloo = "0.8"
gloo = "0.10"
nanoid = "0.4"
rand = "0.8"
getrandom = { version = "0.2", features = ["js"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/function_router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ rand = { version = "0.8", features = ["small_rng"] }
yew = { path = "../../packages/yew" }
yew-router = { path = "../../packages/yew-router" }
serde = { version = "1.0", features = ["derive"] }
gloo = "0.8"
gloo = "0.10"
wasm-logger = "0.2"
instant = { version = "0.1", features = ["wasm-bindgen"] }
once_cell = "1"
Expand Down
2 changes: 1 addition & 1 deletion examples/function_todomvc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0"
serde = { version = "1.0", features = ["derive"] }
strum = "0.25"
strum_macros = "0.25"
gloo = "0.8"
gloo = "0.10"
yew = { path = "../../packages/yew", features = ["csr"] }

[dependencies.web-sys]
Expand Down
2 changes: 1 addition & 1 deletion examples/futures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pulldown-cmark = { version = "0.9", default-features = false }
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
yew = { path = "../../packages/yew", features = ["csr"] }
gloo = "0.8"
gloo = "0.10"

[dependencies.web-sys]
version = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion examples/game_of_life/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ log = "0.4"
rand = "0.8"
wasm-logger = "0.2"
yew = { path = "../../packages/yew", features = ["csr"] }
gloo = "0.8"
gloo = "0.10"
2 changes: 1 addition & 1 deletion examples/inner_html/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0"

[dependencies]
yew = { path = "../../packages/yew", features = ["csr"] }
gloo = "0.8"
gloo = "0.10"

[dependencies.web-sys]
version = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion examples/keyed_list/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
license = "MIT OR Apache-2.0"

[dependencies]
fake = "2.6.1"
fake = "2.8.0"
getrandom = { version = "0.2", features = ["js"] }
instant = { version = "0.1", features = ["wasm-bindgen"] }
log = "0.4"
Expand Down
2 changes: 1 addition & 1 deletion examples/mount_point/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
[dependencies]
wasm-bindgen = "0.2"
yew = { path = "../../packages/yew", features = ["csr"] }
gloo = "0.8"
gloo = "0.10"

[dependencies.web-sys]
version = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion examples/password_strength/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2021"
[dependencies]
yew = { path = "../../packages/yew", features = ["csr"] }
zxcvbn = "2.2.2"
time = "0.3.22"
time = "0.3.28"
js-sys = "0.3.64"
web-sys = { version = "0.3", features = ["Event","EventTarget","InputEvent"] }
wasm-bindgen = "0.2"
Expand Down
2 changes: 1 addition & 1 deletion examples/portals/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0"

[dependencies]
yew = { path = "../../packages/yew", features = ["csr"] }
gloo = "0.8"
gloo = "0.10"
wasm-bindgen = "0.2"

[dependencies.web-sys]
Expand Down
2 changes: 1 addition & 1 deletion examples/router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ yew = { path = "../../packages/yew", features = ["csr"] }
yew-router = { path = "../../packages/yew-router" }
serde = { version = "1.0", features = ["derive"] }
once_cell = "1"
gloo = "0.8"
gloo = "0.10"
10 changes: 5 additions & 5 deletions examples/simple_ssr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ required-features = ["ssr"]

[dependencies]
yew = { path = "../../packages/yew" }
reqwest = { version = "0.11.18", features = ["json"] }
serde = { version = "1.0.164", features = ["derive"] }
uuid = { version = "1.4.0", features = ["serde"] }
reqwest = { version = "0.11.20", features = ["json"] }
serde = { version = "1.0.188", features = ["derive"] }
uuid = { version = "1.4.1", features = ["serde"] }
futures = "0.3"
bytes = "1.4"
bytes = "1.5"

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen-futures = "0.4"
wasm-logger = "0.2"
log = "0.4"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { version = "1.29.0", features = ["full"] }
tokio = { version = "1.32.0", features = ["full"] }
warp = "0.3"
clap = { version = "4", features = ["derive"] }

Expand Down
2 changes: 1 addition & 1 deletion examples/ssr_router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ wasm-bindgen-futures = "0.4"
wasm-logger = "0.2"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { version = "1.29.0", features = ["full"] }
tokio = { version = "1.32.0", features = ["full"] }
axum = "0.6"
tower = { version = "0.4", features = ["make"] }
tower-http = { version = "0.3", features = ["fs"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/suspense/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"

[dependencies]
yew = { path = "../../packages/yew", features = ["csr"] }
gloo = { version = "0.8", features = ["futures"] }
gloo = { version = "0.10", features = ["futures"] }
wasm-bindgen-futures = "0.4"
wasm-bindgen = "0.2"

Expand Down
2 changes: 1 addition & 1 deletion examples/timer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ license = "MIT OR Apache-2.0"
[dependencies]
yew = { path = "../../packages/yew", features = ["csr"] }
js-sys = "0.3"
gloo = "0.8"
gloo = "0.10"
wasm-bindgen = "0.2"
2 changes: 1 addition & 1 deletion examples/timer_functional/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ edition = "2021"
license = "MIT OR Apache-2.0"

[dependencies]
gloo = "0.8.1"
gloo = "0.10.0"
js-sys = "0.3.64"
yew = { path = "../../packages/yew", features = ["csr"] }
2 changes: 1 addition & 1 deletion examples/todomvc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ strum_macros = "0.25"
serde = "1"
serde_derive = "1"
yew = { path = "../../packages/yew", features = ["csr"] }
gloo = "0.8"
gloo = "0.10"

[dependencies.web-sys]
version = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion examples/two_apps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ license = "MIT OR Apache-2.0"

[dependencies]
yew = { path = "../../packages/yew", features = ["csr"] }
gloo = "0.8"
gloo = "0.10"
3 changes: 2 additions & 1 deletion examples/web_worker_fib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ yew-agent = { path = "../../packages/yew-agent" }
wasm-bindgen = "0.2"
js-sys = "0.3"
web-sys = { version = "0.3", features = [ "HtmlInputElement" ] }
serde = "1"
serde = { version = "1", features = ["derive"] }
postcard = "1.0.7"
2 changes: 1 addition & 1 deletion examples/web_worker_fib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Calculate fibrillation value of a number in the worker thread, without blocking

## Concepts

The example illustrates how to use `gloo-worker` to send tasks to a worker thread in a Yew application.
The example illustrates how to use `yew-agent` to send tasks to a worker thread in a Yew application.

## Thanks to

Expand Down
14 changes: 8 additions & 6 deletions examples/web_worker_fib/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8">
<title>Yew • Web Worker Fibonacci</title>
<title>Yew • Web Worker Fibonacci</title>

<link data-trunk rel="rust" href="Cargo.toml" data-bin="app" data-type="main" data-weak-refs />
<link data-trunk rel="rust" href="Cargo.toml" data-bin="worker" data-type="worker" data-weak-refs />
</head>

<link data-trunk rel="rust" href="Cargo.toml" data-bin="app" data-type="main" />
<link data-trunk rel="rust" href="Cargo.toml" data-bin="worker" data-type="worker" />
</head>
<body>
</body>

<body>
</body>
</html>
Loading

0 comments on commit 9a1aeb8

Please sign in to comment.