@leeguoo/pwtk-network-debugger 1.2.49-beta.5 → 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
@@ -17813,7 +17813,6 @@ const _WebGLManager = class _WebGLManager {
17813
17813
  preset: this.config.preset
17814
17814
  });
17815
17815
  this.scene.startAnimation();
17816
- this.scene.updateBackgrounds();
17817
17816
  console.log(`✨ WebGL liquid glass enabled for element: ${layerId}`);
17818
17817
  return true;
17819
17818
  } catch (error) {
@@ -17929,13 +17928,17 @@ const _DebugPanel = class _DebugPanel {
17929
17928
  webgl: {
17930
17929
  enabled: true,
17931
17930
  quality: "medium",
17932
- preset: "normal"
17931
+ preset: "normal",
17932
+ applyToItems: false
17933
17933
  },
17934
17934
  ...savedConfig,
17935
17935
  // 先应用保存的配置
17936
17936
  ...config
17937
17937
  // 再应用传入的配置(优先级最高)
17938
17938
  };
17939
+ if (this.config.webgl && this.config.webgl.applyToItems === void 0) {
17940
+ this.config.webgl.applyToItems = false;
17941
+ }
17939
17942
  this.createPanel();
17940
17943
  this.bindEvents();
17941
17944
  this.startListening();
@@ -17975,7 +17978,7 @@ const _DebugPanel = class _DebugPanel {
17975
17978
  this.container.style.pointerEvents = "auto";
17976
17979
  this.container.innerHTML = `
17977
17980
  <div class="debugger-header">
17978
- <div class="debugger-title">🔓 PWTK 解密小工具 <span style="font-size: 10px; opacity: 0.7;">by Leo v${"1.2.49-beta.5"}</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>
17979
17982
  <div class="debugger-controls">
17980
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>
17981
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>
@@ -18165,19 +18168,24 @@ const _DebugPanel = class _DebugPanel {
18165
18168
  listContainer.appendChild(emptyMessage);
18166
18169
  return;
18167
18170
  }
18171
+ const applyItems = this.config.webgl?.applyToItems ?? false;
18168
18172
  requestsToRender.forEach((request, index) => {
18169
18173
  const item = this.createRequestItem(request);
18170
18174
  listContainer.appendChild(item);
18171
18175
  if (this.webglManager) {
18172
18176
  const layerId = `request-item-${index}`;
18173
18177
  this.webglManager.disableForElement(layerId);
18174
- requestAnimationFrame(() => {
18175
- try {
18176
- this.webglManager.enableForElement(item, layerId);
18177
- } catch (error) {
18178
- logger.debug(`Failed to enable WebGL for request item ${index}:`, error);
18179
- }
18180
- });
18178
+ if (applyItems) {
18179
+ requestAnimationFrame(() => {
18180
+ try {
18181
+ this.webglManager.enableForElement(item, layerId);
18182
+ } catch (error) {
18183
+ logger.debug(`Failed to enable WebGL for request item ${index}:`, error);
18184
+ }
18185
+ });
18186
+ } else {
18187
+ item.classList.add("webgl-fallback", "enhanced-css-glass");
18188
+ }
18181
18189
  }
18182
18190
  });
18183
18191
  }
@@ -18571,15 +18579,26 @@ Created by Leo (@leeguoo)`);
18571
18579
  this.hostElement.style.display = "none";
18572
18580
  this.config.isClosed = true;
18573
18581
  this.saveConfig();
18574
- this.createReopenButton();
18582
+ this.createReopenButton().catch((error) => {
18583
+ console.error("[PWTK] Failed to create reopen button:", error);
18584
+ this.createFallbackButton();
18585
+ });
18575
18586
  }
18576
18587
  async createReopenButton() {
18577
- this.removeReopenButton();
18578
- await liquidGlassPromise;
18579
- if (typeof window !== "undefined" && window.Button) {
18580
- this.createGlassButton();
18581
- } else {
18582
- 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);
18583
18602
  this.createFallbackButton();
18584
18603
  }
18585
18604
  }
@@ -18651,39 +18670,48 @@ Created by Leo (@leeguoo)`);
18651
18670
  }
18652
18671
  }
18653
18672
  createFallbackButton() {
18654
- const btn = document.createElement("button");
18655
- btn.id = "network-debugger-reopen-btn";
18656
- btn.innerText = "PWTK";
18657
- btn.title = "打开调试面板 (可拖动)";
18658
- btn.style.cssText = `
18659
- position: fixed;
18660
- z-index: 999999;
18661
- background: rgba(255, 255, 255, 0.1);
18662
- border: 1px solid rgba(255, 255, 255, 0.2);
18663
- border-radius: 12px;
18664
- color: white;
18665
- font-size: 12px;
18666
- font-weight: 600;
18667
- padding: 8px 16px;
18668
- cursor: pointer;
18669
- backdrop-filter: blur(10px);
18670
- font-family: system-ui, -apple-system, sans-serif;
18671
- `;
18672
- const pos = this.config.position || "bottom-right";
18673
- if (pos.includes("bottom")) {
18674
- btn.style.bottom = "20px";
18675
- } else {
18676
- btn.style.top = "20px";
18677
- }
18678
- if (pos.includes("right")) {
18679
- btn.style.right = "20px";
18680
- } else {
18681
- 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);
18682
18714
  }
18683
- btn.onclick = () => this.show();
18684
- this.addDragFunctionality(btn);
18685
- document.body.appendChild(btn);
18686
- logger.warn("[PWTK] Fallback button created");
18687
18715
  }
18688
18716
  addDragFunctionality(element) {
18689
18717
  let isDragging = false;
@@ -18734,11 +18762,21 @@ Created by Leo (@leeguoo)`);
18734
18762
  };
