phoenix_live_view 0.17.1 → 0.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.17.2 (2021-10-22)
4
+
5
+ ### Bug fixes
6
+ - Fix HTML engine bug causing attribute expressions to be incorrectly evaluated in certain cases
7
+ - Fix show/hide/toggle custom display not being restored.
8
+ - Fix default `to` target for `JS.show|hide|dispatch`
9
+ - Fix form input targetting
10
+
3
11
  ## 0.17.1 (2021-10-21)
4
12
 
5
13
  ### Bug fixes
@@ -76,6 +84,7 @@ Some functionality that was previously deprecated has been removed:
76
84
 
77
85
  ### Enhancements
78
86
  - Allow slots in function components: they are marked as `<:slot_name>` and can be rendered with `<%= render_slot @slot_name %>`
87
+ - Add JS command for executing JavaScript utility operations on the client with an extended push API
79
88
  - Optimize string attributes:
80
89
  - If the attribute is a string interpolation, such as `<div class={"foo bar #{@baz}"}>`, only the interpolation part is marked as dynamic
81
90
  - If the attribute can be empty, such as "class" and "style", keep the attribute name as static
@@ -19,13 +19,18 @@ let JS = {
19
19
  // commands
20
20
 
21
21
  exec_dispatch(eventType, phxEvent, view, sourceEl, {to, event, detail}){
22
- DOM.all(document, to, el => DOM.dispatchEvent(el, event, detail))
22
+ if(to){
23
+ DOM.all(document, to, el => DOM.dispatchEvent(el, event, detail))
24
+ } else {
25
+ DOM.dispatchEvent(sourceEl, event, detail)
26
+ }
23
27
  },
24
28
 
25
29
  exec_push(eventType, phxEvent, view, sourceEl, args){
26
30
  let {event, data, target, page_loading, loading, value} = args
27
31
  let pushOpts = {page_loading: !!page_loading, loading: loading, value: value}
28
- let phxTarget = target || sourceEl.getAttribute(view.binding("target")) || sourceEl
32
+ let targetSrc = eventType === "change" ? sourceEl.form : sourceEl
33
+ let phxTarget = target || targetSrc.getAttribute(view.binding("target")) || targetSrc
29
34
  view.withinTargets(phxTarget, (targetView, targetCtx) => {
30
35
  if(eventType === "change"){
31
36
  let {newCid, _target, callback} = args
@@ -75,7 +80,7 @@ let JS = {
75
80
  if(to){
76
81
  DOM.all(document, to, el => this.show(eventType, view, el, display, transition, time))
77
82
  } else {
78
- this.show(eventType, view, el, transition, time)
83
+ this.show(eventType, view, sourceEl, transition, time)
79
84
  }
80
85
  },
81
86
 
@@ -83,7 +88,7 @@ let JS = {
83
88
  if(to){
84
89
  DOM.all(document, to, el => this.hide(eventType, view, el, display, transition, time))
85
90
  } else {
86
- this.hide(eventType, view, el, dispaly, transition, time)
91
+ this.hide(eventType, view, sourceEl, display, transition, time)
87
92
  }
88
93
  },
89
94
 
@@ -118,7 +123,7 @@ let JS = {
118
123
  } else {
119
124
  if(eventType === "remove"){ return }
120
125
  this.addOrRemoveClasses(el, in_classes, out_classes)
121
- DOM.putSticky(el, "toggle", currentEl => currentEl.style.display = "block")
126
+ DOM.putSticky(el, "toggle", currentEl => currentEl.style.display = (display || "block"))
122
127
  view.transition(time, () => {
123
128
  this.addOrRemoveClasses(el, [], in_classes)
124
129
  })
@@ -161,4 +166,4 @@ let JS = {
161
166
  }
162
167
  }
163
168
 
164
- export default JS
169
+ export default JS
@@ -792,4 +792,4 @@ class TransitionSet {
792
792
  this.pendingOps.forEach(op => op())
793
793
  this.pendingOps = []
794
794
  }
795
- }
795
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phoenix_live_view",
3
- "version": "0.17.1",
3
+ "version": "0.17.2",
4
4
  "description": "The Phoenix LiveView JavaScript client.",
5
5
  "license": "MIT",
6
6
  "module": "./priv/static/phoenix_live_view.esm.js",