Skip to content

v0.10.0

Compare
Choose a tag to compare
@schultek schultek released this 22 Jan 14:31
· 888 commits to main since this release

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 -> Use package:jaspr/jaspr.dart instead.
    • Renamed package:jaspr/components.dart to package:jaspr/ui.dart.
  • 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 single lib/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 generated jaspr_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 from List<String> to String. 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 old Map<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 and onChange. 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 and select 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 added svg(), rect(), circle(), ellipse(), line(), path() and polygon() components.

  • Refactored rendering implementation to use RenderObjects.

  • Added NotificationListener component.

  • Added Colors.transparent.

  • Added Unit.auto, Unit.vw() and Unit.vh() for responsive styling.

  • Added StyleRule.fontFace() to add external font files.

  • Several bug fixes and stability improvements when running jaspr serve or jaspr build.