Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#[cfg(feature = "render")] and yew::Renderer #2498

Merged
merged 35 commits into from
Mar 19, 2022
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b5af7b1
Bring changes to this branch.
futursolo Mar 6, 2022
5cbff1d
Bring changes to this branch.
futursolo Mar 6, 2022
d34272e
Add feature render and renderer.
futursolo Mar 6, 2022
be3e202
Bring changes to this branch.
futursolo Mar 6, 2022
4a5ab80
Migrate examples to Renderer.
futursolo Mar 6, 2022
8bfc524
Satisfy no any render.
futursolo Mar 6, 2022
b3233b6
Satisfy ssr.
futursolo Mar 6, 2022
4e802e2
Satisfy feature render.
futursolo Mar 6, 2022
839c4e1
Lint feature soundness.
futursolo Mar 6, 2022
171d01a
Suppress tests.
futursolo Mar 6, 2022
f0885b8
Fix pr-flow, update docs.
futursolo Mar 6, 2022
d2a45f0
Add a notice.
futursolo Mar 6, 2022
9584d0e
Adjust visibility.
futursolo Mar 6, 2022
aedfed6
Correctly feature gate tests.
futursolo Mar 6, 2022
387d6a3
make test scope available under feature render.
futursolo Mar 6, 2022
88a6997
Fix CI.
futursolo Mar 6, 2022
179993a
Fix CI.
futursolo Mar 6, 2022
c6284c5
Restore tests module to its original place as well.
futursolo Mar 6, 2022
c58a0af
Make bundles crate private.
futursolo Mar 6, 2022
3c528f9
Make most bundle APIs private.
futursolo Mar 7, 2022
4ec2429
Adjust docs.
futursolo Mar 7, 2022
94106f6
Adjust debug implementation.
futursolo Mar 7, 2022
b2faefd
Merge branch 'master' into feat-render
futursolo Mar 8, 2022
bdfd6b6
Replace start_app with Renderer.
futursolo Mar 8, 2022
48ea00f
Merge branch 'master' into feat-render
futursolo Mar 8, 2022
6b4f511
Adjust documentation.
futursolo Mar 9, 2022
de9a2a0
Remove unused lint.
futursolo Mar 9, 2022
5fa2047
Remove start_app from docs.
futursolo Mar 11, 2022
723cf83
DomBundle -> ReconcileTarget.
futursolo Mar 11, 2022
268ae40
Adjust documentation.
futursolo Mar 17, 2022
b50b66c
Merge branch 'master' into feat-render
futursolo Mar 18, 2022
4506d4a
Merge branch 'master' into feat-render
futursolo Mar 18, 2022
1441078
merge 'master' into feat-render.
futursolo Mar 18, 2022
1fa57f0
Once render, now csr.
futursolo Mar 19, 2022
a3efdb2
Fix docs as well.
futursolo Mar 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .github/workflows/main-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ jobs:
command: clippy
args: --all-targets -- -D warnings

- name: Lint feature soundness
run: |
cargo clippy -- --deny=warnings
cargo clippy --features=ssr -- --deny=warnings
cargo clippy --features=render -- --deny=warnings
cargo clippy --all-features --all-targets -- --deny=warnings
working-directory: packages/yew


clippy-release:
name: Clippy on release profile
Expand All @@ -49,6 +57,14 @@ jobs:
command: clippy
args: --all-targets --release -- -D warnings

- name: Lint feature soundness
run: |
cargo clippy --release -- --deny=warnings
cargo clippy --release --features=ssr -- --deny=warnings
cargo clippy --release --features=render -- --deny=warnings
cargo clippy --release --all-features --all-targets -- --deny=warnings
working-directory: packages/yew


doc_tests:
name: Documentation Tests
Expand Down Expand Up @@ -180,4 +196,3 @@ jobs:
with:
command: test
args: -p yew-macro test_html_lints --features lints

