18 KiB
Changelog
✨ 0.10.1 (TBD)
✨ 0.10 (2019-11-11)
-
⚡️ Features
Futuresupport 🎉 AComponentcan update following the completion of aFuture. Check out this example to see how it works. This approach was borrowed from a fork of Yew calledplastercreated by @carlosdp. [@hgzimmerman, #717]- Added the
agentandservicesfeatures so that this functionality can be disabled (useful if you are switching to usingFutures). [@hgzimmerman, #684] - Add
refkeyword for allowing aComponentto have a direct reference to its rendered elements. For example, you can now easily focus an<input>element after mounting. [@jstarry, #715]
use stdweb::web::html_element::InputElement; use stdweb::web::IHtmlElement; use yew::*; pub struct Input { node_ref: NodeRef, } impl Component for Input { type Message = (); type Properties = (); fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self { Input { node_ref: NodeRef::default(), } } fn mounted(&mut self) -> ShouldRender { if let Some(input) = self.node_ref.try_into::<InputElement>() { input.focus(); } false } fn update(&mut self, _: Self::Message) -> ShouldRender { false } fn view(&self) -> Html<Self> { html! { <input ref=self.node_ref.clone() type="text" /> } } }- Make
Agentrelated typespublicto allow other crates to create custom agents. [@dunnock, #721] Component::changewill now returnfalsefor components that haveComponent::Properties == (). [@kellytk, #690]]- Updated
wasm-bindgendependency to0.2.54. Please update yourwasm-bindgen-clitool by runningcargo install --force --version 0.2.54 -- wasm-bindgen-cli. [@jstarry, #730], [@ctaggart, #681]
-
🛠 Fixes
- Fixed the mount order of components. The root component will be mounted after all descendants have been mounted. [@jstarry, #725]
- All public items now implement
Debug. [@hgzimmerman, #673]
-
🚨 Breaking changes
-
Minimum rustc version has been bumped to
1.39.0forFuturesupport. [@jstarry, #730] -
Componentnow has a requiredviewmethod and automatically implements theRenderabletrait. Theviewmethod in theRenderabletrait has been renamed torender. [@jstarry, #563]Before:
impl Component for Model { type Message = Msg; type Properties = (); fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self { Model {} } fn update(&mut self, msg: Self::Message) -> ShouldRender { true } } impl Renderable<Model> for Model { fn view(&self) -> Html<Self> { html! { "hello" } } }After:
impl Component for Model { type Message = Msg; type Properties = (); fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self { Model {} } fn update(&mut self, msg: Self::Message) -> ShouldRender { true } fn view(&self) -> Html<Self> { html! { "hello" } } } -
Removed the
Transferabletrait since it did no more than extend the serdeSerializeandDeserializetraits. [@hgzimmerman, #319]Before:
impl Transferable for Input {} #[derive(Serialize, Deserialize)] pub enum Input { Connect, }After:
#[derive(Serialize, Deserialize)] pub enum Input { Connect, } -
WebSocketService::connectwill now return aResultin order to stop panicking on malformed urls. [@lizhaoxian, #727] -
VTagnow is boxed withinVNodeto shrink the size of its enum representation. [@hgzimmerman, #675]
-
✨ 0.9.2 (2019-10-12)
-
🛠 Fixes
- Fix
yew-macrodependency version
- Fix
✨ 0.9.1 (2019-10-12)
Happy Canadian Thanksgiving! 🦃
-
⚡️ Features
- Implemented
Defaulttrait forVNodeso thatunwrap_or_defaultcan be called onOption<Html<Self>>. [@hgzimmerman, #672] - Implemented
PartialEqtrait forClassesso that is more ergonomic to useClassestype in component props. [@hgzimmerman, #680] - Updated
wasm-bindgendependency to0.2.50. Please update yourwasm-bindgen-clitool by runningcargo install --force --version 0.2.50 -- wasm-bindgen-cli. [@jstarry, #695]
- Implemented
-
🛠 Fixes
- Fixed issue where text nodes were sometimes rendered out of order. [@jstarry, #697]
- Fixed regression introduced in 0.9.0 that prevented tag attributes from updating properly. [@jstarry, #698]
- Fixed emscripten builds by pinning the version for the
ryudownstream dependency. [@jstarry, #703] - Updated
stdwebto0.4.20which fixed emscripten builds and unblocked updatingwasm-bindgento0.2.50. [@ctaggart, @jstarry, #683, #694] - Cleaned up build warnings for missing
dynkeywords. [[@benreyn], #687]
✨ 0.9 (2019-09-27)
-
⚡️ Features
-
New
KeyboardServicefor setting up key listeners on browsers which support the feature. [@hgzimmerman, #647] -
ComponentLinkcan now create aCallbackwith more than oneMessage. TheMessage's will be batched together so that theComponentwill not be re-rendered more than necessary. [@stkevintan, #660] -
Message's toPublicAgent's will now be queued if theAgenthasn'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>>() }} } } -
Iterators can now be rendered in thehtml!macro without using theforkeyword. [@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
Callbackproperties. [@Wodann, #612] -
Improved CSS class ergonomics with new
Classestype. [@DenisKolodin, #585], [@hgzimmerman, #626] -
Touch events are now supported
<div ontouchstart=|_| Msg::TouchStart>[@boydjohnson, #584], [@jstarry, #656] -
The
Componenttrait now has anmountedmethod which can be implemented to react to when your components have been mounted to the DOM. [@hgzimmerman, #583] -
Additional Fetch options
mode,cache, andredirectare now supported [@davidkna, #579] -
The derive props macro now supports Properties with lifetimes [@jstarry, #580]
-
New
ResizeServicefor registering forwindowsize updates [@hgzimmerman, #577]
-
-
🛠 Fixes
- Fixed JS typo in RenderService. This was causing animation frames to not be dropped correctly. [@jstarry, #658]
- Fixed
VNodeorphaning bug when destroyingVTagelements. This caused someComponents to not be properly destroyed when they should have been. [@hgzimmerman, #651] - Fix mishandling of Properties
whereclause in derive_props macro [@astraw, #640]
-
🚨 Breaking changes
None
✨ 0.8 (2019-08-10)
Props! Props! Props!
This release introduces a more developer friendly way to handle your Component props. Use the new #[derive(Properties)] macro to beef up your props! Property values can now be annotated as #[props(required)] which will enforce that props are present at compile time. This means that your props struct no longer needs to implement Default, so time to clean up all of those prop values you wrapped in Option to have a default value.
-
⚡️ Features
html!- Self-closing html tags can now be used:<div class="marker" />[@totorigolo, #523]html!- SVG name-spaced tags are now supported! [@jstarry, #550]- Properties can now be required at compile time [@jstarry, #553]
- App components can now be mounted with properties [@jstarry, #567]
- Apps can now be mounted as the
<body>tag [@jstarry, @kellytk, #540] - Content editable elements can now trigger
oninputevents [@tiziano88, #549]
-
🛠 Fixes
html!- Class name order is now preserved which unlocks the use of Semantic UI [@charvp, #424]html!- Dashed tag names and properties are supported [@jstarry, #512, #550]html!- All rust keywords can be used as tag attributes [@jstarry, #550]html!- SupportCallbackclosure with explicit return type [@totorigolo, #564]html!- Fixed edge case where>token would break parser [@totorigolo, #565]- Performance improvement to the diff engine [@totorigolo, #539]
Propertiesno longer need to implement thePartialEq,Clone, orDefaulttraits [@jstarry, #553]Componentwill not panic if thechangemethod is unimplemented [@jstarry, #554]
-
🚨 Breaking changes
-
The
Component::Propertiesassociated type must implement the newPropertiestrait [@jstarry, #553]The new
Propertiestrait is what powers the ability to check required props are present at compile time. Use the derive props macro to implement automatically.use yew::Properties; #[derive(Properties)] pub struct Props { #[props(required)] pub value: MyStruct, } -
Callbackprops no longer transform intoOptiontypes [@jstarry, #553]html! { <Button on_click=Msg::Click /> }before:
#[derive(PartialEq, Clone, Default)] pub struct Props { on_click: Option<Callback<()>>, }after: note the
#[props(required)]attribute#[derive(PartialEq, Properties)] pub struct Props { #[props(required)] on_click: Callback<()>, }
-
✨ 0.7 (2019-07-19)
Commas? We don't need no stinkin' commas!
This release brings a new and improved html! macro for writing JSX-like syntax. Commas and colons are no longer necessary now that the macro is written as a procedural macro.
-
⚡️ Features
html!{}is now valid syntax and can be used to render nothing [@jstarry, #500]- Apps can now be built without
cargo-webusingwasm-bindgen[@jstarry, #497] Callbacknow implementsDebug[@DenisKolodin, #485]- New utility method for getting the
hostof the current page [@DenisKolodin, #509]
-
🛠 Fixes
html!- Commas are no longer necessary for splitting up attributes [@jstarry, #500]html!- Colons are no longer necessary for denoting aComponenttag [@jstarry, #500]- Textarea value can be now be set:
<textarea value="content">[@DenisKolodin, #476] - changed
StorageService::restoreto take an immutable receiver [@dermetfan, #480] - Fixed a component rendering bug [@jstarry, #502]
✨ 0.6 (2019-02-20)
-
⚡️ Features
- Added
start_appconvenience method for initializing the app and mounting it to the body [@DenisKolodin, #462] - Added handling of files of
inputelement. There is now aChangeData::Filesvariant for theonchangehandler [@DenisKolodin, #464] - Added
ReaderServiceto read data fromFileinstances. [@DenisKolodin, #464, #468]
- Added
-
🛠 Fixes
- It was impossible to set
valueattribute for any tag instead ofoption, because it used inner value ofVTagto keep the value forinputelement. Nowvalueattribute works foroptions,progresstags, etc.
- It was impossible to set
-
🔮 Examples
- New example
file_uploadthat prints sizes of uploaded files [@DenisKolodin, #464]
- New example
✨ 0.5 (2019-02-01)
🎶 Secret Agent Man 🎶
This release introduces the concept of an Agent. Agents are separate activities which you could run in the same thread or in a separate thread. There are three types of agents Context, Job, Public described below. To connect to an agent use the Worker::bridge method and pass a link of component's environment to it.
-
⚡️ Features
- Introduced the concept of an
Agentwhich can run processes in other contexts:Contextagent spawns once per threadJobagent spawns for every bridgePublicagent spawns an agent in a separate thread (it uses Web Workers API under the hood).
- Allow setting the whole properties struct of a component with
<Component: with props /> ComponentLinknow has asend_selfmethod which allows components to update themselves [@DenisKolodin, #365]- All services are re-exported within the
yew::servicesmodule. html!macro supports multiple classes in a single string:<a class="button is-primary",>.- Added
FetchOptionsto allow settingCredentialsoffetchrequest. FetchServiceaborts requests usingAbortController.- Added
SubmitEventwithonsubmitrule.
- Introduced the concept of an
-
🛠 Fixes
- Bug with emscripten target
RuntimeError: index out of boundsfixed with a new scheduler [@DenisKolodin, #272]
- Bug with emscripten target
-
🚨 Breaking changes
send_backmethod requires a mutable reference toself. This was added to prevent creating callbacks inviewimplementations. [@DenisKolodin, #367]Contextrequirement removed. It's no longer necessary to useComponent<CTX>type parameter. Instead, a link to the environment is provided with theComponent::createcall. [@DenisKolodin, #272]