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...
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
metadatamethod is no longer supported. Instead, use our
decoratorshelper 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
- 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
BindingEngineclass which you can inject. It has a number of high level apis for working with the binding engine.
- Router Pipeline steps now receive the
NavigationInstructioninstead of the
NavigationContext. Pipeline steps should use
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.
router.handleUnknownRoutes()with no arguments will no longer cause the router to apply conventional routing. This logic must now be provided by the application.
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.convertModuleIdToViewUrlhas been removed. The new
ViewLocatorcontains the knowledge for transformation. Simply swap
ViewLocator.prototype.convertOriginToViewUrlwith your own implementation. Note that this method now takes an
Originrather than just a moduleId.
@syncdecorator has been removed. It has been replaced with the
@childrendecorator. The new decorator allows content selection by selector, but limits selected elements to direct children of the custom element.
ViewStrategybase class has been removed. Instead, when creating a custom view strategy, decorate your class with the
templatingEngineobject has been made into a
TemplatingEngineclass which provides high level APIs for common developer scenarios. The
createModelForUnitTesthas been renamed to
- 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.
swapmethod of the ViewSlot has been removed and the
movemethod of the Animator as been removed. Neither was in use anywhere within the framework and/or had no concrete implementations.
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
deprecateddecorators for handling common scenarios.
- The DI container now has a more pluggable invoker hook. Call
InvocationHandlercreation. 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
oneTimefor string interpolations,
signalfor manually refreshing bindings tied to a "signal name",
updateTriggerfor 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
$parentin your bindings if you want...it is no longer needed.
- Bindings can now contain a
$thisidentifier to reference the current binding context.
ViewLocatorhas been introduced to enable better/easier customization of view location and conventional fallback.
- A new
@childdecorator has been added. It works like the
@childrendecorator, but instead of synchronizing a collection with the dom, it synchronizes a single child element as a property.
repeatnow uses a strategy pattern to determine how to best iterate different collection types. You can even plug your own strategy in using the CollectionStrategyLocator
router-viewhas a new property
swap-orderwhich 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
- 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
bindcallback. Developers do not need to wait until the
- 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.
withbehavior 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
repeatand 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.
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...