@coolon/angular-ui-powerups 0.0.126 → 0.0.129

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 +3745 -3019
  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 +307 -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 +407 -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 +2637 -2266
  259. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  260. package/fesm5/coolon-angular-ui-powerups.js +3694 -2980
  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,7 +5,7 @@
5
5
  import * as tslib_1 from "tslib";
6
6
  import { Component, EventEmitter, Inject, Input, Optional, Output, SkipSelf, ViewChild } from '@angular/core';
7
7
  import { Router, RouterOutlet } from '@angular/router';
8
- import { DebugContext, DelegatingValueModel, Dsl, Guard, ListModel, MutableValueModel, StoreInListModel, StoreInValueModel, UseDelegate, ValueModel } from '@coolon/pectin';
8
+ import { DebugContext, Dsl, lang, ListModel, MutableValueModel, StoreInListModel, StoreInValueModel, UseDelegate, ValueModel } from '@coolon/pectin';
9
9
  import * as _ from 'lodash';
10
10
  import { DisposableComponent } from '../../../components/disposable-component';
11
11
  import { AUP_PLACE_CONFIG } from '../../place-config';
@@ -36,23 +36,14 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
36
36
  _this.placeRouter = placeRouter;
37
37
  _this.placeConfig = placeConfig;
38
38
  _this.placeChanged = new EventEmitter();
39
- _this._activePlace = new MutableValueModel();
40
- _this._activePlaceVisitModel = new DelegatingValueModel();
41
- _this._inOutletActivation = new Guard();
42
- _this._inOutletDeactivation = new Guard();
43
- _this._inRouteVisitUpdate = new Guard();
39
+ _this.outletActivated = new MutableValueModel(false);
44
40
  _this._activatedRouteModel = new MutableValueModel();
45
- _this._placeDefinition = new MutableValueModel();
41
+ _this._activePlaceModel = new MutableValueModel();
46
42
  _this.initialPlaceIndex = null;
43
+ _this._isPushingVisitToRoute = new MutableValueModel(false);
47
44
  var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
48
45
  _this.parentOutletModel = new MutableValueModel(parentOutlet);
49
46
  /** @type {?} */
50
- var mutableValueModel = new MutableValueModel();
51
- DebugContext.tag(mutableValueModel, "PlaceOutletComponent -> mutableValueModel");
52
- _this._activePlaceVisitModel.setDelegate(mutableValueModel);
53
- DebugContext.tag(_this._activePlaceVisitModel, "PlaceOutletComponent._activePlaceVisitModel");
54
- _this._inOutletUpdate = valueOf.any(_this._inOutletDeactivation, _this._inOutletActivation).areTruthy();
55
- /** @type {?} */
56
47
  var defaultPlaceAnimationOrder = chain(_this.parentOutletModel)
