unpoly-rails 0.61.0 → 2.0.0.pre.rc3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of unpoly-rails might be problematic. Click here for more details.

Files changed (340) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/CHANGELOG.md +94 -1
  4. data/README.md +3 -11
  5. data/README_RAILS.md +295 -14
  6. data/dist/unpoly-bootstrap3.css +9 -14
  7. data/dist/unpoly-bootstrap3.js +4 -18
  8. data/dist/unpoly-bootstrap3.min.css +1 -1
  9. data/dist/unpoly-bootstrap3.min.js +1 -1
  10. data/dist/unpoly-bootstrap4.css +9 -0
  11. data/dist/unpoly-bootstrap4.js +16 -0
  12. data/dist/unpoly-bootstrap4.min.css +1 -0
  13. data/dist/unpoly-bootstrap4.min.js +1 -0
  14. data/dist/unpoly-bootstrap5.css +9 -0
  15. data/dist/unpoly-bootstrap5.js +14 -0
  16. data/dist/unpoly-bootstrap5.min.css +1 -0
  17. data/dist/unpoly-bootstrap5.min.js +1 -0
  18. data/dist/unpoly-migrate.js +1213 -0
  19. data/dist/unpoly-migrate.min.js +1 -0
  20. data/dist/unpoly.css +109 -140
  21. data/dist/unpoly.js +15439 -10434
  22. data/dist/unpoly.min.css +1 -1
  23. data/dist/unpoly.min.js +6 -4
  24. data/lib/unpoly-rails.rb +9 -3
  25. data/lib/unpoly/rails/change.rb +372 -0
  26. data/lib/unpoly/rails/change/cache.rb +26 -0
  27. data/lib/unpoly/rails/change/context.rb +80 -0
  28. data/lib/unpoly/rails/change/field.rb +117 -0
  29. data/lib/unpoly/rails/change/field_definition.rb +74 -0
  30. data/lib/unpoly/rails/change/layer.rb +60 -0
  31. data/lib/unpoly/rails/controller.rb +47 -0
  32. data/lib/unpoly/rails/error.rb +5 -0
  33. data/lib/unpoly/rails/request_echo_headers.rb +2 -2
  34. data/lib/unpoly/rails/version.rb +1 -1
  35. data/lib/unpoly/tasks.rb +45 -0
  36. metadata +43 -314
  37. data/.gitignore +0 -10
  38. data/.ruby-version +0 -2
  39. data/Gemfile +0 -8
  40. data/Gemfile.lock +0 -45
  41. data/Rakefile +0 -144
  42. data/bower.json +0 -27
  43. data/design/animation-ghosting.txt +0 -72
  44. data/design/design.txt +0 -34
  45. data/design/draft.html.erb +0 -48
  46. data/design/draft.rb +0 -9
  47. data/design/es6.js +0 -32
  48. data/design/ghost-debugging.txt +0 -118
  49. data/design/homepage.txt +0 -236
  50. data/design/ie11.txt +0 -9
  51. data/design/measure_import_node.js +0 -330
  52. data/design/measure_jquery/element_list.js +0 -41
  53. data/design/measure_jquery/up.on_vs_addEventListener.js +0 -56
  54. data/design/positioning.txt +0 -28
  55. data/design/query-params-in-form-actions/cases.html +0 -125
  56. data/design/rename.txt +0 -0
  57. data/design/test_rejected_promise.txt +0 -5
  58. data/design/unpoly errors.txt +0 -19
  59. data/lib/assets/javascripts/unpoly-bootstrap3.coffee +0 -2
  60. data/lib/assets/javascripts/unpoly-bootstrap3/feedback-ext.coffee +0 -5
  61. data/lib/assets/javascripts/unpoly-bootstrap3/form-ext.coffee +0 -1
  62. data/lib/assets/javascripts/unpoly-bootstrap3/modal-ext.coffee +0 -14
  63. data/lib/assets/javascripts/unpoly-bootstrap3/viewport-ext.coffee +0 -5
  64. data/lib/assets/javascripts/unpoly.coffee +0 -28
  65. data/lib/assets/javascripts/unpoly/browser.coffee.erb +0 -236
  66. data/lib/assets/javascripts/unpoly/classes/body_shifter.coffee +0 -36
  67. data/lib/assets/javascripts/unpoly/classes/cache.coffee +0 -127
  68. data/lib/assets/javascripts/unpoly/classes/compile_pass.coffee +0 -93
  69. data/lib/assets/javascripts/unpoly/classes/config.coffee +0 -9
  70. data/lib/assets/javascripts/unpoly/classes/css_transition.coffee +0 -118
  71. data/lib/assets/javascripts/unpoly/classes/divertible_chain.coffee +0 -39
  72. data/lib/assets/javascripts/unpoly/classes/event_listener.coffee +0 -116
  73. data/lib/assets/javascripts/unpoly/classes/extract_cascade.coffee +0 -86
  74. data/lib/assets/javascripts/unpoly/classes/extract_plan.coffee +0 -111
  75. data/lib/assets/javascripts/unpoly/classes/field_observer.coffee +0 -80
  76. data/lib/assets/javascripts/unpoly/classes/focus_follower.coffee +0 -29
  77. data/lib/assets/javascripts/unpoly/classes/follow_variant.coffee +0 -56
  78. data/lib/assets/javascripts/unpoly/classes/html_parser.coffee +0 -46
  79. data/lib/assets/javascripts/unpoly/classes/motion_controller.coffee +0 -157
  80. data/lib/assets/javascripts/unpoly/classes/params.coffee.erb +0 -543
  81. data/lib/assets/javascripts/unpoly/classes/record.coffee +0 -22
  82. data/lib/assets/javascripts/unpoly/classes/rect.js +0 -21
  83. data/lib/assets/javascripts/unpoly/classes/request.coffee +0 -246
  84. data/lib/assets/javascripts/unpoly/classes/response.coffee +0 -157
  85. data/lib/assets/javascripts/unpoly/classes/reveal_motion.coffee +0 -102
  86. data/lib/assets/javascripts/unpoly/classes/scroll_motion.coffee +0 -67
  87. data/lib/assets/javascripts/unpoly/classes/selector.coffee +0 -60
  88. data/lib/assets/javascripts/unpoly/classes/store/memory.coffee +0 -26
  89. data/lib/assets/javascripts/unpoly/classes/store/session.coffee +0 -59
  90. data/lib/assets/javascripts/unpoly/classes/tether.coffee +0 -105
  91. data/lib/assets/javascripts/unpoly/classes/url_set.coffee +0 -32
  92. data/lib/assets/javascripts/unpoly/cookie.coffee +0 -56
  93. data/lib/assets/javascripts/unpoly/element.coffee.erb +0 -1126
  94. data/lib/assets/javascripts/unpoly/event.coffee.erb +0 -438
  95. data/lib/assets/javascripts/unpoly/feedback.coffee +0 -353
  96. data/lib/assets/javascripts/unpoly/form.coffee.erb +0 -1032
  97. data/lib/assets/javascripts/unpoly/fragment.coffee.erb +0 -924
  98. data/lib/assets/javascripts/unpoly/framework.coffee +0 -67
  99. data/lib/assets/javascripts/unpoly/history.coffee +0 -268
  100. data/lib/assets/javascripts/unpoly/legacy.coffee +0 -60
  101. data/lib/assets/javascripts/unpoly/link.coffee.erb +0 -622
  102. data/lib/assets/javascripts/unpoly/log.coffee +0 -248
  103. data/lib/assets/javascripts/unpoly/modal.coffee.erb +0 -825
  104. data/lib/assets/javascripts/unpoly/motion.coffee.erb +0 -668
  105. data/lib/assets/javascripts/unpoly/namespace.coffee.erb +0 -5
  106. data/lib/assets/javascripts/unpoly/popup.coffee.erb +0 -515
  107. data/lib/assets/javascripts/unpoly/protocol.coffee +0 -298
  108. data/lib/assets/javascripts/unpoly/proxy.coffee +0 -672
  109. data/lib/assets/javascripts/unpoly/radio.coffee +0 -60
  110. data/lib/assets/javascripts/unpoly/rails.coffee +0 -24
  111. data/lib/assets/javascripts/unpoly/syntax.coffee.erb +0 -477
  112. data/lib/assets/javascripts/unpoly/toast.coffee +0 -67
  113. data/lib/assets/javascripts/unpoly/tooltip.coffee +0 -276
  114. data/lib/assets/javascripts/unpoly/util.coffee.erb +0 -1676
  115. data/lib/assets/javascripts/unpoly/viewport.coffee.erb +0 -806
  116. data/lib/assets/stylesheets/unpoly-bootstrap3.sass +0 -1
  117. data/lib/assets/stylesheets/unpoly-bootstrap3/modal-ext.sass +0 -27
  118. data/lib/assets/stylesheets/unpoly.sass +0 -1
  119. data/lib/assets/stylesheets/unpoly/close.sass +0 -2
  120. data/lib/assets/stylesheets/unpoly/dom.sass +0 -5
  121. data/lib/assets/stylesheets/unpoly/layout.sass +0 -2
  122. data/lib/assets/stylesheets/unpoly/link.sass +0 -2
  123. data/lib/assets/stylesheets/unpoly/modal.sass +0 -116
  124. data/lib/assets/stylesheets/unpoly/popup.sass +0 -7
  125. data/lib/assets/stylesheets/unpoly/toast.sass +0 -33
  126. data/lib/assets/stylesheets/unpoly/tooltip.sass +0 -62
  127. data/lib/unpoly/rails/inspector.rb +0 -149
  128. data/lib/unpoly/rails/inspector_accessor.rb +0 -30
  129. data/package.json +0 -38
  130. data/spec_app/.firefox-version +0 -1
  131. data/spec_app/.gitignore +0 -17
  132. data/spec_app/.rspec +0 -2
  133. data/spec_app/Gemfile +0 -32
  134. data/spec_app/Gemfile.lock +0 -233
  135. data/spec_app/README.rdoc +0 -28
  136. data/spec_app/Rakefile +0 -6
  137. data/spec_app/app/assets/images/.keep +0 -0
  138. data/spec_app/app/assets/images/favicon.png +0 -0
  139. data/spec_app/app/assets/images/grid.png +0 -0
  140. data/spec_app/app/assets/javascripts/bootstrap_manifest.coffee +0 -6
  141. data/spec_app/app/assets/javascripts/integration_test.coffee +0 -6
  142. data/spec_app/app/assets/javascripts/jasmine_specs.coffee +0 -6
  143. data/spec_app/app/assets/stylesheets/_helpers.sass +0 -5
  144. data/spec_app/app/assets/stylesheets/bootstrap_manifest.sass +0 -2
  145. data/spec_app/app/assets/stylesheets/integration_test.sass +0 -88
  146. data/spec_app/app/assets/stylesheets/jasmine_specs.sass +0 -20
  147. data/spec_app/app/controllers/application_controller.rb +0 -14
  148. data/spec_app/app/controllers/binding_test_controller.rb +0 -51
  149. data/spec_app/app/controllers/compiler_test_controller.rb +0 -5
  150. data/spec_app/app/controllers/css_test_controller.rb +0 -5
  151. data/spec_app/app/controllers/error_test_controller.rb +0 -5
  152. data/spec_app/app/controllers/form_test/basics_controller.rb +0 -14
  153. data/spec_app/app/controllers/form_test/redirects_controller.rb +0 -17
  154. data/spec_app/app/controllers/form_test/uploads_controller.rb +0 -15
  155. data/spec_app/app/controllers/hash_test_controller.rb +0 -5
  156. data/spec_app/app/controllers/method_test_controller.rb +0 -16
  157. data/spec_app/app/controllers/motion_test_controller.rb +0 -5
  158. data/spec_app/app/controllers/pages_controller.rb +0 -9
  159. data/spec_app/app/controllers/replace_test_controller.rb +0 -5
  160. data/spec_app/app/controllers/reveal_test_controller.rb +0 -5
  161. data/spec_app/app/controllers/scroll_test_controller.rb +0 -5
  162. data/spec_app/app/helpers/application_helper.rb +0 -2
  163. data/spec_app/app/mailers/.keep +0 -0
  164. data/spec_app/app/models/concerns/.keep +0 -0
  165. data/spec_app/app/views/compiler_test/timestamp.erb +0 -9
  166. data/spec_app/app/views/css_test/modal.erb +0 -47
  167. data/spec_app/app/views/css_test/modal_contents.erb +0 -5
  168. data/spec_app/app/views/css_test/modal_contents_wide.erb +0 -5
  169. data/spec_app/app/views/css_test/popup.erb +0 -81
  170. data/spec_app/app/views/css_test/popup_contents.erb +0 -5
  171. data/spec_app/app/views/css_test/tooltip.erb +0 -48
  172. data/spec_app/app/views/error_test/trigger.erb +0 -80
  173. data/spec_app/app/views/error_test/unexpected_response.erb +0 -3
  174. data/spec_app/app/views/form_test/basics/new.erb +0 -60
  175. data/spec_app/app/views/form_test/redirects/new.erb +0 -27
  176. data/spec_app/app/views/form_test/redirects/target.erb +0 -4
  177. data/spec_app/app/views/form_test/submission_result.erb +0 -30
  178. data/spec_app/app/views/form_test/uploads/new.erb +0 -44
  179. data/spec_app/app/views/hash_test/unpoly.erb +0 -30
  180. data/spec_app/app/views/hash_test/vanilla.erb +0 -13
  181. data/spec_app/app/views/layouts/integration_test.erb +0 -22
  182. data/spec_app/app/views/layouts/jasmine_rails/spec_runner.html.erb +0 -20
  183. data/spec_app/app/views/method_test/form_target.erb +0 -17
  184. data/spec_app/app/views/method_test/page1.erb +0 -11
  185. data/spec_app/app/views/method_test/page2.erb +0 -6
  186. data/spec_app/app/views/motion_test/animations.erb +0 -16
  187. data/spec_app/app/views/motion_test/transitions.erb +0 -13
  188. data/spec_app/app/views/pages/start.erb +0 -79
  189. data/spec_app/app/views/replace_test/_nav.erb +0 -6
  190. data/spec_app/app/views/replace_test/page1.erb +0 -14
  191. data/spec_app/app/views/replace_test/page2.erb +0 -14
  192. data/spec_app/app/views/replace_test/table.erb +0 -16
  193. data/spec_app/app/views/reveal_test/long1.erb +0 -17
  194. data/spec_app/app/views/reveal_test/long2.erb +0 -17
  195. data/spec_app/app/views/reveal_test/within_document_viewport.erb +0 -24
  196. data/spec_app/app/views/reveal_test/within_overflowing_div_viewport.erb +0 -28
  197. data/spec_app/app/views/scroll_test/long1.erb +0 -30
  198. data/spec_app/bin/bundle +0 -3
  199. data/spec_app/bin/rails +0 -8
  200. data/spec_app/bin/rake +0 -8
  201. data/spec_app/bin/setup +0 -29
  202. data/spec_app/bin/spring +0 -18
  203. data/spec_app/config.ru +0 -4
  204. data/spec_app/config/application.rb +0 -28
  205. data/spec_app/config/boot.rb +0 -3
  206. data/spec_app/config/database.yml +0 -25
  207. data/spec_app/config/environment.rb +0 -5
  208. data/spec_app/config/environments/development.rb +0 -41
  209. data/spec_app/config/environments/production.rb +0 -79
  210. data/spec_app/config/environments/test.rb +0 -42
  211. data/spec_app/config/initializers/assets.rb +0 -19
  212. data/spec_app/config/initializers/backtrace_silencers.rb +0 -7
  213. data/spec_app/config/initializers/bower_rails.rb +0 -16
  214. data/spec_app/config/initializers/cookies_serializer.rb +0 -3
  215. data/spec_app/config/initializers/filter_parameter_logging.rb +0 -4
  216. data/spec_app/config/initializers/inflections.rb +0 -16
  217. data/spec_app/config/initializers/mime_types.rb +0 -4
  218. data/spec_app/config/initializers/session_store.rb +0 -3
  219. data/spec_app/config/initializers/wrap_parameters.rb +0 -14
  220. data/spec_app/config/locales/en.yml +0 -23
  221. data/spec_app/config/routes.rb +0 -30
  222. data/spec_app/config/secrets.yml +0 -22
  223. data/spec_app/db/schema.rb +0 -23
  224. data/spec_app/db/seeds.rb +0 -7
  225. data/spec_app/lib/assets/.keep +0 -0
  226. data/spec_app/lib/tasks/.keep +0 -0
  227. data/spec_app/lib/tasks/cucumber.rake +0 -65
  228. data/spec_app/log/.keep +0 -0
  229. data/spec_app/public/404.html +0 -67
  230. data/spec_app/public/422.html +0 -67
  231. data/spec_app/public/500.html +0 -66
  232. data/spec_app/public/favicon.ico +0 -0
  233. data/spec_app/public/robots.txt +0 -5
  234. data/spec_app/script/cucumber +0 -10
  235. data/spec_app/spec/controllers/binding_test_controller_spec.rb +0 -248
  236. data/spec_app/spec/javascripts/helpers/agent_detector.coffee +0 -20
  237. data/spec_app/spec/javascripts/helpers/async_sequence.js.coffee +0 -103
  238. data/spec_app/spec/javascripts/helpers/browser_switches.js.coffee +0 -21
  239. data/spec_app/spec/javascripts/helpers/enable_logging.js.coffee +0 -2
  240. data/spec_app/spec/javascripts/helpers/fixture.js.coffee +0 -25
  241. data/spec_app/spec/javascripts/helpers/index.js.coffee +0 -1
  242. data/spec_app/spec/javascripts/helpers/jquery_no_conflict.js +0 -1
  243. data/spec_app/spec/javascripts/helpers/knife.js.coffee +0 -69
  244. data/spec_app/spec/javascripts/helpers/last_request.js.coffee +0 -25
  245. data/spec_app/spec/javascripts/helpers/mock_ajax.js.coffee +0 -8
  246. data/spec_app/spec/javascripts/helpers/mock_clock.js.coffee +0 -2
  247. data/spec_app/spec/javascripts/helpers/parse_form_data.js.coffee +0 -24
  248. data/spec_app/spec/javascripts/helpers/promise_state.js +0 -18
  249. data/spec_app/spec/javascripts/helpers/protect_jasmine_runner.coffee +0 -12
  250. data/spec_app/spec/javascripts/helpers/remove_body_margin.js.coffee +0 -8
  251. data/spec_app/spec/javascripts/helpers/reset_history.js.coffee +0 -23
  252. data/spec_app/spec/javascripts/helpers/reset_knife.js.coffee +0 -2
  253. data/spec_app/spec/javascripts/helpers/reset_up.js.coffee +0 -25
  254. data/spec_app/spec/javascripts/helpers/restore_body_scroll.js.coffee +0 -5
  255. data/spec_app/spec/javascripts/helpers/show_lib_versions.coffee +0 -12
  256. data/spec_app/spec/javascripts/helpers/spec_util.coffee +0 -47
  257. data/spec_app/spec/javascripts/helpers/to_be_around.js.coffee +0 -8
  258. data/spec_app/spec/javascripts/helpers/to_be_array.coffee +0 -5
  259. data/spec_app/spec/javascripts/helpers/to_be_attached.coffee +0 -9
  260. data/spec_app/spec/javascripts/helpers/to_be_blank.js.coffee +0 -8
  261. data/spec_app/spec/javascripts/helpers/to_be_detached.coffee +0 -9
  262. data/spec_app/spec/javascripts/helpers/to_be_element.js.coffee +0 -8
  263. data/spec_app/spec/javascripts/helpers/to_be_error.coffee +0 -8
  264. data/spec_app/spec/javascripts/helpers/to_be_given.js.coffee +0 -8
  265. data/spec_app/spec/javascripts/helpers/to_be_hidden.js.coffee +0 -8
  266. data/spec_app/spec/javascripts/helpers/to_be_jquery.js.coffee +0 -5
  267. data/spec_app/spec/javascripts/helpers/to_be_missing.js.coffee +0 -8
  268. data/spec_app/spec/javascripts/helpers/to_be_present.js.coffee +0 -8
  269. data/spec_app/spec/javascripts/helpers/to_be_scrolled_to.coffee +0 -11
  270. data/spec_app/spec/javascripts/helpers/to_be_visible.js.coffee +0 -9
  271. data/spec_app/spec/javascripts/helpers/to_contain.js.coffee +0 -8
  272. data/spec_app/spec/javascripts/helpers/to_end_with.js.coffee +0 -11
  273. data/spec_app/spec/javascripts/helpers/to_equal_jquery.js.coffee +0 -8
  274. data/spec_app/spec/javascripts/helpers/to_equal_node_list.coffee +0 -7
  275. data/spec_app/spec/javascripts/helpers/to_equal_via_is_equal.js.coffee +0 -7
  276. data/spec_app/spec/javascripts/helpers/to_have_class.js.coffee +0 -10
  277. data/spec_app/spec/javascripts/helpers/to_have_descendant.js.coffee +0 -10
  278. data/spec_app/spec/javascripts/helpers/to_have_length.js.coffee +0 -8
  279. data/spec_app/spec/javascripts/helpers/to_have_opacity.coffee +0 -15
  280. data/spec_app/spec/javascripts/helpers/to_have_own_property.js.coffee +0 -8
  281. data/spec_app/spec/javascripts/helpers/to_have_request_method.js.coffee +0 -16
  282. data/spec_app/spec/javascripts/helpers/to_have_text.js.coffee +0 -9
  283. data/spec_app/spec/javascripts/helpers/to_have_unhandled_rejections.coffee +0 -18
  284. data/spec_app/spec/javascripts/helpers/to_match_list.coffee +0 -14
  285. data/spec_app/spec/javascripts/helpers/to_match_selector.coffee +0 -8
  286. data/spec_app/spec/javascripts/helpers/to_match_text.js.coffee +0 -13
  287. data/spec_app/spec/javascripts/helpers/to_match_url.coffee +0 -14
  288. data/spec_app/spec/javascripts/helpers/trigger.js.coffee +0 -200
  289. data/spec_app/spec/javascripts/helpers/wait_until_dom_ready.js.coffee +0 -5
  290. data/spec_app/spec/javascripts/support/jasmine.yml +0 -51
  291. data/spec_app/spec/javascripts/up/browser_spec.js.coffee +0 -150
  292. data/spec_app/spec/javascripts/up/classes/cache_spec.js.coffee +0 -82
  293. data/spec_app/spec/javascripts/up/classes/config_spec.coffee +0 -24
  294. data/spec_app/spec/javascripts/up/classes/divertible_chain_spec.coffee +0 -45
  295. data/spec_app/spec/javascripts/up/classes/focus_tracker_spec.coffee +0 -34
  296. data/spec_app/spec/javascripts/up/classes/params_spec.coffee +0 -557
  297. data/spec_app/spec/javascripts/up/classes/request_spec.coffee +0 -50
  298. data/spec_app/spec/javascripts/up/classes/scroll_motion_spec.js.coffee +0 -51
  299. data/spec_app/spec/javascripts/up/classes/store/memory_spec.js.coffee +0 -70
  300. data/spec_app/spec/javascripts/up/classes/store/session_spec.js.coffee +0 -114
  301. data/spec_app/spec/javascripts/up/element_spec.coffee +0 -897
  302. data/spec_app/spec/javascripts/up/event_spec.js.coffee +0 -530
  303. data/spec_app/spec/javascripts/up/feedback_spec.js.coffee +0 -401
  304. data/spec_app/spec/javascripts/up/form_spec.js.coffee +0 -1488
  305. data/spec_app/spec/javascripts/up/fragment_spec.js.coffee +0 -2589
  306. data/spec_app/spec/javascripts/up/history_spec.js.coffee +0 -340
  307. data/spec_app/spec/javascripts/up/jquery_spec.js.coffee +0 -4
  308. data/spec_app/spec/javascripts/up/legacy_spec.js.coffee +0 -27
  309. data/spec_app/spec/javascripts/up/link_spec.js.coffee +0 -1093
  310. data/spec_app/spec/javascripts/up/log_spec.js.coffee +0 -119
  311. data/spec_app/spec/javascripts/up/modal_spec.js.coffee +0 -917
  312. data/spec_app/spec/javascripts/up/motion_spec.js.coffee +0 -582
  313. data/spec_app/spec/javascripts/up/popup_spec.js.coffee +0 -507
  314. data/spec_app/spec/javascripts/up/protocol_spec.js.coffee +0 -39
  315. data/spec_app/spec/javascripts/up/proxy_spec.js.coffee +0 -1137
  316. data/spec_app/spec/javascripts/up/radio_spec.js.coffee +0 -212
  317. data/spec_app/spec/javascripts/up/rails_spec.js.coffee +0 -118
  318. data/spec_app/spec/javascripts/up/spec_spec.js.coffee +0 -9
  319. data/spec_app/spec/javascripts/up/syntax_spec.js.coffee +0 -304
  320. data/spec_app/spec/javascripts/up/toast_spec.js.coffee +0 -37
  321. data/spec_app/spec/javascripts/up/tooltip_spec.js.coffee +0 -163
  322. data/spec_app/spec/javascripts/up/util_spec.js.coffee +0 -1420
  323. data/spec_app/spec/javascripts/up/viewport_spec.js.coffee +0 -655
  324. data/spec_app/spec/spec_helper.rb +0 -62
  325. data/spec_app/test/controllers/.keep +0 -0
  326. data/spec_app/test/fixtures/.keep +0 -0
  327. data/spec_app/test/helpers/.keep +0 -0
  328. data/spec_app/test/integration/.keep +0 -0
  329. data/spec_app/test/mailers/.keep +0 -0
  330. data/spec_app/test/models/.keep +0 -0
  331. data/spec_app/test/test_helper.rb +0 -10
  332. data/spec_app/vendor/asset-libs/es6-promise-4.1.6/es6-promise.auto.js +0 -1159
  333. data/spec_app/vendor/asset-libs/jasmine-ajax-3.3.1/.bower.json +0 -43
  334. data/spec_app/vendor/asset-libs/jasmine-ajax-3.3.1/.gitignore +0 -6
  335. data/spec_app/vendor/asset-libs/jasmine-ajax-3.3.1/.npmignore +0 -10
  336. data/spec_app/vendor/asset-libs/jasmine-ajax-3.3.1/.pairs +0 -6
  337. data/spec_app/vendor/asset-libs/jasmine-ajax-3.3.1/.travis.yml +0 -56
  338. data/spec_app/vendor/asset-libs/jasmine-ajax-3.3.1/jasmine-ajax.js +0 -790
  339. data/spec_app/vendor/assets/.keep +0 -0
  340. data/unpoly-rails.gemspec +0 -24
