@leeguoo/pwtk-network-debugger 1.3.3 → 1.3.5
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/{button-Dt1KsQb6.mjs → button-B5OqHDUm.mjs} +20 -1
- package/dist/button-Bcbh--qO.js +1 -0
- package/dist/container-BZUC7qSB.js +1 -0
- package/dist/{container-Cy51KA7q.mjs → container-qvHOCG_V.mjs} +344 -2
- package/dist/index.cjs.js +4 -4
- package/dist/index.esm.js +140 -19
- package/dist/index.js +4 -4
- package/package.json +1 -1
- package/types/ui/panel.d.ts.map +1 -1
- package/types/webgl/core/scene.d.ts +13 -0
- package/types/webgl/core/scene.d.ts.map +1 -1
- package/types/webgl/manager.d.ts +2 -1
- package/types/webgl/manager.d.ts.map +1 -1
- package/dist/button-CbMfuNRL.js +0 -1
- package/dist/container-D_U0MRYG.js +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -17423,10 +17423,19 @@ class LiquidGlassScene {
|
|
|
17423
17423
|
this.mutationObserver = null;
|
|
17424
17424
|
this.snapshotCanvas = null;
|
|
17425
17425
|
this.snapshotScale = 1;
|
|
17426
|
+
this.maxSnapshotPixels = 3e6;
|
|
17427
|
+
this.minSnapshotScale = 0.35;
|
|
17428
|
+
this.minSnapshotInterval = 1500;
|
|
17429
|
+
this.lastSnapshotCapture = -Infinity;
|
|
17426
17430
|
this.capturePromise = null;
|
|
17427
17431
|
this.snapshotNeedsUpdate = true;
|
|
17428
17432
|
this.refreshTimeout = null;
|
|
17429
17433
|
this.destroyed = false;
|
|
17434
|
+
this.interactionActive = false;
|
|
17435
|
+
this.manualInteractionActive = false;
|
|
17436
|
+
this.transientInteractionCount = 0;
|
|
17437
|
+
this.transientInteractionTimers = [];
|
|
17438
|
+
this.pendingBackgroundRefresh = false;
|
|
17430
17439
|
this.sceneStats = {
|
|
17431
17440
|
averageFps: 60,
|
|
17432
17441
|
lowestFps: 60,
|
|
@@ -17446,6 +17455,7 @@ class LiquidGlassScene {
|
|
|
17446
17455
|
this.markSnapshotDirty = () => {
|
|
17447
17456
|
if (this.destroyed) return;
|
|
17448
17457
|
this.snapshotNeedsUpdate = true;
|
|
17458
|
+
this.beginTransientInteraction();
|
|
17449
17459
|
this.scheduleBackgroundRefresh();
|
|
17450
17460
|
};
|
|
17451
17461
|
this.handleDOMChange = () => {
|
|
@@ -17601,7 +17611,7 @@ class LiquidGlassScene {
|
|
|
17601
17611
|
this.layers.set(id, layer);
|
|
17602
17612
|
renderer.setUniformProvider(() => this.getDynamicUniforms(layer));
|
|
17603
17613
|
this.applyPlaceholderBackground(layer);
|
|
17604
|
-
this.refreshLayerBackground(layer).catch((err) => {
|
|
17614
|
+
this.refreshLayerBackground(layer, true).catch((err) => {
|
|
17605
17615
|
});
|
|
17606
17616
|
return layer;
|
|
17607
17617
|
}
|
|
@@ -17708,6 +17718,7 @@ class LiquidGlassScene {
|
|
|
17708
17718
|
layer.borderRadius = this.getBorderRadius(layer.element);
|
|
17709
17719
|
this.applyPlaceholderBackground(layer);
|
|
17710
17720
|
});
|
|
17721
|
+
this.beginTransientInteraction(600);
|
|
17711
17722
|
this.scheduleBackgroundRefresh();
|
|
17712
17723
|
}
|
|
17713
17724
|
updateBackgrounds(forceSnapshot = false) {
|
|
@@ -17772,6 +17783,11 @@ class LiquidGlassScene {
|
|
|
17772
17783
|
}
|
|
17773
17784
|
this.idleCallbackId = null;
|
|
17774
17785
|
}
|
|
17786
|
+
this.transientInteractionTimers.forEach((id) => window.clearTimeout(id));
|
|
17787
|
+
this.transientInteractionTimers = [];
|
|
17788
|
+
this.transientInteractionCount = 0;
|
|
17789
|
+
this.manualInteractionActive = false;
|
|
17790
|
+
this.interactionActive = false;
|
|
17775
17791
|
window.removeEventListener("scroll", this.markSnapshotDirty);
|
|
17776
17792
|
window.removeEventListener("resize", this.markSnapshotDirty);
|
|
17777
17793
|
document.removeEventListener("visibilitychange", this.handleVisibilityChange);
|
|
@@ -17809,6 +17825,42 @@ class LiquidGlassScene {
|
|
|
17809
17825
|
enableAutoQuality(enabled) {
|
|
17810
17826
|
this.autoQualityEnabled = enabled;
|
|
17811
17827
|
}
|
|
17828
|
+
setInteractionState(active) {
|
|
17829
|
+
if (this.destroyed) return;
|
|
17830
|
+
if (active) {
|
|
17831
|
+
if (this.manualInteractionActive) return;
|
|
17832
|
+
this.manualInteractionActive = true;
|
|
17833
|
+
} else {
|
|
17834
|
+
if (!this.manualInteractionActive) return;
|
|
17835
|
+
this.manualInteractionActive = false;
|
|
17836
|
+
}
|
|
17837
|
+
this.updateInteractionState();
|
|
17838
|
+
}
|
|
17839
|
+
beginTransientInteraction(duration2 = 400) {
|
|
17840
|
+
if (this.destroyed) return;
|
|
17841
|
+
this.transientInteractionCount++;
|
|
17842
|
+
this.updateInteractionState();
|
|
17843
|
+
const timerId = window.setTimeout(() => {
|
|
17844
|
+
this.transientInteractionTimers = this.transientInteractionTimers.filter((id) => id !== timerId);
|
|
17845
|
+
if (this.destroyed) return;
|
|
17846
|
+
this.transientInteractionCount = Math.max(0, this.transientInteractionCount - 1);
|
|
17847
|
+
this.updateInteractionState();
|
|
17848
|
+
}, duration2);
|
|
17849
|
+
this.transientInteractionTimers.push(timerId);
|
|
17850
|
+
}
|
|
17851
|
+
updateInteractionState() {
|
|
17852
|
+
const wasActive = this.interactionActive;
|
|
17853
|
+
this.interactionActive = this.manualInteractionActive || this.transientInteractionCount > 0;
|
|
17854
|
+
if (this.interactionActive && !wasActive) {
|
|
17855
|
+
if (this.pendingBackgroundRefresh || this.snapshotNeedsUpdate) {
|
|
17856
|
+
this.updateBackgrounds();
|
|
17857
|
+
}
|
|
17858
|
+
} else if (!this.interactionActive && wasActive) {
|
|
17859
|
+
if (this.pendingBackgroundRefresh || this.snapshotNeedsUpdate) {
|
|
17860
|
+
this.scheduleBackgroundRefresh(true);
|
|
17861
|
+
}
|
|
17862
|
+
}
|
|
17863
|
+
}
|
|
17812
17864
|
applyPlaceholderBackground(layer) {
|
|
17813
17865
|
const rect = layer.element.getBoundingClientRect();
|
|
17814
17866
|
const width = Math.max(1, Math.round(rect.width || layer.canvas.clientWidth || 1));
|
|
@@ -17852,13 +17904,63 @@ class LiquidGlassScene {
|
|
|
17852
17904
|
}
|
|
17853
17905
|
async refreshLayerBackground(layer, forceSnapshot = false) {
|
|
17854
17906
|
const startTime = performance.now();
|
|
17907
|
+
if (!forceSnapshot && !this.interactionActive) {
|
|
17908
|
+
this.pendingBackgroundRefresh = true;
|
|
17909
|
+
return;
|
|
17910
|
+
}
|
|
17855
17911
|
await this.ensurePageSnapshot(forceSnapshot);
|
|
17856
17912
|
if (!this.snapshotCanvas) return;
|
|
17857
17913
|
layer.renderer.setBackgroundTexture(this.snapshotCanvas);
|
|
17914
|
+
this.pendingBackgroundRefresh = false;
|
|
17858
17915
|
const refreshTime = performance.now() - startTime;
|
|
17859
17916
|
this.sceneStats.backgroundRefreshCount++;
|
|
17860
17917
|
this.sceneStats.backgroundRefreshTime = refreshTime;
|
|
17861
17918
|
}
|
|
17919
|
+
calculateSnapshotScale() {
|
|
17920
|
+
if (typeof document === "undefined" || typeof window === "undefined") {
|
|
17921
|
+
return 1;
|
|
17922
|
+
}
|
|
17923
|
+
const doc = document.documentElement;
|
|
17924
|
+
const body = document.body;
|
|
17925
|
+
const width = Math.max(
|
|
17926
|
+
doc?.scrollWidth ?? 0,
|
|
17927
|
+
body?.scrollWidth ?? 0,
|
|
17928
|
+
window.innerWidth || 0
|
|
17929
|
+
);
|
|
17930
|
+
const height = Math.max(
|
|
17931
|
+
doc?.scrollHeight ?? 0,
|
|
17932
|
+
body?.scrollHeight ?? 0,
|
|
17933
|
+
window.innerHeight || 0
|
|
17934
|
+
);
|
|
17935
|
+
if (width <= 0 || height <= 0) {
|
|
17936
|
+
return 1;
|
|
17937
|
+
}
|
|
17938
|
+
const area = width * height;
|
|
17939
|
+
let scale = area > this.maxSnapshotPixels ? Math.sqrt(this.maxSnapshotPixels / area) : 1;
|
|
17940
|
+
if (!Number.isFinite(scale) || scale <= 0) {
|
|
17941
|
+
scale = 1;
|
|
17942
|
+
}
|
|
17943
|
+
switch (this.performanceMode) {
|
|
17944
|
+
case "low":
|
|
17945
|
+
scale = Math.min(scale, 0.55);
|
|
17946
|
+
break;
|
|
17947
|
+
case "balanced":
|
|
17948
|
+
scale = Math.min(scale, 0.75);
|
|
17949
|
+
break;
|
|
17950
|
+
case "high":
|
|
17951
|
+
scale = Math.min(1, scale * 1.15);
|
|
17952
|
+
break;
|
|
17953
|
+
default:
|
|
17954
|
+
if (this.sceneStats.lowestFps < 45) {
|
|
17955
|
+
scale = Math.min(scale, 0.7);
|
|
17956
|
+
}
|
|
17957
|
+
break;
|
|
17958
|
+
}
|
|
17959
|
+
if (this.layers.size > 1) {
|
|
17960
|
+
scale = Math.min(scale, 0.8);
|
|
17961
|
+
}
|
|
17962
|
+
return Math.max(this.minSnapshotScale, Math.min(1, scale));
|
|
17963
|
+
}
|
|
17862
17964
|
async ensurePageSnapshot(force = false) {
|
|
17863
17965
|
if (this.destroyed) return;
|
|
17864
17966
|
if (this.snapshotCanvas && !this.snapshotNeedsUpdate && !force) return;
|
|
@@ -17866,35 +17968,46 @@ class LiquidGlassScene {
|
|
|
17866
17968
|
await this.capturePromise;
|
|
17867
17969
|
return;
|
|
17868
17970
|
}
|
|
17869
|
-
|
|
17971
|
+
if (!force) {
|
|
17972
|
+
const elapsed = performance.now() - this.lastSnapshotCapture;
|
|
17973
|
+
if (elapsed < this.minSnapshotInterval) {
|
|
17974
|
+
await new Promise((resolve) => window.setTimeout(resolve, this.minSnapshotInterval - elapsed));
|
|
17975
|
+
}
|
|
17976
|
+
}
|
|
17977
|
+
const scale = this.calculateSnapshotScale();
|
|
17870
17978
|
this.capturePromise = html2canvas(document.body, {
|
|
17871
17979
|
scale,
|
|
17872
17980
|
backgroundColor: null,
|
|
17873
17981
|
useCORS: true,
|
|
17874
17982
|
windowWidth: document.documentElement.scrollWidth,
|
|
17875
17983
|
windowHeight: document.documentElement.scrollHeight,
|
|
17984
|
+
logging: false,
|
|
17876
17985
|
ignoreElements: (element) => this.container.contains(element)
|
|
17877
17986
|
}).then((canvas) => {
|
|
17878
17987
|
this.snapshotCanvas = canvas;
|
|
17879
17988
|
this.snapshotScale = scale;
|
|
17880
17989
|
this.snapshotNeedsUpdate = false;
|
|
17990
|
+
this.lastSnapshotCapture = performance.now();
|
|
17881
17991
|
}).catch((error) => {
|
|
17882
17992
|
this.snapshotCanvas = null;
|
|
17993
|
+
this.lastSnapshotCapture = performance.now();
|
|
17994
|
+
this.pendingBackgroundRefresh = true;
|
|
17883
17995
|
}).finally(() => {
|
|
17884
17996
|
this.capturePromise = null;
|
|
17885
17997
|
});
|
|
17886
17998
|
await this.capturePromise;
|
|
17887
17999
|
}
|
|
17888
|
-
scheduleBackgroundRefresh() {
|
|
18000
|
+
scheduleBackgroundRefresh(force = false) {
|
|
17889
18001
|
if (this.refreshTimeout !== null) {
|
|
17890
18002
|
clearTimeout(this.refreshTimeout);
|
|
17891
18003
|
}
|
|
18004
|
+
const delay = force ? 16 : 150;
|
|
17892
18005
|
this.refreshTimeout = window.setTimeout(() => {
|
|
17893
18006
|
this.refreshTimeout = null;
|
|
17894
18007
|
if (!this.destroyed) {
|
|
17895
|
-
this.updateBackgrounds();
|
|
18008
|
+
this.updateBackgrounds(force);
|
|
17896
18009
|
}
|
|
17897
|
-
},
|
|
18010
|
+
}, delay);
|
|
17898
18011
|
}
|
|
17899
18012
|
scheduleBackgroundRefreshIdle() {
|
|
17900
18013
|
if (this.idleCallbackId !== null) {
|
|
@@ -18133,9 +18246,14 @@ const _WebGLManager = class _WebGLManager {
|
|
|
18133
18246
|
this.scene.setPreset(this.config.preset);
|
|
18134
18247
|
}
|
|
18135
18248
|
}
|
|
18136
|
-
updateBackgrounds() {
|
|
18249
|
+
updateBackgrounds(forceSnapshot = false) {
|
|
18250
|
+
if (this.scene) {
|
|
18251
|
+
this.scene.updateBackgrounds(forceSnapshot);
|
|
18252
|
+
}
|
|
18253
|
+
}
|
|
18254
|
+
setInteractionState(active) {
|
|
18137
18255
|
if (this.scene) {
|
|
18138
|
-
this.scene.
|
|
18256
|
+
this.scene.setInteractionState(active);
|
|
18139
18257
|
}
|
|
18140
18258
|
}
|
|
18141
18259
|
isWebGLEnabled() {
|
|
@@ -18256,7 +18374,7 @@ const _DebugPanel = class _DebugPanel {
|
|
|
18256
18374
|
this.container.style.pointerEvents = "auto";
|
|
18257
18375
|
this.container.innerHTML = `
|
|
18258
18376
|
<div class="debugger-header">
|
|
18259
|
-
<div class="debugger-title">🔓 PWTK 解密小工具 <span style="font-size: 10px; opacity: 0.7;">by Leo v${"1.3.
|
|
18377
|
+
<div class="debugger-title">🔓 PWTK 解密小工具 <span style="font-size: 10px; opacity: 0.7;">by Leo v${"1.3.5"}</span></div>
|
|
18260
18378
|
<div class="debugger-controls">
|
|
18261
18379
|
<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>
|
|
18262
18380
|
<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>
|
|
@@ -18724,7 +18842,7 @@ Created by Leo (@leeguoo)`);
|
|
|
18724
18842
|
this.container.style.right = "auto";
|
|
18725
18843
|
this.container.style.bottom = "auto";
|
|
18726
18844
|
}
|
|
18727
|
-
this.scheduleWebGLBackgroundUpdate();
|
|
18845
|
+
this.scheduleWebGLBackgroundUpdate(true);
|
|
18728
18846
|
}
|
|
18729
18847
|
// 移除 handleToolAction 方法 - 不再需要工具功能
|
|
18730
18848
|
// 移除 handleParseCurl 方法
|
|
@@ -18733,12 +18851,14 @@ Created by Leo (@leeguoo)`);
|
|
|
18733
18851
|
this.isDragging = true;
|
|
18734
18852
|
this.dragStart = { x: e2.clientX, y: e2.clientY };
|
|
18735
18853
|
this.container.style.transition = "none";
|
|
18854
|
+
this.webglManager?.setInteractionState(true);
|
|
18736
18855
|
}
|
|
18737
18856
|
startResize(e2, direction2) {
|
|
18738
18857
|
this.isResizing = true;
|
|
18739
18858
|
this.resizeDirection = direction2;
|
|
18740
18859
|
this.dragStart = { x: e2.clientX, y: e2.clientY };
|
|
18741
18860
|
this.container.style.transition = "none";
|
|
18861
|
+
this.webglManager?.setInteractionState(true);
|
|
18742
18862
|
}
|
|
18743
18863
|
handleMouseMove(e2) {
|
|
18744
18864
|
if (this.isDragging) {
|
|
@@ -18796,11 +18916,12 @@ Created by Leo (@leeguoo)`);
|
|
|
18796
18916
|
if (this.isDragging) {
|
|
18797
18917
|
this.savePosition();
|
|
18798
18918
|
}
|
|
18799
|
-
this.scheduleWebGLBackgroundUpdate();
|
|
18919
|
+
this.scheduleWebGLBackgroundUpdate(true);
|
|
18800
18920
|
}
|
|
18801
18921
|
this.isDragging = false;
|
|
18802
18922
|
this.isResizing = false;
|
|
18803
18923
|
this.resizeDirection = "";
|
|
18924
|
+
this.webglManager?.setInteractionState(false);
|
|
18804
18925
|
}
|
|
18805
18926
|
handleWindowResize() {
|
|
18806
18927
|
if (this.resizeTimeout) {
|
|
@@ -18855,7 +18976,7 @@ Created by Leo (@leeguoo)`);
|
|
|
18855
18976
|
this.container.style.height = `${newHeight}px`;
|
|
18856
18977
|
}
|
|
18857
18978
|
this.savePosition();
|
|
18858
|
-
this.scheduleWebGLBackgroundUpdate();
|
|
18979
|
+
this.scheduleWebGLBackgroundUpdate(true);
|
|
18859
18980
|
}
|
|
18860
18981
|
}
|
|
18861
18982
|
show() {
|
|
@@ -19304,7 +19425,7 @@ Created by Leo (@leeguoo)`);
|
|
|
19304
19425
|
setTimeout(() => {
|
|
19305
19426
|
this.enableWebGLForRequestItems();
|
|
19306
19427
|
}, 500);
|
|
19307
|
-
this.scheduleWebGLBackgroundUpdate();
|
|
19428
|
+
this.scheduleWebGLBackgroundUpdate(true);
|
|
19308
19429
|
logger.debug("✨ WebGL liquid glass effects initialized");
|
|
19309
19430
|
} else {
|
|
19310
19431
|
logger.debug("🔄 WebGL initialization failed, using CSS fallback");
|
|
@@ -19327,15 +19448,15 @@ Created by Leo (@leeguoo)`);
|
|
|
19327
19448
|
}
|
|
19328
19449
|
});
|
|
19329
19450
|
}
|
|
19330
|
-
scheduleWebGLBackgroundUpdate() {
|
|
19451
|
+
scheduleWebGLBackgroundUpdate(force = false) {
|
|
19331
19452
|
if (!this.webglManager) return;
|
|
19332
19453
|
if (this.webglBackgroundUpdateTimer !== null) {
|
|
19333
19454
|
window.clearTimeout(this.webglBackgroundUpdateTimer);
|
|
19334
19455
|
}
|
|
19335
|
-
const delay = this.isDragging || this.isResizing ? 120 : 0;
|
|
19456
|
+
const delay = this.isDragging || this.isResizing ? 120 : force ? 30 : 0;
|
|
19336
19457
|
this.webglBackgroundUpdateTimer = window.setTimeout(() => {
|
|
19337
19458
|
this.webglBackgroundUpdateTimer = null;
|
|
19338
|
-
this.webglManager?.updateBackgrounds();
|
|
19459
|
+
this.webglManager?.updateBackgrounds(force);
|
|
19339
19460
|
}, delay);
|
|
19340
19461
|
}
|
|
19341
19462
|
/**
|
|
@@ -19408,8 +19529,8 @@ if (typeof window !== "undefined") {
|
|
|
19408
19529
|
}
|
|
19409
19530
|
function loadLiquidGlass() {
|
|
19410
19531
|
return new Promise((resolve) => {
|
|
19411
|
-
import("./container-
|
|
19412
|
-
return import("./button-
|
|
19532
|
+
import("./container-qvHOCG_V.mjs").then(() => {
|
|
19533
|
+
return import("./button-B5OqHDUm.mjs");
|
|
19413
19534
|
}).then(() => {
|
|
19414
19535
|
resolve();
|
|
19415
19536
|
}).catch((error) => {
|
|
@@ -19549,7 +19670,7 @@ const _NetworkDebugger = class _NetworkDebugger {
|
|
|
19549
19670
|
}
|
|
19550
19671
|
async checkForUpdates() {
|
|
19551
19672
|
try {
|
|
19552
|
-
const currentVersion = "1.3.
|
|
19673
|
+
const currentVersion = "1.3.5";
|
|
19553
19674
|
logger.info(`[PWTK Update] Checking for updates... Current version: ${currentVersion}`);
|
|
19554
19675
|
const response = await fetch("https://registry.npmjs.org/@leeguoo/pwtk-network-debugger/latest");
|
|
19555
19676
|
const data = await response.json();
|
|
@@ -19569,7 +19690,7 @@ const _NetworkDebugger = class _NetworkDebugger {
|
|
|
19569
19690
|
logger.error("[PWTK Update] Failed to check for updates:", error);
|
|
19570
19691
|
return {
|
|
19571
19692
|
hasUpdate: false,
|
|
19572
|
-
currentVersion: "1.3.
|
|
19693
|
+
currentVersion: "1.3.5"
|
|
19573
19694
|
};
|
|
19574
19695
|
}
|
|
19575
19696
|
}
|