@buoy-gg/core 7.0.41 → 7.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. package/README.md +14 -95
  2. package/bin/buoy.js +19 -340
  3. package/lib/commonjs/Buoy.js +1 -107
  4. package/lib/commonjs/browserRegister.js +1 -48
  5. package/lib/commonjs/browserRegister.server.js +1 -10
  6. package/lib/commonjs/earlyHookScript.js +1 -0
  7. package/lib/commonjs/earlyNetwork.js +1 -0
  8. package/lib/commonjs/floatingMenu/AppHost.js +1 -460
  9. package/lib/commonjs/floatingMenu/AppHost.web.js +1 -376
  10. package/lib/commonjs/floatingMenu/AppHostLogic.js +1 -50
  11. package/lib/commonjs/floatingMenu/AppIcon.js +1 -91
  12. package/lib/commonjs/floatingMenu/AppIcon.web.js +1 -53
  13. package/lib/commonjs/floatingMenu/BrowserToolRuntime.js +1 -150
  14. package/lib/commonjs/floatingMenu/DefaultConfigContext.js +1 -45
  15. package/lib/commonjs/floatingMenu/DevToolsSettingsModal.js +1 -18
  16. package/lib/commonjs/floatingMenu/DevToolsSettingsModal.shared.js +1 -1114
  17. package/lib/commonjs/floatingMenu/DevToolsSettingsModal.web.js +1 -48
  18. package/lib/commonjs/floatingMenu/DevToolsVisibilityContext.js +1 -49
  19. package/lib/commonjs/floatingMenu/FloatingDevTools.js +1 -559
  20. package/lib/commonjs/floatingMenu/FloatingDevTools.web.js +1 -415
  21. package/lib/commonjs/floatingMenu/FloatingMenu.js +1 -371
  22. package/lib/commonjs/floatingMenu/MinimizedToolsContext.js +1 -274
  23. package/lib/commonjs/floatingMenu/MinimizedToolsStack.js +1 -288
  24. package/lib/commonjs/floatingMenu/MinimizedToolsStack.web.js +1 -377
  25. package/lib/commonjs/floatingMenu/ToggleStateManager.js +1 -36
  26. package/lib/commonjs/floatingMenu/ToolHost.js +1 -281
  27. package/lib/commonjs/floatingMenu/ToolOpenerBridge.js +1 -41
  28. package/lib/commonjs/floatingMenu/autoDiscoverPresets.js +1 -471
  29. package/lib/commonjs/floatingMenu/autoExternalSync.js +1 -443
  30. package/lib/commonjs/floatingMenu/defaultConfig.js +1 -167
  31. package/lib/commonjs/floatingMenu/deviceIdentity.js +1 -173
  32. package/lib/commonjs/floatingMenu/dial/DialDevTools.js +1 -904
  33. package/lib/commonjs/floatingMenu/dial/DialDevTools.web.js +1 -895
  34. package/lib/commonjs/floatingMenu/dial/DialHyperspace.js +1 -177
  35. package/lib/commonjs/floatingMenu/dial/DialIcon.js +1 -304
  36. package/lib/commonjs/floatingMenu/dial/DialPagination.js +1 -165
  37. package/lib/commonjs/floatingMenu/dial/DialSnow.js +1 -92
  38. package/lib/commonjs/floatingMenu/dial/OnboardingTooltip.js +1 -246
  39. package/lib/commonjs/floatingMenu/dial/OnboardingTooltip.web.js +2 -147
  40. package/lib/commonjs/floatingMenu/dial/dialUsageStore.js +1 -93
  41. package/lib/commonjs/floatingMenu/dial/onboardingConstants.js +1 -42
  42. package/lib/commonjs/floatingMenu/dial/onboardingConstants.web.js +1 -42
  43. package/lib/commonjs/floatingMenu/externalSyncGate.js +1 -49
  44. package/lib/commonjs/floatingMenu/floatingTools.js +1 -42
  45. package/lib/commonjs/floatingMenu/floatingTools.web.js +1 -30
  46. package/lib/commonjs/floatingMenu/optionalRequire.js +1 -37
  47. package/lib/commonjs/floatingMenu/settingsBus.js +1 -12
  48. package/lib/commonjs/floatingMenu/sync/appSyncAdapter.js +1 -115
  49. package/lib/commonjs/floatingMenu/types.js +1 -5
  50. package/lib/commonjs/floatingMenu/useDesktopSyncStatus.js +1 -28
  51. package/lib/commonjs/floatingMenu/useDesktopSyncStatus.web.js +1 -14
  52. package/lib/commonjs/index.js +1 -291
  53. package/lib/commonjs/index.web.js +1 -241
  54. package/lib/commonjs/reactDevtoolsTypes.js +1 -1
  55. package/lib/commonjs/releaseOptIn.js +1 -0
  56. package/lib/commonjs/telemetry/installPing.js +1 -131
  57. package/lib/commonjs/toolkit.js +1 -584
  58. package/lib/commonjs/toolkitComponents.js +1 -241
  59. package/lib/commonjs/utils/autoDiscoverPresets.web.js +1 -46
  60. package/lib/commonjs/utils/createWebTool.js +1 -20
  61. package/lib/commonjs/utils/createWebTools.js +1 -30
  62. package/lib/commonjs/version.js +1 -18
  63. package/lib/module/Buoy.js +1 -102
  64. package/lib/module/browserRegister.js +1 -44
  65. package/lib/module/browserRegister.server.js +1 -6
  66. package/lib/module/earlyHookScript.js +1 -0
  67. package/lib/module/earlyNetwork.js +1 -0
  68. package/lib/module/floatingMenu/AppHost.js +1 -452
  69. package/lib/module/floatingMenu/AppHost.web.js +1 -368
  70. package/lib/module/floatingMenu/AppHostLogic.js +1 -45
  71. package/lib/module/floatingMenu/AppIcon.js +1 -84
  72. package/lib/module/floatingMenu/AppIcon.web.js +1 -47
  73. package/lib/module/floatingMenu/BrowserToolRuntime.js +1 -146
  74. package/lib/module/floatingMenu/DefaultConfigContext.js +1 -39
  75. package/lib/module/floatingMenu/DevToolsSettingsModal.js +1 -3
  76. package/lib/module/floatingMenu/DevToolsSettingsModal.shared.js +1 -1110
  77. package/lib/module/floatingMenu/DevToolsSettingsModal.web.js +1 -44
  78. package/lib/module/floatingMenu/DevToolsVisibilityContext.js +1 -44
  79. package/lib/module/floatingMenu/FloatingDevTools.js +1 -556
  80. package/lib/module/floatingMenu/FloatingDevTools.web.js +1 -412
  81. package/lib/module/floatingMenu/FloatingMenu.js +1 -366
  82. package/lib/module/floatingMenu/MinimizedToolsContext.js +1 -266
  83. package/lib/module/floatingMenu/MinimizedToolsStack.js +1 -285
  84. package/lib/module/floatingMenu/MinimizedToolsStack.web.js +1 -374
  85. package/lib/module/floatingMenu/ToggleStateManager.js +1 -32
  86. package/lib/module/floatingMenu/ToolHost.js +1 -273
  87. package/lib/module/floatingMenu/ToolOpenerBridge.js +1 -37
  88. package/lib/module/floatingMenu/autoDiscoverPresets.js +1 -467
  89. package/lib/module/floatingMenu/autoExternalSync.js +1 -436
  90. package/lib/module/floatingMenu/defaultConfig.js +1 -158
  91. package/lib/module/floatingMenu/deviceIdentity.js +1 -163
  92. package/lib/module/floatingMenu/dial/DialDevTools.js +1 -900
  93. package/lib/module/floatingMenu/dial/DialDevTools.web.js +1 -891
  94. package/lib/module/floatingMenu/dial/DialHyperspace.js +1 -173
  95. package/lib/module/floatingMenu/dial/DialIcon.js +1 -301
  96. package/lib/module/floatingMenu/dial/DialPagination.js +1 -160
  97. package/lib/module/floatingMenu/dial/DialSnow.js +1 -90
  98. package/lib/module/floatingMenu/dial/OnboardingTooltip.js +1 -240
  99. package/lib/module/floatingMenu/dial/OnboardingTooltip.web.js +2 -142
  100. package/lib/module/floatingMenu/dial/dialUsageStore.js +1 -85
  101. package/lib/module/floatingMenu/dial/onboardingConstants.js +1 -3
  102. package/lib/module/floatingMenu/dial/onboardingConstants.web.js +1 -3
  103. package/lib/module/floatingMenu/externalSyncGate.js +1 -44
  104. package/lib/module/floatingMenu/floatingTools.js +1 -27
  105. package/lib/module/floatingMenu/floatingTools.web.js +1 -3
  106. package/lib/module/floatingMenu/optionalRequire.js +1 -33
  107. package/lib/module/floatingMenu/settingsBus.js +1 -3
  108. package/lib/module/floatingMenu/sync/appSyncAdapter.js +1 -112
  109. package/lib/module/floatingMenu/types.js +1 -3
  110. package/lib/module/floatingMenu/useDesktopSyncStatus.js +1 -25
  111. package/lib/module/floatingMenu/useDesktopSyncStatus.web.js +1 -10
  112. package/lib/module/index.js +1 -41
  113. package/lib/module/index.web.js +1 -36
  114. package/lib/module/reactDevtoolsTypes.js +1 -1
  115. package/lib/module/releaseOptIn.js +1 -0
  116. package/lib/module/telemetry/installPing.js +1 -127
  117. package/lib/module/toolkit.js +1 -62
  118. package/lib/module/toolkitComponents.js +1 -230
  119. package/lib/module/utils/autoDiscoverPresets.web.js +1 -38
  120. package/lib/module/utils/createWebTool.js +1 -17
  121. package/lib/module/utils/createWebTools.js +1 -25
  122. package/lib/module/version.js +1 -14
  123. package/lib/typescript/commonjs/browserRegister.d.ts +9 -1
  124. package/lib/typescript/commonjs/browserRegister.server.d.ts +1 -0
  125. package/lib/typescript/commonjs/earlyHookScript.d.ts +12 -0
  126. package/lib/typescript/commonjs/earlyNetwork.d.ts +52 -0
  127. package/lib/typescript/commonjs/floatingMenu/defaultConfig.d.ts +1 -1
  128. package/lib/typescript/commonjs/index.web.d.ts +1 -0
  129. package/lib/typescript/commonjs/releaseOptIn.d.ts +4 -0
  130. package/lib/typescript/commonjs/version.d.ts +1 -1
  131. package/lib/typescript/module/browserRegister.d.ts +9 -1
  132. package/lib/typescript/module/browserRegister.server.d.ts +1 -0
  133. package/lib/typescript/module/earlyHookScript.d.ts +12 -0
  134. package/lib/typescript/module/earlyNetwork.d.ts +52 -0
  135. package/lib/typescript/module/floatingMenu/defaultConfig.d.ts +1 -1
  136. package/lib/typescript/module/index.web.d.ts +1 -0
  137. package/lib/typescript/module/releaseOptIn.d.ts +4 -0
  138. package/lib/typescript/module/version.d.ts +1 -1
  139. package/lib/web/chunks/chunk-5SGL6QL4.mjs +1 -0
  140. package/lib/web/chunks/chunk-FROELTJH.mjs +1 -0
  141. package/lib/web/chunks/chunk-QZDVCMCT.mjs +1 -2
  142. package/lib/web/chunks/chunk-R7RGRTY5.mjs +1 -2
  143. package/lib/web/index.mjs +2 -3
  144. package/lib/web/register-server.mjs +1 -2
  145. package/lib/web/register.mjs +1 -2
  146. package/lib/web/toolkit.mjs +1 -2
  147. package/package.json +6 -9
  148. package/lib/typescript/commonjs/Buoy.d.ts.map +0 -1
  149. package/lib/typescript/commonjs/browserRegister.d.ts.map +0 -1
  150. package/lib/typescript/commonjs/browserRegister.server.d.ts.map +0 -1
  151. package/lib/typescript/commonjs/floatingMenu/AppHost.d.ts.map +0 -1
  152. package/lib/typescript/commonjs/floatingMenu/AppHost.web.d.ts.map +0 -1
  153. package/lib/typescript/commonjs/floatingMenu/AppHostLogic.d.ts.map +0 -1
  154. package/lib/typescript/commonjs/floatingMenu/AppIcon.d.ts.map +0 -1
  155. package/lib/typescript/commonjs/floatingMenu/AppIcon.web.d.ts.map +0 -1
  156. package/lib/typescript/commonjs/floatingMenu/BrowserToolRuntime.d.ts.map +0 -1
  157. package/lib/typescript/commonjs/floatingMenu/DefaultConfigContext.d.ts.map +0 -1
  158. package/lib/typescript/commonjs/floatingMenu/DevToolsSettingsModal.d.ts.map +0 -1
  159. package/lib/typescript/commonjs/floatingMenu/DevToolsSettingsModal.shared.d.ts.map +0 -1
  160. package/lib/typescript/commonjs/floatingMenu/DevToolsSettingsModal.web.d.ts.map +0 -1
  161. package/lib/typescript/commonjs/floatingMenu/DevToolsVisibilityContext.d.ts.map +0 -1
  162. package/lib/typescript/commonjs/floatingMenu/FloatingDevTools.d.ts.map +0 -1
  163. package/lib/typescript/commonjs/floatingMenu/FloatingDevTools.web.d.ts.map +0 -1
  164. package/lib/typescript/commonjs/floatingMenu/FloatingMenu.d.ts.map +0 -1
  165. package/lib/typescript/commonjs/floatingMenu/MinimizedToolsContext.d.ts.map +0 -1
  166. package/lib/typescript/commonjs/floatingMenu/MinimizedToolsStack.d.ts.map +0 -1
  167. package/lib/typescript/commonjs/floatingMenu/MinimizedToolsStack.web.d.ts.map +0 -1
  168. package/lib/typescript/commonjs/floatingMenu/ToggleStateManager.d.ts.map +0 -1
  169. package/lib/typescript/commonjs/floatingMenu/ToolHost.d.ts.map +0 -1
  170. package/lib/typescript/commonjs/floatingMenu/ToolOpenerBridge.d.ts.map +0 -1
  171. package/lib/typescript/commonjs/floatingMenu/autoDiscoverPresets.d.ts.map +0 -1
  172. package/lib/typescript/commonjs/floatingMenu/autoExternalSync.d.ts.map +0 -1
  173. package/lib/typescript/commonjs/floatingMenu/defaultConfig.d.ts.map +0 -1
  174. package/lib/typescript/commonjs/floatingMenu/deviceIdentity.d.ts.map +0 -1
  175. package/lib/typescript/commonjs/floatingMenu/dial/DialDevTools.d.ts.map +0 -1
  176. package/lib/typescript/commonjs/floatingMenu/dial/DialDevTools.web.d.ts.map +0 -1
  177. package/lib/typescript/commonjs/floatingMenu/dial/DialHyperspace.d.ts.map +0 -1
  178. package/lib/typescript/commonjs/floatingMenu/dial/DialIcon.d.ts.map +0 -1
  179. package/lib/typescript/commonjs/floatingMenu/dial/DialPagination.d.ts.map +0 -1
  180. package/lib/typescript/commonjs/floatingMenu/dial/DialSnow.d.ts.map +0 -1
  181. package/lib/typescript/commonjs/floatingMenu/dial/OnboardingTooltip.d.ts.map +0 -1
  182. package/lib/typescript/commonjs/floatingMenu/dial/OnboardingTooltip.web.d.ts.map +0 -1
  183. package/lib/typescript/commonjs/floatingMenu/dial/dialUsageStore.d.ts.map +0 -1
  184. package/lib/typescript/commonjs/floatingMenu/dial/onboardingConstants.d.ts.map +0 -1
  185. package/lib/typescript/commonjs/floatingMenu/dial/onboardingConstants.web.d.ts.map +0 -1
  186. package/lib/typescript/commonjs/floatingMenu/externalSyncGate.d.ts.map +0 -1
  187. package/lib/typescript/commonjs/floatingMenu/floatingTools.d.ts.map +0 -1
  188. package/lib/typescript/commonjs/floatingMenu/floatingTools.web.d.ts.map +0 -1
  189. package/lib/typescript/commonjs/floatingMenu/optionalRequire.d.ts.map +0 -1
  190. package/lib/typescript/commonjs/floatingMenu/settingsBus.d.ts.map +0 -1
  191. package/lib/typescript/commonjs/floatingMenu/sync/appSyncAdapter.d.ts.map +0 -1
  192. package/lib/typescript/commonjs/floatingMenu/types.d.ts.map +0 -1
  193. package/lib/typescript/commonjs/floatingMenu/useDesktopSyncStatus.d.ts.map +0 -1
  194. package/lib/typescript/commonjs/floatingMenu/useDesktopSyncStatus.web.d.ts.map +0 -1
  195. package/lib/typescript/commonjs/index.d.ts.map +0 -1
  196. package/lib/typescript/commonjs/index.web.d.ts.map +0 -1
  197. package/lib/typescript/commonjs/reactDevtoolsTypes.d.ts.map +0 -1
  198. package/lib/typescript/commonjs/telemetry/installPing.d.ts.map +0 -1
  199. package/lib/typescript/commonjs/toolkit.d.ts.map +0 -1
  200. package/lib/typescript/commonjs/toolkitComponents.d.ts.map +0 -1
  201. package/lib/typescript/commonjs/utils/autoDiscoverPresets.web.d.ts.map +0 -1
  202. package/lib/typescript/commonjs/utils/createWebTool.d.ts.map +0 -1
  203. package/lib/typescript/commonjs/utils/createWebTools.d.ts.map +0 -1
  204. package/lib/typescript/commonjs/version.d.ts.map +0 -1
  205. package/lib/typescript/module/Buoy.d.ts.map +0 -1
  206. package/lib/typescript/module/browserRegister.d.ts.map +0 -1
  207. package/lib/typescript/module/browserRegister.server.d.ts.map +0 -1
  208. package/lib/typescript/module/floatingMenu/AppHost.d.ts.map +0 -1
  209. package/lib/typescript/module/floatingMenu/AppHost.web.d.ts.map +0 -1
  210. package/lib/typescript/module/floatingMenu/AppHostLogic.d.ts.map +0 -1
  211. package/lib/typescript/module/floatingMenu/AppIcon.d.ts.map +0 -1
  212. package/lib/typescript/module/floatingMenu/AppIcon.web.d.ts.map +0 -1
  213. package/lib/typescript/module/floatingMenu/BrowserToolRuntime.d.ts.map +0 -1
  214. package/lib/typescript/module/floatingMenu/DefaultConfigContext.d.ts.map +0 -1
  215. package/lib/typescript/module/floatingMenu/DevToolsSettingsModal.d.ts.map +0 -1
  216. package/lib/typescript/module/floatingMenu/DevToolsSettingsModal.shared.d.ts.map +0 -1
  217. package/lib/typescript/module/floatingMenu/DevToolsSettingsModal.web.d.ts.map +0 -1
  218. package/lib/typescript/module/floatingMenu/DevToolsVisibilityContext.d.ts.map +0 -1
  219. package/lib/typescript/module/floatingMenu/FloatingDevTools.d.ts.map +0 -1
  220. package/lib/typescript/module/floatingMenu/FloatingDevTools.web.d.ts.map +0 -1
  221. package/lib/typescript/module/floatingMenu/FloatingMenu.d.ts.map +0 -1
  222. package/lib/typescript/module/floatingMenu/MinimizedToolsContext.d.ts.map +0 -1
  223. package/lib/typescript/module/floatingMenu/MinimizedToolsStack.d.ts.map +0 -1
  224. package/lib/typescript/module/floatingMenu/MinimizedToolsStack.web.d.ts.map +0 -1
  225. package/lib/typescript/module/floatingMenu/ToggleStateManager.d.ts.map +0 -1
  226. package/lib/typescript/module/floatingMenu/ToolHost.d.ts.map +0 -1
  227. package/lib/typescript/module/floatingMenu/ToolOpenerBridge.d.ts.map +0 -1
  228. package/lib/typescript/module/floatingMenu/autoDiscoverPresets.d.ts.map +0 -1
  229. package/lib/typescript/module/floatingMenu/autoExternalSync.d.ts.map +0 -1
  230. package/lib/typescript/module/floatingMenu/defaultConfig.d.ts.map +0 -1
  231. package/lib/typescript/module/floatingMenu/deviceIdentity.d.ts.map +0 -1
  232. package/lib/typescript/module/floatingMenu/dial/DialDevTools.d.ts.map +0 -1
  233. package/lib/typescript/module/floatingMenu/dial/DialDevTools.web.d.ts.map +0 -1
  234. package/lib/typescript/module/floatingMenu/dial/DialHyperspace.d.ts.map +0 -1
  235. package/lib/typescript/module/floatingMenu/dial/DialIcon.d.ts.map +0 -1
  236. package/lib/typescript/module/floatingMenu/dial/DialPagination.d.ts.map +0 -1
  237. package/lib/typescript/module/floatingMenu/dial/DialSnow.d.ts.map +0 -1
  238. package/lib/typescript/module/floatingMenu/dial/OnboardingTooltip.d.ts.map +0 -1
  239. package/lib/typescript/module/floatingMenu/dial/OnboardingTooltip.web.d.ts.map +0 -1
  240. package/lib/typescript/module/floatingMenu/dial/dialUsageStore.d.ts.map +0 -1
  241. package/lib/typescript/module/floatingMenu/dial/onboardingConstants.d.ts.map +0 -1
  242. package/lib/typescript/module/floatingMenu/dial/onboardingConstants.web.d.ts.map +0 -1
  243. package/lib/typescript/module/floatingMenu/externalSyncGate.d.ts.map +0 -1
  244. package/lib/typescript/module/floatingMenu/floatingTools.d.ts.map +0 -1
  245. package/lib/typescript/module/floatingMenu/floatingTools.web.d.ts.map +0 -1
  246. package/lib/typescript/module/floatingMenu/optionalRequire.d.ts.map +0 -1
  247. package/lib/typescript/module/floatingMenu/settingsBus.d.ts.map +0 -1
  248. package/lib/typescript/module/floatingMenu/sync/appSyncAdapter.d.ts.map +0 -1
  249. package/lib/typescript/module/floatingMenu/types.d.ts.map +0 -1
  250. package/lib/typescript/module/floatingMenu/useDesktopSyncStatus.d.ts.map +0 -1
  251. package/lib/typescript/module/floatingMenu/useDesktopSyncStatus.web.d.ts.map +0 -1
  252. package/lib/typescript/module/index.d.ts.map +0 -1
  253. package/lib/typescript/module/index.web.d.ts.map +0 -1
  254. package/lib/typescript/module/reactDevtoolsTypes.d.ts.map +0 -1
  255. package/lib/typescript/module/telemetry/installPing.d.ts.map +0 -1
  256. package/lib/typescript/module/toolkit.d.ts.map +0 -1
  257. package/lib/typescript/module/toolkitComponents.d.ts.map +0 -1
  258. package/lib/typescript/module/utils/autoDiscoverPresets.web.d.ts.map +0 -1
  259. package/lib/typescript/module/utils/createWebTool.d.ts.map +0 -1
  260. package/lib/typescript/module/utils/createWebTools.d.ts.map +0 -1
  261. package/lib/typescript/module/version.d.ts.map +0 -1
  262. package/lib/web/chunks/chunk-5NZOQR6Q.mjs +0 -2
  263. package/lib/web/chunks/chunk-CGDSLLZF.mjs +0 -2
  264. package/lib/web/chunks/chunk-DCJDUSNR.mjs +0 -2
  265. package/lib/web/chunks/chunk-IDSHFS6G.mjs +0 -2
  266. package/lib/web/chunks/chunk-JOAMJGCS.mjs +0 -2
  267. package/lib/web/chunks/chunk-KYKZ2N52.mjs +0 -2
  268. package/lib/web/chunks/chunk-NGM7JGGS.mjs +0 -2
  269. package/lib/web/chunks/chunk-Z3XWDDIO.mjs +0 -2
  270. package/lib/web/chunks/chunk-ZTGQ6TTY.mjs +0 -2
