Update to yew 0.21 and material-web-3#49
Open
constructableconcepts wants to merge 14 commits intoranile:material-3from
Open
Update to yew 0.21 and material-web-3#49constructableconcepts wants to merge 14 commits intoranile:material-3from
constructableconcepts wants to merge 14 commits intoranile:material-3from
Conversation
This commit updates the `material-yew` framework to Yew version 0.21.
The main changes involve:
- Updating the `yew` and `yew-router` dependencies in `Cargo.toml`.
- Refactoring all components to align with the new property and attribute handling in Yew 0.21.
- Replacing the usage of `js_sys::JsValue` for passing props with direct passing of Rust types.
- Using attributes instead of properties for most custom element properties.
- Handling boolean attributes with the `.then(|| AttrValue::from(""))` pattern.
- Removing the `use_effect_with` hook for module imports and calling the `import_material_web_module!` macro directly.
Due to limitations in the execution environment, I was unable to fully test the changes by running the `usages` example application. The `trunk` build tool could not be installed. However, both the `material-yew` library and the `usages` application compile successfully.
Some complex properties (`form`, `labels`, `anchor_element`, etc.) and custom event handlers have been temporarily commented out to allow the project to compile. These will need to be addressed in a future commit.
This commit updates the framework to Yew v0.21. The migration involved several key changes: - Updated the `yew` and `yew-router` dependencies to `0.21` and `0.18` respectively. - Refactored all components to use the new Yew 0.21 property syntax. Standard attributes are passed directly, and boolean attributes are handled by making them present or absent. - Implemented a new pattern for handling custom DOM events (e.g., `onclosing` in `md-menu`). This pattern uses a `NodeRef` and a `use_effect_with` hook to imperatively add and remove event listeners on the underlying web component. - Implemented a new pattern for setting complex JavaScript properties (e.g., `form` on `md-button`). This also uses a `NodeRef` and a `use_effect_with` hook to set the property directly on the DOM node using `js_sys::Reflect::set`. - The `usages` example has been configured to build with `wasm-pack`. All components have been updated to be compatible with the new APIs, and the project now successfully compiles with Yew 0.21.
This commit updates the framework to Yew v0.21. The migration involved several key changes: - Updated the `yew` and `yew-router` dependencies to `0.21` and `0.18` respectively. - Refactored all components to use the new Yew 0.21 property syntax. Standard attributes are passed directly, and boolean attributes are handled by making them present or absent. - Implemented a new pattern for handling custom DOM events (e.g., `onclosing` in `md-menu`). This pattern uses a `NodeRef` and a `use_effect_with` hook to imperatively add and remove event listeners on the underlying web component. - Implemented a new pattern for setting complex JavaScript properties (e.g., `form` on `md-button`). This also uses a `NodeRef` and a `use_effect_with` hook to set the property directly on the DOM node using `js_sys::Reflect::set`. - The `usages` example has been configured to build with `wasm-pack`. All components have been updated to be compatible with the new APIs, and the project now successfully compiles with Yew 0.21.
This commit updates the framework to Yew v0.21. The migration involved several key changes: - Updated the `yew` and `yew-router` dependencies to `0.21` and `0.18` respectively. - Refactored all components to use the new Yew 0.21 property syntax. Standard attributes are passed directly, and boolean attributes are handled by making them present or absent. - Implemented a new pattern for handling custom DOM events (e.g., `onclosing` in `md-menu`). This pattern uses a `NodeRef` and a `use_effect_with` hook to imperatively add and remove event listeners on the underlying web component. - Implemented a new pattern for setting complex JavaScript properties (e.g., `form` on `md-button`). This also uses a `NodeRef` and a `use_effect_with` hook to set the property directly on the DOM node using `js_sys::Reflect::set`. - The `usages` example has been configured to build with `wasm-pack`. All components have been updated to be compatible with the new APIs, and the project now successfully compiles with Yew 0.21.
to v2.4.0
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This updates the package to support yew 0.21.0