@versini/ui-debug-overlay 2.1.0 → 2.2.0
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 +16 -27
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-debug-overlay v2.
|
|
2
|
+
@versini/ui-debug-overlay v2.2.0
|
|
3
3
|
© 2025 gizmette.com
|
|
4
4
|
*/
|
|
5
|
-
try {
|
|
6
|
-
if (!window.__VERSINI_UI_DEBUG_OVERLAY__) {
|
|
7
|
-
window.__VERSINI_UI_DEBUG_OVERLAY__ = {
|
|
8
|
-
version: "2.1.0",
|
|
9
|
-
buildTime: "11/04/2025 03:45 PM EST",
|
|
10
|
-
homepage: "https://github.com/aversini/ui-components",
|
|
11
|
-
license: "MIT",
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
} catch (error) {
|
|
15
|
-
// nothing to declare officer
|
|
16
|
-
}
|
|
17
5
|
|
|
18
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
7
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
@@ -61,10 +49,10 @@ function pushDebugSnapshot(input) {
|
|
|
61
49
|
] : undefined
|
|
62
50
|
};
|
|
63
51
|
manualBuffer.push(snap);
|
|
64
|
-
if (manualBuffer.length > MANUAL_BUFFER_LIMIT) {
|
|
52
|
+
/* v8 ignore start - buffer overflow edge case */ if (manualBuffer.length > MANUAL_BUFFER_LIMIT) {
|
|
65
53
|
manualBuffer.shift();
|
|
66
54
|
}
|
|
67
|
-
manualSubscribers.forEach((cb)=>cb(snap));
|
|
55
|
+
/* v8 ignore stop */ manualSubscribers.forEach((cb)=>cb(snap));
|
|
68
56
|
}
|
|
69
57
|
/**
|
|
70
58
|
* React hook returning a function to push a manual snapshot into all (or
|
|
@@ -112,17 +100,17 @@ function pushDebugSnapshot(input) {
|
|
|
112
100
|
*/ function safeStringify(value, space = 2) {
|
|
113
101
|
const seen = new WeakSet();
|
|
114
102
|
const sortKeys = (val)=>{
|
|
115
|
-
if (!val || typeof val !== "object" || val instanceof Date || val instanceof RegExp) {
|
|
103
|
+
/* v8 ignore start - edge cases for special object types */ if (!val || typeof val !== "object" || val instanceof Date || val instanceof RegExp) {
|
|
116
104
|
return val;
|
|
117
105
|
}
|
|
118
106
|
if (seen.has(val)) {
|
|
119
107
|
return "[Circular]";
|
|
120
108
|
}
|
|
121
|
-
seen.add(val);
|
|
122
|
-
if (Array.isArray(val)) {
|
|
109
|
+
/* v8 ignore stop */ seen.add(val);
|
|
110
|
+
/* v8 ignore start - array handling edge case */ if (Array.isArray(val)) {
|
|
123
111
|
return val.map(sortKeys);
|
|
124
112
|
}
|
|
125
|
-
const out = {};
|
|
113
|
+
/* v8 ignore stop */ const out = {};
|
|
126
114
|
for (const k of Object.keys(val).sort()){
|
|
127
115
|
out[k] = sortKeys(val[k]);
|
|
128
116
|
}
|
|
@@ -130,20 +118,20 @@ function pushDebugSnapshot(input) {
|
|
|
130
118
|
};
|
|
131
119
|
try {
|
|
132
120
|
return JSON.stringify(sortKeys(value), null, space);
|
|
133
|
-
} catch (err) {
|
|
121
|
+
/* v8 ignore start - error handling for unserializable values */ } catch (err) {
|
|
134
122
|
return `<<unserializable: ${err.message}>>`;
|
|
135
123
|
}
|
|
136
|
-
}
|
|
124
|
+
/* v8 ignore stop */ }
|
|
137
125
|
const DebugOverlay = ({ appState, title = "AppState", initialCollapsed = false, overlayId = "default", position, maxBodyHeight = "50svh", indent = 2, maxSnapshots = 50, maxVisibleSnapshots = 10, snapshotOrder = "desc", appendSnapshotCountInTitle = false })=>{
|
|
138
126
|
const [collapsed, setCollapsed] = useState(initialCollapsed);
|
|
139
127
|
const [copied, setCopied] = useState(false);
|
|
140
128
|
const containerRef = useRef(null);
|
|
141
129
|
const [snapshots, setSnapshots] = useState([]);
|
|
142
|
-
const [manualSnaps, setManualSnaps] = useState(()=>// Apply same targeting filter to initial buffered snapshots as we do for
|
|
130
|
+
/* 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
131
|
// live subscription events so targeted snapshots don't leak to unrelated
|
|
144
132
|
// overlays.
|
|
145
133
|
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.
|
|
134
|
+
/* v8 ignore stop */ // Serialize state only if provided; overlay can operate in manual-only mode.
|
|
147
135
|
const json = useMemo(()=>appState !== undefined ? safeStringify(appState, indent) : null, [
|
|
148
136
|
appState,
|
|
149
137
|
indent
|
|
@@ -303,7 +291,7 @@ const DebugOverlay = ({ appState, title = "AppState", initialCollapsed = false,
|
|
|
303
291
|
};
|
|
304
292
|
}
|
|
305
293
|
}
|
|
306
|
-
// Shallow copy to avoid mutating caller object.
|
|
294
|
+
/* v8 ignore start - custom position object handling */ // Shallow copy to avoid mutating caller object.
|
|
307
295
|
const obj = {};
|
|
308
296
|
for (const k of [
|
|
309
297
|
"top",
|
|
@@ -317,7 +305,7 @@ const DebugOverlay = ({ appState, title = "AppState", initialCollapsed = false,
|
|
|
317
305
|
}
|
|
318
306
|
}
|
|
319
307
|
return obj;
|
|
320
|
-
}, [
|
|
308
|
+
/* v8 ignore stop */ }, [
|
|
321
309
|
position
|
|
322
310
|
]);
|
|
323
311
|
/**
|
|
@@ -339,7 +327,7 @@ const DebugOverlay = ({ appState, title = "AppState", initialCollapsed = false,
|
|
|
339
327
|
}, [
|
|
340
328
|
normalizedEdges
|
|
341
329
|
]);
|
|
342
|
-
// Keep overlay inside visual viewport when software keyboard shifts layout.
|
|
330
|
+
/* v8 ignore start - visualViewport browser-specific API for mobile keyboard handling */ // Keep overlay inside visual viewport when software keyboard shifts layout.
|
|
343
331
|
useEffect(()=>{
|
|
344
332
|
const vv = typeof window !== "undefined" ? window.visualViewport : null;
|
|
345
333
|
if (!vv) {
|
|
@@ -369,7 +357,7 @@ const DebugOverlay = ({ appState, title = "AppState", initialCollapsed = false,
|
|
|
369
357
|
}, [
|
|
370
358
|
finalEdges
|
|
371
359
|
]);
|
|
372
|
-
const snapshotCount = unifiedAsc.length;
|
|
360
|
+
/* v8 ignore stop */ const snapshotCount = unifiedAsc.length;
|
|
373
361
|
const headerTitle = appendSnapshotCountInTitle ? `${title} (${snapshotCount})` : title;
|
|
374
362
|
// Base style for all snapshots; manual ones get color variants.
|
|
375
363
|
const statePreStyle = {
|
|
@@ -545,6 +533,7 @@ const buttonStyle = {
|
|
|
545
533
|
};
|
|
546
534
|
|
|
547
535
|
;// CONCATENATED MODULE: ./src/components/index.ts
|
|
536
|
+
// force new release
|
|
548
537
|
|
|
549
538
|
|
|
550
539
|
export { DebugOverlay, LOG_BLUE, LOG_GREEN, LOG_MAGENTA, LOG_RED, LOG_YELLOW, __resetDebugOverlayTestState, useDebugOverlay };
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-debug-overlay",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
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": "b2ee2e328ecadfbedcb26d14afa896a30f0ab54b"
|
|
43
43
|
}
|