discourse-ember-source 3.5.1.1 → 3.5.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (741) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ember/version.rb +1 -1
  3. metadata +2 -740
  4. data/.gitignore +0 -9
  5. data/.travis.yml +0 -5
  6. data/Gemfile +0 -6
  7. data/LICENSE.txt +0 -21
  8. data/README +0 -18
  9. data/README.md +0 -39
  10. data/Rakefile +0 -27
  11. data/bin/console +0 -14
  12. data/bin/setup +0 -8
  13. data/discourse-ember-source-3.5.1.0.gem +0 -0
  14. data/dist/ember-all.debug.map +0 -1
  15. data/dist/ember-template-compiler.map +0 -1
  16. data/dist/ember-testing.map +0 -1
  17. data/dist/ember-tests.map +0 -1
  18. data/dist/ember-tests.prod.map +0 -1
  19. data/dist/ember.debug.map +0 -1
  20. data/dist/ember.min.map +0 -1
  21. data/dist/ember.prod.map +0 -1
  22. data/dist/es/@ember/application/globals-resolver.js +0 -425
  23. data/dist/es/@ember/application/index.js +0 -3
  24. data/dist/es/@ember/application/instance.js +0 -513
  25. data/dist/es/@ember/application/lib/application.js +0 -1139
  26. data/dist/es/@ember/application/lib/lazy_load.js +0 -69
  27. data/dist/es/@ember/application/lib/validate-type.js +0 -24
  28. data/dist/es/@ember/application/tests/application_instance_test.js +0 -230
  29. data/dist/es/@ember/application/tests/application_test.js +0 -470
  30. data/dist/es/@ember/application/tests/bootstrap-test.js +0 -28
  31. data/dist/es/@ember/application/tests/dependency_injection/custom_resolver_test.js +0 -32
  32. data/dist/es/@ember/application/tests/dependency_injection/default_resolver_test.js +0 -363
  33. data/dist/es/@ember/application/tests/dependency_injection/normalization_test.js +0 -70
  34. data/dist/es/@ember/application/tests/dependency_injection/to_string_test.js +0 -71
  35. data/dist/es/@ember/application/tests/dependency_injection_test.js +0 -93
  36. data/dist/es/@ember/application/tests/initializers_test.js +0 -391
  37. data/dist/es/@ember/application/tests/instance_initializers_test.js +0 -395
  38. data/dist/es/@ember/application/tests/lazy_load_test.js +0 -79
  39. data/dist/es/@ember/application/tests/logging_test.js +0 -179
  40. data/dist/es/@ember/application/tests/readiness_test.js +0 -138
  41. data/dist/es/@ember/application/tests/reset_test.js +0 -185
  42. data/dist/es/@ember/application/tests/visit_test.js +0 -783
  43. data/dist/es/@ember/canary-features/index.js +0 -76
  44. data/dist/es/@ember/controller/index.js +0 -50
  45. data/dist/es/@ember/controller/lib/controller_mixin.js +0 -42
  46. data/dist/es/@ember/controller/tests/controller_test.js +0 -209
  47. data/dist/es/@ember/debug/index.js +0 -264
  48. data/dist/es/@ember/debug/lib/deprecate.js +0 -198
  49. data/dist/es/@ember/debug/lib/handlers.js +0 -22
  50. data/dist/es/@ember/debug/lib/testing.js +0 -7
  51. data/dist/es/@ember/debug/lib/warn.js +0 -107
  52. data/dist/es/@ember/debug/tests/handlers-test.js +0 -144
  53. data/dist/es/@ember/debug/tests/main_test.js +0 -444
  54. data/dist/es/@ember/deprecated-features/index.js +0 -21
  55. data/dist/es/@ember/engine/index.js +0 -532
  56. data/dist/es/@ember/engine/instance.js +0 -228
  57. data/dist/es/@ember/engine/lib/engine-parent.js +0 -32
  58. data/dist/es/@ember/engine/tests/engine_initializers_test.js +0 -366
  59. data/dist/es/@ember/engine/tests/engine_instance_initializers_test.js +0 -409
  60. data/dist/es/@ember/engine/tests/engine_instance_test.js +0 -115
  61. data/dist/es/@ember/engine/tests/engine_parent_test.js +0 -20
  62. data/dist/es/@ember/engine/tests/engine_test.js +0 -121
  63. data/dist/es/@ember/error/index.js +0 -36
  64. data/dist/es/@ember/error/tests/index_test.js +0 -19
  65. data/dist/es/@ember/instrumentation/index.js +0 -240
  66. data/dist/es/@ember/instrumentation/tests/index-test.js +0 -214
  67. data/dist/es/@ember/map/index.js +0 -218
  68. data/dist/es/@ember/map/lib/ordered-set.js +0 -186
  69. data/dist/es/@ember/map/lib/utils.js +0 -29
  70. data/dist/es/@ember/map/tests/map_test.js +0 -578
  71. data/dist/es/@ember/map/with-default.js +0 -87
  72. data/dist/es/@ember/object/computed.js +0 -35
  73. data/dist/es/@ember/object/lib/computed/computed_macros.js +0 -742
  74. data/dist/es/@ember/object/lib/computed/reduce_computed_macros.js +0 -894
  75. data/dist/es/@ember/object/tests/computed/computed_macros_test.js +0 -533
  76. data/dist/es/@ember/object/tests/computed/reduce_computed_macros_test.js +0 -2243
  77. data/dist/es/@ember/polyfills/index.js +0 -3
  78. data/dist/es/@ember/polyfills/lib/assign.js +0 -43
  79. data/dist/es/@ember/polyfills/lib/merge.js +0 -35
  80. data/dist/es/@ember/polyfills/tests/assign_test.js +0 -64
  81. data/dist/es/@ember/runloop/index.js +0 -749
  82. data/dist/es/@ember/runloop/tests/debounce_test.js +0 -87
  83. data/dist/es/@ember/runloop/tests/later_test.js +0 -264
  84. data/dist/es/@ember/runloop/tests/next_test.js +0 -56
  85. data/dist/es/@ember/runloop/tests/once_test.js +0 -62
  86. data/dist/es/@ember/runloop/tests/onerror_test.js +0 -59
  87. data/dist/es/@ember/runloop/tests/run_bind_test.js +0 -59
  88. data/dist/es/@ember/runloop/tests/run_test.js +0 -28
  89. data/dist/es/@ember/runloop/tests/schedule_test.js +0 -86
  90. data/dist/es/@ember/runloop/tests/sync_test.js +0 -32
  91. data/dist/es/@ember/runloop/tests/unwind_test.js +0 -54
  92. data/dist/es/@ember/service/index.js +0 -57
  93. data/dist/es/@ember/string/index.js +0 -362
  94. data/dist/es/@ember/string/lib/string_registry.js +0 -13
  95. data/dist/es/@ember/string/tests/camelize_test.js +0 -53
  96. data/dist/es/@ember/string/tests/capitalize_test.js +0 -58
  97. data/dist/es/@ember/string/tests/classify_test.js +0 -79
  98. data/dist/es/@ember/string/tests/dasherize_test.js +0 -57
  99. data/dist/es/@ember/string/tests/decamelize_test.js +0 -51
  100. data/dist/es/@ember/string/tests/loc_test.js +0 -76
  101. data/dist/es/@ember/string/tests/underscore_test.js +0 -51
  102. data/dist/es/@ember/string/tests/w_test.js +0 -39
  103. data/dist/es/@glimmer/compiler.js +0 -1226
  104. data/dist/es/@glimmer/encoder.js +0 -39
  105. data/dist/es/@glimmer/low-level.js +0 -82
  106. data/dist/es/@glimmer/node.js +0 -112
  107. data/dist/es/@glimmer/opcode-compiler.js +0 -1999
  108. data/dist/es/@glimmer/program.js +0 -405
  109. data/dist/es/@glimmer/reference.js +0 -478
  110. data/dist/es/@glimmer/runtime.js +0 -4086
  111. data/dist/es/@glimmer/syntax.js +0 -1424
  112. data/dist/es/@glimmer/util.js +0 -189
  113. data/dist/es/@glimmer/vm.js +0 -27
  114. data/dist/es/@glimmer/wire-format.js +0 -56
  115. data/dist/es/backburner.js +0 -936
  116. data/dist/es/container/index.js +0 -8
  117. data/dist/es/container/lib/container.js +0 -437
  118. data/dist/es/container/lib/registry.js +0 -646
  119. data/dist/es/container/tests/container_test.js +0 -872
  120. data/dist/es/container/tests/owner_test.js +0 -20
  121. data/dist/es/container/tests/registry_test.js +0 -943
  122. data/dist/es/dag-map.js +0 -209
  123. data/dist/es/ember-browser-environment/index.js +0 -8
  124. data/dist/es/ember-browser-environment/lib/has-dom.js +0 -19
  125. data/dist/es/ember-console/index.js +0 -177
  126. data/dist/es/ember-environment/index.js +0 -3
  127. data/dist/es/ember-environment/lib/context.js +0 -20
  128. data/dist/es/ember-environment/lib/env.js +0 -185
  129. data/dist/es/ember-environment/lib/global.js +0 -14
  130. data/dist/es/ember-error-handling/index.js +0 -22
  131. data/dist/es/ember-extension-support/index.js +0 -2
  132. data/dist/es/ember-extension-support/lib/container_debug_adapter.js +0 -99
  133. data/dist/es/ember-extension-support/lib/data_adapter.js +0 -493
  134. data/dist/es/ember-extension-support/tests/container_debug_adapter_test.js +0 -73
  135. data/dist/es/ember-extension-support/tests/data_adapter_test.js +0 -301
  136. data/dist/es/ember-glimmer/index.js +0 -286
  137. data/dist/es/ember-glimmer/lib/compile-time-lookup.js +0 -37
  138. data/dist/es/ember-glimmer/lib/component-managers/abstract.js +0 -49
  139. data/dist/es/ember-glimmer/lib/component-managers/curly.js +0 -395
  140. data/dist/es/ember-glimmer/lib/component-managers/custom.js +0 -145
  141. data/dist/es/ember-glimmer/lib/component-managers/definition-state.js +0 -1
  142. data/dist/es/ember-glimmer/lib/component-managers/mount.js +0 -103
  143. data/dist/es/ember-glimmer/lib/component-managers/outlet.js +0 -114
  144. data/dist/es/ember-glimmer/lib/component-managers/render.js +0 -112
  145. data/dist/es/ember-glimmer/lib/component-managers/root.js +0 -74
  146. data/dist/es/ember-glimmer/lib/component-managers/template-only.js +0 -46
  147. data/dist/es/ember-glimmer/lib/component.js +0 -633
  148. data/dist/es/ember-glimmer/lib/components/checkbox.js +0 -57
  149. data/dist/es/ember-glimmer/lib/components/link-to.js +0 -777
  150. data/dist/es/ember-glimmer/lib/components/text_area.js +0 -236
  151. data/dist/es/ember-glimmer/lib/components/text_field.js +0 -145
  152. data/dist/es/ember-glimmer/lib/dom.js +0 -3
  153. data/dist/es/ember-glimmer/lib/environment.js +0 -102
  154. data/dist/es/ember-glimmer/lib/helper.js +0 -128
  155. data/dist/es/ember-glimmer/lib/helpers/-class.js +0 -23
  156. data/dist/es/ember-glimmer/lib/helpers/-html-safe.js +0 -9
  157. data/dist/es/ember-glimmer/lib/helpers/-input-type.js +0 -11
  158. data/dist/es/ember-glimmer/lib/helpers/-normalize-class.js +0 -22
  159. data/dist/es/ember-glimmer/lib/helpers/action.js +0 -360
  160. data/dist/es/ember-glimmer/lib/helpers/component.js +0 -135
  161. data/dist/es/ember-glimmer/lib/helpers/concat.js +0 -38
  162. data/dist/es/ember-glimmer/lib/helpers/each-in.js +0 -126
  163. data/dist/es/ember-glimmer/lib/helpers/get.js +0 -100
  164. data/dist/es/ember-glimmer/lib/helpers/hash.js +0 -44
  165. data/dist/es/ember-glimmer/lib/helpers/if-unless.js +0 -142
  166. data/dist/es/ember-glimmer/lib/helpers/loc.js +0 -40
  167. data/dist/es/ember-glimmer/lib/helpers/log.js +0 -25
  168. data/dist/es/ember-glimmer/lib/helpers/mut.js +0 -107
  169. data/dist/es/ember-glimmer/lib/helpers/query-param.js +0 -31
  170. data/dist/es/ember-glimmer/lib/helpers/readonly.js +0 -104
  171. data/dist/es/ember-glimmer/lib/helpers/unbound.js +0 -36
  172. data/dist/es/ember-glimmer/lib/modifiers/action.js +0 -185
  173. data/dist/es/ember-glimmer/lib/protocol-for-url.js +0 -48
  174. data/dist/es/ember-glimmer/lib/renderer.js +0 -371
  175. data/dist/es/ember-glimmer/lib/resolver.js +0 -290
  176. data/dist/es/ember-glimmer/lib/setup-registry.js +0 -77
  177. data/dist/es/ember-glimmer/lib/syntax.js +0 -73
  178. data/dist/es/ember-glimmer/lib/syntax/-text-area.js +0 -8
  179. data/dist/es/ember-glimmer/lib/syntax/input.js +0 -173
  180. data/dist/es/ember-glimmer/lib/syntax/let.js +0 -50
  181. data/dist/es/ember-glimmer/lib/syntax/mount.js +0 -101
  182. data/dist/es/ember-glimmer/lib/syntax/outlet.js +0 -120
  183. data/dist/es/ember-glimmer/lib/syntax/render.js +0 -140
  184. data/dist/es/ember-glimmer/lib/syntax/utils.js +0 -6
  185. data/dist/es/ember-glimmer/lib/template-compiler.js +0 -7
  186. data/dist/es/ember-glimmer/lib/template.js +0 -16
  187. data/dist/es/ember-glimmer/lib/template_registry.js +0 -18
  188. data/dist/es/ember-glimmer/lib/templates/component.js +0 -2
  189. data/dist/es/ember-glimmer/lib/templates/empty.js +0 -2
  190. data/dist/es/ember-glimmer/lib/templates/link-to.js +0 -2
  191. data/dist/es/ember-glimmer/lib/templates/outlet.js +0 -2
  192. data/dist/es/ember-glimmer/lib/templates/root.js +0 -2
  193. data/dist/es/ember-glimmer/lib/utils/bindings.js +0 -180
  194. data/dist/es/ember-glimmer/lib/utils/curly-component-state-bucket.js +0 -36
  195. data/dist/es/ember-glimmer/lib/utils/custom-component-manager.js +0 -20
  196. data/dist/es/ember-glimmer/lib/utils/debug-stack.js +0 -57
  197. data/dist/es/ember-glimmer/lib/utils/iterable.js +0 -358
  198. data/dist/es/ember-glimmer/lib/utils/outlet.js +0 -89
  199. data/dist/es/ember-glimmer/lib/utils/process-args.js +0 -40
  200. data/dist/es/ember-glimmer/lib/utils/references.js +0 -325
  201. data/dist/es/ember-glimmer/lib/utils/serialization-first-node-helpers.js +0 -1
  202. data/dist/es/ember-glimmer/lib/utils/string.js +0 -98
  203. data/dist/es/ember-glimmer/lib/utils/to-bool.js +0 -9
  204. data/dist/es/ember-glimmer/lib/views/outlet.js +0 -71
  205. data/dist/es/ember-glimmer/tests/integration/application/actions-test.js +0 -107
  206. data/dist/es/ember-glimmer/tests/integration/application/engine-test.js +0 -912
  207. data/dist/es/ember-glimmer/tests/integration/application/rendering-test.js +0 -530
  208. data/dist/es/ember-glimmer/tests/integration/components/angle-bracket-invocation-test.js +0 -852
  209. data/dist/es/ember-glimmer/tests/integration/components/append-test.js +0 -742
  210. data/dist/es/ember-glimmer/tests/integration/components/attribute-bindings-test.js +0 -999
  211. data/dist/es/ember-glimmer/tests/integration/components/attrs-lookup-test.js +0 -268
  212. data/dist/es/ember-glimmer/tests/integration/components/class-bindings-test.js +0 -849
  213. data/dist/es/ember-glimmer/tests/integration/components/contextual-components-test.js +0 -1493
  214. data/dist/es/ember-glimmer/tests/integration/components/curly-components-test.js +0 -3705
  215. data/dist/es/ember-glimmer/tests/integration/components/destroy-test.js +0 -33
  216. data/dist/es/ember-glimmer/tests/integration/components/dynamic-components-test.js +0 -896
  217. data/dist/es/ember-glimmer/tests/integration/components/error-handling-test.js +0 -164
  218. data/dist/es/ember-glimmer/tests/integration/components/fragment-components-test.js +0 -285
  219. data/dist/es/ember-glimmer/tests/integration/components/instrumentation-compile-test.js +0 -108
  220. data/dist/es/ember-glimmer/tests/integration/components/instrumentation-test.js +0 -157
  221. data/dist/es/ember-glimmer/tests/integration/components/life-cycle-test.js +0 -1653
  222. data/dist/es/ember-glimmer/tests/integration/components/link-to-test.js +0 -218
  223. data/dist/es/ember-glimmer/tests/integration/components/local-lookup-test.js +0 -414
  224. data/dist/es/ember-glimmer/tests/integration/components/namespaced-lookup-test.js +0 -185
  225. data/dist/es/ember-glimmer/tests/integration/components/render-to-element-test.js +0 -0
  226. data/dist/es/ember-glimmer/tests/integration/components/target-action-test.js +0 -779
  227. data/dist/es/ember-glimmer/tests/integration/components/template-only-components-test.js +0 -225
  228. data/dist/es/ember-glimmer/tests/integration/components/to-string-test.js +0 -27
  229. data/dist/es/ember-glimmer/tests/integration/components/utils-test.js +0 -401
  230. data/dist/es/ember-glimmer/tests/integration/components/web-component-fallback-test.js +0 -35
  231. data/dist/es/ember-glimmer/tests/integration/components/will-destroy-element-hook-test.js +0 -40
  232. data/dist/es/ember-glimmer/tests/integration/content-test.js +0 -1759
  233. data/dist/es/ember-glimmer/tests/integration/custom-component-manager-test.js +0 -508
  234. data/dist/es/ember-glimmer/tests/integration/event-dispatcher-test.js +0 -607
  235. data/dist/es/ember-glimmer/tests/integration/helpers/-class-test.js +0 -76
  236. data/dist/es/ember-glimmer/tests/integration/helpers/closure-action-test.js +0 -1240
  237. data/dist/es/ember-glimmer/tests/integration/helpers/concat-test.js +0 -106
  238. data/dist/es/ember-glimmer/tests/integration/helpers/custom-helper-test.js +0 -672
  239. data/dist/es/ember-glimmer/tests/integration/helpers/element-action-test.js +0 -1595
  240. data/dist/es/ember-glimmer/tests/integration/helpers/get-test.js +0 -618
  241. data/dist/es/ember-glimmer/tests/integration/helpers/hash-test.js +0 -188
  242. data/dist/es/ember-glimmer/tests/integration/helpers/if-unless-test.js +0 -149
  243. data/dist/es/ember-glimmer/tests/integration/helpers/input-test.js +0 -827
  244. data/dist/es/ember-glimmer/tests/integration/helpers/loc-test.js +0 -103
  245. data/dist/es/ember-glimmer/tests/integration/helpers/log-test.js +0 -61
  246. data/dist/es/ember-glimmer/tests/integration/helpers/mut-test.js +0 -580
  247. data/dist/es/ember-glimmer/tests/integration/helpers/partial-test.js +0 -386
  248. data/dist/es/ember-glimmer/tests/integration/helpers/readonly-test.js +0 -293
  249. data/dist/es/ember-glimmer/tests/integration/helpers/render-test.js +0 -522
  250. data/dist/es/ember-glimmer/tests/integration/helpers/text-area-test.js +0 -166
  251. data/dist/es/ember-glimmer/tests/integration/helpers/unbound-test.js +0 -650
  252. data/dist/es/ember-glimmer/tests/integration/helpers/yield-test.js +0 -275
  253. data/dist/es/ember-glimmer/tests/integration/input-test.js +0 -242
  254. data/dist/es/ember-glimmer/tests/integration/mount-test.js +0 -424
  255. data/dist/es/ember-glimmer/tests/integration/outlet-test.js +0 -318
  256. data/dist/es/ember-glimmer/tests/integration/refinements-test.js +0 -74
  257. data/dist/es/ember-glimmer/tests/integration/render-settled-test.js +0 -72
  258. data/dist/es/ember-glimmer/tests/integration/svg-test.js +0 -158
  259. data/dist/es/ember-glimmer/tests/integration/syntax/each-in-test.js +0 -697
  260. data/dist/es/ember-glimmer/tests/integration/syntax/each-test.js +0 -1251
  261. data/dist/es/ember-glimmer/tests/integration/syntax/experimental-syntax-test.js +0 -42
  262. data/dist/es/ember-glimmer/tests/integration/syntax/if-unless-test.js +0 -108
  263. data/dist/es/ember-glimmer/tests/integration/syntax/in-element-test.js +0 -119
  264. data/dist/es/ember-glimmer/tests/integration/syntax/let-test.js +0 -390
  265. data/dist/es/ember-glimmer/tests/integration/syntax/with-dynamic-var-test.js +0 -36
  266. data/dist/es/ember-glimmer/tests/integration/syntax/with-test.js +0 -422
  267. data/dist/es/ember-glimmer/tests/unit/outlet-test.js +0 -48
  268. data/dist/es/ember-glimmer/tests/unit/runtime-resolver-cache-test.js +0 -263
  269. data/dist/es/ember-glimmer/tests/unit/template-factory-test.js +0 -67
  270. data/dist/es/ember-glimmer/tests/unit/utils/debug-stack-test.js +0 -38
  271. data/dist/es/ember-glimmer/tests/utils/abstract-test-case.js +0 -1
  272. data/dist/es/ember-glimmer/tests/utils/helpers.js +0 -15
  273. data/dist/es/ember-glimmer/tests/utils/shared-conditional-tests.js +0 -965
  274. data/dist/es/ember-glimmer/tests/utils/string-test.js +0 -47
  275. data/dist/es/ember-glimmer/tests/utils/test-case.js +0 -6
  276. data/dist/es/ember-glimmer/tests/utils/test-helpers.js +0 -1
  277. data/dist/es/ember-meta/index.js +0 -1
  278. data/dist/es/ember-meta/lib/meta.js +0 -623
  279. data/dist/es/ember-meta/tests/meta_test.js +0 -169
  280. data/dist/es/ember-metal/index.js +0 -33
  281. data/dist/es/ember-metal/lib/alias.js +0 -80
  282. data/dist/es/ember-metal/lib/array.js +0 -55
  283. data/dist/es/ember-metal/lib/array_events.js +0 -65
  284. data/dist/es/ember-metal/lib/chains.js +0 -315
  285. data/dist/es/ember-metal/lib/change_event.js +0 -4
  286. data/dist/es/ember-metal/lib/computed.js +0 -526
  287. data/dist/es/ember-metal/lib/computed_cache.js +0 -58
  288. data/dist/es/ember-metal/lib/dependent_keys.js +0 -34
  289. data/dist/es/ember-metal/lib/deprecate_property.js +0 -34
  290. data/dist/es/ember-metal/lib/descriptor.js +0 -28
  291. data/dist/es/ember-metal/lib/each_proxy.js +0 -106
  292. data/dist/es/ember-metal/lib/each_proxy_events.js +0 -13
  293. data/dist/es/ember-metal/lib/events.js +0 -174
  294. data/dist/es/ember-metal/lib/expand_properties.js +0 -64
  295. data/dist/es/ember-metal/lib/get_properties.js +0 -45
  296. data/dist/es/ember-metal/lib/injected_property.js +0 -53
  297. data/dist/es/ember-metal/lib/is_blank.js +0 -34
  298. data/dist/es/ember-metal/lib/is_empty.js +0 -63
  299. data/dist/es/ember-metal/lib/is_none.js +0 -27
  300. data/dist/es/ember-metal/lib/is_present.js +0 -38
  301. data/dist/es/ember-metal/lib/libraries.js +0 -80
  302. data/dist/es/ember-metal/lib/mixin.js +0 -646
  303. data/dist/es/ember-metal/lib/namespace_search.js +0 -166
  304. data/dist/es/ember-metal/lib/observer.js +0 -34
  305. data/dist/es/ember-metal/lib/observer_set.js +0 -48
  306. data/dist/es/ember-metal/lib/path_cache.js +0 -5
  307. data/dist/es/ember-metal/lib/properties.js +0 -192
  308. data/dist/es/ember-metal/lib/property_events.js +0 -198
  309. data/dist/es/ember-metal/lib/property_get.js +0 -160
  310. data/dist/es/ember-metal/lib/property_set.js +0 -157
  311. data/dist/es/ember-metal/lib/set_properties.js +0 -43
  312. data/dist/es/ember-metal/lib/tags.js +0 -81
  313. data/dist/es/ember-metal/lib/tracked.js +0 -201
  314. data/dist/es/ember-metal/lib/transaction.js +0 -137
  315. data/dist/es/ember-metal/lib/watch_key.js +0 -113
  316. data/dist/es/ember-metal/lib/watch_path.js +0 -24
  317. data/dist/es/ember-metal/lib/watching.js +0 -54
  318. data/dist/es/ember-metal/tests/accessors/get_path_test.js +0 -82
  319. data/dist/es/ember-metal/tests/accessors/get_properties_test.js +0 -36
  320. data/dist/es/ember-metal/tests/accessors/get_test.js +0 -335
  321. data/dist/es/ember-metal/tests/accessors/mandatory_setters_test.js +0 -470
  322. data/dist/es/ember-metal/tests/accessors/set_path_test.js +0 -97
  323. data/dist/es/ember-metal/tests/accessors/set_test.js +0 -128
  324. data/dist/es/ember-metal/tests/alias_test.js +0 -167
  325. data/dist/es/ember-metal/tests/chains_test.js +0 -210
  326. data/dist/es/ember-metal/tests/computed_test.js +0 -1040
  327. data/dist/es/ember-metal/tests/descriptor_test.js +0 -368
  328. data/dist/es/ember-metal/tests/events_test.js +0 -210
  329. data/dist/es/ember-metal/tests/expand_properties_test.js +0 -119
  330. data/dist/es/ember-metal/tests/injected_property_test.js +0 -76
  331. data/dist/es/ember-metal/tests/is_blank_test.js +0 -29
  332. data/dist/es/ember-metal/tests/is_empty_test.js +0 -55
  333. data/dist/es/ember-metal/tests/is_none_test.js +0 -23
  334. data/dist/es/ember-metal/tests/is_present_test.js +0 -30
  335. data/dist/es/ember-metal/tests/libraries_test.js +0 -99
  336. data/dist/es/ember-metal/tests/main_test.js +0 -31
  337. data/dist/es/ember-metal/tests/mixin/alias_method_test.js +0 -91
  338. data/dist/es/ember-metal/tests/mixin/apply_test.js +0 -40
  339. data/dist/es/ember-metal/tests/mixin/computed_test.js +0 -166
  340. data/dist/es/ember-metal/tests/mixin/concatenated_properties_test.js +0 -117
  341. data/dist/es/ember-metal/tests/mixin/detect_test.js +0 -40
  342. data/dist/es/ember-metal/tests/mixin/introspection_test.js +0 -75
  343. data/dist/es/ember-metal/tests/mixin/merged_properties_test.js +0 -200
  344. data/dist/es/ember-metal/tests/mixin/method_test.js +0 -252
  345. data/dist/es/ember-metal/tests/mixin/observer_test.js +0 -202
  346. data/dist/es/ember-metal/tests/mixin/reopen_test.js +0 -53
  347. data/dist/es/ember-metal/tests/mixin/without_test.js +0 -22
  348. data/dist/es/ember-metal/tests/namespace_search_test.js +0 -16
  349. data/dist/es/ember-metal/tests/observer_test.js +0 -961
  350. data/dist/es/ember-metal/tests/performance_test.js +0 -81
  351. data/dist/es/ember-metal/tests/properties_test.js +0 -120
  352. data/dist/es/ember-metal/tests/property_did_change_hook.js +0 -73
  353. data/dist/es/ember-metal/tests/set_properties_test.js +0 -49
  354. data/dist/es/ember-metal/tests/tracked/computed_test.js +0 -67
  355. data/dist/es/ember-metal/tests/tracked/get_test.js +0 -86
  356. data/dist/es/ember-metal/tests/tracked/set_test.js +0 -44
  357. data/dist/es/ember-metal/tests/tracked/support.js +0 -37
  358. data/dist/es/ember-metal/tests/tracked/validation_test.js +0 -233
  359. data/dist/es/ember-metal/tests/watching/is_watching_test.js +0 -97
  360. data/dist/es/ember-metal/tests/watching/unwatch_test.js +0 -109
  361. data/dist/es/ember-metal/tests/watching/watch_test.js +0 -255
  362. data/dist/es/ember-owner/index.js +0 -66
  363. data/dist/es/ember-routing/index.js +0 -21
  364. data/dist/es/ember-routing/lib/ext/controller.js +0 -222
  365. data/dist/es/ember-routing/lib/location/api.js +0 -118
  366. data/dist/es/ember-routing/lib/location/auto_location.js +0 -323
  367. data/dist/es/ember-routing/lib/location/hash_location.js +0 -171
  368. data/dist/es/ember-routing/lib/location/history_location.js +0 -298
  369. data/dist/es/ember-routing/lib/location/none_location.js +0 -122
  370. data/dist/es/ember-routing/lib/location/util.js +0 -114
  371. data/dist/es/ember-routing/lib/services/router.js +0 -243
  372. data/dist/es/ember-routing/lib/services/routing.js +0 -101
  373. data/dist/es/ember-routing/lib/system/cache.js +0 -40
  374. data/dist/es/ember-routing/lib/system/controller_for.js +0 -14
  375. data/dist/es/ember-routing/lib/system/dsl.js +0 -208
  376. data/dist/es/ember-routing/lib/system/generate_controller.js +0 -54
  377. data/dist/es/ember-routing/lib/system/query_params.js +0 -6
  378. data/dist/es/ember-routing/lib/system/route.js +0 -2476
  379. data/dist/es/ember-routing/lib/system/router.js +0 -1607
  380. data/dist/es/ember-routing/lib/system/router_state.js +0 -26
  381. data/dist/es/ember-routing/lib/system/transition.js +0 -153
  382. data/dist/es/ember-routing/lib/utils.js +0 -230
  383. data/dist/es/ember-routing/tests/ext/controller_test.js +0 -85
  384. data/dist/es/ember-routing/tests/location/auto_location_test.js +0 -379
  385. data/dist/es/ember-routing/tests/location/hash_location_test.js +0 -207
  386. data/dist/es/ember-routing/tests/location/history_location_test.js +0 -322
  387. data/dist/es/ember-routing/tests/location/none_location_test.js +0 -88
  388. data/dist/es/ember-routing/tests/location/util_test.js +0 -159
  389. data/dist/es/ember-routing/tests/system/cache_test.js +0 -54
  390. data/dist/es/ember-routing/tests/system/controller_for_test.js +0 -75
  391. data/dist/es/ember-routing/tests/system/dsl_test.js +0 -413
  392. data/dist/es/ember-routing/tests/system/route_test.js +0 -587
  393. data/dist/es/ember-routing/tests/system/router_test.js +0 -287
  394. data/dist/es/ember-routing/tests/utils_test.js +0 -37
  395. data/dist/es/ember-runtime/.gitignore +0 -1
  396. data/dist/es/ember-runtime/README +0 -12
  397. data/dist/es/ember-runtime/index.js +0 -35
  398. data/dist/es/ember-runtime/lib/compare.js +0 -149
  399. data/dist/es/ember-runtime/lib/copy.js +0 -106
  400. data/dist/es/ember-runtime/lib/ext/function.js +0 -154
  401. data/dist/es/ember-runtime/lib/ext/rsvp.js +0 -59
  402. data/dist/es/ember-runtime/lib/is-equal.js +0 -60
  403. data/dist/es/ember-runtime/lib/mixins/-proxy.js +0 -109
  404. data/dist/es/ember-runtime/lib/mixins/action_handler.js +0 -222
  405. data/dist/es/ember-runtime/lib/mixins/array.js +0 -1661
  406. data/dist/es/ember-runtime/lib/mixins/comparable.js +0 -38
  407. data/dist/es/ember-runtime/lib/mixins/container_proxy.js +0 -154
  408. data/dist/es/ember-runtime/lib/mixins/copyable.js +0 -34
  409. data/dist/es/ember-runtime/lib/mixins/enumerable.js +0 -16
  410. data/dist/es/ember-runtime/lib/mixins/evented.js +0 -149
  411. data/dist/es/ember-runtime/lib/mixins/mutable_enumerable.js +0 -18
  412. data/dist/es/ember-runtime/lib/mixins/observable.js +0 -482
  413. data/dist/es/ember-runtime/lib/mixins/promise_proxy.js +0 -224
  414. data/dist/es/ember-runtime/lib/mixins/registry_proxy.js +0 -265
  415. data/dist/es/ember-runtime/lib/mixins/target_action_support.js +0 -172
  416. data/dist/es/ember-runtime/lib/system/array_proxy.js +0 -298
  417. data/dist/es/ember-runtime/lib/system/core_object.js +0 -1037
  418. data/dist/es/ember-runtime/lib/system/namespace.js +0 -69
  419. data/dist/es/ember-runtime/lib/system/object.js +0 -73
  420. data/dist/es/ember-runtime/lib/system/object_proxy.js +0 -81
  421. data/dist/es/ember-runtime/lib/type-of.js +0 -107
  422. data/dist/es/ember-runtime/tests/array/any-test.js +0 -55
  423. data/dist/es/ember-runtime/tests/array/compact-test.js +0 -12
  424. data/dist/es/ember-runtime/tests/array/every-test.js +0 -82
  425. data/dist/es/ember-runtime/tests/array/filter-test.js +0 -123
  426. data/dist/es/ember-runtime/tests/array/find-test.js +0 -86
  427. data/dist/es/ember-runtime/tests/array/firstObject-test.js +0 -27
  428. data/dist/es/ember-runtime/tests/array/forEach-test.js +0 -68
  429. data/dist/es/ember-runtime/tests/array/includes-test.js +0 -46
  430. data/dist/es/ember-runtime/tests/array/indexOf-test.js +0 -27
  431. data/dist/es/ember-runtime/tests/array/invoke-test.js +0 -60
  432. data/dist/es/ember-runtime/tests/array/isAny-test.js +0 -53
  433. data/dist/es/ember-runtime/tests/array/lastIndexOf-test.js +0 -78
  434. data/dist/es/ember-runtime/tests/array/lastObject-test.js +0 -31
  435. data/dist/es/ember-runtime/tests/array/map-test.js +0 -68
  436. data/dist/es/ember-runtime/tests/array/mapBy-test.js +0 -16
  437. data/dist/es/ember-runtime/tests/array/objectAt-test.js +0 -34
  438. data/dist/es/ember-runtime/tests/array/reduce-test.js +0 -24
  439. data/dist/es/ember-runtime/tests/array/reject-test.js +0 -134
  440. data/dist/es/ember-runtime/tests/array/sortBy-test.js +0 -23
  441. data/dist/es/ember-runtime/tests/array/toArray-test.js +0 -11
  442. data/dist/es/ember-runtime/tests/array/uniq-test.js +0 -27
  443. data/dist/es/ember-runtime/tests/array/uniqBy-test.js +0 -33
  444. data/dist/es/ember-runtime/tests/array/without-test.js +0 -39
  445. data/dist/es/ember-runtime/tests/copyable-array/copy-test.js +0 -12
  446. data/dist/es/ember-runtime/tests/core/compare_test.js +0 -89
  447. data/dist/es/ember-runtime/tests/core/copy_test.js +0 -47
  448. data/dist/es/ember-runtime/tests/core/isEqual_test.js +0 -65
  449. data/dist/es/ember-runtime/tests/core/is_array_test.js +0 -59
  450. data/dist/es/ember-runtime/tests/core/is_empty_test.js +0 -15
  451. data/dist/es/ember-runtime/tests/core/type_of_test.js +0 -54
  452. data/dist/es/ember-runtime/tests/ext/function_test.js +0 -121
  453. data/dist/es/ember-runtime/tests/ext/rsvp_test.js +0 -269
  454. data/dist/es/ember-runtime/tests/helpers/array.js +0 -336
  455. data/dist/es/ember-runtime/tests/inject_test.js +0 -51
  456. data/dist/es/ember-runtime/tests/legacy_1x/mixins/observable/chained_test.js +0 -63
  457. data/dist/es/ember-runtime/tests/legacy_1x/mixins/observable/observable_test.js +0 -892
  458. data/dist/es/ember-runtime/tests/legacy_1x/mixins/observable/propertyChanges_test.js +0 -142
  459. data/dist/es/ember-runtime/tests/legacy_1x/system/object/base_test.js +0 -98
  460. data/dist/es/ember-runtime/tests/legacy_1x/system/object/concatenated_test.js +0 -131
  461. data/dist/es/ember-runtime/tests/mixins/array_test.js +0 -400
  462. data/dist/es/ember-runtime/tests/mixins/comparable_test.js +0 -37
  463. data/dist/es/ember-runtime/tests/mixins/container_proxy_test.js +0 -48
  464. data/dist/es/ember-runtime/tests/mixins/enumerable_test.js +0 -17
  465. data/dist/es/ember-runtime/tests/mixins/evented_test.js +0 -23
  466. data/dist/es/ember-runtime/tests/mixins/mutable_enumerable_test.js +0 -17
  467. data/dist/es/ember-runtime/tests/mixins/observable_test.js +0 -137
  468. data/dist/es/ember-runtime/tests/mixins/promise_proxy_test.js +0 -593
  469. data/dist/es/ember-runtime/tests/mixins/target_action_support_test.js +0 -237
  470. data/dist/es/ember-runtime/tests/mutable-array/addObject-test.js +0 -76
  471. data/dist/es/ember-runtime/tests/mutable-array/clear-test.js +0 -64
  472. data/dist/es/ember-runtime/tests/mutable-array/insertAt-test.js +0 -216
  473. data/dist/es/ember-runtime/tests/mutable-array/popObject-test.js +0 -91
  474. data/dist/es/ember-runtime/tests/mutable-array/pushObject-test.js +0 -98
  475. data/dist/es/ember-runtime/tests/mutable-array/pushObjects-test.js +0 -12
  476. data/dist/es/ember-runtime/tests/mutable-array/removeAt-test.js +0 -187
  477. data/dist/es/ember-runtime/tests/mutable-array/removeObject-test.js +0 -77
  478. data/dist/es/ember-runtime/tests/mutable-array/removeObjects-test.js +0 -202
  479. data/dist/es/ember-runtime/tests/mutable-array/replace-test.js +0 -221
  480. data/dist/es/ember-runtime/tests/mutable-array/reverseObjects-test.js +0 -35
  481. data/dist/es/ember-runtime/tests/mutable-array/setObjects-test.js +0 -63
  482. data/dist/es/ember-runtime/tests/mutable-array/shiftObject-test.js +0 -105
  483. data/dist/es/ember-runtime/tests/mutable-array/unshiftObject-test.js +0 -99
  484. data/dist/es/ember-runtime/tests/mutable-array/unshiftObjects-test.js +0 -102
  485. data/dist/es/ember-runtime/tests/system/array_proxy/arranged_content_test.js +0 -275
  486. data/dist/es/ember-runtime/tests/system/array_proxy/array_observer_test.js +0 -51
  487. data/dist/es/ember-runtime/tests/system/array_proxy/content_change_test.js +0 -85
  488. data/dist/es/ember-runtime/tests/system/array_proxy/length_test.js +0 -201
  489. data/dist/es/ember-runtime/tests/system/array_proxy/watching_and_listening_test.js +0 -157
  490. data/dist/es/ember-runtime/tests/system/core_object_test.js +0 -114
  491. data/dist/es/ember-runtime/tests/system/namespace/base_test.js +0 -175
  492. data/dist/es/ember-runtime/tests/system/native_array/a_test.js +0 -16
  493. data/dist/es/ember-runtime/tests/system/native_array/copyable_suite_test.js +0 -19
  494. data/dist/es/ember-runtime/tests/system/native_array/replace_test.js +0 -17
  495. data/dist/es/ember-runtime/tests/system/object/computed_test.js +0 -352
  496. data/dist/es/ember-runtime/tests/system/object/create_test.js +0 -135
  497. data/dist/es/ember-runtime/tests/system/object/destroy_test.js +0 -146
  498. data/dist/es/ember-runtime/tests/system/object/detectInstance_test.js +0 -38
  499. data/dist/es/ember-runtime/tests/system/object/detect_test.js +0 -33
  500. data/dist/es/ember-runtime/tests/system/object/es-compatibility-test.js +0 -469
  501. data/dist/es/ember-runtime/tests/system/object/events_test.js +0 -156
  502. data/dist/es/ember-runtime/tests/system/object/extend_test.js +0 -153
  503. data/dist/es/ember-runtime/tests/system/object/observer_test.js +0 -216
  504. data/dist/es/ember-runtime/tests/system/object/reopenClass_test.js +0 -36
  505. data/dist/es/ember-runtime/tests/system/object/reopen_test.js +0 -48
  506. data/dist/es/ember-runtime/tests/system/object/strict-mode-test.js +0 -31
  507. data/dist/es/ember-runtime/tests/system/object/toString_test.js +0 -125
  508. data/dist/es/ember-runtime/tests/system/object_proxy_test.js +0 -314
  509. data/dist/es/ember-template-compiler/index.js +0 -26
  510. data/dist/es/ember-template-compiler/lib/compat.js +0 -16
  511. data/dist/es/ember-template-compiler/lib/plugins/assert-if-helper-without-arguments.js +0 -38
  512. data/dist/es/ember-template-compiler/lib/plugins/assert-input-helper-without-block.js +0 -20
  513. data/dist/es/ember-template-compiler/lib/plugins/assert-reserved-named-arguments.js +0 -26
  514. data/dist/es/ember-template-compiler/lib/plugins/assert-splattribute-expression.js +0 -27
  515. data/dist/es/ember-template-compiler/lib/plugins/deprecate-render-model.js +0 -38
  516. data/dist/es/ember-template-compiler/lib/plugins/deprecate-render.js +0 -41
  517. data/dist/es/ember-template-compiler/lib/plugins/deprecate-send-action.js +0 -42
  518. data/dist/es/ember-template-compiler/lib/plugins/index.js +0 -50
  519. data/dist/es/ember-template-compiler/lib/plugins/transform-action-syntax.js +0 -52
  520. data/dist/es/ember-template-compiler/lib/plugins/transform-angle-bracket-components.js +0 -10
  521. data/dist/es/ember-template-compiler/lib/plugins/transform-attrs-into-args.js +0 -62
  522. data/dist/es/ember-template-compiler/lib/plugins/transform-dot-component-invocation.js +0 -88
  523. data/dist/es/ember-template-compiler/lib/plugins/transform-each-in-into-each.js +0 -48
  524. data/dist/es/ember-template-compiler/lib/plugins/transform-has-block-syntax.js +0 -46
  525. data/dist/es/ember-template-compiler/lib/plugins/transform-in-element.js +0 -83
  526. data/dist/es/ember-template-compiler/lib/plugins/transform-inline-link-to.js +0 -31
  527. data/dist/es/ember-template-compiler/lib/plugins/transform-input-type-syntax.js +0 -52
  528. data/dist/es/ember-template-compiler/lib/plugins/transform-old-binding-syntax.js +0 -48
  529. data/dist/es/ember-template-compiler/lib/plugins/transform-old-class-binding-syntax.js +0 -102
  530. data/dist/es/ember-template-compiler/lib/plugins/transform-quoted-bindings-into-just-bindings.js +0 -34
  531. data/dist/es/ember-template-compiler/lib/plugins/transform-top-level-components.js +0 -41
  532. data/dist/es/ember-template-compiler/lib/system/bootstrap.js +0 -44
  533. data/dist/es/ember-template-compiler/lib/system/calculate-location-display.js +0 -20
  534. data/dist/es/ember-template-compiler/lib/system/compile-options.js +0 -71
  535. data/dist/es/ember-template-compiler/lib/system/compile.js +0 -28
  536. data/dist/es/ember-template-compiler/lib/system/dasherize-component-name.js +0 -13
  537. data/dist/es/ember-template-compiler/lib/system/initializer.js +0 -22
  538. data/dist/es/ember-template-compiler/lib/system/precompile.js +0 -18
  539. data/dist/es/ember-template-compiler/tests/plugins/assert-if-helper-without-arguments-test.js +0 -51
  540. data/dist/es/ember-template-compiler/tests/plugins/assert-input-helper-without-block-test.js +0 -17
  541. data/dist/es/ember-template-compiler/tests/plugins/assert-reserved-named-arguments-test.js +0 -416
  542. data/dist/es/ember-template-compiler/tests/plugins/assert-splattribute-expression-test.js +0 -57
  543. data/dist/es/ember-template-compiler/tests/plugins/deprecate-render-model-test.js +0 -19
  544. data/dist/es/ember-template-compiler/tests/plugins/deprecate-render-test.js +0 -19
  545. data/dist/es/ember-template-compiler/tests/plugins/deprecate-send-action-test.js +0 -29
  546. data/dist/es/ember-template-compiler/tests/plugins/transform-dot-component-invocation-test.js +0 -27
  547. data/dist/es/ember-template-compiler/tests/plugins/transform-inline-link-to-test.js +0 -15
  548. data/dist/es/ember-template-compiler/tests/plugins/transform-input-type-syntax-test.js +0 -25
  549. data/dist/es/ember-template-compiler/tests/system/bootstrap-test.js +0 -155
  550. data/dist/es/ember-template-compiler/tests/system/compile_options_test.js +0 -115
  551. data/dist/es/ember-template-compiler/tests/system/dasherize-component-name-test.js +0 -19
  552. data/dist/es/ember-testing/index.js +0 -10
  553. data/dist/es/ember-testing/lib/adapters/adapter.js +0 -58
  554. data/dist/es/ember-testing/lib/adapters/qunit.js +0 -47
  555. data/dist/es/ember-testing/lib/events.js +0 -136
  556. data/dist/es/ember-testing/lib/ext/application.js +0 -191
  557. data/dist/es/ember-testing/lib/ext/rsvp.js +0 -19
  558. data/dist/es/ember-testing/lib/helpers.js +0 -30
  559. data/dist/es/ember-testing/lib/helpers/-is-form-control.js +0 -16
  560. data/dist/es/ember-testing/lib/helpers/and_then.js +0 -3
  561. data/dist/es/ember-testing/lib/helpers/click.js +0 -36
  562. data/dist/es/ember-testing/lib/helpers/current_path.js +0 -27
  563. data/dist/es/ember-testing/lib/helpers/current_route_name.js +0 -25
  564. data/dist/es/ember-testing/lib/helpers/current_url.js +0 -27
  565. data/dist/es/ember-testing/lib/helpers/fill_in.js +0 -46
  566. data/dist/es/ember-testing/lib/helpers/find.js +0 -41
  567. data/dist/es/ember-testing/lib/helpers/find_with_assert.js +0 -34
  568. data/dist/es/ember-testing/lib/helpers/key_event.js +0 -36
  569. data/dist/es/ember-testing/lib/helpers/pause_test.js +0 -65
  570. data/dist/es/ember-testing/lib/helpers/trigger_event.js +0 -62
  571. data/dist/es/ember-testing/lib/helpers/visit.js +0 -42
  572. data/dist/es/ember-testing/lib/helpers/wait.js +0 -72
  573. data/dist/es/ember-testing/lib/initializers.js +0 -17
  574. data/dist/es/ember-testing/lib/setup_for_testing.js +0 -44
  575. data/dist/es/ember-testing/lib/support.js +0 -62
  576. data/dist/es/ember-testing/lib/test.js +0 -70
  577. data/dist/es/ember-testing/lib/test/adapter.js +0 -33
  578. data/dist/es/ember-testing/lib/test/helpers.js +0 -125
  579. data/dist/es/ember-testing/lib/test/on_inject_helpers.js +0 -38
  580. data/dist/es/ember-testing/lib/test/pending_requests.js +0 -24
  581. data/dist/es/ember-testing/lib/test/promise.js +0 -79
  582. data/dist/es/ember-testing/lib/test/run.js +0 -9
  583. data/dist/es/ember-testing/lib/test/waiters.js +0 -117
  584. data/dist/es/ember-testing/tests/acceptance_test.js +0 -478
  585. data/dist/es/ember-testing/tests/adapters/adapter_test.js +0 -31
  586. data/dist/es/ember-testing/tests/adapters/qunit_test.js +0 -50
  587. data/dist/es/ember-testing/tests/adapters_test.js +0 -405
  588. data/dist/es/ember-testing/tests/ext/rsvp_test.js +0 -124
  589. data/dist/es/ember-testing/tests/helper_registration_test.js +0 -98
  590. data/dist/es/ember-testing/tests/helpers_test.js +0 -1228
  591. data/dist/es/ember-testing/tests/integration_test.js +0 -106
  592. data/dist/es/ember-testing/tests/reexports_test.js +0 -26
  593. data/dist/es/ember-testing/tests/test/waiters-test.js +0 -145
  594. data/dist/es/ember-utils/index.js +0 -28
  595. data/dist/es/ember-utils/lib/cache.js +0 -36
  596. data/dist/es/ember-utils/lib/dictionary.js +0 -11
  597. data/dist/es/ember-utils/lib/guid.js +0 -120
  598. data/dist/es/ember-utils/lib/inspect.js +0 -112
  599. data/dist/es/ember-utils/lib/intern.js +0 -49
  600. data/dist/es/ember-utils/lib/invoke.js +0 -53
  601. data/dist/es/ember-utils/lib/is_proxy.js +0 -14
  602. data/dist/es/ember-utils/lib/lookup-descriptor.js +0 -11
  603. data/dist/es/ember-utils/lib/make-array.js +0 -7
  604. data/dist/es/ember-utils/lib/name.js +0 -9
  605. data/dist/es/ember-utils/lib/proxy-utils.js +0 -1
  606. data/dist/es/ember-utils/lib/spec.js +0 -14
  607. data/dist/es/ember-utils/lib/super.js +0 -83
  608. data/dist/es/ember-utils/lib/symbol-utils.js +0 -8
  609. data/dist/es/ember-utils/lib/symbol.js +0 -15
  610. data/dist/es/ember-utils/lib/to-string.js +0 -35
  611. data/dist/es/ember-utils/lib/weak_set.js +0 -18
  612. data/dist/es/ember-utils/tests/cache_test.js +0 -77
  613. data/dist/es/ember-utils/tests/can_invoke_test.js +0 -46
  614. data/dist/es/ember-utils/tests/checkHasSuper_test.js +0 -17
  615. data/dist/es/ember-utils/tests/generate_guid_test.js +0 -13
  616. data/dist/es/ember-utils/tests/guid_for_test.js +0 -101
  617. data/dist/es/ember-utils/tests/inspect_test.js +0 -146
  618. data/dist/es/ember-utils/tests/is_proxy_test.js +0 -18
  619. data/dist/es/ember-utils/tests/make_array_test.js +0 -41
  620. data/dist/es/ember-utils/tests/to-string-test.js +0 -32
  621. data/dist/es/ember-utils/tests/try_invoke_test.js +0 -48
  622. data/dist/es/ember-views/index.js +0 -28
  623. data/dist/es/ember-views/lib/compat/attrs.js +0 -3
  624. data/dist/es/ember-views/lib/compat/fallback-view-registry.js +0 -3
  625. data/dist/es/ember-views/lib/component_lookup.js +0 -27
  626. data/dist/es/ember-views/lib/mixins/action_support.js +0 -189
  627. data/dist/es/ember-views/lib/mixins/child_views_support.js +0 -27
  628. data/dist/es/ember-views/lib/mixins/class_names_support.js +0 -102
  629. data/dist/es/ember-views/lib/mixins/text_support.js +0 -333
  630. data/dist/es/ember-views/lib/mixins/view_state_support.js +0 -19
  631. data/dist/es/ember-views/lib/mixins/view_support.js +0 -452
  632. data/dist/es/ember-views/lib/system/action_manager.js +0 -14
  633. data/dist/es/ember-views/lib/system/event_dispatcher.js +0 -454
  634. data/dist/es/ember-views/lib/system/jquery.js +0 -29
  635. data/dist/es/ember-views/lib/system/jquery_event_deprecation.js +0 -61
  636. data/dist/es/ember-views/lib/system/lookup_partial.js +0 -55
  637. data/dist/es/ember-views/lib/system/utils.js +0 -201
  638. data/dist/es/ember-views/lib/utils/lookup-component.js +0 -58
  639. data/dist/es/ember-views/lib/views/core_view.js +0 -83
  640. data/dist/es/ember-views/lib/views/states.js +0 -48
  641. data/dist/es/ember-views/lib/views/states/default.js +0 -17
  642. data/dist/es/ember-views/lib/views/states/destroying.js +0 -16
  643. data/dist/es/ember-views/lib/views/states/has_element.js +0 -31
  644. data/dist/es/ember-views/lib/views/states/in_dom.js +0 -28
  645. data/dist/es/ember-views/lib/views/states/pre_render.js +0 -3
  646. data/dist/es/ember/index.js +0 -645
  647. data/dist/es/ember/tests/application_lifecycle_test.js +0 -188
  648. data/dist/es/ember/tests/component_context_test.js +0 -255
  649. data/dist/es/ember/tests/component_registration_test.js +0 -252
  650. data/dist/es/ember/tests/controller_test.js +0 -44
  651. data/dist/es/ember/tests/error_handler_test.js +0 -581
  652. data/dist/es/ember/tests/helpers/helper_registration_test.js +0 -103
  653. data/dist/es/ember/tests/helpers/link_to_test.js +0 -2103
  654. data/dist/es/ember/tests/helpers/link_to_test/link_to_transitioning_classes_test.js +0 -342
  655. data/dist/es/ember/tests/helpers/link_to_test/link_to_with_query_params_test.js +0 -694
  656. data/dist/es/ember/tests/homepage_example_test.js +0 -47
  657. data/dist/es/ember/tests/integration/multiple-app-test.js +0 -101
  658. data/dist/es/ember/tests/production_build_test.js +0 -34
  659. data/dist/es/ember/tests/reexports_test.js +0 -307
  660. data/dist/es/ember/tests/routing/decoupled_basic_test.js +0 -4506
  661. data/dist/es/ember/tests/routing/query_params_test.js +0 -1579
  662. data/dist/es/ember/tests/routing/query_params_test/model_dependent_state_with_query_params_test.js +0 -1117
  663. data/dist/es/ember/tests/routing/query_params_test/overlapping_query_params_test.js +0 -185
  664. data/dist/es/ember/tests/routing/query_params_test/query_param_async_get_handler_test.js +0 -327
  665. data/dist/es/ember/tests/routing/query_params_test/query_params_paramless_link_to_test.js +0 -37
  666. data/dist/es/ember/tests/routing/query_params_test/shared_state_test.js +0 -84
  667. data/dist/es/ember/tests/routing/router_map_test.js +0 -46
  668. data/dist/es/ember/tests/routing/router_service_test/basic_test.js +0 -95
  669. data/dist/es/ember/tests/routing/router_service_test/currenturl_lifecycle_test.js +0 -149
  670. data/dist/es/ember/tests/routing/router_service_test/isActive_test.js +0 -113
  671. data/dist/es/ember/tests/routing/router_service_test/replaceWith_test.js +0 -144
  672. data/dist/es/ember/tests/routing/router_service_test/transitionTo_test.js +0 -370
  673. data/dist/es/ember/tests/routing/router_service_test/urlFor_test.js +0 -307
  674. data/dist/es/ember/tests/routing/substates_test.js +0 -1110
  675. data/dist/es/ember/tests/routing/toplevel_dom_test.js +0 -37
  676. data/dist/es/ember/tests/service_injection_test.js +0 -278
  677. data/dist/es/ember/tests/view_instrumentation_test.js +0 -47
  678. data/dist/es/ember/version.js +0 -1
  679. data/dist/es/handlebars.js +0 -1268
  680. data/dist/es/internal-test-helpers/index.js +0 -31
  681. data/dist/es/internal-test-helpers/lib/.gitkeep +0 -0
  682. data/dist/es/internal-test-helpers/lib/apply-mixins.js +0 -37
  683. data/dist/es/internal-test-helpers/lib/browser-detect.js +0 -4
  684. data/dist/es/internal-test-helpers/lib/build-owner.js +0 -49
  685. data/dist/es/internal-test-helpers/lib/confirm-export.js +0 -45
  686. data/dist/es/internal-test-helpers/lib/ember-dev/assertion.js +0 -87
  687. data/dist/es/internal-test-helpers/lib/ember-dev/containers.js +0 -34
  688. data/dist/es/internal-test-helpers/lib/ember-dev/debug.js +0 -47
  689. data/dist/es/internal-test-helpers/lib/ember-dev/deprecation.js +0 -71
  690. data/dist/es/internal-test-helpers/lib/ember-dev/index.js +0 -19
  691. data/dist/es/internal-test-helpers/lib/ember-dev/method-call-tracker.js +0 -127
  692. data/dist/es/internal-test-helpers/lib/ember-dev/namespaces.js +0 -34
  693. data/dist/es/internal-test-helpers/lib/ember-dev/run-loop.js +0 -28
  694. data/dist/es/internal-test-helpers/lib/ember-dev/setup-qunit.js +0 -26
  695. data/dist/es/internal-test-helpers/lib/ember-dev/utils.js +0 -33
  696. data/dist/es/internal-test-helpers/lib/ember-dev/warning.js +0 -71
  697. data/dist/es/internal-test-helpers/lib/equal-inner-html.js +0 -37
  698. data/dist/es/internal-test-helpers/lib/equal-tokens.js +0 -53
  699. data/dist/es/internal-test-helpers/lib/factory.js +0 -65
  700. data/dist/es/internal-test-helpers/lib/get-all-property-names.js +0 -12
  701. data/dist/es/internal-test-helpers/lib/get-text-of.js +0 -3
  702. data/dist/es/internal-test-helpers/lib/matchers.js +0 -167
  703. data/dist/es/internal-test-helpers/lib/module-for.js +0 -89
  704. data/dist/es/internal-test-helpers/lib/registry-check.js +0 -28
  705. data/dist/es/internal-test-helpers/lib/run.js +0 -11
  706. data/dist/es/internal-test-helpers/lib/strip.js +0 -12
  707. data/dist/es/internal-test-helpers/lib/system/synthetic-events.js +0 -183
  708. data/dist/es/internal-test-helpers/lib/test-cases/abstract-application.js +0 -70
  709. data/dist/es/internal-test-helpers/lib/test-cases/abstract-rendering.js +0 -203
  710. data/dist/es/internal-test-helpers/lib/test-cases/abstract.js +0 -222
  711. data/dist/es/internal-test-helpers/lib/test-cases/application.js +0 -39
  712. data/dist/es/internal-test-helpers/lib/test-cases/autoboot-application.js +0 -34
  713. data/dist/es/internal-test-helpers/lib/test-cases/default-resolver-application.js +0 -43
  714. data/dist/es/internal-test-helpers/lib/test-cases/node-query.js +0 -120
  715. data/dist/es/internal-test-helpers/lib/test-cases/query-param.js +0 -124
  716. data/dist/es/internal-test-helpers/lib/test-cases/rendering.js +0 -14
  717. data/dist/es/internal-test-helpers/lib/test-cases/router.js +0 -26
  718. data/dist/es/internal-test-helpers/lib/test-cases/test-resolver-application.js +0 -40
  719. data/dist/es/internal-test-helpers/lib/test-resolver.js +0 -86
  720. data/dist/es/internal-test-helpers/tests/index-test.js +0 -10
  721. data/dist/es/route-recognizer.js +0 -685
  722. data/dist/es/router.js +0 -2454
  723. data/dist/es/rsvp.js +0 -2394
  724. data/dist/es/simple-html-tokenizer.js +0 -638
  725. data/dist/jquery/jquery.js +0 -10364
  726. data/dist/node/app-boot-test.js +0 -146
  727. data/dist/node/build-info-test.js +0 -177
  728. data/dist/node/component-rendering-test.js +0 -34
  729. data/dist/node/helpers/app-module.js +0 -198
  730. data/dist/node/helpers/assert-html-matches.js +0 -25
  731. data/dist/node/helpers/build-owner.js +0 -28
  732. data/dist/node/helpers/component-module.js +0 -137
  733. data/dist/node/sourcemap-test.js +0 -27
  734. data/dist/node/template-compiler-test.js +0 -45
  735. data/dist/node/visit-test.js +0 -349
  736. data/dist/qunit/qunit.css +0 -436
  737. data/dist/qunit/qunit.js +0 -5188
  738. data/dist/tests/index.html +0 -254
  739. data/ember-source.gemspec +0 -28
  740. data/node_modules/.yarn-integrity +0 -10
  741. data/yarn.lock +0 -4