2 changes: 1 addition & 1 deletion examples/agents/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ license = "MIT OR Apache-2.0"
log = "0.4"
serde = { version = "1.0", features = ["derive"] }
wasm-logger = "0.2"
yew = { path = "../../packages/yew" }
yew = { path = "../../packages/yew", features = ["render"] }
yew-agent = { path = "../../packages/yew-agent" }
gloo-timers = "0.2"
2 changes: 1 addition & 1 deletion examples/agents/src/bin/app.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fn main() {
wasm_logger::init(wasm_logger::Config::default());
yew::start_app::<agents::App>();
yew::Renderer::<agents::App>::new().render();
}
2 changes: 1 addition & 1 deletion examples/boids/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ anyhow = "1.0"
getrandom = { version = "0.2", features = ["js"] }
rand = "0.8"
serde = { version = "1.0", features = ["derive"] }
yew = { path = "../../packages/yew" }
yew = { path = "../../packages/yew", features = ["render"] }
gloo = "0.6"

[dependencies.web-sys]
Expand Down
2 changes: 1 addition & 1 deletion examples/boids/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,5 @@ impl App {
}

fn main() {
yew::start_app::<App>();
yew::Renderer::<App>::new().render();
}
2 changes: 1 addition & 1 deletion examples/contexts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ license = "MIT OR Apache-2.0"

[dependencies]
serde = { version = "1.0", features = ["derive"] }
yew = { path = "../../packages/yew" }
yew = { path = "../../packages/yew", features = ["render"] }
yew-agent = { path = "../../packages/yew-agent" }
2 changes: 1 addition & 1 deletion examples/contexts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ pub fn App() -> Html {
}

fn main() {
yew::start_app::<App>();
yew::Renderer::<App>::new().render();
}
2 changes: 1 addition & 1 deletion examples/counter/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]
gloo-console = "0.2"
js-sys = "0.3"
yew = { path = "../../packages/yew" }
yew = { path = "../../packages/yew", features = ["render"] }
wasm-bindgen = "0.2"
2 changes: 1 addition & 1 deletion examples/counter/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ impl Component for App {
}

