unpoly-rails 0.32.0 → 0.33.0

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 (232) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +106 -76
  3. data/README.md +8 -5
  4. data/README_RAILS.md +1 -1
  5. data/design/test_rejected_promise.txt +5 -0
  6. data/dist/unpoly-bootstrap3.js +1 -1
  7. data/dist/unpoly-bootstrap3.min.js +1 -1
  8. data/dist/unpoly.js +814 -417
  9. data/dist/unpoly.min.js +3 -3
  10. data/lib/assets/javascripts/unpoly/{browser.js.coffee → browser.coffee} +15 -6
  11. data/lib/assets/javascripts/unpoly/{bus.js.coffee → bus.coffee} +13 -13
  12. data/lib/assets/javascripts/unpoly/dom/extract_cascade.coffee +73 -0
  13. data/lib/assets/javascripts/unpoly/dom/extract_plan.coffee +65 -0
  14. data/lib/assets/javascripts/unpoly/{flow.js.coffee → dom.coffee} +109 -114
  15. data/lib/assets/javascripts/unpoly/{navigation.js.coffee → feedback.coffee} +11 -11
  16. data/lib/assets/javascripts/unpoly/{form.js.coffee → form.coffee} +35 -24
  17. data/lib/assets/javascripts/unpoly/{history.js.coffee → history.coffee} +9 -10
  18. data/lib/assets/javascripts/unpoly/{layout.js.coffee → layout.coffee} +53 -21
  19. data/lib/assets/javascripts/unpoly/{link.js.coffee → link.coffee} +46 -40
  20. data/lib/assets/javascripts/unpoly/{log.js.coffee → log.coffee} +2 -2
  21. data/lib/assets/javascripts/unpoly/{modal.js.coffee → modal.coffee} +17 -14
  22. data/lib/assets/javascripts/unpoly/{motion.js.coffee → motion.coffee} +28 -31
  23. data/lib/assets/javascripts/unpoly/namespace.coffee.erb +10 -0
  24. data/lib/assets/javascripts/unpoly/{popup.js.coffee → popup.coffee} +22 -10
  25. data/lib/assets/javascripts/unpoly/{proxy.js.coffee → proxy.coffee} +34 -12
  26. data/lib/assets/javascripts/unpoly/{rails.js.coffee → rails.coffee} +0 -0
  27. data/lib/assets/javascripts/unpoly/{syntax.js.coffee → syntax.coffee} +32 -21
  28. data/lib/assets/javascripts/unpoly/{toast.js.coffee → toast.coffee} +0 -0
  29. data/lib/assets/javascripts/unpoly/{tooltip.js.coffee → tooltip.coffee} +2 -2
  30. data/lib/assets/javascripts/unpoly/{util.js.coffee → util.coffee} +122 -35
  31. data/lib/assets/javascripts/unpoly-bootstrap3/{form-ext.js.coffee → form-ext.coffee} +0 -0
  32. data/lib/assets/javascripts/unpoly-bootstrap3/{layout-ext.js.coffee → layout-ext.coffee} +0 -0
  33. data/lib/assets/javascripts/unpoly-bootstrap3/{modal-ext.js.coffee → modal-ext.coffee} +0 -0
  34. data/lib/assets/javascripts/unpoly-bootstrap3/{navigation-ext.js.coffee → navigation-ext.coffee} +1 -1
  35. data/lib/assets/javascripts/{unpoly-bootstrap3.js.coffee → unpoly-bootstrap3.coffee} +0 -0
  36. data/lib/assets/javascripts/unpoly.coffee +22 -0
  37. data/lib/assets/stylesheets/unpoly/{close.css.sass → close.sass} +0 -0
  38. data/lib/assets/stylesheets/unpoly/{flow.css.sass → flow.sass} +0 -0
  39. data/lib/assets/stylesheets/unpoly/{link.css.sass → link.sass} +0 -0
  40. data/lib/assets/stylesheets/unpoly/{modal.css.sass → modal.sass} +0 -0
  41. data/lib/assets/stylesheets/unpoly/{popup.css.sass → popup.sass} +0 -0
  42. data/lib/assets/stylesheets/unpoly/{toast.css.sass → toast.sass} +0 -0
  43. data/lib/assets/stylesheets/unpoly/{tooltip.css.sass → tooltip.sass} +0 -0
  44. data/lib/assets/stylesheets/unpoly-bootstrap3/{modal-ext.css.sass → modal-ext.sass} +0 -0
  45. data/lib/assets/stylesheets/{unpoly-bootstrap3.css.sass → unpoly-bootstrap3.sass} +0 -0
  46. data/lib/assets/stylesheets/{unpoly.css.sass → unpoly.sass} +0 -0
  47. data/lib/unpoly/rails/version.rb +1 -1
  48. data/package.json +1 -1
  49. data/spec_app/Gemfile.lock +11 -13
  50. data/spec_app/app/assets/javascripts/jasmine_specs.coffee +1 -1
  51. data/spec_app/app/assets/stylesheets/_helpers.sass +1 -1
  52. data/spec_app/config/initializers/assets.rb +1 -5
  53. data/spec_app/spec/javascripts/up/{flow_spec.js.coffee → dom_spec.js.coffee} +294 -44
  54. data/spec_app/spec/javascripts/up/{navigation_spec.js.coffee → feedback_spec.js.coffee} +2 -2
  55. data/spec_app/spec/javascripts/up/form_spec.js.coffee +1 -0
  56. data/spec_app/spec/javascripts/up/layout_spec.js.coffee +10 -0
  57. data/spec_app/spec/javascripts/up/link_spec.js.coffee +28 -0
  58. data/spec_app/spec/javascripts/up/modal_spec.js.coffee +46 -9
  59. data/spec_app/spec/javascripts/up/motion_spec.js.coffee +32 -2
  60. data/spec_app/spec/javascripts/up/popup_spec.js.coffee +5 -4
  61. data/spec_app/spec/javascripts/up/util_spec.js.coffee +75 -0
  62. data/spec_app/vendor/{assets/bower_components/jasmine-ajax → asset-libs/jasmine-ajax-3.3.1}/.bower.json +0 -0
  63. data/spec_app/vendor/asset-libs/jasmine-ajax-3.3.1/.gitignore +6 -0
  64. data/spec_app/vendor/asset-libs/jasmine-ajax-3.3.1/.npmignore +10 -0
  65. data/spec_app/vendor/asset-libs/jasmine-ajax-3.3.1/.pairs +6 -0
  66. data/spec_app/vendor/asset-libs/jasmine-ajax-3.3.1/.travis.yml +56 -0
  67. data/spec_app/vendor/{assets/bower_components/jasmine-ajax/lib/mock-ajax.js → asset-libs/jasmine-ajax-3.3.1/jasmine-ajax.js} +83 -26
  68. data/spec_app/vendor/{assets/bower_components/jasmine-fixture/dist → asset-libs/jasmine-fixture-1.3.4}/jasmine-fixture.js +13 -13
  69. data/spec_app/vendor/{assets/bower_components/jasmine-jquery → asset-libs/jasmine-jquery-2.1.1}/.bower.json +0 -0
  70. data/spec_app/vendor/{assets/bower_components/jasmine-jquery/lib → asset-libs/jasmine-jquery-2.1.1}/jasmine-jquery.js +0 -0
  71. data/spec_app/vendor/assets/{javascripts/.keep → .keep} +0 -0
  72. metadata +52 -203
  73. data/lib/assets/javascripts/unpoly/module.js.coffee.erb +0 -8
  74. data/lib/assets/javascripts/unpoly.js.coffee +0 -21
  75. data/spec_app/Bowerfile +0 -3
  76. data/spec_app/vendor/assets/.bowerrc +0 -3
  77. data/spec_app/vendor/assets/bower.json +0 -8
  78. data/spec_app/vendor/assets/bower_components/jasmine/.bower.json +0 -50
  79. data/spec_app/vendor/assets/bower_components/jasmine/CONTRIBUTING.md +0 -130
  80. data/spec_app/vendor/assets/bower_components/jasmine/GOALS_2.0.md +0 -64
  81. data/spec_app/vendor/assets/bower_components/jasmine/MANIFEST.in +0 -5
  82. data/spec_app/vendor/assets/bower_components/jasmine/MIT.LICENSE +0 -20
  83. data/spec_app/vendor/assets/bower_components/jasmine/README.md +0 -73
  84. data/spec_app/vendor/assets/bower_components/jasmine/RELEASE.md +0 -73
  85. data/spec_app/vendor/assets/bower_components/jasmine/bower.json +0 -41
  86. data/spec_app/vendor/assets/bower_components/jasmine/images/jasmine-horizontal.png +0 -0
  87. data/spec_app/vendor/assets/bower_components/jasmine/images/jasmine-horizontal.svg +0 -102
  88. data/spec_app/vendor/assets/bower_components/jasmine/images/jasmine_favicon.png +0 -0
  89. data/spec_app/vendor/assets/bower_components/jasmine/lib/console/console.js +0 -190
  90. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/boot.js +0 -143
  91. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/node_example/lib/jasmine_examples/Player.js +0 -24
  92. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/node_example/lib/jasmine_examples/Song.js +0 -9
  93. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/jasmine-html.js +0 -446
  94. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/jasmine.css +0 -58
  95. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/jasmine.js +0 -3298
  96. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/json2.js +0 -489
  97. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/node_boot.js +0 -41
  98. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core.js +0 -37
  99. data/spec_app/vendor/assets/bower_components/jasmine/package.json +0 -34
  100. data/spec_app/vendor/assets/bower_components/jasmine/requirements.txt +0 -1
  101. data/spec_app/vendor/assets/bower_components/jasmine-ajax/MIT.LICENSE +0 -20
  102. data/spec_app/vendor/assets/bower_components/jasmine-ajax/README.markdown +0 -289
  103. data/spec_app/vendor/assets/bower_components/jasmine-ajax/bower.json +0 -35
  104. data/spec_app/vendor/assets/bower_components/jasmine-ajax/package.json +0 -26
  105. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/2.0.2.md +0 -50
  106. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/2.99.md +0 -14
  107. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/3.0.md +0 -28
  108. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/3.1.0.md +0 -24
  109. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/3.1.1.md +0 -23
  110. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/3.2.0.md +0 -20
  111. data/spec_app/vendor/assets/bower_components/jasmine-fixture/.bower.json +0 -27
  112. data/spec_app/vendor/assets/bower_components/jasmine-fixture/.gitignore +0 -8
  113. data/spec_app/vendor/assets/bower_components/jasmine-fixture/.npmignore +0 -8
  114. data/spec_app/vendor/assets/bower_components/jasmine-fixture/LICENSE.txt +0 -24
  115. data/spec_app/vendor/assets/bower_components/jasmine-fixture/README.md +0 -118
  116. data/spec_app/vendor/assets/bower_components/jasmine-fixture/bower.json +0 -17
  117. data/spec_app/vendor/assets/bower_components/jasmine-fixture/dist/jasmine-fixture.min.js +0 -5
  118. data/spec_app/vendor/assets/bower_components/jasmine-fixture/spec-e2e/basic-usage-spec.coffee +0 -14
  119. data/spec_app/vendor/assets/bower_components/jasmine-fixture/spec-e2e/helpers/invariants.coffee +0 -17
  120. data/spec_app/vendor/assets/bower_components/jasmine-fixture/spec-e2e/helpers/spec-within-a-spec.coffee +0 -24
  121. data/spec_app/vendor/assets/bower_components/jasmine-fixture/spec-e2e/helpers/tmp-files.coffee +0 -8
  122. data/spec_app/vendor/assets/bower_components/jasmine-fixture/spec-e2e/support/jasmine1-testem-config.json +0 -11
  123. data/spec_app/vendor/assets/bower_components/jasmine-fixture/spec-e2e/support/jasmine2-testem-config.json +0 -11
  124. data/spec_app/vendor/assets/bower_components/jasmine-fixture/vendor/js/jquery-1.11.0.js +0 -10337
  125. data/spec_app/vendor/assets/bower_components/jasmine-fixture/vendor/js/jquery-1.8.3.js +0 -9472
  126. data/spec_app/vendor/assets/bower_components/jasmine-fixture/vendor/js/jquery-2.1.0.js +0 -9111
  127. data/spec_app/vendor/assets/bower_components/jasmine-jquery/CONTRIBUTING.md +0 -28
  128. data/spec_app/vendor/assets/bower_components/jasmine-jquery/Gruntfile.js +0 -49
  129. data/spec_app/vendor/assets/bower_components/jasmine-jquery/LICENSE +0 -20
  130. data/spec_app/vendor/assets/bower_components/jasmine-jquery/README.md +0 -367
  131. data/spec_app/vendor/assets/bower_components/jasmine-jquery/bower.json +0 -15
  132. data/spec_app/vendor/assets/bower_components/jasmine-jquery/package.json +0 -35
  133. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/fixture_with_checkbox_with_checked.html +0 -6
  134. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/fixture_with_javascript.html +0 -1
  135. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/fixture_with_javascript_block.html +0 -1
  136. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/javascripts/jasmine_javascript_click.js +0 -1
  137. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/javascripts/jasmine_javascript_hover.js +0 -1
  138. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/json/jasmine_json_test.json +0 -1
  139. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/real_non_mocked_fixture.html +0 -1
  140. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/real_non_mocked_fixture_style.css +0 -1
  141. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/suites/jasmine-jquery-spec.js +0 -1842
  142. data/spec_app/vendor/assets/bower_components/jquery/.bower.json +0 -38
  143. data/spec_app/vendor/assets/bower_components/jquery/MIT-LICENSE.txt +0 -21
  144. data/spec_app/vendor/assets/bower_components/jquery/bower.json +0 -28
  145. data/spec_app/vendor/assets/bower_components/jquery/dist/jquery.js +0 -9210
  146. data/spec_app/vendor/assets/bower_components/jquery/dist/jquery.min.js +0 -5
  147. data/spec_app/vendor/assets/bower_components/jquery/dist/jquery.min.map +0 -1
  148. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/jsonp.js +0 -89
  149. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/load.js +0 -75
  150. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/parseJSON.js +0 -13
  151. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/parseXML.js +0 -28
  152. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/script.js +0 -64
  153. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/var/nonce.js +0 -5
  154. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/var/rquery.js +0 -3
  155. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/xhr.js +0 -136
  156. data/spec_app/vendor/assets/bower_components/jquery/src/ajax.js +0 -786
  157. data/spec_app/vendor/assets/bower_components/jquery/src/attributes/attr.js +0 -141
  158. data/spec_app/vendor/assets/bower_components/jquery/src/attributes/classes.js +0 -158
  159. data/spec_app/vendor/assets/bower_components/jquery/src/attributes/prop.js +0 -94
  160. data/spec_app/vendor/assets/bower_components/jquery/src/attributes/support.js +0 -35
  161. data/spec_app/vendor/assets/bower_components/jquery/src/attributes/val.js +0 -161
  162. data/spec_app/vendor/assets/bower_components/jquery/src/attributes.js +0 -11
  163. data/spec_app/vendor/assets/bower_components/jquery/src/callbacks.js +0 -205
  164. data/spec_app/vendor/assets/bower_components/jquery/src/core/access.js +0 -60
  165. data/spec_app/vendor/assets/bower_components/jquery/src/core/init.js +0 -123
  166. data/spec_app/vendor/assets/bower_components/jquery/src/core/parseHTML.js +0 -39
  167. data/spec_app/vendor/assets/bower_components/jquery/src/core/ready.js +0 -97
  168. data/spec_app/vendor/assets/bower_components/jquery/src/core/var/rsingleTag.js +0 -4
  169. data/spec_app/vendor/assets/bower_components/jquery/src/core.js +0 -502
  170. data/spec_app/vendor/assets/bower_components/jquery/src/css/addGetHookIf.js +0 -22
  171. data/spec_app/vendor/assets/bower_components/jquery/src/css/curCSS.js +0 -57
  172. data/spec_app/vendor/assets/bower_components/jquery/src/css/defaultDisplay.js +0 -70
  173. data/spec_app/vendor/assets/bower_components/jquery/src/css/hiddenVisibleSelectors.js +0 -15
  174. data/spec_app/vendor/assets/bower_components/jquery/src/css/support.js +0 -96
  175. data/spec_app/vendor/assets/bower_components/jquery/src/css/swap.js +0 -28
  176. data/spec_app/vendor/assets/bower_components/jquery/src/css/var/cssExpand.js +0 -3
  177. data/spec_app/vendor/assets/bower_components/jquery/src/css/var/getStyles.js +0 -12
  178. data/spec_app/vendor/assets/bower_components/jquery/src/css/var/isHidden.js +0 -13
  179. data/spec_app/vendor/assets/bower_components/jquery/src/css/var/rmargin.js +0 -3
  180. data/spec_app/vendor/assets/bower_components/jquery/src/css/var/rnumnonpx.js +0 -5
  181. data/spec_app/vendor/assets/bower_components/jquery/src/css.js +0 -450
  182. data/spec_app/vendor/assets/bower_components/jquery/src/data/Data.js +0 -181
  183. data/spec_app/vendor/assets/bower_components/jquery/src/data/accepts.js +0 -20
  184. data/spec_app/vendor/assets/bower_components/jquery/src/data/var/data_priv.js +0 -5
  185. data/spec_app/vendor/assets/bower_components/jquery/src/data/var/data_user.js +0 -5
  186. data/spec_app/vendor/assets/bower_components/jquery/src/data.js +0 -178
  187. data/spec_app/vendor/assets/bower_components/jquery/src/deferred.js +0 -149
  188. data/spec_app/vendor/assets/bower_components/jquery/src/deprecated.js +0 -13
  189. data/spec_app/vendor/assets/bower_components/jquery/src/dimensions.js +0 -50
  190. data/spec_app/vendor/assets/bower_components/jquery/src/effects/Tween.js +0 -114
  191. data/spec_app/vendor/assets/bower_components/jquery/src/effects/animatedSelector.js +0 -13
  192. data/spec_app/vendor/assets/bower_components/jquery/src/effects.js +0 -648
  193. data/spec_app/vendor/assets/bower_components/jquery/src/event/ajax.js +0 -13
  194. data/spec_app/vendor/assets/bower_components/jquery/src/event/alias.js +0 -39
  195. data/spec_app/vendor/assets/bower_components/jquery/src/event/support.js +0 -9
  196. data/spec_app/vendor/assets/bower_components/jquery/src/event.js +0 -868
  197. data/spec_app/vendor/assets/bower_components/jquery/src/exports/amd.js +0 -24
  198. data/spec_app/vendor/assets/bower_components/jquery/src/exports/global.js +0 -32
  199. data/spec_app/vendor/assets/bower_components/jquery/src/intro.js +0 -44
  200. data/spec_app/vendor/assets/bower_components/jquery/src/jquery.js +0 -37
  201. data/spec_app/vendor/assets/bower_components/jquery/src/manipulation/_evalUrl.js +0 -18
  202. data/spec_app/vendor/assets/bower_components/jquery/src/manipulation/support.js +0 -32
  203. data/spec_app/vendor/assets/bower_components/jquery/src/manipulation/var/rcheckableType.js +0 -3
  204. data/spec_app/vendor/assets/bower_components/jquery/src/manipulation.js +0 -580
  205. data/spec_app/vendor/assets/bower_components/jquery/src/offset.js +0 -207
  206. data/spec_app/vendor/assets/bower_components/jquery/src/outro.js +0 -1
  207. data/spec_app/vendor/assets/bower_components/jquery/src/queue/delay.js +0 -22
  208. data/spec_app/vendor/assets/bower_components/jquery/src/queue.js +0 -142
  209. data/spec_app/vendor/assets/bower_components/jquery/src/selector-native.js +0 -172
  210. data/spec_app/vendor/assets/bower_components/jquery/src/selector-sizzle.js +0 -14
  211. data/spec_app/vendor/assets/bower_components/jquery/src/selector.js +0 -1
  212. data/spec_app/vendor/assets/bower_components/jquery/src/serialize.js +0 -111
  213. data/spec_app/vendor/assets/bower_components/jquery/src/sizzle/dist/sizzle.js +0 -2067
  214. data/spec_app/vendor/assets/bower_components/jquery/src/sizzle/dist/sizzle.min.js +0 -3
  215. data/spec_app/vendor/assets/bower_components/jquery/src/sizzle/dist/sizzle.min.map +0 -1
  216. data/spec_app/vendor/assets/bower_components/jquery/src/traversing/findFilter.js +0 -100
  217. data/spec_app/vendor/assets/bower_components/jquery/src/traversing/var/rneedsContext.js +0 -6
  218. data/spec_app/vendor/assets/bower_components/jquery/src/traversing.js +0 -199
  219. data/spec_app/vendor/assets/bower_components/jquery/src/var/arr.js +0 -3
  220. data/spec_app/vendor/assets/bower_components/jquery/src/var/class2type.js +0 -4
  221. data/spec_app/vendor/assets/bower_components/jquery/src/var/concat.js +0 -5
  222. data/spec_app/vendor/assets/bower_components/jquery/src/var/hasOwn.js +0 -5
  223. data/spec_app/vendor/assets/bower_components/jquery/src/var/indexOf.js +0 -5
  224. data/spec_app/vendor/assets/bower_components/jquery/src/var/pnum.js +0 -3
  225. data/spec_app/vendor/assets/bower_components/jquery/src/var/push.js +0 -5
  226. data/spec_app/vendor/assets/bower_components/jquery/src/var/rnotwhite.js +0 -3
  227. data/spec_app/vendor/assets/bower_components/jquery/src/var/slice.js +0 -5
  228. data/spec_app/vendor/assets/bower_components/jquery/src/var/strundefined.js +0 -3
  229. data/spec_app/vendor/assets/bower_components/jquery/src/var/support.js +0 -4
  230. data/spec_app/vendor/assets/bower_components/jquery/src/var/toString.js +0 -5
  231. data/spec_app/vendor/assets/bower_components/jquery/src/wrap.js +0 -79
  232. data/spec_app/vendor/assets/stylesheets/.keep +0 -0
