Skip to content

Commit

Permalink
Update yew from 0.20 to 0.21 (#141)
Browse files Browse the repository at this point in the history
* Update yew to v0.21

* Fix the reference to yew api.

* Fix CI

* Update CHANGELOG.md

Co-authored-by: Kaede Hoshikawa <futursolo@users.noreply.github.com>

---------

Co-authored-by: Kaede Hoshikawa <futursolo@users.noreply.github.com>
  • Loading branch information
langyo and futursolo committed Oct 6, 2023
1 parent 1c9a17c commit 0a4a583
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 104 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/everything.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Run cargo clippy
run: cargo clippy --all --all-features
env:
RUSTFLAGS: "--cfg releasing"
RUSTFLAGS: '--cfg releasing'

test-native-stable:
name: Run Native Tests (Stable)
Expand All @@ -60,7 +60,7 @@ jobs:
- name: Run cargo test
run: cargo test --all-features --all
env:
RUSTFLAGS: "--cfg releasing"
RUSTFLAGS: '--cfg releasing'

test-native-msrv:
name: Run Native Tests (MSRV)
Expand All @@ -70,7 +70,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Rust
uses: dtolnay/rust-toolchain@1.64.0
uses: dtolnay/rust-toolchain@1.66.0
with:
components: rustfmt, clippy

Expand All @@ -84,7 +84,7 @@ jobs:
cargo test --all-features --package stylist-macros
cargo test --all-features --package stylist
env:
RUSTFLAGS: "--cfg releasing"
RUSTFLAGS: '--cfg releasing'

test-web:
name: Run Browser Tests
Expand All @@ -105,12 +105,12 @@ jobs:
- name: Setup trunk
uses: jetli/trunk-action@v0.4.0
with:
version: "latest"
version: 'latest'

- name: Run cargo build --all --target=wasm32-unknown-unknown
run: cargo build --all --target=wasm32-unknown-unknown
env:
RUSTFLAGS: "--cfg releasing"
RUSTFLAGS: '--cfg releasing'

- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
Expand Down Expand Up @@ -148,13 +148,13 @@ jobs:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: cargo publish --dry-run --manifest-path packages/stylist-core/Cargo.toml
env:
RUSTFLAGS: "--cfg releasing"
RUSTFLAGS: '--cfg releasing'

- name: Run cargo publish for stylist-core
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} --manifest-path packages/stylist-core/Cargo.toml
env:
RUSTFLAGS: "--cfg releasing"
RUSTFLAGS: '--cfg releasing'

- name: Wait crates.io to Refresh
run: sleep 30s
Expand All @@ -171,7 +171,7 @@ jobs:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} --manifest-path packages/stylist-macros/Cargo.toml
env:
RUSTFLAGS: "--cfg releasing"
RUSTFLAGS: '--cfg releasing'

- name: Wait crates.io to Refresh
run: sleep 30s
Expand All @@ -188,4 +188,4 @@ jobs:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} --manifest-path packages/stylist/Cargo.toml
env:
RUSTFLAGS: "--cfg releasing"
RUSTFLAGS: '--cfg releasing'
37 changes: 19 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@

### v0.13.0

- Increase MSRV to 1.64.0.
- Increase MSRV to 1.66.0.
- Update syn to v2.
- Yew version is bumped to v0.21.

### v0.12.1