@@ -1,371 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.FloatingMenu = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _reactNative = require("react-native");
9
- var _sharedUi = require("@buoy-gg/shared-ui");
10
- var _floatingTools = require("./floatingTools");
11
- var _AppIcon = require("./AppIcon");
12
- var _DialDevTools = require("./dial/DialDevTools");
13
- var _DevToolsSettingsModal = require("./DevToolsSettingsModal");
14
- var _AppHost = require("./AppHost");
15
- var _DevToolsVisibilityContext = require("./DevToolsVisibilityContext.js");
16
- var _ToggleStateManager = require("./ToggleStateManager.js");
17
- var _OnboardingTooltip = require("./dial/OnboardingTooltip");
18
- var _jsxRuntime = require("react/jsx-runtime");
19
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
20
- /**
21
- * Props for the floating developer tools launcher. Controls which apps are shown and
22
- * how the menu integrates with the current host environment.
23
- */
24
-
25
- /**
26
- * FloatingMenu renders the persistent developer tools entry point. It handles visibility,
27
- * integrates with the AppHost, and presents available tools as floating shortcuts and a dial.
28
- */
29
- const FLOATING_MENU_ONBOARDING_KEY = "@react_buoy_floating_menu_tooltip_shown";
30
- const ONBOARDING_STEP_KEY = "@react_buoy_onboarding_step";
31
- const FloatingMenu = ({
32
- apps,
33
- state,
34
- actions,
35
- hidden,
36
- environment,
37
- userRole = "admin",
38
- availableEnvironments,
39
- onEnvironmentSwitch
40
- }) => {
41
- const [internalHidden, setInternalHidden] = (0, _react.useState)(false);
42
- const [showDial, setShowDial] = (0, _react.useState)(false);
43
- const [dialStateLoaded, setDialStateLoaded] = (0, _react.useState)(false);
44
- const [onboardingStep, setOnboardingStep] = (0, _react.useState)(null);
45
- const [, forceUpdate] = (0, _react.useState)(0); // Used to force re-render when toggle states change
46
- const onboardingDismissedRef = (0, _react.useRef)(false); // Track if onboarding was dismissed
47
- const hintsDisabled = (0, _sharedUi.useHintsDisabled)();
48
-
49
- // Load persisted dial state on mount
50
- (0, _react.useEffect)(() => {
51
- const loadDialState = async () => {
52
- try {
53
- const savedDialOpen = await _sharedUi.persistentStorage.getItem(_sharedUi.devToolsStorageKeys.dial.isOpen());
54
- if (savedDialOpen === "true") {
55
- setShowDial(true);
56
- }
57
- } catch (error) {
58
- // Failed to load dial state - use default (closed)
59
- } finally {
60
- setDialStateLoaded(true);
61
- }
62
- };
63
- loadDialState();
64
- }, []);
65
-
66
- // Persist dial state when it changes
67
- (0, _react.useEffect)(() => {
68
- // Only persist after initial state is loaded to avoid overwriting with default
69
- if (!dialStateLoaded) return;
70
- _sharedUi.persistentStorage.setItem(_sharedUi.devToolsStorageKeys.dial.isOpen(), showDial ? "true" : "false").catch(error => {
71
- // Failed to save dial state - continue without persistence
72
- console.warn("Failed to save dial state:", error);
73
- });
74
- }, [showDial, dialStateLoaded]);
75
-
76
- // Determine if environment selector should be shown
77
- const showEnvironmentSelector = Boolean(availableEnvironments?.length && onEnvironmentSwitch);
78
- const {
79
- isAnyOpen,
80
- open,
81
- registerApps
82
- } = (0, _AppHost.useAppHost)();
83
- const wasAppOpenRef = (0, _react.useRef)(isAnyOpen);
84
- const {
85
- setDialOpen,
86
- setToolOpen
87
- } = (0, _DevToolsVisibilityContext.useDevToolsVisibility)();
88
-
89
- // Check onboarding status on first load
90
- (0, _react.useEffect)(() => {
91
- // Skip onboarding if hints are disabled
92
- if (hintsDisabled) {
93
- return;
94
- }
95
- const checkOnboarding = async () => {
96
- try {
97
- const hasSeenOnboarding = await _sharedUi.persistentStorage.getItem(FLOATING_MENU_ONBOARDING_KEY);
98
- if (!hasSeenOnboarding) {
99
- // Small delay to let the UI settle before showing tooltip
100
- setTimeout(() => {
101
- setOnboardingStep("positioning");
102
- }, 1000);
103
- }
104
- } catch (error) {
105
- // If there's an error reading storage, don't show onboarding
106
- }
107
- };
108
- checkOnboarding();
109
- }, [hintsDisabled]);
110
-
111
- // Subscribe to toggle state changes to update icon colors
112
- (0, _react.useEffect)(() => {
113
- const unsubscribe = _ToggleStateManager.toggleStateManager.subscribe(() => {
114
- forceUpdate(prev => prev + 1);
115
- });
116
- return unsubscribe;
117
- }, []);
118
-
119
- // Sync dial state with visibility context
120
- (0, _react.useEffect)(() => {
121
- setDialOpen(showDial);
122
- }, [showDial, setDialOpen]);
123
-
124
- // Sync tool open state with visibility context
125
- (0, _react.useEffect)(() => {
126
- setToolOpen(isAnyOpen);
127
- }, [isAnyOpen, setToolOpen]);
128
-
129
- // When an app is open or dial is shown, push the menu to the side instead of hiding completely
130
- const shouldPushToSide = (0, _react.useMemo)(() => Boolean(showDial || isAnyOpen), [showDial, isAnyOpen]);
131
-
132
- // Use external hidden prop or internal hidden state for complete hiding
133
- const isCompletelyHidden = (0, _react.useMemo)(() => Boolean(hidden ?? internalHidden), [hidden, internalHidden]);
134
- const {
135
- settings: devToolsSettings
136
- } = (0, _DevToolsSettingsModal.useDevToolsSettings)();
137
-
138
- // Register apps with AppHost for persistence
139
- (0, _react.useEffect)(() => {
140
- if (registerApps) {
141
- registerApps(apps);
142
- }
143
- }, [apps, registerApps]);
144
- const mergedActions = (0, _react.useMemo)(() => {
145
- return {
146
- ...(actions ?? {}),
147
- closeMenu: () => setShowDial(false),
148
- hideFloatingRow: () => setInternalHidden(true),
149
- showFloatingRow: () => setInternalHidden(false),
150
- notifyToggleChange: () => forceUpdate(prev => prev + 1)
151
- };
152
- }, [actions]);
153
- (0, _react.useEffect)(() => {
154
- if (wasAppOpenRef.current && !isAnyOpen) {
155
- setInternalHidden(false);
156
- setShowDial(false);
157
- }
158
- wasAppOpenRef.current = isAnyOpen;
159
- }, [isAnyOpen]);
160
-
161
- // Filter function for floating tools based on settings
162
- const isFloatingEnabled = id => {
163
- if (!devToolsSettings) return false;
164
- // Floating tools require explicit opt-in (unlike dial tools which auto-enable)
165
- return devToolsSettings.floatingTools[id] ?? false;
166
- };
167
-
168
- // Dial is the default/only layout
169
-
170
- const handlePress = app => {
171
- // Call the app's onPress callback if provided, passing actions for toggle tools
172
- app?.onPress?.(mergedActions);
173
-
174
- // Only open modal if not a toggle-only tool
175
- if (app.launchMode !== "toggle-only") {
176
- // Resolve the icon for minimize stack display (createElement keeps
177
- // function-icon hooks working; strings become text icons).
178
- const resolvedIcon = (0, _AppIcon.renderAppIcon)(app.icon, {
179
- slot: "dial",
180
- size: 20,
181
- color: app.color
182
- });
183
- open({
184
- id: app.id,
185
- title: app.name,
186
- component: app.component,
187
- props: app.props,
188
- launchMode: app.launchMode ?? "self-modal",
189
- singleton: app.singleton ?? true,
190
- icon: resolvedIcon,
191
- color: app.color,
192
- modal: app.modal
193
- });
194
- }
195
- };
196
- const handleOnboardingDismiss = () => {
197
- // Mark as dismissed immediately in ref (synchronous, no re-render needed)
198
- onboardingDismissedRef.current = true;
199
-
200
- // Update state to hide tooltip
201
- setOnboardingStep(null);
202
-
203
- // Save to storage asynchronously in the background
204
- _sharedUi.persistentStorage.setItem(FLOATING_MENU_ONBOARDING_KEY, "true").catch(error => {
205
- // Silently fail - user already saw onboarding, just won't persist
206
- console.warn("Failed to save onboarding state:", error);
207
- });
208
- };
209
- const handleDialOpen = () => {
210
- // If user opens dial during onboarding, mark onboarding as complete
211
- if (isOnboarding) {
212
- handleOnboardingDismiss();
213
- }
214
- setShowDial(true);
215
- };
216
-
217
- // Determine if we're in onboarding mode (only when explicitly set to positioning AND not dismissed AND hints not disabled)
218
- const isOnboarding = onboardingStep === "positioning" && !onboardingDismissedRef.current && !hintsDisabled;
219
-
220
- // During onboarding, disable position persistence and use centered position
221
- const shouldEnablePositionPersistence = !isOnboarding;
222
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
223
- children: [isOnboarding && !showDial && !isAnyOpen && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
224
- style: styles.onboardingContainer,
225
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
226
- style: styles.onboardingBackdrop
227
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_OnboardingTooltip.OnboardingTooltip, {
228
- visible: true,
229
- onDismiss: handleOnboardingDismiss,
230
- title: "Welcome to Buoy!",
231
- message: "Grab and position this menu wherever you want, then tap the icon to open your tools."
232
- })]
233
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
234
- nativeID: "floating-devtools-root"
235
- // While the dial overlay is open, the floating menu underneath must be
236
- // inert — otherwise the draggable bubble's gesture handling intercepts
237
- // touches on dial controls that overlap it (e.g. the pager buttons).
238
- ,
239
- pointerEvents: isCompletelyHidden || showDial ? "none" : "box-none",
240
- style: {
241
- position: "absolute",
242
- top: 0,
243
- left: 0,
244
- right: 0,
245
- bottom: 0,
246
- zIndex: isOnboarding ? 10001 : 9999,
247
- // Higher z-index during onboarding to show above backdrop
248
- opacity: isCompletelyHidden ? 0 : 1
249
- },
250
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_floatingTools.FloatingTools, {
251
- enablePositionPersistence: shouldEnablePositionPersistence,
252
- pushToSide: shouldPushToSide,
253
- centerOnboarding: isOnboarding,
254
- environment: environment,
255
- availableEnvironments: availableEnvironments,
256
- onEnvironmentSwitch: onEnvironmentSwitch,
257
- showEnvironmentSelector: showEnvironmentSelector && devToolsSettings?.floatingTools?.environment,
258
- children: [environment && devToolsSettings?.floatingTools?.environment !== false && !showEnvironmentSelector ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.EnvironmentIndicator, {
259
- environment: environment
260
- }) : null, userRole ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_floatingTools.UserStatus, {
261
- userRole: userRole,
262
- onPress: handleDialOpen
263
- }) :
264
- /*#__PURE__*/
265
- // Fallback: small launcher icon to ensure settings are always accessible
266
- (0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
267
- accessibilityLabel: "Open Dev Tools Menu",
268
- onPress: handleDialOpen,
269
- style: styles.fab,
270
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
271
- style: styles.menuButton,
272
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(MenuLauncherIcon, {
273
- size: 14
274
- })
275
- })
276
- }), apps.filter(a => (a.slot ?? "both") !== "dial" && isFloatingEnabled(a.id)).map(app => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
277
- accessibilityLabel: app.name,
278
- onPress: () => handlePress(app),
279
- style: styles.fab,
280
- children: (() => {
281
- if (typeof app.icon === "function") {
282
- const IconComponent = app.icon;
283
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
284
- slot: "row",
285
- size: 16,
286
- state: state,
287
- actions: mergedActions
288
- });
289
- }
290
- return (0, _AppIcon.renderAppIcon)(app.icon, {
291
- slot: "row",
292
- size: 16,
293
- color: app.color
294
- });
295
- })()
296
- }, `row-${app.id}`))]
297
- })
298
- }), showDial && !isCompletelyHidden && /*#__PURE__*/(0, _jsxRuntime.jsx)(_DialDevTools.DialDevTools, {
299
- apps: apps,
300
- state: state,
301
- actions: mergedActions,
302
- onClose: () => {
303
- setShowDial(false);
304
- }
305
- })]
306
- });
307
- };
308
- exports.FloatingMenu = FloatingMenu;
309
- const styles = _reactNative.StyleSheet.create({
310
- fab: {
311
- paddingHorizontal: 6,
312
- paddingVertical: 4,
313
- borderRadius: 6,
314
- marginRight: 4,
315
- alignItems: "center",
316
- justifyContent: "center",
317
- minWidth: 0,
318
- minHeight: 0,
319
- backgroundColor: "transparent"
320
- },
321
- menuButton: {
322
- paddingHorizontal: 4,
323
- paddingVertical: 2,
324
- minWidth: 16,
325
- alignItems: "center",
326
- justifyContent: "center"
327
- },
328
- menuDots: {
329
- color: "#8CA2C8",
330
- fontSize: 14,
331
- fontWeight: "900"
332
- },
333
- onboardingContainer: {
334
- ..._sharedUi.absoluteFill,
335
- zIndex: 10000
336
- },
337
- onboardingBackdrop: {
338
- ..._sharedUi.absoluteFill,
339
- backgroundColor: "rgba(0, 0, 0, 0.85)"
340
- }
341
- });
342
- /** Minimal 3x3 dot icon used when the user status badge is unavailable. */
343
- const MenuLauncherIcon = ({
344
- size = 14,
345
- color = _sharedUi.buoyColors.primary
346
- }) => {
347
- const dotSize = Math.max(2, Math.floor(size / 4));
348
- const gap = Math.max(1, Math.floor(size / 16));
349
- const items = Array.from({
350
- length: 9
351
- });
352
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
353
- style: {
354
- width: size,
355
- height: size,
356
- flexDirection: "row",
357
- flexWrap: "wrap",
358
- alignContent: "center",
359
- justifyContent: "center"
360
- },
361
- children: items.map((_, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
362
- style: {
363
- width: dotSize,
364
- height: dotSize,
365
- margin: gap,
366
- borderRadius: 2,
367
- backgroundColor: color
368
- }
369
- }, i))
370
- });
371
- };
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.FloatingMenu=void 0;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _floatingTools=require("./floatingTools");var _AppIcon=require("./AppIcon");var _DialDevTools=require("./dial/DialDevTools");var _DevToolsSettingsModal=require("./DevToolsSettingsModal");var _AppHost=require("./AppHost");var _DevToolsVisibilityContext=require("./DevToolsVisibilityContext.js");var _ToggleStateManager=require("./ToggleStateManager.js");var _OnboardingTooltip=require("./dial/OnboardingTooltip");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(o,d){if("function"==typeof WeakMap)var c=new WeakMap,g=new WeakMap;return(_interopRequireWildcard=function(t,f){if(!f&&t&&t.__esModule)return t;var n,u,l={__proto__:null,default:t};if(null===t||"object"!=typeof t&&"function"!=typeof t)return l;if(n=f?g:c){if(n.has(t))return n.get(t);n.set(t,l)}for(const i in t)"default"!==i&&{}.hasOwnProperty.call(t,i)&&((u=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(t,i))&&(u.get||u.set)?n(l,i,u):l[i]=t[i]);return l})(o,d)}const FLOATING_MENU_ONBOARDING_KEY="@react_buoy_floating_menu_tooltip_shown";const ONBOARDING_STEP_KEY="@react_buoy_onboarding_step";const FloatingMenu=({apps:o,state:d,actions:c,hidden:g,environment:t,userRole:f="admin",availableEnvironments:n,onEnvironmentSwitch:u})=>{const[l,i]=(0,_react.useState)(false);const[r,h]=(0,_react.useState)(false);const[_,E]=(0,_react.useState)(false);const[A,T]=(0,_react.useState)(null);const[,w]=(0,_react.useState)(0);const D=(0,_react.useRef)(false);const p=(0,_sharedUi.useHintsDisabled)();(0,_react.useEffect)(()=>{const e=async()=>{try{const s=await _sharedUi.persistentStorage.getItem(_sharedUi.devToolsStorageKeys.dial.isOpen());if(s==="true"){h(true)}}catch(s){}finally{E(true)}};e()},[]);(0,_react.useEffect)(()=>{if(!_)return;_sharedUi.persistentStorage.setItem(_sharedUi.devToolsStorageKeys.dial.isOpen(),r?"true":"false").catch(e=>{console.warn("Failed to save dial state:",e)})},[r,_]);const x=Boolean(n?.length&&u);const{isAnyOpen:a,open:P,registerApps:y}=(0,_AppHost.useAppHost)();const O=(0,_react.useRef)(a);const{setDialOpen:j,setToolOpen:M}=(0,_DevToolsVisibilityContext.useDevToolsVisibility)();(0,_react.useEffect)(()=>{if(p){return}const e=async()=>{try{const s=await _sharedUi.persistentStorage.getItem(FLOATING_MENU_ONBOARDING_KEY);if(!s){setTimeout(()=>{T("positioning")},1e3)}}catch(s){}};e()},[p]);(0,_react.useEffect)(()=>{const e=_ToggleStateManager.toggleStateManager.subscribe(()=>{w(s=>s+1)});return e},[]);(0,_react.useEffect)(()=>{j(r)},[r,j]);(0,_react.useEffect)(()=>{M(a)},[a,M]);const q=(0,_react.useMemo)(()=>Boolean(r||a),[r,a]);const v=(0,_react.useMemo)(()=>Boolean(g??l),[g,l]);const{settings:m}=(0,_DevToolsSettingsModal.useDevToolsSettings)();(0,_react.useEffect)(()=>{if(y){y(o)}},[o,y]);const S=(0,_react.useMemo)(()=>{return{...c??{},closeMenu:()=>h(false),hideFloatingRow:()=>i(true),showFloatingRow:()=>i(false),notifyToggleChange:()=>w(e=>e+1)}},[c]);(0,_react.useEffect)(()=>{if(O.current&&!a){i(false);h(false)}O.current=a},[a]);const F=e=>{if(!m)return false;return m.floatingTools[e]??false};const R=e=>{e?.onPress?.(S);if(e.launchMode!=="toggle-only"){const s=(0,_AppIcon.renderAppIcon)(e.icon,{slot:"dial",size:20,color:e.color});P({id:e.id,title:e.name,component:e.component,props:e.props,launchMode:e.launchMode??"self-modal",singleton:e.singleton??true,icon:s,color:e.color,modal:e.modal})}};const I=()=>{D.current=true;T(null);_sharedUi.persistentStorage.setItem(FLOATING_MENU_ONBOARDING_KEY,"true").catch(e=>{console.warn("Failed to save onboarding state:",e)})};const C=()=>{if(b){I()}h(true)};const b=A==="positioning"&&!D.current&&!p;const V=!b;return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[b&&!r&&!a&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.onboardingContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.onboardingBackdrop}),(0,_jsxRuntime.jsx)(_OnboardingTooltip.OnboardingTooltip,{visible:true,onDismiss:I,title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools."})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{nativeID:"floating-devtools-root",pointerEvents:v||r?"none":"box-none",style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:b?10001:9999,opacity:v?0:1},children:(0,_jsxRuntime.jsxs)(_floatingTools.FloatingTools,{enablePositionPersistence:V,pushToSide:q,centerOnboarding:b,environment:t,availableEnvironments:n,onEnvironmentSwitch:u,showEnvironmentSelector:x&&m?.floatingTools?.environment,children:[t&&m?.floatingTools?.environment!==false&&!x?(0,_jsxRuntime.jsx)(_sharedUi.EnvironmentIndicator,{environment:t}):null,f?(0,_jsxRuntime.jsx)(_floatingTools.UserStatus,{userRole:f,onPress:C}):(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{accessibilityLabel:"Open Dev Tools Menu",onPress:C,style:styles.fab,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.menuButton,children:(0,_jsxRuntime.jsx)(MenuLauncherIcon,{size:14})})}),o.filter(e=>(e.slot??"both")!=="dial"&&F(e.id)).map(e=>(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{accessibilityLabel:e.name,onPress:()=>R(e),style:styles.fab,children:(()=>{if(typeof e.icon==="function"){const s=e.icon;return(0,_jsxRuntime.jsx)(s,{slot:"row",size:16,state:d,actions:S})}return(0,_AppIcon.renderAppIcon)(e.icon,{slot:"row",size:16,color:e.color})})()},`row-${e.id}`))]})}),r&&!v&&(0,_jsxRuntime.jsx)(_DialDevTools.DialDevTools,{apps:o,state:d,actions:S,onClose:()=>{h(false)}})]})};exports.FloatingMenu=FloatingMenu;const styles=_reactNative.StyleSheet.create({fab:{paddingHorizontal:6,paddingVertical:4,borderRadius:6,marginRight:4,alignItems:"center",justifyContent:"center",minWidth:0,minHeight:0,backgroundColor:"transparent"},menuButton:{paddingHorizontal:4,paddingVertical:2,minWidth:16,alignItems:"center",justifyContent:"center"},menuDots:{color:"#8CA2C8",fontSize:14,fontWeight:"900"},onboardingContainer:{..._sharedUi.absoluteFill,zIndex:1e4},onboardingBackdrop:{..._sharedUi.absoluteFill,backgroundColor:"rgba(0, 0, 0, 0.85)"}});const MenuLauncherIcon=({size:o=14,color:d=_sharedUi.buoyColors.primary})=>{const c=Math.max(2,Math.floor(o/4));const g=Math.max(1,Math.floor(o/16));const t=Array.from({length:9});return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:o,height:o,flexDirection:"row",flexWrap:"wrap",alignContent:"center",justifyContent:"center"},children:t.map((f,n)=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:c,height:c,margin:g,borderRadius:2,backgroundColor:d}},n))})};
@@ -1,274 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.MinimizedToolsProvider = MinimizedToolsProvider;
7
- exports.getIconPosition = getIconPosition;
8
- exports.getIconSize = getIconSize;
9
- exports.useMinimizedTools = useMinimizedTools;
10
- var _react = _interopRequireWildcard(require("react"));
11
- var _reactNative = require("react-native");
12
- var _sharedUi = require("@buoy-gg/shared-ui");
13
- var _jsxRuntime = require("react/jsx-runtime");
14
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
15
- // ============================================================================
16
- // Types
17
- // ============================================================================
18
-
19
- // Type moved to the platform-free AppHostLogic.ts (so the web host can use
20
- // it without importing this react-native file); re-exported for back-compat.
21
-
22
- /**
23
- * Represents a minimized tool that can be restored
24
- */
25
-
26
- /**
27
- * Position for a minimized tool icon in the stack
28
- */
29
-
30
- // ============================================================================
31
- // Constants
32
- // ============================================================================
33
-
34
- const ICON_SIZE = 44;
35
- const ICON_GAP = 12;
36
- const BOTTOM_OFFSET = 100; // Distance from safe area bottom
37
- const RIGHT_OFFSET = 16; // Distance from right edge
38
-
39
- /**
40
- * Calculate the position of a minimized tool icon in the stack
41
- * Icons stack upward from bottom-right corner
42
- */
43
- function getIconPosition(index) {
44
- const {
45
- width: screenWidth,
46
- height: screenHeight
47
- } = _reactNative.Dimensions.get("window");
48
- const safeArea = (0, _sharedUi.getSafeAreaInsets)();
49
-
50
- // X position: right edge minus icon size and offset
51
- const x = screenWidth - ICON_SIZE - RIGHT_OFFSET;
52
-
53
- // Y position: bottom up, starting at safe area bottom + offset
54
- const baseY = screenHeight - safeArea.bottom - BOTTOM_OFFSET - ICON_SIZE;
55
- const y = baseY - index * (ICON_SIZE + ICON_GAP);
56
- return {
57
- x,
58
- y
59
- };
60
- }
61
-
62
- /**
63
- * Get the icon size constant
64
- */
65
- function getIconSize() {
66
- return ICON_SIZE;
67
- }
68
-
69
- /**
70
- * Context value for minimized tools management
71
- */
72
-
73
- // ============================================================================
74
- // Storage
75
- // ============================================================================
76
-
77
- const STORAGE_KEY = "@react_buoy_minimized_tools";
78
- const PERSISTENCE_DELAY = 500;
79
-
80
- /**
81
- * Serializable version of MinimizedTool for storage
82
- * (icon is not serializable, so we only store the id to reconstruct)
83
- */
84
-
85
- // ============================================================================
86
- // Context
87
- // ============================================================================
88
-
89
- const MinimizedToolsContext = /*#__PURE__*/(0, _react.createContext)(null);
90
-
91
- // ============================================================================
92
- // Provider
93
- // ============================================================================
94
-
95
- /**
96
- * Provider component for minimized tools management.
97
- * Handles state, persistence, and provides context to children.
98
- */
99
- function MinimizedToolsProvider({
100
- children,
101
- getToolIcon
102
- }) {
103
- const [minimizedTools, setMinimizedTools] = (0, _react.useState)([]);
104
- /**
105
- * A mirror of the list that can be read SYNCHRONOUSLY.
106
- *
107
- * `restore()` has to return the tool it removed, in the same tick, because
108
- * its caller uses that return value to un-minimize the tool in AppHost. It
109
- * cannot get that from `minimizedTools` (the callback is memoized with no
110
- * deps, so it would close over a stale list) and it cannot get it from
111
- * inside a state updater either — see the note on `restore`.
112
- */
113
- const minimizedToolsRef = (0, _react.useRef)([]);
114
- const [isRestored, setIsRestored] = (0, _react.useState)(false);
115
- const persistenceTimeoutRef = (0, _react.useRef)(null);
116
- const getToolIconRef = (0, _react.useRef)(getToolIcon);
117
-
118
- // Keep ref updated
119
- (0, _react.useEffect)(() => {
120
- getToolIconRef.current = getToolIcon;
121
- }, [getToolIcon]);
122
-
123
- // Restore minimized tools from storage on mount
124
- (0, _react.useEffect)(() => {
125
- const restoreMinimizedTools = async () => {
126
- try {
127
- const saved = await _sharedUi.persistentStorage.getItem(STORAGE_KEY);
128
- if (saved) {
129
- const serialized = JSON.parse(saved);
130
- // Reconstruct tools with icons
131
- const restored = serialized.map(tool => ({
132
- ...tool,
133
- icon: getToolIconRef.current?.(tool.id) ?? null
134
- }));
135
- setMinimizedTools(restored);
136
- }
137
- } catch (error) {
138
- // Failed to restore minimized tools - continue with empty state
139
- }
140
- setIsRestored(true);
141
- };
142
- restoreMinimizedTools();
143
- }, []);
144
-
145
- // One assignment, every render, so the ref never lags the state it mirrors.
146
- minimizedToolsRef.current = minimizedTools;
147
-
148
- // Persist minimized tools to storage with debounce
149
- (0, _react.useEffect)(() => {
150
- if (!isRestored) return;
151
- if (persistenceTimeoutRef.current) {
152
- clearTimeout(persistenceTimeoutRef.current);
153
- }
154
- persistenceTimeoutRef.current = setTimeout(() => {
155
- // Serialize tools (exclude icon which is not serializable)
156
- const serialized = minimizedTools.map(({
157
- icon,
158
- ...rest
159
- }) => rest);
160
- _sharedUi.persistentStorage.setItem(STORAGE_KEY, JSON.stringify(serialized));
161
- }, PERSISTENCE_DELAY);
162
- return () => {
163
- if (persistenceTimeoutRef.current) {
164
- clearTimeout(persistenceTimeoutRef.current);
165
- }
166
- };
167
- }, [minimizedTools, isRestored]);
168
- const minimize = (0, _react.useCallback)(tool => {
169
- setMinimizedTools(current => {
170
- // Check if already minimized (by id for singleton behavior)
171
- const existing = current.find(t => t.id === tool.id);
172
- if (existing) {
173
- // Update existing minimized tool
174
- return current.map(t => t.id === tool.id ? {
175
- ...tool,
176
- minimizedAt: Date.now()
177
- } : t);
178
- }
179
- // Add new minimized tool
180
- return [...current, {
181
- ...tool,
182
- minimizedAt: Date.now()
183
- }];
184
- });
185
- }, []);
186
-
187
- /**
188
- * Take a tool out of the minimized list and hand it back to the caller.
189
- *
190
- * THE RETURN VALUE IS LOAD-BEARING. `MinimizedToolsStack` only calls
191
- * `onRestore` — which is what actually un-minimizes the tool in AppHost —
192
- * when this returns non-null. This used to assign the tool inside the
193
- * `setMinimizedTools` updater and read it back on the next line, which
194
- * assumes React runs updaters synchronously at the call site. Under React
195
- * 18's automatic batching it does not: the updater runs in the render
196
- * phase, so the caller always saw `null`, `onRestore` never fired, and
197
- * AppHost kept the tool flagged `minimized: true`. The tool then sat in the
198
- * rail with no way back — tapping it did nothing, and neither did opening
199
- * it again from the dial, because AppHost already had it open. It survived
200
- * reloads, because both stores are persisted.
201
- *
202
- * Reading the ref instead keeps the lookup synchronous and leaves the
203
- * updater doing only what an updater should: deriving the next state.
204
- */
205
- const restore = (0, _react.useCallback)(instanceId => {
206
- const restoredTool = minimizedToolsRef.current.find(t => t.instanceId === instanceId) ?? null;
207
- if (!restoredTool) return null;
208
- setMinimizedTools(current => current.filter(t => t.instanceId !== instanceId));
209
- return restoredTool;
210
- }, []);
211
- const isMinimized = (0, _react.useCallback)(id => {
212
- return minimizedTools.some(t => t.id === id);
213
- }, [minimizedTools]);
214
- const getMinimizedTool = (0, _react.useCallback)(instanceId => {
215
- return minimizedTools.find(t => t.instanceId === instanceId);
216
- }, [minimizedTools]);
217
- const clearAll = (0, _react.useCallback)(() => {
218
- setMinimizedTools([]);
219
- }, []);
220
- const getNextIconPosition = (0, _react.useCallback)(() => {
221
- // Next icon will be at the current count index
222
- return getIconPosition(minimizedTools.length);
223
- }, [minimizedTools.length]);
224
- const getToolIconPosition = (0, _react.useCallback)(instanceId => {
225
- const index = minimizedTools.findIndex(t => t.instanceId === instanceId);
226
- if (index === -1) return null;
227
- return getIconPosition(index);
228
- }, [minimizedTools]);
229
- const value = (0, _react.useMemo)(() => ({
230
- minimizedTools,
231
- minimize,
232
- restore,
233
- isMinimized,
234
- getMinimizedTool,
235
- clearAll,
236
- count: minimizedTools.length,
237
- getNextIconPosition,
238
- getToolIconPosition
239
- }), [minimizedTools, minimize, restore, isMinimized, getMinimizedTool, clearAll, getNextIconPosition, getToolIconPosition]);
240
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(MinimizedToolsContext.Provider, {
241
- value: value,
242
- children: children
243
- });
244
- }
245
-
246
- // ============================================================================
247
- // Hook
248
- // ============================================================================
249
-
250
- /**
251
- * Hook to access minimized tools context.
252
- * Must be used within a MinimizedToolsProvider.
253
- */
254
- function useMinimizedTools() {
255
- const context = (0, _react.useContext)(MinimizedToolsContext);
256
- if (!context) {
257
- // Return a no-op implementation when outside provider
258
- return {
259
- minimizedTools: [],
260
- minimize: () => {},
261
- restore: () => null,
262
- isMinimized: () => false,
263
- getMinimizedTool: () => undefined,
264
- clearAll: () => {},
265
- count: 0,
266
- getNextIconPosition: () => ({
267
- x: 0,
268
- y: 0
269
- }),
270
- getToolIconPosition: () => null
271
- };
272
- }
273
- return context;
274
- }
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.MinimizedToolsProvider=MinimizedToolsProvider;exports.getIconPosition=getIconPosition;exports.getIconSize=getIconSize;exports.useMinimizedTools=useMinimizedTools;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(u,f){if("function"==typeof WeakMap)var t=new WeakMap,a=new WeakMap;return(_interopRequireWildcard=function(e,m){if(!m&&e&&e.__esModule)return e;var o,s,l={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return l;if(o=m?a:t){if(o.has(e))return o.get(e);o.set(e,l)}for(const c in e)"default"!==c&&{}.hasOwnProperty.call(e,c)&&((s=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,c))&&(s.get||s.set)?o(l,c,s):l[c]=e[c]);return l})(u,f)}const ICON_SIZE=44;const ICON_GAP=12;const BOTTOM_OFFSET=100;const RIGHT_OFFSET=16;function getIconPosition(u){const{width:f,height:t}=_reactNative.Dimensions.get("window");const a=(0,_sharedUi.getSafeAreaInsets)();const e=f-ICON_SIZE-RIGHT_OFFSET;const m=t-a.bottom-BOTTOM_OFFSET-ICON_SIZE;const o=m-u*(ICON_SIZE+ICON_GAP);return{x:e,y:o}}function getIconSize(){return ICON_SIZE}const STORAGE_KEY="@react_buoy_minimized_tools";const PERSISTENCE_DELAY=500;const MinimizedToolsContext=(0,_react.createContext)(null);function MinimizedToolsProvider({children:u,getToolIcon:f}){const[t,a]=(0,_react.useState)([]);const e=(0,_react.useRef)([]);const[m,o]=(0,_react.useState)(false);const s=(0,_react.useRef)(null);const l=(0,_react.useRef)(f);(0,_react.useEffect)(()=>{l.current=f},[f]);(0,_react.useEffect)(()=>{const i=async()=>{try{const n=await _sharedUi.persistentStorage.getItem(STORAGE_KEY);if(n){const r=JSON.parse(n);const d=r.map(x=>({...x,icon:l.current?.(x.id)??null}));a(d)}}catch(n){}o(true)};i()},[]);e.current=t;(0,_react.useEffect)(()=>{if(!m)return;if(s.current){clearTimeout(s.current)}s.current=setTimeout(()=>{const i=t.map(({icon:n,...r})=>r);_sharedUi.persistentStorage.setItem(STORAGE_KEY,JSON.stringify(i))},PERSISTENCE_DELAY);return()=>{if(s.current){clearTimeout(s.current)}}},[t,m]);const c=(0,_react.useCallback)(i=>{a(n=>{const r=n.find(d=>d.id===i.id);if(r){return n.map(d=>d.id===i.id?{...i,minimizedAt:Date.now()}:d)}return[...n,{...i,minimizedAt:Date.now()}]})},[]);const g=(0,_react.useCallback)(i=>{const n=e.current.find(r=>r.instanceId===i)??null;if(!n)return null;a(r=>r.filter(d=>d.instanceId!==i));return n},[]);const p=(0,_react.useCallback)(i=>{return t.some(n=>n.id===i)},[t]);const T=(0,_react.useCallback)(i=>{return t.find(n=>n.instanceId===i)},[t]);const z=(0,_react.useCallback)(()=>{a([])},[]);const _=(0,_react.useCallback)(()=>{return getIconPosition(t.length)},[t.length]);const I=(0,_react.useCallback)(i=>{const n=t.findIndex(r=>r.instanceId===i);if(n===-1)return null;return getIconPosition(n)},[t]);const M=(0,_react.useMemo)(()=>({minimizedTools:t,minimize:c,restore:g,isMinimized:p,getMinimizedTool:T,clearAll:z,count:t.length,getNextIconPosition:_,getToolIconPosition:I}),[t,c,g,p,T,z,_,I]);return(0,_jsxRuntime.jsx)(MinimizedToolsContext.Provider,{value:M,children:u})}function useMinimizedTools(){const u=(0,_react.useContext)(MinimizedToolsContext);if(!u){return{minimizedTools:[],minimize:()=>{},restore:()=>null,isMinimized:()=>false,getMinimizedTool:()=>void 0,clearAll:()=>{},count:0,getNextIconPosition:()=>({x:0,y:0}),getToolIconPosition:()=>null}}return u}