@@ -18,6 +18,12 @@ up.util = (($) ->
18
18
  noop = $.noop
19
19
 
20
20
  ###*
21
+ Ensures that the given function can only be called a single time.
22
+ Subsequent calls will return the return value of the first call.
23
+
24
+ Note that this is a simple implementation that
25
+ doesn't distinguish between argument lists.
26
+
21
27
  @function up.util.memoize
22
28
  @internal
23
29
  ###
@@ -233,15 +239,21 @@ up.util = (($) ->
233
239
  # we possibly received a layout-less fragment
234
240
  createElement('div', html)
235
241
 
242
+ assignPolyfill = (target, sources...) ->
243
+ for source in sources
244
+ for own key, value of source
245
+ target[key] = value
246
+ target
247
+
236
248
  ###*
237
- Merge the contents of two or more objects together into the first object.
249
+ Merge the own properties of one or more `sources` into the `target` object.
238
250
 
239
- @function up.util.extend
251
+ @function up.util.assign
240
252
  @param {Object} target
241
253
  @param {Array<Object>} sources...
242
254
  @stable
243
255
  ###
244
- extend = $.extend
256
+ assign = Object.assign || assignPolyfill
245
257
 
246
258
  ###*
247
259
  Returns a new string with whitespace removed from the beginning
@@ -330,7 +342,7 @@ up.util = (($) ->
330
342
 
331
343
  Note that empty strings or zero are *not* considered to be "missing".
332
344
 
333
- For the opposite of `up.util.isMissing` see [`up.util.isGiven`](/up.util.isGiven).
345
+ For the opposite of `up.util.isMissing()` see [`up.util.isGiven()`](/up.util.isGiven).
334
346
 
335
347
  @function up.util.isMissing
336
348
  @param object
@@ -345,7 +357,7 @@ up.util = (($) ->
345
357
 
346
358
  Note that empty strings or zero *are* considered to be "given".
347
359
 
348
- For the opposite of `up.util.isGiven` see [`up.util.isMissing`](/up.util.isMissing).
360
+ For the opposite of `up.util.isGiven()` see [`up.util.isMissing()`](/up.util.isMissing).
349
361
 
350
362
  @function up.util.isGiven
351
363
  @param object
@@ -457,7 +469,7 @@ up.util = (($) ->
457
469
  Returns whether the given argument is an object.
458
470
 
459
471
  This also returns `true` for functions, which may behave like objects in JavaScript.
460
- For an alternative that returns `false` for functions, see [`up.util.isHash`](/up.util.isHash).
472
+ For an alternative that returns `false` for functions, see [`up.util.isHash()`](/up.util.isHash).
461
473
 
462
474
  @function up.util.isObject
463
475
  @param object
@@ -563,7 +575,7 @@ up.util = (($) ->
563
575
  if isArray(object)
564
576
  object.slice()
565
577
  else if isHash(object)
566
- extend({}, object)
578
+ assign({}, object)
567
579
 
568
580
  ###*
569
581
  If given a jQuery collection, returns the underlying array of DOM element.
@@ -588,7 +600,7 @@ up.util = (($) ->
588
600
  @stable
589
601
  ###
590
602
  merge = (sources...) ->
591
- extend({}, sources...)
603
+ assign({}, sources...)
592
604
 
593
605
  ###*
594
606
  Creates an options hash from the given argument and some defaults.
@@ -766,7 +778,7 @@ up.util = (($) ->
766
778
  Waits for the given number of milliseconds, the nruns the given callback.
767
779
 
768
780
  If the number of milliseconds is zero, the callback is run in the current execution frame.
769
- See [`up.util.nextFrame`] for running a function in the next executation frame.
781
+ See [`up.util.nextFrame()`] for running a function in the next executation frame.
770
782
 
771
783
  @function up.util.setTimer
772
784
  @param {Number} millis
@@ -970,7 +982,7 @@ up.util = (($) ->
970
982
  return resolvedDeferred()
971
983
 
972
984
  # We don't finish an existing animation here, since the public API
973
- # we expose as `up.motion.animate` already does this.
985
+ # we expose as `up.motion.animate()` already does this.
974
986
  deferred = $.Deferred()
975
987
 
976
988
  transitionProperties = Object.keys(lastFrame)
@@ -981,29 +993,19 @@ up.util = (($) ->
981
993
  'transition-timing-function': opts.easing
982
994
  oldTransition = $element.css(Object.keys(transition))
983
995
 
984
- $element.addClass('up-animating')
985
-
986
- transitionFinished = ->
987
- $element.removeClass('up-animating')
988
- $element.off('transitionend', onTransitionEnd)
989
-
990
996
  onTransitionEnd = (event) ->
991
997
  completedProperty = event.originalEvent.propertyName
998
+ # Check if the transitionend event was caused by our own transition,
999
+ # and not by some other transition that happens to live on the same element.
992
1000
  if contains(transitionProperties, completedProperty)
993
1001
  deferred.resolve() # unless isDetached($element)
994
- transitionFinished()
995
1002
 
996
1003
  $element.on('transitionend', onTransitionEnd)
997
1004
 
998
- # Clean up in case we're canceled through some other code that resolves our deferred.
999
- deferred.then(transitionFinished)
1000
-
1001
- withoutCompositing = forceCompositing($element)
1002
- $element.css(transition)
1003
- $element.css(lastFrame)
1004
- $element.data(ANIMATION_DEFERRED_KEY, deferred)
1005
-
1006
1005
  deferred.then ->
1006
+ $element.removeClass('up-animating')
1007
+ $element.off('transitionend', onTransitionEnd)
1008
+
1007
1009
  $element.removeData(ANIMATION_DEFERRED_KEY)
1008
1010
  withoutCompositing()
1009
1011
 
@@ -1023,6 +1025,12 @@ up.util = (($) ->
1023
1025
  forceRepaint($element) # :(
1024
1026
  $element.css(oldTransition)
1025
1027
 
1028
+ $element.addClass('up-animating')
1029
+ withoutCompositing = forceCompositing($element)
1030
+ $element.css(transition)
1031
+ $element.data(ANIMATION_DEFERRED_KEY, deferred)
1032
+ $element.css(lastFrame)
1033
+
1026
1034
  # Return the whole deferred and not just return a thenable.
1027
1035
  # Other code will need the possibility to cancel the animation
1028
1036
  # by resolving the deferred.
@@ -1037,7 +1045,7 @@ up.util = (($) ->
1037
1045
 
1038
1046
  Does nothing if the given element is not currently animating.
1039
1047
 
1040
- Also see [`up.motion.finish`](/up.motion.finish).
1048
+ Also see [`up.motion.finish()`](/up.motion.finish).
1041
1049
 
1042
1050
  @function up.util.finishCssAnimate
1043
1051
  @param {Element|jQuery|String} elementOrSelector
@@ -1048,6 +1056,17 @@ up.util = (($) ->
1048
1056
  if existingAnimation = pluckData(this, ANIMATION_DEFERRED_KEY)
1049
1057
  existingAnimation.resolve()
1050
1058
 
1059
+ ###*
1060
+ @internal
1061
+ ###
1062
+ margins = (selectorOrElement) ->
1063
+ $element = $(selectorOrElement)
1064
+ withUnits = $element.css(['margin-top', 'margin-right', 'margin-bottom', 'margin-left'])
1065
+ top: parseFloat(withUnits['margin-top'])
1066
+ right: parseFloat(withUnits['margin-right'])
1067
+ bottom: parseFloat(withUnits['margin-bottom'])
1068
+ left: parseFloat(withUnits['margin-left'])
1069
+
1051
1070
  ###*
1052
1071
  Measures the given element.
1053
1072
 
@@ -1055,7 +1074,7 @@ up.util = (($) ->
1055
1074
  @internal
1056
1075
  ###
1057
1076
  measure = ($element, opts) ->
1058
- opts = options(opts, relative: false, inner: false)
1077
+ opts = options(opts, relative: false, inner: false, includeMargin: false)
1059
1078
 
1060
1079
  if opts.relative
1061
1080
  if opts.relative == true
@@ -1086,6 +1105,13 @@ up.util = (($) ->
1086
1105
  box.width = $element.outerWidth()
1087
1106
  box.height = $element.outerHeight()
1088
1107
 
1108
+ if opts.includeMargin
1109
+ mgs = margins($element)
1110
+ box.left -= mgs.left
1111
+ box.top -= mgs.top
1112
+ box.height += mgs.top + mgs.bottom
1113
+ box.width += mgs.left + mgs.right
1114
+
1089
1115
  box
1090
1116
 
1091
1117
  ###*
@@ -1218,23 +1244,59 @@ up.util = (($) ->
1218
1244
  already resolved.
1219
1245
 
1220
1246
  @function up.util.resolvedDeferred
1247
+ @param {Array<Object>} [args...]
1248
+ The resolution values that will be passed to callbacks
1221
1249
  @return {Deferred}
1222
1250
  @stable
1223
1251
  ###
1224
- resolvedDeferred = ->
1252
+ resolvedDeferred = (args...) ->
1225
1253
  deferred = $.Deferred()
1226
- deferred.resolve()
1254
+ deferred.resolve(args...)
1227
1255
  deferred
1228
1256
 
1229
1257
  ###*
1230
1258
  Returns a promise that is already resolved.
1231
1259
 
1232
1260
  @function up.util.resolvedPromise
1261
+ @param {Array<Object>} [args...]
1262
+ The resolution values that will be passed to callbacks
1233
1263
  @return {Promise}
1234
1264
  @stable
1235
1265
  ###
1236
- resolvedPromise = ->
1237
- resolvedDeferred().promise()
1266
+ resolvedPromise = (args...) ->
1267
+ resolvedDeferred(args...).promise()
1268
+
1269
+ ###*
1270
+ Returns a promise that is already rejected.
1271
+
1272
+ @function up.util.rejectedPromise
1273
+ @param {Array<Object>} [args...]
1274
+ The rejection values that will be passed to callbacks
1275
+ @return {Promise}
1276
+ @stable
1277
+ ###
1278
+ rejectedPromise = (args...) ->
1279
+ deferred = $.Deferred()
1280
+ deferred.reject(args...)
1281
+ deferred.promise()
1282
+
1283
+ ###*
1284
+ Returns whether the given argument is a resolved jQuery promise.
1285
+
1286
+ @return {Boolean}
1287
+ @internal
1288
+ ###
1289
+ isResolvedPromise = (promise) ->
1290
+ isPromise(promise) && promise.state?() == 'resolved'
1291
+
1292
+ ###*
1293
+ Returns whether the given argument is a resolved jQuery promise.
1294
+
1295
+ @return {Boolean}
1296
+ @internal
1297
+ ###
1298
+ isResolvedPromise = (promise) ->
1299
+ isPromise(promise) && promise.state?() == 'resolved'
1238
1300
 
1239
1301
  ###*
1240
1302
  Returns a [Deferred object](https://api.jquery.com/category/deferred-object/) that will never be resolved.
@@ -1524,7 +1586,7 @@ up.util = (($) ->
1524
1586
  hash.reset = ->
1525
1587
  newOptions = blueprint
1526
1588
  newOptions = newOptions() if isFunction(newOptions)
1527
- extend(hash, newOptions)
1589
+ assign(hash, newOptions)
1528
1590
  hash.reset()
1529
1591
  hash
1530
1592
 
@@ -1920,6 +1982,28 @@ up.util = (($) ->
1920
1982
  $insertion.replaceWith($new)
1921
1983
  $old
1922
1984
 
1985
+ ###*
1986
+ Flattens the given `array` a single level deep.
1987
+
1988
+ @function up.util.flatten
1989
+ @param {Array} array
1990
+ An array which might contain other arrays
1991
+ @return {Array}
1992
+ The flattened array
1993
+ @internal
1994
+ ###
1995
+ flatten = (array) ->
1996
+ flattened = []
1997
+ for object in array
1998
+ if isArray(object)
1999
+ flattened = flattened.concat(object)
2000
+ else
2001
+ flattened.push(object)
2002
+ flattened
2003
+
2004
+ isTruthy = (object) ->
2005
+ !!object
2006
+
1923
2007
  isDetached: isDetached
1924
2008
  requestDataAsArray: requestDataAsArray
1925
2009
  requestDataAsQuery: requestDataAsQuery
@@ -1937,7 +2021,8 @@ up.util = (($) ->
1937
2021
  $createElementFromSelector: $createElementFromSelector
1938
2022
  $createPlaceholder: $createPlaceholder
1939
2023
  selectorForElement: selectorForElement
1940
- extend: extend
2024
+ assign: assign
2025
+ assignPolyfill: assignPolyfill
1941
2026
  copy: copy
1942
2027
  merge: merge
1943
2028
  options: options
@@ -1970,6 +2055,7 @@ up.util = (($) ->
1970
2055
  isElement: isElement
1971
2056
  isJQuery: isJQuery
1972
2057
  isPromise: isPromise
2058
+ isResolvedPromise: isResolvedPromise
1973
2059
  isDeferred: isDeferred
1974
2060
  isHash: isHash
1975
2061
  isArray: isArray
@@ -1991,8 +2077,6 @@ up.util = (($) ->
1991
2077
  findWithSelf: findWithSelf
1992
2078
  contains: contains
1993
2079
  toArray: toArray
1994
- # castsToTrue: castsToTrue
1995
- # castsToFalse: castsToFalse
1996
2080
  castedAttr: castedAttr
1997
2081
  locationFromXhr: locationFromXhr
1998
2082
  titleFromXhr: titleFromXhr
@@ -2004,6 +2088,7 @@ up.util = (($) ->
2004
2088
  unresolvableDeferred: unresolvableDeferred
2005
2089
  unresolvablePromise: unresolvablePromise
2006
2090
  resolvedPromise: resolvedPromise
2091
+ rejectedPromise: rejectedPromise
2007
2092
  resolvedDeferred: resolvedDeferred
2008
2093
  resolvableWhen: resolvableWhen
2009
2094
  setMissingAttrs: setMissingAttrs
@@ -2034,6 +2119,8 @@ up.util = (($) ->
2034
2119
  evalOption: evalOption
2035
2120
  horizontalScreenHalf: horizontalScreenHalf
2036
2121
  detachWith: detachWith
2122
+ flatten: flatten
2123
+ isTruthy: isTruthy
2037
2124
 
2038
2125
  )($)
2039
2126
 
@@ -1,3 +1,3 @@
1
1
  # Bootstrap uses the class `active` to highlight the current section
2
2
  # of a navigation bar.
3
- up.navigation.config.currentClasses.push('active')
3
+ up.feedback.config.currentClasses.push('active')
@@ -0,0 +1,22 @@
1
+ #= require ./unpoly/namespace
2
+ #= require ./unpoly/util
3
+ #= require ./unpoly/browser
4
+ #= require ./unpoly/bus
5
+ #= require ./unpoly/log
6
+ #= require ./unpoly/toast
7
+ #= require ./unpoly/syntax
8
+ #= require ./unpoly/history
9
+ #= require ./unpoly/layout
10
+ #= require ./unpoly/dom
11
+ #= require_tree ./unpoly/dom
12
+ #= require ./unpoly/motion
13
+ #= require ./unpoly/proxy
14
+ #= require ./unpoly/link
15
+ #= require ./unpoly/form
16
+ #= require ./unpoly/popup
17
+ #= require ./unpoly/modal
18
+ #= require ./unpoly/tooltip
19
+ #= require ./unpoly/feedback
20
+ #= require ./unpoly/rails
21
+
22
+ up.boot()
@@ -4,6 +4,6 @@ module Unpoly
4
4
  # The current version of the unpoly-rails gem.
5
5
  # This version number is also used for releases of the Unpoly
6
6
  # frontend code.
7
- VERSION = '0.32.0'
7
+ VERSION = '0.33.0'
8
8
  end
9
9
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unpoly",
3
- "version": "0.32.0",
3
+ "version": "0.33.0",
4
4
  "description": "Unobtrusive JavaScript framework",
5
5
  "main": "dist/unpoly.js",
6
6
  "files": [
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- unpoly-rails (0.31.2)
4
+ unpoly-rails (0.32.0)
5
5
  rails (>= 3)
6
6
 
7
7
  GEM
@@ -51,7 +51,7 @@ GEM
51
51
  autoprefixer-rails (>= 5.2.1)
52
52
  sass (>= 3.3.4)
53
53
  bower-rails (0.9.2)
54
- builder (3.2.2)
54
+ builder (3.2.3)
55
55
  byebug (3.5.1)
56
56
  columnize (~> 0.8)
57
57
  debugger-linecache (~> 1.2)
@@ -93,11 +93,11 @@ GEM
93
93
  phantomjs (>= 1.9)
94
94
  railties (>= 3.2.0)
95
95
  sprockets-rails
96
- jquery-rails (4.1.1)
96
+ jquery-rails (4.2.2)
97
97
  rails-dom-testing (>= 1, < 3)
98
98
  railties (>= 4.2.0)
99
99
  thor (>= 0.14, < 2.0)
100
- json (1.8.3)
100
+ json (1.8.6)
101
101
  libv8 (3.16.14.3)
102
102
  loofah (2.0.3)
103
103
  nokogiri (>= 1.5.9)
@@ -105,14 +105,12 @@ GEM
105
105
  mime-types (>= 1.16, < 3)
106
106
  mime-types (2.99)
107
107
  mini_portile2 (2.1.0)
108
- minitest (5.9.1)
108
+ minitest (5.10.1)
109
109
  multi_json (1.12.1)
110
- nokogiri (1.6.8)
110
+ nokogiri (1.7.0.1)
111
111
  mini_portile2 (~> 2.1.0)
112
- pkg-config (~> 1.1.7)
113
112
  phantomjs (2.1.1.0)
114
- pkg-config (1.1.7)
115
- rack (1.6.4)
113
+ rack (1.6.5)
116
114
  rack-test (0.6.3)
117
115
  rack (>= 1.0)
118
116
  rails (4.2.0)
@@ -128,9 +126,9 @@ GEM
128
126
  sprockets-rails
129
127
  rails-deprecated_sanitizer (1.0.3)
130
128
  activesupport (>= 4.2.0.alpha)
131
- rails-dom-testing (1.0.7)
129
+ rails-dom-testing (1.0.8)
132
130
  activesupport (>= 4.2.0.beta, < 5.0)
133
- nokogiri (~> 1.6.0)
131
+ nokogiri (~> 1.6)
134
132
  rails-deprecated_sanitizer (>= 1.0.1)
135
133
  rails-html-sanitizer (1.0.3)
136
134
  loofah (~> 2.0)
@@ -139,7 +137,7 @@ GEM
139
137
  activesupport (= 4.2.0)
140
138
  rake (>= 0.8.7)
141
139
  thor (>= 0.18.1, < 2.0)
142
- rake (11.3.0)
140
+ rake (12.0.0)
143
141
  ref (1.0.5)
144
142
  rspec-core (3.4.1)
145
143
  rspec-support (~> 3.4.0)
@@ -182,7 +180,7 @@ GEM
182
180
  therubyracer (0.12.1)
183
181
  libv8 (~> 3.16.14.0)
184
182
  ref
185
- thor (0.19.1)
183
+ thor (0.19.4)
186
184
  thread_safe (0.3.5)
187
185
  tilt (1.4.1)
188
186
  tzinfo (1.2.2)
@@ -1,4 +1,4 @@
1
- #= require jquery
1
+ #= require jquery2
2
2
  #= require jquery_ujs
3
3
  #= require jasmine-jquery
4
4
  #= require jasmine-fixture
@@ -1,5 +1,5 @@
1
1
  =clear_after
2
2
  &:after
3
3
  content: ""
4
- display: table
4
+ display: block
5
5
  clear: both
@@ -4,15 +4,11 @@
4
4
  Rails.application.config.assets.version = '1.0'
5
5
 
6
6
  # Add additional assets to the asset load path
7
- # Rails.application.config.assets.paths << Emoji.images_path
7
+ Rails.application.config.assets.paths += Dir["#{Rails.root}/vendor/asset-libs/*"].sort_by { |dir| -dir.size }
8
8
 
9
9
  # Precompile additional assets.
10
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
11
-
12
-
13
10
  Rails.application.config.assets.precompile += %w( application.js application.css )
14
11
  Rails.application.config.assets.precompile += %w( jasmine_specs.js jasmine_specs.css )
15
12
  Rails.application.config.assets.precompile += %w( integration_test.js integration_test.css )
16
13
  Rails.application.config.assets.precompile += %w( bootstrap_manifest.js bootstrap_manifest.css )
17
14
  Rails.application.config.assets.precompile += %w( unpoly-bootstrap3.js unpoly-bootstrap3.css )
18
-