@coolon/angular-ui-powerups 0.0.126 → 0.0.128

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 (350) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +3753 -3020
  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 +17 -18
  6. package/coolon-angular-ui-powerups.metadata.json +1 -1
  7. package/esm2015/coolon-angular-ui-powerups.js +16 -17
  8. package/esm2015/coolon-angular-ui-powerups.js.map +1 -1
  9. package/esm2015/coolon-angular-ui-powerups.metadata.json +1 -1
  10. package/esm2015/index.js +1 -1
  11. package/esm2015/index.js.map +1 -1
  12. package/esm2015/lib/angular-ui-powerups.module.ngfactory.js.map +1 -1
  13. package/esm2015/lib/interaction/abstract-interaction-context.js +104 -0
  14. package/esm2015/lib/interaction/abstract-interaction-context.js.map +1 -0
  15. package/esm2015/lib/interaction/abstract-interaction-context.metadata.json +1 -0
  16. package/esm2015/lib/interaction/activity-ref.js +123 -0
  17. package/esm2015/lib/interaction/activity-ref.js.map +1 -0
  18. package/esm2015/lib/interaction/activity-ref.metadata.json +1 -0
  19. package/esm2015/lib/interaction/activity.js +21 -1
  20. package/esm2015/lib/interaction/activity.js.map +1 -1
  21. package/esm2015/lib/interaction/activity.metadata.json +1 -1
  22. package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +199 -230
  23. package/esm2015/lib/interaction/components/activity-container/activity-container.component.js.map +1 -1
  24. package/esm2015/lib/interaction/components/activity-container/activity-container.component.metadata.json +1 -1
  25. package/esm2015/lib/interaction/components/{activity-outlet → activity-container/activity-outlet}/activity-outlet.component.js +24 -31
  26. package/esm2015/lib/interaction/components/activity-container/activity-outlet/activity-outlet.component.js.map +1 -0
  27. package/esm2015/lib/interaction/components/activity-container/activity-outlet/activity-outlet.component.metadata.json +1 -0
  28. package/esm2015/lib/interaction/components/activity-container/activity-outlet/activity-outlet.component.ngfactory.js.map +1 -0
  29. package/esm2015/lib/interaction/components/activity-container/activity-outlet/activity-outlet.component.scss.shim.ngstyle.js.map +1 -0
  30. package/esm2015/lib/interaction/components/alert-dialog/alert-dialog.component.js +2 -3
  31. package/esm2015/lib/interaction/components/alert-dialog/alert-dialog.component.js.map +1 -1
  32. package/esm2015/lib/interaction/components/alert-dialog/alert-dialog.component.metadata.json +1 -1
  33. package/esm2015/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +4 -11
  34. package/esm2015/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js.map +1 -1
  35. package/esm2015/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.metadata.json +1 -1
  36. package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +2 -3
  37. package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js.map +1 -1
  38. package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.metadata.json +1 -1
  39. package/esm2015/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.js +113 -0
  40. package/esm2015/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.js.map +1 -0
  41. package/esm2015/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.metadata.json +1 -0
  42. package/esm2015/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.ngfactory.js.map +1 -0
  43. package/esm2015/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.scss.shim.ngstyle.js.map +1 -0
  44. package/esm2015/lib/interaction/index.js +7 -6
  45. package/esm2015/lib/interaction/index.js.map +1 -1
  46. package/esm2015/lib/interaction/index.metadata.json +1 -1
  47. package/esm2015/lib/interaction/interaction-context.js +12 -67
  48. package/esm2015/lib/interaction/interaction-context.js.map +1 -1
  49. package/esm2015/lib/interaction/interaction-context.metadata.json +1 -1
  50. package/esm2015/lib/interaction/interaction.module.js +4 -4
  51. package/esm2015/lib/interaction/interaction.module.js.map +1 -1
  52. package/esm2015/lib/interaction/interaction.module.metadata.json +1 -1
  53. package/esm2015/lib/interaction/interaction.module.ngfactory.js.map +1 -1
  54. package/esm2015/lib/interaction/route-synchronisation-adapter.js +17 -0
  55. package/esm2015/lib/interaction/route-synchronisation-adapter.js.map +1 -0
  56. package/esm2015/lib/interaction/route-synchronisation-adapter.metadata.json +1 -0
  57. package/esm2015/lib/interaction/services/interaction-service-routing-adapter.js +72 -0
  58. package/esm2015/lib/interaction/services/interaction-service-routing-adapter.js.map +1 -0
  59. package/esm2015/lib/interaction/services/interaction-service-routing-adapter.metadata.json +1 -0
  60. package/esm2015/lib/interaction/services/interaction.service.js +174 -104
  61. package/esm2015/lib/interaction/services/interaction.service.js.map +1 -1
  62. package/esm2015/lib/interaction/services/interaction.service.metadata.json +1 -1
  63. package/esm2015/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.js +4 -2
  64. package/esm2015/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.js.map +1 -1
  65. package/esm2015/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.metadata.json +1 -1
  66. package/esm2015/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context.js +79 -87
  67. package/esm2015/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context.js.map +1 -1
  68. package/esm2015/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context.metadata.json +1 -1
  69. package/esm2015/lib/interaction/services/modal-interaction-context.factory.js +3 -1
  70. package/esm2015/lib/interaction/services/modal-interaction-context.factory.js.map +1 -1
  71. package/esm2015/lib/place/components/abstract-place-navigation.component.js +27 -6
  72. package/esm2015/lib/place/components/abstract-place-navigation.component.js.map +1 -1
  73. package/esm2015/lib/place/components/abstract-place-navigation.component.metadata.json +1 -1
  74. package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.js +9 -3
  75. package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.js.map +1 -1
  76. package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.metadata.json +1 -1
  77. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +98 -110
  78. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
  79. package/esm2015/lib/place/components/place-outlet/place-outlet.component.metadata.json +1 -1
  80. package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +9 -3
  81. package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js.map +1 -1
  82. package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.metadata.json +1 -1
  83. package/esm2015/lib/place/guards/place.guard.js +14 -13
  84. package/esm2015/lib/place/guards/place.guard.js.map +1 -1
  85. package/esm2015/lib/place/guards/place.guard.metadata.json +1 -1
  86. package/esm2015/lib/place/index.js +15 -2
  87. package/esm2015/lib/place/index.js.map +1 -1
  88. package/esm2015/lib/place/index.metadata.json +1 -1
  89. package/esm2015/lib/place/{guards → navigation}/place-component-deactivation-handler.js +28 -22
  90. package/esm2015/lib/place/navigation/place-component-deactivation-handler.js.map +1 -0
  91. package/esm2015/lib/place/navigation/place-component-deactivation-handler.metadata.json +1 -0
  92. package/esm2015/lib/place/navigation/session/abstract-pop-state-navigation.js +37 -0
  93. package/esm2015/lib/place/navigation/session/abstract-pop-state-navigation.js.map +1 -0
  94. package/esm2015/lib/place/navigation/session/abstract-pop-state-navigation.metadata.json +1 -0
  95. package/esm2015/lib/place/navigation/session/event-cleanup/event-clean-up-session.js +19 -0
  96. package/esm2015/lib/place/navigation/session/event-cleanup/event-clean-up-session.js.map +1 -0
  97. package/esm2015/lib/place/navigation/session/event-cleanup/event-clean-up-session.metadata.json +1 -0
  98. package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-leaving-interaction-transition-cancelled.js +95 -0
  99. package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-leaving-interaction-transition-cancelled.js.map +1 -0
  100. package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-leaving-interaction-transition-cancelled.metadata.json +1 -0
  101. package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-link-triggered-interaction-cancelation-finishes.js +132 -0
  102. package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-link-triggered-interaction-cancelation-finishes.js.map +1 -0
  103. package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-link-triggered-interaction-cancelation-finishes.metadata.json +1 -0
  104. package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-popstate-during-can-deactivate-transition-finishes.js +123 -0
  105. package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-popstate-during-can-deactivate-transition-finishes.js.map +1 -0
  106. package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-popstate-during-can-deactivate-transition-finishes.metadata.json +1 -0
  107. package/esm2015/lib/place/navigation/session/interactions/navigating-during-interaction.js +62 -0
  108. package/esm2015/lib/place/navigation/session/interactions/navigating-during-interaction.js.map +1 -0
  109. package/esm2015/lib/place/navigation/session/interactions/navigating-during-interaction.metadata.json +1 -0
  110. package/esm2015/lib/place/navigation/session/interactions/pop-state-during-interaction-navigation.js +48 -0
  111. package/esm2015/lib/place/navigation/session/interactions/pop-state-during-interaction-navigation.js.map +1 -0
  112. package/esm2015/lib/place/navigation/session/interactions/pop-state-during-interaction-navigation.metadata.json +1 -0
  113. package/esm2015/lib/place/navigation/session/interactions/remove-last-interaction-from-url-navigation-session.js +104 -0
  114. package/esm2015/lib/place/navigation/session/interactions/remove-last-interaction-from-url-navigation-session.js.map +1 -0
  115. package/esm2015/lib/place/navigation/session/interactions/remove-last-interaction-from-url-navigation-session.metadata.json +1 -0
  116. package/esm2015/lib/place/navigation/session/interactions/synchronise-interaction-context-ids-with-route.js +141 -0
  117. package/esm2015/lib/place/navigation/session/interactions/synchronise-interaction-context-ids-with-route.js.map +1 -0
  118. package/esm2015/lib/place/navigation/session/interactions/synchronise-interaction-context-ids-with-route.metadata.json +1 -0
  119. package/esm2015/lib/place/navigation/session/navigating.js +54 -0
  120. package/esm2015/lib/place/navigation/session/navigating.js.map +1 -0
  121. package/esm2015/lib/place/navigation/session/navigating.metadata.json +1 -0
  122. package/esm2015/lib/place/navigation/session/navigation-context.js +38 -0
  123. package/esm2015/lib/place/navigation/session/navigation-context.js.map +1 -0
  124. package/esm2015/lib/place/navigation/session/navigation-context.metadata.json +1 -0
  125. package/esm2015/lib/place/navigation/session/navigation-session.js +326 -0
  126. package/esm2015/lib/place/navigation/session/navigation-session.js.map +1 -0
  127. package/esm2015/lib/place/navigation/session/navigation-session.metadata.json +1 -0
  128. package/esm2015/lib/place/navigation/session/pop-state-navigation.js +31 -0
  129. package/esm2015/lib/place/navigation/session/pop-state-navigation.js.map +1 -0
  130. package/esm2015/lib/place/navigation/session/pop-state-navigation.metadata.json +1 -0
  131. package/esm2015/lib/place/place-component.js +46 -15
  132. package/esm2015/lib/place/place-component.js.map +1 -1
  133. package/esm2015/lib/place/place-component.metadata.json +1 -1
  134. package/esm2015/lib/place/place-router.js +314 -309
  135. package/esm2015/lib/place/place-router.js.map +1 -1
  136. package/esm2015/lib/place/place-router.metadata.json +1 -1
  137. package/esm2015/lib/place/place.module.js.map +1 -1
  138. package/esm2015/lib/place/place.module.metadata.json +1 -1
  139. package/esm2015/lib/place/place.module.ngfactory.js.map +1 -1
  140. package/esm2015/lib/place/route/parameter-decorators.js +1 -0
  141. package/esm2015/lib/place/route/parameter-decorators.js.map +1 -1
  142. package/esm2015/lib/place/route/parameter-decorators.metadata.json +1 -1
  143. package/esm2015/lib/place/url-service.js +126 -0
  144. package/esm2015/lib/place/url-service.js.map +1 -0
  145. package/esm2015/lib/place/url-service.metadata.json +1 -0
  146. package/esm2015/lib/place/url-service.ngfactory.js.map +1 -0
  147. package/esm2015/lib/place/url-snapshot.js +15 -1
  148. package/esm2015/lib/place/url-snapshot.js.map +1 -1
  149. package/esm2015/lib/place/url-snapshot.metadata.json +1 -1
  150. package/esm2015/lib/place/visit.js +10 -0
  151. package/esm2015/lib/place/visit.js.map +1 -1
  152. package/esm2015/lib/place/visit.metadata.json +1 -1
  153. package/esm2015/public_api.js +2 -2
  154. package/esm2015/public_api.js.map +1 -1
  155. package/esm5/coolon-angular-ui-powerups.js +16 -17
  156. package/esm5/coolon-angular-ui-powerups.js.map +1 -1
  157. package/esm5/index.js +1 -1
  158. package/esm5/index.js.map +1 -1
  159. package/esm5/lib/angular-ui-powerups.module.ngfactory.js.map +1 -1
  160. package/esm5/lib/interaction/abstract-interaction-context.js +146 -0
  161. package/esm5/lib/interaction/abstract-interaction-context.js.map +1 -0
  162. package/esm5/lib/interaction/activity-ref.js +153 -0
  163. package/esm5/lib/interaction/activity-ref.js.map +1 -0
  164. package/esm5/lib/interaction/activity.js +29 -1
  165. package/esm5/lib/interaction/activity.js.map +1 -1
  166. package/esm5/lib/interaction/components/activity-container/activity-container.component.js +273 -265
  167. package/esm5/lib/interaction/components/activity-container/activity-container.component.js.map +1 -1
  168. package/esm5/lib/interaction/components/{activity-outlet → activity-container/activity-outlet}/activity-outlet.component.js +25 -32
  169. package/esm5/lib/interaction/components/activity-container/activity-outlet/activity-outlet.component.js.map +1 -0
  170. package/esm5/lib/interaction/components/activity-container/activity-outlet/activity-outlet.component.ngfactory.js.map +1 -0
  171. package/esm5/lib/interaction/components/activity-container/activity-outlet/activity-outlet.component.scss.shim.ngstyle.js.map +1 -0
  172. package/esm5/lib/interaction/components/alert-dialog/alert-dialog.component.js +2 -3
  173. package/esm5/lib/interaction/components/alert-dialog/alert-dialog.component.js.map +1 -1
  174. package/esm5/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +4 -10
  175. package/esm5/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js.map +1 -1
  176. package/esm5/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +2 -3
  177. package/esm5/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js.map +1 -1
  178. package/esm5/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.js +158 -0
  179. package/esm5/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.js.map +1 -0
  180. package/esm5/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.ngfactory.js.map +1 -0
  181. package/esm5/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.scss.shim.ngstyle.js.map +1 -0
  182. package/esm5/lib/interaction/index.js +7 -6
  183. package/esm5/lib/interaction/index.js.map +1 -1
  184. package/esm5/lib/interaction/interaction-context.js +12 -106
  185. package/esm5/lib/interaction/interaction-context.js.map +1 -1
  186. package/esm5/lib/interaction/interaction.module.js +4 -4
  187. package/esm5/lib/interaction/interaction.module.js.map +1 -1
  188. package/esm5/lib/interaction/interaction.module.ngfactory.js.map +1 -1
  189. package/esm5/lib/interaction/route-synchronisation-adapter.js +17 -0
  190. package/esm5/lib/interaction/route-synchronisation-adapter.js.map +1 -0
  191. package/esm5/lib/interaction/services/interaction-service-routing-adapter.js +98 -0
  192. package/esm5/lib/interaction/services/interaction-service-routing-adapter.js.map +1 -0
  193. package/esm5/lib/interaction/services/interaction.service.js +243 -117
  194. package/esm5/lib/interaction/services/interaction.service.js.map +1 -1
  195. package/esm5/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.js +6 -2
  196. package/esm5/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.js.map +1 -1
  197. package/esm5/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context.js +96 -107
  198. package/esm5/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context.js.map +1 -1
  199. package/esm5/lib/interaction/services/modal-interaction-context.factory.js +3 -1
  200. package/esm5/lib/interaction/services/modal-interaction-context.factory.js.map +1 -1
  201. package/esm5/lib/place/components/abstract-place-navigation.component.js +24 -6
  202. package/esm5/lib/place/components/abstract-place-navigation.component.js.map +1 -1
  203. package/esm5/lib/place/components/list-place-nav/list-place-nav.component.js +6 -3
  204. package/esm5/lib/place/components/list-place-nav/list-place-nav.component.js.map +1 -1
  205. package/esm5/lib/place/components/place-outlet/place-outlet.component.js +130 -129
  206. package/esm5/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
  207. package/esm5/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +6 -3
  208. package/esm5/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js.map +1 -1
  209. package/esm5/lib/place/guards/place.guard.js +17 -13
  210. package/esm5/lib/place/guards/place.guard.js.map +1 -1
  211. package/esm5/lib/place/index.js +15 -2
  212. package/esm5/lib/place/index.js.map +1 -1
  213. package/esm5/lib/place/{guards → navigation}/place-component-deactivation-handler.js +45 -21
  214. package/esm5/lib/place/navigation/place-component-deactivation-handler.js.map +1 -0
  215. package/esm5/lib/place/navigation/session/abstract-pop-state-navigation.js +49 -0
  216. package/esm5/lib/place/navigation/session/abstract-pop-state-navigation.js.map +1 -0
  217. package/esm5/lib/place/navigation/session/event-cleanup/event-clean-up-session.js +36 -0
  218. package/esm5/lib/place/navigation/session/event-cleanup/event-clean-up-session.js.map +1 -0
  219. package/esm5/lib/place/navigation/session/event-cleanup/wait-until-leaving-interaction-transition-cancelled.js +151 -0
  220. package/esm5/lib/place/navigation/session/event-cleanup/wait-until-leaving-interaction-transition-cancelled.js.map +1 -0
  221. package/esm5/lib/place/navigation/session/event-cleanup/wait-until-link-triggered-interaction-cancelation-finishes.js +221 -0
  222. package/esm5/lib/place/navigation/session/event-cleanup/wait-until-link-triggered-interaction-cancelation-finishes.js.map +1 -0
  223. package/esm5/lib/place/navigation/session/event-cleanup/wait-until-popstate-during-can-deactivate-transition-finishes.js +186 -0
  224. package/esm5/lib/place/navigation/session/event-cleanup/wait-until-popstate-during-can-deactivate-transition-finishes.js.map +1 -0
  225. package/esm5/lib/place/navigation/session/interactions/navigating-during-interaction.js +107 -0
  226. package/esm5/lib/place/navigation/session/interactions/navigating-during-interaction.js.map +1 -0
  227. package/esm5/lib/place/navigation/session/interactions/pop-state-during-interaction-navigation.js +77 -0
  228. package/esm5/lib/place/navigation/session/interactions/pop-state-during-interaction-navigation.js.map +1 -0
  229. package/esm5/lib/place/navigation/session/interactions/remove-last-interaction-from-url-navigation-session.js +167 -0
  230. package/esm5/lib/place/navigation/session/interactions/remove-last-interaction-from-url-navigation-session.js.map +1 -0
  231. package/esm5/lib/place/navigation/session/interactions/synchronise-interaction-context-ids-with-route.js +185 -0
  232. package/esm5/lib/place/navigation/session/interactions/synchronise-interaction-context-ids-with-route.js.map +1 -0
  233. package/esm5/lib/place/navigation/session/navigating.js +75 -0
  234. package/esm5/lib/place/navigation/session/navigating.js.map +1 -0
  235. package/esm5/lib/place/navigation/session/navigation-context.js +32 -0
  236. package/esm5/lib/place/navigation/session/navigation-context.js.map +1 -0
  237. package/esm5/lib/place/navigation/session/navigation-session.js +450 -0
  238. package/esm5/lib/place/navigation/session/navigation-session.js.map +1 -0
  239. package/esm5/lib/place/navigation/session/pop-state-navigation.js +50 -0
  240. package/esm5/lib/place/navigation/session/pop-state-navigation.js.map +1 -0
  241. package/esm5/lib/place/place-component.js +61 -17
  242. package/esm5/lib/place/place-component.js.map +1 -1
  243. package/esm5/lib/place/place-router.js +414 -401
  244. package/esm5/lib/place/place-router.js.map +1 -1
  245. package/esm5/lib/place/place.module.js.map +1 -1
  246. package/esm5/lib/place/place.module.ngfactory.js.map +1 -1
  247. package/esm5/lib/place/route/parameter-decorators.js +1 -0
  248. package/esm5/lib/place/route/parameter-decorators.js.map +1 -1
  249. package/esm5/lib/place/url-service.js +176 -0
  250. package/esm5/lib/place/url-service.js.map +1 -0
  251. package/esm5/lib/place/url-service.ngfactory.js.map +1 -0
  252. package/esm5/lib/place/url-snapshot.js +22 -1
  253. package/esm5/lib/place/url-snapshot.js.map +1 -1
  254. package/esm5/lib/place/visit.js +14 -0
  255. package/esm5/lib/place/visit.js.map +1 -1
  256. package/esm5/public_api.js +2 -2
  257. package/esm5/public_api.js.map +1 -1
  258. package/fesm2015/coolon-angular-ui-powerups.js +2644 -2266
  259. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  260. package/fesm5/coolon-angular-ui-powerups.js +3703 -2982
  261. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  262. package/lib/interaction/abstract-interaction-context.d.ts +24 -0
  263. package/lib/interaction/activity-ref.d.ts +19 -0
  264. package/lib/interaction/activity.d.ts +5 -1
  265. package/lib/interaction/components/activity-container/activity-container.component.d.ts +42 -43
  266. package/lib/interaction/components/{activity-outlet → activity-container/activity-outlet}/activity-outlet.component.d.ts +7 -10
  267. package/lib/interaction/components/alert-dialog/alert-dialog.component.d.ts +2 -2
  268. package/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.d.ts +2 -5
  269. package/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.d.ts +2 -2
  270. package/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.d.ts +24 -0
  271. package/lib/interaction/index.d.ts +6 -5
  272. package/lib/interaction/interaction-context.d.ts +8 -29
  273. package/lib/interaction/route-synchronisation-adapter.d.ts +5 -0
  274. package/lib/interaction/services/interaction-service-routing-adapter.d.ts +15 -0
  275. package/lib/interaction/services/interaction.service.d.ts +52 -24
  276. package/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.d.ts +2 -1
  277. package/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context.d.ts +15 -12
  278. package/lib/interaction/services/modal-interaction-context.factory.d.ts +2 -1
  279. package/lib/place/components/abstract-place-navigation.component.d.ts +5 -3
  280. package/lib/place/components/list-place-nav/list-place-nav.component.d.ts +2 -1
  281. package/lib/place/components/place-outlet/place-outlet.component.d.ts +9 -10
  282. package/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.d.ts +2 -1
  283. package/lib/place/guards/place.guard.d.ts +4 -3
  284. package/lib/place/index.d.ts +15 -2
  285. package/lib/place/navigation/place-component-deactivation-handler.d.ts +22 -0
  286. package/lib/place/navigation/session/abstract-pop-state-navigation.d.ts +9 -0
  287. package/lib/place/navigation/session/event-cleanup/event-clean-up-session.d.ts +4 -0
  288. package/lib/place/navigation/session/event-cleanup/wait-until-leaving-interaction-transition-cancelled.d.ts +27 -0
  289. package/lib/place/navigation/session/event-cleanup/wait-until-link-triggered-interaction-cancelation-finishes.d.ts +43 -0
  290. package/lib/place/navigation/session/event-cleanup/wait-until-popstate-during-can-deactivate-transition-finishes.d.ts +33 -0
  291. package/lib/place/navigation/session/interactions/navigating-during-interaction.d.ts +15 -0
  292. package/lib/place/navigation/session/interactions/pop-state-during-interaction-navigation.d.ts +17 -0
  293. package/lib/place/navigation/session/interactions/remove-last-interaction-from-url-navigation-session.d.ts +24 -0
  294. package/lib/place/navigation/session/interactions/synchronise-interaction-context-ids-with-route.d.ts +15 -0
  295. package/lib/place/navigation/session/navigating.d.ts +11 -0
  296. package/lib/place/navigation/session/navigation-context.d.ts +28 -0
  297. package/lib/place/navigation/session/navigation-session.d.ts +51 -0
  298. package/lib/place/navigation/session/pop-state-navigation.d.ts +7 -0
  299. package/lib/place/place-component.d.ts +6 -3
  300. package/lib/place/place-router.d.ts +39 -35
  301. package/lib/place/url-service.d.ts +30 -0
  302. package/lib/place/url-snapshot.d.ts +3 -1
  303. package/lib/place/visit.d.ts +1 -0
  304. package/package.json +1 -1
  305. package/schematics/place-routes/templates/place-routes.ts.template +4 -3
  306. package/esm2015/lib/interaction/abstract-activity.js +0 -13
  307. package/esm2015/lib/interaction/abstract-activity.js.map +0 -1
  308. package/esm2015/lib/interaction/abstract-activity.metadata.json +0 -1
  309. package/esm2015/lib/interaction/components/activity-outlet/activity-outlet-context.js +0 -21
  310. package/esm2015/lib/interaction/components/activity-outlet/activity-outlet-context.js.map +0 -1
  311. package/esm2015/lib/interaction/components/activity-outlet/activity-outlet-context.metadata.json +0 -1
  312. package/esm2015/lib/interaction/components/activity-outlet/activity-outlet.component.js.map +0 -1
  313. package/esm2015/lib/interaction/components/activity-outlet/activity-outlet.component.metadata.json +0 -1
  314. package/esm2015/lib/interaction/components/activity-outlet/activity-outlet.component.ngfactory.js.map +0 -1
  315. package/esm2015/lib/interaction/components/activity-outlet/activity-outlet.component.scss.shim.ngstyle.js.map +0 -1
  316. package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +0 -102
  317. package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js.map +0 -1
  318. package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.metadata.json +0 -1
  319. package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.ngfactory.js.map +0 -1
  320. package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.scss.shim.ngstyle.js.map +0 -1
  321. package/esm2015/lib/interaction/interaction-context-base.js +0 -171
  322. package/esm2015/lib/interaction/interaction-context-base.js.map +0 -1
  323. package/esm2015/lib/interaction/interaction-context-base.metadata.json +0 -1
  324. package/esm2015/lib/place/guards/navigation-state.js +0 -1118
  325. package/esm2015/lib/place/guards/navigation-state.js.map +0 -1
  326. package/esm2015/lib/place/guards/navigation-state.metadata.json +0 -1
  327. package/esm2015/lib/place/guards/place-component-deactivation-handler.js.map +0 -1
  328. package/esm2015/lib/place/guards/place-component-deactivation-handler.metadata.json +0 -1
  329. package/esm5/lib/interaction/abstract-activity.js +0 -30
  330. package/esm5/lib/interaction/abstract-activity.js.map +0 -1
  331. package/esm5/lib/interaction/components/activity-outlet/activity-outlet-context.js +0 -21
  332. package/esm5/lib/interaction/components/activity-outlet/activity-outlet-context.js.map +0 -1
  333. package/esm5/lib/interaction/components/activity-outlet/activity-outlet.component.js.map +0 -1
  334. package/esm5/lib/interaction/components/activity-outlet/activity-outlet.component.ngfactory.js.map +0 -1
  335. package/esm5/lib/interaction/components/activity-outlet/activity-outlet.component.scss.shim.ngstyle.js.map +0 -1
  336. package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +0 -119
  337. package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js.map +0 -1
  338. package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.ngfactory.js.map +0 -1
  339. package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.scss.shim.ngstyle.js.map +0 -1
  340. package/esm5/lib/interaction/interaction-context-base.js +0 -228
  341. package/esm5/lib/interaction/interaction-context-base.js.map +0 -1
  342. package/esm5/lib/place/guards/navigation-state.js +0 -1491
  343. package/esm5/lib/place/guards/navigation-state.js.map +0 -1
  344. package/esm5/lib/place/guards/place-component-deactivation-handler.js.map +0 -1
  345. package/lib/interaction/abstract-activity.d.ts +0 -6
  346. package/lib/interaction/components/activity-outlet/activity-outlet-context.d.ts +0 -7
  347. package/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.d.ts +0 -17
  348. package/lib/interaction/interaction-context-base.d.ts +0 -29
  349. package/lib/place/guards/navigation-state.d.ts +0 -228
  350. package/lib/place/guards/place-component-deactivation-handler.d.ts +0 -15