data/dist/es/router.js DELETED
@@ -1,2454 +0,0 @@
1
- import { Promise } from 'rsvp';
2
- import RouteRecognizer from 'route-recognizer';
3
-
4
- const slice = Array.prototype.slice;
5
- const hasOwnProperty = Object.prototype.hasOwnProperty;
6
-
7
- /**
8
- Determines if an object is Promise by checking if it is "thenable".
9
- **/
10
- function isPromise(obj) {
11
- return (
12
- ((typeof obj === 'object' && obj !== null) || typeof obj === 'function') &&
13
- typeof obj.then === 'function'
14
- );
15
- }
16
-
17
- function merge(hash, other) {
18
- for (let prop in other) {
19
- if (hasOwnProperty.call(other, prop)) {
20
- hash[prop] = other[prop];
21
- }
22
- }
23
- }
24
-
25
- /**
26
- @private
27
-
28
- Extracts query params from the end of an array
29
- **/
30
- function extractQueryParams(array) {
31
- let len = array && array.length,
32
- head,
33
- queryParams;
34
-
35
- if (
36
- len &&
37
- len > 0 &&
38
- array[len - 1] &&
39
- hasOwnProperty.call(array[len - 1], 'queryParams')
40
- ) {
41
- queryParams = array[len - 1].queryParams;
42
- head = slice.call(array, 0, len - 1);
43
- return [head, queryParams];
44
- } else {
45
- return [array, null];
46
- }
47
- }
48
-
49
- /**
50
- @private
51
-
52
- Coerces query param properties and array elements into strings.
53
- **/
54
- function coerceQueryParamsToString(queryParams) {
55
- for (let key in queryParams) {
56
- let val = queryParams[key];
57
- if (typeof val === 'number') {
58
- queryParams[key] = '' + val;
59
- } else if (Array.isArray(val)) {
60
- for (let i = 0, l = val.length; i < l; i++) {
61
- val[i] = '' + val[i];
62
- }
63
- }
64
- }
65
- }
66
- /**
67
- @private
68
- */
69
- function log(router, sequence, msg) {
70
- if (!router.log) {
71
- return;
72
- }
73
-
74
- if (arguments.length === 3) {
75
- router.log('Transition #' + sequence + ': ' + msg);
76
- } else {
77
- msg = sequence;
78
- router.log(msg);
79
- }
80
- }
81
-
82
- function isParam(object) {
83
- return (
84
- typeof object === 'string' ||
85
- object instanceof String ||
86
- typeof object === 'number' ||
87
- object instanceof Number
88
- );
89
- }
90
-
91
- function forEach(array, callback) {
92
- for (
93
- let i = 0, l = array.length;
94
- i < l && false !== callback(array[i]);
95
- i++
96
- ) {
97
- // empty intentionally
98
- }
99
- }
100
-
101
- function trigger(router, handlerInfos, ignoreFailure, args) {
102
- if (router.triggerEvent) {
103
- router.triggerEvent(handlerInfos, ignoreFailure, args);
104
- return;
105
- }
106
-
107
- let name = args.shift();
108
-
109
- if (!handlerInfos) {
110
- if (ignoreFailure) {
111
- return;
112
- }
113
- throw new Error(
114
- "Could not trigger event '" + name + "'. There are no active handlers"
115
- );
116
- }
117
-
118
- let eventWasHandled = false;
119
-
120
- function delayedEvent(name, args, handler) {
121
- handler.events[name].apply(handler, args);
122
- }
123
-
124
- for (let i = handlerInfos.length - 1; i >= 0; i--) {
125
- let handlerInfo = handlerInfos[i],
126
- handler = handlerInfo.handler;
127
-
128
- // If there is no handler, it means the handler hasn't resolved yet which
129
- // means that we should trigger the event later when the handler is available
130
- if (!handler) {
131
- handlerInfo.handlerPromise.then(delayedEvent.bind(null, name, args));
132
- continue;
133
- }
134
-
135
- if (handler.events && handler.events[name]) {
136
- if (handler.events[name].apply(handler, args) === true) {
137
- eventWasHandled = true;
138
- } else {
139
- return;
140
- }
141
- }
142
- }
143
-
144
- // In the case that we got an UnrecognizedURLError as an event with no handler,
145
- // let it bubble up
146
- if (name === 'error' && args[0].name === 'UnrecognizedURLError') {
147
- throw args[0];
148
- } else if (!eventWasHandled && !ignoreFailure) {
149
- throw new Error("Nothing handled the event '" + name + "'.");
150
- }
151
- }
152
-
153
- function getChangelist(oldObject, newObject) {
154
- let key;
155
- let results = {
156
- all: {},
157
- changed: {},
158
- removed: {},
159
- };
160
-
161
- merge(results.all, newObject);
162
-
163
- let didChange = false;
164
- coerceQueryParamsToString(oldObject);
165
- coerceQueryParamsToString(newObject);
166
-
167
- // Calculate removals
168
- for (key in oldObject) {
169
- if (hasOwnProperty.call(oldObject, key)) {
170
- if (!hasOwnProperty.call(newObject, key)) {
171
- didChange = true;
172
- results.removed[key] = oldObject[key];
173
- }
174
- }
175
- }
176
-
177
- // Calculate changes
178
- for (key in newObject) {
179
- if (hasOwnProperty.call(newObject, key)) {
180
- if (Array.isArray(oldObject[key]) && Array.isArray(newObject[key])) {
181
- if (oldObject[key].length !== newObject[key].length) {
182
- results.changed[key] = newObject[key];
183
- didChange = true;
184
- } else {
185
- for (let i = 0, l = oldObject[key].length; i < l; i++) {
186
- if (oldObject[key][i] !== newObject[key][i]) {
187
- results.changed[key] = newObject[key];
188
- didChange = true;
189
- }
190
- }
191
- }
192
- } else if (oldObject[key] !== newObject[key]) {
193
- results.changed[key] = newObject[key];
194
- didChange = true;
195
- }
196
- }
197
- }
198
-
199
- return didChange ? results : undefined;
200
- }
201
-
202
- function promiseLabel(label) {
203
- return 'Router: ' + label;
204
- }
205
-
206
- function resolveHook(obj, hookName) {
207
- if (!obj) {
208
- return;
209
- }
210
- let underscored = '_' + hookName;
211
- return (obj[underscored] && underscored) || (obj[hookName] && hookName);
212
- }
213
-
214
- function callHook(obj, _hookName, arg1, arg2) {
215
- let hookName = resolveHook(obj, _hookName);
216
- return hookName && obj[hookName].call(obj, arg1, arg2);
217
- }
218
-
219
- function applyHook(obj, _hookName, args) {
220
- let hookName = resolveHook(obj, _hookName);
221
- if (hookName) {
222
- if (args.length === 0) {
223
- return obj[hookName].call(obj);
224
- } else if (args.length === 1) {
225
- return obj[hookName].call(obj, args[0]);
226
- } else if (args.length === 2) {
227
- return obj[hookName].call(obj, args[0], args[1]);
228
- } else {
229
- return obj[hookName].apply(obj, args);
230
- }
231
- }
232
- }
233
-
234
- class TransitionState {
235
- constructor() {
236
- this.handlerInfos = [];
237
- this.queryParams = {};
238
- this.params = {};
239
- }
240
-
241
- promiseLabel(label) {
242
- let targetName = '';
243
- forEach(this.handlerInfos, function(handlerInfo) {
244
- if (targetName !== '') {
245
- targetName += '.';
246
- }
247
- targetName += handlerInfo.name;
248
- });
249
- return promiseLabel("'" + targetName + "': " + label);
250
- }
251
-
252
- resolve(shouldContinue, payload = {}) {
253
- // First, calculate params for this state. This is useful
254
- // information to provide to the various route hooks.
255
- let params = this.params;
256
- forEach(this.handlerInfos, function(handlerInfo) {
257
- params[handlerInfo.name] = handlerInfo.params || {};
258
- });
259
-
260
- payload.resolveIndex = 0;
261
-
262
- let currentState = this;
263
- let wasAborted = false;
264
-
265
- // The prelude RSVP.resolve() asyncs us into the promise land.
266
- return Promise.resolve(null, this.promiseLabel('Start transition'))
267
- .then(resolveOneHandlerInfo, null, this.promiseLabel('Resolve handler'))
268
- .catch(handleError, this.promiseLabel('Handle error'));
269
-
270
- function innerShouldContinue() {
271
- return Promise.resolve(
272
- shouldContinue(),
273
- currentState.promiseLabel('Check if should continue')
274
- ).catch(function(reason) {
275
- // We distinguish between errors that occurred
276
- // during resolution (e.g. before"Model/model/afterModel),
277
- // and aborts due to a rejecting promise from shouldContinue().
278
- wasAborted = true;
279
- return Promise.reject(reason);
280
- }, currentState.promiseLabel('Handle abort'));
281
- }
282
-
283
- function handleError(error) {
284
- // This is the only possible
285
- // reject value of TransitionState#resolve
286
- let handlerInfos = currentState.handlerInfos;
287
- let errorHandlerIndex =
288
- payload.resolveIndex >= handlerInfos.length
289
- ? handlerInfos.length - 1
290
- : payload.resolveIndex;
291
- return Promise.reject({
292
- error: error,
293
- handlerWithError: currentState.handlerInfos[errorHandlerIndex].handler,
294
- wasAborted: wasAborted,
295
- state: currentState,
296
- });
297
- }
298
-
299
- function proceed(resolvedHandlerInfo) {
300
- let wasAlreadyResolved =
301
- currentState.handlerInfos[payload.resolveIndex].isResolved;
302
-
303
- // Swap the previously unresolved handlerInfo with
304
- // the resolved handlerInfo
305
- currentState.handlerInfos[payload.resolveIndex++] = resolvedHandlerInfo;
306
-
307
- if (!wasAlreadyResolved) {
308
- // Call the redirect hook. The reason we call it here
309
- // vs. afterModel is so that redirects into child
310
- // routes don't re-run the model hooks for this
311
- // already-resolved route.
312
- let handler = resolvedHandlerInfo.handler;
313
- callHook(handler, 'redirect', resolvedHandlerInfo.context, payload);
314
- }
315
-
316
- // Proceed after ensuring that the redirect hook
317
- // didn't abort this transition by transitioning elsewhere.
318
- return innerShouldContinue().then(
319
- resolveOneHandlerInfo,
320
- null,
321
- currentState.promiseLabel('Resolve handler')
322
- );
323
- }
324
-
325
- function resolveOneHandlerInfo() {
326
- if (payload.resolveIndex === currentState.handlerInfos.length) {
327
- // This is is the only possible
328
- // fulfill value of TransitionState#resolve
329
- return {
330
- error: null,
331
- state: currentState,
332
- };
333
- }
334
-
335
- let handlerInfo = currentState.handlerInfos[payload.resolveIndex];
336
-
337
- return handlerInfo
338
- .resolve(innerShouldContinue, payload)
339
- .then(proceed, null, currentState.promiseLabel('Proceed'));
340
- }
341
- }
342
- }
343
-
344
- function TransitionAbortedError(message) {
345
- if (!(this instanceof TransitionAbortedError)) {
346
- return new TransitionAbortedError(message);
347
- }
348
-
349
- var error = Error.call(this, message);
350
-
351
- if (Error.captureStackTrace) {
352
- Error.captureStackTrace(this, TransitionAbortedError);
353
- } else {
354
- this.stack = error.stack;
355
- }
356
-
357
- this.description = error.description;
358
- this.fileName = error.fileName;
359
- this.lineNumber = error.lineNumber;
360
- this.message = error.message || 'TransitionAborted';
361
- this.name = 'TransitionAborted';
362
- this.number = error.number;
363
- this.code = error.code;
364
- }
365
-
366
- TransitionAbortedError.prototype = Object.create(Error.prototype);
367
-
368
- /**
369
- A Transition is a thennable (a promise-like object) that represents
370
- an attempt to transition to another route. It can be aborted, either
371
- explicitly via `abort` or by attempting another transition while a
372
- previous one is still underway. An aborted transition can also
373
- be `retry()`d later.
374
-
375
- @class Transition
376
- @constructor
377
- @param {Object} router
378
- @param {Object} intent
379
- @param {Object} state
380
- @param {Object} error
381
- @private
382
- */
383
- class Transition {
384
- constructor(router, intent, state, error, previousTransition) {
385
- this.state = state || router.state;
386
- this.intent = intent;
387
- this.router = router;
388
- this.data = (this.intent && this.intent.data) || {};
389
- this.resolvedModels = {};
390
- this.queryParams = {};
391
- this.promise = undefined;
392
- this.error = undefined;
393
- this.params = undefined;
394
- this.handlerInfos = undefined;
395
- this.targetName = undefined;
396
- this.pivotHandler = undefined;
397
- this.sequence = undefined;
398
- this.isAborted = false;
399
- this.isActive = true;
400
- this.urlMethod = 'update';
401
- this.resolveIndex = 0;
402
- this.queryParamsOnly = false;
403
- this.isTransition = true;
404
-
405
- if (error) {
406
- this.promise = Promise.reject(error);
407
- this.error = error;
408
- return;
409
- }
410
-
411
- // if you're doing multiple redirects, need the new transition to know if it
412
- // is actually part of the first transition or not. Any further redirects
413
- // in the initial transition also need to know if they are part of the
414
- // initial transition
415
- this.isCausedByAbortingTransition = !!previousTransition;
416
- this.isCausedByInitialTransition =
417
- previousTransition &&
418
- (previousTransition.isCausedByInitialTransition ||
419
- previousTransition.sequence === 0);
420
- // Every transition in the chain is a replace
421
- this.isCausedByAbortingReplaceTransition =
422
- previousTransition &&
423
- (previousTransition.urlMethod == 'replace' &&
424
- (!previousTransition.isCausedByAbortingTransition ||
425
- previousTransition.isCausedByAbortingReplaceTransition));
426
-
427
- if (state) {
428
- this.params = state.params;
429
- this.queryParams = state.queryParams;
430
- this.handlerInfos = state.handlerInfos;
431
-
432
- let len = state.handlerInfos.length;
433
- if (len) {
434
- this.targetName = state.handlerInfos[len - 1].name;
435
- }
436
-
437
- for (let i = 0; i < len; ++i) {
438
- let handlerInfo = state.handlerInfos[i];
439
-
440
- // TODO: this all seems hacky
441
- if (!handlerInfo.isResolved) {
442
- break;
443
- }
444
- this.pivotHandler = handlerInfo.handler;
445
- }
446
-
447
- this.sequence = router.currentSequence++;
448
- this.promise = state
449
- .resolve(() => {
450
- if (this.isAborted) {
451
- return Promise.reject(
452
- undefined,
453
- promiseLabel('Transition aborted - reject')
454
- );
455
- }
456
- }, this)
457
- .catch(result => {
458
- if (result.wasAborted || this.isAborted) {
459
- return Promise.reject(logAbort(this));
460
- } else {
461
- this.trigger('error', result.error, this, result.handlerWithError);
462
- this.abort();
463
- return Promise.reject(result.error);
464
- }
465
- }, promiseLabel('Handle Abort'));
466
- } else {
467
- this.promise = Promise.resolve(this.state);
468
- this.params = {};
469
- }
470
- }
471
-
472
- isExiting(handler) {
473
- let handlerInfos = this.handlerInfos;
474
- for (let i = 0, len = handlerInfos.length; i < len; ++i) {
475
- let handlerInfo = handlerInfos[i];
476
- if (handlerInfo.name === handler || handlerInfo.handler === handler) {
477
- return false;
478
- }
479
- }
480
- return true;
481
- }
482
-
483
- /**
484
- The Transition's internal promise. Calling `.then` on this property
485
- is that same as calling `.then` on the Transition object itself, but
486
- this property is exposed for when you want to pass around a
487
- Transition's promise, but not the Transition object itself, since
488
- Transition object can be externally `abort`ed, while the promise
489
- cannot.
490
-
491
- @property promise
492
- @type {Object}
493
- @public
494
- */
495
-
496
- /**
497
- Custom state can be stored on a Transition's `data` object.
498
- This can be useful for decorating a Transition within an earlier
499
- hook and shared with a later hook. Properties set on `data` will
500
- be copied to new transitions generated by calling `retry` on this
501
- transition.
502
-
503
- @property data
504
- @type {Object}
505
- @public
506
- */
507
-
508
- /**
509
- A standard promise hook that resolves if the transition
510
- succeeds and rejects if it fails/redirects/aborts.
511
-
512
- Forwards to the internal `promise` property which you can
513
- use in situations where you want to pass around a thennable,
514
- but not the Transition itself.
515
-
516
- @method then
517
- @param {Function} onFulfilled
518
- @param {Function} onRejected
519
- @param {String} label optional string for labeling the promise.
520
- Useful for tooling.
521
- @return {Promise}
522
- @public
523
- */
524
- then(onFulfilled, onRejected, label) {
525
- return this.promise.then(onFulfilled, onRejected, label);
526
- }
527
-
528
- /**
529
-
530
- Forwards to the internal `promise` property which you can
531
- use in situations where you want to pass around a thennable,
532
- but not the Transition itself.
533
-
534
- @method catch
535
- @param {Function} onRejection
536
- @param {String} label optional string for labeling the promise.
537
- Useful for tooling.
538
- @return {Promise}
539
- @public
540
- */
541
- catch(onRejection, label) {
542
- return this.promise.catch(onRejection, label);
543
- }
544
-
545
- /**
546
-
547
- Forwards to the internal `promise` property which you can
548
- use in situations where you want to pass around a thennable,
549
- but not the Transition itself.
550
-
551
- @method finally
552
- @param {Function} callback
553
- @param {String} label optional string for labeling the promise.
554
- Useful for tooling.
555
- @return {Promise}
556
- @public
557
- */
558
- finally(callback, label) {
559
- return this.promise.finally(callback, label);
560
- }
561
-
562
- /**
563
- Aborts the Transition. Note you can also implicitly abort a transition
564
- by initiating another transition while a previous one is underway.
565
-
566
- @method abort
567
- @return {Transition} this transition
568
- @public
569
- */
570
- abort() {
571
- if (this.isAborted) {
572
- return this;
573
- }
574
- log(
575
- this.router,
576
- this.sequence,
577
- this.targetName + ': transition was aborted'
578
- );
579
- this.intent.preTransitionState = this.router.state;
580
- this.isAborted = true;
581
- this.isActive = false;
582
- this.router.activeTransition = null;
583
- return this;
584
- }
585
-
586
- /**
587
-
588
- Retries a previously-aborted transition (making sure to abort the
589
- transition if it's still active). Returns a new transition that
590
- represents the new attempt to transition.
591
-
592
- @method retry
593
- @return {Transition} new transition
594
- @public
595
- */
596
- retry() {
597
- // TODO: add tests for merged state retry()s
598
- this.abort();
599
- let newTransition = this.router.transitionByIntent(this.intent, false);
600
-
601
- // inheriting a `null` urlMethod is not valid
602
- // the urlMethod is only set to `null` when
603
- // the transition is initiated *after* the url
604
- // has been updated (i.e. `router.handleURL`)
605
- //
606
- // in that scenario, the url method cannot be
607
- // inherited for a new transition because then
608
- // the url would not update even though it should
609
- if (this.urlMethod !== null) {
610
- newTransition.method(this.urlMethod);
611
- }
612
- return newTransition;
613
- }
614
-
615
- /**
616
-
617
- Sets the URL-changing method to be employed at the end of a
618
- successful transition. By default, a new Transition will just
619
- use `updateURL`, but passing 'replace' to this method will
620
- cause the URL to update using 'replaceWith' instead. Omitting
621
- a parameter will disable the URL change, allowing for transitions
622
- that don't update the URL at completion (this is also used for
623
- handleURL, since the URL has already changed before the
624
- transition took place).
625
-
626
- @method method
627
- @param {String} method the type of URL-changing method to use
628
- at the end of a transition. Accepted values are 'replace',
629
- falsy values, or any other non-falsy value (which is
630
- interpreted as an updateURL transition).
631
-
632
- @return {Transition} this transition
633
- @public
634
- */
635
- method(method) {
636
- this.urlMethod = method;
637
- return this;
638
- }
639
-
640
- /**
641
-
642
- Fires an event on the current list of resolved/resolving
643
- handlers within this transition. Useful for firing events
644
- on route hierarchies that haven't fully been entered yet.
645
-
646
- Note: This method is also aliased as `send`
647
-
648
- @method trigger
649
- @param {Boolean} [ignoreFailure=false] a boolean specifying whether unhandled events throw an error
650
- @param {String} name the name of the event to fire
651
- @public
652
- */
653
- trigger(ignoreFailure) {
654
- let args = slice.call(arguments);
655
- if (typeof ignoreFailure === 'boolean') {
656
- args.shift();
657
- } else {
658
- // Throw errors on unhandled trigger events by default
659
- ignoreFailure = false;
660
- }
661
- trigger(
662
- this.router,
663
- this.state.handlerInfos.slice(0, this.resolveIndex + 1),
664
- ignoreFailure,
665
- args
666
- );
667
- }
668
-
669
- /**
670
- Transitions are aborted and their promises rejected
671
- when redirects occur; this method returns a promise
672
- that will follow any redirects that occur and fulfill
673
- with the value fulfilled by any redirecting transitions
674
- that occur.
675
-
676
- @method followRedirects
677
- @return {Promise} a promise that fulfills with the same
678
- value that the final redirecting transition fulfills with
679
- @public
680
- */
681
- followRedirects() {
682
- let router = this.router;
683
- return this.promise.catch(function(reason) {
684
- if (router.activeTransition) {
685
- return router.activeTransition.followRedirects();
686
- }
687
- return Promise.reject(reason);
688
- });
689
- }
690
-
691
- toString() {
692
- return 'Transition (sequence ' + this.sequence + ')';
693
- }
694
-
695
- /**
696
- @private
697
- */
698
- log(message) {
699
- log(this.router, this.sequence, message);
700
- }
701
- }
702
-
703
- // Alias 'trigger' as 'send'
704
- Transition.prototype.send = Transition.prototype.trigger;
705
-
706
- /**
707
- @private
708
-
709
- Logs and returns an instance of TransitionAborted.
710
- */
711
- function logAbort(transition) {
712
- log(transition.router, transition.sequence, 'detected abort.');
713
- return new TransitionAbortedError();
714
- }
715
-
716
- class TransitionIntent {
717
- constructor() {
718
- this.data = this.data || {};
719
- }
720
- }
721
-
722
- const DEFAULT_HANDLER = Object.freeze({});
723
-
724
- class HandlerInfo {
725
- constructor(props = {}) {
726
- // initialize local properties to ensure consistent object shape
727
- this._handler = DEFAULT_HANDLER;
728
- this._handlerPromise = null;
729
- this.factory = null; // Injected by the handler info factory
730
- this.name = props.name;
731
-
732
- for (let prop in props) {
733
- if (prop === 'handler') {
734
- this._processHandler(props.handler);
735
- } else {
736
- this[prop] = props[prop];
737
- }
738
- }
739
- }
740
-
741
- getHandler() {}
742
-
743
- fetchHandler() {
744
- let handler = this.getHandler(this.name);
745
- return this._processHandler(handler);
746
- }
747
-
748
- _processHandler(handler) {
749
- // Setup a handlerPromise so that we can wait for asynchronously loaded handlers
750
- this.handlerPromise = Promise.resolve(handler);
751
-
752
- // Wait until the 'handler' property has been updated when chaining to a handler
753
- // that is a promise
754
- if (isPromise(handler)) {
755
- this.handlerPromise = this.handlerPromise.then(h => {
756
- return this.updateHandler(h);
757
- });
758
- // set to undefined to avoid recursive loop in the handler getter
759
- return (this.handler = undefined);
760
- } else if (handler) {
761
- return this.updateHandler(handler);
762
- }
763
- }
764
-
765
- log(payload, message) {
766
- if (payload.log) {
767
- payload.log(this.name + ': ' + message);
768
- }
769
- }
770
-
771
- promiseLabel(label) {
772
- return promiseLabel("'" + this.name + "' " + label);
773
- }
774
-
775
- getUnresolved() {
776
- return this;
777
- }
778
-
779
- serialize() {
780
- return this.params || {};
781
- }
782
-
783
- updateHandler(handler) {
784
- // Store the name of the handler on the handler for easy checks later
785
- handler._handlerName = this.name;
786
- return (this.handler = handler);
787
- }
788
-
789
- resolve(shouldContinue, payload) {
790
- let checkForAbort = this.checkForAbort.bind(this, shouldContinue);
791
- let beforeModel = this.runBeforeModelHook.bind(this, payload);
792
- let model = this.getModel.bind(this, payload);
793
- let afterModel = this.runAfterModelHook.bind(this, payload);
794
- let becomeResolved = this.becomeResolved.bind(this, payload);
795
-
796
- return Promise.resolve(
797
- this.handlerPromise,
798
- this.promiseLabel('Start handler')
799
- )
800
- .then(checkForAbort, null, this.promiseLabel('Check for abort'))
801
- .then(beforeModel, null, this.promiseLabel('Before model'))
802
- .then(
803
- checkForAbort,
804
- null,
805
- this.promiseLabel("Check if aborted during 'beforeModel' hook")
806
- )
807
- .then(model, null, this.promiseLabel('Model'))
808
- .then(
809
- checkForAbort,
810
- null,
811
- this.promiseLabel("Check if aborted in 'model' hook")
812
- )
813
- .then(afterModel, null, this.promiseLabel('After model'))
814
- .then(
815
- checkForAbort,
816
- null,
817
- this.promiseLabel("Check if aborted in 'afterModel' hook")
818
- )
819
- .then(becomeResolved, null, this.promiseLabel('Become resolved'));
820
- }
821
-
822
- runBeforeModelHook(payload) {
823
- if (payload.trigger) {
824
- payload.trigger(true, 'willResolveModel', payload, this.handler);
825
- }
826
- return this.runSharedModelHook(payload, 'beforeModel', []);
827
- }
828
-
829
- runAfterModelHook(payload, resolvedModel) {
830
- // Stash the resolved model on the payload.
831
- // This makes it possible for users to swap out
832
- // the resolved model in afterModel.
833
- let name = this.name;
834
- this.stashResolvedModel(payload, resolvedModel);
835
-
836
- return this.runSharedModelHook(payload, 'afterModel', [resolvedModel]).then(
837
- function() {
838
- // Ignore the fulfilled value returned from afterModel.
839
- // Return the value stashed in resolvedModels, which
840
- // might have been swapped out in afterModel.
841
- return payload.resolvedModels[name];
842
- },
843
- null,
844
- this.promiseLabel('Ignore fulfillment value and return model value')
845
- );
846
- }
847
-
848
- runSharedModelHook(payload, hookName, args) {
849
- this.log(payload, 'calling ' + hookName + ' hook');
850
-
851
- if (this.queryParams) {
852
- args.push(this.queryParams);
853
- }
854
- args.push(payload);
855
-
856
- var result = applyHook(this.handler, hookName, args);
857
-
858
- if (result && result.isTransition) {
859
- result = null;
860
- }
861
-
862
- return Promise.resolve(
863
- result,
864
- this.promiseLabel('Resolve value returned from one of the model hooks')
865
- );
866
- }
867
-
868
- // overridden by subclasses
869
- getModel() {}
870
-
871
- checkForAbort(shouldContinue, promiseValue) {
872
- return Promise.resolve(
873
- shouldContinue(),
874
- this.promiseLabel('Check for abort')
875
- ).then(
876
- function() {
877
- // We don't care about shouldContinue's resolve value;
878
- // pass along the original value passed to this fn.
879
- return promiseValue;
880
- },
881
- null,
882
- this.promiseLabel('Ignore fulfillment value and continue')
883
- );
884
- }
885
-
886
- stashResolvedModel(payload, resolvedModel) {
887
- payload.resolvedModels = payload.resolvedModels || {};
888
- payload.resolvedModels[this.name] = resolvedModel;
889
- }
890
-
891
- becomeResolved(payload, resolvedContext) {
892
- var params = this.serialize(resolvedContext);
893
-
894
- if (payload) {
895
- this.stashResolvedModel(payload, resolvedContext);
896
- payload.params = payload.params || {};
897
- payload.params[this.name] = params;
898
- }
899
-
900
- var resolution = {
901
- name: this.name,
902
- handler: this.handler,
903
- params: params,
904
- };
905
-
906
- // Don't set a context on the resolution unless we actually have one.
907
- var contextsMatch = resolvedContext === this.context;
908
- if ('context' in this || !contextsMatch) {
909
- resolution.context = resolvedContext;
910
- }
911
-
912
- return this.factory('resolved', resolution);
913
- }
914
-
915
- shouldSupercede(other) {
916
- // Prefer this newer handlerInfo over `other` if:
917
- // 1) The other one doesn't exist
918
- // 2) The names don't match
919
- // 3) This handler has a context that doesn't match
920
- // the other one (or the other one doesn't have one).
921
- // 4) This handler has parameters that don't match the other.
922
- if (!other) {
923
- return true;
924
- }
925
-
926
- var contextsMatch = other.context === this.context;
927
- return (
928
- other.name !== this.name ||
929
- ('context' in this && !contextsMatch) ||
930
- (this.hasOwnProperty('params') && !paramsMatch(this.params, other.params))
931
- );
932
- }
933
-
934
- get handler() {
935
- // _handler could be set to either a handler object or undefined, so we
936
- // compare against a default reference to know when it's been set
937
- if (this._handler !== DEFAULT_HANDLER) {
938
- return this._handler;
939
- }
940
-
941
- return this.fetchHandler();
942
- }
943
-
944
- set handler(handler) {
945
- return (this._handler = handler);
946
- }
947
-
948
- get handlerPromise() {
949
- if (this._handlerPromise !== null) {
950
- return this._handlerPromise;
951
- }
952
-
953
- this.fetchHandler();
954
-
955
- return this._handlerPromise;
956
- }
957
-
958
- set handlerPromise(handlerPromise) {
959
- this._handlerPromise = handlerPromise;
960
-
961
- return handlerPromise;
962
- }
963
- }
964
-
965
- function paramsMatch(a, b) {
966
- if (!a ^ !b) {
967
- // Only one is null.
968
- return false;
969
- }
970
-
971
- if (!a) {
972
- // Both must be null.
973
- return true;
974
- }
975
-
976
- // Note: this assumes that both params have the same
977
- // number of keys, but since we're comparing the
978
- // same handlers, they should.
979
- for (var k in a) {
980
- if (a.hasOwnProperty(k) && a[k] !== b[k]) {
981
- return false;
982
- }
983
- }
984
- return true;
985
- }
986
-
987
- class ResolvedHandlerInfo extends HandlerInfo {
988
- constructor(props) {
989
- super(props);
990
- this.isResolved = true;
991
- }
992
-
993
- resolve(shouldContinue, payload) {
994
- // A ResolvedHandlerInfo just resolved with itself.
995
- if (payload && payload.resolvedModels) {
996
- payload.resolvedModels[this.name] = this.context;
997
- }
998
- return Promise.resolve(this, this.promiseLabel('Resolve'));
999
- }
1000
-
1001
- getUnresolved() {
1002
- return this.factory('param', {
1003
- name: this.name,
1004
- handler: this.handler,
1005
- params: this.params,
1006
- });
1007
- }
1008
- }
1009
-
1010
- class UnresolvedHandlerInfoByObject extends HandlerInfo {
1011
- constructor(props) {
1012
- super(props);
1013
- this.names = this.names || [];
1014
- }
1015
-
1016
- getModel(payload) {
1017
- this.log(payload, this.name + ': resolving provided model');
1018
- return Promise.resolve(this.context);
1019
- }
1020
-
1021
- /**
1022
- @private
1023
-
1024
- Serializes a handler using its custom `serialize` method or
1025
- by a default that looks up the expected property name from
1026
- the dynamic segment.
1027
-
1028
- @param {Object} model the model to be serialized for this handler
1029
- */
1030
- serialize(_model) {
1031
- var model = _model || this.context,
1032
- names = this.names;
1033
-
1034
- var object = {};
1035
- if (isParam(model)) {
1036
- object[names[0]] = model;
1037
- return object;
1038
- }
1039
-
1040
- // Use custom serialize if it exists.
1041
- if (this.serializer) {
1042
- // invoke this.serializer unbound (getSerializer returns a stateless function)
1043
- return this.serializer.call(null, model, names);
1044
- } else if (this.handler && this.handler.serialize) {
1045
- return this.handler.serialize(model, names);
1046
- }
1047
-
1048
- if (names.length !== 1) {
1049
- return;
1050
- }
1051
-
1052
- var name = names[0];
1053
-
1054
- if (/_id$/.test(name)) {
1055
- object[name] = model.id;
1056
- } else {
1057
- object[name] = model;
1058
- }
1059
- return object;
1060
- }
1061
- }
1062
-
1063
- // Generated by URL transitions and non-dynamic route segments in named Transitions.
1064
- class UnresolvedHandlerInfoByParam extends HandlerInfo {
1065
- constructor(props) {
1066
- super(props);
1067
- this.params = this.params || {};
1068
- }
1069
-
1070
- getModel(payload) {
1071
- var fullParams = this.params;
1072
- if (payload && payload.queryParams) {
1073
- fullParams = {};
1074
- merge(fullParams, this.params);
1075
- fullParams.queryParams = payload.queryParams;
1076
- }
1077
-
1078
- var handler = this.handler;
1079
- var hookName =
1080
- resolveHook(handler, 'deserialize') || resolveHook(handler, 'model');
1081
-
1082
- return this.runSharedModelHook(payload, hookName, [fullParams]);
1083
- }
1084
- }
1085
-
1086
- handlerInfoFactory.klasses = {
1087
- resolved: ResolvedHandlerInfo,
1088
- param: UnresolvedHandlerInfoByParam,
1089
- object: UnresolvedHandlerInfoByObject,
1090
- };
1091
-
1092
- function handlerInfoFactory(name, props) {
1093
- let klass = handlerInfoFactory.klasses[name];
1094
- let handlerInfo = new klass(props || {});
1095
- handlerInfo.factory = handlerInfoFactory;
1096
- return handlerInfo;
1097
- }
1098
-
1099
- class NamedTransitionIntent extends TransitionIntent {
1100
- constructor(props) {
1101
- super(props);
1102
-
1103
- this.name = props.name;
1104
- this.pivotHandler = props.pivotHandler;
1105
- this.contexts = props.contexts || [];
1106
- this.queryParams = props.queryParams;
1107
- }
1108
-
1109
- applyToState(
1110
- oldState,
1111
- recognizer,
1112
- getHandler,
1113
- isIntermediate,
1114
- getSerializer
1115
- ) {
1116
- var partitionedArgs = extractQueryParams([this.name].concat(this.contexts)),
1117
- pureArgs = partitionedArgs[0],
1118
- handlers = recognizer.handlersFor(pureArgs[0]);
1119
-
1120
- var targetRouteName = handlers[handlers.length - 1].handler;
1121
-
1122
- return this.applyToHandlers(
1123
- oldState,
1124
- handlers,
1125
- getHandler,
1126
- targetRouteName,
1127
- isIntermediate,
1128
- null,
1129
- getSerializer
1130
- );
1131
- }
1132
-
1133
- applyToHandlers(
1134
- oldState,
1135
- handlers,
1136
- getHandler,
1137
- targetRouteName,
1138
- isIntermediate,
1139
- checkingIfActive,
1140
- getSerializer
1141
- ) {
1142
- var i, len;
1143
- var newState = new TransitionState();
1144
- var objects = this.contexts.slice(0);
1145
-
1146
- var invalidateIndex = handlers.length;
1147
-
1148
- // Pivot handlers are provided for refresh transitions
1149
- if (this.pivotHandler) {
1150
- for (i = 0, len = handlers.length; i < len; ++i) {
1151
- if (handlers[i].handler === this.pivotHandler._handlerName) {
1152
- invalidateIndex = i;
1153
- break;
1154
- }
1155
- }
1156
- }
1157
-
1158
- for (i = handlers.length - 1; i >= 0; --i) {
1159
- var result = handlers[i];
1160
- var name = result.handler;
1161
-
1162
- var oldHandlerInfo = oldState.handlerInfos[i];
1163
- var newHandlerInfo = null;
1164
-
1165
- if (result.names.length > 0) {
1166
- if (i >= invalidateIndex) {
1167
- newHandlerInfo = this.createParamHandlerInfo(
1168
- name,
1169
- getHandler,
1170
- result.names,
1171
- objects,
1172
- oldHandlerInfo
1173
- );
1174
- } else {
1175
- var serializer = getSerializer(name);
1176
- newHandlerInfo = this.getHandlerInfoForDynamicSegment(
1177
- name,
1178
- getHandler,
1179
- result.names,
1180
- objects,
1181
- oldHandlerInfo,
1182
- targetRouteName,
1183
- i,
1184
- serializer
1185
- );
1186
- }
1187
- } else {
1188
- // This route has no dynamic segment.
1189
- // Therefore treat as a param-based handlerInfo
1190
- // with empty params. This will cause the `model`
1191
- // hook to be called with empty params, which is desirable.
1192
- newHandlerInfo = this.createParamHandlerInfo(
1193
- name,
1194
- getHandler,
1195
- result.names,
1196
- objects,
1197
- oldHandlerInfo
1198
- );
1199
- }
1200
-
1201
- if (checkingIfActive) {
1202
- // If we're performing an isActive check, we want to
1203
- // serialize URL params with the provided context, but
1204
- // ignore mismatches between old and new context.
1205
- newHandlerInfo = newHandlerInfo.becomeResolved(
1206
- null,
1207
- newHandlerInfo.context
1208
- );
1209
- var oldContext = oldHandlerInfo && oldHandlerInfo.context;
1210
- if (
1211
- result.names.length > 0 &&
1212
- 'context' in oldHandlerInfo &&
1213
- newHandlerInfo.context === oldContext
1214
- ) {
1215
- // If contexts match in isActive test, assume params also match.
1216
- // This allows for flexibility in not requiring that every last
1217
- // handler provide a `serialize` method
1218
- newHandlerInfo.params = oldHandlerInfo && oldHandlerInfo.params;
1219
- }
1220
- newHandlerInfo.context = oldContext;
1221
- }
1222
-
1223
- var handlerToUse = oldHandlerInfo;
1224
- if (
1225
- i >= invalidateIndex ||
1226
- newHandlerInfo.shouldSupercede(oldHandlerInfo)
1227
- ) {
1228
- invalidateIndex = Math.min(i, invalidateIndex);
1229
- handlerToUse = newHandlerInfo;
1230
- }
1231
-
1232
- if (isIntermediate && !checkingIfActive) {
1233
- handlerToUse = handlerToUse.becomeResolved(null, handlerToUse.context);
1234
- }
1235
-
1236
- newState.handlerInfos.unshift(handlerToUse);
1237
- }
1238
-
1239
- if (objects.length > 0) {
1240
- throw new Error(
1241
- 'More context objects were passed than there are dynamic segments for the route: ' +
1242
- targetRouteName
1243
- );
1244
- }
1245
-
1246
- if (!isIntermediate) {
1247
- this.invalidateChildren(newState.handlerInfos, invalidateIndex);
1248
- }
1249
-
1250
- merge(newState.queryParams, this.queryParams || {});
1251
-
1252
- return newState;
1253
- }
1254
-
1255
- invalidateChildren(handlerInfos, invalidateIndex) {
1256
- for (var i = invalidateIndex, l = handlerInfos.length; i < l; ++i) {
1257
- var handlerInfo = handlerInfos[i];
1258
- handlerInfos[i] = handlerInfo.getUnresolved();
1259
- }
1260
- }
1261
-
1262
- getHandlerInfoForDynamicSegment(
1263
- name,
1264
- getHandler,
1265
- names,
1266
- objects,
1267
- oldHandlerInfo,
1268
- targetRouteName,
1269
- i,
1270
- serializer
1271
- ) {
1272
- var objectToUse;
1273
- if (objects.length > 0) {
1274
- // Use the objects provided for this transition.
1275
- objectToUse = objects[objects.length - 1];
1276
- if (isParam(objectToUse)) {
1277
- return this.createParamHandlerInfo(
1278
- name,
1279
- getHandler,
1280
- names,
1281
- objects,
1282
- oldHandlerInfo
1283
- );
1284
- } else {
1285
- objects.pop();
1286
- }
1287
- } else if (oldHandlerInfo && oldHandlerInfo.name === name) {
1288
- // Reuse the matching oldHandlerInfo
1289
- return oldHandlerInfo;
1290
- } else {
1291
- if (this.preTransitionState) {
1292
- var preTransitionHandlerInfo = this.preTransitionState.handlerInfos[i];
1293
- objectToUse =
1294
- preTransitionHandlerInfo && preTransitionHandlerInfo.context;
1295
- } else {
1296
- // Ideally we should throw this error to provide maximal
1297
- // information to the user that not enough context objects
1298
- // were provided, but this proves too cumbersome in Ember
1299
- // in cases where inner template helpers are evaluated
1300
- // before parent helpers un-render, in which cases this
1301
- // error somewhat prematurely fires.
1302
- //throw new Error("Not enough context objects were provided to complete a transition to " + targetRouteName + ". Specifically, the " + name + " route needs an object that can be serialized into its dynamic URL segments [" + names.join(', ') + "]");
1303
- return oldHandlerInfo;
1304
- }
1305
- }
1306
-
1307
- return handlerInfoFactory('object', {
1308
- name: name,
1309
- getHandler: getHandler,
1310
- serializer: serializer,
1311
- context: objectToUse,
1312
- names: names,
1313
- });
1314
- }
1315
-
1316
- createParamHandlerInfo(name, getHandler, names, objects, oldHandlerInfo) {
1317
- var params = {};
1318
-
1319
- // Soak up all the provided string/numbers
1320
- var numNames = names.length;
1321
- while (numNames--) {
1322
- // Only use old params if the names match with the new handler
1323
- var oldParams =
1324
- (oldHandlerInfo &&
1325
- name === oldHandlerInfo.name &&
1326
- oldHandlerInfo.params) ||
1327
- {};
1328
-
1329
- var peek = objects[objects.length - 1];
1330
- var paramName = names[numNames];
1331
- if (isParam(peek)) {
1332
- params[paramName] = '' + objects.pop();
1333
- } else {
1334
- // If we're here, this means only some of the params
1335
- // were string/number params, so try and use a param
1336
- // value from a previous handler.
1337
- if (oldParams.hasOwnProperty(paramName)) {
1338
- params[paramName] = oldParams[paramName];
1339
- } else {
1340
- throw new Error(
1341
- "You didn't provide enough string/numeric parameters to satisfy all of the dynamic segments for route " +
1342
- name
1343
- );
1344
- }
1345
- }
1346
- }
1347
-
1348
- return handlerInfoFactory('param', {
1349
- name: name,
1350
- getHandler: getHandler,
1351
- params: params,
1352
- });
1353
- }
1354
- }
1355
-
1356
- function UnrecognizedURLError(message) {
1357
- if (!(this instanceof UnrecognizedURLError)) {
1358
- return new UnrecognizedURLError(message);
1359
- }
1360
-
1361
- var error = Error.call(this, message);
1362
-
1363
- if (Error.captureStackTrace) {
1364
- Error.captureStackTrace(this, UnrecognizedURLError);
1365
- } else {
1366
- this.stack = error.stack;
1367
- }
1368
-
1369
- this.description = error.description;
1370
- this.fileName = error.fileName;
1371
- this.lineNumber = error.lineNumber;
1372
- this.message = error.message || 'UnrecognizedURL';
1373
- this.name = 'UnrecognizedURLError';
1374
- this.number = error.number;
1375
- this.code = error.code;
1376
- }
1377
-
1378
- UnrecognizedURLError.prototype = Object.create(Error.prototype);
1379
-
1380
- class URLTransitionIntent extends TransitionIntent {
1381
- constructor(props) {
1382
- super(props);
1383
- this.url = props.url;
1384
- }
1385
-
1386
- applyToState(oldState, recognizer, getHandler) {
1387
- var newState = new TransitionState();
1388
-
1389
- var results = recognizer.recognize(this.url),
1390
- i,
1391
- len;
1392
-
1393
- if (!results) {
1394
- throw new UnrecognizedURLError(this.url);
1395
- }
1396
-
1397
- var statesDiffer = false;
1398
- var url = this.url;
1399
-
1400
- // Checks if a handler is accessible by URL. If it is not, an error is thrown.
1401
- // For the case where the handler is loaded asynchronously, the error will be
1402
- // thrown once it is loaded.
1403
- function checkHandlerAccessibility(handler) {
1404
- if (handler && handler.inaccessibleByURL) {
1405
- throw new UnrecognizedURLError(url);
1406
- }
1407
-
1408
- return handler;
1409
- }
1410
-
1411
- for (i = 0, len = results.length; i < len; ++i) {
1412
- var result = results[i];
1413
- var name = result.handler;
1414
- var newHandlerInfo = handlerInfoFactory('param', {
1415
- name: name,
1416
- getHandler: getHandler,
1417
- params: result.params,
1418
- });
1419
- var handler = newHandlerInfo.handler;
1420
-
1421
- if (handler) {
1422
- checkHandlerAccessibility(handler);
1423
- } else {
1424
- // If the hanlder is being loaded asynchronously, check if we can
1425
- // access it after it has resolved
1426
- newHandlerInfo.handlerPromise = newHandlerInfo.handlerPromise.then(
1427
- checkHandlerAccessibility
1428
- );
1429
- }
1430
-
1431
- var oldHandlerInfo = oldState.handlerInfos[i];
1432
- if (statesDiffer || newHandlerInfo.shouldSupercede(oldHandlerInfo)) {
1433
- statesDiffer = true;
1434
- newState.handlerInfos[i] = newHandlerInfo;
1435
- } else {
1436
- newState.handlerInfos[i] = oldHandlerInfo;
1437
- }
1438
- }
1439
-
1440
- merge(newState.queryParams, results.queryParams);
1441
-
1442
- return newState;
1443
- }
1444
- }
1445
-
1446
- var pop = Array.prototype.pop;
1447
-
1448
- class Router {
1449
- constructor(options = {}) {
1450
- this.getHandler = options.getHandler || this.getHandler;
1451
- this.getSerializer = options.getSerializer || this.getSerializer;
1452
- this.updateURL = options.updateURL || this.updateURL;
1453
- this.replaceURL = options.replaceURL || this.replaceURL;
1454
- this.didTransition = options.didTransition || this.didTransition;
1455
- this.willTransition = options.willTransition || this.willTransition;
1456
- this.delegate = options.delegate || this.delegate;
1457
- this.triggerEvent = options.triggerEvent || this.triggerEvent;
1458
- this.log = options.log || this.log;
1459
- this.dslCallBacks = []; // NOTE: set by Ember
1460
-
1461
- this.state = undefined;
1462
- this.activeTransition = undefined;
1463
- this._changedQueryParams = undefined;
1464
- this.oldState = undefined;
1465
- this.currentHandlerInfos = undefined;
1466
- this.currentSequence = 0;
1467
-
1468
- this.recognizer = new RouteRecognizer();
1469
- this.reset();
1470
- }
1471
-
1472
- /**
1473
- The main entry point into the router. The API is essentially
1474
- the same as the `map` method in `route-recognizer`.
1475
-
1476
- This method extracts the String handler at the last `.to()`
1477
- call and uses it as the name of the whole route.
1478
-
1479
- @param {Function} callback
1480
- */
1481
- map(callback) {
1482
- this.recognizer.delegate = this.delegate;
1483
-
1484
- this.recognizer.map(callback, function(recognizer, routes) {
1485
- for (var i = routes.length - 1, proceed = true; i >= 0 && proceed; --i) {
1486
- var route = routes[i];
1487
- recognizer.add(routes, { as: route.handler });
1488
- proceed =
1489
- route.path === '/' ||
1490
- route.path === '' ||
1491
- route.handler.slice(-6) === '.index';
1492
- }
1493
- });
1494
- }
1495
-
1496
- hasRoute(route) {
1497
- return this.recognizer.hasRoute(route);
1498
- }
1499
-
1500
- getHandler() {}
1501
-
1502
- getSerializer() {}
1503
-
1504
- queryParamsTransition(changelist, wasTransitioning, oldState, newState) {
1505
- let router = this;
1506
-
1507
- fireQueryParamDidChange(this, newState, changelist);
1508
-
1509
- if (!wasTransitioning && this.activeTransition) {
1510
- // One of the handlers in queryParamsDidChange
1511
- // caused a transition. Just return that transition.
1512
- return this.activeTransition;
1513
- } else {
1514
- // Running queryParamsDidChange didn't change anything.
1515
- // Just update query params and be on our way.
1516
-
1517
- // We have to return a noop transition that will
1518
- // perform a URL update at the end. This gives
1519
- // the user the ability to set the url update
1520
- // method (default is replaceState).
1521
- let newTransition = new Transition(this);
1522
- newTransition.queryParamsOnly = true;
1523
-
1524
- oldState.queryParams = finalizeQueryParamChange(
1525
- this,
1526
- newState.handlerInfos,
1527
- newState.queryParams,
1528
- newTransition
1529
- );
1530
-
1531
- newTransition.promise = newTransition.promise.then(
1532
- function(result) {
1533
- updateURL(newTransition, oldState, true);
1534
- if (router.didTransition) {
1535
- router.didTransition(router.currentHandlerInfos);
1536
- }
1537
- return result;
1538
- },
1539
- null,
1540
- promiseLabel('Transition complete')
1541
- );
1542
- return newTransition;
1543
- }
1544
- }
1545
-
1546
- // NOTE: this doesn't really belong here, but here
1547
- // it shall remain until our ES6 transpiler can
1548
- // handle cyclical deps.
1549
- transitionByIntent(intent /*, isIntermediate*/) {
1550
- try {
1551
- return getTransitionByIntent.apply(this, arguments);
1552
- } catch (e) {
1553
- return new Transition(this, intent, null, e);
1554
- }
1555
- }
1556
-
1557
- /**
1558
- Clears the current and target route handlers and triggers exit
1559
- on each of them starting at the leaf and traversing up through
1560
- its ancestors.
1561
- */
1562
- reset() {
1563
- if (this.state) {
1564
- forEach(this.state.handlerInfos.slice().reverse(), function(handlerInfo) {
1565
- var handler = handlerInfo.handler;
1566
- callHook(handler, 'exit');
1567
- });
1568
- }
1569
-
1570
- this.oldState = undefined;
1571
- this.state = new TransitionState();
1572
- this.currentHandlerInfos = null;
1573
- }
1574
-
1575
- /**
1576
- var handler = handlerInfo.handler;
1577
- The entry point for handling a change to the URL (usually
1578
- via the back and forward button).
1579
-
1580
- Returns an Array of handlers and the parameters associated
1581
- with those parameters.
1582
-
1583
- @param {String} url a URL to process
1584
-
1585
- @return {Array} an Array of `[handler, parameter]` tuples
1586
- */
1587
- handleURL(...args) {
1588
- // Perform a URL-based transition, but don't change
1589
- // the URL afterward, since it already happened.
1590
- let url = args[0];
1591
- if (url.charAt(0) !== '/') {
1592
- args[0] = '/' + url;
1593
- }
1594
-
1595
- return doTransition(this, args).method(null);
1596
- }
1597
-
1598
- /**
1599
- Hook point for updating the URL.
1600
-
1601
- @param {String} url a URL to update to
1602
- */
1603
- updateURL() {
1604
- throw new Error('updateURL is not implemented');
1605
- }
1606
-
1607
- /**
1608
- Hook point for replacing the current URL, i.e. with replaceState
1609
-
1610
- By default this behaves the same as `updateURL`
1611
-
1612
- @param {String} url a URL to update to
1613
- */
1614
- replaceURL(url) {
1615
- this.updateURL(url);
1616
- }
1617
-
1618
- /**
1619
- Transition into the specified named route.
1620
-
1621
- If necessary, trigger the exit callback on any handlers
1622
- that are no longer represented by the target route.
1623
-
1624
- @param {String} name the name of the route
1625
- */
1626
- transitionTo(/*name*/) {
1627
- return doTransition(this, arguments);
1628
- }
1629
-
1630
- intermediateTransitionTo(/*name*/) {
1631
- return doTransition(this, arguments, true);
1632
- }
1633
-
1634
- refresh(pivotHandler) {
1635
- let previousTransition = this.activeTransition;
1636
- let state = previousTransition ? previousTransition.state : this.state;
1637
- let handlerInfos = state.handlerInfos;
1638
-
1639
- log(this, 'Starting a refresh transition');
1640
- let intent = new NamedTransitionIntent({
1641
- name: handlerInfos[handlerInfos.length - 1].name,
1642
- pivotHandler: pivotHandler || handlerInfos[0].handler,
1643
- contexts: [], // TODO collect contexts...?
1644
- queryParams: this._changedQueryParams || state.queryParams || {},
1645
- });
1646
-
1647
- let newTransition = this.transitionByIntent(intent, false);
1648
-
1649
- // if the previous transition is a replace transition, that needs to be preserved
1650
- if (previousTransition && previousTransition.urlMethod === 'replace') {
1651
- newTransition.method(previousTransition.urlMethod);
1652
- }
1653
-
1654
- return newTransition;
1655
- }
1656
-
1657
- /**
1658
- Identical to `transitionTo` except that the current URL will be replaced
1659
- if possible.
1660
-
1661
- This method is intended primarily for use with `replaceState`.
1662
-
1663
- @param {String} name the name of the route
1664
- */
1665
- replaceWith(/*name*/) {
1666
- return doTransition(this, arguments).method('replace');
1667
- }
1668
-
1669
- /**
1670
- Take a named route and context objects and generate a
1671
- URL.
1672
-
1673
- @param {String} name the name of the route to generate
1674
- a URL for
1675
- @param {...Object} objects a list of objects to serialize
1676
-
1677
- @return {String} a URL
1678
- */
1679
- generate(handlerName) {
1680
- let partitionedArgs = extractQueryParams(slice.call(arguments, 1)),
1681
- suppliedParams = partitionedArgs[0],
1682
- queryParams = partitionedArgs[1];
1683
-
1684
- // Construct a TransitionIntent with the provided params
1685
- // and apply it to the present state of the router.
1686
- let intent = new NamedTransitionIntent({
1687
- name: handlerName,
1688
- contexts: suppliedParams,
1689
- });
1690
- let state = intent.applyToState(
1691
- this.state,
1692
- this.recognizer,
1693
- this.getHandler,
1694
- null,
1695
- this.getSerializer
1696
- );
1697
-
1698
- let params = {};
1699
- for (var i = 0, len = state.handlerInfos.length; i < len; ++i) {
1700
- var handlerInfo = state.handlerInfos[i];
1701
- var handlerParams = handlerInfo.serialize();
1702
- merge(params, handlerParams);
1703
- }
1704
- params.queryParams = queryParams;
1705
-
1706
- return this.recognizer.generate(handlerName, params);
1707
- }
1708
-
1709
- applyIntent(handlerName, contexts) {
1710
- let intent = new NamedTransitionIntent({
1711
- name: handlerName,
1712
- contexts: contexts,
1713
- });
1714
-
1715
- let state =
1716
- (this.activeTransition && this.activeTransition.state) || this.state;
1717
-
1718
- return intent.applyToState(
1719
- state,
1720
- this.recognizer,
1721
- this.getHandler,
1722
- null,
1723
- this.getSerializer
1724
- );
1725
- }
1726
-
1727
- isActiveIntent(handlerName, contexts, queryParams, _state) {
1728
- let state = _state || this.state,
1729
- targetHandlerInfos = state.handlerInfos,
1730
- handlerInfo,
1731
- len;
1732
-
1733
- if (!targetHandlerInfos.length) {
1734
- return false;
1735
- }
1736
-
1737
- let targetHandler = targetHandlerInfos[targetHandlerInfos.length - 1].name;
1738
- let recogHandlers = this.recognizer.handlersFor(targetHandler);
1739
-
1740
- let index = 0;
1741
- for (len = recogHandlers.length; index < len; ++index) {
1742
- handlerInfo = targetHandlerInfos[index];
1743
- if (handlerInfo.name === handlerName) {
1744
- break;
1745
- }
1746
- }
1747
-
1748
- if (index === recogHandlers.length) {
1749
- // The provided route name isn't even in the route hierarchy.
1750
- return false;
1751
- }
1752
-
1753
- let testState = new TransitionState();
1754
- testState.handlerInfos = targetHandlerInfos.slice(0, index + 1);
1755
- recogHandlers = recogHandlers.slice(0, index + 1);
1756
-
1757
- let intent = new NamedTransitionIntent({
1758
- name: targetHandler,
1759
- contexts: contexts,
1760
- });
1761
-
1762
- let newState = intent.applyToHandlers(
1763
- testState,
1764
- recogHandlers,
1765
- this.getHandler,
1766
- targetHandler,
1767
- true,
1768
- true,
1769
- this.getSerializer
1770
- );
1771
-
1772
- let handlersEqual = handlerInfosEqual(
1773
- newState.handlerInfos,
1774
- testState.handlerInfos
1775
- );
1776
- if (!queryParams || !handlersEqual) {
1777
- return handlersEqual;
1778
- }
1779
-
1780
- // Get a hash of QPs that will still be active on new route
1781
- let activeQPsOnNewHandler = {};
1782
- merge(activeQPsOnNewHandler, queryParams);
1783
-
1784
- let activeQueryParams = state.queryParams;
1785
- for (var key in activeQueryParams) {
1786
- if (
1787
- activeQueryParams.hasOwnProperty(key) &&
1788
- activeQPsOnNewHandler.hasOwnProperty(key)
1789
- ) {
1790
- activeQPsOnNewHandler[key] = activeQueryParams[key];
1791
- }
1792
- }
1793
-
1794
- return handlersEqual && !getChangelist(activeQPsOnNewHandler, queryParams);
1795
- }
1796
-
1797
- isActive(handlerName, ...args) {
1798
- let partitionedArgs = extractQueryParams(args);
1799
- return this.isActiveIntent(
1800
- handlerName,
1801
- partitionedArgs[0],
1802
- partitionedArgs[1]
1803
- );
1804
- }
1805
-
1806
- trigger(...args) {
1807
- trigger(this, this.currentHandlerInfos, false, args);
1808
- }
1809
- }
1810
-
1811
- function getTransitionByIntent(intent, isIntermediate) {
1812
- var wasTransitioning = !!this.activeTransition;
1813
- var oldState = wasTransitioning ? this.activeTransition.state : this.state;
1814
- var newTransition;
1815
-
1816
- var newState = intent.applyToState(
1817
- oldState,
1818
- this.recognizer,
1819
- this.getHandler,
1820
- isIntermediate,
1821
- this.getSerializer
1822
- );
1823
- var queryParamChangelist = getChangelist(
1824
- oldState.queryParams,
1825
- newState.queryParams
1826
- );
1827
-
1828
- if (handlerInfosEqual(newState.handlerInfos, oldState.handlerInfos)) {
1829
- // This is a no-op transition. See if query params changed.
1830
- if (queryParamChangelist) {
1831
- newTransition = this.queryParamsTransition(
1832
- queryParamChangelist,
1833
- wasTransitioning,
1834
- oldState,
1835
- newState
1836
- );
1837
- if (newTransition) {
1838
- newTransition.queryParamsOnly = true;
1839
- return newTransition;
1840
- }
1841
- }
1842
-
1843
- // No-op. No need to create a new transition.
1844
- return this.activeTransition || new Transition(this);
1845
- }
1846
-
1847
- if (isIntermediate) {
1848
- setupContexts(this, newState);
1849
- return;
1850
- }
1851
-
1852
- // Create a new transition to the destination route.
1853
- newTransition = new Transition(
1854
- this,
1855
- intent,
1856
- newState,
1857
- undefined,
1858
- this.activeTransition
1859
- );
1860
-
1861
- // transition is to same route with same params, only query params differ.
1862
- // not caught above probably because refresh() has been used
1863
- if (
1864
- handlerInfosSameExceptQueryParams(
1865
- newState.handlerInfos,
1866
- oldState.handlerInfos
1867
- )
1868
- ) {
1869
- newTransition.queryParamsOnly = true;
1870
- }
1871
-
1872
- // Abort and usurp any previously active transition.
1873
- if (this.activeTransition) {
1874
- this.activeTransition.abort();
1875
- }
1876
- this.activeTransition = newTransition;
1877
-
1878
- // Transition promises by default resolve with resolved state.
1879
- // For our purposes, swap out the promise to resolve
1880
- // after the transition has been finalized.
1881
- newTransition.promise = newTransition.promise.then(
1882
- function(result) {
1883
- return finalizeTransition(newTransition, result.state);
1884
- },
1885
- null,
1886
- promiseLabel('Settle transition promise when transition is finalized')
1887
- );
1888
-
1889
- if (!wasTransitioning) {
1890
- notifyExistingHandlers(this, newState, newTransition);
1891
- }
1892
-
1893
- fireQueryParamDidChange(this, newState, queryParamChangelist);
1894
-
1895
- return newTransition;
1896
- }
1897
-
1898
- /**
1899
- @private
1900
-
1901
- Fires queryParamsDidChange event
1902
- */
1903
- function fireQueryParamDidChange(router, newState, queryParamChangelist) {
1904
- // If queryParams changed trigger event
1905
- if (queryParamChangelist) {
1906
- // This is a little hacky but we need some way of storing
1907
- // changed query params given that no activeTransition
1908
- // is guaranteed to have occurred.
1909
- router._changedQueryParams = queryParamChangelist.all;
1910
- trigger(router, newState.handlerInfos, true, [
1911
- 'queryParamsDidChange',
1912
- queryParamChangelist.changed,
1913
- queryParamChangelist.all,
1914
- queryParamChangelist.removed,
1915
- ]);
1916
- router._changedQueryParams = null;
1917
- }
1918
- }
1919
-
1920
- /**
1921
- @private
1922
-
1923
- Takes an Array of `HandlerInfo`s, figures out which ones are
1924
- exiting, entering, or changing contexts, and calls the
1925
- proper handler hooks.
1926
-
1927
- For example, consider the following tree of handlers. Each handler is
1928
- followed by the URL segment it handles.
1929
-
1930
- ```
1931
- |~index ("/")
1932
- | |~posts ("/posts")
1933
- | | |-showPost ("/:id")
1934
- | | |-newPost ("/new")
1935
- | | |-editPost ("/edit")
1936
- | |~about ("/about/:id")
1937
- ```
1938
-
1939
- Consider the following transitions:
1940
-
1941
- 1. A URL transition to `/posts/1`.
1942
- 1. Triggers the `*model` callbacks on the
1943
- `index`, `posts`, and `showPost` handlers
1944
- 2. Triggers the `enter` callback on the same
1945
- 3. Triggers the `setup` callback on the same
1946
- 2. A direct transition to `newPost`
1947
- 1. Triggers the `exit` callback on `showPost`
1948
- 2. Triggers the `enter` callback on `newPost`
1949
- 3. Triggers the `setup` callback on `newPost`
1950
- 3. A direct transition to `about` with a specified
1951
- context object
1952
- 1. Triggers the `exit` callback on `newPost`
1953
- and `posts`
1954
- 2. Triggers the `serialize` callback on `about`
1955
- 3. Triggers the `enter` callback on `about`
1956
- 4. Triggers the `setup` callback on `about`
1957
-
1958
- @param {Router} transition
1959
- @param {TransitionState} newState
1960
- */
1961
- function setupContexts(router, newState, transition) {
1962
- var partition = partitionHandlers(router.state, newState);
1963
- var i, l, handler;
1964
-
1965
- for (i = 0, l = partition.exited.length; i < l; i++) {
1966
- handler = partition.exited[i].handler;
1967
- delete handler.context;
1968
-
1969
- callHook(handler, 'reset', true, transition);
1970
- callHook(handler, 'exit', transition);
1971
- }
1972
-
1973
- var oldState = (router.oldState = router.state);
1974
- router.state = newState;
1975
- var currentHandlerInfos = (router.currentHandlerInfos = partition.unchanged.slice());
1976
-
1977
- try {
1978
- for (i = 0, l = partition.reset.length; i < l; i++) {
1979
- handler = partition.reset[i].handler;
1980
- callHook(handler, 'reset', false, transition);
1981
- }
1982
-
1983
- for (i = 0, l = partition.updatedContext.length; i < l; i++) {
1984
- handlerEnteredOrUpdated(
1985
- currentHandlerInfos,
1986
- partition.updatedContext[i],
1987
- false,
1988
- transition
1989
- );
1990
- }
1991
-
1992
- for (i = 0, l = partition.entered.length; i < l; i++) {
1993
- handlerEnteredOrUpdated(
1994
- currentHandlerInfos,
1995
- partition.entered[i],
1996
- true,
1997
- transition
1998
- );
1999
- }
2000
- } catch (e) {
2001
- router.state = oldState;
2002
- router.currentHandlerInfos = oldState.handlerInfos;
2003
- throw e;
2004
- }
2005
-
2006
- router.state.queryParams = finalizeQueryParamChange(
2007
- router,
2008
- currentHandlerInfos,
2009
- newState.queryParams,
2010
- transition
2011
- );
2012
- }
2013
-
2014
- /**
2015
- @private
2016
-
2017
- Helper method used by setupContexts. Handles errors or redirects
2018
- that may happen in enter/setup.
2019
- */
2020
- function handlerEnteredOrUpdated(
2021
- currentHandlerInfos,
2022
- handlerInfo,
2023
- enter,
2024
- transition
2025
- ) {
2026
- var handler = handlerInfo.handler,
2027
- context = handlerInfo.context;
2028
-
2029
- function _handlerEnteredOrUpdated(handler) {
2030
- if (enter) {
2031
- callHook(handler, 'enter', transition);
2032
- }
2033
-
2034
- if (transition && transition.isAborted) {
2035
- throw new TransitionAbortedError();
2036
- }
2037
-
2038
- handler.context = context;
2039
- callHook(handler, 'contextDidChange');
2040
-
2041
- callHook(handler, 'setup', context, transition);
2042
- if (transition && transition.isAborted) {
2043
- throw new TransitionAbortedError();
2044
- }
2045
-
2046
- currentHandlerInfos.push(handlerInfo);
2047
- }
2048
-
2049
- // If the handler doesn't exist, it means we haven't resolved the handler promise yet
2050
- if (!handler) {
2051
- handlerInfo.handlerPromise = handlerInfo.handlerPromise.then(
2052
- _handlerEnteredOrUpdated
2053
- );
2054
- } else {
2055
- _handlerEnteredOrUpdated(handler);
2056
- }
2057
-
2058
- return true;
2059
- }
2060
-
2061
- /**
2062
- @private
2063
-
2064
- This function is called when transitioning from one URL to
2065
- another to determine which handlers are no longer active,
2066
- which handlers are newly active, and which handlers remain
2067
- active but have their context changed.
2068
-
2069
- Take a list of old handlers and new handlers and partition
2070
- them into four buckets:
2071
-
2072
- * unchanged: the handler was active in both the old and
2073
- new URL, and its context remains the same
2074
- * updated context: the handler was active in both the
2075
- old and new URL, but its context changed. The handler's
2076
- `setup` method, if any, will be called with the new
2077
- context.
2078
- * exited: the handler was active in the old URL, but is
2079
- no longer active.
2080
- * entered: the handler was not active in the old URL, but
2081
- is now active.
2082
-
2083
- The PartitionedHandlers structure has four fields:
2084
-
2085
- * `updatedContext`: a list of `HandlerInfo` objects that
2086
- represent handlers that remain active but have a changed
2087
- context
2088
- * `entered`: a list of `HandlerInfo` objects that represent
2089
- handlers that are newly active
2090
- * `exited`: a list of `HandlerInfo` objects that are no
2091
- longer active.
2092
- * `unchanged`: a list of `HanderInfo` objects that remain active.
2093
-
2094
- @param {Array[HandlerInfo]} oldHandlers a list of the handler
2095
- information for the previous URL (or `[]` if this is the
2096
- first handled transition)
2097
- @param {Array[HandlerInfo]} newHandlers a list of the handler
2098
- information for the new URL
2099
-
2100
- @return {Partition}
2101
- */
2102
- function partitionHandlers(oldState, newState) {
2103
- var oldHandlers = oldState.handlerInfos;
2104
- var newHandlers = newState.handlerInfos;
2105
-
2106
- var handlers = {
2107
- updatedContext: [],
2108
- exited: [],
2109
- entered: [],
2110
- unchanged: [],
2111
- reset: undefined,
2112
- };
2113
-
2114
- var handlerChanged,
2115
- contextChanged = false,
2116
- i,
2117
- l;
2118
-
2119
- for (i = 0, l = newHandlers.length; i < l; i++) {
2120
- var oldHandler = oldHandlers[i],
2121
- newHandler = newHandlers[i];
2122
-
2123
- if (!oldHandler || oldHandler.handler !== newHandler.handler) {
2124
- handlerChanged = true;
2125
- }
2126
-
2127
- if (handlerChanged) {
2128
- handlers.entered.push(newHandler);
2129
- if (oldHandler) {
2130
- handlers.exited.unshift(oldHandler);
2131
- }
2132
- } else if (contextChanged || oldHandler.context !== newHandler.context) {
2133
- contextChanged = true;
2134
- handlers.updatedContext.push(newHandler);
2135
- } else {
2136
- handlers.unchanged.push(oldHandler);
2137
- }
2138
- }
2139
-
2140
- for (i = newHandlers.length, l = oldHandlers.length; i < l; i++) {
2141
- handlers.exited.unshift(oldHandlers[i]);
2142
- }
2143
-
2144
- handlers.reset = handlers.updatedContext.slice();
2145
- handlers.reset.reverse();
2146
-
2147
- return handlers;
2148
- }
2149
-
2150
- function updateURL(transition, state /*, inputUrl*/) {
2151
- var urlMethod = transition.urlMethod;
2152
-
2153
- if (!urlMethod) {
2154
- return;
2155
- }
2156
-
2157
- var router = transition.router,
2158
- handlerInfos = state.handlerInfos,
2159
- handlerName = handlerInfos[handlerInfos.length - 1].name,
2160
- params = {};
2161
-
2162
- for (var i = handlerInfos.length - 1; i >= 0; --i) {
2163
- var handlerInfo = handlerInfos[i];
2164
- merge(params, handlerInfo.params);
2165
- if (handlerInfo.handler.inaccessibleByURL) {
2166
- urlMethod = null;
2167
- }
2168
- }
2169
-
2170
- if (urlMethod) {
2171
- params.queryParams = transition._visibleQueryParams || state.queryParams;
2172
- var url = router.recognizer.generate(handlerName, params);
2173
-
2174
- // transitions during the initial transition must always use replaceURL.
2175
- // When the app boots, you are at a url, e.g. /foo. If some handler
2176
- // redirects to bar as part of the initial transition, you don't want to
2177
- // add a history entry for /foo. If you do, pressing back will immediately
2178
- // hit the redirect again and take you back to /bar, thus killing the back
2179
- // button
2180
- var initial = transition.isCausedByInitialTransition;
2181
-
2182
- // say you are at / and you click a link to route /foo. In /foo's
2183
- // handler, the transition is aborted using replacewith('/bar').
2184
- // Because the current url is still /, the history entry for / is
2185
- // removed from the history. Clicking back will take you to the page
2186
- // you were on before /, which is often not even the app, thus killing
2187
- // the back button. That's why updateURL is always correct for an
2188
- // aborting transition that's not the initial transition
2189
- var replaceAndNotAborting =
2190
- urlMethod === 'replace' && !transition.isCausedByAbortingTransition;
2191
-
2192
- // because calling refresh causes an aborted transition, this needs to be
2193
- // special cased - if the initial transition is a replace transition, the
2194
- // urlMethod should be honored here.
2195
- var isQueryParamsRefreshTransition =
2196
- transition.queryParamsOnly && urlMethod === 'replace';
2197
-
2198
- // say you are at / and you a `replaceWith(/foo)` is called. Then, that
2199
- // transition is aborted with `replaceWith(/bar)`. At the end, we should
2200
- // end up with /bar replacing /. We are replacing the replace. We only
2201
- // will replace the initial route if all subsequent aborts are also
2202
- // replaces. However, there is some ambiguity around the correct behavior
2203
- // here.
2204
- var replacingReplace =
2205
- urlMethod === 'replace' && transition.isCausedByAbortingReplaceTransition;
2206
-
2207
- if (
2208
- initial ||
2209
- replaceAndNotAborting ||
2210
- isQueryParamsRefreshTransition ||
2211
- replacingReplace
2212
- ) {
2213
- router.replaceURL(url);
2214
- } else {
2215
- router.updateURL(url);
2216
- }
2217
- }
2218
- }
2219
-
2220
- /**
2221
- @private
2222
-
2223
- Updates the URL (if necessary) and calls `setupContexts`
2224
- to update the router's array of `currentHandlerInfos`.
2225
- */
2226
- function finalizeTransition(transition, newState) {
2227
- try {
2228
- log(
2229
- transition.router,
2230
- transition.sequence,
2231
- 'Resolved all models on destination route; finalizing transition.'
2232
- );
2233
-
2234
- var router = transition.router,
2235
- handlerInfos = newState.handlerInfos;
2236
-
2237
- // Run all the necessary enter/setup/exit hooks
2238
- setupContexts(router, newState, transition);
2239
-
2240
- // Check if a redirect occurred in enter/setup
2241
- if (transition.isAborted) {
2242
- // TODO: cleaner way? distinguish b/w targetHandlerInfos?
2243
- router.state.handlerInfos = router.currentHandlerInfos;
2244
- return Promise.reject(logAbort(transition));
2245
- }
2246
-
2247
- updateURL(transition, newState, transition.intent.url);
2248
-
2249
- transition.isActive = false;
2250
- router.activeTransition = null;
2251
-
2252
- trigger(router, router.currentHandlerInfos, true, ['didTransition']);
2253
-
2254
- if (router.didTransition) {
2255
- router.didTransition(router.currentHandlerInfos);
2256
- }
2257
-
2258
- log(router, transition.sequence, 'TRANSITION COMPLETE.');
2259
-
2260
- // Resolve with the final handler.
2261
- return handlerInfos[handlerInfos.length - 1].handler;
2262
- } catch (e) {
2263
- if (!(e instanceof TransitionAbortedError)) {
2264
- //var erroneousHandler = handlerInfos.pop();
2265
- var infos = transition.state.handlerInfos;
2266
- transition.trigger(
2267
- true,
2268
- 'error',
2269
- e,
2270
- transition,
2271
- infos[infos.length - 1].handler
2272
- );
2273
- transition.abort();
2274
- }
2275
-
2276
- throw e;
2277
- }
2278
- }
2279
-
2280
- /**
2281
- @private
2282
-
2283
- Begins and returns a Transition based on the provided
2284
- arguments. Accepts arguments in the form of both URL
2285
- transitions and named transitions.
2286
-
2287
- @param {Router} router
2288
- @param {Array[Object]} args arguments passed to transitionTo,
2289
- replaceWith, or handleURL
2290
- */
2291
- function doTransition(router, args, isIntermediate) {
2292
- // Normalize blank transitions to root URL transitions.
2293
- var name = args[0] || '/';
2294
-
2295
- var lastArg = args[args.length - 1];
2296
- var queryParams = {};
2297
- if (lastArg && lastArg.hasOwnProperty('queryParams')) {
2298
- queryParams = pop.call(args).queryParams;
2299
- }
2300
-
2301
- var intent;
2302
- if (args.length === 0) {
2303
- log(router, 'Updating query params');
2304
-
2305
- // A query param update is really just a transition
2306
- // into the route you're already on.
2307
- var handlerInfos = router.state.handlerInfos;
2308
- intent = new NamedTransitionIntent({
2309
- name: handlerInfos[handlerInfos.length - 1].name,
2310
- contexts: [],
2311
- queryParams: queryParams,
2312
- });
2313
- } else if (name.charAt(0) === '/') {
2314
- log(router, 'Attempting URL transition to ' + name);
2315
- intent = new URLTransitionIntent({ url: name });
2316
- } else {
2317
- log(router, 'Attempting transition to ' + name);
2318
- intent = new NamedTransitionIntent({
2319
- name: args[0],
2320
- contexts: slice.call(args, 1),
2321
- queryParams: queryParams,
2322
- });
2323
- }
2324
-
2325
- return router.transitionByIntent(intent, isIntermediate);
2326
- }
2327
-
2328
- function handlerInfosEqual(handlerInfos, otherHandlerInfos) {
2329
- if (handlerInfos.length !== otherHandlerInfos.length) {
2330
- return false;
2331
- }
2332
-
2333
- for (var i = 0, len = handlerInfos.length; i < len; ++i) {
2334
- if (handlerInfos[i] !== otherHandlerInfos[i]) {
2335
- return false;
2336
- }
2337
- }
2338
- return true;
2339
- }
2340
-
2341
- function handlerInfosSameExceptQueryParams(handlerInfos, otherHandlerInfos) {
2342
- if (handlerInfos.length !== otherHandlerInfos.length) {
2343
- return false;
2344
- }
2345
-
2346
- for (var i = 0, len = handlerInfos.length; i < len; ++i) {
2347
- if (handlerInfos[i].name !== otherHandlerInfos[i].name) {
2348
- return false;
2349
- }
2350
-
2351
- if (!paramsEqual(handlerInfos[i].params, otherHandlerInfos[i].params)) {
2352
- return false;
2353
- }
2354
- }
2355
- return true;
2356
- }
2357
-
2358
- function paramsEqual(params, otherParams) {
2359
- if (!params && !otherParams) {
2360
- return true;
2361
- } else if ((!params && !!otherParams) || (!!params && !otherParams)) {
2362
- // one is falsy but other is not;
2363
- return false;
2364
- }
2365
- var keys = Object.keys(params);
2366
- var otherKeys = Object.keys(otherParams);
2367
-
2368
- if (keys.length !== otherKeys.length) {
2369
- return false;
2370
- }
2371
-
2372
- for (var i = 0, len = keys.length; i < len; ++i) {
2373
- var key = keys[i];
2374
-
2375
- if (params[key] !== otherParams[key]) {
2376
- return false;
2377
- }
2378
- }
2379
-
2380
- return true;
2381
- }
2382
-
2383
- function finalizeQueryParamChange(
2384
- router,
2385
- resolvedHandlers,
2386
- newQueryParams,
2387
- transition
2388
- ) {
2389
- // We fire a finalizeQueryParamChange event which
2390
- // gives the new route hierarchy a chance to tell
2391
- // us which query params it's consuming and what
2392
- // their final values are. If a query param is
2393
- // no longer consumed in the final route hierarchy,
2394
- // its serialized segment will be removed
2395
- // from the URL.
2396
-
2397
- for (var k in newQueryParams) {
2398
- if (newQueryParams.hasOwnProperty(k) && newQueryParams[k] === null) {
2399
- delete newQueryParams[k];
2400
- }
2401
- }
2402
-
2403
- var finalQueryParamsArray = [];
2404
- trigger(router, resolvedHandlers, true, [
2405
- 'finalizeQueryParamChange',
2406
- newQueryParams,
2407
- finalQueryParamsArray,
2408
- transition,
2409
- ]);
2410
-
2411
- if (transition) {
2412
- transition._visibleQueryParams = {};
2413
- }
2414
-
2415
- var finalQueryParams = {};
2416
- for (var i = 0, len = finalQueryParamsArray.length; i < len; ++i) {
2417
- var qp = finalQueryParamsArray[i];
2418
- finalQueryParams[qp.key] = qp.value;
2419
- if (transition && qp.visible !== false) {
2420
- transition._visibleQueryParams[qp.key] = qp.value;
2421
- }
2422
- }
2423
- return finalQueryParams;
2424
- }
2425
-
2426
- function notifyExistingHandlers(router, newState, newTransition) {
2427
- var oldHandlers = router.state.handlerInfos,
2428
- i,
2429
- oldHandlerLen,
2430
- oldHandler,
2431
- newHandler;
2432
-
2433
- oldHandlerLen = oldHandlers.length;
2434
- for (i = 0; i < oldHandlerLen; i++) {
2435
- oldHandler = oldHandlers[i];
2436
- newHandler = newState.handlerInfos[i];
2437
-
2438
- if (!newHandler || oldHandler.name !== newHandler.name) {
2439
- break;
2440
- }
2441
-
2442
- if (!newHandler.isResolved) {
2443
- }
2444
- }
2445
-
2446
- trigger(router, oldHandlers, true, ['willTransition', newTransition]);
2447
-
2448
- if (router.willTransition) {
2449
- router.willTransition(oldHandlers, newState.handlerInfos, newTransition);
2450
- }
2451
- }
2452
-
2453
- export default Router;
2454
- export { Transition };