@leeguoo/pwtk-network-debugger 1.2.46 β†’ 1.2.48

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.esm.js CHANGED
@@ -7953,21 +7953,21 @@ const styles = `
7953
7953
  }
7954
7954
  }
7955
7955
 
7956
- ::-webkit-scrollbar {
7956
+ #network-debugger-panel ::-webkit-scrollbar {
7957
7957
  width: 6px;
7958
7958
  height: 6px;
7959
7959
  }
7960
7960
 
7961
- ::-webkit-scrollbar-track {
7961
+ #network-debugger-panel ::-webkit-scrollbar-track {
7962
7962
  background: #333;
7963
7963
  }
7964
7964
 
7965
- ::-webkit-scrollbar-thumb {
7965
+ #network-debugger-panel ::-webkit-scrollbar-thumb {
7966
7966
  background: #666;
7967
7967
  border-radius: 3px;
7968
7968
  }
7969
7969
 
7970
- ::-webkit-scrollbar-thumb:hover {
7970
+ #network-debugger-panel ::-webkit-scrollbar-thumb:hover {
7971
7971
  background: #888;
7972
7972
  }
7973
7973
 
@@ -8267,15 +8267,17 @@ const _DebugPanel = class _DebugPanel {
8267
8267
  }
8268
8268
  }
8269
8269
  createPanel() {
8270
- if (!document.getElementById("network-debugger-styles")) {
8271
- const styleEl = document.createElement("style");
8272
- styleEl.id = "network-debugger-styles";
8273
- styleEl.textContent = styles;
8274
- document.head.appendChild(styleEl);
8275
- }
8270
+ this.hostElement = document.createElement("div");
8271
+ this.hostElement.id = "network-debugger-host";
8272
+ this.hostElement.style.cssText = "all: initial; position: absolute; top: 0; left: 0; pointer-events: none;";
8273
+ this.shadowRoot = this.hostElement.attachShadow({ mode: "closed" });
8274
+ const styleEl = document.createElement("style");
8275
+ styleEl.textContent = styles;
8276
+ this.shadowRoot.appendChild(styleEl);
8276
8277
  this.container = document.createElement("div");
8277
8278
  this.container.id = "network-debugger-panel";
8278
8279
  this.container.className = `${this.config.position} ${this.config.minimized ? "minimized" : ""}`;
8280
+ this.container.style.pointerEvents = "auto";
8279
8281
  this.container.innerHTML = `
8280
8282
  <div class="debugger-header">
8281
8283
  <div class="debugger-title">πŸ”“ PWTK 解密小ε·₯ε…· <span style="font-size: 10px; opacity: 0.7;">by Leo</span></div>
