@leeguoo/pwtk-network-debugger 1.3.4 → 1.3.6

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
@@ -7867,7 +7867,42 @@ const styles = `
7867
7867
  flex-direction: column;
7868
7868
  }
7869
7869
 
7870
- /* 移除标签页相关样式 - 只保留网络面板 */
7870
+ .debugger-tabs {
7871
+ display: flex;
7872
+ gap: 8px;
7873
+ padding: 0 12px;
7874
+ margin-bottom: 8px;
7875
+ }
7876
+
7877
+ .debugger-tab {
7878
+ cursor: pointer;
7879
+ border: 1px solid transparent;
7880
+ border-radius: 10px;
7881
+ padding: 6px 14px;
7882
+ font-size: 12px;
7883
+ color: rgba(255, 255, 255, 0.85);
7884
+ background: rgba(255, 255, 255, 0.08);
7885
+ transition: all 0.2s ease;
7886
+ }
7887
+
7888
+ .debugger-tab:hover {
7889
+ border-color: rgba(255, 255, 255, 0.3);
7890
+ }
7891
+
7892
+ .debugger-tab.active {
7893
+ background: rgba(44, 110, 203, 0.7);
7894
+ border-color: rgba(255, 255, 255, 0.35);
7895
+ color: #fff;
7896
+ }
7897
+
7898
+ .tab-content {
7899
+ display: none;
7900
+ height: 100%;
7901
+ }
7902
+
7903
+ .tab-content.active {
7904
+ display: block;
7905
+ }
7871
7906
 
7872
7907
  .debugger-panel-content {
7873
7908
  flex: 1;
@@ -7875,6 +7910,90 @@ const styles = `
7875
7910
  padding: 12px;
7876
7911
  }
7877
7912
 
