Releases: blorbb/leptos-mview
v0.4.0
Support for Leptos 0.7.
A few unfortunate changes:
- Error reporting has significantly degraded due to traits not being fulfilled. This makes the entire macro output become an error, so it is impossible for error reporting to be at reasonable spans. Most errors will show up for the entire macro call site.
- Now require
leptos::prelude::*
to be imported since attributes are checked and come from traits. It is possible to use a fully qualified trait path, but it may provide worse autocomplete. Better autocomplete at the cost of requiring the prelude to be imported seems to be a good trade off. - "nightly" feature required for nightly diagnostics, as proc-macro-error2 does not automatically detect nightly.
Breaking changes:
- Special
class
andid
directives on components now just use the attribute spreading that already comes with Leptos instead of the custom solution of setting theclass
andid
arguments.
Full Changelog: v0.3.2...v0.4.0
v0.3.2
Added support for leptos-rs/leptos#2534 and some minor span improvements.
Full Changelog: v0.3.1...v0.3.2
v0.3.1
v0.3.0
A whole ton of fixes and improvements!
BREAKING:
use:
directives now call.into()
on their values, which is whatleptos::view!
also does. See leptos-rs/leptos#2248- Events like
on:click
are now always delegated - they were previously always undelegated. This may break some event listeners' behaviour.
Enhancements:
- Support for qualified paths in component names like
leptos::Show
. - Generics can be used with or without the turbofish.
- Support for the
:undelegated
modifier on event listeners. - Significantly improved error recovery, spans, messages and syntax highlighting.
Full Changelog: v0.2.3...v0.3.0
v0.2.3
Compatible with leptos 0.6! (by just fixing some tests :))
One new feature: children blocks can be wrapped in either braces or parentheses. No functional differences, just a stylistic choice.
mview! {
p("these are " em("my") " " strong("children"))
}
Full Changelog: v0.2.2...v0.2.3
v0.2.2
Minor update to what is being spanned due to updates to proc macro stuff in rust-analyzer. All tokens in quote_spanned!
will show their documentation at that span, leading to component names having documentation for things like std
and vec!
.
The macro now adds a #[allow(unreachable_code)]
for better error messages, but means that this lint may be disabled in attributes.
Hopefully nothing else has broken :)
Full Changelog: v0.2.1...v0.2.2
v0.2.1
Totally didn't forget to make a github release
Copied from CHANGELOG.md:
Hopefully no breaking changes, just a whole bunch of new DX features!
Features:
- Support for slots! Prefix the slot element with
slot:
to use it as a slot. The parameter name in the parent component must be the same name as the slot, in snake_case.- See
Slots
for more details.
- See
- A new value shorthand:
f["{:.3}", some_number()]
: adding thef
prefix addsformat!
into the closure; equivalent to[format!(...)]
or{move || format!(...)}
. - On components, if you have the parameters
#[prop(into, optional)] class: TextProp
or#[prop(optional)] id: &'static str
, you can use the selector shorthandComponent.some-class #some-id
to add it to these attributes, and/or theclass:
directive for reactive classes.impl Default for TextProp
is currently in the Leptos git main / future v0.5.3 release; for 0.5.2 or earlier, you need to use#[prop(default="".into())]
instead ofoptional
.- Reactive classes in this way are not very performant as a
String
is constructed every time any of the signals change. If you only use the selector shorthand, they will be compiled into one string literal (no performance downsides). - This is also supported on slots, using the same fields.
- See Special Attributes for more details.
Enhancements:
- Fixed up a whole lot of spans to improve a whole bunch of error messages: hopefully, there are no more errors that cause the entire macro to be spanned, errors should always be localized to a relevant spot.
- Better rust-analyzer support in some invalid macro situations.
- Better syntax highlighting for the selector shorthand on HTML elements.
Other minor things:
- Removed extra
syn
features, now this just depends onsyn
with its default features (no "full" or "extra-traits"). This doesn't do much because Leptos requires these features anyways.
Full Changelog: v0.2.0...v0.2.1
v0.2.0
Supporting directives from Leptos 0.5.2, as well as some breaking changes cause I'm indecisive :)
Breaking Changes:
-
#4: Rename macro from
view!
tomview!
.A full-word search-and-replace for
view!
->mview!
andleptos_mview::view
->leptos_mview::mview
should fix everything. -
#3:
clone:
directive now takes a single identifier,clone:thing
instead ofclone:{thing}
.
Enhancements:
- #3: added
use:
directive to elements. Syntax is the same as leptos,use:dir
oruse:dir={param}
.