18735
18763
  }
18736
18764
  removeReopenButton() {
18737
- const btn = document.getElementById("network-debugger-reopen-btn");
18738
- if (btn) btn.remove();
18739
- if (this.reopenButton) {
18740
- this.reopenButton.destroy();
18741
- 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);
18742
18780
  }
18743
18781
  }
18744
18782
  destroy() {
@@ -18787,7 +18825,13 @@ Created by Leo (@leeguoo)`);
18787
18825
  position: this.config.position,
18788
18826
  theme: this.config.theme,
18789
18827
  minimized: this.config.minimized,
18790
- isClosed: this.config.isClosed
18828
+ isClosed: this.config.isClosed,
18829
+ webgl: {
18830
+ enabled: this.config.webgl?.enabled,
18831
+ quality: this.config.webgl?.quality,
18832
+ preset: this.config.webgl?.preset,
18833
+ applyToItems: this.config.webgl?.applyToItems
18834
+ }
18791
18835
  };
18792
18836
  localStorage.setItem(_DebugPanel.STORAGE_KEY, JSON.stringify(configToSave));
18793
18837
  logger.debug("配置已保存:", configToSave);
@@ -18904,7 +18948,16 @@ Created by Leo (@leeguoo)`);
18904
18948
  * 更新 WebGL 配置
18905
18949
  */
18906
18950
  updateWebGLConfig(config) {
18907
- if (!this.webglManager) return;
18951
+ if (!this.config.webgl) {
18952
+ this.config.webgl = { enabled: true, quality: "medium", preset: "normal", applyToItems: false };
18953
+ }
18954
+ if (!this.webglManager) {
18955
+ if (config.quality) this.config.webgl.quality = config.quality;
18956
+ if (config.preset) this.config.webgl.preset = config.preset;
18957
+ if (config.applyToItems !== void 0) this.config.webgl.applyToItems = config.applyToItems;
18958
+ this.saveConfig();
18959
+ return;
18960
+ }
18908
18961
  if (config.quality) {
18909
18962
  this.config.webgl.quality = config.quality;
18910
18963
  this.webglManager.setQuality(config.quality);
@@ -18915,6 +18968,15 @@ Created by Leo (@leeguoo)`);
18915
18968
  this.webglManager.setPreset(config.preset);
18916
18969
  logger.debug(`WebGL preset updated to: ${config.preset}`);
18917
18970
  }
18971
+ if (config.applyToItems !== void 0) {
18972
+ this.config.webgl.applyToItems = config.applyToItems;
18973
+ if (!config.applyToItems) {
18974
+ this.requestsCache.forEach((_, index) => {
18975
+ this.webglManager?.disableForElement(`request-item-${index}`);
18976
+ });
18977
+ }
18978
+ this.renderRequests();
18979
+ }
18918
18980
  this.saveConfig();
18919
18981
  }
18920
18982
  /**
@@ -18922,7 +18984,7 @@ Created by Leo (@leeguoo)`);
18922
18984
  */
18923
18985
  toggleWebGL(enabled) {
18924
18986
  if (!this.config.webgl) {
18925
- this.config.webgl = { enabled: true, quality: "medium", preset: "normal" };
18987
+ this.config.webgl = { enabled: true, quality: "medium", preset: "normal", applyToItems: false };
18926
18988
  }
18927
18989
  this.config.webgl.enabled = enabled;
18928
18990
  this.saveConfig();
@@ -19035,7 +19097,7 @@ class NetworkDebugger {
19035
19097
  this.initialized = true;
19036
19098
  logger.consoleDirect(`
19037
19099
  ╔════════════════════════════════════════╗
19038
- ║ 🔓 PWTK 解密小工具 v${"1.2.49-beta.5"} ║
19100
+ ║ 🔓 PWTK 解密小工具 v${"1.2.49-beta.7"} ║
19039
19101
  ║ Created by Leo (@leeguoo) ║
19040
19102
  ║ 技术支持: 请联系 Leo ║
19041
19103
  ║ 分享服务: curl.bwg.leeguoo.com ║
@@ -19096,7 +19158,7 @@ class NetworkDebugger {
19096
19158
  }
19097
19159
  async checkForUpdates() {
19098
19160
  try {
19099
- const currentVersion = "1.2.49-beta.5";
19161
+ const currentVersion = "1.2.49-beta.7";
19100
19162
  logger.info(`[PWTK Update] Checking for updates... Current version: ${currentVersion}`);
19101
19163
  const response = await fetch("https://registry.npmjs.org/@leeguoo/pwtk-network-debugger/latest");
19102
19164
  const data = await response.json();
@@ -19116,7 +19178,7 @@ class NetworkDebugger {
19116
19178
  logger.error("[PWTK Update] Failed to check for updates:", error);
19117
19179
  return {
19118
19180
  hasUpdate: false,
19119
- currentVersion: "1.2.49-beta.5"
19181
+ currentVersion: "1.2.49-beta.7"
19120
19182
  };
19121
19183
  }
19122
19184
  }