unpoly-rails 0.57.0 → 0.60.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 (186) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +393 -1
  3. data/Gemfile.lock +5 -2
  4. data/README.md +1 -1
  5. data/README_RAILS.md +1 -1
  6. data/Rakefile +10 -1
  7. data/design/es6.js +32 -0
  8. data/design/ie11.txt +9 -0
  9. data/design/measure_jquery/element_list.js +41 -0
  10. data/design/measure_jquery/up.on_vs_addEventListener.js +56 -0
  11. data/design/todo_jquery.txt +13 -0
  12. data/dist/unpoly-bootstrap3.js +8 -8
  13. data/dist/unpoly-bootstrap3.min.js +1 -1
  14. data/dist/unpoly.css +22 -20
  15. data/dist/unpoly.js +6990 -5336
  16. data/dist/unpoly.min.css +1 -1
  17. data/dist/unpoly.min.js +4 -4
  18. data/lib/assets/javascripts/unpoly-bootstrap3/viewport-ext.coffee +5 -0
  19. data/lib/assets/javascripts/unpoly.coffee +8 -6
  20. data/lib/assets/javascripts/unpoly/browser.coffee.erb +23 -118
  21. data/lib/assets/javascripts/unpoly/classes/body_shifter.coffee +36 -0
  22. data/lib/assets/javascripts/unpoly/classes/cache.coffee +4 -4
  23. data/lib/assets/javascripts/unpoly/classes/compile_pass.coffee +45 -39
  24. data/lib/assets/javascripts/unpoly/classes/config.coffee +9 -0
  25. data/lib/assets/javascripts/unpoly/classes/css_transition.coffee +18 -27
  26. data/lib/assets/javascripts/unpoly/classes/divertible_chain.coffee +39 -0
  27. data/lib/assets/javascripts/unpoly/classes/event_listener.coffee +116 -0
  28. data/lib/assets/javascripts/unpoly/classes/extract_cascade.coffee +8 -8
  29. data/lib/assets/javascripts/unpoly/classes/extract_plan.coffee +19 -19
  30. data/lib/assets/javascripts/unpoly/classes/field_observer.coffee +54 -31
  31. data/lib/assets/javascripts/unpoly/classes/{focus_tracker.coffee → focus_follower.coffee} +2 -2
  32. data/lib/assets/javascripts/unpoly/classes/follow_variant.coffee +25 -25
  33. data/lib/assets/javascripts/unpoly/classes/html_parser.coffee +4 -11
  34. data/lib/assets/javascripts/unpoly/classes/motion_controller.coffee +157 -0
  35. data/lib/assets/javascripts/unpoly/classes/params.coffee.erb +525 -0
  36. data/lib/assets/javascripts/unpoly/classes/record.coffee +8 -2
  37. data/lib/assets/javascripts/unpoly/classes/rect.js +21 -0
  38. data/lib/assets/javascripts/unpoly/classes/request.coffee +41 -35
  39. data/lib/assets/javascripts/unpoly/classes/response.coffee +7 -3
  40. data/lib/assets/javascripts/unpoly/classes/reveal_motion.coffee +102 -0
  41. data/lib/assets/javascripts/unpoly/classes/scroll_motion.coffee +67 -0
  42. data/lib/assets/javascripts/unpoly/classes/selector.coffee +60 -0
  43. data/lib/assets/javascripts/unpoly/classes/tether.coffee +105 -0
  44. data/lib/assets/javascripts/unpoly/classes/url_set.coffee +12 -7
  45. data/lib/assets/javascripts/unpoly/element.coffee.erb +1126 -0
  46. data/lib/assets/javascripts/unpoly/event.coffee.erb +437 -0
  47. data/lib/assets/javascripts/unpoly/feedback.coffee +73 -94
  48. data/lib/assets/javascripts/unpoly/form.coffee.erb +188 -181
  49. data/lib/assets/javascripts/unpoly/{dom.coffee.erb → fragment.coffee.erb} +250 -283
  50. data/lib/assets/javascripts/unpoly/framework.coffee +67 -0
  51. data/lib/assets/javascripts/unpoly/history.coffee +29 -28
  52. data/lib/assets/javascripts/unpoly/legacy.coffee +60 -0
  53. data/lib/assets/javascripts/unpoly/link.coffee.erb +127 -119
  54. data/lib/assets/javascripts/unpoly/log.coffee +99 -19
  55. data/lib/assets/javascripts/unpoly/modal.coffee.erb +95 -118
  56. data/lib/assets/javascripts/unpoly/motion.coffee.erb +158 -138
  57. data/lib/assets/javascripts/unpoly/namespace.coffee.erb +0 -5
  58. data/lib/assets/javascripts/unpoly/popup.coffee.erb +119 -102
  59. data/lib/assets/javascripts/unpoly/protocol.coffee +11 -15
  60. data/lib/assets/javascripts/unpoly/proxy.coffee +62 -65
  61. data/lib/assets/javascripts/unpoly/radio.coffee +3 -5
  62. data/lib/assets/javascripts/unpoly/rails.coffee +8 -9
  63. data/lib/assets/javascripts/unpoly/syntax.coffee.erb +173 -125
  64. data/lib/assets/javascripts/unpoly/toast.coffee +25 -24
  65. data/lib/assets/javascripts/unpoly/tooltip.coffee +89 -79
  66. data/lib/assets/javascripts/unpoly/util.coffee.erb +579 -1074
  67. data/lib/assets/javascripts/unpoly/{layout.coffee.erb → viewport.coffee.erb} +334 -264
  68. data/lib/assets/stylesheets/unpoly/dom.sass +1 -1
  69. data/lib/assets/stylesheets/unpoly/layout.sass +2 -0
  70. data/lib/assets/stylesheets/unpoly/popup.sass +0 -1
  71. data/lib/assets/stylesheets/unpoly/tooltip.sass +17 -12
  72. data/lib/unpoly/rails/version.rb +1 -1
  73. data/package.json +1 -2
  74. data/spec_app/Gemfile +2 -1
  75. data/spec_app/Gemfile.lock +38 -27
  76. data/spec_app/app/assets/javascripts/integration_test.coffee +1 -0
  77. data/spec_app/app/assets/javascripts/jasmine_specs.coffee +1 -2
  78. data/spec_app/app/assets/stylesheets/integration_test.sass +14 -1
  79. data/spec_app/app/controllers/scroll_test_controller.rb +5 -0
  80. data/spec_app/app/views/css_test/modal.erb +6 -6
  81. data/spec_app/app/views/css_test/popup.erb +44 -18
  82. data/spec_app/app/views/css_test/tooltip.erb +23 -4
  83. data/spec_app/app/views/error_test/trigger.erb +1 -1
  84. data/spec_app/app/views/form_test/basics/new.erb +1 -3
  85. data/spec_app/app/views/pages/start.erb +9 -2
  86. data/spec_app/app/views/reveal_test/long1.erb +1 -1
  87. data/spec_app/app/views/reveal_test/long2.erb +1 -1
  88. data/spec_app/app/views/reveal_test/within_document_viewport.erb +24 -0
  89. data/spec_app/app/views/reveal_test/within_overflowing_div_viewport.erb +28 -0
  90. data/spec_app/app/views/scroll_test/long1.erb +30 -0
  91. data/spec_app/config/routes.rb +1 -0
  92. data/spec_app/spec/javascripts/helpers/agent_detector.coffee +3 -0
  93. data/spec_app/spec/javascripts/helpers/async_sequence.js.coffee +1 -0
  94. data/spec_app/spec/javascripts/helpers/browser_switches.js.coffee +17 -5
  95. data/spec_app/spec/javascripts/helpers/enable_logging.js.coffee +1 -1
  96. data/spec_app/spec/javascripts/helpers/fixture.js.coffee +25 -0
  97. data/spec_app/spec/javascripts/helpers/jquery_no_conflict.js +1 -0
  98. data/spec_app/spec/javascripts/helpers/last_request.js.coffee +1 -0
  99. data/spec_app/spec/javascripts/helpers/mock_ajax.js.coffee +1 -1
  100. data/spec_app/spec/javascripts/helpers/parse_form_data.js.coffee +2 -2
  101. data/spec_app/spec/javascripts/helpers/protect_jasmine_runner.coffee +4 -1
  102. data/spec_app/spec/javascripts/helpers/remove_body_margin.js.coffee +3 -0
  103. data/spec_app/spec/javascripts/helpers/reset_history.js.coffee +2 -1
  104. data/spec_app/spec/javascripts/helpers/reset_knife.js.coffee +2 -2
  105. data/spec_app/spec/javascripts/helpers/reset_up.js.coffee +18 -11
  106. data/spec_app/spec/javascripts/helpers/restore_body_scroll.js.coffee +3 -0
  107. data/spec_app/spec/javascripts/helpers/show_lib_versions.coffee +3 -0
  108. data/spec_app/spec/javascripts/helpers/spec_util.coffee +47 -0
  109. data/spec_app/spec/javascripts/helpers/to_be_around.js.coffee +3 -0
  110. data/spec_app/spec/javascripts/helpers/to_be_array.coffee +5 -0
  111. data/spec_app/spec/javascripts/helpers/to_be_attached.coffee +6 -2
  112. data/spec_app/spec/javascripts/helpers/to_be_blank.js.coffee +3 -0
  113. data/spec_app/spec/javascripts/helpers/to_be_detached.coffee +6 -2
  114. data/spec_app/spec/javascripts/helpers/to_be_element.js.coffee +8 -0
  115. data/spec_app/spec/javascripts/helpers/to_be_error.coffee +3 -0
  116. data/spec_app/spec/javascripts/helpers/to_be_given.js.coffee +3 -0
  117. data/spec_app/spec/javascripts/helpers/to_be_hidden.js.coffee +8 -0
  118. data/spec_app/spec/javascripts/helpers/to_be_missing.js.coffee +3 -0
  119. data/spec_app/spec/javascripts/helpers/to_be_present.js.coffee +3 -0
  120. data/spec_app/spec/javascripts/helpers/to_be_scrolled_to.coffee +3 -0
  121. data/spec_app/spec/javascripts/helpers/to_be_visible.js.coffee +9 -0
  122. data/spec_app/spec/javascripts/helpers/to_contain.js.coffee +3 -0
  123. data/spec_app/spec/javascripts/helpers/to_end_with.js.coffee +3 -0
  124. data/spec_app/spec/javascripts/helpers/to_equal_jquery.js.coffee +1 -2
  125. data/spec_app/spec/javascripts/helpers/to_equal_node_list.coffee +7 -0
  126. data/spec_app/spec/javascripts/helpers/to_equal_via_is_equal.js.coffee +7 -0
  127. data/spec_app/spec/javascripts/helpers/to_have_class.js.coffee +10 -0
  128. data/spec_app/spec/javascripts/helpers/to_have_descendant.js.coffee +10 -0
  129. data/spec_app/spec/javascripts/helpers/to_have_length.js.coffee +8 -0
  130. data/spec_app/spec/javascripts/helpers/to_have_opacity.coffee +7 -3
  131. data/spec_app/spec/javascripts/helpers/to_have_own_property.js.coffee +3 -0
  132. data/spec_app/spec/javascripts/helpers/to_have_request_method.js.coffee +1 -0
  133. data/spec_app/spec/javascripts/helpers/to_have_text.js.coffee +9 -0
  134. data/spec_app/spec/javascripts/helpers/to_have_unhandled_rejections.coffee +0 -21
  135. data/spec_app/spec/javascripts/helpers/to_match_list.coffee +14 -0
  136. data/spec_app/spec/javascripts/helpers/to_match_selector.coffee +3 -0
  137. data/spec_app/spec/javascripts/helpers/to_match_text.js.coffee +4 -1
  138. data/spec_app/spec/javascripts/helpers/to_match_url.coffee +1 -0
  139. data/spec_app/spec/javascripts/helpers/trigger.js.coffee +91 -7
  140. data/spec_app/spec/javascripts/helpers/wait_until_dom_ready.js.coffee +3 -0
  141. data/spec_app/spec/javascripts/up/browser_spec.js.coffee +23 -90
  142. data/spec_app/spec/javascripts/up/classes/cache_spec.js.coffee +3 -0
  143. data/spec_app/spec/javascripts/up/classes/config_spec.coffee +24 -0
  144. data/spec_app/spec/javascripts/up/classes/divertible_chain_spec.coffee +45 -0
  145. data/spec_app/spec/javascripts/up/classes/focus_tracker_spec.coffee +5 -2
  146. data/spec_app/spec/javascripts/up/classes/params_spec.coffee +557 -0
  147. data/spec_app/spec/javascripts/up/classes/request_spec.coffee +7 -4
  148. data/spec_app/spec/javascripts/up/classes/scroll_motion_spec.js.coffee +51 -0
  149. data/spec_app/spec/javascripts/up/classes/store/memory_spec.js.coffee +3 -0
  150. data/spec_app/spec/javascripts/up/classes/store/session_spec.js.coffee +3 -2
  151. data/spec_app/spec/javascripts/up/element_spec.coffee +897 -0
  152. data/spec_app/spec/javascripts/up/event_spec.js.coffee +496 -0
  153. data/spec_app/spec/javascripts/up/feedback_spec.js.coffee +69 -48
  154. data/spec_app/spec/javascripts/up/form_spec.js.coffee +252 -194
  155. data/spec_app/spec/javascripts/up/{dom_spec.js.coffee → fragment_spec.js.coffee} +381 -388
  156. data/spec_app/spec/javascripts/up/history_spec.js.coffee +21 -19
  157. data/spec_app/spec/javascripts/up/jquery_spec.js.coffee +4 -0
  158. data/spec_app/spec/javascripts/up/legacy_spec.js.coffee +27 -0
  159. data/spec_app/spec/javascripts/up/link_spec.js.coffee +163 -160
  160. data/spec_app/spec/javascripts/up/log_spec.js.coffee +85 -12
  161. data/spec_app/spec/javascripts/up/modal_spec.js.coffee +141 -123
  162. data/spec_app/spec/javascripts/up/motion_spec.js.coffee +117 -113
  163. data/spec_app/spec/javascripts/up/popup_spec.js.coffee +60 -77
  164. data/spec_app/spec/javascripts/up/protocol_spec.js.coffee +1 -0
  165. data/spec_app/spec/javascripts/up/proxy_spec.js.coffee +85 -78
  166. data/spec_app/spec/javascripts/up/radio_spec.js.coffee +29 -22
  167. data/spec_app/spec/javascripts/up/rails_spec.js.coffee +14 -13
  168. data/spec_app/spec/javascripts/up/spec_spec.js.coffee +9 -0
  169. data/spec_app/spec/javascripts/up/syntax_spec.js.coffee +96 -66
  170. data/spec_app/spec/javascripts/up/toast_spec.js.coffee +37 -0
  171. data/spec_app/spec/javascripts/up/tooltip_spec.js.coffee +31 -47
  172. data/spec_app/spec/javascripts/up/util_spec.js.coffee +725 -562
  173. data/spec_app/spec/javascripts/up/{layout_spec.js.coffee → viewport_spec.js.coffee} +175 -149
  174. metadata +57 -19
  175. data/lib/assets/javascripts/unpoly-bootstrap3/layout-ext.coffee +0 -5
  176. data/lib/assets/javascripts/unpoly/bus.coffee.erb +0 -518
  177. data/lib/assets/javascripts/unpoly/classes/extract_step.coffee +0 -4
  178. data/lib/assets/javascripts/unpoly/classes/motion_tracker.coffee +0 -125
  179. data/lib/assets/javascripts/unpoly/params.coffee.erb +0 -522
  180. data/spec_app/spec/javascripts/helpers/append_fixture.js.coffee +0 -8
  181. data/spec_app/spec/javascripts/up/bus_spec.js.coffee +0 -210
  182. data/spec_app/spec/javascripts/up/namespace_spec.js.coffee +0 -9
  183. data/spec_app/spec/javascripts/up/params_spec.coffee +0 -768
  184. data/spec_app/vendor/asset-libs/jasmine-fixture-1.3.4/jasmine-fixture.js +0 -433
  185. data/spec_app/vendor/asset-libs/jasmine-jquery-2.1.1/.bower.json +0 -26
  186. data/spec_app/vendor/asset-libs/jasmine-jquery-2.1.1/jasmine-jquery.js +0 -838
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af0d5493649ecec8227682297684d979b948b1f80bbf9cfeae29f38f7a8d6188
4
- data.tar.gz: ef3e30eca247452227534043db0b5e69e4f815299366cedca964fc8c3bc1e9e4
3
+ metadata.gz: 22a06b1df40b84a4c8afd15b404c65addacb66469f0c374912dc5121ee41fd50
4
+ data.tar.gz: dec9cd21d854d639d59cb5de63be07f67e42c8dc6bc992de04bb7ac88dc8ac40
5
5
  SHA512:
