@leeguoo/pwtk-network-debugger 1.2.27 β 1.2.29
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/dist/index.cjs.js +3 -3
- package/dist/index.esm.js +136 -54
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -8093,6 +8093,7 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8093
8093
|
this.isDragging = false;
|
|
8094
8094
|
this.isResizing = false;
|
|
8095
8095
|
this.dragStart = { x: 0, y: 0 };
|
|
8096
|
+
this.resizeTimeout = null;
|
|
8096
8097
|
this.currentTab = "network";
|
|
8097
8098
|
this.consoleHistory = [];
|
|
8098
8099
|
this.requestsCache = [];
|
|
@@ -8126,12 +8127,11 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8126
8127
|
this.container.className = `${this.config.position} ${this.config.minimized ? "minimized" : ""}`;
|
|
8127
8128
|
this.container.innerHTML = `
|
|
8128
8129
|
<div class="debugger-header">
|
|
8129
|
-
<div class="debugger-title">π
|
|
8130
|
+
<div class="debugger-title">π PWTK θ§£ε―ε°ε·₯ε
· <span style="font-size: 10px; opacity: 0.7;">by Leo</span></div>
|
|
8130
8131
|
<div class="debugger-controls">
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
<button class="debugger-btn" data-action="
|
|
8134
|
-
${!this.config.minimized ? '<button class="debugger-btn" data-action="fullscreen" title="ε
¨ε±"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg></button>' : ""}
|
|
8132
|
+
<button class="debugger-btn" data-action="clear" title="ζΈ
η©Ί"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg></button>
|
|
8133
|
+
<button class="debugger-btn" data-action="export" title="ε―ΌεΊ"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/></svg></button>
|
|
8134
|
+
<button class="debugger-btn" data-action="fullscreen" title="ε
¨ε±"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg></button>
|
|
8135
8135
|
<button class="debugger-btn" data-action="close" title="ε
³ι"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg></button>
|
|
8136
8136
|
</div>
|
|
8137
8137
|
</div>
|
|
@@ -8210,8 +8210,14 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8210
8210
|
this.startDrag(e);
|
|
8211
8211
|
});
|
|
8212
8212
|
controls.addEventListener("click", (e) => {
|
|
8213
|
-
|
|
8214
|
-
|
|
8213
|
+
e.stopPropagation();
|
|
8214
|
+
let target = e.target;
|
|
8215
|
+
while (target && target !== controls) {
|
|
8216
|
+
if (target.dataset?.action) break;
|
|
8217
|
+
target = target.parentElement;
|
|
8218
|
+
}
|
|
8219
|
+
const action = target?.dataset?.action;
|
|
8220
|
+
if (!action) return;
|
|
8215
8221
|
switch (action) {
|
|
8216
8222
|
case "clear":
|
|
8217
8223
|
this.clearRequests();
|
|
@@ -8219,9 +8225,6 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8219
8225
|
case "export":
|
|
8220
8226
|
this.exportData();
|
|
8221
8227
|
break;
|
|
8222
|
-
case "minimize":
|
|
8223
|
-
this.toggleMinimize();
|
|
8224
|
-
break;
|
|
8225
8228
|
case "fullscreen":
|
|
8226
8229
|
this.toggleFullscreen();
|
|
8227
8230
|
break;
|
|
@@ -8261,6 +8264,7 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8261
8264
|
});
|
|
8262
8265
|
document.addEventListener("mousemove", this.handleMouseMove.bind(this));
|
|
8263
8266
|
document.addEventListener("mouseup", this.handleMouseUp.bind(this));
|
|
8267
|
+
window.addEventListener("resize", this.handleWindowResize.bind(this));
|
|
8264
8268
|
}
|
|
8265
8269
|
startListening() {
|
|
8266
8270
|
this.interceptor.addListener((request) => {
|
|
@@ -8505,48 +8509,23 @@ Created by Leo (@leeguoo)`);
|
|
|
8505
8509
|
alert("εδΊ«ε€±θ΄₯οΌθ―·η¨ειθ―");
|
|
8506
8510
|
}
|
|
8507
8511
|
}
|
|
8508
|
-
toggleMinimize() {
|
|
8509
|
-
this.config.minimized = !this.config.minimized;
|
|
8510
|
-
this.container.classList.toggle("minimized", this.config.minimized);
|
|
8511
|
-
const header = this.container.querySelector(".debugger-header");
|
|
8512
|
-
if (header) {
|
|
8513
|
-
header.innerHTML = `
|
|
8514
|
-
<div class="debugger-title">π ${this.config.minimized ? "PWTK" : "PWTK θ§£ε―ε°ε·₯ε
·"} <span style="font-size: 10px; opacity: 0.7;">by Leo</span></div>
|
|
8515
|
-
<div class="debugger-controls">
|
|
8516
|
-
${!this.config.minimized ? '<button class="debugger-btn" data-action="clear" title="ζΈ
η©Ί"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg></button>' : ""}
|
|
8517
|
-
${!this.config.minimized ? '<button class="debugger-btn" data-action="export" title="ε―ΌεΊ"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/></svg></button>' : ""}
|
|
8518
|
-
<button class="debugger-btn" data-action="minimize" title="${this.config.minimized ? "ε±εΌ" : "ζε°ε"}"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="${this.config.minimized ? "M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z" : "M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"}"/></svg></button>
|
|
8519
|
-
${!this.config.minimized ? '<button class="debugger-btn" data-action="fullscreen" title="ε
¨ε±"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg></button>' : ""}
|
|
8520
|
-
<button class="debugger-btn" data-action="close" title="ε
³ι"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg></button>
|
|
8521
|
-
</div>
|
|
8522
|
-
`;
|
|
8523
|
-
const controls = header.querySelector(".debugger-controls");
|
|
8524
|
-
controls.addEventListener("click", (e) => {
|
|
8525
|
-
const target = e.target;
|
|
8526
|
-
const action = target.dataset.action;
|
|
8527
|
-
switch (action) {
|
|
8528
|
-
case "clear":
|
|
8529
|
-
this.clearRequests();
|
|
8530
|
-
break;
|
|
8531
|
-
case "export":
|
|
8532
|
-
this.exportData();
|
|
8533
|
-
break;
|
|
8534
|
-
case "minimize":
|
|
8535
|
-
this.toggleMinimize();
|
|
8536
|
-
break;
|
|
8537
|
-
case "fullscreen":
|
|
8538
|
-
this.toggleFullscreen();
|
|
8539
|
-
break;
|
|
8540
|
-
case "close":
|
|
8541
|
-
this.hide();
|
|
8542
|
-
break;
|
|
8543
|
-
}
|
|
8544
|
-
});
|
|
8545
|
-
}
|
|
8546
|
-
this.saveConfig();
|
|
8547
|
-
}
|
|
8548
8512
|
toggleFullscreen() {
|
|
8549
|
-
this.container.classList.
|
|
8513
|
+
if (this.container.classList.contains("fullscreen")) {
|
|
8514
|
+
this.container.classList.remove("fullscreen");
|
|
8515
|
+
this.container.style.top = "";
|
|
8516
|
+
this.container.style.left = "";
|
|
8517
|
+
this.container.style.width = "";
|
|
8518
|
+
this.container.style.height = "";
|
|
8519
|
+
this.loadPosition();
|
|
8520
|
+
} else {
|
|
8521
|
+
this.container.classList.add("fullscreen");
|
|
8522
|
+
this.container.style.top = "0";
|
|
8523
|
+
this.container.style.left = "0";
|
|
8524
|
+
this.container.style.width = "100vw";
|
|
8525
|
+
this.container.style.height = "100vh";
|
|
8526
|
+
this.container.style.right = "auto";
|
|
8527
|
+
this.container.style.bottom = "auto";
|
|
8528
|
+
}
|
|
8550
8529
|
}
|
|
8551
8530
|
handleToolAction(tool) {
|
|
8552
8531
|
const textarea = this.container.querySelector(".tools-content textarea");
|
|
@@ -8725,6 +8704,61 @@ Created by Leo (@leeguoo)`);
|
|
|
8725
8704
|
this.isResizing = false;
|
|
8726
8705
|
delete this.container.dataset.resizeDirection;
|
|
8727
8706
|
}
|
|
8707
|
+
handleWindowResize() {
|
|
8708
|
+
if (this.resizeTimeout) {
|
|
8709
|
+
clearTimeout(this.resizeTimeout);
|
|
8710
|
+
}
|
|
8711
|
+
this.resizeTimeout = window.setTimeout(() => {
|
|
8712
|
+
this.adjustPositionForWindowResize();
|
|
8713
|
+
}, 100);
|
|
8714
|
+
}
|
|
8715
|
+
adjustPositionForWindowResize() {
|
|
8716
|
+
const rect = this.container.getBoundingClientRect();
|
|
8717
|
+
const windowWidth = window.innerWidth;
|
|
8718
|
+
const windowHeight = window.innerHeight;
|
|
8719
|
+
let needsAdjustment = false;
|
|
8720
|
+
let newLeft = rect.left;
|
|
8721
|
+
let newTop = rect.top;
|
|
8722
|
+
let newWidth = rect.width;
|
|
8723
|
+
let newHeight = rect.height;
|
|
8724
|
+
if (rect.right > windowWidth) {
|
|
8725
|
+
newLeft = windowWidth - rect.width;
|
|
8726
|
+
needsAdjustment = true;
|
|
8727
|
+
}
|
|
8728
|
+
if (rect.bottom > windowHeight) {
|
|
8729
|
+
newTop = windowHeight - rect.height;
|
|
8730
|
+
needsAdjustment = true;
|
|
8731
|
+
}
|
|
8732
|
+
if (newLeft < 0) {
|
|
8733
|
+
newLeft = 0;
|
|
8734
|
+
needsAdjustment = true;
|
|
8735
|
+
}
|
|
8736
|
+
if (newTop < 0) {
|
|
8737
|
+
newTop = 0;
|
|
8738
|
+
needsAdjustment = true;
|
|
8739
|
+
}
|
|
8740
|
+
if (rect.width > windowWidth) {
|
|
8741
|
+
newWidth = windowWidth - 20;
|
|
8742
|
+
newLeft = 10;
|
|
8743
|
+
needsAdjustment = true;
|
|
8744
|
+
}
|
|
8745
|
+
if (rect.height > windowHeight) {
|
|
8746
|
+
newHeight = windowHeight - 20;
|
|
8747
|
+
newTop = 10;
|
|
8748
|
+
needsAdjustment = true;
|
|
8749
|
+
}
|
|
8750
|
+
if (needsAdjustment) {
|
|
8751
|
+
this.container.style.left = `${newLeft}px`;
|
|
8752
|
+
this.container.style.top = `${newTop}px`;
|
|
8753
|
+
this.container.style.right = "auto";
|
|
8754
|
+
this.container.style.bottom = "auto";
|
|
8755
|
+
if (rect.width > windowWidth || rect.height > windowHeight) {
|
|
8756
|
+
this.container.style.width = `${newWidth}px`;
|
|
8757
|
+
this.container.style.height = `${newHeight}px`;
|
|
8758
|
+
}
|
|
8759
|
+
this.savePosition();
|
|
8760
|
+
}
|
|
8761
|
+
}
|
|
8728
8762
|
show() {
|
|
8729
8763
|
this.container.style.display = "block";
|
|
8730
8764
|
this.removeReopenButton();
|
|
@@ -8738,7 +8772,7 @@ Created by Leo (@leeguoo)`);
|
|
|
8738
8772
|
const btn = document.createElement("button");
|
|
8739
8773
|
btn.id = "network-debugger-reopen-btn";
|
|
8740
8774
|
btn.className = "debugger-reopen-btn";
|
|
8741
|
-
btn.title = "ζεΌθ°θ―ι’ζΏ";
|
|
8775
|
+
btn.title = "ζεΌθ°θ―ι’ζΏ (ε―ζε¨)";
|
|
8742
8776
|
btn.textContent = "PWTK";
|
|
8743
8777
|
const pos = this.config.position || "bottom-right";
|
|
8744
8778
|
if (pos.includes("bottom")) {
|
|
@@ -8751,7 +8785,55 @@ Created by Leo (@leeguoo)`);
|
|
|
8751
8785
|
} else {
|
|
8752
8786
|
btn.style.left = "20px";
|
|
8753
8787
|
}
|
|
8754
|
-
|
|
8788
|
+
let isDragging = false;
|
|
8789
|
+
let dragStart = { x: 0, y: 0 };
|
|
8790
|
+
let clickTimer = null;
|
|
8791
|
+
btn.addEventListener("mousedown", (e) => {
|
|
8792
|
+
if (e.button === 0) {
|
|
8793
|
+
isDragging = false;
|
|
8794
|
+
dragStart = { x: e.clientX, y: e.clientY };
|
|
8795
|
+
btn.style.transition = "none";
|
|
8796
|
+
clickTimer = window.setTimeout(() => {
|
|
8797
|
+
isDragging = true;
|
|
8798
|
+
btn.style.cursor = "grabbing";
|
|
8799
|
+
}, 150);
|
|
8800
|
+
e.preventDefault();
|
|
8801
|
+
}
|
|
8802
|
+
});
|
|
8803
|
+
const handleMouseMove = (e) => {
|
|
8804
|
+
if (!isDragging) return;
|
|
8805
|
+
const deltaX = e.clientX - dragStart.x;
|
|
8806
|
+
const deltaY = e.clientY - dragStart.y;
|
|
8807
|
+
const rect = btn.getBoundingClientRect();
|
|
8808
|
+
const newLeft = rect.left + deltaX;
|
|
8809
|
+
const newTop = rect.top + deltaY;
|
|
8810
|
+
const maxX = window.innerWidth - rect.width;
|
|
8811
|
+
const maxY = window.innerHeight - rect.height;
|
|
8812
|
+
const clampedX = Math.max(0, Math.min(maxX, newLeft));
|
|
8813
|
+
const clampedY = Math.max(0, Math.min(maxY, newTop));
|
|
8814
|
+
btn.style.position = "fixed";
|
|
8815
|
+
btn.style.left = `${clampedX}px`;
|
|
8816
|
+
btn.style.top = `${clampedY}px`;
|
|
8817
|
+
btn.style.right = "auto";
|
|
8818
|
+
btn.style.bottom = "auto";
|
|
8819
|
+
dragStart = { x: e.clientX, y: e.clientY };
|
|
8820
|
+
};
|
|
8821
|
+
const handleMouseUp = () => {
|
|
8822
|
+
if (clickTimer) {
|
|
8823
|
+
clearTimeout(clickTimer);
|
|
8824
|
+
clickTimer = null;
|
|
8825
|
+
}
|
|
8826
|
+
if (isDragging) {
|
|
8827
|
+
isDragging = false;
|
|
8828
|
+
btn.style.cursor = "pointer";
|
|
8829
|
+
btn.style.transition = "all 0.3s ease";
|
|
8830
|
+
} else {
|
|
8831
|
+
this.show();
|
|
8832
|
+
}
|
|
8833
|
+
};
|
|
8834
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
8835
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
8836
|
+
btn.style.cursor = "pointer";
|
|
8755
8837
|
document.body.appendChild(btn);
|
|
8756
8838
|
}
|
|
8757
8839
|
removeReopenButton() {
|
|
@@ -8915,7 +8997,7 @@ class NetworkDebugger {
|
|
|
8915
8997
|
this.initialized = true;
|
|
8916
8998
|
logger.consoleDirect(`
|
|
8917
8999
|
ββββββββββββββββββββββββββββββββββββββββββ
|
|
8918
|
-
β π PWTK θ§£ε―ε°ε·₯ε
· v1.2.
|
|
9000
|
+
β π PWTK θ§£ε―ε°ε·₯ε
· v1.2.29 β
|
|
8919
9001
|
β Created by Leo (@leeguoo) β
|
|
8920
9002
|
β ζζ―ζ―ζ: θ―·θη³» Leo β
|
|
8921
9003
|
β εδΊ«ζε‘: curl.bwg.leeguoo.com β
|