@buoy-gg/debug-borders 6.0.0 → 7.0.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/README.md +29 -306
- package/package.json +19 -8
package/README.md
CHANGED
|
@@ -1,334 +1,57 @@
|
|
|
1
|
-
# @buoy/debug-borders
|
|
1
|
+
# @buoy-gg/debug-borders
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@buoy-gg/debug-borders) [](https://www.npmjs.com/package/@buoy-gg/debug-borders)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**See your React Native layout instead of guessing at it — depth-colored borders over every component, and tap any label to inspect its testID, styles, and exact position on-device.**
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
- **Smart Filtering**: Only shows borders/labels for components with `testID` or `accessibilityLabel`
|
|
9
|
-
- **Tap-to-Inspect**: Tap any label to see detailed component information in a modal
|
|
10
|
-
- **Color-Coded Labels**: Labels match border colors based on identifier type (testID = green, accessibilityLabel = pink)
|
|
11
|
-
- **Label Stacking**: Overlapping labels automatically stack upward like a menu
|
|
12
|
-
- **Hidden Screen Detection**: Automatically hides borders on inactive screens in stack navigators
|
|
13
|
-
- **DevTools Aware**: Hides borders when DevTools modals are open
|
|
14
|
-
- **Real-Time Updates**: Automatically tracks layout changes (updates every 2 seconds)
|
|
15
|
-
- **Touch-Through**: Borders don't interfere with touch interactions
|
|
16
|
-
- **Performance Optimized**: Minimal impact (~30ms to measure 400+ components)
|
|
7
|
+
Part of [Buoy](https://github.com/Buoy-gg/buoy) — devtools that live inside your React Native app. Install it and it auto-appears in the floating menu from [`@buoy-gg/core`](https://www.npmjs.com/package/@buoy-gg/core).
|
|
17
8
|
|
|
18
|
-
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
## Install
|
|
19
12
|
|
|
20
13
|
```bash
|
|
21
|
-
npm install @buoy/debug-borders
|
|
22
|
-
# or
|
|
23
|
-
pnpm add @buoy/debug-borders
|
|
24
|
-
# or
|
|
25
|
-
yarn add @buoy/debug-borders
|
|
14
|
+
npm install @buoy-gg/core @buoy-gg/debug-borders
|
|
26
15
|
```
|
|
27
16
|
|
|
28
|
-
## Quick
|
|
17
|
+
## Quick start
|
|
29
18
|
|
|
30
19
|
```tsx
|
|
31
|
-
import {
|
|
32
|
-
import { FloatingDevTools } from '@buoy/core';
|
|
33
|
-
|
|
34
|
-
const installedApps = [
|
|
35
|
-
debugBordersToolPreset, // Add the tool to your menu
|
|
36
|
-
// ...your other tools
|
|
37
|
-
];
|
|
20
|
+
import { FloatingDevTools } from "@buoy-gg/core";
|
|
38
21
|
|
|
39
|
-
function App() {
|
|
22
|
+
export default function App() {
|
|
40
23
|
return (
|
|
41
24
|
<>
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
environment="local"
|
|
45
|
-
userRole="admin"
|
|
46
|
-
/>
|
|
47
|
-
|
|
48
|
-
{/* IMPORTANT: Render overlay at root level */}
|
|
49
|
-
<DebugBordersStandaloneOverlay />
|
|
50
|
-
|
|
51
|
-
{/* Your app content */}
|
|
52
|
-
<YourAppContent />
|
|
25
|
+
<YourApp />
|
|
26
|
+
<FloatingDevTools />
|
|
53
27
|
</>
|
|
54
28
|
);
|
|
55
29
|
}
|
|
56
30
|
```
|
|
57
31
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
## Display Modes
|
|
61
|
-
|
|
62
|
-
The tool cycles through three modes when you tap the icon:
|
|
63
|
-
|
|
64
|
-
| Mode | Icon Color | Description |
|
|
65
|
-
|------|------------|-------------|
|
|
66
|
-
| **Off** | Gray | No borders displayed |
|
|
67
|
-
| **Borders** | Green | Rainbow-colored borders for all components (depth-based colors) |
|
|
68
|
-
| **Labels** | Cyan | Borders + labels only for components with `testID` or `accessibilityLabel` |
|
|
69
|
-
|
|
70
|
-
### Labels Mode Features
|
|
71
|
-
|
|
72
|
-
In Labels mode, the tool provides focused debugging:
|
|
73
|
-
|
|
74
|
-
- **Only shows components with identifiers** - Components with `testID` or `accessibilityLabel` get borders and labels
|
|
75
|
-
- **Color-coded by identifier type**:
|
|
76
|
-
- 🟢 Green = `testID`
|
|
77
|
-
- 🩷 Pink = `accessibilityLabel`
|
|
78
|
-
- **Labels positioned above boxes** - Easy to read without obscuring content
|
|
79
|
-
- **Automatic stacking** - Overlapping labels stack upward like a menu
|
|
80
|
-
- **Tap to inspect** - Tap any label to see full component details
|
|
81
|
-
|
|
82
|
-
## Tap-to-Inspect Modal
|
|
83
|
-
|
|
84
|
-
Tap any label in Labels mode to open a detailed inspection modal showing:
|
|
85
|
-
|
|
86
|
-
### Identifiers
|
|
87
|
-
- `testID` (green)
|
|
88
|
-
- `accessibilityLabel` (pink)
|
|
89
|
-
- `nativeID` (amber)
|
|
90
|
-
- `key`
|
|
91
|
-
|
|
92
|
-
### Component Info
|
|
93
|
-
- Component Name (the React component that rendered this)
|
|
94
|
-
- Parent Component
|
|
95
|
-
- Display Name (friendly name like "View", "Text")
|
|
96
|
-
- Native View Type (e.g., "RCTView", "RCTText")
|
|
97
|
-
- Fiber Tag
|
|
98
|
-
|
|
99
|
-
### Position & Size
|
|
100
|
-
- X, Y coordinates
|
|
101
|
-
- Width, Height
|
|
102
|
-
- Depth in component tree
|
|
103
|
-
|
|
104
|
-
### Accessibility
|
|
105
|
-
- Role
|
|
106
|
-
- Hint
|
|
107
|
-
- State (displayed with interactive DataViewer)
|
|
108
|
-
|
|
109
|
-
### Styles
|
|
110
|
-
- Full computed styles (displayed with interactive DataViewer)
|
|
111
|
-
|
|
112
|
-
## Usage Examples
|
|
113
|
-
|
|
114
|
-
### Basic Usage with Preset
|
|
115
|
-
|
|
116
|
-
```tsx
|
|
117
|
-
import { debugBordersToolPreset, DebugBordersStandaloneOverlay } from '@buoy/debug-borders';
|
|
118
|
-
|
|
119
|
-
// Add to your FloatingDevTools apps array
|
|
120
|
-
const installedApps = [debugBordersToolPreset];
|
|
121
|
-
|
|
122
|
-
// Render overlay at root level
|
|
123
|
-
<DebugBordersStandaloneOverlay />
|
|
124
|
-
|
|
125
|
-
// Tap the BORDERS icon to cycle: Off → Borders → Labels → Off
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### Custom Configuration
|
|
129
|
-
|
|
130
|
-
```tsx
|
|
131
|
-
import { createDebugBordersTool, DebugBordersStandaloneOverlay } from '@buoy/debug-borders';
|
|
132
|
-
|
|
133
|
-
const customBordersTool = createDebugBordersTool({
|
|
134
|
-
name: "LAYOUT",
|
|
135
|
-
description: "Layout visualizer",
|
|
136
|
-
offColor: "#9ca3af", // Gray when off
|
|
137
|
-
bordersColor: "#ec4899", // Pink in borders mode
|
|
138
|
-
labelsColor: "#8b5cf6", // Purple in labels mode
|
|
139
|
-
id: "custom-borders",
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
const installedApps = [customBordersTool];
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### Programmatic Control
|
|
146
|
-
|
|
147
|
-
```tsx
|
|
148
|
-
import { DebugBordersManager, DebugBordersStandaloneOverlay } from '@buoy/debug-borders';
|
|
149
|
-
|
|
150
|
-
// Get current mode
|
|
151
|
-
const mode = DebugBordersManager.getMode(); // "off" | "borders" | "labels"
|
|
152
|
-
|
|
153
|
-
// Set specific mode
|
|
154
|
-
DebugBordersManager.setMode("borders");
|
|
155
|
-
DebugBordersManager.setMode("labels");
|
|
156
|
-
DebugBordersManager.setMode("off");
|
|
157
|
-
|
|
158
|
-
// Cycle to next mode
|
|
159
|
-
DebugBordersManager.cycle(); // off → borders → labels → off
|
|
160
|
-
|
|
161
|
-
// Check if labels should be shown
|
|
162
|
-
const showLabels = DebugBordersManager.showLabels(); // true when mode is "labels"
|
|
163
|
-
|
|
164
|
-
// Subscribe to mode changes
|
|
165
|
-
const unsubscribe = DebugBordersManager.subscribe((mode) => {
|
|
166
|
-
console.log('Mode changed to:', mode);
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
// Clean up
|
|
170
|
-
unsubscribe();
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
## API Reference
|
|
174
|
-
|
|
175
|
-
### Preset
|
|
176
|
-
|
|
177
|
-
#### `debugBordersToolPreset`
|
|
178
|
-
|
|
179
|
-
Pre-configured tool for FloatingDevTools. Shows only in the floating menu (not the dial).
|
|
180
|
-
|
|
181
|
-
```tsx
|
|
182
|
-
import { debugBordersToolPreset } from '@buoy/debug-borders';
|
|
183
|
-
|
|
184
|
-
const installedApps = [debugBordersToolPreset];
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
### Functions
|
|
188
|
-
|
|
189
|
-
#### `createDebugBordersTool(options?)`
|
|
190
|
-
|
|
191
|
-
Create a custom debug borders tool configuration.
|
|
192
|
-
|
|
193
|
-
**Options:**
|
|
194
|
-
- `name?: string` - Tool name (default: "BORDERS")
|
|
195
|
-
- `description?: string` - Tool description
|
|
196
|
-
- `offColor?: string` - Icon color when off (default: "#6b7280" gray)
|
|
197
|
-
- `bordersColor?: string` - Icon color in borders mode (default: "#10b981" green)
|
|
198
|
-
- `labelsColor?: string` - Icon color in labels mode (default: "#06b6d4" cyan)
|
|
199
|
-
- `id?: string` - Custom tool ID (default: "debug-borders")
|
|
200
|
-
|
|
201
|
-
### Components
|
|
202
|
-
|
|
203
|
-
#### `<DebugBordersStandaloneOverlay />`
|
|
204
|
-
|
|
205
|
-
The main overlay component that renders borders and labels. **Must be rendered at root level.**
|
|
206
|
-
|
|
207
|
-
```tsx
|
|
208
|
-
import { DebugBordersStandaloneOverlay } from '@buoy/debug-borders';
|
|
209
|
-
|
|
210
|
-
<DebugBordersStandaloneOverlay />
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
**Note:** This component must be rendered at the root level of your app, outside all modals and navigation containers, for borders to appear on top of everything.
|
|
214
|
-
|
|
215
|
-
### Manager API
|
|
216
|
-
|
|
217
|
-
#### `DebugBordersManager`
|
|
32
|
+
Tap the BORDERS icon in the floating menu to cycle Off → Borders → Labels.
|
|
218
33
|
|
|
219
|
-
|
|
34
|
+
Want your own naming or colors? Build the tool with `createDebugBordersTool({ name: "LAYOUT", bordersColor: "#ec4899", ... })` and pass it to `FloatingDevTools` via the `apps` array.
|
|
220
35
|
|
|
221
|
-
|
|
222
|
-
- `getMode(): "off" | "borders" | "labels"` - Get current display mode
|
|
223
|
-
- `setMode(mode)` - Set display mode
|
|
224
|
-
- `cycle()` - Cycle to next mode (off → borders → labels → off)
|
|
225
|
-
- `showLabels(): boolean` - Check if labels should be shown (mode === "labels")
|
|
226
|
-
- `subscribe(callback: (mode) => void): () => void` - Subscribe to mode changes
|
|
36
|
+
## What you get
|
|
227
37
|
|
|
228
|
-
|
|
38
|
+
- **Depth-colored borders** — rainbow borders on every component, colored by depth in the tree, fully touch-through so they never block interaction.
|
|
39
|
+
- **Labels mode** — filters down to components with a `testID` or `accessibilityLabel`: green = testID, pink = accessibilityLabel. Labels sit above their boxes and stack automatically when they overlap.
|
|
40
|
+
- **Tap to inspect** — tap any label for the component's `testID`, `accessibilityLabel`, `nativeID`, key, accessibility props, full computed styles, and exact position and size.
|
|
41
|
+
- **Answers real questions on-device** — "what testID does QA need for this button?" or "which component owns this padding?" without leaving the phone.
|
|
42
|
+
- **Stays out of the way** — borders auto-hide on inactive screens in stack navigators and whenever a DevTools modal is open, and they track layout changes automatically.
|
|
43
|
+
- **Works everywhere** — Expo and React Native CLI, Fabric (New Architecture) and Paper.
|
|
229
44
|
|
|
230
|
-
|
|
45
|
+
## Desktop & AI
|
|
231
46
|
|
|
232
|
-
The
|
|
47
|
+
The same live session streams to [Buoy Desktop](https://github.com/Buoy-gg/Buoy-Desktop) (free, macOS/Windows/Linux) and to Claude Code or Cursor via the [Buoy MCP server](https://buoy.gg/buoy/latest/docs/mcp).
|
|
233
48
|
|
|
234
|
-
|
|
235
|
-
2. **SVG Filtering** - Excludes SVG elements (RNSVG* components)
|
|
236
|
-
3. **DevTools Filtering** - Excludes FloatingDevTools, modals, and other dev tool components
|
|
237
|
-
4. **Identifier Filtering** (Labels mode) - Only shows components with `testID` or `accessibilityLabel`
|
|
49
|
+
## Free vs Pro
|
|
238
50
|
|
|
239
|
-
|
|
51
|
+
Every tool is free. [Pro](https://buoy.gg/pricing) unlocks production builds, the MCP server, and unlimited capture. Every weekend, Pro features unlock free for everyone.
|
|
240
52
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
```
|
|
244
|
-
┌─────────────────────────────────────┐
|
|
245
|
-
│ [submitButton] │ ← Labels stack upward
|
|
246
|
-
│ [formContainer] │
|
|
247
|
-
├─────────────────────────────────────┤
|
|
248
|
-
│ │
|
|
249
|
-
│ Component Content │
|
|
250
|
-
│ │
|
|
251
|
-
└─────────────────────────────────────┘
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
### Color Scheme
|
|
255
|
-
|
|
256
|
-
**Borders Mode** - Colors based on nesting depth using golden angle (137.5°):
|
|
257
|
-
| Depth | Color |
|
|
258
|
-
|-------|-------|
|
|
259
|
-
| 0 | Red-Orange |
|
|
260
|
-
| 1 | Green |
|
|
261
|
-
| 2 | Blue |
|
|
262
|
-
| 3+ | Continues with golden angle |
|
|
263
|
-
|
|
264
|
-
**Labels Mode** - Colors based on identifier type:
|
|
265
|
-
| Identifier | Color |
|
|
266
|
-
|------------|-------|
|
|
267
|
-
| testID | Green (#10b981) |
|
|
268
|
-
| accessibilityLabel | Pink (#ec4899) |
|
|
269
|
-
| componentName | Purple (#a855f7) |
|
|
270
|
-
| nativeID | Amber (#f59e0b) |
|
|
271
|
-
| viewType (fallback) | Gray (#6b7280) |
|
|
272
|
-
|
|
273
|
-
## Performance
|
|
274
|
-
|
|
275
|
-
- **Measurement Time:** ~30ms for 400+ components
|
|
276
|
-
- **Update Frequency:** Every 2 seconds when enabled
|
|
277
|
-
- **Memory Impact:** Minimal (only stores rectangle data)
|
|
278
|
-
- **Runtime Impact:** Zero when disabled
|
|
279
|
-
- **Label Positioning:** O(n²) worst case, optimized with early exits
|
|
280
|
-
|
|
281
|
-
## Compatibility
|
|
282
|
-
|
|
283
|
-
- React Native >= 0.70.0
|
|
284
|
-
- Fabric (New Architecture)
|
|
285
|
-
- Paper (Legacy Architecture)
|
|
286
|
-
- Expo
|
|
287
|
-
- React Native CLI
|
|
288
|
-
|
|
289
|
-
## Troubleshooting
|
|
290
|
-
|
|
291
|
-
### Borders not showing?
|
|
292
|
-
|
|
293
|
-
1. Make sure `DebugBordersStandaloneOverlay` is rendered at root level
|
|
294
|
-
2. Tap the icon to cycle modes - you may be in "off" mode
|
|
295
|
-
3. In Labels mode, borders only show for components with `testID` or `accessibilityLabel`
|
|
296
|
-
4. Verify you're in development mode (`__DEV__` is true)
|
|
297
|
-
|
|
298
|
-
### Labels overlapping content?
|
|
299
|
-
|
|
300
|
-
Labels are positioned above component boxes. If they still overlap, they automatically stack upward. Very dense UIs may have many stacked labels.
|
|
301
|
-
|
|
302
|
-
### Can't tap labels?
|
|
303
|
-
|
|
304
|
-
Make sure you're in Labels mode (cyan icon). In Borders mode, labels aren't shown and tapping doesn't work.
|
|
305
|
-
|
|
306
|
-
### Modal not scrolling?
|
|
307
|
-
|
|
308
|
-
The inspection modal uses the standard JsModal component. Swipe up to expand it or drag the handle to resize.
|
|
309
|
-
|
|
310
|
-
## Structure
|
|
311
|
-
|
|
312
|
-
```
|
|
313
|
-
debug-borders/
|
|
314
|
-
├── src/
|
|
315
|
-
│ ├── index.tsx # Main exports
|
|
316
|
-
│ ├── preset.tsx # Preset configuration
|
|
317
|
-
│ └── debug-borders/
|
|
318
|
-
│ ├── components/
|
|
319
|
-
│ │ └── DebugBordersStandaloneOverlay.tsx
|
|
320
|
-
│ └── utils/
|
|
321
|
-
│ ├── DebugBordersManager.js # State manager (3 modes)
|
|
322
|
-
│ ├── fiberTreeTraversal.js # Fiber traversal + filtering
|
|
323
|
-
│ ├── componentMeasurement.js # Component measurements
|
|
324
|
-
│ ├── componentInfo.js # Label extraction
|
|
325
|
-
│ ├── labelPositioning.js # Overlap resolution
|
|
326
|
-
│ ├── ViewTypeMapper.ts # Native → friendly names
|
|
327
|
-
│ └── colorGeneration.js # Color generation
|
|
328
|
-
├── package.json
|
|
329
|
-
└── README.md
|
|
330
|
-
```
|
|
53
|
+
---
|
|
331
54
|
|
|
332
|
-
|
|
55
|
+
📚 [Full docs](https://buoy.gg/buoy/latest/docs/tools/debug-borders) · [All Buoy tools](https://github.com/Buoy-gg/buoy)
|
|
333
56
|
|
|
334
|
-
|
|
57
|
+
Proprietary software. © Buoy LLC. [Terms](https://buoy.gg/terms)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/debug-borders",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
|
+
"description": "Layout debugging borders for React Native — depth-colored, touch-through, tap any label to inspect testIDs & styles. Part of Buoy devtools.",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
7
7
|
"types": "lib/typescript/index.d.ts",
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
],
|
|
27
27
|
"sideEffects": false,
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@buoy-gg/
|
|
30
|
-
"@buoy-gg/
|
|
29
|
+
"@buoy-gg/core": "7.0.0",
|
|
30
|
+
"@buoy-gg/shared-ui": "7.0.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": "*",
|
|
34
34
|
"react-native": "*",
|
|
35
|
-
"@buoy-gg/license": "
|
|
35
|
+
"@buoy-gg/license": "7.0.0"
|
|
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": "7.0.0"
|
|
42
42
|
},
|
|
43
43
|
"react-native-builder-bob": {
|
|
44
44
|
"source": "src",
|
|
@@ -61,17 +61,28 @@
|
|
|
61
61
|
},
|
|
62
62
|
"repository": {
|
|
63
63
|
"type": "git",
|
|
64
|
-
"url": "https://github.com/
|
|
64
|
+
"url": "https://github.com/Buoy-gg/buoy.git",
|
|
65
65
|
"directory": "packages/debug-borders"
|
|
66
66
|
},
|
|
67
67
|
"bugs": {
|
|
68
68
|
"url": "https://github.com/LovesWorking/react-native-buoy/issues"
|
|
69
69
|
},
|
|
70
|
-
"homepage": "https://
|
|
70
|
+
"homepage": "https://buoy.gg",
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public",
|
|
73
73
|
"tag": "latest"
|
|
74
74
|
},
|
|
75
|
+
"keywords": [
|
|
76
|
+
"react-native",
|
|
77
|
+
"expo",
|
|
78
|
+
"devtools",
|
|
79
|
+
"debugging",
|
|
80
|
+
"react-native-devtools",
|
|
81
|
+
"flipper-alternative",
|
|
82
|
+
"layout-debugging",
|
|
83
|
+
"borders",
|
|
84
|
+
"ui-debugging"
|
|
85
|
+
],
|
|
75
86
|
"scripts": {
|
|
76
87
|
"build": "bob build",
|
|
77
88
|
"typecheck": "tsc --noEmit",
|