@buoy-gg/core 7.0.14 → 7.0.16

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.
Files changed (99) hide show
  1. package/lib/commonjs/floatingMenu/AppHost.web.js +359 -0
  2. package/lib/commonjs/floatingMenu/AppHostLogic.js +6 -0
  3. package/lib/commonjs/floatingMenu/DevToolsSettingsModal.web.js +787 -418
  4. package/lib/commonjs/floatingMenu/FloatingDevTools.js +1 -1
  5. package/lib/commonjs/floatingMenu/FloatingDevTools.web.js +244 -36
  6. package/lib/commonjs/floatingMenu/FloatingMenu.js +2 -2
  7. package/lib/commonjs/floatingMenu/MinimizedToolsContext.js +2 -3
  8. package/lib/commonjs/floatingMenu/MinimizedToolsStack.web.js +287 -0
  9. package/lib/commonjs/floatingMenu/autoDiscoverPresets.js +16 -0
  10. package/lib/commonjs/floatingMenu/autoExternalSync.js +9 -0
  11. package/lib/commonjs/floatingMenu/dial/DialDevTools.js +7 -4
  12. package/lib/commonjs/floatingMenu/dial/DialDevTools.web.js +373 -231
  13. package/lib/commonjs/floatingMenu/dial/DialIcon.js +25 -3
  14. package/lib/commonjs/floatingMenu/dial/OnboardingTooltip.js +1 -1
  15. package/lib/commonjs/floatingMenu/dial/OnboardingTooltip.web.js +154 -0
  16. package/lib/commonjs/floatingMenu/dial/onboardingConstants.web.js +34 -0
  17. package/lib/commonjs/floatingMenu/floatingTools.js +3 -3
  18. package/lib/commonjs/floatingMenu/floatingTools.web.js +191 -28
  19. package/lib/commonjs/index.js +2 -2
  20. package/lib/commonjs/index.web.js +19 -0
  21. package/lib/commonjs/utils/autoDiscoverPresets.web.js +50 -5
  22. package/lib/module/floatingMenu/AppHost.web.js +351 -0
  23. package/lib/module/floatingMenu/AppHostLogic.js +6 -0
  24. package/lib/module/floatingMenu/DevToolsSettingsModal.web.js +792 -422
  25. package/lib/module/floatingMenu/FloatingDevTools.js +2 -2
  26. package/lib/module/floatingMenu/FloatingDevTools.web.js +247 -38
  27. package/lib/module/floatingMenu/FloatingMenu.js +2 -2
  28. package/lib/module/floatingMenu/MinimizedToolsContext.js +2 -3
  29. package/lib/module/floatingMenu/MinimizedToolsStack.web.js +284 -0
  30. package/lib/module/floatingMenu/autoDiscoverPresets.js +16 -0
  31. package/lib/module/floatingMenu/autoExternalSync.js +9 -0
  32. package/lib/module/floatingMenu/dial/DialDevTools.js +8 -5
  33. package/lib/module/floatingMenu/dial/DialDevTools.web.js +375 -233
  34. package/lib/module/floatingMenu/dial/DialIcon.js +26 -4
  35. package/lib/module/floatingMenu/dial/OnboardingTooltip.js +1 -1
  36. package/lib/module/floatingMenu/dial/OnboardingTooltip.web.js +149 -0
  37. package/lib/module/floatingMenu/dial/onboardingConstants.web.js +27 -0
  38. package/lib/module/floatingMenu/floatingTools.js +3 -3
  39. package/lib/module/floatingMenu/floatingTools.web.js +190 -28
  40. package/lib/module/index.js +2 -2
  41. package/lib/module/index.web.js +5 -0
  42. package/lib/module/utils/autoDiscoverPresets.web.js +53 -7
  43. package/lib/typescript/commonjs/floatingMenu/AppHost.web.d.ts +38 -0
  44. package/lib/typescript/commonjs/floatingMenu/AppHost.web.d.ts.map +1 -0
  45. package/lib/typescript/commonjs/floatingMenu/AppHostLogic.d.ts +21 -1
  46. package/lib/typescript/commonjs/floatingMenu/AppHostLogic.d.ts.map +1 -1
  47. package/lib/typescript/commonjs/floatingMenu/DevToolsSettingsModal.web.d.ts +5 -2
  48. package/lib/typescript/commonjs/floatingMenu/DevToolsSettingsModal.web.d.ts.map +1 -1
  49. package/lib/typescript/commonjs/floatingMenu/FloatingDevTools.web.d.ts +2 -14
  50. package/lib/typescript/commonjs/floatingMenu/FloatingDevTools.web.d.ts.map +1 -1
  51. package/lib/typescript/commonjs/floatingMenu/MinimizedToolsContext.d.ts +2 -20
  52. package/lib/typescript/commonjs/floatingMenu/MinimizedToolsContext.d.ts.map +1 -1
  53. package/lib/typescript/commonjs/floatingMenu/MinimizedToolsStack.web.d.ts +21 -0
  54. package/lib/typescript/commonjs/floatingMenu/MinimizedToolsStack.web.d.ts.map +1 -0
  55. package/lib/typescript/commonjs/floatingMenu/autoDiscoverPresets.d.ts.map +1 -1
  56. package/lib/typescript/commonjs/floatingMenu/autoExternalSync.d.ts.map +1 -1
  57. package/lib/typescript/commonjs/floatingMenu/dial/DialDevTools.d.ts.map +1 -1
  58. package/lib/typescript/commonjs/floatingMenu/dial/DialDevTools.web.d.ts +16 -2
  59. package/lib/typescript/commonjs/floatingMenu/dial/DialDevTools.web.d.ts.map +1 -1
  60. package/lib/typescript/commonjs/floatingMenu/dial/DialIcon.d.ts.map +1 -1
  61. package/lib/typescript/commonjs/floatingMenu/dial/OnboardingTooltip.web.d.ts +9 -0
  62. package/lib/typescript/commonjs/floatingMenu/dial/OnboardingTooltip.web.d.ts.map +1 -0
  63. package/lib/typescript/commonjs/floatingMenu/dial/onboardingConstants.web.d.ts +13 -0
  64. package/lib/typescript/commonjs/floatingMenu/dial/onboardingConstants.web.d.ts.map +1 -0
  65. package/lib/typescript/commonjs/floatingMenu/floatingTools.web.d.ts +29 -2
  66. package/lib/typescript/commonjs/floatingMenu/floatingTools.web.d.ts.map +1 -1
  67. package/lib/typescript/commonjs/index.web.d.ts +1 -0
  68. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  69. package/lib/typescript/commonjs/utils/autoDiscoverPresets.web.d.ts +2 -0
  70. package/lib/typescript/commonjs/utils/autoDiscoverPresets.web.d.ts.map +1 -1
  71. package/lib/typescript/module/floatingMenu/AppHost.web.d.ts +38 -0
  72. package/lib/typescript/module/floatingMenu/AppHost.web.d.ts.map +1 -0
  73. package/lib/typescript/module/floatingMenu/AppHostLogic.d.ts +21 -1
  74. package/lib/typescript/module/floatingMenu/AppHostLogic.d.ts.map +1 -1
  75. package/lib/typescript/module/floatingMenu/DevToolsSettingsModal.web.d.ts +5 -2
  76. package/lib/typescript/module/floatingMenu/DevToolsSettingsModal.web.d.ts.map +1 -1
  77. package/lib/typescript/module/floatingMenu/FloatingDevTools.web.d.ts +2 -14
  78. package/lib/typescript/module/floatingMenu/FloatingDevTools.web.d.ts.map +1 -1
  79. package/lib/typescript/module/floatingMenu/MinimizedToolsContext.d.ts +2 -20
  80. package/lib/typescript/module/floatingMenu/MinimizedToolsContext.d.ts.map +1 -1
  81. package/lib/typescript/module/floatingMenu/MinimizedToolsStack.web.d.ts +21 -0
  82. package/lib/typescript/module/floatingMenu/MinimizedToolsStack.web.d.ts.map +1 -0
  83. package/lib/typescript/module/floatingMenu/autoDiscoverPresets.d.ts.map +1 -1
  84. package/lib/typescript/module/floatingMenu/autoExternalSync.d.ts.map +1 -1
  85. package/lib/typescript/module/floatingMenu/dial/DialDevTools.d.ts.map +1 -1
  86. package/lib/typescript/module/floatingMenu/dial/DialDevTools.web.d.ts +16 -2
  87. package/lib/typescript/module/floatingMenu/dial/DialDevTools.web.d.ts.map +1 -1
  88. package/lib/typescript/module/floatingMenu/dial/DialIcon.d.ts.map +1 -1
  89. package/lib/typescript/module/floatingMenu/dial/OnboardingTooltip.web.d.ts +9 -0
  90. package/lib/typescript/module/floatingMenu/dial/OnboardingTooltip.web.d.ts.map +1 -0
  91. package/lib/typescript/module/floatingMenu/dial/onboardingConstants.web.d.ts +13 -0
  92. package/lib/typescript/module/floatingMenu/dial/onboardingConstants.web.d.ts.map +1 -0
  93. package/lib/typescript/module/floatingMenu/floatingTools.web.d.ts +29 -2
  94. package/lib/typescript/module/floatingMenu/floatingTools.web.d.ts.map +1 -1
  95. package/lib/typescript/module/index.web.d.ts +1 -0
  96. package/lib/typescript/module/index.web.d.ts.map +1 -1
  97. package/lib/typescript/module/utils/autoDiscoverPresets.web.d.ts +2 -0
  98. package/lib/typescript/module/utils/autoDiscoverPresets.web.d.ts.map +1 -1
  99. package/package.json +5 -5
