hotwire-native-dev-tools 0.3.0 → 0.3.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.
|
@@ -729,7 +729,7 @@ const E = () => `
|
|
|
729
729
|
width: 80%;
|
|
730
730
|
}
|
|
731
731
|
`;
|
|
732
|
-
class
|
|
732
|
+
class B {
|
|
733
733
|
constructor() {
|
|
734
734
|
this.printedWarnings = [];
|
|
735
735
|
}
|
|
@@ -759,34 +759,34 @@ class T {
|
|
|
759
759
|
return Array.from(document.querySelectorAll("turbo-frame")).map((t) => t.id);
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
|
-
const
|
|
762
|
+
const c = (i) => JSON.parse(localStorage.getItem("hotwire-native-dev-tools") || "{}")[i], l = (i, t) => {
|
|
763
763
|
let e = JSON.parse(localStorage.getItem("hotwire-native-dev-tools") || "{}");
|
|
764
764
|
e[i] = t, localStorage.setItem("hotwire-native-dev-tools", JSON.stringify(e));
|
|
765
|
-
},
|
|
765
|
+
}, $ = () => {
|
|
766
766
|
localStorage.removeItem("hotwire-native-dev-tools");
|
|
767
|
-
}, u = () =>
|
|
767
|
+
}, u = () => c("consoleFilterLevels") || {
|
|
768
768
|
warn: !0,
|
|
769
769
|
error: !0,
|
|
770
770
|
debug: !0,
|
|
771
771
|
info: !0,
|
|
772
772
|
log: !0
|
|
773
|
-
},
|
|
773
|
+
}, I = (i, t) => {
|
|
774
774
|
const e = u();
|
|
775
775
|
return e[i] = t, l("consoleFilterLevels", e), e;
|
|
776
|
-
}, m = () =>
|
|
776
|
+
}, m = () => c("consoleLogBlacklist") || [], F = (i) => {
|
|
777
777
|
i = i.trim();
|
|
778
|
-
const t =
|
|
778
|
+
const t = c("consoleLogBlacklist") || [];
|
|
779
779
|
return t.includes(i) || (t.push(i), l("consoleLogBlacklist", t)), t;
|
|
780
|
-
},
|
|
781
|
-
let t =
|
|
780
|
+
}, q = (i) => {
|
|
781
|
+
let t = c("consoleLogBlacklist") || [];
|
|
782
782
|
return t = t.filter((e) => e !== i), l("consoleLogBlacklist", t), t;
|
|
783
|
-
},
|
|
783
|
+
}, g = (i, t) => {
|
|
784
784
|
let e = null;
|
|
785
785
|
return (...o) => {
|
|
786
786
|
const s = () => i.apply(void 0, o);
|
|
787
787
|
clearTimeout(e), e = setTimeout(s, t);
|
|
788
788
|
};
|
|
789
|
-
}, { userAgent:
|
|
789
|
+
}, { userAgent: k } = window.navigator, L = /iOS/.test(k), M = /Android/.test(k), f = () => L ? "ios" : M ? "android" : "unknown", A = () => {
|
|
790
790
|
switch (f()) {
|
|
791
791
|
case "android":
|
|
792
792
|
return "Android";
|
|
@@ -795,10 +795,13 @@ const a = (i) => JSON.parse(localStorage.getItem("hotwire-native-dev-tools") ||
|
|
|
795
795
|
default:
|
|
796
796
|
return "<unknown>";
|
|
797
797
|
}
|
|
798
|
-
},
|
|
799
|
-
const t =
|
|
798
|
+
}, H = (i) => document.querySelector(`meta[name="${i}"]`), v = (i) => {
|
|
799
|
+
const t = H(i);
|
|
800
800
|
return t && t.content;
|
|
801
|
-
},
|
|
801
|
+
}, y = (i) => {
|
|
802
|
+
const t = Array.from(i.attributes).map((e) => `${e.name}="${e.value}"`).join(" ");
|
|
803
|
+
return `<${i.tagName.toLowerCase()}${t ? " " + t : ""}></${i.tagName.toLowerCase()}>`;
|
|
804
|
+
}, z = `
|
|
802
805
|
<svg width="100%" height="100%" viewBox="0 0 294 320">
|
|
803
806
|
<g transform="matrix(1,0,0,1,-28.38,-15.268)">
|
|
804
807
|
<g transform="matrix(1,0,0,1,-462.157,-144.417)">
|
|
@@ -806,12 +809,12 @@ const a = (i) => JSON.parse(localStorage.getItem("hotwire-native-dev-tools") ||
|
|
|
806
809
|
</g>
|
|
807
810
|
</g>
|
|
808
811
|
</svg>
|
|
809
|
-
`,
|
|
812
|
+
`, N = `
|
|
810
813
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
811
814
|
<!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.-->
|
|
812
815
|
<path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM385 215c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-71-71L280 392c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-214.1-71 71c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9L239 103c9.4-9.4 24.6-9.4 33.9 0L385 215z"/>
|
|
813
816
|
</svg>
|
|
814
|
-
`,
|
|
817
|
+
`, P = `
|
|
815
818
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
816
819
|
<!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.-->
|
|
817
820
|
<path d="M256 0a256 256 0 1 0 0 512A256 256 0 1 0 256 0zM127 297c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l71 71L232 120c0-13.3 10.7-24 24-24s24 10.7 24 24l0 214.1 71-71c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9L273 409c-9.4 9.4-24.6 9.4-33.9 0L127 297z"/>
|
|
@@ -826,56 +829,65 @@ const a = (i) => JSON.parse(localStorage.getItem("hotwire-native-dev-tools") ||
|
|
|
826
829
|
<!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.-->
|
|
827
830
|
<path d="M135.2 17.7L128 32 32 32C14.3 32 0 46.3 0 64S14.3 96 32 96l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-96 0-7.2-14.3C307.4 6.8 296.3 0 284.2 0L163.8 0c-12.1 0-23.2 6.8-28.6 17.7zM416 128L32 128 53.2 467c1.6 25.3 22.6 45 47.9 45l245.8 0c25.3 0 46.3-19.7 47.9-45L416 128z"/>
|
|
828
831
|
</svg>
|
|
829
|
-
`,
|
|
832
|
+
`, D = `
|
|
830
833
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
831
834
|
<!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.-->
|
|
832
835
|
<path d="M142.9 142.9c-17.5 17.5-30.1 38-37.8 59.8c-5.9 16.7-24.2 25.4-40.8 19.5s-25.4-24.2-19.5-40.8C55.6 150.7 73.2 122 97.6 97.6c87.2-87.2 228.3-87.5 315.8-1L455 55c6.9-6.9 17.2-8.9 26.2-5.2s14.8 12.5 14.8 22.2l0 128c0 13.3-10.7 24-24 24l-8.4 0c0 0 0 0 0 0L344 224c-9.7 0-18.5-5.8-22.2-14.8s-1.7-19.3 5.2-26.2l41.1-41.1c-62.6-61.5-163.1-61.2-225.3 1zM16 312c0-13.3 10.7-24 24-24l7.6 0 .7 0L168 288c9.7 0 18.5 5.8 22.2 14.8s1.7 19.3-5.2 26.2l-41.1 41.1c62.6 61.5 163.1 61.2 225.3-1c17.5-17.5 30.1-38 37.8-59.8c5.9-16.7 24.2-25.4 40.8-19.5s25.4 24.2 19.5 40.8c-10.8 30.6-28.4 59.3-52.9 83.8c-87.2 87.2-228.3 87.5-315.8 1L57 457c-6.9 6.9-17.2 8.9-26.2 5.2S16 449.7 16 440l0-119.6 0-.7 0-7.6z"/>
|
|
833
836
|
</svg>
|
|
834
|
-
`,
|
|
837
|
+
`, O = `
|
|
835
838
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
836
839
|
<!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.-->
|
|
837
840
|
<path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM169.8 165.3c7.9-22.3 29.1-37.3 52.8-37.3l58.3 0c34.9 0 63.1 28.3 63.1 63.1c0 22.6-12.1 43.5-31.7 54.8L280 264.4c-.2 13-10.9 23.6-24 23.6c-13.3 0-24-10.7-24-24l0-13.5c0-8.6 4.6-16.5 12.1-20.8l44.3-25.4c4.7-2.7 7.6-7.7 7.6-13.1c0-8.4-6.8-15.1-15.1-15.1l-58.3 0c-3.4 0-6.4 2.1-7.5 5.3l-.4 1.2c-4.4 12.5-18.2 19-30.6 14.6s-19-18.2-14.6-30.6l.4-1.2zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"/>
|
|
838
841
|
</svg>
|
|
839
|
-
`,
|
|
842
|
+
`, j = `
|
|
840
843
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
841
844
|
<!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.-->
|
|
842
845
|
<path d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"/>
|
|
843
846
|
</svg>
|
|
844
|
-
`,
|
|
847
|
+
`, R = `
|
|
845
848
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
846
849
|
<!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.-->
|
|
847
850
|
<path d="M3.9 54.9C10.5 40.9 24.5 32 40 32l432 0c15.5 0 29.5 8.9 36.1 22.9s4.6 30.5-5.2 42.5L320 320.9 320 448c0 12.1-6.8 23.2-17.7 28.6s-23.8 4.3-33.5-3l-64-48c-8.1-6-12.8-15.5-12.8-25.6l0-79.1L9 97.3C-.7 85.4-2.8 68.8 3.9 54.9z"/>
|
|
848
851
|
</svg>
|
|
849
|
-
`,
|
|
852
|
+
`, S = `
|
|
850
853
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 512">
|
|
851
854
|
<!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.-->
|
|
852
855
|
<path d="M64 360a56 56 0 1 0 0 112 56 56 0 1 0 0-112zm0-160a56 56 0 1 0 0 112 56 56 0 1 0 0-112zM120 96A56 56 0 1 0 8 96a56 56 0 1 0 112 0z"/>
|
|
853
856
|
</svg>
|
|
854
|
-
`,
|
|
857
|
+
`, V = `
|
|
855
858
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640">
|
|
856
859
|
<!--!Font Awesome Free 7.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.-->
|
|
857
860
|
<path d="M431.2 476.5L163.5 208.8C141.1 240.2 128 278.6 128 320C128 426 214 512 320 512C361.5 512 399.9 498.9 431.2 476.5zM476.5 431.2C498.9 399.8 512 361.4 512 320C512 214 426 128 320 128C278.5 128 240.1 141.1 208.8 163.5L476.5 431.2zM64 320C64 178.6 178.6 64 320 64C461.4 64 576 178.6 576 320C576 461.4 461.4 576 320 576C178.6 576 64 461.4 64 320z"/>
|
|
858
861
|
</svg>
|
|
859
862
|
`;
|
|
860
|
-
class
|
|
863
|
+
class Y {
|
|
861
864
|
constructor(t) {
|
|
862
865
|
this.devTools = t, this.bubbleSize = 4.75 * 16 + 0.3 * 16, this.minVisible = this.bubbleSize * 0.5, this.currentlyDragging = !1;
|
|
863
866
|
}
|
|
864
|
-
render =
|
|
867
|
+
render = g(() => {
|
|
865
868
|
this.setPosition(), this.createDragItem(), this.setTranslate(this.initialX, this.initialY, this.dragItem), this.addEventListeners();
|
|
866
869
|
}, 50);
|
|
867
870
|
setPosition() {
|
|
868
871
|
this.settingKey = window.innerWidth < window.innerHeight ? "bubblePosPortrait" : "bubblePosLandscape";
|
|
869
|
-
const t =
|
|
872
|
+
const t = this.cornerPosition(this.devTools.options.initialBubblePosition), { x: e, y: o } = c(this.settingKey) || t;
|
|
870
873
|
this.currentX = this.initialX = this.xOffset = e, this.currentY = this.initialY = this.yOffset = o;
|
|
871
874
|
}
|
|
875
|
+
cornerPosition(t) {
|
|
876
|
+
const e = 100 - this.bubbleSize, o = e, s = window.innerWidth - 100, n = e, a = window.innerHeight - 100, r = {
|
|
877
|
+
"top-left": { x: o, y: n },
|
|
878
|
+
"top-right": { x: s, y: n },
|
|
879
|
+
"bottom-left": { x: o, y: a },
|
|
880
|
+
"bottom-right": { x: s, y: a }
|
|
881
|
+
};
|
|
882
|
+
return r[t] || r["bottom-right"];
|
|
883
|
+
}
|
|
872
884
|
createDragItem() {
|
|
873
885
|
const t = this.devTools.shadowRoot?.getElementById("floating-bubble");
|
|
874
886
|
if (t) {
|
|
875
887
|
this.dragItem = t;
|
|
876
888
|
return;
|
|
877
889
|
}
|
|
878
|
-
this.dragItem = document.createElement("div"), this.dragItem.id = "floating-bubble", this.dragItem.innerHTML =
|
|
890
|
+
this.dragItem = document.createElement("div"), this.dragItem.id = "floating-bubble", this.dragItem.innerHTML = z, this.devTools.shadowRoot.appendChild(this.dragItem);
|
|
879
891
|
}
|
|
880
892
|
addEventListeners() {
|
|
881
893
|
this.dragItem.hasEventListeners || (this.dragItem.addEventListener("click", this.click.bind(this), { passive: !0 }), this.dragItem.addEventListener("touchstart", this.dragStart.bind(this), { passive: !0 }), this.dragItem.addEventListener("touchend", this.dragEnd.bind(this), { passive: !0 }), this.dragItem.addEventListener("touchmove", this.drag.bind(this), { passive: !0 }), this.dragItem.hasEventListeners = !0);
|
|
@@ -883,8 +895,8 @@ class V {
|
|
|
883
895
|
click(t) {
|
|
884
896
|
this.clickCallback && this.clickCallback(t);
|
|
885
897
|
}
|
|
886
|
-
animateErrorBorder =
|
|
887
|
-
if (!this.dragItem ||
|
|
898
|
+
animateErrorBorder = g(() => {
|
|
899
|
+
if (!this.dragItem || c("errorAnimationEnabled") === !1) return;
|
|
888
900
|
let t = this.dragItem.querySelector(".error-border"), e = this.dragItem.querySelector(".error-border circle");
|
|
889
901
|
t && t.remove();
|
|
890
902
|
const o = document.createElement("div");
|
|
@@ -926,9 +938,9 @@ class V {
|
|
|
926
938
|
o.style.transform = `translate3d(${t}px, ${e}px, 0)`;
|
|
927
939
|
}
|
|
928
940
|
}
|
|
929
|
-
class
|
|
941
|
+
class U {
|
|
930
942
|
constructor(t) {
|
|
931
|
-
this.devTools = t, this.state = t.state.state, this.sheetHeight = parseInt(
|
|
943
|
+
this.devTools = t, this.state = t.state.state, this.sheetHeight = parseInt(c("bottomSheetHeight")) || 55;
|
|
932
944
|
}
|
|
933
945
|
render() {
|
|
934
946
|
this.createBottomSheet(), this.sheetContent = this.bottomSheet.querySelector(".content"), this.sheetOverlay = this.bottomSheet.querySelector(".sheet-overlay"), this.addEventListeners();
|
|
@@ -936,7 +948,7 @@ class Y {
|
|
|
936
948
|
// Called when the in-memory state changes,
|
|
937
949
|
// such as when a new console or bridge log is captured.
|
|
938
950
|
update(t) {
|
|
939
|
-
this.state = t, this.checkNativeFeatures(), this.renderConsoleLogs(), this.renderBridgeComponents(), this.renderBridgeLogs(), this.renderEvents(), this.renderNativeStack(), this.scrollToLatestLog(this.state.activeTab), this.state.shouldScrollToLatestLog = !0;
|
|
951
|
+
this.state = t, this.checkNativeFeatures(), this.renderConsoleLogs(), this.renderBridgeComponents(), this.renderBridgeLogs(), this.renderEvents(), this.renderNativeStack(), this.renderInfos(), this.scrollToLatestLog(this.state.activeTab), this.state.shouldScrollToLatestLog = !0;
|
|
940
952
|
}
|
|
941
953
|
// Called when another native tab of the mobile app
|
|
942
954
|
// updates devtools-related local storage.
|
|
@@ -948,7 +960,7 @@ class Y {
|
|
|
948
960
|
{ key: "errorAnimationEnabled", setter: (o) => this.updateErrorAnimation(o) },
|
|
949
961
|
{ key: "autoOpen", setter: (o) => this.updateAutoOpen(o) }
|
|
950
962
|
].forEach(({ key: o, setter: s }) => {
|
|
951
|
-
const n =
|
|
963
|
+
const n = c(o);
|
|
952
964
|
n !== void 0 && s(n);
|
|
953
965
|
});
|
|
954
966
|
const e = u();
|
|
@@ -962,7 +974,7 @@ class Y {
|
|
|
962
974
|
}
|
|
963
975
|
const e = this.state.activeTab, o = u(), s = this.state.consoleSearch;
|
|
964
976
|
this.bottomSheet = document.createElement("div"), this.bottomSheet.classList.add("bottom-sheet"), this.bottomSheet.innerHTML = `
|
|
965
|
-
<div class="sheet-overlay ${
|
|
977
|
+
<div class="sheet-overlay ${c("bottomSheetPinned") === !0 ? "" : "active"}"></div>
|
|
966
978
|
<div class="content">
|
|
967
979
|
<div class="top-part">
|
|
968
980
|
<div class="tablist">
|
|
@@ -971,7 +983,7 @@ class Y {
|
|
|
971
983
|
<button class="tablink ${e === "tab-event-logs" ? "active" : ""}" data-tab-id="tab-event-logs">Events</button>
|
|
972
984
|
<button class="tablink ${e === "tab-native-stack" ? "active" : ""} d-none" data-tab-id="tab-native-stack">Stack</button>
|
|
973
985
|
<div class="tablink-settings dropdown d-flex">
|
|
974
|
-
<button class="dropdown-trigger tablink-dropdown">${
|
|
986
|
+
<button class="dropdown-trigger tablink-dropdown">${S}</button>
|
|
975
987
|
<div class="dropdown-content settings-dropdown">
|
|
976
988
|
<button class="dropdown-btn-full-width btn-switch-to-single-tab-sheet" data-tab-id="single-tab-settings">Settings</button>
|
|
977
989
|
<button class="dropdown-btn-full-width btn-switch-to-single-tab-sheet" data-tab-id="single-tab-info">Info</button>
|
|
@@ -987,9 +999,9 @@ class Y {
|
|
|
987
999
|
</div>
|
|
988
1000
|
<div class="tab-action-bar d-flex flex-column tab-console-logs ${e === "tab-console-logs" ? "active" : ""}">
|
|
989
1001
|
<div class="d-flex">
|
|
990
|
-
<button class="btn-icon btn-search-console">${
|
|
1002
|
+
<button class="btn-icon btn-search-console">${j}</button>
|
|
991
1003
|
<div class="dropdown">
|
|
992
|
-
<button class="dropdown-trigger btn-icon">${
|
|
1004
|
+
<button class="dropdown-trigger btn-icon">${R}</button>
|
|
993
1005
|
<div class="dropdown-content console-filter-levels">
|
|
994
1006
|
<label><input type="checkbox" ${o.warn ? "checked" : ""} data-console-filter="warn" /> Warnings</label>
|
|
995
1007
|
<label><input type="checkbox" ${o.error ? "checked" : ""} data-console-filter="error" /> Errors</label>
|
|
@@ -999,7 +1011,7 @@ class Y {
|
|
|
999
1011
|
</div>
|
|
1000
1012
|
</div>
|
|
1001
1013
|
<div class="dropdown dropdown--scrollable">
|
|
1002
|
-
<button class="dropdown-trigger btn-icon">${
|
|
1014
|
+
<button class="dropdown-trigger btn-icon">${V}</button>
|
|
1003
1015
|
<div class="dropdown-content console-log-blacklist">
|
|
1004
1016
|
</div>
|
|
1005
1017
|
</div>
|
|
@@ -1014,7 +1026,7 @@ class Y {
|
|
|
1014
1026
|
<button class="btn-icon btn-clear-tab btn-clear-events">${p}</button>
|
|
1015
1027
|
</div>
|
|
1016
1028
|
<div class="tab-action-bar tab-native-stack ${e === "tab-native-stack" ? "active" : ""}">
|
|
1017
|
-
<button class="btn-icon btn-reload-tab btn-reload-stack">${
|
|
1029
|
+
<button class="btn-icon btn-reload-tab btn-reload-stack">${D}</button>
|
|
1018
1030
|
</div>
|
|
1019
1031
|
</div>
|
|
1020
1032
|
</div>
|
|
@@ -1028,7 +1040,7 @@ class Y {
|
|
|
1028
1040
|
<div id="bridge-components-collapse" class="collapse-target">
|
|
1029
1041
|
<div class="d-flex justify-content-between border-bottom">
|
|
1030
1042
|
<div class="tab-content-bridge-components flex-grow-1"></div>
|
|
1031
|
-
<button class="btn-icon btn-help btn-switch-to-single-tab-sheet mt-1" data-tab-id="single-tab-bridge-component-help">${
|
|
1043
|
+
<button class="btn-icon btn-help btn-switch-to-single-tab-sheet mt-1" data-tab-id="single-tab-bridge-component-help">${O}</button>
|
|
1032
1044
|
</div>
|
|
1033
1045
|
</div>
|
|
1034
1046
|
|
|
@@ -1082,28 +1094,28 @@ class Y {
|
|
|
1082
1094
|
</div>
|
|
1083
1095
|
<div class="mb-4">
|
|
1084
1096
|
<label for="font-size-setting"> Font Size</label>
|
|
1085
|
-
<input type="range" id="font-size-setting" class="w-100" min="8" max="24" value="${
|
|
1097
|
+
<input type="range" id="font-size-setting" class="w-100" min="8" max="24" value="${c("fontSize") || 16}" step="1" list="font-size-setting-markers" />
|
|
1086
1098
|
<datalist id="font-size-setting-markers">
|
|
1087
1099
|
<option value="16"></option>
|
|
1088
1100
|
</datalist>
|
|
1089
1101
|
</div>
|
|
1090
1102
|
<div class="mb-3">
|
|
1091
1103
|
<label class="toggle">
|
|
1092
|
-
<input class="toggle-checkbox" type="checkbox" id="console-error-animation-setting" ${
|
|
1104
|
+
<input class="toggle-checkbox" type="checkbox" id="console-error-animation-setting" ${c("errorAnimationEnabled") !== !1 ? "checked" : ""} />
|
|
1093
1105
|
<div class="toggle-switch"></div>
|
|
1094
1106
|
<span class="toggle-label">Console Error Animation</span>
|
|
1095
1107
|
</label>
|
|
1096
1108
|
</div>
|
|
1097
1109
|
<div class="mb-3">
|
|
1098
1110
|
<label class="toggle">
|
|
1099
|
-
<input class="toggle-checkbox" type="checkbox" id="auto-open-setting" ${
|
|
1111
|
+
<input class="toggle-checkbox" type="checkbox" id="auto-open-setting" ${c("autoOpen") === !0 ? "checked" : ""} />
|
|
1100
1112
|
<div class="toggle-switch"></div>
|
|
1101
1113
|
<span class="toggle-label">Auto Open</span>
|
|
1102
1114
|
</label>
|
|
1103
1115
|
</div>
|
|
1104
1116
|
<div class="mb-3">
|
|
1105
1117
|
<label class="toggle">
|
|
1106
|
-
<input class="toggle-checkbox" type="checkbox" id="scroll-to-latest-log-setting" ${
|
|
1118
|
+
<input class="toggle-checkbox" type="checkbox" id="scroll-to-latest-log-setting" ${c("scrollToLatestLog") === !0 ? "checked" : ""} />
|
|
1107
1119
|
<div class="toggle-switch"></div>
|
|
1108
1120
|
<span class="toggle-label">Automatically Scroll to New Logs</span>
|
|
1109
1121
|
</label>
|
|
@@ -1127,36 +1139,6 @@ class Y {
|
|
|
1127
1139
|
</div>
|
|
1128
1140
|
|
|
1129
1141
|
<div id="single-tab-info" class="single-tab-content outer-tab-content">
|
|
1130
|
-
<div class="inner-tab-content">
|
|
1131
|
-
<div class="d-flex align-items-center mb-3">
|
|
1132
|
-
<button class="btn-icon btn-close-single-mode">${b}</button>
|
|
1133
|
-
<h3 class="ms-1">Info</h3>
|
|
1134
|
-
</div>
|
|
1135
|
-
<div class="info-card">
|
|
1136
|
-
<div class="info-card-title">Current URL</div>
|
|
1137
|
-
<div class="current-url">${this.currentUrl}</div>
|
|
1138
|
-
</div>
|
|
1139
|
-
<div class="info-card">
|
|
1140
|
-
<div class="info-card-title">User Agent</div>
|
|
1141
|
-
<div class="user-agent">${navigator.userAgent}</div>
|
|
1142
|
-
</div>
|
|
1143
|
-
<div class="info-card">
|
|
1144
|
-
<div class="info-card-title"><pre class="m-0">turbo-cache-control:</pre> <span>${v("turbo-cache-control") || "-"}</span></div>
|
|
1145
|
-
<div class="info-card-hint"><strong>no-cache:</strong> always fetched from the network, even on restore</div>
|
|
1146
|
-
<div class="info-card-hint"><strong>no-preview:</strong> skipped in preview, used only on restore</div>
|
|
1147
|
-
<div class="info-card-hint"><strong>unset:</strong> shows cached preview if the cache is valid</div>
|
|
1148
|
-
</div>
|
|
1149
|
-
<div class="info-card">
|
|
1150
|
-
<div class="info-card-title"><pre class="m-0">turbo-refresh-method:</pre> <span>${v("turbo-refresh-method") || "-"}</span></div>
|
|
1151
|
-
<div class="info-card-hint"><strong>replace (default):</strong> replaces the entire <body> on revisit</div>
|
|
1152
|
-
<div class="info-card-hint"><strong>morph:</strong> updates only changed DOM elements, preserving state</div>
|
|
1153
|
-
</div>
|
|
1154
|
-
<div class="info-card">
|
|
1155
|
-
<div class="info-card-title"><pre class="m-0">turbo-visit-control:</pre> <span>${v("turbo-visit-control") || "-"}</span></div>
|
|
1156
|
-
<div class="info-card-hint"><strong>reload:</strong> forces a full page reload</div>
|
|
1157
|
-
<div class="info-card-hint"><strong>unset:</strong> allows Turbo to handle the visit normally</div>
|
|
1158
|
-
</div>
|
|
1159
|
-
</div>
|
|
1160
1142
|
</div>
|
|
1161
1143
|
</div>
|
|
1162
1144
|
</div>
|
|
@@ -1195,26 +1177,61 @@ class Y {
|
|
|
1195
1177
|
const t = this.bottomSheet.querySelector(".tab-content-native-stack");
|
|
1196
1178
|
t.innerHTML = '<div class="native-stack-wrapper">' + (this.state.nativeStack.length ? this.state.nativeStack.map((e) => this.nativeViewStackHTML(e)).join("") : '<div class="tab-empty-content"><span>No native stack captured yet</span></div>') + "</div>";
|
|
1197
1179
|
}
|
|
1198
|
-
|
|
1199
|
-
const
|
|
1180
|
+
renderInfos() {
|
|
1181
|
+
const t = `
|
|
1182
|
+
<div class="inner-tab-content">
|
|
1183
|
+
<div class="d-flex align-items-center mb-3">
|
|
1184
|
+
<button class="btn-icon btn-close-single-mode">${b}</button>
|
|
1185
|
+
<h3 class="ms-1">Info</h3>
|
|
1186
|
+
</div>
|
|
1187
|
+
<div class="info-card">
|
|
1188
|
+
<div class="info-card-title">Current URL</div>
|
|
1189
|
+
<div class="current-url">${this.currentUrl}</div>
|
|
1190
|
+
</div>
|
|
1191
|
+
<div class="info-card">
|
|
1192
|
+
<div class="info-card-title">User Agent</div>
|
|
1193
|
+
<div class="user-agent">${navigator.userAgent}</div>
|
|
1194
|
+
</div>
|
|
1195
|
+
<div class="info-card">
|
|
1196
|
+
<div class="info-card-title"><pre class="m-0">turbo-cache-control:</pre> <span>${v("turbo-cache-control") || "-"}</span></div>
|
|
1197
|
+
<div class="info-card-hint"><strong>no-cache:</strong> always fetched from the network, even on restore</div>
|
|
1198
|
+
<div class="info-card-hint"><strong>no-preview:</strong> skipped in preview, used only on restore</div>
|
|
1199
|
+
<div class="info-card-hint"><strong>unset:</strong> shows cached preview if the cache is valid</div>
|
|
1200
|
+
</div>
|
|
1201
|
+
<div class="info-card">
|
|
1202
|
+
<div class="info-card-title"><pre class="m-0">turbo-refresh-method:</pre> <span>${v("turbo-refresh-method") || "-"}</span></div>
|
|
1203
|
+
<div class="info-card-hint"><strong>replace (default):</strong> replaces the entire <body> on revisit</div>
|
|
1204
|
+
<div class="info-card-hint"><strong>morph:</strong> updates only changed DOM elements, preserving state</div>
|
|
1205
|
+
</div>
|
|
1206
|
+
<div class="info-card">
|
|
1207
|
+
<div class="info-card-title"><pre class="m-0">turbo-visit-control:</pre> <span>${v("turbo-visit-control") || "-"}</span></div>
|
|
1208
|
+
<div class="info-card-hint"><strong>reload:</strong> forces a full page reload</div>
|
|
1209
|
+
<div class="info-card-hint"><strong>unset:</strong> allows Turbo to handle the visit normally</div>
|
|
1210
|
+
</div>
|
|
1211
|
+
</div>
|
|
1212
|
+
`;
|
|
1213
|
+
this.bottomSheet.querySelector("#single-tab-info").innerHTML = t;
|
|
1214
|
+
}
|
|
1215
|
+
renderPathConfigurationCheck = g((t) => {
|
|
1216
|
+
const e = L ? t : `${window.location.origin}${t}`;
|
|
1200
1217
|
this.devTools.nativeBridge.send("propertiesForUrl", { url: e }, (o) => {
|
|
1201
1218
|
this.bottomSheet.querySelector("#path-configuration-check-properties-output").style.opacity = 1;
|
|
1202
1219
|
const s = (() => {
|
|
1203
1220
|
try {
|
|
1204
|
-
const
|
|
1205
|
-
return JSON.stringify(typeof
|
|
1221
|
+
const r = o.data.properties;
|
|
1222
|
+
return JSON.stringify(typeof r == "string" ? JSON.parse(r) : r, null, 2);
|
|
1206
1223
|
} catch {
|
|
1207
1224
|
return o.data.properties;
|
|
1208
1225
|
}
|
|
1209
|
-
})(), n = s ? `<pre class="view-path-configuration">${s}</pre>` : "",
|
|
1210
|
-
|
|
1226
|
+
})(), n = s ? `<pre class="view-path-configuration">${s}</pre>` : "", a = this.bottomSheet.querySelector("#path-configuration-check-properties-output");
|
|
1227
|
+
a.innerHTML = n;
|
|
1211
1228
|
});
|
|
1212
1229
|
}, 500);
|
|
1213
1230
|
bridgeLogHTML(t, e, o, s, n) {
|
|
1214
1231
|
return `
|
|
1215
1232
|
<div class="log-entry d-flex gap-3 pt-2 pb-2">
|
|
1216
1233
|
<div class="log-entry-icon d-flex justify-content-center align-items-center">
|
|
1217
|
-
${t === "send" ?
|
|
1234
|
+
${t === "send" ? P : N}
|
|
1218
1235
|
</div>
|
|
1219
1236
|
<div class="w-100 overflow-auto">
|
|
1220
1237
|
<div class="d-flex justify-content-between">
|
|
@@ -1222,9 +1239,9 @@ class Y {
|
|
|
1222
1239
|
<small>${n}</small>
|
|
1223
1240
|
</div>
|
|
1224
1241
|
<div class="overflow-auto">
|
|
1225
|
-
${Object.entries(s).map(([
|
|
1226
|
-
const
|
|
1227
|
-
return `<div class="white-space-collapse">${
|
|
1242
|
+
${Object.entries(s).map(([a, r]) => {
|
|
1243
|
+
const h = typeof r == "object" && r !== null ? JSON.stringify(r) : r;
|
|
1244
|
+
return `<div class="white-space-collapse">${a}: ${h}</div>`;
|
|
1228
1245
|
}).join("")}
|
|
1229
1246
|
</div>
|
|
1230
1247
|
</div>
|
|
@@ -1243,7 +1260,7 @@ class Y {
|
|
|
1243
1260
|
${e}
|
|
1244
1261
|
</div>
|
|
1245
1262
|
<div class="dropdown dropdown--right">
|
|
1246
|
-
<button class="dropdown-trigger btn-icon">${
|
|
1263
|
+
<button class="dropdown-trigger btn-icon">${S}</button>
|
|
1247
1264
|
<div class="dropdown-content">
|
|
1248
1265
|
<button class="dropdown-btn-full-width dropdown-content-action console-log-action-hide-console-log">Ignore this log</button>
|
|
1249
1266
|
<button class="dropdown-btn-full-width dropdown-content-action console-log-action-copy-console-log">Copy log message</button>
|
|
@@ -1269,7 +1286,7 @@ class Y {
|
|
|
1269
1286
|
`;
|
|
1270
1287
|
}
|
|
1271
1288
|
nativeViewStackHTML(t) {
|
|
1272
|
-
const e = (d) => d?.replace(/\/+$/, ""), o = ["UINavigationController", "NavigatorHost"].includes(t.type), s = t.type === "UITabBarController", n = ["VisitableViewController", "HotwireWebFragment", "BackStackEntry"].includes(t.type),
|
|
1289
|
+
const e = (d) => d?.replace(/\/+$/, ""), o = ["UINavigationController", "NavigatorHost"].includes(t.type), s = t.type === "UITabBarController", n = ["VisitableViewController", "HotwireWebFragment", "BackStackEntry"].includes(t.type), r = `viewstack-card ${e(t.url) === e(this.currentUrl) ? "current-view" : ""} ${o ? "main-view" : n ? "hotwire-view" : s ? "tab-container" : "non-identified-view"}`, h = "viewstack-" + Math.random().toString(16).slice(2), x = t.url ? `<div class="view-url">
|
|
1273
1290
|
${(() => {
|
|
1274
1291
|
try {
|
|
1275
1292
|
return new URL(t.url).pathname;
|
|
@@ -1284,24 +1301,24 @@ class Y {
|
|
|
1284
1301
|
} catch {
|
|
1285
1302
|
return t.pathConfigurationProperties;
|
|
1286
1303
|
}
|
|
1287
|
-
})(),
|
|
1304
|
+
})(), C = w ? `<pre class="view-path-configuration">${w}</pre>` : "", T = t.children?.length ? `<div class="child-container">
|
|
1288
1305
|
${t.children.map((d) => this.nativeViewStackHTML(d)).join("")}
|
|
1289
1306
|
</div>` : "";
|
|
1290
1307
|
return `
|
|
1291
1308
|
<div>
|
|
1292
|
-
<div class="${
|
|
1309
|
+
<div class="${r} collapse no-chevron" data-collapse-target="path-configuration-properties-${h}">
|
|
1293
1310
|
<div>
|
|
1294
1311
|
<div class="view-title">
|
|
1295
1312
|
${t.title == "null" ? "" : t.title}
|
|
1296
1313
|
<div class="view-title-details">${t.type}</div>
|
|
1297
1314
|
</div>
|
|
1298
|
-
${L}
|
|
1299
|
-
</div>
|
|
1300
|
-
<div id="path-configuration-properties-${g}" class="collapse-target">
|
|
1301
1315
|
${x}
|
|
1302
1316
|
</div>
|
|
1317
|
+
<div id="path-configuration-properties-${h}" class="collapse-target">
|
|
1318
|
+
${C}
|
|
1319
|
+
</div>
|
|
1303
1320
|
</div>
|
|
1304
|
-
${
|
|
1321
|
+
${T}
|
|
1305
1322
|
</div>
|
|
1306
1323
|
`;
|
|
1307
1324
|
}
|
|
@@ -1361,17 +1378,13 @@ class Y {
|
|
|
1361
1378
|
}), this.bottomSheet.querySelectorAll(".btn-switch-to-single-tab-sheet").forEach((t) => {
|
|
1362
1379
|
t.addEventListener("click", (e) => {
|
|
1363
1380
|
const o = e.target.closest("[data-tab-id]").dataset.tabId;
|
|
1364
|
-
o && (o === "single-tab-path-configuration-check" && this.bottomSheet.querySelector("#path-configuration-check-url").value === "/" && this.renderPathConfigurationCheck("/"), this.switchToSingleTabSheet(o));
|
|
1365
|
-
});
|
|
1366
|
-
}), this.bottomSheet.querySelectorAll(".btn-close-single-mode").forEach((t) => {
|
|
1367
|
-
t.addEventListener("click", () => {
|
|
1368
|
-
this.switchToMultiTabSheet();
|
|
1381
|
+
o && (o === "single-tab-path-configuration-check" && this.bottomSheet.querySelector("#path-configuration-check-url").value === "/" && this.renderPathConfigurationCheck("/"), o === "single-tab-info" && this.renderInfos(), this.switchToSingleTabSheet(o));
|
|
1369
1382
|
});
|
|
1370
1383
|
}), this.bottomSheet.querySelector(".top-part").addEventListener("touchstart", this.dragStart.bind(this), { passive: !0 }), this.bottomSheet.addEventListener("touchmove", this.dragging.bind(this), { passive: !0 }), this.bottomSheet.addEventListener("touchend", this.dragStop.bind(this), { passive: !0 }), this.bottomSheet.querySelector(".console-filter-levels").addEventListener("click", ({ target: t }) => {
|
|
1371
1384
|
const e = t.closest("input[type='checkbox']");
|
|
1372
1385
|
if (!e) return;
|
|
1373
1386
|
const o = e.dataset.consoleFilter, s = e.checked;
|
|
1374
|
-
|
|
1387
|
+
I(o, s), this.renderConsoleLogs();
|
|
1375
1388
|
}), this.bottomSheet.querySelector(".btn-search-console").addEventListener("click", () => {
|
|
1376
1389
|
const t = this.bottomSheet.querySelector(".console-search");
|
|
1377
1390
|
t.classList.toggle("d-none"), t.querySelector("input").focus();
|
|
@@ -1390,17 +1403,17 @@ class Y {
|
|
|
1390
1403
|
}), this.bottomSheet.querySelector("#scroll-to-latest-log-setting").addEventListener("change", (t) => {
|
|
1391
1404
|
l("scrollToLatestLog", t.target.checked);
|
|
1392
1405
|
}), this.bottomSheet.querySelector(".pin-bottom-sheet").addEventListener("click", () => {
|
|
1393
|
-
const t =
|
|
1406
|
+
const t = c("bottomSheetPinned") === !0;
|
|
1394
1407
|
l("bottomSheetPinned", !t), this.sheetOverlay.classList.toggle("active"), this.bottomSheet.querySelector(".settings-dropdown").classList.remove("dropdown-open");
|
|
1395
1408
|
}), this.bottomSheet.querySelector("#path-configuration-check-url").addEventListener("input", (t) => {
|
|
1396
1409
|
this.bottomSheet.querySelector("#path-configuration-check-properties-output").style.opacity = 0.5, this.renderPathConfigurationCheck(t.target.value);
|
|
1397
1410
|
}), this.bottomSheet.addEventListener("click", (t) => {
|
|
1398
1411
|
const e = t.target.closest(".collapse");
|
|
1399
1412
|
if (e && this.bottomSheet.contains(e)) {
|
|
1400
|
-
const
|
|
1413
|
+
const a = e.getAttribute("data-collapse-target"), r = this.bottomSheet.querySelector(`#${a}`);
|
|
1401
1414
|
if (r) {
|
|
1402
|
-
const
|
|
1403
|
-
r.classList.toggle("active",
|
|
1415
|
+
const h = e.classList.toggle("active");
|
|
1416
|
+
r.classList.toggle("active", h);
|
|
1404
1417
|
}
|
|
1405
1418
|
return;
|
|
1406
1419
|
}
|
|
@@ -1413,6 +1426,10 @@ class Y {
|
|
|
1413
1426
|
this.handleDropdownActionClick(t);
|
|
1414
1427
|
return;
|
|
1415
1428
|
}
|
|
1429
|
+
if (t.target.closest(".btn-close-single-mode")) {
|
|
1430
|
+
this.switchToMultiTabSheet();
|
|
1431
|
+
return;
|
|
1432
|
+
}
|
|
1416
1433
|
this.closeAllDropdowns(t);
|
|
1417
1434
|
}), this.bottomSheet.hasEventListeners = !0);
|
|
1418
1435
|
}
|
|
@@ -1443,19 +1460,19 @@ class Y {
|
|
|
1443
1460
|
const e = t.target.closest(".dropdown-content-action");
|
|
1444
1461
|
if (e)
|
|
1445
1462
|
if (e.classList.contains("console-log-action-hide-console-log"))
|
|
1446
|
-
|
|
1463
|
+
F(e.closest(".log-entry").querySelector(".log-entry-message").textContent), this.renderConsoleLogs();
|
|
1447
1464
|
else if (e.classList.contains("console-log-action-copy-console-log")) {
|
|
1448
1465
|
const s = e.closest(".log-entry").querySelector(".log-entry-message").textContent;
|
|
1449
1466
|
navigator.clipboard.writeText(s).then(() => {
|
|
1450
1467
|
this.closeAllDropdowns(t);
|
|
1451
1468
|
});
|
|
1452
|
-
} else e.classList.contains("btn-remove-console-log-blacklist-entry") && (
|
|
1469
|
+
} else e.classList.contains("btn-remove-console-log-blacklist-entry") && (q(e.dataset.entry.trim()), this.renderConsoleLogs());
|
|
1453
1470
|
};
|
|
1454
1471
|
updateTabView(t) {
|
|
1455
1472
|
this.devTools.shadowRoot.querySelectorAll(".tablink, .outer-tab-content").forEach((e) => e.classList.remove("active")), this.devTools.shadowRoot.querySelectorAll(".tab-action-bar").forEach((e) => e.classList.remove("active")), this.devTools.shadowRoot.querySelector(`[data-tab-id="${t}"]`).classList.add("active"), this.devTools.shadowRoot.getElementById(t).classList.add("active"), this.devTools.shadowRoot.querySelector(`.tab-action-bar.${t}`).classList.add("active"), this.state.shouldScrollToLatestLog && (this.scrollToLatestLog(t), this.state.shouldScrollToLatestLog = !1);
|
|
1456
1473
|
}
|
|
1457
1474
|
scrollToLatestLog(t) {
|
|
1458
|
-
|
|
1475
|
+
c("scrollToLatestLog") == !0 && requestAnimationFrame(() => {
|
|
1459
1476
|
this.devTools.shadowRoot.getElementById(t)?.querySelector(".log-entry:last-child")?.scrollIntoView({ behavior: "instant", block: "center" });
|
|
1460
1477
|
});
|
|
1461
1478
|
}
|
|
@@ -1503,7 +1520,7 @@ class Y {
|
|
|
1503
1520
|
return window.location.href;
|
|
1504
1521
|
}
|
|
1505
1522
|
}
|
|
1506
|
-
class
|
|
1523
|
+
class W {
|
|
1507
1524
|
constructor() {
|
|
1508
1525
|
this.state = {
|
|
1509
1526
|
consoleLogs: [],
|
|
@@ -1569,10 +1586,10 @@ class U {
|
|
|
1569
1586
|
return (/* @__PURE__ */ new Date()).toLocaleTimeString();
|
|
1570
1587
|
}
|
|
1571
1588
|
get storedActiveTab() {
|
|
1572
|
-
return
|
|
1589
|
+
return c("activeTab") || "tab-bridge-components";
|
|
1573
1590
|
}
|
|
1574
1591
|
}
|
|
1575
|
-
class
|
|
1592
|
+
class X {
|
|
1576
1593
|
bridgeIsConnected() {
|
|
1577
1594
|
return !!(window.HotwireNative?.web || window.Strada?.web);
|
|
1578
1595
|
}
|
|
@@ -1603,13 +1620,13 @@ class W {
|
|
|
1603
1620
|
return window.HotwireNative?.web || window.Strada?.web;
|
|
1604
1621
|
}
|
|
1605
1622
|
}
|
|
1606
|
-
class
|
|
1623
|
+
class J {
|
|
1607
1624
|
constructor(t = {}) {
|
|
1608
1625
|
this.options = {
|
|
1609
1626
|
enabled: !0,
|
|
1610
1627
|
reset: !1,
|
|
1611
1628
|
...t
|
|
1612
|
-
}, this.options.enabled && (this.options.reset &&
|
|
1629
|
+
}, this.options.enabled && (this.options.reset && $(), this.state = new W(), this.bubble = new Y(this), this.bottomSheet = new U(this), this.nativeBridge = new X(this), this.diagnosticsChecker = new B(), this.state.subscribe(this.update.bind(this)), this.listenForTurboEvents());
|
|
1613
1630
|
}
|
|
1614
1631
|
// Setup gets called initially and on every turbo:load event, eg. when navigating to a new page
|
|
1615
1632
|
setup() {
|
|
@@ -1617,7 +1634,7 @@ class X {
|
|
|
1617
1634
|
this.nativeBridgeGotConnected();
|
|
1618
1635
|
}), this.addEventListeners(), this.diagnosticsChecker.checkForWarnings(), this.bubble.onClick(() => {
|
|
1619
1636
|
this.bottomSheet.showBottomSheet(), this.nativeBridge.send("vibrate");
|
|
1620
|
-
}),
|
|
1637
|
+
}), c("autoOpen") === !0 && this.bottomSheet.showBottomSheet());
|
|
1621
1638
|
}
|
|
1622
1639
|
nativeBridgeGotConnected() {
|
|
1623
1640
|
this.originalBridge || (this.originalBridge = window.HotwireNative?.web || window.Strada?.web, this.addBridgeProxy(), this.state.setBridgeIsConnected(!0), this.callNativeBridgeComponent(), this.updateSupportedBridgeComponents(), this.startBridgeComponentObserver());
|
|
@@ -1627,7 +1644,7 @@ class X {
|
|
|
1627
1644
|
this.fetchNativeStack();
|
|
1628
1645
|
});
|
|
1629
1646
|
}
|
|
1630
|
-
update =
|
|
1647
|
+
update = g((t) => {
|
|
1631
1648
|
this.bottomSheet.update(t);
|
|
1632
1649
|
}, 200);
|
|
1633
1650
|
setupShadowRoot() {
|
|
@@ -1635,13 +1652,13 @@ class X {
|
|
|
1635
1652
|
this.shadowRoot = this.shadowContainer.shadowRoot, this.injectCSSToShadowRoot();
|
|
1636
1653
|
return;
|
|
1637
1654
|
}
|
|
1638
|
-
this.shadowRoot = this.shadowContainer.attachShadow({ mode: "open" }), this.setCSSProperty("--font-size", `${
|
|
1655
|
+
this.shadowRoot = this.shadowContainer.attachShadow({ mode: "open" }), this.setCSSProperty("--font-size", `${c("fontSize") || 16}px`), this.injectCSSToShadowRoot();
|
|
1639
1656
|
}
|
|
1640
1657
|
addBridgeProxy() {
|
|
1641
1658
|
const t = () => ({
|
|
1642
1659
|
get: (e, o, s) => {
|
|
1643
1660
|
const n = Reflect.get(e, o, s);
|
|
1644
|
-
return typeof n == "function" && (o === "send" || o === "receive") ? (...
|
|
1661
|
+
return typeof n == "function" && (o === "send" || o === "receive") ? (...a) => (this.interceptedBridgeMessage(o, a), n.apply(e, a)) : typeof n == "function" ? (...a) => n.apply(e, a) : n;
|
|
1645
1662
|
}
|
|
1646
1663
|
});
|
|
1647
1664
|
window.Strada && (window.Strada.web = new Proxy(this.originalBridge, t())), window.HotwireNative && (window.HotwireNative.web = new Proxy(this.originalBridge, t()));
|
|
@@ -1656,23 +1673,31 @@ class X {
|
|
|
1656
1673
|
}
|
|
1657
1674
|
interceptedBridgeMessage(t, e) {
|
|
1658
1675
|
e.forEach((o) => {
|
|
1659
|
-
const s = o.component, n = o.event, { metadata:
|
|
1660
|
-
s !== "dev-tools" && this.state.addBridgeLog(t, s, n,
|
|
1676
|
+
const s = o.component, n = o.event, { metadata: a, ...r } = o.data;
|
|
1677
|
+
s !== "dev-tools" && this.state.addBridgeLog(t, s, n, r);
|
|
1661
1678
|
});
|
|
1662
1679
|
}
|
|
1663
1680
|
interceptedConsoleMessage(t, e) {
|
|
1664
1681
|
const o = e.map((s) => {
|
|
1665
|
-
if (s instanceof Element)
|
|
1666
|
-
|
|
1667
|
-
|
|
1682
|
+
if (s instanceof Element)
|
|
1683
|
+
return y(s);
|
|
1684
|
+
if (s instanceof Error) {
|
|
1685
|
+
let a = `${s.name}: ${s.message}
|
|
1686
|
+
`;
|
|
1687
|
+
return s.stack && (a += `
|
|
1688
|
+
${s.stack}`), `<pre>${a}</pre>`;
|
|
1668
1689
|
}
|
|
1669
|
-
if (typeof s == "object")
|
|
1690
|
+
if (typeof s == "object" && s !== null)
|
|
1670
1691
|
try {
|
|
1671
|
-
return `<pre>${JSON.stringify(
|
|
1692
|
+
return `<pre>${JSON.stringify(
|
|
1693
|
+
s,
|
|
1694
|
+
(a, r) => r === window ? "[Window Object]" : r instanceof HTMLElement ? y(r) : r,
|
|
1695
|
+
2
|
|
1696
|
+
)}</pre>`;
|
|
1672
1697
|
} catch {
|
|
1673
|
-
return `<pre>${s}</pre>`;
|
|
1698
|
+
return `<pre>${s.toString()}</pre>`;
|
|
1674
1699
|
}
|
|
1675
|
-
return s
|
|
1700
|
+
return String(s).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1676
1701
|
}).join(" ");
|
|
1677
1702
|
o.includes("hotwire-native-dev-tools") || o.includes("HotwireDevTools") || (this.state.addConsoleLog(t, o), t === "error" && (m().includes(o) || this.bubble.animateErrorBorder()));
|
|
1678
1703
|
}
|
|
@@ -1680,7 +1705,7 @@ class X {
|
|
|
1680
1705
|
// The debounce on this function is intentionally high,
|
|
1681
1706
|
// to ensure the native side has enough time to set the ViewController / Fragment titles.
|
|
1682
1707
|
// With a lower debounce, the view controller / fragment title would often be empty.
|
|
1683
|
-
fetchNativeStack =
|
|
1708
|
+
fetchNativeStack = g(() => {
|
|
1684
1709
|
this.nativeBridge.send("currentStackInfo", {}, (t) => {
|
|
1685
1710
|
this.state.setSupportsNativeStack(!0), this.state.setNativeStack(t.data.stack);
|
|
1686
1711
|
});
|
|
@@ -1697,10 +1722,10 @@ class X {
|
|
|
1697
1722
|
};
|
|
1698
1723
|
addEventListeners() {
|
|
1699
1724
|
this.hasEventListeners || (window.addEventListener("error", (t) => {
|
|
1700
|
-
const { message: e, filename: o, lineno: s, colno: n } = t,
|
|
1701
|
-
this.interceptedConsoleMessage("error", [
|
|
1725
|
+
const { message: e, filename: o, lineno: s, colno: n } = t, a = `${e} at ${o}:${s}:${n}`;
|
|
1726
|
+
this.interceptedConsoleMessage("error", [a]);
|
|
1702
1727
|
}), window.addEventListener("unhandledrejection", (t) => {
|
|
1703
|
-
this.interceptedConsoleMessage("error", [t.reason
|
|
1728
|
+
this.interceptedConsoleMessage("error", [t.reason]);
|
|
1704
1729
|
}), window.addEventListener(
|
|
1705
1730
|
"resize",
|
|
1706
1731
|
() => {
|
|
@@ -1775,8 +1800,8 @@ class X {
|
|
|
1775
1800
|
return (/* @__PURE__ */ new Date()).toLocaleTimeString();
|
|
1776
1801
|
}
|
|
1777
1802
|
}
|
|
1778
|
-
const
|
|
1779
|
-
const t = new
|
|
1803
|
+
const G = (i = {}) => {
|
|
1804
|
+
const t = new J(i);
|
|
1780
1805
|
t.options.enabled && (t.setup(), document.addEventListener(
|
|
1781
1806
|
"turbo:load",
|
|
1782
1807
|
() => {
|
|
@@ -1786,6 +1811,6 @@ const J = (i = {}) => {
|
|
|
1786
1811
|
));
|
|
1787
1812
|
};
|
|
1788
1813
|
export {
|
|
1789
|
-
|
|
1814
|
+
G as setupDevTools
|
|
1790
1815
|
};
|
|
1791
1816
|
//# sourceMappingURL=hotwire-native-dev-tools.es.js.map
|