@@ -5,53 +5,78 @@
5
5
  import * as tslib_1 from "tslib";
6
6
  import { Location } from '@angular/common';
7
7
  import { Injectable } from '@angular/core';
8
- import { NavigationCancel, NavigationEnd, NavigationError, NavigationStart, Router, UrlSerializer } from '@angular/router';
9
- import { assert, Dsl, GarbageCollector, lang, Logger, MutableListModel, MutableStream, MutableValueModel } from '@coolon/pectin';
10
- import _ from 'lodash';
8
+ import { NavigationCancel, NavigationEnd, NavigationError, NavigationStart, Router } from '@angular/router';
9
+ import { assert, DebugContext, Dsl, GarbageCollector, lang, Logger, MutableListModel, MutableValueModel } from '@coolon/pectin';
11
10
  import { InteractionService } from '../interaction/services/interaction.service';
12
- import { NavigationState } from './guards/navigation-state';
11
+ import { NavigatingDuringInteraction } from './navigation/session/interactions/navigating-during-interaction';
12
+ import { PopStateDuringInteractionNavigation } from './navigation/session/interactions/pop-state-during-interaction-navigation';
13
+ import { SynchroniseInteractionContextIdsWithRoute } from './navigation/session/interactions/synchronise-interaction-context-ids-with-route';
14
+ import { Navigating } from './navigation/session/navigating';
15
+ import { NavigationContext } from './navigation/session/navigation-context';
16
+ import { PopStateNavigation } from './navigation/session/pop-state-navigation';
13
17
  import { PlaceHistory } from './place-history';