@@ -25,6 +25,39 @@ var _jsxRuntime = require("react/jsx-runtime");
25
25
  * @platform React DOM Web (Vite, CRA, Next.js, Electron)
26
26
  */
27
27
 
28
+ /**
29
+ * Dashed-square glyph for debug-borders (no BIF brand icon exists for it
30
+ * yet). Plain SVG so it renders identically everywhere — emoji icons are
31
+ * banned here: WKWebView (Capacitor/Tauri) renders them as tofu boxes.
32
+ */function DebugBordersGlyph({
33
+ size
34
+ }) {
35
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
36
+ width: size,
37
+ height: size,
38
+ viewBox: "0 0 24 24",
39
+ "aria-hidden": "true",
40
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("rect", {
41
+ x: "3",
42
+ y: "3",
43
+ width: "18",
44
+ height: "18",
45
+ rx: "2",
46
+ fill: "none",
47
+ stroke: "#10b981",
48
+ strokeWidth: "2",
49
+ strokeDasharray: "4 3"
50
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("rect", {
51
+ x: "8",
52
+ y: "8",
53
+ width: "8",
54
+ height: "8",
55
+ rx: "1",
56
+ fill: "#10b98155"
57
+ })]
58
+ });
59
+ }
60
+
28
61
  // =============================