fn main() {
yew::start_app::<App>();
yew::Renderer::<App>::new().render();
}
2 changes: 1 addition & 1 deletion examples/dyn_create_destroy_apps/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]
js-sys = "0.3"
yew = { path = "../../packages/yew" }
yew = { path = "../../packages/yew", features = ["render"] }
slab = "0.4.3"
gloo = "0.6"
wasm-bindgen = "0.2"
Expand Down
7 changes: 4 additions & 3 deletions examples/dyn_create_destroy_apps/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@ impl Component for App {
// Get the key for the entry and create and mount a new CounterModel app
// with a callback that destroys the app when emitted
let app_key = app_entry.key();
let new_counter_app = yew::start_app_with_props_in_element(
let new_counter_app = yew::Renderer::<CounterModel>::with_root_and_props(
app_div.clone(),
CounterProps {
destroy_callback: ctx
.link()
.callback(move |_| Msg::DestroyCounterApp(app_key)),
},
);
)
.render();

// Insert the app and the app div to our app collection
app_entry.insert((app_div, new_counter_app));
Expand Down Expand Up @@ -107,5 +108,5 @@ impl Component for App {

fn main() {
// Start main app
yew::start_app::<App>();
yew::Renderer::<App>::new().render();
}
2 changes: 1 addition & 1 deletion examples/file_upload/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]
js-sys = "0.3"
yew = { path = "../../packages/yew" }
yew = { path = "../../packages/yew", features = ["render"] }
gloo-file = "0.2"

[dependencies.web-sys]
Expand Down
2 changes: 1 addition & 1 deletion examples/file_upload/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,5 @@ impl App {
}

fn main() {
yew::start_app::<App>();
yew::Renderer::<App>::new().render();
}
2 changes: 1 addition & 1 deletion examples/function_memory_game/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ gloo = "0.4"
nanoid = "0.4"
rand = "0.8"
getrandom = { version = "0.2", features = ["js"] }
yew = { path = "../../packages/yew" }
yew = { path = "../../packages/yew", features = ["render"] }

[dependencies.web-sys]
version = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion examples/function_memory_game/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ mod state;
use crate::components::app::App;

fn main() {
yew::start_app::<App>();
yew::Renderer::<App>::new().render();
}
3 changes: 3 additions & 0 deletions examples/function_router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ wasm-logger = "0.2"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
instant = { version = "0.1" }

[features]
render = ["yew/render"]
1 change: 1 addition & 0 deletions examples/function_router/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css"
/>
<link data-trunk rel="sass" href="index.scss" />
<link data-trunk rel="rust" data-cargo-features="render" />
</head>

<body></body>
Expand Down
3 changes: 2 additions & 1 deletion examples/function_router/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ pub use app::*;
fn main() {
#[cfg(target_arch = "wasm32")]
wasm_logger::init(wasm_logger::Config::new(log::Level::Trace));
yew::start_app::<App>();
#[cfg(feature = "render")]
yew::Renderer::<App>::new().render();
}
2 changes: 1 addition & 1 deletion examples/function_todomvc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ serde = { version = "1.0", features = ["derive"] }
strum = "0.24"
strum_macros = "0.24"
gloo = "0.6"
yew = { path = "../../packages/yew" }
yew = { path = "../../packages/yew", features = ["render"] }

[dependencies.web-sys]
version = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion examples/function_todomvc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,5 @@ fn app() -> Html {
}

fn main() {
yew::start_app::<App>();
yew::Renderer::<App>::new().render();
}
2 changes: 1 addition & 1 deletion examples/futures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0"
pulldown-cmark = { version = "0.9", default-features = false }
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
yew = { path = "../../packages/yew", features = ["tokio"] }
yew = { path = "../../packages/yew", features = ["tokio", "render"] }
gloo-utils = "0.1"

[dependencies.web-sys]
Expand Down
2 changes: 1 addition & 1 deletion examples/futures/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,5 @@ impl Component for App {
}

fn main() {
yew::start_app::<App>();
yew::Renderer::<App>::new().render();
}
2 changes: 1 addition & 1 deletion examples/game_of_life/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ getrandom = { version = "0.2", features = ["js"] }
log = "0.4"
rand = "0.8"
wasm-logger = "0.2"
yew = { path = "../../packages/yew" }
yew = { path = "../../packages/yew", features = ["render"] }
gloo-timers = "0.2"
2 changes: 1 addition & 1 deletion examples/game_of_life/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,5 @@ fn wrap(coord: isize, range: isize) -> usize {
fn main() {
wasm_logger::init(wasm_logger::Config::default());
log::trace!("Initializing yew...");
yew::start_app::<App>();
yew::Renderer::<App>::new().render();
}
2 changes: 1 addition & 1 deletion examples/inner_html/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]
yew = { path = "../../packages/yew" }
yew = { path = "../../packages/yew", features = ["render"] }
gloo-utils = "0.1"

[dependencies.web-sys]
Expand Down
2 changes: 1 addition & 1 deletion examples/inner_html/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ impl Component for App {
}

fn main() {
yew::start_app::<App>();
yew::Renderer::<App>::new().render();
}
2 changes: 1 addition & 1 deletion examples/js_callback/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]
wasm-bindgen = "0.2"
yew = { path = "../../packages/yew" }
yew = { path = "../../packages/yew", features = ["render"] }

[dependencies.web-sys]
version = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion examples/js_callback/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ impl Component for App {
}

fn main() {
yew::start_app::<App>();
yew::Renderer::<App>::new().render();
}
2 changes: 1 addition & 1 deletion examples/keyed_list/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ instant = { version = "0.1", features = ["wasm-bindgen"] }
log = "0.4"
rand = "0.8"
wasm-logger = "0.2"
yew = { path = "../../packages/yew" }
yew = { path = "../../packages/yew", features = ["render"] }

[dependencies.web-sys]
version = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion examples/keyed_list/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,5 +279,5 @@ impl App {

fn main() {
wasm_logger::init(wasm_logger::Config::new(log::Level::Trace));
yew::start_app::<App>();
yew::Renderer::<App>::new().render();
}
2 changes: 1 addition & 1 deletion examples/mount_point/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]
wasm-bindgen = "0.2"
yew = { path = "../../packages/yew" }
yew = { path = "../../packages/yew", features = ["render"] }
gloo-utils = "0.1"

