@coolon/angular-ui-powerups 0.0.97 → 0.0.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +99 -241
  2. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  3. package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  5. package/coolon-angular-ui-powerups.metadata.json +1 -1
  6. package/esm2015/coolon-angular-ui-powerups.js +2 -2
  7. package/esm2015/index.js +2 -2
  8. package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +2 -2
  9. package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +6 -5
  10. package/esm2015/lib/place/guards/navigation-state.js +613 -0
  11. package/esm2015/lib/place/guards/place-component-deactivation-handler.js +14 -37
  12. package/esm2015/lib/place/index.js +2 -2
  13. package/esm2015/lib/place/place-router.js +11 -54
  14. package/esm2015/public_api.js +2 -2
  15. package/esm5/coolon-angular-ui-powerups.js +2 -2
  16. package/esm5/index.js +2 -2
  17. package/esm5/lib/interaction/components/activity-container/activity-container.component.js +2 -2
  18. package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +6 -5
  19. package/esm5/lib/place/guards/navigation-state.js +764 -0
  20. package/esm5/lib/place/guards/place-component-deactivation-handler.js +21 -55
  21. package/esm5/lib/place/index.js +2 -2
  22. package/esm5/lib/place/place-router.js +12 -144
  23. package/esm5/public_api.js +2 -2
  24. package/fesm2015/coolon-angular-ui-powerups.js +80 -122
  25. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  26. package/fesm5/coolon-angular-ui-powerups.js +101 -243
  27. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  28. package/lib/interaction/components/activity-container/activity-container.component.d.ts +1 -1
  29. package/lib/place/guards/{navigation-session.d.ts → navigation-state.d.ts} +34 -34
  30. package/lib/place/guards/place-component-deactivation-handler.d.ts +3 -5
  31. package/lib/place/index.d.ts +1 -1
  32. package/lib/place/place-router.d.ts +4 -4
  33. package/package.json +1 -1
  34. package/esm2015/lib/place/guards/navigation-session.js +0 -590
  35. package/esm5/lib/place/guards/navigation-session.js +0 -741
@@ -7,7 +7,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7
7
  import { __extends, __decorate, __metadata, __awaiter, __generator, __assign, __spread } from 'tslib';
8
8
  import { DelegatingValueModel, assert, UnaryCommand, lang, Dsl, GarbageCollector, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, EventListenerList, DelegatingListModel, Deferred, MutableStream, MutableValueModel, MutableListModel, Binding, Trace, Guard as Guard$1, StoreInValueModel, Command, OptionsHelper, ValueHolder } from '@coolon/pectin';
9
9
  import { PortalModule } from '@angular/cdk/portal';