57
48
  .pullValueModel((/**
58
49
  * @param {?} o
@@ -85,29 +76,24 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
85
76
  }
86
77
  return _.isNil(_this.initialPlaceIndex) ? 0 : placeIndex - _this.initialPlaceIndex;
87
78
  }), { dependsOn: activatePlaceType });
88
- // Push incoming changes into the component
89
- _this.routerVisit = chain(_this._activePlace).pluck('placeDefinition').findIn(placeRouter.activeVisitIndex);
90
- // Our router visit will change when our active is nullified during deactivation, which will push a null visit
91
- // the the deactivated component, which will nuke it's view before the animations have finished.
92
- // The visit will alway updated after the router session is finsised (when the new visits are registered) so
93
- // we can safely ignore it during outlet changes as these always happen before the router session ends.
94
- when.valueOf(_this.routerVisit).changes((/**
79
+ // Extract our visit model from the place router.
80
+ _this._activePlaceDefinition = chain(_this._activePlaceModel).pluck('placeDefinition');
81
+ _this.routerVisitModel = _this._activePlaceDefinition.findIn(chain(placeRouter.activeVisitsByPlaceDefinition));
82
+ _this.navigationInProgress = chain(_this.placeRouter.navigationInProgress);
83
+ when.valueOf(_this.navigationInProgress).becomesFalsey((/**
95
84
  * @return {?}
96
85
  */
97
- function () { return _this.pushRouteChangesToVisit(); }), { unless: _this._inOutletUpdate });
98
- // Handle component based changes
99
- when.valueOf(_this._activePlaceVisitModel).changes((/**
100
- * @param {?} next
101
- * @param {?} previous
86
+ function () {
87
+ _this.checkStateAndInitialise();
88
+ }));
89
+ when.valueOf(_this.outletActivated).becomesTruthy((/**
102
90
  * @return {?}
103
91
  */
104
- function (next, previous) {
105
- _this.pushVisitChangesToRoute(next, previous);
106
- }), {
107
- unless: _this.placeRouter.navigationInProgress
108
- });
109
- chain(_this._activePlace)
110
- .postponeWhile(placeRouter.navigationInProgress)
92
+ function () {
93
+ _this.checkStateAndInitialise();
94
+ }));
95
+ chain(_this._activePlaceModel)
96
+ .postponeWhile(_this.navigationInProgress)
111
97
  .subscribe((/**
112
98
  * @param {?} place
113
99
  * @return {?}
@@ -115,10 +101,14 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
115
101
  function (place) { return _this.placeChanged.emit(place); }));
116
102
  return _this;
117
103
  }
104
+ // @Trace()
105
+ // @Trace()
118
106
  /**
119
107
  * @return {?}
120
108
  */
121
- PlaceOutletComponent.prototype.ngOnInit = /**
109
+ PlaceOutletComponent.prototype.ngOnInit =
110
+ // @Trace()
111
+ /**
122
112
  * @return {?}
123
113
  */
124
114
  function () {
@@ -174,56 +164,12 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
174
164
  enumerable: true,
175
165
  configurable: true
176
166
  });
177
- // @Trace()
178
- // @Trace()
179
- /**
180
- * @return {?}
181
- */
182
- PlaceOutletComponent.prototype.pushRouteChangesToVisit =
183
- // @Trace()
184
- /**
185
- * @return {?}
186
- */
187
- function () {
188
- var _this = this;
189
- /** @type {?} */
190
- var visit = this.routerVisit.value;
191
- // console.log({
192
- // visit,
193
- // place: visit ? visit.placeDefinition.component : null,
194
- // inOutletActivation: this._inOutletActivation.value,
195
- // inRoutingSession: this.placeRouter.navigationSessionActive.value
196
- // });
197
- if (visit) { // can be null while the place and index sync up
198
- this._inRouteVisitUpdate.whileTrue((/**
199
- * @return {?}
200
- */
201
- function () {
202
- _this._activePlaceVisitModel.value = visit;
203
- }));
204
- }
205
- };
206
- /**
207
- * @param {?} next
208
- * @param {?} previous
209
- * @return {?}
210
- */
211
- PlaceOutletComponent.prototype.pushVisitChangesToRoute = /**
212
- * @param {?} next
213
- * @param {?} previous
214
- * @return {?}
215
- */
216
- function (next, previous) {
217
- /** @type {?} */
218
- var activatedRoute = this._activatedRouteModel.value;
219
- this.placeRouter.pushVisitChangesToRoute(activatedRoute, previous, next);
220
- };
221
167
  Object.defineProperty(PlaceOutletComponent.prototype, "activePlaceModel", {
222
168
  get: /**
223
169
  * @return {?}
224
170
  */
225
171
  function () {
226
- return this._activePlace.readonly;
172
+ return this._activePlaceModel.readonly;
227
173
  },
228
174
  enumerable: true,
229
175
  configurable: true
@@ -253,50 +199,115 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
253
199
  * @return {?}
254
200
  */
255
201
  function (routerOutlet, place) {
202
+ this._activatedRouteModel.value = routerOutlet.activatedRoute;
203
+ this._activePlaceModel.value = place;
204
+ this.outletActivated.value = true;
205
+ this.checkStateAndInitialise();
206
+ };
207
+ // @Trace()
208
+ // @Trace()
209
+ /**
210
+ * @return {?}
211
+ */
212
+ PlaceOutletComponent.prototype.onOutletDeactivated =
213
+ // @Trace()
214
+ /**
215
+ * @return {?}
216
+ */
217
+ function () {
218
+ this.outletActivated.value = false;
219
+ this._activePlaceModel.value = null;
220
+ this._activatedRouteModel.value = null;
221
+ };
222
+ // @Trace()
223
+ // @Trace()
224
+ /**
225
+ * @private
226
+ * @return {?}
227
+ */
228
+ PlaceOutletComponent.prototype.checkStateAndInitialise =
229
+ // @Trace()
230
+ /**
231
+ * @private
232
+ * @return {?}
233
+ */
234
+ function () {
235
+ /** @type {?} */
236
+ var routerVisit = this.routerVisitModel.value;
237
+ /** @type {?} */
238
+ var activePlace = this.activePlaceModel.value;
239
+ if (routerVisit && activePlace && !activePlace.isInitialised()) {
240
+ if (routerVisit.placeDefinition !== activePlace.placeDefinition) {
241
+ lang.illegalState('wrong visit!!!');
242
+ }
243
+ this.initialisePlace(routerVisit, activePlace);
244
+ }
245
+ };
246
+ // @Trace()
247
+ // @Trace()
248
+ /**
249
+ * @private
250
+ * @param {?} routerVisit
251
+ * @param {?} activePlace
252
+ * @return {?}
253
+ */
254
+ PlaceOutletComponent.prototype.initialisePlace =
255
+ // @Trace()
256
+ /**
257
+ * @private
258
+ * @param {?} routerVisit
259
+ * @param {?} activePlace
260
+ * @return {?}
261
+ */
262
+ function (routerVisit, activePlace) {
256
263
  var _this = this;
257
- this._inOutletActivation.whileTrue((/**
264
+ /** @type {?} */
265
+ var visitModel = new MutableValueModel(routerVisit);
266
+ DebugContext.tag(visitModel, "PlaceOutletComponent[" + activePlace.constructor.name + ")].visitModel");
267
+ activePlace.initialiseVisit(routerVisit, (/**
268
+ * @param {?} current
269
+ * @param {?} previous
258
270
  * @return {?}
259
271
  */
260
- function () {
261
- try {
262
- _this._activePlace.value = place;
263
- _this._activatedRouteModel.value = routerOutlet.activatedRoute;
264
- _this._placeDefinition.value = place.placeDefinition;
265
- /** @type {?} */
266
- var visitModel = new MutableValueModel();
267
- DebugContext.tag(visitModel, "PlaceOutletCompeont.visitModel");
268
- _this._activePlaceVisitModel.setDelegate(visitModel);
269
- place.initialiseVisit(visitModel);
270
- }
271
- catch (error) {
272
- console.error(error);
273
- }
272
+ function (current, previous) {
273
+ _this.pushVisitChangeToRoute(previous, current);
274
274
  }));
275
275
  if (!this.animateModel.value) {
276
276
  // we're not animating so trigger any post animation callbacks now.
277
277
  this.animationDone();
278
278
  }
279
+ var _a = Dsl.disposeWith(activePlace), when = _a.when, chain = _a.chain, valueOf = _a.valueOf;
280
+ when.valueOf(this.routerVisitModel)
281
+ .changes((/**
282
+ * @param {?} visit
283
+ * @return {?}
284
+ */
285
+ function (visit) {
286
+ activePlace.updateVisit(visit);
287
+ }), {
288
+ unless: valueOf.any(this._isPushingVisitToRoute, this.routerVisitModel.isNil()).areTruthy()
289
+ });
279
290
  };
280
- // @Trace()
281
- // @Trace()
282
291
  /**
292
+ * @private
293
+ * @param {?} previous
294
+ * @param {?} current
283
295
  * @return {?}
284
296
  */
285
- PlaceOutletComponent.prototype.onOutletDeactivated =
286
- // @Trace()
287
- /**
297
+ PlaceOutletComponent.prototype.pushVisitChangeToRoute = /**
298
+ * @private
299
+ * @param {?} previous
300
+ * @param {?} current
288
301
  * @return {?}
289
302
  */
290
- function () {
303
+ function (previous, current) {
291
304
  var _this = this;
292
- this._inOutletDeactivation.whileTrue((/**
305
+ this._isPushingVisitToRoute.value = true;
306
+ this.placeRouter.pushVisitChangesToRoute(previous, current).finally((/**
293
307
  * @return {?}
294
308
  */
295
309
  function () {
296
- _this._activePlace.value = null;
297
- _this._activatedRouteModel.value = null;
298
- _this._placeDefinition.value = null;
299
- _this._activePlaceVisitModel.setDelegate(null);
310
+ _this._isPushingVisitToRoute.value = false;
300
311
  }));
301
312
  };
302
313
  // @Trace()
@@ -310,7 +321,7 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
310
321
  * @return {?}
311
322
  */
312
323
  function () {
313
- // console.log({ activePlace: this._activePlace.value });
324
+ // console.log({ activePlace: this._activePlaceModel.value });
314
325
  };
315
326
  // @Trace()
316
327
  // @Trace()
@@ -323,14 +334,14 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
323
334
  * @return {?}
324
335
  */
325
336
  function () {
326
- if (this._activePlace.value) {
327
- this._activePlace.value.onPlaceReady();
337
+ if (this._activePlaceModel.value) {
338
+ this._activePlaceModel.value.onPlaceReady();
328
339
  }
329
340
  };
330
341
  PlaceOutletComponent.decorators = [
331
342
  { type: Component, args: [{
332
343
  selector: 'aup-place-outlet',
333
- template: "<div class=\"router-outlet-container\"\n [@routeAnimations]=\"{value: getAnimationOrder(), params:{duration: animationDuration}}\"\n [@.disabled]=\"!animateModel.value\"\n (@routeAnimations.start)=\"animationStarted()\"\n (@routeAnimations.done)=\"animationDone()\"\n>\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n</div>\n\n",
344
+ template: "<ng-container *ngIf=\"animateModel.value\">\n <div class=\"router-outlet-container\"\n [@routeAnimations]=\"{value: getAnimationOrder(), params:{duration: animationDuration}}\"\n (@routeAnimations.start)=\"animationStarted()\"\n (@routeAnimations.done)=\"animationDone()\"\n >\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n </div>\n</ng-container>\n\n<ng-container *ngIf=\"!animateModel.value\">\n <div class=\"router-outlet-container\">\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n </div>\n</ng-container>\n\n",
334
345
  animations: [LEFT_RIGHT_PLACE_ANIMATION],
335
346
  styles: [":host{display:flex;flex-direction:column;min-height:0;overflow-x:hidden}.router-outlet-container{flex:1;display:block;position:relative;min-height:0}router-outlet{display:none}"]
336
347
  }] }
@@ -386,59 +397,49 @@ if (false) {
386
397
  * @type {?}
387
398
  * @private
388
399
  */
389
- PlaceOutletComponent.prototype._activePlace;
390
- /**
391
- * @type {?}
392
- * @private
393
- */
394
- PlaceOutletComponent.prototype._activePlaceVisitModel;
400
+ PlaceOutletComponent.prototype.outletActivated;
395
401
  /**
396
402
  * @type {?}
397
403
  * @private
398
404
  */
399
- PlaceOutletComponent.prototype._inOutletActivation;
400
- /**
401
- * @type {?}
402
- * @private
403
- */
404
- PlaceOutletComponent.prototype._inOutletDeactivation;
405
+ PlaceOutletComponent.prototype._activatedRouteModel;
405
406
  /**
406
407
  * @type {?}
407
408
  * @private
408
409
  */
409
- PlaceOutletComponent.prototype._inOutletUpdate;
410
+ PlaceOutletComponent.prototype._activePlaceModel;
410
411
  /**
411
412
  * @type {?}
412
413
  * @private
413
414
  */
414
- PlaceOutletComponent.prototype._inRouteVisitUpdate;
415
+ PlaceOutletComponent.prototype._activePlaceDefinition;
415
416
  /**
416
417
  * @type {?}
417
418
  * @private
418
419
  */
419
- PlaceOutletComponent.prototype._activatedRouteModel;
420
+ PlaceOutletComponent.prototype.parentOutletModel;
421
+ /** @type {?} */
422
+ PlaceOutletComponent.prototype.placeAnimationOrder;
420
423
  /**
421
424
  * @type {?}
422
425
  * @private
423
426
  */
424
- PlaceOutletComponent.prototype._placeDefinition;
427
+ PlaceOutletComponent.prototype.initialPlaceIndex;
425
428
  /**
426
429
  * @type {?}
427
430
  * @private
428
431
  */
429
- PlaceOutletComponent.prototype.parentOutletModel;
430
- /** @type {?} */
431
- PlaceOutletComponent.prototype.placeAnimationOrder;
432
+ PlaceOutletComponent.prototype.routerVisitModel;
432
433
  /**
433
434
  * @type {?}
434
435
  * @private
435
436
  */
436
- PlaceOutletComponent.prototype.initialPlaceIndex;
437
+ PlaceOutletComponent.prototype._isPushingVisitToRoute;
437
438
  /**
438
439
  * @type {?}
439
440
  * @private
440
441
  */
441
- PlaceOutletComponent.prototype.routerVisit;
442
+ PlaceOutletComponent.prototype.navigationInProgress;
442
443
  /**
443
444
  * @type {?}
444
445
  * @private
@@ -1 +1 @@
1
- {"version":3,"file":"place-outlet.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/components/place-outlet/place-outlet.component.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAU,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACtH,OAAO,EAAkB,MAAM,EAAE,YAAY,EAAE,MAAM,iBAAiB,C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;;;;;IACnD,oDAAgF;;;;;IAEhF,gDAA6E;;;;;IAC7E,iDAAmE;;IACnE,mDAA6D;;;;;IAE7D,iDAAyC;;;;;IACzC,2CAA4C;;;;;IAEhC,sCAA+B;;;;;IAC/B,2CAAyC;;IACzC,2CAAuE","sourcesContent":["import { Component, EventEmitter, Inject, Input, OnInit, Optional, Output, SkipSelf, ViewChild } from '@angular/core';\nimport { ActivatedRoute, Router, RouterOutlet } from '@angular/router';\nimport {\n BooleanValueModelChain,\n Constructable, DebugContext,\n DelegatingValueModel,\n Dsl,\n Guard,\n ListModel,\n MutableValueModel,\n StoreInListModel,\n StoreInValueModel,\n UseDelegate,\n ValueModel,\n ValueModelChain\n} from '@coolon/pectin';\nimport * as _ from 'lodash';\nimport { DisposableComponent } from '../../../components/disposable-component';\nimport { PlaceComponent } from '../../place-component';\nimport { AUP_PLACE_CONFIG, PlaceConfig } from '../../place-config';\nimport { PlaceDefinition } from '../../place-definition';\nimport { PlaceRouter } from '../../place-router';\n\nimport { Visit } from '../../visit';\nimport { LEFT_RIGHT_PLACE_ANIMATION } from './route-animations';\n\n// Quick hack to avoid circular references between this and PlaceComponents.\ninterface PlaceRef {\n readonly placeDefinition: PlaceDefinition\n\n initialiseBindings(param: ValueModel<Visit>): void;\n\n onPlaceReady(): void;\n}\n\n@Component({\n selector: 'aup-place-outlet',\n templateUrl: './place-outlet.component.html',\n styleUrls: ['./place-outlet.component.scss'],\n animations: [LEFT_RIGHT_PLACE_ANIMATION]\n})\nexport class PlaceOutletComponent extends DisposableComponent implements OnInit {\n\n @Input() @StoreInValueModel('animateModel')\n animate: boolean;\n\n @Input() @UseDelegate({ defaultValue: true })\n animateModel: ValueModel<boolean>;\n\n // tslint:disable-next-line:no-input-rename\n @Input('placeAnimationOrderModel') @UseDelegate()\n customPlaceAnimationOrderModel: ListModel<Constructable<PlaceComponent>>;\n\n // tslint:disable-next-line:no-input-rename\n @Input('placeAnimationOrder') @StoreInListModel('customPlaceAnimationOrderModel')\n customPlaceAnimationOrder: Constructable<PlaceComponent>[];\n\n @Output()\n readonly placeChanged = new EventEmitter<PlaceComponent>();\n\n @ViewChild('routeOutlet', { static: true })\n routerOut: RouterOutlet;\n\n private readonly _activePlace = new MutableValueModel<PlaceComponent>();\n private readonly _activePlaceVisitModel = new DelegatingValueModel<Visit>();\n\n private readonly _inOutletActivation = new Guard();\n private readonly _inOutletDeactivation = new Guard();\n private readonly _inOutletUpdate: BooleanValueModelChain;\n private readonly _inRouteVisitUpdate = new Guard();\n private readonly _activatedRouteModel = new MutableValueModel<ActivatedRoute>();\n\n private readonly _placeDefinition = new MutableValueModel<PlaceDefinition>();\n private parentOutletModel: MutableValueModel<PlaceOutletComponent>;\n public readonly placeAnimationOrder: ValueModelChain<number>;\n\n private initialPlaceIndex: number = null;\n private routerVisit: ValueModelChain<Visit>;\n\n constructor(private readonly router: Router,\n private readonly placeRouter: PlaceRouter,\n @Optional() @Inject(AUP_PLACE_CONFIG) readonly placeConfig: PlaceConfig,\n @SkipSelf() @Optional() parentOutlet: PlaceOutletComponent) {\n super();\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n\n this.parentOutletModel = new MutableValueModel(parentOutlet);\n const mutableValueModel = new MutableValueModel<Visit>();\n DebugContext.tag(mutableValueModel, \"PlaceOutletComponent -> mutableValueModel\");\n this._activePlaceVisitModel.setDelegate(mutableValueModel);\n DebugContext.tag(this._activePlaceVisitModel, \"PlaceOutletComponent._activePlaceVisitModel\");\n this._inOutletUpdate = valueOf.any(this._inOutletDeactivation, this._inOutletActivation).areTruthy();\n\n const defaultPlaceAnimationOrder = chain(this.parentOutletModel)\n .pullValueModel(o => o.activePlaceModel)\n .pluck('placeDefinition')\n .pluckList('children')\n .pluck('component');\n\n const activatePlaceType = chain(this.activePlaceModel).map(p => p.constructor as Constructable<PlaceComponent>);\n this.placeAnimationOrder = chain(this.customPlaceAnimationOrderModel)\n .otherwise(defaultPlaceAnimationOrder)\n .reduce((placesInOrder) => {\n let placeIndex = 0;\n if (activatePlaceType.value) {\n placeIndex = placesInOrder.indexOf(activatePlaceType.value);\n if (_.isNil(this.initialPlaceIndex)) {\n this.initialPlaceIndex = placeIndex;\n }\n }\n return _.isNil(this.initialPlaceIndex) ? 0 : placeIndex - this.initialPlaceIndex;\n }, { dependsOn: activatePlaceType });\n\n // Push incoming changes into the component\n this.routerVisit = chain(this._activePlace).pluck('placeDefinition').findIn(placeRouter.activeVisitIndex);\n // Our router visit will change when our active is nullified during deactivation, which will push a null visit\n // the the deactivated component, which will nuke it's view before the animations have finished.\n // The visit will alway updated after the router session is finsised (when the new visits are registered) so\n // we can safely ignore it during outlet changes as these always happen before the router session ends.\n when.valueOf(this.routerVisit).changes(() => this.pushRouteChangesToVisit(), { unless: this._inOutletUpdate });\n\n // Handle component based changes\n when.valueOf(this._activePlaceVisitModel).changes((next, previous) => {\n this.pushVisitChangesToRoute(next, previous);\n }, {\n unless: this.placeRouter.navigationInProgress\n });\n\n chain(this._activePlace)\n .postponeWhile(placeRouter.navigationInProgress)\n .subscribe(place => this.placeChanged.emit(place));\n\n }\n\n ngOnInit() {\n }\n\n // @Trace()\n getAnimationOrder() {\n return this.placeAnimationOrder.value;\n }\n\n get animationDuration() {\n return this.placeConfig && this.placeConfig.animationDuration ? this.placeConfig.animationDuration : '500ms';\n }\n\n // @Trace()\n navigate(visit: Visit) {\n // console.log({ activatedRoute: this._activatedRouteModel.value });\n this.placeRouter.navigate(visit, {\n relativeTo: this.parentOutlet ? this.parentOutlet.activatedRouteModel.value : null\n });\n }\n\n get parentOutlet(): PlaceOutletComponent {\n return this.parentOutletModel.value;\n }\n\n // @Trace()\n pushRouteChangesToVisit() {\n const visit = this.routerVisit.value;\n // console.log({\n // visit,\n // place: visit ? visit.placeDefinition.component : null,\n // inOutletActivation: this._inOutletActivation.value,\n // inRoutingSession: this.placeRouter.navigationSessionActive.value\n // });\n if (visit) { // can be null while the place and index sync up\n this._inRouteVisitUpdate.whileTrue(() => {\n this._activePlaceVisitModel.value = visit;\n });\n }\n }\n\n pushVisitChangesToRoute(next: Visit, previous: Visit) {\n const activatedRoute = this._activatedRouteModel.value;\n this.placeRouter.pushVisitChangesToRoute(activatedRoute, previous, next);\n }\n\n get activePlaceModel(): ValueModel<PlaceComponent> {\n return this._activePlace.readonly;\n }\n\n get activatedRouteModel(): ValueModel<ActivatedRoute> {\n return this._activatedRouteModel.readonly;\n }\n\n // @Trace()\n onOutletActivated(routerOutlet: RouterOutlet, place: PlaceComponent) {\n this._inOutletActivation.whileTrue(() => {\n try {\n this._activePlace.value = place;\n this._activatedRouteModel.value = routerOutlet.activatedRoute;\n this._placeDefinition.value = place.placeDefinition;\n const visitModel = new MutableValueModel<Visit>();\n DebugContext.tag(visitModel, \"PlaceOutletCompeont.visitModel\");\n this._activePlaceVisitModel.setDelegate(visitModel);\n place.initialiseVisit(visitModel);\n } catch (error) {\n console.error(error);\n }\n });\n if (!this.animateModel.value) {\n // we're not animating so trigger any post animation callbacks now.\n this.animationDone();\n }\n }\n\n // @Trace()\n onOutletDeactivated() {\n this._inOutletDeactivation.whileTrue(() => {\n this._activePlace.value = null;\n this._activatedRouteModel.value = null;\n this._placeDefinition.value = null;\n this._activePlaceVisitModel.setDelegate(null);\n });\n }\n\n // @Trace()\n animationStarted() {\n // console.log({ activePlace: this._activePlace.value });\n }\n\n // @Trace()\n animationDone() {\n if (this._activePlace.value) {\n this._activePlace.value.onPlaceReady();\n }\n }\n\n\n}\n"]}
1
+ {"version":3,"file":"place-outlet.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/components/place-outlet/place-outlet.component.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAU,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACtH,OAAO,EAAkB,MAAM,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACvE,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ject, Input, OnInit, Optional, Output, SkipSelf, ViewChild } from '@angular/core';\nimport { ActivatedRoute, Router, RouterOutlet } from '@angular/router';\nimport {\n Constructable,\n DebugContext,\n Dsl,\n lang,\n ListModel,\n MutableValueModel,\n StoreInListModel,\n StoreInValueModel,\n UseDelegate,\n ValueModel,\n ValueModelChain\n} from '@coolon/pectin';\nimport * as _ from 'lodash';\nimport { DisposableComponent } from '../../../components/disposable-component';\nimport { PlaceComponent } from '../../place-component';\nimport { AUP_PLACE_CONFIG, PlaceConfig } from '../../place-config';\nimport { PlaceDefinition } from '../../place-definition';\nimport { PlaceRouter } from '../../place-router';\n\nimport { Visit } from '../../visit';\nimport { LEFT_RIGHT_PLACE_ANIMATION } from './route-animations';\n\n// Quick hack to avoid circular references between this and PlaceComponents.\ninterface PlaceRef {\n readonly placeDefinition: PlaceDefinition\n\n initialiseBindings(param: ValueModel<Visit>): void;\n\n onPlaceReady(): void;\n}\n\n@Component({\n selector: 'aup-place-outlet',\n templateUrl: './place-outlet.component.html',\n styleUrls: ['./place-outlet.component.scss'],\n animations: [LEFT_RIGHT_PLACE_ANIMATION]\n})\nexport class PlaceOutletComponent extends DisposableComponent implements OnInit {\n\n @Input() @StoreInValueModel('animateModel')\n animate: boolean;\n\n @Input() @UseDelegate({ defaultValue: true })\n animateModel: ValueModel<boolean>;\n\n // tslint:disable-next-line:no-input-rename\n @Input('placeAnimationOrderModel') @UseDelegate()\n customPlaceAnimationOrderModel: ListModel<Constructable<PlaceComponent>>;\n\n // tslint:disable-next-line:no-input-rename\n @Input('placeAnimationOrder') @StoreInListModel('customPlaceAnimationOrderModel')\n customPlaceAnimationOrder: Constructable<PlaceComponent>[];\n\n @Output()\n readonly placeChanged = new EventEmitter<PlaceComponent>();\n\n @ViewChild('routeOutlet', { static: true })\n routerOut: RouterOutlet;\n\n\n private outletActivated = new MutableValueModel(false);\n private readonly _activatedRouteModel = new MutableValueModel<ActivatedRoute>();\n private readonly _activePlaceModel = new MutableValueModel<PlaceComponent>();\n private readonly _activePlaceDefinition: ValueModelChain<PlaceDefinition>;\n\n private parentOutletModel: MutableValueModel<PlaceOutletComponent>;\n public readonly placeAnimationOrder: ValueModelChain<number>;\n\n private initialPlaceIndex: number = null;\n private routerVisitModel: ValueModelChain<Visit>;\n private _isPushingVisitToRoute = new MutableValueModel<boolean>(false);\n private navigationInProgress: ValueModelChain<boolean>;\n\n constructor(private readonly router: Router,\n private readonly placeRouter: PlaceRouter,\n @Optional() @Inject(AUP_PLACE_CONFIG) readonly placeConfig: PlaceConfig,\n @SkipSelf() @Optional() parentOutlet: PlaceOutletComponent) {\n super();\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n\n this.parentOutletModel = new MutableValueModel(parentOutlet);\n\n const defaultPlaceAnimationOrder = chain(this.parentOutletModel)\n .pullValueModel(o => o.activePlaceModel)\n .pluck('placeDefinition')\n .pluckList('children')\n .pluck('component');\n\n const activatePlaceType = chain(this.activePlaceModel).map(p => p.constructor as Constructable<PlaceComponent>);\n this.placeAnimationOrder = chain(this.customPlaceAnimationOrderModel)\n .otherwise(defaultPlaceAnimationOrder)\n .reduce((placesInOrder) => {\n let placeIndex = 0;\n if (activatePlaceType.value) {\n placeIndex = placesInOrder.indexOf(activatePlaceType.value);\n if (_.isNil(this.initialPlaceIndex)) {\n this.initialPlaceIndex = placeIndex;\n }\n }\n return _.isNil(this.initialPlaceIndex) ? 0 : placeIndex - this.initialPlaceIndex;\n }, { dependsOn: activatePlaceType });\n\n // Extract our visit model from the place router.\n this._activePlaceDefinition = chain(this._activePlaceModel).pluck('placeDefinition');\n this.routerVisitModel = this._activePlaceDefinition.findIn(chain(placeRouter.activeVisitsByPlaceDefinition));\n\n this.navigationInProgress = chain(this.placeRouter.navigationInProgress);\n when.valueOf(this.navigationInProgress).becomesFalsey(() => {\n this.checkStateAndInitialise();\n });\n when.valueOf(this.outletActivated).becomesTruthy(() => {\n this.checkStateAndInitialise();\n });\n\n chain(this._activePlaceModel)\n .postponeWhile(this.navigationInProgress)\n .subscribe(place => this.placeChanged.emit(place));\n\n }\n\n // @Trace()\n ngOnInit() {\n }\n\n // @Trace()\n getAnimationOrder() {\n return this.placeAnimationOrder.value;\n }\n\n get animationDuration() {\n return this.placeConfig && this.placeConfig.animationDuration ? this.placeConfig.animationDuration : '500ms';\n }\n\n // @Trace()\n navigate(visit: Visit) {\n // console.log({ activatedRoute: this._activatedRouteModel.value });\n this.placeRouter.navigate(visit, {\n relativeTo: this.parentOutlet ? this.parentOutlet.activatedRouteModel.value : null\n });\n }\n\n get parentOutlet(): PlaceOutletComponent {\n return this.parentOutletModel.value;\n }\n\n\n get activePlaceModel(): ValueModel<PlaceComponent> {\n return this._activePlaceModel.readonly;\n }\n\n get activatedRouteModel(): ValueModel<ActivatedRoute> {\n return this._activatedRouteModel.readonly;\n }\n\n // @Trace()\n onOutletActivated(routerOutlet: RouterOutlet, place: PlaceComponent) {\n this._activatedRouteModel.value = routerOutlet.activatedRoute;\n this._activePlaceModel.value = place;\n this.outletActivated.value = true;\n this.checkStateAndInitialise();\n }\n\n // @Trace()\n onOutletDeactivated() {\n this.outletActivated.value = false;\n this._activePlaceModel.value = null;\n this._activatedRouteModel.value = null;\n }\n\n // @Trace()\n private checkStateAndInitialise() {\n const routerVisit = this.routerVisitModel.value;\n const activePlace = this.activePlaceModel.value;\n if (routerVisit && activePlace && !activePlace.isInitialised()) {\n if (routerVisit.placeDefinition !== activePlace.placeDefinition) {\n lang.illegalState('wrong visit!!!');\n }\n this.initialisePlace(routerVisit, activePlace);\n }\n }\n\n // @Trace()\n private initialisePlace(routerVisit: Visit, activePlace: PlaceComponent) {\n const visitModel = new MutableValueModel<Visit>(routerVisit);\n DebugContext.tag(visitModel, `PlaceOutletComponent[${activePlace.constructor.name})].visitModel`);\n activePlace.initialiseVisit(routerVisit, (current, previous) => {\n this.pushVisitChangeToRoute(previous, current);\n });\n if (!this.animateModel.value) {\n // we're not animating so trigger any post animation callbacks now.\n this.animationDone();\n }\n const { when, chain, valueOf } = Dsl.disposeWith(activePlace);\n when.valueOf(this.routerVisitModel)\n .changes(visit => {\n activePlace.updateVisit(visit);\n }, {\n unless: valueOf.any(\n this._isPushingVisitToRoute,\n this.routerVisitModel.isNil()\n ).areTruthy()\n });\n }\n\n private pushVisitChangeToRoute(previous: Visit, current: Visit) {\n this._isPushingVisitToRoute.value = true;\n this.placeRouter.pushVisitChangesToRoute(previous, current).finally(() => {\n this._isPushingVisitToRoute.value = false;\n });\n }\n\n// @Trace()\n animationStarted() {\n // console.log({ activePlace: this._activePlaceModel.value });\n }\n\n // @Trace()\n animationDone() {\n if (this._activePlaceModel.value) {\n this._activePlaceModel.value.onPlaceReady();\n }\n }\n\n}\n"]}
@@ -4,11 +4,12 @@
4
4
  */
5
5
  import * as tslib_1 from "tslib";
6
6
  import { Component } from '@angular/core';
7
+ import { PlaceRouter } from '../../place-router';
7
8
  import { AbstractPlaceNavigationComponent } from '../abstract-place-navigation.component';
8
9
  var TabbedPlaceNavigationComponent = /** @class */ (function (_super) {
9
10
  tslib_1.__extends(TabbedPlaceNavigationComponent, _super);
10
- function TabbedPlaceNavigationComponent() {
11
- return _super.call(this) || this;
11
+ function TabbedPlaceNavigationComponent(placeRouter) {
12
+ return _super.call(this, placeRouter) || this;
12
13
  }
13
14
  TabbedPlaceNavigationComponent.decorators = [
14
15
  { type: Component, args: [{
@@ -18,7 +19,9 @@ var TabbedPlaceNavigationComponent = /** @class */ (function (_super) {
18
19
  }] }
19
20
  ];
20
21
  /** @nocollapse */
21
- TabbedPlaceNavigationComponent.ctorParameters = function () { return []; };
22
+ TabbedPlaceNavigationComponent.ctorParameters = function () { return [
23
+ { type: PlaceRouter }
24
+ ]; };
22
25
  return TabbedPlaceNavigationComponent;
23
26
  }(AbstractPlaceNavigationComponent));
24
27
  export { TabbedPlaceNavigationComponent };
@@ -1 +1 @@
1
- {"version":3,"file":"tabbed-place-navigation.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AAE1F;IAKoD,0DAAgC;IAClF;eACE,iBAAO;IACT,CAAC;;gBARF,SAAS,SAAC;oBACT,QAAQ,EAAE,6BAA6B;oBACvC,mcAAuD;;iBAExD;;;;IAKD,qCAAC;CAAA,AATD,CAKoD,gCAAgC,GAInF;SAJY,8BAA8B","sourcesContent":["import { Component } from '@angular/core';\nimport { AbstractPlaceNavigationComponent } from '../abstract-place-navigation.component';\n\n@Component({\n selector: 'aup-tabbed-place-navigation',\n templateUrl: './tabbed-place-navigation.component.html',\n styleUrls: ['./tabbed-place-navigation.component.scss']\n})\nexport class TabbedPlaceNavigationComponent extends AbstractPlaceNavigationComponent {\n constructor() {\n super();\n }\n}\n"]}
1
+ {"version":3,"file":"tabbed-place-navigation.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AAE1F;IAKoD,0DAAgC;IAClF,wCAAY,WAAuB;eACjC,kBAAM,WAAW,CAAC;IACpB,CAAC;;gBARF,SAAS,SAAC;oBACT,QAAQ,EAAE,6BAA6B;oBACvC,mcAAuD;;iBAExD;;;;gBAPQ,WAAW;;IAYpB,qCAAC;CAAA,AATD,CAKoD,gCAAgC,GAInF;SAJY,8BAA8B","sourcesContent":["import { Component } from '@angular/core';\nimport { PlaceRouter } from '../../place-router';\nimport { AbstractPlaceNavigationComponent } from '../abstract-place-navigation.component';\n\n@Component({\n selector: 'aup-tabbed-place-navigation',\n templateUrl: './tabbed-place-navigation.component.html',\n styleUrls: ['./tabbed-place-navigation.component.scss']\n})\nexport class TabbedPlaceNavigationComponent extends AbstractPlaceNavigationComponent {\n constructor(placeRouter:PlaceRouter) {\n super(placeRouter);\n }\n}\n"]}
@@ -17,9 +17,9 @@ var /**
17
17
  * @abstract
18
18
  */
19
19
  PlaceGuard = /** @class */ (function () {
20
- function PlaceGuard(router, urlSerializer, placeRouter, placeHistory, interactionService, injector) {
20
+ function PlaceGuard(router, urlService, placeRouter, placeHistory, interactionService, injector) {
21
21
  this.router = router;
22
- this.urlSerializer = urlSerializer;
22
+ this.urlService = urlService;
23
23
  this.placeRouter = placeRouter;
24
24
  this.placeHistory = placeHistory;
25
25
  this.interactionService = interactionService;
@@ -65,17 +65,17 @@ PlaceGuard = /** @class */ (function () {
65
65
  // Parse our route params.
66
66
  params = new ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
67
67
  parsedParams = placeDefinition.parseRouteParams(params);
68
- initialVisit = this.placeRouter.navigationState.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
68
+ initialVisit = this.placeRouter.navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
69
69
  sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
70
70
  return [4 /*yield*/, sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams))];
71
71
  case 1:
72
72
  sanitisedVisit = _a.sent();
73
73
  // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
74
- this.placeRouter.navigationState.storeVisit(sanitisedVisit);
74
+ this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
75
75
  if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
76
76
  // Regenerate the url
77
- urlSnapshot = this.placeRouter.parseUrl(state.url).updateVisitSegments(sanitisedVisit);
78
- console.log('##### Place Guard Redirect', urlSnapshot);
77
+ urlSnapshot = this.urlService.parseUrl(state.url).updateVisitSegments(sanitisedVisit);
78
+ // console.log('##### Place Guard Redirect', urlSnapshot);
79
79
  return [2 /*return*/, urlSnapshot];
80
80
  }
81
81
  else {
@@ -118,9 +118,9 @@ PlaceGuard = /** @class */ (function () {
118
118
  return tslib_1.__generator(this, function (_a) {
119
119
  switch (_a.label) {
120
120
  case 0:
121
- currentUrl = this.placeRouter.parseUrl(currentState.url);
122
- nextUrl = this.placeRouter.parseUrl(nextState.url);
123
- return [4 /*yield*/, this.placeRouter.navigationState.canDeactivatePlace(component, currentUrl, nextUrl)];
121
+ currentUrl = this.urlService.parseUrl(currentState.url);
122
+ nextUrl = this.urlService.parseUrl(nextState.url);
123
+ return [4 /*yield*/, this.placeRouter.navigationSession.canDeactivatePlace(component, currentUrl, nextUrl)];
124
124
  case 1:
125
125
  result = _a.sent();
126
126
  return [2 /*return*/, this.handleGuardResult(result)];
@@ -128,12 +128,16 @@ PlaceGuard = /** @class */ (function () {
128
128
  });
129
129
  });
130
130
  };
131
+ // @Trace()
132
+ // @Trace()
131
133
  /**
132
134
  * @private
133
135
  * @param {?} result
134
136
  * @return {?}
135
137
  */
136
- PlaceGuard.prototype.handleGuardResult = /**
138
+ PlaceGuard.prototype.handleGuardResult =
139
+ // @Trace()
140
+ /**
137
141
  * @private
138
142
  * @param {?} result
139
143
  * @return {?}
@@ -240,8 +244,8 @@ PlaceGuard = /** @class */ (function () {
240
244
  return tslib_1.__awaiter(this, void 0, void 0, function () {
241
245
  var url;
242
246
  return tslib_1.__generator(this, function (_a) {
243
- url = this.placeRouter.parseUrl(state.url);
244
- if (!this.interactionService.isActive() && url.hasInteractionIds()) {
247
+ url = this.urlService.parseUrl(state.url);
248
+ if (!this.interactionService.isActive() && url.hasInteractions()) {
245
249
  // This happens if we reload the page or the url was pasted as the route should only be activated
246
250
  // after the interaction context has become active.
247
251
  return [2 /*return*/, url.removeInteractionIds()];
@@ -269,7 +273,7 @@ if (false) {
269
273
  * @type {?}
270
274
  * @private
271
275
  */
272
- PlaceGuard.prototype.urlSerializer;
276
+ PlaceGuard.prototype.urlService;
273
277
  /**
274
278
  * @type {?}
275
279
  * @private
@@ -1 +1 @@
1
- {"version":3,"file":"place.guard.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/guards/place.guard.ts"],"names":[],"mappings":";;;;;AAUA,OAAO,EAAE,IAAI,EAAS,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;;;;AAGpE;;;;IAGE,oBAA6B,MAAc,EACvB,aAA4B,EACnB,WAAwB,EACxB,YAA0B,EAC1B,kBAAsC,EACtC,QAAkB;QALlB,WAAM,GAAN,MAAM,CAAQ;QACvB,kBAAa,GAAb,aAAa,CAAe;QACnB,gBAAW,GAAX,WAAW,CAAa;QACxB,iBAAY,GAAZ,YAAY,CAAc;QAC1B,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,aAAQ,GAAR,QAAQ,CAAU;IAC/C,CAAC;IAED,WAAW;;;;;;;IACL,gCAAW;;;;;;;IAAjB,UAAkB,cAAsC,EAAE,KAA0B;;;;gBAEjF,yGAAyG;gBAC1G,6DAA6D;gBAC7D,sBAAO,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,KAAK;;;;oBAAE,UAAO,eAAe;;;;;wCAE3D,qBAAM,IAAI,CAAC,qBAAqB,CAAC,cAAc,EAAE,KAAK;;;oCAAE;;;;;;oDAE/D,MAAM,GAAG,IAAI,wBAAwB,CAAC,cAAc,CAAC,QAAQ,EAAE,cAAc,CAAC,GAAG,CAAC;oDAClF,YAAY,GAAG,eAA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AAC,CAAC,WAAW,CAAC,cAAc,EAAE,KAAK,CAAC;gBACtF,sBAAO,CAAC,UAAU,YAAY,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,UAAU,EAAC;;;KACjF;IAID,WAAW;;;;;;;;IACL,0CAAqB;;;;;;;;IAA3B,UAA4B,KAA6B,EAAE,KAA0B,EAAE,IAA0C;;;;gBACzH,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC;gBAChD,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,IAAI,GAAG,CAAC,iBAAiB,EAAE,EAAE;oBAClE,iGAAiG;oBACjG,mDAAmD;oBACnD,sBAAO,GAAG,CAAC,oBAAoB,EAAE,EAAC;iBACnC;qBAAM;oBACL,sBAAO,IAAI,EAAE,EAAC;iBACf;;;;KACF;IAEH,iBAAC;AAAD,CAAC,AAhGD,IAgGC;;;;;;;;;;IA7Fa,4BAA+B;;;;;IAC/B,mCAAoC;;;;;IACpC,iCAAyC;;;;;IACzC,kCAA2C;;;;;IAC3C,wCAAuD;;;;;IACvD,8BAAmC;;;;;;IA0E/C,4DAAuD","sourcesContent":["import { Injector } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n CanActivate,\n CanDeactivate,\n Router,\n RouterStateSnapshot,\n UrlSerializer,\n UrlTree\n} from '@angular/router';\nimport { lang, Trace } from '@coolon/pectin';\nimport { Observable } from 'rxjs';\nimport { InteractionService } from '../../interaction/services/interaction.service';\nimport { PlaceComponent } from '../place-component';\nimport { PlaceDefinition } from '../place-definition';\nimport { PlaceHistory } from '../place-history';\nimport { PlaceRouter } from '../place-router';\nimport { VisitSanitiser } from '../route/visit-sanitiser';\nimport { UrlSnapshot } from '../url-snapshot';\nimport { Visit } from '../visit';\nimport { ConsolidatedParameterMap } from './consolidated-param-map';\n\n\nexport abstract class PlaceGuard implements CanActivate, CanDeactivate<PlaceComponent> {\n\n\n constructor(private readonly router: Router,\n private urlSerializer: UrlSerializer,\n private readonly placeRouter: PlaceRouter,\n private readonly placeHistory: PlaceHistory,\n private readonly interactionService: InteractionService,\n private readonly injector: Injector) {\n }\n\n // @Trace()\n async canActivate(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree> {\n\n // TODO: this is ugly now that I'm return UrlSnapshots and not UrlTrees. It'd be better if the functions\n // weren't nested or if I implemented a handler chain.\n return this.authorisePlaceThen(activatedRoute, state, async (placeDefinition) => {\n\n const result = await this.cleanInteractionState(activatedRoute, state, async () => {\n // Parse our route params.\n const params = new ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);\n const parsedParams = placeDefinition.parseRouteParams(params);\n\n const initialVisit = this.placeRouter.navigationState.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);\n const sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);\n const sanitisedVisit = await sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams));\n\n // Save the visit with any updated parameters. We need to save it so we remember any non route parameters\n this.placeRouter.navigationState.storeVisit(sanitisedVisit);\n if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {\n // Regenerate the url\n const urlSnapshot = this.placeRouter.parseUrl(state.url).updateVisitSegments(sanitisedVisit);\n console.log('##### Place Guard Redirect', urlSnapshot);\n return urlSnapshot;\n } else {\n return true;\n }\n });\n return this.handleGuardResult(result);\n\n });\n }\n\n // @Trace()\n async canDeactivate(component: PlaceComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Promise<boolean | UrlTree> {\n const currentUrl = this.placeRouter.parseUrl(currentState.url);\n const nextUrl = this.placeRouter.parseUrl(nextState.url);\n const result = await this.placeRouter.navigationState.canDeactivatePlace(component, currentUrl, nextUrl);\n return this.handleGuardResult(result);\n }\n\n private handleGuardResult(result) {\n if (result instanceof UrlSnapshot) {\n return result.urlTree;\n } else {\n return result;\n }\n }\n\n // @Trace()\n protected async authorisePlaceThen(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot, runPlaceGuards: (placeDefinition: PlaceDefinition) => Promise<boolean | UrlTree>) {\n if (PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) {\n const placeDefinition = PlaceComponent.getDefinition(activatedRoute.component);\n const authoriseResult = placeDefinition.authenticate ? await this.isAuthorised(activatedRoute, state) : true;\n if (authoriseResult === true) {\n // we're authorised, now run the place guards.\n return runPlaceGuards(placeDefinition);\n } else {\n console.log('not authorised result', authoriseResult);\n return authoriseResult;\n }\n } else {\n return lang.illegalState(`expected component to be an instance of PlaceComponent, got ${activatedRoute.component}`);\n }\n }\n\n // @Trace()\n async isAuthorised(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree> {\n const authorised = this.getAuthGuard(this.injector).canActivate(activatedRoute, state);\n return (authorised instanceof Observable) ? authorised.toPromise() : authorised;\n }\n\n abstract getAuthGuard(injector: Injector): CanActivate;\n\n // @Trace()\n async cleanInteractionState(route: ActivatedRouteSnapshot, state: RouterStateSnapshot, then: () => Promise<boolean | UrlSnapshot>): Promise<boolean | UrlSnapshot> {\n const url = this.placeRouter.parseUrl(state.url);\n if (!this.interactionService.isActive() && url.hasInteractionIds()) {\n // This happens if we reload the page or the url was pasted as the route should only be activated\n // after the interaction context has become active.\n return url.removeInteractionIds();\n } else {\n return then();\n }\n }\n\n}\n"]}
1
+ {"version":3,"file":"place.guard.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/guards/place.guard.ts"],"names":[],"mappings":";;;;;AAUA,OAAO,EAAE,IAAI,EAAS,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CA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IAAI,GAAG,CAAC,eAAe,EAAE,EAAE;oBAChE,iGAAiG;oBACjG,mDAAmD;oBACnD,sBAAO,GAAG,CAAC,oBAAoB,EAAE,EAAC;iBACnC;qBAAM;oBACL,sBAAO,IAAI,EAAE,EAAC;iBACf;;;;KACF;IAEH,iBAAC;AAAD,CAAC,AAjGD,IAiGC;;;;;;;;;;IA9Fa,4BAA+B;;;;;IAC/B,gCAA8B;;;;;IAC9B,iCAAyC;;;;;IACzC,kCAA2C;;;;;IAC3C,wCAAuD;;;;;IACvD,8BAAmC;;;;;;IA2E/C,4DAAuD","sourcesContent":["import { Injector } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n CanActivate,\n CanDeactivate,\n Router,\n RouterStateSnapshot,\n UrlSerializer,\n UrlTree\n} from '@angular/router';\nimport { lang, Trace } from '@coolon/pectin';\nimport { Observable } from 'rxjs';\nimport { InteractionService } from '../../interaction/services/interaction.service';\nimport { PlaceComponent } from '../place-component';\nimport { PlaceDefinition } from '../place-definition';\nimport { PlaceHistory } from '../place-history';\nimport { PlaceRouter } from '../place-router';\nimport { VisitSanitiser } from '../route/visit-sanitiser';\nimport { UrlService } from '../url-service';\nimport { UrlSnapshot } from '../url-snapshot';\nimport { Visit } from '../visit';\nimport { ConsolidatedParameterMap } from './consolidated-param-map';\n\n\nexport abstract class PlaceGuard implements CanActivate, CanDeactivate<PlaceComponent> {\n\n\n constructor(private readonly router: Router,\n private urlService: UrlService,\n private readonly placeRouter: PlaceRouter,\n private readonly placeHistory: PlaceHistory,\n private readonly interactionService: InteractionService,\n private readonly injector: Injector) {\n }\n\n // @Trace()\n async canActivate(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree> {\n\n // TODO: this is ugly now that I'm return UrlSnapshots and not UrlTrees. It'd be better if the functions\n // weren't nested or if I implemented a handler chain.\n return this.authorisePlaceThen(activatedRoute, state, async (placeDefinition) => {\n\n const result = await this.cleanInteractionState(activatedRoute, state, async () => {\n // Parse our route params.\n const params = new ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);\n const parsedParams = placeDefinition.parseRouteParams(params);\n\n const initialVisit = this.placeRouter.navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);\n const sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);\n const sanitisedVisit = await sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams));\n\n // Save the visit with any updated parameters. We need to save it so we remember any non route parameters\n this.placeRouter.navigationSession.storeVisit(sanitisedVisit);\n if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {\n // Regenerate the url\n const urlSnapshot = this.urlService.parseUrl(state.url).updateVisitSegments(sanitisedVisit);\n // console.log('##### Place Guard Redirect', urlSnapshot);\n return urlSnapshot;\n } else {\n return true;\n }\n });\n return this.handleGuardResult(result);\n\n });\n }\n\n // @Trace()\n async canDeactivate(component: PlaceComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Promise<boolean | UrlTree> {\n const currentUrl = this.urlService.parseUrl(currentState.url);\n const nextUrl = this.urlService.parseUrl(nextState.url);\n const result = await this.placeRouter.navigationSession.canDeactivatePlace(component, currentUrl, nextUrl);\n return this.handleGuardResult(result);\n }\n\n // @Trace()\n private handleGuardResult(result) {\n if (result instanceof UrlSnapshot) {\n return result.urlTree;\n } else {\n return result;\n }\n }\n\n // @Trace()\n protected async authorisePlaceThen(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot, runPlaceGuards: (placeDefinition: PlaceDefinition) => Promise<boolean | UrlTree>) {\n if (PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) {\n const placeDefinition = PlaceComponent.getDefinition(activatedRoute.component);\n const authoriseResult = placeDefinition.authenticate ? await this.isAuthorised(activatedRoute, state) : true;\n if (authoriseResult === true) {\n // we're authorised, now run the place guards.\n return runPlaceGuards(placeDefinition);\n } else {\n console.log('not authorised result', authoriseResult);\n return authoriseResult;\n }\n } else {\n return lang.illegalState(`expected component to be an instance of PlaceComponent, got ${activatedRoute.component}`);\n }\n }\n\n // @Trace()\n async isAuthorised(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree> {\n const authorised = this.getAuthGuard(this.injector).canActivate(activatedRoute, state);\n return (authorised instanceof Observable) ? authorised.toPromise() : authorised;\n }\n\n abstract getAuthGuard(injector: Injector): CanActivate;\n\n // @Trace()\n async cleanInteractionState(route: ActivatedRouteSnapshot, state: RouterStateSnapshot, then: () => Promise<boolean | UrlSnapshot>): Promise<boolean | UrlSnapshot> {\n const url = this.urlService.parseUrl(state.url);\n if (!this.interactionService.isActive() && url.hasInteractions()) {\n // This happens if we reload the page or the url was pasted as the route should only be activated\n // after the interaction context has become active.\n return url.removeInteractionIds();\n } else {\n return then();\n }\n }\n\n}\n"]}