@buoy-gg/ask-buoy 7.0.38 → 7.0.39

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 (306) hide show
  1. package/lib/commonjs/blocks/AskBlocks.js +338 -1
  2. package/lib/commonjs/blocks/AskBlocks.js.map +1 -0
  3. package/lib/commonjs/blocks/BlockRenderer.js +262 -1
  4. package/lib/commonjs/blocks/BlockRenderer.js.map +1 -0
  5. package/lib/commonjs/blocks/ChromePrototypes.js +514 -1
  6. package/lib/commonjs/blocks/ChromePrototypes.js.map +1 -0
  7. package/lib/commonjs/blocks/DataBlocks.js +781 -1
  8. package/lib/commonjs/blocks/DataBlocks.js.map +1 -0
  9. package/lib/commonjs/blocks/ExtraBlocks.js +1860 -1
  10. package/lib/commonjs/blocks/ExtraBlocks.js.map +1 -0
  11. package/lib/commonjs/blocks/MediaBlocks.js +156 -1
  12. package/lib/commonjs/blocks/MediaBlocks.js.map +1 -0
  13. package/lib/commonjs/blocks/ReceiptBlocks.js +586 -1
  14. package/lib/commonjs/blocks/ReceiptBlocks.js.map +1 -0
  15. package/lib/commonjs/blocks/blockText.js +60 -1
  16. package/lib/commonjs/blocks/blockText.js.map +1 -0
  17. package/lib/commonjs/blocks/blockText.test.js +53 -1
  18. package/lib/commonjs/blocks/blockText.test.js.map +1 -0
  19. package/lib/commonjs/blocks/context.js +42 -1
  20. package/lib/commonjs/blocks/context.js.map +1 -0
  21. package/lib/commonjs/blocks/icons.js +96 -1
  22. package/lib/commonjs/blocks/icons.js.map +1 -0
  23. package/lib/commonjs/blocks/index.js +95 -1
  24. package/lib/commonjs/blocks/index.js.map +1 -0
  25. package/lib/commonjs/blocks/listRow.test.js +55 -1
  26. package/lib/commonjs/blocks/listRow.test.js.map +1 -0
  27. package/lib/commonjs/blocks/pageState.js +34 -1
  28. package/lib/commonjs/blocks/pageState.js.map +1 -0
  29. package/lib/commonjs/blocks/pageState.test.js +57 -1
  30. package/lib/commonjs/blocks/pageState.test.js.map +1 -0
  31. package/lib/commonjs/blocks/primitives.js +457 -1
  32. package/lib/commonjs/blocks/primitives.js.map +1 -0
  33. package/lib/commonjs/blocks/primitivesIndex.js +62 -1
  34. package/lib/commonjs/blocks/primitivesIndex.js.map +1 -0
  35. package/lib/commonjs/components/ApprovalCard.js +297 -1
  36. package/lib/commonjs/components/ApprovalCard.js.map +1 -0
  37. package/lib/commonjs/components/AskBuoyHeader.js +196 -1
  38. package/lib/commonjs/components/AskBuoyHeader.js.map +1 -0
  39. package/lib/commonjs/components/AskBuoyIcon.js +19 -1
  40. package/lib/commonjs/components/AskBuoyIcon.js.map +1 -0
  41. package/lib/commonjs/components/AskBuoyModal.js +479 -1
  42. package/lib/commonjs/components/AskBuoyModal.js.map +1 -0
  43. package/lib/commonjs/components/AskBuoySettings.js +181 -1
  44. package/lib/commonjs/components/AskBuoySettings.js.map +1 -0
  45. package/lib/commonjs/components/ChangesBar.js +211 -1
  46. package/lib/commonjs/components/ChangesBar.js.map +1 -0
  47. package/lib/commonjs/components/Composer.js +255 -1
  48. package/lib/commonjs/components/Composer.js.map +1 -0
  49. package/lib/commonjs/components/EmptyState.js +161 -1
  50. package/lib/commonjs/components/EmptyState.js.map +1 -0
  51. package/lib/commonjs/components/KeyboardPad.js +80 -1
  52. package/lib/commonjs/components/KeyboardPad.js.map +1 -0
  53. package/lib/commonjs/components/Markdown.js +310 -1
  54. package/lib/commonjs/components/Markdown.js.map +1 -0
  55. package/lib/commonjs/components/MessageList.js +970 -1
  56. package/lib/commonjs/components/MessageList.js.map +1 -0
  57. package/lib/commonjs/components/QueuedMessages.js +145 -1
  58. package/lib/commonjs/components/QueuedMessages.js.map +1 -0
  59. package/lib/commonjs/components/ThinkingStrip.js +223 -1
  60. package/lib/commonjs/components/ThinkingStrip.js.map +1 -0
  61. package/lib/commonjs/components/TypingDots.js +63 -1
  62. package/lib/commonjs/components/TypingDots.js.map +1 -0
  63. package/lib/commonjs/components/markdownParse.js +131 -1
  64. package/lib/commonjs/components/markdownParse.js.map +1 -0
  65. package/lib/commonjs/components/markdownParse.test.js +99 -1
  66. package/lib/commonjs/components/markdownParse.test.js.map +1 -0
  67. package/lib/commonjs/components/useCopyAction.js +50 -1
  68. package/lib/commonjs/components/useCopyAction.js.map +1 -0
  69. package/lib/commonjs/index.js +252 -1
  70. package/lib/commonjs/index.js.map +1 -0
  71. package/lib/commonjs/preset.js +91 -1
  72. package/lib/commonjs/preset.js.map +1 -0
  73. package/lib/commonjs/store/activityGroups.js +110 -1
  74. package/lib/commonjs/store/activityGroups.js.map +1 -0
  75. package/lib/commonjs/store/activityGroups.test.js +78 -1
  76. package/lib/commonjs/store/activityGroups.test.js.map +1 -0
  77. package/lib/commonjs/store/askBuoySettings.js +72 -1
  78. package/lib/commonjs/store/askBuoySettings.js.map +1 -0
  79. package/lib/commonjs/store/askBuoyStore.js +589 -1
  80. package/lib/commonjs/store/askBuoyStore.js.map +1 -0
  81. package/lib/commonjs/store/blockPlacement.js +64 -1
  82. package/lib/commonjs/store/blockPlacement.js.map +1 -0
  83. package/lib/commonjs/store/blockPlacement.test.js +123 -1
  84. package/lib/commonjs/store/blockPlacement.test.js.map +1 -0
  85. package/lib/commonjs/store/queue.test.js +150 -1
  86. package/lib/commonjs/store/queue.test.js.map +1 -0
  87. package/lib/commonjs/store/resetConversation.js +77 -1
  88. package/lib/commonjs/store/resetConversation.js.map +1 -0
  89. package/lib/commonjs/store/restorePending.test.js +63 -1
  90. package/lib/commonjs/store/restorePending.test.js.map +1 -0
  91. package/lib/commonjs/store/restoredIds.test.js +47 -1
  92. package/lib/commonjs/store/restoredIds.test.js.map +1 -0
  93. package/lib/commonjs/store/suggestions.js +54 -1
  94. package/lib/commonjs/store/suggestions.js.map +1 -0
  95. package/lib/commonjs/store/suggestions.test.js +58 -1
  96. package/lib/commonjs/store/suggestions.test.js.map +1 -0
  97. package/lib/commonjs/store/systemLine.test.js +77 -1
  98. package/lib/commonjs/store/systemLine.test.js.map +1 -0
  99. package/lib/commonjs/store/ticketPrompt.js +17 -1
  100. package/lib/commonjs/store/ticketPrompt.js.map +1 -0
  101. package/lib/commonjs/store/traceText.js +81 -1
  102. package/lib/commonjs/store/traceText.js.map +1 -0
  103. package/lib/commonjs/store/traceText.test.js +112 -1
  104. package/lib/commonjs/store/traceText.test.js.map +1 -0
  105. package/lib/commonjs/store/transcriptPersistence.js +297 -1
  106. package/lib/commonjs/store/transcriptPersistence.js.map +1 -0
  107. package/lib/commonjs/store/transcriptPersistence.test.js +333 -1
  108. package/lib/commonjs/store/transcriptPersistence.test.js.map +1 -0
  109. package/lib/commonjs/store/turnRendering.test.js +151 -1
  110. package/lib/commonjs/store/turnRendering.test.js.map +1 -0
  111. package/lib/commonjs/store/useAskBuoy.js +651 -1
  112. package/lib/commonjs/store/useAskBuoy.js.map +1 -0
  113. package/lib/commonjs/store/useAskBuoySettings.js +14 -1
  114. package/lib/commonjs/store/useAskBuoySettings.js.map +1 -0
  115. package/lib/commonjs/sync/askBuoySyncAdapter.js +153 -1
  116. package/lib/commonjs/sync/askBuoySyncAdapter.js.map +1 -0
  117. package/lib/commonjs/sync/askBuoySyncAdapter.test.js +141 -1
  118. package/lib/commonjs/sync/askBuoySyncAdapter.test.js.map +1 -0
  119. package/lib/commonjs/sync/wire.js +58 -1
  120. package/lib/commonjs/sync/wire.js.map +1 -0
  121. package/lib/commonjs/types.js +6 -1
  122. package/lib/commonjs/types.js.map +1 -0
  123. package/lib/module/blocks/AskBlocks.js +331 -1
  124. package/lib/module/blocks/AskBlocks.js.map +1 -0
  125. package/lib/module/blocks/BlockRenderer.js +257 -1
  126. package/lib/module/blocks/BlockRenderer.js.map +1 -0
  127. package/lib/module/blocks/ChromePrototypes.js +503 -1
  128. package/lib/module/blocks/ChromePrototypes.js.map +1 -0
  129. package/lib/module/blocks/DataBlocks.js +767 -1
  130. package/lib/module/blocks/DataBlocks.js.map +1 -0
  131. package/lib/module/blocks/ExtraBlocks.js +1833 -1
  132. package/lib/module/blocks/ExtraBlocks.js.map +1 -0
  133. package/lib/module/blocks/MediaBlocks.js +151 -1
  134. package/lib/module/blocks/MediaBlocks.js.map +1 -0
  135. package/lib/module/blocks/ReceiptBlocks.js +574 -1
  136. package/lib/module/blocks/ReceiptBlocks.js.map +1 -0
  137. package/lib/module/blocks/blockText.js +55 -1
  138. package/lib/module/blocks/blockText.js.map +1 -0
  139. package/lib/module/blocks/blockText.test.js +53 -1
  140. package/lib/module/blocks/blockText.test.js.map +1 -0
  141. package/lib/module/blocks/context.js +35 -1
  142. package/lib/module/blocks/context.js.map +1 -0
  143. package/lib/module/blocks/icons.js +91 -1
  144. package/lib/module/blocks/icons.js.map +1 -0
  145. package/lib/module/blocks/index.js +8 -1
  146. package/lib/module/blocks/index.js.map +1 -0
  147. package/lib/module/blocks/listRow.test.js +56 -1
  148. package/lib/module/blocks/listRow.test.js.map +1 -0
  149. package/lib/module/blocks/pageState.js +30 -1
  150. package/lib/module/blocks/pageState.js.map +1 -0
  151. package/lib/module/blocks/pageState.test.js +56 -1
  152. package/lib/module/blocks/pageState.test.js.map +1 -0
  153. package/lib/module/blocks/primitives.js +445 -1
  154. package/lib/module/blocks/primitives.js.map +1 -0
  155. package/lib/module/blocks/primitivesIndex.js +5 -1
  156. package/lib/module/blocks/primitivesIndex.js.map +1 -0
  157. package/lib/module/components/ApprovalCard.js +292 -1
  158. package/lib/module/components/ApprovalCard.js.map +1 -0
  159. package/lib/module/components/AskBuoyHeader.js +193 -1
  160. package/lib/module/components/AskBuoyHeader.js.map +1 -0
  161. package/lib/module/components/AskBuoyIcon.js +8 -1
  162. package/lib/module/components/AskBuoyIcon.js.map +1 -0
  163. package/lib/module/components/AskBuoyModal.js +474 -1
  164. package/lib/module/components/AskBuoyModal.js.map +1 -0
  165. package/lib/module/components/AskBuoySettings.js +176 -1
  166. package/lib/module/components/AskBuoySettings.js.map +1 -0
  167. package/lib/module/components/ChangesBar.js +206 -1
  168. package/lib/module/components/ChangesBar.js.map +1 -0
  169. package/lib/module/components/Composer.js +250 -1
  170. package/lib/module/components/Composer.js.map +1 -0
  171. package/lib/module/components/EmptyState.js +156 -1
  172. package/lib/module/components/EmptyState.js.map +1 -0
  173. package/lib/module/components/KeyboardPad.js +75 -1
  174. package/lib/module/components/KeyboardPad.js.map +1 -0
  175. package/lib/module/components/Markdown.js +305 -1
  176. package/lib/module/components/Markdown.js.map +1 -0
  177. package/lib/module/components/MessageList.js +964 -1
  178. package/lib/module/components/MessageList.js.map +1 -0
  179. package/lib/module/components/QueuedMessages.js +140 -1
  180. package/lib/module/components/QueuedMessages.js.map +1 -0
  181. package/lib/module/components/ThinkingStrip.js +218 -1
  182. package/lib/module/components/ThinkingStrip.js.map +1 -0
  183. package/lib/module/components/TypingDots.js +58 -1
  184. package/lib/module/components/TypingDots.js.map +1 -0
  185. package/lib/module/components/markdownParse.js +125 -1
  186. package/lib/module/components/markdownParse.js.map +1 -0
  187. package/lib/module/components/markdownParse.test.js +98 -1
  188. package/lib/module/components/markdownParse.test.js.map +1 -0
  189. package/lib/module/components/useCopyAction.js +46 -1
  190. package/lib/module/components/useCopyAction.js.map +1 -0
  191. package/lib/module/index.js +34 -1
  192. package/lib/module/index.js.map +1 -0
  193. package/lib/module/preset.js +74 -1
  194. package/lib/module/preset.js.map +1 -0
  195. package/lib/module/store/activityGroups.js +103 -1
  196. package/lib/module/store/activityGroups.js.map +1 -0
  197. package/lib/module/store/activityGroups.test.js +77 -1
  198. package/lib/module/store/activityGroups.test.js.map +1 -0
  199. package/lib/module/store/askBuoySettings.js +67 -1
  200. package/lib/module/store/askBuoySettings.js.map +1 -0
  201. package/lib/module/store/askBuoyStore.js +583 -1
  202. package/lib/module/store/askBuoyStore.js.map +1 -0
  203. package/lib/module/store/blockPlacement.js +59 -1
  204. package/lib/module/store/blockPlacement.js.map +1 -0
  205. package/lib/module/store/blockPlacement.test.js +122 -1
  206. package/lib/module/store/blockPlacement.test.js.map +1 -0
  207. package/lib/module/store/queue.test.js +149 -1
  208. package/lib/module/store/queue.test.js.map +1 -0
  209. package/lib/module/store/resetConversation.js +72 -1
  210. package/lib/module/store/resetConversation.js.map +1 -0
  211. package/lib/module/store/restorePending.test.js +62 -1
  212. package/lib/module/store/restorePending.test.js.map +1 -0
  213. package/lib/module/store/restoredIds.test.js +46 -1
  214. package/lib/module/store/restoredIds.test.js.map +1 -0
  215. package/lib/module/store/suggestions.js +49 -1
  216. package/lib/module/store/suggestions.js.map +1 -0
  217. package/lib/module/store/suggestions.test.js +57 -1
  218. package/lib/module/store/suggestions.test.js.map +1 -0
  219. package/lib/module/store/systemLine.test.js +76 -1
  220. package/lib/module/store/systemLine.test.js.map +1 -0
  221. package/lib/module/store/ticketPrompt.js +13 -1
  222. package/lib/module/store/ticketPrompt.js.map +1 -0
  223. package/lib/module/store/traceText.js +75 -1
  224. package/lib/module/store/traceText.js.map +1 -0
  225. package/lib/module/store/traceText.test.js +111 -1
  226. package/lib/module/store/traceText.test.js.map +1 -0
  227. package/lib/module/store/transcriptPersistence.js +287 -1
  228. package/lib/module/store/transcriptPersistence.js.map +1 -0
  229. package/lib/module/store/transcriptPersistence.test.js +332 -1
  230. package/lib/module/store/transcriptPersistence.test.js.map +1 -0
  231. package/lib/module/store/turnRendering.test.js +150 -1
  232. package/lib/module/store/turnRendering.test.js.map +1 -0
  233. package/lib/module/store/useAskBuoy.js +646 -1
  234. package/lib/module/store/useAskBuoy.js.map +1 -0
  235. package/lib/module/store/useAskBuoySettings.js +9 -1
  236. package/lib/module/store/useAskBuoySettings.js.map +1 -0
  237. package/lib/module/sync/askBuoySyncAdapter.js +148 -1
  238. package/lib/module/sync/askBuoySyncAdapter.js.map +1 -0
  239. package/lib/module/sync/askBuoySyncAdapter.test.js +140 -1
  240. package/lib/module/sync/askBuoySyncAdapter.test.js.map +1 -0
  241. package/lib/module/sync/wire.js +47 -1
  242. package/lib/module/sync/wire.js.map +1 -0
  243. package/lib/module/types.js +4 -1
  244. package/lib/module/types.js.map +1 -0
  245. package/lib/typescript/blocks/AskBlocks.d.ts.map +1 -0
  246. package/lib/typescript/blocks/BlockRenderer.d.ts.map +1 -0
  247. package/lib/typescript/blocks/ChromePrototypes.d.ts.map +1 -0
  248. package/lib/typescript/blocks/DataBlocks.d.ts.map +1 -0
  249. package/lib/typescript/blocks/ExtraBlocks.d.ts.map +1 -0
  250. package/lib/typescript/blocks/MediaBlocks.d.ts.map +1 -0
  251. package/lib/typescript/blocks/ReceiptBlocks.d.ts.map +1 -0
  252. package/lib/typescript/blocks/blockText.d.ts.map +1 -0
  253. package/lib/typescript/blocks/blockText.test.d.ts.map +1 -0
  254. package/lib/typescript/blocks/context.d.ts.map +1 -0
  255. package/lib/typescript/blocks/icons.d.ts.map +1 -0
  256. package/lib/typescript/blocks/index.d.ts.map +1 -0
  257. package/lib/typescript/blocks/listRow.test.d.ts.map +1 -0
  258. package/lib/typescript/blocks/pageState.d.ts.map +1 -0
  259. package/lib/typescript/blocks/pageState.test.d.ts.map +1 -0
  260. package/lib/typescript/blocks/primitives.d.ts.map +1 -0
  261. package/lib/typescript/blocks/primitivesIndex.d.ts.map +1 -0
  262. package/lib/typescript/components/ApprovalCard.d.ts.map +1 -0
  263. package/lib/typescript/components/AskBuoyHeader.d.ts.map +1 -0
  264. package/lib/typescript/components/AskBuoyIcon.d.ts.map +1 -0
  265. package/lib/typescript/components/AskBuoyModal.d.ts.map +1 -0
  266. package/lib/typescript/components/AskBuoySettings.d.ts.map +1 -0
  267. package/lib/typescript/components/ChangesBar.d.ts.map +1 -0
  268. package/lib/typescript/components/Composer.d.ts.map +1 -0
  269. package/lib/typescript/components/EmptyState.d.ts.map +1 -0
  270. package/lib/typescript/components/KeyboardPad.d.ts.map +1 -0
  271. package/lib/typescript/components/Markdown.d.ts.map +1 -0
  272. package/lib/typescript/components/MessageList.d.ts.map +1 -0
  273. package/lib/typescript/components/QueuedMessages.d.ts.map +1 -0
  274. package/lib/typescript/components/ThinkingStrip.d.ts.map +1 -0
  275. package/lib/typescript/components/TypingDots.d.ts.map +1 -0
  276. package/lib/typescript/components/markdownParse.d.ts.map +1 -0
  277. package/lib/typescript/components/markdownParse.test.d.ts.map +1 -0
  278. package/lib/typescript/components/useCopyAction.d.ts.map +1 -0
  279. package/lib/typescript/index.d.ts.map +1 -0
  280. package/lib/typescript/preset.d.ts.map +1 -0
  281. package/lib/typescript/store/activityGroups.d.ts.map +1 -0
  282. package/lib/typescript/store/activityGroups.test.d.ts.map +1 -0
  283. package/lib/typescript/store/askBuoySettings.d.ts.map +1 -0
  284. package/lib/typescript/store/askBuoyStore.d.ts.map +1 -0
  285. package/lib/typescript/store/blockPlacement.d.ts.map +1 -0
  286. package/lib/typescript/store/blockPlacement.test.d.ts.map +1 -0
  287. package/lib/typescript/store/queue.test.d.ts.map +1 -0
  288. package/lib/typescript/store/resetConversation.d.ts.map +1 -0
  289. package/lib/typescript/store/restorePending.test.d.ts.map +1 -0
  290. package/lib/typescript/store/restoredIds.test.d.ts.map +1 -0
  291. package/lib/typescript/store/suggestions.d.ts.map +1 -0
  292. package/lib/typescript/store/suggestions.test.d.ts.map +1 -0
  293. package/lib/typescript/store/systemLine.test.d.ts.map +1 -0
  294. package/lib/typescript/store/ticketPrompt.d.ts.map +1 -0
  295. package/lib/typescript/store/traceText.d.ts.map +1 -0
  296. package/lib/typescript/store/traceText.test.d.ts.map +1 -0
  297. package/lib/typescript/store/transcriptPersistence.d.ts.map +1 -0
  298. package/lib/typescript/store/transcriptPersistence.test.d.ts.map +1 -0
  299. package/lib/typescript/store/turnRendering.test.d.ts.map +1 -0
  300. package/lib/typescript/store/useAskBuoy.d.ts.map +1 -0
  301. package/lib/typescript/store/useAskBuoySettings.d.ts.map +1 -0
  302. package/lib/typescript/sync/askBuoySyncAdapter.d.ts.map +1 -0
  303. package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts.map +1 -0
  304. package/lib/typescript/sync/wire.d.ts.map +1 -0
  305. package/lib/typescript/types.d.ts.map +1 -0
  306. package/package.json +8 -8