@@ -8322,7 +8324,7 @@ const _DebugPanel = class _DebugPanel {
8322
8324
  <div class="about-panel" data-panel="about" style="display: none;">
8323
8325
  <div style="padding: 20px; color: #fff; text-align: center;">
8324
8326
  <h2 style="margin: 0 0 20px 0;">πŸ”“ PWTK 解密小ε·₯ε…·</h2>
8325
- <p style="margin: 10px 0;">Version: ${"1.2.46"}</p>
8327
+ <p style="margin: 10px 0;">Version: ${"1.2.48"}</p>
8326
8328
  <p style="margin: 10px 0;">πŸ‘¨β€πŸ’» Created by <strong>Leo (@leeguoo)</strong></p>
8327
8329
  <p style="margin: 10px 0;">πŸ“§ ζŠ€ζœ―ζ”―ζŒοΌšθ―·θ”η³» Leo</p>
8328
8330
  <p style="margin: 10px 0;">🌐 εˆ†δΊ«ζœεŠ‘οΌšcurl.bwg.leeguoo.com</p>
@@ -8336,10 +8338,11 @@ const _DebugPanel = class _DebugPanel {
8336
8338
  </div>
8337
8339
  `;
8338
8340
  this.addResizeHandles();
8339
- document.body.appendChild(this.container);
8340
- this.networkTab = this.container.querySelector('[data-panel="network"]');
8341
- this.consoleTab = this.container.querySelector('[data-panel="console"]');
8342
- this.consoleContent = this.container.querySelector(".console-content");
8341
+ this.shadowRoot.appendChild(this.container);
8342
+ document.body.appendChild(this.hostElement);
8343
+ this.networkTab = this.shadowRoot.querySelector('[data-panel="network"]');
8344
+ this.consoleTab = this.shadowRoot.querySelector('[data-panel="console"]');
8345
+ this.consoleContent = this.shadowRoot.querySelector(".console-content");
8343
8346
  }
8344
8347
  addResizeHandles() {
8345
8348
  const handles = ["n", "s", "e", "w", "ne", "nw", "se", "sw"];
@@ -8351,11 +8354,11 @@ const _DebugPanel = class _DebugPanel {
8351
8354
  });
8352
8355
  }
8353
8356
  bindEvents() {
8354
- const header = this.container.querySelector(".debugger-header");
8355
- const controls = this.container.querySelector(".debugger-controls");
8356
- const tabs = this.container.querySelectorAll(".debugger-tab");
8357
- const toolButtons = this.container.querySelectorAll("[data-tool]");
8358
- const consoleInput = this.container.querySelector(".console-cmd");
8357
+ const header = this.shadowRoot.querySelector(".debugger-header");
8358
+ const controls = this.shadowRoot.querySelector(".debugger-controls");
8359
+ const tabs = this.shadowRoot.querySelectorAll(".debugger-tab");
8360
+ const toolButtons = this.shadowRoot.querySelectorAll("[data-tool]");
8361
+ const consoleInput = this.shadowRoot.querySelector(".console-cmd");
8359
8362
  header.addEventListener("mousedown", (e) => {
8360
8363
  if (e.target === controls || controls.contains(e.target)) return;
8361
8364
  this.startDrag(e);
@@ -8406,7 +8409,7 @@ const _DebugPanel = class _DebugPanel {
8406
8409
  }
8407
8410
  });
8408
8411
  }
8409
- const resizeHandles = this.container.querySelectorAll(".resize-handle");
8412
+ const resizeHandles = this.shadowRoot.querySelectorAll(".resize-handle");
8410
8413
  resizeHandles.forEach((handle) => {
8411
8414
  handle.addEventListener("mousedown", (e) => {
8412
8415
  e.stopPropagation();
@@ -8446,7 +8449,7 @@ const _DebugPanel = class _DebugPanel {
8446
8449
  this.renderRequests();
8447
8450
  }
8448
8451
  renderRequests() {
8449
- const listContainer = this.container.querySelector(".request-list");
8452
+ const listContainer = this.shadowRoot.querySelector(".request-list");
8450
8453
  if (!listContainer) return;
8451
8454
  listContainer.innerHTML = "";
8452
8455
  this.requestsCache.forEach((request) => {
@@ -8627,10 +8630,10 @@ const _DebugPanel = class _DebugPanel {
8627
8630
  return url;
8628
8631
  }
8629
8632
  switchTab(tabName) {
8630
- this.container.querySelectorAll(".debugger-tab").forEach((tab) => {
8633
+ this.shadowRoot.querySelectorAll(".debugger-tab").forEach((tab) => {
8631
8634
  tab.classList.toggle("active", tab.dataset.tab === tabName);
8632
8635
  });
8633
- this.container.querySelectorAll("[data-panel]").forEach((panel) => {
8636
+ this.shadowRoot.querySelectorAll("[data-panel]").forEach((panel) => {
8634
8637
  const panelEl = panel;
8635
8638
  panelEl.style.display = panel.getAttribute("data-panel") === tabName ? "block" : "none";
8636
8639
  });
@@ -8724,7 +8727,7 @@ Created by Leo (@leeguoo)`);
8724
8727
  }
8725
8728
  }
