@buoy-gg/core 7.0.40 → 7.0.42
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 +14 -85
- package/bin/buoy.js +20 -347
- package/lib/commonjs/Buoy.js +1 -107
- package/lib/commonjs/browserRegister.js +1 -0
- package/lib/commonjs/browserRegister.server.js +1 -0
- package/lib/commonjs/earlyHookScript.js +1 -0
- package/lib/commonjs/earlyNetwork.js +1 -0
- package/lib/commonjs/floatingMenu/AppHost.js +1 -460
- package/lib/commonjs/floatingMenu/AppHost.web.js +1 -364
- package/lib/commonjs/floatingMenu/AppHostLogic.js +1 -50
- package/lib/commonjs/floatingMenu/AppIcon.js +1 -91
- package/lib/commonjs/floatingMenu/AppIcon.web.js +1 -53
- package/lib/commonjs/floatingMenu/BrowserToolRuntime.js +1 -0
- package/lib/commonjs/floatingMenu/DefaultConfigContext.js +1 -45
- package/lib/commonjs/floatingMenu/DevToolsSettingsModal.js +1 -1119
- package/lib/commonjs/floatingMenu/DevToolsSettingsModal.shared.js +1 -0
- package/lib/commonjs/floatingMenu/DevToolsSettingsModal.web.js +1 -1048
- package/lib/commonjs/floatingMenu/DevToolsVisibilityContext.js +1 -49
- package/lib/commonjs/floatingMenu/FloatingDevTools.js +1 -554
- package/lib/commonjs/floatingMenu/FloatingDevTools.web.js +1 -401
- package/lib/commonjs/floatingMenu/FloatingMenu.js +1 -371
- package/lib/commonjs/floatingMenu/MinimizedToolsContext.js +1 -274
- package/lib/commonjs/floatingMenu/MinimizedToolsStack.js +1 -288
- package/lib/commonjs/floatingMenu/MinimizedToolsStack.web.js +1 -371
- package/lib/commonjs/floatingMenu/ToggleStateManager.js +1 -36
- package/lib/commonjs/floatingMenu/ToolHost.js +1 -281
- package/lib/commonjs/floatingMenu/ToolOpenerBridge.js +1 -41
- package/lib/commonjs/floatingMenu/autoDiscoverPresets.js +1 -461
- package/lib/commonjs/floatingMenu/autoExternalSync.js +1 -434
- package/lib/commonjs/floatingMenu/defaultConfig.js +1 -167
- package/lib/commonjs/floatingMenu/deviceIdentity.js +1 -173
- package/lib/commonjs/floatingMenu/dial/DialDevTools.js +1 -904
- package/lib/commonjs/floatingMenu/dial/DialDevTools.web.js +1 -821
- package/lib/commonjs/floatingMenu/dial/DialHyperspace.js +1 -177
- package/lib/commonjs/floatingMenu/dial/DialIcon.js +1 -302
- package/lib/commonjs/floatingMenu/dial/DialPagination.js +1 -165
- package/lib/commonjs/floatingMenu/dial/DialSnow.js +1 -92
- package/lib/commonjs/floatingMenu/dial/OnboardingTooltip.js +1 -246
- package/lib/commonjs/floatingMenu/dial/OnboardingTooltip.web.js +2 -147
- package/lib/commonjs/floatingMenu/dial/dialUsageStore.js +1 -93
- package/lib/commonjs/floatingMenu/dial/onboardingConstants.js +1 -42
- package/lib/commonjs/floatingMenu/dial/onboardingConstants.web.js +1 -42
- package/lib/commonjs/floatingMenu/externalSyncGate.js +1 -49
- package/lib/commonjs/floatingMenu/floatingTools.js +1 -42
- package/lib/commonjs/floatingMenu/floatingTools.web.js +1 -30
- package/lib/commonjs/floatingMenu/optionalRequire.js +1 -37
- package/lib/commonjs/floatingMenu/settingsBus.js +1 -23
- package/lib/commonjs/floatingMenu/sync/appSyncAdapter.js +1 -115
- package/lib/commonjs/floatingMenu/types.js +1 -5
- package/lib/commonjs/floatingMenu/useDesktopSyncStatus.js +1 -28
- package/lib/commonjs/floatingMenu/useDesktopSyncStatus.web.js +1 -0
- package/lib/commonjs/index.js +1 -291
- package/lib/commonjs/index.web.js +1 -150
- package/lib/commonjs/reactDevtoolsTypes.js +1 -0
- package/lib/commonjs/releaseOptIn.js +1 -0
- package/lib/commonjs/telemetry/installPing.js +1 -131
- package/lib/commonjs/toolkit.js +1 -584
- package/lib/commonjs/toolkitComponents.js +1 -241
- package/lib/commonjs/utils/autoDiscoverPresets.web.js +1 -219
- package/lib/commonjs/utils/createWebTool.js +1 -0
- package/lib/commonjs/utils/createWebTools.js +1 -0
- package/lib/commonjs/version.js +1 -18
- package/lib/module/Buoy.js +1 -102
- package/lib/module/browserRegister.js +1 -0
- package/lib/module/browserRegister.server.js +1 -0
- package/lib/module/earlyHookScript.js +1 -0
- package/lib/module/earlyNetwork.js +1 -0
- package/lib/module/floatingMenu/AppHost.js +1 -452
- package/lib/module/floatingMenu/AppHost.web.js +1 -356
- package/lib/module/floatingMenu/AppHostLogic.js +1 -45
- package/lib/module/floatingMenu/AppIcon.js +1 -84
- package/lib/module/floatingMenu/AppIcon.web.js +1 -47
- package/lib/module/floatingMenu/BrowserToolRuntime.js +1 -0
- package/lib/module/floatingMenu/DefaultConfigContext.js +1 -39
- package/lib/module/floatingMenu/DevToolsSettingsModal.js +1 -1115
- package/lib/module/floatingMenu/DevToolsSettingsModal.shared.js +1 -0
- package/lib/module/floatingMenu/DevToolsSettingsModal.web.js +1 -1055
- package/lib/module/floatingMenu/DevToolsVisibilityContext.js +1 -44
- package/lib/module/floatingMenu/FloatingDevTools.js +1 -551
- package/lib/module/floatingMenu/FloatingDevTools.web.js +1 -399
- package/lib/module/floatingMenu/FloatingMenu.js +1 -366
- package/lib/module/floatingMenu/MinimizedToolsContext.js +1 -266
- package/lib/module/floatingMenu/MinimizedToolsStack.js +1 -285
- package/lib/module/floatingMenu/MinimizedToolsStack.web.js +1 -368
- package/lib/module/floatingMenu/ToggleStateManager.js +1 -32
- package/lib/module/floatingMenu/ToolHost.js +1 -273
- package/lib/module/floatingMenu/ToolOpenerBridge.js +1 -37
- package/lib/module/floatingMenu/autoDiscoverPresets.js +1 -457
- package/lib/module/floatingMenu/autoExternalSync.js +1 -427
- package/lib/module/floatingMenu/defaultConfig.js +1 -158
- package/lib/module/floatingMenu/deviceIdentity.js +1 -163
- package/lib/module/floatingMenu/dial/DialDevTools.js +1 -900
- package/lib/module/floatingMenu/dial/DialDevTools.web.js +1 -818
- package/lib/module/floatingMenu/dial/DialHyperspace.js +1 -173
- package/lib/module/floatingMenu/dial/DialIcon.js +1 -299
- package/lib/module/floatingMenu/dial/DialPagination.js +1 -160
- package/lib/module/floatingMenu/dial/DialSnow.js +1 -90
- package/lib/module/floatingMenu/dial/OnboardingTooltip.js +1 -240
- package/lib/module/floatingMenu/dial/OnboardingTooltip.web.js +2 -142
- package/lib/module/floatingMenu/dial/dialUsageStore.js +1 -85
- package/lib/module/floatingMenu/dial/onboardingConstants.js +1 -3
- package/lib/module/floatingMenu/dial/onboardingConstants.web.js +1 -3
- package/lib/module/floatingMenu/externalSyncGate.js +1 -44
- package/lib/module/floatingMenu/floatingTools.js +1 -27
- package/lib/module/floatingMenu/floatingTools.web.js +1 -3
- package/lib/module/floatingMenu/optionalRequire.js +1 -33
- package/lib/module/floatingMenu/settingsBus.js +1 -19
- package/lib/module/floatingMenu/sync/appSyncAdapter.js +1 -112
- package/lib/module/floatingMenu/types.js +1 -3
- package/lib/module/floatingMenu/useDesktopSyncStatus.js +1 -25
- package/lib/module/floatingMenu/useDesktopSyncStatus.web.js +1 -0
- package/lib/module/index.js +1 -41
- package/lib/module/index.web.js +1 -29
- package/lib/module/reactDevtoolsTypes.js +1 -0
- package/lib/module/releaseOptIn.js +1 -0
- package/lib/module/telemetry/installPing.js +1 -127
- package/lib/module/toolkit.js +1 -62
- package/lib/module/toolkitComponents.js +1 -230
- package/lib/module/utils/autoDiscoverPresets.web.js +1 -213
- package/lib/module/utils/createWebTool.js +1 -0
- package/lib/module/utils/createWebTools.js +1 -0
- package/lib/module/version.js +1 -14
- package/lib/typescript/commonjs/browserRegister.d.ts +13 -0
- package/lib/typescript/commonjs/browserRegister.server.d.ts +6 -0
- package/lib/typescript/commonjs/earlyHookScript.d.ts +12 -0
- package/lib/typescript/commonjs/earlyNetwork.d.ts +52 -0
- package/lib/typescript/commonjs/floatingMenu/AppHost.web.d.ts +3 -3
- package/lib/typescript/commonjs/floatingMenu/BrowserToolRuntime.d.ts +14 -0
- package/lib/typescript/commonjs/floatingMenu/DevToolsSettingsModal.d.ts +2 -67
- package/lib/typescript/commonjs/floatingMenu/DevToolsSettingsModal.shared.d.ts +71 -0
- package/lib/typescript/commonjs/floatingMenu/DevToolsSettingsModal.web.d.ts +3 -16
- package/lib/typescript/commonjs/floatingMenu/FloatingDevTools.web.d.ts +12 -6
- package/lib/typescript/commonjs/floatingMenu/defaultConfig.d.ts +1 -1
- package/lib/typescript/commonjs/floatingMenu/settingsBus.d.ts +1 -9
- package/lib/typescript/commonjs/floatingMenu/useDesktopSyncStatus.web.d.ts +3 -0
- package/lib/typescript/commonjs/index.web.d.ts +7 -0
- package/lib/typescript/commonjs/reactDevtoolsTypes.d.ts +8 -0
- package/lib/typescript/commonjs/releaseOptIn.d.ts +4 -0
- package/lib/typescript/commonjs/utils/autoDiscoverPresets.web.d.ts +3 -40
- package/lib/typescript/commonjs/utils/createWebTool.d.ts +6 -0
- package/lib/typescript/commonjs/utils/createWebTools.d.ts +4 -0
- package/lib/typescript/commonjs/version.d.ts +1 -1
- package/lib/typescript/module/browserRegister.d.ts +13 -0
- package/lib/typescript/module/browserRegister.server.d.ts +6 -0
- package/lib/typescript/module/earlyHookScript.d.ts +12 -0
- package/lib/typescript/module/earlyNetwork.d.ts +52 -0
- package/lib/typescript/module/floatingMenu/AppHost.web.d.ts +3 -3
- package/lib/typescript/module/floatingMenu/BrowserToolRuntime.d.ts +14 -0
- package/lib/typescript/module/floatingMenu/DevToolsSettingsModal.d.ts +2 -67
- package/lib/typescript/module/floatingMenu/DevToolsSettingsModal.shared.d.ts +71 -0
- package/lib/typescript/module/floatingMenu/DevToolsSettingsModal.web.d.ts +3 -16
- package/lib/typescript/module/floatingMenu/FloatingDevTools.web.d.ts +12 -6
- package/lib/typescript/module/floatingMenu/defaultConfig.d.ts +1 -1
- package/lib/typescript/module/floatingMenu/settingsBus.d.ts +1 -9
- package/lib/typescript/module/floatingMenu/useDesktopSyncStatus.web.d.ts +3 -0
- package/lib/typescript/module/index.web.d.ts +7 -0
- package/lib/typescript/module/reactDevtoolsTypes.d.ts +8 -0
- package/lib/typescript/module/releaseOptIn.d.ts +4 -0
- package/lib/typescript/module/utils/autoDiscoverPresets.web.d.ts +3 -40
- package/lib/typescript/module/utils/createWebTool.d.ts +6 -0
- package/lib/typescript/module/utils/createWebTools.d.ts +4 -0
- package/lib/typescript/module/version.d.ts +1 -1
- package/lib/web/chunks/chunk-5SGL6QL4.mjs +1 -0
- package/lib/web/chunks/chunk-FROELTJH.mjs +1 -0
- package/lib/web/chunks/chunk-QZDVCMCT.mjs +1 -0
- package/lib/web/chunks/chunk-R7RGRTY5.mjs +1 -0
- package/lib/web/index.mjs +10 -0
- package/lib/web/register-server.mjs +1 -0
- package/lib/web/register.mjs +1 -0
- package/lib/web/toolkit.mjs +1 -0
- package/package.json +50 -12
- package/lib/typescript/commonjs/Buoy.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/AppHost.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/AppHost.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/AppHostLogic.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/AppIcon.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/AppIcon.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/DefaultConfigContext.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/DevToolsSettingsModal.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/DevToolsSettingsModal.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/DevToolsVisibilityContext.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/FloatingDevTools.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/FloatingDevTools.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/FloatingMenu.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/MinimizedToolsContext.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/MinimizedToolsStack.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/MinimizedToolsStack.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/ToggleStateManager.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/ToolHost.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/ToolOpenerBridge.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/autoDiscoverPresets.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/autoExternalSync.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/defaultConfig.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/deviceIdentity.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/DialDevTools.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/DialDevTools.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/DialHyperspace.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/DialIcon.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/DialPagination.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/DialSnow.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/OnboardingTooltip.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/OnboardingTooltip.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/dialUsageStore.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/onboardingConstants.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/onboardingConstants.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/externalSyncGate.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/floatingTools.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/floatingTools.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/optionalRequire.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/settingsBus.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/sync/appSyncAdapter.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/types.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/useDesktopSyncStatus.d.ts.map +0 -1
- package/lib/typescript/commonjs/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/index.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/telemetry/installPing.d.ts.map +0 -1
- package/lib/typescript/commonjs/toolkit.d.ts.map +0 -1
- package/lib/typescript/commonjs/toolkitComponents.d.ts.map +0 -1
- package/lib/typescript/commonjs/utils/autoDiscoverPresets.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/version.d.ts.map +0 -1
- package/lib/typescript/module/Buoy.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/AppHost.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/AppHost.web.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/AppHostLogic.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/AppIcon.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/AppIcon.web.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/DefaultConfigContext.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/DevToolsSettingsModal.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/DevToolsSettingsModal.web.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/DevToolsVisibilityContext.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/FloatingDevTools.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/FloatingDevTools.web.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/FloatingMenu.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/MinimizedToolsContext.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/MinimizedToolsStack.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/MinimizedToolsStack.web.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/ToggleStateManager.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/ToolHost.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/ToolOpenerBridge.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/autoDiscoverPresets.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/autoExternalSync.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/defaultConfig.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/deviceIdentity.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/DialDevTools.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/DialDevTools.web.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/DialHyperspace.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/DialIcon.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/DialPagination.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/DialSnow.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/OnboardingTooltip.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/OnboardingTooltip.web.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/dialUsageStore.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/onboardingConstants.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/onboardingConstants.web.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/externalSyncGate.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/floatingTools.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/floatingTools.web.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/optionalRequire.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/settingsBus.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/sync/appSyncAdapter.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/types.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/useDesktopSyncStatus.d.ts.map +0 -1
- package/lib/typescript/module/index.d.ts.map +0 -1
- package/lib/typescript/module/index.web.d.ts.map +0 -1
- package/lib/typescript/module/telemetry/installPing.d.ts.map +0 -1
- package/lib/typescript/module/toolkit.d.ts.map +0 -1
- package/lib/typescript/module/toolkitComponents.d.ts.map +0 -1
- package/lib/typescript/module/utils/autoDiscoverPresets.web.d.ts.map +0 -1
- package/lib/typescript/module/version.d.ts.map +0 -1
|
@@ -1,356 +1 @@
|
|
|
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 { renderAppIcon } from "./AppIcon";
|
|
29
|
-
import { getBubbleAnchorPosition } from "./floatingTools.web.js";
|
|
30
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
31
|
-
const AppHostContext = /*#__PURE__*/createContext(null);
|
|
32
|
-
const STORAGE_KEY_OPEN_APPS = "@react_buoy_open_apps";
|
|
33
|
-
const PERSISTENCE_DELAY = 500;
|
|
34
|
-
|
|
35
|
-
// Minimized dock geometry — mirrors MinimizedToolsContext.tsx constants.
|
|
36
|
-
const ICON_SIZE = 44;
|
|
37
|
-
const ICON_GAP = 12;
|
|
38
|
-
const BOTTOM_OFFSET = 100;
|
|
39
|
-
const RIGHT_OFFSET = 16;
|
|
40
|
-
const dockIconPosition = index => ({
|
|
41
|
-
x: window.innerWidth - ICON_SIZE - RIGHT_OFFSET,
|
|
42
|
-
y: window.innerHeight - BOTTOM_OFFSET - ICON_SIZE - index * (ICON_SIZE + ICON_GAP)
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Provides the floating dev tools application host for web. Tracks open tool
|
|
47
|
-
* instances, restores persisted state, and exposes the same imperative
|
|
48
|
-
* helpers as the native `AppHostProvider`.
|
|
49
|
-
*/
|
|
50
|
-
export const AppHostProvider = ({
|
|
51
|
-
children
|
|
52
|
-
}) => {
|
|
53
|
-
const [openApps, setOpenApps] = useState([]);
|
|
54
|
-
const [isRestored, setIsRestored] = useState(false);
|
|
55
|
-
const persistenceTimeoutRef = useRef(null);
|
|
56
|
-
const installedAppsRef = useRef([]);
|
|
57
|
-
const pendingRestoreRef = useRef(null);
|
|
58
|
-
const open = useCallback(def => {
|
|
59
|
-
let resolvedId = "";
|
|
60
|
-
setOpenApps(current => {
|
|
61
|
-
const {
|
|
62
|
-
apps,
|
|
63
|
-
instanceId
|
|
64
|
-
} = resolveOpenAppsState(current, def, () => `${def.id}-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
|
65
|
-
resolvedId = instanceId;
|
|
66
|
-
return apps;
|
|
67
|
-
});
|
|
68
|
-
return resolvedId;
|
|
69
|
-
}, []);
|
|
70
|
-
const tryRestorePending = useCallback(() => {
|
|
71
|
-
if (isRestored) return;
|
|
72
|
-
if (!installedAppsRef.current.length) return;
|
|
73
|
-
const pendingApps = pendingRestoreRef.current;
|
|
74
|
-
if (!pendingApps || pendingApps.length === 0) {
|
|
75
|
-
setIsRestored(true);
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
pendingRestoreRef.current = null;
|
|
79
|
-
pendingApps.forEach(({
|
|
80
|
-
id: appId,
|
|
81
|
-
minimized
|
|
82
|
-
}) => {
|
|
83
|
-
const appDef = installedAppsRef.current.find(app => app.id === appId);
|
|
84
|
-
if (appDef && appDef.component) {
|
|
85
|
-
const resolvedIcon = renderAppIcon(appDef.icon, {
|
|
86
|
-
slot: "dial",
|
|
87
|
-
size: 20,
|
|
88
|
-
color: appDef.color
|
|
89
|
-
});
|
|
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
|
-
useEffect(() => {
|
|
109
|
-
const restoreOpenApps = async () => {
|
|
110
|
-
try {
|
|
111
|
-
const saved = await 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
|
-
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
|
-
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 = useCallback(apps => {
|
|
161
|
-
installedAppsRef.current = apps;
|
|
162
|
-
tryRestorePending();
|
|
163
|
-
}, [tryRestorePending]);
|
|
164
|
-
const close = 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 = useCallback(() => setOpenApps([]), []);
|
|
172
|
-
const minimize = useCallback(instanceId => {
|
|
173
|
-
setOpenApps(s => s.map(app => app.instanceId === instanceId ? {
|
|
174
|
-
...app,
|
|
175
|
-
minimized: true
|
|
176
|
-
} : app));
|
|
177
|
-
}, []);
|
|
178
|
-
const restore = useCallback(instanceId => {
|
|
179
|
-
setOpenApps(s => s.map(app => app.instanceId === instanceId ? {
|
|
180
|
-
...app,
|
|
181
|
-
minimized: false
|
|
182
|
-
} : app));
|
|
183
|
-
}, []);
|
|
184
|
-
const isMinimized = 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
|
-
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 = 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__*/_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
|
-
export const useAppHost = () => {
|
|
223
|
-
const ctx = useContext(AppHostContext);
|
|
224
|
-
if (!ctx) {
|
|
225
|
-
return {
|
|
226
|
-
openApps: [],
|
|
227
|
-
isAnyOpen: false,
|
|
228
|
-
open: () => "",
|
|
229
|
-
close: () => {},
|
|
230
|
-
closeAll: () => {},
|
|
231
|
-
registerApps: () => {},
|
|
232
|
-
minimize: () => {},
|
|
233
|
-
restore: () => {},
|
|
234
|
-
isMinimized: () => false
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
return ctx;
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
// Base z-index for tool surfaces — parity with native AppOverlay.
|
|
241
|
-
const BASE_ZINDEX = 9000;
|
|
242
|
-
// The dock sits above tool panels but below the dial/settings overlays (10000).
|
|
243
|
-
|
|
244
|
-
const backdropStyle = {
|
|
245
|
-
position: "fixed",
|
|
246
|
-
inset: 0,
|
|
247
|
-
backgroundColor: "rgba(0,0,0,0.28)",
|
|
248
|
-
display: "flex",
|
|
249
|
-
alignItems: "center",
|
|
250
|
-
justifyContent: "center"
|
|
251
|
-
};
|
|
252
|
-
const cardStyle = {
|
|
253
|
-
maxHeight: "90%",
|
|
254
|
-
width: "94%",
|
|
255
|
-
borderRadius: 12,
|
|
256
|
-
backgroundColor: "white",
|
|
257
|
-
overflow: "hidden"
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Renders a single app instance — DOM twin of the native `AppRenderer`.
|
|
262
|
-
* Keeps the component mounted while minimized (visible={false} /
|
|
263
|
-
* display:none) so tool state and listeners survive, like native.
|
|
264
|
-
*/
|
|
265
|
-
const AppRenderer = ({
|
|
266
|
-
app,
|
|
267
|
-
zIndex,
|
|
268
|
-
onClose,
|
|
269
|
-
onMinimize,
|
|
270
|
-
minimizeTargetPosition
|
|
271
|
-
}) => {
|
|
272
|
-
const Comp = app.component;
|
|
273
|
-
const isVisible = !app.minimized;
|
|
274
|
-
if (app.launchMode === "self-modal") {
|
|
275
|
-
return /*#__PURE__*/_jsx(Comp, {
|
|
276
|
-
...(app.props ?? {}),
|
|
277
|
-
visible: isVisible,
|
|
278
|
-
onClose: onClose,
|
|
279
|
-
onRequestClose: onClose,
|
|
280
|
-
onMinimize: onMinimize,
|
|
281
|
-
minimizeTargetPosition: minimizeTargetPosition,
|
|
282
|
-
instanceId: app.instanceId,
|
|
283
|
-
zIndex: zIndex
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
if (app.launchMode === "inline") {
|
|
287
|
-
if (!isVisible) return null;
|
|
288
|
-
// pointerEvents:none matches native box-none: the layer never eats input;
|
|
289
|
-
// inline tool components opt back in with pointerEvents:auto on their own
|
|
290
|
-
// interactive surfaces.
|
|
291
|
-
return /*#__PURE__*/_jsx("div", {
|
|
292
|
-
style: {
|
|
293
|
-
position: "fixed",
|
|
294
|
-
inset: 0,
|
|
295
|
-
zIndex,
|
|
296
|
-
pointerEvents: "none"
|
|
297
|
-
},
|
|
298
|
-
children: /*#__PURE__*/_jsx(Comp, {
|
|
299
|
-
...(app.props ?? {}),
|
|
300
|
-
onClose: onClose,
|
|
301
|
-
onMinimize: onMinimize,
|
|
302
|
-
minimizeTargetPosition: minimizeTargetPosition,
|
|
303
|
-
instanceId: app.instanceId
|
|
304
|
-
})
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
// host-modal mode
|
|
309
|
-
return /*#__PURE__*/_jsx("div", {
|
|
310
|
-
style: {
|
|
311
|
-
...backdropStyle,
|
|
312
|
-
zIndex,
|
|
313
|
-
display: isVisible ? "flex" : "none"
|
|
314
|
-
},
|
|
315
|
-
children: /*#__PURE__*/_jsx("div", {
|
|
316
|
-
style: cardStyle,
|
|
317
|
-
children: /*#__PURE__*/_jsx(Comp, {
|
|
318
|
-
...(app.props ?? {}),
|
|
319
|
-
onClose: onClose,
|
|
320
|
-
onMinimize: onMinimize,
|
|
321
|
-
minimizeTargetPosition: minimizeTargetPosition,
|
|
322
|
-
instanceId: app.instanceId
|
|
323
|
-
})
|
|
324
|
-
})
|
|
325
|
-
});
|
|
326
|
-
};
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* Renders all open dev tool surfaces — DOM twin of the native `AppOverlay`.
|
|
330
|
-
* Later-opened tools stack on top (base z 9000 + index). Minimized tools are
|
|
331
|
-
* shown by the MinimizedToolsStack fused to the floating bubble (native
|
|
332
|
-
* parity) — the old fixed bottom-right MinimizedDock was replaced by it.
|
|
333
|
-
*/
|
|
334
|
-
export const AppOverlay = () => {
|
|
335
|
-
const {
|
|
336
|
-
openApps,
|
|
337
|
-
close,
|
|
338
|
-
minimize
|
|
339
|
-
} = useAppHost();
|
|
340
|
-
const renderableApps = openApps.filter(app => app.launchMode !== "toggle-only");
|
|
341
|
-
if (renderableApps.length === 0) return null;
|
|
342
|
-
const minimizedCount = renderableApps.filter(app => app.minimized).length;
|
|
343
|
-
|
|
344
|
-
// Minimize animation shrinks toward the bubble (where the stack lives);
|
|
345
|
-
// fall back to the legacy dock slot if the bubble hasn't mounted yet.
|
|
346
|
-
const minimizeTarget = getBubbleAnchorPosition() ?? dockIconPosition(minimizedCount);
|
|
347
|
-
return /*#__PURE__*/_jsx(_Fragment, {
|
|
348
|
-
children: renderableApps.map((app, index) => /*#__PURE__*/_jsx(AppRenderer, {
|
|
349
|
-
app: app,
|
|
350
|
-
zIndex: BASE_ZINDEX + index,
|
|
351
|
-
onClose: () => close(app.instanceId),
|
|
352
|
-
onMinimize: () => minimize(app.instanceId),
|
|
353
|
-
minimizeTargetPosition: minimizeTarget
|
|
354
|
-
}, app.instanceId))
|
|
355
|
-
});
|
|
356
|
-
};
|
|
1
|
+
"use strict";import{persistentStorage as P}from"@buoy-gg/shared-ui";import{createContext as D,useCallback as p,useContext as F,useEffect as M,useMemo as H,useRef as y,useState as C}from"react";import{resolveOpenAppsState as N}from"./AppHostLogic.js";import{renderAppIcon as j}from"./AppIcon";import{ToolModalShell as B}from"./ToolHost.js";import{useDevToolsSettings as G}from"./DevToolsSettingsModal.shared.js";import{getBubbleAnchorPosition as $}from"./floatingTools.web.js";import{jsx as a,Fragment as J}from"react/jsx-runtime";const _=D(null);const T="@react_buoy_open_apps";const b=44;const L=12;const V=100;const Z=16;const q=t=>({x:window.innerWidth-b-Z,y:window.innerHeight-V-b-t*(b+L)});export const AppHostProvider=({children:t})=>{const[r,l]=C([]);const[m,c]=C(false);const g=y([]);const u=y(null);const s=y(false);const f=y(false);const A=y(false);const I=p(n=>{let o="";l(i=>{const{apps:e,instanceId:d}=N(i,n,()=>`${n.id}-${Date.now()}-${Math.random().toString(36).slice(2)}`);o=d;return e});return o},[]);const S=p(()=>{if(s.current||!f.current||!A.current)return;s.current=true;const n=u.current;if(!n||n.length===0){c(true);return}u.current=null;n.forEach(({id:o,minimized:i})=>{const e=g.current.find(d=>d.id===o);if(e&&e.component){const d=j(e.icon,{slot:"dial",size:20,color:e.color});I({id:e.id,title:e.name,component:e.component,props:e.props,modal:e.modal,launchMode:e.launchMode||"self-modal",singleton:e.singleton??true,icon:d,color:e.color,minimized:i})}});c(true)},[I]);M(()=>{let n=false;const o=async()=>{try{const i=await P.getItem(T);if(n)return;if(i){const e=JSON.parse(i);let d;if(Array.isArray(e)&&e.length>0){if(typeof e[0]==="string"){d=e.map(h=>({id:h,minimized:false}))}else{d=e.filter(h=>typeof h==="object"&&h!==null&&typeof h.id==="string")}if(d.length){u.current=d}}}}catch{}if(n)return;f.current=true;S()};void o();return()=>{n=true}},[S]);M(()=>{if(!m)return;const n=r.map(o=>({id:o.id,minimized:o.minimized??false}));void P.setItem(T,JSON.stringify(n))},[r,m]);const O=p(n=>{g.current=n;A.current=true;S()},[S]);const v=p(n=>{l(o=>{if(!o.length)return o;if(!n)return o.slice(0,-1);return o.filter(i=>i.instanceId!==n)})},[]);const R=p(()=>l([]),[]);const w=p((n,o)=>{l(i=>i.map(e=>e.instanceId===n?{...e,minimized:true,restoreState:o}:e))},[]);const x=p((n,o)=>{l(i=>i.map(e=>e.instanceId===n?{...e,minimized:false,restoreState:o??e.restoreState}:e))},[]);const E=p(n=>{const o=r.find(i=>i.instanceId===n);return o?.minimized??false},[r]);const z=r.some(n=>n.launchMode!=="toggle-only"&&!n.minimized);M(()=>{if(!z)return;const n=o=>{if(o.key!=="Escape")return;if(o.defaultPrevented)return;const i=[...r].reverse().find(e=>e.launchMode!=="toggle-only"&&!e.minimized);if(i)v(i.instanceId)};window.addEventListener("keydown",n);return()=>window.removeEventListener("keydown",n)},[z,v,r]);const k=H(()=>({openApps:r,isAnyOpen:z,open:I,close:v,closeAll:R,registerApps:O,minimize:w,restore:x,isMinimized:E}),[r,z,I,v,R,O,w,x,E]);return a(_.Provider,{value:k,children:t})};export const useAppHost=()=>{const t=F(_);if(!t){return{openApps:[],isAnyOpen:false,open:()=>"",close:()=>{},closeAll:()=>{},registerApps:()=>{},minimize:()=>{},restore:()=>{},isMinimized:()=>false}}return t};const K=9e3;const W={position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.28)",display:"flex",alignItems:"center",justifyContent:"center"};const X={maxHeight:"90%",width:"94%",borderRadius:12,backgroundColor:"white",overflow:"hidden"};const Y=({app:t,zIndex:r,onClose:l,onMinimize:m,minimizeTargetPosition:c,enableSharedModalDimensions:g})=>{const u=t.component;const s=!t.minimized;const f={...t.props??{},...g?{enableSharedModalDimensions:true}:{}};if(t.modal&&(!t.launchMode||t.launchMode==="self-modal")){return a(B,{app:t,config:t.modal,visible:s,zIndex:r,onClose:l,onMinimize:m,initialModalState:t.restoreState,enableSharedModalDimensions:g,bodyProps:f})}if(t.launchMode==="self-modal"){return a(u,{...f,visible:s,onClose:l,onRequestClose:l,onMinimize:m,minimizeTargetPosition:c,instanceId:t.instanceId,zIndex:r,initialModalState:t.restoreState})}if(t.launchMode==="inline"){if(!s)return null;return a("div",{style:{position:"fixed",inset:0,zIndex:r,pointerEvents:"none"},children:a(u,{...f,onClose:l,onMinimize:m,minimizeTargetPosition:c,instanceId:t.instanceId})})}return a("div",{style:{...W,zIndex:r,display:s?"flex":"none"},children:a("div",{style:X,children:a(u,{...f,onClose:l,onMinimize:m,minimizeTargetPosition:c,instanceId:t.instanceId})})})};export const AppOverlay=()=>{const{openApps:t,close:r,minimize:l}=useAppHost();const{settings:m}=G();const c=t.filter(s=>s.launchMode!=="toggle-only");if(c.length===0)return null;const g=c.filter(s=>s.minimized).length;const u=$()??q(g);return a(J,{children:c.map((s,f)=>a(Y,{app:s,zIndex:K+f,onClose:()=>r(s.instanceId),onMinimize:A=>l(s.instanceId,A),enableSharedModalDimensions:m.globalSettings?.enableSharedModalDimensions===true,minimizeTargetPosition:u},s.instanceId))})};
|
|
@@ -1,45 +1 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Computes the new list of open tool instances when a user launches a dev app. Singleton
|
|
11
|
-
* tools reuse their existing instance while non-singletons create a new entry using the
|
|
12
|
-
* provided `generateId` helper.
|
|
13
|
-
*
|
|
14
|
-
* @param current - Current stack of open app instances.
|
|
15
|
-
* @param def - Descriptor of the tool to launch (without runtime instance id).
|
|
16
|
-
* @param generateId - Callback used to generate a unique instance identifier.
|
|
17
|
-
* @returns Updated instance list alongside the resolved instance id.
|
|
18
|
-
*/
|
|
19
|
-
export const resolveOpenAppsState = (current, def, generateId) => {
|
|
20
|
-
if (def.singleton) {
|
|
21
|
-
const existing = current.find(app => app.id === def.id);
|
|
22
|
-
if (existing) {
|
|
23
|
-
const wasMinimized = existing.minimized ?? false;
|
|
24
|
-
return {
|
|
25
|
-
instanceId: existing.instanceId,
|
|
26
|
-
wasMinimized,
|
|
27
|
-
apps: [...current.filter(app => app.instanceId !== existing.instanceId),
|
|
28
|
-
// Un-minimize the existing app when re-opening it
|
|
29
|
-
{
|
|
30
|
-
...existing,
|
|
31
|
-
minimized: false
|
|
32
|
-
}]
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
const instanceId = generateId();
|
|
37
|
-
return {
|
|
38
|
-
instanceId,
|
|
39
|
-
wasMinimized: false,
|
|
40
|
-
apps: [...current, {
|
|
41
|
-
...def,
|
|
42
|
-
instanceId
|
|
43
|
-
}]
|
|
44
|
-
};
|
|
45
|
-
};
|
|
1
|
+
"use strict";export const resolveOpenAppsState=(n,s,a)=>{if(s.singleton){const i=n.find(e=>e.id===s.id);if(i){const e=i.minimized??false;return{instanceId:i.instanceId,wasMinimized:e,apps:[...n.filter(d=>d.instanceId!==i.instanceId),{...i,minimized:false}]}}}const t=a();return{instanceId:t,wasMinimized:false,apps:[...n,{...s,instanceId:t}]}};
|
|
@@ -1,84 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Icon resolution for `InstalledApp.icon`.
|
|
5
|
-
*
|
|
6
|
-
* Custom tools may provide an icon three ways:
|
|
7
|
-
* - a component `({ slot, size }) => node` (dynamic, hook-capable)
|
|
8
|
-
* - a pre-built ReactNode
|
|
9
|
-
* - a PLAIN STRING — "AUTH", "KIT", "🗑️" — rendered as an auto-fitting text
|
|
10
|
-
* icon so simple tools never need an icon library.
|
|
11
|
-
*
|
|
12
|
-
* Every menu surface (dial, row, minimize stack, restore path) resolves icons
|
|
13
|
-
* through `renderAppIcon` so all three forms behave identically.
|
|
14
|
-
*/
|
|
15
|
-
import React from "react";
|
|
16
|
-
import { Text, View } from "react-native";
|
|
17
|
-
import { toolTheme } from "@buoy-gg/shared-ui";
|
|
18
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
-
/** Visible glyphs, not UTF-16 units — "🗑️" is one glyph, not three. */
|
|
20
|
-
function glyphCount(label) {
|
|
21
|
-
// Strip variation selectors + zero-width joiners before counting.
|
|
22
|
-
const stripped = label.replace(/[\uFE00-\uFE0F\u200D]/g, "");
|
|
23
|
-
return Math.max(Array.from(stripped).length, 1);
|
|
24
|
-
}
|
|
25
|
-
export function AppTextIcon({
|
|
26
|
-
label,
|
|
27
|
-
size,
|
|
28
|
-
color = toolTheme.colors.text
|
|
29
|
-
}) {
|
|
30
|
-
const chars = glyphCount(label);
|
|
31
|
-
// Short labels stay square; longer ones ("AUTH") get a wider box — the
|
|
32
|
-
// dial/row layouts have breathing room and the label reads better than a
|
|
33
|
-
// squashed square would. The computed font size is what fits the box on
|
|
34
|
-
// web; adjustsFontSizeToFit covers native font-metric drift.
|
|
35
|
-
const maxWidth = chars <= 2 ? size : size * 1.6;
|
|
36
|
-
const fontSize = Math.max(7, Math.min(size * (chars === 1 ? 0.7 : 0.62), maxWidth / (0.62 * chars)));
|
|
37
|
-
return /*#__PURE__*/_jsx(View, {
|
|
38
|
-
style: {
|
|
39
|
-
minWidth: size,
|
|
40
|
-
maxWidth,
|
|
41
|
-
height: size,
|
|
42
|
-
alignItems: "center",
|
|
43
|
-
justifyContent: "center"
|
|
44
|
-
},
|
|
45
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
46
|
-
numberOfLines: 1,
|
|
47
|
-
adjustsFontSizeToFit: true,
|
|
48
|
-
minimumFontScale: 0.5,
|
|
49
|
-
style: {
|
|
50
|
-
color,
|
|
51
|
-
fontSize,
|
|
52
|
-
fontWeight: "800",
|
|
53
|
-
letterSpacing: 0.5,
|
|
54
|
-
textAlign: "center"
|
|
55
|
-
},
|
|
56
|
-
children: label
|
|
57
|
-
})
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Resolve any `InstalledApp.icon` form to a renderable node. Function icons
|
|
63
|
-
* become elements (createElement — hooks keep working); strings become
|
|
64
|
-
* auto-fitting text icons; nodes pass through.
|
|
65
|
-
*/
|
|
66
|
-
export function renderAppIcon(icon, ctx) {
|
|
67
|
-
if (icon == null) return icon;
|
|
68
|
-
if (typeof icon === "function") {
|
|
69
|
-
return /*#__PURE__*/React.createElement(icon, {
|
|
70
|
-
slot: ctx.slot,
|
|
71
|
-
size: ctx.size,
|
|
72
|
-
state: ctx.state,
|
|
73
|
-
actions: ctx.actions
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
if (typeof icon === "string" || typeof icon === "number") {
|
|
77
|
-
return /*#__PURE__*/_jsx(AppTextIcon, {
|
|
78
|
-
label: String(icon),
|
|
79
|
-
size: ctx.size,
|
|
80
|
-
color: ctx.color
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
return icon;
|
|
84
|
-
}
|
|
1
|
+
"use strict";import m from"react";import{Text as u,View as a}from"react-native";import{toolTheme as l}from"@buoy-gg/shared-ui";import{jsx as n}from"react/jsx-runtime";function f(e){const t=e.replace(/[\uFE00-\uFE0F\u200D]/g,"");return Math.max(Array.from(t).length,1)}export function AppTextIcon({label:e,size:t,color:i=l.colors.text}){const r=f(e);const o=r<=2?t:t*1.6;const s=Math.max(7,Math.min(t*(r===1?.7:.62),o/(.62*r)));return n(a,{style:{minWidth:t,maxWidth:o,height:t,alignItems:"center",justifyContent:"center"},children:n(u,{numberOfLines:1,adjustsFontSizeToFit:true,minimumFontScale:.5,style:{color:i,fontSize:s,fontWeight:"800",letterSpacing:.5,textAlign:"center"},children:e})})}export function renderAppIcon(e,t){if(e==null)return e;if(typeof e==="function"){return m.createElement(e,{slot:t.slot,size:t.size,state:t.state,actions:t.actions})}if(typeof e==="string"||typeof e==="number"){return n(AppTextIcon,{label:String(e),size:t.size,color:t.color})}return e}
|
|
@@ -1,47 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { toolTheme } from "@buoy-gg/shared-ui";
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
/** DOM twin of the native icon resolver; importing RN breaks pure web hosts. */
|
|
7
|
-
export function AppTextIcon({
|
|
8
|
-
label,
|
|
9
|
-
size,
|
|
10
|
-
color = toolTheme.colors.text
|
|
11
|
-
}) {
|
|
12
|
-
const chars = Math.max(Array.from(label.replace(/[\uFE00-\uFE0F\u200D]/g, "")).length, 1);
|
|
13
|
-
const maxWidth = chars <= 2 ? size : size * 1.6;
|
|
14
|
-
const fontSize = Math.max(7, Math.min(size * (chars === 1 ? 0.7 : 0.62), maxWidth / (0.62 * chars)));
|
|
15
|
-
return /*#__PURE__*/_jsx("span", {
|
|
16
|
-
style: {
|
|
17
|
-
display: "inline-flex",
|
|
18
|
-
minWidth: size,
|
|
19
|
-
maxWidth,
|
|
20
|
-
height: size,
|
|
21
|
-
alignItems: "center",
|
|
22
|
-
justifyContent: "center",
|
|
23
|
-
color,
|
|
24
|
-
fontSize,
|
|
25
|
-
fontWeight: 800,
|
|
26
|
-
letterSpacing: 0.5,
|
|
27
|
-
whiteSpace: "nowrap",
|
|
28
|
-
overflow: "hidden"
|
|
29
|
-
},
|
|
30
|
-
children: label
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
export function renderAppIcon(icon, ctx) {
|
|
34
|
-
if (icon == null) return icon;
|
|
35
|
-
if (typeof icon === "function") return /*#__PURE__*/React.createElement(icon, {
|
|
36
|
-
slot: ctx.slot,
|
|
37
|
-
size: ctx.size,
|
|
38
|
-
state: ctx.state,
|
|
39
|
-
actions: ctx.actions
|
|
40
|
-
});
|
|
41
|
-
if (typeof icon === "string" || typeof icon === "number") return /*#__PURE__*/_jsx(AppTextIcon, {
|
|
42
|
-
label: String(icon),
|
|
43
|
-
size: ctx.size,
|
|
44
|
-
color: ctx.color
|
|
45
|
-
});
|
|
46
|
-
return icon;
|
|
47
|
-
}
|
|
1
|
+
"use strict";import s from"react";import{toolTheme as l}from"@buoy-gg/shared-ui";import{jsx as o}from"react/jsx-runtime";export function AppTextIcon({label:e,size:t,color:i=l.colors.text}){const r=Math.max(Array.from(e.replace(/[\uFE00-\uFE0F\u200D]/g,"")).length,1);const n=r<=2?t:t*1.6;const a=Math.max(7,Math.min(t*(r===1?.7:.62),n/(.62*r)));return o("span",{style:{display:"inline-flex",minWidth:t,maxWidth:n,height:t,alignItems:"center",justifyContent:"center",color:i,fontSize:a,fontWeight:800,letterSpacing:.5,whiteSpace:"nowrap",overflow:"hidden"},children:e})}export function renderAppIcon(e,t){if(e==null)return e;if(typeof e==="function")return s.createElement(e,{slot:t.slot,size:t.size,state:t.state,actions:t.actions});if(typeof e==="string"||typeof e==="number")return o(AppTextIcon,{label:String(e),size:t.size,color:t.color});return e}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{useEffect as m,useMemo as S,useRef as I}from"react";import{LicenseManager as _,useLicense as j}from"@buoy-gg/license";import{registerToolAdapters as x}from"@buoy-gg/shared-ui";import{externalSyncOptions as E,shouldMountExternalSync as L}from"./externalSyncGate.js";import{useDeviceIdentity as h}from"./deviceIdentity.js";import{appSyncAdapter as k}from"./sync/appSyncAdapter.js";import{jsx as u,Fragment as B,jsxs as D}from"react/jsx-runtime";const M=["ConsoleRoot","RouteTracker","ReactQueryTracker","ReduxAutoInstrument","PerfMonitorRoot","AutomationResumer","ImagesRoot"];const N=["DebugBordersStandaloneOverlay","HighlightUpdatesOverlay","ImageOverlayStandalone","PerfMonitorOverlay","JsTopHudOverlay","ImpersonateOverlay","ScenariosOverlay"];export function BrowserToolRuntime(e){const s=S(()=>Object.fromEntries(Object.entries(e.modules).map(([i,f])=>[i.replace(/^@buoy-gg\//,"").replace(/\/web$/,""),f])),[e.modules]);const c=s["react-query"];return c?.useReactQuerySyncAdapter?u(T,{...e,modules:s,query:c}):u(R,{...e,modules:s})}function T(e){const s=e.query.useReactQuerySyncAdapter();return u(R,{...e,queryAdapter:s})}function R({modules:e,apps:s,requiredEnvVars:c,externalSync:i,headless:f,sentryGetClient:l,queryAdapter:o}){const{isPro:p,tier:O}=j();const y=S(()=>{const n={app:k};for(const[t,r]of Object.entries(e)){for(const[a,d]of Object.entries(r)){if(a.endsWith("SyncAdapter")&&d&&typeof d==="object")n[t]=d}}if(o)n.query=o;if(e.env?.createEnvSyncAdapter)n.env=e.env.createEnvSyncAdapter(c??[]);for(const t of s??[])if(t.sync)n[`custom:${t.id}`]=t.sync;return n},[e,s,c,o]);const v=I(y);v.current=y;m(()=>x(()=>v.current),[]);m(()=>{const n=[];const t=r=>{const a=r?.();if(typeof a==="function")n.push(a)};t(e.network?.startNetworkCapture);t(e.storage?.startBrowserStorageCapture);t(e.assets?.startBrowserAssetCapture);if(e.storage?.storageSyncAdapter?.subscribe)t(()=>e.storage.storageSyncAdapter.subscribe(()=>{}));if(e["focus-inspector"]?.focusInspectorSyncAdapter?.subscribe)t(()=>e["focus-inspector"].focusInspectorSyncAdapter.subscribe(()=>{}));return()=>{for(const r of n.reverse())r()}},[e]);const b=e["external-sync"];const A=typeof __DEV__!=="undefined"?__DEV__:process.env.NODE_ENV!=="production";const w=L({isDevelopment:A,isLicensed:p,externalSync:i,isAvailable:Boolean(b)});const g=e.sentry?.SentryRoot;return D(B,{children:[Object.entries(e).flatMap(([n,t])=>M.map(r=>{const a=t[r];return a?u(a,{},`${n}:${r}`):null})),g&&u(g,{getClient:l}),Object.entries(e).flatMap(([n,t])=>N.map(r=>{const a=t[r];return a&&(!f||r==="ScenariosOverlay"||r==="ImpersonateOverlay")?u(a,{},`${n}:${r}`):null})),w&&u($,{module:b,tools:y,options:E(i),isPro:p,tier:O})]})}function $({module:e,tools:s,options:c,isPro:i,tier:f}){const l=h(c,{appName:typeof document==="undefined"?null:document.title||location.hostname,hardwareName:"Browser",platform:"web"});const{socket:o}=e.useExternalSyncSocket({deviceName:l?.deviceName??"Buoy Browser",socketURL:c?.socketURL??e.getDefaultSocketURL(),persistentDeviceId:l?.deviceId??null,platform:"web",enableLogs:c?.enableLogs});m(()=>{if(!o)return;const p=()=>{if(o.connected&&_.hasAccountAccess())o.emit("device-license",{isPro:i?"1":"0",tier:f})};p();o.on("connect",p);return()=>{o.off("connect",p)}},[o,i,f]);e.useExternalSync({tools:s,socket:o,deviceId:l?.deviceId??null,enableLogs:c?.enableLogs});return null}
|
|
@@ -1,39 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React, { createContext, useContext } from 'react';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Context value for default configuration settings.
|
|
7
|
-
*/
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
const DefaultConfigContext = /*#__PURE__*/createContext({});
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Provider for default configuration that can be consumed by the settings system.
|
|
13
|
-
* This allows teams to set default tool configurations without prop drilling.
|
|
14
|
-
*
|
|
15
|
-
* @internal Used by FloatingDevTools to provide defaults to the settings hook.
|
|
16
|
-
*/
|
|
17
|
-
export function DefaultConfigProvider({
|
|
18
|
-
children,
|
|
19
|
-
defaultFloatingTools,
|
|
20
|
-
defaultDialTools
|
|
21
|
-
}) {
|
|
22
|
-
const value = React.useMemo(() => ({
|
|
23
|
-
defaultFloatingTools,
|
|
24
|
-
defaultDialTools
|
|
25
|
-
}), [defaultFloatingTools, defaultDialTools]);
|
|
26
|
-
return /*#__PURE__*/_jsx(DefaultConfigContext.Provider, {
|
|
27
|
-
value: value,
|
|
28
|
-
children: children
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Hook to access the default configuration from context.
|
|
34
|
-
*
|
|
35
|
-
* @internal Used by useDevToolsSettings to apply defaults.
|
|
36
|
-
*/
|
|
37
|
-
export function useDefaultConfig() {
|
|
38
|
-
return useContext(DefaultConfigContext);
|
|
39
|
-
}
|
|
1
|
+
"use strict";import u,{createContext as i,useContext as c}from"react";import{jsx as f}from"react/jsx-runtime";const r=i({});export function DefaultConfigProvider({children:n,defaultFloatingTools:e,defaultDialTools:t}){const o=u.useMemo(()=>({defaultFloatingTools:e,defaultDialTools:t}),[e,t]);return f(r.Provider,{value:o,children:n})}export function useDefaultConfig(){return c(r)}
|