phoenix_live_view 1.1.31 → 1.1.32

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.
@@ -622,7 +622,9 @@ var DOM = {
622
622
  if (this.once(el, "bind-debounce")) {
623
623
  el.addEventListener("blur", () => {
624
624
  clearTimeout(this.private(el, THROTTLED));
625
- this.triggerCycle(el, DEBOUNCE_TRIGGER);
625
+ if (asyncFilter()) {
626
+ this.triggerCycle(el, DEBOUNCE_TRIGGER);
627
+ }
626
628
  });
627
629
  }
628
630
  }
@@ -2728,7 +2730,7 @@ var DOMPatch = class {
2728
2730
  transitionPendingRemoves() {
2729
2731
  const { pendingRemoves, liveSocket } = this;
2730
2732
  if (pendingRemoves.length > 0) {
2731
- liveSocket.transitionRemoves(pendingRemoves, () => {
2733
+ liveSocket.transitionRemoves(pendingRemoves, this.view, () => {
2732
2734
  pendingRemoves.forEach((el) => {
2733
2735
  const child = dom_default.firstPhxChild(el);
2734
2736
  if (child) {
@@ -4420,6 +4422,7 @@ var View = class _View {
4420
4422
  if (container) {
4421
4423
  const [tag, attrs] = container;
4422
4424
  this.el = dom_default.replaceRootContainer(this.el, tag, attrs);
4425
+ dom_default.putPrivate(this.el, "view", this);
4423
4426
  }
4424
4427
  this.childJoins = 0;
4425
4428
  this.joinPending = true;
@@ -4502,6 +4505,7 @@ var View = class _View {
4502
4505
  }
4503
4506
  attachTrueDocEl() {
4504
4507
  this.el = dom_default.byId(this.id);
4508
+ dom_default.putPrivate(this.el, "view", this);
4505
4509
  this.el.setAttribute(PHX_ROOT_ID, this.root.id);
4506
4510
  }
4507
4511
  // this is invoked for dead and live views, so we must filter by
@@ -4685,6 +4689,7 @@ var View = class _View {
4685
4689
  rootEl.setAttribute(PHX_SESSION, this.getSession());
4686
4690
  rootEl.setAttribute(PHX_STATIC, this.getStatic());
4687
4691
  rootEl.setAttribute(PHX_PARENT_ID, this.parent ? this.parent.id : null);
4692
+ dom_default.putPrivate(rootEl, "view", this);
4688
4693
  const formsToRecover = (
4689
4694
  // we go over all forms in the new DOM; because this is only the HTML for the current
4690
4695
  // view, we can be sure that all forms are owned by this view:
@@ -5965,7 +5970,7 @@ var LiveSocket = class {
5965
5970
  }
5966
5971
  // public
5967
5972
  version() {
5968
- return "1.1.31";
5973
+ return "1.1.32";
5969
5974
  }
5970
5975
  isProfileEnabled() {
5971
5976
  return this.sessionStorage.getItem(PHX_LV_PROFILE) === "true";
@@ -6244,11 +6249,12 @@ var LiveSocket = class {
6244
6249
  `[${this.binding("remove")}]`
6245
6250
  ).filter((el) => !dom_default.isChildOfAny(el, stickies));
6246
6251
  const newMainEl = dom_default.cloneNode(this.outgoingMainEl, "");
6247
- this.main.showLoader(this.loaderTimeout);
6248
- this.main.destroy();
6252
+ const oldMainView = this.main;
6253
+ oldMainView.showLoader(this.loaderTimeout);
6254
+ oldMainView.destroy();
6249
6255
  this.main = this.newRootView(newMainEl, flash, liveReferer);
6250
6256
  this.main.setRedirect(href);
6251
- this.transitionRemoves(removeEls);
6257
+ this.transitionRemoves(removeEls, oldMainView);
6252
6258
  this.main.join((joinCount, onDone) => {
6253
6259
  if (joinCount === 1 && this.commitPendingLink(linkRef)) {
6254
6260
  this.requestDOMUpdate(() => {
@@ -6262,7 +6268,7 @@ var LiveSocket = class {
6262
6268
  }
6263
6269
  });
6264
6270
  }
6265
- transitionRemoves(elements, callback) {
6271
+ transitionRemoves(elements, view, callback) {
6266
6272
  const removeAttr = this.binding("remove");
6267
6273
  const silenceEvents = (e) => {
6268
6274
  e.preventDefault();
@@ -6272,7 +6278,8 @@ var LiveSocket = class {
6272
6278
  for (const event of this.boundEventNames) {
6273
6279
  el.addEventListener(event, silenceEvents, true);
6274
6280
  }
6275
- this.execJS(el, el.getAttribute(removeAttr), "remove");
6281
+ const e = new CustomEvent("phx:exec", { detail: { sourceElement: el } });
6282
+ js_default.exec(e, "remove", el.getAttribute(removeAttr), view, el);
6276
6283
  });
6277
6284
  this.requestDOMUpdate(() => {
6278
6285
  elements.forEach((el) => {
@@ -6295,7 +6302,7 @@ var LiveSocket = class {
6295
6302
  let view;
6296
6303
  const viewEl = dom_default.closestViewEl(childEl);
6297
6304
  if (viewEl) {
6298
- view = this.getViewByEl(viewEl);
6305
+ view = dom_default.private(viewEl, "view");
6299
6306
  } else {
6300
6307
  if (!childEl.isConnected) {
6301
6308
  return null;