Aurelia

Aurelia Pre-Beta Release

Introduction

Aurelia

Aurelia


aurelia release

Aurelia Pre-Beta Release

Posted by Aurelia on .
Featured

aurelia release

Aurelia Pre-Beta Release

Posted by Aurelia on .

The Aurelia beta is fast approaching (as in coming next week). We're waiting on some tooling fixes before we launch. In the mean time, we thought we'd give you an "almost beta" release so you can start to update your code and provide us with feedback. Read on for the details...

Breaking Changes

Though this looks like a large list of breaking changes, in reality it should not affect most of you. Those who are more likely to be affected are those who have created custom navigation pipeline steps, are workinging without decorators, have customized the DI in an advanced way, customized view location or been using our unit test helpers provided by the binding or templating engines. Updating should be relatively straight forward regardless.

  • The decorator helpers for those not using ES 2016 have changed. WE have done this in order to provide a more "correct" way of applying decorator functions for languages that don't support them. As a result the static metadata method is no longer supported. Instead, use our decorators helper to apply decorators to an ES 2015 class or ES 5 quasi-class. To see what this looks like, have a look at a few of our unit tests.
  • Custom resolvers for the container no longer inherit from Resolver. Instead, resolver classes must be decorated with the @resolver decorator.
  • Low-level changes to TemplateRegistryEntry.
  • In the previous release we introduced a singleton object named bindingEngine. We thought better of that almost immediately after doing it. This release introduces a BindingEngine class which you can inject. It has a number of high level apis for working with the binding engine.
  • Router Pipeline steps now receive the NavigationInstruction instead of the NavigationContext. Pipeline steps should use instruction.getAllInstructions() and instruction.getAllPreviousInstructions() instead of context.nextInstructions and context.currentInstructions, respectively, to inspect current and previous instructions.
  • Router semantics have changed in names such as "prevInstruction" such that "current" refers to the current navigation, and "previous" refers to the previous navigation. Previously, "next" referred to the current navigation, and "current" and "previous" both referred to the previous navigation.
  • Unknown route handlers must now return the moduleId or a route config instead of mutating instruction.config.
  • Calling router.handleUnknownRoutes() with no arguments will no longer cause the router to apply conventional routing. This logic must now be provided by the application.
  • The router.reset() api has been removed. We don't think it's a good practice to call this, so we are removing and and we'll help you find alternative ways of accomplishing your scenarios.
  • ConventionalViewStrategy.convertModuleIdToViewUrl has been removed. The new ViewLocator contains the knowledge for transformation. Simply swap ViewLocator.prototype.convertOriginToViewUrl with your own implementation. Note that this method now takes an Origin rather than just a moduleId.
  • The @sync decorator has been removed. It has been replaced with the @children decorator. The new decorator allows content selection by selector, but limits selected elements to direct children of the custom element.
  • The ViewStrategy base class has been removed. Instead, when creating a custom view strategy, decorate your class with the @viewStrategy decorator.
  • The templatingEngine object has been made into a TemplatingEngine class which provides high level APIs for common developer scenarios. The createModelForUnitTest has been renamed to createViewModelForUnitTest
  • The templating engine's use of the term/property "model" throughout has been changed to "viewModel".
  • The "global" fallback behavior which allowed bindings such as jquery.modal="show: true; keyboard.bind: allowKeyboard" has been removed as it wasn't able to provide consistent, high-fidelity behavior. In lieu of this, it is recommended to create simple custom elements or custom attributes.
  • The swap method of the ViewSlot has been removed and the move method of the Animator as been removed. Neither was in use anywhere within the framework and/or had no concrete implementations.

New Features

Some of the biggest new features that have been long-time requests are in this release. Among them are binding behaviors and the removal of the need from $parent.

  • Our metadata library contains new mixin, protocol and deprecated decorators for handling common scenarios.
  • The DI container now has a more pluggable invoker hook. Call container.setHandlerCreatedCallback(callback) to hook InvocationHandler creation. This is for advanced usage, but allows custom code to alter constructor invocation and/or alter instances returned from calling a constructor.
  • New support for Binding Behaviors. A Binding Behavior enables a developer to customize the runtime behavior of various binding expressions. It's fully extensible, but out of the box we provide you with oneTime for string interpolations, signal for manually refreshing bindings tied to a "signal name", debounce, throttle and updateTrigger for changing the event that causes two-way binding to update (for example blur instead of change). Here's how you might use the latter: <input type="text" value.bind="foo & updateTrigger:'blur'">
  • We now flow an "override scope" through the binding engine. This allows us to detect variables and methods on the parent binding context automatically. So, while you can continue to use $parent in your bindings if you want...it is no longer needed.
  • Bindings can now contain a $this identifier to reference the current binding context.
  • A ViewLocator has been introduced to enable better/easier customization of view location and conventional fallback.
  • A new @child decorator has been added. It works like the @children decorator, but instead of synchronizing a collection with the dom, it synchronizes a single child element as a property.
  • The repeat now uses a strategy pattern to determine how to best iterate different collection types. You can even plug your own strategy in using the CollectionStrategyLocator
  • The router-view has a new property swap-order which lets you control the swaping order of views. By default, it is set to "before" which adds the new view before removing the old view. It can also be set to "with" and "after".

Fixes and Improvements

As usual, we are always looking to fix bugs and make general improvements everywhere. There are quite a few items of that sort in this release.

  • Fixes to the DI related to singleton view models used in routing or composition.
  • Added a method to setTitle on the History abstraction.
  • Fix TaskQueue overflow issue.
  • Lots of bug fixes in the binding engine.
  • A major memory leak in the router was plugged as well as a number of other fixes.
  • Static and Dynamic component lifecycles are now consistent.
  • Both refs and child/children bindings are now available in the bind callback. Developers do not need to wait until the attached callback.
  • The templating engine and all resources have been updated to understand the new "override context" concept from the binding engine.
  • Lots or internal cleanup, stability and consistency in the templating engine.
  • All child/children bindings on an element share the same MutationObserver instance for efficiency.
  • The with behavior now supports referencing parent properties/methods thanks to your new override context capability. As a result of being able to make these improvements, we will not be deprecating this feature.
  • Lots of fixes in repeat and other behaviors, including full incorporation of our view caching mechanism. One of the nicer improvements is that our repeater will now properly observe array mutation even when value converters and binding behaviors are used.
  • core-js updated to the consistently use the latest version everywhere.
  • Numerous improvements to d.ts files for many libraries.

Updating

Because this is a breaking change release, you cannot simply run jspm update to get the latest. Instead, you will need to install each top-level Aurelia library using jspm install. We have released updates to all our plugins, so you should not get any forks or old versions during this process unless you have a 3rd party plugin (such as aurelia-flux) that has not yet been updated.

If you have many top-level Aurelia libraries installed, you may find it convenient to use this aggregated jspm update command:

jspm install aurelia-animator-css aurelia-binding aurelia-bootstrapper aurelia-dependency-injection aurelia-framework aurelia-fetch-client aurelia-router aurelia-event-aggregator aurelia-history-browser aurelia-loader-default aurelia-loader aurelia-metadata aurelia-route-recognizer aurelia-templating-binding aurelia-templating-resources aurelia-templating-router aurelia-templating aurelia-logging aurelia-task-queue aurelia-history aurelia-path aurelia-pal aurelia-pal-browser  

Same Beta Channel

You are going to want to be tuning in here next week. The Beta cometh...

View Comments...