Skip to content

Commit

Permalink
chore(all): prepare release 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Dec 3, 2016
1 parent 7de1854 commit f2cafb2
Show file tree
Hide file tree
Showing 17 changed files with 339 additions and 213 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-templating-router",
"version": "1.0.0",
"version": "1.0.1",
"description": "An implementation of the RouteLoader interface for use with the router module. Also contains a custom element that allows the templating engine to display the current route.",
"keywords": [
"aurelia",
Expand Down
59 changes: 38 additions & 21 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
System.config({
defaultJSExtensions: true,
transpiler: "babel",
babelOptions: {
"optional": [
"runtime",
"optimisation.modules.system"
]
},
paths: {
"github:*": "jspm_packages/github/*",
"aurelia-templating-router/*": "dist/*",
"npm:*": "jspm_packages/npm/*"
},

map: {
"aurelia-binding": "npm:[email protected]",
"aurelia-bootstrapper": "npm:[email protected]",
"aurelia-dependency-injection": "npm:[email protected]",
"aurelia-event-aggregator": "npm:[email protected]",
"aurelia-framework": "npm:[email protected]",
"aurelia-history": "npm:[email protected]",
"aurelia-history-browser": "npm:[email protected]",
"aurelia-loader-default": "npm:[email protected]",
"aurelia-logging": "npm:aurelia-logging@1.0.0",
"aurelia-logging": "npm:aurelia-logging@1.2.0",
"aurelia-logging-console": "npm:[email protected]",
"aurelia-metadata": "npm:[email protected].0",
"aurelia-metadata": "npm:[email protected].2",
"aurelia-pal": "npm:[email protected]",
"aurelia-pal-browser": "npm:[email protected]",
"aurelia-path": "npm:[email protected]",
Expand Down Expand Up @@ -55,11 +63,17 @@ System.config({
"util": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-logging": "npm:aurelia-logging@1.0.0",
"aurelia-metadata": "npm:[email protected].0",
"aurelia-logging": "npm:aurelia-logging@1.2.0",
"aurelia-metadata": "npm:[email protected].2",
"aurelia-pal": "npm:[email protected]",
"aurelia-task-queue": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-logging": "npm:[email protected]",
"aurelia-metadata": "npm:[email protected]",
"aurelia-pal": "npm:[email protected]",
"aurelia-task-queue": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-event-aggregator": "npm:[email protected]",
"aurelia-framework": "npm:[email protected]",
Expand All @@ -77,18 +91,18 @@ System.config({
"aurelia-templating-router": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-metadata": "npm:[email protected].0",
"aurelia-metadata": "npm:[email protected].2",
"aurelia-pal": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-logging": "npm:aurelia-logging@1.0.0"
"aurelia-logging": "npm:aurelia-logging@1.2.0"
},
"npm:[email protected]": {
"aurelia-binding": "npm:[email protected]",
"aurelia-dependency-injection": "npm:[email protected]",
"aurelia-loader": "npm:[email protected]",
"aurelia-logging": "npm:aurelia-logging@1.0.0",
"aurelia-metadata": "npm:[email protected].0",
"aurelia-logging": "npm:aurelia-logging@1.2.0",
"aurelia-metadata": "npm:[email protected].2",
"aurelia-pal": "npm:[email protected]",
"aurelia-path": "npm:[email protected]",
"aurelia-task-queue": "npm:[email protected]",
Expand All @@ -100,17 +114,17 @@ System.config({
},
"npm:[email protected]": {
"aurelia-loader": "npm:[email protected]",
"aurelia-metadata": "npm:[email protected].0",
"aurelia-metadata": "npm:[email protected].2",
"aurelia-pal": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-metadata": "npm:[email protected].0",
"aurelia-metadata": "npm:[email protected].2",
"aurelia-path": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-logging": "npm:aurelia-logging@1.0.0"
"aurelia-logging": "npm:aurelia-logging@1.2.0"
},
"npm:[email protected].0": {
"npm:[email protected].2": {
"aurelia-pal": "npm:[email protected]"
},
"npm:[email protected]": {
Expand All @@ -126,33 +140,36 @@ System.config({
"aurelia-dependency-injection": "npm:[email protected]",
"aurelia-event-aggregator": "npm:[email protected]",
"aurelia-history": "npm:[email protected]",
"aurelia-logging": "npm:aurelia-logging@1.0.0",
"aurelia-logging": "npm:aurelia-logging@1.2.0",
"aurelia-path": "npm:[email protected]",
"aurelia-route-recognizer": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-pal": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-pal": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-binding": "npm:[email protected]",
"aurelia-logging": "npm:aurelia-logging@1.0.0",
"aurelia-logging": "npm:aurelia-logging@1.2.0",
"aurelia-templating": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-binding": "npm:[email protected]",
"aurelia-dependency-injection": "npm:[email protected]",
"aurelia-loader": "npm:[email protected]",
"aurelia-logging": "npm:aurelia-logging@1.0.0",
"aurelia-metadata": "npm:[email protected].0",
"aurelia-logging": "npm:aurelia-logging@1.2.0",
"aurelia-metadata": "npm:[email protected].2",
"aurelia-pal": "npm:[email protected]",
"aurelia-path": "npm:[email protected]",
"aurelia-task-queue": "npm:[email protected]",
"aurelia-templating": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-dependency-injection": "npm:[email protected]",
"aurelia-logging": "npm:aurelia-logging@1.0.0",
"aurelia-metadata": "npm:[email protected].0",
"aurelia-logging": "npm:aurelia-logging@1.2.0",
"aurelia-metadata": "npm:[email protected].2",
"aurelia-pal": "npm:[email protected]",
"aurelia-path": "npm:[email protected]",
"aurelia-router": "npm:[email protected]",
Expand All @@ -162,16 +179,16 @@ System.config({
"aurelia-binding": "npm:[email protected]",
"aurelia-dependency-injection": "npm:[email protected]",
"aurelia-loader": "npm:[email protected]",
"aurelia-logging": "npm:aurelia-logging@1.0.0",
"aurelia-metadata": "npm:[email protected].0",
"aurelia-logging": "npm:aurelia-logging@1.2.0",
"aurelia-metadata": "npm:[email protected].2",
"aurelia-pal": "npm:[email protected]",
"aurelia-path": "npm:[email protected]",
"aurelia-task-queue": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-dependency-injection": "npm:[email protected]",
"aurelia-framework": "npm:[email protected]",
"aurelia-logging": "npm:aurelia-logging@1.0.0",
"aurelia-logging": "npm:aurelia-logging@1.2.0",
"aurelia-pal": "npm:[email protected]",
"aurelia-templating": "npm:[email protected]"
},
Expand Down
8 changes: 7 additions & 1 deletion dist/amd/route-href.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ define(['exports', 'aurelia-templating', 'aurelia-dependency-injection', 'aureli
}

var href = _this.router.generate(_this.route, _this.params);
_this.element.setAttribute(_this.attribute, href);

if (_this.element.au.controller) {
_this.element.au.controller.viewModel[_this.attribute] = href;
} else {
_this.element.setAttribute(_this.attribute, href);
}

return null;
}).catch(function (reason) {
logger.error(reason);
Expand Down
58 changes: 32 additions & 26 deletions dist/amd/router-view.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aurelia-router', 'aurelia-metadata', 'aurelia-pal'], function (exports, _aureliaDependencyInjection, _aureliaTemplating, _aureliaRouter, _aureliaMetadata, _aureliaPal) {
define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-templating', 'aurelia-router', 'aurelia-metadata', 'aurelia-pal'], function (exports, _aureliaDependencyInjection, _aureliaBinding, _aureliaTemplating, _aureliaRouter, _aureliaMetadata, _aureliaPal) {
'use strict';

Object.defineProperty(exports, "__esModule", {
Expand Down Expand Up @@ -172,49 +172,55 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aureli
RouterView.prototype.swap = function swap(viewPortInstruction) {
var _this2 = this;

var layoutInstruction = viewPortInstruction.layoutInstruction;

var work = function work() {
var previousView = _this2.view;
var swapStrategy = void 0;
var viewSlot = _this2.viewSlot;
var layoutInstruction = viewPortInstruction.layoutInstruction;

swapStrategy = _this2.swapOrder in swapStrategies ? swapStrategies[_this2.swapOrder] : swapStrategies.after;

swapStrategy(viewSlot, previousView, function () {
var waitForView = void 0;

if (layoutInstruction) {
if (!layoutInstruction.viewModel) {
layoutInstruction.viewModel = {};
}

waitForView = _this2.compositionEngine.createController(layoutInstruction).then(function (layout) {
_aureliaTemplating.ShadowDOM.distributeView(viewPortInstruction.controller.view, layout.slots || layout.view.slots);
return layout.view || layout;
});
} else {
waitForView = Promise.resolve(viewPortInstruction.controller.view);
}

return waitForView.then(function (newView) {
_this2.view = newView;
return viewSlot.add(newView);
return Promise.resolve().then(function () {
return viewSlot.add(_this2.view);
}).then(function () {
_this2._notify();
});
});
};

viewPortInstruction.controller.automate(this.overrideContext, this.owningView);
var ready = function ready(owningView) {
viewPortInstruction.controller.automate(_this2.overrideContext, owningView);
if (_this2.compositionTransactionOwnershipToken) {
return _this2.compositionTransactionOwnershipToken.waitForCompositionComplete().then(function () {
_this2.compositionTransactionOwnershipToken = null;
return work();
});
}

return work();
};

if (layoutInstruction) {
if (!layoutInstruction.viewModel) {
layoutInstruction.viewModel = {};
}

if (this.compositionTransactionOwnershipToken) {
return this.compositionTransactionOwnershipToken.waitForCompositionComplete().then(function () {
_this2.compositionTransactionOwnershipToken = null;
return work();
return this.compositionEngine.createController(layoutInstruction).then(function (controller) {
_aureliaTemplating.ShadowDOM.distributeView(viewPortInstruction.controller.view, controller.slots || controller.view.slots);
controller.automate((0, _aureliaBinding.createOverrideContext)(layoutInstruction.viewModel), _this2.owningView);
controller.view.children.push(viewPortInstruction.controller.view);
return controller.view || controller;
}).then(function (newView) {
_this2.view = newView;
return ready(newView);
});
}

return work();
this.view = viewPortInstruction.controller.view;

return ready(this.owningView);
};

RouterView.prototype._notify = function _notify() {
Expand Down
3 changes: 3 additions & 0 deletions dist/aurelia-templating-router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import {
import {
DOM
} from 'aurelia-pal';
import {
createOverrideContext
} from 'aurelia-binding';
import {
Origin
} from 'aurelia-metadata';
Expand Down
69 changes: 41 additions & 28 deletions dist/aurelia-templating-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {customAttribute,bindable,ViewSlot,ViewLocator,customElement,noView,Behav
import {inject,Container} from 'aurelia-dependency-injection';
import {Router,RouteLoader} from 'aurelia-router';
import {DOM} from 'aurelia-pal';
import {createOverrideContext} from 'aurelia-binding';
import {Origin} from 'aurelia-metadata';
import {relativeToFile} from 'aurelia-path';

Expand Down Expand Up @@ -44,7 +45,13 @@ export class RouteHref {
}

let href = this.router.generate(this.route, this.params);
this.element.setAttribute(this.attribute, href);

if (this.element.au.controller) {
this.element.au.controller.viewModel[this.attribute] = href;
} else {
this.element.setAttribute(this.attribute, href);
}

return null;
}).catch(reason => {
logger.error(reason);
Expand Down Expand Up @@ -168,53 +175,59 @@ export class RouterView {
}

swap(viewPortInstruction) {
let layoutInstruction = viewPortInstruction.layoutInstruction;

let work = () => {
let previousView = this.view;
let swapStrategy;
let viewSlot = this.viewSlot;
let layoutInstruction = viewPortInstruction.layoutInstruction;

swapStrategy = this.swapOrder in swapStrategies
? swapStrategies[this.swapOrder]
: swapStrategies.after;

swapStrategy(viewSlot, previousView, () => {
let waitForView;

if (layoutInstruction) {
if (!layoutInstruction.viewModel) {
// createController chokes if there's no viewmodel, so create a dummy one
// could possibly check if there was no VM and don't use compose, just create a viewfactory -> view?
layoutInstruction.viewModel = {};
}

waitForView = this.compositionEngine.createController(layoutInstruction).then(layout => {
ShadowDOM.distributeView(viewPortInstruction.controller.view, layout.slots || layout.view.slots);
return layout.view || layout;
});
} else {
waitForView = Promise.resolve(viewPortInstruction.controller.view);
}

return waitForView.then(newView => {
this.view = newView;
return viewSlot.add(newView);
return Promise.resolve().then(() => {
return viewSlot.add(this.view);
}).then(() => {
this._notify();
});
});
};

viewPortInstruction.controller.automate(this.overrideContext, this.owningView);
let ready = owningView => {
viewPortInstruction.controller.automate(this.overrideContext, owningView);
if (this.compositionTransactionOwnershipToken) {
return this.compositionTransactionOwnershipToken.waitForCompositionComplete().then(() => {
this.compositionTransactionOwnershipToken = null;
return work();
});
}

return work();
};

if (this.compositionTransactionOwnershipToken) {
return this.compositionTransactionOwnershipToken.waitForCompositionComplete().then(() => {
this.compositionTransactionOwnershipToken = null;
return work();
if (layoutInstruction) {
if (!layoutInstruction.viewModel) {
// createController chokes if there's no viewmodel, so create a dummy one
// should we use something else for the view model here?
layoutInstruction.viewModel = {};
}

return this.compositionEngine.createController(layoutInstruction).then(controller => {
ShadowDOM.distributeView(viewPortInstruction.controller.view, controller.slots || controller.view.slots);
controller.automate(createOverrideContext(layoutInstruction.viewModel), this.owningView);
controller.view.children.push(viewPortInstruction.controller.view);
return controller.view || controller;
}).then(newView => {
this.view = newView;
return ready(newView);
});
}

return work();
this.view = viewPortInstruction.controller.view;

return ready(this.owningView);
}

_notify() {
Expand Down
Loading

0 comments on commit f2cafb2

Please sign in to comment.