v0.1.0-alpha #187
gbj
announced in
Announcements
Replies: 1 comment
-
One notable change is that we now have a builder API, so we can do: [
h1(cx).child("Hello, world!").into_any(),
p(cx).child("I am a child!").into_any(),
] A lot of types can be passed into (
h1(cx).child("Hello, world!"),
p(cx).child("I am a child!"),
) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A preview of
v0.1.0
🎄 Merry Christmas!
I thought I'd offer this alpha release of the upcoming
0.1.0
so you can get a taste for some of what we've been working on. Shout out to @jquesada2016 for driving the work on the rewritten renderer that got us here, as well as huge improvements to the#[component]
macro and many other details of the framework.You can track the current state of this work in PR #119. You can download the alpha from crates.io.
There are a few known issues still (see below) but this release should be more or less usable, and the APIs are pretty much final. You can expect something closer to a final release in the next few weeks, but here's what to look forward to in the meantime.
Features
More flexible rendering
You can now easily mix and match different types of node in a
Fragment
, which previously needed to be aVec
of all the same types (like aVec<Fragment>
).Typed HTML elements
HTML elements generated by the
view!
macro are now typed, and implementDeref
to give a correctly-typedweb_sys
element.Massively improved Rust Analyzer support
DX with this new system is much better. You'll see hugely improved language-server integration for the
view!
macro, including features like doc comments for HTML elements, autocompletion for component properties, clicking to go to the definition of a component, type hints for component arguments, etc.Inline documentation in the
#[component]
macroYou can now document components and their properties directly in the
#[component]
macro like this:The macro will automatically generate docs for the components and for each of its props.
#[prop]
attributes for component propsYou can use the
#[prop]
attribute macro to mark component props in several ways:#[prop(optional)]
: this property is not required, and will default toDefault::default()
if you don't provide it in the view#[prop(into)]
:.into()
will be called to convert the arguments provided in the view you can specify, to save you adding.into()
in your viewsAnd much more!
<Router/>
in a<div>
for no obvious reasonBreaking Changes
Here are a few things to watch out for as you migrate:
-> impl IntoView
<For/>
component now takes aview
property, instead of you passing the view function as the child of the component<Route/>
component takes aview
property instead ofelement
for consistencychildren
properties are now typedBox<dyn Fn() -> Fragment>
view!
macro returns distinct structures, which are all different types. In other words, this code no longer compilesbecause the first branch now returns
HtmlElement<P>
while the second returnsHtmlElement<Span>
.In this case, simply add
.into_any()
to each to returnHtmlElement<AnyElement>
from both. In general, you can always call.into_view(cx)
to return a wrappingView
type instead.Outstanding Issues (in progress)
<Transition/>
component doesn't quite work properly yet.create_resource
and read it without using<Suspense/>
view!
macro yetstable
support forleptos_router
andleptos_meta
This discussion was created from the release v0.1.0-alpha.
Beta Was this translation helpful? Give feedback.
All reactions