- Implemented a workaround that mitigates the linker error from Rust compiler (https://github.com/rust-lang/rust/issues/111888).
- Implemented a workaround that mitigates the linker error from Rust compiler (<https://github.com/rust-lang/rust/issues/111888>).

## v0.12.0

### Other Changes:
### Other Changes

- Added Server-side Rendering Support.
- Fixed a reference cycle between `Style` and `StyleManager`.
- Added `StyleManager::new()` to create a style manager with default configuration.

## v0.11.0

### Breaking Changes:
### Breaking Changes

- Yew version is bumped to v0.20.
- Remove `YieldStyle`. This API can be easily reproduced in user code, if need be,
Expand All @@ -34,26 +35,26 @@
macros and interpolation syntax to write styles, if you don't need to parse css at
runtime.

### Other Changes:
### Other Changes

- The `Style::new_*` API is more open for accepted types of the `Css` parameter.
- The name of styled components now defaults to the name of the function, like in
`function_component`.

## v0.10.1

### Other Changes:
### Other Changes

- Added an impl of `IntoPropValue<Classes>` for `Style` and `StyleSource` when
the `yew_integration` feature is active.

## v0.10.0

### Breaking Changes:
### Breaking Changes

- Yew version is bumped to 0.19.

### Other Changes:
### Other Changes

- Added an API to style Yew Function Component.
- `random` features is now provided with `fastrand`.
Expand All @@ -62,19 +63,19 @@

## v0.9.2

### Other Changes:
### Other Changes

- Fixed a misconfiguration causing documentation fails to build on `docs.rs`.

## v0.9.1

### Other Changes:
### Other Changes

- Removed an unused import.

## v0.9

### Breaking Changes:
### Breaking Changes

- `Style` and `GlobalStyle` no longer implements `FromStr`.
- `Style` and `GlobalStyle` now takes any type that implements
Expand All @@ -84,7 +85,7 @@
- Accepted at-rules are limited to `@keyframe`, `@supports` and
`@media`.

### Other Changes:
### Other Changes

- Added a Procedural Macro API that parses the Stylesheet at the compile
time.
Expand All @@ -100,7 +101,7 @@

## v0.8

### Breaking Changes:
### Breaking Changes

- `Style::new()` and `Style::create()` now takes a new trait `IntoSheet` for
Stylesheet which is implemented by default for both
Expand All @@ -111,7 +112,7 @@
- Stylist now treats pseudo class selectors (e.g.:`:hover`) like emotion
and styled-components.

### Other Changes:
### Other Changes

- Added a `GlobalStyle` struct to register global styles.
- Added a `<Global />` Component for global styling for yew applications.
Expand All @@ -127,7 +128,7 @@

## v0.7

### Breaking Changes:
### Breaking Changes

- `Style::new()` now takes an `Into<Cow<'static, str>>` instead of
`Into<String>` and returns `stylist::Error` instead of `String` when
Expand All @@ -137,7 +138,7 @@
encountering an error.
- `Style` no longer implements `ToString`.

### Other Changes:
### Other Changes

- Added a new API `YieldStyle`.
- Added theming examples.
Expand All @@ -150,13 +151,13 @@

## v0.6

### Breaking Changes:
### Breaking Changes

- `style.get_class_name()` no longer consumes the style and returns a `&str`
instead of an owned string.
- Seed Integration is Removed.

### Other Changes:
### Other Changes

- Added `Style::new` which does not require a component name.
- Aesthetically pleasing Class Name.
Expand Down
2 changes: 1 addition & 1 deletion examples/benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ publish = false
[dependencies]
log = "0.4.17"
console_log = { version = "1.0.0", features = ["color"] }
yew = { version = "0.20", features = ["csr"] }
yew = { version = "0.21", features = ["csr"] }
stylist = { path = "../../packages/stylist", features = [
"yew_integration",
"parser",
Expand Down
2 changes: 1 addition & 1 deletion examples/use-media-query/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ publish = false
[dependencies]
log = "0.4.17"
console_log = { version = "1.0.0", features = ["color"] }
yew = { version = "0.20", features = ["csr"] }
yew = { version = "0.21", features = ["csr"] }
stylist = { path = "../../packages/stylist", features = [
"yew_integration",
"yew_use_media_query",
Expand Down
2 changes: 1 addition & 1 deletion examples/yew-integration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ publish = false
[dependencies]
log = "0.4.17"
console_log = { version = "1.0.0", features = ["color"] }
yew = { version = "0.20", features = ["csr"] }
yew = { version = "0.21", features = ["csr"] }
stylist = { path = "../../packages/stylist", features = ["yew_integration"] }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion examples/yew-proc-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ publish = false
[dependencies]
log = "0.4.17"
console_log = { version = "1.0.0", features = ["color"] }
yew = { version = "0.20", features = ["csr"] }
yew = { version = "0.21", features = ["csr"] }
stylist = { path = "../../packages/stylist", default-features = false, features = [
"yew_integration",
"macros",
Expand Down
2 changes: 1 addition & 1 deletion examples/yew-shadow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ publish = false
[dependencies]
log = "0.4.17"
console_log = { version = "1.0.0", features = ["color"] }
yew = { version = "0.20", features = ["csr"] }
yew = { version = "0.21", features = ["csr"] }
stylist = { path = "../../packages/stylist", features = ["yew_integration"] }
once_cell = "1.16.0"

Expand Down
10 changes: 7 additions & 3 deletions examples/yew-ssr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ required-features = ["ssr"]
[dependencies]
log = "0.4.17"
console_log = { version = "1.0.0", features = ["color"] }
yew = { version = "0.20" }
yew = { version = "0.21" }
stylist = { path = "../../packages/stylist", features = ["yew_integration"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
Expand All @@ -30,8 +30,12 @@ gloo-utils = "0.2.0"
gloo-timers = { version = "0.3.0", features = ["futures"] }
wasm-bindgen-test = "0.3.33"
wasm-bindgen = "0.2.83"
yew = { version = "0.20", features = ["csr", "ssr", "hydration"] }
stylist = { path = "../../packages/stylist", features = ["yew_integration", "ssr", "hydration"] }
yew = { version = "0.21", features = ["csr", "ssr", "hydration"] }
stylist = { path = "../../packages/stylist", features = [
"yew_integration",
"ssr",
"hydration",
] }

[dev-dependencies.web-sys]
version = "0.3.60"
Expand Down
7 changes: 3 additions & 4 deletions examples/yew-ssr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,9 @@ pub fn ServerApp(props: &ServerAppProps) -> Html {
#[function_component]
pub fn App() -> Html {
let fallback = html! { <div>{"Loading..."}</div> };
let style_mgr = (*use_memo(
|_| StyleManager::new().expect("failed to create style manager."),
(),
))
let style_mgr = (*use_memo((), |_| {
StyleManager::new().expect("failed to create style manager.")
}))
.to_owned();

html! {
Expand Down
2 changes: 1 addition & 1 deletion examples/yew-theme-context/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ publish = false
[dependencies]
log = "0.4.17"
console_log = { version = "1.0.0", features = ["color"] }
yew = { version = "0.20", features = ["csr"] }
yew = { version = "0.21", features = ["csr"] }
stylist = { path = "../../packages/stylist", features = ["yew_integration"] }
once_cell = "1.16.0"

Expand Down
2 changes: 1 addition & 1 deletion examples/yew-theme-hooks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ publish = false
[dependencies]
log = "0.4.17"
console_log = { version = "1.0.0", features = ["color"] }
yew = { version = "0.20", features = ["csr"] }
yew = { version = "0.21", features = ["csr"] }
stylist = { path = "../../packages/stylist", features = [
"yew_integration",
"yew_use_style",
Expand Down
4 changes: 2 additions & 2 deletions packages/stylist/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ stylist-macros = { path = "../stylist-macros", version = "0.12", optional = true

once_cell = "1.16.0"
wasm-bindgen = "0.2.83"
yew = { version = "0.20", optional = true, default-features = false }
yew = { version = "0.21", optional = true, default-features = false }
gloo-events = { version = "0.2.0", optional = true }
fastrand = { version = "2.0.0", optional = true }
instant = { version = "0.1.12", optional = true, features = ["wasm-bindgen"] }
Expand All @@ -47,7 +47,7 @@ features = [
log = "0.4.17"
env_logger = "0.10.0"
trybuild = "1.0.72"
yew = "0.20"
yew = "0.21"
rustversion = "1"

[features]
Expand Down
11 changes: 4 additions & 7 deletions packages/stylist/src/yew/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,10 @@ pub fn global(props: &GlobalProps) -> Html {
}
}

use_memo(
move |(manager, css)| GlobalStyleGuard {
inner: GlobalStyle::new_with_manager(css.clone(), manager)
.expect_display("Failed to create style."),
},
(mgr, css),
);
use_memo((mgr, css), move |(manager, css)| GlobalStyleGuard {
inner: GlobalStyle::new_with_manager(css.clone(), manager)
.expect_display("Failed to create style."),
});

Html::default()
}

0 comments on commit 0a4a583

Please sign in to comment.