@coolon/angular-ui-powerups 0.0.119 → 0.0.121
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.
- package/bundles/coolon-angular-ui-powerups.umd.js +72 -168
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/lib/place/guards/navigation-state.js +43 -85
- package/esm2015/lib/place/guards/navigation-state.js.map +1 -1
- package/esm2015/lib/place/guards/navigation-state.metadata.json +1 -1
- package/esm2015/lib/place/place-component.js +2 -2
- package/esm2015/lib/place/place-component.js.map +1 -1
- package/esm2015/lib/place/place-router.js +9 -2
- package/esm2015/lib/place/place-router.js.map +1 -1
- package/esm2015/lib/place/place-router.metadata.json +1 -1
- package/esm2015/lib/place/route/parameter-decorators.js +6 -6
- package/esm2015/lib/place/route/parameter-decorators.js.map +1 -1
- package/esm5/lib/place/guards/navigation-state.js +52 -159
- package/esm5/lib/place/guards/navigation-state.js.map +1 -1
- package/esm5/lib/place/place-component.js +2 -2
- package/esm5/lib/place/place-component.js.map +1 -1
- package/esm5/lib/place/place-router.js +13 -2
- package/esm5/lib/place/place-router.js.map +1 -1
- package/esm5/lib/place/route/parameter-decorators.js +6 -6
- package/esm5/lib/place/route/parameter-decorators.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +60 -95
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +73 -169
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/place/guards/navigation-state.d.ts +4 -1
- package/lib/place/place-router.d.ts +4 -1
- package/package.json +2 -2
|
@@ -175,13 +175,13 @@ export class NavigationState extends GarbageCollector {
|
|
|
175
175
|
new NavigationState.IdleDuringInteraction(this.context, this.currentRouterUrl()) :
|
|
176
176
|
new NavigationState.Idle(this.context);
|
|
177
177
|
}
|
|
178
|
-
//
|
|
179
178
|
/**
|
|
180
179
|
* @param {?} url
|
|
180
|
+
* @param {?=} options
|
|
181
181
|
* @return {?}
|
|
182
182
|
*/
|
|
183
|
-
resetBrowserLocation(url) {
|
|
184
|
-
this.placeRouter.resetBrowserLocation(url);
|
|
183
|
+
resetBrowserLocation(url, options = { replaceCurrent: false }) {
|
|
184
|
+
this.placeRouter.resetBrowserLocation(url, options);
|
|
185
185
|
}
|
|
186
186
|
/**
|
|
187
187
|
* @param {?} event
|
|
@@ -213,6 +213,20 @@ export class NavigationState extends GarbageCollector {
|
|
|
213
213
|
return `${p}: ${this[p]}`;
|
|
214
214
|
})).join(', ');
|
|
215
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* @protected
|
|
218
|
+
* @param {?} url
|
|
219
|
+
* @return {?}
|
|
220
|
+
*/
|
|
221
|
+
replaceBuggeredUrlAfterAngularRouterCancelled(url) {
|
|
222
|
+
// Angular calls _this.resetUrlToCurrentUrlTree() on cancelling and fucks our history.
|
|
223
|
+
// So this means that the top of the stack is the url we want to go back to, and not the one that was on
|
|
224
|
+
// it before the cancel event fired.
|
|
225
|
+
// So we need to:
|
|
226
|
+
// - replace the just inserted url with the one that used to be there.
|
|
227
|
+
// - push our actual url back onto the top of the stack.
|
|
228
|
+
this.resetBrowserLocation(url, { replaceCurrent: true });
|
|
229
|
+
}
|
|
216
230
|
}
|
|
217
231
|
if (false) {
|
|
218
232
|
/**
|
|
@@ -491,11 +505,11 @@ if (false) {
|
|
|
491
505
|
* @return {?}
|
|
492
506
|
*/
|
|
493
507
|
onRouterCancelled(event) {
|
|
508
|
+
this.replaceBuggeredUrlAfterAngularRouterCancelled(this.poppedHistoryUrl);
|
|
494
509
|
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
495
510
|
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
496
511
|
Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
497
|
-
this.resetBrowserLocation(this.
|
|
498
|
-
this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
|
|
512
|
+
this.resetBrowserLocation(this.startingUrl);
|
|
499
513
|
return new Idle(this.context);
|
|
500
514
|
}
|
|
501
515
|
/**
|
|
@@ -503,15 +517,18 @@ if (false) {
|
|
|
503
517
|
* @return {?}
|
|
504
518
|
*/
|
|
505
519
|
onRouterError(event) {
|
|
506
|
-
// navigation was aborted.
|
|
507
|
-
if (this.currentRouterUrl() !== this.startingUrl) {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
520
|
+
// // navigation was aborted.
|
|
521
|
+
// if (this.currentRouterUrl() !== this.startingUrl) {
|
|
522
|
+
// // Angular doesn't preserve the url when a guard cancels the back button.
|
|
523
|
+
// // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
524
|
+
// Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
525
|
+
// this.restoreHistory([
|
|
526
|
+
// this.poppedHistoryUrl,
|
|
527
|
+
// this.startingUrl
|
|
528
|
+
// ]);
|
|
529
|
+
// }
|
|
530
|
+
// return new Idle(this.context);
|
|
531
|
+
return this.illegalTransition("when do I get this???");
|
|
515
532
|
}
|
|
516
533
|
/**
|
|
517
534
|
* @param {?} locationTriggerUrl
|
|
@@ -623,6 +640,7 @@ if (false) {
|
|
|
623
640
|
* @return {?}
|
|
624
641
|
*/
|
|
625
642
|
onRouterCancelled(event) {
|
|
643
|
+
// TODO: this.replaceBuggeredUrlAfterAngularRouterCancells(...);???
|
|
626
644
|
if (this.context.interactionService.isActive()) {
|
|
627
645
|
/** @type {?} */
|
|
628
646
|
const interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
@@ -715,6 +733,7 @@ if (false) {
|
|
|
715
733
|
this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
|
|
716
734
|
}
|
|
717
735
|
else {
|
|
736
|
+
// this.replaceBuggeredUrlAfterAngularRouterCancells(this.start)
|
|
718
737
|
this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
|
|
719
738
|
}
|
|
720
739
|
return this.createIdleState();
|
|
@@ -789,6 +808,7 @@ if (false) {
|
|
|
789
808
|
* @return {?}
|
|
790
809
|
*/
|
|
791
810
|
onRouterCancelled(event) {
|
|
811
|
+
// TODO: this.replaceBuggeredUrlAfterAngularRouterCancells(...);???
|
|
792
812
|
if (this.interactionService.isActive()) {
|
|
793
813
|
/** @type {?} */
|
|
794
814
|
const interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
@@ -816,7 +836,7 @@ if (false) {
|
|
|
816
836
|
* @return {?}
|
|
817
837
|
*/
|
|
818
838
|
createNavigationInteractionCancelledState(newUrl) {
|
|
819
|
-
return this.illegalTransition(
|
|
839
|
+
return this.illegalTransition('Leaving interaction after pop-state should\'t block so should never see a back button click');
|
|
820
840
|
}
|
|
821
841
|
}
|
|
822
842
|
NavigationState.LeavingInteractionAfterPopStateTransition = LeavingInteractionAfterPopStateTransition;
|
|
@@ -826,74 +846,6 @@ if (false) {
|
|
|
826
846
|
/** @type {?} */
|
|
827
847
|
LeavingInteractionAfterPopStateTransition.prototype.poppedHistoryUrl;
|
|
828
848
|
}
|
|
829
|
-
// See LeavingInteractionAfterPopStateTransition.createNavigationInteractionCancelledState(...) above.
|
|
830
|
-
//
|
|
831
|
-
// export class LeavingInteractionAfterPopStateCancelled extends NavigationState {
|
|
832
|
-
//
|
|
833
|
-
// readonly isPopState = false;
|
|
834
|
-
// firstCancelHandled = false;
|
|
835
|
-
// popStateHandled = false;
|
|
836
|
-
// popStateEventUrl: string;
|
|
837
|
-
// debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];
|
|
838
|
-
//
|
|
839
|
-
// constructor(context: Context,
|
|
840
|
-
// readonly startingUrl: string,
|
|
841
|
-
// readonly locationChangeTriggerUrl: string,
|
|
842
|
-
// readonly poppedHistoryUrl: string) {
|
|
843
|
-
// super(context);
|
|
844
|
-
// }
|
|
845
|
-
//
|
|
846
|
-
// get isTransitional() {
|
|
847
|
-
// return true;
|
|
848
|
-
// }
|
|
849
|
-
//
|
|
850
|
-
// onRouterStarted(event: NavigationStart): NavigationState {
|
|
851
|
-
// return this.ignore(event);
|
|
852
|
-
// }
|
|
853
|
-
//
|
|
854
|
-
//
|
|
855
|
-
// onRouterCancelled(event: NavigationCancel): NavigationState {
|
|
856
|
-
//
|
|
857
|
-
// // if (this.firstCancelHandled && this.popStateHandled) {
|
|
858
|
-
// // // Angular doesn't preserve the url when a guard cancels the back button.
|
|
859
|
-
// // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
860
|
-
// // Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
861
|
-
// // this.resetBrowserLocation(this.locationChangeTriggerUrl); // put the second back click one back in.
|
|
862
|
-
// // this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.
|
|
863
|
-
// // if (this.interactionService.isActive()) {
|
|
864
|
-
// // const interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
865
|
-
// // this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
|
|
866
|
-
// // } else {
|
|
867
|
-
// // this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
|
|
868
|
-
// // }
|
|
869
|
-
// // return this.createIdleState();
|
|
870
|
-
// // } else {
|
|
871
|
-
// // this.firstCancelHandled = true;
|
|
872
|
-
// return this.ignore(event);
|
|
873
|
-
// // }
|
|
874
|
-
// }
|
|
875
|
-
//
|
|
876
|
-
//
|
|
877
|
-
// onRouterEnd(event: NavigationEnd): NavigationState {
|
|
878
|
-
// return this.ignore(event);
|
|
879
|
-
// }
|
|
880
|
-
//
|
|
881
|
-
//
|
|
882
|
-
// onRouterError(event: NavigationError): NavigationState {
|
|
883
|
-
// return this.ignore(event);
|
|
884
|
-
// }
|
|
885
|
-
//
|
|
886
|
-
//
|
|
887
|
-
// onPopState(event: NavigationStart): NavigationState {
|
|
888
|
-
// // this.popStateHandled = true;
|
|
889
|
-
// // this.popStateEventUrl = event.url;
|
|
890
|
-
// return this.ignore(event);
|
|
891
|
-
// }
|
|
892
|
-
//
|
|
893
|
-
// async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {
|
|
894
|
-
// return false;
|
|
895
|
-
// }
|
|
896
|
-
// }
|
|
897
849
|
/**
|
|
898
850
|
* This state handles the scenario where a link navigation triggered an interaction and the user clicked back a to cancel it.
|
|
899
851
|
* The routing event sequence is different depending on the link that was clicked.
|
|
@@ -993,7 +945,7 @@ if (false) {
|
|
|
993
945
|
*/
|
|
994
946
|
finaliseRouting() {
|
|
995
947
|
Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
996
|
-
this.
|
|
948
|
+
this.replaceBuggeredUrlAfterAngularRouterCancelled(this.clickedLinkUrl); // put the back click one back in.
|
|
997
949
|
if (this.interactionService.isActive()) {
|
|
998
950
|
/** @type {?} */
|
|
999
951
|
const interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
@@ -1085,7 +1037,13 @@ if (false) {
|
|
|
1085
1037
|
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
1086
1038
|
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
1087
1039
|
Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
1088
|
-
//
|
|
1040
|
+
// Angular calls _this.resetUrlToCurrentUrlTree() on cancelling and fucks our history.
|
|
1041
|
+
// So this means that the top of the stack is the url we want to go back to, and not the one that was on
|
|
1042
|
+
// it before the cancel event fired.
|
|
1043
|
+
// So we need to:
|
|
1044
|
+
// - replace the just inserted url with the one that used to be there.
|
|
1045
|
+
// - push our actual url back onto the top of the stack.
|
|
1046
|
+
this.replaceBuggeredUrlAfterAngularRouterCancelled(this.locationChangeTriggerUrl);
|
|
1089
1047
|
this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.
|
|
1090
1048
|
if (this.interactionService.isActive()) {
|
|
1091
1049
|
/** @type {?} */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-state.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/guards/navigation-state.ts"],"names":[],"mappings":";;;;;AACA,OAAO,EAAE,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAS,MAAM,gBAAgB,CAAC;AAQ5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;;;;AAE3F,MAAM,OAAgB,eAAgB,SAAQ,gBAAgB;;;;IAS5D,YAA+B,OAAgC;QAC7D,KAAK,EAAE,CAAC;QADqB,YAAO,GAAP,OAAO,CAAyB;QAPvD,YAAO,GAAG,IAAI,GAAG,EAA0B,CAAC;QAKpD,sBAAiB,GAAa,EAAE,CAAC;IAIjC,CAAC;;;;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IAC/B,CAAC;;;;IAED,IAAI,IAAI;QACN,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC;IAC9B,CAAC;;;;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;IAClC,CAAC;;;;IAED,IAAI,kBAAkB;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC;IACzC,CAAC;;;;IAED,IAAI,kBAAkB;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;;;;;IAED,UAAU,CAAC,KAAY;QACrB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAA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,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;;;;;;;QAEK,kBAAkB,CAAC,SAAyB,EAAE,UAAuB,EAAE,OAAoB;;gBAC/F,OAAO,KAAK,CAAC;YACf,CAAC;SAAA;KACF;IA7DY,+DAA+C,kDA6D3D,CAAA;;;QA3DC,qEAA4B;;QAC5B,6EAA2B;;QAC3B,0EAAwB;;QACxB,2EAAyB;;QACzB,4EAAyJ;;QAG7I,sEAA4B;;QAC5B,mFAAyC;;QACzC,2EAAiC;;AAmDjD,CAAC,EAnlBgB,eAAe,KAAf,eAAe,QAmlB/B","sourcesContent":["import { NavigationCancel, NavigationEnd, NavigationError, NavigationStart, RouterEvent } from '@angular/router';\nimport { Dsl, GarbageCollector, lang, Logger, Trace } from '@coolon/pectin';\nimport { InteractionContext } from '../../interaction/interaction-context';\nimport { InteractionService } from '../../interaction/services/interaction.service';\nimport { PlaceComponent } from '../place-component';\nimport { PlaceDefinition } from '../place-definition';\nimport { PlaceRouter } from '../place-router';\nimport { UrlSnapshot } from '../url-snapshot';\nimport { Visit } from '../visit';\nimport { PlaceComponentDeactivationHandler } from './place-component-deactivation-handler';\n\nexport abstract class NavigationState extends GarbageCollector {\n\n private _visits = new Map<PlaceDefinition, Visit>();\n\n abstract readonly isTransitional: boolean;\n abstract readonly startingUrl: string;\n abstract readonly isPopState: boolean;\n debugPropertyKeys: string[] = [];\n\n constructor(protected readonly context: NavigationState.Context) {\n super();\n }\n\n get name(): string {\n return this.constructor.name;\n }\n\n get idle() {\n return !this.isTransitional;\n }\n\n get placeRouter(): PlaceRouter {\n return this.context.placeRouter;\n }\n\n get interactionService(): InteractionService {\n return this.context.interactionService;\n }\n\n get interactionContext(): InteractionContext {\n return null;\n }\n\n storeVisit(visit: Visit) {\n this._visits.set(visit.placeDefinition, visit);\n }\n\n getVisitFor(placeDef: PlaceDefinition) {\n return this._visits.get(placeDef);\n }\n\n onPlaceNavigationStart(visit: Visit, initialUrl: string): NavigationState {\n return this.illegalTransition('onPlaceNavigationStart');\n }\n\n onPopState(event: NavigationStart): NavigationState {\n return this.illegalTransition(event);\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n return this.illegalTransition(event);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n return this.illegalTransition(event);\n }\n\n onRouterError(event: NavigationError): NavigationState {\n return this.illegalTransition(event);\n }\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n return this.illegalTransition(event);\n }\n\n onBackClickedDuringNavigationInteraction(newUrl: string): NavigationState {\n return this.illegalTransition('onBackClickedDuringNavigationInteraction');\n }\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return this.illegalTransition('canDeactivatePlace');\n }\n\n getVisits(): Visit[] {\n return Array.from(this._visits.values());\n }\n\n protected illegalTransition<R>(message: string | RouterEvent): R {\n return lang.illegalState(`${message.toString()} not supported by ${this.toString()}`);\n }\n\n protected currentRouterUrl(): string {\n return this.placeRouter.getCurrentRouterUrl();\n }\n\n protected createTransitionStateFor(event: NavigationStart) {\n const popstate = event.navigationTrigger === 'popstate';\n const inInteraction = this.interactionService.isActive();\n if (popstate) {\n return inInteraction ?\n new NavigationState.LeavingInteractionAfterPopStateTransition(this.context, this.currentRouterUrl(), event.url) :\n new NavigationState.PopStateTransition(this.context, this.currentRouterUrl(), event.url);\n } else {\n return inInteraction ?\n new NavigationState.StartingInteractionTransition(this.context, this.currentRouterUrl()) :\n new NavigationState.NavigationTransition(this.context, this.currentRouterUrl());\n }\n }\n\n protected createIdleState() {\n return this.interactionService.isActive() ?\n new NavigationState.IdleDuringInteraction(this.context, this.currentRouterUrl()) :\n new NavigationState.Idle(this.context);\n }\n\n //\n resetBrowserLocation(url) {\n this.placeRouter.resetBrowserLocation(url);\n }\n\n ignore(event: RouterEvent, reason?: string): NavigationState {\n reason = reason ? ` -> ${reason}` : '';\n Logger.get(this).info(`Ignoring router event${reason}: ${event.constructor.name} -> ${event.url} :: ${this.toString()}`);\n return this;\n }\n\n toString(): string {\n return `${this.constructor.name}(${this.debugState()})`;\n }\n\n protected debugState(properties?: string[]) {\n return (properties || this.debugPropertyKeys).map(p => {\n return `${p}: ${this[p]}`;\n }).join(', ');\n }\n}\n\nexport namespace NavigationState {\n\n export class Context {\n constructor(\n readonly placeRouter: PlaceRouter,\n readonly interactionService: InteractionService,\n readonly notifySuccess: (success: NavigationState) => void) {\n }\n }\n\n export class Idle extends NavigationState {\n readonly isTransitional = false;\n readonly startingUrl = null;\n readonly isPopState = false;\n\n constructor(context: Context) {\n super(context);\n }\n\n onPlaceNavigationStart(visit: Visit, initialUrl: string): NavigationState {\n const navigationTransition = new NavigationTransition(this.context, initialUrl);\n navigationTransition.storeVisit(visit);\n return navigationTransition;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n\n // calling angularLocation.go() to clear back state can trigger router cycles to the current url if we don't ignore them\n if (event.url === this.currentRouterUrl()) {\n Logger.get(this).info(`navigation started to same url -> ${event.url}`);\n return this;\n }\n\n if (this.placeRouter.hasActiveInteractionIds(event.url)) {\n Logger.get(this).info(`navigation started with interaction outlet -> ${event.url}`);\n return new StartingInteractionTransition(this.context, event.url);\n } else {\n return this.createTransitionStateFor(event);\n }\n }\n\n onPopState(event: NavigationStart): NavigationState {\n return this.createTransitionStateFor(event);\n }\n }\n\n export abstract class AbstractNavigationTransition extends NavigationState {\n readonly isTransitional = true;\n private componentDeactivationHandlers = new Map<PlaceComponent, PlaceComponentDeactivationHandler>();\n private _interactionContext: InteractionContext;\n\n constructor(context: Context, readonly startingUrl: string) {\n super(context);\n this._interactionContext = this.interactionService._createExclusiveModalInteractionContext();\n this.onDispose(() => {\n // the interaction context can be detached during the back button cancellation state transition\n // as the transition is synchronous and activityCancellation isn't. Otherwise dispose will be\n // called before the context has been cancelled. It might be work having the interaction context\n // automatically cancel if the context is disposed so we don't have worry about detaching etc.\n if (this._interactionContext) {\n this._interactionContext.dispose(); // or do something like cancelAndDispose?\n }\n });\n }\n\n get interactionContext(): InteractionContext {\n return this._interactionContext;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n // active sessions can have many cancel start cycles due\n // to place guard redirects\n return this;\n }\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n // navigation succeeded\n this.context.notifySuccess(this);\n return new Idle(this.context);\n }\n\n\n onBackClickedDuringNavigationInteraction(newUrl: string): NavigationState {\n Logger.get(this).info(`back button pressed during navigation session interaction promise`);\n // detach the interaction from the session so it doesn't get disposed until the activity has completed.\n const navigationInteraction = this.detachInteractionContext();\n const { when } = Dsl.disposeWith(navigationInteraction);\n // TODO: I need to make the exclusive interaction context disallow nested activities or\n // that would mess things up entirely. Or, can I do a context.abortAll().then(..)\n Logger.get(this).info('cancelling current navigation activity..');\n navigationInteraction.cancelActiveActivity().then(() => {\n navigationInteraction.dispose();\n });\n\n return this.createNavigationInteractionCancelledState(newUrl);\n }\n\n abstract createNavigationInteractionCancelledState(newUrl: string): NavigationState\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n // lookup the handler and create it if we've not seen it yet\n let handler = this.componentDeactivationHandlers.get(component);\n if (!handler) {\n const isPrimaryHandler = this.componentDeactivationHandlers.size === 0; // only primary handler cancels the app model interations\n handler = new PlaceComponentDeactivationHandler(component, this, isPrimaryHandler);\n this.componentDeactivationHandlers.set(component, handler);\n }\n return handler.canDeactivate(currentUrl, nextUrl);\n }\n\n protected detachInteractionContext(): InteractionContext {\n const context = this._interactionContext;\n this._interactionContext = null;\n return context;\n }\n }\n\n export class NavigationTransition extends AbstractNavigationTransition {\n readonly isPopState = false;\n debugPropertyKeys = ['startingUrl'];\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n return this;\n }\n\n onRouterError(event: NavigationError): NavigationState {\n // navigation was aborted.\n return new Idle(this.context);\n }\n\n createNavigationInteractionCancelledState(newUrl: string): NavigationState {\n return new LinkTriggeredNavigationInteractionCancelled(\n this.context,\n this.startingUrl,\n newUrl\n );\n }\n }\n\n export class PopStateTransition extends AbstractNavigationTransition {\n readonly isPopState = true;\n debugPropertyKeys = ['startingUrl', 'poppedHistoryUrl'];\n\n constructor(context: NavigationState.Context, startingUrl: string, readonly poppedHistoryUrl: string) {\n super(context, startingUrl);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n // Angular doesn't preserve the url when a guard cancels the back button.\n // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n this.resetBrowserLocation(this.poppedHistoryUrl); // put the popped history item back in.\n this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.\n return new Idle(this.context);\n }\n\n onRouterError(event: NavigationError): NavigationState {\n // navigation was aborted.\n if (this.currentRouterUrl() !== this.startingUrl) {\n // Angular doesn't preserve the url when a guard cancels the back button.\n // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n this.resetBrowserLocation(this.poppedHistoryUrl); // put the popped history item back in.\n this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.\n }\n return new Idle(this.context);\n }\n\n createNavigationInteractionCancelledState(locationTriggerUrl: string): NavigationState {\n return new PopStateTriggeredNavigationInteractionCancelled(this.context,\n this.startingUrl,\n locationTriggerUrl,\n this.poppedHistoryUrl);\n }\n\n }\n\n export abstract class AbstractInteractionTransition extends AbstractNavigationTransition {\n readonly isTransitional = true;\n\n constructor(context: Context, readonly startingUrl: string) {\n super(context, startingUrl);\n }\n\n }\n\n\n// The following states exist to handle all events while any kind of navigation is in progress. That way all other states can\n// happily ignore interaction contexts.\n\n /**\n * This is the non transitional (i.e. rest) state that is used whenever an interaction context is active.\n */\n export class IdleDuringInteraction extends NavigationState {\n readonly isTransitional = false;\n readonly isPopState = false;\n debugPropertyKeys = ['startingUrl'];\n\n constructor(context: Context, readonly startingUrl: string) {\n super(context);\n }\n\n onPlaceNavigationStart(visit: Visit, initialUrl: string): NavigationState {\n // we're in an interaction and the user clicked back\n const navigationTransition = new StartingInteractionTransition(this.context, initialUrl);\n navigationTransition.storeVisit(visit);\n return navigationTransition;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n return new StartingInteractionTransition(this.context, event.url);\n }\n\n onPopState(event: NavigationStart): NavigationState {\n // we're in an interaction and the user clicked back\n return new LeavingInteractionAfterPopStateTransition(this.context, event.url, event.url);\n }\n }\n\n /**\n * This state exists to handle all events while any kind of navigation is in progress. That way all other states can\n * happily ignore interaction contexts.\n * NOTE: This state is activated when ever an interaction is started. It might be better to split it into\n * different states for different scenarios, e.g. starting model, starting model during route guard etc.\n */\n export class StartingInteractionTransition extends AbstractInteractionTransition {\n readonly isPopState = false;\n\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n if (this.context.interactionService.isActive()) {\n const interactionIds = this.interactionService.activeInteractionContextIds.value;\n this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n return new IdleDuringInteraction(this.context, this.startingUrl);\n } else {\n return new Idle(this.context);\n }\n }\n\n\n onRouterError(event: NavigationError): NavigationState {\n // navigation was aborted.\n return new IdleDuringInteraction(this.context, this.startingUrl);\n }\n\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n if (this.context.interactionService.isActive()) {\n return new IdleDuringInteraction(this.context, this.startingUrl);\n } else {\n return new Idle(this.context);\n }\n }\n\n createNavigationInteractionCancelledState(locationTriggerUrl: string): NavigationState {\n return new LeavingInteractionTransitionCancelled(this.context,\n this.startingUrl,\n locationTriggerUrl);\n }\n }\n\n /**\n * The sequence of router events are:\n * Error -> url = url of navigation link\n * End\n * onPopState url = current intereaction url sans the query params\n * Cancel url == same as above.\n */\n export class LeavingInteractionTransitionCancelled extends NavigationState {\n\n readonly isPopState = false;\n firstCancelHandled = false;\n popStateHandled = false;\n popStateEventUrl: string;\n debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];\n\n constructor(context: Context,\n readonly startingUrl: string,\n readonly locationChangeTriggerUrl: string) {\n super(context);\n }\n\n get isTransitional() {\n return true;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n return this.ignore(event);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n // Angular doesn't preserve the url when a guard cancels the back button.\n // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n if (this.interactionService.isActive()) {\n const interactionIds = this.interactionService.activeInteractionContextIds.value;\n this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n } else {\n this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.\n }\n return this.createIdleState();\n }\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n return this.ignore(event);\n }\n\n onRouterError(event: NavigationError): NavigationState {\n return this.ignore(event);\n }\n\n onPopState(event: NavigationStart): NavigationState {\n return this.ignore(event);\n }\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return false;\n }\n }\n\n\n /**\n * This state exists to handle all events while any kind of navigation is in progress. That way all other states can\n * happily ignore interaction contexts.\n */\n export class LeavingInteractionAfterPopStateTransition extends AbstractInteractionTransition {\n readonly isPopState = true;\n\n constructor(context: NavigationState.Context, startingUrl: string, readonly poppedHistoryUrl: string) {\n super(context, startingUrl);\n }\n\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n if (this.interactionService.isActive()) {\n const interactionIds = this.interactionService.activeInteractionContextIds.value;\n this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n return new IdleDuringInteraction(this.context, this.startingUrl);\n } else {\n return new Idle(this.context);\n }\n }\n\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n if (this.context.interactionService.isActive()) {\n return new IdleDuringInteraction(this.context, this.startingUrl);\n } else {\n return new Idle(this.context);\n }\n }\n\n createNavigationInteractionCancelledState(newUrl: string): NavigationState {\n return this.illegalTransition(\"Leaving interaction after pop-state should't block so should never see a back button click\")\n }\n\n }\n\n // See LeavingInteractionAfterPopStateTransition.createNavigationInteractionCancelledState(...) above.\n //\n // export class LeavingInteractionAfterPopStateCancelled extends NavigationState {\n //\n // readonly isPopState = false;\n // firstCancelHandled = false;\n // popStateHandled = false;\n // popStateEventUrl: string;\n // debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];\n //\n // constructor(context: Context,\n // readonly startingUrl: string,\n // readonly locationChangeTriggerUrl: string,\n // readonly poppedHistoryUrl: string) {\n // super(context);\n // }\n //\n // get isTransitional() {\n // return true;\n // }\n //\n // onRouterStarted(event: NavigationStart): NavigationState {\n // return this.ignore(event);\n // }\n //\n //\n // onRouterCancelled(event: NavigationCancel): NavigationState {\n //\n // // if (this.firstCancelHandled && this.popStateHandled) {\n // // // Angular doesn't preserve the url when a guard cancels the back button.\n // // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n // // Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n // // this.resetBrowserLocation(this.locationChangeTriggerUrl); // put the second back click one back in.\n // // this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.\n // // if (this.interactionService.isActive()) {\n // // const interactionIds = this.interactionService.activeInteractionContextIds.value;\n // // this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n // // } else {\n // // this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.\n // // }\n // // return this.createIdleState();\n // // } else {\n // // this.firstCancelHandled = true;\n // return this.ignore(event);\n // // }\n // }\n //\n //\n // onRouterEnd(event: NavigationEnd): NavigationState {\n // return this.ignore(event);\n // }\n //\n //\n // onRouterError(event: NavigationError): NavigationState {\n // return this.ignore(event);\n // }\n //\n //\n // onPopState(event: NavigationStart): NavigationState {\n // // this.popStateHandled = true;\n // // this.popStateEventUrl = event.url;\n // return this.ignore(event);\n // }\n //\n // async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n // return false;\n // }\n // }\n\n\n /**\n * This state handles the scenario where a link navigation triggered an interaction and the user clicked back a to cancel it.\n * The routing event sequence is different depending on the link that was clicked.\n *\n * If the link was the same as the previous history location (i.e. they've gone back via a link rather than clicking back) then the sequence is:\n *\n * -> Idle -> NavigationTransition\n * -> confirm dialog shown.\n * -> click back\n * -> NavigationCancel -> clickedLinkUrl === cancel.url\n * -> NavigationEnd\n *\n * Otherwise if the link is different from teh history location then the sequence is:\n *\n * -> Idle -> NavigationTransition\n * -> confirm dialog shown.\n * -> click back\n * -> NavigationCancel -> clickedLinkUrl !== cancel.url\n * -> NavigationEnd\n * -> PopState\n * -> NavigationCancel\n */\n export class LinkTriggeredNavigationInteractionCancelled extends NavigationState {\n\n readonly isPopState = false;\n firstCancelEventUrl: string;\n popStateEventUrl: string;\n clickedLinkMatchedBackButtonUrl = false;\n debugPropertyKeys = ['idle', 'startingUrl', 'clickedLinkUrl', 'firstCancelEventUrl', 'clickedLinkMatchedBackButtonUrl', 'popStateEventUrl'];\n\n constructor(context: Context,\n readonly startingUrl: string,\n readonly clickedLinkUrl: string) {\n super(context);\n }\n\n get isTransitional() {\n return true;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n return this.ignore(event);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n // TODO: should really split this into two sub states in the first cancel event.\n if (!this.firstCancelEventUrl) {\n this.firstCancelEventUrl = event.url;\n this.clickedLinkMatchedBackButtonUrl = event.url === this.clickedLinkUrl;\n return this.ignore(event);\n } else {\n // we wait for our popped state to come in.\n if (!this.clickedLinkMatchedBackButtonUrl && this.popStateEventUrl) {\n return this.finaliseRouting();\n }\n }\n }\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n if (this.clickedLinkMatchedBackButtonUrl) {\n return this.finaliseRouting();\n } else {\n return this.ignore(event);\n }\n }\n\n onRouterError(event: NavigationError): NavigationState {\n return this.ignore(event);\n }\n\n onPopState(event: NavigationStart): NavigationState {\n this.popStateEventUrl = event.url;\n return this.ignore(event);\n }\n\n finaliseRouting() {\n Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n this.resetBrowserLocation(this.clickedLinkUrl); // put the back click one back in.\n if (this.interactionService.isActive()) {\n const interactionIds = this.interactionService.activeInteractionContextIds.value;\n // Angular doesn't preserve the url when a guard cancels the back button.\n // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n } else {\n this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.\n }\n return this.createIdleState();\n }\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return false;\n }\n }\n\n /**\n * This state handles the scenario where a pop state triggered and interaction and the user clickeb back a second time to cancel it.\n * The sequence of routing events/state transitions is as follows.\n * -> Idle -> PopStateTransition (poppedHistoryUrl == page to go to, startingUrl = page to stay on )\n * -> confirm dialog shown.\n * -> click back\n * -> PopStateTransition -> CancelledDuringBackButtonNavigationInteraction(trigger url is the page before the popped history url)\n * -> NavigationCancel (for the previous back)\n * -> PopState\n * -> NavigationCancel\n */\n export class PopStateTriggeredNavigationInteractionCancelled extends NavigationState {\n\n readonly isPopState = false;\n firstCancelHandled = false;\n popStateHandled = false;\n popStateEventUrl: string;\n debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];\n\n constructor(context: Context,\n readonly startingUrl: string,\n readonly locationChangeTriggerUrl: string,\n readonly poppedHistoryUrl: string) {\n super(context);\n }\n\n get isTransitional() {\n return true;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n return this.ignore(event);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n\n if (this.firstCancelHandled && this.popStateHandled) {\n // Angular doesn't preserve the url when a guard cancels the back button.\n // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n // this.resetBrowserLocation(this.locationChangeTriggerUrl); // put the second back click one back in.\n this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.\n if (this.interactionService.isActive()) {\n const interactionIds = this.interactionService.activeInteractionContextIds.value;\n this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n } else {\n this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.\n }\n return this.createIdleState();\n } else {\n this.firstCancelHandled = true;\n return this.ignore(event);\n }\n }\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n return this.ignore(event);\n }\n\n onRouterError(event: NavigationError): NavigationState {\n return this.ignore(event);\n }\n\n onPopState(event: NavigationStart): NavigationState {\n this.popStateHandled = true;\n this.popStateEventUrl = event.url;\n return this.ignore(event);\n }\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return false;\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"navigation-state.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/guards/navigation-state.ts"],"names":[],"mappings":";;;;;AACA,OAAO,EAAE,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAQrE,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;;;;AAE3F,MAAM,OAAgB,eAAgB,SAAQ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avigationStart, RouterEvent } from '@angular/router';\nimport { Dsl, GarbageCollector, lang, Logger } from '@coolon/pectin';\nimport { InteractionContext } from '../../interaction/interaction-context';\nimport { InteractionService } from '../../interaction/services/interaction.service';\nimport { PlaceComponent } from '../place-component';\nimport { PlaceDefinition } from '../place-definition';\nimport { PlaceRouter } from '../place-router';\nimport { UrlSnapshot } from '../url-snapshot';\nimport { Visit } from '../visit';\nimport { PlaceComponentDeactivationHandler } from './place-component-deactivation-handler';\n\nexport abstract class NavigationState extends GarbageCollector {\n\n private _visits = new Map<PlaceDefinition, Visit>();\n\n abstract readonly isTransitional: boolean;\n abstract readonly startingUrl: string;\n abstract readonly isPopState: boolean;\n debugPropertyKeys: string[] = [];\n\n constructor(protected readonly context: NavigationState.Context) {\n super();\n }\n\n get name(): string {\n return this.constructor.name;\n }\n\n get idle() {\n return !this.isTransitional;\n }\n\n get placeRouter(): PlaceRouter {\n return this.context.placeRouter;\n }\n\n get interactionService(): InteractionService {\n return this.context.interactionService;\n }\n\n get interactionContext(): InteractionContext {\n return null;\n }\n\n storeVisit(visit: Visit) {\n this._visits.set(visit.placeDefinition, visit);\n }\n\n getVisitFor(placeDef: PlaceDefinition) {\n return this._visits.get(placeDef);\n }\n\n onPlaceNavigationStart(visit: Visit, initialUrl: string): NavigationState {\n return this.illegalTransition('onPlaceNavigationStart');\n }\n\n onPopState(event: NavigationStart): NavigationState {\n return this.illegalTransition(event);\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n return this.illegalTransition(event);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n return this.illegalTransition(event);\n }\n\n onRouterError(event: NavigationError): NavigationState {\n return this.illegalTransition(event);\n }\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n return this.illegalTransition(event);\n }\n\n onBackClickedDuringNavigationInteraction(newUrl: string): NavigationState {\n return this.illegalTransition('onBackClickedDuringNavigationInteraction');\n }\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return this.illegalTransition('canDeactivatePlace');\n }\n\n getVisits(): Visit[] {\n return Array.from(this._visits.values());\n }\n\n protected illegalTransition<R>(message: string | RouterEvent): R {\n return lang.illegalState(`${message.toString()} not supported by ${this.toString()}`);\n }\n\n protected currentRouterUrl(): string {\n return this.placeRouter.getCurrentRouterUrl();\n }\n\n protected createTransitionStateFor(event: NavigationStart) {\n const popstate = event.navigationTrigger === 'popstate';\n const inInteraction = this.interactionService.isActive();\n if (popstate) {\n return inInteraction ?\n new NavigationState.LeavingInteractionAfterPopStateTransition(this.context, this.currentRouterUrl(), event.url) :\n new NavigationState.PopStateTransition(this.context, this.currentRouterUrl(), event.url);\n } else {\n return inInteraction ?\n new NavigationState.StartingInteractionTransition(this.context, this.currentRouterUrl()) :\n new NavigationState.NavigationTransition(this.context, this.currentRouterUrl());\n }\n }\n\n protected createIdleState() {\n return this.interactionService.isActive() ?\n new NavigationState.IdleDuringInteraction(this.context, this.currentRouterUrl()) :\n new NavigationState.Idle(this.context);\n }\n\n\n resetBrowserLocation(url, options: {replaceCurrent: boolean} = {replaceCurrent: false}) {\n this.placeRouter.resetBrowserLocation(url, options);\n }\n\n ignore(event: RouterEvent, reason?: string): NavigationState {\n reason = reason ? ` -> ${reason}` : '';\n Logger.get(this).info(`Ignoring router event${reason}: ${event.constructor.name} -> ${event.url} :: ${this.toString()}`);\n return this;\n }\n\n toString(): string {\n return `${this.constructor.name}(${this.debugState()})`;\n }\n\n protected debugState(properties?: string[]) {\n return (properties || this.debugPropertyKeys).map(p => {\n return `${p}: ${this[p]}`;\n }).join(', ');\n }\n\n protected replaceBuggeredUrlAfterAngularRouterCancelled(url:string) {\n // Angular calls _this.resetUrlToCurrentUrlTree() on cancelling and fucks our history.\n // So this means that the top of the stack is the url we want to go back to, and not the one that was on\n // it before the cancel event fired.\n // So we need to:\n // - replace the just inserted url with the one that used to be there.\n // - push our actual url back onto the top of the stack.\n this.resetBrowserLocation(url, {replaceCurrent: true});\n }\n\n}\n\nexport namespace NavigationState {\n\n export class Context {\n constructor(\n readonly placeRouter: PlaceRouter,\n readonly interactionService: InteractionService,\n readonly notifySuccess: (success: NavigationState) => void) {\n }\n }\n\n export class Idle extends NavigationState {\n readonly isTransitional = false;\n readonly startingUrl = null;\n readonly isPopState = false;\n\n constructor(context: Context) {\n super(context);\n }\n\n onPlaceNavigationStart(visit: Visit, initialUrl: string): NavigationState {\n const navigationTransition = new NavigationTransition(this.context, initialUrl);\n navigationTransition.storeVisit(visit);\n return navigationTransition;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n\n // calling angularLocation.go() to clear back state can trigger router cycles to the current url if we don't ignore them\n if (event.url === this.currentRouterUrl()) {\n Logger.get(this).info(`navigation started to same url -> ${event.url}`);\n return this;\n }\n\n if (this.placeRouter.hasActiveInteractionIds(event.url)) {\n Logger.get(this).info(`navigation started with interaction outlet -> ${event.url}`);\n return new StartingInteractionTransition(this.context, event.url);\n } else {\n return this.createTransitionStateFor(event);\n }\n }\n\n onPopState(event: NavigationStart): NavigationState {\n return this.createTransitionStateFor(event);\n }\n }\n\n export abstract class AbstractNavigationTransition extends NavigationState {\n readonly isTransitional = true;\n private componentDeactivationHandlers = new Map<PlaceComponent, PlaceComponentDeactivationHandler>();\n private _interactionContext: InteractionContext;\n\n constructor(context: Context, readonly startingUrl: string) {\n super(context);\n this._interactionContext = this.interactionService._createExclusiveModalInteractionContext();\n this.onDispose(() => {\n // the interaction context can be detached during the back button cancellation state transition\n // as the transition is synchronous and activityCancellation isn't. Otherwise dispose will be\n // called before the context has been cancelled. It might be work having the interaction context\n // automatically cancel if the context is disposed so we don't have worry about detaching etc.\n if (this._interactionContext) {\n this._interactionContext.dispose(); // or do something like cancelAndDispose?\n }\n });\n }\n\n get interactionContext(): InteractionContext {\n return this._interactionContext;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n // active sessions can have many cancel start cycles due\n // to place guard redirects\n return this;\n }\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n // navigation succeeded\n this.context.notifySuccess(this);\n return new Idle(this.context);\n }\n\n\n onBackClickedDuringNavigationInteraction(newUrl: string): NavigationState {\n Logger.get(this).info(`back button pressed during navigation session interaction promise`);\n // detach the interaction from the session so it doesn't get disposed until the activity has completed.\n const navigationInteraction = this.detachInteractionContext();\n const { when } = Dsl.disposeWith(navigationInteraction);\n // TODO: I need to make the exclusive interaction context disallow nested activities or\n // that would mess things up entirely. Or, can I do a context.abortAll().then(..)\n Logger.get(this).info('cancelling current navigation activity..');\n navigationInteraction.cancelActiveActivity().then(() => {\n navigationInteraction.dispose();\n });\n\n return this.createNavigationInteractionCancelledState(newUrl);\n }\n\n abstract createNavigationInteractionCancelledState(newUrl: string): NavigationState\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n // lookup the handler and create it if we've not seen it yet\n let handler = this.componentDeactivationHandlers.get(component);\n if (!handler) {\n const isPrimaryHandler = this.componentDeactivationHandlers.size === 0; // only primary handler cancels the app model interations\n handler = new PlaceComponentDeactivationHandler(component, this, isPrimaryHandler);\n this.componentDeactivationHandlers.set(component, handler);\n }\n return handler.canDeactivate(currentUrl, nextUrl);\n }\n\n protected detachInteractionContext(): InteractionContext {\n const context = this._interactionContext;\n this._interactionContext = null;\n return context;\n }\n }\n\n export class NavigationTransition extends AbstractNavigationTransition {\n readonly isPopState = false;\n debugPropertyKeys = ['startingUrl'];\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n return this;\n }\n\n onRouterError(event: NavigationError): NavigationState {\n // navigation was aborted.\n return new Idle(this.context);\n }\n\n createNavigationInteractionCancelledState(newUrl: string): NavigationState {\n return new LinkTriggeredNavigationInteractionCancelled(\n this.context,\n this.startingUrl,\n newUrl\n );\n }\n\n }\n\n export class PopStateTransition extends AbstractNavigationTransition {\n readonly isPopState = true;\n debugPropertyKeys = ['startingUrl', 'poppedHistoryUrl'];\n\n constructor(context: NavigationState.Context, startingUrl: string, readonly poppedHistoryUrl: string) {\n super(context, startingUrl);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n this.replaceBuggeredUrlAfterAngularRouterCancelled(this.poppedHistoryUrl);\n // Angular doesn't preserve the url when a guard cancels the back button.\n // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n this.resetBrowserLocation(this.startingUrl);\n return new Idle(this.context);\n }\n\n\n onRouterError(event: NavigationError): NavigationState {\n // // navigation was aborted.\n // if (this.currentRouterUrl() !== this.startingUrl) {\n // // Angular doesn't preserve the url when a guard cancels the back button.\n // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n // Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n // this.restoreHistory([\n // this.poppedHistoryUrl,\n // this.startingUrl\n // ]);\n // }\n // return new Idle(this.context);\n return this.illegalTransition(\"when do I get this???\")\n }\n\n createNavigationInteractionCancelledState(locationTriggerUrl: string): NavigationState {\n return new PopStateTriggeredNavigationInteractionCancelled(this.context,\n this.startingUrl,\n locationTriggerUrl,\n this.poppedHistoryUrl);\n }\n\n }\n\n export abstract class AbstractInteractionTransition extends AbstractNavigationTransition {\n readonly isTransitional = true;\n\n constructor(context: Context, readonly startingUrl: string) {\n super(context, startingUrl);\n }\n\n }\n\n\n// The following states exist to handle all events while any kind of navigation is in progress. That way all other states can\n// happily ignore interaction contexts.\n\n /**\n * This is the non transitional (i.e. rest) state that is used whenever an interaction context is active.\n */\n export class IdleDuringInteraction extends NavigationState {\n readonly isTransitional = false;\n readonly isPopState = false;\n debugPropertyKeys = ['startingUrl'];\n\n constructor(context: Context, readonly startingUrl: string) {\n super(context);\n }\n\n onPlaceNavigationStart(visit: Visit, initialUrl: string): NavigationState {\n // we're in an interaction and the user clicked back\n const navigationTransition = new StartingInteractionTransition(this.context, initialUrl);\n navigationTransition.storeVisit(visit);\n return navigationTransition;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n return new StartingInteractionTransition(this.context, event.url);\n }\n\n onPopState(event: NavigationStart): NavigationState {\n // we're in an interaction and the user clicked back\n return new LeavingInteractionAfterPopStateTransition(this.context, event.url, event.url);\n }\n }\n\n /**\n * This state exists to handle all events while any kind of navigation is in progress. That way all other states can\n * happily ignore interaction contexts.\n * NOTE: This state is activated when ever an interaction is started. It might be better to split it into\n * different states for different scenarios, e.g. starting model, starting model during route guard etc.\n */\n export class StartingInteractionTransition extends AbstractInteractionTransition {\n readonly isPopState = false;\n\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n // TODO: this.replaceBuggeredUrlAfterAngularRouterCancells(...);???\n if (this.context.interactionService.isActive()) {\n const interactionIds = this.interactionService.activeInteractionContextIds.value;\n this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n return new IdleDuringInteraction(this.context, this.startingUrl);\n } else {\n return new Idle(this.context);\n }\n }\n\n\n onRouterError(event: NavigationError): NavigationState {\n // navigation was aborted.\n return new IdleDuringInteraction(this.context, this.startingUrl);\n }\n\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n if (this.context.interactionService.isActive()) {\n return new IdleDuringInteraction(this.context, this.startingUrl);\n } else {\n return new Idle(this.context);\n }\n }\n\n createNavigationInteractionCancelledState(locationTriggerUrl: string): NavigationState {\n return new LeavingInteractionTransitionCancelled(this.context,\n this.startingUrl,\n locationTriggerUrl);\n }\n }\n\n /**\n * The sequence of router events are:\n * Error -> url = url of navigation link\n * End\n * onPopState url = current intereaction url sans the query params\n * Cancel url == same as above.\n */\n export class LeavingInteractionTransitionCancelled extends NavigationState {\n\n readonly isPopState = false;\n firstCancelHandled = false;\n popStateHandled = false;\n popStateEventUrl: string;\n debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];\n\n constructor(context: Context,\n readonly startingUrl: string,\n readonly locationChangeTriggerUrl: string) {\n super(context);\n }\n\n get isTransitional() {\n return true;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n return this.ignore(event);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n // Angular doesn't preserve the url when a guard cancels the back button.\n // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n if (this.interactionService.isActive()) {\n const interactionIds = this.interactionService.activeInteractionContextIds.value;\n this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n } else {\n // this.replaceBuggeredUrlAfterAngularRouterCancells(this.start)\n this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.\n }\n return this.createIdleState();\n }\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n return this.ignore(event);\n }\n\n onRouterError(event: NavigationError): NavigationState {\n return this.ignore(event);\n }\n\n onPopState(event: NavigationStart): NavigationState {\n return this.ignore(event);\n }\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return false;\n }\n }\n\n\n /**\n * This state exists to handle all events while any kind of navigation is in progress. That way all other states can\n * happily ignore interaction contexts.\n */\n export class LeavingInteractionAfterPopStateTransition extends AbstractInteractionTransition {\n readonly isPopState = true;\n\n constructor(context: NavigationState.Context, startingUrl: string, readonly poppedHistoryUrl: string) {\n super(context, startingUrl);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n // TODO: this.replaceBuggeredUrlAfterAngularRouterCancells(...);???\n if (this.interactionService.isActive()) {\n const interactionIds = this.interactionService.activeInteractionContextIds.value;\n this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n return new IdleDuringInteraction(this.context, this.startingUrl);\n } else {\n return new Idle(this.context);\n }\n }\n\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n if (this.context.interactionService.isActive()) {\n return new IdleDuringInteraction(this.context, this.startingUrl);\n } else {\n return new Idle(this.context);\n }\n }\n\n createNavigationInteractionCancelledState(newUrl: string): NavigationState {\n return this.illegalTransition('Leaving interaction after pop-state should\\'t block so should never see a back button click');\n }\n\n }\n\n /**\n * This state handles the scenario where a link navigation triggered an interaction and the user clicked back a to cancel it.\n * The routing event sequence is different depending on the link that was clicked.\n *\n * If the link was the same as the previous history location (i.e. they've gone back via a link rather than clicking back) then the sequence is:\n *\n * -> Idle -> NavigationTransition\n * -> confirm dialog shown.\n * -> click back\n * -> NavigationCancel -> clickedLinkUrl === cancel.url\n * -> NavigationEnd\n *\n * Otherwise if the link is different from teh history location then the sequence is:\n *\n * -> Idle -> NavigationTransition\n * -> confirm dialog shown.\n * -> click back\n * -> NavigationCancel -> clickedLinkUrl !== cancel.url\n * -> NavigationEnd\n * -> PopState\n * -> NavigationCancel\n */\n export class LinkTriggeredNavigationInteractionCancelled extends NavigationState {\n\n readonly isPopState = false;\n firstCancelEventUrl: string;\n popStateEventUrl: string;\n clickedLinkMatchedBackButtonUrl = false;\n debugPropertyKeys = ['idle', 'startingUrl', 'clickedLinkUrl', 'firstCancelEventUrl', 'clickedLinkMatchedBackButtonUrl', 'popStateEventUrl'];\n\n constructor(context: Context,\n readonly startingUrl: string,\n readonly clickedLinkUrl: string) {\n super(context);\n }\n\n get isTransitional() {\n return true;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n return this.ignore(event);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n // TODO: should really split this into two sub states in the first cancel event.\n if (!this.firstCancelEventUrl) {\n this.firstCancelEventUrl = event.url;\n this.clickedLinkMatchedBackButtonUrl = event.url === this.clickedLinkUrl;\n return this.ignore(event);\n } else {\n // we wait for our popped state to come in.\n if (!this.clickedLinkMatchedBackButtonUrl && this.popStateEventUrl) {\n return this.finaliseRouting();\n }\n }\n }\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n if (this.clickedLinkMatchedBackButtonUrl) {\n return this.finaliseRouting();\n } else {\n return this.ignore(event);\n }\n }\n\n onRouterError(event: NavigationError): NavigationState {\n return this.ignore(event);\n }\n\n onPopState(event: NavigationStart): NavigationState {\n this.popStateEventUrl = event.url;\n return this.ignore(event);\n }\n\n finaliseRouting() {\n Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n this.replaceBuggeredUrlAfterAngularRouterCancelled(this.clickedLinkUrl); // put the back click one back in.\n if (this.interactionService.isActive()) {\n const interactionIds = this.interactionService.activeInteractionContextIds.value;\n // Angular doesn't preserve the url when a guard cancels the back button.\n // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n } else {\n this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.\n }\n return this.createIdleState();\n }\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return false;\n }\n }\n\n /**\n * This state handles the scenario where a pop state triggered and interaction and the user clickeb back a second time to cancel it.\n * The sequence of routing events/state transitions is as follows.\n * -> Idle -> PopStateTransition (poppedHistoryUrl == page to go to, startingUrl = page to stay on )\n * -> confirm dialog shown.\n * -> click back\n * -> PopStateTransition -> CancelledDuringBackButtonNavigationInteraction(trigger url is the page before the popped history url)\n * -> NavigationCancel (for the previous back)\n * -> PopState\n * -> NavigationCancel\n */\n export class PopStateTriggeredNavigationInteractionCancelled extends NavigationState {\n\n readonly isPopState = false;\n firstCancelHandled = false;\n popStateHandled = false;\n popStateEventUrl: string;\n debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];\n\n constructor(context: Context,\n readonly startingUrl: string,\n readonly locationChangeTriggerUrl: string,\n readonly poppedHistoryUrl: string) {\n super(context);\n }\n\n get isTransitional() {\n return true;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n return this.ignore(event);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n\n if (this.firstCancelHandled && this.popStateHandled) {\n // Angular doesn't preserve the url when a guard cancels the back button.\n // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n\n // Angular calls _this.resetUrlToCurrentUrlTree() on cancelling and fucks our history.\n // So this means that the top of the stack is the url we want to go back to, and not the one that was on\n // it before the cancel event fired.\n // So we need to:\n // - replace the just inserted url with the one that used to be there.\n // - push our actual url back onto the top of the stack.\n this.replaceBuggeredUrlAfterAngularRouterCancelled(this.locationChangeTriggerUrl);\n this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.\n if (this.interactionService.isActive()) {\n const interactionIds = this.interactionService.activeInteractionContextIds.value;\n this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n } else {\n this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.\n }\n return this.createIdleState();\n } else {\n this.firstCancelHandled = true;\n return this.ignore(event);\n }\n }\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n return this.ignore(event);\n }\n\n onRouterError(event: NavigationError): NavigationState {\n return this.ignore(event);\n }\n\n onPopState(event: NavigationStart): NavigationState {\n this.popStateHandled = true;\n this.popStateEventUrl = event.url;\n return this.ignore(event);\n }\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return false;\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"NavigationState":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@coolon/pectin","name":"GarbageCollector","line":11,"character":46},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"NavigationState"},"member":"Context"}]}],"storeVisit":[{"__symbolic":"method"}],"getVisitFor":[{"__symbolic":"method"}],"onPlaceNavigationStart":[{"__symbolic":"method"}],"onPopState":[{"__symbolic":"method"}],"onRouterStarted":[{"__symbolic":"method"}],"onRouterCancelled":[{"__symbolic":"method"}],"onRouterError":[{"__symbolic":"method"}],"onRouterEnd":[{"__symbolic":"method"}],"onBackClickedDuringNavigationInteraction":[{"__symbolic":"method"}],"canDeactivatePlace":[{"__symbolic":"method"}],"getVisits":[{"__symbolic":"method"}],"illegalTransition":[{"__symbolic":"method"}],"currentRouterUrl":[{"__symbolic":"method"}],"createTransitionStateFor":[{"__symbolic":"method"}],"createIdleState":[{"__symbolic":"method"}],"resetBrowserLocation":[{"__symbolic":"method"}],"ignore":[{"__symbolic":"method"}],"toString":[{"__symbolic":"method"}],"debugState":[{"__symbolic":"method"}]}}}}]
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"NavigationState":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@coolon/pectin","name":"GarbageCollector","line":11,"character":46},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"NavigationState"},"member":"Context"}]}],"storeVisit":[{"__symbolic":"method"}],"getVisitFor":[{"__symbolic":"method"}],"onPlaceNavigationStart":[{"__symbolic":"method"}],"onPopState":[{"__symbolic":"method"}],"onRouterStarted":[{"__symbolic":"method"}],"onRouterCancelled":[{"__symbolic":"method"}],"onRouterError":[{"__symbolic":"method"}],"onRouterEnd":[{"__symbolic":"method"}],"onBackClickedDuringNavigationInteraction":[{"__symbolic":"method"}],"canDeactivatePlace":[{"__symbolic":"method"}],"getVisits":[{"__symbolic":"method"}],"illegalTransition":[{"__symbolic":"method"}],"currentRouterUrl":[{"__symbolic":"method"}],"createTransitionStateFor":[{"__symbolic":"method"}],"createIdleState":[{"__symbolic":"method"}],"resetBrowserLocation":[{"__symbolic":"method"}],"ignore":[{"__symbolic":"method"}],"toString":[{"__symbolic":"method"}],"debugState":[{"__symbolic":"method"}],"replaceBuggeredUrlAfterAngularRouterCancelled":[{"__symbolic":"method"}]}}}}]
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4
4
|
*/
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
|
-
import { assert, Binding, lang } from '@coolon/pectin';
|
|
6
|
+
import { assert, Binding, DebugContext, lang } from '@coolon/pectin';
|
|
7
7
|
import { Klass } from '@coolon/typescript-utilities';
|
|
8
8
|
import { Memoize } from '@typescript-plus/fast-memoize-decorator';
|
|
9
9
|
import 'reflect-metadata';
|
|
@@ -26,7 +26,7 @@ export class PlaceComponent extends DisposableComponent {
|
|
|
26
26
|
initialiseBindings(visit) {
|
|
27
27
|
assert.isNil(this.visit);
|
|
28
28
|
this.visit = visit;
|
|
29
|
-
|
|
29
|
+
DebugContext.get(this.visit).tag(`${this.placeDefinition.component.name}.visit`);
|
|
30
30
|
this.placeDefinition.getVisitParameterDefs().forEach((/**
|
|
31
31
|
* @param {?} parameterDef
|
|
32
32
|
* @return {?}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"place-component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/place-component.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,EACL,MAAM,EACN,OAAO,
|
|
1
|
+
{"version":3,"file":"place-component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/place-component.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,EACL,MAAM,EACN,OAAO,EAEP,YAAY,EAEZ,IAAI,EAGL,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAClE,OAAO,kBAAkB,CAAC;AAC1B,OAAO,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,cAAc,QAkB9B","sourcesContent":["import {\n assert,\n Binding,\n Constructable,\n DebugContext,\n IMutableHasValue,\n lang,\n TransactionObserver,\n ValueModel\n} from '@coolon/pectin';\nimport { Klass } from '@coolon/typescript-utilities';\nimport { Memoize } from '@typescript-plus/fast-memoize-decorator';\nimport 'reflect-metadata';\nimport { DisposableComponent } from '../components/disposable-component';\nimport { InteractionContext } from '../interaction/interaction-context';\nimport { PlaceDefinition } from './place-definition';\nimport { ParameterDefinition } from './route/parameter-definition.class';\nimport { Visit } from './visit';\n\n// RAKE: making this Symbol(...) broke things.\nexport const DEFINITION_META_DATA_KEY = 'PLACE_DEFINITION_OPTIONS';\n// this one seems ok.\nexport const ROUTE_PARAMETER_LIST_KEY = Symbol('place:route:parameters');\n\nexport class PlaceComponent extends DisposableComponent {\n\n private visit: ValueModel<Visit>;\n // private _inDeactivationGuard = new MutableValueModel<boolean>(false);\n\n interactionContext?: InteractionContext;\n\n canDeactivate?(interactionContext: InteractionContext): boolean | Promise<boolean>;\n\n constructor() {\n super();\n }\n\n public initialiseBindings(visit: ValueModel<Visit>) {\n assert.isNil(this.visit);\n this.visit = visit;\n DebugContext.get(this.visit).tag(`${this.placeDefinition.component.name}.visit`);\n this.placeDefinition.getVisitParameterDefs().forEach(parameterDef => {\n this.installBinding(parameterDef);\n });\n }\n\n private installBinding<T, S>(parameterDef: ParameterDefinition<T, S>) {\n const model = this[parameterDef.propertyName] as IMutableHasValue<S>;\n // this.txo.observe(parameterDef.propertyName, model);\n this.registerDisposable(new Binding(this.visit, model, {\n toRight(visit: Visit): S {\n const value = visit.getParameter(parameterDef.name);\n // console.log('push to component', {name:parameterDef.name, value, visit});\n return value;\n },\n toLeft(value: S, currentVisit?: Visit): Visit {\n console.log('push to route', { name: parameterDef.name, value, currentVisit });\n return currentVisit.replace(parameterDef, value);\n }\n }));\n }\n\n @Memoize()\n get placeDefinition(): PlaceDefinition {\n return PlaceComponent.getDefinition(this.constructor as any as Constructable<PlaceComponent>);\n }\n\n get childPlaces(): Constructable<PlaceComponent>[] {\n return this.placeDefinition.children.map(d => d.component);\n }\n\n onPlaceReady() {\n }\n\n}\n\nexport namespace PlaceComponent {\n\n export function isPlaceComponentConstructor(target: any): target is Constructable<PlaceComponent> {\n return lang.constructorChain(target as Constructable<any>).includes(PlaceComponent);\n }\n\n export function getRouteParameters(klass: Constructable<PlaceComponent>): ParameterDefinition<any>[] {\n return Klass.get(klass).getMetadataList(ROUTE_PARAMETER_LIST_KEY);\n }\n\n export function getDefinition(klass: Constructable<PlaceComponent>): PlaceDefinition {\n return Reflect.getMetadata(DEFINITION_META_DATA_KEY, klass);\n }\n\n export function injectDefinition(klass: Constructable<PlaceComponent>, definition: PlaceDefinition) {\n Reflect.defineMetadata(DEFINITION_META_DATA_KEY, definition, klass);\n }\n\n}\n"]}
|
|
@@ -315,10 +315,17 @@ export class PlaceRouter extends GarbageCollector {
|
|
|
315
315
|
}
|
|
316
316
|
/**
|
|
317
317
|
* @param {?} url
|
|
318
|
+
* @param {?} options
|
|
318
319
|
* @return {?}
|
|
319
320
|
*/
|
|
320
|
-
resetBrowserLocation(url) {
|
|
321
|
-
this.angularLocation.go(url);
|
|
321
|
+
resetBrowserLocation(url, options) {
|
|
322
|
+
options.replaceCurrent ? this.angularLocation.replaceState(url) : this.angularLocation.go(url);
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* @return {?}
|
|
326
|
+
*/
|
|
327
|
+
forward() {
|
|
328
|
+
this.angularLocation.forward();
|
|
322
329
|
}
|
|
323
330
|
/**
|
|
324
331
|
* @param {...?} visits
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"place-router.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/place-router.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAGL,gBAAg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oBACL,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE;wBAC9B,UAAU,EAAE,IAAI;qBACjB,CAAC,CAAC;iBACJ;aACF;SACF;IACH,CAAC;;;YA/PF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;;YA7BC,MAAM;YACN,aAAa;YAXN,QAAQ;YAgCR,YAAY;YAFZ,kBAAkB;;;;;;;;IAYzB,4CAAkF;;;;;IAClF,oCAA+D;;IAE/D,2CAAmD;;IACnD,uCAAsE;;;;;IACtE,gDAA2D;;;;;IAC3D,gDAAmF;;;;;IAEvE,6BAA+B;;;;;IAC/B,oCAA6C;;;;;IAC7C,sCAA0C;;;;;IAC1C,mCAA2C;;;;;IAC3C,yCAAuD","sourcesContent":["import { Location } from '@angular/common';\nimport { Injectable } from '@angular/core';\nimport {\n ActivatedRoute,\n ActivatedRouteSnapshot,\n NavigationCancel,\n NavigationEnd,\n NavigationError,\n NavigationExtras,\n NavigationStart,\n Router,\n UrlSerializer\n} from '@angular/router';\nimport {\n assert,\n Constructable,\n Dsl,\n GarbageCollector,\n HasOneIndexChain,\n lang,\n ListModel,\n Logger,\n MutableListModel,\n MutableStream,\n MutableValueModel,\n Trace,\n ValueModel,\n ValueModelChain\n} from '@coolon/pectin';\nimport _ from 'lodash';\nimport { InteractionService } from '../interaction/services/interaction.service';\nimport { NavigationState } from './guards/navigation-state';\nimport { PlaceHistory } from './place-history';\nimport { UrlSnapshot } from './url-snapshot';\nimport { Visit } from './visit';\n\n\n@Injectable({\n providedIn: 'root'\n})\nexport class PlaceRouter extends GarbageCollector {\n\n private readonly _navigationStateModel = new MutableValueModel<NavigationState>();\n private readonly _activeVisits = new MutableListModel<Visit>();\n\n readonly navigationInProgress: ValueModel<boolean>;\n readonly activeVisitIndex: HasOneIndexChain<'placeDefinition', Visit>;\n private _navigationSessionContext: NavigationState.Context;\n private _navigationStateTypeModel: ValueModelChain<Constructable<NavigationState>>;\n\n constructor(private readonly router: Router,\n private readonly urlSerializer: UrlSerializer,\n private readonly angularLocation: Location,\n private readonly placeHistory: PlaceHistory,\n private readonly interactionService: InteractionService) {\n super();\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n this.activeVisitIndex = chain(this._activeVisits).indexBy('placeDefinition');\n this.navigationInProgress = chain(this.navigationStateModel).pluck('isTransitional');\n this._navigationSessionContext = new NavigationState.Context(this, this.interactionService, session => {\n this.processNavigationSuccess(session);\n });\n this._navigationStateModel.value = new NavigationState.Idle(this._navigationSessionContext);\n this._navigationStateTypeModel = chain(this._navigationStateModel).map(state => state.constructor as Constructable<NavigationState>);\n\n // TODO: make setup the callbacks in during module initiation to make this testable.\n this.router.events.subscribe(event => {\n // Routing event sequence\n // ======================\n // NavigationStart -> .... -> NavigationCancel --> redirect, go around again in the same session\n // NavigationStart -> .... -> NavigationEnd --> navigation complete, end session.\n // NavigationStart -> .... -> NavigationError --> navigation aborted, end session.\n // =======================\n if (event instanceof NavigationStart) {\n if (event.navigationTrigger === 'popstate') {\n this.runStateTransition(state => state.onPopState(event));\n } else {\n this.runStateTransition(state => state.onRouterStarted(event));\n }\n }\n if (event instanceof NavigationEnd) {\n console.log(event);\n this.runStateTransition(state => state.onRouterEnd(event));\n }\n if (event instanceof NavigationError) {\n console.log(event);\n this.runStateTransition(state => state.onRouterError(event));\n }\n if (event instanceof NavigationCancel) {\n console.log(event);\n this.runStateTransition(state => state.onRouterCancelled(event));\n }\n });\n\n // Push dialog state to the url so we can capture the back button.\n when.listOf(this.interactionService.activeInteractionContextIds).changes((ids, previous) => {\n this.syncInteractionIdsWithRouter(ids, previous);\n }, { unless: this.navigationInProgress }); // TODO: I think the exclusive interaction prevents interactions starting while it's active so we might not need this.\n\n const urlChanges = new MutableStream<{ url: string, state: NavigationState }>();\n\n // The angular router doesn't always fire router events when the back button is pushed while a navigation\n // session is in progress. Sometimes we only know about it from the url change.\n // IMPORTANT ORDER DEPENDENCY\n // This only works because we're notified of the change after the router has started reacting to it. This\n // we can can use our navigationState to determine things.\n angularLocation.onUrlChange(url => {\n const navigationState = this._navigationStateModel.value;\n console.log(`URLChange -> ${url}`, { state: navigationState });\n urlChanges.publish({ url, state: navigationState });\n\n // The url has changed while we're in a transitional state\n if (navigationState.isTransitional) {\n const navigationInteraction = this.navigationState.interactionContext;\n if (navigationInteraction && navigationInteraction.isActive()) {\n this.runStateTransition(state => state.onBackClickedDuringNavigationInteraction(url));\n }\n }\n });\n }\n\n private processNavigationSuccess(session: NavigationState) {\n // We need to update the visits before the session finishes. This allows the placeOutets to ignore visit\n // changes that occur while routerNavigationActive is true.\n assert.isTruthy(this.navigationInProgress.value);\n const visits = session.getVisits();\n visits.forEach(v => this.placeHistory.add(v));\n this._activeVisits.value = visits;\n }\n\n get navigationState(): NavigationState {\n return this._navigationStateModel.value;\n }\n\n get navigationStateModel(): ValueModel<NavigationState> {\n return this._navigationStateModel.readonly;\n }\n\n get activeVisits(): ListModel<Visit> {\n return this._activeVisits.readonly;\n }\n\n /**\n * placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));\n * @param visit\n */\n async navigate(visit: Visit, options?: { relativeTo: ActivatedRoute }) {\n this.doNavigation(visit, async router => {\n const commands = [\n visit.placeDefinition.path,\n ...this.createRouteParameters(visit)\n ];\n await this.router.navigate(commands, {\n relativeTo: options ? options.relativeTo : null\n });\n });\n }\n\n // @Trace()\n async pushVisitChangesToRoute(activatedRoute: ActivatedRoute, previous: Visit, next: Visit) {\n // we have to push to history so our remember sanitisers don't pick up the previous value\n // when it's been cleared by the user.\n this.placeHistory.add(next);\n\n // FIXME: no route id -> route id duplicates route parameters\n if (next.hasRoutingChangedFrom(previous)) {\n return this.doNavigation(next, router => {\n const urlSnapshot = this.parseUrl(this.router.routerState.snapshot.url).updateVisitSegments(next);\n console.log('### Push Changes to route Redirect', { commands: urlSnapshot.url });\n return this.navigateByUrl(urlSnapshot);\n });\n }\n }\n\n async doNavigation(visit: Visit, runNavigationCommands: (router: Router) => any) {\n if (this.navigationInProgress.value) {\n lang.illegalState('Navigation already in progress');\n }\n this.runStateTransition(current => {\n const session = this.navigationState.onPlaceNavigationStart(visit, this.getCurrentRouterUrl());\n session.storeVisit(visit);\n return session;\n });\n try {\n await runNavigationCommands(this.router);\n } finally {\n // Router has finished (since there was no router change required) so we\n // need to end the navigation session.\n if (this.navigationState.isTransitional && !this.router.getCurrentNavigation()) {\n this.runStateTransition(session => session.onRouterEnd(new NavigationEnd(-1, '', '')));\n }\n }\n }\n\n // @Trace()\n protected runStateTransition(transition: (navigationSession: NavigationState) => NavigationState) {\n const previous = this._navigationStateModel.value;\n const next = transition(this.navigationState);\n this._navigationStateModel.value = next;\n if (next !== previous) {\n previous.dispose();\n Logger.get(this).info(`Router State Transition: ${previous.toString()} -> ${next.toString()}`);\n }\n }\n\n private createRouteParameters(visit: Visit) {\n const def = visit.placeDefinition;\n return visit.hasRouteId() ?\n [def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :\n [def.getFormattedRouteParameters(visit)];\n }\n\n extractChildPath(activatedRoute: ActivatedRouteSnapshot): any[] {\n return _.flatten(activatedRoute.children.map(child => child.url));\n }\n\n parseUrl(url: string): UrlSnapshot {\n return new UrlSnapshot(this.urlSerializer, url);\n }\n\n resetBrowserLocation(url: string) {\n this.angularLocation.go(url);\n }\n\n createUrlSnapshot(...visits: Visit[]): UrlSnapshot {\n const bits = [];\n visits.forEach(v => {\n bits.push(this.parseUrl(`${v.placeDefinition.path}`).updateVisitSegments(v).url);\n });\n return this.parseUrl(bits.join(''));\n }\n\n getCurrentRouterUrl(): string {\n return this.router.routerState ? this.router.routerState.snapshot.url : null;\n }\n\n getCurrentRouteSnapshot(): UrlSnapshot {\n return this.parseUrl(this.getCurrentRouterUrl());\n }\n\n getActiveInteractionIdsFromUrl(url: string): string[] {\n return this.parseUrl(url).getInteractionIds();\n }\n\n\n // @Trace()\n hasActiveInteractionIds(url: string) {\n return this.getActiveInteractionIdsFromUrl(url).length > 0;\n }\n\n // @Trace()\n navigateByUrl(urlSnapshot: UrlSnapshot, navigationExtras?: NavigationExtras): Promise<boolean> {\n return this.router.navigateByUrl(urlSnapshot.urlTree, navigationExtras);\n }\n\n // TODO: Should this be moved to the navigation states?\n syncInteractionIdsWithRouter(currentIds: string[], previous: string[]) {\n assert.isFalsey(this.navigationInProgress.value); // Updating interaction routes during an existing navigation breaks all the things.\n console.log({\n startingActivity: currentIds.length > previous.length,\n wasBackButton: this.navigationState.isPopState\n });\n\n if (_.isEqual(currentIds, previous)) {\n console.log('activity ids were the same, skipping');\n } else {\n // OMG, this is nuts.\n const addingActivity = currentIds.length > previous.length;\n const isFirstActivity = addingActivity && previous.length < 1;\n const removingLastActivity = currentIds.length < 1;\n if (addingActivity) {// we're starting a new activity, push the change to the history and update the url\n console.log('adding activity');\n this.navigateByUrl(this.getCurrentRouteSnapshot().updateInteractionIds(currentIds), {\n replaceUrl: !isFirstActivity // we don't let the history pile up\n });\n } else {\n const urlSnapshot = this.getCurrentRouteSnapshot().updateInteractionIds(currentIds);\n if (removingLastActivity) {\n this.navigateByUrl(urlSnapshot, {\n replaceUrl: true\n }).then(() => {\n // for some reason we need to pop the last history off the stack when leaving the\n // active activity state.\n this.angularLocation.back();\n });\n } else {\n this.navigateByUrl(urlSnapshot, {\n replaceUrl: true\n });\n }\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"place-router.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/place-router.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAGL,gBAAgB,EAChB,aAAa,EACb,eAAe,EAEf,eAAe,EACf,MAAM,EACN,aAAa,EACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,MAAM,EAEN,GAAG,EACH,gBAAgB,EAEhB,IAAI,EAEJ,MAAM,EACN,gBAAgB,EA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BACJ;qBAAM;oBACL,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE;wBAC9B,UAAU,EAAE,IAAI;qBACjB,CAAC,CAAC;iBACJ;aACF;SACF;IACH,CAAC;;;YAnQF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;;YA5BC,MAAM;YACN,aAAa;YAXN,QAAQ;YA+BR,YAAY;YAFZ,kBAAkB;;;;;;;;IAYzB,4CAAkF;;;;;IAClF,oCAA+D;;IAE/D,2CAAmD;;IACnD,uCAAsE;;;;;IACtE,gDAA2D;;;;;IAC3D,gDAAmF;;;;;IAEvE,6BAA+B;;;;;IAC/B,oCAA6C;;;;;IAC7C,sCAA0C;;;;;IAC1C,mCAA2C;;;;;IAC3C,yCAAuD","sourcesContent":["import { Location } from '@angular/common';\nimport { Injectable } from '@angular/core';\nimport {\n ActivatedRoute,\n ActivatedRouteSnapshot,\n NavigationCancel,\n NavigationEnd,\n NavigationError,\n NavigationExtras,\n NavigationStart,\n Router,\n UrlSerializer\n} from '@angular/router';\nimport {\n assert,\n Constructable,\n Dsl,\n GarbageCollector,\n HasOneIndexChain,\n lang,\n ListModel,\n Logger,\n MutableListModel,\n MutableStream,\n MutableValueModel,\n ValueModel,\n ValueModelChain\n} from '@coolon/pectin';\nimport _ from 'lodash';\nimport { InteractionService } from '../interaction/services/interaction.service';\nimport { NavigationState } from './guards/navigation-state';\nimport { PlaceHistory } from './place-history';\nimport { UrlSnapshot } from './url-snapshot';\nimport { Visit } from './visit';\n\n\n@Injectable({\n providedIn: 'root'\n})\nexport class PlaceRouter extends GarbageCollector {\n\n private readonly _navigationStateModel = new MutableValueModel<NavigationState>();\n private readonly _activeVisits = new MutableListModel<Visit>();\n\n readonly navigationInProgress: ValueModel<boolean>;\n readonly activeVisitIndex: HasOneIndexChain<'placeDefinition', Visit>;\n private _navigationSessionContext: NavigationState.Context;\n private _navigationStateTypeModel: ValueModelChain<Constructable<NavigationState>>;\n\n constructor(private readonly router: Router,\n private readonly urlSerializer: UrlSerializer,\n private readonly angularLocation: Location,\n private readonly placeHistory: PlaceHistory,\n private readonly interactionService: InteractionService) {\n super();\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n this.activeVisitIndex = chain(this._activeVisits).indexBy('placeDefinition');\n this.navigationInProgress = chain(this.navigationStateModel).pluck('isTransitional');\n this._navigationSessionContext = new NavigationState.Context(this, this.interactionService, session => {\n this.processNavigationSuccess(session);\n });\n this._navigationStateModel.value = new NavigationState.Idle(this._navigationSessionContext);\n this._navigationStateTypeModel = chain(this._navigationStateModel).map(state => state.constructor as Constructable<NavigationState>);\n\n // TODO: make setup the callbacks in during module initiation to make this testable.\n this.router.events.subscribe(event => {\n // Routing event sequence\n // ======================\n // NavigationStart -> .... -> NavigationCancel --> redirect, go around again in the same session\n // NavigationStart -> .... -> NavigationEnd --> navigation complete, end session.\n // NavigationStart -> .... -> NavigationError --> navigation aborted, end session.\n // =======================\n if (event instanceof NavigationStart) {\n if (event.navigationTrigger === 'popstate') {\n this.runStateTransition(state => state.onPopState(event));\n } else {\n this.runStateTransition(state => state.onRouterStarted(event));\n }\n }\n if (event instanceof NavigationEnd) {\n console.log(event);\n this.runStateTransition(state => state.onRouterEnd(event));\n }\n if (event instanceof NavigationError) {\n console.log(event);\n this.runStateTransition(state => state.onRouterError(event));\n }\n if (event instanceof NavigationCancel) {\n console.log(event);\n this.runStateTransition(state => state.onRouterCancelled(event));\n }\n });\n\n // Push dialog state to the url so we can capture the back button.\n when.listOf(this.interactionService.activeInteractionContextIds).changes((ids, previous) => {\n this.syncInteractionIdsWithRouter(ids, previous);\n }, { unless: this.navigationInProgress }); // TODO: I think the exclusive interaction prevents interactions starting while it's active so we might not need this.\n\n const urlChanges = new MutableStream<{ url: string, state: NavigationState }>();\n\n // The angular router doesn't always fire router events when the back button is pushed while a navigation\n // session is in progress. Sometimes we only know about it from the url change.\n // IMPORTANT ORDER DEPENDENCY\n // This only works because we're notified of the change after the router has started reacting to it. This\n // we can can use our navigationState to determine things.\n angularLocation.onUrlChange(url => {\n const navigationState = this._navigationStateModel.value;\n console.log(`URLChange -> ${url}`, { state: navigationState });\n urlChanges.publish({ url, state: navigationState });\n\n // The url has changed while we're in a transitional state\n if (navigationState.isTransitional) {\n const navigationInteraction = this.navigationState.interactionContext;\n if (navigationInteraction && navigationInteraction.isActive()) {\n this.runStateTransition(state => state.onBackClickedDuringNavigationInteraction(url));\n }\n }\n });\n }\n\n private processNavigationSuccess(session: NavigationState) {\n // We need to update the visits before the session finishes. This allows the placeOutets to ignore visit\n // changes that occur while routerNavigationActive is true.\n assert.isTruthy(this.navigationInProgress.value);\n const visits = session.getVisits();\n visits.forEach(v => this.placeHistory.add(v));\n this._activeVisits.value = visits;\n }\n\n get navigationState(): NavigationState {\n return this._navigationStateModel.value;\n }\n\n get navigationStateModel(): ValueModel<NavigationState> {\n return this._navigationStateModel.readonly;\n }\n\n get activeVisits(): ListModel<Visit> {\n return this._activeVisits.readonly;\n }\n\n /**\n * placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));\n * @param visit\n */\n async navigate(visit: Visit, options?: { relativeTo: ActivatedRoute }) {\n this.doNavigation(visit, async router => {\n const commands = [\n visit.placeDefinition.path,\n ...this.createRouteParameters(visit)\n ];\n await this.router.navigate(commands, {\n relativeTo: options ? options.relativeTo : null\n });\n });\n }\n\n // @Trace()\n async pushVisitChangesToRoute(activatedRoute: ActivatedRoute, previous: Visit, next: Visit) {\n // we have to push to history so our remember sanitisers don't pick up the previous value\n // when it's been cleared by the user.\n this.placeHistory.add(next);\n\n // FIXME: no route id -> route id duplicates route parameters\n if (next.hasRoutingChangedFrom(previous)) {\n return this.doNavigation(next, router => {\n const urlSnapshot = this.parseUrl(this.router.routerState.snapshot.url).updateVisitSegments(next);\n console.log('### Push Changes to route Redirect', { commands: urlSnapshot.url });\n return this.navigateByUrl(urlSnapshot);\n });\n }\n }\n\n async doNavigation(visit: Visit, runNavigationCommands: (router: Router) => any) {\n if (this.navigationInProgress.value) {\n lang.illegalState('Navigation already in progress');\n }\n this.runStateTransition(current => {\n const session = this.navigationState.onPlaceNavigationStart(visit, this.getCurrentRouterUrl());\n session.storeVisit(visit);\n return session;\n });\n try {\n await runNavigationCommands(this.router);\n } finally {\n // Router has finished (since there was no router change required) so we\n // need to end the navigation session.\n if (this.navigationState.isTransitional && !this.router.getCurrentNavigation()) {\n this.runStateTransition(session => session.onRouterEnd(new NavigationEnd(-1, '', '')));\n }\n }\n }\n\n // @Trace()\n protected runStateTransition(transition: (navigationSession: NavigationState) => NavigationState) {\n const previous = this._navigationStateModel.value;\n const next = transition(this.navigationState);\n this._navigationStateModel.value = next;\n if (next !== previous) {\n previous.dispose();\n Logger.get(this).info(`Router State Transition: ${previous.toString()} -> ${next.toString()}`);\n }\n }\n\n private createRouteParameters(visit: Visit) {\n const def = visit.placeDefinition;\n return visit.hasRouteId() ?\n [def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :\n [def.getFormattedRouteParameters(visit)];\n }\n\n extractChildPath(activatedRoute: ActivatedRouteSnapshot): any[] {\n return _.flatten(activatedRoute.children.map(child => child.url));\n }\n\n parseUrl(url: string): UrlSnapshot {\n return new UrlSnapshot(this.urlSerializer, url);\n }\n\n resetBrowserLocation(url: string, options: { replaceCurrent: boolean }) {\n options.replaceCurrent ? this.angularLocation.replaceState(url) : this.angularLocation.go(url);\n }\n\n forward() {\n this.angularLocation.forward();\n }\n\n createUrlSnapshot(...visits: Visit[]): UrlSnapshot {\n const bits = [];\n visits.forEach(v => {\n bits.push(this.parseUrl(`${v.placeDefinition.path}`).updateVisitSegments(v).url);\n });\n return this.parseUrl(bits.join(''));\n }\n\n getCurrentRouterUrl(): string {\n return this.router.routerState ? this.router.routerState.snapshot.url : null;\n }\n\n getCurrentRouteSnapshot(): UrlSnapshot {\n return this.parseUrl(this.getCurrentRouterUrl());\n }\n\n getActiveInteractionIdsFromUrl(url: string): string[] {\n return this.parseUrl(url).getInteractionIds();\n }\n\n\n // @Trace()\n hasActiveInteractionIds(url: string) {\n return this.getActiveInteractionIdsFromUrl(url).length > 0;\n }\n\n // @Trace()\n navigateByUrl(urlSnapshot: UrlSnapshot, navigationExtras?: NavigationExtras): Promise<boolean> {\n return this.router.navigateByUrl(urlSnapshot.urlTree, navigationExtras);\n }\n\n // TODO: Should this be moved to the navigation states?\n syncInteractionIdsWithRouter(currentIds: string[], previous: string[]) {\n assert.isFalsey(this.navigationInProgress.value); // Updating interaction routes during an existing navigation breaks all the things.\n console.log({\n startingActivity: currentIds.length > previous.length,\n wasBackButton: this.navigationState.isPopState\n });\n\n if (_.isEqual(currentIds, previous)) {\n console.log('activity ids were the same, skipping');\n } else {\n // OMG, this is nuts.\n const addingActivity = currentIds.length > previous.length;\n const isFirstActivity = addingActivity && previous.length < 1;\n const removingLastActivity = currentIds.length < 1;\n if (addingActivity) {// we're starting a new activity, push the change to the history and update the url\n console.log('adding activity');\n this.navigateByUrl(this.getCurrentRouteSnapshot().updateInteractionIds(currentIds), {\n replaceUrl: !isFirstActivity // we don't let the history pile up\n });\n } else {\n const urlSnapshot = this.getCurrentRouteSnapshot().updateInteractionIds(currentIds);\n if (removingLastActivity) {\n this.navigateByUrl(urlSnapshot, {\n replaceUrl: true\n }).then(() => {\n // for some reason we need to pop the last history off the stack when leaving the\n // active activity state.\n this.angularLocation.back();\n });\n } else {\n this.navigateByUrl(urlSnapshot, {\n replaceUrl: true\n });\n }\n }\n }\n }\n}\n"]}
|