10
- import { RouterModule, NavigationStart, NavigationCancel, NavigationEnd, UrlSegment, NavigationError, Router, UrlSerializer, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
10
+ import { RouterModule, NavigationStart, NavigationCancel, NavigationError, NavigationEnd, UrlSegment, Router, UrlSerializer, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
11
11
  import ___default, { last, isNil, isEqual } from 'lodash';
12
12
  import { assert as assert$1, Opts, Klass } from '@coolon/typescript-utilities';
13
13
  import { MatDialogConfig, MatDialog as MatDialog$1, MAT_DIALOG_DEFAULT_OPTIONS } from '@angular/material/dialog';
@@ -2001,7 +2001,7 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
2001
2001
  * @return {?}
2002
2002
  */
2003
2003
  function () {
2004
- this._initialActivityOutletContext = null;
2004
+ this._initialActivityOutletContext.value = null;
2005
2005
  this.initialActivityOutletContextEvent.emit(null);
2006
2006
  };
2007
2007
  // @Trace()
@@ -2178,8 +2178,7 @@ var InplaceInteractionContextComponent = /** @class */ (function (_super) {
2178
2178
  __extends(InplaceInteractionContextComponent, _super);
2179
2179
  function InplaceInteractionContextComponent() {
2180
2180
  var _this = _super.call(this) || this;
2181
- _this._active = new DelegatingValueModel().withDefault(false);
2182
- var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
2181
+ _this._active = new MutableValueModel(false);
2183
2182
  return _this;
2184
2183
  }
2185
2184
  /**
@@ -2190,7 +2189,6 @@ var InplaceInteractionContextComponent = /** @class */ (function (_super) {
2190
2189
  */
2191
2190
  function () {
2192
2191
  this.setActivityList(this.interactionContext.activityList);
2193
- this._active.setDelegate(this.interactionContext.active);
2194
2192
  };
2195
2193
  Object.defineProperty(InplaceInteractionContextComponent.prototype, "active", {
2196
2194
  get: /**
@@ -2218,6 +2216,7 @@ var InplaceInteractionContextComponent = /** @class */ (function (_super) {
2218
2216
  */
2219
2217
  function (activityType, data) {
2220
2218
  var _this = this;
2219
+ this._active.value = true;
2221
2220
  /** @type {?} */
2222
2221
  var self = this;
2223
2222
  return new Promise((/**
@@ -2234,6 +2233,7 @@ var InplaceInteractionContextComponent = /** @class */ (function (_super) {
2234
2233
  * @return {?}
2235
2234
  */
2236
2235
  function (result) {
2236
+ self._active.value = false;
2237
2237
  resolve(result);
2238
2238
  },
2239
2239
  onCancel: /**
@@ -2241,6 +2241,7 @@ var InplaceInteractionContextComponent = /** @class */ (function (_super) {
2241
2241
  * @return {?}
2242
2242
  */
2243
2243
  function (error) {
2244
+ self._active.value = false;
2244
2245
  reject(error);
2245
2246
  }
2246
2247
  };
@@ -3831,67 +3832,33 @@ var PlaceComponentDeactivationHandler = /** @class */ (function () {
3831
3832
  * @return {?}
3832
3833
  */
3833
3834
  function (nextState) {
3834
- return __awaiter(this, void 0, void 0, function () {
3835
- return __generator(this, function (_a) {
3836
- // Automatically cancel any active activities if the navigation session was triggered
3837
- // by the back button.
3838
- if (this.navigationSession.isPopState && this.component.interactionContext && this.component.interactionContext.isActive()) {
3839
- // Note: any modal interactions run in a different router outlet so we should never get place deactivated while
3840
- // one is active. This is because:
3841
- // 1. the user can't click anything to navigate away
3842
- // 2. clicking the back button will only change the outlet route and will leave the component route alone. This
3843
- // is all handled by the InteractionGuard and so the component guards will never run.
3844
- // TODO: how will I handle this now??
3845
- // BUT: activities could call navigate while they're still active.. but we'll barf and tell them
3846
- // to call activity.done(newVisitToNavigateTo) and let the caller do the navigate after the
3847
- // dialog has closed.
3848
- // Can I capture this in placeRouter.navigate(..) ? i.e. navigationSession && navigationSession.interactionContext.isActive()
3849
- // Or can I just ignore it altogether?
3850
- // 1. I no longer have a singleton dialog interaction that can be returned from any component in the deactivation cycle.
3851
- // 2. We only ever check the component once per nav cycle
3852
- // 3. The navigation session interaction context will barf if multiple components try and use it at once.
3853
- // if (this.component.interactionContext instanceof DialogInteractionContext) {
3854
- // // BUT: activities could call navigate while they're still active.. but we'll barf and tell them
3855
- // // to call activity.done(newVisitToNavigateTo) and let the caller do the navigate after the
3856
- // // dialog has closed.
3857
- // lang.illegalState('Navigation started from an activity in a modal dialog. Have your activity return a Visit instead and navigate after the activity has finished');
3858
- // }
3859
- // Now we just cancel the current activity and stay where we are
3860
- this.cancelCurrentActivityOf(this.component.interactionContext);
3861
- return [2 /*return*/, false];
3862
- }
3863
- // Ok, so now we're really leaving, so we ask the component if we should.;
3864
- if (this.isNotJustAChangeInRouteId(nextState) && this.component.canDeactivate) {
3865
- // No interaction in progress, so ask the component .
3866
- // This may start an interaction, hence checking the interaction context before now. I.e. if the place pops up the dialog, and
3867
- // the user clicks back again, we'll re-enter here and go bang when the component tries to open another dialog.
3868
- return [2 /*return*/, this.component.canDeactivate(this.navigationSession.interactionContext)];
3869
- }
3870
- return [2 /*return*/, true];
3871
- });
3872
- });
3873
- };
3874
- /**
3875
- * @protected
3876
- * @param {?} interactionContext
3877
- * @return {?}
3878
- */
3879
- PlaceComponentDeactivationHandler.prototype.cancelCurrentActivityOf = /**
3880
- * @protected
3881
- * @param {?} interactionContext
3882
- * @return {?}
3883
- */
3884
- function (interactionContext) {
3885
3835
  return __awaiter(this, void 0, void 0, function () {
3886
3836
  var activity;
3887
3837
  return __generator(this, function (_a) {
3888
3838
  switch (_a.label) {
3889
- case 0: return [4 /*yield*/, interactionContext.getCurrentActivity()];
3839
+ case 0:
3840
+ if (!(this.navigationSession.isPopState && this.component.interactionContext && this.component.interactionContext.isActive())) return [3 /*break*/, 2];
3841
+ // Note: Modal interactions are run in a different router outlet so we never get place deactivating while
3842
+ // a model interaction is active. This is because:
3843
+ // 1. the user can't click anything to navigate away
3844
+ // 2. clicking the back button will only change the outlet route portion of the URL. This
3845
+ // is all handled by the InteractionGuard and so the component guards will never run.
3846
+ //
3847
+ // Now we just cancel the current activity...
3848
+ return [4 /*yield*/, this.component.interactionContext.getCurrentActivity()];
3890
3849
  case 1:
3891
3850
  activity = _a.sent();
3892
- console.log('cancelling', { activity: activity });
3893
3851
  activity.cancel(null);
3894
- return [2 /*return*/];
3852
+ return [2 /*return*/, false]; // ..and stay where we are.
3853
+ case 2:
3854
+ // Ok, so now we're really leaving, so we ask the component if we should.;
3855
+ if (this.isNotJustAChangeInRouteId(nextState) && this.component.canDeactivate) {
3856
+ // No interaction in progress, so ask the component .
3857
+ // This may start an interaction, hence checking the interaction context before now. I.e. if the place pops up the dialog, and
3858
+ // the user clicks back again, we'll re-enter here and go bang when the component tries to open another dialog.
3859
+ return [2 /*return*/, this.component.canDeactivate(this.navigationSession.interactionContext)];
3860
+ }
3861
+ return [2 /*return*/, true];
3895
3862
  }
3896
3863
  });
3897
3864
  });
@@ -3933,15 +3900,15 @@ if (false) {
3933
3900
  /**
3934
3901
  * @abstract
3935
3902
  */
3936
- var NavigationSession = /** @class */ (function (_super) {
3937
- __extends(NavigationSession, _super);
3938
- function NavigationSession(context) {
3903
+ var NavigationState = /** @class */ (function (_super) {
3904
+ __extends(NavigationState, _super);
3905
+ function NavigationState(context) {
3939
3906
  var _this = _super.call(this) || this;
3940
3907
  _this.context = context;
3941
3908
  _this._visits = new Map();
3942
3909
  return _this;
3943
3910
  }
3944
- Object.defineProperty(NavigationSession.prototype, "interactionContext", {
3911
+ Object.defineProperty(NavigationState.prototype, "interactionContext", {
3945
3912
  get: /**
3946
3913
  * @return {?}
3947
3914
  */
@@ -3955,7 +3922,7 @@ var NavigationSession = /** @class */ (function (_super) {
3955
3922
  * @param {?} visit
3956
3923
  * @return {?}
3957
3924
  */
3958
- NavigationSession.prototype.storeVisit = /**
3925
+ NavigationState.prototype.storeVisit = /**
3959
3926
  * @param {?} visit
3960
3927
  * @return {?}
3961
3928
  */
@@ -3966,7 +3933,7 @@ var NavigationSession = /** @class */ (function (_super) {
3966
3933
  * @param {?} placeDef
3967
3934
  * @return {?}
3968
3935
  */
3969
- NavigationSession.prototype.getVisitFor = /**
3936
+ NavigationState.prototype.getVisitFor = /**
3970
3937
  * @param {?} placeDef
3971
3938
  * @return {?}
3972
3939
  */
@@ -3977,7 +3944,7 @@ var NavigationSession = /** @class */ (function (_super) {
3977
3944
  * @param {?} newUrl
3978
3945
  * @return {?}
3979
3946
  */
3980
- NavigationSession.prototype.onBackClickedDuringNavigationInteraction = /**
3947
+ NavigationState.prototype.onBackClickedDuringNavigationInteraction = /**
3981
3948
  * @param {?} newUrl
3982
3949
  * @return {?}
3983
3950
  */
@@ -3987,7 +3954,7 @@ var NavigationSession = /** @class */ (function (_super) {
3987
3954
  /**
3988
3955
  * @return {?}
3989
3956
  */
3990
- NavigationSession.prototype.getVisits = /**
3957
+ NavigationState.prototype.getVisits = /**
3991
3958
  * @return {?}
3992
3959
  */
3993
3960
  function () {
@@ -3999,7 +3966,7 @@ var NavigationSession = /** @class */ (function (_super) {
3999
3966
  * @param {?} message
4000
3967
  * @return {?}
4001
3968
  */
4002
- NavigationSession.prototype.illegalTransition = /**
3969
+ NavigationState.prototype.illegalTransition = /**
4003
3970
  * @protected
4004
3971
  * @template R
4005
3972
  * @param {?} message
@@ -4012,7 +3979,7 @@ var NavigationSession = /** @class */ (function (_super) {
4012
3979
  * @protected
4013
3980
  * @return {?}
4014
3981
  */
4015
- NavigationSession.prototype.currentRouterUrl = /**
3982
+ NavigationState.prototype.currentRouterUrl = /**
4016
3983
  * @protected
4017
3984
  * @return {?}
4018
3985
  */
@@ -4024,21 +3991,21 @@ var NavigationSession = /** @class */ (function (_super) {
4024
3991
  * @param {?} event
4025
3992
  * @return {?}
4026
3993
  */
4027
- NavigationSession.prototype.createActiveSession = /**
3994
+ NavigationState.prototype.createActiveSession = /**
4028
3995
  * @protected
4029
3996
  * @param {?} event
4030
3997
  * @return {?}
4031
3998
  */
4032
3999
  function (event) {
4033
4000
  // TODO: check if the event is purely for interaction context changes.
4034
- return new NavigationSession.Active(this.context, event.navigationTrigger === 'popstate', this.currentRouterUrl());
4001
+ return new NavigationState.Active(this.context, event.navigationTrigger === 'popstate', this.currentRouterUrl());
4035
4002
  };
4036
4003
  /**
4037
4004
  * @protected
4038
4005
  * @param {?} url
4039
4006
  * @return {?}
4040
4007
  */
4041
- NavigationSession.prototype.updateLocation = /**
4008
+ NavigationState.prototype.updateLocation = /**
4042
4009
  * @protected
4043
4010
  * @param {?} url
4044
4011
  * @return {?}
@@ -4049,7 +4016,7 @@ var NavigationSession = /** @class */ (function (_super) {
4049
4016
  /**
4050
4017
  * @return {?}
4051
4018
  */
4052
- NavigationSession.prototype.toString = /**
4019
+ NavigationState.prototype.toString = /**
4053
4020
  * @return {?}
4054
4021
  */
4055
4022
  function () {
@@ -4060,59 +4027,59 @@ var NavigationSession = /** @class */ (function (_super) {
4060
4027
  __metadata("design:type", Function),
4061
4028
  __metadata("design:paramtypes", [Object]),
4062
4029
  __metadata("design:returntype", void 0)
4063
- ], NavigationSession.prototype, "updateLocation", null);
4064
- return NavigationSession;
4030
+ ], NavigationState.prototype, "updateLocation", null);
4031
+ return NavigationState;
4065
4032
  }(GarbageCollector));
4066
4033
  if (false) {
4067
4034
  /**
4068
4035
  * @type {?}
4069
4036
  * @private
4070
4037
  */
4071
- NavigationSession.prototype._visits;
4038
+ NavigationState.prototype._visits;
4072
4039
  /** @type {?} */
4073
- NavigationSession.prototype.isPopState;
4040
+ NavigationState.prototype.isPopState;
4074
4041
  /** @type {?} */
4075
- NavigationSession.prototype.active;
4042
+ NavigationState.prototype.active;
4076
4043
  /** @type {?} */
4077
- NavigationSession.prototype.startingUrl;
4044
+ NavigationState.prototype.startingUrl;
4078
4045
  /**
4079
4046
  * @type {?}
4080
4047
  * @protected
4081
4048
  */
4082
- NavigationSession.prototype.context;
4049
+ NavigationState.prototype.context;
4083
4050
  /**
4084
4051
  * @abstract
4085
4052
  * @param {?} event
4086
4053
  * @return {?}
4087
4054
  */
4088
- NavigationSession.prototype.onStart = function (event) { };
4055
+ NavigationState.prototype.onStart = function (event) { };
4089
4056
  /**
4090
4057
  * @abstract
4091
4058
  * @param {?} event
4092
4059
  * @return {?}
4093
4060
  */
4094
- NavigationSession.prototype.onCancel = function (event) { };
4061
+ NavigationState.prototype.onCancel = function (event) { };
4095
4062
  /**
4096
4063
  * @abstract
4097
4064
  * @param {?} event
4098
4065
  * @return {?}
4099
4066
  */
4100
- NavigationSession.prototype.onError = function (event) { };
4067
+ NavigationState.prototype.onError = function (event) { };
4101
4068
  /**
4102
4069
  * @abstract
4103
4070
  * @param {?} event
4104
4071
  * @return {?}
4105
4072
  */
4106
- NavigationSession.prototype.onEnd = function (event) { };
4073
+ NavigationState.prototype.onEnd = function (event) { };
4107
4074
  /**
4108
4075
  * @abstract
4109
4076
  * @param {?} component
4110
4077
  * @param {?} nextState
4111
4078
  * @return {?}
4112
4079
  */
4113
- NavigationSession.prototype.canDeactivatePlace = function (component, nextState) { };
4080
+ NavigationState.prototype.canDeactivatePlace = function (component, nextState) { };
4114
4081
  }
4115
- (function (NavigationSession) {
4082
+ (function (NavigationState) {
4116
4083
  var Context = /** @class */ (function () {
4117
4084
  function Context(router, modalInteractionService, angularLocation, notifySuccess) {
4118
4085
  this.router = router;
@@ -4122,7 +4089,7 @@ if (false) {
4122
4089
  }
4123
4090
  return Context;
4124
4091
  }());
4125
- NavigationSession.Context = Context;
4092
+ NavigationState.Context = Context;
4126
4093
  if (false) {
4127
4094
  /** @type {?} */
4128
4095
  Context.prototype.router;
@@ -4212,8 +4179,8 @@ if (false) {
4212
4179
  return this.illegalTransition(event);
4213
4180
  };
4214
4181
  return Idle;
4215
- }(NavigationSession));
4216
- NavigationSession.Idle = Idle;
4182
+ }(NavigationState));
4183
+ NavigationState.Idle = Idle;
4217
4184
  if (false) {
4218
4185
  /** @type {?} */
4219
4186
  Idle.prototype.isPopState;
@@ -4289,8 +4256,13 @@ if (false) {
4289
4256
  * @return {?}
4290
4257
  */
4291
4258
  function (event) {
4292
- // active sessions can have many cancel start cycles.
4293
- return this;
4259
+ if (this.isPopState) { // back button clicked and a guard cancelled
4260
+ // Angular doesn't preserve the url when a guard cancels the back button.
4261
+ // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
4262
+ Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
4263
+ this.updateLocation(this.startingUrl);
4264
+ }
4265
+ return this.isPopState ? new Idle(this.context) : this;
4294
4266
  };
4295
4267
  /**
4296
4268
  * @param {?} event
@@ -4391,9 +4363,27 @@ if (false) {
4391
4363
  function () {
4392
4364
  return this.constructor.name + "(startingUrl: " + this.startingUrl + ", isPopState:" + this.isPopState + ")";
4393
4365
  };
4366
+ __decorate([
4367
+ Trace(),
4368
+ __metadata("design:type", Function),
4369
+ __metadata("design:paramtypes", [NavigationStart]),
4370
+ __metadata("design:returntype", NavigationState)
4371
+ ], Active.prototype, "onStart", null);
4372
+ __decorate([
4373
+ Trace(),
4374
+ __metadata("design:type", Function),
4375
+ __metadata("design:paramtypes", [NavigationCancel]),
4376
+ __metadata("design:returntype", NavigationState)
4377
+ ], Active.prototype, "onCancel", null);
4378
+ __decorate([
4379
+ Trace(),
4380
+ __metadata("design:type", Function),
4381
+ __metadata("design:paramtypes", [NavigationError]),
4382
+ __metadata("design:returntype", NavigationState)
4383
+ ], Active.prototype, "onError", null);
4394
4384
  return Active;
4395
- }(NavigationSession));
4396
- NavigationSession.Active = Active;
4385
+ }(NavigationState));
4386
+ NavigationState.Active = Active;
4397
4387
  if (false) {
4398
4388
  /** @type {?} */
4399
4389
  Active.prototype.active;
@@ -4514,23 +4504,23 @@ if (false) {
4514
4504
  Trace(),
4515
4505
  __metadata("design:type", Function),
4516
4506
  __metadata("design:paramtypes", [NavigationStart]),
4517
- __metadata("design:returntype", NavigationSession)
4507
+ __metadata("design:returntype", NavigationState)
4518
4508
  ], ModalInteractionSession.prototype, "onStart", null);
4519
4509
  __decorate([
4520
4510
  Trace(),
4521
4511
  __metadata("design:type", Function),
4522
4512
  __metadata("design:paramtypes", [NavigationCancel]),
4523
- __metadata("design:returntype", NavigationSession)
4513
+ __metadata("design:returntype", NavigationState)
4524
4514
  ], ModalInteractionSession.prototype, "onCancel", null);
4525
4515
  __decorate([
4526
4516
  Trace(),
4527
4517
  __metadata("design:type", Function),
4528
4518
  __metadata("design:paramtypes", [NavigationEnd]),
4529
- __metadata("design:returntype", NavigationSession)
4519
+ __metadata("design:returntype", NavigationState)
4530
4520
  ], ModalInteractionSession.prototype, "onEnd", null);
4531
4521
  return ModalInteractionSession;
4532
- }(NavigationSession));
4533
- NavigationSession.ModalInteractionSession = ModalInteractionSession;
4522
+ }(NavigationState));
4523
+ NavigationState.ModalInteractionSession = ModalInteractionSession;
4534
4524
  if (false) {
4535
4525
  /** @type {?} */
4536
4526
  ModalInteractionSession.prototype.active;
@@ -4643,8 +4633,8 @@ if (false) {
4643
4633
  return this.constructor.name + "(startingUrl: " + this.startingUrl + ", locationChangeTriggerUrl:" + this.locationChangeTriggerUrl + ")";
4644
4634
  };
4645
4635
  return CancelledDuringNavigationInteraction;
4646
- }(NavigationSession));
4647
- NavigationSession.CancelledDuringNavigationInteraction = CancelledDuringNavigationInteraction;
4636
+ }(NavigationState));
4637
+ NavigationState.CancelledDuringNavigationInteraction = CancelledDuringNavigationInteraction;
4648
4638
  if (false) {
4649
4639
  /** @type {?} */
4650
4640
  CancelledDuringNavigationInteraction.prototype.active;
@@ -4660,7 +4650,7 @@ if (false) {
4660
4650
  /** @type {?} */
4661
4651
  CancelledDuringNavigationInteraction.prototype.locationChangeTriggerUrl;
4662
4652
  }
4663
- })(NavigationSession || (NavigationSession = {}));
4653
+ })(NavigationState || (NavigationState = {}));
4664
4654
 
4665
4655
  /**
4666
4656
  * @fileoverview added by tsickle
@@ -4878,14 +4868,14 @@ var PlaceRouter = /** @class */ (function (_super) {
4878
4868
  var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
4879
4869
  _this.activeVisitIndex = chain(_this._activeVisits).indexBy('placeDefinition');
4880
4870
  _this.navigationSessionActive = chain(_this.navigationSessionModel).pluck('active');
4881
- _this._navigationSessionContext = new NavigationSession.Context(_this.router, _this.modalInteractionService, _this.angularLocation, (/**
4871
+ _this._navigationSessionContext = new NavigationState.Context(_this.router, _this.modalInteractionService, _this.angularLocation, (/**
4882
4872
  * @param {?} session
4883
4873
  * @return {?}
4884
4874
  */
4885
4875
  function (session) {
4886
4876
  _this.processNavigationSuccess(session);
4887
4877
  }));
4888
- _this._navigationSessionModel.value = new NavigationSession.Idle(_this._navigationSessionContext);
4878
+ _this._navigationSessionModel.value = new NavigationState.Idle(_this._navigationSessionContext);
4889
4879
  // TODO: make setup the callbacks in during module initiation to make this testable.
4890
4880
  _this.router.events.subscribe((/**
4891
4881
  * @param {?} event
@@ -4936,7 +4926,7 @@ var PlaceRouter = /** @class */ (function (_super) {
4936
4926
  * @return {?}
4937
4927
  */
4938
4928
  function (url) {
4939
- console.log("#### url changed -> " + url);
4929
+ console.log("#### url changed ->", { url: url, navIsActive: _this.navigationSessionActive.value });
4940
4930
  /** @type {?} */
4941
4931
  var interactionContext = _this.navigationSessionActive.value && _this.navigationSession.interactionContext;
4942
4932
  if (interactionContext && interactionContext.isActive()) {
@@ -4962,6 +4952,9 @@ var PlaceRouter = /** @class */ (function (_super) {
4962
4952
  */
4963
4953
  function (session) {
4964
4954
  var _this = this;
4955
+ // We need to update the visits before the session finishes. This allows the placeOutets to ignore visit
4956
+ // changes that occur while routerNavigationActive is true.
4957
+ assert.isTruthy(this.navigationSessionActive.value);
4965
4958
  /** @type {?} */
4966
4959
  var visits = session.getVisits();
4967
4960
  visits.forEach((/**
@@ -4969,8 +4962,6 @@ var PlaceRouter = /** @class */ (function (_super) {
4969
4962
  * @return {?}
4970
4963
  */
4971
4964
  function (v) { return _this.placeHistory.add(v); }));
4972
- // Update visits before we end the navigation session. This allows the placeOutets to
4973
- // ignore visit changes that occur while the navigation is in progress
4974
4965
  this._activeVisits.value = visits;
4975
4966
  };
4976
4967
  Object.defineProperty(PlaceRouter.prototype, "navigationSession", {
@@ -5113,7 +5104,7 @@ var PlaceRouter = /** @class */ (function (_super) {
5113
5104
  */
5114
5105
  function (current) {
5115
5106
  /** @type {?} */
5116
- var session = new NavigationSession.Active(_this._navigationSessionContext, false, _this.router.routerState.snapshot.url);
5107
+ var session = new NavigationState.Active(_this._navigationSessionContext, false, _this.router.routerState.snapshot.url);
5117
5108
  session.storeVisit(visit);
5118
5109
  return session;
5119
5110
  }));
@@ -5178,144 +5169,11 @@ var PlaceRouter = /** @class */ (function (_super) {
5178
5169
  [def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :
5179
5170
  [def.getFormattedRouteParameters(visit)];
5180
5171
  };
5181
- // private onAngularRouterStarted(event: NavigationStart) {
5182
- // if (!this.navigationSession) {
5183
- // // We been activated by an external route rather than placeRouter.go(visit)
5184
- // this._navigationSessionModel.value = this.createExternalNavigationSession(event);
5185
- // }
5186
- // this.firstRoute = false;
5187
- // }
5188
- //
5189
- // private createExternalNavigationSession(event: NavigationStart) {
5190
- // return new NavigationSession.Active(
5191
- // this.modalInteractionService,
5192
- // this.angularLocation,
5193
- // // event.url,
5194
- // event.navigationTrigger === 'popstate'
5195
- // );
5196
- // }
5197
- // private onAngularRouterFinished(cancelled: boolean) {
5198
- // const session = this._navigationSessionModel.value;
5199
- // if (session.backClickedDuringCanDeactivateInteraction) {
5200
- // // we swallow this finished event but keep the session alive as we're going to
5201
- // // get another route started event, which will trigger anohter canDeactivate dialog
5202
- // // if we start a new session.
5203
- // // session.resetInteractionSession()
5204
- // } else {
5205
- // if (!cancelled) {
5206
- // const visits = session.getVisits();
5207
- // visits.forEach(v => this.placeHistory.add(v));
5208
- // // Update visits before we end the navigation session. This allows the placeOutets to
5209
- // // ignore visit changes that occur while the navigation is in progress
5210
- // this._activeVisits.value = visits;
5211
- // } else {
5212
- // // TODO: move this to the navigation session
5213
- // // Angular doesn't preserve the url when a guard cancels the back button.
5214
- // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
5215
- // // session.rememberPopStateReturnUrl(this.router.routerState.snapshot.url);
5216
- // if (session.isPopState) {
5217
- // console.log('cancelled during popstate');
5218
- // // this.angularLocation.go(session.previousUrl);
5219
- // }
5220
- // }
5221
- // session.dispose();
5222
- // this._navigationSessionModel.value = null;
5223
- // }
5224
- // }
5225
- // private onAngularRouterStarted(event: NavigationStart) {
5226
- // if (!this.navigationSession) {
5227
- // // We been activated by an external route rather than placeRouter.go(visit)
5228
- // this._navigationSessionModel.value = this.createExternalNavigationSession(event);
5229
- // }
5230
- // this.firstRoute = false;
5231
- // }
5232
- //
5233
- // private createExternalNavigationSession(event: NavigationStart) {
5234
- // return new NavigationSession.Active(
5235
- // this.modalInteractionService,
5236
- // this.angularLocation,
5237
- // // event.url,
5238
- // event.navigationTrigger === 'popstate'
5239
- // );
5240
- // }
5241
- // private onAngularRouterFinished(cancelled: boolean) {
5242
- // const session = this._navigationSessionModel.value;
5243
- // if (session.backClickedDuringCanDeactivateInteraction) {
5244
- // // we swallow this finished event but keep the session alive as we're going to
5245
- // // get another route started event, which will trigger anohter canDeactivate dialog
5246
- // // if we start a new session.
5247
- // // session.resetInteractionSession()
5248
- // } else {
5249
- // if (!cancelled) {
5250
- // const visits = session.getVisits();
5251
- // visits.forEach(v => this.placeHistory.add(v));
5252
- // // Update visits before we end the navigation session. This allows the placeOutets to
5253
- // // ignore visit changes that occur while the navigation is in progress
5254
- // this._activeVisits.value = visits;
5255
- // } else {
5256
- // // TODO: move this to the navigation session
5257
- // // Angular doesn't preserve the url when a guard cancels the back button.
5258
- // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
5259
- // // session.rememberPopStateReturnUrl(this.router.routerState.snapshot.url);
5260
- // if (session.isPopState) {
5261
- // console.log('cancelled during popstate');
5262
- // // this.angularLocation.go(session.previousUrl);
5263
- // }
5264
- // }
5265
- // session.dispose();
5266
- // this._navigationSessionModel.value = null;
5267
- // }
5268
- // }
5269
5172
  /**
5270
5173
  * @param {?} activatedRoute
5271
5174
  * @return {?}
5272
5175
  */
5273
- PlaceRouter.prototype.extractChildPath =
5274
- // private onAngularRouterStarted(event: NavigationStart) {
5275
- // if (!this.navigationSession) {
5276
- // // We been activated by an external route rather than placeRouter.go(visit)
5277
- // this._navigationSessionModel.value = this.createExternalNavigationSession(event);
5278
- // }
5279
- // this.firstRoute = false;
5280
- // }
5281
- //
5282
- // private createExternalNavigationSession(event: NavigationStart) {
5283
- // return new NavigationSession.Active(
5284
- // this.modalInteractionService,
5285
- // this.angularLocation,
5286
- // // event.url,
5287
- // event.navigationTrigger === 'popstate'
5288
- // );
5289
- // }
5290
- // private onAngularRouterFinished(cancelled: boolean) {
5291
- // const session = this._navigationSessionModel.value;
5292
- // if (session.backClickedDuringCanDeactivateInteraction) {
5293
- // // we swallow this finished event but keep the session alive as we're going to
5294
- // // get another route started event, which will trigger anohter canDeactivate dialog
5295
- // // if we start a new session.
5296
- // // session.resetInteractionSession()
5297
- // } else {
5298
- // if (!cancelled) {
5299
- // const visits = session.getVisits();
5300
- // visits.forEach(v => this.placeHistory.add(v));
5301
- // // Update visits before we end the navigation session. This allows the placeOutets to
5302
- // // ignore visit changes that occur while the navigation is in progress
5303
- // this._activeVisits.value = visits;
5304
- // } else {
5305
- // // TODO: move this to the navigation session
5306
- // // Angular doesn't preserve the url when a guard cancels the back button.
5307
- // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
5308
- // // session.rememberPopStateReturnUrl(this.router.routerState.snapshot.url);
5309
- // if (session.isPopState) {
5310
- // console.log('cancelled during popstate');
5311
- // // this.angularLocation.go(session.previousUrl);
5312
- // }
5313
- // }
5314
- // session.dispose();
5315
- // this._navigationSessionModel.value = null;
5316
- // }
5317
- // }
5318
- /**
5176
+ PlaceRouter.prototype.extractChildPath = /**
5319
5177
  * @param {?} activatedRoute
5320
5178
  * @return {?}
5321
5179
  */
@@ -5443,7 +5301,7 @@ if (false) {
5443
5301
  ,
5444
5302
  _a)
5445
5303
  }], {
5446
- replaceUrl: false,
5304
+ replaceUrl: false
5447
5305
  });
5448
5306
  }
5449
5307
  };
@@ -7654,5 +7512,5 @@ if (false) {
7654
7512
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7655
7513
  */
7656
7514
 
7657
- export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractActivity, AbstractInputComponent, AbstractPlaceGuard, AbstractPlaceNavigationComponent, Activity, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, ConsolidatedParameterMap, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionContext, DialogInteractionService, Dimension, DirectivesModule, DisposableComponent, EmptyStateComponent, FocusBindingDirective, Formatter, InplaceInteractionContextComponent, InteractionContext, InteractionContextBase, InteractionGuard, InteractionModule, InteractionOutletComponent, LEFT_RIGHT_PLACE_ANIMATION, ListPlaceNavComponent, ModalInteractionService, NavigationSession, NoopAuthGuard, NoopComponent, NumberInputComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceComponentDeactivationHandler, PlaceDefinition, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, UrlSnapshot, Visit, VisitParameter, VisitParameterList, VisitSanitiser, leftRightPlaceAnimation, slideDownAndUpAnimation, DirectivesModule as ɵa, CommandDirective as ɵb, ActivityContainerComponent as ɵba, InteractionContextBase as ɵbb, InteractionContext as ɵbc, ActivityOutletComponent as ɵbd, ConfirmationDialogComponent as ɵbe, AbstractActivity as ɵbf, ACTIVITY_DATA as ɵbg, Activity as ɵbh, ConfirmThenDialogComponent as ɵbj, AlertDialogComponent as ɵbk, InteractionOutletComponent as ɵbm, InplaceInteractionContextComponent as ɵbn, DIALOG_INTERACTION_SERVICE_DEFAULTS as ɵbo, DialogInteractionService as ɵbp, FocusBindingDirective as ɵc, DisposableComponent as ɵd, ComponentsModule as ɵe, NumberInputComponent as ɵf, AbstractInputComponent as ɵg, StringInputComponent as ɵh, PasswordInputComponent as ɵi, SelectInputComponent as ɵj, NoopComponent as ɵk, PlaceModule as ɵl, EmptyStateComponent as ɵm, BusyOverlayComponent as ɵn, PlaceOutletComponent as ɵo, leftRightPlaceAnimation as ɵp, LEFT_RIGHT_PLACE_ANIMATION as ɵq, AUP_PLACE_CONFIG as ɵr, PlaceRouter as ɵt, PlaceHistory as ɵu, ModalInteractionService as ɵv, TabbedPlaceNavigationComponent as ɵw, AbstractPlaceNavigationComponent as ɵx, ListPlaceNavComponent as ɵy, InteractionModule as ɵz };
7515
+ export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractActivity, AbstractInputComponent, AbstractPlaceGuard, AbstractPlaceNavigationComponent, Activity, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, ConsolidatedParameterMap, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionContext, DialogInteractionService, Dimension, DirectivesModule, DisposableComponent, EmptyStateComponent, FocusBindingDirective, Formatter, InplaceInteractionContextComponent, InteractionContext, InteractionContextBase, InteractionGuard, InteractionModule, InteractionOutletComponent, LEFT_RIGHT_PLACE_ANIMATION, ListPlaceNavComponent, ModalInteractionService, NavigationState, NoopAuthGuard, NoopComponent, NumberInputComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceComponentDeactivationHandler, PlaceDefinition, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, UrlSnapshot, Visit, VisitParameter, VisitParameterList, VisitSanitiser, leftRightPlaceAnimation, slideDownAndUpAnimation, DirectivesModule as ɵa, CommandDirective as ɵb, ActivityContainerComponent as ɵba, InteractionContextBase as ɵbb, InteractionContext as ɵbc, ActivityOutletComponent as ɵbd, ConfirmationDialogComponent as ɵbe, AbstractActivity as ɵbf, ACTIVITY_DATA as ɵbg, Activity as ɵbh, ConfirmThenDialogComponent as ɵbj, AlertDialogComponent as ɵbk, InteractionOutletComponent as ɵbm, InplaceInteractionContextComponent as ɵbn, DIALOG_INTERACTION_SERVICE_DEFAULTS as ɵbo, DialogInteractionService as ɵbp, FocusBindingDirective as ɵc, DisposableComponent as ɵd, ComponentsModule as ɵe, NumberInputComponent as ɵf, AbstractInputComponent as ɵg, StringInputComponent as ɵh, PasswordInputComponent as ɵi, SelectInputComponent as ɵj, NoopComponent as ɵk, PlaceModule as ɵl, EmptyStateComponent as ɵm, BusyOverlayComponent as ɵn, PlaceOutletComponent as ɵo, leftRightPlaceAnimation as ɵp, LEFT_RIGHT_PLACE_ANIMATION as ɵq, AUP_PLACE_CONFIG as ɵr, PlaceRouter as ɵt, PlaceHistory as ɵu, ModalInteractionService as ɵv, TabbedPlaceNavigationComponent as ɵw, AbstractPlaceNavigationComponent as ɵx, ListPlaceNavComponent as ɵy, InteractionModule as ɵz };
7658
7516
  //# sourceMappingURL=coolon-angular-ui-powerups.js.map