@@ -1 +1,255 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Composer=Composer;var _react=require("react"),_reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_jsxRuntime=require("react/jsx-runtime");const MIN_INPUT_HEIGHT=40,MAX_INPUT_HEIGHT=120,INPUT_PAD_V="ios"===_reactNative.Platform.OS?10:6,INPUT_PAD_H=16;function Composer({onSend:e,onStop:t,busy:s,draft:r,onDraftTaken:i,disabled:o,placeholder:a,focusKey:l,canFocus:n=!0}){const[c,d]=(0,_react.useState)(""),u=(0,_react.useRef)(null);(0,_react.useEffect)(()=>{l&&n&&!o&&u.current?.focus()},[l,n,o]),(0,_react.useEffect)(()=>{r&&(d(e=>e?`${e} ${r}`:r),i?.())},[r,i]);const h=(0,_react.useCallback)(()=>{const t=c.trim();t&&(d(""),e(t))},[c,e]),y=c.trim().length>0&&!s&&!o,_=c.trim().length>0&&s&&!o;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.wrap,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.field,o&&styles.fieldDisabled],children:(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:u,testID:"buoy-ask-buoy-input",style:[styles.input,0===c.length&&styles.inputEmpty],value:c,onChangeText:d,placeholder:a??(o?"Ask Buoy isn't set up yet":"Ask, or tell it what to change…"),placeholderTextColor:_sharedUi.night.color.placeholder,multiline:!0,editable:!o,keyboardType:"ascii-capable",autoCorrect:!0,autoCapitalize:"sentences",blurOnSubmit:!1,onSubmitEditing:h,returnKeyType:"send",maxLength:4e3})}),_&&(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:"buoy-ask-buoy-queue",accessibilityRole:"button",accessibilityLabel:"Queue message",onPress:h,style:({pressed:e})=>[styles.button,styles.queue,e&&styles.pressed],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.sendGlyph,{color:_sharedUi.night.color.accent}],children:"↑"})}),s?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:"buoy-ask-buoy-stop",accessibilityRole:"button",accessibilityLabel:"Stop",onPress:t,style:({pressed:e})=>[styles.button,styles.stop,e&&styles.pressed],children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.stopGlyph})}):(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:"buoy-ask-buoy-send",accessibilityRole:"button",accessibilityLabel:"Send",disabled:!y,onPress:h,style:({pressed:e})=>[styles.button,y?styles.sendOn:styles.sendOff,e&&y&&styles.pressed],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.sendGlyph,{color:y?_sharedUi.night.color.onAccent:_sharedUi.night.color.textTertiary}],children:"↑"})})]})}const styles=_reactNative.StyleSheet.create({wrap:{flexDirection:"row",alignItems:"flex-end",gap:8,paddingHorizontal:_sharedUi.night.gutter,paddingTop:10,paddingBottom:6,borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.bg},field:{flex:1,minHeight:40,justifyContent:"center",borderRadius:20,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surfaceElevated},fieldDisabled:{opacity:.6},input:{maxHeight:120,paddingHorizontal:16,paddingTop:INPUT_PAD_V,paddingBottom:INPUT_PAD_V,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.row},inputEmpty:{height:40},button:{width:40,height:40,borderRadius:20,alignItems:"center",justifyContent:"center"},sendGlyph:{fontSize:20,fontWeight:"700",lineHeight:22},sendOn:{backgroundColor:_sharedUi.night.color.accent},sendOff:{backgroundColor:_sharedUi.night.color.fill},stop:{backgroundColor:_sharedUi.night.color.fillTertiary},queue:{backgroundColor:"transparent",borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.accentBorderStrong},stopGlyph:{width:12,height:12,borderRadius:2,backgroundColor:_sharedUi.night.color.text},pressed:{opacity:.7}});
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Composer = Composer;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ var _sharedUi = require("@buoy-gg/shared-ui");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ /**
12
+ * The message box.
13
+ *
14
+ * This is the first keyboard-safe BOTTOM input in Buoy, and the reason none
15
+ * existed before is that JsModal has no keyboard handling at all: the sheet is
16
+ * `position:absolute; bottom:0` inside the app tree, not an RN `Modal`, so on
17
+ * iOS the keyboard simply draws over it. Two other tools hit this and chose to
18
+ * dodge it — NetworkNumberPrompt and StorageValueEditModal both say so in
19
+ * comments and pin their inputs to the TOP of the screen. A chat cannot.
20
+ *
21
+ * What makes it work:
22
+ * - `KeyboardPad` (see that file), iOS only. `KeyboardAvoidingView` looked
23
+ * right here and did nothing: it measures its frame relative to its PARENT
24
+ * and compares that with the keyboard's SCREEN position, which never
25
+ * overlap inside a bottom-anchored sheet. On Android Expo's default
26
+ * `softwareKeyboardLayoutMode: "resize"` shrinks the window and a
27
+ * bottom-anchored view rides up for free; adding padding there would lift
28
+ * it twice.
29
+ * - The parent list carries `keyboardShouldPersistTaps="handled"`. Without it
30
+ * the first tap after typing only dismisses the keyboard and Send never
31
+ * fires — a real shipped bug in Time Machine, and invisible to Detox because
32
+ * `replaceText` opens no keyboard.
33
+ * - `keyboardType="ascii-capable"`, because iOS Smart Punctuation rewrites
34
+ * straight quotes as curly ones. That permanently broke the raw-JSON editor
35
+ * in Storage, and a tester pasting a JSON blob here would hit the same wall.
36
+ *
37
+ * While the agent is working the send button becomes a STOP button — a
38
+ * square, the universal glyph — rather than a spinner in a circle, which
39
+ * looked like a disabled control and gave no hint it was tappable.
40
+ */
41
+
42
+ /**
43
+ * One line of input, and the height of the send/stop button beside it — the
44
+ * row only reads as level while those two agree.
45
+ */
46
+ const MIN_INPUT_HEIGHT = 40;
47
+ /** ~5 lines, then it scrolls instead of eating the transcript. */
48
+ const MAX_INPUT_HEIGHT = 120;
49
+ const INPUT_PAD_V = _reactNative.Platform.OS === "ios" ? 10 : 6;
50
+ const INPUT_PAD_H = 16;
51
+ function Composer({
52
+ onSend,
53
+ onStop,
54
+ busy,
55
+ draft,
56
+ onDraftTaken,
57
+ disabled,
58
+ placeholder,
59
+ focusKey,
60
+ canFocus = true
61
+ }) {
62
+ const [text, setText] = (0, _react.useState)("");
63
+ const inputRef = (0, _react.useRef)(null);
64
+ (0, _react.useEffect)(() => {
65
+ if (!focusKey || !canFocus || disabled) return;
66
+ inputRef.current?.focus();
67
+ }, [focusKey, canFocus, disabled]);
68
+ (0, _react.useEffect)(() => {
69
+ if (!draft) return;
70
+ // Appended, not assigned: they may have started typing something else in
71
+ // the moment between pressing Stop and this landing.
72
+ setText(current => current ? `${current} ${draft}` : draft);
73
+ onDraftTaken?.();
74
+ }, [draft, onDraftTaken]);
75
+ const submit = (0, _react.useCallback)(() => {
76
+ const value = text.trim();
77
+ if (!value) return;
78
+ setText("");
79
+ onSend(value);
80
+ }, [text, onSend]);
81
+ const canSend = text.trim().length > 0 && !busy && !disabled;
82
+ /**
83
+ * Typed something while a turn is running.
84
+ *
85
+ * `send` parks it and flushes it when the turn ends — but the only button on
86
+ * screen while busy was Stop, so the sole way to reach that was the
87
+ * keyboard's return key, and the "Queued" placeholder that explains it only
88
+ * appears AFTER you have managed it. The button is the affordance.
89
+ */
90
+ const canQueue = text.trim().length > 0 && busy && !disabled;
91
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
92
+ style: styles.wrap,
93
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
94
+ style: [styles.field, disabled && styles.fieldDisabled],
95
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
96
+ ref: inputRef,
97
+ testID: "buoy-ask-buoy-input"
98
+ /*
99
+ * Empty means one line, always.
100
+ *
101
+ * The box is otherwise auto-height, and an iOS multiline TextInput
102
+ * grows with the text but never shrinks back: sending a two-line
103
+ * message cleared the text and left a two-line box standing over
104
+ * the 40pt round button beside it. Nothing on the native side
105
+ * reports the shrink either — on Fabric `onContentSizeChange` is
106
+ * emitted from `updateLayoutMetrics` (a LAYOUT change), not from a
107
+ * text change — so the height it last grew to is the height it
108
+ * keeps. Pinning the empty case is the whole fix: it is the only
109
+ * state that has to line up with the button, and it is exactly the
110
+ * state a send or a new conversation lands in.
111
+ */,
112
+ style: [styles.input, text.length === 0 && styles.inputEmpty],
113
+ value: text,
114
+ onChangeText: setText,
115
+ placeholder: placeholder ?? (disabled ? "Ask Buoy isn't set up yet" : "Ask, or tell it what to change…"),
116
+ placeholderTextColor: _sharedUi.night.color.placeholder,
117
+ multiline: true,
118
+ editable: !disabled
119
+ // Straight quotes only — see the header note.
120
+ ,
121
+ keyboardType: "ascii-capable",
122
+ autoCorrect: true,
123
+ autoCapitalize: "sentences"
124
+ // Enter sends; Shift-Enter is not a thing on a phone keyboard, and a
125
+ // multiline box with no submit affordance strands people.
126
+ ,
127
+ blurOnSubmit: false,
128
+ onSubmitEditing: submit,
129
+ returnKeyType: "send",
130
+ maxLength: 4000
131
+ })
132
+ }), canQueue && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
133
+ testID: "buoy-ask-buoy-queue",
134
+ accessibilityRole: "button",
135
+ accessibilityLabel: "Queue message",
136
+ onPress: submit,
137
+ style: ({
138
+ pressed
139
+ }) => [styles.button, styles.queue, pressed && styles.pressed],
140
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
141
+ style: [styles.sendGlyph, {
142
+ color: _sharedUi.night.color.accent
143
+ }],
144
+ children: "\u2191"
145
+ })
146
+ }), busy ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
147
+ testID: "buoy-ask-buoy-stop",
148
+ accessibilityRole: "button",
149
+ accessibilityLabel: "Stop",
150
+ onPress: onStop,
151
+ style: ({
152
+ pressed
153
+ }) => [styles.button, styles.stop, pressed && styles.pressed],
154
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
155
+ style: styles.stopGlyph
156
+ })
157
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
158
+ testID: "buoy-ask-buoy-send",
159
+ accessibilityRole: "button",
160
+ accessibilityLabel: "Send",
161
+ disabled: !canSend,
162
+ onPress: submit,
163
+ style: ({
164
+ pressed
165
+ }) => [styles.button, canSend ? styles.sendOn : styles.sendOff, pressed && canSend && styles.pressed],
166
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
167
+ style: [styles.sendGlyph, {
168
+ color: canSend ? _sharedUi.night.color.onAccent : _sharedUi.night.color.textTertiary
169
+ }],
170
+ children: "\u2191"
171
+ })
172
+ })]
173
+ });
174
+ }
175
+ const styles = _reactNative.StyleSheet.create({
176
+ wrap: {
177
+ flexDirection: "row",
178
+ alignItems: "flex-end",
179
+ gap: 8,
180
+ paddingHorizontal: _sharedUi.night.gutter,
181
+ paddingTop: 10,
182
+ paddingBottom: 6,
183
+ borderTopWidth: _reactNative.StyleSheet.hairlineWidth,
184
+ borderTopColor: _sharedUi.night.color.border,
185
+ // Opaque: messages scroll UNDER the composer, and a translucent bar over
186
+ // moving text is unreadable.
187
+ backgroundColor: _sharedUi.night.color.bg
188
+ },
189
+ field: {
190
+ flex: 1,
191
+ minHeight: MIN_INPUT_HEIGHT,
192
+ justifyContent: "center",
193
+ borderRadius: 20,
194
+ borderWidth: _reactNative.StyleSheet.hairlineWidth,
195
+ borderColor: _sharedUi.night.color.border,
196
+ backgroundColor: _sharedUi.night.color.surfaceElevated
197
+ },
198
+ fieldDisabled: {
199
+ opacity: 0.6
200
+ },
201
+ input: {
202
+ maxHeight: MAX_INPUT_HEIGHT,
203
+ paddingHorizontal: INPUT_PAD_H,
204
+ paddingTop: INPUT_PAD_V,
205
+ paddingBottom: INPUT_PAD_V,
206
+ color: _sharedUi.night.color.text,
207
+ fontSize: _sharedUi.night.font.row
208
+ // No `lineHeight` here on purpose. A multiline TextInput on iOS lays out
209
+ // with the paragraph line height AND the font's own leading, so setting
210
+ // it made a one-line box measure ~56pt instead of 40 — the pill towered
211
+ // over the 40pt send/stop button beside it and the row read as crooked.
212
+ },
213
+ // Exactly the button's height, so the two read as one level row.
214
+ inputEmpty: {
215
+ height: MIN_INPUT_HEIGHT
216
+ },
217
+ button: {
218
+ width: 40,
219
+ height: 40,
220
+ borderRadius: 20,
221
+ alignItems: "center",
222
+ justifyContent: "center"
223
+ },
224
+ sendGlyph: {
225
+ fontSize: 20,
226
+ fontWeight: "700",
227
+ lineHeight: 22
228
+ },
229
+ sendOn: {
230
+ backgroundColor: _sharedUi.night.color.accent
231
+ },
232
+ sendOff: {
233
+ backgroundColor: _sharedUi.night.color.fill
234
+ },
235
+ stop: {
236
+ backgroundColor: _sharedUi.night.color.fillTertiary
237
+ },
238
+ // Outlined rather than filled: it sits beside Stop, and two solid buttons
239
+ // read as one control with two halves.
240
+ queue: {
241
+ backgroundColor: "transparent",
242
+ borderWidth: _reactNative.StyleSheet.hairlineWidth,
243
+ borderColor: _sharedUi.night.color.accentBorderStrong
244
+ },
245
+ stopGlyph: {
246
+ width: 12,
247
+ height: 12,
248
+ borderRadius: 2,
249
+ backgroundColor: _sharedUi.night.color.text
250
+ },
251
+ pressed: {
252
+ opacity: 0.7
253
+ }
254
+ });
255
+ //# sourceMappingURL=Composer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNative","_sharedUi","_jsxRuntime","MIN_INPUT_HEIGHT","MAX_INPUT_HEIGHT","INPUT_PAD_V","Platform","OS","INPUT_PAD_H","Composer","onSend","onStop","busy","draft","onDraftTaken","disabled","placeholder","focusKey","canFocus","text","setText","useState","inputRef","useRef","useEffect","current","focus","submit","useCallback","value","trim","canSend","length","canQueue","jsxs","View","style","styles","wrap","children","jsx","field","fieldDisabled","TextInput","ref","testID","input","inputEmpty","onChangeText","placeholderTextColor","night","color","multiline","editable","keyboardType","autoCorrect","autoCapitalize","blurOnSubmit","onSubmitEditing","returnKeyType","maxLength","Pressable","accessibilityRole","accessibilityLabel","onPress","pressed","button","queue","Text","sendGlyph","accent","stop","stopGlyph","sendOn","sendOff","onAccent","textTertiary","StyleSheet","create","flexDirection","alignItems","gap","paddingHorizontal","gutter","paddingTop","paddingBottom","borderTopWidth","hairlineWidth","borderTopColor","border","backgroundColor","bg","flex","minHeight","justifyContent","borderRadius","borderWidth","borderColor","surfaceElevated","opacity","maxHeight","fontSize","font","row","height","width","fontWeight","lineHeight","fill","fillTertiary","accentBorderStrong"],"sourceRoot":"../../../src","sources":["components/Composer.tsx"],"mappings":";;;;;;AA8BA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAQA,IAAAE,SAAA,GAAAF,OAAA;AAA2C,IAAAG,WAAA,GAAAH,OAAA;AAvC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmCA;AACA;AACA;AACA;AACA,MAAMI,gBAAgB,GAAG,EAAE;AAC3B;AACA,MAAMC,gBAAgB,GAAG,GAAG;AAC5B,MAAMC,WAAW,GAAGC,qBAAQ,CAACC,EAAE,KAAK,KAAK,GAAG,EAAE,GAAG,CAAC;AAClD,MAAMC,WAAW,GAAG,EAAE;AAEf,SAASC,QAAQA,CAAC;EACvBC,MAAM;EACNC,MAAM;EACNC,IAAI;EACJC,KAAK;EACLC,YAAY;EACZC,QAAQ;EACRC,WAAW;EACXC,QAAQ;EACRC,QAAQ,GAAG;AACE,CAAC,EAAE;EAChB,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAG,IAAAC,eAAQ,EAAC,EAAE,CAAC;EACpC,MAAMC,QAAQ,GAAG,IAAAC,aAAM,EAAY,IAAI,CAAC;EAExC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AAM,EAAE;IACNuC,KAAK,EAAE,EAAE;IACTD,MAAM,EAAE,EAAE;IACVT,YAAY,EAAE,EAAE;IAChBf,UAAU,EAAE,QAAQ;IACpBc,cAAc,EAAE;EAClB,CAAC;EACDzB,SAAS,EAAE;IAAEgC,QAAQ,EAAE,EAAE;IAAEK,UAAU,EAAE,KAAK;IAAEC,UAAU,EAAE;EAAG,CAAC;EAC9DlC,MAAM,EAAE;IAAEiB,eAAe,EAAExC,eAAK,CAACC,KAAK,CAACmB;EAAO,CAAC;EAC/CI,OAAO,EAAE;IAAEgB,eAAe,EAAExC,eAAK,CAACC,KAAK,CAACyD;EAAK,CAAC;EAC9CrC,IAAI,EAAE;IAAEmB,eAAe,EAAExC,eAAK,CAACC,KAAK,CAAC0D;EAAa,CAAC;EACnD;EACA;EACA1C,KAAK,EAAE;IACLuB,eAAe,EAAE,aAAa;IAC9BM,WAAW,EAAEnB,uBAAU,CAACU,aAAa;IACrCU,WAAW,EAAE/C,eAAK,CAACC,KAAK,CAAC2D;EAC3B,CAAC;EACDtC,SAAS,EAAE;IACTiC,KAAK,EAAE,EAAE;IACTD,MAAM,EAAE,EAAE;IACVT,YAAY,EAAE,CAAC;IACfL,eAAe,EAAExC,eAAK,CAACC,KAAK,CAAChC;EAC/B,CAAC;EACD8C,OAAO,EAAE;IAAEkC,OAAO,EAAE;EAAI;AAC1B,CAAC,CAAC","ignoreList":[]}
@@ -1 +1,161 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EmptyState=EmptyState;var _reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_suggestions=require("../store/suggestions"),_jsxRuntime=require("react/jsx-runtime");const isRelease="undefined"!=typeof __DEV__&&!__DEV__;function EmptyState({configured:e,onPick:t,availableToolIds:i=[],readOnly:s=!1}){const r=(0,_suggestions.pickSuggestions)({availableToolIds:i,readOnly:s,isRelease:isRelease});return e?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.wrap,testID:"buoy-ask-buoy-empty",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.title,children:"Ask about this app"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.body,children:"Ask what the app is doing right now, or tell it to change something. Anything it changes shows up in a bar at the top, with what can be undone."}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buildLine,testID:"buoy-ask-buoy-build-line",children:isRelease?"Release build — reading, impersonation and navigation work; simulations (forcing server responses, driving the screen) need a dev build.":"Dev build — full simulation available."}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.group,children:[(0,_jsxRuntime.jsx)(_sharedUi.NightSectionLabel,{children:"Try asking"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.card,children:r.map((e,i)=>(0,_jsxRuntime.jsx)(Suggestion,{text:e,onPick:t,last:i===r.length-1},e))})]})]}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.wrap,testID:"buoy-ask-buoy-unconfigured",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.title,children:"Not set up yet"}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.body,children:["Ask Buoy talks to your own company's AI endpoint — nothing goes to Buoy. A developer needs to add the ",(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.code,children:"askBuoy"})," prop to"," ",(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.code,children:"<FloatingDevTools />"})," with your team's endpoint and model."]})]})}function Suggestion({text:e,onPick:t,last:i}){return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:`buoy-ask-buoy-suggestion-${e.slice(0,12)}`,accessibilityRole:"button",onPress:()=>t(e),style:({pressed:e})=>[styles.row,!i&&styles.rowDivider,e&&styles.pressed],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowText,children:e}),(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:14,color:_sharedUi.night.color.textTertiary})]})}const styles=_reactNative.StyleSheet.create({wrap:{flex:1,justifyContent:"center",paddingHorizontal:_sharedUi.night.gutter,paddingVertical:24,gap:8},title:{color:_sharedUi.night.color.text,fontSize:22,fontWeight:"700",letterSpacing:-.3},body:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.body,lineHeight:20},code:{color:_sharedUi.night.color.text,fontFamily:"Menlo"},buildLine:{marginTop:8,color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro,lineHeight:15},group:{marginTop:_sharedUi.night.groupGap-8},card:{borderRadius:_sharedUi.night.radius.card,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface,overflow:"hidden"},row:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:_sharedUi.night.rowPadH,paddingVertical:13},rowDivider:{borderBottomWidth:_reactNative.StyleSheet.hairlineWidth,borderBottomColor:_sharedUi.night.color.separator},rowText:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.body,lineHeight:19},pressed:{backgroundColor:_sharedUi.night.color.fill}});
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EmptyState = EmptyState;
7
+ var _reactNative = require("react-native");
8
+ var _sharedUi = require("@buoy-gg/shared-ui");
9
+ var _suggestions = require("../store/suggestions");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ /**
12
+ * The first screen.
13
+ *
14
+ * Written for someone who has never used a devtool. The suggestions are not
15
+ * decoration — they are the fastest way to teach a tester what kind of sentence
16
+ * works here, and they are phrased as outcomes ("why is this screen empty?")
17
+ * rather than as tool names, because the tools are the thing this feature
18
+ * exists to hide.
19
+ */
20
+
21
+ const isRelease = typeof __DEV__ !== "undefined" && !__DEV__;
22
+ function EmptyState({
23
+ configured,
24
+ onPick,
25
+ availableToolIds = [],
26
+ readOnly = false
27
+ }) {
28
+ const suggestions = (0, _suggestions.pickSuggestions)({
29
+ availableToolIds,
30
+ readOnly,
31
+ isRelease
32
+ });
33
+ if (!configured) {
34
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
35
+ style: styles.wrap,
36
+ testID: "buoy-ask-buoy-unconfigured",
37
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
38
+ style: styles.title,
39
+ children: "Not set up yet"
40
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
41
+ style: styles.body,
42
+ children: ["Ask Buoy talks to your own company's AI endpoint \u2014 nothing goes to Buoy. A developer needs to add the ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
43
+ style: styles.code,
44
+ children: "askBuoy"
45
+ }), " prop to", " ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
46
+ style: styles.code,
47
+ children: "<FloatingDevTools />"
48
+ }), " with your team's endpoint and model."]
49
+ })]
50
+ });
51
+ }
52
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
53
+ style: styles.wrap,
54
+ testID: "buoy-ask-buoy-empty",
55
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
56
+ style: styles.title,
57
+ children: "Ask about this app"
58
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
59
+ style: styles.body,
60
+ children: "Ask what the app is doing right now, or tell it to change something. Anything it changes shows up in a bar at the top, with what can be undone."
61
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
62
+ style: styles.buildLine,
63
+ testID: "buoy-ask-buoy-build-line",
64
+ children: isRelease ? "Release build — reading, impersonation and navigation work; simulations (forcing server responses, driving the screen) need a dev build." : "Dev build — full simulation available."
65
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
66
+ style: styles.group,
67
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.NightSectionLabel, {
68
+ children: "Try asking"
69
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
70
+ style: styles.card,
71
+ children: suggestions.map((s, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Suggestion, {
72
+ text: s,
73
+ onPick: onPick,
74
+ last: i === suggestions.length - 1
75
+ }, s))
76
+ })]
77
+ })]
78
+ });
79
+ }
80
+ function Suggestion({
81
+ text,
82
+ onPick,
83
+ last
84
+ }) {
85
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
86
+ testID: `buoy-ask-buoy-suggestion-${text.slice(0, 12)}`,
87
+ accessibilityRole: "button",
88
+ onPress: () => onPick(text),
89
+ style: ({
90
+ pressed
91
+ }) => [styles.row, !last && styles.rowDivider, pressed && styles.pressed],
92
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
93
+ style: styles.rowText,
94
+ children: text
95
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChevronRight, {
96
+ size: 14,
97
+ color: _sharedUi.night.color.textTertiary
98
+ })]
99
+ });
100
+ }
101
+ const styles = _reactNative.StyleSheet.create({
102
+ wrap: {
103
+ flex: 1,
104
+ justifyContent: "center",
105
+ paddingHorizontal: _sharedUi.night.gutter,
106
+ paddingVertical: 24,
107
+ gap: 8
108
+ },
109
+ title: {
110
+ color: _sharedUi.night.color.text,
111
+ fontSize: 22,
112
+ fontWeight: "700",
113
+ letterSpacing: -0.3
114
+ },
115
+ body: {
116
+ color: _sharedUi.night.color.textSecondary,
117
+ fontSize: _sharedUi.night.font.body,
118
+ lineHeight: 20
119
+ },
120
+ code: {
121
+ color: _sharedUi.night.color.text,
122
+ fontFamily: "Menlo"
123
+ },
124
+ buildLine: {
125
+ marginTop: 8,
126
+ color: _sharedUi.night.color.textTertiary,
127
+ fontSize: _sharedUi.night.font.micro,
128
+ lineHeight: 15
129
+ },
130
+ group: {
131
+ marginTop: _sharedUi.night.groupGap - 8
132
+ },
133
+ card: {
134
+ borderRadius: _sharedUi.night.radius.card,
135
+ borderWidth: _reactNative.StyleSheet.hairlineWidth,
136
+ borderColor: _sharedUi.night.color.border,
137
+ backgroundColor: _sharedUi.night.color.surface,
138
+ overflow: "hidden"
139
+ },
140
+ row: {
141
+ flexDirection: "row",
142
+ alignItems: "center",
143
+ gap: 10,
144
+ paddingHorizontal: _sharedUi.night.rowPadH,
145
+ paddingVertical: 13
146
+ },
147
+ rowDivider: {
148
+ borderBottomWidth: _reactNative.StyleSheet.hairlineWidth,
149
+ borderBottomColor: _sharedUi.night.color.separator
150
+ },
151
+ rowText: {
152
+ flex: 1,
153
+ color: _sharedUi.night.color.text,
154
+ fontSize: _sharedUi.night.font.body,
155
+ lineHeight: 19
156
+ },
157
+ pressed: {
158
+ backgroundColor: _sharedUi.night.color.fill
159
+ }
160
+ });
161
+ //# sourceMappingURL=EmptyState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_sharedUi","_suggestions","_jsxRuntime","isRelease","__DEV__","EmptyState","configured","onPick","availableToolIds","readOnly","suggestions","pickSuggestions","jsxs","View","style","styles","wrap","testID","children","jsx","Text","title","body","code","buildLine","group","NightSectionLabel","card","map","s","i","Suggestion","text","last","length","Pressable","slice","accessibilityRole","onPress","pressed","row","rowDivider","rowText","ChevronRight","size","color","night","textTertiary","StyleSheet","create","flex","justifyContent","paddingHorizontal","gutter","paddingVertical","gap","fontSize","fontWeight","letterSpacing","textSecondary","font","lineHeight","fontFamily","marginTop","micro","groupGap","borderRadius","radius","borderWidth","hairlineWidth","borderColor","border","backgroundColor","surface","overflow","flexDirection","alignItems","rowPadH","borderBottomWidth","borderBottomColor","separator","fill"],"sourceRoot":"../../../src","sources":["components/EmptyState.tsx"],"mappings":";;;;;;AASA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AAAuD,IAAAG,WAAA,GAAAH,OAAA;AAZvD;AACA;AACA;AACA;AACA;AACA;A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";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KeyboardPad=KeyboardPad;var _react=require("react"),_reactNative=require("react-native"),_jsxRuntime=require("react/jsx-runtime");function KeyboardPad({children:e}){const t=(0,_react.useRef)(null),r=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;return(0,_react.useEffect)(()=>{if("ios"!==_reactNative.Platform.OS)return;const e=(e,t)=>{_reactNative.Animated.timing(r,{toValue:e,duration:t.duration||250,easing:_reactNative.Easing.bezier(.17,.59,.4,.77),useNativeDriver:!1}).start()},a=[_reactNative.Keyboard.addListener("keyboardWillChangeFrame",r=>{const a=t.current;a&&a.measureInWindow((t,a,i,n)=>{const c=a+n-r.endCoordinates.screenY;e(Math.max(0,c),r)})}),_reactNative.Keyboard.addListener("keyboardWillHide",t=>e(0,t))];return()=>a.forEach(e=>e.remove())},[r]),(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{ref:t,style:[styles.flex,{paddingBottom:r}],children:e})}const styles=_reactNative.StyleSheet.create({flex:{flex:1}});
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.KeyboardPad = KeyboardPad;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ var _jsxRuntime = require("react/jsx-runtime");
10
+ /**
11
+ * Keeps the composer above the iOS keyboard.
12
+ *
13
+ * Why not `KeyboardAvoidingView`: it takes its frame from `onLayout`, which
14
+ * is RELATIVE TO ITS PARENT, and compares that to the keyboard's SCREEN
15
+ * position. That only agrees when the view starts at the window's origin.
16
+ * Ask Buoy is a JsModal — an absolutely positioned sheet anchored to the
17
+ * bottom of the app tree — so the view's local bottom (a few hundred points
18
+ * into the sheet) sits well above the keyboard's screen Y, the overlap comes
19
+ * out as zero, and nothing moves. The keyboard drew over the composer with
20
+ * a "working" `KeyboardAvoidingView` around it.
21
+ *
22
+ * This measures the SAME thing in the SAME coordinate space: the wrapper's
23
+ * bottom edge in window coordinates via `measureInWindow`, against the
24
+ * keyboard's `endCoordinates.screenY`. The difference is the overlap, and it
25
+ * becomes bottom padding animated over the keyboard's own duration so the
26
+ * composer rides the keyboard instead of jumping after it.
27
+ *
28
+ * The wrapper is `flex: 1` inside a fixed-height sheet body, so its OUTER
29
+ * bounds never change when its padding does — re-measuring on a later
30
+ * frame-change event (a predictive-text bar appearing, an emoji keyboard)
31
+ * gives the same bottom edge.
32
+ *
33
+ * iOS only. Android's window resizes under the keyboard
34
+ * (`softwareKeyboardLayoutMode: "resize"`, both the Expo and the RN CLI
35
+ * template default) and a bottom-anchored sheet rides up for free; padding
36
+ * there would lift it twice. Web has no keyboard events and no keyboard.
37
+ */
38
+
39
+ function KeyboardPad({
40
+ children
41
+ }) {
42
+ const ref = (0, _react.useRef)(null);
43
+ const pad = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
44
+ (0, _react.useEffect)(() => {
45
+ if (_reactNative.Platform.OS !== "ios") return;
46
+ const animateTo = (value, event) => {
47
+ _reactNative.Animated.timing(pad, {
48
+ toValue: value,
49
+ duration: event.duration || 250,
50
+ // iOS's keyboard curve; `keyboard` is the matching Easing preset.
51
+ easing: _reactNative.Easing.bezier(0.17, 0.59, 0.4, 0.77),
52
+ useNativeDriver: false
53
+ }).start();
54
+ };
55
+ const onChange = event => {
56
+ const node = ref.current;
57
+ if (!node) return;
58
+ node.measureInWindow((_x, y, _w, h) => {
59
+ const overlap = y + h - event.endCoordinates.screenY;
60
+ animateTo(Math.max(0, overlap), event);
61
+ });
62
+ };
63
+ const onHide = event => animateTo(0, event);
64
+ const subs = [_reactNative.Keyboard.addListener("keyboardWillChangeFrame", onChange), _reactNative.Keyboard.addListener("keyboardWillHide", onHide)];
65
+ return () => subs.forEach(s => s.remove());
66
+ }, [pad]);
67
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
68
+ ref: ref,
69
+ style: [styles.flex, {
70
+ paddingBottom: pad
71
+ }],
72
+ children: children
73
+ });
74
+ }
75
+ const styles = _reactNative.StyleSheet.create({
76
+ flex: {
77
+ flex: 1
78
+ }
79
+ });
80
+ //# sourceMappingURL=KeyboardPad.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNative","_jsxRuntime","KeyboardPad","children","ref","useRef","pad","Animated","Value","current","useEffect","Platform","OS","animateTo","value","event","timing","toValue","duration","easing","Easing","bezier","useNativeDriver","start","onChange","node","measureInWindow","_x","y","_w","h","overlap","endCoordinates","screenY","Math","max","onHide","subs","Keyboard","addListener","forEach","s","remove","jsx","View","style","styles","flex","paddingBottom","StyleSheet","create"],"sourceRoot":"../../../src","sources":["components/KeyboardPad.tsx"],"mappings":";;;;;;AA4BA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAA0G,IAAAE,WAAA,GAAAF,OAAA;AA7B1G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIO,SAASG,WAAWA,CAAC;EAAEC;AAAkC,CAAC,EAAE;EACjE,MAAMC,GAAG,GAAG,IAAAC,aAAM,EAAO,IAAI,CAAC;EAC9B,MAAMC,GAAG,GAAG,IAAAD,aAAM,EAAC,IAAIE,qBAAQ,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC,CAACC,OAAO;EAEjD,IAAAC,gBAAS,EAAC,MAAM;IACd,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IAE3B,MAAMC,SAAS,GAAGA,CAACC,KAAa,EAAEC,KAAoB,KAAK;MACzDR,qBAAQ,CAACS,MAAM,CAACV,GAAG,EAAE;QACnBW,OAAO,EAAEH,KAAK;QACdI,QAAQ,EAAEH,KAAK,CAACG,QAAQ,IAAI,GAAG;QAC/B;QACAC,MAAM,EAAEC,mBAAM,CAACC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI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