@angular/platform-browser 0.0.0-6 → 2.0.0-rc.2

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 (546) hide show
  1. package/bundles/platform-browser.umd.js +4685 -0
  2. package/bundles/platform-browser.umd.min.js +4 -0
  3. package/core_private.d.ts +27 -1
  4. package/core_private.js +16 -0
  5. package/core_private.js.map +1 -1
  6. package/core_private.metadata.json +1 -1
  7. package/esm/core_private.d.ts +27 -1
  8. package/esm/core_private.js +16 -0
  9. package/esm/core_private.js.map +1 -1
  10. package/esm/core_private.metadata.json +1 -1
  11. package/esm/index.d.ts +22 -1
  12. package/esm/index.js +25 -1
  13. package/esm/index.js.map +1 -1
  14. package/esm/index.metadata.json +1 -0
  15. package/esm/private_export.d.ts +21 -21
  16. package/esm/private_export.js +11 -21
  17. package/esm/private_export.js.map +1 -1
  18. package/esm/private_export.metadata.json +1 -0
  19. package/esm/src/browser/browser_adapter.d.ts +6 -0
  20. package/esm/src/browser/browser_adapter.js +146 -76
  21. package/esm/src/browser/browser_adapter.js.map +1 -1
  22. package/esm/src/browser/generic_browser_adapter.js +4 -4
  23. package/esm/src/browser/generic_browser_adapter.js.map +1 -1
  24. package/esm/src/browser/location/browser_platform_location.d.ts +1 -5
  25. package/esm/src/browser/location/browser_platform_location.js +16 -3
  26. package/esm/src/browser/location/browser_platform_location.js.map +1 -1
  27. package/esm/src/browser/location/browser_platform_location.metadata.json +1 -1
  28. package/esm/src/browser/location/history.d.ts +1 -0
  29. package/esm/src/browser/location/history.js +4 -0
  30. package/esm/src/browser/location/history.js.map +1 -0
  31. package/esm/src/browser/location/history.metadata.json +1 -0
  32. package/esm/src/browser/testability.d.ts +1 -1
  33. package/esm/src/browser/testability.js +7 -5
  34. package/esm/src/browser/testability.js.map +1 -1
  35. package/esm/src/browser/title.d.ts +2 -0
  36. package/esm/src/browser/title.js +2 -0
  37. package/esm/src/browser/title.js.map +1 -1
  38. package/esm/src/browser/tools/common_tools.js +2 -2
  39. package/esm/src/browser/tools/common_tools.js.map +1 -1
  40. package/esm/src/browser/tools/tools.d.ts +1 -1
  41. package/esm/src/browser/tools/tools.js +2 -1
  42. package/esm/src/browser/tools/tools.js.map +1 -1
  43. package/esm/src/browser.d.ts +15 -0
  44. package/esm/src/browser.js +76 -0
  45. package/esm/src/browser.js.map +1 -0
  46. package/esm/src/browser.metadata.json +1 -0
  47. package/esm/src/dom/debug/by.d.ts +2 -2
  48. package/esm/src/dom/debug/by.js +1 -1
  49. package/esm/src/dom/debug/by.js.map +1 -1
  50. package/esm/src/dom/debug/ng_probe.js +10 -19
  51. package/esm/src/dom/debug/ng_probe.js.map +1 -1
  52. package/esm/src/dom/debug/ng_probe.metadata.json +1 -1
  53. package/esm/src/dom/dom_adapter.d.ts +7 -5
  54. package/esm/src/dom/dom_adapter.js +1 -1
  55. package/esm/src/dom/dom_adapter.js.map +1 -1
  56. package/esm/src/dom/dom_adapter.metadata.json +1 -0
  57. package/esm/src/dom/dom_animate_player.d.ts +9 -0
  58. package/esm/src/dom/dom_animate_player.js +1 -0
  59. package/esm/src/dom/dom_animate_player.js.map +1 -0
  60. package/esm/src/dom/dom_renderer.d.ts +9 -19
  61. package/esm/src/dom/dom_renderer.js +29 -61
  62. package/esm/src/dom/dom_renderer.js.map +1 -1
  63. package/esm/src/dom/dom_renderer.metadata.json +1 -1
  64. package/esm/src/dom/dom_tokens.js.map +1 -1
  65. package/esm/src/dom/dom_tokens.metadata.json +1 -1
  66. package/esm/src/dom/events/dom_events.js +3 -2
  67. package/esm/src/dom/events/dom_events.js.map +1 -1
  68. package/esm/src/dom/events/dom_events.metadata.json +1 -1
  69. package/esm/src/dom/events/event_manager.d.ts +1 -3
  70. package/esm/src/dom/events/event_manager.js +9 -8
  71. package/esm/src/dom/events/event_manager.js.map +1 -1
  72. package/esm/src/dom/events/event_manager.metadata.json +1 -1
  73. package/esm/src/dom/events/hammer_common.js +1 -1
  74. package/esm/src/dom/events/hammer_common.js.map +1 -1
  75. package/esm/src/dom/events/hammer_gestures.js +10 -6
  76. package/esm/src/dom/events/hammer_gestures.js.map +1 -1
  77. package/esm/src/dom/events/hammer_gestures.metadata.json +1 -1
  78. package/esm/src/dom/events/key_events.d.ts +0 -2
  79. package/esm/src/dom/events/key_events.js +5 -3
  80. package/esm/src/dom/events/key_events.js.map +1 -1
  81. package/esm/src/dom/events/key_events.metadata.json +1 -1
  82. package/esm/src/dom/shared_styles_host.d.ts +0 -6
  83. package/esm/src/dom/shared_styles_host.js +5 -1
  84. package/esm/src/dom/shared_styles_host.js.map +1 -1
  85. package/esm/src/dom/shared_styles_host.metadata.json +1 -1
  86. package/esm/src/dom/util.js +3 -3
  87. package/esm/src/dom/util.js.map +1 -1
  88. package/esm/src/dom/util.metadata.json +1 -0
  89. package/esm/src/dom/web_animations_driver.d.ts +4 -0
  90. package/esm/src/dom/web_animations_driver.js +118 -0
  91. package/esm/src/dom/web_animations_driver.js.map +1 -0
  92. package/esm/src/dom/web_animations_player.d.ts +20 -0
  93. package/esm/src/dom/web_animations_player.js +42 -0
  94. package/esm/src/dom/web_animations_player.js.map +1 -0
  95. package/esm/src/facade/async.d.ts +90 -0
  96. package/esm/src/facade/async.js +137 -0
  97. package/esm/src/facade/async.js.map +1 -0
  98. package/esm/src/facade/base_wrapped_exception.js +4 -4
  99. package/esm/src/facade/base_wrapped_exception.js.map +1 -1
  100. package/esm/src/facade/browser.js +2 -2
  101. package/esm/src/facade/browser.js.map +1 -1
  102. package/esm/src/facade/browser.metadata.json +1 -1
  103. package/esm/src/facade/collection.js +1 -1
  104. package/esm/src/facade/collection.js.map +1 -1
  105. package/esm/src/facade/collection.metadata.json +1 -1
  106. package/esm/src/facade/exception_handler.d.ts +2 -11
  107. package/esm/src/facade/exception_handler.js +8 -7
  108. package/esm/src/facade/exception_handler.js.map +1 -1
  109. package/esm/src/facade/exceptions.d.ts +4 -0
  110. package/esm/src/facade/exceptions.js +6 -2
  111. package/esm/src/facade/exceptions.js.map +1 -1
  112. package/esm/src/facade/exceptions.metadata.json +1 -0
  113. package/esm/src/facade/lang.d.ts +6 -4
  114. package/esm/src/facade/lang.js +12 -11
  115. package/esm/src/facade/lang.js.map +1 -1
  116. package/esm/src/facade/lang.metadata.json +1 -1
  117. package/esm/src/facade/promise.d.ts +17 -0
  118. package/esm/src/facade/promise.js +41 -0
  119. package/esm/src/facade/promise.js.map +1 -0
  120. package/esm/src/security/dom_sanitization_service.d.ts +98 -0
  121. package/esm/src/security/dom_sanitization_service.js +108 -0
  122. package/esm/src/security/dom_sanitization_service.js.map +1 -0
  123. package/esm/src/security/dom_sanitization_service.metadata.json +1 -0
  124. package/esm/src/security/html_sanitizer.d.ts +5 -0
  125. package/esm/src/security/html_sanitizer.js +233 -0
  126. package/esm/src/security/html_sanitizer.js.map +1 -0
  127. package/esm/src/security/style_sanitizer.d.ts +5 -0
  128. package/esm/src/security/style_sanitizer.js +81 -0
  129. package/esm/src/security/style_sanitizer.js.map +1 -0
  130. package/esm/src/security/url_sanitizer.d.ts +1 -0
  131. package/esm/src/security/url_sanitizer.js +40 -0
  132. package/esm/src/security/url_sanitizer.js.map +1 -0
  133. package/esm/src/web_workers/shared/api.d.ts +2 -0
  134. package/esm/src/web_workers/shared/api.js +3 -0
  135. package/esm/src/web_workers/shared/api.js.map +1 -0
  136. package/esm/src/web_workers/shared/api.metadata.json +1 -0
  137. package/esm/src/web_workers/shared/client_message_broker.d.ts +51 -0
  138. package/esm/src/web_workers/shared/client_message_broker.js +156 -0
  139. package/esm/src/web_workers/shared/client_message_broker.js.map +1 -0
  140. package/esm/src/web_workers/shared/client_message_broker.metadata.json +1 -0
  141. package/esm/src/web_workers/shared/message_bus.d.ts +82 -0
  142. package/esm/src/web_workers/shared/message_bus.js +10 -0
  143. package/esm/src/web_workers/shared/message_bus.js.map +1 -0
  144. package/esm/src/web_workers/shared/messaging_api.d.ts +7 -0
  145. package/esm/src/web_workers/shared/messaging_api.js +8 -0
  146. package/esm/src/web_workers/shared/messaging_api.js.map +1 -0
  147. package/esm/src/web_workers/shared/messaging_api.metadata.json +1 -0
  148. package/esm/src/web_workers/shared/post_message_bus.d.ts +41 -0
  149. package/esm/src/web_workers/shared/post_message_bus.js +133 -0
  150. package/esm/src/web_workers/shared/post_message_bus.js.map +1 -0
  151. package/esm/src/web_workers/shared/post_message_bus.metadata.json +1 -0
  152. package/esm/src/web_workers/shared/render_store.d.ts +11 -0
  153. package/esm/src/web_workers/shared/render_store.js +40 -0
  154. package/esm/src/web_workers/shared/render_store.js.map +1 -0
  155. package/esm/src/web_workers/shared/render_store.metadata.json +1 -0
  156. package/esm/src/web_workers/shared/serialized_types.d.ts +12 -0
  157. package/esm/src/web_workers/shared/serialized_types.js +16 -0
  158. package/esm/src/web_workers/shared/serialized_types.js.map +1 -0
  159. package/esm/src/web_workers/shared/serializer.d.ts +18 -0
  160. package/esm/src/web_workers/shared/serializer.js +110 -0
  161. package/esm/src/web_workers/shared/serializer.js.map +1 -0
  162. package/esm/src/web_workers/shared/serializer.metadata.json +1 -0
  163. package/esm/src/web_workers/shared/service_message_broker.d.ts +48 -0
  164. package/esm/src/web_workers/shared/service_message_broker.js +88 -0
  165. package/esm/src/web_workers/shared/service_message_broker.js.map +1 -0
  166. package/esm/src/web_workers/shared/service_message_broker.metadata.json +1 -0
  167. package/esm/src/web_workers/ui/event_dispatcher.d.ts +8 -0
  168. package/esm/src/web_workers/ui/event_dispatcher.js +104 -0
  169. package/esm/src/web_workers/ui/event_dispatcher.js.map +1 -0
  170. package/esm/src/web_workers/ui/event_serializer.d.ts +15 -0
  171. package/esm/src/web_workers/ui/event_serializer.js +53 -0
  172. package/esm/src/web_workers/ui/event_serializer.js.map +1 -0
  173. package/esm/src/web_workers/ui/event_serializer.metadata.json +1 -0
  174. package/esm/src/web_workers/ui/location_providers.d.ts +14 -0
  175. package/esm/src/web_workers/ui/location_providers.js +19 -0
  176. package/esm/src/web_workers/ui/location_providers.js.map +1 -0
  177. package/esm/src/web_workers/ui/location_providers.metadata.json +1 -0
  178. package/esm/src/web_workers/ui/platform_location.d.ts +16 -0
  179. package/esm/src/web_workers/ui/platform_location.js +49 -0
  180. package/esm/src/web_workers/ui/platform_location.js.map +1 -0
  181. package/esm/src/web_workers/ui/platform_location.metadata.json +1 -0
  182. package/esm/src/web_workers/ui/renderer.d.ts +35 -0
  183. package/esm/src/web_workers/ui/renderer.js +122 -0
  184. package/esm/src/web_workers/ui/renderer.js.map +1 -0
  185. package/esm/src/web_workers/ui/renderer.metadata.json +1 -0
  186. package/esm/src/web_workers/worker/event_deserializer.d.ts +5 -0
  187. package/esm/src/web_workers/worker/event_deserializer.js +6 -0
  188. package/esm/src/web_workers/worker/event_deserializer.js.map +1 -0
  189. package/esm/src/web_workers/worker/event_deserializer.metadata.json +1 -0
  190. package/esm/src/web_workers/worker/location_providers.d.ts +17 -0
  191. package/esm/src/web_workers/worker/location_providers.js +20 -0
  192. package/esm/src/web_workers/worker/location_providers.js.map +1 -0
  193. package/esm/src/web_workers/worker/location_providers.metadata.json +1 -0
  194. package/esm/src/web_workers/worker/platform_location.d.ts +23 -0
  195. package/esm/src/web_workers/worker/platform_location.js +111 -0
  196. package/esm/src/web_workers/worker/platform_location.js.map +1 -0
  197. package/esm/src/web_workers/worker/platform_location.metadata.json +1 -0
  198. package/esm/src/web_workers/worker/renderer.d.ts +55 -0
  199. package/esm/src/web_workers/worker/renderer.js +227 -0
  200. package/esm/src/web_workers/worker/renderer.js.map +1 -0
  201. package/esm/src/web_workers/worker/renderer.metadata.json +1 -0
  202. package/esm/src/web_workers/worker/worker_adapter.d.ts +132 -0
  203. package/esm/src/web_workers/worker/worker_adapter.js +192 -0
  204. package/esm/src/web_workers/worker/worker_adapter.js.map +1 -0
  205. package/esm/src/worker_app.d.ts +13 -0
  206. package/esm/src/worker_app.js +68 -0
  207. package/esm/src/worker_app.js.map +1 -0
  208. package/esm/src/worker_app.metadata.json +1 -0
  209. package/esm/src/worker_render.d.ts +35 -0
  210. package/esm/src/worker_render.js +147 -0
  211. package/esm/src/worker_render.js.map +1 -0
  212. package/esm/src/worker_render.metadata.json +1 -0
  213. package/esm/testing/browser.d.ts +8 -0
  214. package/esm/testing/browser.js +38 -0
  215. package/esm/testing/browser.js.map +1 -0
  216. package/esm/testing/browser.metadata.json +1 -0
  217. package/esm/testing/browser_util.d.ts +1 -0
  218. package/esm/testing/browser_util.js +11 -6
  219. package/esm/testing/browser_util.js.map +1 -1
  220. package/esm/testing/browser_util.metadata.json +1 -1
  221. package/esm/testing/e2e_util.d.ts +4 -0
  222. package/esm/testing/e2e_util.js +21 -0
  223. package/esm/testing/e2e_util.js.map +1 -0
  224. package/esm/testing/e2e_util.metadata.json +1 -0
  225. package/esm/testing/matchers.js +24 -22
  226. package/esm/testing/matchers.js.map +1 -1
  227. package/esm/testing/matchers.metadata.json +1 -1
  228. package/esm/testing.d.ts +1 -2
  229. package/esm/testing.js +1 -2
  230. package/esm/testing.js.map +1 -1
  231. package/esm/testing_e2e.d.ts +1 -0
  232. package/esm/testing_e2e.js +2 -0
  233. package/esm/testing_e2e.js.map +1 -0
  234. package/index.d.ts +22 -1
  235. package/index.js +50 -1
  236. package/index.js.map +1 -1
  237. package/index.metadata.json +1 -0
  238. package/package.json +8 -4
  239. package/private_export.d.ts +21 -21
  240. package/private_export.js +11 -21
  241. package/private_export.js.map +1 -1
  242. package/private_export.metadata.json +1 -0
  243. package/src/browser/browser_adapter.d.ts +6 -0
  244. package/src/browser/browser_adapter.js +144 -76
  245. package/src/browser/browser_adapter.js.map +1 -1
  246. package/src/browser/generic_browser_adapter.js +4 -4
  247. package/src/browser/generic_browser_adapter.js.map +1 -1
  248. package/src/browser/location/browser_platform_location.d.ts +1 -5
  249. package/src/browser/location/browser_platform_location.js +16 -3
  250. package/src/browser/location/browser_platform_location.js.map +1 -1
  251. package/src/browser/location/browser_platform_location.metadata.json +1 -1
  252. package/src/browser/location/history.d.ts +1 -0
  253. package/src/browser/location/history.js +6 -0
  254. package/src/browser/location/history.js.map +1 -0
  255. package/src/browser/location/history.metadata.json +1 -0
  256. package/src/browser/testability.d.ts +1 -1
  257. package/src/browser/testability.js +7 -5
  258. package/src/browser/testability.js.map +1 -1
  259. package/src/browser/title.d.ts +2 -0
  260. package/src/browser/title.js +2 -0
  261. package/src/browser/title.js.map +1 -1
  262. package/src/browser/tools/common_tools.js +2 -2
  263. package/src/browser/tools/common_tools.js.map +1 -1
  264. package/src/browser/tools/tools.d.ts +1 -1
  265. package/src/browser/tools/tools.js +2 -1
  266. package/src/browser/tools/tools.js.map +1 -1
  267. package/src/browser.d.ts +15 -0
  268. package/src/browser.js +78 -0
  269. package/src/browser.js.map +1 -0
  270. package/src/browser.metadata.json +1 -0
  271. package/src/dom/debug/by.d.ts +2 -2
  272. package/src/dom/debug/by.js +1 -1
  273. package/src/dom/debug/by.js.map +1 -1
  274. package/src/dom/debug/ng_probe.js +9 -18
  275. package/src/dom/debug/ng_probe.js.map +1 -1
  276. package/src/dom/debug/ng_probe.metadata.json +1 -1
  277. package/src/dom/dom_adapter.d.ts +7 -5
  278. package/src/dom/dom_adapter.js +1 -1
  279. package/src/dom/dom_adapter.js.map +1 -1
  280. package/src/dom/dom_adapter.metadata.json +1 -0
  281. package/src/dom/dom_animate_player.d.ts +9 -0
  282. package/src/dom/dom_animate_player.js +2 -0
  283. package/src/dom/dom_animate_player.js.map +1 -0
  284. package/src/dom/dom_renderer.d.ts +9 -19
  285. package/src/dom/dom_renderer.js +29 -61
  286. package/src/dom/dom_renderer.js.map +1 -1
  287. package/src/dom/dom_renderer.metadata.json +1 -1
  288. package/src/dom/dom_tokens.js.map +1 -1
  289. package/src/dom/dom_tokens.metadata.json +1 -1
  290. package/src/dom/events/dom_events.js +3 -2
  291. package/src/dom/events/dom_events.js.map +1 -1
  292. package/src/dom/events/dom_events.metadata.json +1 -1
  293. package/src/dom/events/event_manager.d.ts +1 -3
  294. package/src/dom/events/event_manager.js +8 -7
  295. package/src/dom/events/event_manager.js.map +1 -1
  296. package/src/dom/events/event_manager.metadata.json +1 -1
  297. package/src/dom/events/hammer_common.js +1 -1
  298. package/src/dom/events/hammer_common.js.map +1 -1
  299. package/src/dom/events/hammer_gestures.js +9 -5
  300. package/src/dom/events/hammer_gestures.js.map +1 -1
  301. package/src/dom/events/hammer_gestures.metadata.json +1 -1
  302. package/src/dom/events/key_events.d.ts +0 -2
  303. package/src/dom/events/key_events.js +5 -3
  304. package/src/dom/events/key_events.js.map +1 -1
  305. package/src/dom/events/key_events.metadata.json +1 -1
  306. package/src/dom/shared_styles_host.d.ts +0 -6
  307. package/src/dom/shared_styles_host.js +5 -1
  308. package/src/dom/shared_styles_host.js.map +1 -1
  309. package/src/dom/shared_styles_host.metadata.json +1 -1
  310. package/src/dom/util.js +3 -3
  311. package/src/dom/util.js.map +1 -1
  312. package/src/dom/util.metadata.json +1 -0
  313. package/src/dom/web_animations_driver.d.ts +4 -0
  314. package/src/dom/web_animations_driver.js +123 -0
  315. package/src/dom/web_animations_driver.js.map +1 -0
  316. package/src/dom/web_animations_player.d.ts +20 -0
  317. package/src/dom/web_animations_player.js +46 -0
  318. package/src/dom/web_animations_player.js.map +1 -0
  319. package/src/facade/async.d.ts +90 -0
  320. package/src/facade/async.js +160 -0
  321. package/src/facade/async.js.map +1 -0
  322. package/src/facade/base_wrapped_exception.js +4 -4
  323. package/src/facade/base_wrapped_exception.js.map +1 -1
  324. package/src/facade/browser.js +2 -2
  325. package/src/facade/browser.js.map +1 -1
  326. package/src/facade/browser.metadata.json +1 -1
  327. package/src/facade/collection.js.map +1 -1
  328. package/src/facade/collection.metadata.json +1 -1
  329. package/src/facade/exception_handler.d.ts +2 -11
  330. package/src/facade/exception_handler.js +8 -7
  331. package/src/facade/exception_handler.js.map +1 -1
  332. package/src/facade/exceptions.d.ts +4 -0
  333. package/src/facade/exceptions.js +6 -2
  334. package/src/facade/exceptions.js.map +1 -1
  335. package/src/facade/exceptions.metadata.json +1 -0
  336. package/src/facade/lang.d.ts +6 -4
  337. package/src/facade/lang.js +12 -11
  338. package/src/facade/lang.js.map +1 -1
  339. package/src/facade/lang.metadata.json +1 -1
  340. package/src/facade/promise.d.ts +17 -0
  341. package/src/facade/promise.js +49 -0
  342. package/src/facade/promise.js.map +1 -0
  343. package/src/security/dom_sanitization_service.d.ts +98 -0
  344. package/src/security/dom_sanitization_service.js +150 -0
  345. package/src/security/dom_sanitization_service.js.map +1 -0
  346. package/src/security/dom_sanitization_service.metadata.json +1 -0
  347. package/src/security/html_sanitizer.d.ts +5 -0
  348. package/src/security/html_sanitizer.js +246 -0
  349. package/src/security/html_sanitizer.js.map +1 -0
  350. package/src/security/style_sanitizer.d.ts +5 -0
  351. package/src/security/style_sanitizer.js +83 -0
  352. package/src/security/style_sanitizer.js.map +1 -0
  353. package/src/security/url_sanitizer.d.ts +1 -0
  354. package/src/security/url_sanitizer.js +42 -0
  355. package/src/security/url_sanitizer.js.map +1 -0
  356. package/src/web_workers/shared/api.d.ts +2 -0
  357. package/src/web_workers/shared/api.js +4 -0
  358. package/src/web_workers/shared/api.js.map +1 -0
  359. package/src/web_workers/shared/api.metadata.json +1 -0
  360. package/src/web_workers/shared/client_message_broker.d.ts +51 -0
  361. package/src/web_workers/shared/client_message_broker.js +184 -0
  362. package/src/web_workers/shared/client_message_broker.js.map +1 -0
  363. package/src/web_workers/shared/client_message_broker.metadata.json +1 -0
  364. package/src/web_workers/shared/message_bus.d.ts +82 -0
  365. package/src/web_workers/shared/message_bus.js +15 -0
  366. package/src/web_workers/shared/message_bus.js.map +1 -0
  367. package/src/web_workers/shared/messaging_api.d.ts +7 -0
  368. package/src/web_workers/shared/messaging_api.js +9 -0
  369. package/src/web_workers/shared/messaging_api.js.map +1 -0
  370. package/src/web_workers/shared/messaging_api.metadata.json +1 -0
  371. package/src/web_workers/shared/post_message_bus.d.ts +41 -0
  372. package/src/web_workers/shared/post_message_bus.js +147 -0
  373. package/src/web_workers/shared/post_message_bus.js.map +1 -0
  374. package/src/web_workers/shared/post_message_bus.metadata.json +1 -0
  375. package/src/web_workers/shared/render_store.d.ts +11 -0
  376. package/src/web_workers/shared/render_store.js +43 -0
  377. package/src/web_workers/shared/render_store.js.map +1 -0
  378. package/src/web_workers/shared/render_store.metadata.json +1 -0
  379. package/src/web_workers/shared/serialized_types.d.ts +12 -0
  380. package/src/web_workers/shared/serialized_types.js +19 -0
  381. package/src/web_workers/shared/serialized_types.js.map +1 -0
  382. package/src/web_workers/shared/serializer.d.ts +18 -0
  383. package/src/web_workers/shared/serializer.js +119 -0
  384. package/src/web_workers/shared/serializer.js.map +1 -0
  385. package/src/web_workers/shared/serializer.metadata.json +1 -0
  386. package/src/web_workers/shared/service_message_broker.d.ts +48 -0
  387. package/src/web_workers/shared/service_message_broker.js +114 -0
  388. package/src/web_workers/shared/service_message_broker.js.map +1 -0
  389. package/src/web_workers/shared/service_message_broker.metadata.json +1 -0
  390. package/src/web_workers/ui/event_dispatcher.d.ts +8 -0
  391. package/src/web_workers/ui/event_dispatcher.js +107 -0
  392. package/src/web_workers/ui/event_dispatcher.js.map +1 -0
  393. package/src/web_workers/ui/event_serializer.d.ts +15 -0
  394. package/src/web_workers/ui/event_serializer.js +59 -0
  395. package/src/web_workers/ui/event_serializer.js.map +1 -0
  396. package/src/web_workers/ui/event_serializer.metadata.json +1 -0
  397. package/src/web_workers/ui/location_providers.d.ts +14 -0
  398. package/src/web_workers/ui/location_providers.js +20 -0
  399. package/src/web_workers/ui/location_providers.js.map +1 -0
  400. package/src/web_workers/ui/location_providers.metadata.json +1 -0
  401. package/src/web_workers/ui/platform_location.d.ts +16 -0
  402. package/src/web_workers/ui/platform_location.js +52 -0
  403. package/src/web_workers/ui/platform_location.js.map +1 -0
  404. package/src/web_workers/ui/platform_location.metadata.json +1 -0
  405. package/src/web_workers/ui/renderer.d.ts +35 -0
  406. package/src/web_workers/ui/renderer.js +131 -0
  407. package/src/web_workers/ui/renderer.js.map +1 -0
  408. package/src/web_workers/ui/renderer.metadata.json +1 -0
  409. package/src/web_workers/worker/event_deserializer.d.ts +5 -0
  410. package/src/web_workers/worker/event_deserializer.js +8 -0
  411. package/src/web_workers/worker/event_deserializer.js.map +1 -0
  412. package/src/web_workers/worker/event_deserializer.metadata.json +1 -0
  413. package/src/web_workers/worker/location_providers.d.ts +17 -0
  414. package/src/web_workers/worker/location_providers.js +21 -0
  415. package/src/web_workers/worker/location_providers.js.map +1 -0
  416. package/src/web_workers/worker/location_providers.metadata.json +1 -0
  417. package/src/web_workers/worker/platform_location.d.ts +23 -0
  418. package/src/web_workers/worker/platform_location.js +134 -0
  419. package/src/web_workers/worker/platform_location.js.map +1 -0
  420. package/src/web_workers/worker/platform_location.metadata.json +1 -0
  421. package/src/web_workers/worker/renderer.d.ts +55 -0
  422. package/src/web_workers/worker/renderer.js +241 -0
  423. package/src/web_workers/worker/renderer.js.map +1 -0
  424. package/src/web_workers/worker/renderer.metadata.json +1 -0
  425. package/src/web_workers/worker/worker_adapter.d.ts +132 -0
  426. package/src/web_workers/worker/worker_adapter.js +208 -0
  427. package/src/web_workers/worker/worker_adapter.js.map +1 -0
  428. package/src/worker_app.d.ts +13 -0
  429. package/src/worker_app.js +71 -0
  430. package/src/worker_app.js.map +1 -0
  431. package/src/worker_app.metadata.json +1 -0
  432. package/src/worker_render.d.ts +35 -0
  433. package/src/worker_render.js +153 -0
  434. package/src/worker_render.js.map +1 -0
  435. package/src/worker_render.metadata.json +1 -0
  436. package/testing/browser.d.ts +8 -0
  437. package/testing/browser.js +39 -0
  438. package/testing/browser.js.map +1 -0
  439. package/testing/browser.metadata.json +1 -0
  440. package/testing/browser_util.d.ts +1 -0
  441. package/testing/browser_util.js +14 -5
  442. package/testing/browser_util.js.map +1 -1
  443. package/testing/browser_util.metadata.json +1 -1
  444. package/testing/e2e_util.d.ts +4 -0
  445. package/testing/e2e_util.js +24 -0
  446. package/testing/e2e_util.js.map +1 -0
  447. package/testing/e2e_util.metadata.json +1 -0
  448. package/testing/matchers.js +24 -22
  449. package/testing/matchers.js.map +1 -1
  450. package/testing/matchers.metadata.json +1 -1
  451. package/testing.d.ts +1 -2
  452. package/testing.js +1 -2
  453. package/testing.js.map +1 -1
  454. package/testing_e2e.d.ts +1 -0
  455. package/testing_e2e.js +6 -0
  456. package/testing_e2e.js.map +1 -0
  457. package/esm/platform-browser.umd.js.map +0 -1
  458. package/esm/src/animate/animation.d.ts +0 -82
  459. package/esm/src/animate/animation.js +0 -173
  460. package/esm/src/animate/animation.js.map +0 -1
  461. package/esm/src/animate/animation_builder.d.ts +0 -15
  462. package/esm/src/animate/animation_builder.js +0 -24
  463. package/esm/src/animate/animation_builder.js.map +0 -1
  464. package/esm/src/animate/animation_builder.metadata.json +0 -1
  465. package/esm/src/animate/browser_details.d.ts +0 -10
  466. package/esm/src/animate/browser_details.js +0 -60
  467. package/esm/src/animate/browser_details.js.map +0 -1
  468. package/esm/src/animate/browser_details.metadata.json +0 -1
  469. package/esm/src/animate/css_animation_builder.d.ts +0 -66
  470. package/esm/src/animate/css_animation_builder.js +0 -84
  471. package/esm/src/animate/css_animation_builder.js.map +0 -1
  472. package/esm/src/animate/css_animation_options.d.ts +0 -20
  473. package/esm/src/animate/css_animation_options.js +0 -11
  474. package/esm/src/animate/css_animation_options.js.map +0 -1
  475. package/esm/src/browser_common.d.ts +0 -20
  476. package/esm/src/browser_common.js +0 -76
  477. package/esm/src/browser_common.js.map +0 -1
  478. package/esm/src/browser_common.metadata.json +0 -1
  479. package/esm/src/facade/math.d.ts +0 -2
  480. package/esm/src/facade/math.js +0 -4
  481. package/esm/src/facade/math.js.map +0 -1
  482. package/esm/src/facade/math.metadata.json +0 -1
  483. package/esm/src/platform_browser.d.ts +0 -9
  484. package/esm/src/platform_browser.js +0 -17
  485. package/esm/src/platform_browser.js.map +0 -1
  486. package/esm/src/platform_browser_static.d.ts +0 -16
  487. package/esm/src/platform_browser_static.js +0 -32
  488. package/esm/src/platform_browser_static.js.map +0 -1
  489. package/esm/src/platform_browser_static.metadata.json +0 -1
  490. package/esm/testing/animation_builder_mock.d.ts +0 -6
  491. package/esm/testing/animation_builder_mock.js +0 -35
  492. package/esm/testing/animation_builder_mock.js.map +0 -1
  493. package/esm/testing/animation_builder_mock.metadata.json +0 -1
  494. package/esm/testing/browser_static.d.ts +0 -10
  495. package/esm/testing/browser_static.js +0 -53
  496. package/esm/testing/browser_static.js.map +0 -1
  497. package/esm/testing/browser_static.metadata.json +0 -1
  498. package/esm/testing/dom_test_component_renderer.d.ts +0 -9
  499. package/esm/testing/dom_test_component_renderer.js +0 -27
  500. package/esm/testing/dom_test_component_renderer.js.map +0 -1
  501. package/esm/testing/dom_test_component_renderer.metadata.json +0 -1
  502. package/platform-browser.umd.js +0 -2488
  503. package/src/animate/animation.d.ts +0 -82
  504. package/src/animate/animation.js +0 -183
  505. package/src/animate/animation.js.map +0 -1
  506. package/src/animate/animation_builder.d.ts +0 -15
  507. package/src/animate/animation_builder.js +0 -27
  508. package/src/animate/animation_builder.js.map +0 -1
  509. package/src/animate/animation_builder.metadata.json +0 -1
  510. package/src/animate/browser_details.d.ts +0 -10
  511. package/src/animate/browser_details.js +0 -66
  512. package/src/animate/browser_details.js.map +0 -1
  513. package/src/animate/browser_details.metadata.json +0 -1
  514. package/src/animate/css_animation_builder.d.ts +0 -66
  515. package/src/animate/css_animation_builder.js +0 -87
  516. package/src/animate/css_animation_builder.js.map +0 -1
  517. package/src/animate/css_animation_options.d.ts +0 -20
  518. package/src/animate/css_animation_options.js +0 -14
  519. package/src/animate/css_animation_options.js.map +0 -1
  520. package/src/browser_common.d.ts +0 -20
  521. package/src/browser_common.js +0 -85
  522. package/src/browser_common.js.map +0 -1
  523. package/src/browser_common.metadata.json +0 -1
  524. package/src/facade/math.d.ts +0 -2
  525. package/src/facade/math.js +0 -5
  526. package/src/facade/math.js.map +0 -1
  527. package/src/facade/math.metadata.json +0 -1
  528. package/src/platform_browser.d.ts +0 -9
  529. package/src/platform_browser.js +0 -39
  530. package/src/platform_browser.js.map +0 -1
  531. package/src/platform_browser_static.d.ts +0 -16
  532. package/src/platform_browser_static.js +0 -42
  533. package/src/platform_browser_static.js.map +0 -1
  534. package/src/platform_browser_static.metadata.json +0 -1
  535. package/testing/animation_builder_mock.d.ts +0 -6
  536. package/testing/animation_builder_mock.js +0 -53
  537. package/testing/animation_builder_mock.js.map +0 -1
  538. package/testing/animation_builder_mock.metadata.json +0 -1
  539. package/testing/browser_static.d.ts +0 -10
  540. package/testing/browser_static.js +0 -55
  541. package/testing/browser_static.js.map +0 -1
  542. package/testing/browser_static.metadata.json +0 -1
  543. package/testing/dom_test_component_renderer.d.ts +0 -9
  544. package/testing/dom_test_component_renderer.js +0 -36
  545. package/testing/dom_test_component_renderer.js.map +0 -1
  546. package/testing/dom_test_component_renderer.metadata.json +0 -1