14
- import { UrlSnapshot } from './url-snapshot';
18
+ import { UrlService } from './url-service';
15
19
  import * as i0 from "@angular/core";
16
20
  import * as i1 from "@angular/router";
17
21
  import * as i2 from "@angular/common";
18
- import * as i3 from "./place-history";
19
- import * as i4 from "../interaction/services/interaction.service";
22
+ import * as i3 from "../interaction/services/interaction.service";
23
+ import * as i4 from "./url-service";
24
+ import * as i5 from "./place-history";
20
25
  export class PlaceRouter extends GarbageCollector {
21
26
  /**
22
- * @param {?} router
23
- * @param {?} urlSerializer
27
+ * @param {?} angularRouter
24
28
  * @param {?} angularLocation
25
- * @param {?} placeHistory
26
29
  * @param {?} interactionService
30
+ * @param {?} urlService
31
+ * @param {?} placeHistory
27
32
  */
28
- constructor(router, urlSerializer, angularLocation, placeHistory, interactionService) {
33
+ constructor(angularRouter, angularLocation, interactionService, urlService, placeHistory) {
29
34
  super();
30
- this.router = router;
31
- this.urlSerializer = urlSerializer;
35
+ this.angularRouter = angularRouter;
32
36
  this.angularLocation = angularLocation;
33
- this.placeHistory = placeHistory;
34
37
  this.interactionService = interactionService;
35
- this._navigationStateModel = new MutableValueModel();
38
+ this.urlService = urlService;
39
+ this.placeHistory = placeHistory;
40
+ this.navigationSessionModel = new MutableValueModel();
36
41
  this._activeVisits = new MutableListModel();
37
- const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
38
- this.activeVisitIndex = chain(this._activeVisits).indexBy('placeDefinition');
39
- this.navigationInProgress = chain(this.navigationStateModel).pluck('isTransitional');
40
- this._navigationSessionContext = new NavigationState.Context(this, this.interactionService, (/**
41
- * @param {?} session
42
+ this.sessionFinishedJobs = [];
43
+ this.routerInteractionAdapter = interactionService.registerPlaceRouter(this);
44
+ // TODO: Make this an interface and use 'this' instead.
45
+ this.navigationContext = new NavigationContext.Impl(this.urlService, this.routerInteractionAdapter, (/**
46
+ * @param {?} urlSnapshot
47
+ * @param {?} options
42
48
  * @return {?}
43
49
  */
44
- session => {
45
- this.processNavigationSuccess(session);
46
- }));
47
- this._navigationStateModel.value = new NavigationState.Idle(this._navigationSessionContext);
48
- this._navigationStateTypeModel = chain(this._navigationStateModel).map((/**
50
+ (urlSnapshot, options) => {
51
+ return this.navigateByUrl(urlSnapshot, options);
52
+ }), (/**
49
53
  * @param {?} state
50
54
  * @return {?}
51
55
  */
52
- state => (/** @type {?} */ (state.constructor))));
56
+ state => {
57
+ this.transitionTo(state);
58
+ }), (/**
59
+ * @param {?} visits
60
+ * @return {?}
61
+ */
62
+ visits => {
63
+ this.routingSessionFinished(visits);
64
+ }));
65
+ const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
66
+ this.navigationInProgress = chain(this.navigationSessionModel).isNotNil();
67
+ /** @type {?} */
68
+ const idleStateName = chain(this.interactionService.active).map((/**
69
+ * @param {?} active
70
+ * @return {?}
71
+ */
72
+ active => active ? 'IdleDuringInteraction' : 'Idle'));
73
+ this.navigationSessionName = chain(this.navigationSessionModel)
74
+ .pluck('name')
75
+ .otherwise(idleStateName);
76
+ DebugContext.tag(this._activeVisits, "PlaceRouter.activeVisits");
77
+ this.activeVisitsByPlaceDefinition = chain(this._activeVisits).indexBy('placeDefinition');
53
78
  // TODO: make setup the callbacks in during module initiation to make this testable.
54
- this.router.events.subscribe((/**
79
+ angularRouter.events.subscribe((/**
55
80
  * @param {?} event
56
81
  * @return {?}
57
82
  */
@@ -63,154 +88,199 @@ export class PlaceRouter extends GarbageCollector {
63
88
  // NavigationStart -> .... -> NavigationError --> navigation aborted, end session.
64
89
  // =======================
65
90
  if (event instanceof NavigationStart) {
91
+ // console.log(`---> NavigationStart[${event.id}]: ${event.url} (${event.navigationTrigger})`);
66
92
  if (event.navigationTrigger === 'popstate') {
67
- this.runStateTransition((/**
68
- * @param {?} state
69
- * @return {?}
70
- */
71
- state => state.onPopState(event)));
93
+ this.onPopState(event);
72
94
  }
73
95
  else {
74
- this.runStateTransition((/**
75
- * @param {?} state
76
- * @return {?}
77
- */
78
- state => state.onRouterStarted(event)));
96
+ this.onRouterStarted(event);
79
97
  }
98
+ // console.log(`<--- NavigationStart[${event.id}]: ${event.url} (${event.navigationTrigger})`);
80
99
  }
81
100
  if (event instanceof NavigationEnd) {
82
- console.log(event);
83
- this.runStateTransition((/**
84
- * @param {?} state
85
- * @return {?}
86
- */
87
- state => state.onRouterEnd(event)));
101
+ // console.log(`---> NavigationEnd[${event.id}]: ${event.url}`);
102
+ this.onRouterEnd(event);
103
+ // console.log(`<--- NavigationEnd[${event.id}]: ${event.url}`);
88
104
  }
89
105
  if (event instanceof NavigationError) {
90
- console.log(event);
91
- this.runStateTransition((/**
92
- * @param {?} state
93
- * @return {?}
94
- */
95
- state => state.onRouterError(event)));
106
+ // console.log(`---> NavigationError[${event.id}]: ${event.url}`);
107
+ this.onRouterError(event);
108
+ // console.log(`<--- NavigationError[${event.id}]: ${event.url}`);
96
109
  }
97
110
  if (event instanceof NavigationCancel) {
98
- console.log(event);
99
- this.runStateTransition((/**
100
- * @param {?} state
101
- * @return {?}
102
- */
103
- state => state.onRouterCancelled(event)));
111
+ // console.log(`---> NavigationCancel[${event.id}]: ${event.url}`);
112
+ this.onRouterCancelled(event);
113
+ // console.log(`<--- NavigationCancel[${event.id}]: ${event.url}`);
104
114
  }
105
115
  }));
106
- // Push dialog state to the url so we can capture the back button.
107
- when.listOf(this.interactionService.activeInteractionContextIds).changes((/**
108
- * @param {?} ids
109
- * @param {?} previous
110
- * @return {?}
111
- */
112
- (ids, previous) => {
113
- this.syncInteractionIdsWithRouter(ids, previous);
114
- }), { unless: this.navigationInProgress }); // TODO: I think the exclusive interaction prevents interactions starting while it's active so we might not need this.
115
- // TODO: I think the exclusive interaction prevents interactions starting while it's active so we might not need this.
116
- /** @type {?} */
117
- const urlChanges = new MutableStream();
118
- // The angular router doesn't always fire router events when the back button is pushed while a navigation
119
- // session is in progress. Sometimes we only know about it from the url change.
120
- // IMPORTANT ORDER DEPENDENCY
121
- // This only works because we're notified of the change after the router has started reacting to it. This
122
- // we can can use our navigationState to determine things.
116
+ // The router needs to know about url changes and in some cases they are the only way the router can know if
117
+ // the back button was clicked.
123
118
  angularLocation.onUrlChange((/**
124
119
  * @param {?} url
125
120
  * @return {?}
126
121
  */
127
- url => {
122
+ url => this.onUrlChanged(url)));
123
+ }
124
+ /**
125
+ * @return {?}
126
+ */
127
+ get navigationSession() {
128
+ return this.navigationSessionModel.value;
129
+ }
130
+ /**
131
+ * @return {?}
132
+ */
133
+ get currentSession() {
134
+ return this.navigationSessionModel.value;
135
+ }
136
+ // @Trace()
137
+ /**
138
+ * @param {?} event
139
+ * @return {?}
140
+ */
141
+ onPopState(event) {
142
+ assert.isTruthy(event.navigationTrigger === 'popstate');
143
+ if (this.currentSession) {
144
+ this.currentSession.onPopState(event);
145
+ }
146
+ else {
128
147
  /** @type {?} */
129
- const navigationState = this._navigationStateModel.value;
130
- console.log(`URLChange -> ${url}`, { state: navigationState });
131
- urlChanges.publish({ url, state: navigationState });
132
- // The url has changed while we're in a transitional state
133
- if (navigationState.isTransitional) {
134
- /** @type {?} */
135
- const navigationInteraction = this.navigationState.interactionContext;
136
- if (navigationInteraction && navigationInteraction.isActive()) {
137
- this.runStateTransition((/**
138
- * @param {?} state
139
- * @return {?}
140
- */
141
- state => state.onBackClickedDuringNavigationInteraction(url)));
142
- }
143
- }
144
- }));
148
+ const poppedHistoryUrl = event.url;
149
+ /** @type {?} */
150
+ const currentRouterUrl = this.urlService.getCurrentRouterUrl();
151
+ /** @type {?} */
152
+ const session = this.interactionService.isActive() ?
153
+ new PopStateDuringInteractionNavigation(this.navigationContext, currentRouterUrl, poppedHistoryUrl) :
154
+ new PopStateNavigation(this.navigationContext, currentRouterUrl, poppedHistoryUrl);
155
+ this.transitionTo(session);
156
+ }
145
157
  }
