Skip to content

Commit

Permalink
chore(all): prepare release 0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Mar 25, 2015
1 parent 4d1a7ea commit 08a63fd
Show file tree
Hide file tree
Showing 22 changed files with 238 additions and 64 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This library is part of the [Aurelia](http://www.aurelia.io/) platform and contains a powerful client-side router.

> To keep up to date on [Aurelia](http://www.aurelia.io/), please visit and subscribe to [the official blog](http://blog.durandal.io/). If you have questions, we invite you to join us on [our Gitter Channel](https://gitter.im/aurelia/discuss).
> To keep up to date on [Aurelia](http://www.aurelia.io/), please visit and subscribe to [the official blog](http://blog.durandal.io/). If you have questions, we invite you to join us on [![Join the chat at https://gitter.im/aurelia/discuss](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/aurelia/discuss?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge).
## Polyfills

Expand Down
13 changes: 7 additions & 6 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-router",
"version": "0.5.8",
"version": "0.6.0",
"description": "A powerful client-side router.",
"keywords": [
"aurelia",
Expand All @@ -16,10 +16,11 @@
"url": "http://github.com/aurelia/router"
},
"dependencies": {
"aurelia-dependency-injection": "^0.4.1",
"aurelia-history": "^0.2.2",
"aurelia-path": "^0.4.1",
"aurelia-route-recognizer": "^0.2.2",
"aurelia-dependency-injection": "^0.5.0",
"aurelia-event-aggregator": "^0.2.4",
"aurelia-history": "^0.2.4",
"aurelia-path": "^0.4.6",
"aurelia-route-recognizer": "^0.2.4",
"core-js": "zloirock/core-js"
}
}
}
11 changes: 6 additions & 5 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ System.config({

System.config({
"map": {
"aurelia-dependency-injection": "github:aurelia/dependency-injection@0.4.5",
"aurelia-dependency-injection": "github:aurelia/dependency-injection@0.5.0",
"aurelia-event-aggregator": "github:aurelia/[email protected]",
"aurelia-history": "github:aurelia/[email protected]",
"aurelia-path": "github:aurelia/[email protected].5",
"aurelia-path": "github:aurelia/[email protected].6",
"aurelia-route-recognizer": "github:aurelia/[email protected]",
"core-js": "npm:[email protected]",
"github:aurelia/[email protected]": {
"aurelia-metadata": "github:aurelia/[email protected]",
"github:aurelia/[email protected]": {
"aurelia-logging": "github:aurelia/[email protected]",
"aurelia-metadata": "github:aurelia/[email protected]",
"core-js": "npm:[email protected]"
},
"github:jspm/[email protected]": {
"process": "npm:[email protected].0"
"process": "npm:[email protected].1"
},
"npm:[email protected]": {
"process": "github:jspm/[email protected]"
Expand Down
9 changes: 6 additions & 3 deletions dist/amd/activation.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,18 @@ define(["exports", "./navigation-plan", "./navigation-commands", "./util"], func
}

if (isNavigationCommand(output)) {
output.router = router;
if (typeof output.setRouter === "function") {
output.setRouter(router);
}

return !!output.shouldContinueProcessing;
}

if (typeof output == "string") {
if (typeof output === "string") {
return affirmations.indexOf(value.toLowerCase()) !== -1;
}

if (typeof output == "undefined") {
if (typeof output === "undefined") {
return true;
}

Expand Down
21 changes: 19 additions & 2 deletions dist/amd/navigation-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,30 @@ define(["exports"], function (exports) {
*/

var Redirect = exports.Redirect = (function () {
function Redirect(url) {
function Redirect(url, options) {
_classCallCheck(this, Redirect);

this.url = url;
this.options = Object.assign({ trigger: true, replace: true }, options || {});
this.shouldContinueProcessing = false;
}

_prototypeProperties(Redirect, null, {
setRouter: {

/**
* Called by the activation system to set the child router.
*
* @method setRouter
* @param {Router} router
*/

value: function setRouter(router) {
this.router = router;
},
writable: true,
configurable: true
},
navigate: {

/**
Expand All @@ -44,7 +60,8 @@ define(["exports"], function (exports) {
*/

value: function navigate(appRouter) {
(this.router || appRouter).navigate(this.url, { trigger: true, replace: true });
var navigatingRouter = this.options.useAppRouter ? appRouter : this.router || appRouter;
navigatingRouter.navigate(this.url, this.options);
},
writable: true,
configurable: true
Expand Down
14 changes: 10 additions & 4 deletions dist/amd/route-loading.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
define(["exports", "./navigation-plan"], function (exports, _navigationPlan) {
"use strict";

var _toConsumableArray = function (arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } };

var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };

var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
Expand Down Expand Up @@ -101,12 +103,12 @@ define(["exports", "./navigation-plan"], function (exports, _navigationPlan) {

routers.push(navigationContext.router);

return loadComponent(routeLoader, navigationContext.router, viewPortPlan.config).then(function (component) {
return loadComponent(routeLoader, navigationContext, viewPortPlan.config).then(function (component) {
var viewPortInstruction = next.addViewPortInstruction(viewPortPlan.name, viewPortPlan.strategy, moduleId, component);

var controller = component.executionContext;

if (controller.router && routers.indexOf(controller.router) === -1) {
if (controller.router && controller.router.isConfigured && routers.indexOf(controller.router) === -1) {
var path = next.getWildcardPath();

return controller.router.createNavigationInstruction(path, next).then(function (childInstruction) {
Expand All @@ -123,10 +125,14 @@ define(["exports", "./navigation-plan"], function (exports, _navigationPlan) {
});
}

function loadComponent(routeLoader, router, config) {
function loadComponent(routeLoader, navigationContext, config) {
var router = navigationContext.router,
lifecycleArgs = navigationContext.nextInstruction.lifecycleArgs;
return routeLoader.loadRoute(router, config).then(function (component) {
if ("configureRouter" in component.executionContext) {
var result = component.executionContext.configureRouter() || Promise.resolve();
var _component$executionContext;

var result = (_component$executionContext = component.executionContext).configureRouter.apply(_component$executionContext, _toConsumableArray(lifecycleArgs)) || Promise.resolve();
return result.then(function () {
return component;
});
Expand Down
18 changes: 17 additions & 1 deletion dist/amd/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ define(["exports", "aurelia-route-recognizer", "aurelia-path", "./navigation-con
this.viewPorts = {};
this.reset();
this.baseUrl = "";
this.isConfigured = false;
}

_prototypeProperties(Router, null, {
Expand Down Expand Up @@ -77,6 +78,8 @@ define(["exports", "aurelia-route-recognizer", "aurelia-path", "./navigation-con
},
configure: {
value: function configure(callbackOrConfig) {
this.isConfigured = true;

if (typeof callbackOrConfig == "function") {
var config = new RouterConfiguration();
callbackOrConfig(config);
Expand All @@ -92,6 +95,10 @@ define(["exports", "aurelia-route-recognizer", "aurelia-path", "./navigation-con
},
navigate: {
value: function navigate(fragment, options) {
if (!this.isConfigured && this.parent) {
return this.parent.navigate(fragment, options);
}

fragment = join(this.baseUrl, fragment);
if (fragment === "") fragment = "/";
return this.history.navigate(fragment, options);
Expand Down Expand Up @@ -191,6 +198,10 @@ define(["exports", "aurelia-route-recognizer", "aurelia-path", "./navigation-con
},
generate: {
value: function generate(name, params) {
if (!this.isConfigured && this.parent) {
return this.parent.generate(name, params);
}

return this.recognizer.generate(name, params);
},
writable: true,
Expand All @@ -216,7 +227,11 @@ define(["exports", "aurelia-route-recognizer", "aurelia-path", "./navigation-con
this.recognizer.add([{ path: config.route, handler: config }]);

if (config.route) {
var withChild = JSON.parse(JSON.stringify(config));
var withChild,
settings = config.settings;
delete config.settings;
withChild = JSON.parse(JSON.stringify(config));
config.settings = settings;
withChild.route += "/*childRoute";
withChild.hasChildRouter = true;
this.childRecognizer.add([{
Expand Down Expand Up @@ -292,6 +307,7 @@ define(["exports", "aurelia-route-recognizer", "aurelia-path", "./navigation-con
this.routes = [];
this.isNavigating = false;
this.navigation = [];
this.isConfigured = false;
},
writable: true,
configurable: true
Expand Down
9 changes: 6 additions & 3 deletions dist/commonjs/activation.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,18 @@ function shouldContinue(output, router) {
}

if (isNavigationCommand(output)) {
output.router = router;
if (typeof output.setRouter === "function") {
output.setRouter(router);
}

return !!output.shouldContinueProcessing;
}

if (typeof output == "string") {
if (typeof output === "string") {
return affirmations.indexOf(value.toLowerCase()) !== -1;
}

if (typeof output == "undefined") {
if (typeof output === "undefined") {
return true;
}

Expand Down
21 changes: 19 additions & 2 deletions dist/commonjs/navigation-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,30 @@ function isNavigationCommand(obj) {
*/

var Redirect = exports.Redirect = (function () {
function Redirect(url) {
function Redirect(url, options) {
_classCallCheck(this, Redirect);

this.url = url;
this.options = Object.assign({ trigger: true, replace: true }, options || {});
this.shouldContinueProcessing = false;
}

_prototypeProperties(Redirect, null, {
setRouter: {

/**
* Called by the activation system to set the child router.
*
* @method setRouter
* @param {Router} router
*/

value: function setRouter(router) {
this.router = router;
},
writable: true,
configurable: true
},
navigate: {

/**
Expand All @@ -43,7 +59,8 @@ var Redirect = exports.Redirect = (function () {
*/

value: function navigate(appRouter) {
(this.router || appRouter).navigate(this.url, { trigger: true, replace: true });
var navigatingRouter = this.options.useAppRouter ? appRouter : this.router || appRouter;
navigatingRouter.navigate(this.url, this.options);
},
writable: true,
configurable: true
Expand Down
14 changes: 10 additions & 4 deletions dist/commonjs/route-loading.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"use strict";

var _toConsumableArray = function (arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } };

var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };

var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
Expand Down Expand Up @@ -103,12 +105,12 @@ function loadRoute(routers, routeLoader, navigationContext, viewPortPlan) {

routers.push(navigationContext.router);

return loadComponent(routeLoader, navigationContext.router, viewPortPlan.config).then(function (component) {
return loadComponent(routeLoader, navigationContext, viewPortPlan.config).then(function (component) {
var viewPortInstruction = next.addViewPortInstruction(viewPortPlan.name, viewPortPlan.strategy, moduleId, component);

var controller = component.executionContext;

if (controller.router && routers.indexOf(controller.router) === -1) {
if (controller.router && controller.router.isConfigured && routers.indexOf(controller.router) === -1) {
var path = next.getWildcardPath();

return controller.router.createNavigationInstruction(path, next).then(function (childInstruction) {
Expand All @@ -125,10 +127,14 @@ function loadRoute(routers, routeLoader, navigationContext, viewPortPlan) {
});
}

function loadComponent(routeLoader, router, config) {
function loadComponent(routeLoader, navigationContext, config) {
var router = navigationContext.router,
lifecycleArgs = navigationContext.nextInstruction.lifecycleArgs;
return routeLoader.loadRoute(router, config).then(function (component) {
if ("configureRouter" in component.executionContext) {
var result = component.executionContext.configureRouter() || Promise.resolve();
var _component$executionContext;

var result = (_component$executionContext = component.executionContext).configureRouter.apply(_component$executionContext, _toConsumableArray(lifecycleArgs)) || Promise.resolve();
return result.then(function () {
return component;
});
Expand Down
18 changes: 17 additions & 1 deletion dist/commonjs/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var Router = exports.Router = (function () {
this.viewPorts = {};
this.reset();
this.baseUrl = "";
this.isConfigured = false;
}

_prototypeProperties(Router, null, {
Expand Down Expand Up @@ -81,6 +82,8 @@ var Router = exports.Router = (function () {
},
configure: {
value: function configure(callbackOrConfig) {
this.isConfigured = true;

if (typeof callbackOrConfig == "function") {
var config = new RouterConfiguration();
callbackOrConfig(config);
Expand All @@ -96,6 +99,10 @@ var Router = exports.Router = (function () {
},
navigate: {
value: function navigate(fragment, options) {
if (!this.isConfigured && this.parent) {
return this.parent.navigate(fragment, options);
}

fragment = join(this.baseUrl, fragment);
if (fragment === "") fragment = "/";
return this.history.navigate(fragment, options);
Expand Down Expand Up @@ -195,6 +202,10 @@ var Router = exports.Router = (function () {
},
generate: {
value: function generate(name, params) {
if (!this.isConfigured && this.parent) {
return this.parent.generate(name, params);
}

return this.recognizer.generate(name, params);
},
writable: true,
Expand All @@ -220,7 +231,11 @@ var Router = exports.Router = (function () {
this.recognizer.add([{ path: config.route, handler: config }]);

if (config.route) {
var withChild = JSON.parse(JSON.stringify(config));
var withChild,
settings = config.settings;
delete config.settings;
withChild = JSON.parse(JSON.stringify(config));
config.settings = settings;
withChild.route += "/*childRoute";
withChild.hasChildRouter = true;
this.childRecognizer.add([{
Expand Down Expand Up @@ -296,6 +311,7 @@ var Router = exports.Router = (function () {
this.routes = [];
this.isNavigating = false;
this.navigation = [];
this.isConfigured = false;
},
writable: true,
configurable: true
Expand Down
Loading

0 comments on commit 08a63fd

Please sign in to comment.