[dependencies.web-sys]
Expand Down
2 changes: 1 addition & 1 deletion examples/mount_point/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ fn main() {

body.append_child(&mount_point).unwrap();

yew::start_app_in_element::<App>(mount_point);
yew::Renderer::<App>::with_root(mount_point).render();
}
2 changes: 1 addition & 1 deletion examples/nested_list/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ license = "MIT OR Apache-2.0"
[dependencies]
log = "0.4"
wasm-logger = "0.2"
yew = { path = "../../packages/yew" }
yew = { path = "../../packages/yew", features = ["render"] }
2 changes: 1 addition & 1 deletion examples/nested_list/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ impl fmt::Display for Hovered {

fn main() {
wasm_logger::init(wasm_logger::Config::default());
yew::start_app::<app::App>();
yew::Renderer::<app::App>::new().render();
}
2 changes: 1 addition & 1 deletion examples/node_refs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ edition = "2021"
license = "MIT OR Apache-2.0"

[dependencies]
yew = { path = "../../packages/yew" }
yew = { path = "../../packages/yew", features = ["render"] }
web-sys = { version = "0.3", features = ["HtmlElement", "HtmlInputElement", "Node"] }
2 changes: 1 addition & 1 deletion examples/node_refs/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ impl Component for App {
}

fn main() {
yew::start_app::<App>();
yew::Renderer::<App>::new().render();
}
2 changes: 1 addition & 1 deletion examples/password_strength/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
yew = { path = "../../packages/yew" }
yew = { path = "../../packages/yew", features = ["render"] }
zxcvbn = "2.1.2"
js-sys = "0.3.46"
web-sys = { version = "0.3", features = ["Event","EventTarget","InputEvent"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/password_strength/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ mod password;
use app::App;

fn main() {
yew::start_app::<App>();
yew::Renderer::<App>::new().render();
}
2 changes: 1 addition & 1 deletion examples/portals/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]
yew = { path = "../../packages/yew" }
yew = { path = "../../packages/yew", features = ["render"] }
gloo-utils = "0.1"
wasm-bindgen = "0.2"

Expand Down
2 changes: 1 addition & 1 deletion examples/portals/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,5 @@ impl Component for App {
}

fn main() {
yew::start_app::<App>();
yew::Renderer::<App>::new().render();
}
2 changes: 1 addition & 1 deletion examples/router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ log = "0.4"
getrandom = { version = "0.2", features = ["js"] }
rand = { version = "0.8", features = ["small_rng"] }
wasm-logger = "0.2"
yew = { path = "../../packages/yew" }
yew = { path = "../../packages/yew", features = ["render"] }
yew-router = { path = "../../packages/yew-router" }
serde = { version = "1.0", features = ["derive"] }
lazy_static = "1.4.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/router/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,5 @@ fn switch(routes: &Route) -> Html {

fn main() {
wasm_logger::init(wasm_logger::Config::new(log::Level::Trace));
yew::start_app::<App>();
yew::Renderer::<App>::new().render();
}
2 changes: 1 addition & 1 deletion examples/suspense/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
yew = { path = "../../packages/yew", features = ["tokio"] }
yew = { path = "../../packages/yew", features = ["tokio", "render"] }
gloo-timers = { version = "0.2.2", features = ["futures"] }
wasm-bindgen-futures = "0.4"
wasm-bindgen = "0.2"
Expand Down
2 changes: 1 addition & 1 deletion examples/suspense/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ fn app() -> Html {
}

fn main() {
yew::start_app::<App>();
yew::Renderer::<App>::new().render();
}
2 changes: 1 addition & 1 deletion examples/timer/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]
yew = { path = "../../packages/yew" }
yew = { path = "../../packages/yew", features = ["render"] }
js-sys = "0.3"
gloo = "0.6"
wasm-bindgen = "0.2"
2 changes: 1 addition & 1 deletion examples/timer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,5 @@ impl Component for App {
}

fn main() {
yew::start_app::<App>();
yew::Renderer::<App>::new().render();
}
Loading