158
+ // @Trace()
146
159
  /**
147
- * @private
148
- * @param {?} session
160
+ * @param {?} event
149
161
  * @return {?}
150
162
  */
151
- processNavigationSuccess(session) {
152
- // We need to update the visits before the session finishes. This allows the placeOutets to ignore visit
153
- // changes that occur while routerNavigationActive is true.
154
- assert.isTruthy(this.navigationInProgress.value);
163
+ onRouterStarted(event) {
164
+ assert.isFalsey(event.navigationTrigger === 'popstate');
155
165
  /** @type {?} */
156
- const visits = session.getVisits();
157
- visits.forEach((/**
158
- * @param {?} v
159
- * @return {?}
160
- */
161
- v => this.placeHistory.add(v)));
162
- this._activeVisits.value = visits;
166
+ const inInteraction = this.interactionService.isActive();
167
+ if (this.currentSession) {
168
+ this.currentSession.onRouterStarted(event);
169
+ }
170
+ else {
171
+ this.transitionTo(this.createNavigationSession(this.urlService.getCurrentRouterUrl()));
172
+ }
173
+ }
174
+ // @Trace()
175
+ /**
176
+ * @param {?} newUrl
177
+ * @return {?}
178
+ */
179
+ onUrlChanged(newUrl) {
180
+ // the back button can trigger a url change without a navigation session in progress so we
181
+ // console.log(`---> Url Changed ${newUrl}`);
182
+ if (this.currentSession) {
183
+ this.currentSession.onUrlChange(newUrl);
184
+ }
185
+ else {
186
+ console.log('FYI: url changed without a navigation session in progress');
187
+ }
188
+ // console.log(`<--- Url Changed`);
163
189
  }
190
+ // @Trace()
164
191
  /**
192
+ * @param {?} event
165
193
  * @return {?}
166
194
  */
167
- get navigationState() {
168
- return this._navigationStateModel.value;
195
+ onRouterCancelled(event) {
196
+ this.currentSession.onRouterCancelled(event);
169
197
  }
198
+ // @Trace()
170
199
  /**
200
+ * @param {?} event
171
201
  * @return {?}
172
202
  */
173
- get navigationStateModel() {
174
- return this._navigationStateModel.readonly;
203
+ onRouterError(event) {
204
+ this.currentSession.onRouterError(event);
175
205
  }
206
+ // @Trace()
176
207
  /**
208
+ * @param {?} event
177
209
  * @return {?}
178
210
  */
179
- get activeVisits() {
180
- return this._activeVisits.readonly;
211
+ onRouterEnd(event) {
212
+ this.currentSession.onRouterEnd(event);
181
213
  }
182
214
  /**
183
- * placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));
184
215
  * @param {?} visit
185
216
  * @param {?=} options
186
217
  * @return {?}
187
218
  */
188
219
  navigate(visit, options) {
220
+ return this.doNavigation(visit, (/**
221
+ * @param {?} router
222
+ * @return {?}
223
+ */
224
+ (router) => tslib_1.__awaiter(this, void 0, void 0, function* () {
225
+ /** @type {?} */
226
+ const commands = [
227
+ visit.placeDefinition.path,
228
+ ...this.createRouteParameters(visit)
229
+ ];
230
+ yield this.angularRouter.navigate(commands, {
231
+ relativeTo: options ? options.relativeTo : null
232
+ });
233
+ })));
234
+ }
235
+ // @Trace()
236
+ /**
237
+ * @param {?} visit
238
+ * @param {?} runNavigationCommands
239
+ * @return {?}
240
+ */
241
+ doNavigation(visit, runNavigationCommands) {
189
242
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
190
- this.doNavigation(visit, (/**
191
- * @param {?} router
192
- * @return {?}
193
- */
194
- (router) => tslib_1.__awaiter(this, void 0, void 0, function* () {
195
- /** @type {?} */
196
- const commands = [
197
- visit.placeDefinition.path,
198
- ...this.createRouteParameters(visit)
199
- ];
200
- yield this.router.navigate(commands, {
201
- relativeTo: options ? options.relativeTo : null
202
- });
203
- })));
243
+ if (this.navigationInProgress.value) {
244
+ lang.illegalState('Navigation already in progress');
245
+ }
246
+ /** @type {?} */
247
+ const navigation = this.createNavigationSession(this.urlService.getCurrentRouterUrl());
248
+ navigation.storeVisit(visit);
249
+ this.transitionTo(navigation);
250
+ try {
251
+ yield runNavigationCommands(this.angularRouter);
252
+ }
253
+ finally {
254
+ // Check if the router has finished (in the case where no router change required) and we're still in a
255
+ // transient state and finish of the transition.
256
+ if (!this.angularRouter.getCurrentNavigation() && this.currentSession) {
257
+ this.currentSession.onRouterEnd(new NavigationEnd(-1, '', ''));
258
+ }
259
+ }
204
260
  });
205
261
  }
262
+ /**
263
+ * @param {?} urlSnapshot
264
+ * @param {?=} navigationExtras
265
+ * @return {?}
266
+ */
267
+ navigateByUrl(urlSnapshot, navigationExtras) {
268
+ // console.log(`### navigationByUrl -> ${urlSnapshot.urlTree.toString()}`);
269
+ return this.angularRouter.navigateByUrl(urlSnapshot.urlTree, navigationExtras);
270
+ }
271
+ /**
272
+ * @return {?}
273
+ */
274
+ get activeVisits() {
275
+ return this._activeVisits.readonly;
276
+ }
206
277
  // @Trace()
207
278
  /**
208
- * @param {?} activatedRoute
209
279
  * @param {?} previous
210
280
  * @param {?} next
211
281
  * @return {?}
212
282
  */
213
- pushVisitChangesToRoute(activatedRoute, previous, next) {
283
+ pushVisitChangesToRoute(previous, next) {
214
284
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
215
285
  // we have to push to history so our remember sanitisers don't pick up the previous value
216
286
  // when it's been cleared by the user.
@@ -223,214 +293,145 @@ export class PlaceRouter extends GarbageCollector {
223
293
  */
224
294
  router => {
225
295
  /** @type {?} */
226
- const urlSnapshot = this.parseUrl(this.router.routerState.snapshot.url).updateVisitSegments(next);
227
- console.log('### Push Changes to route Redirect', { commands: urlSnapshot.url });
296
+ const urlSnapshot = this.urlService.parseUrl(this.angularRouter.routerState.snapshot.url).updateVisitSegments(next);
297
+ // console.log('### Push Changes to route Redirect', { commands: urlSnapshot.url });
228
298
  return this.navigateByUrl(urlSnapshot);
229
299
  }));
230
300
  }
231
301
  });
