@buoy-gg/debug-borders 3.0.1 → 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.
- package/lib/commonjs/debug-borders/components/DebugBordersStandaloneOverlay.js +25 -10
- package/lib/commonjs/index.js +9 -1
- package/lib/commonjs/sync/debugBordersSyncAdapter.js +34 -0
- package/lib/module/debug-borders/components/DebugBordersStandaloneOverlay.js +25 -10
- package/lib/module/index.js +3 -0
- package/lib/module/sync/debugBordersSyncAdapter.js +30 -0
- package/lib/typescript/debug-borders/components/DebugBordersStandaloneOverlay.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/sync/debugBordersSyncAdapter.d.ts +22 -0
- package/lib/typescript/sync/debugBordersSyncAdapter.d.ts.map +1 -0
- package/package.json +5 -5
|
@@ -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);
|
package/lib/commonjs/index.js
CHANGED
|
@@ -5,7 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
debugBordersToolPreset: true,
|
|
8
|
-
createDebugBordersTool: true
|
|
8
|
+
createDebugBordersTool: true,
|
|
9
|
+
debugBordersSyncAdapter: true
|
|
9
10
|
};
|
|
10
11
|
Object.defineProperty(exports, "createDebugBordersTool", {
|
|
11
12
|
enumerable: true,
|
|
@@ -13,6 +14,12 @@ Object.defineProperty(exports, "createDebugBordersTool", {
|
|
|
13
14
|
return _preset.createDebugBordersTool;
|
|
14
15
|
}
|
|
15
16
|
});
|
|
17
|
+
Object.defineProperty(exports, "debugBordersSyncAdapter", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () {
|
|
20
|
+
return _debugBordersSyncAdapter.debugBordersSyncAdapter;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
16
23
|
Object.defineProperty(exports, "debugBordersToolPreset", {
|
|
17
24
|
enumerable: true,
|
|
18
25
|
get: function () {
|
|
@@ -20,6 +27,7 @@ Object.defineProperty(exports, "debugBordersToolPreset", {
|
|
|
20
27
|
}
|
|
21
28
|
});
|
|
22
29
|
var _preset = require("./preset");
|
|
30
|
+
var _debugBordersSyncAdapter = require("./sync/debugBordersSyncAdapter");
|
|
23
31
|
var _debugBorders = require("./debug-borders");
|
|
24
32
|
Object.keys(_debugBorders).forEach(function (key) {
|
|
25
33
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.debugBordersSyncAdapter = void 0;
|
|
7
|
+
// CJS module (matches how preset.tsx loads it)
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
9
|
+
const DebugBordersManager = require("../debug-borders/utils/DebugBordersManager");
|
|
10
|
+
/**
|
|
11
|
+
* Sync adapter for the debug-borders tool, consumed by @buoy-gg/external-sync's
|
|
12
|
+
* `useExternalSync` (structurally matches its ToolSyncAdapter interface so
|
|
13
|
+
* this package doesn't need a dependency on it).
|
|
14
|
+
*
|
|
15
|
+
* Debug borders draw on the DEVICE's UI — there is nothing to mirror on a
|
|
16
|
+
* dashboard. This adapter is a remote control: the dashboard reads the
|
|
17
|
+
* current mode from snapshots and drives it via actions.
|
|
18
|
+
*/
|
|
19
|
+
const debugBordersSyncAdapter = exports.debugBordersSyncAdapter = {
|
|
20
|
+
version: 1,
|
|
21
|
+
getSnapshot: () => ({
|
|
22
|
+
mode: DebugBordersManager.getMode()
|
|
23
|
+
}),
|
|
24
|
+
subscribe: onChange => DebugBordersManager.subscribe(onChange),
|
|
25
|
+
actions: {
|
|
26
|
+
/** off → borders → labels → off (labels is Pro-gated on device) */
|
|
27
|
+
cycleMode: () => {
|
|
28
|
+
DebugBordersManager.cycle();
|
|
29
|
+
},
|
|
30
|
+
setMode: params => {
|
|
31
|
+
DebugBordersManager.setMode(params.mode);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
@@ -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);
|
package/lib/module/index.js
CHANGED
|
@@ -3,5 +3,8 @@
|
|
|
3
3
|
// Export preset configuration (easiest way to add to FloatingDevTools!)
|
|
4
4
|
export { debugBordersToolPreset, createDebugBordersTool } from "./preset";
|
|
5
5
|
|
|
6
|
+
// External sync (adapter for @buoy-gg/external-sync's useExternalSync)
|
|
7
|
+
export { debugBordersSyncAdapter } from "./sync/debugBordersSyncAdapter";
|
|
8
|
+
|
|
6
9
|
// Export all debug-borders utilities and components
|
|
7
10
|
export * from "./debug-borders";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// CJS module (matches how preset.tsx loads it)
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
5
|
+
const DebugBordersManager = require("../debug-borders/utils/DebugBordersManager");
|
|
6
|
+
/**
|
|
7
|
+
* Sync adapter for the debug-borders tool, consumed by @buoy-gg/external-sync's
|
|
8
|
+
* `useExternalSync` (structurally matches its ToolSyncAdapter interface so
|
|
9
|
+
* this package doesn't need a dependency on it).
|
|
10
|
+
*
|
|
11
|
+
* Debug borders draw on the DEVICE's UI — there is nothing to mirror on a
|
|
12
|
+
* dashboard. This adapter is a remote control: the dashboard reads the
|
|
13
|
+
* current mode from snapshots and drives it via actions.
|
|
14
|
+
*/
|
|
15
|
+
export const debugBordersSyncAdapter = {
|
|
16
|
+
version: 1,
|
|
17
|
+
getSnapshot: () => ({
|
|
18
|
+
mode: DebugBordersManager.getMode()
|
|
19
|
+
}),
|
|
20
|
+
subscribe: onChange => DebugBordersManager.subscribe(onChange),
|
|
21
|
+
actions: {
|
|
22
|
+
/** off → borders → labels → off (labels is Pro-gated on device) */
|
|
23
|
+
cycleMode: () => {
|
|
24
|
+
DebugBordersManager.cycle();
|
|
25
|
+
},
|
|
26
|
+
setMode: params => {
|
|
27
|
+
DebugBordersManager.setMode(params.mode);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
@@ -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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAG1E,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAG1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sync adapter for the debug-borders tool, consumed by @buoy-gg/external-sync's
|
|
3
|
+
* `useExternalSync` (structurally matches its ToolSyncAdapter interface so
|
|
4
|
+
* this package doesn't need a dependency on it).
|
|
5
|
+
*
|
|
6
|
+
* Debug borders draw on the DEVICE's UI — there is nothing to mirror on a
|
|
7
|
+
* dashboard. This adapter is a remote control: the dashboard reads the
|
|
8
|
+
* current mode from snapshots and drives it via actions.
|
|
9
|
+
*/
|
|
10
|
+
export declare const debugBordersSyncAdapter: {
|
|
11
|
+
version: number;
|
|
12
|
+
getSnapshot: () => {
|
|
13
|
+
mode: any;
|
|
14
|
+
};
|
|
15
|
+
subscribe: (onChange: () => void) => () => void;
|
|
16
|
+
actions: {
|
|
17
|
+
/** off → borders → labels → off (labels is Pro-gated on device) */
|
|
18
|
+
cycleMode: () => void;
|
|
19
|
+
setMode: (params: unknown) => void;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=debugBordersSyncAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debugBordersSyncAdapter.d.ts","sourceRoot":"","sources":["../../../src/sync/debugBordersSyncAdapter.ts"],"names":[],"mappings":"AAQA;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB;;;;;0BAGZ,MAAM,IAAI,KACa,MAAM,IAAI;;QAErD,mEAAmE;;0BAIjD,OAAO;;CAI5B,CAAC"}
|
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",
|