@leeguoo/pwtk-network-debugger 1.2.49-beta.6 β†’ 1.2.49-beta.7

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
@@ -17978,7 +17978,7 @@ const _DebugPanel = class _DebugPanel {
17978
17978
  this.container.style.pointerEvents = "auto";
17979
17979
  this.container.innerHTML = `
17980
17980
  <div class="debugger-header">
17981
- <div class="debugger-title">πŸ”“ PWTK 解密小ε·₯ε…· <span style="font-size: 10px; opacity: 0.7;">by Leo v${"1.2.49-beta.6"}</span></div>
17981
+ <div class="debugger-title">πŸ”“ PWTK 解密小ε·₯ε…· <span style="font-size: 10px; opacity: 0.7;">by Leo v${"1.2.49-beta.7"}</span></div>
17982
17982
  <div class="debugger-controls">
17983
17983
  <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>
17984
17984
  <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>
@@ -18579,15 +18579,26 @@ Created by Leo (@leeguoo)`);
18579
18579
  this.hostElement.style.display = "none";
18580
18580
  this.config.isClosed = true;
18581
18581
  this.saveConfig();
18582
- this.createReopenButton();
18582
+ this.createReopenButton().catch((error) => {
18583
+ console.error("[PWTK] Failed to create reopen button:", error);
18584
+ this.createFallbackButton();
18585
+ });
18583
18586
  }
18584
18587
  async createReopenButton() {
18585
- this.removeReopenButton();
18586
- await liquidGlassPromise;
18587
- if (typeof window !== "undefined" && window.Button) {
18588
- this.createGlassButton();
18589
- } else {
18590
- console.warn("[PWTK] Button class not available, using fallback");
18588
+ try {
18589
+ this.removeReopenButton();
18590
+ const timeout = new Promise(
18591
+ (_, reject) => setTimeout(() => reject(new Error("Timeout waiting for liquid glass")), 3e3)
18592
+ );
18593
+ await Promise.race([liquidGlassPromise, timeout]);
18594
+ if (typeof window !== "undefined" && window.Button) {
18595
+ this.createGlassButton();
18596
+ } else {
18597
+ console.warn("[PWTK] Button class not available, using fallback");
18598
+ this.createFallbackButton();
18599
+ }
18600
+ } catch (error) {
18601
+ console.warn("[PWTK] Error creating glass button, using fallback:", error);
18591
18602
  this.createFallbackButton();
18592
18603
  }
18593
18604
  }
@@ -18659,39 +18670,48 @@ Created by Leo (@leeguoo)`);
18659
18670
  }
18660
18671
  }
18661
18672
  createFallbackButton() {
18662
- const btn = document.createElement("button");
18663
- btn.id = "network-debugger-reopen-btn";
18664
- btn.innerText = "PWTK";
18665
- btn.title = "打开调试青板 (ε―ζ‹–εŠ¨)";
18666
- btn.style.cssText = `
18667
- position: fixed;
18668
- z-index: 999999;
18669
- background: rgba(255, 255, 255, 0.1);
18670
- border: 1px solid rgba(255, 255, 255, 0.2);
18671
- border-radius: 12px;
18672
- color: white;
18673
- font-size: 12px;
18674
- font-weight: 600;
18675
- padding: 8px 16px;
18676
- cursor: pointer;
18677
- backdrop-filter: blur(10px);
18678
- font-family: system-ui, -apple-system, sans-serif;
18679
- `;
18680
- const pos = this.config.position || "bottom-right";
18681
- if (pos.includes("bottom")) {
18682
- btn.style.bottom = "20px";
18683
- } else {
18684
- btn.style.top = "20px";
18685
- }
18686
- if (pos.includes("right")) {
18687
- btn.style.right = "20px";
18688
- } else {
18689
- btn.style.left = "20px";
18673
+ try {
18674
+ const existingBtn = document.getElementById("network-debugger-reopen-btn");
18675
+ if (existingBtn) {
18676
+ existingBtn.remove();
18677
+ }
18678
+ const btn = document.createElement("button");
18679
+ btn.id = "network-debugger-reopen-btn";
18680
+ btn.innerText = "打开 PWTK";
18681
+ btn.title = "打开调试青板 (ε―ζ‹–εŠ¨)";
18682
+ btn.style.cssText = `
18683
+ position: fixed;
18684
+ z-index: 999999;
18685
+ background: rgba(255, 255, 255, 0.1);
18686
+ border: 1px solid rgba(255, 255, 255, 0.2);
18687
+ border-radius: 12px;
18688
+ color: white;
18689
+ font-size: 14px;
18690
+ font-weight: 600;
18691
+ padding: 10px 20px;
18692
+ cursor: pointer;
18693
+ backdrop-filter: blur(10px);
18694
+ font-family: system-ui, -apple-system, sans-serif;
18695
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
18696
+ `;
18697
+ const pos = this.config.position || "bottom-right";
18698
+ if (pos.includes("bottom")) {
18699
+ btn.style.bottom = "20px";
18700
+ } else {
18701
+ btn.style.top = "20px";
18702
+ }
18703
+ if (pos.includes("right")) {
18704
+ btn.style.right = "20px";
18705
+ } else {
18706
+ btn.style.left = "20px";
18707
+ }
18708
+ btn.onclick = () => this.show();
18709
+ this.addDragFunctionality(btn);
18710
+ document.body.appendChild(btn);
18711
+ logger.debug("[PWTK] Fallback button created successfully");
18712
+ } catch (error) {
18713
+ console.error("[PWTK] Failed to create fallback button:", error);
18690
18714
  }
18691
- btn.onclick = () => this.show();
18692
- this.addDragFunctionality(btn);
18693
- document.body.appendChild(btn);
18694
- logger.warn("[PWTK] Fallback button created");
18695
18715
  }
18696
18716
  addDragFunctionality(element) {
18697
18717
  let isDragging = false;
@@ -18742,11 +18762,21 @@ Created by Leo (@leeguoo)`);
18742
18762
  };
