@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,285 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React, { useCallback, useEffect, useRef, useSyncExternalStore } from "react";
|
|
4
|
-
import { Animated, TouchableOpacity, View, Text, StyleSheet, Easing } from "react-native";
|
|
5
|
-
import { ExpandablePopover, getToolAttention, subscribeToolAttention } from "@buoy-gg/shared-ui";
|
|
6
|
-
import { useMinimizedTools } from "./MinimizedToolsContext.js";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* A hidden tool's "I need you". See `setToolAttention` in shared-ui — the tool
|
|
10
|
-
* publishes, the rail draws. Read through useSyncExternalStore so a badge set
|
|
11
|
-
* from inside a minimized sheet lands on the chip without the rail polling.
|
|
12
|
-
*/
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
function useToolAttention(toolId) {
|
|
15
|
-
return useSyncExternalStore(subscribeToolAttention, () => getToolAttention(toolId), () => getToolAttention(toolId));
|
|
16
|
-
}
|
|
17
|
-
const ATTENTION_COLORS = {
|
|
18
|
-
needsInput: "#FF8329",
|
|
19
|
-
done: "#20C997",
|
|
20
|
-
failed: "#FF3B30"
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/** needsInput outranks failed outranks done — the peek shows the one that matters most. */
|
|
24
|
-
const ATTENTION_RANK = {
|
|
25
|
-
needsInput: 3,
|
|
26
|
-
failed: 2,
|
|
27
|
-
done: 1
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/** The strongest attention across every minimized tool, for the folded peek. */
|
|
31
|
-
function useStrongestAttention(toolIds) {
|
|
32
|
-
const key = toolIds.join("|");
|
|
33
|
-
return useSyncExternalStore(subscribeToolAttention, () => strongest(key), () => strongest(key));
|
|
34
|
-
}
|
|
35
|
-
const strongestCache = new Map();
|
|
36
|
-
function strongest(key) {
|
|
37
|
-
let best = null;
|
|
38
|
-
for (const id of key ? key.split("|") : []) {
|
|
39
|
-
const a = getToolAttention(id);
|
|
40
|
-
if (a && (!best || ATTENTION_RANK[a.kind] > ATTENTION_RANK[best.kind])) best = a;
|
|
41
|
-
}
|
|
42
|
-
// Same value → same object, or useSyncExternalStore re-renders forever.
|
|
43
|
-
const prev = strongestCache.get(key);
|
|
44
|
-
if (prev && best && prev.kind === best.kind && prev.label === best.label) return prev;
|
|
45
|
-
if (!prev && !best) return null;
|
|
46
|
-
strongestCache.set(key, best);
|
|
47
|
-
return best;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// ============================================================================
|
|
51
|
-
// Constants
|
|
52
|
-
// ============================================================================
|
|
53
|
-
|
|
54
|
-
const PEEK_HEIGHT = 28;
|
|
55
|
-
const TOOLBAR_WIDTH = 44;
|
|
56
|
-
const TOOL_ITEM_SIZE = 32;
|
|
57
|
-
const ICON_GAP = 6;
|
|
58
|
-
const TOOLBAR_PADDING = 8;
|
|
59
|
-
const COLLAPSE_BUTTON_SIZE = 24;
|
|
60
|
-
const STORAGE_KEY_EXPANDED = "@react_buoy_minimized_stack_expanded";
|
|
61
|
-
|
|
62
|
-
// Glitch effect constants
|
|
63
|
-
const GLITCH_DURATION_MS = 80;
|
|
64
|
-
const MIN_GLITCH_DELAY = 2000;
|
|
65
|
-
const MAX_GLITCH_DELAY = 6000;
|
|
66
|
-
|
|
67
|
-
// ============================================================================
|
|
68
|
-
// Glitch Tool Button Component
|
|
69
|
-
// ============================================================================
|
|
70
|
-
|
|
71
|
-
function GlitchToolButton({
|
|
72
|
-
tool,
|
|
73
|
-
onSelect,
|
|
74
|
-
index
|
|
75
|
-
}) {
|
|
76
|
-
const attention = useToolAttention(tool.id);
|
|
77
|
-
const glitchX = useRef(new Animated.Value(0)).current;
|
|
78
|
-
const glitchOpacity = useRef(new Animated.Value(1)).current;
|
|
79
|
-
const glitchScale = useRef(new Animated.Value(1)).current;
|
|
80
|
-
useEffect(() => {
|
|
81
|
-
let isMounted = true;
|
|
82
|
-
const runGlitch = () => {
|
|
83
|
-
if (!isMounted) return;
|
|
84
|
-
const d = GLITCH_DURATION_MS;
|
|
85
|
-
Animated.parallel([
|
|
86
|
-
// X displacement - quick shake
|
|
87
|
-
Animated.sequence([Animated.timing(glitchX, {
|
|
88
|
-
toValue: 3,
|
|
89
|
-
duration: d * 0.2,
|
|
90
|
-
easing: Easing.linear,
|
|
91
|
-
useNativeDriver: true
|
|
92
|
-
}), Animated.timing(glitchX, {
|
|
93
|
-
toValue: -3,
|
|
94
|
-
duration: d * 0.2,
|
|
95
|
-
easing: Easing.linear,
|
|
96
|
-
useNativeDriver: true
|
|
97
|
-
}), Animated.timing(glitchX, {
|
|
98
|
-
toValue: 2,
|
|
99
|
-
duration: d * 0.2,
|
|
100
|
-
easing: Easing.linear,
|
|
101
|
-
useNativeDriver: true
|
|
102
|
-
}), Animated.timing(glitchX, {
|
|
103
|
-
toValue: -1,
|
|
104
|
-
duration: d * 0.2,
|
|
105
|
-
easing: Easing.linear,
|
|
106
|
-
useNativeDriver: true
|
|
107
|
-
}), Animated.timing(glitchX, {
|
|
108
|
-
toValue: 0,
|
|
109
|
-
duration: d * 0.2,
|
|
110
|
-
easing: Easing.linear,
|
|
111
|
-
useNativeDriver: true
|
|
112
|
-
})]),
|
|
113
|
-
// Opacity flicker
|
|
114
|
-
Animated.sequence([Animated.timing(glitchOpacity, {
|
|
115
|
-
toValue: 0.4,
|
|
116
|
-
duration: d * 0.25,
|
|
117
|
-
useNativeDriver: true
|
|
118
|
-
}), Animated.timing(glitchOpacity, {
|
|
119
|
-
toValue: 1,
|
|
120
|
-
duration: d * 0.25,
|
|
121
|
-
useNativeDriver: true
|
|
122
|
-
}), Animated.timing(glitchOpacity, {
|
|
123
|
-
toValue: 0.6,
|
|
124
|
-
duration: d * 0.25,
|
|
125
|
-
useNativeDriver: true
|
|
126
|
-
}), Animated.timing(glitchOpacity, {
|
|
127
|
-
toValue: 1,
|
|
128
|
-
duration: d * 0.25,
|
|
129
|
-
useNativeDriver: true
|
|
130
|
-
})]),
|
|
131
|
-
// Scale pulse
|
|
132
|
-
Animated.sequence([Animated.timing(glitchScale, {
|
|
133
|
-
toValue: 1.1,
|
|
134
|
-
duration: d * 0.3,
|
|
135
|
-
useNativeDriver: true
|
|
136
|
-
}), Animated.timing(glitchScale, {
|
|
137
|
-
toValue: 0.95,
|
|
138
|
-
duration: d * 0.4,
|
|
139
|
-
useNativeDriver: true
|
|
140
|
-
}), Animated.timing(glitchScale, {
|
|
141
|
-
toValue: 1,
|
|
142
|
-
duration: d * 0.3,
|
|
143
|
-
useNativeDriver: true
|
|
144
|
-
})])]).start();
|
|
145
|
-
};
|
|
146
|
-
const scheduleNextGlitch = () => {
|
|
147
|
-
if (!isMounted) return;
|
|
148
|
-
const delay = MIN_GLITCH_DELAY + Math.random() * (MAX_GLITCH_DELAY - MIN_GLITCH_DELAY) + index * 300;
|
|
149
|
-
setTimeout(() => {
|
|
150
|
-
if (isMounted) {
|
|
151
|
-
runGlitch();
|
|
152
|
-
scheduleNextGlitch();
|
|
153
|
-
}
|
|
154
|
-
}, delay);
|
|
155
|
-
};
|
|
156
|
-
const initialDelay = 500 + Math.random() * 1500 + index * 200;
|
|
157
|
-
const timeoutId = setTimeout(() => {
|
|
158
|
-
if (isMounted) {
|
|
159
|
-
runGlitch();
|
|
160
|
-
scheduleNextGlitch();
|
|
161
|
-
}
|
|
162
|
-
}, initialDelay);
|
|
163
|
-
return () => {
|
|
164
|
-
isMounted = false;
|
|
165
|
-
clearTimeout(timeoutId);
|
|
166
|
-
};
|
|
167
|
-
}, [glitchX, glitchOpacity, glitchScale, index]);
|
|
168
|
-
return /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
169
|
-
onPress: () => onSelect(tool),
|
|
170
|
-
activeOpacity: 0.7,
|
|
171
|
-
style: styles.toolButton,
|
|
172
|
-
accessibilityLabel: attention ? `${tool.title} — ${attention.label}. Restore` : `Restore ${tool.title}`,
|
|
173
|
-
accessibilityRole: "button",
|
|
174
|
-
testID: `buoy-dock-restore-${tool.id}`,
|
|
175
|
-
children: [/*#__PURE__*/_jsx(Animated.View, {
|
|
176
|
-
style: {
|
|
177
|
-
opacity: glitchOpacity,
|
|
178
|
-
transform: [{
|
|
179
|
-
translateX: glitchX
|
|
180
|
-
}, {
|
|
181
|
-
scale: glitchScale
|
|
182
|
-
}]
|
|
183
|
-
},
|
|
184
|
-
children: tool.icon
|
|
185
|
-
}), attention ? /*#__PURE__*/_jsx(View, {
|
|
186
|
-
style: [styles.badge, {
|
|
187
|
-
backgroundColor: ATTENTION_COLORS[attention.kind]
|
|
188
|
-
}],
|
|
189
|
-
testID: `buoy-dock-badge-${tool.id}-${attention.kind}`,
|
|
190
|
-
pointerEvents: "none",
|
|
191
|
-
children: attention.kind === "needsInput" ? /*#__PURE__*/_jsx(Text, {
|
|
192
|
-
style: styles.badgeText,
|
|
193
|
-
children: "!"
|
|
194
|
-
}) : null
|
|
195
|
-
}) : null]
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// ============================================================================
|
|
200
|
-
// Types
|
|
201
|
-
// ============================================================================
|
|
202
|
-
|
|
203
|
-
// ============================================================================
|
|
204
|
-
// Main Component
|
|
205
|
-
// ============================================================================
|
|
206
|
-
|
|
207
|
-
export function MinimizedToolsStack({
|
|
208
|
-
onRestore,
|
|
209
|
-
containerWidth = TOOLBAR_WIDTH
|
|
210
|
-
}) {
|
|
211
|
-
const {
|
|
212
|
-
minimizedTools,
|
|
213
|
-
restore
|
|
214
|
-
} = useMinimizedTools();
|
|
215
|
-
const peekAttention = useStrongestAttention(minimizedTools.map(t => t.id));
|
|
216
|
-
|
|
217
|
-
// Calculate expanded height based on number of tools
|
|
218
|
-
const expandedHeight = TOOLBAR_PADDING + minimizedTools.length * TOOL_ITEM_SIZE + (minimizedTools.length - 1) * ICON_GAP + ICON_GAP + COLLAPSE_BUTTON_SIZE + 4;
|
|
219
|
-
|
|
220
|
-
// Handle tool press (restore)
|
|
221
|
-
const handleToolPress = useCallback(tool => {
|
|
222
|
-
const restored = restore(tool.instanceId);
|
|
223
|
-
if (restored && onRestore) {
|
|
224
|
-
onRestore(restored);
|
|
225
|
-
}
|
|
226
|
-
}, [restore, onRestore]);
|
|
227
|
-
return /*#__PURE__*/_jsx(ExpandablePopover, {
|
|
228
|
-
hasItems: minimizedTools.length > 0,
|
|
229
|
-
itemCount: minimizedTools.length,
|
|
230
|
-
showCount: true,
|
|
231
|
-
width: containerWidth,
|
|
232
|
-
expandedHeight: expandedHeight,
|
|
233
|
-
persistState: true,
|
|
234
|
-
storageKey: STORAGE_KEY_EXPANDED,
|
|
235
|
-
peekHeight: PEEK_HEIGHT,
|
|
236
|
-
collapsedLabel: `Show ${minimizedTools.length} minimized tools`,
|
|
237
|
-
testID: "buoy-dock-peek",
|
|
238
|
-
collapseTestID: "buoy-dock-collapse",
|
|
239
|
-
attention: peekAttention ? {
|
|
240
|
-
color: ATTENTION_COLORS[peekAttention.kind],
|
|
241
|
-
glyph: peekAttention.kind === "needsInput" ? "!" : undefined,
|
|
242
|
-
label: peekAttention.label
|
|
243
|
-
} : null,
|
|
244
|
-
children: [...minimizedTools].reverse().map((tool, index) => /*#__PURE__*/_jsx(GlitchToolButton, {
|
|
245
|
-
tool: tool,
|
|
246
|
-
onSelect: handleToolPress,
|
|
247
|
-
index: index
|
|
248
|
-
}, tool.instanceId))
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
// ============================================================================
|
|
253
|
-
// Styles
|
|
254
|
-
// ============================================================================
|
|
255
|
-
|
|
256
|
-
const styles = StyleSheet.create({
|
|
257
|
-
toolButton: {
|
|
258
|
-
width: TOOL_ITEM_SIZE,
|
|
259
|
-
height: TOOL_ITEM_SIZE,
|
|
260
|
-
alignItems: "center",
|
|
261
|
-
justifyContent: "center",
|
|
262
|
-
backgroundColor: "transparent"
|
|
263
|
-
},
|
|
264
|
-
// Top-right of the chip. Needs-input carries a glyph; done/failed are a dot —
|
|
265
|
-
// the colour says which, the glyph says "act".
|
|
266
|
-
badge: {
|
|
267
|
-
position: "absolute",
|
|
268
|
-
top: 0,
|
|
269
|
-
right: 0,
|
|
270
|
-
minWidth: 12,
|
|
271
|
-
height: 12,
|
|
272
|
-
borderRadius: 6,
|
|
273
|
-
paddingHorizontal: 2,
|
|
274
|
-
alignItems: "center",
|
|
275
|
-
justifyContent: "center",
|
|
276
|
-
borderWidth: 1.5,
|
|
277
|
-
borderColor: "#0C0C0C"
|
|
278
|
-
},
|
|
279
|
-
badgeText: {
|
|
280
|
-
color: "#000",
|
|
281
|
-
fontSize: 8,
|
|
282
|
-
fontWeight: "800",
|
|
283
|
-
lineHeight: 9
|
|
284
|
-
}
|
|
285
|
-
});
|
|
1
|
+
"use strict";import q,{useCallback as C,useEffect as O,useRef as m,useSyncExternalStore as f}from"react";import{Animated as t,TouchableOpacity as S,View as V,Text as x,StyleSheet as L,Easing as d}from"react-native";import{ExpandablePopover as H,getToolAttention as h,subscribeToolAttention as v}from"@buoy-gg/shared-ui";import{useMinimizedTools as w}from"./MinimizedToolsContext.js";import{jsx as g,jsxs as G}from"react/jsx-runtime";function M(e){return f(v,()=>h(e),()=>h(e))}const I={needsInput:"#FF8329",done:"#20C997",failed:"#FF3B30"};const D={needsInput:3,failed:2,done:1};function R(e){const i=e.join("|");return f(v,()=>_(i),()=>_(i))}const N=new Map;function _(e){let i=null;for(const a of e?e.split("|"):[]){const o=h(a);if(o&&(!i||D[o.kind]>D[i.kind]))i=o}const n=N.get(e);if(n&&i&&n.kind===i.kind&&n.label===i.label)return n;if(!n&&!i)return null;N.set(e,i);return i}const P=28;const j=44;const p=32;const y=6;const z=8;const B=24;const $="@react_buoy_minimized_stack_expanded";const F=80;const A=2e3;const K=6e3;function W({tool:e,onSelect:i,index:n}){const a=M(e.id);const o=m(new t.Value(0)).current;const u=m(new t.Value(1)).current;const l=m(new t.Value(1)).current;O(()=>{let s=true;const c=()=>{if(!s)return;const r=F;t.parallel([t.sequence([t.timing(o,{toValue:3,duration:r*.2,easing:d.linear,useNativeDriver:true}),t.timing(o,{toValue:-3,duration:r*.2,easing:d.linear,useNativeDriver:true}),t.timing(o,{toValue:2,duration:r*.2,easing:d.linear,useNativeDriver:true}),t.timing(o,{toValue:-1,duration:r*.2,easing:d.linear,useNativeDriver:true}),t.timing(o,{toValue:0,duration:r*.2,easing:d.linear,useNativeDriver:true})]),t.sequence([t.timing(u,{toValue:.4,duration:r*.25,useNativeDriver:true}),t.timing(u,{toValue:1,duration:r*.25,useNativeDriver:true}),t.timing(u,{toValue:.6,duration:r*.25,useNativeDriver:true}),t.timing(u,{toValue:1,duration:r*.25,useNativeDriver:true})]),t.sequence([t.timing(l,{toValue:1.1,duration:r*.3,useNativeDriver:true}),t.timing(l,{toValue:.95,duration:r*.4,useNativeDriver:true}),t.timing(l,{toValue:1,duration:r*.3,useNativeDriver:true})])]).start()};const b=()=>{if(!s)return;const r=A+Math.random()*(K-A)+n*300;setTimeout(()=>{if(s){c();b()}},r)};const E=500+Math.random()*1500+n*200;const k=setTimeout(()=>{if(s){c();b()}},E);return()=>{s=false;clearTimeout(k)}},[o,u,l,n]);return G(S,{onPress:()=>i(e),activeOpacity:.7,style:T.toolButton,accessibilityLabel:a?`${e.title} \u2014 ${a.label}. Restore`:`Restore ${e.title}`,accessibilityRole:"button",testID:`buoy-dock-restore-${e.id}`,children:[g(t.View,{style:{opacity:u,transform:[{translateX:o},{scale:l}]},children:e.icon}),a?g(V,{style:[T.badge,{backgroundColor:I[a.kind]}],testID:`buoy-dock-badge-${e.id}-${a.kind}`,pointerEvents:"none",children:a.kind==="needsInput"?g(x,{style:T.badgeText,children:"!"}):null}):null]})}export function MinimizedToolsStack({onRestore:e,containerWidth:i=j}){const{minimizedTools:n,restore:a}=w();const o=R(n.map(s=>s.id));const u=z+n.length*p+(n.length-1)*y+y+B+4;const l=C(s=>{const c=a(s.instanceId);if(c&&e){e(c)}},[a,e]);return g(H,{hasItems:n.length>0,itemCount:n.length,showCount:true,width:i,expandedHeight:u,persistState:true,storageKey:$,peekHeight:P,collapsedLabel:`Show ${n.length} minimized tools`,testID:"buoy-dock-peek",collapseTestID:"buoy-dock-collapse",attention:o?{color:I[o.kind],glyph:o.kind==="needsInput"?"!":void 0,label:o.label}:null,children:[...n].reverse().map((s,c)=>g(W,{tool:s,onSelect:l,index:c},s.instanceId))})}const T=L.create({toolButton:{width:p,height:p,alignItems:"center",justifyContent:"center",backgroundColor:"transparent"},badge:{position:"absolute",top:0,right:0,minWidth:12,height:12,borderRadius:6,paddingHorizontal:2,alignItems:"center",justifyContent:"center",borderWidth:1.5,borderColor:"#0C0C0C"},badgeText:{color:"#000",fontSize:8,fontWeight:"800",lineHeight:9}});
|
|
@@ -1,368 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* MinimizedToolsStack — Web twin of MinimizedToolsStack.tsx +
|
|
5
|
-
* shared-ui's ExpandablePopover (inlined: the popover is only used here on
|
|
6
|
-
* web). A vertical stack of minimized-tool icons fused to the top of the
|
|
7
|
-
* floating bubble's drag handle:
|
|
8
|
-
* - collapsed: a 28px "peek" tab (chevron-up + count) with top corners only
|
|
9
|
-
* - expanded: animated-height panel, icons newest-first, collapse chevron
|
|
10
|
-
* - expanded state persists under "@react_buoy_minimized_stack_expanded"
|
|
11
|
-
* - each icon runs the native randomized glitch loop (translateX shake +
|
|
12
|
-
* opacity flicker + scale pulse, 80ms), scheduled every 2-6s + index*300ms
|
|
13
|
-
*
|
|
14
|
-
* Data comes from the web AppHost (openApps with minimized === true) instead
|
|
15
|
-
* of the native MinimizedToolsContext — same derivation the MinimizedDock
|
|
16
|
-
* used before this replaced it.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import { useCallback, useEffect, useRef, useState, useSyncExternalStore } from 'react';
|
|
20
|
-
import { persistentStorage, getToolAttention, subscribeToolAttention } from '@buoy-gg/shared-ui';
|
|
21
|
-
|
|
22
|
-
/** Twin of the native hook — see MinimizedToolsStack.tsx. */
|
|
23
|
-
function useToolAttention(toolId) {
|
|
24
|
-
return useSyncExternalStore(subscribeToolAttention, () => getToolAttention(toolId), () => getToolAttention(toolId));
|
|
25
|
-
}
|
|
26
|
-
const ATTENTION_COLORS = {
|
|
27
|
-
needsInput: '#FF8329',
|
|
28
|
-
done: '#20C997',
|
|
29
|
-
failed: '#FF3B30'
|
|
30
|
-
};
|
|
31
|
-
const ATTENTION_RANK = {
|
|
32
|
-
needsInput: 3,
|
|
33
|
-
failed: 2,
|
|
34
|
-
done: 1
|
|
35
|
-
};
|
|
36
|
-
const strongestCache = new Map();
|
|
37
|
-
function strongest(key) {
|
|
38
|
-
let best = null;
|
|
39
|
-
for (const id of key ? key.split('|') : []) {
|
|
40
|
-
const a = getToolAttention(id);
|
|
41
|
-
if (a && (!best || ATTENTION_RANK[a.kind] > ATTENTION_RANK[best.kind])) best = a;
|
|
42
|
-
}
|
|
43
|
-
const prev = strongestCache.get(key);
|
|
44
|
-
if (prev && best && prev.kind === best.kind && prev.label === best.label) return prev;
|
|
45
|
-
if (!prev && !best) return null;
|
|
46
|
-
strongestCache.set(key, best);
|
|
47
|
-
return best;
|
|
48
|
-
}
|
|
49
|
-
/** Twin of the native hook: the strongest attention across the folded dock. */
|
|
50
|
-
function useStrongestAttention(toolIds) {
|
|
51
|
-
const key = toolIds.join('|');
|
|
52
|
-
return useSyncExternalStore(subscribeToolAttention, () => strongest(key), () => strongest(key));
|
|
53
|
-
}
|
|
54
|
-
import { useAppHost } from "./AppHost.web.js";
|
|
55
|
-
|
|
56
|
-
// native MinimizedToolsStack.tsx constants
|
|
57
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
58
|
-
const PEEK_HEIGHT = 28;
|
|
59
|
-
const TOOL_ITEM_SIZE = 32;
|
|
60
|
-
const ICON_GAP = 6;
|
|
61
|
-
const TOOLBAR_PADDING = 8;
|
|
62
|
-
const COLLAPSE_BUTTON_SIZE = 24;
|
|
63
|
-
const STORAGE_KEY_EXPANDED = '@react_buoy_minimized_stack_expanded';
|
|
64
|
-
const GLITCH_DURATION_MS = 80;
|
|
65
|
-
const MIN_GLITCH_DELAY = 2000;
|
|
66
|
-
const MAX_GLITCH_DELAY = 6000;
|
|
67
|
-
|
|
68
|
-
// native shared-ui buoyColors (gameUIColors.ts) — card + textMuted
|
|
69
|
-
const CARD = '#1A1A1A';
|
|
70
|
-
const TEXT_MUTED = '#888888';
|
|
71
|
-
function ChevronGlyph({
|
|
72
|
-
down = false
|
|
73
|
-
}) {
|
|
74
|
-
// native: ChevronUp size 12, strokeWidth 2, buoyColors.textMuted
|
|
75
|
-
return /*#__PURE__*/_jsx("svg", {
|
|
76
|
-
width: 12,
|
|
77
|
-
height: 12,
|
|
78
|
-
viewBox: "0 0 24 24",
|
|
79
|
-
"aria-hidden": "true",
|
|
80
|
-
style: {
|
|
81
|
-
transform: down ? 'rotate(180deg)' : undefined
|
|
82
|
-
},
|
|
83
|
-
children: /*#__PURE__*/_jsx("path", {
|
|
84
|
-
d: "M18 15l-6-6-6 6",
|
|
85
|
-
fill: "none",
|
|
86
|
-
stroke: TEXT_MUTED,
|
|
87
|
-
strokeWidth: "2",
|
|
88
|
-
strokeLinecap: "round",
|
|
89
|
-
strokeLinejoin: "round"
|
|
90
|
-
})
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
function GlitchToolButton({
|
|
94
|
-
id,
|
|
95
|
-
title,
|
|
96
|
-
icon,
|
|
97
|
-
index,
|
|
98
|
-
onPress
|
|
99
|
-
}) {
|
|
100
|
-
const attention = useToolAttention(id);
|
|
101
|
-
const innerRef = useRef(null);
|
|
102
|
-
useEffect(() => {
|
|
103
|
-
let mounted = true;
|
|
104
|
-
let timer;
|
|
105
|
-
const runGlitch = () => {
|
|
106
|
-
// native: parallel translateX shake / opacity flicker / scale pulse,
|
|
107
|
-
// all inside GLITCH_DURATION_MS — one WAAPI animation with offsets.
|
|
108
|
-
innerRef.current?.animate([{
|
|
109
|
-
transform: 'translateX(0) scale(1)',
|
|
110
|
-
opacity: 1,
|
|
111
|
-
offset: 0
|
|
112
|
-
}, {
|
|
113
|
-
transform: 'translateX(3px) scale(1.05)',
|
|
114
|
-
opacity: 0.4,
|
|
115
|
-
offset: 0.2
|
|
116
|
-
}, {
|
|
117
|
-
transform: 'translateX(-3px) scale(1.1)',
|
|
118
|
-
opacity: 1,
|
|
119
|
-
offset: 0.4
|
|
120
|
-
}, {
|
|
121
|
-
transform: 'translateX(2px) scale(1.0)',
|
|
122
|
-
opacity: 0.6,
|
|
123
|
-
offset: 0.6
|
|
124
|
-
}, {
|
|
125
|
-
transform: 'translateX(-1px) scale(0.95)',
|
|
126
|
-
opacity: 1,
|
|
127
|
-
offset: 0.8
|
|
128
|
-
}, {
|
|
129
|
-
transform: 'translateX(0) scale(1)',
|
|
130
|
-
opacity: 1,
|
|
131
|
-
offset: 1
|
|
132
|
-
}], {
|
|
133
|
-
duration: GLITCH_DURATION_MS,
|
|
134
|
-
easing: 'linear'
|
|
135
|
-
});
|
|
136
|
-
};
|
|
137
|
-
const schedule = initial => {
|
|
138
|
-
const delay = initial ? 500 + Math.random() * 1500 + index * 200 : MIN_GLITCH_DELAY + Math.random() * (MAX_GLITCH_DELAY - MIN_GLITCH_DELAY) + index * 300;
|
|
139
|
-
timer = setTimeout(() => {
|
|
140
|
-
if (!mounted) return;
|
|
141
|
-
runGlitch();
|
|
142
|
-
schedule(false);
|
|
143
|
-
}, delay);
|
|
144
|
-
};
|
|
145
|
-
schedule(true);
|
|
146
|
-
return () => {
|
|
147
|
-
mounted = false;
|
|
148
|
-
clearTimeout(timer);
|
|
149
|
-
};
|
|
150
|
-
}, [index]);
|
|
151
|
-
return /*#__PURE__*/_jsxs("button", {
|
|
152
|
-
type: "button",
|
|
153
|
-
"aria-label": attention ? `${title} — ${attention.label}. Restore` : `Restore ${title}`,
|
|
154
|
-
onClick: onPress,
|
|
155
|
-
style: {
|
|
156
|
-
width: TOOL_ITEM_SIZE,
|
|
157
|
-
height: TOOL_ITEM_SIZE,
|
|
158
|
-
display: 'flex',
|
|
159
|
-
alignItems: 'center',
|
|
160
|
-
justifyContent: 'center',
|
|
161
|
-
background: 'none',
|
|
162
|
-
border: 'none',
|
|
163
|
-
padding: 0,
|
|
164
|
-
cursor: 'pointer',
|
|
165
|
-
position: 'relative'
|
|
166
|
-
},
|
|
167
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
168
|
-
ref: innerRef,
|
|
169
|
-
style: {
|
|
170
|
-
display: 'flex',
|
|
171
|
-
alignItems: 'center',
|
|
172
|
-
justifyContent: 'center'
|
|
173
|
-
},
|
|
174
|
-
children: icon
|
|
175
|
-
}), attention ? /*#__PURE__*/_jsx("span", {
|
|
176
|
-
"aria-hidden": true,
|
|
177
|
-
"data-testid": `buoy-dock-badge-${id}-${attention.kind}`,
|
|
178
|
-
style: {
|
|
179
|
-
position: 'absolute',
|
|
180
|
-
top: 0,
|
|
181
|
-
right: 0,
|
|
182
|
-
minWidth: 12,
|
|
183
|
-
height: 12,
|
|
184
|
-
borderRadius: 6,
|
|
185
|
-
padding: '0 2px',
|
|
186
|
-
boxSizing: 'border-box',
|
|
187
|
-
background: ATTENTION_COLORS[attention.kind],
|
|
188
|
-
border: '1.5px solid #0C0C0C',
|
|
189
|
-
color: '#000',
|
|
190
|
-
fontSize: 8,
|
|
191
|
-
fontWeight: 800,
|
|
192
|
-
lineHeight: '9px',
|
|
193
|
-
display: 'flex',
|
|
194
|
-
alignItems: 'center',
|
|
195
|
-
justifyContent: 'center'
|
|
196
|
-
},
|
|
197
|
-
children: attention.kind === 'needsInput' ? '!' : ''
|
|
198
|
-
}) : null]
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
export function MinimizedToolsStack({
|
|
202
|
-
containerWidth = 32
|
|
203
|
-
}) {
|
|
204
|
-
const {
|
|
205
|
-
openApps,
|
|
206
|
-
restore
|
|
207
|
-
} = useAppHost();
|
|
208
|
-
const minimized = openApps.filter(app => app.minimized && app.launchMode !== 'toggle-only');
|
|
209
|
-
const [isExpanded, setIsExpanded] = useState(false);
|
|
210
|
-
const [isStateRestored, setIsStateRestored] = useState(false);
|
|
211
|
-
const peekAttention = useStrongestAttention(minimized.map(app => app.id));
|
|
212
|
-
|
|
213
|
-
// Restore + persist the expanded flag (native ExpandablePopover persistState).
|
|
214
|
-
useEffect(() => {
|
|
215
|
-
let cancelled = false;
|
|
216
|
-
const load = async () => {
|
|
217
|
-
const saved = await persistentStorage.getItem(STORAGE_KEY_EXPANDED);
|
|
218
|
-
if (!cancelled && saved === 'true') setIsExpanded(true);
|
|
219
|
-
if (!cancelled) setIsStateRestored(true);
|
|
220
|
-
};
|
|
221
|
-
void load();
|
|
222
|
-
return () => {
|
|
223
|
-
cancelled = true;
|
|
224
|
-
};
|
|
225
|
-
}, []);
|
|
226
|
-
useEffect(() => {
|
|
227
|
-
if (!isStateRestored) return;
|
|
228
|
-
void persistentStorage.setItem(STORAGE_KEY_EXPANDED, isExpanded ? 'true' : 'false');
|
|
229
|
-
}, [isExpanded, isStateRestored]);
|
|
230
|
-
const handleRestore = useCallback(instanceId => {
|
|
231
|
-
restore(instanceId);
|
|
232
|
-
}, [restore]);
|
|
233
|
-
if (minimized.length === 0) return null;
|
|
234
|
-
|
|
235
|
-
// native: expandedHeight = padding + n*item + (n-1)*gap + gap + collapse + 4
|
|
236
|
-
const expandedHeight = TOOLBAR_PADDING + minimized.length * TOOL_ITEM_SIZE + (minimized.length - 1) * ICON_GAP + ICON_GAP + COLLAPSE_BUTTON_SIZE + 4;
|
|
237
|
-
const frame = {
|
|
238
|
-
// native peekButton/expandedContainer: card bg, top corners 6, 1px border
|
|
239
|
-
// on top/left/right only (fuses with the bubble below)
|
|
240
|
-
backgroundColor: CARD,
|
|
241
|
-
borderTopLeftRadius: 6,
|
|
242
|
-
borderTopRightRadius: 6,
|
|
243
|
-
borderTop: `1px solid ${TEXT_MUTED}66`,
|
|
244
|
-
borderLeft: `1px solid ${TEXT_MUTED}66`,
|
|
245
|
-
borderRight: `1px solid ${TEXT_MUTED}66`,
|
|
246
|
-
borderBottom: 'none',
|
|
247
|
-
boxSizing: 'border-box'
|
|
248
|
-
};
|
|
249
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
250
|
-
style: {
|
|
251
|
-
height: PEEK_HEIGHT,
|
|
252
|
-
overflow: 'visible',
|
|
253
|
-
position: 'relative'
|
|
254
|
-
},
|
|
255
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
256
|
-
style: {
|
|
257
|
-
position: 'absolute',
|
|
258
|
-
bottom: 0,
|
|
259
|
-
left: 0,
|
|
260
|
-
width: containerWidth,
|
|
261
|
-
height: isExpanded ? expandedHeight : 0,
|
|
262
|
-
opacity: isExpanded ? 1 : 0,
|
|
263
|
-
overflow: 'hidden',
|
|
264
|
-
transition: 'height 200ms ease, opacity 200ms ease',
|
|
265
|
-
pointerEvents: isExpanded ? 'auto' : 'none',
|
|
266
|
-
...frame
|
|
267
|
-
},
|
|
268
|
-
children: /*#__PURE__*/_jsxs("div", {
|
|
269
|
-
style: {
|
|
270
|
-
height: expandedHeight,
|
|
271
|
-
display: 'flex',
|
|
272
|
-
flexDirection: 'column',
|
|
273
|
-
alignItems: 'center',
|
|
274
|
-
paddingTop: TOOLBAR_PADDING,
|
|
275
|
-
gap: ICON_GAP,
|
|
276
|
-
boxSizing: 'border-box'
|
|
277
|
-
},
|
|
278
|
-
children: [[...minimized].reverse().map((app, index) => /*#__PURE__*/_jsx(GlitchToolButton, {
|
|
279
|
-
id: app.id,
|
|
280
|
-
title: app.title || app.id,
|
|
281
|
-
icon: app.icon ?? /*#__PURE__*/_jsx("span", {
|
|
282
|
-
style: {
|
|
283
|
-
color: '#fff',
|
|
284
|
-
fontSize: 13
|
|
285
|
-
},
|
|
286
|
-
children: (app.title || app.id).slice(0, 1).toUpperCase()
|
|
287
|
-
}),
|
|
288
|
-
index: index,
|
|
289
|
-
onPress: () => handleRestore(app.instanceId)
|
|
290
|
-
}, app.instanceId)), /*#__PURE__*/_jsx("button", {
|
|
291
|
-
type: "button",
|
|
292
|
-
"aria-label": "Collapse",
|
|
293
|
-
onClick: () => setIsExpanded(false),
|
|
294
|
-
style: {
|
|
295
|
-
width: '100%',
|
|
296
|
-
height: COLLAPSE_BUTTON_SIZE,
|
|
297
|
-
marginTop: 3,
|
|
298
|
-
display: 'flex',
|
|
299
|
-
alignItems: 'center',
|
|
300
|
-
justifyContent: 'center',
|
|
301
|
-
background: 'none',
|
|
302
|
-
border: 'none',
|
|
303
|
-
cursor: 'pointer',
|
|
304
|
-
padding: 0
|
|
305
|
-
},
|
|
306
|
-
children: /*#__PURE__*/_jsx(ChevronGlyph, {
|
|
307
|
-
down: true
|
|
308
|
-
})
|
|
309
|
-
})]
|
|
310
|
-
})
|
|
311
|
-
}), /*#__PURE__*/_jsxs("button", {
|
|
312
|
-
type: "button",
|
|
313
|
-
"aria-label": `Show ${minimized.length} minimized tools`,
|
|
314
|
-
onClick: () => setIsExpanded(true),
|
|
315
|
-
style: {
|
|
316
|
-
position: 'absolute',
|
|
317
|
-
bottom: 0,
|
|
318
|
-
left: 0,
|
|
319
|
-
width: containerWidth,
|
|
320
|
-
height: PEEK_HEIGHT,
|
|
321
|
-
display: 'flex',
|
|
322
|
-
flexDirection: 'row',
|
|
323
|
-
alignItems: 'center',
|
|
324
|
-
justifyContent: 'center',
|
|
325
|
-
gap: 2,
|
|
326
|
-
cursor: 'pointer',
|
|
327
|
-
padding: 0,
|
|
328
|
-
opacity: isExpanded ? 0 : 1,
|
|
329
|
-
transform: isExpanded ? 'scale(0.9)' : 'scale(1)',
|
|
330
|
-
transition: 'opacity 200ms ease, transform 200ms ease',
|
|
331
|
-
pointerEvents: isExpanded ? 'none' : 'auto',
|
|
332
|
-
...frame
|
|
333
|
-
},
|
|
334
|
-
children: [/*#__PURE__*/_jsx(ChevronGlyph, {}), peekAttention ? /*#__PURE__*/_jsx("span", {
|
|
335
|
-
"aria-hidden": true,
|
|
336
|
-
"data-testid": `buoy-dock-peek-attention`,
|
|
337
|
-
style: {
|
|
338
|
-
position: 'absolute',
|
|
339
|
-
top: 2,
|
|
340
|
-
right: 2,
|
|
341
|
-
minWidth: 11,
|
|
342
|
-
height: 11,
|
|
343
|
-
borderRadius: 6,
|
|
344
|
-
padding: '0 2px',
|
|
345
|
-
boxSizing: 'border-box',
|
|
346
|
-
background: ATTENTION_COLORS[peekAttention.kind],
|
|
347
|
-
border: '1.5px solid #0C0C0C',
|
|
348
|
-
color: '#000',
|
|
349
|
-
fontSize: 8,
|
|
350
|
-
fontWeight: 800,
|
|
351
|
-
lineHeight: '9px',
|
|
352
|
-
display: 'flex',
|
|
353
|
-
alignItems: 'center',
|
|
354
|
-
justifyContent: 'center'
|
|
355
|
-
},
|
|
356
|
-
children: peekAttention.kind === 'needsInput' ? '!' : ''
|
|
357
|
-
}) : null, minimized.length > 1 && /*#__PURE__*/_jsx("span", {
|
|
358
|
-
style: {
|
|
359
|
-
fontSize: 9,
|
|
360
|
-
fontWeight: 600,
|
|
361
|
-
color: TEXT_MUTED,
|
|
362
|
-
marginLeft: 1
|
|
363
|
-
},
|
|
364
|
-
children: minimized.length
|
|
365
|
-
})]
|
|
366
|
-
})]
|
|
367
|
-
});
|
|
368
|
-
}
|
|
1
|
+
"use strict";import{useCallback as M,useEffect as m,useRef as N,useState as I,useSyncExternalStore as k}from"react";import{persistentStorage as C,getToolAttention as y,subscribeToolAttention as v}from"@buoy-gg/shared-ui";function G(e){return k(v,()=>y(e),()=>y(e))}const A={needsInput:"#FF8329",done:"#20C997",failed:"#FF3B30"};const _={needsInput:3,failed:2,done:1};const E=new Map;function S(e){let n=null;for(const i of e?e.split("|"):[]){const o=y(i);if(o&&(!n||_[o.kind]>_[n.kind]))n=o}const r=E.get(e);if(r&&n&&r.kind===n.kind&&r.label===n.label)return r;if(!r&&!n)return null;E.set(e,n);return n}function H(e){const n=e.join("|");return k(v,()=>S(n),()=>S(n))}import{useAppHost as X}from"./AppHost.web.js";import{jsx as s,jsxs as h}from"react/jsx-runtime";const R=28;const x=32;const T=6;const L=8;const w=24;const z="@react_buoy_minimized_stack_expanded";const $=80;const O=2e3;const B=6e3;const P="#1A1A1A";const u="#888888";function j({down:e=false}){return s("svg",{width:12,height:12,viewBox:"0 0 24 24","aria-hidden":"true",style:{transform:e?"rotate(180deg)":void 0},children:s("path",{d:"M18 15l-6-6-6 6",fill:"none",stroke:u,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function W({id:e,title:n,icon:r,index:i,onPress:o}){const a=G(e);const d=N(null);m(()=>{let f=true;let l;const g=()=>{d.current?.animate([{transform:"translateX(0) scale(1)",opacity:1,offset:0},{transform:"translateX(3px) scale(1.05)",opacity:.4,offset:.2},{transform:"translateX(-3px) scale(1.1)",opacity:1,offset:.4},{transform:"translateX(2px) scale(1.0)",opacity:.6,offset:.6},{transform:"translateX(-1px) scale(0.95)",opacity:1,offset:.8},{transform:"translateX(0) scale(1)",opacity:1,offset:1}],{duration:$,easing:"linear"})};const c=p=>{const t=p?500+Math.random()*1500+i*200:O+Math.random()*(B-O)+i*300;l=setTimeout(()=>{if(!f)return;g();c(false)},t)};c(true);return()=>{f=false;clearTimeout(l)}},[i]);return h("button",{type:"button","aria-label":a?`${n} \u2014 ${a.label}. Restore`:`Restore ${n}`,onClick:o,style:{width:x,height:x,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",padding:0,cursor:"pointer",position:"relative"},children:[s("div",{ref:d,style:{display:"flex",alignItems:"center",justifyContent:"center"},children:r}),a?s("span",{"aria-hidden":true,"data-testid":`buoy-dock-badge-${e}-${a.kind}`,style:{position:"absolute",top:0,right:0,minWidth:12,height:12,borderRadius:6,padding:"0 2px",boxSizing:"border-box",background:A[a.kind],border:"1.5px solid #0C0C0C",color:"#000",fontSize:8,fontWeight:800,lineHeight:"9px",display:"flex",alignItems:"center",justifyContent:"center"},children:a.kind==="needsInput"?"!":""}):null]})}export function MinimizedToolsStack({containerWidth:e=32}){const{openApps:n,restore:r}=X();const i=n.filter(t=>t.minimized&&t.launchMode!=="toggle-only");const[o,a]=I(false);const[d,f]=I(false);const l=H(i.map(t=>t.id));m(()=>{let t=false;const b=async()=>{const D=await C.getItem(z);if(!t&&D==="true")a(true);if(!t)f(true)};void b();return()=>{t=true}},[]);m(()=>{if(!d)return;void C.setItem(z,o?"true":"false")},[o,d]);const g=M(t=>{r(t)},[r]);if(i.length===0)return null;const c=L+i.length*x+(i.length-1)*T+T+w+4;const p={backgroundColor:P,borderTopLeftRadius:6,borderTopRightRadius:6,borderTop:`1px solid ${u}66`,borderLeft:`1px solid ${u}66`,borderRight:`1px solid ${u}66`,borderBottom:"none",boxSizing:"border-box"};return h("div",{style:{height:R,overflow:"visible",position:"relative"},children:[s("div",{style:{position:"absolute",bottom:"var(--buoy-stack-bottom, 0px)",top:"var(--buoy-stack-top, auto)",left:0,width:e,maxHeight:"var(--buoy-stack-space, calc(100vh - 48px))",visibility:o?"visible":"hidden",height:o?c:0,opacity:o?1:0,overflowY:"auto",overflowX:"hidden",transition:"height 200ms ease, opacity 200ms ease",pointerEvents:o?"auto":"none",...p},children:h("div",{style:{height:c,display:"flex",flexDirection:"column",alignItems:"center",paddingTop:L,gap:T,boxSizing:"border-box"},children:[[...i].reverse().map((t,b)=>s(W,{id:t.id,title:t.title||t.id,icon:t.icon??s("span",{style:{color:"#fff",fontSize:13},children:(t.title||t.id).slice(0,1).toUpperCase()}),index:b,onPress:()=>g(t.instanceId)},t.instanceId)),s("button",{type:"button","aria-label":"Collapse",onClick:()=>a(false),style:{width:"100%",height:w,marginTop:3,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:s(j,{down:true})})]})}),h("button",{type:"button","aria-label":`Show ${i.length} minimized tools`,tabIndex:o?-1:0,"aria-hidden":o,onClick:()=>a(true),style:{position:"absolute",bottom:0,left:0,width:e,height:R,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:2,cursor:"pointer",padding:0,opacity:o?0:1,transform:o?"scale(0.9)":"scale(1)",transition:"opacity 200ms ease, transform 200ms ease",pointerEvents:o?"none":"auto",...p},children:[s(j,{}),l?s("span",{"aria-hidden":true,"data-testid":`buoy-dock-peek-attention`,style:{position:"absolute",top:2,right:2,minWidth:11,height:11,borderRadius:6,padding:"0 2px",boxSizing:"border-box",background:A[l.kind],border:"1.5px solid #0C0C0C",color:"#000",fontSize:8,fontWeight:800,lineHeight:"9px",display:"flex",alignItems:"center",justifyContent:"center"},children:l.kind==="needsInput"?"!":""}):null,i.length>1&&s("span",{style:{fontSize:9,fontWeight:600,color:u,marginLeft:1},children:i.length})]})]})}
|