@leeguoo/pwtk-network-debugger 1.3.5 → 1.3.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
@@ -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;
@@ -17974,6 +18093,8 @@ class LiquidGlassScene {
17974
18093
  await new Promise((resolve) => window.setTimeout(resolve, this.minSnapshotInterval - elapsed));
17975
18094
  }
17976
18095
  }
18096
+ const containerClass = typeof window !== "undefined" ? window.Container : null;
18097
+ containerClass?.suppressDocumentWriteWarnings?.();
17977
18098
  const scale = this.calculateSnapshotScale();
17978
18099
  this.capturePromise = html2canvas(document.body, {
17979
18100
  scale,
@@ -17994,6 +18115,7 @@ class LiquidGlassScene {
17994
18115
  this.pendingBackgroundRefresh = true;
17995
18116
  }).finally(() => {
17996
18117
  this.capturePromise = null;
18118
+ containerClass?.restoreDocumentWriteWarnings?.();
17997
18119
  });
17998
18120
  await this.capturePromise;
17999
18121
  }
@@ -18309,6 +18431,7 @@ const _DebugPanel = class _DebugPanel {
18309
18431
  this.webglManager = null;
18310
18432
  this.reopenButton = null;
18311
18433
  this.webglBackgroundUpdateTimer = null;
18434
+ this.activeTab = "network";
18312
18435
  this.boundHandlers = /* @__PURE__ */ new Map();
18313
18436
  this.eventListeners = [];
18314
18437
  this.renderDebounceTimer = null;
@@ -18374,7 +18497,7 @@ const _DebugPanel = class _DebugPanel {
18374
18497
  this.container.style.pointerEvents = "auto";
18375
18498
  this.container.innerHTML = `
18376
18499
  <div class="debugger-header">
18377
- <div class="debugger-title">🔓 PWTK 解密小工具 <span style="font-size: 10px; opacity: 0.7;">by Leo v${"1.3.5"}</span></div>
18500
+ <div class="debugger-title">🔓 PWTK 解密小工具 <span style="font-size: 10px; opacity: 0.7;">by Leo v${"1.3.7"}</span></div>
18378
18501
  <div class="debugger-controls">
18379
18502
  <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>
18380
18503
  <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>
@@ -18387,14 +18510,45 @@ const _DebugPanel = class _DebugPanel {
18387
18510
  <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>
18388
18511
  <input type="text" class="search-input" placeholder="搜索 URL、方法、状态码..." />
18389
18512
  <button class="search-clear-btn" title="清除搜索" style="display: none;">×</button>
18390
- </div>
18391
- <div class="search-stats"></div>
18392
18513
  </div>
18393
- <div class="debugger-content">
18514
+ <div class="search-stats"></div>
18515
+ </div>
18516
+ <div class="debugger-content">
18517
+ <div class="debugger-tabs">
18518
+ <button class="debugger-tab active" data-tab="network">网络请求</button>
18519
+ <button class="debugger-tab" data-tab="settings">性能与外观</button>
18520
+ </div>
18394
18521
  <div class="debugger-panel-content">
18395
- <div class="network-panel">
18522
+ <div class="tab-content network-panel active" data-tab-content="network">
18396
18523
  <div class="request-list"></div>
18397
18524
  </div>
18525
+ <div class="tab-content performance-panel" data-tab-content="settings">
18526
+ <div class="settings-section" data-setting-group="enableWebGL">
18527
+ <label class="settings-toggle">
18528
+ <input type="checkbox" data-setting="enableWebGL" />
18529
+ <div class="settings-text">
18530
+ <div class="settings-title">启用液态玻璃效果</div>
18531
+ <div class="settings-desc">关闭后使用轻量级 CSS 背景,适合低性能设备</div>
18532
+ </div>
18533
+ </label>
18534
+ <label class="settings-toggle" data-setting-group="autoRefresh">
18535
+ <input type="checkbox" data-setting="autoRefresh" />
18536
+ <div class="settings-text">
18537
+ <div class="settings-title">自动刷新背景快照</div>
18538
+ <div class="settings-desc">监听页面变化自动重新截图,关闭后可通过下方按钮手动刷新</div>
18539
+ </div>
18540
+ </label>
18541
+ <label class="settings-toggle" data-setting-group="enableButtonAnimation">
18542
+ <input type="checkbox" data-setting="enableButtonAnimation" />
18543
+ <div class="settings-text">
18544
+ <div class="settings-title">浮动按钮动效</div>
18545
+ <div class="settings-desc">更新 WebGL 按钮的实时玻璃动效,关闭可降低 GPU 压力</div>
18546
+ </div>
18547
+ </label>
18548
+ </div>
18549
+ <button class="settings-refresh-btn" data-action="manual-refresh">手动刷新背景</button>
18550
+ <div class="settings-note">提示:当性能受限时可以关闭液态玻璃效果。随时可以重新开启,并手动刷新一次背景同步页面。</div>
18551
+ </div>
18398
18552
  </div>
18399
18553
  </div>
18400
18554
  `;
@@ -18402,6 +18556,7 @@ const _DebugPanel = class _DebugPanel {
18402
18556
  this.shadowRoot.appendChild(this.container);
18403
18557
  document.body.appendChild(this.hostElement);
18404
18558
  this.networkTab = this.shadowRoot.querySelector(".network-panel");
18559
+ this.performancePanel = this.shadowRoot.querySelector(".performance-panel");
18405
18560
  }
18406
18561
  addResizeHandles() {
18407
18562
  const handles = ["n", "s", "e", "w", "ne", "nw", "se", "sw"];
@@ -18417,6 +18572,23 @@ const _DebugPanel = class _DebugPanel {
18417
18572
  const controls = this.shadowRoot.querySelector(".debugger-controls");
18418
18573
  const searchInput = this.shadowRoot.querySelector(".search-input");
18419
18574
  const searchClearBtn = this.shadowRoot.querySelector(".search-clear-btn");
18575
+ const tabButtons = this.shadowRoot.querySelectorAll(".debugger-tab");
18576
+ tabButtons.forEach((button) => {
18577
+ button.addEventListener("click", () => {
18578
+ const tab = button.dataset.tab === "settings" ? "settings" : "network";
18579
+ this.switchTab(tab);
18580
+ });
18581
+ });
18582
+ const settingInputs = this.shadowRoot.querySelectorAll("input[data-setting]");
18583
+ settingInputs.forEach((input) => {
18584
+ input.addEventListener("change", () => {
18585
+ const key = input.getAttribute("data-setting");
18586
+ if (!key) return;
18587
+ this.handleSettingToggle(key, input.checked);
18588
+ });
18589
+ });
18590
+ const manualRefreshBtn = this.shadowRoot.querySelector('[data-action="manual-refresh"]');
18591
+ manualRefreshBtn?.addEventListener("click", () => this.handleManualRefresh());
18420
18592
  searchInput.addEventListener("input", (e2) => {
18421
18593
  const query = e2.target.value;
18422
18594
  this.searchQuery = query;
@@ -18483,6 +18655,80 @@ const _DebugPanel = class _DebugPanel {
18483
18655
  this.addEventListener(document, "mousemove", boundMouseMove);
18484
18656
  this.addEventListener(document, "mouseup", boundMouseUp);
18485
18657
  this.addEventListener(window, "resize", boundWindowResize);
18658
+ this.syncLiquidSettings();
18659
+ this.switchTab(this.activeTab);
18660
+ }
18661
+ switchTab(tab) {
18662
+ this.activeTab = tab;
18663
+ const tabButtons = this.shadowRoot.querySelectorAll(".debugger-tab");
18664
+ tabButtons.forEach((btn) => {
18665
+ btn.classList.toggle("active", btn.dataset.tab === tab);
18666
+ });
18667
+ const tabContents = this.shadowRoot.querySelectorAll(".tab-content");
18668
+ tabContents.forEach((content2) => {
18669
+ content2.classList.toggle("active", content2.dataset.tabContent === tab);
18670
+ });
18671
+ const searchBar = this.shadowRoot.querySelector(".debugger-search-bar");
18672
+ if (searchBar) {
18673
+ searchBar.style.display = tab === "network" ? "flex" : "none";
18674
+ }
18675
+ }
18676
+ syncLiquidSettings() {
18677
+ if (typeof Container === "undefined") return;
18678
+ const baseSettings = Container.settings || (typeof Container.loadSettings === "function" ? Container.loadSettings() : Container.defaultSettings || {});
18679
+ const enableWebGL = baseSettings.enableWebGL !== false;
18680
+ const autoRefresh = baseSettings.autoRefresh !== false;
18681
+ const enableButtonAnimation = baseSettings.enableButtonAnimation !== false;
18682
+ const settingsMap = {
18683
+ enableWebGL,
18684
+ autoRefresh,
18685
+ enableButtonAnimation
18686
+ };
18687
+ const settingInputs = this.shadowRoot.querySelectorAll("input[data-setting]");
18688
+ settingInputs.forEach((input) => {
18689
+ const key = input.getAttribute("data-setting");
18690
+ if (!key) return;
18691
+ const value = settingsMap[key];
18692
+ if (typeof value !== "undefined") {
18693
+ input.checked = value;
18694
+ }
18695
+ if (key !== "enableWebGL") {
18696
+ input.disabled = !enableWebGL;
18697
+ }
18698
+ });
18699
+ const autoGroup = this.shadowRoot.querySelector('[data-setting-group="autoRefresh"]');
18700
+ if (autoGroup) {
18701
+ autoGroup.classList.toggle("disabled", !enableWebGL);
18702
+ }
18703
+ const animGroup = this.shadowRoot.querySelector('[data-setting-group="enableButtonAnimation"]');
18704
+ if (animGroup) {
18705
+ animGroup.classList.toggle("disabled", !enableWebGL);
18706
+ }
18707
+ const manualRefreshBtn = this.shadowRoot.querySelector('[data-action="manual-refresh"]');
18708
+ if (manualRefreshBtn) {
18709
+ manualRefreshBtn.disabled = !enableWebGL;
18710
+ }
18711
+ }
18712
+ handleSettingToggle(key, value) {
18713
+ if (typeof Container !== "undefined" && typeof Container.updateSetting === "function") {
18714
+ Container.updateSetting(key, value);
18715
+ }
18716
+ if (key === "enableWebGL") {
18717
+ this.toggleWebGL(value);
18718
+ if (value) {
18719
+ this.scheduleLiquidGlassRefresh(true, 30);
18720
+ }
18721
+ }
18722
+ if (key === "enableButtonAnimation" && value) {
18723
+ this.scheduleLiquidGlassRefresh(true, 30);
18724
+ }
18725
+ this.syncLiquidSettings();
18726
+ }
18727
+ handleManualRefresh() {
18728
+ if (typeof Container !== "undefined" && typeof Container.refreshAll === "function") {
18729
+ Container.refreshAll(true);
18730
+ }
18731
+ this.webglManager?.updateBackgrounds(true);
18486
18732
  }
18487
18733
  startListening() {
18488
18734
  this.interceptor.addListener((request) => {
@@ -18984,6 +19230,8 @@ Created by Leo (@leeguoo)`);
18984
19230
  this.config.isClosed = false;
18985
19231
  this.saveConfig();
18986
19232
  this.removeReopenButton();
19233
+ this.syncLiquidSettings();
19234
+ this.switchTab(this.activeTab);
18987
19235
  this.scheduleLiquidGlassRefresh(true, 50);
18988
19236
  }
18989
19237
  hide() {
@@ -19529,7 +19777,7 @@ if (typeof window !== "undefined") {
19529
19777
  }
19530
19778
  function loadLiquidGlass() {
19531
19779
  return new Promise((resolve) => {
19532
- import("./container-qvHOCG_V.mjs").then(() => {
19780
+ import("./container-fXvGYIU-.mjs").then(() => {
19533
19781
  return import("./button-B5OqHDUm.mjs");
19534
19782
  }).then(() => {
19535
19783
  resolve();
@@ -19670,7 +19918,7 @@ const _NetworkDebugger = class _NetworkDebugger {
19670
19918
  }
19671
19919
  async checkForUpdates() {
19672
19920
  try {
19673
- const currentVersion = "1.3.5";
19921
+ const currentVersion = "1.3.7";
19674
19922
  logger.info(`[PWTK Update] Checking for updates... Current version: ${currentVersion}`);
19675
19923
  const response = await fetch("https://registry.npmjs.org/@leeguoo/pwtk-network-debugger/latest");
19676
19924
  const data = await response.json();
@@ -19690,7 +19938,7 @@ const _NetworkDebugger = class _NetworkDebugger {
19690
19938
  logger.error("[PWTK Update] Failed to check for updates:", error);
19691
19939
  return {
19692
19940
  hasUpdate: false,
19693
- currentVersion: "1.3.5"
19941
+ currentVersion: "1.3.7"
19694
19942
  };
19695
19943
  }
19696
19944
  }