phoenix_live_view 1.1.12 → 1.1.14
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/assets/js/phoenix_live_view/js.js +1 -0
- package/assets/js/phoenix_live_view/view.js +18 -3
- package/package.json +1 -1
- package/priv/static/phoenix_live_view.cjs.js +13 -5
- package/priv/static/phoenix_live_view.cjs.js.map +2 -2
- package/priv/static/phoenix_live_view.esm.js +13 -5
- package/priv/static/phoenix_live_view.esm.js.map +2 -2
- package/priv/static/phoenix_live_view.js +13 -5
- package/priv/static/phoenix_live_view.min.js +6 -6
|
@@ -38,6 +38,8 @@ import {
|
|
|
38
38
|
PHX_VIEWPORT_BOTTOM,
|
|
39
39
|
MAX_CHILD_JOIN_ATTEMPTS,
|
|
40
40
|
PHX_LV_PID,
|
|
41
|
+
PHX_PORTAL,
|
|
42
|
+
PHX_TELEPORTED_REF,
|
|
41
43
|
} from "./constants";
|
|
42
44
|
|
|
43
45
|
import {
|
|
@@ -398,7 +400,7 @@ export default class View {
|
|
|
398
400
|
this.log(type, () => ["", clone(rawDiff)]);
|
|
399
401
|
const { diff, reply, events, title } = Rendered.extract(rawDiff);
|
|
400
402
|
callback({ diff, reply, events });
|
|
401
|
-
if (typeof title === "string" || type == "mount") {
|
|
403
|
+
if (typeof title === "string" || (type == "mount" && this.isMain())) {
|
|
402
404
|
window.requestAnimationFrame(() => DOM.putTitle(title));
|
|
403
405
|
}
|
|
404
406
|
}
|
|
@@ -724,6 +726,15 @@ export default class View {
|
|
|
724
726
|
// recovery events are done.
|
|
725
727
|
const template = document.createElement("template");
|
|
726
728
|
template.innerHTML = html;
|
|
729
|
+
|
|
730
|
+
// we special case <.portal> here and teleport it into our temporary DOM for recovery
|
|
731
|
+
// as we'd otherwise not find teleported forms
|
|
732
|
+
DOM.all(template.content, `[${PHX_PORTAL}]`).forEach((portalTemplate) => {
|
|
733
|
+
template.content.firstElementChild.appendChild(
|
|
734
|
+
portalTemplate.content.firstElementChild,
|
|
735
|
+
);
|
|
736
|
+
});
|
|
737
|
+
|
|
727
738
|
// because we work with a template element, we must manually copy the attributes
|
|
728
739
|
// otherwise the owner / target helpers don't work properly
|
|
729
740
|
const rootEl = template.content.firstElementChild;
|
|
@@ -1313,7 +1324,8 @@ export default class View {
|
|
|
1313
1324
|
finish(null);
|
|
1314
1325
|
}
|
|
1315
1326
|
},
|
|
1316
|
-
error: (reason) =>
|
|
1327
|
+
error: (reason) =>
|
|
1328
|
+
reject(new Error(`failed with reason: ${JSON.stringify(reason)}`)),
|
|
1317
1329
|
timeout: () => {
|
|
1318
1330
|
reject(new Error("timeout"));
|
|
1319
1331
|
if (this.joinCount === oldJoinCount) {
|
|
@@ -2088,7 +2100,10 @@ export default class View {
|
|
|
2088
2100
|
|
|
2089
2101
|
const phxChange = this.binding("change");
|
|
2090
2102
|
|
|
2091
|
-
return DOM.all(
|
|
2103
|
+
return DOM.all(
|
|
2104
|
+
document,
|
|
2105
|
+
`#${CSS.escape(this.id)} form[${phxChange}], [${PHX_TELEPORTED_REF}="${CSS.escape(this.id)}"] form[${phxChange}]`,
|
|
2106
|
+
)
|
|
2092
2107
|
.filter((form) => form.id)
|
|
2093
2108
|
.filter((form) => form.elements.length > 0)
|
|
2094
2109
|
.filter(
|
package/package.json
CHANGED
|
@@ -3398,7 +3398,7 @@ var JS = {
|
|
|
3398
3398
|
apply: (fromEl, toEl) => {
|
|
3399
3399
|
Array.from(fromEl.attributes).forEach((attr) => {
|
|
3400
3400
|
if (attrs.some(
|
|
3401
|
-
(toIgnore) => attr.name == toIgnore || toIgnore.includes("*") && attr.name.match(toIgnore) != null
|
|
3401
|
+
(toIgnore) => attr.name == toIgnore || toIgnore === "*" || toIgnore.includes("*") && attr.name.match(toIgnore) != null
|
|
3402
3402
|
)) {
|
|
3403
3403
|
toEl.setAttribute(attr.name, attr.value);
|
|
3404
3404
|
}
|
|
@@ -4276,7 +4276,7 @@ var View = class _View {
|
|
|
4276
4276
|
this.log(type, () => ["", clone(rawDiff)]);
|
|
4277
4277
|
const { diff, reply, events, title } = Rendered.extract(rawDiff);
|
|
4278
4278
|
callback({ diff, reply, events });
|
|
4279
|
-
if (typeof title === "string" || type == "mount") {
|
|
4279
|
+
if (typeof title === "string" || type == "mount" && this.isMain()) {
|
|
4280
4280
|
window.requestAnimationFrame(() => dom_default.putTitle(title));
|
|
4281
4281
|
}
|
|
4282
4282
|
}
|
|
@@ -4538,6 +4538,11 @@ var View = class _View {
|
|
|
4538
4538
|
const oldForms = this.root.formsForRecovery;
|
|
4539
4539
|
const template = document.createElement("template");
|
|
4540
4540
|
template.innerHTML = html;
|
|
4541
|
+
dom_default.all(template.content, `[${PHX_PORTAL}]`).forEach((portalTemplate) => {
|
|
4542
|
+
template.content.firstElementChild.appendChild(
|
|
4543
|
+
portalTemplate.content.firstElementChild
|
|
4544
|
+
);
|
|
4545
|
+
});
|
|
4541
4546
|
const rootEl = template.content.firstElementChild;
|
|
4542
4547
|
rootEl.id = this.id;
|
|
4543
4548
|
rootEl.setAttribute(PHX_ROOT_ID, this.root.id);
|
|
@@ -5013,7 +5018,7 @@ var View = class _View {
|
|
|
5013
5018
|
finish(null);
|
|
5014
5019
|
}
|
|
5015
5020
|
},
|
|
5016
|
-
error: (reason) => reject(new Error(`failed with reason: ${reason}`)),
|
|
5021
|
+
error: (reason) => reject(new Error(`failed with reason: ${JSON.stringify(reason)}`)),
|
|
5017
5022
|
timeout: () => {
|
|
5018
5023
|
reject(new Error("timeout"));
|
|
5019
5024
|
if (this.joinCount === oldJoinCount) {
|
|
@@ -5638,7 +5643,10 @@ var View = class _View {
|
|
|
5638
5643
|
return {};
|
|
5639
5644
|
}
|
|
5640
5645
|
const phxChange = this.binding("change");
|
|
5641
|
-
return dom_default.all(
|
|
5646
|
+
return dom_default.all(
|
|
5647
|
+
document,
|
|
5648
|
+
`#${CSS.escape(this.id)} form[${phxChange}], [${PHX_TELEPORTED_REF}="${CSS.escape(this.id)}"] form[${phxChange}]`
|
|
5649
|
+
).filter((form) => form.id).filter((form) => form.elements.length > 0).filter(
|
|
5642
5650
|
(form) => form.getAttribute(this.binding(PHX_AUTO_RECOVER)) !== "ignore"
|
|
5643
5651
|
).map((form) => {
|
|
5644
5652
|
const clonedForm = form.cloneNode(true);
|
|
@@ -5795,7 +5803,7 @@ var LiveSocket = class {
|
|
|
5795
5803
|
}
|
|
5796
5804
|
// public
|
|
5797
5805
|
version() {
|
|
5798
|
-
return "1.1.
|
|
5806
|
+
return "1.1.14";
|
|
5799
5807
|
}
|
|
5800
5808
|
isProfileEnabled() {
|
|
5801
5809
|
return this.sessionStorage.getItem(PHX_LV_PROFILE) === "true";
|