@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,376 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useAppHost = exports.AppOverlay = exports.AppHostProvider = void 0;
7
- var _sharedUi = require("@buoy-gg/shared-ui");
8
- var _react = require("react");
9
- var _AppHostLogic = require("./AppHostLogic.js");
10
- var _AppIcon = require("./AppIcon");
11
- var _ToolHost = require("./ToolHost.js");
12
- var _DevToolsSettingsModalShared = require("./DevToolsSettingsModal.shared.js");
13
- var _floatingToolsWeb = require("./floatingTools.web.js");
14
- var _jsxRuntime = require("react/jsx-runtime");
15
- /**
16
- * Browser tool host using the shared open-app state machine and persistence.
17
- * Minimized tools derive from openApps. Escape closes the top visible tool;
18
- * the minimized stack remains attached to the floating menu.
19
- */
20
-
21
- const AppHostContext = /*#__PURE__*/(0, _react.createContext)(null);
22
- const STORAGE_KEY_OPEN_APPS = "@react_buoy_open_apps";
23
-
24
- // Minimized dock geometry — mirrors MinimizedToolsContext.tsx constants.
25
- const ICON_SIZE = 44;
26
- const ICON_GAP = 12;
27
- const BOTTOM_OFFSET = 100;
28
- const RIGHT_OFFSET = 16;
29
- const dockIconPosition = index => ({
30
- x: window.innerWidth - ICON_SIZE - RIGHT_OFFSET,
31
- y: window.innerHeight - BOTTOM_OFFSET - ICON_SIZE - index * (ICON_SIZE + ICON_GAP)
32
- });
33
-
34
- /**
35
- * Provides the floating dev tools application host for web. Tracks open tool
36
- * instances, restores persisted state, and exposes the same imperative
37
- * helpers as the native `AppHostProvider`.
38
- */
39
- const AppHostProvider = ({
40
- children
41
- }) => {
42
- const [openApps, setOpenApps] = (0, _react.useState)([]);
43
- const [isRestored, setIsRestored] = (0, _react.useState)(false);
44
- const installedAppsRef = (0, _react.useRef)([]);
45
- const pendingRestoreRef = (0, _react.useRef)(null);
46
- const restoredRef = (0, _react.useRef)(false);
47
- const storageReadRef = (0, _react.useRef)(false);
48
- const registeredRef = (0, _react.useRef)(false);
49
- const open = (0, _react.useCallback)(def => {
50
- let resolvedId = "";
51
- setOpenApps(current => {
52
- const {
53
- apps,
54
- instanceId
55
- } = (0, _AppHostLogic.resolveOpenAppsState)(current, def, () => `${def.id}-${Date.now()}-${Math.random().toString(36).slice(2)}`);
56
- resolvedId = instanceId;
57
- return apps;
58
- });
59
- return resolvedId;
60
- }, []);
61
- const tryRestorePending = (0, _react.useCallback)(() => {
62
- if (restoredRef.current || !storageReadRef.current || !registeredRef.current) return;
63
- restoredRef.current = true;
64
- const pendingApps = pendingRestoreRef.current;
65
- if (!pendingApps || pendingApps.length === 0) {
66
- setIsRestored(true);
67
- return;
68
- }
69
- pendingRestoreRef.current = null;
70
- pendingApps.forEach(({
71
- id: appId,
72
- minimized
73
- }) => {
74
- const appDef = installedAppsRef.current.find(app => app.id === appId);
75
- if (appDef && appDef.component) {
76
- const resolvedIcon = (0, _AppIcon.renderAppIcon)(appDef.icon, {
77
- slot: "dial",
78
- size: 20,
79
- color: appDef.color
80
- });
81
- open({
82
- id: appDef.id,
83
- title: appDef.name,
84
- component: appDef.component,
85
- props: appDef.props,
86
- modal: appDef.modal,
87
- launchMode: appDef.launchMode || "self-modal",
88
- singleton: appDef.singleton ?? true,
89
- icon: resolvedIcon,
90
- color: appDef.color,
91
- minimized
92
- });
93
- }
94
- });
95
- setIsRestored(true);
96
- }, [open]);
97
-
98
- // Restore open apps on mount. Handles both the legacy `string[]` shape and
99
- // the current `{id, minimized}[]` shape — same tolerance as native.
100
- (0, _react.useEffect)(() => {
101
- let cancelled = false;
102
- const restoreOpenApps = async () => {
103
- try {
104
- const saved = await _sharedUi.persistentStorage.getItem(STORAGE_KEY_OPEN_APPS);
105
- if (cancelled) return;
106
- if (saved) {
107
- const parsed = JSON.parse(saved);
108
- let savedApps;
109
- if (Array.isArray(parsed) && parsed.length > 0) {
110
- if (typeof parsed[0] === "string") {
111
- savedApps = parsed.map(id => ({
112
- id,
113
- minimized: false
114
- }));
115
- } else {
116
- savedApps = parsed.filter(item => typeof item === "object" && item !== null && typeof item.id === "string");
117
- }
118
- if (savedApps.length) {
119
- pendingRestoreRef.current = savedApps;
120
- }
121
- }
122
- }
123
- } catch {
124
- // Failed to restore open apps - continue with fresh state
125
- }
126
- if (cancelled) return;
127
- storageReadRef.current = true;
128
- tryRestorePending();
129
- };
130
- void restoreOpenApps();
131
- return () => {
132
- cancelled = true;
133
- };
134
- }, [tryRestorePending]);
135
-
136
- // Save discrete open/minimize/close changes before a reload can lose them.
137
- (0, _react.useEffect)(() => {
138
- if (!isRestored) return;
139
- const appStates = openApps.map(app => ({
140
- id: app.id,
141
- minimized: app.minimized ?? false
142
- }));
143
- void _sharedUi.persistentStorage.setItem(STORAGE_KEY_OPEN_APPS, JSON.stringify(appStates));
144
- }, [openApps, isRestored]);
145
-
146
- // Store reference to installed apps for restoration
147
- const registerApps = (0, _react.useCallback)(apps => {
148
- installedAppsRef.current = apps;
149
- registeredRef.current = true;
150
- tryRestorePending();
151
- }, [tryRestorePending]);
152
- const close = (0, _react.useCallback)(instanceId => {
153
- setOpenApps(s => {
154
- if (!s.length) return s;
155
- if (!instanceId) return s.slice(0, -1);
156
- return s.filter(a => a.instanceId !== instanceId);
157
- });
158
- }, []);
159
- const closeAll = (0, _react.useCallback)(() => setOpenApps([]), []);
160
- const minimize = (0, _react.useCallback)((instanceId, restoreState) => {
161
- setOpenApps(s => s.map(app => app.instanceId === instanceId ? {
162
- ...app,
163
- minimized: true,
164
- restoreState
165
- } : app));
166
- }, []);
167
- const restore = (0, _react.useCallback)((instanceId, restoreState) => {
168
- setOpenApps(s => s.map(app => app.instanceId === instanceId ? {
169
- ...app,
170
- minimized: false,
171
- restoreState: restoreState ?? app.restoreState
172
- } : app));
173
- }, []);
174
- const isMinimized = (0, _react.useCallback)(instanceId => {
175
- const app = openApps.find(a => a.instanceId === instanceId);
176
- return app?.minimized ?? false;
177
- }, [openApps]);
178
-
179
- // Escape closes the top-most open tool — web analog of the native
180
- // hardware-back handler.
181
- const hasVisibleApps = openApps.some(app => app.launchMode !== "toggle-only" && !app.minimized);
182
- (0, _react.useEffect)(() => {
183
- if (!hasVisibleApps) return;
184
- const handler = event => {
185
- if (event.key !== "Escape") return;
186
- if (event.defaultPrevented) return;
187
- const top = [...openApps].reverse().find(app => app.launchMode !== "toggle-only" && !app.minimized);
188
- if (top) close(top.instanceId);
189
- };
190
- window.addEventListener("keydown", handler);
191
- return () => window.removeEventListener("keydown", handler);
192
- }, [hasVisibleApps, close, openApps]);
193
- const value = (0, _react.useMemo)(() => ({
194
- openApps,
195
- isAnyOpen: hasVisibleApps,
196
- open,
197
- close,
198
- closeAll,
199
- registerApps,
200
- minimize,
201
- restore,
202
- isMinimized
203
- }), [openApps, hasVisibleApps, open, close, closeAll, registerApps, minimize, restore, isMinimized]);
204
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(AppHostContext.Provider, {
205
- value: value,
206
- children: children
207
- });
208
- };
209
-
210
- /**
211
- * Accessor hook for the web app host. Falls back to a no-op implementation
212
- * when rendered outside the provider — same contract as native.
213
- */
214
- exports.AppHostProvider = AppHostProvider;
215
- const useAppHost = () => {
216
- const ctx = (0, _react.useContext)(AppHostContext);
217
- if (!ctx) {
218
- return {
219
- openApps: [],
220
- isAnyOpen: false,
221
- open: () => "",
222
- close: () => {},
223
- closeAll: () => {},
224
- registerApps: () => {},
225
- minimize: () => {},
226
- restore: () => {},
227
- isMinimized: () => false
228
- };
229
- }
230
- return ctx;
231
- };
232
-
233
- // Base z-index for tool surfaces — parity with native AppOverlay.
234
- exports.useAppHost = useAppHost;
235
- const BASE_ZINDEX = 9000;
236
- // The dock sits above tool panels but below the dial/settings overlays (10000).
237
-
238
- const backdropStyle = {
239
- position: "fixed",
240
- inset: 0,
241
- backgroundColor: "rgba(0,0,0,0.28)",
242
- display: "flex",
243
- alignItems: "center",
244
- justifyContent: "center"
245
- };
246
- const cardStyle = {
247
- maxHeight: "90%",
248
- width: "94%",
249
- borderRadius: 12,
250
- backgroundColor: "white",
251
- overflow: "hidden"
252
- };
253
-
254
- /**
255
- * Renders a single app instance — DOM twin of the native `AppRenderer`.
256
- * Keeps the component mounted while minimized (visible={false} /
257
- * display:none) so tool state and listeners survive, like native.
258
- */
259
- const AppRenderer = ({
260
- app,
261
- zIndex,
262
- onClose,
263
- onMinimize,
264
- minimizeTargetPosition,
265
- enableSharedModalDimensions
266
- }) => {
267
- const Comp = app.component;
268
- const isVisible = !app.minimized;
269
- const bodyProps = {
270
- ...(app.props ?? {}),
271
- ...(enableSharedModalDimensions ? {
272
- enableSharedModalDimensions: true
273
- } : {})
274
- };
275
- if (app.modal && (!app.launchMode || app.launchMode === "self-modal")) {
276
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToolHost.ToolModalShell, {
277
- app: app,
278
- config: app.modal,
279
- visible: isVisible,
280
- zIndex: zIndex,
281
- onClose: onClose,
282
- onMinimize: onMinimize,
283
- initialModalState: app.restoreState,
284
- enableSharedModalDimensions: enableSharedModalDimensions,
285
- bodyProps: bodyProps
286
- });
287
- }
288
- if (app.launchMode === "self-modal") {
289
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, {
290
- ...bodyProps,
291
- visible: isVisible,
292
- onClose: onClose,
293
- onRequestClose: onClose,
294
- onMinimize: onMinimize,
295
- minimizeTargetPosition: minimizeTargetPosition,
296
- instanceId: app.instanceId,
297
- zIndex: zIndex,
298
- initialModalState: app.restoreState
299
- });
300
- }
301
- if (app.launchMode === "inline") {
302
- if (!isVisible) return null;
303
- // pointerEvents:none matches native box-none: the layer never eats input;
304
- // inline tool components opt back in with pointerEvents:auto on their own
305
- // interactive surfaces.
306
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
307
- style: {
308
- position: "fixed",
309
- inset: 0,
310
- zIndex,
311
- pointerEvents: "none"
312
- },
313
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, {
314
- ...bodyProps,
315
- onClose: onClose,
316
- onMinimize: onMinimize,
317
- minimizeTargetPosition: minimizeTargetPosition,
318
- instanceId: app.instanceId
319
- })
320
- });
321
- }
322
-
323
- // host-modal mode
324
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
325
- style: {
326
- ...backdropStyle,
327
- zIndex,
328
- display: isVisible ? "flex" : "none"
329
- },
330
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
331
- style: cardStyle,
332
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, {
333
- ...bodyProps,
334
- onClose: onClose,
335
- onMinimize: onMinimize,
336
- minimizeTargetPosition: minimizeTargetPosition,
337
- instanceId: app.instanceId
338
- })
339
- })
340
- });
341
- };
342
-
343
- /**
344
- * Renders all open dev tool surfaces — DOM twin of the native `AppOverlay`.
345
- * Later-opened tools stack on top (base z 9000 + index). Minimized tools are
346
- * shown by the MinimizedToolsStack fused to the floating bubble (native
347
- * parity) — the old fixed bottom-right MinimizedDock was replaced by it.
348
- */
349
- const AppOverlay = () => {
350
- const {
351
- openApps,
352
- close,
353
- minimize
354
- } = useAppHost();
355
- const {
356
- settings
357
- } = (0, _DevToolsSettingsModalShared.useDevToolsSettings)();
358
- const renderableApps = openApps.filter(app => app.launchMode !== "toggle-only");
359
- if (renderableApps.length === 0) return null;
360
- const minimizedCount = renderableApps.filter(app => app.minimized).length;
361
-
362
- // Minimize animation shrinks toward the bubble (where the stack lives);
363
- // fall back to the legacy dock slot if the bubble hasn't mounted yet.
364
- const minimizeTarget = (0, _floatingToolsWeb.getBubbleAnchorPosition)() ?? dockIconPosition(minimizedCount);
365
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
366
- children: renderableApps.map((app, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(AppRenderer, {
367
- app: app,
368
- zIndex: BASE_ZINDEX + index,
369
- onClose: () => close(app.instanceId),
370
- onMinimize: state => minimize(app.instanceId, state),
371
- enableSharedModalDimensions: settings.globalSettings?.enableSharedModalDimensions === true,
372
- minimizeTargetPosition: minimizeTarget
373
- }, app.instanceId))
374
- });
375
- };
376
- exports.AppOverlay = AppOverlay;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.useAppHost=exports.AppOverlay=exports.AppHostProvider=void 0;var _sharedUi=require("@buoy-gg/shared-ui");var _react=require("react");var _AppHostLogic=require("./AppHostLogic.js");var _AppIcon=require("./AppIcon");var _ToolHost=require("./ToolHost.js");var _DevToolsSettingsModalShared=require("./DevToolsSettingsModal.shared.js");var _floatingToolsWeb=require("./floatingTools.web.js");var _jsxRuntime=require("react/jsx-runtime");const AppHostContext=(0,_react.createContext)(null);const STORAGE_KEY_OPEN_APPS="@react_buoy_open_apps";const ICON_SIZE=44;const ICON_GAP=12;const BOTTOM_OFFSET=100;const RIGHT_OFFSET=16;const dockIconPosition=t=>({x:window.innerWidth-ICON_SIZE-RIGHT_OFFSET,y:window.innerHeight-BOTTOM_OFFSET-ICON_SIZE-t*(ICON_SIZE+ICON_GAP)});const AppHostProvider=({children:t})=>{const[r,l]=(0,_react.useState)([]);const[d,c]=(0,_react.useState)(false);const f=(0,_react.useRef)([]);const u=(0,_react.useRef)(null);const i=(0,_react.useRef)(false);const p=(0,_react.useRef)(false);const g=(0,_react.useRef)(false);const h=(0,_react.useCallback)(n=>{let s="";l(o=>{const{apps:e,instanceId:a}=(0,_AppHostLogic.resolveOpenAppsState)(o,n,()=>`${n.id}-${Date.now()}-${Math.random().toString(36).slice(2)}`);s=a;return e});return s},[]);const v=(0,_react.useCallback)(()=>{if(i.current||!p.current||!g.current)return;i.current=true;const n=u.current;if(!n||n.length===0){c(true);return}u.current=null;n.forEach(({id:s,minimized:o})=>{const e=f.current.find(a=>a.id===s);if(e&&e.component){const a=(0,_AppIcon.renderAppIcon)(e.icon,{slot:"dial",size:20,color:e.color});h({id:e.id,title:e.name,component:e.component,props:e.props,modal:e.modal,launchMode:e.launchMode||"self-modal",singleton:e.singleton??true,icon:a,color:e.color,minimized:o})}});c(true)},[h]);(0,_react.useEffect)(()=>{let n=false;const s=async()=>{try{const o=await _sharedUi.persistentStorage.getItem(STORAGE_KEY_OPEN_APPS);if(n)return;if(o){const e=JSON.parse(o);let a;if(Array.isArray(e)&&e.length>0){if(typeof e[0]==="string"){a=e.map(m=>({id:m,minimized:false}))}else{a=e.filter(m=>typeof m==="object"&&m!==null&&typeof m.id==="string")}if(a.length){u.current=a}}}}catch{}if(n)return;p.current=true;v()};void s();return()=>{n=true}},[v]);(0,_react.useEffect)(()=>{if(!d)return;const n=r.map(s=>({id:s.id,minimized:s.minimized??false}));void _sharedUi.persistentStorage.setItem(STORAGE_KEY_OPEN_APPS,JSON.stringify(n))},[r,d]);const b=(0,_react.useCallback)(n=>{f.current=n;g.current=true;v()},[v]);const A=(0,_react.useCallback)(n=>{l(s=>{if(!s.length)return s;if(!n)return s.slice(0,-1);return s.filter(o=>o.instanceId!==n)})},[]);const S=(0,_react.useCallback)(()=>l([]),[]);const x=(0,_react.useCallback)((n,s)=>{l(o=>o.map(e=>e.instanceId===n?{...e,minimized:true,restoreState:s}:e))},[]);const I=(0,_react.useCallback)((n,s)=>{l(o=>o.map(e=>e.instanceId===n?{...e,minimized:false,restoreState:s??e.restoreState}:e))},[]);const M=(0,_react.useCallback)(n=>{const s=r.find(o=>o.instanceId===n);return s?.minimized??false},[r]);const y=r.some(n=>n.launchMode!=="toggle-only"&&!n.minimized);(0,_react.useEffect)(()=>{if(!y)return;const n=s=>{if(s.key!=="Escape")return;if(s.defaultPrevented)return;const o=[...r].reverse().find(e=>e.launchMode!=="toggle-only"&&!e.minimized);if(o)A(o.instanceId)};window.addEventListener("keydown",n);return()=>window.removeEventListener("keydown",n)},[y,A,r]);const z=(0,_react.useMemo)(()=>({openApps:r,isAnyOpen:y,open:h,close:A,closeAll:S,registerApps:b,minimize:x,restore:I,isMinimized:M}),[r,y,h,A,S,b,x,I,M]);return(0,_jsxRuntime.jsx)(AppHostContext.Provider,{value:z,children:t})};exports.AppHostProvider=AppHostProvider;const useAppHost=()=>{const t=(0,_react.useContext)(AppHostContext);if(!t){return{openApps:[],isAnyOpen:false,open:()=>"",close:()=>{},closeAll:()=>{},registerApps:()=>{},minimize:()=>{},restore:()=>{},isMinimized:()=>false}}return t};exports.useAppHost=useAppHost;const BASE_ZINDEX=9e3;const backdropStyle={position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.28)",display:"flex",alignItems:"center",justifyContent:"center"};const cardStyle={maxHeight:"90%",width:"94%",borderRadius:12,backgroundColor:"white",overflow:"hidden"};const AppRenderer=({app:t,zIndex:r,onClose:l,onMinimize:d,minimizeTargetPosition:c,enableSharedModalDimensions:f})=>{const u=t.component;const i=!t.minimized;const p={...t.props??{},...f?{enableSharedModalDimensions:true}:{}};if(t.modal&&(!t.launchMode||t.launchMode==="self-modal")){return(0,_jsxRuntime.jsx)(_ToolHost.ToolModalShell,{app:t,config:t.modal,visible:i,zIndex:r,onClose:l,onMinimize:d,initialModalState:t.restoreState,enableSharedModalDimensions:f,bodyProps:p})}if(t.launchMode==="self-modal"){return(0,_jsxRuntime.jsx)(u,{...p,visible:i,onClose:l,onRequestClose:l,onMinimize:d,minimizeTargetPosition:c,instanceId:t.instanceId,zIndex:r,initialModalState:t.restoreState})}if(t.launchMode==="inline"){if(!i)return null;return(0,_jsxRuntime.jsx)("div",{style:{position:"fixed",inset:0,zIndex:r,pointerEvents:"none"},children:(0,_jsxRuntime.jsx)(u,{...p,onClose:l,onMinimize:d,minimizeTargetPosition:c,instanceId:t.instanceId})})}return(0,_jsxRuntime.jsx)("div",{style:{...backdropStyle,zIndex:r,display:i?"flex":"none"},children:(0,_jsxRuntime.jsx)("div",{style:cardStyle,children:(0,_jsxRuntime.jsx)(u,{...p,onClose:l,onMinimize:d,minimizeTargetPosition:c,instanceId:t.instanceId})})})};const AppOverlay=()=>{const{openApps:t,close:r,minimize:l}=useAppHost();const{settings:d}=(0,_DevToolsSettingsModalShared.useDevToolsSettings)();const c=t.filter(i=>i.launchMode!=="toggle-only");if(c.length===0)return null;const f=c.filter(i=>i.minimized).length;const u=(0,_floatingToolsWeb.getBubbleAnchorPosition)()??dockIconPosition(f);return(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:c.map((i,p)=>(0,_jsxRuntime.jsx)(AppRenderer,{app:i,zIndex:BASE_ZINDEX+p,onClose:()=>r(i.instanceId),onMinimize:g=>l(i.instanceId,g),enableSharedModalDimensions:d.globalSettings?.enableSharedModalDimensions===true,minimizeTargetPosition:u},i.instanceId))})};exports.AppOverlay=AppOverlay;
@@ -1,50 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.resolveOpenAppsState = void 0;
7
- /**
8
- * Modal state to restore when reopening a minimized tool. Defined here (the
9
- * platform-free logic module) so the web host doesn't pull in the native
10
- * MinimizedToolsContext; that file re-exports this type for back-compat.
11
- */
12
-
13
- /**
14
- * Computes the new list of open tool instances when a user launches a dev app. Singleton
15
- * tools reuse their existing instance while non-singletons create a new entry using the
16
- * provided `generateId` helper.
17
- *
18
- * @param current - Current stack of open app instances.
19
- * @param def - Descriptor of the tool to launch (without runtime instance id).
20
- * @param generateId - Callback used to generate a unique instance identifier.
21
- * @returns Updated instance list alongside the resolved instance id.
22
- */
23
- const resolveOpenAppsState = (current, def, generateId) => {
24
- if (def.singleton) {
25
- const existing = current.find(app => app.id === def.id);
26
- if (existing) {
27
- const wasMinimized = existing.minimized ?? false;
28
- return {
29
- instanceId: existing.instanceId,
30
- wasMinimized,
31
- apps: [...current.filter(app => app.instanceId !== existing.instanceId),
32
- // Un-minimize the existing app when re-opening it
33
- {
34
- ...existing,
35
- minimized: false
36
- }]
37
- };
38
- }
39
- }
40
- const instanceId = generateId();
41
- return {
42
- instanceId,
43
- wasMinimized: false,
44
- apps: [...current, {
45
- ...def,
46
- instanceId
47
- }]
48
- };
49
- };
50
- exports.resolveOpenAppsState = resolveOpenAppsState;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.resolveOpenAppsState=void 0;const resolveOpenAppsState=(s,i,p)=>{if(i.singleton){const e=s.find(n=>n.id===i.id);if(e){const n=e.minimized??false;return{instanceId:e.instanceId,wasMinimized:n,apps:[...s.filter(a=>a.instanceId!==e.instanceId),{...e,minimized:false}]}}}const t=p();return{instanceId:t,wasMinimized:false,apps:[...s,{...i,instanceId:t}]}};exports.resolveOpenAppsState=resolveOpenAppsState;
@@ -1,91 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.AppTextIcon = AppTextIcon;
7
- exports.renderAppIcon = renderAppIcon;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _reactNative = require("react-native");
10
- var _sharedUi = require("@buoy-gg/shared-ui");
11
- var _jsxRuntime = require("react/jsx-runtime");
12
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
- /**
14
- * Icon resolution for `InstalledApp.icon`.
15
- *
16
- * Custom tools may provide an icon three ways:
17
- * - a component `({ slot, size }) => node` (dynamic, hook-capable)
18
- * - a pre-built ReactNode
19
- * - a PLAIN STRING — "AUTH", "KIT", "🗑️" — rendered as an auto-fitting text
20
- * icon so simple tools never need an icon library.
21
- *
22
- * Every menu surface (dial, row, minimize stack, restore path) resolves icons
23
- * through `renderAppIcon` so all three forms behave identically.
24
- */
25
-
26
- /** Visible glyphs, not UTF-16 units — "🗑️" is one glyph, not three. */
27
- function glyphCount(label) {
28
- // Strip variation selectors + zero-width joiners before counting.
29
- const stripped = label.replace(/[\uFE00-\uFE0F\u200D]/g, "");
30
- return Math.max(Array.from(stripped).length, 1);
31
- }
32
- function AppTextIcon({
33
- label,
34
- size,
35
- color = _sharedUi.toolTheme.colors.text
36
- }) {
37
- const chars = glyphCount(label);
38
- // Short labels stay square; longer ones ("AUTH") get a wider box — the
39
- // dial/row layouts have breathing room and the label reads better than a
40
- // squashed square would. The computed font size is what fits the box on
41
- // web; adjustsFontSizeToFit covers native font-metric drift.
42
- const maxWidth = chars <= 2 ? size : size * 1.6;
43
- const fontSize = Math.max(7, Math.min(size * (chars === 1 ? 0.7 : 0.62), maxWidth / (0.62 * chars)));
44
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
45
- style: {
46
- minWidth: size,
47
- maxWidth,
48
- height: size,
49
- alignItems: "center",
50
- justifyContent: "center"
51
- },
52
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
53
- numberOfLines: 1,
54
- adjustsFontSizeToFit: true,
55
- minimumFontScale: 0.5,
56
- style: {
57
- color,
58
- fontSize,
59
- fontWeight: "800",
60
- letterSpacing: 0.5,
61
- textAlign: "center"
62
- },
63
- children: label
64
- })
65
- });
66
- }
67
-
68
- /**
69
- * Resolve any `InstalledApp.icon` form to a renderable node. Function icons
70
- * become elements (createElement — hooks keep working); strings become
71
- * auto-fitting text icons; nodes pass through.
72
- */
73
- function renderAppIcon(icon, ctx) {
74
- if (icon == null) return icon;
75
- if (typeof icon === "function") {
76
- return /*#__PURE__*/_react.default.createElement(icon, {
77
- slot: ctx.slot,
78
- size: ctx.size,
79
- state: ctx.state,
80
- actions: ctx.actions
81
- });
82
- }
83
- if (typeof icon === "string" || typeof icon === "number") {
84
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(AppTextIcon, {
85
- label: String(icon),
86
- size: ctx.size,
87
- color: ctx.color
88
- });
89
- }
90
- return icon;
91
- }
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.AppTextIcon=AppTextIcon;exports.renderAppIcon=renderAppIcon;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function glyphCount(e){const t=e.replace(/[\uFE00-\uFE0F\u200D]/g,"");return Math.max(Array.from(t).length,1)}function AppTextIcon({label:e,size:t,color:u=_sharedUi.toolTheme.colors.text}){const r=glyphCount(e);const n=r<=2?t:t*1.6;const i=Math.max(7,Math.min(t*(r===1?.7:.62),n/(.62*r)));return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{minWidth:t,maxWidth:n,height:t,alignItems:"center",justifyContent:"center"},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{numberOfLines:1,adjustsFontSizeToFit:true,minimumFontScale:.5,style:{color:u,fontSize:i,fontWeight:"800",letterSpacing:.5,textAlign:"center"},children:e})})}function renderAppIcon(e,t){if(e==null)return e;if(typeof e==="function"){return _react.default.createElement(e,{slot:t.slot,size:t.size,state:t.state,actions:t.actions})}if(typeof e==="string"||typeof e==="number"){return(0,_jsxRuntime.jsx)(AppTextIcon,{label:String(e),size:t.size,color:t.color})}return e}
@@ -1,53 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.AppTextIcon = AppTextIcon;
7
- exports.renderAppIcon = renderAppIcon;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _sharedUi = require("@buoy-gg/shared-ui");
10
- var _jsxRuntime = require("react/jsx-runtime");
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- /** DOM twin of the native icon resolver; importing RN breaks pure web hosts. */
13
- function AppTextIcon({
14
- label,
15
- size,
16
- color = _sharedUi.toolTheme.colors.text
17
- }) {
18
- const chars = Math.max(Array.from(label.replace(/[\uFE00-\uFE0F\u200D]/g, "")).length, 1);
19
- const maxWidth = chars <= 2 ? size : size * 1.6;
20
- const fontSize = Math.max(7, Math.min(size * (chars === 1 ? 0.7 : 0.62), maxWidth / (0.62 * chars)));
21
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
22
- style: {
23
- display: "inline-flex",
24
- minWidth: size,
25
- maxWidth,
26
- height: size,
27
- alignItems: "center",
28
- justifyContent: "center",
29
- color,
30
- fontSize,
31
- fontWeight: 800,
32
- letterSpacing: 0.5,
33
- whiteSpace: "nowrap",
34
- overflow: "hidden"
35
- },
36
- children: label
37
- });
38
- }
39
- function renderAppIcon(icon, ctx) {
40
- if (icon == null) return icon;
41
- if (typeof icon === "function") return /*#__PURE__*/_react.default.createElement(icon, {
42
- slot: ctx.slot,
43
- size: ctx.size,
44
- state: ctx.state,
45
- actions: ctx.actions
46
- });
47
- if (typeof icon === "string" || typeof icon === "number") return /*#__PURE__*/(0, _jsxRuntime.jsx)(AppTextIcon, {
48
- label: String(icon),
49
- size: ctx.size,
50
- color: ctx.color
51
- });
52
- return icon;
53
- }
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.AppTextIcon=AppTextIcon;exports.renderAppIcon=renderAppIcon;var _react=_interopRequireDefault(require("react"));var _sharedUi=require("@buoy-gg/shared-ui");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function AppTextIcon({label:e,size:t,color:o=_sharedUi.toolTheme.colors.text}){const r=Math.max(Array.from(e.replace(/[\uFE00-\uFE0F\u200D]/g,"")).length,1);const n=r<=2?t:t*1.6;const a=Math.max(7,Math.min(t*(r===1?.7:.62),n/(.62*r)));return(0,_jsxRuntime.jsx)("span",{style:{display:"inline-flex",minWidth:t,maxWidth:n,height:t,alignItems:"center",justifyContent:"center",color:o,fontSize:a,fontWeight:800,letterSpacing:.5,whiteSpace:"nowrap",overflow:"hidden"},children:e})}function renderAppIcon(e,t){if(e==null)return e;if(typeof e==="function")return _react.default.createElement(e,{slot:t.slot,size:t.size,state:t.state,actions:t.actions});if(typeof e==="string"||typeof e==="number")return(0,_jsxRuntime.jsx)(AppTextIcon,{label:String(e),size:t.size,color:t.color});return e}