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