@coolon/angular-ui-powerups 0.0.98 → 0.0.101

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +1351 -1109
  2. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  3. package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  5. package/coolon-angular-ui-powerups.d.ts +19 -19
  6. package/coolon-angular-ui-powerups.metadata.json +1 -1
  7. package/esm2015/coolon-angular-ui-powerups.js +19 -19
  8. package/esm2015/index.js +2 -2
  9. package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +19 -5
  10. package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +13 -3
  11. package/esm2015/lib/interaction/index.js +5 -4
  12. package/esm2015/lib/interaction/interaction-context.js +7 -53
  13. package/esm2015/lib/interaction/interaction.module.js +3 -3
  14. package/esm2015/lib/interaction/services/interaction.service.js +228 -0
  15. package/esm2015/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.js +62 -0
  16. package/esm2015/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context.js +145 -0
  17. package/esm2015/lib/interaction/services/modal-interaction-context.factory.js +17 -0
  18. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +3 -3
  19. package/esm2015/lib/place/guards/abstract-place.guard.js +13 -12
  20. package/esm2015/lib/place/guards/interaction.guard.js +27 -19
  21. package/esm2015/lib/place/guards/navigation-state.js +309 -246
  22. package/esm2015/lib/place/place-router.js +160 -115
  23. package/esm2015/lib/place/url-snapshot.js +91 -19
  24. package/esm2015/public_api.js +2 -2
  25. package/esm5/coolon-angular-ui-powerups.js +19 -19
  26. package/esm5/index.js +2 -2
  27. package/esm5/lib/interaction/components/activity-container/activity-container.component.js +23 -14
  28. package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +10 -3
  29. package/esm5/lib/interaction/index.js +5 -4
  30. package/esm5/lib/interaction/interaction-context.js +8 -61
  31. package/esm5/lib/interaction/interaction.module.js +3 -3
  32. package/esm5/lib/interaction/services/interaction.service.js +271 -0
  33. package/esm5/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.js +65 -0
  34. package/esm5/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context.js +170 -0
  35. package/esm5/lib/interaction/services/modal-interaction-context.factory.js +27 -0
  36. package/esm5/lib/place/components/place-outlet/place-outlet.component.js +3 -3
  37. package/esm5/lib/place/guards/abstract-place.guard.js +15 -14
  38. package/esm5/lib/place/guards/interaction.guard.js +25 -17
  39. package/esm5/lib/place/guards/navigation-state.js +422 -292
  40. package/esm5/lib/place/place-router.js +182 -133
  41. package/esm5/lib/place/url-snapshot.js +105 -21
  42. package/esm5/public_api.js +2 -2
  43. package/fesm2015/coolon-angular-ui-powerups.js +1112 -918
  44. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  45. package/fesm5/coolon-angular-ui-powerups.js +1302 -1060
  46. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  47. package/lib/interaction/components/activity-container/activity-container.component.d.ts +1 -0
  48. package/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.d.ts +3 -1
  49. package/lib/interaction/index.d.ts +4 -3
  50. package/lib/interaction/interaction-context.d.ts +2 -11
  51. package/lib/interaction/services/interaction.service.d.ts +46 -0
  52. package/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.d.ts +15 -0
  53. package/lib/interaction/services/{dialog-interaction-context.d.ts → mat-dialog-interaction/dialog-interaction-context.d.ts} +2 -2
  54. package/lib/interaction/services/modal-interaction-context.factory.d.ts +4 -0
  55. package/lib/place/guards/abstract-place.guard.d.ts +1 -1
  56. package/lib/place/guards/interaction.guard.d.ts +3 -3
  57. package/lib/place/guards/navigation-state.d.ts +65 -37
  58. package/lib/place/place-router.d.ts +15 -22
  59. package/lib/place/url-snapshot.d.ts +18 -6
  60. package/package.json +1 -1
  61. package/schematics/place-routes/templates/place-routes.ts.template +3 -3
  62. package/styles/styles.scss +1 -1
  63. package/esm2015/lib/interaction/services/dialog-interaction-context.js +0 -163
  64. package/esm2015/lib/interaction/services/dialog-interaction.service.js +0 -151
  65. package/esm2015/lib/interaction/services/modal-interaction.service.js +0 -109
  66. package/esm5/lib/interaction/services/dialog-interaction-context.js +0 -188
  67. package/esm5/lib/interaction/services/dialog-interaction.service.js +0 -179
  68. package/esm5/lib/interaction/services/modal-interaction.service.js +0 -153
  69. package/lib/interaction/services/dialog-interaction.service.d.ts +0 -24
  70. package/lib/interaction/services/modal-interaction.service.d.ts +0 -15