29
62
  // Default Tool Presets (Fallback)
30
63
  // =============================
@@ -32,6 +65,8 @@ var _jsxRuntime = require("react/jsx-runtime");
32
65
  /**
33
66
  * Default tool presets for when packages don't export web presets yet.
34
67
  * These will be used until each @buoy-gg/* package exports its own preset.
68
+ * Icons are the BIF brand icon components (same artwork as native) —
69
+ * never emoji strings (tofu in WKWebView).
35
70
  */
36
71
  const defaultToolPresets = exports.defaultToolPresets = [{
37
72
  id: 'env',
@@ -47,7 +82,9 @@ const defaultToolPresets = exports.defaultToolPresets = [{
47
82
  name: 'STORAGE',
48
83
  description: 'AsyncStorage browser',
49
84
  slot: 'both',
50
- icon: '💾',
85
+ icon: size => /*#__PURE__*/(0, _jsxRuntime.jsx)(_floatingToolsCore.StorageIcon, {
86
+ size: size
87
+ }),
51
88
  color: '#BA68C8'
52
89
  }, {
53
90
  id: 'network',
@@ -63,28 +100,36 @@ const defaultToolPresets = exports.defaultToolPresets = [{
63
100
  name: 'QUERY',
64
101
  description: 'React Query inspector',
65
102
  slot: 'both',
66
- icon: '🔍',
103
+ icon: size => /*#__PURE__*/(0, _jsxRuntime.jsx)(_floatingToolsCore.QueryIcon, {
104
+ size: size
105
+ }),
67
106
  color: '#FF4154'
68
107
  }, {
69
108
  id: 'route-events',
70
109
  name: 'ROUTES',
71
110
  description: 'Route tracking & navigation inspector',
72
111
  slot: 'both',
73
- icon: '🗺️',
112
+ icon: size => /*#__PURE__*/(0, _jsxRuntime.jsx)(_floatingToolsCore.RoutesIcon, {
113
+ size: size
114
+ }),
74
115
  color: '#FF9F1C'
75
116
  }, {
76
117
  id: 'highlight-updates',
77
118
  name: 'RENDERS',
78
119
  description: 'View component render tracking',
79
120
  slot: 'dial',
80
- icon: '✨',
121
+ icon: size => /*#__PURE__*/(0, _jsxRuntime.jsx)(_floatingToolsCore.RendersIcon, {
122
+ size: size
123
+ }),
81
124
  color: '#10b981'
82
125
  }, {
83
126
  id: 'debug-borders',
84
127
  name: 'DEBUG BORDERS',
85
128
  description: 'Component layout borders',
86
129
  slot: 'dial',
87
- icon: '📐',
130
+ icon: size => /*#__PURE__*/(0, _jsxRuntime.jsx)(DebugBordersGlyph, {
131
+ size: size
132
+ }),
88
133
  color: '#10b981'
89
134
  }];
90
135
 
@@ -0,0 +1,351 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * AppHost.web.tsx — DOM port of AppHost.tsx (React Native).
5
+ *
6
+ * Same state machine (shared `AppHostLogic.ts`), same `@react_buoy_open_apps`
7
+ * persistence key + JSON shape (`{id, minimized}[]`, 500ms debounce), same
8
+ * launch modes and z-order model (base 9000 + stack index).
9
+ *
10
+ * Intentional deviations from the native file (all logged):
11
+ * - No `MinimizedToolsContext`/`MinimizedToolsStack` second store: the
12
+ * minimized dock derives directly from `openApps` (`minimized === true`),
13
+ * the same simplification the Flutter port made deliberately
14
+ * (packages-flutter/buoy_core — see FLUTTER_TOOLS_PORT/MASTER_PLAN.md).
15
+ * `@react_buoy_minimized_tools` is therefore not written on web.
16
+ * - `BackHandler` (Android hardware back) → `Escape` keydown closes the
17
+ * top-most open tool.
18
+ * - No `setExpandableWindowControls` / global settings bridge — the web
19
+ * settings modal has no global-settings tab yet.
20
+ * - `minimizeTargetPosition` is computed from the dock layout below instead
21
+ * of `MinimizedToolsContext.getNextIconPosition()`.
22
+ *
23
+ * @platform React DOM Web
24
+ */
25
+ import { persistentStorage } from "@buoy-gg/shared-ui";
26
+ import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
27
+ import { resolveOpenAppsState } from "./AppHostLogic.js";
28
+ import { getBubbleAnchorPosition } from "./floatingTools.web.js";
29
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
30
+ const AppHostContext = /*#__PURE__*/createContext(null);
31
+ const STORAGE_KEY_OPEN_APPS = "@react_buoy_open_apps";
32
+ const PERSISTENCE_DELAY = 500;
33
+
34
+ // Minimized dock geometry — mirrors MinimizedToolsContext.tsx constants.
35
+ const ICON_SIZE = 44;
36
+ const ICON_GAP = 12;
37
+ const BOTTOM_OFFSET = 100;
38
+ const RIGHT_OFFSET = 16;
39
+ const dockIconPosition = index => ({
40
+ x: window.innerWidth - ICON_SIZE - RIGHT_OFFSET,
41
+ y: window.innerHeight - BOTTOM_OFFSET - ICON_SIZE - index * (ICON_SIZE + ICON_GAP)
42
+ });
43
+
44
+ /**
45
+ * Provides the floating dev tools application host for web. Tracks open tool
46
+ * instances, restores persisted state, and exposes the same imperative
47
+ * helpers as the native `AppHostProvider`.
48
+ */
49
+ export const AppHostProvider = ({
50
+ children
51
+ }) => {
52
+ const [openApps, setOpenApps] = useState([]);
53
+ const [isRestored, setIsRestored] = useState(false);
54
+ const persistenceTimeoutRef = useRef(null);
55
+ const installedAppsRef = useRef([]);
56
+ const pendingRestoreRef = useRef(null);
57
+ const open = useCallback(def => {
58
+ let resolvedId = "";
59
+ setOpenApps(current => {
60
+ const {
61
+ apps,
62
+ instanceId
63
+ } = resolveOpenAppsState(current, def, () => `${def.id}-${Date.now()}-${Math.random().toString(36).slice(2)}`);
64
+ resolvedId = instanceId;
65
+ return apps;
66
+ });
67
+ return resolvedId;
68
+ }, []);
69
+ const tryRestorePending = useCallback(() => {
70
+ if (isRestored) return;
71
+ if (!installedAppsRef.current.length) return;
72
+ const pendingApps = pendingRestoreRef.current;
73
+ if (!pendingApps || pendingApps.length === 0) {
74
+ setIsRestored(true);
75
+ return;
76
+ }
77
+ pendingRestoreRef.current = null;
78
+ pendingApps.forEach(({
79
+ id: appId,
80
+ minimized
81
+ }) => {
82
+ const appDef = installedAppsRef.current.find(app => app.id === appId);
83
+ if (appDef && appDef.component) {
84
+ const resolvedIcon = typeof appDef.icon === "function" ? appDef.icon(20) : appDef.icon;
85
+ open({
86
+ id: appDef.id,
87
+ title: appDef.name,
88
+ component: appDef.component,
89
+ props: appDef.props,
90
+ launchMode: appDef.launchMode || "self-modal",
91
+ singleton: appDef.singleton,
92
+ icon: resolvedIcon,
93
+ color: appDef.color,
94
+ minimized
95
+ });
96
+ }
97
+ });
98
+ setIsRestored(true);
99
+ }, [isRestored, open]);
100
+
101
+ // Restore open apps on mount. Handles both the legacy `string[]` shape and
102
+ // the current `{id, minimized}[]` shape — same tolerance as native.
103
+ useEffect(() => {
104
+ const restoreOpenApps = async () => {
105
+ try {
106
+ const saved = await persistentStorage.getItem(STORAGE_KEY_OPEN_APPS);
107
+ if (saved) {
108
+ const parsed = JSON.parse(saved);
109
+ let savedApps;
110
+ if (Array.isArray(parsed) && parsed.length > 0) {
111
+ if (typeof parsed[0] === "string") {
112
+ savedApps = parsed.map(id => ({
113
+ id,
114
+ minimized: false
115
+ }));
116
+ } else {
117
+ savedApps = parsed;
118
+ }
119
+ if (savedApps.length) {
120
+ pendingRestoreRef.current = savedApps;
121
+ tryRestorePending();
122
+ return;
123
+ }
124
+ }
125
+ }
126
+ } catch {
127
+ // Failed to restore open apps - continue with fresh state
128
+ }
129
+ setIsRestored(true);
130
+ };
131
+ restoreOpenApps();
132
+ }, [tryRestorePending]);
133
+
134
+ // Save open apps with debounce
135
+ useEffect(() => {
136
+ if (!isRestored) return;
137
+ if (persistenceTimeoutRef.current) {
138
+ clearTimeout(persistenceTimeoutRef.current);
139
+ }
140
+ persistenceTimeoutRef.current = setTimeout(() => {
141
+ const appStates = openApps.map(app => ({
142
+ id: app.id,
143
+ minimized: app.minimized ?? false
144
+ }));
145
+ persistentStorage.setItem(STORAGE_KEY_OPEN_APPS, JSON.stringify(appStates));
146
+ }, PERSISTENCE_DELAY);
147
+ return () => {
148
+ if (persistenceTimeoutRef.current) {
149
+ clearTimeout(persistenceTimeoutRef.current);
150
+ }
151
+ };
152
+ }, [openApps, isRestored]);
153
+
154
+ // Store reference to installed apps for restoration
155
+ const registerApps = useCallback(apps => {
156
+ installedAppsRef.current = apps;
157
+ tryRestorePending();
158
+ }, [tryRestorePending]);
159
+ const close = useCallback(instanceId => {
160
+ setOpenApps(s => {
161
+ if (!s.length) return s;
162
+ if (!instanceId) return s.slice(0, -1);
163
+ return s.filter(a => a.instanceId !== instanceId);
164
+ });
165
+ }, []);
166
+ const closeAll = useCallback(() => setOpenApps([]), []);
167
+ const minimize = useCallback(instanceId => {
168
+ setOpenApps(s => s.map(app => app.instanceId === instanceId ? {
169
+ ...app,
170
+ minimized: true
171
+ } : app));
172
+ }, []);
173
+ const restore = useCallback(instanceId => {
174
+ setOpenApps(s => s.map(app => app.instanceId === instanceId ? {
175
+ ...app,
176
+ minimized: false
177
+ } : app));
178
+ }, []);
179
+ const isMinimized = useCallback(instanceId => {
180
+ const app = openApps.find(a => a.instanceId === instanceId);
181
+ return app?.minimized ?? false;
182
+ }, [openApps]);
183
+
184
+ // Escape closes the top-most open tool — web analog of the native
185
+ // hardware-back handler.
186
+ const hasVisibleApps = openApps.some(app => app.launchMode !== "toggle-only" && !app.minimized);
187
+ useEffect(() => {
188
+ if (!hasVisibleApps) return;
189
+ const handler = event => {
190
+ if (event.key !== "Escape") return;
191
+ close();
192
+ };
193
+ window.addEventListener("keydown", handler);
194
+ return () => window.removeEventListener("keydown", handler);
195
+ }, [hasVisibleApps, close]);
196
+ const value = useMemo(() => ({
197
+ openApps,
198
+ isAnyOpen: hasVisibleApps,
199
+ open,
200
+ close,
201
+ closeAll,
202
+ registerApps,
203
+ minimize,
204
+ restore,
205
+ isMinimized
206
+ }), [openApps, hasVisibleApps, open, close, closeAll, registerApps, minimize, restore, isMinimized]);
207
+ return /*#__PURE__*/_jsx(AppHostContext.Provider, {
208
+ value: value,
209
+ children: children
210
+ });
211
+ };
212
+
213
+ /**
214
+ * Accessor hook for the web app host. Falls back to a no-op implementation
215
+ * when rendered outside the provider — same contract as native.
216
+ */
217
+ export const useAppHost = () => {
218
+ const ctx = useContext(AppHostContext);
219
+ if (!ctx) {
220
+ return {
221
+ openApps: [],
222
+ isAnyOpen: false,
223
+ open: () => "",
224
+ close: () => {},
225
+ closeAll: () => {},
226
+ registerApps: () => {},
227
+ minimize: () => {},
228
+ restore: () => {},
229
+ isMinimized: () => false
230
+ };
231
+ }
232
+ return ctx;
233
+ };
234
+
235
+ // Base z-index for tool surfaces — parity with native AppOverlay.
236
+ const BASE_ZINDEX = 9000;
237
+ // The dock sits above tool panels but below the dial/settings overlays (10000).
238
+
239
+ const backdropStyle = {
240
+ position: "fixed",
241
+ inset: 0,
242
+ backgroundColor: "rgba(0,0,0,0.28)",
243
+ display: "flex",
244
+ alignItems: "center",
245
+ justifyContent: "center"
246
+ };
247
+ const cardStyle = {
248
+ maxHeight: "90%",
249
+ width: "94%",
250
+ borderRadius: 12,
251
+ backgroundColor: "white",
252
+ overflow: "hidden"
253
+ };
254
+
255
+ /**
256
+ * Renders a single app instance — DOM twin of the native `AppRenderer`.
257
+ * Keeps the component mounted while minimized (visible={false} /
258
+ * display:none) so tool state and listeners survive, like native.
259
+ */
260
+ const AppRenderer = ({
261
+ app,
262
+ zIndex,
263
+ onClose,
264
+ onMinimize,
265
+ minimizeTargetPosition
266
+ }) => {
267
+ const Comp = app.component;
268
+ const isVisible = !app.minimized;
269
+ if (app.launchMode === "self-modal") {
270
+ return /*#__PURE__*/_jsx(Comp, {
271
+ ...(app.props ?? {}),
272
+ visible: isVisible,
273
+ onClose: onClose,
274
+ onRequestClose: onClose,
275
+ onMinimize: onMinimize,
276
+ minimizeTargetPosition: minimizeTargetPosition,
277
+ instanceId: app.instanceId,
278
+ zIndex: zIndex
279
+ });
280
+ }
281
+ if (app.launchMode === "inline") {
282
+ if (!isVisible) return null;
283
+ // pointerEvents:none matches native box-none: the layer never eats input;
284
+ // inline tool components opt back in with pointerEvents:auto on their own
285
+ // interactive surfaces.
286
+ return /*#__PURE__*/_jsx("div", {
287
+ style: {
288
+ position: "fixed",
289
+ inset: 0,
290
+ zIndex,
291
+ pointerEvents: "none"
292
+ },
293
+ children: /*#__PURE__*/_jsx(Comp, {
294
+ ...(app.props ?? {}),
295
+ onClose: onClose,
296
+ onMinimize: onMinimize,
297
+ minimizeTargetPosition: minimizeTargetPosition,
298
+ instanceId: app.instanceId
299
+ })
300
+ });
301
+ }
302
+
303
+ // host-modal mode
304
+ return /*#__PURE__*/_jsx("div", {
305
+ style: {
306
+ ...backdropStyle,
307
+ zIndex,
308
+ display: isVisible ? "flex" : "none"
309
+ },
310
+ children: /*#__PURE__*/_jsx("div", {
311
+ style: cardStyle,
312
+ children: /*#__PURE__*/_jsx(Comp, {
313
+ ...(app.props ?? {}),
314
+ onClose: onClose,
315
+ onMinimize: onMinimize,
316
+ minimizeTargetPosition: minimizeTargetPosition,
317
+ instanceId: app.instanceId
318
+ })
319
+ })
320
+ });
321
+ };
322
+
323
+ /**
324
+ * Renders all open dev tool surfaces — DOM twin of the native `AppOverlay`.
325
+ * Later-opened tools stack on top (base z 9000 + index). Minimized tools are
326
+ * shown by the MinimizedToolsStack fused to the floating bubble (native
327
+ * parity) — the old fixed bottom-right MinimizedDock was replaced by it.
328
+ */
329
+ export const AppOverlay = () => {
330
+ const {
331
+ openApps,
332
+ close,
333
+ minimize
334
+ } = useAppHost();
335
+ const renderableApps = openApps.filter(app => app.launchMode !== "toggle-only");
336
+ if (renderableApps.length === 0) return null;
337
+ const minimizedCount = renderableApps.filter(app => app.minimized).length;
338
+
339
+ // Minimize animation shrinks toward the bubble (where the stack lives);
340
+ // fall back to the legacy dock slot if the bubble hasn't mounted yet.
341
+ const minimizeTarget = getBubbleAnchorPosition() ?? dockIconPosition(minimizedCount);
342
+ return /*#__PURE__*/_jsx(_Fragment, {
343
+ children: renderableApps.map((app, index) => /*#__PURE__*/_jsx(AppRenderer, {
344
+ app: app,
345
+ zIndex: BASE_ZINDEX + index,
346
+ onClose: () => close(app.instanceId),
347
+ onMinimize: () => minimize(app.instanceId),
348
+ minimizeTargetPosition: minimizeTarget
349
+ }, app.instanceId))
350
+ });
351
+ };
@@ -1,5 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ /**
4
+ * Modal state to restore when reopening a minimized tool. Defined here (the
5
+ * platform-free logic module) so the web host doesn't pull in the native
6
+ * MinimizedToolsContext; that file re-exports this type for back-compat.
7
+ */
8
+
3
9
  /**
4
10
  * Computes the new list of open tool instances when a user launches a dev app. Singleton
5
11
  * tools reuse their existing instance while non-singletons create a new entry using the