232
302
  }
233
303
  /**
234
- * @param {?} visit
235
- * @param {?} runNavigationCommands
304
+ * @private
305
+ * @param {?} currentRouterUrl
236
306
  * @return {?}
237
307
  */
238
- doNavigation(visit, runNavigationCommands) {
239
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
240
- if (this.navigationInProgress.value) {
241
- lang.illegalState('Navigation already in progress');
242
- }
243
- this.runStateTransition((/**
244
- * @param {?} current
245
- * @return {?}
246
- */
247
- current => {
248
- /** @type {?} */
249
- const session = this.navigationState.onPlaceNavigationStart(visit, this.getCurrentRouterUrl());
250
- session.storeVisit(visit);
251
- return session;
252
- }));
253
- try {
254
- yield runNavigationCommands(this.router);
255
- }
256
- finally {
257
- // Router has finished (since there was no router change required) so we
258
- // need to end the navigation session.
259
- if (this.navigationState.isTransitional && !this.router.getCurrentNavigation()) {
260
- this.runStateTransition((/**
261
- * @param {?} session
262
- * @return {?}
263
- */
264
- session => session.onRouterEnd(new NavigationEnd(-1, '', ''))));
265
- }
266
- }
267
- });
308
+ createNavigationSession(currentRouterUrl) {
309
+ /** @type {?} */
310
+ const inInteraction = this.interactionService.isActive();
311
+ return inInteraction ?
312
+ new NavigatingDuringInteraction(this.navigationContext, currentRouterUrl) :
313
+ new Navigating(this.navigationContext, currentRouterUrl);
268
314
  }