@@ -1,2488 +0,0 @@
1
- var __extends = (this && this.__extends) || function (d, b) {
2
- for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
3
- function __() { this.constructor = d; }
4
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
5
- };
6
- (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common')) :
8
- typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@angular/common'], factory) :
9
- (factory((global.ng = global.ng || {}, global.ng.platformBrowser = global.ng.platformBrowser || {}), global.ng.core, global.ng.common));
10
- }(this, function (exports, _angular_core, _angular_common) {
11
- 'use strict';
12
- var globalScope;
13
- if (typeof window === 'undefined') {
14
- if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
15
- // TODO: Replace any with WorkerGlobalScope from lib.webworker.d.ts #3492
16
- globalScope = self;
17
- }
18
- else {
19
- globalScope = global;
20
- }
21
- }
22
- else {
23
- globalScope = window;
24
- }
25
- var IS_DART = false;
26
- // Need to declare a new variable for global here since TypeScript
27
- // exports the original value of the symbol.
28
- var global$1 = globalScope;
29
- var Date = global$1.Date;
30
- var _devMode = true;
31
- function assertionsEnabled() {
32
- return _devMode;
33
- }
34
- // TODO: remove calls to assert in production environment
35
- // Note: Can't just export this and import in in other files
36
- // as `assert` is a reserved keyword in Dart
37
- global$1.assert = function assert(condition) {
38
- // TODO: to be fixed properly via #2830, noop for now
39
- };
40
- function isPresent(obj) {
41
- return obj !== undefined && obj !== null;
42
- }
43
- function isBlank(obj) {
44
- return obj === undefined || obj === null;
45
- }
46
- function isString(obj) {
47
- return typeof obj === "string";
48
- }
49
- function isFunction(obj) {
50
- return typeof obj === "function";
51
- }
52
- function isArray(obj) {
53
- return Array.isArray(obj);
54
- }
55
- function stringify(token) {
56
- if (typeof token === 'string') {
57
- return token;
58
- }
59
- if (token === undefined || token === null) {
60
- return '' + token;
61
- }
62
- if (token.name) {
63
- return token.name;
64
- }
65
- if (token.overriddenName) {
66
- return token.overriddenName;
67
- }
68
- var res = token.toString();
69
- var newLineIndex = res.indexOf("\n");
70
- return (newLineIndex === -1) ? res : res.substring(0, newLineIndex);
71
- }
72
- var StringWrapper = (function () {
73
- function StringWrapper() {
74
- }
75
- StringWrapper.fromCharCode = function (code) { return String.fromCharCode(code); };
76
- StringWrapper.charCodeAt = function (s, index) { return s.charCodeAt(index); };
77
- StringWrapper.split = function (s, regExp) { return s.split(regExp); };
78
- StringWrapper.equals = function (s, s2) { return s === s2; };
79
- StringWrapper.stripLeft = function (s, charVal) {
80
- if (s && s.length) {
81
- var pos = 0;
82
- for (var i = 0; i < s.length; i++) {
83
- if (s[i] != charVal)
84
- break;
85
- pos++;
86
- }
87
- s = s.substring(pos);
88
- }
89
- return s;
90
- };
91
- StringWrapper.stripRight = function (s, charVal) {
92
- if (s && s.length) {
93
- var pos = s.length;
94
- for (var i = s.length - 1; i >= 0; i--) {
95
- if (s[i] != charVal)
96
- break;
97
- pos--;
98
- }
99
- s = s.substring(0, pos);
100
- }
101
- return s;
102
- };
103
- StringWrapper.replace = function (s, from, replace) {
104
- return s.replace(from, replace);
105
- };
106
- StringWrapper.replaceAll = function (s, from, replace) {
107
- return s.replace(from, replace);
108
- };
109
- StringWrapper.slice = function (s, from, to) {
110
- if (from === void 0) { from = 0; }
111
- if (to === void 0) { to = null; }
112
- return s.slice(from, to === null ? undefined : to);
113
- };
114
- StringWrapper.replaceAllMapped = function (s, from, cb) {
115
- return s.replace(from, function () {
116
- var matches = [];
117
- for (var _i = 0; _i < arguments.length; _i++) {
118
- matches[_i - 0] = arguments[_i];
119
- }
120
- // Remove offset & string from the result array
121
- matches.splice(-2, 2);
122
- // The callback receives match, p1, ..., pn
123
- return cb(matches);
124
- });
125
- };
126
- StringWrapper.contains = function (s, substr) { return s.indexOf(substr) != -1; };
127
- StringWrapper.compare = function (a, b) {
128
- if (a < b) {
129
- return -1;
130
- }
131
- else if (a > b) {
132
- return 1;
133
- }
134
- else {
135
- return 0;
136
- }
137
- };
138
- return StringWrapper;
139
- }());
140
- var NumberParseError = (function (_super) {
141
- __extends(NumberParseError, _super);
142
- function NumberParseError(message) {
143
- _super.call(this);
144
- this.message = message;
145
- }
146
- NumberParseError.prototype.toString = function () { return this.message; };
147
- return NumberParseError;
148
- }(Error));
149
- var NumberWrapper = (function () {
150
- function NumberWrapper() {
151
- }
152
- NumberWrapper.toFixed = function (n, fractionDigits) { return n.toFixed(fractionDigits); };
153
- NumberWrapper.equal = function (a, b) { return a === b; };
154
- NumberWrapper.parseIntAutoRadix = function (text) {
155
- var result = parseInt(text);
156
- if (isNaN(result)) {
157
- throw new NumberParseError("Invalid integer literal when parsing " + text);
158
- }
159
- return result;
160
- };
161
- NumberWrapper.parseInt = function (text, radix) {
162
- if (radix == 10) {
163
- if (/^(\-|\+)?[0-9]+$/.test(text)) {
164
- return parseInt(text, radix);
165
- }
166
- }
167
- else if (radix == 16) {
168
- if (/^(\-|\+)?[0-9ABCDEFabcdef]+$/.test(text)) {
169
- return parseInt(text, radix);
170
- }
171
- }
172
- else {
173
- var result = parseInt(text, radix);
174
- if (!isNaN(result)) {
175
- return result;
176
- }
177
- }
178
- throw new NumberParseError("Invalid integer literal when parsing " + text + " in base " +
179
- radix);
180
- };
181
- // TODO: NaN is a valid literal but is returned by parseFloat to indicate an error.
182
- NumberWrapper.parseFloat = function (text) { return parseFloat(text); };
183
- Object.defineProperty(NumberWrapper, "NaN", {
184
- get: function () { return NaN; },
185
- enumerable: true,
186
- configurable: true
187
- });
188
- NumberWrapper.isNaN = function (value) { return isNaN(value); };
189
- NumberWrapper.isInteger = function (value) { return Number.isInteger(value); };
190
- return NumberWrapper;
191
- }());
192
- var RegExpWrapper = (function () {
193
- function RegExpWrapper() {
194
- }
195
- RegExpWrapper.create = function (regExpStr, flags) {
196
- if (flags === void 0) { flags = ''; }
197
- flags = flags.replace(/g/g, '');
198
- return new global$1.RegExp(regExpStr, flags + 'g');
199
- };
200
- RegExpWrapper.firstMatch = function (regExp, input) {
201
- // Reset multimatch regex state
202
- regExp.lastIndex = 0;
203
- return regExp.exec(input);
204
- };
205
- RegExpWrapper.test = function (regExp, input) {
206
- regExp.lastIndex = 0;
207
- return regExp.test(input);
208
- };
209
- RegExpWrapper.matcher = function (regExp, input) {
210
- // Reset regex state for the case
211
- // someone did not loop over all matches
212
- // last time.
213
- regExp.lastIndex = 0;
214
- return { re: regExp, input: input };
215
- };
216
- RegExpWrapper.replaceAll = function (regExp, input, replace) {
217
- var c = regExp.exec(input);
218
- var res = '';
219
- regExp.lastIndex = 0;
220
- var prev = 0;
221
- while (c) {
222
- res += input.substring(prev, c.index);
223
- res += replace(c);
224
- prev = c.index + c[0].length;
225
- regExp.lastIndex = prev;
226
- c = regExp.exec(input);
227
- }
228
- res += input.substring(prev);
229
- return res;
230
- };
231
- return RegExpWrapper;
232
- }());
233
- // Can't be all uppercase as our transpiler would think it is a special directive...
234
- var Json = (function () {
235
- function Json() {
236
- }
237
- Json.parse = function (s) { return global$1.JSON.parse(s); };
238
- Json.stringify = function (data) {
239
- // Dart doesn't take 3 arguments
240
- return global$1.JSON.stringify(data, null, 2);
241
- };
242
- return Json;
243
- }());
244
- var DateWrapper = (function () {
245
- function DateWrapper() {
246
- }
247
- DateWrapper.create = function (year, month, day, hour, minutes, seconds, milliseconds) {
248
- if (month === void 0) { month = 1; }
249
- if (day === void 0) { day = 1; }
250
- if (hour === void 0) { hour = 0; }
251
- if (minutes === void 0) { minutes = 0; }
252
- if (seconds === void 0) { seconds = 0; }
253
- if (milliseconds === void 0) { milliseconds = 0; }
254
- return new Date(year, month - 1, day, hour, minutes, seconds, milliseconds);
255
- };
256
- DateWrapper.fromISOString = function (str) { return new Date(str); };
257
- DateWrapper.fromMillis = function (ms) { return new Date(ms); };
258
- DateWrapper.toMillis = function (date) { return date.getTime(); };
259
- DateWrapper.now = function () { return new Date(); };
260
- DateWrapper.toJson = function (date) { return date.toJSON(); };
261
- return DateWrapper;
262
- }());
263
- function setValueOnPath(global, path, value) {
264
- var parts = path.split('.');
265
- var obj = global;
266
- while (parts.length > 1) {
267
- var name = parts.shift();
268
- if (obj.hasOwnProperty(name) && isPresent(obj[name])) {
269
- obj = obj[name];
270
- }
271
- else {
272
- obj = obj[name] = {};
273
- }
274
- }
275
- if (obj === undefined || obj === null) {
276
- obj = {};
277
- }
278
- obj[parts.shift()] = value;
279
- }
280
- var wtfInit = _angular_core.__core_private__.wtfInit;
281
- var DebugDomRootRenderer = _angular_core.__core_private__.DebugDomRootRenderer;
282
- var Map$1 = global$1.Map;
283
- var Set$1 = global$1.Set;
284
- // Safari and Internet Explorer do not support the iterable parameter to the
285
- // Map constructor. We work around that by manually adding the items.
286
- var createMapFromPairs = (function () {
287
- try {
288
- if (new Map$1([[1, 2]]).size === 1) {
289
- return function createMapFromPairs(pairs) { return new Map$1(pairs); };
290
- }
291
- }
292
- catch (e) {
293
- }
294
- return function createMapAndPopulateFromPairs(pairs) {
295
- var map = new Map$1();
296
- for (var i = 0; i < pairs.length; i++) {
297
- var pair = pairs[i];
298
- map.set(pair[0], pair[1]);
299
- }
300
- return map;
301
- };
302
- })();
303
- var createMapFromMap = (function () {
304
- try {
305
- if (new Map$1(new Map$1())) {
306
- return function createMapFromMap(m) { return new Map$1(m); };
307
- }
308
- }
309
- catch (e) {
310
- }
311
- return function createMapAndPopulateFromMap(m) {
312
- var map = new Map$1();
313
- m.forEach(function (v, k) { map.set(k, v); });
314
- return map;
315
- };
316
- })();
317
- var _clearValues = (function () {
318
- if ((new Map$1()).keys().next) {
319
- return function _clearValues(m) {
320
- var keyIterator = m.keys();
321
- var k;
322
- while (!((k = keyIterator.next()).done)) {
323
- m.set(k.value, null);
324
- }
325
- };
326
- }
327
- else {
328
- return function _clearValuesWithForeEach(m) {
329
- m.forEach(function (v, k) { m.set(k, null); });
330
- };
331
- }
332
- })();
333
- // Safari doesn't implement MapIterator.next(), which is used is Traceur's polyfill of Array.from
334
- // TODO(mlaval): remove the work around once we have a working polyfill of Array.from
335
- var _arrayFromMap = (function () {
336
- try {
337
- if ((new Map$1()).values().next) {
338
- return function createArrayFromMap(m, getValues) {
339
- return getValues ? Array.from(m.values()) : Array.from(m.keys());
340
- };
341
- }
342
- }
343
- catch (e) {
344
- }
345
- return function createArrayFromMapWithForeach(m, getValues) {
346
- var res = ListWrapper.createFixedSize(m.size), i = 0;
347
- m.forEach(function (v, k) {
348
- res[i] = getValues ? v : k;
349
- i++;
350
- });
351
- return res;
352
- };
353
- })();
354
- /**
355
- * Wraps Javascript Objects
356
- */
357
- var StringMapWrapper = (function () {
358
- function StringMapWrapper() {
359
- }
360
- StringMapWrapper.create = function () {
361
- // Note: We are not using Object.create(null) here due to
362
- // performance!
363
- // http://jsperf.com/ng2-object-create-null
364
- return {};
365
- };
366
- StringMapWrapper.contains = function (map, key) {
367
- return map.hasOwnProperty(key);
368
- };
369
- StringMapWrapper.get = function (map, key) {
370
- return map.hasOwnProperty(key) ? map[key] : undefined;
371
- };
372
- StringMapWrapper.set = function (map, key, value) { map[key] = value; };
373
- StringMapWrapper.keys = function (map) { return Object.keys(map); };
374
- StringMapWrapper.values = function (map) {
375
- return Object.keys(map).reduce(function (r, a) {
376
- r.push(map[a]);
377
- return r;
378
- }, []);
379
- };
380
- StringMapWrapper.isEmpty = function (map) {
381
- for (var prop in map) {
382
- return false;
383
- }
384
- return true;
385
- };
386
- StringMapWrapper.delete = function (map, key) { delete map[key]; };
387
- StringMapWrapper.forEach = function (map, callback) {
388
- for (var prop in map) {
389
- if (map.hasOwnProperty(prop)) {
390
- callback(map[prop], prop);
391
- }
392
- }
393
- };
394
- StringMapWrapper.merge = function (m1, m2) {
395
- var m = {};
396
- for (var attr in m1) {
397
- if (m1.hasOwnProperty(attr)) {
398
- m[attr] = m1[attr];
399
- }
400
- }
401
- for (var attr in m2) {
402
- if (m2.hasOwnProperty(attr)) {
403
- m[attr] = m2[attr];
404
- }
405
- }
406
- return m;
407
- };
408
- StringMapWrapper.equals = function (m1, m2) {
409
- var k1 = Object.keys(m1);
410
- var k2 = Object.keys(m2);
411
- if (k1.length != k2.length) {
412
- return false;
413
- }
414
- var key;
415
- for (var i = 0; i < k1.length; i++) {
416
- key = k1[i];
417
- if (m1[key] !== m2[key]) {
418
- return false;
419
- }
420
- }
421
- return true;
422
- };
423
- return StringMapWrapper;
424
- }());
425
- var ListWrapper = (function () {
426
- function ListWrapper() {
427
- }
428
- // JS has no way to express a statically fixed size list, but dart does so we
429
- // keep both methods.
430
- ListWrapper.createFixedSize = function (size) { return new Array(size); };
431
- ListWrapper.createGrowableSize = function (size) { return new Array(size); };
432
- ListWrapper.clone = function (array) { return array.slice(0); };
433
- ListWrapper.forEachWithIndex = function (array, fn) {
434
- for (var i = 0; i < array.length; i++) {
435
- fn(array[i], i);
436
- }
437
- };
438
- ListWrapper.first = function (array) {
439
- if (!array)
440
- return null;
441
- return array[0];
442
- };
443
- ListWrapper.last = function (array) {
444
- if (!array || array.length == 0)
445
- return null;
446
- return array[array.length - 1];
447
- };
448
- ListWrapper.indexOf = function (array, value, startIndex) {
449
- if (startIndex === void 0) { startIndex = 0; }
450
- return array.indexOf(value, startIndex);
451
- };
452
- ListWrapper.contains = function (list, el) { return list.indexOf(el) !== -1; };
453
- ListWrapper.reversed = function (array) {
454
- var a = ListWrapper.clone(array);
455
- return a.reverse();
456
- };
457
- ListWrapper.concat = function (a, b) { return a.concat(b); };
458
- ListWrapper.insert = function (list, index, value) { list.splice(index, 0, value); };
459
- ListWrapper.removeAt = function (list, index) {
460
- var res = list[index];
461
- list.splice(index, 1);
462
- return res;
463
- };
464
- ListWrapper.removeAll = function (list, items) {
465
- for (var i = 0; i < items.length; ++i) {
466
- var index = list.indexOf(items[i]);
467
- list.splice(index, 1);
468
- }
469
- };
470
- ListWrapper.remove = function (list, el) {
471
- var index = list.indexOf(el);
472
- if (index > -1) {
473
- list.splice(index, 1);
474
- return true;
475
- }
476
- return false;
477
- };
478
- ListWrapper.clear = function (list) { list.length = 0; };
479
- ListWrapper.isEmpty = function (list) { return list.length == 0; };
480
- ListWrapper.fill = function (list, value, start, end) {
481
- if (start === void 0) { start = 0; }
482
- if (end === void 0) { end = null; }
483
- list.fill(value, start, end === null ? list.length : end);
484
- };
485
- ListWrapper.equals = function (a, b) {
486
- if (a.length != b.length)
487
- return false;
488
- for (var i = 0; i < a.length; ++i) {
489
- if (a[i] !== b[i])
490
- return false;
491
- }
492
- return true;
493
- };
494
- ListWrapper.slice = function (l, from, to) {
495
- if (from === void 0) { from = 0; }
496
- if (to === void 0) { to = null; }
497
- return l.slice(from, to === null ? undefined : to);
498
- };
499
- ListWrapper.splice = function (l, from, length) { return l.splice(from, length); };
500
- ListWrapper.sort = function (l, compareFn) {
501
- if (isPresent(compareFn)) {
502
- l.sort(compareFn);
503
- }
504
- else {
505
- l.sort();
506
- }
507
- };
508
- ListWrapper.toString = function (l) { return l.toString(); };
509
- ListWrapper.toJSON = function (l) { return JSON.stringify(l); };
510
- ListWrapper.maximum = function (list, predicate) {
511
- if (list.length == 0) {
512
- return null;
513
- }
514
- var solution = null;
515
- var maxValue = -Infinity;
516
- for (var index = 0; index < list.length; index++) {
517
- var candidate = list[index];
518
- if (isBlank(candidate)) {
519
- continue;
520
- }
521
- var candidateValue = predicate(candidate);
522
- if (candidateValue > maxValue) {
523
- solution = candidate;
524
- maxValue = candidateValue;
525
- }
526
- }
527
- return solution;
528
- };
529
- ListWrapper.flatten = function (list) {
530
- var target = [];
531
- _flattenArray(list, target);
532
- return target;
533
- };
534
- ListWrapper.addAll = function (list, source) {
535
- for (var i = 0; i < source.length; i++) {
536
- list.push(source[i]);
537
- }
538
- };
539
- return ListWrapper;
540
- }());
541
- function _flattenArray(source, target) {
542
- if (isPresent(source)) {
543
- for (var i = 0; i < source.length; i++) {
544
- var item = source[i];
545
- if (isArray(item)) {
546
- _flattenArray(item, target);
547
- }
548
- else {
549
- target.push(item);
550
- }
551
- }
552
- }
553
- return target;
554
- }
555
- // Safari and Internet Explorer do not support the iterable parameter to the
556
- // Set constructor. We work around that by manually adding the items.
557
- var createSetFromList = (function () {
558
- var test = new Set$1([1, 2, 3]);
559
- if (test.size === 3) {
560
- return function createSetFromList(lst) { return new Set$1(lst); };
561
- }
562
- else {
563
- return function createSetAndPopulateFromList(lst) {
564
- var res = new Set$1(lst);
565
- if (res.size !== lst.length) {
566
- for (var i = 0; i < lst.length; i++) {
567
- res.add(lst[i]);
568
- }
569
- }
570
- return res;
571
- };
572
- }
573
- })();
574
- var SetWrapper = (function () {
575
- function SetWrapper() {
576
- }
577
- SetWrapper.createFromList = function (lst) { return createSetFromList(lst); };
578
- SetWrapper.has = function (s, key) { return s.has(key); };
579
- SetWrapper.delete = function (m, k) { m.delete(k); };
580
- return SetWrapper;
581
- }());
582
- var _DOM = null;
583
- function getDOM() {
584
- return _DOM;
585
- }
586
- function setDOM(adapter) {
587
- _DOM = adapter;
588
- }
589
- function setRootDomAdapter(adapter) {
590
- if (isBlank(_DOM)) {
591
- _DOM = adapter;
592
- }
593
- }
594
- /* tslint:disable:requireParameterType */
595
- /**
596
- * Provides DOM operations in an environment-agnostic way.
597
- */
598
- var DomAdapter = (function () {
599
- function DomAdapter() {
600
- this.xhrType = null;
601
- }
602
- /** @deprecated */
603
- DomAdapter.prototype.getXHR = function () { return this.xhrType; };
604
- Object.defineProperty(DomAdapter.prototype, "attrToPropMap", {
605
- /**
606
- * Maps attribute names to their corresponding property names for cases
607
- * where attribute name doesn't match property name.
608
- */
609
- get: function () { return this._attrToPropMap; },
610
- set: function (value) { this._attrToPropMap = value; },
611
- enumerable: true,
612
- configurable: true
613
- });
614
- ;
615
- ;
616
- return DomAdapter;
617
- }());
618
- /**
619
- * Provides DOM operations in any browser environment.
620
- */
621
- var GenericBrowserDomAdapter = (function (_super) {
622
- __extends(GenericBrowserDomAdapter, _super);
623
- function GenericBrowserDomAdapter() {
624
- var _this = this;
625
- _super.call(this);
626
- this._animationPrefix = null;
627
- this._transitionEnd = null;
628
- try {
629
- var element = this.createElement('div', this.defaultDoc());
630
- if (isPresent(this.getStyle(element, 'animationName'))) {
631
- this._animationPrefix = '';
632
- }
633
- else {
634
- var domPrefixes = ['Webkit', 'Moz', 'O', 'ms'];
635
- for (var i = 0; i < domPrefixes.length; i++) {
636
- if (isPresent(this.getStyle(element, domPrefixes[i] + 'AnimationName'))) {
637
- this._animationPrefix = '-' + domPrefixes[i].toLowerCase() + '-';
638
- break;
639
- }
640
- }
641
- }
642
- var transEndEventNames = {
643
- WebkitTransition: 'webkitTransitionEnd',
644
- MozTransition: 'transitionend',
645
- OTransition: 'oTransitionEnd otransitionend',
646
- transition: 'transitionend'
647
- };
648
- StringMapWrapper.forEach(transEndEventNames, function (value, key) {
649
- if (isPresent(_this.getStyle(element, key))) {
650
- _this._transitionEnd = value;
651
- }
652
- });
653
- }
654
- catch (e) {
655
- this._animationPrefix = null;
656
- this._transitionEnd = null;
657
- }
658
- }
659
- GenericBrowserDomAdapter.prototype.getDistributedNodes = function (el) { return el.getDistributedNodes(); };
660
- GenericBrowserDomAdapter.prototype.resolveAndSetHref = function (el, baseUrl, href) {
661
- el.href = href == null ? baseUrl : baseUrl + '/../' + href;
662
- };
663
- GenericBrowserDomAdapter.prototype.supportsDOMEvents = function () { return true; };
664
- GenericBrowserDomAdapter.prototype.supportsNativeShadowDOM = function () {
665
- return isFunction(this.defaultDoc().body.createShadowRoot);
666
- };
667
- GenericBrowserDomAdapter.prototype.getAnimationPrefix = function () {
668
- return isPresent(this._animationPrefix) ? this._animationPrefix : "";
669
- };
670
- GenericBrowserDomAdapter.prototype.getTransitionEnd = function () { return isPresent(this._transitionEnd) ? this._transitionEnd : ""; };
671
- GenericBrowserDomAdapter.prototype.supportsAnimation = function () {
672
- return isPresent(this._animationPrefix) && isPresent(this._transitionEnd);
673
- };
674
- return GenericBrowserDomAdapter;
675
- }(DomAdapter));
676
- var _attrToPropMap = {
677
- 'class': 'className',
678
- 'innerHtml': 'innerHTML',
679
- 'readonly': 'readOnly',
680
- 'tabindex': 'tabIndex'
681
- };
682
- var DOM_KEY_LOCATION_NUMPAD = 3;
683
- // Map to convert some key or keyIdentifier values to what will be returned by getEventKey
684
- var _keyMap = {
685
- // The following values are here for cross-browser compatibility and to match the W3C standard
686
- // cf http://www.w3.org/TR/DOM-Level-3-Events-key/
687
- '\b': 'Backspace',
688
- '\t': 'Tab',
689
- '\x7F': 'Delete',
690
- '\x1B': 'Escape',
691
- 'Del': 'Delete',
692
- 'Esc': 'Escape',
693
- 'Left': 'ArrowLeft',
694
- 'Right': 'ArrowRight',
695
- 'Up': 'ArrowUp',
696
- 'Down': 'ArrowDown',
697
- 'Menu': 'ContextMenu',
698
- 'Scroll': 'ScrollLock',
699
- 'Win': 'OS'
700
- };
701
- // There is a bug in Chrome for numeric keypad keys:
702
- // https://code.google.com/p/chromium/issues/detail?id=155654
703
- // 1, 2, 3 ... are reported as A, B, C ...
704
- var _chromeNumKeyPadMap = {
705
- 'A': '1',
706
- 'B': '2',
707
- 'C': '3',
708
- 'D': '4',
709
- 'E': '5',
710
- 'F': '6',
711
- 'G': '7',
712
- 'H': '8',
713
- 'I': '9',
714
- 'J': '*',
715
- 'K': '+',
716
- 'M': '-',
717
- 'N': '.',
718
- 'O': '/',
719
- '\x60': '0',
720
- '\x90': 'NumLock'
721
- };
722
- /**
723
- * A `DomAdapter` powered by full browser DOM APIs.
724
- */
725
- /* tslint:disable:requireParameterType */
726
- var BrowserDomAdapter = (function (_super) {
727
- __extends(BrowserDomAdapter, _super);
728
- function BrowserDomAdapter() {
729
- _super.apply(this, arguments);
730
- }
731
- BrowserDomAdapter.prototype.parse = function (templateHtml) { throw new Error("parse not implemented"); };
732
- BrowserDomAdapter.makeCurrent = function () { setRootDomAdapter(new BrowserDomAdapter()); };
733
- BrowserDomAdapter.prototype.hasProperty = function (element, name) { return name in element; };
734
- BrowserDomAdapter.prototype.setProperty = function (el, name, value) { el[name] = value; };
735
- BrowserDomAdapter.prototype.getProperty = function (el, name) { return el[name]; };
736
- BrowserDomAdapter.prototype.invoke = function (el, methodName, args) {
737
- el[methodName].apply(el, args);
738
- };
739
- // TODO(tbosch): move this into a separate environment class once we have it
740
- BrowserDomAdapter.prototype.logError = function (error) {
741
- if (window.console.error) {
742
- window.console.error(error);
743
- }
744
- else {
745
- window.console.log(error);
746
- }
747
- };
748
- BrowserDomAdapter.prototype.log = function (error) { window.console.log(error); };
749
- BrowserDomAdapter.prototype.logGroup = function (error) {
750
- if (window.console.group) {
751
- window.console.group(error);
752
- this.logError(error);
753
- }
754
- else {
755
- window.console.log(error);
756
- }
757
- };
758
- BrowserDomAdapter.prototype.logGroupEnd = function () {
759
- if (window.console.groupEnd) {
760
- window.console.groupEnd();
761
- }
762
- };
763
- Object.defineProperty(BrowserDomAdapter.prototype, "attrToPropMap", {
764
- get: function () { return _attrToPropMap; },
765
- enumerable: true,
766
- configurable: true
767
- });
768
- BrowserDomAdapter.prototype.query = function (selector) { return document.querySelector(selector); };
769
- BrowserDomAdapter.prototype.querySelector = function (el, selector) { return el.querySelector(selector); };
770
- BrowserDomAdapter.prototype.querySelectorAll = function (el, selector) { return el.querySelectorAll(selector); };
771
- BrowserDomAdapter.prototype.on = function (el, evt, listener) { el.addEventListener(evt, listener, false); };
772
- BrowserDomAdapter.prototype.onAndCancel = function (el, evt, listener) {
773
- el.addEventListener(evt, listener, false);
774
- // Needed to follow Dart's subscription semantic, until fix of
775
- // https://code.google.com/p/dart/issues/detail?id=17406
776
- return function () { el.removeEventListener(evt, listener, false); };
777
- };
778
- BrowserDomAdapter.prototype.dispatchEvent = function (el, evt) { el.dispatchEvent(evt); };
779
- BrowserDomAdapter.prototype.createMouseEvent = function (eventType) {
780
- var evt = document.createEvent('MouseEvent');
781
- evt.initEvent(eventType, true, true);
782
- return evt;
783
- };
784
- BrowserDomAdapter.prototype.createEvent = function (eventType) {
785
- var evt = document.createEvent('Event');
786
- evt.initEvent(eventType, true, true);
787
- return evt;
788
- };
789
- BrowserDomAdapter.prototype.preventDefault = function (evt) {
790
- evt.preventDefault();
791
- evt.returnValue = false;
792
- };
793
- BrowserDomAdapter.prototype.isPrevented = function (evt) {
794
- return evt.defaultPrevented || isPresent(evt.returnValue) && !evt.returnValue;
795
- };
796
- BrowserDomAdapter.prototype.getInnerHTML = function (el) { return el.innerHTML; };
797
- BrowserDomAdapter.prototype.getOuterHTML = function (el) { return el.outerHTML; };
798
- BrowserDomAdapter.prototype.nodeName = function (node) { return node.nodeName; };
799
- BrowserDomAdapter.prototype.nodeValue = function (node) { return node.nodeValue; };
800
- BrowserDomAdapter.prototype.type = function (node) { return node.type; };
801
- BrowserDomAdapter.prototype.content = function (node) {
802
- if (this.hasProperty(node, "content")) {
803
- return node.content;
804
- }
805
- else {
806
- return node;
807
- }
808
- };
809
- BrowserDomAdapter.prototype.firstChild = function (el) { return el.firstChild; };
810
- BrowserDomAdapter.prototype.nextSibling = function (el) { return el.nextSibling; };
811
- BrowserDomAdapter.prototype.parentElement = function (el) { return el.parentNode; };
812
- BrowserDomAdapter.prototype.childNodes = function (el) { return el.childNodes; };
813
- BrowserDomAdapter.prototype.childNodesAsList = function (el) {
814
- var childNodes = el.childNodes;
815
- var res = ListWrapper.createFixedSize(childNodes.length);
816
- for (var i = 0; i < childNodes.length; i++) {
817
- res[i] = childNodes[i];
818
- }
819
- return res;
820
- };
821
- BrowserDomAdapter.prototype.clearNodes = function (el) {
822
- while (el.firstChild) {
823
- el.removeChild(el.firstChild);
824
- }
825
- };
826
- BrowserDomAdapter.prototype.appendChild = function (el, node) { el.appendChild(node); };
827
- BrowserDomAdapter.prototype.removeChild = function (el, node) { el.removeChild(node); };
828
- BrowserDomAdapter.prototype.replaceChild = function (el, newChild, oldChild) { el.replaceChild(newChild, oldChild); };
829
- BrowserDomAdapter.prototype.remove = function (node) {
830
- if (node.parentNode) {
831
- node.parentNode.removeChild(node);
832
- }
833
- return node;
834
- };
835
- BrowserDomAdapter.prototype.insertBefore = function (el, node) { el.parentNode.insertBefore(node, el); };
836
- BrowserDomAdapter.prototype.insertAllBefore = function (el, nodes) { nodes.forEach(function (n) { return el.parentNode.insertBefore(n, el); }); };
837
- BrowserDomAdapter.prototype.insertAfter = function (el, node) { el.parentNode.insertBefore(node, el.nextSibling); };
838
- BrowserDomAdapter.prototype.setInnerHTML = function (el, value) { el.innerHTML = value; };
839
- BrowserDomAdapter.prototype.getText = function (el) { return el.textContent; };
840
- // TODO(vicb): removed Element type because it does not support StyleElement
841
- BrowserDomAdapter.prototype.setText = function (el, value) { el.textContent = value; };
842
- BrowserDomAdapter.prototype.getValue = function (el) { return el.value; };
843
- BrowserDomAdapter.prototype.setValue = function (el, value) { el.value = value; };
844
- BrowserDomAdapter.prototype.getChecked = function (el) { return el.checked; };
845
- BrowserDomAdapter.prototype.setChecked = function (el, value) { el.checked = value; };
846
- BrowserDomAdapter.prototype.createComment = function (text) { return document.createComment(text); };
847
- BrowserDomAdapter.prototype.createTemplate = function (html) {
848
- var t = document.createElement('template');
849
- t.innerHTML = html;
850
- return t;
851
- };
852
- BrowserDomAdapter.prototype.createElement = function (tagName, doc) {
853
- if (doc === void 0) { doc = document; }
854
- return doc.createElement(tagName);
855
- };
856
- BrowserDomAdapter.prototype.createElementNS = function (ns, tagName, doc) {
857
- if (doc === void 0) { doc = document; }
858
- return doc.createElementNS(ns, tagName);
859
- };
860
- BrowserDomAdapter.prototype.createTextNode = function (text, doc) {
861
- if (doc === void 0) { doc = document; }
862
- return doc.createTextNode(text);
863
- };
864
- BrowserDomAdapter.prototype.createScriptTag = function (attrName, attrValue, doc) {
865
- if (doc === void 0) { doc = document; }
866
- var el = doc.createElement('SCRIPT');
867
- el.setAttribute(attrName, attrValue);
868
- return el;
869
- };
870
- BrowserDomAdapter.prototype.createStyleElement = function (css, doc) {
871
- if (doc === void 0) { doc = document; }
872
- var style = doc.createElement('style');
873
- this.appendChild(style, this.createTextNode(css));
874
- return style;
875
- };
876
- BrowserDomAdapter.prototype.createShadowRoot = function (el) { return el.createShadowRoot(); };
877
- BrowserDomAdapter.prototype.getShadowRoot = function (el) { return el.shadowRoot; };
878
- BrowserDomAdapter.prototype.getHost = function (el) { return el.host; };
879
- BrowserDomAdapter.prototype.clone = function (node) { return node.cloneNode(true); };
880
- BrowserDomAdapter.prototype.getElementsByClassName = function (element, name) {
881
- return element.getElementsByClassName(name);
882
- };
883
- BrowserDomAdapter.prototype.getElementsByTagName = function (element, name) {
884
- return element.getElementsByTagName(name);
885
- };
886
- BrowserDomAdapter.prototype.classList = function (element) { return Array.prototype.slice.call(element.classList, 0); };
887
- BrowserDomAdapter.prototype.addClass = function (element, className) { element.classList.add(className); };
888
- BrowserDomAdapter.prototype.removeClass = function (element, className) { element.classList.remove(className); };
889
- BrowserDomAdapter.prototype.hasClass = function (element, className) { return element.classList.contains(className); };
890
- BrowserDomAdapter.prototype.setStyle = function (element, styleName, styleValue) {
891
- element.style[styleName] = styleValue;
892
- };
893
- BrowserDomAdapter.prototype.removeStyle = function (element, stylename) { element.style[stylename] = null; };
894
- BrowserDomAdapter.prototype.getStyle = function (element, stylename) { return element.style[stylename]; };
895
- BrowserDomAdapter.prototype.hasStyle = function (element, styleName, styleValue) {
896
- if (styleValue === void 0) { styleValue = null; }
897
- var value = this.getStyle(element, styleName) || '';
898
- return styleValue ? value == styleValue : value.length > 0;
899
- };
900
- BrowserDomAdapter.prototype.tagName = function (element) { return element.tagName; };
901
- BrowserDomAdapter.prototype.attributeMap = function (element) {
902
- var res = new Map();
903
- var elAttrs = element.attributes;
904
- for (var i = 0; i < elAttrs.length; i++) {
905
- var attrib = elAttrs[i];
906
- res.set(attrib.name, attrib.value);
907
- }
908
- return res;
909
- };
910
- BrowserDomAdapter.prototype.hasAttribute = function (element, attribute) { return element.hasAttribute(attribute); };
911
- BrowserDomAdapter.prototype.hasAttributeNS = function (element, ns, attribute) {
912
- return element.hasAttributeNS(ns, attribute);
913
- };
914
- BrowserDomAdapter.prototype.getAttribute = function (element, attribute) { return element.getAttribute(attribute); };
915
- BrowserDomAdapter.prototype.getAttributeNS = function (element, ns, name) {
916
- return element.getAttributeNS(ns, name);
917
- };
918
- BrowserDomAdapter.prototype.setAttribute = function (element, name, value) { element.setAttribute(name, value); };
919
- BrowserDomAdapter.prototype.setAttributeNS = function (element, ns, name, value) {
920
- element.setAttributeNS(ns, name, value);
921
- };
922
- BrowserDomAdapter.prototype.removeAttribute = function (element, attribute) { element.removeAttribute(attribute); };
923
- BrowserDomAdapter.prototype.removeAttributeNS = function (element, ns, name) { element.removeAttributeNS(ns, name); };
924
- BrowserDomAdapter.prototype.templateAwareRoot = function (el) { return this.isTemplateElement(el) ? this.content(el) : el; };
925
- BrowserDomAdapter.prototype.createHtmlDocument = function () {
926
- return document.implementation.createHTMLDocument('fakeTitle');
927
- };
928
- BrowserDomAdapter.prototype.defaultDoc = function () { return document; };
929
- BrowserDomAdapter.prototype.getBoundingClientRect = function (el) {
930
- try {
931
- return el.getBoundingClientRect();
932
- }
933
- catch (e) {
934
- return { top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0 };
935
- }
936
- };
937
- BrowserDomAdapter.prototype.getTitle = function () { return document.title; };
938
- BrowserDomAdapter.prototype.setTitle = function (newTitle) { document.title = newTitle || ''; };
939
- BrowserDomAdapter.prototype.elementMatches = function (n, selector) {
940
- var matches = false;
941
- if (n instanceof HTMLElement) {
942
- if (n.matches) {
943
- matches = n.matches(selector);
944
- }
945
- else if (n.msMatchesSelector) {
946
- matches = n.msMatchesSelector(selector);
947
- }
948
- else if (n.webkitMatchesSelector) {
949
- matches = n.webkitMatchesSelector(selector);
950
- }
951
- }
952
- return matches;
953
- };
954
- BrowserDomAdapter.prototype.isTemplateElement = function (el) {
955
- return el instanceof HTMLElement && el.nodeName == "TEMPLATE";
956
- };
957
- BrowserDomAdapter.prototype.isTextNode = function (node) { return node.nodeType === Node.TEXT_NODE; };
958
- BrowserDomAdapter.prototype.isCommentNode = function (node) { return node.nodeType === Node.COMMENT_NODE; };
959
- BrowserDomAdapter.prototype.isElementNode = function (node) { return node.nodeType === Node.ELEMENT_NODE; };
960
- BrowserDomAdapter.prototype.hasShadowRoot = function (node) { return node instanceof HTMLElement && isPresent(node.shadowRoot); };
961
- BrowserDomAdapter.prototype.isShadowRoot = function (node) { return node instanceof DocumentFragment; };
962
- BrowserDomAdapter.prototype.importIntoDoc = function (node) {
963
- var toImport = node;
964
- if (this.isTemplateElement(node)) {
965
- toImport = this.content(node);
966
- }
967
- return document.importNode(toImport, true);
968
- };
969
- BrowserDomAdapter.prototype.adoptNode = function (node) { return document.adoptNode(node); };
970
- BrowserDomAdapter.prototype.getHref = function (el) { return el.href; };
971
- BrowserDomAdapter.prototype.getEventKey = function (event) {
972
- var key = event.key;
973
- if (isBlank(key)) {
974
- key = event.keyIdentifier;
975
- // keyIdentifier is defined in the old draft of DOM Level 3 Events implemented by Chrome and
976
- // Safari
977
- // cf
978
- // http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221/events.html#Events-KeyboardEvents-Interfaces
979
- if (isBlank(key)) {
980
- return 'Unidentified';
981
- }
982
- if (key.startsWith('U+')) {
983
- key = String.fromCharCode(parseInt(key.substring(2), 16));
984
- if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) {
985
- // There is a bug in Chrome for numeric keypad keys:
986
- // https://code.google.com/p/chromium/issues/detail?id=155654
987
- // 1, 2, 3 ... are reported as A, B, C ...
988
- key = _chromeNumKeyPadMap[key];
989
- }
990
- }
991
- }
992
- if (_keyMap.hasOwnProperty(key)) {
993
- key = _keyMap[key];
994
- }
995
- return key;
996
- };
997
- BrowserDomAdapter.prototype.getGlobalEventTarget = function (target) {
998
- if (target == "window") {
999
- return window;
1000
- }
1001
- else if (target == "document") {
1002
- return document;
1003
- }
1004
- else if (target == "body") {
1005
- return document.body;
1006
- }
1007
- };
1008
- BrowserDomAdapter.prototype.getHistory = function () { return window.history; };
1009
- BrowserDomAdapter.prototype.getLocation = function () { return window.location; };
1010
- BrowserDomAdapter.prototype.getBaseHref = function () {
1011
- var href = getBaseElementHref();
1012
- if (isBlank(href)) {
1013
- return null;
1014
- }
1015
- return relativePath(href);
1016
- };
1017
- BrowserDomAdapter.prototype.resetBaseElement = function () { baseElement = null; };
1018
- BrowserDomAdapter.prototype.getUserAgent = function () { return window.navigator.userAgent; };
1019
- BrowserDomAdapter.prototype.setData = function (element, name, value) {
1020
- this.setAttribute(element, 'data-' + name, value);
1021
- };
1022
- BrowserDomAdapter.prototype.getData = function (element, name) { return this.getAttribute(element, 'data-' + name); };
1023
- BrowserDomAdapter.prototype.getComputedStyle = function (element) { return getComputedStyle(element); };
1024
- // TODO(tbosch): move this into a separate environment class once we have it
1025
- BrowserDomAdapter.prototype.setGlobalVar = function (path, value) { setValueOnPath(global$1, path, value); };
1026
- BrowserDomAdapter.prototype.requestAnimationFrame = function (callback) { return window.requestAnimationFrame(callback); };
1027
- BrowserDomAdapter.prototype.cancelAnimationFrame = function (id) { window.cancelAnimationFrame(id); };
1028
- BrowserDomAdapter.prototype.performanceNow = function () {
1029
- // performance.now() is not available in all browsers, see
1030
- // http://caniuse.com/#search=performance.now
1031
- if (isPresent(window.performance) && isPresent(window.performance.now)) {
1032
- return window.performance.now();
1033
- }
1034
- else {
1035
- return DateWrapper.toMillis(DateWrapper.now());
1036
- }
1037
- };
1038
- return BrowserDomAdapter;
1039
- }(GenericBrowserDomAdapter));
1040
- var baseElement = null;
1041
- function getBaseElementHref() {
1042
- if (isBlank(baseElement)) {
1043
- baseElement = document.querySelector('base');
1044
- if (isBlank(baseElement)) {
1045
- return null;
1046
- }
1047
- }
1048
- return baseElement.getAttribute('href');
1049
- }
1050
- // based on urlUtils.js in AngularJS 1
1051
- var urlParsingNode = null;
1052
- function relativePath(url) {
1053
- if (isBlank(urlParsingNode)) {
1054
- urlParsingNode = document.createElement("a");
1055
- }
1056
- urlParsingNode.setAttribute('href', url);
1057
- return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname :
1058
- '/' + urlParsingNode.pathname;
1059
- }
1060
- var PublicTestability = (function () {
1061
- function PublicTestability(testability) {
1062
- this._testability = testability;
1063
- }
1064
- PublicTestability.prototype.isStable = function () { return this._testability.isStable(); };
1065
- PublicTestability.prototype.whenStable = function (callback) { this._testability.whenStable(callback); };
1066
- PublicTestability.prototype.findBindings = function (using, provider, exactMatch) {
1067
- return this.findProviders(using, provider, exactMatch);
1068
- };
1069
- PublicTestability.prototype.findProviders = function (using, provider, exactMatch) {
1070
- return this._testability.findBindings(using, provider, exactMatch);
1071
- };
1072
- return PublicTestability;
1073
- }());
1074
- var BrowserGetTestability = (function () {
1075
- function BrowserGetTestability() {
1076
- }
1077
- BrowserGetTestability.init = function () { _angular_core.setTestabilityGetter(new BrowserGetTestability()); };
1078
- BrowserGetTestability.prototype.addToWindow = function (registry) {
1079
- global$1.getAngularTestability = function (elem, findInAncestors) {
1080
- if (findInAncestors === void 0) { findInAncestors = true; }
1081
- var testability = registry.findTestabilityInTree(elem, findInAncestors);
1082
- if (testability == null) {
1083
- throw new Error('Could not find testability for element.');
1084
- }
1085
- return new PublicTestability(testability);
1086
- };
1087
- global$1.getAllAngularTestabilities = function () {
1088
- var testabilities = registry.getAllTestabilities();
1089
- return testabilities.map(function (testability) { return new PublicTestability(testability); });
1090
- };
1091
- global$1.getAllAngularRootElements = function () { return registry.getAllRootElements(); };
1092
- var whenAllStable = function (callback) {
1093
- var testabilities = global$1.getAllAngularTestabilities();
1094
- var count = testabilities.length;
1095
- var didWork = false;
1096
- var decrement = function (didWork_) {
1097
- didWork = didWork || didWork_;
1098
- count--;
1099
- if (count == 0) {
1100
- callback(didWork);
1101
- }
1102
- };
1103
- testabilities.forEach(function (testability) { testability.whenStable(decrement); });
1104
- };
1105
- if (!global$1.frameworkStabilizers) {
1106
- global$1.frameworkStabilizers = ListWrapper.createGrowableSize(0);
1107
- }
1108
- global$1.frameworkStabilizers.push(whenAllStable);
1109
- };
1110
- BrowserGetTestability.prototype.findTestabilityInTree = function (registry, elem, findInAncestors) {
1111
- if (elem == null) {
1112
- return null;
1113
- }
1114
- var t = registry.getTestability(elem);
1115
- if (isPresent(t)) {
1116
- return t;
1117
- }
1118
- else if (!findInAncestors) {
1119
- return null;
1120
- }
1121
- if (getDOM().isShadowRoot(elem)) {
1122
- return this.findTestabilityInTree(registry, getDOM().getHost(elem), true);
1123
- }
1124
- return this.findTestabilityInTree(registry, getDOM().parentElement(elem), true);
1125
- };
1126
- return BrowserGetTestability;
1127
- }());
1128
- /**
1129
- * A DI Token representing the main rendering context. In a browser this is the DOM Document.
1130
- *
1131
- * Note: Document might not be available in the Application Context when Application and Rendering
1132
- * Contexts are not the same (e.g. when running the application into a Web Worker).
1133
- */
1134
- var DOCUMENT = new _angular_core.OpaqueToken('DocumentToken');
1135
- var BaseException = (function (_super) {
1136
- __extends(BaseException, _super);
1137
- function BaseException(message) {
1138
- if (message === void 0) { message = "--"; }
1139
- _super.call(this, message);
1140
- this.message = message;
1141
- this.stack = (new Error(message)).stack;
1142
- }
1143
- BaseException.prototype.toString = function () { return this.message; };
1144
- return BaseException;
1145
- }(Error));
1146
- var EVENT_MANAGER_PLUGINS =
1147
- /*@ts2dart_const*/ new _angular_core.OpaqueToken("EventManagerPlugins");
1148
- var EventManager = (function () {
1149
- function EventManager(plugins, _zone) {
1150
- var _this = this;
1151
- this._zone = _zone;
1152
- plugins.forEach(function (p) { return p.manager = _this; });
1153
- this._plugins = ListWrapper.reversed(plugins);
1154
- }
1155
- EventManager.prototype.addEventListener = function (element, eventName, handler) {
1156
- var plugin = this._findPluginFor(eventName);
1157
- return plugin.addEventListener(element, eventName, handler);
1158
- };
1159
- EventManager.prototype.addGlobalEventListener = function (target, eventName, handler) {
1160
- var plugin = this._findPluginFor(eventName);
1161
- return plugin.addGlobalEventListener(target, eventName, handler);
1162
- };
1163
- EventManager.prototype.getZone = function () { return this._zone; };
1164
- /** @internal */
1165
- EventManager.prototype._findPluginFor = function (eventName) {
1166
- var plugins = this._plugins;
1167
- for (var i = 0; i < plugins.length; i++) {
1168
- var plugin = plugins[i];
1169
- if (plugin.supports(eventName)) {
1170
- return plugin;
1171
- }
1172
- }
1173
- throw new BaseException("No event manager plugin found for event " + eventName);
1174
- };
1175
- return EventManager;
1176
- }());
1177
- EventManager.decorators = [
1178
- { type: _angular_core.Injectable },
1179
- ];
1180
- EventManager.ctorParameters = [
1181
- { type: undefined, decorators: [{ type: _angular_core.Inject, args: [EVENT_MANAGER_PLUGINS,] },] },
1182
- { type: _angular_core.NgZone, },
1183
- ];
1184
- var EventManagerPlugin = (function () {
1185
- function EventManagerPlugin() {
1186
- }
1187
- // That is equivalent to having supporting $event.target
1188
- EventManagerPlugin.prototype.supports = function (eventName) { return false; };
1189
- EventManagerPlugin.prototype.addEventListener = function (element, eventName, handler) {
1190
- throw "not implemented";
1191
- };
1192
- EventManagerPlugin.prototype.addGlobalEventListener = function (element, eventName, handler) {
1193
- throw "not implemented";
1194
- };
1195
- return EventManagerPlugin;
1196
- }());
1197
- var CssAnimationOptions = (function () {
1198
- function CssAnimationOptions() {
1199
- /** classes to be added to the element */
1200
- this.classesToAdd = [];
1201
- /** classes to be removed from the element */
1202
- this.classesToRemove = [];
1203
- /** classes to be added for the duration of the animation */
1204
- this.animationClasses = [];
1205
- }
1206
- return CssAnimationOptions;
1207
- }());
1208
- var Math$1 = global$1.Math;
1209
- var CAMEL_CASE_REGEXP = /([A-Z])/g;
1210
- function camelCaseToDashCase(input) {
1211
- return StringWrapper.replaceAllMapped(input, CAMEL_CASE_REGEXP, function (m) { return '-' + m[1].toLowerCase(); });
1212
- }
1213
- var Animation = (function () {
1214
- /**
1215
- * Stores the start time and starts the animation
1216
- * @param element
1217
- * @param data
1218
- * @param browserDetails
1219
- */
1220
- function Animation(element, data, browserDetails) {
1221
- var _this = this;
1222
- this.element = element;
1223
- this.data = data;
1224
- this.browserDetails = browserDetails;
1225
- /** functions to be called upon completion */
1226
- this.callbacks = [];
1227
- /** functions for removing event listeners */
1228
- this.eventClearFunctions = [];
1229
- /** flag used to track whether or not the animation has finished */
1230
- this.completed = false;
1231
- this._stringPrefix = '';
1232
- this.startTime = DateWrapper.toMillis(DateWrapper.now());
1233
- this._stringPrefix = getDOM().getAnimationPrefix();
1234
- this.setup();
1235
- this.wait(function (timestamp) { return _this.start(); });
1236
- }
1237
- Object.defineProperty(Animation.prototype, "totalTime", {
1238
- /** total amount of time that the animation should take including delay */
1239
- get: function () {
1240
- var delay = this.computedDelay != null ? this.computedDelay : 0;
1241
- var duration = this.computedDuration != null ? this.computedDuration : 0;
1242
- return delay + duration;
1243
- },
1244
- enumerable: true,
1245
- configurable: true
1246
- });
1247
- Animation.prototype.wait = function (callback) {
1248
- // Firefox requires 2 frames for some reason
1249
- this.browserDetails.raf(callback, 2);
1250
- };
1251
- /**
1252
- * Sets up the initial styles before the animation is started
1253
- */
1254
- Animation.prototype.setup = function () {
1255
- if (this.data.fromStyles != null)
1256
- this.applyStyles(this.data.fromStyles);
1257
- if (this.data.duration != null)
1258
- this.applyStyles({ 'transitionDuration': this.data.duration.toString() + 'ms' });
1259
- if (this.data.delay != null)
1260
- this.applyStyles({ 'transitionDelay': this.data.delay.toString() + 'ms' });
1261
- };
1262
- /**
1263
- * After the initial setup has occurred, this method adds the animation styles
1264
- */
1265
- Animation.prototype.start = function () {
1266
- this.addClasses(this.data.classesToAdd);
1267
- this.addClasses(this.data.animationClasses);
1268
- this.removeClasses(this.data.classesToRemove);
1269
- if (this.data.toStyles != null)
1270
- this.applyStyles(this.data.toStyles);
1271
- var computedStyles = getDOM().getComputedStyle(this.element);
1272
- this.computedDelay =
1273
- Math$1.max(this.parseDurationString(computedStyles.getPropertyValue(this._stringPrefix + 'transition-delay')), this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix + 'transition-delay')));
1274
- this.computedDuration = Math$1.max(this.parseDurationString(computedStyles.getPropertyValue(this._stringPrefix + 'transition-duration')), this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix + 'transition-duration')));
1275
- this.addEvents();
1276
- };
1277
- /**
1278
- * Applies the provided styles to the element
1279
- * @param styles
1280
- */
1281
- Animation.prototype.applyStyles = function (styles) {
1282
- var _this = this;
1283
- StringMapWrapper.forEach(styles, function (value, key) {
1284
- var dashCaseKey = camelCaseToDashCase(key);
1285
- if (isPresent(getDOM().getStyle(_this.element, dashCaseKey))) {
1286
- getDOM().setStyle(_this.element, dashCaseKey, value.toString());
1287
- }
1288
- else {
1289
- getDOM().setStyle(_this.element, _this._stringPrefix + dashCaseKey, value.toString());
1290
- }
1291
- });
1292
- };
1293
- /**
1294
- * Adds the provided classes to the element
1295
- * @param classes
1296
- */
1297
- Animation.prototype.addClasses = function (classes) {
1298
- for (var i = 0, len = classes.length; i < len; i++)
1299
- getDOM().addClass(this.element, classes[i]);
1300
- };
1301
- /**
1302
- * Removes the provided classes from the element
1303
- * @param classes
1304
- */
1305
- Animation.prototype.removeClasses = function (classes) {
1306
- for (var i = 0, len = classes.length; i < len; i++)
1307
- getDOM().removeClass(this.element, classes[i]);
1308
- };
1309
- /**
1310
- * Adds events to track when animations have finished
1311
- */
1312
- Animation.prototype.addEvents = function () {
1313
- var _this = this;
1314
- if (this.totalTime > 0) {
1315
- this.eventClearFunctions.push(getDOM().onAndCancel(this.element, getDOM().getTransitionEnd(), function (event) { return _this.handleAnimationEvent(event); }));
1316
- }
1317
- else {
1318
- this.handleAnimationCompleted();
1319
- }
1320
- };
1321
- Animation.prototype.handleAnimationEvent = function (event) {
1322
- var elapsedTime = Math$1.round(event.elapsedTime * 1000);
1323
- if (!this.browserDetails.elapsedTimeIncludesDelay)
1324
- elapsedTime += this.computedDelay;
1325
- event.stopPropagation();
1326
- if (elapsedTime >= this.totalTime)
1327
- this.handleAnimationCompleted();
1328
- };
1329
- /**
1330
- * Runs all animation callbacks and removes temporary classes
1331
- */
1332
- Animation.prototype.handleAnimationCompleted = function () {
1333
- this.removeClasses(this.data.animationClasses);
1334
- this.callbacks.forEach(function (callback) { return callback(); });
1335
- this.callbacks = [];
1336
- this.eventClearFunctions.forEach(function (fn) { return fn(); });
1337
- this.eventClearFunctions = [];
1338
- this.completed = true;
1339
- };
1340
- /**
1341
- * Adds animation callbacks to be called upon completion
1342
- * @param callback
1343
- * @returns {Animation}
1344
- */
1345
- Animation.prototype.onComplete = function (callback) {
1346
- if (this.completed) {
1347
- callback();
1348
- }
1349
- else {
1350
- this.callbacks.push(callback);
1351
- }
1352
- return this;
1353
- };
1354
- /**
1355
- * Converts the duration string to the number of milliseconds
1356
- * @param duration
1357
- * @returns {number}
1358
- */
1359
- Animation.prototype.parseDurationString = function (duration) {
1360
- var maxValue = 0;
1361
- // duration must have at least 2 characters to be valid. (number + type)
1362
- if (duration == null || duration.length < 2) {
1363
- return maxValue;
1364
- }
1365
- else if (duration.substring(duration.length - 2) == 'ms') {
1366
- var value = NumberWrapper.parseInt(this.stripLetters(duration), 10);
1367
- if (value > maxValue)
1368
- maxValue = value;
1369
- }
1370
- else if (duration.substring(duration.length - 1) == 's') {
1371
- var ms = NumberWrapper.parseFloat(this.stripLetters(duration)) * 1000;
1372
- var value = Math$1.floor(ms);
1373
- if (value > maxValue)
1374
- maxValue = value;
1375
- }
1376
- return maxValue;
1377
- };
1378
- /**
1379
- * Strips the letters from the duration string
1380
- * @param str
1381
- * @returns {string}
1382
- */
1383
- Animation.prototype.stripLetters = function (str) {
1384
- return StringWrapper.replaceAll(str, RegExpWrapper.create('[^0-9]+$', ''), '');
1385
- };
1386
- return Animation;
1387
- }());
1388
- var CssAnimationBuilder = (function () {
1389
- /**
1390
- * Accepts public properties for CssAnimationBuilder
1391
- */
1392
- function CssAnimationBuilder(browserDetails) {
1393
- this.browserDetails = browserDetails;
1394
- /** @type {CssAnimationOptions} */
1395
- this.data = new CssAnimationOptions();
1396
- }
1397
- /**
1398
- * Adds a temporary class that will be removed at the end of the animation
1399
- * @param className
1400
- */
1401
- CssAnimationBuilder.prototype.addAnimationClass = function (className) {
1402
- this.data.animationClasses.push(className);
1403
- return this;
1404
- };
1405
- /**
1406
- * Adds a class that will remain on the element after the animation has finished
1407
- * @param className
1408
- */
1409
- CssAnimationBuilder.prototype.addClass = function (className) {
1410
- this.data.classesToAdd.push(className);
1411
- return this;
1412
- };
1413
- /**
1414
- * Removes a class from the element
1415
- * @param className
1416
- */
1417
- CssAnimationBuilder.prototype.removeClass = function (className) {
1418
- this.data.classesToRemove.push(className);
1419
- return this;
1420
- };
1421
- /**
1422
- * Sets the animation duration (and overrides any defined through CSS)
1423
- * @param duration
1424
- */
1425
- CssAnimationBuilder.prototype.setDuration = function (duration) {
1426
- this.data.duration = duration;
1427
- return this;
1428
- };
1429
- /**
1430
- * Sets the animation delay (and overrides any defined through CSS)
1431
- * @param delay
1432
- */
1433
- CssAnimationBuilder.prototype.setDelay = function (delay) {
1434
- this.data.delay = delay;
1435
- return this;
1436
- };
1437
- /**
1438
- * Sets styles for both the initial state and the destination state
1439
- * @param from
1440
- * @param to
1441
- */
1442
- CssAnimationBuilder.prototype.setStyles = function (from, to) {
1443
- return this.setFromStyles(from).setToStyles(to);
1444
- };
1445
- /**
1446
- * Sets the initial styles for the animation
1447
- * @param from
1448
- */
1449
- CssAnimationBuilder.prototype.setFromStyles = function (from) {
1450
- this.data.fromStyles = from;
1451
- return this;
1452
- };
1453
- /**
1454
- * Sets the destination styles for the animation
1455
- * @param to
1456
- */
1457
- CssAnimationBuilder.prototype.setToStyles = function (to) {
1458
- this.data.toStyles = to;
1459
- return this;
1460
- };
1461
- /**
1462
- * Starts the animation and returns a promise
1463
- * @param element
1464
- */
1465
- CssAnimationBuilder.prototype.start = function (element) {
1466
- return new Animation(element, this.data, this.browserDetails);
1467
- };
1468
- return CssAnimationBuilder;
1469
- }());
1470
- var BrowserDetails = (function () {
1471
- function BrowserDetails() {
1472
- this.elapsedTimeIncludesDelay = false;
1473
- this.doesElapsedTimeIncludesDelay();
1474
- }
1475
- /**
1476
- * Determines if `event.elapsedTime` includes transition delay in the current browser. At this
1477
- * time, Chrome and Opera seem to be the only browsers that include this.
1478
- */
1479
- BrowserDetails.prototype.doesElapsedTimeIncludesDelay = function () {
1480
- var _this = this;
1481
- var div = getDOM().createElement('div');
1482
- getDOM().setAttribute(div, 'style', "position: absolute; top: -9999px; left: -9999px; width: 1px;\n height: 1px; transition: all 1ms linear 1ms;");
1483
- // Firefox requires that we wait for 2 frames for some reason
1484
- this.raf(function (timestamp) {
1485
- getDOM().on(div, 'transitionend', function (event) {
1486
- var elapsed = Math$1.round(event.elapsedTime * 1000);
1487
- _this.elapsedTimeIncludesDelay = elapsed == 2;
1488
- getDOM().remove(div);
1489
- });
1490
- getDOM().setStyle(div, 'width', '2px');
1491
- }, 2);
1492
- };
1493
- BrowserDetails.prototype.raf = function (callback, frames) {
1494
- if (frames === void 0) { frames = 1; }
1495
- var queue = new RafQueue(callback, frames);
1496
- return function () { return queue.cancel(); };
1497
- };
1498
- return BrowserDetails;
1499
- }());
1500
- BrowserDetails.decorators = [
1501
- { type: _angular_core.Injectable },
1502
- ];
1503
- BrowserDetails.ctorParameters = [];
1504
- var RafQueue = (function () {
1505
- function RafQueue(callback, frames) {
1506
- this.callback = callback;
1507
- this.frames = frames;
1508
- this._raf();
1509
- }
1510
- RafQueue.prototype._raf = function () {
1511
- var _this = this;
1512
- this.currentFrameId =
1513
- getDOM().requestAnimationFrame(function (timestamp) { return _this._nextFrame(timestamp); });
1514
- };
1515
- RafQueue.prototype._nextFrame = function (timestamp) {
1516
- this.frames--;
1517
- if (this.frames > 0) {
1518
- this._raf();
1519
- }
1520
- else {
1521
- this.callback(timestamp);
1522
- }
1523
- };
1524
- RafQueue.prototype.cancel = function () {
1525
- getDOM().cancelAnimationFrame(this.currentFrameId);
1526
- this.currentFrameId = null;
1527
- };
1528
- return RafQueue;
1529
- }());
1530
- var AnimationBuilder = (function () {
1531
- /**
1532
- * Used for DI
1533
- * @param browserDetails
1534
- */
1535
- function AnimationBuilder(browserDetails) {
1536
- this.browserDetails = browserDetails;
1537
- }
1538
- /**
1539
- * Creates a new CSS Animation
1540
- * @returns {CssAnimationBuilder}
1541
- */
1542
- AnimationBuilder.prototype.css = function () { return new CssAnimationBuilder(this.browserDetails); };
1543
- return AnimationBuilder;
1544
- }());
1545
- AnimationBuilder.decorators = [
1546
- { type: _angular_core.Injectable },
1547
- ];
1548
- AnimationBuilder.ctorParameters = [
1549
- { type: BrowserDetails, },
1550
- ];
1551
- var SharedStylesHost = (function () {
1552
- function SharedStylesHost() {
1553
- /** @internal */
1554
- this._styles = [];
1555
- /** @internal */
1556
- this._stylesSet = new Set();
1557
- }
1558
- SharedStylesHost.prototype.addStyles = function (styles) {
1559
- var _this = this;
1560
- var additions = [];
1561
- styles.forEach(function (style) {
1562
- if (!SetWrapper.has(_this._stylesSet, style)) {
1563
- _this._stylesSet.add(style);
1564
- _this._styles.push(style);
1565
- additions.push(style);
1566
- }
1567
- });
1568
- this.onStylesAdded(additions);
1569
- };
1570
- SharedStylesHost.prototype.onStylesAdded = function (additions) { };
1571
- SharedStylesHost.prototype.getAllStyles = function () { return this._styles; };
1572
- return SharedStylesHost;
1573
- }());
1574
- SharedStylesHost.decorators = [
1575
- { type: _angular_core.Injectable },
1576
- ];
1577
- SharedStylesHost.ctorParameters = [];
1578
- var DomSharedStylesHost = (function (_super) {
1579
- __extends(DomSharedStylesHost, _super);
1580
- function DomSharedStylesHost(doc) {
1581
- _super.call(this);
1582
- this._hostNodes = new Set();
1583
- this._hostNodes.add(doc.head);
1584
- }
1585
- /** @internal */
1586
- DomSharedStylesHost.prototype._addStylesToHost = function (styles, host) {
1587
- for (var i = 0; i < styles.length; i++) {
1588
- var style = styles[i];
1589
- getDOM().appendChild(host, getDOM().createStyleElement(style));
1590
- }
1591
- };
1592
- DomSharedStylesHost.prototype.addHost = function (hostNode) {
1593
- this._addStylesToHost(this._styles, hostNode);
1594
- this._hostNodes.add(hostNode);
1595
- };
1596
- DomSharedStylesHost.prototype.removeHost = function (hostNode) { SetWrapper.delete(this._hostNodes, hostNode); };
1597
- DomSharedStylesHost.prototype.onStylesAdded = function (additions) {
1598
- var _this = this;
1599
- this._hostNodes.forEach(function (hostNode) { _this._addStylesToHost(additions, hostNode); });
1600
- };
1601
- return DomSharedStylesHost;
1602
- }(SharedStylesHost));
1603
- DomSharedStylesHost.decorators = [
1604
- { type: _angular_core.Injectable },
1605
- ];
1606
- DomSharedStylesHost.ctorParameters = [
1607
- { type: undefined, decorators: [{ type: _angular_core.Inject, args: [DOCUMENT,] },] },
1608
- ];
1609
- var NAMESPACE_URIS =
1610
- /*@ts2dart_const*/
1611
- { 'xlink': 'http://www.w3.org/1999/xlink', 'svg': 'http://www.w3.org/2000/svg' };
1612
- var TEMPLATE_COMMENT_TEXT = 'template bindings={}';
1613
- var TEMPLATE_BINDINGS_EXP = /^template bindings=(.*)$/g;
1614
- var DomRootRenderer = (function () {
1615
- function DomRootRenderer(document, eventManager, sharedStylesHost, animate) {
1616
- this.document = document;
1617
- this.eventManager = eventManager;
1618
- this.sharedStylesHost = sharedStylesHost;
1619
- this.animate = animate;
1620
- this._registeredComponents = new Map();
1621
- }
1622
- DomRootRenderer.prototype.renderComponent = function (componentProto) {
1623
- var renderer = this._registeredComponents.get(componentProto.id);
1624
- if (isBlank(renderer)) {
1625
- renderer = new DomRenderer(this, componentProto);
1626
- this._registeredComponents.set(componentProto.id, renderer);
1627
- }
1628
- return renderer;
1629
- };
1630
- return DomRootRenderer;
1631
- }());
1632
- var DomRootRenderer_ = (function (_super) {
1633
- __extends(DomRootRenderer_, _super);
1634
- function DomRootRenderer_(_document, _eventManager, sharedStylesHost, animate) {
1635
- _super.call(this, _document, _eventManager, sharedStylesHost, animate);
1636
- }
1637
- return DomRootRenderer_;
1638
- }(DomRootRenderer));
1639
- DomRootRenderer_.decorators = [
1640
- { type: _angular_core.Injectable },
1641
- ];
1642
- DomRootRenderer_.ctorParameters = [
1643
- { type: undefined, decorators: [{ type: _angular_core.Inject, args: [DOCUMENT,] },] },
1644
- { type: EventManager, },
1645
- { type: DomSharedStylesHost, },
1646
- { type: AnimationBuilder, },
1647
- ];
1648
- var DomRenderer = (function () {
1649
- function DomRenderer(_rootRenderer, componentProto) {
1650
- this._rootRenderer = _rootRenderer;
1651
- this.componentProto = componentProto;
1652
- this._styles = _flattenStyles(componentProto.id, componentProto.styles, []);
1653
- if (componentProto.encapsulation !== _angular_core.ViewEncapsulation.Native) {
1654
- this._rootRenderer.sharedStylesHost.addStyles(this._styles);
1655
- }
1656
- if (this.componentProto.encapsulation === _angular_core.ViewEncapsulation.Emulated) {
1657
- this._contentAttr = _shimContentAttribute(componentProto.id);
1658
- this._hostAttr = _shimHostAttribute(componentProto.id);
1659
- }
1660
- else {
1661
- this._contentAttr = null;
1662
- this._hostAttr = null;
1663
- }
1664
- }
1665
- DomRenderer.prototype.selectRootElement = function (selectorOrNode, debugInfo) {
1666
- var el;
1667
- if (isString(selectorOrNode)) {
1668
- el = getDOM().querySelector(this._rootRenderer.document, selectorOrNode);
1669
- if (isBlank(el)) {
1670
- throw new BaseException("The selector \"" + selectorOrNode + "\" did not match any elements");
1671
- }
1672
- }
1673
- else {
1674
- el = selectorOrNode;
1675
- }
1676
- getDOM().clearNodes(el);
1677
- return el;
1678
- };
1679
- DomRenderer.prototype.createElement = function (parent, name, debugInfo) {
1680
- var nsAndName = splitNamespace(name);
1681
- var el = isPresent(nsAndName[0]) ?
1682
- getDOM().createElementNS(NAMESPACE_URIS[nsAndName[0]], nsAndName[1]) :
1683
- getDOM().createElement(nsAndName[1]);
1684
- if (isPresent(this._contentAttr)) {
1685
- getDOM().setAttribute(el, this._contentAttr, '');
1686
- }
1687
- if (isPresent(parent)) {
1688
- getDOM().appendChild(parent, el);
1689
- }
1690
- return el;
1691
- };
1692
- DomRenderer.prototype.createViewRoot = function (hostElement) {
1693
- var nodesParent;
1694
- if (this.componentProto.encapsulation === _angular_core.ViewEncapsulation.Native) {
1695
- nodesParent = getDOM().createShadowRoot(hostElement);
1696
- this._rootRenderer.sharedStylesHost.addHost(nodesParent);
1697
- for (var i = 0; i < this._styles.length; i++) {
1698
- getDOM().appendChild(nodesParent, getDOM().createStyleElement(this._styles[i]));
1699
- }
1700
- }
1701
- else {
1702
- if (isPresent(this._hostAttr)) {
1703
- getDOM().setAttribute(hostElement, this._hostAttr, '');
1704
- }
1705
- nodesParent = hostElement;
1706
- }
1707
- return nodesParent;
1708
- };
1709
- DomRenderer.prototype.createTemplateAnchor = function (parentElement, debugInfo) {
1710
- var comment = getDOM().createComment(TEMPLATE_COMMENT_TEXT);
1711
- if (isPresent(parentElement)) {
1712
- getDOM().appendChild(parentElement, comment);
1713
- }
1714
- return comment;
1715
- };
1716
- DomRenderer.prototype.createText = function (parentElement, value, debugInfo) {
1717
- var node = getDOM().createTextNode(value);
1718
- if (isPresent(parentElement)) {
1719
- getDOM().appendChild(parentElement, node);
1720
- }
1721
- return node;
1722
- };
1723
- DomRenderer.prototype.projectNodes = function (parentElement, nodes) {
1724
- if (isBlank(parentElement))
1725
- return;
1726
- appendNodes(parentElement, nodes);
1727
- };
1728
- DomRenderer.prototype.attachViewAfter = function (node, viewRootNodes) {
1729
- moveNodesAfterSibling(node, viewRootNodes);
1730
- for (var i = 0; i < viewRootNodes.length; i++)
1731
- this.animateNodeEnter(viewRootNodes[i]);
1732
- };
1733
- DomRenderer.prototype.detachView = function (viewRootNodes) {
1734
- for (var i = 0; i < viewRootNodes.length; i++) {
1735
- var node = viewRootNodes[i];
1736
- getDOM().remove(node);
1737
- this.animateNodeLeave(node);
1738
- }
1739
- };
1740
- DomRenderer.prototype.destroyView = function (hostElement, viewAllNodes) {
1741
- if (this.componentProto.encapsulation === _angular_core.ViewEncapsulation.Native && isPresent(hostElement)) {
1742
- this._rootRenderer.sharedStylesHost.removeHost(getDOM().getShadowRoot(hostElement));
1743
- }
1744
- };
1745
- DomRenderer.prototype.listen = function (renderElement, name, callback) {
1746
- return this._rootRenderer.eventManager.addEventListener(renderElement, name, decoratePreventDefault(callback));
1747
- };
1748
- DomRenderer.prototype.listenGlobal = function (target, name, callback) {
1749
- return this._rootRenderer.eventManager.addGlobalEventListener(target, name, decoratePreventDefault(callback));
1750
- };
1751
- DomRenderer.prototype.setElementProperty = function (renderElement, propertyName, propertyValue) {
1752
- getDOM().setProperty(renderElement, propertyName, propertyValue);
1753
- };
1754
- DomRenderer.prototype.setElementAttribute = function (renderElement, attributeName, attributeValue) {
1755
- var attrNs;
1756
- var nsAndName = splitNamespace(attributeName);
1757
- if (isPresent(nsAndName[0])) {
1758
- attributeName = nsAndName[0] + ':' + nsAndName[1];
1759
- attrNs = NAMESPACE_URIS[nsAndName[0]];
1760
- }
1761
- if (isPresent(attributeValue)) {
1762
- if (isPresent(attrNs)) {
1763
- getDOM().setAttributeNS(renderElement, attrNs, attributeName, attributeValue);
1764
- }
1765
- else {
1766
- getDOM().setAttribute(renderElement, attributeName, attributeValue);
1767
- }
1768
- }
1769
- else {
1770
- if (isPresent(attrNs)) {
1771
- getDOM().removeAttributeNS(renderElement, attrNs, nsAndName[1]);
1772
- }
1773
- else {
1774
- getDOM().removeAttribute(renderElement, attributeName);
1775
- }
1776
- }
1777
- };
1778
- DomRenderer.prototype.setBindingDebugInfo = function (renderElement, propertyName, propertyValue) {
1779
- var dashCasedPropertyName = camelCaseToDashCase(propertyName);
1780
- if (getDOM().isCommentNode(renderElement)) {
1781
- var existingBindings = RegExpWrapper.firstMatch(TEMPLATE_BINDINGS_EXP, StringWrapper.replaceAll(getDOM().getText(renderElement), /\n/g, ''));
1782
- var parsedBindings = Json.parse(existingBindings[1]);
1783
- parsedBindings[dashCasedPropertyName] = propertyValue;
1784
- getDOM().setText(renderElement, StringWrapper.replace(TEMPLATE_COMMENT_TEXT, '{}', Json.stringify(parsedBindings)));
1785
- }
1786
- else {
1787
- this.setElementAttribute(renderElement, propertyName, propertyValue);
1788
- }
1789
- };
1790
- DomRenderer.prototype.setElementClass = function (renderElement, className, isAdd) {
1791
- if (isAdd) {
1792
- getDOM().addClass(renderElement, className);
1793
- }
1794
- else {
1795
- getDOM().removeClass(renderElement, className);
1796
- }
1797
- };
1798
- DomRenderer.prototype.setElementStyle = function (renderElement, styleName, styleValue) {
1799
- if (isPresent(styleValue)) {
1800
- getDOM().setStyle(renderElement, styleName, stringify(styleValue));
1801
- }
1802
- else {
1803
- getDOM().removeStyle(renderElement, styleName);
1804
- }
1805
- };
1806
- DomRenderer.prototype.invokeElementMethod = function (renderElement, methodName, args) {
1807
- getDOM().invoke(renderElement, methodName, args);
1808
- };
1809
- DomRenderer.prototype.setText = function (renderNode, text) { getDOM().setText(renderNode, text); };
1810
- /**
1811
- * Performs animations if necessary
1812
- * @param node
1813
- */
1814
- DomRenderer.prototype.animateNodeEnter = function (node) {
1815
- if (getDOM().isElementNode(node) && getDOM().hasClass(node, 'ng-animate')) {
1816
- getDOM().addClass(node, 'ng-enter');
1817
- this._rootRenderer.animate.css()
1818
- .addAnimationClass('ng-enter-active')
1819
- .start(node)
1820
- .onComplete(function () { getDOM().removeClass(node, 'ng-enter'); });
1821
- }
1822
- };
1823
- /**
1824
- * If animations are necessary, performs animations then removes the element; otherwise, it just
1825
- * removes the element.
1826
- * @param node
1827
- */
1828
- DomRenderer.prototype.animateNodeLeave = function (node) {
1829
- if (getDOM().isElementNode(node) && getDOM().hasClass(node, 'ng-animate')) {
1830
- getDOM().addClass(node, 'ng-leave');
1831
- this._rootRenderer.animate.css()
1832
- .addAnimationClass('ng-leave-active')
1833
- .start(node)
1834
- .onComplete(function () {
1835
- getDOM().removeClass(node, 'ng-leave');
1836
- getDOM().remove(node);
1837
- });
1838
- }
1839
- else {
1840
- getDOM().remove(node);
1841
- }
1842
- };
1843
- return DomRenderer;
1844
- }());
1845
- function moveNodesAfterSibling(sibling, nodes) {
1846
- var parent = getDOM().parentElement(sibling);
1847
- if (nodes.length > 0 && isPresent(parent)) {
1848
- var nextSibling = getDOM().nextSibling(sibling);
1849
- if (isPresent(nextSibling)) {
1850
- for (var i = 0; i < nodes.length; i++) {
1851
- getDOM().insertBefore(nextSibling, nodes[i]);
1852
- }
1853
- }
1854
- else {
1855
- for (var i = 0; i < nodes.length; i++) {
1856
- getDOM().appendChild(parent, nodes[i]);
1857
- }
1858
- }
1859
- }
1860
- }
1861
- function appendNodes(parent, nodes) {
1862
- for (var i = 0; i < nodes.length; i++) {
1863
- getDOM().appendChild(parent, nodes[i]);
1864
- }
1865
- }
1866
- function decoratePreventDefault(eventHandler) {
1867
- return function (event) {
1868
- var allowDefaultBehavior = eventHandler(event);
1869
- if (allowDefaultBehavior === false) {
1870
- // TODO(tbosch): move preventDefault into event plugins...
1871
- getDOM().preventDefault(event);
1872
- }
1873
- };
1874
- }
1875
- var COMPONENT_REGEX = /%COMP%/g;
1876
- var COMPONENT_VARIABLE = '%COMP%';
1877
- var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE;
1878
- var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE;
1879
- function _shimContentAttribute(componentShortId) {
1880
- return StringWrapper.replaceAll(CONTENT_ATTR, COMPONENT_REGEX, componentShortId);
1881
- }
1882
- function _shimHostAttribute(componentShortId) {
1883
- return StringWrapper.replaceAll(HOST_ATTR, COMPONENT_REGEX, componentShortId);
1884
- }
1885
- function _flattenStyles(compId, styles, target) {
1886
- for (var i = 0; i < styles.length; i++) {
1887
- var style = styles[i];
1888
- if (isArray(style)) {
1889
- _flattenStyles(compId, style, target);
1890
- }
1891
- else {
1892
- style = StringWrapper.replaceAll(style, COMPONENT_REGEX, compId);
1893
- target.push(style);
1894
- }
1895
- }
1896
- return target;
1897
- }
1898
- var NS_PREFIX_RE = /^@([^:]+):(.+)/g;
1899
- function splitNamespace(name) {
1900
- if (name[0] != '@') {
1901
- return [null, name];
1902
- }
1903
- var match = RegExpWrapper.firstMatch(NS_PREFIX_RE, name);
1904
- return [match[1], match[2]];
1905
- }
1906
- var modifierKeys = ['alt', 'control', 'meta', 'shift'];
1907
- var modifierKeyGetters = {
1908
- 'alt': function (event) { return event.altKey; },
1909
- 'control': function (event) { return event.ctrlKey; },
1910
- 'meta': function (event) { return event.metaKey; },
1911
- 'shift': function (event) { return event.shiftKey; }
1912
- };
1913
- var KeyEventsPlugin = (function (_super) {
1914
- __extends(KeyEventsPlugin, _super);
1915
- function KeyEventsPlugin() {
1916
- _super.call(this);
1917
- }
1918
- KeyEventsPlugin.prototype.supports = function (eventName) {
1919
- return isPresent(KeyEventsPlugin.parseEventName(eventName));
1920
- };
1921
- KeyEventsPlugin.prototype.addEventListener = function (element, eventName, handler) {
1922
- var parsedEvent = KeyEventsPlugin.parseEventName(eventName);
1923
- var outsideHandler = KeyEventsPlugin.eventCallback(element, StringMapWrapper.get(parsedEvent, 'fullKey'), handler, this.manager.getZone());
1924
- return this.manager.getZone().runOutsideAngular(function () {
1925
- return getDOM().onAndCancel(element, StringMapWrapper.get(parsedEvent, 'domEventName'), outsideHandler);
1926
- });
1927
- };
1928
- KeyEventsPlugin.parseEventName = function (eventName) {
1929
- var parts = eventName.toLowerCase().split('.');
1930
- var domEventName = parts.shift();
1931
- if ((parts.length === 0) ||
1932
- !(StringWrapper.equals(domEventName, 'keydown') ||
1933
- StringWrapper.equals(domEventName, 'keyup'))) {
1934
- return null;
1935
- }
1936
- var key = KeyEventsPlugin._normalizeKey(parts.pop());
1937
- var fullKey = '';
1938
- modifierKeys.forEach(function (modifierName) {
1939
- if (ListWrapper.contains(parts, modifierName)) {
1940
- ListWrapper.remove(parts, modifierName);
1941
- fullKey += modifierName + '.';
1942
- }
1943
- });
1944
- fullKey += key;
1945
- if (parts.length != 0 || key.length === 0) {
1946
- // returning null instead of throwing to let another plugin process the event
1947
- return null;
1948
- }
1949
- var result = StringMapWrapper.create();
1950
- StringMapWrapper.set(result, 'domEventName', domEventName);
1951
- StringMapWrapper.set(result, 'fullKey', fullKey);
1952
- return result;
1953
- };
1954
- KeyEventsPlugin.getEventFullKey = function (event) {
1955
- var fullKey = '';
1956
- var key = getDOM().getEventKey(event);
1957
- key = key.toLowerCase();
1958
- if (StringWrapper.equals(key, ' ')) {
1959
- key = 'space'; // for readability
1960
- }
1961
- else if (StringWrapper.equals(key, '.')) {
1962
- key = 'dot'; // because '.' is used as a separator in event names
1963
- }
1964
- modifierKeys.forEach(function (modifierName) {
1965
- if (modifierName != key) {
1966
- var modifierGetter = StringMapWrapper.get(modifierKeyGetters, modifierName);
1967
- if (modifierGetter(event)) {
1968
- fullKey += modifierName + '.';
1969
- }
1970
- }
1971
- });
1972
- fullKey += key;
1973
- return fullKey;
1974
- };
1975
- KeyEventsPlugin.eventCallback = function (element, fullKey, handler, zone) {
1976
- return function (event) {
1977
- if (StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) {
1978
- zone.runGuarded(function () { return handler(event); });
1979
- }
1980
- };
1981
- };
1982
- /** @internal */
1983
- KeyEventsPlugin._normalizeKey = function (keyName) {
1984
- // TODO: switch to a StringMap if the mapping grows too much
1985
- switch (keyName) {
1986
- case 'esc':
1987
- return 'escape';
1988
- default:
1989
- return keyName;
1990
- }
1991
- };
1992
- return KeyEventsPlugin;
1993
- }(EventManagerPlugin));
1994
- KeyEventsPlugin.decorators = [
1995
- { type: _angular_core.Injectable },
1996
- ];
1997
- KeyEventsPlugin.ctorParameters = [];
1998
- var CORE_TOKENS = { 'ApplicationRef': _angular_core.ApplicationRef, 'NgZone': _angular_core.NgZone };
1999
- var INSPECT_GLOBAL_NAME = 'ng.probe';
2000
- var CORE_TOKENS_GLOBAL_NAME = 'ng.coreTokens';
2001
- /**
2002
- * Returns a {@link DebugElement} for the given native DOM element, or
2003
- * null if the given native element does not have an Angular view associated
2004
- * with it.
2005
- */
2006
- function inspectNativeElement(element) {
2007
- return _angular_core.getDebugNode(element);
2008
- }
2009
- function _createConditionalRootRenderer(rootRenderer) {
2010
- if (assertionsEnabled()) {
2011
- return _createRootRenderer(rootRenderer);
2012
- }
2013
- return rootRenderer;
2014
- }
2015
- function _createRootRenderer(rootRenderer) {
2016
- getDOM().setGlobalVar(INSPECT_GLOBAL_NAME, inspectNativeElement);
2017
- getDOM().setGlobalVar(CORE_TOKENS_GLOBAL_NAME, CORE_TOKENS);
2018
- return new DebugDomRootRenderer(rootRenderer);
2019
- }
2020
- /**
2021
- * Providers which support debugging Angular applications (e.g. via `ng.probe`).
2022
- */
2023
- var ELEMENT_PROBE_PROVIDERS = [
2024
- /*@ts2dart_Provider*/ {
2025
- provide: _angular_core.RootRenderer,
2026
- useFactory: _createConditionalRootRenderer,
2027
- deps: [DomRootRenderer]
2028
- }
2029
- ];
2030
- var DomEventsPlugin = (function (_super) {
2031
- __extends(DomEventsPlugin, _super);
2032
- function DomEventsPlugin() {
2033
- _super.apply(this, arguments);
2034
- }
2035
- // This plugin should come last in the list of plugins, because it accepts all
2036
- // events.
2037
- DomEventsPlugin.prototype.supports = function (eventName) { return true; };
2038
- DomEventsPlugin.prototype.addEventListener = function (element, eventName, handler) {
2039
- var zone = this.manager.getZone();
2040
- var outsideHandler = function (event) { return zone.runGuarded(function () { return handler(event); }); };
2041
- return this.manager.getZone().runOutsideAngular(function () { return getDOM().onAndCancel(element, eventName, outsideHandler); });
2042
- };
2043
- DomEventsPlugin.prototype.addGlobalEventListener = function (target, eventName, handler) {
2044
- var element = getDOM().getGlobalEventTarget(target);
2045
- var zone = this.manager.getZone();
2046
- var outsideHandler = function (event) { return zone.runGuarded(function () { return handler(event); }); };
2047
- return this.manager.getZone().runOutsideAngular(function () { return getDOM().onAndCancel(element, eventName, outsideHandler); });
2048
- };
2049
- return DomEventsPlugin;
2050
- }(EventManagerPlugin));
2051
- DomEventsPlugin.decorators = [
2052
- { type: _angular_core.Injectable },
2053
- ];
2054
- var _eventNames = {
2055
- // pan
2056
- 'pan': true,
2057
- 'panstart': true,
2058
- 'panmove': true,
2059
- 'panend': true,
2060
- 'pancancel': true,
2061
- 'panleft': true,
2062
- 'panright': true,
2063
- 'panup': true,
2064
- 'pandown': true,
2065
- // pinch
2066
- 'pinch': true,
2067
- 'pinchstart': true,
2068
- 'pinchmove': true,
2069
- 'pinchend': true,
2070
- 'pinchcancel': true,
2071
- 'pinchin': true,
2072
- 'pinchout': true,
2073
- // press
2074
- 'press': true,
2075
- 'pressup': true,
2076
- // rotate
2077
- 'rotate': true,
2078
- 'rotatestart': true,
2079
- 'rotatemove': true,
2080
- 'rotateend': true,
2081
- 'rotatecancel': true,
2082
- // swipe
2083
- 'swipe': true,
2084
- 'swipeleft': true,
2085
- 'swiperight': true,
2086
- 'swipeup': true,
2087
- 'swipedown': true,
2088
- // tap
2089
- 'tap': true,
2090
- };
2091
- var HammerGesturesPluginCommon = (function (_super) {
2092
- __extends(HammerGesturesPluginCommon, _super);
2093
- function HammerGesturesPluginCommon() {
2094
- _super.call(this);
2095
- }
2096
- HammerGesturesPluginCommon.prototype.supports = function (eventName) {
2097
- eventName = eventName.toLowerCase();
2098
- return StringMapWrapper.contains(_eventNames, eventName);
2099
- };
2100
- return HammerGesturesPluginCommon;
2101
- }(EventManagerPlugin));
2102
- var HAMMER_GESTURE_CONFIG =
2103
- /*@ts2dart_const*/ new _angular_core.OpaqueToken("HammerGestureConfig");
2104
- var HammerGestureConfig = (function () {
2105
- function HammerGestureConfig() {
2106
- this.events = [];
2107
- this.overrides = {};
2108
- }
2109
- HammerGestureConfig.prototype.buildHammer = function (element) {
2110
- var mc = new Hammer(element);
2111
- mc.get('pinch').set({ enable: true });
2112
- mc.get('rotate').set({ enable: true });
2113
- for (var eventName in this.overrides) {
2114
- mc.get(eventName).set(this.overrides[eventName]);
2115
- }
2116
- return mc;
2117
- };
2118
- return HammerGestureConfig;
2119
- }());
2120
- HammerGestureConfig.decorators = [
2121
- { type: _angular_core.Injectable },
2122
- ];
2123
- var HammerGesturesPlugin = (function (_super) {
2124
- __extends(HammerGesturesPlugin, _super);
2125
- function HammerGesturesPlugin(_config) {
2126
- _super.call(this);
2127
- this._config = _config;
2128
- }
2129
- HammerGesturesPlugin.prototype.supports = function (eventName) {
2130
- if (!_super.prototype.supports.call(this, eventName) && !this.isCustomEvent(eventName))
2131
- return false;
2132
- if (!isPresent(window['Hammer'])) {
2133
- throw new BaseException("Hammer.js is not loaded, can not bind " + eventName + " event");
2134
- }
2135
- return true;
2136
- };
2137
- HammerGesturesPlugin.prototype.addEventListener = function (element, eventName, handler) {
2138
- var _this = this;
2139
- var zone = this.manager.getZone();
2140
- eventName = eventName.toLowerCase();
2141
- return zone.runOutsideAngular(function () {
2142
- // Creating the manager bind events, must be done outside of angular
2143
- var mc = _this._config.buildHammer(element);
2144
- var callback = function (eventObj) { zone.runGuarded(function () { handler(eventObj); }); };
2145
- mc.on(eventName, callback);
2146
- return function () { mc.off(eventName, callback); };
2147
- });
2148
- };
2149
- HammerGesturesPlugin.prototype.isCustomEvent = function (eventName) { return this._config.events.indexOf(eventName) > -1; };
2150
- return HammerGesturesPlugin;
2151
- }(HammerGesturesPluginCommon));
2152
- HammerGesturesPlugin.decorators = [
2153
- { type: _angular_core.Injectable },
2154
- ];
2155
- HammerGesturesPlugin.ctorParameters = [
2156
- { type: HammerGestureConfig, decorators: [{ type: _angular_core.Inject, args: [HAMMER_GESTURE_CONFIG,] },] },
2157
- ];
2158
- /**
2159
- * A service that can be used to get and set the title of a current HTML document.
2160
- *
2161
- * Since an Angular 2 application can't be bootstrapped on the entire HTML document (`<html>` tag)
2162
- * it is not possible to bind to the `text` property of the `HTMLTitleElement` elements
2163
- * (representing the `<title>` tag). Instead, this service can be used to set and get the current
2164
- * title value.
2165
- */
2166
- var Title = (function () {
2167
- function Title() {
2168
- }
2169
- /**
2170
- * Get the title of the current HTML document.
2171
- * @returns {string}
2172
- */
2173
- Title.prototype.getTitle = function () { return getDOM().getTitle(); };
2174
- /**
2175
- * Set the title of the current HTML document.
2176
- * @param newTitle
2177
- */
2178
- Title.prototype.setTitle = function (newTitle) { getDOM().setTitle(newTitle); };
2179
- return Title;
2180
- }());
2181
- /**
2182
- * JS version of browser APIs. This library can only run in the browser.
2183
- */
2184
- var win = typeof window !== 'undefined' && window || {};
2185
- var ChangeDetectionPerfRecord = (function () {
2186
- function ChangeDetectionPerfRecord(msPerTick, numTicks) {
2187
- this.msPerTick = msPerTick;
2188
- this.numTicks = numTicks;
2189
- }
2190
- return ChangeDetectionPerfRecord;
2191
- }());
2192
- /**
2193
- * Entry point for all Angular debug tools. This object corresponds to the `ng`
2194
- * global variable accessible in the dev console.
2195
- */
2196
- var AngularTools = (function () {
2197
- function AngularTools(ref) {
2198
- this.profiler = new AngularProfiler(ref);
2199
- }
2200
- return AngularTools;
2201
- }());
2202
- /**
2203
- * Entry point for all Angular profiling-related debug tools. This object
2204
- * corresponds to the `ng.profiler` in the dev console.
2205
- */
2206
- var AngularProfiler = (function () {
2207
- function AngularProfiler(ref) {
2208
- this.appRef = ref.injector.get(_angular_core.ApplicationRef);
2209
- }
2210
- /**
2211
- * Exercises change detection in a loop and then prints the average amount of
2212
- * time in milliseconds how long a single round of change detection takes for
2213
- * the current state of the UI. It runs a minimum of 5 rounds for a minimum
2214
- * of 500 milliseconds.
2215
- *
2216
- * Optionally, a user may pass a `config` parameter containing a map of
2217
- * options. Supported options are:
2218
- *
2219
- * `record` (boolean) - causes the profiler to record a CPU profile while
2220
- * it exercises the change detector. Example:
2221
- *
2222
- * ```
2223
- * ng.profiler.timeChangeDetection({record: true})
2224
- * ```
2225
- */
2226
- AngularProfiler.prototype.timeChangeDetection = function (config) {
2227
- var record = isPresent(config) && config['record'];
2228
- var profileName = 'Change Detection';
2229
- // Profiler is not available in Android browsers, nor in IE 9 without dev tools opened
2230
- var isProfilerAvailable = isPresent(win.console.profile);
2231
- if (record && isProfilerAvailable) {
2232
- win.console.profile(profileName);
2233
- }
2234
- var start = getDOM().performanceNow();
2235
- var numTicks = 0;
2236
- while (numTicks < 5 || (getDOM().performanceNow() - start) < 500) {
2237
- this.appRef.tick();
2238
- numTicks++;
2239
- }
2240
- var end = getDOM().performanceNow();
2241
- if (record && isProfilerAvailable) {
2242
- // need to cast to <any> because type checker thinks there's no argument
2243
- // while in fact there is:
2244
- //
2245
- // https://developer.mozilla.org/en-US/docs/Web/API/Console/profileEnd
2246
- win.console.profileEnd(profileName);
2247
- }
2248
- var msPerTick = (end - start) / numTicks;
2249
- win.console.log("ran " + numTicks + " change detection cycles");
2250
- win.console.log(NumberWrapper.toFixed(msPerTick, 2) + " ms per check");
2251
- return new ChangeDetectionPerfRecord(msPerTick, numTicks);
2252
- };
2253
- return AngularProfiler;
2254
- }());
2255
- var context = global$1;
2256
- /**
2257
- * Enabled Angular 2 debug tools that are accessible via your browser's
2258
- * developer console.
2259
- *
2260
- * Usage:
2261
- *
2262
- * 1. Open developer console (e.g. in Chrome Ctrl + Shift + j)
2263
- * 1. Type `ng.` (usually the console will show auto-complete suggestion)
2264
- * 1. Try the change detection profiler `ng.profiler.timeChangeDetection()`
2265
- * then hit Enter.
2266
- */
2267
- function enableDebugTools(ref) {
2268
- context.ng = new AngularTools(ref);
2269
- }
2270
- /**
2271
- * Disables Angular 2 tools.
2272
- */
2273
- function disableDebugTools() {
2274
- delete context.ng;
2275
- }
2276
- /**
2277
- * Predicates for use with {@link DebugElement}'s query functions.
2278
- */
2279
- var By = (function () {
2280
- function By() {
2281
- }
2282
- /**
2283
- * Match all elements.
2284
- *
2285
- * ## Example
2286
- *
2287
- * {@example platform/dom/debug/ts/by/by.ts region='by_all'}
2288
- */
2289
- By.all = function () { return function (debugElement) { return true; }; };
2290
- /**
2291
- * Match elements by the given CSS selector.
2292
- *
2293
- * ## Example
2294
- *
2295
- * {@example platform/dom/debug/ts/by/by.ts region='by_css'}
2296
- */
2297
- By.css = function (selector) {
2298
- return function (debugElement) {
2299
- return isPresent(debugElement.nativeElement) ?
2300
- getDOM().elementMatches(debugElement.nativeElement, selector) :
2301
- false;
2302
- };
2303
- };
2304
- /**
2305
- * Match elements that have the given directive present.
2306
- *
2307
- * ## Example
2308
- *
2309
- * {@example platform/dom/debug/ts/by/by.ts region='by_directive'}
2310
- */
2311
- By.directive = function (type) {
2312
- return function (debugElement) { return debugElement.providerTokens.indexOf(type) !== -1; };
2313
- };
2314
- return By;
2315
- }());
2316
- var BROWSER_PLATFORM_MARKER =
2317
- /*@ts2dart_const*/ new _angular_core.OpaqueToken('BrowserPlatformMarker');
2318
- /**
2319
- * A set of providers to initialize the Angular platform in a web browser.
2320
- *
2321
- * Used automatically by `bootstrap`, or can be passed to {@link platform}.
2322
- */
2323
- var BROWSER_PROVIDERS = [
2324
- /*@ts2dart_Provider*/ { provide: BROWSER_PLATFORM_MARKER, useValue: true },
2325
- _angular_core.PLATFORM_COMMON_PROVIDERS,
2326
- /*@ts2dart_Provider*/ { provide: _angular_core.PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true },
2327
- ];
2328
- function _exceptionHandler() {
2329
- // !IS_DART is required because we must rethrow exceptions in JS,
2330
- // but must not rethrow exceptions in Dart
2331
- return new _angular_core.ExceptionHandler(getDOM(), !IS_DART);
2332
- }
2333
- function _document() {
2334
- return getDOM().defaultDoc();
2335
- }
2336
- /**
2337
- * A set of providers to initialize an Angular application in a web browser.
2338
- *
2339
- * Used automatically by `bootstrap`, or can be passed to {@link PlatformRef.application}.
2340
- */
2341
- var BROWSER_APP_COMMON_PROVIDERS =
2342
- /*@ts2dart_const*/ [
2343
- _angular_core.APPLICATION_COMMON_PROVIDERS,
2344
- _angular_common.FORM_PROVIDERS,
2345
- /* @ts2dart_Provider */ { provide: _angular_core.PLATFORM_PIPES, useValue: _angular_common.COMMON_PIPES, multi: true },
2346
- /* @ts2dart_Provider */ { provide: _angular_core.PLATFORM_DIRECTIVES, useValue: _angular_common.COMMON_DIRECTIVES, multi: true },
2347
- /* @ts2dart_Provider */ { provide: _angular_core.ExceptionHandler, useFactory: _exceptionHandler, deps: [] },
2348
- /* @ts2dart_Provider */ { provide: DOCUMENT, useFactory: _document, deps: [] },
2349
- /* @ts2dart_Provider */ { provide: EVENT_MANAGER_PLUGINS, useClass: DomEventsPlugin, multi: true },
2350
- /* @ts2dart_Provider */ { provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true },
2351
- /* @ts2dart_Provider */ { provide: EVENT_MANAGER_PLUGINS, useClass: HammerGesturesPlugin, multi: true },
2352
- /* @ts2dart_Provider */ { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig },
2353
- /* @ts2dart_Provider */ { provide: DomRootRenderer, useClass: DomRootRenderer_ },
2354
- /* @ts2dart_Provider */ { provide: _angular_core.RootRenderer, useExisting: DomRootRenderer },
2355
- /* @ts2dart_Provider */ { provide: SharedStylesHost, useExisting: DomSharedStylesHost },
2356
- DomSharedStylesHost,
2357
- _angular_core.Testability,
2358
- BrowserDetails,
2359
- AnimationBuilder,
2360
- EventManager,
2361
- ELEMENT_PROBE_PROVIDERS
2362
- ];
2363
- function initDomAdapter() {
2364
- BrowserDomAdapter.makeCurrent();
2365
- wtfInit();
2366
- BrowserGetTestability.init();
2367
- }
2368
- exports.__platform_browser_private__;
2369
- (function (__platform_browser_private__) {
2370
- __platform_browser_private__.DomAdapter = DomAdapter;
2371
- function getDOM$$() { return getDOM(); }
2372
- __platform_browser_private__.getDOM = getDOM$$;
2373
- function setDOM$$(adapter) { return setDOM(adapter); }
2374
- __platform_browser_private__.setDOM = setDOM$$;
2375
- __platform_browser_private__.setRootDomAdapter = setRootDomAdapter;
2376
- __platform_browser_private__.BrowserDomAdapter = BrowserDomAdapter;
2377
- __platform_browser_private__.AnimationBuilder = AnimationBuilder;
2378
- __platform_browser_private__.CssAnimationBuilder = CssAnimationBuilder;
2379
- __platform_browser_private__.CssAnimationOptions = CssAnimationOptions;
2380
- __platform_browser_private__.Animation = Animation;
2381
- __platform_browser_private__.BrowserDetails = BrowserDetails;
2382
- })(exports.__platform_browser_private__ || (exports.__platform_browser_private__ = {}));
2383
- var BrowserPlatformLocation = (function (_super) {
2384
- __extends(BrowserPlatformLocation, _super);
2385
- function BrowserPlatformLocation() {
2386
- _super.call(this);
2387
- this._init();
2388
- }
2389
- // This is moved to its own method so that `MockPlatformLocationStrategy` can overwrite it
2390
- /** @internal */
2391
- BrowserPlatformLocation.prototype._init = function () {
2392
- this._location = getDOM().getLocation();
2393
- this._history = getDOM().getHistory();
2394
- };
2395
- Object.defineProperty(BrowserPlatformLocation.prototype, "location", {
2396
- /** @internal */
2397
- get: function () { return this._location; },
2398
- enumerable: true,
2399
- configurable: true
2400
- });
2401
- BrowserPlatformLocation.prototype.getBaseHrefFromDOM = function () { return getDOM().getBaseHref(); };
2402
- BrowserPlatformLocation.prototype.onPopState = function (fn) {
2403
- getDOM().getGlobalEventTarget('window').addEventListener('popstate', fn, false);
2404
- };
2405
- BrowserPlatformLocation.prototype.onHashChange = function (fn) {
2406
- getDOM().getGlobalEventTarget('window').addEventListener('hashchange', fn, false);
2407
- };
2408
- Object.defineProperty(BrowserPlatformLocation.prototype, "pathname", {
2409
- get: function () { return this._location.pathname; },
2410
- set: function (newPath) { this._location.pathname = newPath; },
2411
- enumerable: true,
2412
- configurable: true
2413
- });
2414
- Object.defineProperty(BrowserPlatformLocation.prototype, "search", {
2415
- get: function () { return this._location.search; },
2416
- enumerable: true,
2417
- configurable: true
2418
- });
2419
- Object.defineProperty(BrowserPlatformLocation.prototype, "hash", {
2420
- get: function () { return this._location.hash; },
2421
- enumerable: true,
2422
- configurable: true
2423
- });
2424
- BrowserPlatformLocation.prototype.pushState = function (state, title, url) {
2425
- this._history.pushState(state, title, url);
2426
- };
2427
- BrowserPlatformLocation.prototype.replaceState = function (state, title, url) {
2428
- this._history.replaceState(state, title, url);
2429
- };
2430
- BrowserPlatformLocation.prototype.forward = function () { this._history.forward(); };
2431
- BrowserPlatformLocation.prototype.back = function () { this._history.back(); };
2432
- return BrowserPlatformLocation;
2433
- }(_angular_common.PlatformLocation));
2434
- BrowserPlatformLocation.decorators = [
2435
- { type: _angular_core.Injectable },
2436
- ];
2437
- BrowserPlatformLocation.ctorParameters = [];
2438
- /**
2439
- * An array of providers that should be passed into `application()` when bootstrapping a component
2440
- * when all templates
2441
- * have been precompiled offline.
2442
- */
2443
- var BROWSER_APP_STATIC_PROVIDERS =
2444
- /*@ts2dart_const*/ BROWSER_APP_COMMON_PROVIDERS;
2445
- function browserStaticPlatform() {
2446
- if (isBlank(_angular_core.getPlatform())) {
2447
- _angular_core.createPlatform(_angular_core.ReflectiveInjector.resolveAndCreate(BROWSER_PROVIDERS));
2448
- }
2449
- return _angular_core.assertPlatform(BROWSER_PLATFORM_MARKER);
2450
- }
2451
- /**
2452
- * See {@link bootstrap} for more information.
2453
- */
2454
- function bootstrapStatic(appComponentType, customProviders, initReflector) {
2455
- if (isPresent(initReflector)) {
2456
- initReflector();
2457
- }
2458
- var appProviders = isPresent(customProviders) ? [BROWSER_APP_STATIC_PROVIDERS, customProviders] :
2459
- BROWSER_APP_STATIC_PROVIDERS;
2460
- var appInjector = _angular_core.ReflectiveInjector.resolveAndCreate(appProviders, browserStaticPlatform().injector);
2461
- return _angular_core.coreLoadAndBootstrap(appInjector, appComponentType);
2462
- }
2463
- function browserPlatform() {
2464
- if (isBlank(_angular_core.getPlatform())) {
2465
- _angular_core.createPlatform(_angular_core.ReflectiveInjector.resolveAndCreate(BROWSER_PROVIDERS));
2466
- }
2467
- return _angular_core.assertPlatform(BROWSER_PLATFORM_MARKER);
2468
- }
2469
- exports.browserPlatform = browserPlatform;
2470
- exports.DomEventsPlugin = DomEventsPlugin;
2471
- exports.EventManager = EventManager;
2472
- exports.EVENT_MANAGER_PLUGINS = EVENT_MANAGER_PLUGINS;
2473
- exports.ELEMENT_PROBE_PROVIDERS = ELEMENT_PROBE_PROVIDERS;
2474
- exports.BROWSER_APP_COMMON_PROVIDERS = BROWSER_APP_COMMON_PROVIDERS;
2475
- exports.BROWSER_PROVIDERS = BROWSER_PROVIDERS;
2476
- exports.By = By;
2477
- exports.Title = Title;
2478
- exports.enableDebugTools = enableDebugTools;
2479
- exports.disableDebugTools = disableDebugTools;
2480
- exports.HAMMER_GESTURE_CONFIG = HAMMER_GESTURE_CONFIG;
2481
- exports.HammerGestureConfig = HammerGestureConfig;
2482
- exports.DOCUMENT = DOCUMENT;
2483
- exports.bootstrapStatic = bootstrapStatic;
2484
- exports.browserStaticPlatform = browserStaticPlatform;
2485
- exports.BROWSER_APP_STATIC_PROVIDERS = BROWSER_APP_STATIC_PROVIDERS;
2486
- exports.BrowserPlatformLocation = BrowserPlatformLocation;
2487
- }));
2488
- //# sourceMappingURL=platform-browser.umd.js.map