7913
+ .performance-panel {
7914
+ display: flex;
7915
+ flex-direction: column;
7916
+ gap: 12px;
7917
+ height: 100%;
7918
+ overflow-y: auto;
7919
+ padding-right: 6px;
7920
+ }
7921
+
7922
+ .settings-section {
7923
+ display: flex;
7924
+ flex-direction: column;
7925
+ gap: 10px;
7926
+ }
7927
+
7928
+ .settings-toggle {
7929
+ display: flex;
7930
+ gap: 10px;
7931
+ align-items: flex-start;
7932
+ padding: 10px;
7933
+ border-radius: 12px;
7934
+ background: rgba(255, 255, 255, 0.06);
7935
+ border: 1px solid rgba(255, 255, 255, 0.12);
7936
+ cursor: pointer;
7937
+ transition: border 0.2s ease, background 0.2s ease;
7938
+ }
7939
+
7940
+ .settings-toggle:hover {
7941
+ border-color: rgba(255, 255, 255, 0.25);
7942
+ }
7943
+
7944
+ .settings-toggle.disabled {
7945
+ opacity: 0.5;
7946
+ cursor: not-allowed;
7947
+ }
7948
+
7949
+ .settings-toggle input {
7950
+ margin-top: 3px;
7951
+ }
7952
+
7953
+ .settings-text {
7954
+ display: flex;
7955
+ flex-direction: column;
7956
+ }
7957
+
7958
+ .settings-title {
7959
+ font-weight: 600;
7960
+ font-size: 13px;
7961
+ margin-bottom: 4px;
7962
+ }
7963
+
7964
+ .settings-desc {
7965
+ font-size: 11px;
7966
+ opacity: 0.75;
7967
+ line-height: 1.5;
7968
+ }
7969
+
7970
+ .settings-refresh-btn {
7971
+ padding: 10px 0;
7972
+ border-radius: 10px;
7973
+ border: 1px solid rgba(255, 255, 255, 0.25);
7974
+ background: rgba(44, 110, 203, 0.75);
7975
+ color: #fff;
7976
+ font-weight: 600;
7977
+ cursor: pointer;
7978
+ transition: all 0.2s ease;
7979
+ }
7980
+
7981
+ .settings-refresh-btn:hover:not(:disabled) {
7982
+ background: rgba(44, 110, 203, 0.85);
7983
+ }
7984
+
7985
+ .settings-refresh-btn:disabled {
7986
+ opacity: 0.5;
7987
+ cursor: not-allowed;
7988
+ }
7989
+
7990
+ .settings-note {
7991
+ font-size: 11px;
7992
+ opacity: 0.65;
7993
+ line-height: 1.6;
7994
+ padding-bottom: 8px;
7995
+ }
7996
+
7878
7997
  .request-list {
7879
7998
  display: flex;
7880
7999
  flex-direction: column;
@@ -17981,6 +18100,7 @@ class LiquidGlassScene {
17981
18100
  useCORS: true,
17982
18101
  windowWidth: document.documentElement.scrollWidth,
17983
18102
  windowHeight: document.documentElement.scrollHeight,
18103
+ logging: false,
17984
18104
  ignoreElements: (element) => this.container.contains(element)
17985
18105
  }).then((canvas) => {
17986
18106
  this.snapshotCanvas = canvas;
@@ -18308,6 +18428,7 @@ const _DebugPanel = class _DebugPanel {
18308
18428
  this.webglManager = null;
18309
18429
  this.reopenButton = null;
18310
18430
  this.webglBackgroundUpdateTimer = null;
18431
+ this.activeTab = "network";
18311
18432
  this.boundHandlers = /* @__PURE__ */ new Map();
18312
18433
  this.eventListeners = [];
18313
18434
  this.renderDebounceTimer = null;
@@ -18373,7 +18494,7 @@ const _DebugPanel = class _DebugPanel {
18373
18494
  this.container.style.pointerEvents = "auto";
18374
18495
  this.container.innerHTML = `
18375
18496
  <div class="debugger-header">
18376
- <div class="debugger-title">🔓 PWTK 解密小工具 <span style="font-size: 10px; opacity: 0.7;">by Leo v${"1.3.4"}</span></div>
18497
+ <div class="debugger-title">🔓 PWTK 解密小工具 <span style="font-size: 10px; opacity: 0.7;">by Leo v${"1.3.6"}</span></div>
18377
18498
  <div class="debugger-controls">
18378
18499
  <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>
18379
18500
  <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>
@@ -18386,14 +18507,45 @@ const _DebugPanel = class _DebugPanel {
18386
18507
  <svg class="search-icon" viewBox="0 0 24 24" width="16" height="16"><path fill="currentColor" d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>
18387
18508
  <input type="text" class="search-input" placeholder="搜索 URL、方法、状态码..." />
18388
18509
  <button class="search-clear-btn" title="清除搜索" style="display: none;">×</button>
18389
- </div>
18390
- <div class="search-stats"></div>
18391
18510
  </div>
18392
- <div class="debugger-content">
18511
+ <div class="search-stats"></div>
18512
+ </div>
18513
+ <div class="debugger-content">
18514
+ <div class="debugger-tabs">
18515
+ <button class="debugger-tab active" data-tab="network">网络请求</button>
18516
+ <button class="debugger-tab" data-tab="settings">性能与外观</button>
18517
+ </div>
18393
18518
  <div class="debugger-panel-content">
18394
- <div class="network-panel">
18519
+ <div class="tab-content network-panel active" data-tab-content="network">
18395
18520
  <div class="request-list"></div>
18396
18521
  </div>
18522
+ <div class="tab-content performance-panel" data-tab-content="settings">
18523
+ <div class="settings-section" data-setting-group="enableWebGL">
18524
+ <label class="settings-toggle">
18525
+ <input type="checkbox" data-setting="enableWebGL" />
18526
+ <div class="settings-text">
18527
+ <div class="settings-title">启用液态玻璃效果</div>
18528
+ <div class="settings-desc">关闭后使用轻量级 CSS 背景,适合低性能设备</div>
18529
+ </div>
18530
+ </label>
18531
+ <label class="settings-toggle" data-setting-group="autoRefresh">
18532
+ <input type="checkbox" data-setting="autoRefresh" />
18533
+ <div class="settings-text">
18534
+ <div class="settings-title">自动刷新背景快照</div>
18535
+ <div class="settings-desc">监听页面变化自动重新截图,关闭后可通过下方按钮手动刷新</div>
18536
+ </div>
18537
+ </label>
18538
+ <label class="settings-toggle" data-setting-group="enableButtonAnimation">
18539
+ <input type="checkbox" data-setting="enableButtonAnimation" />
18540
+ <div class="settings-text">
18541
+ <div class="settings-title">浮动按钮动效</div>
18542
+ <div class="settings-desc">更新 WebGL 按钮的实时玻璃动效,关闭可降低 GPU 压力</div>
18543
+ </div>
18544
+ </label>
18545
+ </div>
18546
+ <button class="settings-refresh-btn" data-action="manual-refresh">手动刷新背景</button>
18547
+ <div class="settings-note">提示:当性能受限时可以关闭液态玻璃效果。随时可以重新开启,并手动刷新一次背景同步页面。</div>
18548
+ </div>
18397
18549
  </div>
18398
18550
  </div>
18399
18551
  `;
@@ -18401,6 +18553,7 @@ const _DebugPanel = class _DebugPanel {
18401
18553
  this.shadowRoot.appendChild(this.container);
18402
18554
  document.body.appendChild(this.hostElement);
18403
18555
  this.networkTab = this.shadowRoot.querySelector(".network-panel");
18556
+ this.performancePanel = this.shadowRoot.querySelector(".performance-panel");
18404
18557
  }
18405
18558
  addResizeHandles() {
18406
18559
  const handles = ["n", "s", "e", "w", "ne", "nw", "se", "sw"];
@@ -18416,6 +18569,23 @@ const _DebugPanel = class _DebugPanel {
18416
18569
  const controls = this.shadowRoot.querySelector(".debugger-controls");
18417
18570
  const searchInput = this.shadowRoot.querySelector(".search-input");
18418
18571
  const searchClearBtn = this.shadowRoot.querySelector(".search-clear-btn");
18572
+ const tabButtons = this.shadowRoot.querySelectorAll(".debugger-tab");
18573
+ tabButtons.forEach((button) => {
18574
+ button.addEventListener("click", () => {
18575
+ const tab = button.dataset.tab === "settings" ? "settings" : "network";
18576
+ this.switchTab(tab);
18577
+ });
18578
+ });
18579
+ const settingInputs = this.shadowRoot.querySelectorAll("input[data-setting]");
18580
+ settingInputs.forEach((input) => {
18581
+ input.addEventListener("change", () => {
18582
+ const key = input.getAttribute("data-setting");
18583
+ if (!key) return;
18584
+ this.handleSettingToggle(key, input.checked);
18585
+ });
18586
+ });
18587
+ const manualRefreshBtn = this.shadowRoot.querySelector('[data-action="manual-refresh"]');
18588
+ manualRefreshBtn?.addEventListener("click", () => this.handleManualRefresh());
18419
18589
  searchInput.addEventListener("input", (e2) => {
18420
18590
  const query = e2.target.value;
18421
18591
  this.searchQuery = query;
@@ -18482,6 +18652,80 @@ const _DebugPanel = class _DebugPanel {
18482
18652
  this.addEventListener(document, "mousemove", boundMouseMove);
18483
18653
  this.addEventListener(document, "mouseup", boundMouseUp);
18484
18654
  this.addEventListener(window, "resize", boundWindowResize);
18655
+ this.syncLiquidSettings();
18656
+ this.switchTab(this.activeTab);
18657
+ }
18658
+ switchTab(tab) {
18659
+ this.activeTab = tab;
18660
+ const tabButtons = this.shadowRoot.querySelectorAll(".debugger-tab");
18661
+ tabButtons.forEach((btn) => {
18662
+ btn.classList.toggle("active", btn.dataset.tab === tab);
18663
+ });
18664
+ const tabContents = this.shadowRoot.querySelectorAll(".tab-content");
18665
+ tabContents.forEach((content2) => {
18666
+ content2.classList.toggle("active", content2.dataset.tabContent === tab);
18667
+ });
18668
+ const searchBar = this.shadowRoot.querySelector(".debugger-search-bar");
18669
+ if (searchBar) {
18670
+ searchBar.style.display = tab === "network" ? "flex" : "none";
18671
+ }
18672
+ }
18673
+ syncLiquidSettings() {
18674
+ if (typeof Container === "undefined") return;
18675
+ const baseSettings = Container.settings || (typeof Container.loadSettings === "function" ? Container.loadSettings() : Container.defaultSettings || {});
18676
+ const enableWebGL = baseSettings.enableWebGL !== false;
18677
+ const autoRefresh = baseSettings.autoRefresh !== false;
18678
+ const enableButtonAnimation = baseSettings.enableButtonAnimation !== false;
18679
+ const settingsMap = {
18680
+ enableWebGL,
18681
+ autoRefresh,
18682
+ enableButtonAnimation
18683
+ };
18684
+ const settingInputs = this.shadowRoot.querySelectorAll("input[data-setting]");
18685
+ settingInputs.forEach((input) => {
18686
+ const key = input.getAttribute("data-setting");
18687
+ if (!key) return;
18688
+ const value = settingsMap[key];
18689
+ if (typeof value !== "undefined") {
18690
+ input.checked = value;
18691
+ }
18692
+ if (key !== "enableWebGL") {
18693
+ input.disabled = !enableWebGL;
18694
+ }
18695
+ });
18696
+ const autoGroup = this.shadowRoot.querySelector('[data-setting-group="autoRefresh"]');
18697
+ if (autoGroup) {
18698
+ autoGroup.classList.toggle("disabled", !enableWebGL);
18699
+ }
18700
+ const animGroup = this.shadowRoot.querySelector('[data-setting-group="enableButtonAnimation"]');
18701
+ if (animGroup) {
18702
+ animGroup.classList.toggle("disabled", !enableWebGL);
18703
+ }
18704
+ const manualRefreshBtn = this.shadowRoot.querySelector('[data-action="manual-refresh"]');
18705
+ if (manualRefreshBtn) {
18706
+ manualRefreshBtn.disabled = !enableWebGL;
18707
+ }
18708
+ }
18709
+ handleSettingToggle(key, value) {
18710
+ if (typeof Container !== "undefined" && typeof Container.updateSetting === "function") {
18711
+ Container.updateSetting(key, value);
18712
+ }
18713
+ if (key === "enableWebGL") {
18714
+ this.toggleWebGL(value);
18715
+ if (value) {
18716
+ this.scheduleLiquidGlassRefresh(true, 30);
18717
+ }
18718
+ }
18719
+ if (key === "enableButtonAnimation" && value) {
18720
+ this.scheduleLiquidGlassRefresh(true, 30);
18721
+ }
18722
+ this.syncLiquidSettings();
18723
+ }
18724
+ handleManualRefresh() {
18725
+ if (typeof Container !== "undefined" && typeof Container.refreshAll === "function") {
18726
+ Container.refreshAll(true);
18727
+ }
18728
+ this.webglManager?.updateBackgrounds(true);
18485
18729
  }
18486
18730
  startListening() {
18487
18731
  this.interceptor.addListener((request) => {
@@ -18983,6 +19227,8 @@ Created by Leo (@leeguoo)`);
18983
19227
  this.config.isClosed = false;
18984
19228
  this.saveConfig();
18985
19229
  this.removeReopenButton();
19230
+ this.syncLiquidSettings();
19231
+ this.switchTab(this.activeTab);
18986
19232
  this.scheduleLiquidGlassRefresh(true, 50);
18987
19233
  }
18988
19234
  hide() {
@@ -19528,8 +19774,8 @@ if (typeof window !== "undefined") {
19528
19774
  }
19529
19775
  function loadLiquidGlass() {
19530
19776
  return new Promise((resolve) => {
19531
- import("./container-Cy51KA7q.mjs").then(() => {
19532
- return import("./button-Dt1KsQb6.mjs");
19777
+ import("./container-D251rMGP.mjs").then(() => {
19778
+ return import("./button-B5OqHDUm.mjs");
19533
19779
  }).then(() => {
19534
19780
  resolve();
19535
19781
  }).catch((error) => {
@@ -19669,7 +19915,7 @@ const _NetworkDebugger = class _NetworkDebugger {
19669
19915
  }
19670
19916
  async checkForUpdates() {
19671
19917
  try {
19672
- const currentVersion = "1.3.4";
19918
+ const currentVersion = "1.3.6";
19673
19919
  logger.info(`[PWTK Update] Checking for updates... Current version: ${currentVersion}`);
19674
19920
  const response = await fetch("https://registry.npmjs.org/@leeguoo/pwtk-network-debugger/latest");
19675
19921
  const data = await response.json();
@@ -19689,7 +19935,7 @@ const _NetworkDebugger = class _NetworkDebugger {
19689
19935
  logger.error("[PWTK Update] Failed to check for updates:", error);
19690
19936
  return {
19691
19937
  hasUpdate: false,
19692
- currentVersion: "1.3.4"
19938
+ currentVersion: "1.3.6"
19693
19939
  };
19694
19940
  }
19695
19941
  }