@buoy-gg/core 1.7.7 β 1.7.8
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/floatingMenu/AppHost.js +1 -1
- package/lib/commonjs/floatingMenu/DevToolsSettingsModal.js +20 -8
- package/lib/commonjs/floatingMenu/DevToolsSettingsModal.web.js +746 -0
- package/lib/commonjs/floatingMenu/FloatingDevTools.js +16 -4
- package/lib/commonjs/floatingMenu/FloatingDevTools.web.js +154 -0
- package/lib/commonjs/floatingMenu/FloatingMenu.js +4 -4
- package/lib/commonjs/floatingMenu/autoDiscoverPresets.js +15 -0
- package/lib/commonjs/floatingMenu/defaultConfig.js +14 -7
- package/lib/commonjs/floatingMenu/dial/DialDevTools.js +8 -2
- package/lib/commonjs/floatingMenu/dial/DialDevTools.web.js +593 -0
- package/lib/commonjs/floatingMenu/floatingTools.web.js +357 -0
- package/lib/commonjs/index.js +2 -2
- package/lib/commonjs/index.web.js +131 -0
- package/lib/commonjs/utils/autoDiscoverPresets.web.js +181 -0
- package/lib/module/floatingMenu/AppHost.js +1 -1
- package/lib/module/floatingMenu/DevToolsSettingsModal.js +21 -9
- package/lib/module/floatingMenu/DevToolsSettingsModal.web.js +756 -0
- package/lib/module/floatingMenu/FloatingDevTools.js +17 -5
- package/lib/module/floatingMenu/FloatingDevTools.web.js +150 -0
- package/lib/module/floatingMenu/FloatingMenu.js +4 -4
- package/lib/module/floatingMenu/autoDiscoverPresets.js +15 -0
- package/lib/module/floatingMenu/defaultConfig.js +14 -7
- package/lib/module/floatingMenu/dial/DialDevTools.js +8 -2
- package/lib/module/floatingMenu/dial/DialDevTools.web.js +590 -0
- package/lib/module/floatingMenu/floatingTools.web.js +357 -0
- package/lib/module/index.js +2 -2
- package/lib/module/index.web.js +24 -0
- package/lib/module/utils/autoDiscoverPresets.web.js +174 -0
- package/lib/typescript/commonjs/floatingMenu/DevToolsSettingsModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/floatingMenu/DevToolsSettingsModal.web.d.ts +23 -0
- package/lib/typescript/commonjs/floatingMenu/DevToolsSettingsModal.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/floatingMenu/FloatingDevTools.d.ts +1 -1
- package/lib/typescript/commonjs/floatingMenu/FloatingDevTools.d.ts.map +1 -1
- package/lib/typescript/commonjs/floatingMenu/FloatingDevTools.web.d.ts +48 -0
- package/lib/typescript/commonjs/floatingMenu/FloatingDevTools.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/floatingMenu/autoDiscoverPresets.d.ts.map +1 -1
- package/lib/typescript/commonjs/floatingMenu/defaultConfig.d.ts +8 -7
- package/lib/typescript/commonjs/floatingMenu/defaultConfig.d.ts.map +1 -1
- package/lib/typescript/commonjs/floatingMenu/dial/DialDevTools.d.ts.map +1 -1
- package/lib/typescript/commonjs/floatingMenu/dial/DialDevTools.web.d.ts +26 -0
- package/lib/typescript/commonjs/floatingMenu/dial/DialDevTools.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/floatingMenu/floatingTools.web.d.ts +27 -0
- package/lib/typescript/commonjs/floatingMenu/floatingTools.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.web.d.ts +20 -0
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/autoDiscoverPresets.web.d.ts +58 -0
- package/lib/typescript/commonjs/utils/autoDiscoverPresets.web.d.ts.map +1 -0
- package/lib/typescript/module/floatingMenu/DevToolsSettingsModal.d.ts.map +1 -1
- package/lib/typescript/module/floatingMenu/DevToolsSettingsModal.web.d.ts +23 -0
- package/lib/typescript/module/floatingMenu/DevToolsSettingsModal.web.d.ts.map +1 -0
- package/lib/typescript/module/floatingMenu/FloatingDevTools.d.ts +1 -1
- package/lib/typescript/module/floatingMenu/FloatingDevTools.d.ts.map +1 -1
- package/lib/typescript/module/floatingMenu/FloatingDevTools.web.d.ts +48 -0
- package/lib/typescript/module/floatingMenu/FloatingDevTools.web.d.ts.map +1 -0
- package/lib/typescript/module/floatingMenu/autoDiscoverPresets.d.ts.map +1 -1
- package/lib/typescript/module/floatingMenu/defaultConfig.d.ts +8 -7
- package/lib/typescript/module/floatingMenu/defaultConfig.d.ts.map +1 -1
- package/lib/typescript/module/floatingMenu/dial/DialDevTools.d.ts.map +1 -1
- package/lib/typescript/module/floatingMenu/dial/DialDevTools.web.d.ts +26 -0
- package/lib/typescript/module/floatingMenu/dial/DialDevTools.web.d.ts.map +1 -0
- package/lib/typescript/module/floatingMenu/floatingTools.web.d.ts +27 -0
- package/lib/typescript/module/floatingMenu/floatingTools.web.d.ts.map +1 -0
- package/lib/typescript/module/index.web.d.ts +20 -0
- package/lib/typescript/module/index.web.d.ts.map +1 -0
- package/lib/typescript/module/utils/autoDiscoverPresets.web.d.ts +58 -0
- package/lib/typescript/module/utils/autoDiscoverPresets.web.d.ts.map +1 -0
- package/package.json +5 -4
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Divider = Divider;
|
|
7
|
+
exports.FloatingTools = FloatingTools;
|
|
8
|
+
exports.UserStatus = UserStatus;
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _floatingToolsReact = require("@buoy-gg/floating-tools-react");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
/**
|
|
13
|
+
* FloatingTools - Web renderer using shared React bindings.
|
|
14
|
+
*
|
|
15
|
+
* This file contains ONLY web-specific code (React DOM):
|
|
16
|
+
* - Mouse event handling
|
|
17
|
+
* - requestAnimationFrame animation
|
|
18
|
+
* - Web JSX (div, span)
|
|
19
|
+
* - localStorage adapter
|
|
20
|
+
*
|
|
21
|
+
* All logic is shared via @buoy-gg/floating-tools-react
|
|
22
|
+
*
|
|
23
|
+
* @platform React DOM Web (Vite, CRA, Next.js, Electron)
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
// Re-export for consumers
|
|
27
|
+
|
|
28
|
+
// =============================
|
|
29
|
+
// Web Storage Adapter
|
|
30
|
+
// =============================
|
|
31
|
+
const webStorageAdapter = {
|
|
32
|
+
getItem: key => localStorage.getItem(key),
|
|
33
|
+
setItem: (key, value) => localStorage.setItem(key, value)
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// =============================
|
|
37
|
+
// GripVerticalIcon (web JSX)
|
|
38
|
+
// =============================
|
|
39
|
+
function GripVerticalIcon({
|
|
40
|
+
size = 24,
|
|
41
|
+
color = (0, _floatingToolsReact.withAlpha)(_floatingToolsReact.floatingToolsColors.secondary, 'CC')
|
|
42
|
+
}) {
|
|
43
|
+
const layout = (0, _floatingToolsReact.getGripIconLayout)(size);
|
|
44
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
45
|
+
style: {
|
|
46
|
+
width: size,
|
|
47
|
+
height: size,
|
|
48
|
+
display: 'flex',
|
|
49
|
+
flexDirection: 'row',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
justifyContent: 'center'
|
|
52
|
+
},
|
|
53
|
+
children: [0, 1].map(col => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
54
|
+
style: {
|
|
55
|
+
display: 'flex',
|
|
56
|
+
flexDirection: 'column',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
justifyContent: 'center',
|
|
59
|
+
marginLeft: col === 0 ? 0 : layout.columnGap
|
|
60
|
+
},
|
|
61
|
+
children: [0, 1, 2].map(row => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
62
|
+
style: {
|
|
63
|
+
width: layout.dotSize,
|
|
64
|
+
height: layout.dotSize,
|
|
65
|
+
borderRadius: layout.dotSize / 2,
|
|
66
|
+
backgroundColor: color,
|
|
67
|
+
marginTop: row === 0 ? 0 : layout.rowGap
|
|
68
|
+
}
|
|
69
|
+
}, row))
|
|
70
|
+
}, col))
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// =============================
|
|
75
|
+
// Divider (web JSX)
|
|
76
|
+
// =============================
|
|
77
|
+
function Divider() {
|
|
78
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
79
|
+
style: {
|
|
80
|
+
width: 1,
|
|
81
|
+
height: 12,
|
|
82
|
+
backgroundColor: (0, _floatingToolsReact.withAlpha)(_floatingToolsReact.floatingToolsColors.muted, '66'),
|
|
83
|
+
flexShrink: 0
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// =============================
|
|
89
|
+
// UserStatus (web JSX)
|
|
90
|
+
// =============================
|
|
91
|
+
function UserStatus({
|
|
92
|
+
userRole,
|
|
93
|
+
onPress
|
|
94
|
+
}) {
|
|
95
|
+
const {
|
|
96
|
+
isDragging
|
|
97
|
+
} = (0, _floatingToolsReact.useFloatingToolsContext)();
|
|
98
|
+
const config = (0, _floatingToolsReact.getUserStatusConfig)(userRole, _floatingToolsReact.floatingToolsColors);
|
|
99
|
+
const handleClick = e => {
|
|
100
|
+
if (!isDragging && onPress) {
|
|
101
|
+
e.stopPropagation();
|
|
102
|
+
onPress();
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
|
|
106
|
+
role: "button",
|
|
107
|
+
"aria-label": `User status: ${config.label}`,
|
|
108
|
+
onClick: handleClick,
|
|
109
|
+
style: {
|
|
110
|
+
display: 'flex',
|
|
111
|
+
flexDirection: 'row',
|
|
112
|
+
alignItems: 'center',
|
|
113
|
+
paddingTop: 6,
|
|
114
|
+
paddingBottom: 6,
|
|
115
|
+
paddingLeft: 8,
|
|
116
|
+
paddingRight: 8,
|
|
117
|
+
flexShrink: 0,
|
|
118
|
+
cursor: onPress && !isDragging ? 'pointer' : 'default',
|
|
119
|
+
background: 'none',
|
|
120
|
+
border: 'none'
|
|
121
|
+
},
|
|
122
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
123
|
+
style: {
|
|
124
|
+
width: 6,
|
|
125
|
+
height: 6,
|
|
126
|
+
borderRadius: 3,
|
|
127
|
+
backgroundColor: config.dotColor,
|
|
128
|
+
marginRight: 4
|
|
129
|
+
}
|
|
130
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
131
|
+
style: {
|
|
132
|
+
fontSize: 10,
|
|
133
|
+
fontWeight: 500,
|
|
134
|
+
color: config.textColor,
|
|
135
|
+
letterSpacing: 0.3
|
|
136
|
+
},
|
|
137
|
+
children: config.label
|
|
138
|
+
})]
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// =============================
|
|
143
|
+
// Web Animation Hook
|
|
144
|
+
// =============================
|
|
145
|
+
function useWebAnimation() {
|
|
146
|
+
const animationRef = (0, _react.useRef)(null);
|
|
147
|
+
const [position, setPosition] = (0, _react.useState)({
|
|
148
|
+
x: 0,
|
|
149
|
+
y: 0
|
|
150
|
+
});
|
|
151
|
+
const animateTo = (0, _react.useCallback)((from, to, onComplete) => {
|
|
152
|
+
if (animationRef.current) {
|
|
153
|
+
cancelAnimationFrame(animationRef.current);
|
|
154
|
+
}
|
|
155
|
+
const startTime = performance.now();
|
|
156
|
+
const animate = currentTime => {
|
|
157
|
+
const elapsed = currentTime - startTime;
|
|
158
|
+
const progress = Math.min(elapsed / _floatingToolsReact.ANIMATION_DURATION, 1);
|
|
159
|
+
const newPosition = (0, _floatingToolsReact.interpolatePosition)(from, to, progress, _floatingToolsReact.easing.easeOutCubic);
|
|
160
|
+
setPosition(newPosition);
|
|
161
|
+
if (progress < 1) {
|
|
162
|
+
animationRef.current = requestAnimationFrame(animate);
|
|
163
|
+
} else {
|
|
164
|
+
setPosition(to);
|
|
165
|
+
onComplete?.();
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
animationRef.current = requestAnimationFrame(animate);
|
|
169
|
+
}, []);
|
|
170
|
+
(0, _react.useEffect)(() => {
|
|
171
|
+
return () => {
|
|
172
|
+
if (animationRef.current) {
|
|
173
|
+
cancelAnimationFrame(animationRef.current);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
}, []);
|
|
177
|
+
return {
|
|
178
|
+
position,
|
|
179
|
+
setPosition,
|
|
180
|
+
animateTo
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// =============================
|
|
185
|
+
// Main FloatingTools Component
|
|
186
|
+
// =============================
|
|
187
|
+
|
|
188
|
+
function FloatingTools({
|
|
189
|
+
enablePositionPersistence = true,
|
|
190
|
+
children
|
|
191
|
+
}) {
|
|
192
|
+
const bubbleRef = (0, _react.useRef)(null);
|
|
193
|
+
|
|
194
|
+
// Use shared hook
|
|
195
|
+
const {
|
|
196
|
+
state,
|
|
197
|
+
actions,
|
|
198
|
+
isInitialized
|
|
199
|
+
} = (0, _floatingToolsReact.useFloatingTools)({
|
|
200
|
+
screenSize: {
|
|
201
|
+
width: window.innerWidth,
|
|
202
|
+
height: window.innerHeight
|
|
203
|
+
},
|
|
204
|
+
enablePositionPersistence,
|
|
205
|
+
storage: webStorageAdapter
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
// Web-specific animation
|
|
209
|
+
const {
|
|
210
|
+
position: animatedPosition,
|
|
211
|
+
setPosition: setAnimatedPosition,
|
|
212
|
+
animateTo
|
|
213
|
+
} = useWebAnimation();
|
|
214
|
+
|
|
215
|
+
// Sync position when initialized
|
|
216
|
+
(0, _react.useEffect)(() => {
|
|
217
|
+
if (isInitialized) {
|
|
218
|
+
setAnimatedPosition(state.position);
|
|
219
|
+
}
|
|
220
|
+
}, [isInitialized, state.position, setAnimatedPosition]);
|
|
221
|
+
|
|
222
|
+
// Handle window resize
|
|
223
|
+
(0, _react.useEffect)(() => {
|
|
224
|
+
const handleResize = () => {
|
|
225
|
+
actions.setScreenSize(window.innerWidth, window.innerHeight);
|
|
226
|
+
};
|
|
227
|
+
window.addEventListener('resize', handleResize);
|
|
228
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
229
|
+
}, [actions]);
|
|
230
|
+
|
|
231
|
+
// Update bubble size on layout
|
|
232
|
+
const [bubbleMeasured, setBubbleMeasured] = (0, _react.useState)(false);
|
|
233
|
+
(0, _react.useEffect)(() => {
|
|
234
|
+
if (!bubbleMeasured && bubbleRef.current) {
|
|
235
|
+
const rect = bubbleRef.current.getBoundingClientRect();
|
|
236
|
+
if (rect.width > 0 && rect.height > 0) {
|
|
237
|
+
actions.setBubbleSize({
|
|
238
|
+
width: rect.width,
|
|
239
|
+
height: rect.height
|
|
240
|
+
});
|
|
241
|
+
setBubbleMeasured(true);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}, [bubbleMeasured, actions]);
|
|
245
|
+
|
|
246
|
+
// Web-specific: mouse event handling
|
|
247
|
+
const [isMouseDown, setIsMouseDown] = (0, _react.useState)(false);
|
|
248
|
+
const handleMouseDown = (0, _react.useCallback)(e => {
|
|
249
|
+
e.preventDefault();
|
|
250
|
+
setIsMouseDown(true);
|
|
251
|
+
actions.handleDragStart({
|
|
252
|
+
clientX: e.clientX,
|
|
253
|
+
clientY: e.clientY
|
|
254
|
+
});
|
|
255
|
+
}, [actions]);
|
|
256
|
+
const handleMouseMove = (0, _react.useCallback)(e => {
|
|
257
|
+
const result = actions.handleDragMove({
|
|
258
|
+
clientX: e.clientX,
|
|
259
|
+
clientY: e.clientY
|
|
260
|
+
});
|
|
261
|
+
if (result.isDragging) {
|
|
262
|
+
setAnimatedPosition(result.position);
|
|
263
|
+
}
|
|
264
|
+
}, [actions, setAnimatedPosition]);
|
|
265
|
+
const handleMouseUp = (0, _react.useCallback)(e => {
|
|
266
|
+
setIsMouseDown(false);
|
|
267
|
+
const result = actions.handleDragEnd({
|
|
268
|
+
clientX: e.clientX,
|
|
269
|
+
clientY: e.clientY
|
|
270
|
+
});
|
|
271
|
+
if (result.wasTap) {
|
|
272
|
+
const toggleResult = actions.toggleHideShow();
|
|
273
|
+
animateTo(state.position, toggleResult.targetPosition, () => {
|
|
274
|
+
actions.commitPosition(toggleResult.targetPosition);
|
|
275
|
+
});
|
|
276
|
+
} else if (result.shouldHide) {
|
|
277
|
+
animateTo(state.position, result.position, () => {
|
|
278
|
+
actions.commitPosition(result.position);
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}, [actions, animateTo, state.position]);
|
|
282
|
+
(0, _react.useEffect)(() => {
|
|
283
|
+
if (isMouseDown) {
|
|
284
|
+
window.addEventListener('mousemove', handleMouseMove);
|
|
285
|
+
window.addEventListener('mouseup', handleMouseUp);
|
|
286
|
+
return () => {
|
|
287
|
+
window.removeEventListener('mousemove', handleMouseMove);
|
|
288
|
+
window.removeEventListener('mouseup', handleMouseUp);
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
}, [isMouseDown, handleMouseMove, handleMouseUp]);
|
|
292
|
+
|
|
293
|
+
// Interleave children with dividers
|
|
294
|
+
const actionsContent = (0, _react.useMemo)(() => (0, _floatingToolsReact.interleaveWithDividers)(_react.Children.toArray(children), key => /*#__PURE__*/(0, _jsxRuntime.jsx)(Divider, {}, key)), [children]);
|
|
295
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
296
|
+
ref: bubbleRef,
|
|
297
|
+
role: "toolbar",
|
|
298
|
+
"aria-label": "Floating Tools",
|
|
299
|
+
style: {
|
|
300
|
+
position: 'fixed',
|
|
301
|
+
left: animatedPosition.x,
|
|
302
|
+
top: animatedPosition.y,
|
|
303
|
+
zIndex: 9999,
|
|
304
|
+
display: 'flex',
|
|
305
|
+
flexDirection: 'row',
|
|
306
|
+
alignItems: 'center',
|
|
307
|
+
backgroundColor: _floatingToolsReact.floatingToolsColors.panel,
|
|
308
|
+
borderRadius: 6,
|
|
309
|
+
borderWidth: state.isDragging ? 2 : 1,
|
|
310
|
+
borderStyle: 'solid',
|
|
311
|
+
borderColor: state.isDragging ? _floatingToolsReact.floatingToolsColors.dragActive : (0, _floatingToolsReact.withAlpha)(_floatingToolsReact.floatingToolsColors.muted, '66'),
|
|
312
|
+
boxShadow: state.isDragging ? `0 6px 12px ${(0, _floatingToolsReact.withAlpha)(_floatingToolsReact.floatingToolsColors.dragActive, '99')}` : '0 4px 8px rgba(0, 0, 0, 0.3)',
|
|
313
|
+
userSelect: 'none',
|
|
314
|
+
touchAction: 'none'
|
|
315
|
+
},
|
|
316
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
317
|
+
role: "slider",
|
|
318
|
+
"aria-label": "Drag handle",
|
|
319
|
+
"aria-valuetext": `Position: ${Math.round(animatedPosition.x)}, ${Math.round(animatedPosition.y)}`,
|
|
320
|
+
tabIndex: 0,
|
|
321
|
+
onMouseDown: handleMouseDown,
|
|
322
|
+
style: {
|
|
323
|
+
paddingLeft: 6,
|
|
324
|
+
paddingRight: 6,
|
|
325
|
+
paddingTop: 6,
|
|
326
|
+
paddingBottom: 6,
|
|
327
|
+
backgroundColor: (0, _floatingToolsReact.withAlpha)(_floatingToolsReact.floatingToolsColors.muted, '1A'),
|
|
328
|
+
display: 'flex',
|
|
329
|
+
alignItems: 'center',
|
|
330
|
+
justifyContent: 'center',
|
|
331
|
+
width: _floatingToolsReact.VISIBLE_HANDLE_WIDTH,
|
|
332
|
+
borderRight: `1px solid ${(0, _floatingToolsReact.withAlpha)(_floatingToolsReact.floatingToolsColors.muted, '66')}`,
|
|
333
|
+
borderTopLeftRadius: 5,
|
|
334
|
+
borderBottomLeftRadius: 5,
|
|
335
|
+
cursor: state.isDragging ? 'grabbing' : 'grab'
|
|
336
|
+
},
|
|
337
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(GripVerticalIcon, {
|
|
338
|
+
size: 12
|
|
339
|
+
})
|
|
340
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_floatingToolsReact.FloatingToolsProvider, {
|
|
341
|
+
value: {
|
|
342
|
+
isDragging: state.isDragging,
|
|
343
|
+
isHidden: state.isHidden
|
|
344
|
+
},
|
|
345
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
346
|
+
style: {
|
|
347
|
+
display: 'flex',
|
|
348
|
+
flexDirection: 'row',
|
|
349
|
+
alignItems: 'center',
|
|
350
|
+
gap: 6,
|
|
351
|
+
paddingRight: 8
|
|
352
|
+
},
|
|
353
|
+
children: actionsContent
|
|
354
|
+
})
|
|
355
|
+
})]
|
|
356
|
+
});
|
|
357
|
+
}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -215,7 +215,7 @@ Object.defineProperty(exports, "validateDialConfig", {
|
|
|
215
215
|
return _defaultConfig.validateDialConfig;
|
|
216
216
|
}
|
|
217
217
|
});
|
|
218
|
-
var _FloatingDevTools = require("./floatingMenu/FloatingDevTools
|
|
218
|
+
var _FloatingDevTools = require("./floatingMenu/FloatingDevTools");
|
|
219
219
|
var _autoDiscoverPresets = require("./floatingMenu/autoDiscoverPresets.js");
|
|
220
220
|
var _defaultConfig = require("./floatingMenu/defaultConfig.js");
|
|
221
221
|
var _FloatingMenu = require("./floatingMenu/FloatingMenu.js");
|
|
@@ -231,7 +231,7 @@ Object.keys(_types).forEach(function (key) {
|
|
|
231
231
|
}
|
|
232
232
|
});
|
|
233
233
|
});
|
|
234
|
-
var _DevToolsSettingsModal = require("./floatingMenu/DevToolsSettingsModal
|
|
234
|
+
var _DevToolsSettingsModal = require("./floatingMenu/DevToolsSettingsModal");
|
|
235
235
|
var _AppHost = require("./floatingMenu/AppHost.js");
|
|
236
236
|
var _DevToolsVisibilityContext = require("./floatingMenu/DevToolsVisibilityContext.js");
|
|
237
237
|
var _ToggleStateManager = require("./floatingMenu/ToggleStateManager.js");
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "DialMenu", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _DialDevToolsWeb.DialMenu;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "Divider", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _floatingToolsWeb.Divider;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "FloatingDevTools", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _FloatingDevToolsWeb.FloatingDevTools;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "FloatingTools", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _floatingToolsWeb.FloatingTools;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "SettingsModal", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _DevToolsSettingsModalWeb.SettingsModal;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "UserStatus", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _floatingToolsWeb.UserStatus;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "autoDiscoverWebPresets", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _autoDiscoverPresetsWeb.autoDiscoverWebPresets;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "autoDiscoverWithCustom", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _autoDiscoverPresetsWeb.autoDiscoverWithCustom;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "defaultToolPresets", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _autoDiscoverPresetsWeb.defaultToolPresets;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "dialColors", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _floatingToolsReact.dialColors;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "dialStyles", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _floatingToolsReact.dialStyles;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "getEnabledTools", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _autoDiscoverPresetsWeb.getEnabledTools;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, "getToolColor", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () {
|
|
81
|
+
return _floatingToolsReact.getToolColor;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, "getToolDescription", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return _floatingToolsReact.getToolDescription;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, "getToolLabel", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return _floatingToolsReact.getToolLabel;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, "getToolsBySlot", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () {
|
|
99
|
+
return _autoDiscoverPresetsWeb.getToolsBySlot;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
Object.defineProperty(exports, "settingsColors", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function () {
|
|
105
|
+
return _floatingToolsReact.settingsColors;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
Object.defineProperty(exports, "settingsStyles", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function () {
|
|
111
|
+
return _floatingToolsReact.settingsStyles;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
Object.defineProperty(exports, "useFloatingTools", {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function () {
|
|
117
|
+
return _floatingToolsReact.useFloatingTools;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(exports, "useSettings", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function () {
|
|
123
|
+
return _floatingToolsReact.useSettings;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
var _FloatingDevToolsWeb = require("./floatingMenu/FloatingDevTools.web.js");
|
|
127
|
+
var _floatingToolsWeb = require("./floatingMenu/floatingTools.web.js");
|
|
128
|
+
var _DialDevToolsWeb = require("./floatingMenu/dial/DialDevTools.web.js");
|
|
129
|
+
var _DevToolsSettingsModalWeb = require("./floatingMenu/DevToolsSettingsModal.web.js");
|
|
130
|
+
var _autoDiscoverPresetsWeb = require("./utils/autoDiscoverPresets.web.js");
|
|
131
|
+
var _floatingToolsReact = require("@buoy-gg/floating-tools-react");
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.autoDiscoverWebPresets = autoDiscoverWebPresets;
|
|
7
|
+
exports.autoDiscoverWithCustom = autoDiscoverWithCustom;
|
|
8
|
+
exports.defaultToolPresets = void 0;
|
|
9
|
+
exports.getEnabledTools = getEnabledTools;
|
|
10
|
+
exports.getToolsBySlot = getToolsBySlot;
|
|
11
|
+
var _floatingToolsCore = require("@buoy-gg/floating-tools-core");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
/**
|
|
14
|
+
* Auto-discovery utility for React DOM Web.
|
|
15
|
+
*
|
|
16
|
+
* Uses Vite's import.meta.glob to discover installed @buoy-gg/* packages
|
|
17
|
+
* at build time. This provides Metro-like auto-discovery behavior for web.
|
|
18
|
+
*
|
|
19
|
+
* How it works:
|
|
20
|
+
* 1. import.meta.glob scans node_modules at build time
|
|
21
|
+
* 2. Only packages that are actually installed are included
|
|
22
|
+
* 3. Missing packages don't cause errors (like Metro's try-catch)
|
|
23
|
+
* 4. Custom tools can override discovered ones by ID
|
|
24
|
+
*
|
|
25
|
+
* @platform React DOM Web (Vite, CRA, Next.js, Electron)
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
// =============================
|
|
29
|
+
// Default Tool Presets (Fallback)
|
|
30
|
+
// =============================
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Default tool presets for when packages don't export web presets yet.
|
|
34
|
+
* These will be used until each @buoy-gg/* package exports its own preset.
|
|
35
|
+
*/
|
|
36
|
+
const defaultToolPresets = exports.defaultToolPresets = [{
|
|
37
|
+
id: 'env',
|
|
38
|
+
name: 'ENV',
|
|
39
|
+
description: 'Environment variables debugger',
|
|
40
|
+
slot: 'both',
|
|
41
|
+
icon: size => /*#__PURE__*/(0, _jsxRuntime.jsx)(_floatingToolsCore.EnvIcon, {
|
|
42
|
+
size: size
|
|
43
|
+
}),
|
|
44
|
+
color: '#4AFF9F'
|
|
45
|
+
}, {
|
|
46
|
+
id: 'storage',
|
|
47
|
+
name: 'STORAGE',
|
|
48
|
+
description: 'AsyncStorage browser',
|
|
49
|
+
slot: 'both',
|
|
50
|
+
icon: 'πΎ',
|
|
51
|
+
color: '#BA68C8'
|
|
52
|
+
}, {
|
|
53
|
+
id: 'network',
|
|
54
|
+
name: 'NET',
|
|
55
|
+
description: 'Network request logger',
|
|
56
|
+
slot: 'both',
|
|
57
|
+
icon: size => /*#__PURE__*/(0, _jsxRuntime.jsx)(_floatingToolsCore.NetworkIcon, {
|
|
58
|
+
size: size
|
|
59
|
+
}),
|
|
60
|
+
color: '#4AFF9F'
|
|
61
|
+
}, {
|
|
62
|
+
id: 'query',
|
|
63
|
+
name: 'QUERY',
|
|
64
|
+
description: 'React Query inspector',
|
|
65
|
+
slot: 'both',
|
|
66
|
+
icon: 'π',
|
|
67
|
+
color: '#FF4154'
|
|
68
|
+
}, {
|
|
69
|
+
id: 'route-events',
|
|
70
|
+
name: 'ROUTES',
|
|
71
|
+
description: 'Route tracking & navigation inspector',
|
|
72
|
+
slot: 'both',
|
|
73
|
+
icon: 'πΊοΈ',
|
|
74
|
+
color: '#FF9F1C'
|
|
75
|
+
}, {
|
|
76
|
+
id: 'highlight-updates',
|
|
77
|
+
name: 'RENDERS',
|
|
78
|
+
description: 'View component render tracking',
|
|
79
|
+
slot: 'dial',
|
|
80
|
+
icon: 'β¨',
|
|
81
|
+
color: '#10b981'
|
|
82
|
+
}, {
|
|
83
|
+
id: 'debug-borders',
|
|
84
|
+
name: 'DEBUG BORDERS',
|
|
85
|
+
description: 'Component layout borders',
|
|
86
|
+
slot: 'dial',
|
|
87
|
+
icon: 'π',
|
|
88
|
+
color: '#10b981'
|
|
89
|
+
}, {
|
|
90
|
+
id: 'benchmark',
|
|
91
|
+
name: 'BENCHMARK',
|
|
92
|
+
description: 'Performance benchmarks',
|
|
93
|
+
slot: 'dial',
|
|
94
|
+
icon: 'β‘',
|
|
95
|
+
color: '#F59E0B'
|
|
96
|
+
}];
|
|
97
|
+
|
|
98
|
+
// =============================
|
|
99
|
+
// Auto-Discovery Functions
|
|
100
|
+
// =============================
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Auto-discover installed @buoy-gg/* tool packages.
|
|
104
|
+
*
|
|
105
|
+
* Uses Vite's import.meta.glob to find packages at build time.
|
|
106
|
+
* Only installed packages are included (no errors for missing ones).
|
|
107
|
+
*
|
|
108
|
+
* Note: Until packages export web presets, this returns default presets.
|
|
109
|
+
*
|
|
110
|
+
* @returns Array of discovered tool configurations
|
|
111
|
+
*/
|
|
112
|
+
function autoDiscoverWebPresets() {
|
|
113
|
+
// TODO: When @buoy-gg/* packages export web presets, use import.meta.glob:
|
|
114
|
+
//
|
|
115
|
+
// const modules = import.meta.glob(
|
|
116
|
+
// '/node_modules/@buoy-gg/*/dist/preset.{js,mjs}',
|
|
117
|
+
// { eager: true, import: 'default' }
|
|
118
|
+
// );
|
|
119
|
+
//
|
|
120
|
+
// const presets: WebToolConfig[] = [];
|
|
121
|
+
// for (const [path, preset] of Object.entries(modules)) {
|
|
122
|
+
// if (preset && typeof preset === 'object' && 'id' in preset) {
|
|
123
|
+
// presets.push(preset as WebToolConfig);
|
|
124
|
+
// }
|
|
125
|
+
// }
|
|
126
|
+
// return presets;
|
|
127
|
+
|
|
128
|
+
// For now, return default presets
|
|
129
|
+
return [...defaultToolPresets];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Merge custom tools with auto-discovered ones.
|
|
134
|
+
*
|
|
135
|
+
* Custom tools take precedence - if a custom tool has the same ID as
|
|
136
|
+
* a discovered tool, the custom one is used (same behavior as mobile).
|
|
137
|
+
*
|
|
138
|
+
* @param customTools - Custom tools to merge (optional)
|
|
139
|
+
* @returns Merged array with custom tools taking precedence
|
|
140
|
+
*/
|
|
141
|
+
function autoDiscoverWithCustom(customTools = []) {
|
|
142
|
+
const discovered = autoDiscoverWebPresets();
|
|
143
|
+
if (customTools.length === 0) {
|
|
144
|
+
return discovered;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Create set of custom tool IDs for quick lookup
|
|
148
|
+
const customIds = new Set(customTools.map(t => t.id));
|
|
149
|
+
|
|
150
|
+
// Filter out discovered tools that have custom overrides
|
|
151
|
+
const filteredDiscovered = discovered.filter(t => !customIds.has(t.id));
|
|
152
|
+
|
|
153
|
+
// Custom tools first, then remaining discovered
|
|
154
|
+
return [...customTools, ...filteredDiscovered];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Get tools filtered by slot.
|
|
159
|
+
*
|
|
160
|
+
* @param tools - Array of tool configurations
|
|
161
|
+
* @param slot - Slot to filter by ('dial' or 'row')
|
|
162
|
+
* @returns Filtered array of tools that can appear in the specified slot
|
|
163
|
+
*/
|
|
164
|
+
function getToolsBySlot(tools, slot) {
|
|
165
|
+
return tools.filter(tool => {
|
|
166
|
+
const toolSlot = tool.slot || 'both';
|
|
167
|
+
return toolSlot === 'both' || toolSlot === slot;
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Get enabled tools based on settings.
|
|
173
|
+
*
|
|
174
|
+
* @param tools - Array of all tool configurations
|
|
175
|
+
* @param enabledIds - Set or array of enabled tool IDs
|
|
176
|
+
* @returns Filtered array of enabled tools
|
|
177
|
+
*/
|
|
178
|
+
function getEnabledTools(tools, enabledIds) {
|
|
179
|
+
const idSet = enabledIds instanceof Set ? enabledIds : new Set(enabledIds);
|
|
180
|
+
return tools.filter(tool => idSet.has(tool.id));
|
|
181
|
+
}
|
|
@@ -5,7 +5,7 @@ import React, { createContext, useCallback, useContext, useMemo, useState, useEf
|
|
|
5
5
|
import { BackHandler, Modal, StyleSheet, View } from "react-native";
|
|
6
6
|
import { resolveOpenAppsState } from "./AppHostLogic.js";
|
|
7
7
|
import { useMinimizedTools } from "./MinimizedToolsContext.js";
|
|
8
|
-
import { useDevToolsSettings } from "./DevToolsSettingsModal
|
|
8
|
+
import { useDevToolsSettings } from "./DevToolsSettingsModal";
|
|
9
9
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
10
10
|
const AppHostContext = /*#__PURE__*/createContext(null);
|
|
11
11
|
const STORAGE_KEY_OPEN_APPS = "@react_buoy_open_apps";
|