8726
8729
  handleToolAction(tool) {
8727
- const textarea = this.container.querySelector(".tools-content textarea");
8730
+ const textarea = this.shadowRoot.querySelector(".tools-content textarea");
8728
8731
  const input = textarea.value.trim();
8729
8732
  switch (tool) {
8730
8733
  case "parse-curl":
@@ -8974,13 +8977,13 @@ Created by Leo (@leeguoo)`);
8974
8977
  }
8975
8978
  }
8976
8979
  show() {
8977
- this.container.style.display = "block";
8980
+ this.hostElement.style.display = "block";
8978
8981
  this.config.isClosed = false;
8979
8982
  this.saveConfig();
8980
8983
  this.removeReopenButton();
8981
8984
  }
8982
8985
  hide() {
8983
- this.container.style.display = "none";
8986
+ this.hostElement.style.display = "none";
8984
8987
  this.config.isClosed = true;
8985
8988
  this.saveConfig();
8986
8989
  this.createReopenButton();
@@ -8989,9 +8992,22 @@ Created by Leo (@leeguoo)`);
8989
8992
  if (document.getElementById("network-debugger-reopen-btn")) return;
8990
8993
  const btn = document.createElement("button");
8991
8994
  btn.id = "network-debugger-reopen-btn";
8992
- btn.className = "debugger-reopen-btn";
8993
8995
  btn.title = "打开调试青板 (ε―ζ‹–εŠ¨)";
8994
8996
  btn.textContent = "PWTK";
8997
+ btn.style.cssText = `
8998
+ position: fixed;
8999
+ z-index: 999999;
9000
+ background: #4CAF50;
9001
+ color: #000;
9002
+ border: none;
9003
+ padding: 8px 10px;
9004
+ border-radius: 16px;
9005
+ font-weight: bold;
9006
+ font-size: 12px;
9007
+ box-shadow: 0 4px 12px rgba(0,0,0,0.25);
9008
+ cursor: pointer;
9009
+ transition: filter 0.2s;
9010
+ `;
8995
9011
  const pos = this.config.position || "bottom-right";
8996
9012
  if (pos.includes("bottom")) {
8997
9013
  btn.style.bottom = "20px";
@@ -9015,6 +9031,8 @@ Created by Leo (@leeguoo)`);
9015
9031
  isDragging = true;
9016
9032
  btn.style.cursor = "grabbing";
9017
9033
  }, 150);
9034
+ document.addEventListener("mousemove", handleMouseMove);
9035
+ document.addEventListener("mouseup", handleMouseUp);
9018
9036
  e.preventDefault();
9019
9037
  }
9020
9038
  });
@@ -9044,14 +9062,19 @@ Created by Leo (@leeguoo)`);
9044
9062
  if (isDragging) {
9045
9063
  isDragging = false;
9046
9064
  btn.style.cursor = "pointer";
9047
- btn.style.transition = "all 0.3s ease";
9065
+ btn.style.transition = "filter 0.2s";
9048
9066
  } else {
9049
9067
  this.show();
9050
9068
  }
9069
+ document.removeEventListener("mousemove", handleMouseMove);
9070
+ document.removeEventListener("mouseup", handleMouseUp);
9051
9071
  };
9052
- document.addEventListener("mousemove", handleMouseMove);
9053
- document.addEventListener("mouseup", handleMouseUp);
9054
- btn.style.cursor = "pointer";
9072
+ btn.addEventListener("mouseenter", () => {
9073
+ btn.style.filter = "brightness(0.95)";
9074
+ });
9075
+ btn.addEventListener("mouseleave", () => {
9076
+ btn.style.filter = "brightness(1)";
9077
+ });
9055
9078
  document.body.appendChild(btn);
9056
9079
  }
9057
9080
  removeReopenButton() {
@@ -9059,9 +9082,7 @@ Created by Leo (@leeguoo)`);
9059
9082
  if (btn) btn.remove();
9060
9083
  }
9061
9084
  destroy() {
9062
- this.container.remove();
9063
- const styles2 = document.getElementById("network-debugger-styles");
9064
- if (styles2) styles2.remove();
9085
+ this.hostElement.remove();
9065
9086
  this.removeReopenButton();
9066
9087
  }
9067
9088
  // ========== localStorage 方法 ==========
@@ -9216,7 +9237,7 @@ class NetworkDebugger {
9216
9237
  this.initialized = true;
9217
9238
  logger.consoleDirect(`
9218
9239
  ╔════════════════════════════════════════╗
9219
- β•‘ πŸ”“ PWTK 解密小ε·₯ε…· v${"1.2.46"} β•‘
9240
+ β•‘ πŸ”“ PWTK 解密小ε·₯ε…· v${"1.2.48"} β•‘
9220
9241
  β•‘ Created by Leo (@leeguoo) β•‘
9221
9242
  β•‘ ζŠ€ζœ―ζ”―ζŒ: 请联系 Leo β•‘
9222
9243
  β•‘ εˆ†δΊ«ζœεŠ‘: curl.bwg.leeguoo.com β•‘
@@ -9277,7 +9298,7 @@ class NetworkDebugger {
9277
9298
  }
9278
9299
  async checkForUpdates() {
9279
9300
  try {
9280
- const currentVersion = "1.2.46";
9301
+ const currentVersion = "1.2.48";
9281
9302
  logger.info(`[PWTK Update] Checking for updates... Current version: ${currentVersion}`);
9282
9303
  const response = await fetch("https://registry.npmjs.org/@leeguoo/pwtk-network-debugger/latest");
9283
9304
  const data = await response.json();
@@ -9297,7 +9318,7 @@ class NetworkDebugger {
9297
9318
  logger.error("[PWTK Update] Failed to check for updates:", error);
9298
9319
  return {
9299
9320
  hasUpdate: false,
9300
- currentVersion: "1.2.46"
9321
+ currentVersion: "1.2.48"
9301
9322
  };
9302
9323
  }
9303
9324
  }