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.
@@ -667,7 +667,9 @@ var LiveView = (() => {
667
667
  if (this.once(el, "bind-debounce")) {
668
668
  el.addEventListener("blur", () => {
669
669
  clearTimeout(this.private(el, THROTTLED));
670
- this.triggerCycle(el, DEBOUNCE_TRIGGER);
670
+ if (asyncFilter()) {
671
+ this.triggerCycle(el, DEBOUNCE_TRIGGER);
672
+ }
671
673
  });
672
674
  }
673
675
  }
@@ -2775,7 +2777,7 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
2775
2777
  transitionPendingRemoves() {
2776
2778
  const { pendingRemoves, liveSocket } = this;
2777
2779
  if (pendingRemoves.length > 0) {
2778
- liveSocket.transitionRemoves(pendingRemoves, () => {
2780
+ liveSocket.transitionRemoves(pendingRemoves, this.view, () => {
2779
2781
  pendingRemoves.forEach((el) => {
2780
2782
  const child = dom_default.firstPhxChild(el);
2781
2783
  if (child) {
@@ -4466,6 +4468,7 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
4466
4468
  if (container) {
4467
4469
  const [tag, attrs] = container;
4468
4470
  this.el = dom_default.replaceRootContainer(this.el, tag, attrs);
4471
+ dom_default.putPrivate(this.el, "view", this);
4469
4472
  }
4470
4473
  this.childJoins = 0;
4471
4474
  this.joinPending = true;
@@ -4548,6 +4551,7 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
4548
4551
  }
4549
4552
  attachTrueDocEl() {
4550
4553
  this.el = dom_default.byId(this.id);
4554
+ dom_default.putPrivate(this.el, "view", this);
4551
4555
  this.el.setAttribute(PHX_ROOT_ID, this.root.id);
4552
4556
  }
4553
4557
  // this is invoked for dead and live views, so we must filter by
@@ -4731,6 +4735,7 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
4731
4735
  rootEl.setAttribute(PHX_SESSION, this.getSession());
4732
4736
  rootEl.setAttribute(PHX_STATIC, this.getStatic());
4733
4737
  rootEl.setAttribute(PHX_PARENT_ID, this.parent ? this.parent.id : null);
4738
+ dom_default.putPrivate(rootEl, "view", this);
4734
4739
  const formsToRecover = (
4735
4740
  // we go over all forms in the new DOM; because this is only the HTML for the current
4736
4741
  // view, we can be sure that all forms are owned by this view:
@@ -6009,7 +6014,7 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
6009
6014
  }
6010
6015
  // public
6011
6016
  version() {
6012
- return "1.1.31";
6017
+ return "1.1.32";
6013
6018
  }
6014
6019
  isProfileEnabled() {
6015
6020
  return this.sessionStorage.getItem(PHX_LV_PROFILE) === "true";
@@ -6289,11 +6294,12 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
6289
6294
  `[${this.binding("remove")}]`
6290
6295
  ).filter((el) => !dom_default.isChildOfAny(el, stickies));
6291
6296
  const newMainEl = dom_default.cloneNode(this.outgoingMainEl, "");
6292
- this.main.showLoader(this.loaderTimeout);
6293
- this.main.destroy();
6297
+ const oldMainView = this.main;
6298
+ oldMainView.showLoader(this.loaderTimeout);
6299
+ oldMainView.destroy();
6294
6300
  this.main = this.newRootView(newMainEl, flash, liveReferer);
6295
6301
  this.main.setRedirect(href);
6296
- this.transitionRemoves(removeEls);
6302
+ this.transitionRemoves(removeEls, oldMainView);
6297
6303
  this.main.join((joinCount, onDone) => {
6298
6304
  if (joinCount === 1 && this.commitPendingLink(linkRef)) {
6299
6305
  this.requestDOMUpdate(() => {
@@ -6307,7 +6313,7 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
6307
6313
  }
6308
6314
  });
6309
6315
  }
6310
- transitionRemoves(elements, callback) {
6316
+ transitionRemoves(elements, view, callback) {
6311
6317
  const removeAttr = this.binding("remove");
6312
6318
  const silenceEvents = (e) => {
6313
6319
  e.preventDefault();
@@ -6317,7 +6323,8 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
6317
6323
  for (const event of this.boundEventNames) {
6318
6324
  el.addEventListener(event, silenceEvents, true);
6319
6325
  }
6320
- this.execJS(el, el.getAttribute(removeAttr), "remove");
6326
+ const e = new CustomEvent("phx:exec", { detail: { sourceElement: el } });
6327
+ js_default.exec(e, "remove", el.getAttribute(removeAttr), view, el);
6321
6328
  });
6322
6329
  this.requestDOMUpdate(() => {
6323
6330
  elements.forEach((el) => {
@@ -6340,7 +6347,7 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
6340
6347
  let view;
6341
6348
  const viewEl = dom_default.closestViewEl(childEl);
6342
6349
  if (viewEl) {
6343
- view = this.getViewByEl(viewEl);
6350
+ view = dom_default.private(viewEl, "view");
6344
6351
  } else {
6345
6352
  if (!childEl.isConnected) {
6346
6353
  return null;