@@ -1,668 +0,0 @@
1
- ###**
2
- Animation
3
- =========
4
-
5
- Whenever you [update a page fragment](/up.link) you can animate the change.
6
-
7
- Let's say you are using an [`up-target`](/a-up-target) link to update an element
8
- with content from the server. You can add an attribute [`up-transition`](/a-up-target#up-transition)
9
- to smoothly fade out the old element while fading in the new element:
10
-
11
- <a href="/users" up-target=".list" up-transition="cross-fade">Show users</a>
12
-
13
- \#\#\# Transitions vs. animations
14
-
15
- When we morph between an old and a new element, we call it a *transition*.
16
- In contrast, when we animate a new element without simultaneously removing an
17
- old element, we call it an *animation*.
18
-
19
- An example for an animation is opening a new dialog. We can animate the appearance
20
- of the dialog by adding an [`[up-animation]`](/a-up-modal#up-animation) attribute to the opening link:
21
-
22
- <a href="/users" up-modal=".list" up-animation="move-from-top">Show users</a>
23
-
24
- \#\#\# Which animations are available?
25
-
26
- Unpoly ships with a number of [predefined transitions](/up.morph#named-transitions)
27
- and [predefined animations](/up.animate#named-animations).
28
-
29
- You can define custom animations using [`up.transition()`](/up.transition) and
30
- [`up.animation()`](/up.animation).
31
-
32
- @module up.motion
33
- ###
34
- up.motion = do ->
35
-
36
- u = up.util
37
- e = up.element
38
-
39
- namedAnimations = {}
40
- defaultNamedAnimations = {}
41
- namedTransitions = {}
42
- defaultNamedTransitions = {}
43
-
44
- motionController = new up.MotionController('motion')
45
-
46
- ###**
47
- Sets default options for animations and transitions.
48
-
49
- @property up.motion.config
50
- @param {number} [config.duration=300]
51
- The default duration for all animations and transitions (in milliseconds).
52
- @param {number} [config.delay=0]
53
- The default delay for all animations and transitions (in milliseconds).
54
- @param {string} [config.easing='ease']
55
- The default timing function that controls the acceleration of animations and transitions.
56
-
57
- See [W3C documentation](http://www.w3.org/TR/css3-transitions/#transition-timing-function)
58
- for a list of pre-defined timing functions.
59
- @param {boolean} [config.enabled=true]
60
- Whether animation is enabled.
61
-
62
- Set this to `false` to disable animation globally.
63
- This can be useful in full-stack integration tests like a Selenium test suite.
64
-
65
- Regardless of this setting, all animations will be skipped on browsers
66
- that do not support [CSS transitions](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions).
67
- @stable
68
- ###
69
- config = new up.Config
70
- duration: 300
71
- delay: 0
72
- easing: 'ease'
73
- enabled: true
74
-
75
- reset = ->
76
- motionController.reset()
77
- namedAnimations = u.copy(defaultNamedAnimations)
78
- namedTransitions = u.copy(defaultNamedTransitions)
79
- config.reset()
80
-
81
- ###**
82
- Returns whether Unpoly will perform animations.
83
-
84
- Set [`up.motion.config.enabled`](/up.motion.config) `false` in order to disable animations globally.
85
-
86
- @function up.motion.isEnabled
87
- @return {boolean}
88
- @stable
89
- ###
90
- isEnabled = ->
91
- config.enabled
92
-
93
- ###**
94
- Applies the given animation to the given element.
95
-
96
- \#\#\# Example
97
-
98
- up.animate('.warning', 'fade-in')
99
-
100
- You can pass additional options:
101
-
102
- up.animate('warning', '.fade-in', {
103
- delay: 1000,
104
- duration: 250,
105
- easing: 'linear'
106
- })
107
-
108
- \#\#\# Named animations
109
-
110
- The following animations are pre-defined:
111
-
112
- | `fade-in` | Changes the element's opacity from 0% to 100% |
113
- | `fade-out` | Changes the element's opacity from 100% to 0% |
114
- | `move-to-top` | Moves the element upwards until it exits the screen at the top edge |
115
- | `move-from-top` | Moves the element downwards from beyond the top edge of the screen until it reaches its current position |
116
- | `move-to-bottom` | Moves the element downwards until it exits the screen at the bottom edge |
117
- | `move-from-bottom` | Moves the element upwards from beyond the bottom edge of the screen until it reaches its current position |
118
- | `move-to-left` | Moves the element leftwards until it exists the screen at the left edge |
119
- | `move-from-left` | Moves the element rightwards from beyond the left edge of the screen until it reaches its current position |
120
- | `move-to-right` | Moves the element rightwards until it exists the screen at the right edge |
121
- | `move-from-right` | Moves the element leftwards from beyond the right edge of the screen until it reaches its current position |
122
- | `none` | An animation that has no visible effect. Sounds useless at first, but can save you a lot of `if` statements. |
123
-
124
- You can define additional named animations using [`up.animation()`](/up.animation).
125
-
126
- \#\#\# Animating CSS properties directly
127
-
128
- By passing an object instead of an animation name, you can animate
129
- the CSS properties of the given element:
130
-
131
- var warning = document.querySelector('.warning')
132
- warning.style.opacity = 0
133
- up.animate(warning, { opacity: 1 })
134
-
135
- CSS properties must be given in `kebab-case`, not `camelCase`.
136
-
137
- \#\#\# Multiple animations on the same element
138
-
139
- Unpoly doesn't allow more than one concurrent animation on the same element.
140
-
141
- If you attempt to animate an element that is already being animated,
142
- the previous animation will instantly jump to its last frame before
143
- the new animation begins.
144
-
145
- @function up.animate
146
- @param {Element|jQuery|string} elementOrSelector
147
- The element to animate.
148
- @param {string|Function(element, options): Promise|Object} animation
149
- Can either be:
150
-
151
- - The animation's name
152
- - A function performing the animation
153
- - An object of CSS attributes describing the last frame of the animation (using kebeb-case property names)
154
- @param {number} [options.duration=300]
155
- The duration of the animation, in milliseconds.
156
- @param {number} [options.delay=0]
157
- The delay before the animation starts, in milliseconds.
158
- @param {string} [options.easing='ease']
159
- The timing function that controls the animation's acceleration.
160
-
161
- See [W3C documentation](http://www.w3.org/TR/css3-transitions/#transition-timing-function)
162
- for a list of pre-defined timing functions.
163
- @return {Promise}
164
- A promise for the animation's end.
165
- @stable
166
- ###
167
- animate = (elementOrSelector, animation, options) ->
168
- element = e.get(elementOrSelector)
169
- options = animateOptions(options)
170
-
171
- animationFn = findAnimationFn(animation)
172
- willRun = willAnimate(element, animation, options)
173
-
174
- if willRun
175
- runNow = -> animationFn(element, options)
176
- motionController.startFunction(element, runNow, options)
177
- else
178
- skipAnimate(element, animation)
179
-
180
- willAnimate = (element, animationOrTransition, options) ->
181
- options = animateOptions(options)
182
- isEnabled() && !isNone(animationOrTransition) && options.duration > 0 && !e.isSingleton(element)
183
-
184
- skipAnimate = (element, animation) ->
185
- if u.isOptions(animation)
186
- # If we are given the final animation frame as an object of CSS properties,
187
- # the best we can do is to set the final frame without animation.
188
- e.setStyle(element, animation)
189
- # Signal that the animation is already done.
190
- Promise.resolve()
191
-
192
- animCount = 0
193
-
194
- ###**
195
- Animates the given element's CSS properties using CSS transitions.
196
-
197
- Does not track the animation, nor does it finishes existing animations
198
- (use `up.motion.animate()` for that). It does, however, listen to the motionController's
199
- finish event.
200
-
201
- @function animateNow
202
- @param {Element|jQuery|string} elementOrSelector
203
- The element to animate.
204
- @param {Object} lastFrame
205
- The CSS properties that should be transitioned to.
206
- @param {number} [options.duration=300]
207
- The duration of the animation, in milliseconds.
208
- @param {number} [options.delay=0]
209
- The delay before the animation starts, in milliseconds.
210
- @param {string} [options.easing='ease']
211
- The timing function that controls the animation's acceleration.
212
- See [W3C documentation](http://www.w3.org/TR/css3-transitions/#transition-timing-function)
213
- for a list of pre-defined timing functions.
214
- @return {Promise}
215
- A promise that fulfills when the animation ends.
216
- @internal
217
- ###
218
- animateNow = (element, lastFrame, options) ->
219
- options = u.merge(options, finishEvent: motionController.finishEvent)
220
- cssTransition = new up.CssTransition(element, lastFrame, options)
221
- return cssTransition.start()
222
-
223
- ###**
224
- Extracts animation-related options from the given options hash.
225
- If `element` is given, also inspects the element for animation-related
226
- attributes like `up-easing` or `up-duration`.
227
-
228
- @param {Object} userOptions
229
- @param {Element|jQuery} [element]
230
- @param {Object} [moduleDefaults]
231
- @function up.motion.animateOptions
232
- @internal
233
- ###
234
- animateOptions = (args...) ->
235
- userOptions = args.shift() ? {}
236
- moduleDefaults = u.extractOptions(args)
237
- element = args.pop() || e.none()
238
-
239
- consolidatedOptions = {}
240
- consolidatedOptions.easing = userOptions.easing ? element.getAttribute('up-easing') ? moduleDefaults.easing ? config.easing
241
- consolidatedOptions.duration = userOptions.duration ? e.numberAttr(element, 'up-duration') ? moduleDefaults.duration ? config.duration
242
- consolidatedOptions.delay = userOptions.delay ? e.numberAttr(element, 'up-delay') ? moduleDefaults.delay ? config.delay
243
- consolidatedOptions.trackMotion = userOptions.trackMotion # required by up.MotionController
244
- consolidatedOptions
245
-
246
- findNamedAnimation = (name) ->
247
- namedAnimations[name] or up.fail("Unknown animation %o", name)
248
-
249
- ###**
250
- Completes [animations](/up.animate) and [transitions](/up.morph).
251
-
252
- If called without arguments, all animations on the screen are completed.
253
- If given an element (or selector), animations on that element and its children
254
- are completed.
255
-
256
- Animations are completed by jumping to the last animation frame instantly.
257
- Promises returned by animation and transition functions instantly settle.
258
-
259
- Emits the `up:motion:finish` event that is already handled by `up.animate()`.
260
-
261
- Does nothing if there are no animation to complete.
262
-
263
- @function up.motion.finish
264
- @param {Element|jQuery|string} [elementOrSelector]
265
- @return {Promise}
266
- A promise that fulfills when animations and transitions have finished.
267
- @stable
268
- ###
269
- finish = (elementOrSelector) ->
270
- motionController.finish(elementOrSelector)
271
-
272
- ###**
273
- This event is emitted on an [animating](/up.animating) element by `up.motion.finish()` to
274
- request the animation to instantly finish and skip to the last frame.
275
-
276
- Promises returned by completed animation functions are expected to settle.
277
-
278
- Animations started by `up.animate()` already handle this event.
279
-
280
- @event up:motion:finish
281
- @param {Element} event.target
282
- The animating element.
283
- @experimental
284
- ###
285
-
286
- ###**
287
- Performs an animated transition between the `source` and `target` elements.
288
-
289
- Transitions are implement by performing two animations in parallel,
290
- causing `source` to disappear and the `target` to appear.
291
-
292
- - `target` is [inserted before](https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore) `source`
293
- - `source` is removed from the [document flow](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Positioning) with `position: absolute`.
294
- It will be positioned over its original place in the flow that is now occupied by `target`.
295
- - Both `source` and `target` are animated in parallel
296
- - `source` is removed from the DOM
297
-
298
- \#\#\# Named transitions
299
-
300
- The following transitions are pre-defined:
301
-
302
- | `cross-fade` | Fades out the first element. Simultaneously fades in the second element. |
303
- | `move-up` | Moves the first element upwards until it exits the screen at the top edge. Simultaneously moves the second element upwards from beyond the bottom edge of the screen until it reaches its current position. |
304
- | `move-down` | Moves the first element downwards until it exits the screen at the bottom edge. Simultaneously moves the second element downwards from beyond the top edge of the screen until it reaches its current position. |
305
- | `move-left` | Moves the first element leftwards until it exists the screen at the left edge. Simultaneously moves the second element leftwards from beyond the right edge of the screen until it reaches its current position. |
306
- | `move-right` | Moves the first element rightwards until it exists the screen at the right edge. Simultaneously moves the second element rightwards from beyond the left edge of the screen until it reaches its current position. |
307
- | `none` | A transition that has no visible effect. Sounds useless at first, but can save you a lot of `if` statements. |
308
-
309
- You can define additional named transitions using [`up.transition()`](/up.transition).
310
-
311
- You can also compose a transition from two [named animations](/named-animations).
312
- separated by a slash character (`/`):
313
-
314
- - `move-to-bottom/fade-in`
315
- - `move-to-left/move-from-top`
316
-
317
- \#\#\# Implementation details
318
-
319
- During a transition both the old and new element occupy
320
- the same position on the screen.
321
-
322
- Since the CSS layout flow will usually not allow two elements to
323
- overlay the same space, Unpoly:
324
-
325
- - The old and new elements are cloned
326
- - The old element is removed from the layout flow using `display: hidden`
327
- - The new element is hidden, but still leaves space in the layout flow by setting `visibility: hidden`
328
- - The clones are [absolutely positioned](https://developer.mozilla.org/en-US/docs/Web/CSS/position#Absolute_positioning)
329
- over the original elements.
330
- - The transition is applied to the cloned elements.
331
- At no point will the hidden, original elements be animated.
332
- - When the transition has finished, the clones are removed from the DOM and the new element is shown.
333
- The old element remains hidden in the DOM.
334
-
335
- @function up.morph
336
- @param {Element|jQuery|string} source
337
- @param {Element|jQuery|string} target
338
- @param {Function(oldElement, newElement)|string} transition
339
- @param {number} [options.duration=300]
340
- The duration of the animation, in milliseconds.
341
- @param {number} [options.delay=0]
342
- The delay before the animation starts, in milliseconds.
343
- @param {string} [options.easing='ease']
344
- The timing function that controls the transition's acceleration.
345
-
346
- See [W3C documentation](http://www.w3.org/TR/css3-transitions/#transition-timing-function)
347
- for a list of pre-defined timing functions.
348
- @param {boolean} [options.reveal=false]
349
- Whether to reveal the new element by scrolling its parent viewport.
350
- @return {Promise}
351
- A promise that fulfills when the transition ends.
352
- @stable
353
- ###
354
- morph = (oldElement, newElement, transitionObject, options) ->
355
- options = u.options(options)
356
- u.assign(options, animateOptions(options))
357
-
358
- oldElement = e.get(oldElement)
359
- newElement = e.get(newElement)
360
-
361
- transitionFn = findTransitionFn(transitionObject)
362
- willMorph = willAnimate(oldElement, transitionFn, options)
363
-
364
- # Remove callbacks from our options hash in case transitionFn calls morph() recursively.
365
- # If we passed on these callbacks, we might call destructors, events, etc. multiple times.
366
- beforeStart = u.pluckKey(options, 'beforeStart') || u.noop
367
- afterInsert = u.pluckKey(options, 'afterInsert') || u.noop
368
- beforeDetach = u.pluckKey(options, 'beforeDetach') || u.noop
369
- afterDetach = u.pluckKey(options, 'afterDetach') || u.noop
370
-
371
- beforeStart()
372
-
373
- scrollNew = ->
374
- # Don't animate the scrolling.
375
- scrollOptions = u.merge(options, scrollBehavior: 'auto')
376
- # Scroll newElement into position before we start the enter animation.
377
- up.viewport.scrollAfterInsertFragment(newElement, scrollOptions)
378
-
379
- if willMorph
380
- if motionController.isActive(oldElement) && options.trackMotion is false
381
- return transitionFn(oldElement, newElement, options)
382
-
383
- up.puts 'Morphing %o to %o with transition %o', oldElement, newElement, transitionObject
384
-
385
- viewport = up.viewport.closest(oldElement)
386
- scrollTopBeforeReveal = viewport.scrollTop
387
-
388
- oldRemote = up.viewport.absolutize oldElement,
389
- # Because the insertion will shift elements visually, we must delay insertion
390
- # until absolutize() has measured the bounding box of the old element.
391
- afterMeasure: ->
392
- e.insertBefore(oldElement, newElement)
393
- afterInsert()
394
-
395
- trackable = ->
396
- # Scroll newElement into position before we start the enter animation.
397
- promise = scrollNew()
398
-
399
- promise = promise.then ->
400
- # Since we have scrolled the viewport (containing both oldElement and newElement),
401
- # we must shift the old copy so it looks like it it is still sitting
402
- # in the same position.
403
- scrollTopAfterReveal = viewport.scrollTop
404
- oldRemote.moveBounds(0, scrollTopAfterReveal - scrollTopBeforeReveal)
405
-
406
- transitionFn(oldElement, newElement, options)
407
-
408
- promise = promise.then ->
409
- beforeDetach()
410
- e.remove(oldRemote.bounds)
411
- afterDetach()
412
-
413
- return promise
414
-
415
- motionController.startFunction([oldElement, newElement], trackable, options)
416
-
417
- else
418
- beforeDetach()
419
- # Swapping the elements directly with replaceWith() will cause
420
- # jQuery to remove all data attributes, which we use to store destructors
421
- swapElementsDirectly(oldElement, newElement)
422
- afterInsert()
423
- afterDetach()
424
- promise = scrollNew()
425
- return promise
426
-
427
- findTransitionFn = (object) ->
428
- if isNone(object)
429
- undefined
430
- else if u.isFunction(object)
431
- object
432
- else if u.isArray(object)
433
- composeTransitionFn(object...)
434
- else if u.isString(object)
435
- if object.indexOf('/') >= 0 # Compose a transition from two animation names
436
- composeTransitionFn(object.split('/')...)
437
- else if namedTransition = namedTransitions[object]
438
- findTransitionFn(namedTransition)
439
- else
440
- up.fail("Unknown transition %o", object)
441
-
442
- composeTransitionFn = (oldAnimation, newAnimation) ->
443
- if isNone(oldAnimation) && isNone(oldAnimation)
444
- # A composition of two null-animations is a null-transform
445
- # and should be skipped.
446
- undefined
447
- else
448
- oldAnimationFn = findAnimationFn(oldAnimation) || u.asyncNoop
449
- newAnimationFn = findAnimationFn(newAnimation) || u.asyncNoop
450
- (oldElement, newElement, options) ->
451
- Promise.all([
452
- oldAnimationFn(oldElement, options),
453
- newAnimationFn(newElement, options)
454
- ])
455
-
456
- findAnimationFn = (object) ->
457
- if isNone(object)
458
- undefined
459
- else if u.isFunction(object)
460
- object
461
- else if u.isString(object)
462
- findNamedAnimation(object)
463
- else if u.isOptions(object)
464
- (element, options) -> animateNow(element, object, options)
465
- else
466
- up.fail('Unknown animation %o', object)
467
-
468
- # Have a separate function so we can mock it in specs.
469
- swapElementsDirectly = (oldElement, newElement) ->
470
- e.replace(oldElement, newElement)
471
-
472
- ###**
473
- Defines a named transition that [morphs](/up.element) from one element to another.
474
-
475
- \#\#\# Example
476
-
477
- Here is the definition of the pre-defined `cross-fade` animation:
478
-
479
- up.transition('cross-fade', (oldElement, newElement, options) ->
480
- Promise.all([
481
- up.animate(oldElement, 'fade-out', options),
482
- up.animate(newElement, 'fade-in', options)
483
- ])
484
- )
485
-
486
- It is recommended that your transitions use [`up.animate()`](/up.animate),
487
- passing along the `options` that were passed to you.
488
-
489
- If you choose to *not* use `up.animate()` and roll your own
490
- logic instead, your code must honor the following contract:
491
-
492
- 1. It must honor the options `{ delay, duration, easing }` if given.
493
- 2. It must *not* remove any of the given elements from the DOM.
494
- 3. It returns a promise that is fulfilled when the transition has ended.
495
- 4. If during the animation an event `up:motion:finish` is emitted on
496
- either element, the transition instantly jumps to the last frame
497
- and resolves the returned promise.
498
-
499
- Calling [`up.animate()`](/up.animate) with an object argument
500
- will take care of all these points.
501
-
502
- @function up.transition
503
- @param {string} name
504
- @param {Function(oldElement, newElement, options): Promise|Array} transition
505
- @stable
506
- ###
507
- registerTransition = (name, transition) ->
508
- namedTransitions[name] = findTransitionFn(transition)
509
-
510
- ###**
511
- Defines a named animation.
512
-
513
- Here is the definition of the pre-defined `fade-in` animation:
514
-
515
- up.animation('fade-in', function(element, options) {
516
- element.style.opacity = 0
517
- up.animate(element, { opacity: 1 }, options)
518
- })
519
-
520
- It is recommended that your definitions always end by calling
521
- calling [`up.animate()`](/up.animate) with an object argument, passing along
522
- the `options` that were passed to you.
523
-
524
- If you choose to *not* use `up.animate()` and roll your own
525
- animation code instead, your code must honor the following contract:
526
-
527
- 1. It must honor the options `{ delay, duration, easing }` if given
528
- 2. It must *not* remove any of the given elements from the DOM.
529
- 3. It returns a promise that is fulfilled when the transition has ended
530
- 4. If during the animation an event `up:motion:finish` is emitted on
531
- the given element, the transition instantly jumps to the last frame
532
- and resolves the returned promise.
533
-
534
- Calling [`up.animate()`](/up.animate) with an object argument
535
- will take care of all these points.
536
-
537
- @function up.animation
538
- @param {string} name
539
- @param {Function(element, options): Promise} animation
540
- @stable
541
- ###
542
- registerAnimation = (name, animation) ->
543
- namedAnimations[name] = findAnimationFn(animation)
544
-
545
- snapshot = ->
546
- defaultNamedAnimations = u.copy(namedAnimations)
547
- defaultNamedTransitions = u.copy(namedTransitions)
548
-
549
- ###**
550
- Returns whether the given animation option will cause the animation
551
- to be skipped.
552
-
553
- @function up.motion.isNone
554
- @internal
555
- ###
556
- isNone = (animationOrTransition) ->
557
- # false, undefined, '', null and the string "none" are all ways to skip animations
558
- !animationOrTransition || animationOrTransition == 'none' || u.isBlank(animationOrTransition)
559
-
560
- registerAnimation('fade-in', (element, options) ->
561
- e.setStyle(element, opacity: 0)
562
- animateNow(element, { opacity: 1 }, options)
563
- )
564
-
565
- registerAnimation('fade-out', (element, options) ->
566
- e.setStyle(element, opacity: 1)
567
- animateNow(element, { opacity: 0 }, options)
568
- )
569
-
570
- translateCss = (x, y) ->
571
- { transform: "translate(#{x}px, #{y}px)" }
572
-
573
- registerAnimation('move-to-top', (element, options) ->
574
- e.setStyle(element, translateCss(0, 0))
575
- box = element.getBoundingClientRect()
576
- travelDistance = box.top + box.height
577
- animateNow(element, translateCss(0, -travelDistance), options)
578
- )
579
-
580
- registerAnimation('move-from-top', (element, options) ->
581
- e.setStyle(element, translateCss(0, 0))
582
- box = element.getBoundingClientRect()
583
- travelDistance = box.top + box.height
584
- e.setStyle(element, translateCss(0, -travelDistance))
585
- animateNow(element, translateCss(0, 0), options)
586
- )
587
-
588
- registerAnimation('move-to-bottom', (element, options) ->
589
- e.setStyle(element, translateCss(0, 0))
590
- box = element.getBoundingClientRect()
591
- travelDistance = e.root().clientHeight - box.top
592
- animateNow(element, translateCss(0, travelDistance), options)
593
- )
594
-
595
- registerAnimation('move-from-bottom', (element, options) ->
596
- e.setStyle(element, translateCss(0, 0))
597
- box = element.getBoundingClientRect()
598
- travelDistance = up.viewport.rootHeight() - box.top
599
- e.setStyle(element, translateCss(0, travelDistance))
600
- animateNow(element, translateCss(0, 0), options)
601
- )
602
-
603
- registerAnimation('move-to-left', (element, options) ->
604
- e.setStyle(element, translateCss(0, 0))
605
- box = element.getBoundingClientRect()
606
- travelDistance = box.left + box.width
607
- animateNow(element, translateCss(-travelDistance, 0), options)
608
- )
609
-
610
- registerAnimation('move-from-left', (element, options) ->
611
- e.setStyle(element, translateCss(0, 0))
612
- box = element.getBoundingClientRect()
613
- travelDistance = box.left + box.width
614
- e.setStyle(element, translateCss(-travelDistance, 0))
615
- animateNow(element, translateCss(0, 0), options)
616
- )
617
-
618
- registerAnimation('move-to-right', (element, options) ->
619
- e.setStyle(element, translateCss(0, 0))
620
- box = element.getBoundingClientRect()
621
- travelDistance = up.viewport.rootWidth() - box.left
622
- animateNow(element, translateCss(travelDistance, 0), options)
623
- )
624
-
625
- registerAnimation('move-from-right', (element, options) ->
626
- e.setStyle(element, translateCss(0, 0))
627
- box = element.getBoundingClientRect()
628
- travelDistance = up.viewport.rootWidth() - box.left
629
- e.setStyle(element, translateCss(travelDistance, 0))
630
- animateNow(element, translateCss(0, 0), options)
631
- )
632
-
633
- registerAnimation('roll-down', (element, options) ->
634
- previousHeightStr = e.style(element, 'height')
635
- styleMemo = e.setTemporaryStyle(element,
636
- height: '0px'
637
- overflow: 'hidden'
638
- )
639
- deferred = animate(element, { height: previousHeightStr }, options)
640
- deferred.then(styleMemo)
641
- deferred
642
- )
643
-
644
- registerTransition('move-left', ['move-to-left', 'move-from-right'])
645
- registerTransition('move-right', ['move-to-right', 'move-from-left'])
646
- registerTransition('move-up', ['move-to-top', 'move-from-bottom'])
647
- registerTransition('move-down', ['move-to-bottom', 'move-from-top'])
648
- registerTransition('cross-fade', ['fade-out', 'fade-in'])
649
-
650
- up.on 'up:framework:booted', snapshot
651
- up.on 'up:framework:reset', reset
652
-
653
- <% if ENV['JS_KNIFE'] %>knife: eval(Knife.point)<% end %>
654
- morph: morph
655
- animate: animate
656
- animateOptions: animateOptions
657
- finish: finish
658
- finishCount: -> motionController.finishCount
659
- transition: registerTransition
660
- animation: registerAnimation
661
- config: config
662
- isEnabled: isEnabled
663
- isNone: isNone
664
-
665
- up.transition = up.motion.transition
666
- up.animation = up.motion.animation
667
- up.morph = up.motion.morph
668
- up.animate = up.motion.animate