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