18743
18763
  }
18744
18764
  removeReopenButton() {
18745
- const btn = document.getElementById("network-debugger-reopen-btn");
18746
- if (btn) btn.remove();
18747
- if (this.reopenButton) {
18748
- this.reopenButton.destroy();
18749
- this.reopenButton = null;
18765
+ try {
18766
+ const btn = document.getElementById("network-debugger-reopen-btn");
18767
+ if (btn) {
18768
+ btn.remove();
18769
+ logger.debug("[PWTK] Reopen button removed from DOM");
18770
+ }
18771
+ if (this.reopenButton) {
18772
+ if (typeof this.reopenButton.destroy === "function") {
18773
+ this.reopenButton.destroy();
18774
+ }
18775
+ this.reopenButton = null;
18776
+ logger.debug("[PWTK] Reopen button reference cleared");
18777
+ }
18778
+ } catch (error) {
18779
+ console.error("[PWTK] Error removing reopen button:", error);
18750
18780
  }
18751
18781
  }
18752
18782
  destroy() {
@@ -19067,7 +19097,7 @@ class NetworkDebugger {
19067
19097
  this.initialized = true;
19068
19098
  logger.consoleDirect(`
19069
19099
  ╔════════════════════════════════════════╗
19070
- β•‘ πŸ”“ PWTK 解密小ε·₯ε…· v${"1.2.49-beta.6"} β•‘
19100
+ β•‘ πŸ”“ PWTK 解密小ε·₯ε…· v${"1.2.49-beta.7"} β•‘
19071
19101
  β•‘ Created by Leo (@leeguoo) β•‘
19072
19102
  β•‘ ζŠ€ζœ―ζ”―ζŒ: 请联系 Leo β•‘
19073
19103
  β•‘ εˆ†δΊ«ζœεŠ‘: curl.bwg.leeguoo.com β•‘
@@ -19128,7 +19158,7 @@ class NetworkDebugger {
19128
19158
  }
19129
19159
  async checkForUpdates() {
19130
19160
  try {
19131
- const currentVersion = "1.2.49-beta.6";
19161
+ const currentVersion = "1.2.49-beta.7";
19132
19162
  logger.info(`[PWTK Update] Checking for updates... Current version: ${currentVersion}`);
19133
19163
  const response = await fetch("https://registry.npmjs.org/@leeguoo/pwtk-network-debugger/latest");
19134
19164
  const data = await response.json();
@@ -19148,7 +19178,7 @@ class NetworkDebugger {
19148
19178
  logger.error("[PWTK Update] Failed to check for updates:", error);
19149
19179
  return {
19150
19180
  hasUpdate: false,
19151
- currentVersion: "1.2.49-beta.6"
19181
+ currentVersion: "1.2.49-beta.7"
19152
19182
  };
19153
19183
  }
19154
19184
  }