From 01ad30f540b3f14c6dccd0d4c63dc83ab52f1ac9 Mon Sep 17 00:00:00 2001 From: EisenbergEffect Date: Mon, 15 Jan 2018 03:02:17 -0800 Subject: [PATCH] chore(all): prepare release 1.3.0 --- dist/amd/route-href.js | 2 +- dist/amd/route-loader.js | 30 ++++++++++++++++------- dist/amd/router-view.js | 2 +- dist/aurelia-templating-router.d.ts | 5 ++-- dist/aurelia-templating-router.js | 22 ++++++++++++----- dist/commonjs/route-href.js | 2 +- dist/commonjs/route-loader.js | 30 ++++++++++++++++------- dist/commonjs/router-view.js | 2 +- dist/es2015/route-href.js | 2 +- dist/es2015/route-loader.js | 27 ++++++++++++++------- dist/es2015/router-view.js | 2 +- dist/native-modules/route-href.js | 2 +- dist/native-modules/route-loader.js | 33 ++++++++++++++++++-------- dist/native-modules/router-view.js | 2 +- dist/system/route-href.js | 2 +- dist/system/route-loader.js | 32 ++++++++++++++++++------- dist/system/router-view.js | 2 +- dist/temp/aurelia-templating-router.js | 30 ++++++++++++++++------- doc/CHANGELOG.md | 10 ++++++++ 19 files changed, 167 insertions(+), 72 deletions(-) diff --git a/dist/amd/route-href.js b/dist/amd/route-href.js index 9f4458d..1a9d0b7 100644 --- a/dist/amd/route-href.js +++ b/dist/amd/route-href.js @@ -39,7 +39,7 @@ define(['exports', 'aurelia-templating', 'aurelia-dependency-injection', 'aureli this.element = element; } - RouteHref.prototype.attached = function attached() { + RouteHref.prototype.bind = function bind() { this.isActive = true; this.processChange(); }; diff --git a/dist/amd/route-loader.js b/dist/amd/route-loader.js index cb98d20..dbd8afa 100644 --- a/dist/amd/route-loader.js +++ b/dist/amd/route-loader.js @@ -6,8 +6,6 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aureli }); exports.TemplatingRouteLoader = undefined; - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); @@ -32,9 +30,14 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aureli if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - var _dec, _class; + + + var _dec, _class, _dec2, _class2; - var TemplatingRouteLoader = exports.TemplatingRouteLoader = (_dec = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.CompositionEngine), _dec(_class = function (_RouteLoader) { + var EmptyClass = (_dec = (0, _aureliaTemplating.inlineView)(''), _dec(_class = function EmptyClass() { + + }) || _class); + var TemplatingRouteLoader = exports.TemplatingRouteLoader = (_dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.CompositionEngine), _dec2(_class2 = function (_RouteLoader) { _inherits(TemplatingRouteLoader, _RouteLoader); function TemplatingRouteLoader(compositionEngine) { @@ -49,7 +52,16 @@ 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 viewModel = void 0; + if (config.moduleId === null) { + viewModel = EmptyClass; + } else if (/\.html/i.test(config.moduleId)) { + viewModel = createDynamicClass(config.moduleId); + } else { + viewModel = (0, _aureliaPath.relativeToFile)(config.moduleId, _aureliaMetadata.Origin.get(router.container.viewModel.constructor).moduleId); + } + + config = config || {}; var instruction = { viewModel: viewModel, @@ -74,15 +86,15 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aureli }; return TemplatingRouteLoader; - }(_aureliaRouter.RouteLoader)) || _class); + }(_aureliaRouter.RouteLoader)) || _class2); function createDynamicClass(moduleId) { - var _dec2, _dec3, _class2; + var _dec3, _dec4, _class3; var name = /([^\/^\?]+)\.html/i.exec(moduleId)[1]; - var DynamicClass = (_dec2 = (0, _aureliaTemplating.customElement)(name), _dec3 = (0, _aureliaTemplating.useView)(moduleId), _dec2(_class2 = _dec3(_class2 = function () { + var DynamicClass = (_dec3 = (0, _aureliaTemplating.customElement)(name), _dec4 = (0, _aureliaTemplating.useView)(moduleId), _dec3(_class3 = _dec4(_class3 = function () { function DynamicClass() { } @@ -92,7 +104,7 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aureli }; return DynamicClass; - }()) || _class2) || _class2); + }()) || _class3) || _class3); return DynamicClass; diff --git a/dist/amd/router-view.js b/dist/amd/router-view.js index de842e9..34177df 100644 --- a/dist/amd/router-view.js +++ b/dist/amd/router-view.js @@ -98,7 +98,7 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t var viewModelResource = component.viewModelResource; var metadata = viewModelResource.metadata; var config = component.router.currentInstruction.config; - var viewPort = config.viewPorts ? config.viewPorts[viewPortInstruction.name] : {}; + var viewPort = config.viewPorts ? config.viewPorts[viewPortInstruction.name] || {} : {}; childContainer.get(RouterViewLocator)._notify(this); diff --git a/dist/aurelia-templating-router.d.ts b/dist/aurelia-templating-router.d.ts index 93d3441..367c2f1 100644 --- a/dist/aurelia-templating-router.d.ts +++ b/dist/aurelia-templating-router.d.ts @@ -11,7 +11,8 @@ import { CompositionEngine, ShadowDOM, SwapStrategies, - useView + useView, + inlineView } from 'aurelia-templating'; import { inject, @@ -35,7 +36,7 @@ import { } from 'aurelia-path'; export declare class RouteHref { constructor(router?: any, element?: any); - attached(): any; + bind(): any; unbind(): any; attributeChanged(value?: any, previous?: any): any; processChange(): any; diff --git a/dist/aurelia-templating-router.js b/dist/aurelia-templating-router.js index 594a2d7..ab7d0f0 100644 --- a/dist/aurelia-templating-router.js +++ b/dist/aurelia-templating-router.js @@ -1,5 +1,5 @@ import * as LogManager from 'aurelia-logging'; -import {customAttribute,bindable,ViewSlot,ViewLocator,customElement,noView,BehaviorInstruction,CompositionTransaction,CompositionEngine,ShadowDOM,SwapStrategies,useView} from 'aurelia-templating'; +import {customAttribute,bindable,ViewSlot,ViewLocator,customElement,noView,BehaviorInstruction,CompositionTransaction,CompositionEngine,ShadowDOM,SwapStrategies,useView,inlineView} from 'aurelia-templating'; import {inject,Container} from 'aurelia-dependency-injection'; import {Router,RouteLoader} from 'aurelia-router'; import {DOM} from 'aurelia-pal'; @@ -20,7 +20,7 @@ export class RouteHref { this.element = element; } - attached() { + bind() { this.isActive = true; this.processChange(); } @@ -101,7 +101,7 @@ export class RouterView { let viewModelResource = component.viewModelResource; let metadata = viewModelResource.metadata; let config = component.router.currentInstruction.config; - let viewPort = config.viewPorts ? config.viewPorts[viewPortInstruction.name] : {}; + let viewPort = config.viewPorts ? (config.viewPorts[viewPortInstruction.name] || {}) : {}; childContainer.get(RouterViewLocator)._notify(this); @@ -228,6 +228,9 @@ export class RouterViewLocator { } } +@inlineView('') +class EmptyClass { } + @inject(CompositionEngine) export class TemplatingRouteLoader extends RouteLoader { constructor(compositionEngine) { @@ -238,9 +241,16 @@ export class TemplatingRouteLoader extends RouteLoader { loadRoute(router, config) { let childContainer = router.container.createChild(); - let viewModel = /\.html/.test(config.moduleId) - ? createDynamicClass(config.moduleId) - : relativeToFile(config.moduleId, Origin.get(router.container.viewModel.constructor).moduleId); + let viewModel; + if (config.moduleId === null) { + viewModel = EmptyClass; + } else if (/\.html/i.test(config.moduleId)) { + viewModel = createDynamicClass(config.moduleId); + } else { + viewModel = relativeToFile(config.moduleId, Origin.get(router.container.viewModel.constructor).moduleId); + } + + config = config || {}; let instruction = { viewModel: viewModel, diff --git a/dist/commonjs/route-href.js b/dist/commonjs/route-href.js index 4b1520d..73921ef 100644 --- a/dist/commonjs/route-href.js +++ b/dist/commonjs/route-href.js @@ -33,7 +33,7 @@ var RouteHref = exports.RouteHref = (_dec = (0, _aureliaTemplating.customAttribu this.element = element; } - RouteHref.prototype.attached = function attached() { + RouteHref.prototype.bind = function bind() { this.isActive = true; this.processChange(); }; diff --git a/dist/commonjs/route-loader.js b/dist/commonjs/route-loader.js index 88eb7fa..f7708ff 100644 --- a/dist/commonjs/route-loader.js +++ b/dist/commonjs/route-loader.js @@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.TemplatingRouteLoader = undefined; -var _dec, _class; +var _dec, _class, _dec2, _class2; var _aureliaDependencyInjection = require('aurelia-dependency-injection'); @@ -19,13 +19,16 @@ var _aureliaMetadata = require('aurelia-metadata'); var _routerView = require('./router-view'); - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } -var TemplatingRouteLoader = exports.TemplatingRouteLoader = (_dec = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.CompositionEngine), _dec(_class = function (_RouteLoader) { + + +var EmptyClass = (_dec = (0, _aureliaTemplating.inlineView)(''), _dec(_class = function EmptyClass() { + +}) || _class); +var TemplatingRouteLoader = exports.TemplatingRouteLoader = (_dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.CompositionEngine), _dec2(_class2 = function (_RouteLoader) { _inherits(TemplatingRouteLoader, _RouteLoader); function TemplatingRouteLoader(compositionEngine) { @@ -40,7 +43,16 @@ var TemplatingRouteLoader = exports.TemplatingRouteLoader = (_dec = (0, _aurelia 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 viewModel = void 0; + if (config.moduleId === null) { + viewModel = EmptyClass; + } else if (/\.html/i.test(config.moduleId)) { + viewModel = createDynamicClass(config.moduleId); + } else { + viewModel = (0, _aureliaPath.relativeToFile)(config.moduleId, _aureliaMetadata.Origin.get(router.container.viewModel.constructor).moduleId); + } + + config = config || {}; var instruction = { viewModel: viewModel, @@ -65,15 +77,15 @@ var TemplatingRouteLoader = exports.TemplatingRouteLoader = (_dec = (0, _aurelia }; return TemplatingRouteLoader; -}(_aureliaRouter.RouteLoader)) || _class); +}(_aureliaRouter.RouteLoader)) || _class2); function createDynamicClass(moduleId) { - var _dec2, _dec3, _class2; + var _dec3, _dec4, _class3; var name = /([^\/^\?]+)\.html/i.exec(moduleId)[1]; - var DynamicClass = (_dec2 = (0, _aureliaTemplating.customElement)(name), _dec3 = (0, _aureliaTemplating.useView)(moduleId), _dec2(_class2 = _dec3(_class2 = function () { + var DynamicClass = (_dec3 = (0, _aureliaTemplating.customElement)(name), _dec4 = (0, _aureliaTemplating.useView)(moduleId), _dec3(_class3 = _dec4(_class3 = function () { function DynamicClass() { } @@ -83,7 +95,7 @@ function createDynamicClass(moduleId) { }; return DynamicClass; - }()) || _class2) || _class2); + }()) || _class3) || _class3); return DynamicClass; diff --git a/dist/commonjs/router-view.js b/dist/commonjs/router-view.js index bee64f0..8c016ec 100644 --- a/dist/commonjs/router-view.js +++ b/dist/commonjs/router-view.js @@ -109,7 +109,7 @@ var RouterView = exports.RouterView = (_dec = (0, _aureliaTemplating.customEleme var viewModelResource = component.viewModelResource; var metadata = viewModelResource.metadata; var config = component.router.currentInstruction.config; - var viewPort = config.viewPorts ? config.viewPorts[viewPortInstruction.name] : {}; + var viewPort = config.viewPorts ? config.viewPorts[viewPortInstruction.name] || {} : {}; childContainer.get(RouterViewLocator)._notify(this); diff --git a/dist/es2015/route-href.js b/dist/es2015/route-href.js index 5f6e473..d4083c8 100644 --- a/dist/es2015/route-href.js +++ b/dist/es2015/route-href.js @@ -14,7 +14,7 @@ export let RouteHref = (_dec = customAttribute('route-href'), _dec2 = bindable({ this.element = element; } - attached() { + bind() { this.isActive = true; this.processChange(); } diff --git a/dist/es2015/route-loader.js b/dist/es2015/route-loader.js index c80a4b6..b62ac01 100644 --- a/dist/es2015/route-loader.js +++ b/dist/es2015/route-loader.js @@ -1,13 +1,15 @@ -var _dec, _class; +var _dec, _class, _dec2, _class2; import { inject } from 'aurelia-dependency-injection'; -import { CompositionEngine, useView, customElement } from 'aurelia-templating'; +import { CompositionEngine, useView, inlineView, customElement } from 'aurelia-templating'; import { RouteLoader, Router } from 'aurelia-router'; import { relativeToFile } from 'aurelia-path'; import { Origin } from 'aurelia-metadata'; import { RouterViewLocator } from './router-view'; -export let TemplatingRouteLoader = (_dec = inject(CompositionEngine), _dec(_class = class TemplatingRouteLoader extends RouteLoader { +let EmptyClass = (_dec = inlineView(''), _dec(_class = class EmptyClass {}) || _class); + +export let TemplatingRouteLoader = (_dec2 = inject(CompositionEngine), _dec2(_class2 = class TemplatingRouteLoader extends RouteLoader { constructor(compositionEngine) { super(); this.compositionEngine = compositionEngine; @@ -16,7 +18,16 @@ export let TemplatingRouteLoader = (_dec = inject(CompositionEngine), _dec(_clas loadRoute(router, config) { let childContainer = router.container.createChild(); - let viewModel = /\.html/.test(config.moduleId) ? createDynamicClass(config.moduleId) : relativeToFile(config.moduleId, Origin.get(router.container.viewModel.constructor).moduleId); + let viewModel; + if (config.moduleId === null) { + viewModel = EmptyClass; + } else if (/\.html/i.test(config.moduleId)) { + viewModel = createDynamicClass(config.moduleId); + } else { + viewModel = relativeToFile(config.moduleId, Origin.get(router.container.viewModel.constructor).moduleId); + } + + config = config || {}; let instruction = { viewModel: viewModel, @@ -39,18 +50,18 @@ export let TemplatingRouteLoader = (_dec = inject(CompositionEngine), _dec(_clas return this.compositionEngine.ensureViewModel(instruction); } -}) || _class); +}) || _class2); function createDynamicClass(moduleId) { - var _dec2, _dec3, _class2; + var _dec3, _dec4, _class3; let name = /([^\/^\?]+)\.html/i.exec(moduleId)[1]; - let DynamicClass = (_dec2 = customElement(name), _dec3 = useView(moduleId), _dec2(_class2 = _dec3(_class2 = class DynamicClass { + let DynamicClass = (_dec3 = customElement(name), _dec4 = useView(moduleId), _dec3(_class3 = _dec4(_class3 = class DynamicClass { bind(bindingContext) { this.$parent = bindingContext; } - }) || _class2) || _class2); + }) || _class3) || _class3); return DynamicClass; diff --git a/dist/es2015/router-view.js b/dist/es2015/router-view.js index 3bc991e..ea7a7d0 100644 --- a/dist/es2015/router-view.js +++ b/dist/es2015/router-view.js @@ -92,7 +92,7 @@ export let RouterView = (_dec = customElement('router-view'), _dec2 = inject(DOM let viewModelResource = component.viewModelResource; let metadata = viewModelResource.metadata; let config = component.router.currentInstruction.config; - let viewPort = config.viewPorts ? config.viewPorts[viewPortInstruction.name] : {}; + let viewPort = config.viewPorts ? config.viewPorts[viewPortInstruction.name] || {} : {}; childContainer.get(RouterViewLocator)._notify(this); diff --git a/dist/native-modules/route-href.js b/dist/native-modules/route-href.js index 276e902..3de81ff 100644 --- a/dist/native-modules/route-href.js +++ b/dist/native-modules/route-href.js @@ -18,7 +18,7 @@ export var RouteHref = (_dec = customAttribute('route-href'), _dec2 = bindable({ this.element = element; } - RouteHref.prototype.attached = function attached() { + RouteHref.prototype.bind = function bind() { this.isActive = true; this.processChange(); }; diff --git a/dist/native-modules/route-loader.js b/dist/native-modules/route-loader.js index 747b4a1..d9f5d47 100644 --- a/dist/native-modules/route-loader.js +++ b/dist/native-modules/route-loader.js @@ -1,19 +1,23 @@ -var _dec, _class; - - +var _dec, _class, _dec2, _class2; function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + import { inject } from 'aurelia-dependency-injection'; -import { CompositionEngine, useView, customElement } from 'aurelia-templating'; +import { CompositionEngine, useView, inlineView, customElement } from 'aurelia-templating'; import { RouteLoader, Router } from 'aurelia-router'; import { relativeToFile } from 'aurelia-path'; import { Origin } from 'aurelia-metadata'; import { RouterViewLocator } from './router-view'; -export var TemplatingRouteLoader = (_dec = inject(CompositionEngine), _dec(_class = function (_RouteLoader) { +var EmptyClass = (_dec = inlineView(''), _dec(_class = function EmptyClass() { + +}) || _class); + +export var TemplatingRouteLoader = (_dec2 = inject(CompositionEngine), _dec2(_class2 = function (_RouteLoader) { _inherits(TemplatingRouteLoader, _RouteLoader); function TemplatingRouteLoader(compositionEngine) { @@ -28,7 +32,16 @@ export var TemplatingRouteLoader = (_dec = inject(CompositionEngine), _dec(_clas TemplatingRouteLoader.prototype.loadRoute = function loadRoute(router, config) { var childContainer = router.container.createChild(); - var viewModel = /\.html/.test(config.moduleId) ? createDynamicClass(config.moduleId) : relativeToFile(config.moduleId, Origin.get(router.container.viewModel.constructor).moduleId); + var viewModel = void 0; + if (config.moduleId === null) { + viewModel = EmptyClass; + } else if (/\.html/i.test(config.moduleId)) { + viewModel = createDynamicClass(config.moduleId); + } else { + viewModel = relativeToFile(config.moduleId, Origin.get(router.container.viewModel.constructor).moduleId); + } + + config = config || {}; var instruction = { viewModel: viewModel, @@ -53,14 +66,14 @@ export var TemplatingRouteLoader = (_dec = inject(CompositionEngine), _dec(_clas }; return TemplatingRouteLoader; -}(RouteLoader)) || _class); +}(RouteLoader)) || _class2); function createDynamicClass(moduleId) { - var _dec2, _dec3, _class2; + var _dec3, _dec4, _class3; var name = /([^\/^\?]+)\.html/i.exec(moduleId)[1]; - var DynamicClass = (_dec2 = customElement(name), _dec3 = useView(moduleId), _dec2(_class2 = _dec3(_class2 = function () { + var DynamicClass = (_dec3 = customElement(name), _dec4 = useView(moduleId), _dec3(_class3 = _dec4(_class3 = function () { function DynamicClass() { } @@ -70,7 +83,7 @@ function createDynamicClass(moduleId) { }; return DynamicClass; - }()) || _class2) || _class2); + }()) || _class3) || _class3); return DynamicClass; diff --git a/dist/native-modules/router-view.js b/dist/native-modules/router-view.js index 849584a..4a84aa3 100644 --- a/dist/native-modules/router-view.js +++ b/dist/native-modules/router-view.js @@ -97,7 +97,7 @@ export var RouterView = (_dec = customElement('router-view'), _dec2 = inject(DOM var viewModelResource = component.viewModelResource; var metadata = viewModelResource.metadata; var config = component.router.currentInstruction.config; - var viewPort = config.viewPorts ? config.viewPorts[viewPortInstruction.name] : {}; + var viewPort = config.viewPorts ? config.viewPorts[viewPortInstruction.name] || {} : {}; childContainer.get(RouterViewLocator)._notify(this); diff --git a/dist/system/route-href.js b/dist/system/route-href.js index 3ba5d5b..3cb8a4c 100644 --- a/dist/system/route-href.js +++ b/dist/system/route-href.js @@ -31,7 +31,7 @@ System.register(['aurelia-templating', 'aurelia-dependency-injection', 'aurelia- this.element = element; } - RouteHref.prototype.attached = function attached() { + RouteHref.prototype.bind = function bind() { this.isActive = true; this.processChange(); }; diff --git a/dist/system/route-loader.js b/dist/system/route-loader.js index 36dc268..ee5a2ff 100644 --- a/dist/system/route-loader.js +++ b/dist/system/route-loader.js @@ -3,9 +3,7 @@ System.register(['aurelia-dependency-injection', 'aurelia-templating', 'aurelia-router', 'aurelia-path', 'aurelia-metadata', './router-view'], function (_export, _context) { "use strict"; - var inject, CompositionEngine, useView, customElement, RouteLoader, Router, relativeToFile, Origin, RouterViewLocator, _dec, _class, TemplatingRouteLoader; - - + var inject, CompositionEngine, useView, inlineView, customElement, RouteLoader, Router, relativeToFile, Origin, RouterViewLocator, _dec, _class, _dec2, _class2, EmptyClass, TemplatingRouteLoader; function _possibleConstructorReturn(self, call) { if (!self) { @@ -31,12 +29,14 @@ System.register(['aurelia-dependency-injection', 'aurelia-templating', 'aurelia- if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + function createDynamicClass(moduleId) { - var _dec2, _dec3, _class2; + var _dec3, _dec4, _class3; var name = /([^\/^\?]+)\.html/i.exec(moduleId)[1]; - var DynamicClass = (_dec2 = customElement(name), _dec3 = useView(moduleId), _dec2(_class2 = _dec3(_class2 = function () { + var DynamicClass = (_dec3 = customElement(name), _dec4 = useView(moduleId), _dec3(_class3 = _dec4(_class3 = function () { function DynamicClass() { } @@ -46,7 +46,7 @@ System.register(['aurelia-dependency-injection', 'aurelia-templating', 'aurelia- }; return DynamicClass; - }()) || _class2) || _class2); + }()) || _class3) || _class3); return DynamicClass; @@ -57,6 +57,7 @@ System.register(['aurelia-dependency-injection', 'aurelia-templating', 'aurelia- }, function (_aureliaTemplating) { CompositionEngine = _aureliaTemplating.CompositionEngine; useView = _aureliaTemplating.useView; + inlineView = _aureliaTemplating.inlineView; customElement = _aureliaTemplating.customElement; }, function (_aureliaRouter) { RouteLoader = _aureliaRouter.RouteLoader; @@ -69,7 +70,11 @@ System.register(['aurelia-dependency-injection', 'aurelia-templating', 'aurelia- RouterViewLocator = _routerView.RouterViewLocator; }], execute: function () { - _export('TemplatingRouteLoader', TemplatingRouteLoader = (_dec = inject(CompositionEngine), _dec(_class = function (_RouteLoader) { + EmptyClass = (_dec = inlineView(''), _dec(_class = function EmptyClass() { + + }) || _class); + + _export('TemplatingRouteLoader', TemplatingRouteLoader = (_dec2 = inject(CompositionEngine), _dec2(_class2 = function (_RouteLoader) { _inherits(TemplatingRouteLoader, _RouteLoader); function TemplatingRouteLoader(compositionEngine) { @@ -84,7 +89,16 @@ System.register(['aurelia-dependency-injection', 'aurelia-templating', 'aurelia- TemplatingRouteLoader.prototype.loadRoute = function loadRoute(router, config) { var childContainer = router.container.createChild(); - var viewModel = /\.html/.test(config.moduleId) ? createDynamicClass(config.moduleId) : relativeToFile(config.moduleId, Origin.get(router.container.viewModel.constructor).moduleId); + var viewModel = void 0; + if (config.moduleId === null) { + viewModel = EmptyClass; + } else if (/\.html/i.test(config.moduleId)) { + viewModel = createDynamicClass(config.moduleId); + } else { + viewModel = relativeToFile(config.moduleId, Origin.get(router.container.viewModel.constructor).moduleId); + } + + config = config || {}; var instruction = { viewModel: viewModel, @@ -109,7 +123,7 @@ System.register(['aurelia-dependency-injection', 'aurelia-templating', 'aurelia- }; return TemplatingRouteLoader; - }(RouteLoader)) || _class)); + }(RouteLoader)) || _class2)); _export('TemplatingRouteLoader', TemplatingRouteLoader); } diff --git a/dist/system/router-view.js b/dist/system/router-view.js index ae8b87a..8e5c189 100644 --- a/dist/system/router-view.js +++ b/dist/system/router-view.js @@ -120,7 +120,7 @@ System.register(['aurelia-dependency-injection', 'aurelia-binding', 'aurelia-tem var viewModelResource = component.viewModelResource; var metadata = viewModelResource.metadata; var config = component.router.currentInstruction.config; - var viewPort = config.viewPorts ? config.viewPorts[viewPortInstruction.name] : {}; + var viewPort = config.viewPorts ? config.viewPorts[viewPortInstruction.name] || {} : {}; childContainer.get(RouterViewLocator)._notify(this); diff --git a/dist/temp/aurelia-templating-router.js b/dist/temp/aurelia-templating-router.js index f15ad17..652e34c 100644 --- a/dist/temp/aurelia-templating-router.js +++ b/dist/temp/aurelia-templating-router.js @@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.TemplatingRouteLoader = exports.RouterViewLocator = exports.RouterView = exports.RouteHref = undefined; -var _dec, _dec2, _dec3, _dec4, _dec5, _class, _dec6, _dec7, _class2, _desc, _value, _class3, _descriptor, _descriptor2, _descriptor3, _descriptor4, _dec8, _class5; +var _dec, _dec2, _dec3, _dec4, _dec5, _class, _dec6, _dec7, _class2, _desc, _value, _class3, _descriptor, _descriptor2, _descriptor3, _descriptor4, _dec8, _class5, _dec9, _class6; var _aureliaLogging = require('aurelia-logging'); @@ -86,7 +86,7 @@ var RouteHref = exports.RouteHref = (_dec = (0, _aureliaTemplating.customAttribu this.element = element; } - RouteHref.prototype.attached = function attached() { + RouteHref.prototype.bind = function bind() { this.isActive = true; this.processChange(); }; @@ -172,7 +172,7 @@ var RouterView = exports.RouterView = (_dec6 = (0, _aureliaTemplating.customElem var viewModelResource = component.viewModelResource; var metadata = viewModelResource.metadata; var config = component.router.currentInstruction.config; - var viewPort = config.viewPorts ? config.viewPorts[viewPortInstruction.name] : {}; + var viewPort = config.viewPorts ? config.viewPorts[viewPortInstruction.name] || {} : {}; childContainer.get(RouterViewLocator)._notify(this); @@ -303,7 +303,10 @@ var RouterViewLocator = exports.RouterViewLocator = function () { return RouterViewLocator; }(); -var TemplatingRouteLoader = exports.TemplatingRouteLoader = (_dec8 = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.CompositionEngine), _dec8(_class5 = function (_RouteLoader) { +var EmptyClass = (_dec8 = (0, _aureliaTemplating.inlineView)(''), _dec8(_class5 = function EmptyClass() { + _classCallCheck(this, EmptyClass); +}) || _class5); +var TemplatingRouteLoader = exports.TemplatingRouteLoader = (_dec9 = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.CompositionEngine), _dec9(_class6 = function (_RouteLoader) { _inherits(TemplatingRouteLoader, _RouteLoader); function TemplatingRouteLoader(compositionEngine) { @@ -318,7 +321,16 @@ var TemplatingRouteLoader = exports.TemplatingRouteLoader = (_dec8 = (0, _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 viewModel = void 0; + if (config.moduleId === null) { + viewModel = EmptyClass; + } else if (/\.html/i.test(config.moduleId)) { + viewModel = createDynamicClass(config.moduleId); + } else { + viewModel = (0, _aureliaPath.relativeToFile)(config.moduleId, _aureliaMetadata.Origin.get(router.container.viewModel.constructor).moduleId); + } + + config = config || {}; var instruction = { viewModel: viewModel, @@ -343,15 +355,15 @@ var TemplatingRouteLoader = exports.TemplatingRouteLoader = (_dec8 = (0, _aureli }; return TemplatingRouteLoader; -}(_aureliaRouter.RouteLoader)) || _class5); +}(_aureliaRouter.RouteLoader)) || _class6); function createDynamicClass(moduleId) { - var _dec9, _dec10, _class6; + var _dec10, _dec11, _class7; var name = /([^\/^\?]+)\.html/i.exec(moduleId)[1]; - var DynamicClass = (_dec9 = (0, _aureliaTemplating.customElement)(name), _dec10 = (0, _aureliaTemplating.useView)(moduleId), _dec9(_class6 = _dec10(_class6 = function () { + var DynamicClass = (_dec10 = (0, _aureliaTemplating.customElement)(name), _dec11 = (0, _aureliaTemplating.useView)(moduleId), _dec10(_class7 = _dec11(_class7 = function () { function DynamicClass() { _classCallCheck(this, DynamicClass); } @@ -361,7 +373,7 @@ function createDynamicClass(moduleId) { }; return DynamicClass; - }()) || _class6) || _class6); + }()) || _class7) || _class7); return DynamicClass; diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index de2d77f..41210bc 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,3 +1,13 @@ + +# [1.3.0](https://github.com/aurelia/templating-router/compare/1.2.0...1.3.0) (2018-01-15) + + +### Features + +* **templating-router:** optional viewports ([24532ff](https://github.com/aurelia/templating-router/commit/24532ff)) + + + # [1.2.0](https://github.com/aurelia/templating-router/compare/1.1.0...1.2.0) (2017-10-02)