Skip to content

Commit

Permalink
bump build
Browse files Browse the repository at this point in the history
  • Loading branch information
SteffenDE committed Feb 11, 2024
1 parent 1d7080a commit 9814067
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 141 deletions.
91 changes: 47 additions & 44 deletions priv/static/phoenix_live_view.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions priv/static/phoenix_live_view.cjs.js.map

Large diffs are not rendered by default.

91 changes: 47 additions & 44 deletions priv/static/phoenix_live_view.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions priv/static/phoenix_live_view.esm.js.map

Large diffs are not rendered by default.

91 changes: 47 additions & 44 deletions priv/static/phoenix_live_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -2183,38 +2183,9 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
let updates = [];
let appendPrependUpdates = [];
let externalFormTriggered = null;
this.trackBefore("added", container);
this.trackBefore("updated", container, container);
liveSocket.time("morphdom", () => {
this.streams.forEach(([ref, inserts, deleteIds, reset]) => {
inserts.forEach(([key, streamAt, limit]) => {
this.streamInserts[key] = { ref, streamAt, limit, reset };
});
if (reset !== void 0) {
dom_default.all(container, `[${PHX_STREAM_REF}="${ref}"]`, (child) => {
this.removeStreamChildElement(child);
});
}
deleteIds.forEach((id) => {
let child = container.querySelector(`[id="${id}"]`);
if (child) {
this.removeStreamChildElement(child);
}
});
});
if (isJoinPatch) {
dom_default.all(this.container, `[${phxUpdate}=${PHX_STREAM}]`, (el) => {
this.liveSocket.owner(el, (view2) => {
if (view2 === this.view) {
Array.from(el.children).forEach((child) => {
this.removeStreamChildElement(child);
});
}
});
});
}
morphdom_esm_default(targetContainer, html, {
childrenOnly: targetContainer.getAttribute(PHX_COMPONENT) === null,
function morph(targetContainer2, source) {
morphdom_esm_default(targetContainer2, source, {
childrenOnly: targetContainer2.getAttribute(PHX_COMPONENT) === null,
getNodeKey: (node) => {
if (dom_default.isPhxDestroyed(node)) {
return null;
Expand All @@ -2233,12 +2204,6 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
return parent.appendChild(child);
}
this.setStreamRef(child, ref);
child.querySelectorAll(`[${PHX_MAGIC_ID}][${PHX_SKIP}]`).forEach((el) => {
const component = this.streamComponentRestore[el.getAttribute(PHX_MAGIC_ID)];
if (component) {
el.replaceWith(component);
}
});
if (streamAt === 0) {
parent.insertAdjacentElement("afterbegin", child);
} else if (streamAt === -1) {
Expand All @@ -2253,7 +2218,13 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
if (dom_default.isFeedbackContainer(el, phxFeedbackFor))
feedbackContainers.push(el);
this.trackBefore("added", el);
return el;
let morphedEl = el;
if (!isJoinPatch && this.streamComponentRestore[el.id]) {
morphedEl = this.streamComponentRestore[el.id];
delete this.streamComponentRestore[el.id];
morph.bind(this)(morphedEl, el);
}
return morphedEl;
},
onNodeAdded: (el) => {
if (el.getAttribute) {
Expand Down Expand Up @@ -2361,6 +2332,38 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
}
}
});
}
this.trackBefore("added", container);
this.trackBefore("updated", container, container);
liveSocket.time("morphdom", () => {
this.streams.forEach(([ref, inserts, deleteIds, reset]) => {
inserts.forEach(([key, streamAt, limit]) => {
this.streamInserts[key] = { ref, streamAt, limit, reset };
});
if (reset !== void 0) {
dom_default.all(container, `[${PHX_STREAM_REF}="${ref}"]`, (child) => {
this.removeStreamChildElement(child);
});
}
deleteIds.forEach((id) => {
let child = container.querySelector(`[id="${id}"]`);
if (child) {
this.removeStreamChildElement(child);
}
});
});
if (isJoinPatch) {
dom_default.all(this.container, `[${phxUpdate}=${PHX_STREAM}]`, (el) => {
this.liveSocket.owner(el, (view2) => {
if (view2 === this.view) {
Array.from(el.children).forEach((child) => {
this.removeStreamChildElement(child);
});
}
});
});
}
morph.bind(this)(targetContainer, html);
});
if (liveSocket.isDebugEnabled()) {
detectDuplicateIds();
Expand Down Expand Up @@ -2399,12 +2402,12 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
removeStreamChildElement(child) {
if (!this.maybePendingRemove(child)) {
if (this.streamInserts[child.id]) {
child.querySelectorAll(`[${PHX_MAGIC_ID}]`).forEach((el) => {
this.streamComponentRestore[el.getAttribute(PHX_MAGIC_ID)] = el;
});
this.streamComponentRestore[child.id] = child;
child.remove();
} else {
child.remove();
this.onNodeDiscarded(child);
}
child.remove();
this.onNodeDiscarded(child);
}
}
getStreamInsert(el) {
Expand Down
Loading

0 comments on commit 9814067

Please sign in to comment.