@@ -25,6 +25,7 @@ declare class TabContext<D, R, E> implements ActivityOutletContext<D, R, E> {
25
25
  readonly component: Activity<D, R, E>;
26
26
  onDone(result: R): void;
27
27
  onCancel(error: E): void;
28
+ dispose(): void;
28
29
  }
29
30
  export declare class ActivityContainerComponent<D, R, E> extends InteractionContextBase implements OnInit, AfterViewInit {
30
31
  private readonly throttledNestedActivityFinishEvents;
@@ -2,13 +2,15 @@ import { AfterViewInit } from '@angular/core';
2
2
  import { Constructable } from '@coolon/pectin';
3
3
  import { Activity } from '../../activity';
4
4
  import { InteractionContextBase } from '../../interaction-context-base';
5
+ import { InteractionService } from '../../services/interaction.service';
5
6
  import { ActivityContainerComponent } from '../activity-container/activity-container.component';
6
7
  import { ActivityOutletContext } from '../activity-outlet/activity-outlet-context';
7
8
  export declare class InplaceInteractionContextComponent<D, R, E> extends InteractionContextBase implements AfterViewInit {
9
+ readonly interactionService: InteractionService;
8
10
  interactionContext: ActivityContainerComponent<any, any, any>;
9
11
  initialActivityContext: ActivityOutletContext<D, R, E>;
10
12
  private _active;
11
- constructor();
13
+ constructor(interactionService: InteractionService);
12
14
  ngAfterViewInit(): void;
13
15
  readonly active: import("@coolon/pectin").ValueModel<boolean>;
14
16
  protected _startActivity<D1, R1, E1>(activityType: Constructable<Activity<D1, R1, E1>>, data?: D1): Promise<R1>;
@@ -17,6 +17,7 @@ export * from "./components/confirm-then-dialog/confirm-then-dialog.component";
17
17
  export * from "./components/confirmation-dialog/confirmation-dialog.component";
18
18
  export * from "./components/inplace-interaction-context/inplace-interaction-context.component";
19
19
  export * from "./components/interaction-outlet/interaction-outlet.component";
20
- export * from "./services/dialog-interaction-context";
21
- export * from "./services/dialog-interaction.service";
22
- export * from "./services/modal-interaction.service";
20
+ export * from "./services/interaction.service";
21
+ export * from "./services/modal-interaction-context.factory";
22
+ export * from "./services/mat-dialog-interaction/dialog-interaction-context-factory";
23
+ export * from "./services/mat-dialog-interaction/dialog-interaction-context";
@@ -1,18 +1,15 @@
1
- import { Constructable, Disposable, GarbageCollector, ListModel, ValueModel } from '@coolon/pectin';
1
+ import { Constructable, GarbageCollector, ListModel, ValueModel } from '@coolon/pectin';
2
2
  import { Activity } from './activity';
3
3
  import { Alert } from './alert';
4
4
  import { Confirm } from './confirm';
5
5
  export declare abstract class InteractionContext extends GarbageCollector {
6
- private readonly activityListeners;
7
6
  abstract readonly activityList: ListModel<Activity<any, any, any>>;
8
7
  abstract readonly active: ValueModel<boolean>;
9
8
  /**
10
9
  * Returns true if an activity is currently running.
11
10
  */
12
11
  isActive(): boolean;
13
- addActivityListener(listener: InteractionContext.Listener): Disposable;
14
- protected notifyActivityStarted(): void;
15
- protected notifyActivityFinished(): void;
12
+ dispose(): void;
16
13
  /**
17
14
  * Returns the activity that is currently active.
18
15
  * This model is only updated in the next tick after the view has been updated.
@@ -30,9 +27,3 @@ export declare abstract class InteractionContext extends GarbageCollector {
30
27
  */
31
28
  abstract confirmThen<D, R, E>(confirm: Confirm, activityType: Constructable<Activity<D, R, E>>, data?: D): Promise<R>;
32
29
  }
33
- export declare namespace InteractionContext {
34
- interface Listener {
35
- onActivityStarted(): void;
36
- onActivityFinished(): void;
37
- }
38
- }
@@ -0,0 +1,46 @@
1
+ import { BooleanValueModelChain, Disposable, GarbageCollector, ListModelChain, MutableValueModel, ValueModel } from '@coolon/pectin';
2
+ import { Activity } from '../activity';
3
+ import { InteractionContext } from '../interaction-context';
4
+ import { ModalInteractionContextFactory } from './modal-interaction-context.factory';
5
+ export declare class InteractionService {
6
+ readonly modelInteractionContextFactory: ModalInteractionContextFactory;
7
+ private readonly garbage;
8
+ readonly active: BooleanValueModelChain;
9
+ private readonly exclusiveContext;
10
+ private readonly _activeModalInteractionContextModel;
11
+ private readonly _activeInlineInteractionContextModel;
12
+ private readonly _activeInteractionContext;
13
+ readonly activeInteractionContextIds: ListModelChain<string>;
14
+ readonly modelInteractionActive: BooleanValueModelChain;
15
+ readonly inlineInteractionActive: BooleanValueModelChain;
16
+ constructor(modelInteractionContextFactory: ModalInteractionContextFactory);
17
+ isActive(): boolean;
18
+ createModalInteractionContextFor(disposable: Disposable.Collector): InteractionContext;
19
+ _registerInplaceInteractionContext(interactionContext: InteractionContext): void;
20
+ getCurrentActivity(): Promise<Activity<any, any, any>>;
21
+ /**
22
+ * Creates an interaction context that will prevent any other contexts from starting an
23
+ * activity until it is disposed. This is intended for use by the router for passing
24
+ * to PlaceComponent.canDeactivate(interactionContext). This ensures components don't
25
+ * try and interact in a way that we can't track and synchronise with the browser back
26
+ * button.
27
+ */
28
+ _createExclusiveModalInteractionContext(): InteractionContext;
29
+ }
30
+ export declare namespace InteractionService {
31
+ interface Callback {
32
+ onStarted(monitor: Monitor): any;
33
+ onFinished(monitor: Monitor): any;
34
+ }
35
+ class Monitor extends GarbageCollector {
36
+ readonly id: string;
37
+ readonly interactionContext: InteractionContext;
38
+ readonly currentActiveMonitor: MutableValueModel<Monitor>;
39
+ readonly exclusiveContext: ValueModel<InteractionContext>;
40
+ constructor(id: string, interactionContext: InteractionContext, currentActiveMonitor: MutableValueModel<Monitor>, exclusiveContext: ValueModel<InteractionContext>);
41
+ protected onStarted(): void;
42
+ private assertCanStart;
43
+ protected onFinished(): void;
44
+ private assertCurrentlyActive;
45
+ }
46
+ }
@@ -0,0 +1,15 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { MatDialog } from '@angular/material';
3
+ import { MatDialogConfig } from '@angular/material/dialog';
4
+ import { BooleanValueModelChain } from '@coolon/pectin';
5
+ import { InteractionContext } from '../../interaction-context';
6
+ import { ModalInteractionContextFactory } from '../modal-interaction-context.factory';
7
+ export declare const DIALOG_INTERACTION_SERVICE_DEFAULTS: InjectionToken<MatDialogConfig<any>>;
8
+ export declare class DialogInteractionContextFactory extends ModalInteractionContextFactory {
9
+ private readonly dialogService;
10
+ readonly dialogServiceDefaults: MatDialogConfig<any>;
11
+ readonly matDialogDefaultConfig: MatDialogConfig<any>;
12
+ readonly active: BooleanValueModelChain;
13
+ constructor(dialogService: MatDialog, dialogServiceDefaults: MatDialogConfig<any>, matDialogDefaultConfig: MatDialogConfig<any>);
14
+ createInteractionContext(): InteractionContext;
15
+ }
@@ -1,8 +1,8 @@
1
1
  import { MatDialog } from '@angular/material';
2
2
  import { MatDialogConfig } from '@angular/material/dialog';
3
3
  import { Constructable, ListModel, ValueModel } from '@coolon/pectin';
4
- import { Activity } from '../activity';
5
- import { InteractionContextBase } from '../interaction-context-base';
4
+ import { Activity } from '../../activity';
5
+ import { InteractionContextBase } from '../../interaction-context-base';
6
6
  export declare class DialogInteractionContext extends InteractionContextBase {
7
7
  private readonly dialogService;
8
8
  readonly config: MatDialogConfig<any>;
@@ -0,0 +1,4 @@
1
+ import { InteractionContext } from '../interaction-context';
2
+ export declare abstract class ModalInteractionContextFactory {
3
+ abstract createInteractionContext(): InteractionContext;
4
+ }
@@ -13,7 +13,7 @@ export declare abstract class AbstractPlaceGuard implements CanActivate, CanDeac
13
13
  constructor(router: Router, urlSerializer: UrlSerializer, placeRouter: PlaceRouter, placeHistory: PlaceHistory, injector: Injector);
14
14
  canActivate(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree>;
15
15
  canDeactivate(component: PlaceComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Promise<boolean>;
16
- protected authorisePlaceThen(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot, canActivate: (placeDefinition: PlaceDefinition) => Promise<boolean | UrlTree>): Promise<boolean | UrlTree>;
16
+ protected authorisePlaceThen(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot, runPlaceGuards: (placeDefinition: PlaceDefinition) => Promise<boolean | UrlTree>): Promise<boolean | UrlTree>;
17
17
  isAuthorised(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree>;
18
18
  abstract getAuthGuard(injector: Injector): CanActivate;
19
19
  }
@@ -3,15 +3,15 @@ import { Injector } from '@angular/core';
3
3
  import { ActivatedRouteSnapshot, CanActivate, CanDeactivate, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
4
4
  import { Observable } from 'rxjs';
5
5
  import { NoopComponent } from '../../components/noop/noop.component';
6
- import { ModalInteractionService } from '../../interaction/services/modal-interaction.service';
6
+ import { InteractionService } from '../../interaction/services/interaction.service';
7
7
  import { PlaceRouter } from '../place-router';
8
8
  export declare class InteractionGuard implements CanDeactivate<NoopComponent>, CanActivate {
9
9
  private router;
10
10
  private injector;
11
11
  private placeRouter;
12
12
  private readonly angularLocation;
13
- private readonly modalInteractionService;
14
- constructor(router: Router, injector: Injector, placeRouter: PlaceRouter, angularLocation: Location, modalInteractionService: ModalInteractionService);
13
+ private readonly interactionService;
14
+ constructor(router: Router, injector: Injector, placeRouter: PlaceRouter, angularLocation: Location, interactionService: InteractionService);
15
15
  canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
16
16
  canDeactivate(component: NoopComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Promise<boolean | UrlTree>;
17
17
  }
@@ -1,95 +1,123 @@
1
- import { Location } from '@angular/common';
2
- import { NavigationCancel, NavigationEnd, NavigationError, NavigationStart, Router, RouterEvent } from '@angular/router';
1
+ import { NavigationCancel, NavigationEnd, NavigationError, NavigationStart, RouterEvent } from '@angular/router';
3
2
  import { GarbageCollector } from '@coolon/pectin';
4
3
  import { InteractionContext } from '../../interaction/interaction-context';
5
- import { ModalInteractionService } from '../../interaction/services/modal-interaction.service';
4
+ import { InteractionService } from '../../interaction/services/interaction.service';
6
5
  import { PlaceComponent } from '../place-component';
7
6
  import { PlaceDefinition } from '../place-definition';
7
+ import { PlaceRouter } from '../place-router';
8
8
  import { UrlSnapshot } from '../url-snapshot';
9
9
  import { Visit } from '../visit';
10
10
  export declare abstract class NavigationState extends GarbageCollector {
11
11
  protected readonly context: NavigationState.Context;
12
12
  private _visits;
13
- abstract readonly isPopState: boolean;
14
- abstract readonly active: boolean;
13
+ abstract readonly isTransitional: boolean;
15
14
  abstract readonly startingUrl: string;
15
+ abstract readonly isPopState: boolean;
16
16
  constructor(context: NavigationState.Context);
17
+ readonly idle: boolean;
18
+ readonly placeRouter: PlaceRouter;
19
+ readonly interactionService: InteractionService;
17
20
  readonly interactionContext: InteractionContext;
18
21
  storeVisit(visit: Visit): void;
19
22
  getVisitFor(placeDef: PlaceDefinition): Visit;
20
- abstract onStart(event: NavigationStart): NavigationState;
21
- abstract onCancel(event: NavigationCancel): NavigationState;
22
- abstract onError(event: NavigationError): NavigationState;
23
- abstract onEnd(event: NavigationEnd): NavigationState;
23
+ onPopState(event: NavigationStart): NavigationState;
24
+ onStart(event: NavigationStart): NavigationState;
25
+ onCancel(event: NavigationCancel): NavigationState;
26
+ onError(event: NavigationError): NavigationState;
27
+ onEnd(event: NavigationEnd): NavigationState;
24
28
  onBackClickedDuringNavigationInteraction(newUrl: string): NavigationState;
25
- abstract canDeactivatePlace(component: PlaceComponent, nextState: UrlSnapshot): Promise<boolean>;
29
+ canDeactivatePlace(component: PlaceComponent, nextState: UrlSnapshot): Promise<boolean>;
26
30
  getVisits(): Visit[];
27
31
  protected illegalTransition<R>(message: string | RouterEvent): R;
28
32
  protected currentRouterUrl(): string;
29
- protected createActiveSession(event: NavigationStart): NavigationState.Active;
30
- protected updateLocation(url: any): void;
33
+ protected createTransitionStateFor(event: NavigationStart): NavigationState.NavigationBackTransition | NavigationState.NavigationTransition;
34
+ resetBrowserLocation(url: any): void;
31
35
  toString(): string;
32
36
  }
33
37
  export declare namespace NavigationState {
34
38
  class Context {
35
- readonly router: Router;
36
- readonly modalInteractionService: ModalInteractionService;
37
- readonly angularLocation: Location;
39
+ readonly placeRouter: PlaceRouter;
40
+ readonly interactionService: InteractionService;
38
41
  readonly notifySuccess: (success: NavigationState) => void;
39
- constructor(router: Router, modalInteractionService: ModalInteractionService, angularLocation: Location, notifySuccess: (success: NavigationState) => void);
42
+ constructor(placeRouter: PlaceRouter, interactionService: InteractionService, notifySuccess: (success: NavigationState) => void);
40
43
  }
41
44
  class Idle extends NavigationState {
42
- readonly isPopState: boolean;
43
- readonly active = false;
45
+ readonly isTransitional = false;
44
46
  readonly startingUrl: any;
47
+ readonly isPopState = false;
45
48
  constructor(context: Context);
46
- canDeactivatePlace(component: PlaceComponent, nextState: UrlSnapshot): Promise<boolean>;
47
49
  onStart(event: NavigationStart): NavigationState;
48
- onCancel(event: NavigationCancel): NavigationState;
49
- onEnd(event: NavigationEnd): NavigationState;
50
- onError(event: NavigationError): NavigationState;
50
+ onPopState(event: NavigationStart): NavigationState;
51
51
  }
52
- class Active extends NavigationState {
52
+ abstract class AbstractNavigationTransition extends NavigationState {
53
53
  readonly isPopState: boolean;
54
54
  readonly startingUrl: string;
55
- readonly active = true;
55
+ readonly isTransitional = true;
56
56
  private componentDeactivationHandlers;
57
57
  private _interactionContext;
58
58
  constructor(context: Context, isPopState: boolean, startingUrl: string);
59
59
  readonly interactionContext: InteractionContext;
60
60
  onStart(event: NavigationStart): NavigationState;
61
61
  onEnd(event: NavigationEnd): NavigationState;
62
- onCancel(event: NavigationCancel): NavigationState;
63
- onError(event: NavigationError): NavigationState;
64
62
  onBackClickedDuringNavigationInteraction(locationTriggerUrl: string): NavigationState;
65
63
  canDeactivatePlace(component: PlaceComponent, nextState: UrlSnapshot): Promise<boolean>;
66
64
  private detachInteractionContext;
65
+ }
66
+ class NavigationTransition extends AbstractNavigationTransition {
67
+ readonly isPopState = false;
68
+ onStart(event: NavigationStart): NavigationState;
69
+ onEnd(event: NavigationEnd): NavigationState;
70
+ onCancel(event: NavigationCancel): NavigationState;
71
+ onError(event: NavigationError): NavigationState;
67
72
  toString(): string;
68
73
  }
69
- class ModalInteractionSession extends NavigationState {
74
+ class NavigationBackTransition extends AbstractNavigationTransition {
75
+ readonly isPopState = true;
76
+ onCancel(event: NavigationCancel): NavigationState;
77
+ onError(event: NavigationError): NavigationState;
78
+ }
79
+ abstract class AbstractInteractionTransition extends NavigationState {
80
+ readonly startingUrl: string;
81
+ readonly isTransitional = true;
82
+ constructor(context: Context, startingUrl: string);
83
+ protected reinstateInteractionRoute(): void;
84
+ }
85
+ /**
86
+ * This state exists to handle all events while any kind of navigation is in progress. That way all other states can
87
+ * happily ignore interaction contexts.
88
+ */
89
+ class InteractionTransition extends AbstractInteractionTransition {
90
+ readonly isPopState = false;
91
+ onEnd(event: NavigationEnd): NavigationState;
92
+ }
93
+ /**
94
+ * This state exists to handle all events while any kind of navigation is in progress. That way all other states can
95
+ * happily ignore interaction contexts.
96
+ */
97
+ class InteractionBackTransition extends AbstractInteractionTransition {
98
+ readonly isPopState = true;
99
+ onEnd(event: NavigationEnd): NavigationState;
100
+ }
101
+ class IdleDuringInteraction extends NavigationState {
70
102
  readonly startingUrl: string;
71
- readonly active = false;
103
+ readonly isTransitional = false;
72
104
  readonly isPopState = false;
73
- static hasInteraction(url: string): boolean;
74
105
  constructor(context: Context, startingUrl: string);
75
106
  onStart(event: NavigationStart): NavigationState;
76
- onCancel(event: NavigationCancel): NavigationState;
77
- onEnd(event: NavigationEnd): NavigationState;
78
- onError(event: NavigationError): NavigationState;
79
- canDeactivatePlace(component: PlaceComponent, nextState: UrlSnapshot): Promise<boolean>;
107
+ onPopState(event: NavigationStart): NavigationState;
80
108
  }
81
109
  class CancelledDuringNavigationInteraction extends NavigationState {
82
110
  readonly startingUrl: string;
83
111
  readonly locationChangeTriggerUrl: string;
84
- readonly active = false;
85
- readonly isPopState: boolean;
112
+ readonly isPopState = false;
86
113
  private capturedFauxRouterStart;
87
114
  constructor(context: Context, startingUrl: string, locationChangeTriggerUrl: string);
88
- canDeactivatePlace(component: PlaceComponent, nextState: UrlSnapshot): Promise<boolean>;
115
+ readonly isTransitional: boolean;
116
+ onStart(event: NavigationStart): NavigationState;
89
117
  onCancel(event: NavigationCancel): NavigationState;
90
118
  onEnd(event: NavigationEnd): NavigationState;
91
119
  onError(event: NavigationError): NavigationState;
92
- onStart(event: NavigationStart): NavigationState;
120
+ onPopState(event: NavigationStart): NavigationState;
93
121
  ignore(event: RouterEvent, reason?: string): NavigationState;
94
122
  toString(): string;
95
123
  }
@@ -1,8 +1,7 @@
1
1
  import { Location } from '@angular/common';
2
- import { ActivatedRoute, ActivatedRouteSnapshot, Router, RouterStateSnapshot, UrlSerializer } from '@angular/router';
2
+ import { ActivatedRoute, ActivatedRouteSnapshot, Router, UrlSerializer } from '@angular/router';
3
3
  import { GarbageCollector, HasOneIndexChain, ListModel, ValueModel } from '@coolon/pectin';
4
- import { InteractionContext } from '../interaction/interaction-context';
5
- import { ModalInteractionService } from '../interaction/services/modal-interaction.service';
4
+ import { InteractionService } from '../interaction/services/interaction.service';
6
5
  import { NavigationState } from './guards/navigation-state';
7
6
  import { PlaceHistory } from './place-history';
8
7
  import { UrlSnapshot } from './url-snapshot';
@@ -12,17 +11,17 @@ export declare class PlaceRouter extends GarbageCollector {
12
11
  private readonly urlSerializer;
13
12
  private readonly angularLocation;
14
13
  private readonly placeHistory;
15
- private readonly modalInteractionService;
16
- private firstRoute;
17
- private readonly _navigationSessionModel;
14
+ private readonly interactionService;
15
+ private readonly _navigationStateModel;
18
16
  private readonly _activeVisits;
19
- readonly navigationSessionActive: ValueModel<boolean>;
17
+ readonly navigationInProgress: ValueModel<boolean>;
20
18
  readonly activeVisitIndex: HasOneIndexChain<'placeDefinition', Visit>;
21
19
  private _navigationSessionContext;
22
- constructor(router: Router, urlSerializer: UrlSerializer, angularLocation: Location, placeHistory: PlaceHistory, modalInteractionService: ModalInteractionService);
20
+ private _navigationStateTypeModel;
21
+ constructor(router: Router, urlSerializer: UrlSerializer, angularLocation: Location, placeHistory: PlaceHistory, interactionService: InteractionService);
23
22
  private processNavigationSuccess;
24
- readonly navigationSession: NavigationState;
25
- readonly navigationSessionModel: ValueModel<NavigationState>;
23
+ readonly navigationState: NavigationState;
24
+ readonly navigationStateModel: ValueModel<NavigationState>;
26
25
  readonly activeVisits: ListModel<Visit>;
27
26
  /**
28
27
  * placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));
@@ -36,16 +35,10 @@ export declare class PlaceRouter extends GarbageCollector {
36
35
  protected runStateTransition(transition: (navigationSession: NavigationState) => NavigationState): void;
37
36
  private createRouteParameters;
38
37
  extractChildPath(activatedRoute: ActivatedRouteSnapshot): any[];
39
- parseUrl(snapshot: RouterStateSnapshot): UrlSnapshot;
40
- }
41
- export declare namespace PlaceRouter {
42
- const INTERACTION_ROUTER_OUTLET = "aup-interaction";
43
- class InteractionRouteMediator implements InteractionContext.Listener {
44
- readonly navigationSessionModelActive: ValueModel<boolean>;
45
- readonly router: Router;
46
- constructor(navigationSessionModelActive: ValueModel<boolean>, router: Router);
47
- readonly isNavigating: boolean;
48
- onActivityStarted(): void;
49
- onActivityFinished(): void;
50
- }
38
+ parseUrl(url: string): UrlSnapshot;
39
+ resetBrowserLocation(url: string): void;
40
+ getCurrentRouterUrl(): string;
41
+ getActiveInteractionIdsFromUrl(url: string): string[];
42
+ hasActiveInteractionIds(url: string): boolean;
43
+ syncInteractionIdsWithRouter(): void;
51
44
  }
@@ -1,16 +1,28 @@
1
- import { UrlSegment, UrlTree } from '@angular/router';
1
+ import { UrlSegment, UrlSerializer } from '@angular/router';
2
2
  import { PlaceDefinition } from './place-definition';
3
3
  import { Visit } from './visit';
4
4
  export declare class UrlSnapshot {
5
- readonly urlTree: UrlTree;
6
- constructor(urlTree: UrlTree);
7
- cloneUrlSegmentList(): UrlSegment[];
8
- updateVisitSegments(visit: Visit): UrlSegment[];
5
+ readonly urlSerializer: UrlSerializer;
6
+ readonly url: string;
7
+ private readonly urlTree;
8
+ constructor(urlSerializer: UrlSerializer, url: string);
9
+ protected replaceExistingVisitSegmentsWith(visit: Visit): UrlSegment[];
10
+ private getPrimarySegments;
9
11
  /**
10
12
  * Converts the visit into segments. Please not that these segments are not e
11
13
  * @param visit
12
14
  */
13
- convertToUrlSegments(visit: Visit): UrlSegment[];
15
+ protected getSegmentsFor(visit: Visit): UrlSegment[];
14
16
  createRedirectCommandsFor(visit: Visit): any[];
15
17
  includesPathOf(placeDef: PlaceDefinition): UrlSegment;
18
+ getInteractionIds(): string[];
19
+ addOrReplaceInteractionIds(ids: string[]): UrlSnapshot;
20
+ }
21
+ export declare namespace UrlSnapshot {
22
+ const INTERACTION_ROUTER_OUTLET = "aup-interactions";
23
+ const INTERACTION_ROUTER_PATH = "active";
24
+ const INTERACTION_ID_SEPARATOR = "--";
25
+ function parseInteractionIds(path: string): string[];
26
+ function createPathIdFor(interactionIds: string[]): string;
27
+ function createInteractionOutletRouterCommands(interactionIds: string[]): string[];
16
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coolon/angular-ui-powerups",
3
- "version": "0.0.98",
3
+ "version": "0.0.101",
4
4
  "schematics": "./schematics/collection.json",
5
5
  "dependencies": {
6
6
  "ts-morph": "^3.1.3",
@@ -13,7 +13,7 @@
13
13
 
14
14
  import { Injectable, Injector } from '@angular/core';
15
15
  import { Router, UrlSerializer } from '@angular/router';
16
- import { AbstractPlaceGuard, PlaceHistory, PlaceRouter, InteractionGuard, NoopComponent } from '@coolon/angular-ui-powerups';
16
+ import { AbstractPlaceGuard, PlaceHistory, PlaceRouter, InteractionGuard, NoopComponent, UrlSnapshot } from '@coolon/angular-ui-powerups';
17
17
  import { <%= config.authGuard.className %> } from '<%= config.authGuard.importPath %>';
18
18
 
19
19
  <% placeDefs.forEach(def => { %>import {<%= def.componentClass %>} from "<%= def.importPath %>";
@@ -41,8 +41,8 @@ export const placeRoutes = [<% placeDefs.filter(def=> !def.isChild()).forEach(de
41
41
  <%= def.getRouteTemplate() %>,
42
42
  <% }) %>
43
43
  {
44
- path: "modal",
45
- outlet:PlaceRouter.INTERACTION_ROUTER_OUTLET,
44
+ path: "active/:ids", // Must match `${UrlSnapshot.INTERACTION_ROUTER_PATH}/:ids`
45
+ outlet:UrlSnapshot.INTERACTION_ROUTER_OUTLET,
46
46
  component: NoopComponent,
47
47
  canDeactivate: [InteractionGuard],
48
48
  canActivate: [InteractionGuard]
@@ -2,7 +2,7 @@
2
2
  --aup-default-padding: var(--default-padding, 18px);
3
3
  }
4
4
 
5
- .dialog-interaction-service {
5
+ .dialog-interaction-context {
6
6
  max-width: 95vw !important;
7
7
  max-height: 95vh !important;
8
8