Skip to content

Commit

Permalink
chore(all): prepare release 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Feb 26, 2017
1 parent fad8b18 commit 498234e
Show file tree
Hide file tree
Showing 23 changed files with 470 additions and 357 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.1",
"version": "1.1.0",
"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
4 changes: 2 additions & 2 deletions dist/amd/aurelia-templating-router.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(['exports', 'aurelia-router', './route-loader', './router-view', './route-href'], function (exports, _aureliaRouter, _routeLoader, _routerView, _routeHref) {
define(['exports', 'aurelia-pal', 'aurelia-router', './route-loader', './router-view', './route-href'], function (exports, _aureliaPal, _aureliaRouter, _routeLoader, _routerView, _routeHref) {
'use strict';

Object.defineProperty(exports, "__esModule", {
Expand All @@ -8,7 +8,7 @@ define(['exports', 'aurelia-router', './route-loader', './router-view', './route


function configure(config) {
config.singleton(_aureliaRouter.RouteLoader, _routeLoader.TemplatingRouteLoader).singleton(_aureliaRouter.Router, _aureliaRouter.AppRouter).globalResources('./router-view', './route-href');
config.singleton(_aureliaRouter.RouteLoader, _routeLoader.TemplatingRouteLoader).singleton(_aureliaRouter.Router, _aureliaRouter.AppRouter).globalResources(_aureliaPal.PLATFORM.moduleName('./router-view'), _aureliaPal.PLATFORM.moduleName('./route-href'));

config.container.registerAlias(_aureliaRouter.Router, _aureliaRouter.AppRouter);
}
Expand Down
31 changes: 29 additions & 2 deletions dist/amd/route-loader.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-path', 'aurelia-metadata'], function (exports, _aureliaDependencyInjection, _aureliaTemplating, _aureliaRouter, _aureliaPath, _aureliaMetadata) {
define(['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aurelia-router', 'aurelia-path', 'aurelia-metadata', './router-view'], function (exports, _aureliaDependencyInjection, _aureliaTemplating, _aureliaRouter, _aureliaPath, _aureliaMetadata, _routerView) {
'use strict';

Object.defineProperty(exports, "__esModule", {
Expand Down Expand Up @@ -48,13 +48,18 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aureli

TemplatingRouteLoader.prototype.loadRoute = function loadRoute(router, config) {
var childContainer = router.container.createChild();

var viewModel = /\.html/.test(config.moduleId) ? createDynamicClass(config.moduleId) : (0, _aureliaPath.relativeToFile)(config.moduleId, _aureliaMetadata.Origin.get(router.container.viewModel.constructor).moduleId);

var instruction = {
viewModel: (0, _aureliaPath.relativeToFile)(config.moduleId, _aureliaMetadata.Origin.get(router.container.viewModel.constructor).moduleId),
viewModel: viewModel,
childContainer: childContainer,
view: config.view || config.viewStrategy,
router: router
};

childContainer.registerSingleton(_routerView.RouterViewLocator);

childContainer.getChildRouter = function () {
var childRouter = void 0;

Expand All @@ -70,4 +75,26 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aureli

return TemplatingRouteLoader;
}(_aureliaRouter.RouteLoader)) || _class);


function createDynamicClass(moduleId) {
var _dec2, _dec3, _class2;

var name = /([^\/^\?]+)\.html/i.exec(moduleId)[1];

var DynamicClass = (_dec2 = (0, _aureliaTemplating.customElement)(name), _dec3 = (0, _aureliaTemplating.useView)(moduleId), _dec2(_class2 = _dec3(_class2 = function () {
function DynamicClass() {

}

DynamicClass.prototype.bind = function bind(bindingContext) {
this.$parent = bindingContext;
};

return DynamicClass;
}()) || _class2) || _class2);


return DynamicClass;
}
});
80 changes: 32 additions & 48 deletions dist/amd/router-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.RouterView = undefined;
exports.RouterViewLocator = exports.RouterView = undefined;

function _initDefineProp(target, property, descriptor, context) {
if (!descriptor) return;
Expand All @@ -16,6 +16,8 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
});
}



function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
var desc = {};
Object['ke' + 'ys'](descriptor).forEach(function (key) {
Expand Down Expand Up @@ -51,44 +53,6 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t

var _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4;



var SwapStrategies = function () {
function SwapStrategies() {

}

SwapStrategies.prototype.before = function before(viewSlot, previousView, callback) {
var promise = Promise.resolve(callback());

if (previousView !== undefined) {
return promise.then(function () {
return viewSlot.remove(previousView, true);
});
}

return promise;
};

SwapStrategies.prototype.with = function _with(viewSlot, previousView, callback) {
var promise = Promise.resolve(callback());

if (previousView !== undefined) {
return Promise.all([viewSlot.remove(previousView, true), promise]);
}

return promise;
};

SwapStrategies.prototype.after = function after(viewSlot, previousView, callback) {
return Promise.resolve(viewSlot.removeAll(true)).then(callback);
};

return SwapStrategies;
}();

var swapStrategies = new SwapStrategies();

var RouterView = exports.RouterView = (_dec = (0, _aureliaTemplating.customElement)('router-view'), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaPal.DOM.Element, _aureliaDependencyInjection.Container, _aureliaTemplating.ViewSlot, _aureliaRouter.Router, _aureliaTemplating.ViewLocator, _aureliaTemplating.CompositionTransaction, _aureliaTemplating.CompositionEngine), _dec(_class = (0, _aureliaTemplating.noView)(_class = _dec2(_class = (_class2 = function () {
function RouterView(element, container, viewSlot, router, viewLocator, compositionTransaction, compositionEngine) {

Expand Down Expand Up @@ -136,6 +100,8 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
var config = component.router.currentInstruction.config;
var viewPort = config.viewPorts ? config.viewPorts[viewPortInstruction.name] : {};

childContainer.get(RouterViewLocator)._notify(this);

var layoutInstruction = {
viewModel: viewPort.layoutViewModel || config.layoutViewModel || this.layoutViewModel,
view: viewPort.layoutView || config.layoutView || this.layoutView,
Expand Down Expand Up @@ -173,20 +139,16 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
var _this2 = this;

var layoutInstruction = viewPortInstruction.layoutInstruction;
var previousView = this.view;

var work = function work() {
var previousView = _this2.view;
var swapStrategy = void 0;
var swapStrategy = _aureliaTemplating.SwapStrategies[_this2.swapOrder] || _aureliaTemplating.SwapStrategies.after;
var viewSlot = _this2.viewSlot;

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

swapStrategy(viewSlot, previousView, function () {
return Promise.resolve().then(function () {
return viewSlot.add(_this2.view);
}).then(function () {
_this2._notify();
});
return Promise.resolve(viewSlot.add(_this2.view));
}).then(function () {
_this2._notify();
});
};

Expand Down Expand Up @@ -244,4 +206,26 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
enumerable: true,
initializer: null
})), _class2)) || _class) || _class) || _class);

var RouterViewLocator = exports.RouterViewLocator = function () {
function RouterViewLocator() {
var _this3 = this;



this.promise = new Promise(function (resolve) {
return _this3.resolve = resolve;
});
}

RouterViewLocator.prototype.findNearest = function findNearest() {
return this.promise;
};

RouterViewLocator.prototype._notify = function _notify(routerView) {
this.resolve(routerView);
};

return RouterViewLocator;
}();
});
22 changes: 21 additions & 1 deletion dist/aurelia-templating-router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import {
BehaviorInstruction,
CompositionTransaction,
CompositionEngine,
ShadowDOM
ShadowDOM,
SwapStrategies,
useView
} from 'aurelia-templating';
import {
inject,
Expand Down Expand Up @@ -43,12 +45,30 @@ export declare class RouterView {
layoutView: any;
layoutViewModel: any;
layoutModel: any;
element: any;
constructor(element?: any, container?: any, viewSlot?: any, router?: any, viewLocator?: any, compositionTransaction?: any, compositionEngine?: any);
created(owningView?: any): any;
bind(bindingContext?: any, overrideContext?: any): any;
process(viewPortInstruction?: any, waitToSwap?: any): any;
swap(viewPortInstruction?: any): any;
}

/**
* Locator which finds the nearest RouterView, relative to the current dependency injection container.
*/
export declare class RouterViewLocator {

/**
* Creates an instance of the RouterViewLocator class.
*/
constructor();

/**
* Finds the nearest RouterView instance.
* @returns A promise that will be resolved with the located RouterView instance.
*/
findNearest(): Promise<RouterView>;
}
export declare class TemplatingRouteLoader extends RouteLoader {
constructor(compositionEngine?: any);
loadRoute(router?: any, config?: any): any;
Expand Down
Loading

0 comments on commit 498234e

Please sign in to comment.