@coolon/angular-ui-powerups 0.0.116 → 0.0.117

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.
@@ -13,6 +13,7 @@ export declare abstract class NavigationState extends GarbageCollector {
13
13
  abstract readonly isTransitional: boolean;
14
14
  abstract readonly startingUrl: string;
15
15
  abstract readonly isPopState: boolean;
16
+ debugPropertyKeys: string[];
16
17
  constructor(context: NavigationState.Context);
17
18
  readonly name: string;
18
19
  readonly idle: boolean;
@@ -35,7 +36,9 @@ export declare abstract class NavigationState extends GarbageCollector {
35
36
  protected createTransitionStateFor(event: NavigationStart): any;
36
37
  protected createIdleState(): any;
37
38
  resetBrowserLocation(url: any): void;
39
+ ignore(event: RouterEvent, reason?: string): NavigationState;
38
40
  toString(): string;
41
+ protected debugState(properties?: string[]): string;
39
42
  }
40
43
  export declare namespace NavigationState {
41
44
  class Context {
@@ -62,61 +65,155 @@ export declare namespace NavigationState {
62
65
  readonly interactionContext: InteractionContext;
63
66
  onRouterStarted(event: NavigationStart): NavigationState;
64
67
  onRouterEnd(event: NavigationEnd): NavigationState;
65
- onBackClickedDuringNavigationInteraction(locationTriggerUrl: string): NavigationState;
68
+ onBackClickedDuringNavigationInteraction(newUrl: string): NavigationState;
69
+ abstract createNavigationInteractionCancelledState(newUrl: string): NavigationState;
66
70
  canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot>;
67
- private detachInteractionContext;
71
+ protected detachInteractionContext(): InteractionContext;
68
72
  }
69
73
  class NavigationTransition extends AbstractNavigationTransition {
70
74
  readonly isPopState = false;
75
+ debugPropertyKeys: string[];
71
76
  onRouterCancelled(event: NavigationCancel): NavigationState;
72
77
  onRouterError(event: NavigationError): NavigationState;
73
- toString(): string;
78
+ createNavigationInteractionCancelledState(newUrl: string): NavigationState;
74
79
  }
75
80
  class PopStateTransition extends AbstractNavigationTransition {
81
+ readonly poppedHistoryUrl: string;
76
82
  readonly isPopState = true;
83
+ debugPropertyKeys: string[];
84
+ constructor(context: NavigationState.Context, startingUrl: string, poppedHistoryUrl: string);
77
85
  onRouterCancelled(event: NavigationCancel): NavigationState;
78
86
  onRouterError(event: NavigationError): NavigationState;
87
+ createNavigationInteractionCancelledState(locationTriggerUrl: string): NavigationState;
79
88
  }
89
+ abstract class AbstractInteractionTransition extends AbstractNavigationTransition {
90
+ readonly startingUrl: string;
91
+ readonly isTransitional = true;
92
+ constructor(context: Context, startingUrl: string);
93
+ }
94
+ /**
95
+ * This is the non transitional (i.e. rest) state that is used whenever an interaction context is active.
96
+ */
80
97
  class IdleDuringInteraction extends NavigationState {
81
98
  readonly startingUrl: string;
82
99
  readonly isTransitional = false;
83
100
  readonly isPopState = false;
101
+ debugPropertyKeys: string[];
84
102
  constructor(context: Context, startingUrl: string);
85
103
  onPlaceNavigationStart(visit: Visit, initialUrl: string): NavigationState;
86
104
  onRouterStarted(event: NavigationStart): NavigationState;
87
105
  onPopState(event: NavigationStart): NavigationState;
88
106
  }
89
- abstract class AbstractInteractionTransition extends AbstractNavigationTransition {
90
- readonly startingUrl: string;
91
- readonly isTransitional = true;
92
- constructor(context: Context, startingUrl: string);
93
- }
94
107
  /**
95
108
  * This state exists to handle all events while any kind of navigation is in progress. That way all other states can
96
109
  * happily ignore interaction contexts.
110
+ * NOTE: This state is activated when ever an interaction is started. It might be better to split it into
111
+ * different states for different scenarios, e.g. starting model, starting model during route guard etc.
97
112
  */
98
- class InteractionTransition extends AbstractInteractionTransition {
113
+ class StartingInteractionTransition extends AbstractInteractionTransition {
99
114
  readonly isPopState = false;
100
115
  onRouterCancelled(event: NavigationCancel): NavigationState;
101
116
  onRouterError(event: NavigationError): NavigationState;
102
117
  onRouterEnd(event: NavigationEnd): NavigationState;
118
+ createNavigationInteractionCancelledState(locationTriggerUrl: string): NavigationState;
119
+ }
120
+ /**
121
+ * The sequence of router events are:
122
+ * Error -> url = url of navigation link
123
+ * End
124
+ * onPopState url = current intereaction url sans the query params
125
+ * Cancel url == same as above.
126
+ */
127
+ class LeavingInteractionTransitionCancelled extends NavigationState {
128
+ readonly startingUrl: string;
129
+ readonly locationChangeTriggerUrl: string;
130
+ readonly isPopState = false;
131
+ firstCancelHandled: boolean;
132
+ popStateHandled: boolean;
133
+ popStateEventUrl: string;
134
+ debugPropertyKeys: string[];
135
+ constructor(context: Context, startingUrl: string, locationChangeTriggerUrl: string);
136
+ readonly isTransitional: boolean;
137
+ onRouterStarted(event: NavigationStart): NavigationState;
138
+ onRouterCancelled(event: NavigationCancel): NavigationState;
139
+ onRouterEnd(event: NavigationEnd): NavigationState;
140
+ onRouterError(event: NavigationError): NavigationState;
141
+ onPopState(event: NavigationStart): NavigationState;
142
+ canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot>;
103
143
  }
104
144
  /**
105
145
  * This state exists to handle all events while any kind of navigation is in progress. That way all other states can
106
146
  * happily ignore interaction contexts.
107
147
  */
108
- class InteractionPopStateTransition extends AbstractInteractionTransition {
148
+ class LeavingInteractionAfterPopStateTransition extends AbstractInteractionTransition {
149
+ readonly poppedHistoryUrl: string;
109
150
  readonly isPopState = true;
151
+ constructor(context: NavigationState.Context, startingUrl: string, poppedHistoryUrl: string);
110
152
  onRouterCancelled(event: NavigationCancel): NavigationState;
111
153
  onRouterEnd(event: NavigationEnd): NavigationState;
154
+ createNavigationInteractionCancelledState(newUrl: string): NavigationState;
112
155
  }
113
- class CancelledDuringNavigationInteraction extends NavigationState {
156
+ /**
157
+ * This state handles the scenario where a link navigation triggered an interaction and the user clicked back a to cancel it.
158
+ * The routing event sequence is different depending on the link that was clicked.
159
+ *
160
+ * 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:
161
+ *
162
+ * -> Idle -> NavigationTransition
163
+ * -> confirm dialog shown.
164
+ * -> click back
165
+ * -> NavigationCancel -> clickedLinkUrl === cancel.url
166
+ * -> NavigationEnd
167
+ *
168
+ * Otherwise if the link is different from teh history location then the sequence is:
169
+ *
170
+ * -> Idle -> NavigationTransition
171
+ * -> confirm dialog shown.
172
+ * -> click back
173
+ * -> NavigationCancel -> clickedLinkUrl !== cancel.url
174
+ * -> NavigationEnd
175
+ * -> PopState
176
+ * -> NavigationCancel
177
+ */
178
+ class LinkTriggeredNavigationInteractionCancelled extends NavigationState {
179
+ readonly startingUrl: string;
180
+ readonly clickedLinkUrl: string;
181
+ readonly isPopState = false;
182
+ firstCancelEventUrl: string;
183
+ popStateEventUrl: string;
184
+ clickedLinkMatchedBackButtonUrl: boolean;
185
+ debugPropertyKeys: string[];
186
+ constructor(context: Context, startingUrl: string, clickedLinkUrl: string);
187
+ readonly isTransitional: boolean;
188
+ onRouterStarted(event: NavigationStart): NavigationState;
189
+ onRouterCancelled(event: NavigationCancel): NavigationState;
190
+ onRouterEnd(event: NavigationEnd): NavigationState;
191
+ onRouterError(event: NavigationError): NavigationState;
192
+ onPopState(event: NavigationStart): NavigationState;
193
+ finaliseRouting(): any;
194
+ canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot>;
195
+ }
196
+ /**
197
+ * This state handles the scenario where a pop state triggered and interaction and the user clickeb back a second time to cancel it.
198
+ * The sequence of routing events/state transitions is as follows.
199
+ * -> Idle -> PopStateTransition (poppedHistoryUrl == page to go to, startingUrl = page to stay on )
200
+ * -> confirm dialog shown.
201
+ * -> click back
202
+ * -> PopStateTransition -> CancelledDuringBackButtonNavigationInteraction(trigger url is the page before the popped history url)
203
+ * -> NavigationCancel (for the previous back)
204
+ * -> PopState
205
+ * -> NavigationCancel
206
+ */
207
+ class PopStateTriggeredNavigationInteractionCancelled extends NavigationState {
114
208
  readonly startingUrl: string;
115
- readonly startingEventWasAPopState: boolean;
116
209
  readonly locationChangeTriggerUrl: string;
210
+ readonly poppedHistoryUrl: string;
117
211
  readonly isPopState = false;
118
- private gotPopStateWithLeavingUrl;
119
- constructor(context: Context, startingUrl: string, startingEventWasAPopState: boolean, locationChangeTriggerUrl: string);
212
+ firstCancelHandled: boolean;
213
+ popStateHandled: boolean;
214
+ popStateEventUrl: string;
215
+ debugPropertyKeys: string[];
216
+ constructor(context: Context, startingUrl: string, locationChangeTriggerUrl: string, poppedHistoryUrl: string);
120
217
  readonly isTransitional: boolean;
121
218
  onRouterStarted(event: NavigationStart): NavigationState;
122
219
  onRouterCancelled(event: NavigationCancel): NavigationState;
@@ -124,7 +221,5 @@ export declare namespace NavigationState {
124
221
  onRouterError(event: NavigationError): NavigationState;
125
222
  onPopState(event: NavigationStart): NavigationState;
126
223
  canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot>;
127
- ignore(event: RouterEvent, reason?: string): NavigationState;
128
- toString(): string;
129
224
  }
130
225
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coolon/angular-ui-powerups",
3
- "version": "0.0.116",
3
+ "version": "0.0.117",
4
4
  "schematics": "./schematics/collection.json",
5
5
  "dependencies": {
6
6
  "ts-morph": "^3.1.3",
@@ -15,7 +15,7 @@
15
15
  "@angular/material": "^8.2.3",
16
16
  "@angular/animations": "^8.2.14",
17
17
  "@angular/cdk": "^8.2.3",
18
- "@coolon/pectin": ">=1.15.23",
18
+ "@coolon/pectin": "1.15.0",
19
19
  "resize-observer-polyfill": "^1.5.1"
20
20
  },
21
21
  "main": "bundles/coolon-angular-ui-powerups.umd.js",