@buoy-gg/debug-borders 3.0.2 → 4.0.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.
|
@@ -53,14 +53,27 @@ const {
|
|
|
53
53
|
resolveOverlappingLabels
|
|
54
54
|
} = require("../utils/labelPositioning");
|
|
55
55
|
|
|
56
|
-
// Import DevToolsVisibility context to detect when DevTools are open
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
// Import DevToolsVisibility context to detect when DevTools are open.
|
|
57
|
+
//
|
|
58
|
+
// Resolved lazily (on first render) instead of at module load to avoid a
|
|
59
|
+
// require cycle: @buoy-gg/core -> FloatingDevTools -> autoExternalSync ->
|
|
60
|
+
// @buoy-gg/debug-borders -> preset -> this file -> @buoy-gg/core.
|
|
61
|
+
// Deferring the require breaks the cycle while keeping the optional dependency.
|
|
62
|
+
|
|
63
|
+
let useDevToolsVisibility;
|
|
64
|
+
function resolveUseDevToolsVisibility() {
|
|
65
|
+
if (useDevToolsVisibility !== undefined) {
|
|
66
|
+
return useDevToolsVisibility;
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
// Optional import - will gracefully fail if not available
|
|
70
|
+
const coreModule = require("@buoy-gg/core");
|
|
71
|
+
useDevToolsVisibility = coreModule.useDevToolsVisibility ?? null;
|
|
72
|
+
} catch (e) {
|
|
73
|
+
// DevToolsVisibility not available, that's ok - borders will always work
|
|
74
|
+
useDevToolsVisibility = null;
|
|
75
|
+
}
|
|
76
|
+
return useDevToolsVisibility ?? null;
|
|
64
77
|
}
|
|
65
78
|
// Row component for displaying info
|
|
66
79
|
function InfoRow({
|
|
@@ -216,8 +229,10 @@ function DebugBordersStandaloneOverlay() {
|
|
|
216
229
|
const [modalVisible, setModalVisible] = (0, _react.useState)(false);
|
|
217
230
|
const measuringRef = _react.default.useRef(false); // Prevent overlapping measurements
|
|
218
231
|
|
|
219
|
-
// Check if any DevTools are open (if context is available)
|
|
220
|
-
|
|
232
|
+
// Check if any DevTools are open (if context is available).
|
|
233
|
+
// The hook reference is resolved lazily but is stable for the app's lifetime,
|
|
234
|
+
// so calling it conditionally here is safe across renders.
|
|
235
|
+
const isDevToolsActive = resolveUseDevToolsVisibility()?.()?.isDevToolsActive ?? false;
|
|
221
236
|
const handleLabelPress = (0, _react.useCallback)(rect => {
|
|
222
237
|
setSelectedRect(rect);
|
|
223
238
|
setModalVisible(true);
|
|
@@ -49,14 +49,27 @@ const {
|
|
|
49
49
|
resolveOverlappingLabels
|
|
50
50
|
} = require("../utils/labelPositioning");
|
|
51
51
|
|
|
52
|
-
// Import DevToolsVisibility context to detect when DevTools are open
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
// Import DevToolsVisibility context to detect when DevTools are open.
|
|
53
|
+
//
|
|
54
|
+
// Resolved lazily (on first render) instead of at module load to avoid a
|
|
55
|
+
// require cycle: @buoy-gg/core -> FloatingDevTools -> autoExternalSync ->
|
|
56
|
+
// @buoy-gg/debug-borders -> preset -> this file -> @buoy-gg/core.
|
|
57
|
+
// Deferring the require breaks the cycle while keeping the optional dependency.
|
|
58
|
+
|
|
59
|
+
let useDevToolsVisibility;
|
|
60
|
+
function resolveUseDevToolsVisibility() {
|
|
61
|
+
if (useDevToolsVisibility !== undefined) {
|
|
62
|
+
return useDevToolsVisibility;
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
// Optional import - will gracefully fail if not available
|
|
66
|
+
const coreModule = require("@buoy-gg/core");
|
|
67
|
+
useDevToolsVisibility = coreModule.useDevToolsVisibility ?? null;
|
|
68
|
+
} catch (e) {
|
|
69
|
+
// DevToolsVisibility not available, that's ok - borders will always work
|
|
70
|
+
useDevToolsVisibility = null;
|
|
71
|
+
}
|
|
72
|
+
return useDevToolsVisibility ?? null;
|
|
60
73
|
}
|
|
61
74
|
// Row component for displaying info
|
|
62
75
|
function InfoRow({
|
|
@@ -212,8 +225,10 @@ export function DebugBordersStandaloneOverlay() {
|
|
|
212
225
|
const [modalVisible, setModalVisible] = useState(false);
|
|
213
226
|
const measuringRef = React.useRef(false); // Prevent overlapping measurements
|
|
214
227
|
|
|
215
|
-
// Check if any DevTools are open (if context is available)
|
|
216
|
-
|
|
228
|
+
// Check if any DevTools are open (if context is available).
|
|
229
|
+
// The hook reference is resolved lazily but is stable for the app's lifetime,
|
|
230
|
+
// so calling it conditionally here is safe across renders.
|
|
231
|
+
const isDevToolsActive = resolveUseDevToolsVisibility()?.()?.isDevToolsActive ?? false;
|
|
217
232
|
const handleLabelPress = useCallback(rect => {
|
|
218
233
|
setSelectedRect(rect);
|
|
219
234
|
setModalVisible(true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DebugBordersStandaloneOverlay.d.ts","sourceRoot":"","sources":["../../../../src/debug-borders/components/DebugBordersStandaloneOverlay.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAA2C,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DebugBordersStandaloneOverlay.d.ts","sourceRoot":"","sources":["../../../../src/debug-borders/components/DebugBordersStandaloneOverlay.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAA2C,MAAM,OAAO,CAAC;AAiNhE,wBAAgB,6BAA6B,6BAsL5C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/debug-borders",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "debug-borders package",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
],
|
|
27
27
|
"sideEffects": false,
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@buoy-gg/core": "
|
|
30
|
-
"@buoy-gg/shared-ui": "
|
|
29
|
+
"@buoy-gg/core": "4.0.1",
|
|
30
|
+
"@buoy-gg/shared-ui": "4.0.1"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": "*",
|
|
34
34
|
"react-native": "*",
|
|
35
|
-
"@buoy-gg/license": "
|
|
35
|
+
"@buoy-gg/license": "4.0.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/react": "^19.1.0",
|
|
39
39
|
"@types/react-native": "^0.73.0",
|
|
40
40
|
"typescript": "~5.8.3",
|
|
41
|
-
"@buoy-gg/license": "
|
|
41
|
+
"@buoy-gg/license": "4.0.1"
|
|
42
42
|
},
|
|
43
43
|
"react-native-builder-bob": {
|
|
44
44
|
"source": "src",
|