0.9.0
版本发布时间: 2019-09-27 23:27:38
yewstack/yew最新发布版本:yew-v0.21.0(2023-09-29 19:14:55)
Feature Overload
This release introduces a slew of new features, many of which come from first-time contributors! There's too many to mention so read more below 😄 Also, a long-standing bug was fixed by @hgzimmerman which was causing Component
's to not be destroyed properly.
-
⚡️ Features
-
New
KeyboardService
for setting up key listeners on browsers which support the feature. [@hgzimmerman, #647] -
ComponentLink
can now create aCallback
with more than oneMessage
. TheMessage
's will be batched together so that theComponent
will not be re-rendered more than necessary. [@stkevintan, #660] -
Message
's toPublic
Agent
's will now be queued if theAgent
hasn't finished setting up yet. [@serzhiio, #596] -
Agent
's can now be connected to without aCallback
. Instead of creating a bridge to the agent, create a dispatcher like so:MyAgent::dispatcher()
. [@hgzimmerman, #639] -
Component
's can now accept children in thehtml!
macro. [@jstarry, #589]// app.rs html! { <MyList name="Grocery List"> <MyListItem text="Apples" /> </MyList> }
// my_list.rs use yew::prelude::*; pub struct MyList(Props); #[derive(Properties)] pub struct Props { #[props(required)] pub name: String, pub children: Children<MyListItem>, } impl Renderable<MyList> for MyList { fn view(&self) -> Html<Self> { html! {{ self.props.children.iter().collect::<Html<Self>>() }} } }
-
Iterator
s can now be rendered in thehtml!
macro without using thefor
keyword. [@hgzimmerman, #622]Before:
html! {{ for self.props.items.iter().map(renderItem) }}
After:
html! {{ self.props.items.iter().map(renderItem).collect::<Html<Self>>() }}
-
Closures are now able to be transformed into optional
Callback
properties. [@Wodann, #612] -
Improved CSS class ergonomics with new
Classes
type. [@DenisKolodin, #585], [@hgzimmerman, #626] -
Touch events are now supported
<div ontouchstart=|_| Msg::TouchStart>
[@boydjohnson, #584], [@jstarry, #656] -
The
Component
trait now has anmounted
method which can be implemented to react to when your components have been mounted to the DOM. [@hgzimmerman, #583] -
Additional Fetch options
mode
,cache
, andredirect
are now supported [@davidkna, #579] -
The derive props macro now supports Properties with lifetimes [@jstarry, #580]
-
New
ResizeService
for registering forwindow
size updates [@hgzimmerman, #577]
-
-
🛠 Fixes
- Fixed JS typo in RenderService. This was causing animation frames to not be dropped correctly. [@jstarry, #658]
- Fixed
VNode
orphaning bug when destroyingVTag
elements. This caused someComponent
s to not be properly destroyed when they should have been. [@hgzimmerman, #651] - Fix mishandling of Properties
where
clause in derive_props macro [@astraw, #640]
-
🚨 Breaking changes
None