UNPKG

83 kBJavaScriptView Raw
1var __extends = (this && this.__extends) || (function () {
2 var extendStatics = Object.setPrototypeOf ||
3 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
4 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
5 return function (d, b) {
6 extendStatics(d, b);
7 function __() { this.constructor = d; }
8 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
9 };
10})();
11/**
12 * @license Framing v0.8.24
13 * Copyright 2016-2017 Biznas Innovations, Inc. http://biznas.io
14 * License: Apache License, Version 2.0
15 */
16import { ANALYZE_FOR_ENTRY_COMPONENTS, ChangeDetectorRef, Component, ComponentFactoryResolver, Directive, EventEmitter, Injectable, Injector, Input, NgModule, NgModuleFactory, Output, Type, ViewContainerRef } from '@angular/core';
17import { ActivatedRoute, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, Router, RouterModule } from '@angular/router';
18import { assign, camelCase, clone, defaults, differenceWith, each, filter, find, isArray, isEmpty, isEqual, isNil, keys, merge, reject, uniqWith } from 'lodash';
19import { BehaviorSubject } from 'rxjs/BehaviorSubject';
20import { ReplaySubject, Subject } from 'rxjs';
21import { ReplaySubject as ReplaySubject$1 } from 'rxjs/Rx';
22import { CommonModule } from '@angular/common';
23import { FormsModule } from '@angular/forms';
24import { BrowserModule } from '@angular/platform-browser';
25var Component$1 = (function () {
26 function Component$1(controller, injector) {
27 var _this = this;
28 this.controller = controller;
29 this.changeDetectorRef = injector.get(ChangeDetectorRef);
30 this.subscriptions = [];
31 this.subscriptions.push(controller.model$.subscribe(function (model) { return _this.updateModel(model); }), controller.view$.subscribe(function (view) { return _this.updateView(view); }), controller.markForCheck$.subscribe(function () { return _this.changeDetectorRef.markForCheck(); }));
32 this.controller.attach();
33 }
34 Component$1.prototype.ngOnInit = function () {
35 };
36 Component$1.prototype.ngOnDestroy = function () {
37 this.controller.detach();
38 this.subscriptions.forEach(function (s) { return s.unsubscribe(); });
39 this.subscriptions = null;
40 this.changeDetectorRef = null;
41 this.controller = null;
42 this.model = null;
43 this.view = null;
44 };
45 Component$1.prototype.updateModel = function (model) {
46 this.model = model;
47 this.changeDetectorRef.markForCheck();
48 };
49 Component$1.prototype.updateView = function (view) {
50 this.view = view;
51 this.changeDetectorRef.markForCheck();
52 };
53 return Component$1;
54}());
55var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
56 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
57 if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
58 r = Reflect.decorate(decorators, target, key, desc);
59 else
60 for (var i = decorators.length - 1; i >= 0; i--)
61 if (d = decorators[i])
62 r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
63 return c > 3 && r && Object.defineProperty(target, key, r), r;
64};
65// import { Subject } from 'rxjs/Subject';
66var Controller = (function () {
67 // import { Subject } from 'rxjs/Subject';
68 function Controller() {
69 // ========================================
70 // private properties
71 // ========================================
72 this._refCount = 0;
73 }
74 Object.defineProperty(Controller.prototype, "model$", {
75 // ========================================
76 // public methods
77 // ========================================
78 /**
79 * Model observable accessor.
80 */
81 get: function () { return this._model$; },
82 enumerable: true,
83 configurable: true
84 });
85 Object.defineProperty(Controller.prototype, "model", {
86 /**
87 * Model accessor.
88 */
89 get: function () { return this._model; },
90 enumerable: true,
91 configurable: true
92 });
93 Object.defineProperty(Controller.prototype, "view$", {
94 /**
95 * View observable accessor.
96 */
97 get: function () { return this._view$; },
98 enumerable: true,
99 configurable: true
100 });
101 Object.defineProperty(Controller.prototype, "view", {
102 /**
103 * View accessor.
104 */
105 get: function () { return this._view; },
106 enumerable: true,
107 configurable: true
108 });
109 Object.defineProperty(Controller.prototype, "markForCheck$", {
110 /**
111 * Mark for check observable accessor.
112 */
113 get: function () { return this._markForCheck$; },
114 enumerable: true,
115 configurable: true
116 });
117 Object.defineProperty(Controller.prototype, "frame", {
118 /**
119 * Frame accessor.
120 */
121 get: function () { return this._frame; },
122 enumerable: true,
123 configurable: true
124 });
125 Object.defineProperty(Controller.prototype, "injector", {
126 /**
127 * Model accessor.
128 */
129 get: function () { return this._injector; },
130 enumerable: true,
131 configurable: true
132 });
133 /**
134 * Called after controller is initialized with model, view & frame from framing.
135 */
136 Controller.prototype.onControllerInit = function () { };
137 /**
138 * Called when the controller's route starts resolving.
139 */
140 Controller.prototype.onResolveStart = function () { };
141 /**
142 * Called when the controller's route end resolving.
143 */
144 Controller.prototype.onResolveEnd = function () { };
145 /**
146 * Called when the controller's route resolve is cancelled.
147 */
148 Controller.prototype.onResolveCancel = function () { };
149 /**
150 * Called by framing after construction to link the model, view & frame for this controller.
151 */
152 Controller.prototype.initController = function (model, view, frame, framerName, injector) {
153 var _this = this;
154 this._modelSubject = new BehaviorSubject(model);
155 this._viewSubject = new BehaviorSubject(view);
156 this._model$ = this._modelSubject.asObservable();
157 this._view$ = this._viewSubject.asObservable();
158 this._model = model;
159 this._view = view;
160 this._markForCheckSubject = new BehaviorSubject(true);
161 this._markForCheck$ = this._markForCheckSubject.asObservable();
162 this._frame = frame;
163 this._injector = injector;
164 this._framerName = framerName;
165 if (this._frame) {
166 this._frame.resolveStart$.subscribe(function () { _this.onResolveStart(); });
167 this._frame.resolveEnd$.subscribe(function () { _this.onResolveEnd(); });
168 this._frame.resolveCancel$.subscribe(function () { _this.onResolveCancel(); });
169 }
170 this.onControllerInit();
171 console.log('initController');
172 console.log(this);
173 };
174 Controller.prototype.updateModel = function (model, replace) {
175 if (replace === void 0) { replace = false; }
176 if (replace) {
177 this._model = clone(model);
178 }
179 else {
180 this._model = assign({}, this._model, model);
181 }
182 this._modelSubject.next(this._model);
183 };
184 Controller.prototype.updateView = function (view, replace) {
185 if (replace === void 0) { replace = false; }
186 if (replace) {
187 this._view = clone(view);
188 }
189 else {
190 this._view = assign({}, this._view, view);
191 }
192 this._viewSubject.next(this._view);
193 };
194 Controller.prototype.markForCheck = function () {
195 this._markForCheckSubject.next(true);
196 };
197 Controller.prototype.attach = function () {
198 var _this = this;
199 this._refCount++;
200 if (this._refCount === 1) {
201 setTimeout(function () {
202 _this.onAttached();
203 });
204 }
205 };
206 Controller.prototype.detach = function () {
207 var _this = this;
208 this._refCount--;
209 if (this._refCount === 0) {
210 setTimeout(function () {
211 _this.onDetached();
212 });
213 }
214 };
215 Controller.prototype.onAttached = function () { };
216 Controller.prototype.onDetached = function () { };
217 return Controller;
218}());
219Controller = __decorate$2([
220 Injectable()
221], Controller);
222/**
223 * Dev tool class used for framing integration with Redux DevTools
224 *
225 * @class FramingTools
226 */
227/**
228 * Dev tool class used for framing integration with Redux DevTools
229 *
230 * @class FramingTools
231 */ var FramingTools = (function () {
232 function FramingTools() {
233 this.instantiatedControllers = {};
234 }
235 Object.defineProperty(FramingTools, "Instance", {
236 get: function () {
237 return this._instance || (this._instance = new this());
238 },
239 enumerable: true,
240 configurable: true
241 });
242 FramingTools.prototype.addController = function (framerName, controller) {
243 this.instantiatedControllers[framerName] = controller;
244 };
245 FramingTools.prototype.getAllControllers = function () {
246 return this.instantiatedControllers;
247 };
248 FramingTools.prototype.getControllerByKey = function (key) {
249 return this.instantiatedControllers[key] ? this.instantiatedControllers[key] : null;
250 };
251 return FramingTools;
252}());
253var framingTools = FramingTools.Instance;
254var stateRoot = {};
255var onLoad = true;
256// let controllers: any[] = [];
257var devTools = _createReduxDevtoolsExtension();
258var isListening = false;
259/* tslint:disable */
260function Action(description, log) {
261 if (description === void 0) { description = null; }
262 if (log === void 0) { log = true; }
263 return function (target, propertyKey, descriptor) {
264 if (descriptor === undefined) {
265 descriptor = Object.getOwnPropertyDescriptor(target, propertyKey);
266 }
267 var originalMethod = descriptor.value;
268 descriptor.value = function () {
269 var args = [];
270 var controller = this;
271 // let controllerIndex: number;
272 // if (controllers.indexOf(controller) <= -1) {
273 // controllers.push(controller);
274 // controllerIndex = controllers.length - 1;
275 // } else {
276 // controllerIndex = controllers.indexOf(controller);
277 // }
278 for (var _i = 0; _i < arguments.length; _i++) {
279 args[_i] = arguments[_i];
280 }
281 try {
282 listenForChanges();
283 }
284 catch (e) {
285 console.log('Listen to Devtools failed: ');
286 console.log(e);
287 }
288 // Send the initial state if this is the first time connecting to the dev tools
289 if (onLoad && log && devTools) {
290 onLoad = !onLoad;
291 stateRoot[controller._framerName] = controller.model;
292 var state = {
293 framerName: controller._framerName,
294 value: stateRoot,
295 };
296 try {
297 devTools.send((description || propertyKey), state);
298 }
299 catch (e) {
300 console.log('Send to Devtools failed: ');
301 console.log(e);
302 }
303 }
304 originalMethod.apply(controller, args);
305 // Need to log after the method has been ran and state is updated
306 if (log && devTools) {
307 stateRoot[controller._framerName] = controller.model;
308 var state = {
309 framerName: controller._framerName,
310 // controllerIndex: controllerIndex,
311 value: stateRoot,
312 };
313 try {
314 devTools.send((description || propertyKey), state);
315 }
316 catch (e) {
317 console.log('Send to Devtools failed: ');
318 console.log(e);
319 }
320 }
321 controller.markForCheck();
322 };
323 return descriptor;
324 };
325}
326/**
327 * Listen for message events being broadcast from the redux devTools
328 * Changes state on the correct controller to match the state changes broadcast
329 */
330function listenForChanges() {
331 if (isListening || !devTools)
332 return;
333 isListening = true;
334 var connection = devTools.connect();
335 connection.subscribe(function (message) {
336 if (!!message.state) {
337 var messageState = JSON.parse(message.state);
338 var messageController = framingTools.getControllerByKey(messageState.framerName);
339 if (messageController) {
340 for (var prop in messageController.model) {
341 messageController.model[prop] = messageState.value[messageState.framerName][prop];
342 }
343 messageController.markForCheck();
344 }
345 }
346 });
347}
348/**
349 * Returns correct instance of redux dev tools installed
350 *
351 * @export
352 * @returns
353 */
354function _createReduxDevtoolsExtension() {
355 var legacyExtensionKey = 'devToolsExtension';
356 var extensionKey = '__REDUX_DEVTOOLS_EXTENSION__';
357 if (typeof window === 'object' && typeof window[legacyExtensionKey] !== 'undefined') {
358 return window[legacyExtensionKey];
359 }
360 else if (typeof window === 'object' && typeof window[extensionKey] !== 'undefined') {
361 return window[extensionKey];
362 }
363 else {
364 return null;
365 }
366}
367var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
368 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
369 if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
370 r = Reflect.decorate(decorators, target, key, desc);
371 else
372 for (var i = decorators.length - 1; i >= 0; i--)
373 if (d = decorators[i])
374 r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
375 return c > 3 && r && Object.defineProperty(target, key, r), r;
376};
377var __metadata$1 = (undefined && undefined.__metadata) || function (k, v) {
378 if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
379 return Reflect.metadata(k, v);
380};
381var FramingDevToolsController = (function (_super) {
382 __extends(FramingDevToolsController, _super);
383 function FramingDevToolsController(router) {
384 var _this = _super.call(this) || this;
385 _this.router = router;
386 _this.replayNavigation = false;
387 return _this;
388 }
389 FramingDevToolsController.prototype.onControllerInit = function () {
390 var _this = this;
391 this.router.events.subscribe(function (event) {
392 _this.handleRouterEvents(event);
393 });
394 this.markForCheck$.subscribe(function (data) {
395 if (_this.model.snapshotUrl && _this.model.snapshotUrl !== _this.router.routerState.snapshot.url) {
396 _this.replayNavigation = true;
397 _this.router.navigate([_this.model.snapshotUrl]);
398 }
399 }, function (err) { return console.error(err); });
400 };
401 FramingDevToolsController.prototype.trackRouterState = function () {
402 this.model.snapshotUrl = this.router.routerState.snapshot.url;
403 };
404 FramingDevToolsController.prototype.handleRouterEvents = function (event) {
405 if (event instanceof NavigationEnd) {
406 if (!this.replayNavigation) {
407 this.trackRouterState();
408 }
409 this.replayNavigation = false;
410 }
411 };
412 return FramingDevToolsController;
413}(Controller));
414__decorate$1([
415 Action(),
416 __metadata$1("design:type", Function),
417 __metadata$1("design:paramtypes", []),
418 __metadata$1("design:returntype", void 0)
419], FramingDevToolsController.prototype, "trackRouterState", null);
420FramingDevToolsController = __decorate$1([
421 Injectable(),
422 __metadata$1("design:paramtypes", [Router])
423], FramingDevToolsController);
424var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
425 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
426 if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
427 r = Reflect.decorate(decorators, target, key, desc);
428 else
429 for (var i = decorators.length - 1; i >= 0; i--)
430 if (d = decorators[i])
431 r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
432 return c > 3 && r && Object.defineProperty(target, key, r), r;
433};
434var __metadata = (undefined && undefined.__metadata) || function (k, v) {
435 if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
436 return Reflect.metadata(k, v);
437};
438var FramingDevToolsComponent = (function (_super) {
439 __extends(FramingDevToolsComponent, _super);
440 function FramingDevToolsComponent(controller, injector) {
441 return _super.call(this, controller, injector) || this;
442 }
443 return FramingDevToolsComponent;
444}(Component$1));
445FramingDevToolsComponent = __decorate([
446 Component({}),
447 __metadata("design:paramtypes", [FramingDevToolsController, Injector])
448], FramingDevToolsComponent);
449var Frame = (function () {
450 function Frame() {
451 // ========================================
452 // public properties
453 // ========================================
454 /**
455 * Subjects
456 */
457 this.routeUrlSubject = new ReplaySubject();
458 this.resolveStartSubject = new Subject();
459 this.resolveEndSubject = new Subject();
460 this.resolveCancelSubject = new Subject();
461 }
462 Object.defineProperty(Frame.prototype, "routeUrl$", {
463 /**
464 * An observable of the route url of the route that this controllerr is attached to, if any.
465 */
466 get: function () { return this.routeUrlSubject; },
467 enumerable: true,
468 configurable: true
469 });
470 Object.defineProperty(Frame.prototype, "resolveStart$", {
471 /**
472 * Emitted when the frame resolve method starts if this controller is attached to a route.
473 */
474 get: function () { return this.resolveStartSubject; },
475 enumerable: true,
476 configurable: true
477 });
478 Object.defineProperty(Frame.prototype, "resolveEnd$", {
479 /**
480 * Emitted when the frame resolve method ends if this controller is attached to a route.
481 */
482 get: function () { return this.resolveEndSubject; },
483 enumerable: true,
484 configurable: true
485 });
486 Object.defineProperty(Frame.prototype, "resolveCancel$", {
487 /**
488 * Emitted when the frame resolve method is cancelled if this controller is attached to a route.
489 */
490 get: function () { return this.resolveCancelSubject; },
491 enumerable: true,
492 configurable: true
493 });
494 return Frame;
495}());
496/**
497 * @description This is a description
498 */
499var Framer = (function () {
500 // ========================================
501 // constructor
502 // ========================================
503 /**
504 * Contructor.
505 */
506 function Framer(model, view, controller) {
507 this.framingDevTools = FramingTools.Instance;
508 /**
509 * True if framing() has been called.
510 */
511 this._framed = false;
512 this.construct(model, view, controller);
513 }
514 Object.defineProperty(Framer.prototype, "theModel", {
515 /**
516 * Model accessor.
517 */
518 get: function () { return this._model; },
519 enumerable: true,
520 configurable: true
521 });
522 Object.defineProperty(Framer.prototype, "theView", {
523 /**
524 * View accessor.
525 */
526 get: function () { return this._view; },
527 enumerable: true,
528 configurable: true
529 });
530 Object.defineProperty(Framer.prototype, "theController", {
531 /**
532 * Controller accessor.
533 */
534 get: function () { return this._controller; },
535 enumerable: true,
536 configurable: true
537 });
538 Object.defineProperty(Framer.prototype, "createFrame", {
539 /**
540 * When true, framing will create a frame for this framer.
541 */
542 get: function () { return true; },
543 enumerable: true,
544 configurable: true
545 });
546 Object.defineProperty(Framer.prototype, "multiFramer", {
547 /**
548 * When true, framing will use multi on all providers so multiple framers of the same type can be setup on the same module.
549 */
550 get: function () { return false; },
551 enumerable: true,
552 configurable: true
553 });
554 Object.defineProperty(Framer.prototype, "provideControllerByType", {
555 /**
556 * When true, framing will setup the controller as a provider by its type.
557 */
558 get: function () { return true; },
559 enumerable: true,
560 configurable: true
561 });
562 Object.defineProperty(Framer.prototype, "addModelToRouteData", {
563 /**
564 * When true, framing will add the model to the route data.
565 */
566 get: function () { return false; },
567 enumerable: true,
568 configurable: true
569 });
570 Object.defineProperty(Framer.prototype, "addViewToRouteData", {
571 /**
572 * When true, framing will add the view to the route data.
573 */
574 get: function () { return false; },
575 enumerable: true,
576 configurable: true
577 });
578 Object.defineProperty(Framer.prototype, "addFrameToRouteData", {
579 /**
580 * When true, framing will add the frame to the route data.
581 */
582 get: function () { return false; },
583 enumerable: true,
584 configurable: true
585 });
586 Object.defineProperty(Framer.prototype, "defaultModel", {
587 /**
588 * The default model.
589 */
590 get: function () { return undefined; },
591 enumerable: true,
592 configurable: true
593 });
594 Object.defineProperty(Framer.prototype, "defaultView", {
595 /**
596 * The default view.
597 */
598 get: function () { return undefined; },
599 enumerable: true,
600 configurable: true
601 });
602 Object.defineProperty(Framer.prototype, "defaultController", {
603 /**
604 * The default controller.
605 */
606 get: function () { return undefined; },
607 enumerable: true,
608 configurable: true
609 });
610 Object.defineProperty(Framer.prototype, "routeRule", {
611 /**
612 * 'require': framing will attach the default route, creating it if it doesn't yet exist, if not route is attached to this framer (default behavior)
613 * 'auto': framing will attach the default route if available if not route is attached to this framer
614 * 'none': framing will not attach a route to this framer
615 */
616 get: function () { return 'require'; },
617 enumerable: true,
618 configurable: true
619 });
620 Object.defineProperty(Framer.prototype, "framerId", {
621 /**
622 * A unique framer id for this framer.
623 */
624 get: function () { return this._framerId; },
625 enumerable: true,
626 configurable: true
627 });
628 Object.defineProperty(Framer.prototype, "framerIdent", {
629 /**
630 * A unique identifier string for this framer instance.
631 */
632 get: function () { return this.framerName + "Framer-" + this._framerId; },
633 enumerable: true,
634 configurable: true
635 });
636 Object.defineProperty(Framer.prototype, "framed", {
637 /**
638 * True if framing() has been called.
639 */
640 get: function () { return this._framed; },
641 enumerable: true,
642 configurable: true
643 });
644 Object.defineProperty(Framer.prototype, "injector", {
645 /**
646 * The injector (available on and after framerOnResolveRoute or framerOnControllerInit, whichever comes first)
647 */
648 get: function () { return this._injector; },
649 enumerable: true,
650 configurable: true
651 });
652 Object.defineProperty(Framer.prototype, "route", {
653 /**
654 * The framer's route, if attached to a route, otherwise undefined
655 * Valid ONLY during the runFraming() and framing() functions
656 */
657 get: function () { return this._route; },
658 enumerable: true,
659 configurable: true
660 });
661 // ========================================
662 // public static methods
663 // ========================================
664 /**
665 * Helper function to build the URL of an ActivatedRouteSnapshot
666 */
667 Framer.buildUrlLink = function (route) {
668 if (!route) {
669 return '/';
670 }
671 var urls = [];
672 /* tslint:disable:no-param-reassign */
673 for (; route.parent; route = route.parent) {
674 /* tslint:enable:no-param-reassign */
675 urls = urls.concat(route.url.reverse());
676 }
677 urls = urls.reverse();
678 return '/' + urls.join('/');
679 };
680 // ========================================
681 // public methods
682 // ========================================
683 /**
684 * Model chaining function.
685 */
686 Framer.prototype.model = function (model) {
687 merge(this._model, model);
688 return this;
689 };
690 /**
691 * View chaining function.
692 */
693 Framer.prototype.view = function (view) {
694 merge(this._view, view);
695 return this;
696 };
697 /**
698 * Controller chaining function.
699 */
700 Framer.prototype.controller = function (controller) {
701 if (controller) {
702 this._controller = controller;
703 }
704 return this;
705 };
706 /**
707 * Framer on resolve route function called when framer's route is resolved.
708 * Injector is set before during this call.
709 * Not called if framer is not attached to a route.
710 * To be overwritten if needed.
711 */
712 Framer.prototype.framerOnResolveRoute = function () { };
713 /**
714 * Framer on controller init function is called when the controller is first injected.
715 * To be overwritten if needed.
716 */
717 Framer.prototype.framerOnControllerInit = function (controller) { };
718 /**
719 * Calls derived framing()
720 */
721 Framer.prototype.runFraming = function (framing, routeParam) {
722 var _this = this;
723 if (this._framed) {
724 console.warn("runFraming() called multiple times on framer '" + this.framerIdent + "'");
725 return;
726 }
727 this._framed = true; // mark this framer to framed
728 if (this.routeRule === 'auto') {
729 // set the framer's attached route (if any)
730 this._route = routeParam;
731 }
732 else if (this.routeRule === 'require') {
733 // set the framer's attached route to the supplied route or create one if it doesn not exist
734 if (routeParam) {
735 this._route = routeParam;
736 }
737 else {
738 /* tslint:disable:no-param-reassign */
739 this._route = routeParam = framing.getOrAddRoute();
740 /* tslint:enable:no-param-reassign */
741 }
742 }
743 this._framing = framing; // set _framing to framing ONLY for the duration of the controller() function
744 try {
745 this.frame(framing);
746 }
747 catch (e) {
748 console.error("Exception when framing " + this.framerIdent + " :", e);
749 this._model = undefined;
750 this._view = undefined;
751 this._controller = undefined;
752 }
753 this._framing = undefined;
754 if (this.routeRule === 'auto') {
755 this._route = routeParam;
756 }
757 var self = this;
758 if (this._controller) {
759 // FUTURE
760 // this.provideTypeByName(framing, this.framerName + 'Controller', this._controller);
761 var controllerInstance_1;
762 framing
763 .provide({
764 provide: this.framerIdent + '-ControllerInternal',
765 useClass: this._controller,
766 })
767 .provide({
768 provide: this.framerIdent + '-Controller',
769 useFactory: function (injector) {
770 if (controllerInstance_1) {
771 _this.framingDevTools.addController(_this.framerName, controllerInstance_1);
772 return controllerInstance_1;
773 }
774 self._injector = injector;
775 controllerInstance_1 = injector.get(_this.framerIdent + '-ControllerInternal');
776 controllerInstance_1.initController(_this._model, _this._view, _this._frame, _this.framerName, injector);
777 _this.framerOnControllerInit(controllerInstance_1);
778 _this.framingDevTools.addController(_this.framerName, controllerInstance_1);
779 return controllerInstance_1;
780 },
781 deps: [Injector],
782 });
783 if (this.provideControllerByType) {
784 framing
785 .provide({
786 provide: this._controller,
787 useExisting: this.framerIdent + '-Controller',
788 multi: this.multiFramer && this._controller === this.defaultController,
789 });
790 /* tslint:disable:no-console */
791 console.info("Providing controller for framer " + this.framerIdent + " by type");
792 /* tslint:enable:no-console */
793 if (this.defaultController && this._controller !== this.defaultController) {
794 framing.provide({
795 provide: this.defaultController,
796 useExisting: this.framerIdent + '-Controller',
797 multi: this.multiFramer,
798 });
799 /* tslint:disable:no-console */
800 console.info("Providing controller overload for framer " + this.framerIdent + " by default controller type");
801 /* tslint:enable:no-console */
802 }
803 }
804 }
805 // FUTURE: frame, model & view provided by name
806 // this.provideValueByName(framing, this.framerName + 'Frame', this._frame);
807 // this.provideValueByName(framing, this.framerName + 'Model', this._model);
808 // this.provideValueByName(framing, this.framerName + 'View', this._view);
809 // FUTURE: model & view provided by type
810 // this.provideInstanceByType(framing, this._model);
811 // this.provideInstanceByType(framing, this._view);
812 if (this.route) {
813 if (this.addFrameToRouteData) {
814 this.addRouteData(framing, this.framerName + 'Frame', this._frame);
815 }
816 if (this.addModelToRouteData) {
817 this.addRouteData(framing, this.framerName + 'Model', this._model);
818 }
819 if (this.addViewToRouteData) {
820 this.addRouteData(framing, this.framerName + 'View', this._view);
821 }
822 if (this._frame) {
823 var FrameResolver_1 = (function () {
824 function FrameResolver_1(router, route, injector) {
825 this.router = router;
826 this.route = route;
827 self._injector = injector;
828 }
829 FrameResolver_1.prototype.resolve = function (routeSnapshot, routeStateSnapshot) {
830 var _this = this;
831 self._frame.resolveStartSubject.next();
832 var routeUrl = Framer.buildUrlLink(routeSnapshot);
833 var sub = this.router.events.subscribe(function (event) {
834 if (event instanceof NavigationStart) {
835 console.error('Unexpected NavigationStart');
836 }
837 else if (event instanceof NavigationEnd) {
838 /* tslint:disable:no-console */
839 console.info("Route url for framer " + self.framerIdent + " changed to " + routeUrl);
840 /* tslint:enable:no-console */
841 self._frame.routeSnapshot = self.findActivateRouteSnapshot(_this.route);
842 self._frame.routeUrl = routeUrl;
843 self._frame.routeUrlSubject.next(routeUrl);
844 self.framerOnResolveRoute();
845 self._frame.resolveEndSubject.next();
846 }
847 else if (event instanceof NavigationError) {
848 self._frame.resolveCancelSubject.next();
849 }
850 else if (event instanceof NavigationCancel) {
851 self._frame.resolveCancelSubject.next();
852 }
853 sub.unsubscribe();
854 });
855 return self._frame;
856 };
857 return FrameResolver_1;
858 }());
859 framing
860 .resolve(this.framerIdent, FrameResolver_1, this.route)
861 .provide({
862 provide: FrameResolver_1,
863 useFactory: function (r, a, i) { return new FrameResolver_1(r, a, i); },
864 deps: [Router, ActivatedRoute, Injector]
865 });
866 }
867 }
868 this._route = undefined; // clear the route so we're not holding any references to its properties
869 };
870 /**
871 * Protected construct function for derived construction help.
872 */
873 Framer.prototype.construct = function (model, view, controller) {
874 this._framerId = Framer._nextId++;
875 if (this.createFrame) {
876 this._frame = new Frame();
877 }
878 var defaultModel = this.defaultModel;
879 this._model = defaultModel ? merge(defaultModel, model) : model;
880 var defaultView = this.defaultView;
881 this._view = defaultView ? merge(defaultView, view) : view;
882 this._controller = controller || this.defaultController;
883 };
884 /**
885 * Protected construct function for derived construction help.
886 */
887 Framer.prototype.findActivateRouteSnapshot = function (route) {
888 if (!route) {
889 console.error('Failed to find activated route snapshot');
890 return undefined;
891 }
892 if (route.snapshot && route.snapshot.data && route.snapshot.data.hasOwnProperty(this.framerIdent)) {
893 return route.snapshot;
894 }
895 return this.findActivateRouteSnapshot(route.firstChild);
896 };
897 /**
898 * FUTURE
899 */
900 // private provideTypeByName(framing: FramingNgModule, name: string, type: any): void {
901 // if (type) {
902 // framing.provide({ provide: name, useClass: type });
903 // /* tslint:disable:no-console */
904 // console.info(`Providing ${name} for framer ${this.framerIdent} by name`);
905 // /* tslint:enable:no-console */
906 // }
907 // }
908 /**
909 * FUTURE
910 */
911 // private provideInstanceByType(framing: FramingNgModule, instance: any): void {
912 // if (instance &&
913 // (instance as any).__proto__ &&
914 // (instance as any).__proto__.constructor &&
915 // (instance as any).__proto__.constructor.name !== 'Object') {
916 // framing.provide({ provide: (instance as any).__proto__.constructor, useValue: instance });
917 // /* tslint:disable:no-console */
918 // console.info(`Providing ${(instance as any).__proto__.constructor.name} for framer ${this.framerIdent} by type`);
919 // /* tslint:enable:no-console */
920 // }
921 // }
922 /**
923 * FUTURE
924 */
925 // private provideValueByName(framing: FramingNgModule, name: string, value: any): void {
926 // if (value) {
927 // framing.provide({ provide: name, useValue: value });
928 // /* tslint:disable:no-console */
929 // console.info(`Providing ${name} for framer ${this.framerIdent} by name`);
930 // /* tslint:enable:no-console */
931 // }
932 // }
933 Framer.prototype.addRouteData = function (framing, name, value) {
934 if (value) {
935 var routeConfig = framing.getOrAddRoute(this.route);
936 if (routeConfig.data && routeConfig.data[name]) {
937 console.warn("Failed to add " + name + " route data for framer " + this.framerIdent + ". Data item already exists.");
938 }
939 else {
940 framing.datum(name, value, this.route);
941 /* tslint:disable:no-console */
942 console.info("Adding " + name + " route data for framer " + this.framerIdent);
943 /* tslint:enable:no-console */
944 }
945 }
946 };
947 return Framer;
948}());
949Framer._nextId = 1;
950var FramingDevToolsFeature = (function (_super) {
951 __extends(FramingDevToolsFeature, _super);
952 function FramingDevToolsFeature() {
953 return _super !== null && _super.apply(this, arguments) || this;
954 }
955 Object.defineProperty(FramingDevToolsFeature.prototype, "defaultModel", {
956 get: function () {
957 return {};
958 },
959 enumerable: true,
960 configurable: true
961 });
962 Object.defineProperty(FramingDevToolsFeature.prototype, "defaultView", {
963 get: function () {
964 return {};
965 },
966 enumerable: true,
967 configurable: true
968 });
969 FramingDevToolsFeature.prototype.frame = function (framing) { };
970 FramingDevToolsFeature.prototype.framerOnResolveRoute = function () {
971 var framingDevToolsController;
972 framingDevToolsController = this.injector.get(FramingDevToolsController);
973 };
974 Object.defineProperty(FramingDevToolsFeature.prototype, "framerName", {
975 // ========================================
976 // internal framing methods (don't touch!)
977 // ========================================
978 get: function () { return 'FramingDevTools'; },
979 enumerable: true,
980 configurable: true
981 });
982 Object.defineProperty(FramingDevToolsFeature.prototype, "defaultController", {
983 get: function () { return FramingDevToolsController; },
984 enumerable: true,
985 configurable: true
986 });
987 return FramingDevToolsFeature;
988}(Framer));
989var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
990 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
991 if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
992 r = Reflect.decorate(decorators, target, key, desc);
993 else
994 for (var i = decorators.length - 1; i >= 0; i--)
995 if (d = decorators[i])
996 r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
997 return c > 3 && r && Object.defineProperty(target, key, r), r;
998};
999var __metadata$2 = (undefined && undefined.__metadata) || function (k, v) {
1000 if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1001 return Reflect.metadata(k, v);
1002};
1003var FramingComponentOutletDirective = (function () {
1004 function FramingComponentOutletDirective(_view) {
1005 this._view = _view;
1006 this.onComponent = new EventEmitter();
1007 }
1008 FramingComponentOutletDirective.prototype.isActivated = function () { return !!this._componentRef; };
1009 FramingComponentOutletDirective.prototype.ngOnChanges = function (changes) {
1010 var activate = false;
1011 if (changes.ngModuleFactory) {
1012 if (this._moduleRef) {
1013 this._moduleRef.destroy();
1014 }
1015 if (this.ngModuleFactory) {
1016 var injector = this.injector || this._view.parentInjector;
1017 this._moduleRef = this.ngModuleFactory.create(injector);
1018 }
1019 else {
1020 this._moduleRef = undefined;
1021 }
1022 activate = true;
1023 }
1024 if (changes.framingComponentOutlet.currentValue !== changes.framingComponentOutlet.previousValue) {
1025 activate = true;
1026 }
1027 if (activate) {
1028 this.activate(this.framingComponentOutlet);
1029 }
1030 };
1031 FramingComponentOutletDirective.prototype.ngOnDestroy = function () {
1032 this.deactivate();
1033 if (this._moduleRef) {
1034 this._moduleRef.destroy();
1035 }
1036 };
1037 FramingComponentOutletDirective.prototype.activate = function (component) {
1038 this.deactivate();
1039 if (!component) {
1040 return;
1041 }
1042 try {
1043 var injector = this.injector || this._view.parentInjector;
1044 var factory = injector.get(ComponentFactoryResolver).resolveComponentFactory(component);
1045 this._componentRef = this._view.createComponent(factory, this._view.length, injector, this.content);
1046 this.onComponent.emit(this._componentRef);
1047 try {
1048 this._componentRef.changeDetectorRef.detectChanges();
1049 }
1050 catch (e) {
1051 console.error("detectChanges failed on activated component in FramingComponentOutlet", { e: e, component: component });
1052 return;
1053 }
1054 }
1055 catch (e) {
1056 console.error("Failed to activate component in FramingComponentOutlet", { e: e, component: component });
1057 return;
1058 }
1059 };
1060 FramingComponentOutletDirective.prototype.deactivate = function () {
1061 if (this._componentRef) {
1062 this._view.remove(this._view.indexOf(this._componentRef.hostView));
1063 this._componentRef.destroy();
1064 }
1065 this._view.clear();
1066 this._componentRef = undefined;
1067 };
1068 return FramingComponentOutletDirective;
1069}());
1070__decorate$3([
1071 Input(),
1072 __metadata$2("design:type", Type)
1073], FramingComponentOutletDirective.prototype, "framingComponentOutlet", void 0);
1074__decorate$3([
1075 Input(),
1076 __metadata$2("design:type", Injector)
1077], FramingComponentOutletDirective.prototype, "injector", void 0);
1078__decorate$3([
1079 Input(),
1080 __metadata$2("design:type", Array)
1081], FramingComponentOutletDirective.prototype, "content", void 0);
1082__decorate$3([
1083 Input(),
1084 __metadata$2("design:type", NgModuleFactory)
1085], FramingComponentOutletDirective.prototype, "ngModuleFactory", void 0);
1086__decorate$3([
1087 Output(),
1088 __metadata$2("design:type", EventEmitter)
1089], FramingComponentOutletDirective.prototype, "onComponent", void 0);
1090FramingComponentOutletDirective = __decorate$3([
1091 Directive({
1092 selector: '[framingComponentOutlet]',
1093 }),
1094 __metadata$2("design:paramtypes", [ViewContainerRef])
1095], FramingComponentOutletDirective);
1096var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1097 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1098 if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1099 r = Reflect.decorate(decorators, target, key, desc);
1100 else
1101 for (var i = decorators.length - 1; i >= 0; i--)
1102 if (d = decorators[i])
1103 r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1104 return c > 3 && r && Object.defineProperty(target, key, r), r;
1105};
1106var FramingComponentOutletModule = FramingComponentOutletModule_1 = (function () {
1107 function FramingComponentOutletModule() {
1108 }
1109 FramingComponentOutletModule.withEntryComponents = function () {
1110 var components = [];
1111 for (var _a = 0; _a < arguments.length; _a++) {
1112 components[_a] = arguments[_a];
1113 }
1114 return {
1115 ngModule: FramingComponentOutletModule_1,
1116 providers: [
1117 { provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: components, multi: true },
1118 ],
1119 };
1120 };
1121 return FramingComponentOutletModule;
1122}());
1123FramingComponentOutletModule = FramingComponentOutletModule_1 = __decorate$4([
1124 NgModule({
1125 declarations: [FramingComponentOutletDirective],
1126 exports: [FramingComponentOutletDirective],
1127 })
1128], FramingComponentOutletModule);
1129var FramingComponentOutletModule_1;
1130var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1131 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1132 if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1133 r = Reflect.decorate(decorators, target, key, desc);
1134 else
1135 for (var i = decorators.length - 1; i >= 0; i--)
1136 if (d = decorators[i])
1137 r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1138 return c > 3 && r && Object.defineProperty(target, key, r), r;
1139};
1140var __metadata$4 = (undefined && undefined.__metadata) || function (k, v) {
1141 if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1142 return Reflect.metadata(k, v);
1143};
1144var FramingContainerOutletService = (function () {
1145 function FramingContainerOutletService(router) {
1146 var _this = this;
1147 this.router = router;
1148 this.contentsSubject = new ReplaySubject$1();
1149 this.contents = [];
1150 this.routeContents = [];
1151 this.subscriptions = [];
1152 this.subscriptions.push(this.router.events.subscribe(function (event) {
1153 if (event instanceof NavigationEnd) {
1154 _this.onNavigationEnd();
1155 }
1156 }));
1157 }
1158 Object.defineProperty(FramingContainerOutletService.prototype, "contents$", {
1159 get: function () { return this.contentsSubject.asObservable(); },
1160 enumerable: true,
1161 configurable: true
1162 });
1163 FramingContainerOutletService.prototype.hasContent = function (container) {
1164 return !!this.contents.filter(function (c) { return isEqual(c.container, container); }).length;
1165 };
1166 FramingContainerOutletService.prototype.activate = function (content) {
1167 var _this = this;
1168 this.contents.push(content);
1169 this.contentsSubject.next(clone(this.contents));
1170 return function () { _this.deactivate(content); };
1171 };
1172 FramingContainerOutletService.prototype.deactivate = function (content) {
1173 this.contents = this.contents.filter(function (e) { return e !== content; });
1174 this.contentsSubject.next(clone(this.contents));
1175 };
1176 FramingContainerOutletService.prototype.onNavigationEnd = function () {
1177 var _this = this;
1178 var newRouteContents = [];
1179 this.resolveRouteContents(this.router.routerState.snapshot.root, newRouteContents);
1180 newRouteContents = uniqWith(newRouteContents, isEqual);
1181 var newContents = differenceWith(newRouteContents, this.routeContents, isEqual);
1182 var removedContents = differenceWith(this.routeContents, newRouteContents, isEqual);
1183 newContents.forEach(function (c) { return _this.activate(c); });
1184 removedContents.forEach(function (c) { return _this.deactivate(c); });
1185 this.routeContents = newRouteContents;
1186 };
1187 FramingContainerOutletService.prototype.resolveRouteContents = function (snapshot, routeContents) {
1188 if (snapshot.data && snapshot.data.containers) {
1189 var containers = snapshot.data.containers;
1190 for (var _a = 0, containers_1 = containers; _a < containers_1.length; _a++) {
1191 var container = containers_1[_a];
1192 routeContents.push(container);
1193 }
1194 }
1195 for (var _b = 0, _c = snapshot.children; _b < _c.length; _b++) {
1196 var child = _c[_b];
1197 this.resolveRouteContents(child, routeContents);
1198 }
1199 };
1200 return FramingContainerOutletService;
1201}());
1202FramingContainerOutletService = __decorate$6([
1203 Injectable(),
1204 __metadata$4("design:paramtypes", [Router])
1205], FramingContainerOutletService);
1206var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1207 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1208 if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1209 r = Reflect.decorate(decorators, target, key, desc);
1210 else
1211 for (var i = decorators.length - 1; i >= 0; i--)
1212 if (d = decorators[i])
1213 r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1214 return c > 3 && r && Object.defineProperty(target, key, r), r;
1215};
1216var __metadata$3 = (undefined && undefined.__metadata) || function (k, v) {
1217 if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1218 return Reflect.metadata(k, v);
1219};
1220var FramingContainerOutletDirective = (function () {
1221 function FramingContainerOutletDirective(_view, _containerService, _router) {
1222 this._view = _view;
1223 this._containerService = _containerService;
1224 this._router = _router;
1225 this.onComponents = new EventEmitter();
1226 this._activated = [];
1227 this._subscriptions = [];
1228 }
1229 FramingContainerOutletDirective.prototype.containerName = function () { return this.framingContainerOutlet; };
1230 FramingContainerOutletDirective.prototype.isActivated = function () { return this._activated.length > 0; };
1231 FramingContainerOutletDirective.prototype.ngOnInit = function () {
1232 var _this = this;
1233 if (!this.framingContainerOutlet) {
1234 console.warn('FramingContainerOutlet without a container name');
1235 }
1236 else {
1237 if (this.framingContainerOutlet[0] === '\'') {
1238 console.warn("FramingContainerOutlet name \"" + this.framingContainerOutlet + "\" starts with a qoute");
1239 }
1240 this._subscriptions.push(this._containerService.contents$.subscribe(function (contents) { return _this.onContent(contents); }));
1241 }
1242 this._subscriptions.push(this._router.events.subscribe(function (event) {
1243 if (event instanceof NavigationEnd) {
1244 if (!_this.optionalContainer && !_this.isActivated()) {
1245 console.warn("No content for required FramingContainerOutlet '" + _this.framingContainerOutlet + "' found");
1246 }
1247 }
1248 }));
1249 };
1250 FramingContainerOutletDirective.prototype.ngOnDestroy = function () {
1251 var _this = this;
1252 this._activated.forEach(function (a) { return _this.deactivate(a); });
1253 this._subscriptions.forEach(function (s) { return s.unsubscribe(); });
1254 };
1255 FramingContainerOutletDirective.prototype.onContent = function (allContents) {
1256 var _this = this;
1257 var contents = allContents.filter(function (c) { return isEqual(c.container, _this.framingContainerOutlet); });
1258 // remove all content that is no longer active
1259 this._activated.forEach(function (a) {
1260 if (contents.findIndex(function (content) { return content === a.content; }) === -1) {
1261 _this.deactivate(a);
1262 }
1263 });
1264 this._activated = this._activated.filter(function (a) { return !!a.ref; });
1265 // now setup the new activated components
1266 var i = 0;
1267 var _loop_1 = function (content) {
1268 if (this_1._activated.length > i) {
1269 if (this_1._activated[i].content !== content) {
1270 // look for this content
1271 var activatedIndex = this_1._activated.findIndex(function (a) { return a.content === content; });
1272 if (activatedIndex === -1) {
1273 // activate this content at i
1274 this_1._activated.splice(i, 0, { content: content, ref: this_1.activate(content) });
1275 }
1276 else if (activatedIndex > i) {
1277 // move content from activatedIndex to i
1278 var _activated = this_1._activated.splice(activatedIndex, 1);
1279 (_a = this_1._activated).splice.apply(_a, [i, 0].concat(_activated));
1280 var view = this_1._view.detach(activatedIndex);
1281 this_1._view.insert(view, i);
1282 }
1283 else {
1284 console.error('Logic error in FramingContainerOutlet!');
1285 }
1286 }
1287 }
1288 else {
1289 // activate this content
1290 var ref = this_1.activate(content);
1291 if (ref) {
1292 this_1._activated.push({ content: content, ref: ref });
1293 }
1294 }
1295 i++;
1296 var _a;
1297 };
1298 var this_1 = this;
1299 for (var _a = 0, contents_1 = contents; _a < contents_1.length; _a++) {
1300 var content = contents_1[_a];
1301 _loop_1(content);
1302 }
1303 this.onComponents.emit(this._activated.map(function (a) { return a.ref; }));
1304 };
1305 FramingContainerOutletDirective.prototype.activate = function (content, i) {
1306 try {
1307 var injector = (!this.useViewInjector && content.injector) ? content.injector : this._view.parentInjector;
1308 var factory = injector.get(ComponentFactoryResolver).resolveComponentFactory(content.component);
1309 var ref = this._view.createComponent(factory, i, injector, this.content);
1310 try {
1311 ref.changeDetectorRef.detectChanges();
1312 }
1313 catch (e) {
1314 console.error("detectChanges failed on activated component in FramingContainerOutlet '" + this.framingContainerOutlet + "'", { e: e, component: content.component });
1315 }
1316 return ref;
1317 }
1318 catch (e) {
1319 console.error("Failed to activate component in FramingContainerOutlet '" + this.framingContainerOutlet + "'", { e: e, component: content.component });
1320 return undefined;
1321 }
1322 };
1323 FramingContainerOutletDirective.prototype.deactivate = function (activated) {
1324 activated.ref.destroy();
1325 activated.ref = null;
1326 };
1327 return FramingContainerOutletDirective;
1328}());
1329__decorate$5([
1330 Input(),
1331 __metadata$3("design:type", String)
1332], FramingContainerOutletDirective.prototype, "framingContainerOutlet", void 0);
1333__decorate$5([
1334 Input(),
1335 __metadata$3("design:type", Boolean)
1336], FramingContainerOutletDirective.prototype, "optionalContainer", void 0);
1337__decorate$5([
1338 Input(),
1339 __metadata$3("design:type", Boolean)
1340], FramingContainerOutletDirective.prototype, "useViewInjector", void 0);
1341__decorate$5([
1342 Input(),
1343 __metadata$3("design:type", Array)
1344], FramingContainerOutletDirective.prototype, "content", void 0);
1345__decorate$5([
1346 Output(),
1347 __metadata$3("design:type", EventEmitter)
1348], FramingContainerOutletDirective.prototype, "onComponents", void 0);
1349FramingContainerOutletDirective = __decorate$5([
1350 Directive({
1351 selector: '[framingContainerOutlet]',
1352 }),
1353 __metadata$3("design:paramtypes", [ViewContainerRef,
1354 FramingContainerOutletService,
1355 Router])
1356], FramingContainerOutletDirective);
1357var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1358 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1359 if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1360 r = Reflect.decorate(decorators, target, key, desc);
1361 else
1362 for (var i = decorators.length - 1; i >= 0; i--)
1363 if (d = decorators[i])
1364 r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1365 return c > 3 && r && Object.defineProperty(target, key, r), r;
1366};
1367var FramingContainerOutletModule = FramingContainerOutletModule_1 = (function () {
1368 function FramingContainerOutletModule() {
1369 }
1370 FramingContainerOutletModule.withEntryComponents = function () {
1371 var components = [];
1372 for (var _a = 0; _a < arguments.length; _a++) {
1373 components[_a] = arguments[_a];
1374 }
1375 return {
1376 ngModule: FramingContainerOutletModule_1,
1377 providers: [
1378 { provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: components, multi: true },
1379 ],
1380 };
1381 };
1382 FramingContainerOutletModule.forRoot = function () {
1383 return {
1384 ngModule: FramingContainerOutletModule_1,
1385 providers: [FramingContainerOutletService],
1386 };
1387 };
1388 return FramingContainerOutletModule;
1389}());
1390FramingContainerOutletModule = FramingContainerOutletModule_1 = __decorate$7([
1391 NgModule({
1392 declarations: [FramingContainerOutletDirective],
1393 exports: [FramingContainerOutletDirective],
1394 })
1395], FramingContainerOutletModule);
1396var FramingContainerOutletModule_1;
1397var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1398 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1399 if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1400 r = Reflect.decorate(decorators, target, key, desc);
1401 else
1402 for (var i = decorators.length - 1; i >= 0; i--)
1403 if (d = decorators[i])
1404 r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1405 return c > 3 && r && Object.defineProperty(target, key, r), r;
1406};
1407var __metadata$5 = (undefined && undefined.__metadata) || function (k, v) {
1408 if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1409 return Reflect.metadata(k, v);
1410};
1411var FramingContainerOutletResolver = (function () {
1412 function FramingContainerOutletResolver(containers, injector) {
1413 this.containers = containers;
1414 this.injector = injector;
1415 }
1416 /**
1417 * Resolve hook.
1418 */
1419 FramingContainerOutletResolver.prototype.resolve = function (route, state) {
1420 // set the injector in each container
1421 for (var _a = 0, _b = this.containers; _a < _b.length; _a++) {
1422 var container = _b[_a];
1423 container.injector = this.injector;
1424 }
1425 return this.containers;
1426 };
1427 return FramingContainerOutletResolver;
1428}());
1429FramingContainerOutletResolver = __decorate$8([
1430 Injectable(),
1431 __metadata$5("design:paramtypes", [Array, Injector])
1432], FramingContainerOutletResolver);
1433var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1434 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1435 if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1436 r = Reflect.decorate(decorators, target, key, desc);
1437 else
1438 for (var i = decorators.length - 1; i >= 0; i--)
1439 if (d = decorators[i])
1440 r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1441 return c > 3 && r && Object.defineProperty(target, key, r), r;
1442};
1443/**
1444 * @experimental
1445 */
1446var FramingEmptyParentComponent = (function () {
1447 function FramingEmptyParentComponent() {
1448 }
1449 return FramingEmptyParentComponent;
1450}());
1451FramingEmptyParentComponent = __decorate$9([
1452 Component({
1453 selector: 'empty-parent-component',
1454 template: '<router-outlet></router-outlet>',
1455 })
1456], FramingEmptyParentComponent);
1457var __decorate$11 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1458 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1459 if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1460 r = Reflect.decorate(decorators, target, key, desc);
1461 else
1462 for (var i = decorators.length - 1; i >= 0; i--)
1463 if (d = decorators[i])
1464 r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1465 return c > 3 && r && Object.defineProperty(target, key, r), r;
1466};
1467var FramingRootComponent = (function () {
1468 function FramingRootComponent() {
1469 }
1470 return FramingRootComponent;
1471}());
1472FramingRootComponent = __decorate$11([
1473 Component({
1474 selector: 'app-root',
1475 template: '<router-outlet></router-outlet>',
1476 })
1477], FramingRootComponent);
1478var __decorate$10 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1479 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1480 if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1481 r = Reflect.decorate(decorators, target, key, desc);
1482 else
1483 for (var i = decorators.length - 1; i >= 0; i--)
1484 if (d = decorators[i])
1485 r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1486 return c > 3 && r && Object.defineProperty(target, key, r), r;
1487};
1488var FramingComponentsModule = (function () {
1489 function FramingComponentsModule() {
1490 }
1491 return FramingComponentsModule;
1492}());
1493FramingComponentsModule = __decorate$10([
1494 NgModule({
1495 imports: [
1496 RouterModule,
1497 ],
1498 declarations: [
1499 FramingEmptyParentComponent,
1500 FramingRootComponent,
1501 ],
1502 exports: [
1503 FramingEmptyParentComponent,
1504 FramingRootComponent,
1505 ],
1506 })
1507], FramingComponentsModule);
1508var FramerHelper = (function () {
1509 // ========================================
1510 // constructor
1511 // ========================================
1512 function FramerHelper() {
1513 this.framerHelperId = FramerHelper._nextId++;
1514 }
1515 Object.defineProperty(FramerHelper.prototype, "framerHelperIdent", {
1516 /**
1517 * A unique identifier string for this framer helper instance.
1518 */
1519 get: function () {
1520 return camelCase("framerHelper-" + this.__proto__.constructor.name + "-" + this.framerHelperId);
1521 },
1522 enumerable: true,
1523 configurable: true
1524 });
1525 return FramerHelper;
1526}());
1527FramerHelper._nextId = 1;
1528/**
1529 *
1530 */
1531var FramingNgModule = (function () {
1532 function FramingNgModule() {
1533 // ========================================
1534 // private properties
1535 // ========================================
1536 this._ngModule = {
1537 imports: [],
1538 declarations: [],
1539 exports: [],
1540 providers: [],
1541 bootstrap: [],
1542 entryComponents: [],
1543 };
1544 this._root = false;
1545 this._routes = [];
1546 }
1547 Object.defineProperty(FramingNgModule, "defaultPathMatch", {
1548 get: function () { return 'prefix'; },
1549 enumerable: true,
1550 configurable: true
1551 });
1552 // ========================================
1553 // public methods
1554 // ========================================
1555 FramingNgModule.prototype.ngModule = function (ngModule) {
1556 var _this = this;
1557 if (ngModule) {
1558 defaults(this._ngModule, ngModule);
1559 each(filter(keys(ngModule), function (key) { return isArray(ngModule[key]); }), function (key) {
1560 _this._ngModule[key] = uniqWith(_this._ngModule[key].concat(reject(ngModule[key], isNil)), isEqual);
1561 });
1562 }
1563 return this;
1564 };
1565 FramingNgModule.prototype.bootstrap = function (bootstrap) {
1566 var flattened = [].concat.apply([], bootstrap);
1567 this._ngModule.bootstrap = uniqWith(this._ngModule.bootstrap.concat(reject(flattened, isNil)), isEqual);
1568 return this;
1569 };
1570 FramingNgModule.prototype.child = function (child, parent) {
1571 var parentRoute = this.getOrAddRouteOverload(parent);
1572 if (!parentRoute.children) {
1573 parentRoute.children = [];
1574 }
1575 if (!parentRoute.component) {
1576 parentRoute.component = FramingEmptyParentComponent;
1577 }
1578 this.getOrAddRoute(child, parentRoute.children);
1579 return this;
1580 };
1581 FramingNgModule.prototype.children = function (children, parent) {
1582 var _this = this;
1583 each(children, function (child) {
1584 _this.child(child, parent);
1585 });
1586 return this;
1587 };
1588 FramingNgModule.prototype.component = function (component, route) {
1589 if (component) {
1590 var routeConfig = this.getOrAddRouteOverload(route);
1591 routeConfig.component = component;
1592 }
1593 return this;
1594 };
1595 FramingNgModule.prototype.componentAndDeclare = function (component, route) {
1596 return this.componentAndDeclaration(component, route);
1597 };
1598 FramingNgModule.prototype.componentAndDeclaration = function (component, route) {
1599 this.component(component, route);
1600 if (component) {
1601 this.declare(component);
1602 }
1603 return this;
1604 };
1605 FramingNgModule.prototype.container = function (container, components, route) {
1606 var containers = {};
1607 containers[container] = components;
1608 this.containers(containers, route);
1609 return this;
1610 };
1611 FramingNgModule.prototype.containers = function (containers, route) {
1612 for (var key in containers) {
1613 if (containers.hasOwnProperty(key)) {
1614 if (isNil(containers[key])) {
1615 delete containers[key];
1616 }
1617 }
1618 }
1619 var routeConfig = this.getOrAddRoute(route);
1620 if (!routeConfig.resolve) {
1621 routeConfig.resolve = {};
1622 }
1623 if (!routeConfig.resolve.containers) {
1624 routeConfig.resolve.containers = [];
1625 }
1626 for (var key in containers) {
1627 if (containers.hasOwnProperty(key)) {
1628 var components = containers[key];
1629 if (isArray(components)) {
1630 for (var _a = 0, components_1 = components; _a < components_1.length; _a++) {
1631 var component = components_1[_a];
1632 routeConfig.resolve.containers.push({ container: key, component: component });
1633 }
1634 }
1635 else {
1636 routeConfig.resolve.containers.push({ container: key, component: components });
1637 }
1638 }
1639 }
1640 return this;
1641 };
1642 FramingNgModule.prototype.datum = function (key, datum, route) {
1643 var data = {};
1644 data[key] = datum;
1645 this.data(data, route);
1646 return this;
1647 };
1648 FramingNgModule.prototype.data = function (data, route) {
1649 var routeConfig = this.getOrAddRouteOverload(route);
1650 if (!routeConfig.data) {
1651 routeConfig.data = {};
1652 }
1653 merge(routeConfig.data, data);
1654 return this;
1655 };
1656 FramingNgModule.prototype.resolve = function (key, resolve, route) {
1657 var resolves = {};
1658 resolves[key] = resolve;
1659 this.resolves(resolves, route);
1660 return this;
1661 };
1662 FramingNgModule.prototype.resolves = function (resolves, route) {
1663 var routeConfig = this.getOrAddRouteOverload(route);
1664 if (!routeConfig.resolve) {
1665 routeConfig.resolve = {};
1666 }
1667 merge(routeConfig.resolve, resolves);
1668 return this;
1669 };
1670 FramingNgModule.prototype.declare = function (declaration) {
1671 return this.declaration(declaration);
1672 };
1673 FramingNgModule.prototype.declaration = function (declaration) {
1674 return this.declarations(isArray(declaration) ? declaration : [declaration]);
1675 };
1676 FramingNgModule.prototype.declarations = function (declarations) {
1677 var flattened = [].concat.apply([], declarations);
1678 this._ngModule.declarations = uniqWith(this._ngModule.declarations.concat(reject(flattened, isNil)), isEqual);
1679 return this;
1680 };
1681 FramingNgModule.prototype.declareAndExport = function (declaration) {
1682 return this.declarationAndExport(declaration);
1683 };
1684 FramingNgModule.prototype.declarationAndExport = function (declaration) {
1685 return this.declarationsAndExports(isArray(declaration) ? declaration : [declaration]);
1686 };
1687 FramingNgModule.prototype.declarationsAndExports = function (declarations) {
1688 this.declarations(declarations);
1689 this.exports(declarations);
1690 return this;
1691 };
1692 FramingNgModule.prototype.declareAndEntryComponent = function (declaration) {
1693 return this.declarationAndEntryComponent(declaration);
1694 };
1695 FramingNgModule.prototype.declarationAndEntryComponent = function (declaration) {
1696 return this.declarationsAndEntryComponents(isArray(declaration) ? declaration : [declaration]);
1697 };
1698 FramingNgModule.prototype.declarationsAndEntryComponents = function (declarations) {
1699 this.declarations(declarations);
1700 this.entryComponents(declarations);
1701 return this;
1702 };
1703 FramingNgModule.prototype.entryComponent = function (entryComponent) {
1704 return this.entryComponents(isArray(entryComponent) ? entryComponent : [entryComponent]);
1705 };
1706 FramingNgModule.prototype.entryComponents = function (entryComponents) {
1707 var flattened = [].concat.apply([], entryComponents);
1708 this._ngModule.entryComponents = uniqWith(this._ngModule.entryComponents.concat(reject(flattened, isNil)), isEqual);
1709 return this;
1710 };
1711 FramingNgModule.prototype.export = function (e) {
1712 return this.exports(isArray(e) ? e : [e]);
1713 };
1714 FramingNgModule.prototype.exports = function (exports) {
1715 var flattened = [].concat.apply([], exports);
1716 this._ngModule.exports = uniqWith(this._ngModule.exports.concat(reject(flattened, isNil)), isEqual);
1717 return this;
1718 };
1719 FramingNgModule.prototype.import = function (i) {
1720 return this.imports(isArray(i) ? i : [i]);
1721 };
1722 FramingNgModule.prototype.imports = function (imports) {
1723 var flattened = [].concat.apply([], imports);
1724 this._ngModule.imports = uniqWith(this._ngModule.imports.concat(reject(flattened, isNil)), isEqual);
1725 return this;
1726 };
1727 FramingNgModule.prototype.importAndExport = function (m) {
1728 return this.importsAndExports(isArray(m) ? m : [m]);
1729 };
1730 FramingNgModule.prototype.importsAndExports = function (modules) {
1731 this.imports(modules);
1732 this.exports(modules);
1733 return this;
1734 };
1735 FramingNgModule.prototype.provide = function (provider) {
1736 return this.provider(provider);
1737 };
1738 FramingNgModule.prototype.provider = function (provider) {
1739 return this.providers(isArray(provider) ? provider : [provider]);
1740 };
1741 FramingNgModule.prototype.providers = function (providers) {
1742 var flattened = [].concat.apply([], providers);
1743 this._ngModule.providers = uniqWith(this._ngModule.providers.concat(reject(flattened, isNil)), isEqual);
1744 return this;
1745 };
1746 /**
1747 * Adds component to bootstrap
1748 * Defaults route to path '', pathMatch: 'full'
1749 */
1750 FramingNgModule.prototype.root = function (rootComponent, config) {
1751 this._root = true;
1752 this._rootComponentConfig = config || {};
1753 defaults(this._rootComponentConfig, { hybrid: false });
1754 this._rootComponent = rootComponent || FramingRootComponent;
1755 return this;
1756 };
1757 /**
1758 * Creates Routes array with single route
1759 * Adds RouterModule.forRoot(routes) or RouterModule.forChild(routes) to imports
1760 * Adds all resolve services as providers
1761 */
1762 FramingNgModule.prototype.route = function (route, config) {
1763 this.getOrAddRoute(route);
1764 if (this._routeConfig) {
1765 if (config) {
1766 merge(this._routeConfig, config);
1767 }
1768 }
1769 else {
1770 this._routeConfig = config || {};
1771 defaults(this._routeConfig, { forRoot: false });
1772 }
1773 return this;
1774 };
1775 FramingNgModule.prototype.routes = function (routes, config) {
1776 var _this = this;
1777 each(routes, function (route) {
1778 _this.route(route, config);
1779 });
1780 return this;
1781 };
1782 FramingNgModule.prototype.frameRoute = function (route) {
1783 var framers = [];
1784 for (var _a = 1; _a < arguments.length; _a++) {
1785 framers[_a - 1] = arguments[_a];
1786 }
1787 this.buildFramers(framers, this.getOrAddRouteOverload(route));
1788 return this;
1789 };
1790 /**
1791 * Returns the route if it exists.
1792 */
1793 FramingNgModule.prototype.getRoute = function (route, array) {
1794 if (route === void 0) { route = {}; }
1795 /* tslint:disable:no-param-reassign */
1796 if (!array) {
1797 array = this._routes;
1798 }
1799 /* tslint:enable:no-param-reassign */
1800 defaults(route, { path: '', pathMatch: FramingNgModule.defaultPathMatch });
1801 return find(array, function (m) { return m.path === route.path && m.pathMatch === route.pathMatch; });
1802 };
1803 /**
1804 * Returns the route. Creates it if it does not exist.
1805 */
1806 FramingNgModule.prototype.getOrAddRoute = function (route, array) {
1807 if (route === void 0) { route = {}; }
1808 /* tslint:disable:no-param-reassign */
1809 if (!array) {
1810 array = this._routes;
1811 }
1812 /* tslint:enable:no-param-reassign */
1813 defaults(route, { path: '', pathMatch: FramingNgModule.defaultPathMatch });
1814 var r = find(array, function (m) { return m.path === route.path && m.pathMatch === route.pathMatch; });
1815 if (r) {
1816 merge(r, route);
1817 return r;
1818 }
1819 else {
1820 array.push(route);
1821 return route;
1822 }
1823 };
1824 /**
1825 * Run framers.
1826 */
1827 FramingNgModule.prototype.frame = function () {
1828 var framers = [];
1829 for (var _a = 0; _a < arguments.length; _a++) {
1830 framers[_a] = arguments[_a];
1831 }
1832 this.buildFramers(framers);
1833 return this;
1834 };
1835 FramingNgModule.prototype.use = function () {
1836 var framers = [];
1837 for (var _a = 0; _a < arguments.length; _a++) {
1838 framers[_a] = arguments[_a];
1839 }
1840 return this.frame.apply(this, framers);
1841 };
1842 /**
1843 * Builds @NgModule() config in the following order:
1844 * - Route framers
1845 * - Root
1846 * - Route
1847 */
1848 FramingNgModule.prototype.build = function () {
1849 this.buildRouteFramers(this._routes);
1850 this.buildRoot();
1851 this.buildContainers(this._routes);
1852 this.buildRoute();
1853 this.inspectModule();
1854 return this._ngModule;
1855 };
1856 // ========================================
1857 // private methods
1858 // ========================================
1859 FramingNgModule.prototype.inspectModule = function () {
1860 var _this = this;
1861 this._routes.forEach(function (r) { return _this.inspectRoute(r); });
1862 };
1863 FramingNgModule.prototype.inspectRoute = function (route) {
1864 var _this = this;
1865 if (route.component === undefined && route.redirectTo === undefined && isEmpty(route.children) && route.loadChildren === undefined) {
1866 console.error("Looks like you have a badly configured route in a framed module.\n One of the following must be provided: component, redirectTo, children or loadChildren", { route: route, self: this });
1867 }
1868 if (route.children) {
1869 route.children.forEach(function (c) { return _this.inspectRoute(c); });
1870 }
1871 };
1872 FramingNgModule.prototype.buildRoot = function () {
1873 var m = this._ngModule;
1874 if (this._root) {
1875 m.imports = uniqWith(m.imports.concat([
1876 BrowserModule.withServerTransition({
1877 appId: 'app',
1878 }),
1879 FormsModule,
1880 ]), isEqual);
1881 m.bootstrap = uniqWith(m.bootstrap.concat([this._rootComponent]), isEqual);
1882 }
1883 else {
1884 m.imports = uniqWith(m.imports.concat([
1885 CommonModule,
1886 ]), isEqual);
1887 }
1888 m.imports = uniqWith(m.imports.concat([FramingComponentsModule]), isEqual);
1889 };
1890 FramingNgModule.prototype.buildFramers = function (framers, route) {
1891 for (var _a = 0, framers_1 = framers; _a < framers_1.length; _a++) {
1892 var framer = framers_1[_a];
1893 this.buildFramer(framer, route);
1894 }
1895 };
1896 FramingNgModule.prototype.buildFramer = function (framer, route) {
1897 if (!framer.framed) {
1898 framer.runFraming(this, route || this.getRoute());
1899 }
1900 };
1901 /**
1902 * Builds framers that were manually added to route data.
1903 */
1904 FramingNgModule.prototype.buildRouteFramers = function (routes) {
1905 for (var _a = 0, routes_1 = routes; _a < routes_1.length; _a++) {
1906 var route = routes_1[_a];
1907 if (route.data) {
1908 for (var key in route.data) {
1909 if (route.data.hasOwnProperty(key)) {
1910 var prop = route.data[key];
1911 if (prop && prop._frame !== undefined) {
1912 // this is a framer attached to route data
1913 this.buildFramer(prop, route);
1914 }
1915 }
1916 }
1917 }
1918 if (route.children) {
1919 this.buildRouteFramers(route.children);
1920 }
1921 }
1922 };
1923 FramingNgModule.prototype.buildContainers = function (routes) {
1924 var _loop_2 = function (route) {
1925 if (route.resolve && route.resolve.containers) {
1926 var containers_2 = route.resolve.containers;
1927 for (var _a = 0, containers_3 = containers_2; _a < containers_3.length; _a++) {
1928 var container = containers_3[_a];
1929 var containerId = FramingNgModule._nextId++;
1930 container.id = '' + containerId;
1931 }
1932 var resolveId = FramingNgModule._nextId++;
1933 this_2.provide({
1934 provide: 'containerResolver' + resolveId,
1935 useFactory: function (i) { return new FramingContainerOutletResolver(containers_2, i); },
1936 deps: [Injector],
1937 });
1938 route.resolve.containers = 'containerResolver' + resolveId;
1939 }
1940 if (route.children) {
1941 this_2.buildContainers(route.children);
1942 }
1943 };
1944 var this_2 = this;
1945 for (var _a = 0, routes_2 = routes; _a < routes_2.length; _a++) {
1946 var route = routes_2[_a];
1947 _loop_2(route);
1948 }
1949 };
1950 FramingNgModule.prototype.buildRoute = function () {
1951 var _this = this;
1952 if (this._routes.length > 0) {
1953 // re-order routes so that full routes are first
1954 var fullRoutes_1 = [];
1955 var prefixRoutes_1 = [];
1956 this._routes.forEach(function (route) {
1957 if (route.pathMatch && route.pathMatch === 'full') {
1958 fullRoutes_1.push(route);
1959 }
1960 else if (!route.pathMatch || route.pathMatch === 'prefix') {
1961 prefixRoutes_1.push(route);
1962 }
1963 else {
1964 console.warn('Unknown pathMatch on route', route);
1965 }
1966 _this._routes = [];
1967 _this._routes = _this._routes.concat(fullRoutes_1);
1968 _this._routes = _this._routes.concat(prefixRoutes_1);
1969 });
1970 var routing = this._root || (this._routeConfig && this._routeConfig.forRoot) ?
1971 RouterModule.forRoot(this._routes, this._routeConfig ? this._routeConfig.extraRootRouterOptions : undefined) :
1972 RouterModule.forChild(this._routes);
1973 this.imports([routing]);
1974 if (this._routeConfig && this._routeConfig.forRoot && !this._root) {
1975 this.exports([RouterModule]); // export RouterModule from AppRoutingModule
1976 }
1977 }
1978 };
1979 FramingNgModule.prototype.getOrAddRouteOverload = function (route) {
1980 if (isArray(route)) {
1981 if (route.length) {
1982 var result = void 0;
1983 /* tslint:disable:prefer-for-of */
1984 result = this.getOrAddRoute(route[0]);
1985 for (var i = 1; i < route.length; i++) {
1986 if (!result.children) {
1987 result.children = [];
1988 }
1989 result = this.getOrAddRoute(route[i], result.children);
1990 }
1991 /* tslint:enable:prefer-for-of */
1992 return result;
1993 }
1994 else {
1995 return this.getOrAddRoute();
1996 }
1997 }
1998 else {
1999 return this.getOrAddRoute(route);
2000 }
2001 };
2002 return FramingNgModule;
2003}());
2004FramingNgModule._nextId = 1;
2005/* tslint:disable:variable-name */
2006var Framing = function (ngModuleBuilder) {
2007 /* tslint:enable:variable-name */
2008 var framing = ngModuleBuilder(new FramingNgModule());
2009 if (!framing) {
2010 console.error('Framing must return a FramingNgModule');
2011 return {};
2012 }
2013 return framing.build();
2014};
2015/**
2016 * A framer with no route, model, view, controller or frame.
2017 * To be used for leveraging the frame() function only.
2018 */
2019var SimpleFramer = (function (_super) {
2020 __extends(SimpleFramer, _super);
2021 function SimpleFramer() {
2022 return _super !== null && _super.apply(this, arguments) || this;
2023 }
2024 Object.defineProperty(SimpleFramer.prototype, "framerName", {
2025 get: function () { return 'Simple'; },
2026 enumerable: true,
2027 configurable: true
2028 });
2029 Object.defineProperty(SimpleFramer.prototype, "createFrame", {
2030 get: function () { return false; },
2031 enumerable: true,
2032 configurable: true
2033 });
2034 Object.defineProperty(SimpleFramer.prototype, "routeRule", {
2035 get: function () { return 'none'; },
2036 enumerable: true,
2037 configurable: true
2038 });
2039 return SimpleFramer;
2040}(Framer));
2041export { FramingDevToolsComponent, FramingDevToolsController, FramingDevToolsFeature, Action, _createReduxDevtoolsExtension, FramingComponentOutletDirective, FramingComponentOutletModule, FramingContainerOutletDirective, FramingContainerOutletModule, FramingContainerOutletResolver, FramingContainerOutletService, FramingEmptyParentComponent, FramingComponentsModule, FramingRootComponent, Component$1 as Component, Controller, FramingTools, Frame, FramerHelper, Framer, FramingNgModule, Framing, SimpleFramer };
2042//# sourceMappingURL=ng-core.es5.js.map