@coolon/angular-ui-powerups 0.0.105 → 0.0.107

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.
@@ -2440,10 +2440,33 @@
2440
2440
  return this.modelInteractionActive.value;
2441
2441
  };
2442
2442
  /**
2443
+ * @deprecated use #createModalInteractionContextDisposedWith instead.
2444
+ * @param disposable
2445
+ */
2446
+ /**
2447
+ * @deprecated use #createModalInteractionContextDisposedWith instead.
2443
2448
  * @param {?} disposable
2444
2449
  * @return {?}
2445
2450
  */
2446
2451
  InteractionService.prototype.createModalInteractionContextFor = /**
2452
+ * @deprecated use #createModalInteractionContextDisposedWith instead.
2453
+ * @param {?} disposable
2454
+ * @return {?}
2455
+ */
2456
+ function (disposable) {
2457
+ return this.createModalInteractionContextDisposedWith(disposable);
2458
+ };
2459
+ /**
2460
+ * Creates a new model interaction context that will be disposed along with the component.
2461
+ * @param disposable
2462
+ */
2463
+ /**
2464
+ * Creates a new model interaction context that will be disposed along with the component.
2465
+ * @param {?} disposable
2466
+ * @return {?}
2467
+ */
2468
+ InteractionService.prototype.createModalInteractionContextDisposedWith = /**
2469
+ * Creates a new model interaction context that will be disposed along with the component.
2447
2470
  * @param {?} disposable
2448
2471
  * @return {?}
2449
2472
  */
@@ -3830,7 +3853,7 @@
3830
3853
  // we always return true if we accepted promise from a previous cycle of the current
3831
3854
  // navigation session.
3832
3855
  if (!this.canDeactivatePromise) {
3833
- console.log("creating deactivate promise for -> " + this.component.constructor.name);
3856
+ // console.log(`creating deactivate promise for -> ${this.component.constructor.name}`);
3834
3857
  this.canDeactivatePromise = this.canDeactivateComponent(currentUrl, nextState);
3835
3858
  }
3836
3859
  return [2 /*return*/, this.canDeactivatePromise];
