v0.10.0
The developer ergonomics update
This update combines a bunch of changes (some breaking) to improve the experience about writing websites with Jaspr. You can now write a lot more concise and compact markup using Jaspr, which drastically reduces the needed lines-of-code and produces a lot more readable code.
Changelog
-
BREAKING Restructured core libraries:
- Removed
package:jaspr/html.dart
-> Usepackage:jaspr/jaspr.dart
instead. - Renamed
package:jaspr/components.dart
topackage:jaspr/ui.dart
.
- Removed
-
BREAKING Updated
@client
components for a more streamlined usage.Annotated components no longer generate a
.g.dart
file and don't need to implement any generated mixin anymore.
Instead, a singlelib/jaspr_options.dart
file is generated when using@client
components.You must now call
Jaspr.initializeApp(options: defaultJasprOptions)
at the start of your app, where
defaultJasprOptions
is part of the newly generatedjaspr_options.dart
file.Note: Calling
Jaspr.initializeApp()
will be required in a future version of Jaspr, and the cli will warn you
when it's not called. -
BREAKING Changed type of the
classes
property of html components fromList<String>
toString
. Multiple class
names can be set using a single space-delimited string, e.g.classes: 'class1 class2'
. -
BREAKING Event callbacks are now typed. The
events
property of html components now expects a
Map<String, void Function(Event)>
instead of the oldMap<String, void Function(dynamic)>
.In addition to this Jaspr comes with a new
events()
function to provide typed event handlers for common events, like
onClick
,onInput
andonChange
. Use it like this:anyelement( // Uses the [events] method to provide typed event handlers. events: events( onClick: () { print("Clicked"); }, // [value] can be typed depending on the element, e.g. `String` for text inputs or `bool` for checkboxes. onInput: (String value) { print("Value: $value"); }, ), [...] )
Moreover, the html components
button
,input
,textarea
andselect
now also come with additional shorthand
properties for their supported event handlers:button( onClick: () { print("Clicked"); }, [...] )
-
BREAKING Refactored components inside the
package:jaspr/ui.dart
library. Some component properties have
changed or been discontinued. Check the separate components for details. -
BREAKING Promoted
jaspr_web_compilers
to non-experimental status.This also changes the respective cli option from
jaspr create --experimental-web-compilers
(old) to
jaspr create --jaspr-web-compilers
(new). -
Added support for rendering
svg
elements.
Also addedsvg()
,rect()
,circle()
,ellipse()
,line()
,path()
andpolygon()
components. -
Refactored rendering implementation to use
RenderObject
s. -
Added
NotificationListener
component. -
Added
Colors.transparent
. -
Added
Unit.auto
,Unit.vw()
andUnit.vh()
for responsive styling. -
Added
StyleRule.fontFace()
to add external font files. -
Several bug fixes and stability improvements when running
jaspr serve
orjaspr build
.