aurelia-templating-router
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"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.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
System.config({ | ||
defaultJSExtensions: true, | ||
transpiler: "babel", | ||
babelOptions: { | ||
"optional": [ | ||
"runtime", | ||
"optimisation.modules.system" | ||
] | ||
}, | ||
paths: { | ||
@@ -10,2 +17,3 @@ "github:*": "jspm_packages/github/*", | ||
map: { | ||
"aurelia-binding": "npm:aurelia-binding@1.0.9", | ||
"aurelia-bootstrapper": "npm:aurelia-bootstrapper@1.0.0-rc.1.0.1", | ||
@@ -18,5 +26,5 @@ "aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.0.0", | ||
"aurelia-loader-default": "npm:aurelia-loader-default@1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.2.0", | ||
"aurelia-logging-console": "npm:aurelia-logging-console@1.0.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.2", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0", | ||
@@ -60,7 +68,13 @@ "aurelia-pal-browser": "npm:aurelia-pal-browser@1.0.0", | ||
"npm:aurelia-binding@1.0.0": { | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.2.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.2", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0", | ||
"aurelia-task-queue": "npm:aurelia-task-queue@1.0.0" | ||
}, | ||
"npm:aurelia-binding@1.0.9": { | ||
"aurelia-logging": "npm:aurelia-logging@1.2.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.2", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0", | ||
"aurelia-task-queue": "npm:aurelia-task-queue@1.1.0" | ||
}, | ||
"npm:aurelia-bootstrapper@1.0.0-rc.1.0.1": { | ||
@@ -83,7 +97,7 @@ "aurelia-event-aggregator": "npm:aurelia-event-aggregator@1.0.0", | ||
"npm:aurelia-dependency-injection@1.0.0": { | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.2", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0" | ||
}, | ||
"npm:aurelia-event-aggregator@1.0.0": { | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0" | ||
"aurelia-logging": "npm:aurelia-logging@1.2.0" | ||
}, | ||
@@ -94,4 +108,4 @@ "npm:aurelia-framework@1.0.0-rc.1.0.13": { | ||
"aurelia-loader": "npm:aurelia-loader@1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.2.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.2", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0", | ||
@@ -108,13 +122,13 @@ "aurelia-path": "npm:aurelia-path@1.0.0", | ||
"aurelia-loader": "npm:aurelia-loader@1.0.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.2", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0" | ||
}, | ||
"npm:aurelia-loader@1.0.0": { | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.2", | ||
"aurelia-path": "npm:aurelia-path@1.0.0" | ||
}, | ||
"npm:aurelia-logging-console@1.0.0": { | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0" | ||
"aurelia-logging": "npm:aurelia-logging@1.2.0" | ||
}, | ||
"npm:aurelia-metadata@1.0.0": { | ||
"npm:aurelia-metadata@1.0.2": { | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0" | ||
@@ -135,3 +149,3 @@ }, | ||
"aurelia-history": "npm:aurelia-history@1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.2.0", | ||
"aurelia-path": "npm:aurelia-path@1.0.0", | ||
@@ -143,5 +157,8 @@ "aurelia-route-recognizer": "npm:aurelia-route-recognizer@1.0.0" | ||
}, | ||
"npm:aurelia-task-queue@1.1.0": { | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0" | ||
}, | ||
"npm:aurelia-templating-binding@1.0.0-rc.1.0.1": { | ||
"aurelia-binding": "npm:aurelia-binding@1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.2.0", | ||
"aurelia-templating": "npm:aurelia-templating@1.0.0" | ||
@@ -153,4 +170,4 @@ }, | ||
"aurelia-loader": "npm:aurelia-loader@1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.2.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.2", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0", | ||
@@ -163,4 +180,4 @@ "aurelia-path": "npm:aurelia-path@1.0.0", | ||
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.2.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.2", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0", | ||
@@ -175,4 +192,4 @@ "aurelia-path": "npm:aurelia-path@1.0.0", | ||
"aurelia-loader": "npm:aurelia-loader@1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.2.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.2", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0", | ||
@@ -185,3 +202,3 @@ "aurelia-path": "npm:aurelia-path@1.0.0", | ||
"aurelia-framework": "npm:aurelia-framework@1.0.0-rc.1.0.13", | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.2.0", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0", | ||
@@ -188,0 +205,0 @@ "aurelia-templating": "npm:aurelia-templating@1.0.0" |
@@ -68,3 +68,9 @@ define(['exports', 'aurelia-templating', 'aurelia-dependency-injection', 'aurelia-router', 'aurelia-pal', 'aurelia-logging'], function (exports, _aureliaTemplating, _aureliaDependencyInjection, _aureliaRouter, _aureliaPal, _aureliaLogging) { | ||
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; | ||
@@ -71,0 +77,0 @@ }).catch(function (reason) { |
@@ -1,2 +0,2 @@ | ||
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'; | ||
@@ -175,2 +175,4 @@ | ||
var layoutInstruction = viewPortInstruction.layoutInstruction; | ||
var work = function work() { | ||
@@ -180,3 +182,2 @@ var previousView = _this2.view; | ||
var viewSlot = _this2.viewSlot; | ||
var layoutInstruction = viewPortInstruction.layoutInstruction; | ||
@@ -186,20 +187,4 @@ 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 () { | ||
@@ -211,12 +196,33 @@ _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(); | ||
}); | ||
} | ||
if (this.compositionTransactionOwnershipToken) { | ||
return this.compositionTransactionOwnershipToken.waitForCompositionComplete().then(function () { | ||
_this2.compositionTransactionOwnershipToken = null; | ||
return work(); | ||
return work(); | ||
}; | ||
if (layoutInstruction) { | ||
if (!layoutInstruction.viewModel) { | ||
layoutInstruction.viewModel = {}; | ||
} | ||
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); | ||
}; | ||
@@ -223,0 +229,0 @@ |
@@ -26,2 +26,5 @@ import * as LogManager from 'aurelia-logging'; | ||
import { | ||
createOverrideContext | ||
} from 'aurelia-binding'; | ||
import { | ||
Origin | ||
@@ -28,0 +31,0 @@ } from 'aurelia-metadata'; |
@@ -6,2 +6,3 @@ import * as LogManager from 'aurelia-logging'; | ||
import {DOM} from 'aurelia-pal'; | ||
import {createOverrideContext} from 'aurelia-binding'; | ||
import {Origin} from 'aurelia-metadata'; | ||
@@ -48,3 +49,9 @@ import {relativeToFile} from 'aurelia-path'; | ||
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; | ||
@@ -173,2 +180,4 @@ }).catch(reason => { | ||
swap(viewPortInstruction) { | ||
let layoutInstruction = viewPortInstruction.layoutInstruction; | ||
let work = () => { | ||
@@ -178,3 +187,2 @@ let previousView = this.view; | ||
let viewSlot = this.viewSlot; | ||
let layoutInstruction = viewPortInstruction.layoutInstruction; | ||
@@ -186,22 +194,4 @@ swapStrategy = this.swapOrder in swapStrategies | ||
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(() => { | ||
@@ -213,12 +203,35 @@ 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(); | ||
}); | ||
} | ||
if (this.compositionTransactionOwnershipToken) { | ||
return this.compositionTransactionOwnershipToken.waitForCompositionComplete().then(() => { | ||
this.compositionTransactionOwnershipToken = null; | ||
return work(); | ||
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); | ||
} | ||
@@ -225,0 +238,0 @@ |
@@ -62,3 +62,9 @@ 'use strict'; | ||
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; | ||
@@ -65,0 +71,0 @@ }).catch(function (reason) { |
@@ -12,2 +12,4 @@ 'use strict'; | ||
var _aureliaBinding = require('aurelia-binding'); | ||
var _aureliaTemplating = require('aurelia-templating'); | ||
@@ -185,2 +187,4 @@ | ||
var layoutInstruction = viewPortInstruction.layoutInstruction; | ||
var work = function work() { | ||
@@ -190,3 +194,2 @@ var previousView = _this2.view; | ||
var viewSlot = _this2.viewSlot; | ||
var layoutInstruction = viewPortInstruction.layoutInstruction; | ||
@@ -196,20 +199,4 @@ 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 () { | ||
@@ -221,12 +208,33 @@ _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(); | ||
}); | ||
} | ||
if (this.compositionTransactionOwnershipToken) { | ||
return this.compositionTransactionOwnershipToken.waitForCompositionComplete().then(function () { | ||
_this2.compositionTransactionOwnershipToken = null; | ||
return work(); | ||
return work(); | ||
}; | ||
if (layoutInstruction) { | ||
if (!layoutInstruction.viewModel) { | ||
layoutInstruction.viewModel = {}; | ||
} | ||
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); | ||
}; | ||
@@ -233,0 +241,0 @@ |
@@ -41,3 +41,9 @@ var _dec, _dec2, _dec3, _dec4, _dec5, _class; | ||
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; | ||
@@ -44,0 +50,0 @@ }).catch(reason => { |
@@ -47,2 +47,3 @@ var _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4; | ||
import { Container, inject } from 'aurelia-dependency-injection'; | ||
import { createOverrideContext } from 'aurelia-binding'; | ||
import { ViewSlot, ViewLocator, customElement, noView, BehaviorInstruction, bindable, CompositionTransaction, CompositionEngine, ShadowDOM } from 'aurelia-templating'; | ||
@@ -160,2 +161,4 @@ import { Router } from 'aurelia-router'; | ||
swap(viewPortInstruction) { | ||
let layoutInstruction = viewPortInstruction.layoutInstruction; | ||
let work = () => { | ||
@@ -165,3 +168,2 @@ let previousView = this.view; | ||
let viewSlot = this.viewSlot; | ||
let layoutInstruction = viewPortInstruction.layoutInstruction; | ||
@@ -171,20 +173,4 @@ swapStrategy = this.swapOrder in swapStrategies ? swapStrategies[this.swapOrder] : swapStrategies.after; | ||
swapStrategy(viewSlot, previousView, () => { | ||
let waitForView; | ||
if (layoutInstruction) { | ||
if (!layoutInstruction.viewModel) { | ||
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(() => { | ||
@@ -196,12 +182,33 @@ 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(); | ||
}); | ||
} | ||
if (this.compositionTransactionOwnershipToken) { | ||
return this.compositionTransactionOwnershipToken.waitForCompositionComplete().then(() => { | ||
this.compositionTransactionOwnershipToken = null; | ||
return work(); | ||
return work(); | ||
}; | ||
if (layoutInstruction) { | ||
if (!layoutInstruction.viewModel) { | ||
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); | ||
} | ||
@@ -208,0 +215,0 @@ |
@@ -47,3 +47,9 @@ var _dec, _dec2, _dec3, _dec4, _dec5, _class; | ||
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; | ||
@@ -50,0 +56,0 @@ }).catch(function (reason) { |
@@ -49,2 +49,3 @@ var _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4; | ||
import { Container, inject } from 'aurelia-dependency-injection'; | ||
import { createOverrideContext } from 'aurelia-binding'; | ||
import { ViewSlot, ViewLocator, customElement, noView, BehaviorInstruction, bindable, CompositionTransaction, CompositionEngine, ShadowDOM } from 'aurelia-templating'; | ||
@@ -174,2 +175,4 @@ import { Router } from 'aurelia-router'; | ||
var layoutInstruction = viewPortInstruction.layoutInstruction; | ||
var work = function work() { | ||
@@ -179,3 +182,2 @@ var previousView = _this2.view; | ||
var viewSlot = _this2.viewSlot; | ||
var layoutInstruction = viewPortInstruction.layoutInstruction; | ||
@@ -185,20 +187,4 @@ 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) { | ||
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 () { | ||
@@ -210,12 +196,33 @@ _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(); | ||
}); | ||
} | ||
if (this.compositionTransactionOwnershipToken) { | ||
return this.compositionTransactionOwnershipToken.waitForCompositionComplete().then(function () { | ||
_this2.compositionTransactionOwnershipToken = null; | ||
return work(); | ||
return work(); | ||
}; | ||
if (layoutInstruction) { | ||
if (!layoutInstruction.viewModel) { | ||
layoutInstruction.viewModel = {}; | ||
} | ||
return this.compositionEngine.createController(layoutInstruction).then(function (controller) { | ||
ShadowDOM.distributeView(viewPortInstruction.controller.view, controller.slots || controller.view.slots); | ||
controller.automate(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); | ||
}; | ||
@@ -222,0 +229,0 @@ |
@@ -60,3 +60,9 @@ 'use strict'; | ||
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; | ||
@@ -63,0 +69,0 @@ }).catch(function (reason) { |
'use strict'; | ||
System.register(['aurelia-dependency-injection', 'aurelia-templating', 'aurelia-router', 'aurelia-metadata', 'aurelia-pal'], function (_export, _context) { | ||
System.register(['aurelia-dependency-injection', 'aurelia-binding', 'aurelia-templating', 'aurelia-router', 'aurelia-metadata', 'aurelia-pal'], function (_export, _context) { | ||
"use strict"; | ||
var Container, inject, ViewSlot, ViewLocator, customElement, noView, BehaviorInstruction, bindable, CompositionTransaction, CompositionEngine, ShadowDOM, Router, Origin, DOM, _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, SwapStrategies, swapStrategies, RouterView; | ||
var Container, inject, createOverrideContext, ViewSlot, ViewLocator, customElement, noView, BehaviorInstruction, bindable, CompositionTransaction, CompositionEngine, ShadowDOM, Router, Origin, DOM, _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, SwapStrategies, swapStrategies, RouterView; | ||
@@ -57,2 +57,4 @@ function _initDefineProp(target, property, descriptor, context) { | ||
inject = _aureliaDependencyInjection.inject; | ||
}, function (_aureliaBinding) { | ||
createOverrideContext = _aureliaBinding.createOverrideContext; | ||
}, function (_aureliaTemplating) { | ||
@@ -195,2 +197,4 @@ ViewSlot = _aureliaTemplating.ViewSlot; | ||
var layoutInstruction = viewPortInstruction.layoutInstruction; | ||
var work = function work() { | ||
@@ -200,3 +204,2 @@ var previousView = _this2.view; | ||
var viewSlot = _this2.viewSlot; | ||
var layoutInstruction = viewPortInstruction.layoutInstruction; | ||
@@ -206,20 +209,4 @@ 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) { | ||
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 () { | ||
@@ -231,12 +218,33 @@ _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(); | ||
}); | ||
} | ||
if (this.compositionTransactionOwnershipToken) { | ||
return this.compositionTransactionOwnershipToken.waitForCompositionComplete().then(function () { | ||
_this2.compositionTransactionOwnershipToken = null; | ||
return work(); | ||
return work(); | ||
}; | ||
if (layoutInstruction) { | ||
if (!layoutInstruction.viewModel) { | ||
layoutInstruction.viewModel = {}; | ||
} | ||
return this.compositionEngine.createController(layoutInstruction).then(function (controller) { | ||
ShadowDOM.distributeView(viewPortInstruction.controller.view, controller.slots || controller.view.slots); | ||
controller.automate(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); | ||
}; | ||
@@ -243,0 +251,0 @@ |
@@ -22,2 +22,4 @@ 'use strict'; | ||
var _aureliaBinding = require('aurelia-binding'); | ||
var _aureliaMetadata = require('aurelia-metadata'); | ||
@@ -114,3 +116,9 @@ | ||
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; | ||
@@ -244,2 +252,4 @@ }).catch(function (reason) { | ||
var layoutInstruction = viewPortInstruction.layoutInstruction; | ||
var work = function work() { | ||
@@ -249,3 +259,2 @@ var previousView = _this3.view; | ||
var viewSlot = _this3.viewSlot; | ||
var layoutInstruction = viewPortInstruction.layoutInstruction; | ||
@@ -255,20 +264,4 @@ swapStrategy = _this3.swapOrder in swapStrategies ? swapStrategies[_this3.swapOrder] : swapStrategies.after; | ||
swapStrategy(viewSlot, previousView, function () { | ||
var waitForView = void 0; | ||
if (layoutInstruction) { | ||
if (!layoutInstruction.viewModel) { | ||
layoutInstruction.viewModel = {}; | ||
} | ||
waitForView = _this3.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) { | ||
_this3.view = newView; | ||
return viewSlot.add(newView); | ||
return Promise.resolve().then(function () { | ||
return viewSlot.add(_this3.view); | ||
}).then(function () { | ||
@@ -280,12 +273,33 @@ _this3._notify(); | ||
viewPortInstruction.controller.automate(this.overrideContext, this.owningView); | ||
var ready = function ready(owningView) { | ||
viewPortInstruction.controller.automate(_this3.overrideContext, owningView); | ||
if (_this3.compositionTransactionOwnershipToken) { | ||
return _this3.compositionTransactionOwnershipToken.waitForCompositionComplete().then(function () { | ||
_this3.compositionTransactionOwnershipToken = null; | ||
return work(); | ||
}); | ||
} | ||
if (this.compositionTransactionOwnershipToken) { | ||
return this.compositionTransactionOwnershipToken.waitForCompositionComplete().then(function () { | ||
_this3.compositionTransactionOwnershipToken = null; | ||
return work(); | ||
return work(); | ||
}; | ||
if (layoutInstruction) { | ||
if (!layoutInstruction.viewModel) { | ||
layoutInstruction.viewModel = {}; | ||
} | ||
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), _this3.owningView); | ||
controller.view.children.push(viewPortInstruction.controller.view); | ||
return controller.view || controller; | ||
}).then(function (newView) { | ||
_this3.view = newView; | ||
return ready(newView); | ||
}); | ||
} | ||
return work(); | ||
this.view = viewPortInstruction.controller.view; | ||
return ready(this.owningView); | ||
}; | ||
@@ -292,0 +306,0 @@ |
@@ -0,1 +1,11 @@ | ||
<a name="1.0.1"></a> | ||
## [1.0.1](https://github.com/aurelia/templating-router/compare/1.0.0...v1.0.1) (2016-12-03) | ||
### Bug Fixes | ||
* **router-view:** deco typo, lint and missing conditional ([7de1854](https://github.com/aurelia/templating-router/commit/7de1854)) | ||
<a name="1.0.0"></a> | ||
@@ -2,0 +12,0 @@ # [1.0.0](https://github.com/aurelia/templating-router/compare/1.0.0-rc.1.0.1...v1.0.0) (2016-07-27) |
@@ -9,4 +9,4 @@ <!-- | ||
Durandal Inc. offers paid support agreements. Further information regarding paid support | ||
may be obtained by emailing support@durandal.io | ||
Blue Spire offers paid support agreements. Further information regarding paid support | ||
may be obtained by emailing support@bluespire.com | ||
@@ -13,0 +13,0 @@ Future support requests submitted here will be closed. |
{ | ||
"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.", | ||
@@ -37,3 +37,4 @@ "keywords": [ | ||
"aurelia-router": "^1.0.1", | ||
"aurelia-templating": "^1.0.0" | ||
"aurelia-templating": "^1.0.0", | ||
"aurelia-binding": "^1.0.9" | ||
}, | ||
@@ -47,3 +48,4 @@ "dependencies": { | ||
"aurelia-router": "^1.0.1", | ||
"aurelia-templating": "^1.0.0" | ||
"aurelia-templating": "^1.0.0", | ||
"aurelia-binding": "^1.0.9" | ||
}, | ||
@@ -67,3 +69,4 @@ "devDependencies": { | ||
"aurelia-router": "^1.0.1", | ||
"aurelia-templating": "^1.0.0" | ||
"aurelia-templating": "^1.0.0", | ||
"aurelia-binding": "^1.0.9" | ||
}, | ||
@@ -70,0 +73,0 @@ "devDependencies": { |
@@ -10,3 +10,3 @@ # aurelia-templating-router | ||
> To keep up to date on [Aurelia](http://www.aurelia.io/), please visit and subscribe to [the official blog](http://blog.durandal.io/) and [our email list](http://durandal.us10.list-manage1.com/subscribe?u=dae7661a3872ee02b519f6f29&id=3de6801ccc). We also invite you to [follow us on twitter](https://twitter.com/aureliaeffect). If you have questions, please [join our community on Gitter](https://gitter.im/aurelia/discuss). If you would like to have deeper insight into our development process, please install the [ZenHub](https://zenhub.io) Chrome or Firefox Extension and visit any of our repository's boards. You can get an overview of all Aurelia work by visiting [the framework board](https://github.com/aurelia/framework#boards). | ||
> To keep up to date on [Aurelia](http://www.aurelia.io/), please visit and subscribe to [the official blog](http://blog.aurelia.io/) and [our email list](http://eepurl.com/ces50j). We also invite you to [follow us on twitter](https://twitter.com/aureliaeffect). If you have questions, please [join our community on Gitter](https://gitter.im/aurelia/discuss) or use [stack overflow](http://stackoverflow.com/search?q=aurelia). Documentation can be found [in our developer hub](http://aurelia.io/hub.html). If you would like to have deeper insight into our development process, please install the [ZenHub](https://zenhub.io) Chrome or Firefox Extension and visit any of our repository's boards. | ||
@@ -13,0 +13,0 @@ ## Platform Support |
@@ -45,3 +45,9 @@ import {customAttribute, bindable} from 'aurelia-templating'; | ||
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; | ||
@@ -48,0 +54,0 @@ }).catch(reason => { |
import {Container, inject} from 'aurelia-dependency-injection'; | ||
import {createOverrideContext} from 'aurelia-binding'; | ||
import {ViewSlot, ViewLocator, customElement, noView, BehaviorInstruction, bindable, CompositionTransaction, CompositionEngine, ShadowDOM} from 'aurelia-templating'; | ||
@@ -123,2 +124,4 @@ import {Router} from 'aurelia-router'; | ||
swap(viewPortInstruction) { | ||
let layoutInstruction = viewPortInstruction.layoutInstruction; | ||
let work = () => { | ||
@@ -128,3 +131,2 @@ let previousView = this.view; | ||
let viewSlot = this.viewSlot; | ||
let layoutInstruction = viewPortInstruction.layoutInstruction; | ||
@@ -136,22 +138,4 @@ swapStrategy = this.swapOrder in swapStrategies | ||
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(() => { | ||
@@ -163,12 +147,35 @@ 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(); | ||
}); | ||
} | ||
if (this.compositionTransactionOwnershipToken) { | ||
return this.compositionTransactionOwnershipToken.waitForCompositionComplete().then(() => { | ||
this.compositionTransactionOwnershipToken = null; | ||
return work(); | ||
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); | ||
} | ||
@@ -175,0 +182,0 @@ |
Sorry, the diff of this file is not supported yet
263195
3651
8
+ Addedaurelia-binding@^1.0.9
+ Addedaurelia-binding@1.7.3(transitive)