@@ -3859,7 +3882,6 @@
3859
3882
  return __generator(this, function (_a) {
3860
3883
  switch (_a.label) {
3861
3884
  case 0:
3862
- console.log(this.navigationState.toString());
3863
3885
  if (!this.navigationState.isPopState) return [3 /*break*/, 5];
3864
3886
  if (!(this.isPrimaryComponent && this.interactionService.isModalActive())) return [3 /*break*/, 3];
3865
3887
  routeIds = this.placeRouter.getActiveInteractionIdsFromUrl(nextState.url);
@@ -4585,11 +4607,15 @@
4585
4607
  navigationTransition.storeVisit(visit);
4586
4608
  return navigationTransition;
4587
4609
  };
4610
+ // @Trace()
4611
+ // @Trace()
4588
4612
  /**
4589
4613
  * @param {?} event
4590
4614
  * @return {?}
4591
4615
  */
4592
- IdleDuringInteraction.prototype.onRouterStarted = /**
4616
+ IdleDuringInteraction.prototype.onRouterStarted =
4617
+ // @Trace()
4618
+ /**
4593
4619
  * @param {?} event
4594
4620
  * @return {?}
4595
4621
  */
@@ -4607,12 +4633,6 @@
4607
4633
  function (event) {
4608
4634
  return new InteractionPopStateTransition(this.context, event.url);
4609
4635
  };
4610
- __decorate([
4611
- pectin.Trace(),
4612
- __metadata("design:type", Function),
4613
- __metadata("design:paramtypes", [router.NavigationStart]),
4614
- __metadata("design:returntype", NavigationState)
4615
- ], IdleDuringInteraction.prototype, "onRouterStarted", null);
4616
4636
  __decorate([
4617
4637
  pectin.Trace(),
4618
4638
  __metadata("design:type", Function),
@@ -4657,11 +4677,7 @@
4657
4677
  * This state exists to handle all events while any kind of navigation is in progress. That way all other states can
4658
4678
  * happily ignore interaction contexts.
4659
4679
  */
4660
- var /**
4661
- * This state exists to handle all events while any kind of navigation is in progress. That way all other states can
4662
- * happily ignore interaction contexts.
4663
- */
4664
- InteractionTransition = /** @class */ (function (_super) {
4680
+ var InteractionTransition = /** @class */ (function (_super) {
4665
4681
  __extends(InteractionTransition, _super);
4666
4682
  function InteractionTransition() {
4667
4683
  var _this = _super !== null && _super.apply(this, arguments) || this;
@@ -4715,6 +4731,24 @@
4715
4731
  return new Idle(this.context);
4716
4732
  }
4717
4733
  };
4734
+ __decorate([
4735
+ pectin.Trace(),
4736
+ __metadata("design:type", Function),
4737
+ __metadata("design:paramtypes", [router.NavigationCancel]),
4738
+ __metadata("design:returntype", NavigationState)
4739
+ ], InteractionTransition.prototype, "onRouterCancelled", null);
4740
+ __decorate([
4741
+ pectin.Trace(),
4742
+ __metadata("design:type", Function),
4743
+ __metadata("design:paramtypes", [router.NavigationError]),
4744
+ __metadata("design:returntype", NavigationState)
4745
+ ], InteractionTransition.prototype, "onRouterError", null);
4746
+ __decorate([
4747
+ pectin.Trace(),
4748
+ __metadata("design:type", Function),
4749
+ __metadata("design:paramtypes", [router.NavigationEnd]),
4750
+ __metadata("design:returntype", NavigationState)
4751
+ ], InteractionTransition.prototype, "onRouterEnd", null);
4718
4752
  return InteractionTransition;
4719
4753
  }(AbstractInteractionTransition));
4720
4754
  NavigationState.InteractionTransition = InteractionTransition;
@@ -4726,11 +4760,7 @@
4726
4760
  * This state exists to handle all events while any kind of navigation is in progress. That way all other states can
4727
4761
  * happily ignore interaction contexts.
4728
4762
  */
4729
- var /**
4730
- * This state exists to handle all events while any kind of navigation is in progress. That way all other states can
4731
- * happily ignore interaction contexts.
4732
- */
4733
- InteractionPopStateTransition = /** @class */ (function (_super) {
4763
+ var InteractionPopStateTransition = /** @class */ (function (_super) {
4734
4764
  __extends(InteractionPopStateTransition, _super);
4735
4765
  function InteractionPopStateTransition() {
4736
4766
  var _this = _super !== null && _super.apply(this, arguments) || this;
@@ -4772,6 +4802,18 @@
4772
4802
  return new Idle(this.context);
4773
4803
  }
4774
4804
  };
4805
+ __decorate([
4806
+ pectin.Trace(),
4807
+ __metadata("design:type", Function),
4808
+ __metadata("design:paramtypes", [router.NavigationCancel]),
4809
+ __metadata("design:returntype", NavigationState)
4810
+ ], InteractionPopStateTransition.prototype, "onRouterCancelled", null);
4811
+ __decorate([
4812
+ pectin.Trace(),
4813
+ __metadata("design:type", Function),
4814
+ __metadata("design:paramtypes", [router.NavigationEnd]),
4815
+ __metadata("design:returntype", NavigationState)
4816
+ ], InteractionPopStateTransition.prototype, "onRouterEnd", null);
4775
4817
  return InteractionPopStateTransition;
4776
4818
  }(AbstractInteractionTransition));
4777
4819
  NavigationState.InteractionPopStateTransition = InteractionPopStateTransition;
@@ -5020,10 +5062,9 @@
5020
5062
  */
5021
5063
  exports.UrlSnapshot = /** @class */ (function () {
5022
5064
  // TODO: Update this accept a url Parser so it can be immutable and generate new trees on mutation using toString() are parseUrl.
5023
- function UrlSnapshot(urlSerializer, url, options) {
5065
+ function UrlSnapshot(urlSerializer, url) {
5024
5066
  this.urlSerializer = urlSerializer;
5025
5067
  this.url = url;
5026
- this.options = options;
5027
5068
  this.urlTree = urlSerializer.parse(url);
5028
5069
  }
5029
5070
  /**
@@ -5051,7 +5092,7 @@
5051
5092
  // do not use the return value, it's the items that were removed!
5052
5093
  segments.splice.apply(segments, __spread([replaceAt, visitSegments.length], visitSegments));
5053
5094
  urlTree.root.children.primary.segments = segments;
5054
- return new UrlSnapshot(this.urlSerializer, urlTree.toString(), this.options);
5095
+ return new UrlSnapshot(this.urlSerializer, urlTree.toString());
5055
5096
  };
5056
5097
  /**
5057
5098
  * @private
@@ -5156,7 +5197,7 @@
5156
5197
  /** @type {?} */
5157
5198
  var urlTree = this.urlSerializer.parse(this.url);
5158
5199
  urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM] = UrlSnapshot.createPathIdFor(ids);
5159
- return new UrlSnapshot(this.urlSerializer, urlTree.toString(), this.options);
5200
+ return new UrlSnapshot(this.urlSerializer, urlTree.toString());
5160
5201
  }
5161
5202
  };
5162
5203
  // @Trace()
@@ -5175,27 +5216,7 @@
5175
5216
  if (urlTree.queryParams && urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM]) {
5176
5217
  urlTree.queryParams = {}; //[UrlSnapshot.INTERACTION_ROUTER_OUTLET]
5177
5218
  }
5178
- return new UrlSnapshot(this.urlSerializer, urlTree.toString(), this.options);
5179
- };
5180
- /**
5181
- * @param {?} options
5182
- * @return {?}
5183
- */
5184
- UrlSnapshot.prototype.withOptions = /**
5185
- * @param {?} options
5186
- * @return {?}
5187
- */
5188
- function (options) {
5189
- return new UrlSnapshot(this.urlSerializer, this.url, options);
5190
- };
5191
- /**
5192
- * @return {?}
5193
- */
5194
- UrlSnapshot.prototype.getNavigationExtras = /**
5195
- * @return {?}
5196
- */
5197
- function () {
5198
- return this.options;
5219
+ return new UrlSnapshot(this.urlSerializer, urlTree.toString());
5199
5220
  };
5200
5221
  return UrlSnapshot;
5201
5222
  }());
@@ -5206,11 +5227,6 @@
5206
5227
  exports.UrlSnapshot.prototype.urlSerializer;
5207
5228
  /** @type {?} */
5208
5229
  exports.UrlSnapshot.prototype.url;
5209
- /**
5210
- * @type {?}
5211
- * @private
5212
- */
5213
- exports.UrlSnapshot.prototype.options;
5214
5230
  }
5215
5231
  (function (UrlSnapshot) {
5216
5232
  UrlSnapshot.INTERACTION_QUERY_PARAM = 'aup-interactions';
@@ -5333,7 +5349,7 @@
5333
5349
  * @return {?}
5334
5350
  */
5335
5351
  function (ids, previous) {
5336
- _this.syncInteractionIdsWithRouter();
5352
+ _this.syncInteractionIdsWithRouter(ids, previous);
5337
5353
  }), { unless: _this.navigationInProgress }); // TODO: I think the exclusive interaction prevents interactions starting while it's active so we might not need this.
5338
5354
  // TODO: I think the exclusive interaction prevents interactions starting while it's active so we might not need this.
5339
5355
  /** @type {?} */
@@ -5624,7 +5640,7 @@
5624
5640
  * @return {?}
5625
5641
  */
5626
5642
  function (url) {
5627
- return new exports.UrlSnapshot(this.urlSerializer, url, {});
5643
+ return new exports.UrlSnapshot(this.urlSerializer, url);
5628
5644
  };
5629
5645
  /**
5630
5646
  * @param {?} url
@@ -5706,47 +5722,77 @@
5706
5722
  function (url) {
5707
5723
  return this.getActiveInteractionIdsFromUrl(url).length > 0;
5708
5724
  };
5709
- // @Trace()
5710
- // @Trace()
5711
5725
  /**
5712
5726
  * @param {?} urlSnapshot
5727
+ * @param {?=} navigationExtras
5713
5728
  * @return {?}
5714
5729
  */
5715
- PlaceRouter.prototype.navigateByUrl =
5716
- // @Trace()
5717
- /**
5730
+ PlaceRouter.prototype.navigateByUrl = /**
5718
5731
  * @param {?} urlSnapshot
5732
+ * @param {?=} navigationExtras
5719
5733
  * @return {?}
5720
5734
  */
5721
- function (urlSnapshot) {
5722
- this.router.navigateByUrl(urlSnapshot.urlTree, urlSnapshot.getNavigationExtras());
5735
+ function (urlSnapshot, navigationExtras) {
5736
+ return this.router.navigateByUrl(urlSnapshot.urlTree, navigationExtras);
5723
5737
  };
5724
- // @Trace()
5725
- // @Trace()
5738
+ // TODO: Should this be moved to the navigation states?
5739
+ // TODO: Should this be moved to the navigation states?
5726
5740
  /**
5741
+ * @param {?} currentIds
5742
+ * @param {?} previous
5727
5743
  * @return {?}
5728
5744
  */
5729
5745
  PlaceRouter.prototype.syncInteractionIdsWithRouter =
5730
- // @Trace()
5746
+ // TODO: Should this be moved to the navigation states?
5731
5747
  /**
5748
+ * @param {?} currentIds
5749
+ * @param {?} previous
5732
5750
  * @return {?}
5733
5751
  */
5734
- function () {
5752
+ function (currentIds, previous) {
5753
+ var _this = this;
5735
5754
  pectin.assert.isFalsey(this.navigationInProgress.value); // Updating interaction routes during an existing navigation breaks all the things.
5736
- // Updating interaction routes during an existing navigation breaks all the things.
5737
- /** @type {?} */
5738
- var currentIds = this.interactionService.activeInteractionContextIds.value;
5739
- if (___default__default.isEqual(currentIds, this.getActiveInteractionIdsFromUrl(this.getCurrentRouterUrl()))) {
5755
+ console.log({
5756
+ startingActivity: currentIds.length > previous.length,
5757
+ wasBackButton: this.navigationState.isPopState
5758
+ });
5759
+ if (___default__default.isEqual(currentIds, previous)) {
5740
5760
  console.log('activity ids were the same, skipping');
5741
5761
  }
5742
5762
  else {
5743
- if (currentIds.length < 1) {
5744
- // no more interactions to remove from history.
5745
- this.navigateByUrl(this.getCurrentRouteSnapshot().removeInteractionIds());
5763
+ // OMG, this is nuts.
5764
+ /** @type {?} */
5765
+ var addingActivity = currentIds.length > previous.length;
5766
+ /** @type {?} */
5767
+ var isFirstActivity = addingActivity && previous.length < 1;
5768
+ /** @type {?} */
5769
+ var removingLastActivity = currentIds.length < 1;
5770
+ if (addingActivity) { // we're starting a new activity, push the change to the history and update the url
5771
+ console.log('adding activity');
5772
+ this.navigateByUrl(this.getCurrentRouteSnapshot().updateInteractionIds(currentIds), {
5773
+ replaceUrl: !isFirstActivity // we don't let the history pile up
5774
+ });
5746
5775
  }
5747
5776
  else {
5748
- // todo was or is...
5749
- this.navigateByUrl(this.getCurrentRouteSnapshot().updateInteractionIds(currentIds));
5777
+ /** @type {?} */
5778
+ var urlSnapshot = this.getCurrentRouteSnapshot().updateInteractionIds(currentIds);
5779
+ if (removingLastActivity) {
5780
+ this.navigateByUrl(urlSnapshot, {
5781
+ replaceUrl: true
5782
+ }).then((/**
5783
+ * @return {?}
5784
+ */
5785
+ function () {
5786
+ // for some reason we need to pop the last history off the stack when leaving the
5787
+ // active activity state.
5788
+ _this.angularLocation.back();
5789
+ }));
5790
+ }
5791
+ else {
5792
+ this.navigateByUrl(urlSnapshot, {
5793
+ replaceUrl: true
5794
+ });
5795
+ }
5750
5796
  }
5751
5797
  }
5752
5798
  };
@@ -5764,6 +5810,12 @@
5764
5810
  { type: exports.ɵv }
5765
5811
  ]; };
5766
5812
  /** @nocollapse */ PlaceRouter.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(core.ɵɵinject(router.Router), core.ɵɵinject(router.UrlSerializer), core.ɵɵinject(common.Location), core.ɵɵinject(PlaceHistory), core.ɵɵinject(exports.ɵv)); }, token: PlaceRouter, providedIn: "root" });
5813
+ __decorate([
5814
+ pectin.Trace(),
5815
+ __metadata("design:type", Function),
5816
+ __metadata("design:paramtypes", [exports.UrlSnapshot, Object]),
5817
+ __metadata("design:returntype", Promise)
5818
+ ], PlaceRouter.prototype, "navigateByUrl", null);
5767
5819
  return PlaceRouter;
5768
5820
  }(pectin.GarbageCollector));
5769
5821
  if (false) {