aurelia-templating-router
Advanced tools
Comparing version 1.0.0-beta.1.0.2 to 1.0.0-beta.1.0.3
{ | ||
"name": "aurelia-templating-router", | ||
"version": "1.0.0-beta.1.0.2", | ||
"version": "1.0.0-beta.1.0.3", | ||
"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": [ |
@@ -21,8 +21,8 @@ System.config({ | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0-beta.1", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-beta.1", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-beta.1.0.1", | ||
"aurelia-path": "npm:aurelia-path@1.0.0-beta.1", | ||
"aurelia-router": "npm:aurelia-router@1.0.0-beta.1", | ||
"aurelia-templating": "npm:aurelia-templating@1.0.0-beta.1", | ||
"babel": "npm:babel-core@5.8.23", | ||
"babel-runtime": "npm:babel-runtime@5.8.20", | ||
"aurelia-templating": "npm:aurelia-templating@1.0.0-beta.1.0.2", | ||
"babel": "npm:babel-core@5.8.34", | ||
"babel-runtime": "npm:babel-runtime@5.8.34", | ||
"core-js": "npm:core-js@1.2.6", | ||
@@ -44,6 +44,6 @@ "github:jspm/nodelibs-assert@0.1.0": { | ||
}, | ||
"npm:aurelia-binding@1.0.0-beta.1.0.1": { | ||
"npm:aurelia-binding@1.0.0-beta.1.0.3": { | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0-beta.1", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-beta.1", | ||
"aurelia-task-queue": "npm:aurelia-task-queue@1.0.0-beta.1", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-beta.1.0.1", | ||
"aurelia-task-queue": "npm:aurelia-task-queue@1.0.0-beta.1.0.1", | ||
"core-js": "npm:core-js@1.2.6" | ||
@@ -54,3 +54,3 @@ }, | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0-beta.1", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-beta.1", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-beta.1.0.1", | ||
"core-js": "npm:core-js@1.2.6" | ||
@@ -66,3 +66,3 @@ }, | ||
"npm:aurelia-metadata@1.0.0-beta.1": { | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-beta.1", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-beta.1.0.1", | ||
"core-js": "npm:core-js@1.2.6" | ||
@@ -83,7 +83,7 @@ }, | ||
}, | ||
"npm:aurelia-task-queue@1.0.0-beta.1": { | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-beta.1" | ||
"npm:aurelia-task-queue@1.0.0-beta.1.0.1": { | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-beta.1.0.1" | ||
}, | ||
"npm:aurelia-templating@1.0.0-beta.1": { | ||
"aurelia-binding": "npm:aurelia-binding@1.0.0-beta.1.0.1", | ||
"npm:aurelia-templating@1.0.0-beta.1.0.2": { | ||
"aurelia-binding": "npm:aurelia-binding@1.0.0-beta.1.0.3", | ||
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.0.0-beta.1", | ||
@@ -93,8 +93,8 @@ "aurelia-loader": "npm:aurelia-loader@1.0.0-beta.1", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0-beta.1", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-beta.1", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-beta.1.0.1", | ||
"aurelia-path": "npm:aurelia-path@1.0.0-beta.1", | ||
"aurelia-task-queue": "npm:aurelia-task-queue@1.0.0-beta.1", | ||
"aurelia-task-queue": "npm:aurelia-task-queue@1.0.0-beta.1.0.1", | ||
"core-js": "npm:core-js@1.2.6" | ||
}, | ||
"npm:babel-runtime@5.8.20": { | ||
"npm:babel-runtime@5.8.34": { | ||
"process": "github:jspm/nodelibs-process@0.1.2" | ||
@@ -101,0 +101,0 @@ }, |
@@ -16,2 +16,13 @@ declare module 'aurelia-templating-router' { | ||
} | ||
class SwapStrategies { | ||
// animate the next view in before removing the current view; | ||
before(viewSlot: any, previousView: any, callback: any): any; | ||
// animate the next view at the same time the current view is removed | ||
with(viewSlot: any, previousView: any, callback: any): any; | ||
// animate the next view in after the current view has been removed | ||
after(viewSlot: any, previousView: any, callback: any): any; | ||
} | ||
export class RouterView { | ||
@@ -18,0 +29,0 @@ swapOrder: any; |
@@ -8,10 +8,12 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aurelia-router', 'aurelia-metadata', 'aurelia-pal'], function (exports, _aureliaDependencyInjection, _aureliaTemplating, _aureliaRouter, _aureliaMetadata, _aureliaPal) { | ||
function _defineDecoratedPropertyDescriptor(target, key, descriptors) { var _descriptor = descriptors[key]; if (!_descriptor) return; var descriptor = {}; for (var _key in _descriptor) descriptor[_key] = _descriptor[_key]; descriptor.value = descriptor.initializer ? descriptor.initializer.call(target) : undefined; Object.defineProperty(target, key, descriptor); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
function _defineDecoratedPropertyDescriptor(target, key, descriptors) { var _descriptor = descriptors[key]; if (!_descriptor) return; var descriptor = {}; for (var _key in _descriptor) descriptor[_key] = _descriptor[_key]; descriptor.value = descriptor.initializer ? descriptor.initializer.call(target) : undefined; Object.defineProperty(target, key, descriptor); } | ||
var SwapStrategies = (function () { | ||
function SwapStrategies() { | ||
_classCallCheck(this, SwapStrategies); | ||
} | ||
var swapStrategies = { | ||
'default': 'before', | ||
before: function before(viewSlot, previousView, callback) { | ||
SwapStrategies.prototype.before = function before(viewSlot, previousView, callback) { | ||
var promise = Promise.resolve(callback()); | ||
@@ -26,17 +28,23 @@ | ||
return promise; | ||
}, | ||
}; | ||
'with': function _with(viewSlot, previousView, callback) { | ||
SwapStrategies.prototype['with'] = function _with(viewSlot, previousView, callback) { | ||
var promise = Promise.resolve(callback()); | ||
if (previousView !== undefined) { | ||
viewSlot.remove(previousView, true); | ||
return Promise.all(viewSlot.remove(previousView, true), promise); | ||
} | ||
return callback(); | ||
}, | ||
return promise; | ||
}; | ||
after: function after(viewSlot, previousView, callback) { | ||
SwapStrategies.prototype.after = function after(viewSlot, previousView, callback) { | ||
return Promise.resolve(viewSlot.removeAll(true)).then(callback); | ||
} | ||
}; | ||
}; | ||
return SwapStrategies; | ||
})(); | ||
var swapStrategies = new SwapStrategies(); | ||
var RouterView = (function () { | ||
@@ -48,5 +56,3 @@ var _instanceInitializers = {}; | ||
decorators: [_aureliaTemplating.bindable], | ||
initializer: function initializer() { | ||
return swapStrategies[swapStrategies['default']]; | ||
}, | ||
initializer: null, | ||
enumerable: true | ||
@@ -100,4 +106,6 @@ }], null, _instanceInitializers); | ||
var viewSlot = this.viewSlot; | ||
var swapStrategy = this.swapOrder in swapStrategies ? swapStrategies[this.swapOrder] : swapStrategies[swapStrategies['default']]; | ||
var swapStrategy = undefined; | ||
swapStrategy = this.swapOrder in swapStrategies ? swapStrategies[this.swapOrder] : swapStrategies.after; | ||
swapStrategy(viewSlot, previousView, addNextView); | ||
@@ -104,0 +112,0 @@ this.view = viewPortInstruction.controller.view; |
@@ -16,2 +16,13 @@ declare module 'aurelia-templating-router' { | ||
} | ||
class SwapStrategies { | ||
// animate the next view in before removing the current view; | ||
before(viewSlot: any, previousView: any, callback: any): any; | ||
// animate the next view at the same time the current view is removed | ||
with(viewSlot: any, previousView: any, callback: any): any; | ||
// animate the next view in after the current view has been removed | ||
after(viewSlot: any, previousView: any, callback: any): any; | ||
} | ||
export class RouterView { | ||
@@ -18,0 +29,0 @@ swapOrder: any; |
@@ -55,4 +55,3 @@ import * as LogManager from 'aurelia-logging'; | ||
const swapStrategies = { | ||
default: 'before', | ||
class SwapStrategies { | ||
// animate the next view in before removing the current view; | ||
@@ -67,11 +66,15 @@ before(viewSlot, previousView, callback) { | ||
return promise; | ||
}, | ||
} | ||
// animate the next view at the same time the current view is removed | ||
with(viewSlot, previousView, callback) { | ||
let promise = Promise.resolve(callback()); | ||
if (previousView !== undefined) { | ||
viewSlot.remove(previousView, true); | ||
return Promise.all(viewSlot.remove(previousView, true), promise); | ||
} | ||
return callback(); | ||
}, | ||
return promise; | ||
} | ||
// animate the next view in after the current view has been removed | ||
@@ -81,4 +84,6 @@ after(viewSlot, previousView, callback) { | ||
} | ||
}; | ||
} | ||
const swapStrategies = new SwapStrategies(); | ||
@customElement('router-view') | ||
@@ -88,3 +93,3 @@ @noView | ||
export class RouterView { | ||
@bindable swapOrder = swapStrategies[swapStrategies.default]; | ||
@bindable swapOrder; | ||
@@ -136,6 +141,8 @@ constructor(element, container, viewSlot, router, viewLocator) { | ||
let viewSlot = this.viewSlot; | ||
let swapStrategy = this.swapOrder in swapStrategies | ||
? swapStrategies[this.swapOrder] | ||
: swapStrategies[swapStrategies.default]; | ||
let swapStrategy; | ||
swapStrategy = this.swapOrder in swapStrategies | ||
? swapStrategies[this.swapOrder] | ||
: swapStrategies.after; | ||
swapStrategy(viewSlot, previousView, addNextView); | ||
@@ -142,0 +149,0 @@ this.view = viewPortInstruction.controller.view; |
@@ -16,2 +16,13 @@ declare module 'aurelia-templating-router' { | ||
} | ||
class SwapStrategies { | ||
// animate the next view in before removing the current view; | ||
before(viewSlot: any, previousView: any, callback: any): any; | ||
// animate the next view at the same time the current view is removed | ||
with(viewSlot: any, previousView: any, callback: any): any; | ||
// animate the next view in after the current view has been removed | ||
after(viewSlot: any, previousView: any, callback: any): any; | ||
} | ||
export class RouterView { | ||
@@ -18,0 +29,0 @@ swapOrder: any; |
@@ -7,6 +7,6 @@ 'use strict'; | ||
function _defineDecoratedPropertyDescriptor(target, key, descriptors) { var _descriptor = descriptors[key]; if (!_descriptor) return; var descriptor = {}; for (var _key in _descriptor) descriptor[_key] = _descriptor[_key]; descriptor.value = descriptor.initializer ? descriptor.initializer.call(target) : undefined; Object.defineProperty(target, key, descriptor); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
function _defineDecoratedPropertyDescriptor(target, key, descriptors) { var _descriptor = descriptors[key]; if (!_descriptor) return; var descriptor = {}; for (var _key in _descriptor) descriptor[_key] = _descriptor[_key]; descriptor.value = descriptor.initializer ? descriptor.initializer.call(target) : undefined; Object.defineProperty(target, key, descriptor); } | ||
var _aureliaDependencyInjection = require('aurelia-dependency-injection'); | ||
@@ -22,6 +22,8 @@ | ||
var swapStrategies = { | ||
'default': 'before', | ||
var SwapStrategies = (function () { | ||
function SwapStrategies() { | ||
_classCallCheck(this, SwapStrategies); | ||
} | ||
before: function before(viewSlot, previousView, callback) { | ||
SwapStrategies.prototype.before = function before(viewSlot, previousView, callback) { | ||
var promise = Promise.resolve(callback()); | ||
@@ -36,17 +38,23 @@ | ||
return promise; | ||
}, | ||
}; | ||
'with': function _with(viewSlot, previousView, callback) { | ||
SwapStrategies.prototype['with'] = function _with(viewSlot, previousView, callback) { | ||
var promise = Promise.resolve(callback()); | ||
if (previousView !== undefined) { | ||
viewSlot.remove(previousView, true); | ||
return Promise.all(viewSlot.remove(previousView, true), promise); | ||
} | ||
return callback(); | ||
}, | ||
return promise; | ||
}; | ||
after: function after(viewSlot, previousView, callback) { | ||
SwapStrategies.prototype.after = function after(viewSlot, previousView, callback) { | ||
return Promise.resolve(viewSlot.removeAll(true)).then(callback); | ||
} | ||
}; | ||
}; | ||
return SwapStrategies; | ||
})(); | ||
var swapStrategies = new SwapStrategies(); | ||
var RouterView = (function () { | ||
@@ -58,5 +66,3 @@ var _instanceInitializers = {}; | ||
decorators: [_aureliaTemplating.bindable], | ||
initializer: function initializer() { | ||
return swapStrategies[swapStrategies['default']]; | ||
}, | ||
initializer: null, | ||
enumerable: true | ||
@@ -110,4 +116,6 @@ }], null, _instanceInitializers); | ||
var viewSlot = this.viewSlot; | ||
var swapStrategy = this.swapOrder in swapStrategies ? swapStrategies[this.swapOrder] : swapStrategies[swapStrategies['default']]; | ||
var swapStrategy = undefined; | ||
swapStrategy = this.swapOrder in swapStrategies ? swapStrategies[this.swapOrder] : swapStrategies.after; | ||
swapStrategy(viewSlot, previousView, addNextView); | ||
@@ -114,0 +122,0 @@ this.view = viewPortInstruction.controller.view; |
@@ -16,2 +16,13 @@ declare module 'aurelia-templating-router' { | ||
} | ||
class SwapStrategies { | ||
// animate the next view in before removing the current view; | ||
before(viewSlot: any, previousView: any, callback: any): any; | ||
// animate the next view at the same time the current view is removed | ||
with(viewSlot: any, previousView: any, callback: any): any; | ||
// animate the next view in after the current view has been removed | ||
after(viewSlot: any, previousView: any, callback: any): any; | ||
} | ||
export class RouterView { | ||
@@ -18,0 +29,0 @@ swapOrder: any; |
@@ -7,4 +7,3 @@ import {Container, inject} from 'aurelia-dependency-injection'; | ||
const swapStrategies = { | ||
default: 'before', | ||
class SwapStrategies { | ||
// animate the next view in before removing the current view; | ||
@@ -19,11 +18,15 @@ before(viewSlot, previousView, callback) { | ||
return promise; | ||
}, | ||
} | ||
// animate the next view at the same time the current view is removed | ||
with(viewSlot, previousView, callback) { | ||
let promise = Promise.resolve(callback()); | ||
if (previousView !== undefined) { | ||
viewSlot.remove(previousView, true); | ||
return Promise.all(viewSlot.remove(previousView, true), promise); | ||
} | ||
return callback(); | ||
}, | ||
return promise; | ||
} | ||
// animate the next view in after the current view has been removed | ||
@@ -33,4 +36,6 @@ after(viewSlot, previousView, callback) { | ||
} | ||
}; | ||
} | ||
const swapStrategies = new SwapStrategies(); | ||
@customElement('router-view') | ||
@@ -40,3 +45,3 @@ @noView | ||
export class RouterView { | ||
@bindable swapOrder = swapStrategies[swapStrategies.default]; | ||
@bindable swapOrder; | ||
@@ -88,6 +93,8 @@ constructor(element, container, viewSlot, router, viewLocator) { | ||
let viewSlot = this.viewSlot; | ||
let swapStrategy = this.swapOrder in swapStrategies | ||
? swapStrategies[this.swapOrder] | ||
: swapStrategies[swapStrategies.default]; | ||
let swapStrategy; | ||
swapStrategy = this.swapOrder in swapStrategies | ||
? swapStrategies[this.swapOrder] | ||
: swapStrategies.after; | ||
swapStrategy(viewSlot, previousView, addNextView); | ||
@@ -94,0 +101,0 @@ this.view = viewPortInstruction.controller.view; |
@@ -16,2 +16,13 @@ declare module 'aurelia-templating-router' { | ||
} | ||
class SwapStrategies { | ||
// animate the next view in before removing the current view; | ||
before(viewSlot: any, previousView: any, callback: any): any; | ||
// animate the next view at the same time the current view is removed | ||
with(viewSlot: any, previousView: any, callback: any): any; | ||
// animate the next view in after the current view has been removed | ||
after(viewSlot: any, previousView: any, callback: any): any; | ||
} | ||
export class RouterView { | ||
@@ -18,0 +29,0 @@ swapOrder: any; |
System.register(['aurelia-dependency-injection', 'aurelia-templating', 'aurelia-router', 'aurelia-metadata', 'aurelia-pal'], function (_export) { | ||
'use strict'; | ||
var Container, inject, ViewSlot, ViewLocator, customElement, noView, BehaviorInstruction, bindable, Router, Origin, DOM, swapStrategies, RouterView; | ||
var Container, inject, ViewSlot, ViewLocator, customElement, noView, BehaviorInstruction, bindable, Router, Origin, DOM, SwapStrategies, swapStrategies, RouterView; | ||
var _createDecoratedClass = (function () { function defineProperties(target, descriptors, initializers) { for (var i = 0; i < descriptors.length; i++) { var descriptor = descriptors[i]; var decorators = descriptor.decorators; var key = descriptor.key; delete descriptor.key; delete descriptor.decorators; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor || descriptor.initializer) descriptor.writable = true; if (decorators) { for (var f = 0; f < decorators.length; f++) { var decorator = decorators[f]; if (typeof decorator === 'function') { descriptor = decorator(target, key, descriptor) || descriptor; } else { throw new TypeError('The decorator for method ' + descriptor.key + ' is of the invalid type ' + typeof decorator); } } if (descriptor.initializer !== undefined) { initializers[key] = descriptor; continue; } } Object.defineProperty(target, key, descriptor); } } return function (Constructor, protoProps, staticProps, protoInitializers, staticInitializers) { if (protoProps) defineProperties(Constructor.prototype, protoProps, protoInitializers); if (staticProps) defineProperties(Constructor, staticProps, staticInitializers); return Constructor; }; })(); | ||
function _defineDecoratedPropertyDescriptor(target, key, descriptors) { var _descriptor = descriptors[key]; if (!_descriptor) return; var descriptor = {}; for (var _key in _descriptor) descriptor[_key] = _descriptor[_key]; descriptor.value = descriptor.initializer ? descriptor.initializer.call(target) : undefined; Object.defineProperty(target, key, descriptor); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
function _defineDecoratedPropertyDescriptor(target, key, descriptors) { var _descriptor = descriptors[key]; if (!_descriptor) return; var descriptor = {}; for (var _key in _descriptor) descriptor[_key] = _descriptor[_key]; descriptor.value = descriptor.initializer ? descriptor.initializer.call(target) : undefined; Object.defineProperty(target, key, descriptor); } | ||
return { | ||
@@ -31,6 +31,8 @@ setters: [function (_aureliaDependencyInjection) { | ||
execute: function () { | ||
swapStrategies = { | ||
'default': 'before', | ||
SwapStrategies = (function () { | ||
function SwapStrategies() { | ||
_classCallCheck(this, SwapStrategies); | ||
} | ||
before: function before(viewSlot, previousView, callback) { | ||
SwapStrategies.prototype.before = function before(viewSlot, previousView, callback) { | ||
var promise = Promise.resolve(callback()); | ||
@@ -45,17 +47,23 @@ | ||
return promise; | ||
}, | ||
}; | ||
'with': function _with(viewSlot, previousView, callback) { | ||
SwapStrategies.prototype['with'] = function _with(viewSlot, previousView, callback) { | ||
var promise = Promise.resolve(callback()); | ||
if (previousView !== undefined) { | ||
viewSlot.remove(previousView, true); | ||
return Promise.all(viewSlot.remove(previousView, true), promise); | ||
} | ||
return callback(); | ||
}, | ||
return promise; | ||
}; | ||
after: function after(viewSlot, previousView, callback) { | ||
SwapStrategies.prototype.after = function after(viewSlot, previousView, callback) { | ||
return Promise.resolve(viewSlot.removeAll(true)).then(callback); | ||
} | ||
}; | ||
}; | ||
return SwapStrategies; | ||
})(); | ||
swapStrategies = new SwapStrategies(); | ||
RouterView = (function () { | ||
@@ -67,5 +75,3 @@ var _instanceInitializers = {}; | ||
decorators: [bindable], | ||
initializer: function initializer() { | ||
return swapStrategies[swapStrategies['default']]; | ||
}, | ||
initializer: null, | ||
enumerable: true | ||
@@ -119,4 +125,6 @@ }], null, _instanceInitializers); | ||
var viewSlot = this.viewSlot; | ||
var swapStrategy = this.swapOrder in swapStrategies ? swapStrategies[this.swapOrder] : swapStrategies[swapStrategies['default']]; | ||
var swapStrategy = undefined; | ||
swapStrategy = this.swapOrder in swapStrategies ? swapStrategies[this.swapOrder] : swapStrategies.after; | ||
swapStrategy(viewSlot, previousView, addNextView); | ||
@@ -123,0 +131,0 @@ this.view = viewPortInstruction.controller.view; |
@@ -84,6 +84,8 @@ 'use strict'; | ||
var swapStrategies = { | ||
'default': 'before', | ||
var SwapStrategies = (function () { | ||
function SwapStrategies() { | ||
_classCallCheck(this, SwapStrategies); | ||
} | ||
before: function before(viewSlot, previousView, callback) { | ||
SwapStrategies.prototype.before = function before(viewSlot, previousView, callback) { | ||
var promise = Promise.resolve(callback()); | ||
@@ -98,17 +100,23 @@ | ||
return promise; | ||
}, | ||
}; | ||
'with': function _with(viewSlot, previousView, callback) { | ||
SwapStrategies.prototype['with'] = function _with(viewSlot, previousView, callback) { | ||
var promise = Promise.resolve(callback()); | ||
if (previousView !== undefined) { | ||
viewSlot.remove(previousView, true); | ||
return Promise.all(viewSlot.remove(previousView, true), promise); | ||
} | ||
return callback(); | ||
}, | ||
return promise; | ||
}; | ||
after: function after(viewSlot, previousView, callback) { | ||
SwapStrategies.prototype.after = function after(viewSlot, previousView, callback) { | ||
return Promise.resolve(viewSlot.removeAll(true)).then(callback); | ||
} | ||
}; | ||
}; | ||
return SwapStrategies; | ||
})(); | ||
var swapStrategies = new SwapStrategies(); | ||
var RouterView = (function () { | ||
@@ -120,5 +128,3 @@ var _instanceInitializers = {}; | ||
decorators: [_aureliaTemplating.bindable], | ||
initializer: function initializer() { | ||
return swapStrategies[swapStrategies['default']]; | ||
}, | ||
initializer: null, | ||
enumerable: true | ||
@@ -172,4 +178,6 @@ }], null, _instanceInitializers); | ||
var viewSlot = this.viewSlot; | ||
var swapStrategy = this.swapOrder in swapStrategies ? swapStrategies[this.swapOrder] : swapStrategies[swapStrategies['default']]; | ||
var swapStrategy = undefined; | ||
swapStrategy = this.swapOrder in swapStrategies ? swapStrategies[this.swapOrder] : swapStrategies.after; | ||
swapStrategy(viewSlot, previousView, addNextView); | ||
@@ -176,0 +184,0 @@ this.view = viewPortInstruction.controller.view; |
266
doc/api.json
@@ -199,3 +199,3 @@ { | ||
{ | ||
"id": 18, | ||
"id": 34, | ||
"name": "RouterView", | ||
@@ -209,3 +209,3 @@ "kind": 128, | ||
{ | ||
"id": 20, | ||
"id": 36, | ||
"name": "constructor", | ||
@@ -219,3 +219,3 @@ "kind": 512, | ||
{ | ||
"id": 21, | ||
"id": 37, | ||
"name": "new RouterView", | ||
@@ -227,3 +227,3 @@ "kind": 16384, | ||
{ | ||
"id": 22, | ||
"id": 38, | ||
"name": "element", | ||
@@ -239,3 +239,3 @@ "kind": 32768, | ||
{ | ||
"id": 23, | ||
"id": 39, | ||
"name": "container", | ||
@@ -251,3 +251,3 @@ "kind": 32768, | ||
{ | ||
"id": 24, | ||
"id": 40, | ||
"name": "viewSlot", | ||
@@ -263,3 +263,3 @@ "kind": 32768, | ||
{ | ||
"id": 25, | ||
"id": 41, | ||
"name": "router", | ||
@@ -275,3 +275,3 @@ "kind": 32768, | ||
{ | ||
"id": 26, | ||
"id": 42, | ||
"name": "viewLocator", | ||
@@ -290,3 +290,3 @@ "kind": 32768, | ||
"name": "RouterView", | ||
"id": 18, | ||
"id": 34, | ||
"moduleName": "\"aurelia-templating-router\"" | ||
@@ -298,3 +298,3 @@ } | ||
{ | ||
"id": 19, | ||
"id": 35, | ||
"name": "swapOrder", | ||
@@ -312,3 +312,3 @@ "kind": 1024, | ||
{ | ||
"id": 27, | ||
"id": 43, | ||
"name": "bind", | ||
@@ -322,3 +322,3 @@ "kind": 2048, | ||
{ | ||
"id": 28, | ||
"id": 44, | ||
"name": "bind", | ||
@@ -330,3 +330,3 @@ "kind": 4096, | ||
{ | ||
"id": 29, | ||
"id": 45, | ||
"name": "bindingContext", | ||
@@ -350,3 +350,3 @@ "kind": 32768, | ||
{ | ||
"id": 30, | ||
"id": 46, | ||
"name": "process", | ||
@@ -360,3 +360,3 @@ "kind": 2048, | ||
{ | ||
"id": 31, | ||
"id": 47, | ||
"name": "process", | ||
@@ -368,3 +368,3 @@ "kind": 4096, | ||
{ | ||
"id": 32, | ||
"id": 48, | ||
"name": "viewPortInstruction", | ||
@@ -380,3 +380,3 @@ "kind": 32768, | ||
{ | ||
"id": 33, | ||
"id": 49, | ||
"name": "waitToSwap", | ||
@@ -400,3 +400,3 @@ "kind": 32768, | ||
{ | ||
"id": 34, | ||
"id": 50, | ||
"name": "swap", | ||
@@ -410,3 +410,3 @@ "kind": 2048, | ||
{ | ||
"id": 35, | ||
"id": 51, | ||
"name": "swap", | ||
@@ -418,3 +418,3 @@ "kind": 4096, | ||
{ | ||
"id": 36, | ||
"id": 52, | ||
"name": "viewPortInstruction", | ||
@@ -443,3 +443,3 @@ "kind": 32768, | ||
"children": [ | ||
20 | ||
36 | ||
] | ||
@@ -451,3 +451,3 @@ }, | ||
"children": [ | ||
19 | ||
35 | ||
] | ||
@@ -459,5 +459,5 @@ }, | ||
"children": [ | ||
27, | ||
30, | ||
34 | ||
43, | ||
46, | ||
50 | ||
] | ||
@@ -468,3 +468,188 @@ } | ||
{ | ||
"id": 37, | ||
"id": 18, | ||
"name": "SwapStrategies", | ||
"kind": 128, | ||
"kindString": "Class", | ||
"flags": {}, | ||
"children": [ | ||
{ | ||
"id": 29, | ||
"name": "after", | ||
"kind": 2048, | ||
"kindString": "Method", | ||
"flags": {}, | ||
"signatures": [ | ||
{ | ||
"id": 30, | ||
"name": "after", | ||
"kind": 4096, | ||
"kindString": "Call signature", | ||
"flags": {}, | ||
"parameters": [ | ||
{ | ||
"id": 31, | ||
"name": "viewSlot", | ||
"kind": 32768, | ||
"kindString": "Parameter", | ||
"flags": {}, | ||
"type": { | ||
"type": "instrinct", | ||
"name": "any" | ||
} | ||
}, | ||
{ | ||
"id": 32, | ||
"name": "previousView", | ||
"kind": 32768, | ||
"kindString": "Parameter", | ||
"flags": {}, | ||
"type": { | ||
"type": "instrinct", | ||
"name": "any" | ||
} | ||
}, | ||
{ | ||
"id": 33, | ||
"name": "callback", | ||
"kind": 32768, | ||
"kindString": "Parameter", | ||
"flags": {}, | ||
"type": { | ||
"type": "instrinct", | ||
"name": "any" | ||
} | ||
} | ||
], | ||
"type": { | ||
"type": "instrinct", | ||
"name": "any" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"id": 19, | ||
"name": "before", | ||
"kind": 2048, | ||
"kindString": "Method", | ||
"flags": {}, | ||
"signatures": [ | ||
{ | ||
"id": 20, | ||
"name": "before", | ||
"kind": 4096, | ||
"kindString": "Call signature", | ||
"flags": {}, | ||
"parameters": [ | ||
{ | ||
"id": 21, | ||
"name": "viewSlot", | ||
"kind": 32768, | ||
"kindString": "Parameter", | ||
"flags": {}, | ||
"type": { | ||
"type": "instrinct", | ||
"name": "any" | ||
} | ||
}, | ||
{ | ||
"id": 22, | ||
"name": "previousView", | ||
"kind": 32768, | ||
"kindString": "Parameter", | ||
"flags": {}, | ||
"type": { | ||
"type": "instrinct", | ||
"name": "any" | ||
} | ||
}, | ||
{ | ||
"id": 23, | ||
"name": "callback", | ||
"kind": 32768, | ||
"kindString": "Parameter", | ||
"flags": {}, | ||
"type": { | ||
"type": "instrinct", | ||
"name": "any" | ||
} | ||
} | ||
], | ||
"type": { | ||
"type": "instrinct", | ||
"name": "any" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"id": 24, | ||
"name": "with", | ||
"kind": 2048, | ||
"kindString": "Method", | ||
"flags": {}, | ||
"signatures": [ | ||
{ | ||
"id": 25, | ||
"name": "with", | ||
"kind": 4096, | ||
"kindString": "Call signature", | ||
"flags": {}, | ||
"parameters": [ | ||
{ | ||
"id": 26, | ||
"name": "viewSlot", | ||
"kind": 32768, | ||
"kindString": "Parameter", | ||
"flags": {}, | ||
"type": { | ||
"type": "instrinct", | ||
"name": "any" | ||
} | ||
}, | ||
{ | ||
"id": 27, | ||
"name": "previousView", | ||
"kind": 32768, | ||
"kindString": "Parameter", | ||
"flags": {}, | ||
"type": { | ||
"type": "instrinct", | ||
"name": "any" | ||
} | ||
}, | ||
{ | ||
"id": 28, | ||
"name": "callback", | ||
"kind": 32768, | ||
"kindString": "Parameter", | ||
"flags": {}, | ||
"type": { | ||
"type": "instrinct", | ||
"name": "any" | ||
} | ||
} | ||
], | ||
"type": { | ||
"type": "instrinct", | ||
"name": "any" | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"groups": [ | ||
{ | ||
"title": "Methods", | ||
"kind": 2048, | ||
"children": [ | ||
29, | ||
19, | ||
24 | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"id": 53, | ||
"name": "TemplatingRouteLoader", | ||
@@ -478,3 +663,3 @@ "kind": 128, | ||
{ | ||
"id": 38, | ||
"id": 54, | ||
"name": "constructor", | ||
@@ -488,3 +673,3 @@ "kind": 512, | ||
{ | ||
"id": 39, | ||
"id": 55, | ||
"name": "new TemplatingRouteLoader", | ||
@@ -496,3 +681,3 @@ "kind": 16384, | ||
{ | ||
"id": 40, | ||
"id": 56, | ||
"name": "compositionEngine", | ||
@@ -511,3 +696,3 @@ "kind": 32768, | ||
"name": "TemplatingRouteLoader", | ||
"id": 37, | ||
"id": 53, | ||
"moduleName": "\"aurelia-templating-router\"" | ||
@@ -519,3 +704,3 @@ } | ||
{ | ||
"id": 41, | ||
"id": 57, | ||
"name": "loadRoute", | ||
@@ -529,3 +714,3 @@ "kind": 2048, | ||
{ | ||
"id": 42, | ||
"id": 58, | ||
"name": "loadRoute", | ||
@@ -537,3 +722,3 @@ "kind": 4096, | ||
{ | ||
"id": 43, | ||
"id": 59, | ||
"name": "router", | ||
@@ -549,3 +734,3 @@ "kind": 32768, | ||
{ | ||
"id": 44, | ||
"id": 60, | ||
"name": "config", | ||
@@ -568,3 +753,3 @@ "kind": 32768, | ||
"name": "RouteLoader.loadRoute", | ||
"id": 1276 | ||
"id": 1301 | ||
} | ||
@@ -576,3 +761,3 @@ } | ||
"name": "RouteLoader.loadRoute", | ||
"id": 1276 | ||
"id": 1301 | ||
} | ||
@@ -586,3 +771,3 @@ } | ||
"children": [ | ||
38 | ||
54 | ||
] | ||
@@ -594,3 +779,3 @@ }, | ||
"children": [ | ||
41 | ||
57 | ||
] | ||
@@ -603,3 +788,3 @@ } | ||
"name": "RouteLoader", | ||
"id": 1275 | ||
"id": 1300 | ||
} | ||
@@ -615,4 +800,5 @@ ] | ||
3, | ||
34, | ||
18, | ||
37 | ||
53 | ||
] | ||
@@ -619,0 +805,0 @@ } |
@@ -0,1 +1,11 @@ | ||
### 1.0.0-beta.1.0.3 (2015-12-16) | ||
#### Bug Fixes | ||
* **add-nextview-first:** Add the next first on with ([d188112c](http://github.com/aurelia/templating-router/commit/d188112c67bbfd290c046ad11ce95338386024ea)) | ||
* **default-swap-order:** Set default swap order to after resolves aurelia/framework#263 ([984aeb12](http://github.com/aurelia/templating-router/commit/984aeb1260670a9202dcda0b933608a61b1daade)) | ||
* **spelling:** Miss-Spelled SwapStrategies ([9b9fb9ea](http://github.com/aurelia/templating-router/commit/9b9fb9ea1990376d7d0642a39df23eae8700de84)) | ||
## 1.0.0-beta.1.0.2 (2015-12-03) | ||
@@ -2,0 +12,0 @@ |
{ | ||
"name": "aurelia-templating-router", | ||
"version": "1.0.0-beta.1.0.2", | ||
"version": "1.0.0-beta.1.0.3", | ||
"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": [ |
@@ -7,4 +7,3 @@ import {Container, inject} from 'aurelia-dependency-injection'; | ||
const swapStrategies = { | ||
default: 'before', | ||
class SwapStrategies { | ||
// animate the next view in before removing the current view; | ||
@@ -19,11 +18,15 @@ before(viewSlot, previousView, callback) { | ||
return promise; | ||
}, | ||
} | ||
// animate the next view at the same time the current view is removed | ||
with(viewSlot, previousView, callback) { | ||
let promise = Promise.resolve(callback()); | ||
if (previousView !== undefined) { | ||
viewSlot.remove(previousView, true); | ||
return Promise.all(viewSlot.remove(previousView, true), promise); | ||
} | ||
return callback(); | ||
}, | ||
return promise; | ||
} | ||
// animate the next view in after the current view has been removed | ||
@@ -33,4 +36,6 @@ after(viewSlot, previousView, callback) { | ||
} | ||
}; | ||
} | ||
const swapStrategies = new SwapStrategies(); | ||
@customElement('router-view') | ||
@@ -40,3 +45,3 @@ @noView | ||
export class RouterView { | ||
@bindable swapOrder = swapStrategies[swapStrategies.default]; | ||
@bindable swapOrder; | ||
@@ -88,6 +93,8 @@ constructor(element, container, viewSlot, router, viewLocator) { | ||
let viewSlot = this.viewSlot; | ||
let swapStrategy = this.swapOrder in swapStrategies | ||
? swapStrategies[this.swapOrder] | ||
: swapStrategies[swapStrategies.default]; | ||
let swapStrategy; | ||
swapStrategy = this.swapOrder in swapStrategies | ||
? swapStrategies[this.swapOrder] | ||
: swapStrategies.after; | ||
swapStrategy(viewSlot, previousView, addNextView); | ||
@@ -94,0 +101,0 @@ this.view = viewPortInstruction.controller.view; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
216914
3103