@versini/ui-debug-overlay 2.1.0 → 2.1.1
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.js +18 -18
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-debug-overlay v2.1.
|
|
2
|
+
@versini/ui-debug-overlay v2.1.1
|
|
3
3
|
© 2025 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
try {
|
|
6
6
|
if (!window.__VERSINI_UI_DEBUG_OVERLAY__) {
|
|
7
7
|
window.__VERSINI_UI_DEBUG_OVERLAY__ = {
|
|
8
|
-
version: "2.1.
|
|
9
|
-
buildTime: "
|
|
10
|
-
homepage: "https://
|
|
8
|
+
version: "2.1.1",
|
|
9
|
+
buildTime: "12/24/2025 09:21 AM EST",
|
|
10
|
+
homepage: "https://www.npmjs.com/package/@versini/ui-debug-overlay",
|
|
11
11
|
license: "MIT",
|
|
12
12
|
};
|
|
13
13
|
}
|
|
@@ -61,10 +61,10 @@ function pushDebugSnapshot(input) {
|
|
|
61
61
|
] : undefined
|
|
62
62
|
};
|
|
63
63
|
manualBuffer.push(snap);
|
|
64
|
-
if (manualBuffer.length > MANUAL_BUFFER_LIMIT) {
|
|
64
|
+
/* v8 ignore start - buffer overflow edge case */ if (manualBuffer.length > MANUAL_BUFFER_LIMIT) {
|
|
65
65
|
manualBuffer.shift();
|
|
66
66
|
}
|
|
67
|
-
manualSubscribers.forEach((cb)=>cb(snap));
|
|
67
|
+
/* v8 ignore stop */ manualSubscribers.forEach((cb)=>cb(snap));
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
70
|
* React hook returning a function to push a manual snapshot into all (or
|
|
@@ -112,17 +112,17 @@ function pushDebugSnapshot(input) {
|
|
|
112
112
|
*/ function safeStringify(value, space = 2) {
|
|
113
113
|
const seen = new WeakSet();
|
|
114
114
|
const sortKeys = (val)=>{
|
|
115
|
-
if (!val || typeof val !== "object" || val instanceof Date || val instanceof RegExp) {
|
|
115
|
+
/* v8 ignore start - edge cases for special object types */ if (!val || typeof val !== "object" || val instanceof Date || val instanceof RegExp) {
|
|
116
116
|
return val;
|
|
117
117
|
}
|
|
118
118
|
if (seen.has(val)) {
|
|
119
119
|
return "[Circular]";
|
|
120
120
|
}
|
|
121
|
-
seen.add(val);
|
|
122
|
-
if (Array.isArray(val)) {
|
|
121
|
+
/* v8 ignore stop */ seen.add(val);
|
|
122
|
+
/* v8 ignore start - array handling edge case */ if (Array.isArray(val)) {
|
|
123
123
|
return val.map(sortKeys);
|
|
124
124
|
}
|
|
125
|
-
const out = {};
|
|
125
|
+
/* v8 ignore stop */ const out = {};
|
|
126
126
|
for (const k of Object.keys(val).sort()){
|
|
127
127
|
out[k] = sortKeys(val[k]);
|
|
128
128
|
}
|
|
@@ -130,20 +130,20 @@ function pushDebugSnapshot(input) {
|
|
|
130
130
|
};
|
|
131
131
|
try {
|
|
132
132
|
return JSON.stringify(sortKeys(value), null, space);
|
|
133
|
-
} catch (err) {
|
|
133
|
+
/* v8 ignore start - error handling for unserializable values */ } catch (err) {
|
|
134
134
|
return `<<unserializable: ${err.message}>>`;
|
|
135
135
|
}
|
|
136
|
-
}
|
|
136
|
+
/* v8 ignore stop */ }
|
|
137
137
|
const DebugOverlay = ({ appState, title = "AppState", initialCollapsed = false, overlayId = "default", position, maxBodyHeight = "50svh", indent = 2, maxSnapshots = 50, maxVisibleSnapshots = 10, snapshotOrder = "desc", appendSnapshotCountInTitle = false })=>{
|
|
138
138
|
const [collapsed, setCollapsed] = useState(initialCollapsed);
|
|
139
139
|
const [copied, setCopied] = useState(false);
|
|
140
140
|
const containerRef = useRef(null);
|
|
141
141
|
const [snapshots, setSnapshots] = useState([]);
|
|
142
|
-
const [manualSnaps, setManualSnaps] = useState(()=>// Apply same targeting filter to initial buffered snapshots as we do for
|
|
142
|
+
/* v8 ignore start - initial buffer filter edge case */ const [manualSnaps, setManualSnaps] = useState(()=>// Apply same targeting filter to initial buffered snapshots as we do for
|
|
143
143
|
// live subscription events so targeted snapshots don't leak to unrelated
|
|
144
144
|
// overlays.
|
|
145
145
|
manualBuffer.filter((m)=>!m.targetOverlays || m.targetOverlays.length === 0 || m.targetOverlays.includes(overlayId)));
|
|
146
|
-
// Serialize state only if provided; overlay can operate in manual-only mode.
|
|
146
|
+
/* v8 ignore stop */ // Serialize state only if provided; overlay can operate in manual-only mode.
|
|
147
147
|
const json = useMemo(()=>appState !== undefined ? safeStringify(appState, indent) : null, [
|
|
148
148
|
appState,
|
|
149
149
|
indent
|
|
@@ -303,7 +303,7 @@ const DebugOverlay = ({ appState, title = "AppState", initialCollapsed = false,
|
|
|
303
303
|
};
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
|
-
// Shallow copy to avoid mutating caller object.
|
|
306
|
+
/* v8 ignore start - custom position object handling */ // Shallow copy to avoid mutating caller object.
|
|
307
307
|
const obj = {};
|
|
308
308
|
for (const k of [
|
|
309
309
|
"top",
|
|
@@ -317,7 +317,7 @@ const DebugOverlay = ({ appState, title = "AppState", initialCollapsed = false,
|
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
return obj;
|
|
320
|
-
}, [
|
|
320
|
+
/* v8 ignore stop */ }, [
|
|
321
321
|
position
|
|
322
322
|
]);
|
|
323
323
|
/**
|
|
@@ -339,7 +339,7 @@ const DebugOverlay = ({ appState, title = "AppState", initialCollapsed = false,
|
|
|
339
339
|
}, [
|
|
340
340
|
normalizedEdges
|
|
341
341
|
]);
|
|
342
|
-
// Keep overlay inside visual viewport when software keyboard shifts layout.
|
|
342
|
+
/* v8 ignore start - visualViewport browser-specific API for mobile keyboard handling */ // Keep overlay inside visual viewport when software keyboard shifts layout.
|
|
343
343
|
useEffect(()=>{
|
|
344
344
|
const vv = typeof window !== "undefined" ? window.visualViewport : null;
|
|
345
345
|
if (!vv) {
|
|
@@ -369,7 +369,7 @@ const DebugOverlay = ({ appState, title = "AppState", initialCollapsed = false,
|
|
|
369
369
|
}, [
|
|
370
370
|
finalEdges
|
|
371
371
|
]);
|
|
372
|
-
const snapshotCount = unifiedAsc.length;
|
|
372
|
+
/* v8 ignore stop */ const snapshotCount = unifiedAsc.length;
|
|
373
373
|
const headerTitle = appendSnapshotCountInTitle ? `${title} (${snapshotCount})` : title;
|
|
374
374
|
// Base style for all snapshots; manual ones get color variants.
|
|
375
375
|
const statePreStyle = {
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-debug-overlay",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
|
-
"homepage": "https://
|
|
9
|
+
"homepage": "https://www.npmjs.com/package/@versini/ui-debug-overlay",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "git@github.com:aversini/ui-components.git"
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@testing-library/jest-dom": "6.9.1"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "7b2640a0650a4c3aa6ca078888f765cb400f9f13"
|
|
43
43
|
}
|