269
315
  // @Trace()
270
316
  /**
271
317
  * @protected
272
- * @param {?} transition
318
+ * @param {?} next
273
319
  * @return {?}
274
320
  */
275
- runStateTransition(transition) {
276
- /** @type {?} */
277
- const previous = this._navigationStateModel.value;
321
+ transitionTo(next) {
278
322
  /** @type {?} */
279
- const next = transition(this.navigationState);
280
- this._navigationStateModel.value = next;
281
- if (next !== previous) {
323
+ const previous = this.navigationSessionModel.value;
324
+ assert.isTruthy(next !== previous);
325
+ Logger.get(this).info(`### Router State Transition: ${previous ? previous.toString() : 'null'} -> ${next.toString()}`);
326
+ this.navigationSessionModel.value = next;
327
+ if (!!previous) {
282
328
  previous.dispose();
283
- Logger.get(this).info(`Router State Transition: ${previous.toString()} -> ${next.toString()}`);
284
329
  }
330
+ next.notifyActive();
285
331
  }
332
+ // @Trace()
286
333
  /**
287
334
  * @private
288
- * @param {?} visit
289
- * @return {?}
290
- */
291
- createRouteParameters(visit) {
292
- /** @type {?} */
293
- const def = visit.placeDefinition;
294
- return visit.hasRouteId() ?
295
- [def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :
296
- [def.getFormattedRouteParameters(visit)];
297
- }
298
- /**
299
- * @param {?} activatedRoute
300
- * @return {?}
301
- */
302
- extractChildPath(activatedRoute) {
303
- return _.flatten(activatedRoute.children.map((/**
304
- * @param {?} child
305
- * @return {?}
306
- */
307
- child => child.url)));
308
- }
309
- /**
310
- * @param {?} url
335
+ * @param {?} visits
311
336
  * @return {?}
312
337
  */
313
- parseUrl(url) {
314
- return new UrlSnapshot(this.urlSerializer, url);
315
- }
316
- /**
317
- * @param {?} url
318
- * @param {?} options
319
- * @return {?}
320
- */
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();
329
- }
330
- /**
331
- * @param {...?} visits
332
- * @return {?}
333
- */
334
- createUrlSnapshot(...visits) {
338
+ routingSessionFinished(visits) {
339
+ if (visits && visits.length > 0) {
340
+ assert.isTruthy(this.navigationInProgress.value);
341
+ visits.forEach((/**
342
+ * @param {?} v
343
+ * @return {?}
344
+ */
345
+ v => this.placeHistory.add(v)));
346
+ // We update the active visits before we finish the session so the
347
+ // place outlets can ignore the incoming changes until things are
348
+ // settled. TODO: can we removed the event'ness here and just do a push?
349
+ this._activeVisits.value = visits;
350
+ }
335
351
  /** @type {?} */
336
- const bits = [];
337
- visits.forEach((/**
338
- * @param {?} v
352
+ const session = this.currentSession;
353
+ session.dispose();
354
+ this.navigationSessionModel.value = null;
355
+ console.log(`### Router Session Finished (was ${session.toString()})`);
356
+ this.sessionFinishedJobs.forEach((/**
357
+ * @param {?} job
339
358
  * @return {?}
340
359
  */
341
- v => {
342
- bits.push(this.parseUrl(`${v.placeDefinition.path}`).updateVisitSegments(v).url);
343
- }));
344
- return this.parseUrl(bits.join(''));
345
- }
346
- /**
347
- * @return {?}
348
- */
349
- getCurrentRouterUrl() {
350
- return this.router.routerState ? this.router.routerState.snapshot.url : null;
351
- }
352
- /**
353
- * @return {?}
354
- */
355
- getCurrentRouteSnapshot() {
356
- return this.parseUrl(this.getCurrentRouterUrl());
360
+ job => job()));
361
+ this.sessionFinishedJobs = [];
357
362
  }
358
363
  /**
359
- * @param {?} url
364
+ * @private
365
+ * @param {?} func
360
366
  * @return {?}
361
367
  */
362
- getActiveInteractionIdsFromUrl(url) {
363
- return this.parseUrl(url).getInteractionIds();
368
+ runAfterCurrentRoutingSession(func) {
369
+ assert.isTruthy(this.navigationInProgress);
370
+ this.sessionFinishedJobs.push(func);
364
371
  }
365
- // @Trace()
366
372
  /**
367
- * @param {?} url
373
+ * Sync's the current interaction state with the URL. We need to push something in the URL in order
374
+ * to be able to capture the back button on the first page. If we don't then the back click will exit
375
+ * the app directly and we don't get to ask.
368
376
  * @return {?}
369
377
  */
370
- hasActiveInteractionIds(url) {
371
- return this.getActiveInteractionIdsFromUrl(url).length > 0;
372
- }
373
378
  // @Trace()
374
- /**
375
- * @param {?} urlSnapshot
376
- * @param {?=} navigationExtras
377
- * @return {?}
378
- */
379
- navigateByUrl(urlSnapshot, navigationExtras) {
380
- return this.router.navigateByUrl(urlSnapshot.urlTree, navigationExtras);
381
- }
382
- // TODO: Should this be moved to the navigation states?
383
- /**
384
- * @param {?} currentIds
385
- * @param {?} previous
386
- * @return {?}
387
- */
388
- syncInteractionIdsWithRouter(currentIds, previous) {
389
- assert.isFalsey(this.navigationInProgress.value); // Updating interaction routes during an existing navigation breaks all the things.
390
- console.log({
391
- startingActivity: currentIds.length > previous.length,
392
- wasBackButton: this.navigationState.isPopState
393
- });
394
- if (_.isEqual(currentIds, previous)) {
395
- console.log('activity ids were the same, skipping');
396
- }
397
- else {
398
- // OMG, this is nuts.
379
+ syncInteractionContextIdsWithRouter() {
380
+ if (this.navigationSession) {
381
+ // console.log(`Navigation active -> ${this.navigationSession.toString()}, sync delayed until finished.`);
399
382
  /** @type {?} */
400
- const addingActivity = currentIds.length > previous.length;
401
- /** @type {?} */
402
- const isFirstActivity = addingActivity && previous.length < 1;
403
- /** @type {?} */
404
- const removingLastActivity = currentIds.length < 1;
405
- if (addingActivity) { // we're starting a new activity, push the change to the history and update the url
406
- console.log('adding activity');
407
- this.navigateByUrl(this.getCurrentRouteSnapshot().updateInteractionIds(currentIds), {
408
- replaceUrl: !isFirstActivity // we don't let the history pile up
409
- });
410
- }
411
- else {
412
- /** @type {?} */
413
- const urlSnapshot = this.getCurrentRouteSnapshot().updateInteractionIds(currentIds);
414
- if (removingLastActivity) {
415
- this.navigateByUrl(urlSnapshot, {
416
- replaceUrl: true
417
- }).then((/**
383
+ const session = this.navigationSession;
384
+ return new Promise((/**
385
+ * @param {?} resolve
386
+ * @param {?} reject
387
+ * @return {?}
388
+ */
389
+ (resolve, reject) => {
390
+ this.runAfterCurrentRoutingSession((/**
391
+ * @return {?}
392
+ */
393
+ () => {
394
+ // console.log(`Starting delayed sync job`);
395
+ /** @type {?} */
396
+ const syncSession = new SynchroniseInteractionContextIdsWithRoute(this.navigationContext, this.urlService.getCurrentRouterUrl(), false);
397
+ syncSession.onDispose((/**
418
398
  * @return {?}
419
399
  */
420
- () => {
421
- // for some reason we need to pop the last history off the stack when leaving the
422
- // active activity state.
423
- this.angularLocation.back();
424
- }));
425
- }
426
- else {
427
- this.navigateByUrl(urlSnapshot, {
428
- replaceUrl: true
429
- });
430
- }
431
- }
400
+ () => resolve()));
401
+ this.transitionTo(syncSession);
402
+ }));
403
+ }));
404
+ }
405
+ else {
406
+ return new Promise(((/**
407
+ * @param {?} resolve
408
+ * @param {?} reject
409
+ * @return {?}
410
+ */
411
+ (resolve, reject) => {
412
+ // console.log(`No navigation in progress, starting synchronisation job`);
413
+ /** @type {?} */
414
+ const session = new SynchroniseInteractionContextIdsWithRoute(this.navigationContext, this.urlService.getCurrentRouterUrl(), false);
415
+ session.onDispose((/**
416
+ * @return {?}
417
+ */
418
+ () => resolve()));
419
+ this.transitionTo(session);
420
+ })));
432
421
  }
433
422
  }
423
+ /**
424
+ * @private
425
+ * @param {?} visit
426
+ * @return {?}
427
+ */
428
+ createRouteParameters(visit) {
429
+ /** @type {?} */
430
+ const def = visit.placeDefinition;
431
+ return visit.hasRouteId() ?
432
+ [def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :
433
+ [def.getFormattedRouteParameters(visit)];
434
+ }
434
435
  }
435
436
  PlaceRouter.decorators = [
436
437
  { type: Injectable, args: [{
@@ -440,61 +441,65 @@ PlaceRouter.decorators = [
440
441
  /** @nocollapse */
441
442
  PlaceRouter.ctorParameters = () => [
442
443
  { type: Router },
443
- { type: UrlSerializer },
444
444
  { type: Location },
445
- { type: PlaceHistory },
446
- { type: InteractionService }
445
+ { type: InteractionService },
446
+ { type: UrlService },
447
+ { type: PlaceHistory }
447
448
  ];
448
- /** @nocollapse */ PlaceRouter.ngInjectableDef = i0.ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(i0.ɵɵinject(i1.Router), i0.ɵɵinject(i1.UrlSerializer), i0.ɵɵinject(i2.Location), i0.ɵɵinject(i3.PlaceHistory), i0.ɵɵinject(i4.InteractionService)); }, token: PlaceRouter, providedIn: "root" });
449
+ /** @nocollapse */ PlaceRouter.ngInjectableDef = i0.ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(i0.ɵɵinject(i1.Router), i0.ɵɵinject(i2.Location), i0.ɵɵinject(i3.InteractionService), i0.ɵɵinject(i4.UrlService), i0.ɵɵinject(i5.PlaceHistory)); }, token: PlaceRouter, providedIn: "root" });
449
450
  if (false) {
451
+ /** @type {?} */
452
+ PlaceRouter.prototype.navigationSessionModel;
453
+ /** @type {?} */
454
+ PlaceRouter.prototype.navigationInProgress;
455
+ /** @type {?} */
456
+ PlaceRouter.prototype.navigationSessionName;
450
457
  /**
451
458
  * @type {?}
452
459
  * @private
453
460
  */
454
- PlaceRouter.prototype._navigationStateModel;
461
+ PlaceRouter.prototype.navigationContext;
455
462
  /**
456
463
  * @type {?}
457
464
  * @private
458
465
  */
459
466
  PlaceRouter.prototype._activeVisits;
460
467
  /** @type {?} */
461
- PlaceRouter.prototype.navigationInProgress;
462
- /** @type {?} */
463
- PlaceRouter.prototype.activeVisitIndex;
468
+ PlaceRouter.prototype.activeVisitsByPlaceDefinition;
464
469
  /**
465
470
  * @type {?}
466
471
  * @private
467
472
  */
468
- PlaceRouter.prototype._navigationSessionContext;
473
+ PlaceRouter.prototype.routerInteractionAdapter;
469
474
  /**
470
475
  * @type {?}
471
476
  * @private
472
477
  */
473
- PlaceRouter.prototype._navigationStateTypeModel;
478
+ PlaceRouter.prototype.sessionFinishedJobs;
474
479
  /**
475
480
  * @type {?}
476
481
  * @private
477
482
  */
478
- PlaceRouter.prototype.router;
483
+ PlaceRouter.prototype.angularRouter;
479
484
  /**
480
485
  * @type {?}
481
486
  * @private
482
487
  */
483
- PlaceRouter.prototype.urlSerializer;
488
+ PlaceRouter.prototype.angularLocation;
484
489
  /**
485
490
  * @type {?}
486
491
  * @private
487
492
  */
488
- PlaceRouter.prototype.angularLocation;
493
+ PlaceRouter.prototype.interactionService;
489
494
  /**
490
495
  * @type {?}
491
496
  * @private
492
497
  */
493
- PlaceRouter.prototype.placeHistory;
498
+ PlaceRouter.prototype.urlService;
494
499
  /**
495
500
  * @type {?}
496
501
  * @private
497
502
  */
498
- PlaceRouter.prototype.interactionService;
503
+ PlaceRouter.prototype.placeHistory;
499
504
  }
500
505
  //# sourceMappingURL=place-router.js.map