Skip to content

Commit

Permalink
chore(all): prepare release 0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Jan 12, 2015
1 parent 21897ec commit b0948de
Show file tree
Hide file tree
Showing 9 changed files with 374 additions and 214 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.7.0",
"version": "0.8.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
80 changes: 49 additions & 31 deletions dist/amd/route-loader.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,76 @@
define(["exports", "aurelia-templating", "aurelia-router", "aurelia-path", "aurelia-metadata"], function (exports, _aureliaTemplating, _aureliaRouter, _aureliaPath, _aureliaMetadata) {
"use strict";

var _inherits = function (child, parent) {
if (typeof parent !== "function" && parent !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof parent);
var _prototypeProperties = function (child, staticProps, instanceProps) {
if (staticProps) Object.defineProperties(child, staticProps);
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};

var _inherits = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
child.prototype = Object.create(parent && parent.prototype, {
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: child,
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (parent) child.__proto__ = parent;
if (superClass) subClass.__proto__ = superClass;
};

var CompositionEngine = _aureliaTemplating.CompositionEngine;
var RouteLoader = _aureliaRouter.RouteLoader;
var Router = _aureliaRouter.Router;
var relativeToFile = _aureliaPath.relativeToFile;
var Origin = _aureliaMetadata.Origin;
var TemplatingRouteLoader = (function () {
var _RouteLoader = RouteLoader;
var TemplatingRouteLoader = function TemplatingRouteLoader(compositionEngine) {
var TemplatingRouteLoader = (function (RouteLoader) {
function TemplatingRouteLoader(compositionEngine) {
this.compositionEngine = compositionEngine;
};

_inherits(TemplatingRouteLoader, _RouteLoader);
}

TemplatingRouteLoader.inject = function () {
return [CompositionEngine];
};
_inherits(TemplatingRouteLoader, RouteLoader);

TemplatingRouteLoader.prototype.loadRoute = function (router, config) {
var childContainer = router.container.createChild(), instruction = {
viewModel: relativeToFile(config.moduleId, Origin.get(router.container.viewModel.constructor).moduleId),
childContainer: childContainer,
view: config.view
}, childRouter;
_prototypeProperties(TemplatingRouteLoader, {
inject: {
value: function () {
return [CompositionEngine];
},
writable: true,
enumerable: true,
configurable: true
}
}, {
loadRoute: {
value: function (router, config) {
var childContainer = router.container.createChild(),
instruction = {
viewModel: relativeToFile(config.moduleId, Origin.get(router.container.viewModel.constructor).moduleId),
childContainer: childContainer,
view: config.view
},
childRouter;

childContainer.registerHandler(Router, function (c) {
return childRouter || (childRouter = router.createChild(childContainer));
});
childContainer.registerHandler(Router, function (c) {
return childRouter || (childRouter = router.createChild(childContainer));
});

return this.compositionEngine.createViewModel(instruction).then(function (instruction) {
instruction.executionContext = instruction.viewModel;
instruction.router = router;
return instruction;
});
};
return this.compositionEngine.createViewModel(instruction).then(function (instruction) {
instruction.executionContext = instruction.viewModel;
instruction.router = router;
return instruction;
});
},
writable: true,
enumerable: true,
configurable: true
}
});

return TemplatingRouteLoader;
})();
})(RouteLoader);

exports.TemplatingRouteLoader = TemplatingRouteLoader;
});
111 changes: 72 additions & 39 deletions dist/amd/router-view.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
define(["exports", "aurelia-dependency-injection", "aurelia-templating", "aurelia-router", "aurelia-metadata"], function (exports, _aureliaDependencyInjection, _aureliaTemplating, _aureliaRouter, _aureliaMetadata) {
"use strict";

var _prototypeProperties = function (child, staticProps, instanceProps) {
if (staticProps) Object.defineProperties(child, staticProps);
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};

var Container = _aureliaDependencyInjection.Container;
var CustomElement = _aureliaTemplating.CustomElement;
var ViewSlot = _aureliaTemplating.ViewSlot;
Expand All @@ -9,55 +14,83 @@ define(["exports", "aurelia-dependency-injection", "aurelia-templating", "aureli
var NoView = _aureliaTemplating.NoView;
var Router = _aureliaRouter.Router;
var Origin = _aureliaMetadata.Origin;
var RouterView = function RouterView(element, container, viewSlot, router) {
this.element = element;
this.container = container;
this.viewSlot = viewSlot;
this.router = router;
router.registerViewPort(this, element.getAttribute("name"));
};
var RouterView = (function () {
function RouterView(element, container, viewSlot, router) {
this.element = element;
this.container = container;
this.viewSlot = viewSlot;
this.router = router;
router.registerViewPort(this, element.getAttribute("name"));
}

RouterView.annotations = function () {
return [new CustomElement("router-view"), new NoView()];
};
_prototypeProperties(RouterView, {
annotations: {
value: function () {
return [new CustomElement("router-view"), new NoView()];
},
writable: true,
enumerable: true,
configurable: true
},
inject: {
value: function () {
return [Element, Container, ViewSlot, Router];
},
writable: true,
enumerable: true,
configurable: true
}
}, {
process: {
value: function (viewPortInstruction, waitToSwap) {
var _this = this;
var component = viewPortInstruction.component,
viewStrategy = component.view,
viewModelInfo = component.viewModelInfo,
childContainer = component.childContainer,
viewModel = component.executionContext;

RouterView.inject = function () {
return [Element, Container, ViewSlot, Router];
};
if (!viewStrategy && "getViewStrategy" in viewModel) {
viewStrategy = viewModel.getViewStrategy();
}

RouterView.prototype.process = function (viewPortInstruction, waitToSwap) {
var _this = this;
var component = viewPortInstruction.component, viewStrategy = component.view, viewModelInfo = component.viewModelInfo, childContainer = component.childContainer, viewModel = component.executionContext;
if (viewStrategy) {
viewStrategy = ViewStrategy.normalize(viewStrategy);
viewStrategy.makeRelativeTo(Origin.get(component.router.container.viewModel.constructor).moduleId);
}

if (!viewStrategy && "getViewStrategy" in viewModel) {
viewStrategy = viewModel.getViewStrategy();
}
return viewModelInfo.type.load(childContainer, viewModelInfo.value, viewStrategy).then(function (behaviorType) {
viewPortInstruction.behavior = behaviorType.create(childContainer, { executionContext: viewModel });

if (viewStrategy) {
viewStrategy = ViewStrategy.normalize(viewStrategy);
viewStrategy.makeRelativeTo(Origin.get(component.router.container.viewModel.constructor).moduleId);
}
if (waitToSwap) {
return;
}

return viewModelInfo.type.load(childContainer, viewModelInfo.value, viewStrategy).then(function (behaviorType) {
viewPortInstruction.behavior = behaviorType.create(childContainer, { executionContext: viewModel });
_this.swap(viewPortInstruction);
});
},
writable: true,
enumerable: true,
configurable: true
},
swap: {
value: function (viewPortInstruction) {
this.viewSlot.swap(viewPortInstruction.behavior.view);

if (waitToSwap) {
return;
}
if (this.view) {
this.view.unbind();
}

_this.swap(viewPortInstruction);
this.view = viewPortInstruction.behavior.view;
},
writable: true,
enumerable: true,
configurable: true
}
});
};

RouterView.prototype.swap = function (viewPortInstruction) {
this.viewSlot.swap(viewPortInstruction.behavior.view);

if (this.view) {
this.view.unbind();
}

this.view = viewPortInstruction.behavior.view;
};
return RouterView;
})();

exports.RouterView = RouterView;
});
80 changes: 49 additions & 31 deletions dist/commonjs/route-loader.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,74 @@
"use strict";

var _inherits = function (child, parent) {
if (typeof parent !== "function" && parent !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof parent);
var _prototypeProperties = function (child, staticProps, instanceProps) {
if (staticProps) Object.defineProperties(child, staticProps);
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};

var _inherits = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
child.prototype = Object.create(parent && parent.prototype, {
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: child,
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (parent) child.__proto__ = parent;
if (superClass) subClass.__proto__ = superClass;
};

var CompositionEngine = require("aurelia-templating").CompositionEngine;
var RouteLoader = require("aurelia-router").RouteLoader;
var Router = require("aurelia-router").Router;
var relativeToFile = require("aurelia-path").relativeToFile;
var Origin = require("aurelia-metadata").Origin;
var TemplatingRouteLoader = (function () {
var _RouteLoader = RouteLoader;
var TemplatingRouteLoader = function TemplatingRouteLoader(compositionEngine) {
var TemplatingRouteLoader = (function (RouteLoader) {
function TemplatingRouteLoader(compositionEngine) {
this.compositionEngine = compositionEngine;
};

_inherits(TemplatingRouteLoader, _RouteLoader);
}

TemplatingRouteLoader.inject = function () {
return [CompositionEngine];
};
_inherits(TemplatingRouteLoader, RouteLoader);

TemplatingRouteLoader.prototype.loadRoute = function (router, config) {
var childContainer = router.container.createChild(), instruction = {
viewModel: relativeToFile(config.moduleId, Origin.get(router.container.viewModel.constructor).moduleId),
childContainer: childContainer,
view: config.view
}, childRouter;
_prototypeProperties(TemplatingRouteLoader, {
inject: {
value: function () {
return [CompositionEngine];
},
writable: true,
enumerable: true,
configurable: true
}
}, {
loadRoute: {
value: function (router, config) {
var childContainer = router.container.createChild(),
instruction = {
viewModel: relativeToFile(config.moduleId, Origin.get(router.container.viewModel.constructor).moduleId),
childContainer: childContainer,
view: config.view
},
childRouter;

childContainer.registerHandler(Router, function (c) {
return childRouter || (childRouter = router.createChild(childContainer));
});
childContainer.registerHandler(Router, function (c) {
return childRouter || (childRouter = router.createChild(childContainer));
});

return this.compositionEngine.createViewModel(instruction).then(function (instruction) {
instruction.executionContext = instruction.viewModel;
instruction.router = router;
return instruction;
});
};
return this.compositionEngine.createViewModel(instruction).then(function (instruction) {
instruction.executionContext = instruction.viewModel;
instruction.router = router;
return instruction;
});
},
writable: true,
enumerable: true,
configurable: true
}
});

return TemplatingRouteLoader;
})();
})(RouteLoader);

exports.TemplatingRouteLoader = TemplatingRouteLoader;
Loading

0 comments on commit b0948de

Please sign in to comment.