Skip to content

Commit

Permalink
chore(*): prepare release 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Dec 22, 2014
1 parent 9102ed0 commit 1898e1e
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 23 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": "0.4.1",
"version": "0.5.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
2 changes: 1 addition & 1 deletion dist/amd/route-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ define(["exports", "aurelia-templating", "aurelia-router"], function (exports, _
};

TemplatingRouteLoader.prototype.loadRoute = function (config) {
return this.resourceCoordinator.loadAnonymousElement(config.moduleId, null, config.view);
return this.resourceCoordinator.loadViewModelType(config.moduleId);
};

return TemplatingRouteLoader;
Expand Down
36 changes: 30 additions & 6 deletions dist/amd/router-view.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
define(["exports", "aurelia-dependency-injection", "aurelia-templating", "aurelia-router"], function (exports, _aureliaDependencyInjection, _aureliaTemplating, _aureliaRouter) {
define(["exports", "aurelia-dependency-injection", "aurelia-templating", "aurelia-router", "aurelia-metadata", "aurelia-path"], function (exports, _aureliaDependencyInjection, _aureliaTemplating, _aureliaRouter, _aureliaMetadata, _aureliaPath) {
"use strict";

var Container = _aureliaDependencyInjection.Container;
var CustomElement = _aureliaTemplating.CustomElement;
var ViewSlot = _aureliaTemplating.ViewSlot;
var ViewStrategy = _aureliaTemplating.ViewStrategy;
var UseView = _aureliaTemplating.UseView;
var NoView = _aureliaTemplating.NoView;
var Router = _aureliaRouter.Router;
var Origin = _aureliaMetadata.Origin;
var relativeToFile = _aureliaPath.relativeToFile;


var defaultInstruction = { suppressBind: true };
function makeViewRelative(executionContext, viewPath) {
var origin = Origin.get(executionContext.constructor);
return relativeToFile(viewPath, origin.moduleId);
}

var RouterView = (function () {
var RouterView = function RouterView(element, container, viewSlot) {
Expand Down Expand Up @@ -39,17 +46,34 @@ define(["exports", "aurelia-dependency-injection", "aurelia-templating", "aureli
}

if ("router" in executionContext) {
this.executionContext = executionContext;
executionContext.router.registerViewPort(this, this.element.getAttribute("name"));
}
};

RouterView.prototype.getComponent = function (type, createChildRouter) {
var childContainer = this.container.createChild();
RouterView.prototype.getComponent = function (viewModelType, createChildRouter, config) {
var childContainer = this.container.createChild(), viewStrategy = config.view || config.viewStrategy, viewModel;

childContainer.registerHandler(Router, createChildRouter);
childContainer.autoRegister(type.target);
childContainer.autoRegister(viewModelType);

return type.create(childContainer, defaultInstruction);
viewModel = childContainer.get(viewModelType);

if ("getViewStrategy" in viewModel && !viewStrategy) {
viewStrategy = viewModel.getViewStrategy();
}

if (typeof viewStrategy === "string") {
viewStrategy = new UseView(makeViewRelative(this.executionContext, viewStrategy));
}

if (viewStrategy && !(viewStrategy instanceof ViewStrategy)) {
throw new Error("The view must be a string or an instance of ViewStrategy.");
}

CustomElement.anonymous(this.container, viewModel, viewStrategy).then(function (behaviorType) {
return behaviorType.create(childContainer, { executionContext: viewModel, suppressBind: true });
});
};

RouterView.prototype.process = function (viewPortInstruction) {
Expand Down
2 changes: 1 addition & 1 deletion dist/commonjs/route-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var TemplatingRouteLoader = (function (RouteLoader) {
};

TemplatingRouteLoader.prototype.loadRoute = function (config) {
return this.resourceCoordinator.loadAnonymousElement(config.moduleId, null, config.view);
return this.resourceCoordinator.loadViewModelType(config.moduleId);
};

return TemplatingRouteLoader;
Expand Down
34 changes: 29 additions & 5 deletions dist/commonjs/router-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@
var Container = require('aurelia-dependency-injection').Container;
var CustomElement = require('aurelia-templating').CustomElement;
var ViewSlot = require('aurelia-templating').ViewSlot;
var ViewStrategy = require('aurelia-templating').ViewStrategy;
var UseView = require('aurelia-templating').UseView;
var NoView = require('aurelia-templating').NoView;
var Router = require('aurelia-router').Router;
var Origin = require('aurelia-metadata').Origin;
var relativeToFile = require('aurelia-path').relativeToFile;


var defaultInstruction = { suppressBind: true };
function makeViewRelative(executionContext, viewPath) {
var origin = Origin.get(executionContext.constructor);
return relativeToFile(viewPath, origin.moduleId);
}

var RouterView = (function () {
var RouterView = function RouterView(element, container, viewSlot) {
Expand Down Expand Up @@ -38,17 +45,34 @@ var RouterView = (function () {
}

if ("router" in executionContext) {
this.executionContext = executionContext;
executionContext.router.registerViewPort(this, this.element.getAttribute("name"));
}
};

RouterView.prototype.getComponent = function (type, createChildRouter) {
var childContainer = this.container.createChild();
RouterView.prototype.getComponent = function (viewModelType, createChildRouter, config) {
var childContainer = this.container.createChild(), viewStrategy = config.view || config.viewStrategy, viewModel;

childContainer.registerHandler(Router, createChildRouter);
childContainer.autoRegister(type.target);
childContainer.autoRegister(viewModelType);

return type.create(childContainer, defaultInstruction);
viewModel = childContainer.get(viewModelType);

if ("getViewStrategy" in viewModel && !viewStrategy) {
viewStrategy = viewModel.getViewStrategy();
}

if (typeof viewStrategy === "string") {
viewStrategy = new UseView(makeViewRelative(this.executionContext, viewStrategy));
}

if (viewStrategy && !(viewStrategy instanceof ViewStrategy)) {
throw new Error("The view must be a string or an instance of ViewStrategy.");
}

CustomElement.anonymous(this.container, viewModel, viewStrategy).then(function (behaviorType) {
return behaviorType.create(childContainer, { executionContext: viewModel, suppressBind: true });
});
};

RouterView.prototype.process = function (viewPortInstruction) {
Expand Down
2 changes: 1 addition & 1 deletion dist/es6/route-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export class TemplatingRouteLoader extends RouteLoader {
}

loadRoute(config){
return this.resourceCoordinator.loadAnonymousElement(config.moduleId, null, config.view);
return this.resourceCoordinator.loadViewModelType(config.moduleId);
}
}
38 changes: 31 additions & 7 deletions dist/es6/router-view.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import {Container} from 'aurelia-dependency-injection';
import {CustomElement, ViewSlot, NoView} from 'aurelia-templating';
import {CustomElement, ViewSlot, ViewStrategy, UseView, NoView} from 'aurelia-templating';
import {Router} from 'aurelia-router';
import {Origin} from 'aurelia-metadata';
import {relativeToFile} from 'aurelia-path';

var defaultInstruction = {suppressBind:true};
function makeViewRelative(executionContext, viewPath){
var origin = Origin.get(executionContext.constructor);
return relativeToFile(viewPath, origin.moduleId);
}

export class RouterView {
static annotations(){
Expand Down Expand Up @@ -33,17 +38,36 @@ export class RouterView {
}

if ('router' in executionContext) {
this.executionContext = executionContext;
executionContext.router.registerViewPort(this, this.element.getAttribute('name'));
}
}

getComponent(type, createChildRouter){
var childContainer = this.container.createChild();

getComponent(viewModelType, createChildRouter, config){
var childContainer = this.container.createChild(),
viewStrategy = config.view || config.viewStrategy,
viewModel;

childContainer.registerHandler(Router, createChildRouter);
childContainer.autoRegister(type.target);
childContainer.autoRegister(viewModelType);

viewModel = childContainer.get(viewModelType);

if('getViewStrategy' in viewModel && !viewStrategy){
viewStrategy = viewModel.getViewStrategy();
}

if(typeof viewStrategy === 'string'){
viewStrategy = new UseView(makeViewRelative(this.executionContext, viewStrategy));
}

if(viewStrategy && !(viewStrategy instanceof ViewStrategy)){
throw new Error('The view must be a string or an instance of ViewStrategy.');
}

return type.create(childContainer, defaultInstruction);
CustomElement.anonymous(this.container, viewModel, viewStrategy).then(behaviorType => {
return behaviorType.create(childContainer, {executionContext:viewModel, suppressBind:true});
});
}

process(viewPortInstruction) {
Expand Down
14 changes: 14 additions & 0 deletions doc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## 0.5.0 (2014-12-22)


#### Bug Fixes

* **package:** update dependencies to latest versions ([9102ed05](http://github.com/aurelia/templating-router/commit/9102ed05892dc23859bc8f6129b27e87d8c30d39))
* **router-view:** ensure that execution context is always set ([609b8ec1](http://github.com/aurelia/templating-router/commit/609b8ec170054417e58944a6dd3341c38e9fb947))


#### Features

* **router-view:** enable getViewStrategy on view models ([5aea8b3e](http://github.com/aurelia/templating-router/commit/5aea8b3eb0ede9c08fe728299a95689c503b32e3))


### 0.4.1 (2014-12-18)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-templating-router",
"version": "0.4.1",
"version": "0.5.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

0 comments on commit 1898e1e

Please sign in to comment.