6
- metadata.gz: 1393189464a4148ffd4a5bc1392607345b493a31847c999a0f45916c62cb912d255ca39c2ab95a2703007d14ada30930f7313585ac6e4d742e0c9dee2303e374
7
- data.tar.gz: 6e42685e20553c08ad58e4d89296ebe009766f602af8e383e6e5a40aafce27dfdde0f186ba56ecadcb41bf9a6648ae0bf3090ea6b8cfb37225c982f7940475e8
6
+ metadata.gz: f4c3fc420e7eaeb04497ad867c920a48de3c0f21cb0adc85daf58107752f9d7ef9608ac96cf917e6e1b04f6a6e0c5ffb9a649ff1e3ee089cb5f8562a49e259d9
7
+ data.tar.gz: ca57a9c137357b15a9c2e6935384f00a81422561eabd81bf499f2dcf1427e0c4e2141ee7dda8f87627891adbb3e1bb599fa7dddf729b704d7816a8491db8a634
@@ -3,7 +3,399 @@ Changelog
3
3
 
4
4
  Changes to this project will be documented in this file.
5
5
 
6
- This project mostly adheres to [Semantic Versioning](http://semver.org/).
6
+ You may browse a formatted and hyperlinked version of this file at <http://unpoly.com/changes>.
7
+
8
+
9
+ 0.60.0
10
+ ------
11
+
12
+ This is a major update with some breaking changes.
13
+
14
+ ### Highlights
15
+
16
+ - jQuery is no longer required! Unpoly now has zero dependencies.
17
+ - New `up.element` helpers to complement [native `Element` methods](https://www.w3schools.com/jsref/dom_obj_all.asp). You might not even miss jQuery anymore.
18
+ - Vastly improved performance on slow devices.
19
+ - Utility functions that work with arrays and array-like values have been greatly improved.
20
+ - The `up.util` module now plug the worst emissions in JavaScript's standard library: Equality-by-value, empty-by-value and shallow-copy. Your own objects may hook into those protocols.
21
+ - You may define a padding when [revealing](/up.reveal).
22
+ - Smooth [scrolling](/up.scroll) now mimics [native scroll behavior](https://hospodarets.com/native_smooth_scrolling).
23
+ - Fixed many positioning issues with [popups](/up.popup) and [tooltips](/up.tooltip).
24
+ - Several modules have been renamed to match the pattern `up.thing.verb()`. `up.dom` is now `up.fragment`, `up.bus` is now `up.event`, `up.layout` is now `up.viewport`.
25
+
26
+ Details below.
27
+
28
+
29
+ ### jQuery is no longer required
30
+
31
+ jQuery no longer required to use Unpoly. That means Unpoly no longer has any dependencies!
32
+
33
+ Due to its use of native DOM APIs, Unpoly is now a lot faster. Like, a **lot**. Ditching jQuery also saves you 30 KB of gzipped bundle size and speeds up your own code.
34
+
35
+ #### Migrating apps that use jQuery
36
+
37
+ Effort has been made to ensure that migrating to this version is smooth for existing apps that use jQuery.
38
+
39
+ All Unpoly functions that accept element arguments will accept both native elements and jQuery collections.
40
+
41
+ You will need to prefix some function calls with `$` to have your callbacks called with jQuery collections instead of native elements:
42
+
43
+ - The `up.compiler()` callback now receives a [native element](https://developer.mozilla.org/en-US/docs/Web/API/Element) instead of a jQuery collection. For the old behavior, use `up.$compiler()`.
44
+ - The `up.macro()` callback now received a [native element](https://developer.mozilla.org/en-US/docs/Web/API/Element) instead of a jQuery collection. For the old behavior, use `up.$macro()`.
45
+ - The event handler passed to `up.on()` now receives an element instead of a jQuery collection. For the old behavior, use `up.$on()`.
46
+
47
+ Finally, all Unpoly events (`up:*`) are now triggered as native events that can be received with [`Element#addEventListener()`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener). You may continue to use jQuery's [`jQuery#on()`](http://api.jquery.com/on/) to listen to Unpoly events, but you need to access custom properties through `event.originalEvent`.
48
+
49
+ Also know that if you use jQuery's `$.fn.trigger()` to emit events, these events are not received by native event listeners (including Unpoly). Use `up.emit()` instead to trigger an event that can be received by both native listeners and jQuery listeners.
50
+
51
+ See below for detailed changes.
52
+
53
+
54
+ ### New DOM helpers
55
+
56
+ A new, experimental `up.element` module offers convience functions for DOM manipulation and traversal.
57
+
58
+ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_obj_all.asp) and works across all [supported browsers](/up.browser) without polyfills.
59
+
60
+ | `up.element.first()` | Returns the first descendant element matching the given selector.|
61
+ | `up.element.all()` | Returns all descendant elements matching the given selector.|
62
+ | `up.element.subtree()` | Returns a list of the given parent's descendants matching the given selector. The list will also include the parent element if it matches the selector itself.|
63
+ | `up.element.closest()` | Returns the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.|
64
+ | `up.element.matches()` | Matches all elements that have a descendant matching the given selector.|
65
+ | `up.element.get()` | Casts the given value to a native [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element).|
66
+ | `up.element.toggle()` | Display or hide the given element, depending on its current visibility.|
67
+ | `up.element.toggleClass()` | Adds or removes the given class from the given element.|
68
+ | `up.element.hide()` | Hides the given element.|
69
+ | `up.element.show()` | Shows the given element.|
70
+ | `up.element.remove()` | Removes the given element from the DOM tree.|
71
+ | `up.element.replace()` | Replaces the given old element with the given new element.|
72
+ | `up.element.setAttrs()` | Sets all key/values from the given object as attributes on the given element.|
73
+ | `up.element.affix()` | Creates an element matching the given CSS selector and attaches it to the given parent element.|
74
+ | `up.element.createFromSelector()` | Creates an element matching the given CSS selector.|
75
+ | `up.element.createFromHtml()` | Creates an element from the given HTML fragment.|
76
+ | `up.element.toSelector()` | Returns a CSS selector that matches the given element as good as possible.|
77
+ | `up.element.setAttrs()` | Sets all key/values from the given object as attributes on the given element.|
78
+ | `up.element.booleanAttr()` | Returns the value of the given attribute on the given element, cast as a boolean value.|
79
+ | `up.element.numberAttr()` | Returns the value of the given attribute on the given element, cast to a number.|
80
+ | `up.element.jsonAttr()` | Reads the given attribute from the element, parsed as [JSON](https://www.json.org/).|
81
+ | `up.element.style()` | Receives [computed CSS styles](https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle) for the given element.|
82
+ | `up.element.styleNumber()` | Receives a [computed CSS property value](https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle) for the given element, casted as a number.|
83
+ | `up.element.setStyle()` | Sets the given CSS properties as inline styles on the given element.|
84
+ | `up.element.isVisible()` | Returns whether the given element is currently visible.|
85
+ | `:has()` | A non-standard [pseudo-class](https://developer.mozilla.org/en-US/docs/Learn/CSS/Introduction_to_CSS/Pseudo-classes_and_pseudo-elements) that matches all elements that have a descendant matching the given selector. |
86
+
87
+ ### Events
88
+
89
+ - The `up.bus` module has been renamed to `up.event`. We want to normalize Unpoly's API to the pattern `up.thing.verb()` in the future.
90
+ - All Unpoly events (`up:*`) are now triggered as native events that can be received with [`Element#addEventListener()`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener). You may continue to use jQuery's [`jQuery#on()`](http://api.jquery.com/on/) to listen to Unpoly events, but you need to access custom properties from `event.originalEvent`.
91
+ - Properties named `event.$target` and `event.$element` have been removed from *all* Unpoly events.
92
+ Use the standard `event.target` to retrieve the element on which the element was [emitted](/up.emit).
93
+ - `up.on()` may now bind to a given element by passing it as an (optional) first argument:
94
+
95
+ ```
96
+ up.on(element, '.button', 'click', (event) => { ... })
97
+ ```
98
+
99
+ You may use this for [event delegation](https://davidwalsh.name/event-delegate).
100
+ - The event handler passed to `up.on()` now receives an element instead of a jQuery collection:
101
+
102
+ ```
103
+ up.on('click', (event, element) => {
104
+ alert("Clicked on an " + element.tagName)
105
+ })
106
+ ```
107
+
108
+ For the old behavior, use `up.$on()`.
109
+ - `up.emit()` may now trigger an event on a given element by passing the element as an (optional) first argument:
110
+
111
+ ```
112
+ up.emit(element, 'app:user:login', { email: 'foo@example.com' })
113
+ ```
114
+ - `up.emit()` option `{ message }` is now `{ log }`.
115
+ - `up.emit()` no longer logs by default. You can enable the old efault message with `{ log: true }`.
116
+ - `up.event.nobodyPrevents()` option `{ message }` is now `{ log }`.
117
+ - The experimental function `up.reset()` was removed without replacement.
118
+ - The experimental event `up:framework:reset` was removed without replacement.
119
+
120
+
121
+
122
+ ### Custom JavaScript
123
+
124
+ - [Compilers](/up.compiler) may again return an array of destructor functions. The previous deprecation was removed.
125
+ - The `up.compiler()` callback now receives a [native element](https://developer.mozilla.org/en-US/docs/Web/API/Element) instead of a jQuery collection:
126
+
127
+ ```
128
+ up.compiler('.button', function(button) {
129
+ alert("We have a new button with class " + button.className)
130
+ })
131
+ ```
132
+
133
+ For the old behavior, use `up.$compiler()`.
134
+ - The `up.macro()` callback now received a [native element](https://developer.mozilla.org/en-US/docs/Web/API/Element) instead of a jQuery collection:
135
+
136
+ ```
137
+ up.compiler('a.fast-link', function(element) {
138
+ element.setAttribute('up-preload', 'up-preload')
139
+ element.setAttribute('up-instant', 'up-instant')
140
+ })
141
+ ```
142
+
143
+ For the old behavior, use `up.$macro()`.
144
+
145
+
146
+
147
+ ### Forms
148
+
149
+ - `up:form:submit` no longer has a `{ $form }` property. The event is now [emitted](/up.emit)
150
+ on the form that is being submitted.
151
+ - `up.observe()` now accepts a single form field, multiple fields,
152
+ a `<form>` or any container that contains form fields.
153
+ The callback is called once for each change in any of the given elements.
154
+ - The callback for `up.observe()` now receives the arguments `(value, name)`, where
155
+ `value` is the changed field value and `name` is the `[name]` of the field element:
156
+
157
+ ```
158
+ up.observe('form', function(value, name) {
159
+ console.log('The value of %o is now %o', name, value);
160
+ });
161
+ ```
162
+
163
+ The second argument was previously the observed input element as a jQuery collection.
164
+ - `up.observe()` now accepts a `{ batch: true }` option to receive all changes
165
+ since the last callback in a single object:
166
+
167
+ ```
168
+ up.observe('form', { batch: true }, function(diff) {
169
+ console.log('Observed one or more changes: %o', diff);
170
+ });
171
+ ```
172
+ - The default `up.form.config.validateTargets` no longer includes the
173
+ selector `'[up-fieldset]'`.
174
+
175
+
176
+ ### Animation
177
+
178
+ - CSS property names for custom [animations](/up.animation) and [transitions](/up.transition) must be given in `kebab-case`.
179
+ `camelCase` properties are no longer supported.
180
+
181
+
182
+ ### Fragment update API
183
+
184
+ - The module `up.dom` has been renamed to `up.fragment`. We want to normalize Unpoly's API to the pattern `up.thing.verb()` in the future.
185
+ - The experimental function `up.all()` has been removed without replacement
186
+ - The function `up.first()` has been renamed to `up.fragment.first()` to not be confused
187
+ with the low-level `up.element.first()`.
188
+ - The event `up:fragment:destroy` has been removed without replacement. This event was previously emitted before a fragment was removed. The event [`up:fragment:destroyed`](/up:fragment:destroyed) (emitted after a fragment was removed), remains in the API.
189
+ - The `up:fragment:destroyed` event no longer has a `{ $element }` property. It now has a `{ fragment }` property that contains the detached element. Like before, it is emitted on the former parent of the destroyed element.
190
+ - The properties for the `up:fragment:keep` event have been renamed.
191
+ - The properties for the `up:fragment:kept` event have been renamed.
192
+ - The properties for the `up:fragment:inserted` event have been renamed.
193
+ - The properties for the `up:fragment:destroyed` event have been renamed.
194
+
195
+
196
+ ### Utility functions
197
+
198
+ The `up.util` module now plug the worst emissions in JavaScript's standard library: Equality-by-value, empty-by-value, shallow copy:
199
+
200
+ - New experimental function `up.util.isEqual()`. It returns whether the given arguments are equal by value.
201
+ - New experimental property `up.util.isEqual.key`.
202
+ This property contains the name of a method that user-defined classes
203
+ may implement to hook into the `up.util.isEqual()` protocol.
204
+ - `up.util.isBlank()` now returns false for objects with a constructor.
205
+ - New experimental property `up.util.isBlank.key`. This property contains the name of a method that user-defined classes may implement to hook into the `up.util.isBlank()` protocol.
206
+ - New experimental property `up.util.copy.key`. This property contains the name of a method that user-defined classes may implement to hook into the `up.util.copy()` protocol.
207
+
208
+ More utility functions to have been added to work with lists:
209
+
210
+ - New experimental function `up.util.findResult()`.
211
+ It consecutively calls the given function which each element in the given list and
212
+ returns the first truthy return value.
213
+ - New experimental function `up.util.flatten()`. This flattens the given list a single level deep.
214
+ - New experimental function `up.util.flatMap()`. This maps each element using a mapping function, then flattens the result into a new array.
215
+
216
+ Some list functions have been renamed to names used in the standard `Array` API:
217
+
218
+ - `up.util.all()` was renamed to `up.util.every()` to match the standard [`Array#every()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every), and to be less confusing with `up.element.all()`.
219
+ - `up.util.any()` was renamed to `up.util.some()` to match the standard
220
+ [`Array#some()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some).
221
+ - `up.util.select()` was renamed to `up.util.filter()` to match the standard
222
+ [`Array#filter()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).
223
+ - `up.util.detect()` was renamed to `up.util.find()` to match the standard
224
+ [`Array#find()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find).
225
+
226
+ All functions that worked for arrays now also work for array-like values:
227
+
228
+ - New experimental function `up.util.isList()`. It returns whether the given argument is an array-like value, like an `Array` or a
229
+ [`NodeList`](https://developer.mozilla.org/en-US/docs/Web/API/NodeList).
230
+ - `up.util.reject()` now works for all [array-like values](/up.util.isList), not just arrays.
231
+ - `up.util.filter()` now works for all [array-like values](/up.util.isList), not just arrays.
232
+ - `up.util.find()` now works for all [array-like values](/up.util.isList), not just arrays.
233
+ - `up.util.some()` now works for all [array-like values](/up.util.isList), not just arrays.
234
+ - `up.util.every()` now works for all [array-like values](/up.util.isList), not just arrays.
235
+
236
+ And some minor changes:
237
+
238
+ - `up.util.nextFrame()` has been renamed to `up.util.task()`.
239
+ - `up.util.setTimer()` has been renamed to `up.util.timer()`.
240
+ - `up.util.toArray() now returns its unchanged argument if the argument is already an array.
241
+ - `up.util.copy()` now works with `Date` objects.
242
+ - `up.util.isBoolean()` is now stable
243
+ - `up.util.escapeHtml()` is now stable
244
+ - `up.util.isJQuery()` now returns `false` if no jQuery is loaded into the `window.jQuery` global
245
+ - `up.util.unresolvablePromise()` was removed without replacement.
246
+ - `up.util.trim()` has been removed without replacement. Use the standard
247
+ [`String#trim()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim) instead.
248
+ - `up.util.parseUrl()` now returns the correct `{ hostname }`, `{ protocol }` and `{ pathname }` properties on IE11.
249
+ - `up.util.selectorForElement()` is now `up.element.toSelector()`
250
+
251
+
252
+ ### Scrolling Viewports
253
+
254
+ - The `up.layout` module has been renamed to `up.viewport`. We want to normalize Unpoly's API to the pattern `up.thing.verb()` in the future.
255
+ - Smooth [scrolling](/up.scroll) now mimics [native scroll behavior](https://hospodarets.com/native_smooth_scrolling):
256
+ - `up.scroll()` no longer takes a `{ duration }` or `{ easing }` option.
257
+ - `up.scroll()` now takes a `{ behavior }` option. Valid values are `auto` (no animation) and `smooth` (animates the scroll motion).
258
+ - You may control the pace of `{ behavior: 'smooth' }` by also passing a `{ speed }` option`.
259
+ - New config property `up.viewport.scrollSpeed`. This sets the default speed for smooth scrolling. The default value (`1`) roughly corresponds to the default speed of Chrome's native smooth scrolling.
260
+ - Options for `up.reveal()` have been changed:
261
+ - Options `{ duration }` and `{ easing }` have been removed.
262
+ - New option `{ padding }` to pass the desired padding between the revealed element and the closest [viewport](/up.viewport) edge (in pixels).
263
+ - New option `{ snap }`. It can be `true`, `false` or a pixel number.
264
+ - New option `{ behavior }`
265
+ - New option `{ speed }`. Defaults to `up.viewport.scrollSpeed`.
266
+ - Config property `up.layout.config.snap` has been renamed to `up.viewport.config.revealSnap`.
267
+ - New config option `up.viewport.revealPadding`.
268
+ - New experimental function `up.viewport.root()`. It return the [scrolling element](https://developer.mozilla.org/en-US/docs/Web/API/document/scrollingElement)
269
+ for the browser's main content area.
270
+ - New experimental function `up.viewport.closest()`. It returns the scrolling container for the given element.
271
+ - When a `#hash` anchor is [revealed](/up.reveal) during the initial page load, Unpoly will look for an `[up-id=hash]` before looking for `[id=hash]` and `a[name=hash]`.
272
+ - Fix issues with restoring scroll positions when going back on some browsers.
273
+
274
+
275
+ ### Navigation feedback
276
+
277
+ - [`[up-alias]`](/up-nav#matching-url-by-pattern) now accepts one or more asterisks (`*`) anywhere in the pattern.
278
+ It was previously limited to match URLs with a given prefix.
279
+
280
+
281
+ ### Performance
282
+
283
+ - Use of native browser APIs has improved performance drastically.
284
+ - `[up-preload]` and `[up-instant]` links no longer bind to the `touchstart` event, increasing frame rate while scrolling.
285
+
286
+
287
+ ### Request parameters
288
+
289
+ The experimental `up.params` module has been replaced with the `up.Params` class.
290
+ Wrap any type of parameter representation into `up.Params` to get consistent API for reading
291
+ and manipulation.
292
+
293
+ The following types of parameter representation are supported:
294
+
295
+ 1. An object like `{ email: 'foo@bar.com' }`
296
+ 2. A query string like `'email=foo%40bar.com'`
297
+ 3. An array of `{ name, value }` objects like `[{ name: 'email', value: 'foo@bar.com' }]`
298
+ 4. A [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData) object.
299
+ On IE 11 and Edge, `FormData` payloads require a [polyfill for `FormData#entries()`](https://github.com/jimmywarting/FormData).
300
+
301
+ Supported methods are:
302
+
303
+ | `new up.Params()` | Constructor. |
304
+ | `up.Params#add()` | Adds a new entry with the given `name` and `value`. |
305
+ | `up.Params#addAll()` | Adds all entries from the given list of params. |
306
+ | `up.Params#addField()` | Adds params from the given [HTML form field](https://www.w3schools.com/html/html_form_elements.asp). |
307
+ | `up.Params#delete()` | Deletes all entries with the given `name`. |
308
+ | `up.Params#get()` | Returns the first param value with the given `name` from the given `params`. |
309
+ | `up.Params#set()` | Sets the `value` for the entry with given `name`. |
310
+ | `up.Params#toArray()` | Returns an array representation of this `up.Params` instance. |
311
+ | `up.Params#toFormData()` | Returns a [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) representation of this `up.Params` instance. |
312
+ | `up.Params#toObject()` | Returns an object representation of this `up.Params` instance. |
313
+ | `up.Params#toQuery()` | Returns an [query string](https://en.wikipedia.org/wiki/Query_string) for this `up.Params` instance. |
314
+ | `up.Params#toURL()` | Builds an URL string from the given base URL and this `up.Params` instance as a [query string](/up.Params.toString). |
315
+ | `up.Params.fromFields()` | Constructs a new `up.Params` instance from one or more [HTML form field](https://www.w3schools.com/html/html_form_elements.asp). |
316
+ | `up.Params.fromForm()` | Constructs a new `up.Params` instance from the given `<form>`. |
317
+ | `up.Params.fromURL()` | Constructs a new `up.Params` instance from the given URL's [query string](https://en.wikipedia.org/wiki/Query_string). |
318
+
319
+
320
+ ### Popups
321
+
322
+ - The HTML markup for a popup has been changed to make it easier to style with CSS.
323
+ The new structure is:
324
+
325
+ ```
326
+ <div class="up-popup">
327
+ <div class="up-popup-content">
328
+ Fragment content here
329
+ </div>
330
+ </div>
331
+ ```
332
+ - The default CSS styles for `.up-popup` has been changed. If you have customized popup styles,
333
+ you should check if your modifications still work with the new defaults.
334
+ - Popups now update their position when the screen is resized.
335
+ - Popups now follow scrolling when placed within [viewports](/up.viewport) other than the main document.
336
+ - The `[up-position]` attribute has been split into two attributes `[up-position]` and `[up-align]`.
337
+ Similarly the `{ position }` option has been split into two options `{ position }` and `{ align }`:
338
+ - `{ position }` defines on which side of the opening element the popup is attached. Valid values are `'top'`, `'right'`, `'bottom'` and `'left'`.
339
+ - `{ align }` defines the alignment of the popup along its side.
340
+ - When the popup's `{ position }` is `'top'` or `'bottom'`, valid `{ align }` values are `'left'`, `center'` and `'right'`.
341
+ - When the popup's `{ position }` is `'left'` or `'right'`, valid `{ align }` values are `top'`, `center'` and `bottom'`.
342
+ - New experimental function `up.popup.sync()`. It forces the popup to update its position when a
343
+ layout change is not detected automatically.
344
+ - popup elements are now appended to the respective viewport of the anchor element.
345
+ They were previously always appended to the end of the `<body>`.
346
+ - The events `up:popup:open`,`up:popup:opened`, `up:popup:close` and `up:popup:closed` have an `{ anchor }` property.
347
+ It references the element that the popup was [attached](/up.popup.attach()) to.
348
+
349
+
350
+ ### Tooltips
351
+
352
+ - The HTML markup for a popup has been changed to make it easier to style with CSS.
353
+ The new structure is:
354
+
355
+ ```
356
+ <div class="up-tooltip">
357
+ <div class="up-tooltip-content">
358
+ Tooltip text here
359
+ </div>
360
+ </div>
361
+ ```
362
+ - The default CSS styles for `.up-tooltip` have been changed. If you have customized tooltip styles,
363
+ you should check if your modifications still work with the new defaults.
364
+ - Tooltips now update their position when the screen is resized.
365
+ - Tooltips now follow scrolling when placed within [viewports](/up.viewport) other than the main document.
366
+ - The `[up-position]` attribute has been split into two attributes `[up-position]` and `[up-align]`. Similarly the `{ position }` option has been split into two options `{ position }` and `{ align }`:
367
+ - `{ position }` defines on which side of the opening element the popup is attached. Valid values are `'top'`, `'right'`, `'bottom'` and `'left'`.
368
+ - `{ align }` defines the alignment of the popup along its side.
369
+ - When the tooltip's `{ position }` is `'top'` or `'bottom'`, valid `{ align }` values are `'left'`, `center'` and `'right'`.
370
+ - When the tooltip's `{ position }` is `'left'` or `'right'`, valid `{ align }` values are `top'`, `center'` and `bottom'`.
371
+ - New experimental function `up.tooltip.sync()`. It forces the popup to update its position when a
372
+ layout change is not detected automatically.
373
+ - Tooltip elements are now appended to the respective viewport of the anchor element.
374
+ They were previously always appended to the end of the `<body>`.
375
+
376
+
377
+ ### Ruby on Rails integration
378
+
379
+ - Unpoly is now compatible with the jQuery-less UJS adapter (now [part of Action View](https://github.com/rails/rails/tree/master/actionview/app/assets/javascripts)).
380
+
381
+
382
+ ### AJAX acceleration
383
+
384
+ - The properties for the `up:link:preload` event have been renamed.
385
+
386
+
387
+ ### Modal dialogs
388
+
389
+ - Opening/closing a modal will now manipulate the `{ overflow-y }` style on the same element
390
+ that was chosen by the CSS author ([nasty details](https://makandracards.com/makandra/55801-does-html-or-body-scroll-the-page)).
391
+
392
+
393
+ ### Various
394
+
395
+ - Renamed some files so they won't be blocked by over-eager ad blockers on developer PCs.
396
+ - Deprecation warnings are only printed once per environment.
397
+
398
+
7
399
 
8
400
 
9
401
  0.57.0
@@ -4,8 +4,8 @@ GEM
4
4
  coffee-script (2.4.1)
5
5
  coffee-script-source
6
6
  execjs
7
- coffee-script-source (1.9.1.1)
8
- execjs (2.5.2)
7
+ coffee-script-source (1.12.2)
8
+ execjs (2.7.0)
9
9
  hike (1.2.3)
10
10
  json (1.8.2)
11
11
  libv8 (3.16.14.11)
@@ -40,3 +40,6 @@ DEPENDENCIES
40
40
  sprockets-standalone
41
41
  therubyracer
42
42
  uglifier
43
+
44
+ BUNDLED WITH
45
+ 1.16.1
data/README.md CHANGED
@@ -52,7 +52,7 @@ To run RSpec tests for the `unpoly-rails` gem:
52
52
 
53
53
  We are currently feeding four release channels:
54
54
 
55
- - Manual download from Github
55
+ - Manual download from GitHub
56
56
  - npm
57
57
  - Bower (which is based on Git and version tags)
58
58
  - Rubygems (as the `unpoly-rails` gem)
@@ -110,7 +110,7 @@ Development
110
110
 
111
111
  ### Before you make a PR
112
112
 
113
- Before you make a PR, please have some discussion about the proposed change by [opening an issue on Github](https://github.com/unpoly/unpoly/issues/new).
113
+ Before you make a PR, please have some discussion about the proposed change by [opening an issue on GitHub](https://github.com/unpoly/unpoly/issues/new).
114
114
 
115
115
  ### Running tests
116
116
 
data/Rakefile CHANGED
@@ -41,6 +41,15 @@ Sprockets::Standalone::RakeTask.new(:minified_assets) do |task, sprockets|
41
41
  end
42
42
 
43
43
  namespace :publish do
44
+ task :confirm do
45
+ puts "Are you ready to publish a new Unpoly version to all release channels? [y/N] "
46
+ reply = STDIN.gets.strip.downcase
47
+ unless reply == 'y'
48
+ puts "Aborted"
49
+ exit
50
+ end
51
+ end
52
+
44
53
  desc 'Build release artifacts'
45
54
  task :build do
46
55
  ENV['JS_KNIFE'] = nil
@@ -99,7 +108,7 @@ namespace :publish do
99
108
  end
100
109
 
101
110
  desc 'Build artifacts, push to git and release to package managers'
102
- task :all => [:build, :commit, :release, :remind_to_update_site] do
111
+ task :all => [:confirm, :build, :commit, :release, :remind_to_update_site] do
103
112
  end
104
113
 
105
114
  end