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

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
@@ -6616,7 +6616,7 @@ let Logger$1 = class Logger {
6616
6616
  this.buffer = [];
6617
6617
  this.maxBufferSize = 100;
6618
6618
  this.enableBrowserConsole = false;
6619
- this.logLevel = "debug";
6619
+ this.logLevel = "error";
6620
6620
  }
6621
6621
  configure(config) {
6622
6622
  if (config.enableBrowserConsole !== void 0) {
@@ -17053,7 +17053,6 @@ class LiquidGlassRenderer {
17053
17053
  let fragmentShaderSource = LiquidEffects.getAdvancedFragmentShader();
17054
17054
  let fragmentShader = this.compileShader(gl.FRAGMENT_SHADER, fragmentShaderSource);
17055
17055
  if (!fragmentShader) {
17056
- console.warn("[PWTK WebGL] Advanced shader compile failed, using fallback shader.");
17057
17056
  this.usingFallbackShader = true;
17058
17057
  fragmentShaderSource = this.getFallbackFragmentShader();
17059
17058
  fragmentShader = this.compileShader(gl.FRAGMENT_SHADER, fragmentShaderSource);
@@ -17108,7 +17107,6 @@ class LiquidGlassRenderer {
17108
17107
  this.gl.shaderSource(shader, source);
17109
17108
  this.gl.compileShader(shader);
17110
17109
  if (!this.gl.getShaderParameter(shader, this.gl.COMPILE_STATUS)) {
17111
- console.error("Shader compilation error:", this.gl.getShaderInfoLog(shader));
17112
17110
  this.gl.deleteShader(shader);
17113
17111
  return null;
17114
17112
  }
@@ -17427,7 +17425,6 @@ class LiquidGlassScene {
17427
17425
  try {
17428
17426
  renderer = new LiquidGlassRenderer(config);
17429
17427
  } catch (error) {
17430
- console.warn("[PWTK WebGL] WebGL not supported, falling back to CSS effects:", error);
17431
17428
  element.removeChild(canvas);
17432
17429
  throw error;
17433
17430
  }
@@ -17449,7 +17446,6 @@ class LiquidGlassScene {
17449
17446
  renderer.setUniformProvider(() => this.getDynamicUniforms(layer));
17450
17447
  this.applyPlaceholderBackground(layer);
17451
17448
  this.refreshLayerBackground(layer).catch((err) => {
17452
- console.warn("[PWTK WebGL] Initial background capture failed:", err);
17453
17449
  });
17454
17450
  return layer;
17455
17451
  }
@@ -17507,7 +17503,6 @@ class LiquidGlassScene {
17507
17503
  updateBackgrounds(forceSnapshot = false) {
17508
17504
  this.layers.forEach((layer) => {
17509
17505
  this.refreshLayerBackground(layer, forceSnapshot).catch((err) => {
17510
- console.warn("[PWTK WebGL] Background refresh failed:", err);
17511
17506
  });
17512
17507
  });
17513
17508
  }
@@ -17639,7 +17634,6 @@ class LiquidGlassScene {
17639
17634
  this.snapshotScale = scale;
17640
17635
  this.snapshotNeedsUpdate = false;
17641
17636
  }).catch((error) => {
17642
- console.warn("[PWTK WebGL] html2canvas capture failed:", error);
17643
17637
  this.snapshotCanvas = null;
17644
17638
  }).finally(() => {
17645
17639
  this.capturePromise = null;
@@ -17682,14 +17676,8 @@ const _WebGLManager = class _WebGLManager {
17682
17676
  const canvas = document.createElement("canvas");
17683
17677
  const gl = canvas.getContext("webgl2", { failIfMajorPerformanceCaveat: true });
17684
17678
  this.isSupported = !!gl;
17685
- if (this.isSupported) {
17686
- console.log("🎨 WebGL2 supported - Liquid Glass effects enabled");
17687
- } else {
17688
- console.log("⚠️ WebGL2 not supported - falling back to CSS effects");
17689
- }
17690
17679
  return this.isSupported;
17691
17680
  } catch (error) {
17692
- console.warn("WebGL support check failed:", error);
17693
17681
  this.isSupported = false;
17694
17682
  return false;
17695
17683
  }
@@ -17709,10 +17697,8 @@ const _WebGLManager = class _WebGLManager {
17709
17697
  throw new Error("WebGL context creation failed");
17710
17698
  }
17711
17699
  this.isInitialized = true;
17712
- console.log("✨ Liquid Glass WebGL effects initialized successfully");
17713
17700
  return true;
17714
17701
  } catch (error) {
17715
- console.warn("WebGL initialization failed:", error);
17716
17702
  if (this.config.autoFallback) {
17717
17703
  this.enableCSSFallback(container);
17718
17704
  }
@@ -17720,7 +17706,6 @@ const _WebGLManager = class _WebGLManager {
17720
17706
  }
17721
17707
  }
17722
17708
  enableCSSFallback(container) {
17723
- console.log("πŸ”„ Enabling CSS fallback for liquid glass effects");
17724
17709
  container.classList.add("webgl-fallback", "enhanced-css-glass");
17725
17710
  this.injectEnhancedCSS();
17726
17711
  }
@@ -17796,12 +17781,10 @@ const _WebGLManager = class _WebGLManager {
17796
17781
  }
17797
17782
  enableForElement(element, layerId) {
17798
17783
  if (!this.isInitialized || !this.scene) {
17799
- console.warn("WebGL manager not initialized");
17800
17784
  return false;
17801
17785
  }
17802
17786
  try {
17803
17787
  if (!this.scene) {
17804
- console.warn("WebGL scene not ready");
17805
17788
  return false;
17806
17789
  }
17807
17790
  if (this.scene.getLayer(layerId)) {
@@ -17813,10 +17796,8 @@ const _WebGLManager = class _WebGLManager {
17813
17796
  preset: this.config.preset
17814
17797
  });
17815
17798
  this.scene.startAnimation();
17816
- console.log(`✨ WebGL liquid glass enabled for element: ${layerId}`);
17817
17799
  return true;
17818
17800
  } catch (error) {
17819
- console.warn(`Failed to enable WebGL for element ${layerId}:`, error);
17820
17801
  if (this.config.autoFallback) {
17821
17802
  element.classList.add("enhanced-css-glass");
17822
17803
  this.addMouseTrackingToElement(element);
@@ -17836,25 +17817,21 @@ const _WebGLManager = class _WebGLManager {
17836
17817
  disableForElement(layerId) {
17837
17818
  if (!this.scene) return;
17838
17819
  this.scene.removeLayer(layerId);
17839
- console.log(`πŸ”„ WebGL liquid glass disabled for element: ${layerId}`);
17840
17820
  }
17841
17821
  setQuality(quality) {
17842
17822
  this.config.quality = quality;
17843
17823
  if (this.scene) {
17844
17824
  this.scene.setQuality(quality);
17845
- console.log(`πŸŽ›οΈ WebGL quality set to: ${quality}`);
17846
17825
  }
17847
17826
  }
17848
17827
  setPreset(preset) {
17849
17828
  this.config.preset = preset;
17850
- console.log(`🎨 WebGL preset set to: ${preset}`);
17851
17829
  if (this.scene) {
17852
17830
  this.updateEffectPresets();
17853
17831
  }
17854
17832
  }
17855
17833
  updateEffectPresets() {
17856
- const presetConfig = LiquidEffects.presets[this.config.preset];
17857
- console.log("πŸ”„ Updating effect presets:", presetConfig);
17834
+ LiquidEffects.presets[this.config.preset];
17858
17835
  if (this.scene) {
17859
17836
  this.scene.setPreset(this.config.preset);
17860
17837
  }
@@ -17881,7 +17858,6 @@ const _WebGLManager = class _WebGLManager {
17881
17858
  if (cssElement) {
17882
17859
  cssElement.remove();
17883
17860
  }
17884
- console.log("🧹 WebGL manager destroyed");
17885
17861
  }
17886
17862
  // 静态ε·₯具方法
17887
17863
  static checkSupport() {
@@ -17978,7 +17954,7 @@ const _DebugPanel = class _DebugPanel {
17978
17954
  this.container.style.pointerEvents = "auto";
17979
17955
  this.container.innerHTML = `
17980
17956
  <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>
17957
+ <div class="debugger-title">πŸ”“ PWTK 解密小ε·₯ε…· <span style="font-size: 10px; opacity: 0.7;">by Leo v${"1.2.49-beta.8"}</span></div>
17982
17958
  <div class="debugger-controls">
17983
17959
  <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
17960
  <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 +18555,26 @@ Created by Leo (@leeguoo)`);
18579
18555
  this.hostElement.style.display = "none";
18580
18556
  this.config.isClosed = true;
18581
18557
  this.saveConfig();
18582
- this.createReopenButton();
18558
+ this.createReopenButton().catch((error) => {
18559
+ logger.error("[PWTK] Failed to create reopen button:", error);
18560
+ this.createFallbackButton();
18561
+ });
18583
18562
  }
18584
18563
  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");
18564
+ try {
18565
+ this.removeReopenButton();
18566
+ const timeout = new Promise(
18567
+ (_, reject) => setTimeout(() => reject(new Error("Timeout waiting for liquid glass")), 3e3)
18568
+ );
18569
+ await Promise.race([liquidGlassPromise, timeout]);
18570
+ if (typeof window !== "undefined" && window.Button) {
18571
+ this.createGlassButton();
18572
+ } else {
18573
+ logger.debug("[PWTK] Button class not available, using fallback");
18574
+ this.createFallbackButton();
18575
+ }
18576
+ } catch (error) {
18577
+ logger.debug("[PWTK] Error creating glass button, using fallback:", error);
18591
18578
  this.createFallbackButton();
18592
18579
  }
18593
18580
  }
@@ -18654,44 +18641,53 @@ Created by Leo (@leeguoo)`);
18654
18641
  this.reopenButton = glassButton;
18655
18642
  logger.debug("[PWTK] Glass button created successfully");
18656
18643
  } catch (error) {
18657
- console.error("[PWTK] Failed to create glass button:", error);
18644
+ logger.error("[PWTK] Failed to create glass button:", error);
18658
18645
  this.createFallbackButton();
18659
18646
  }
18660
18647
  }
18661
18648
  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";
18649
+ try {
18650
+ const existingBtn = document.getElementById("network-debugger-reopen-btn");
18651
+ if (existingBtn) {
18652
+ existingBtn.remove();
18653
+ }
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: 14px;
18666
+ font-weight: 600;
18667
+ padding: 10px 20px;
18668
+ cursor: pointer;
18669
+ backdrop-filter: blur(10px);
18670
+ font-family: system-ui, -apple-system, sans-serif;
18671
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
18672
+ `;
18673
+ const pos = this.config.position || "bottom-right";
18674
+ if (pos.includes("bottom")) {
18675
+ btn.style.bottom = "20px";
18676
+ } else {
18677
+ btn.style.top = "20px";
18678
+ }
18679
+ if (pos.includes("right")) {
18680
+ btn.style.right = "20px";
18681
+ } else {
18682
+ btn.style.left = "20px";
18683
+ }
18684
+ btn.onclick = () => this.show();
18685
+ this.addDragFunctionality(btn);
18686
+ document.body.appendChild(btn);
18687
+ logger.debug("[PWTK] Fallback button created successfully");
18688
+ } catch (error) {
18689
+ logger.error("[PWTK] Failed to create fallback button:", error);
18690
18690
  }
18691
- btn.onclick = () => this.show();
18692
- this.addDragFunctionality(btn);
18693
- document.body.appendChild(btn);
18694
- logger.warn("[PWTK] Fallback button created");
18695
18691
  }
18696
18692
  addDragFunctionality(element) {
18697
18693
  let isDragging = false;
@@ -18742,11 +18738,21 @@ Created by Leo (@leeguoo)`);
18742
18738
  };
18743
18739
  }
18744
18740
  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;
18741
+ try {
18742
+ const btn = document.getElementById("network-debugger-reopen-btn");
18743
+ if (btn) {
18744
+ btn.remove();
18745
+ logger.debug("[PWTK] Reopen button removed from DOM");
18746
+ }
18747
+ if (this.reopenButton) {
18748
+ if (typeof this.reopenButton.destroy === "function") {
18749
+ this.reopenButton.destroy();
18750
+ }
18751
+ this.reopenButton = null;
18752
+ logger.debug("[PWTK] Reopen button reference cleared");
18753
+ }
18754
+ } catch (error) {
18755
+ logger.error("[PWTK] Error removing reopen button:", error);
18750
18756
  }
18751
18757
  }
18752
18758
  destroy() {
@@ -18981,19 +18987,15 @@ _DebugPanel.STORAGE_KEY = "pwtk-debugger-config";
18981
18987
  let DebugPanel = _DebugPanel;
18982
18988
  if (typeof window !== "undefined") {
18983
18989
  window.html2canvas = html2canvas;
18984
- console.log("[PWTK] html2canvas loaded and set to window");
18985
18990
  }
18986
18991
  function loadLiquidGlass() {
18987
18992
  return new Promise((resolve) => {
18988
18993
  import("./container-DZOQFeJd.mjs").then(() => {
18989
- console.log("[PWTK] Container loaded");
18990
18994
  return import("./button-DfB5OFDC.mjs");
18991
18995
  }).then(() => {
18992
- console.log("[PWTK] Button loaded");
18993
- console.log("[PWTK] Liquid glass components loaded successfully");
18994
18996
  resolve();
18995
18997
  }).catch((error) => {
18996
- console.error("[PWTK] Failed to load liquid glass components:", error);
18998
+ logger.error("[PWTK] Failed to load liquid glass components:", error);
18997
18999
  resolve();
18998
19000
  });
18999
19001
  });
@@ -19067,7 +19069,7 @@ class NetworkDebugger {
19067
19069
  this.initialized = true;
19068
19070
  logger.consoleDirect(`
19069
19071
  ╔════════════════════════════════════════╗
19070
- β•‘ πŸ”“ PWTK 解密小ε·₯ε…· v${"1.2.49-beta.6"} β•‘
19072
+ β•‘ πŸ”“ PWTK 解密小ε·₯ε…· v${"1.2.49-beta.8"} β•‘
19071
19073
  β•‘ Created by Leo (@leeguoo) β•‘
19072
19074
  β•‘ ζŠ€ζœ―ζ”―ζŒ: 请联系 Leo β•‘
19073
19075
  β•‘ εˆ†δΊ«ζœεŠ‘: curl.bwg.leeguoo.com β•‘
@@ -19128,7 +19130,7 @@ class NetworkDebugger {
19128
19130
  }
19129
19131
  async checkForUpdates() {
19130
19132
  try {
19131
- const currentVersion = "1.2.49-beta.6";
19133
+ const currentVersion = "1.2.49-beta.8";
19132
19134
  logger.info(`[PWTK Update] Checking for updates... Current version: ${currentVersion}`);
19133
19135
  const response = await fetch("https://registry.npmjs.org/@leeguoo/pwtk-network-debugger/latest");
19134
19136
  const data = await response.json();
@@ -19148,7 +19150,7 @@ class NetworkDebugger {
19148
19150
  logger.error("[PWTK Update] Failed to check for updates:", error);
19149
19151
  return {
19150
19152
  hasUpdate: false,
19151
- currentVersion: "1.2.49-beta.6"
19153
+ currentVersion: "1.2.49-beta.8"
19152
19154
  };
19153
19155
  }
19154
19156
  }