@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,250 @@
1
- "use strict";import{useCallback,useEffect,useRef,useState}from"react";import{Platform,Pressable,StyleSheet,Text,TextInput,View}from"react-native";import{night}from"@buoy-gg/shared-ui";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const MIN_INPUT_HEIGHT=40,MAX_INPUT_HEIGHT=120,INPUT_PAD_V="ios"===Platform.OS?10:6,INPUT_PAD_H=16;export function Composer({onSend:e,onStop:t,busy:s,draft:o,onDraftTaken:r,disabled:l,placeholder:i,focusKey:n,canFocus:a=!0}){const[c,d]=useState(""),u=useRef(null);useEffect(()=>{n&&a&&!l&&u.current?.focus()},[n,a,l]),useEffect(()=>{o&&(d(e=>e?`${e} ${o}`:o),r?.())},[o,r]);const y=useCallback(()=>{const t=c.trim();t&&(d(""),e(t))},[c,e]),h=c.trim().length>0&&!s&&!l,b=c.trim().length>0&&s&&!l;return _jsxs(View,{style:styles.wrap,children:[_jsx(View,{style:[styles.field,l&&styles.fieldDisabled],children:_jsx(TextInput,{ref:u,testID:"buoy-ask-buoy-input",style:[styles.input,0===c.length&&styles.inputEmpty],value:c,onChangeText:d,placeholder:i??(l?"Ask Buoy isn't set up yet":"Ask, or tell it what to change…"),placeholderTextColor:night.color.placeholder,multiline:!0,editable:!l,keyboardType:"ascii-capable",autoCorrect:!0,autoCapitalize:"sentences",blurOnSubmit:!1,onSubmitEditing:y,returnKeyType:"send",maxLength:4e3})}),b&&_jsx(Pressable,{testID:"buoy-ask-buoy-queue",accessibilityRole:"button",accessibilityLabel:"Queue message",onPress:y,style:({pressed:e})=>[styles.button,styles.queue,e&&styles.pressed],children:_jsx(Text,{style:[styles.sendGlyph,{color:night.color.accent}],children:"↑"})}),_jsx(Pressable,s?{testID:"buoy-ask-buoy-stop",accessibilityRole:"button",accessibilityLabel:"Stop",onPress:t,style:({pressed:e})=>[styles.button,styles.stop,e&&styles.pressed],children:_jsx(View,{style:styles.stopGlyph})}:{testID:"buoy-ask-buoy-send",accessibilityRole:"button",accessibilityLabel:"Send",disabled:!h,onPress:y,style:({pressed:e})=>[styles.button,h?styles.sendOn:styles.sendOff,e&&h&&styles.pressed],children:_jsx(Text,{style:[styles.sendGlyph,{color:h?night.color.onAccent:night.color.textTertiary}],children:"↑"})})]})}const styles=StyleSheet.create({wrap:{flexDirection:"row",alignItems:"flex-end",gap:8,paddingHorizontal:night.gutter,paddingTop:10,paddingBottom:6,borderTopWidth:StyleSheet.hairlineWidth,borderTopColor:night.color.border,backgroundColor:night.color.bg},field:{flex:1,minHeight:40,justifyContent:"center",borderRadius:20,borderWidth:StyleSheet.hairlineWidth,borderColor:night.color.border,backgroundColor:night.color.surfaceElevated},fieldDisabled:{opacity:.6},input:{maxHeight:120,paddingHorizontal:16,paddingTop:INPUT_PAD_V,paddingBottom:INPUT_PAD_V,color:night.color.text,fontSize: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:night.color.accent},sendOff:{backgroundColor:night.color.fill},stop:{backgroundColor:night.color.fillTertiary},queue:{backgroundColor:"transparent",borderWidth:StyleSheet.hairlineWidth,borderColor:night.color.accentBorderStrong},stopGlyph:{width:12,height:12,borderRadius:2,backgroundColor:night.color.text},pressed:{opacity:.7}});
1
+ "use strict";
2
+
3
+ /**
4
+ * The message box.
5
+ *
6
+ * This is the first keyboard-safe BOTTOM input in Buoy, and the reason none
7
+ * existed before is that JsModal has no keyboard handling at all: the sheet is
8
+ * `position:absolute; bottom:0` inside the app tree, not an RN `Modal`, so on
9
+ * iOS the keyboard simply draws over it. Two other tools hit this and chose to
10
+ * dodge it — NetworkNumberPrompt and StorageValueEditModal both say so in
11
+ * comments and pin their inputs to the TOP of the screen. A chat cannot.
12
+ *
13
+ * What makes it work:
14
+ * - `KeyboardPad` (see that file), iOS only. `KeyboardAvoidingView` looked
15
+ * right here and did nothing: it measures its frame relative to its PARENT
16
+ * and compares that with the keyboard's SCREEN position, which never
17
+ * overlap inside a bottom-anchored sheet. On Android Expo's default
18
+ * `softwareKeyboardLayoutMode: "resize"` shrinks the window and a
19
+ * bottom-anchored view rides up for free; adding padding there would lift
20
+ * it twice.
21
+ * - The parent list carries `keyboardShouldPersistTaps="handled"`. Without it
22
+ * the first tap after typing only dismisses the keyboard and Send never
23
+ * fires — a real shipped bug in Time Machine, and invisible to Detox because
24
+ * `replaceText` opens no keyboard.
25
+ * - `keyboardType="ascii-capable"`, because iOS Smart Punctuation rewrites
26
+ * straight quotes as curly ones. That permanently broke the raw-JSON editor
27
+ * in Storage, and a tester pasting a JSON blob here would hit the same wall.
28
+ *
29
+ * While the agent is working the send button becomes a STOP button — a
30
+ * square, the universal glyph — rather than a spinner in a circle, which
31
+ * looked like a disabled control and gave no hint it was tappable.
32
+ */
33
+ import { useCallback, useEffect, useRef, useState } from "react";
34
+ import { Platform, Pressable, StyleSheet, Text, TextInput, View } from "react-native";
35
+ import { night } from "@buoy-gg/shared-ui";
36
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
37
+ /**
38
+ * One line of input, and the height of the send/stop button beside it — the
39
+ * row only reads as level while those two agree.
40
+ */
41
+ const MIN_INPUT_HEIGHT = 40;
42
+ /** ~5 lines, then it scrolls instead of eating the transcript. */
43
+ const MAX_INPUT_HEIGHT = 120;
44
+ const INPUT_PAD_V = Platform.OS === "ios" ? 10 : 6;
45
+ const INPUT_PAD_H = 16;
46
+ export function Composer({
47
+ onSend,
48
+ onStop,
49
+ busy,
50
+ draft,
51
+ onDraftTaken,
52
+ disabled,
53
+ placeholder,
54
+ focusKey,
55
+ canFocus = true
56
+ }) {
57
+ const [text, setText] = useState("");
58
+ const inputRef = useRef(null);
59
+ useEffect(() => {
60
+ if (!focusKey || !canFocus || disabled) return;
61
+ inputRef.current?.focus();
62
+ }, [focusKey, canFocus, disabled]);
63
+ useEffect(() => {
64
+ if (!draft) return;
65
+ // Appended, not assigned: they may have started typing something else in
66
+ // the moment between pressing Stop and this landing.
67
+ setText(current => current ? `${current} ${draft}` : draft);
68
+ onDraftTaken?.();
69
+ }, [draft, onDraftTaken]);
70
+ const submit = useCallback(() => {
71
+ const value = text.trim();
72
+ if (!value) return;
73
+ setText("");
74
+ onSend(value);
75
+ }, [text, onSend]);
76
+ const canSend = text.trim().length > 0 && !busy && !disabled;
77
+ /**
78
+ * Typed something while a turn is running.
79
+ *
80
+ * `send` parks it and flushes it when the turn ends — but the only button on
81
+ * screen while busy was Stop, so the sole way to reach that was the
82
+ * keyboard's return key, and the "Queued" placeholder that explains it only
83
+ * appears AFTER you have managed it. The button is the affordance.
84
+ */
85
+ const canQueue = text.trim().length > 0 && busy && !disabled;
86
+ return /*#__PURE__*/_jsxs(View, {
87
+ style: styles.wrap,
88
+ children: [/*#__PURE__*/_jsx(View, {
89
+ style: [styles.field, disabled && styles.fieldDisabled],
90
+ children: /*#__PURE__*/_jsx(TextInput, {
91
+ ref: inputRef,
92
+ testID: "buoy-ask-buoy-input"
93
+ /*
94
+ * Empty means one line, always.
95
+ *
96
+ * The box is otherwise auto-height, and an iOS multiline TextInput
97
+ * grows with the text but never shrinks back: sending a two-line
98
+ * message cleared the text and left a two-line box standing over
99
+ * the 40pt round button beside it. Nothing on the native side
100
+ * reports the shrink either — on Fabric `onContentSizeChange` is
101
+ * emitted from `updateLayoutMetrics` (a LAYOUT change), not from a
102
+ * text change — so the height it last grew to is the height it
103
+ * keeps. Pinning the empty case is the whole fix: it is the only
104
+ * state that has to line up with the button, and it is exactly the
105
+ * state a send or a new conversation lands in.
106
+ */,
107
+ style: [styles.input, text.length === 0 && styles.inputEmpty],
108
+ value: text,
109
+ onChangeText: setText,
110
+ placeholder: placeholder ?? (disabled ? "Ask Buoy isn't set up yet" : "Ask, or tell it what to change…"),
111
+ placeholderTextColor: night.color.placeholder,
112
+ multiline: true,
113
+ editable: !disabled
114
+ // Straight quotes only — see the header note.
115
+ ,
116
+ keyboardType: "ascii-capable",
117
+ autoCorrect: true,
118
+ autoCapitalize: "sentences"
119
+ // Enter sends; Shift-Enter is not a thing on a phone keyboard, and a
120
+ // multiline box with no submit affordance strands people.
121
+ ,
122
+ blurOnSubmit: false,
123
+ onSubmitEditing: submit,
124
+ returnKeyType: "send",
125
+ maxLength: 4000
126
+ })
127
+ }), canQueue && /*#__PURE__*/_jsx(Pressable, {
128
+ testID: "buoy-ask-buoy-queue",
129
+ accessibilityRole: "button",
130
+ accessibilityLabel: "Queue message",
131
+ onPress: submit,
132
+ style: ({
133
+ pressed
134
+ }) => [styles.button, styles.queue, pressed && styles.pressed],
135
+ children: /*#__PURE__*/_jsx(Text, {
136
+ style: [styles.sendGlyph, {
137
+ color: night.color.accent
138
+ }],
139
+ children: "\u2191"
140
+ })
141
+ }), busy ? /*#__PURE__*/_jsx(Pressable, {
142
+ testID: "buoy-ask-buoy-stop",
143
+ accessibilityRole: "button",
144
+ accessibilityLabel: "Stop",
145
+ onPress: onStop,
146
+ style: ({
147
+ pressed
148
+ }) => [styles.button, styles.stop, pressed && styles.pressed],
149
+ children: /*#__PURE__*/_jsx(View, {
150
+ style: styles.stopGlyph
151
+ })
152
+ }) : /*#__PURE__*/_jsx(Pressable, {
153
+ testID: "buoy-ask-buoy-send",
154
+ accessibilityRole: "button",
155
+ accessibilityLabel: "Send",
156
+ disabled: !canSend,
157
+ onPress: submit,
158
+ style: ({
159
+ pressed
160
+ }) => [styles.button, canSend ? styles.sendOn : styles.sendOff, pressed && canSend && styles.pressed],
161
+ children: /*#__PURE__*/_jsx(Text, {
162
+ style: [styles.sendGlyph, {
163
+ color: canSend ? night.color.onAccent : night.color.textTertiary
164
+ }],
165
+ children: "\u2191"
166
+ })
167
+ })]
168
+ });
169
+ }
170
+ const styles = StyleSheet.create({
171
+ wrap: {
172
+ flexDirection: "row",
173
+ alignItems: "flex-end",
174
+ gap: 8,
175
+ paddingHorizontal: night.gutter,
176
+ paddingTop: 10,
177
+ paddingBottom: 6,
178
+ borderTopWidth: StyleSheet.hairlineWidth,
179
+ borderTopColor: night.color.border,
180
+ // Opaque: messages scroll UNDER the composer, and a translucent bar over
181
+ // moving text is unreadable.
182
+ backgroundColor: night.color.bg
183
+ },
184
+ field: {
185
+ flex: 1,
186
+ minHeight: MIN_INPUT_HEIGHT,
187
+ justifyContent: "center",
188
+ borderRadius: 20,
189
+ borderWidth: StyleSheet.hairlineWidth,
190
+ borderColor: night.color.border,
191
+ backgroundColor: night.color.surfaceElevated
192
+ },
193
+ fieldDisabled: {
194
+ opacity: 0.6
195
+ },
196
+ input: {
197
+ maxHeight: MAX_INPUT_HEIGHT,
198
+ paddingHorizontal: INPUT_PAD_H,
199
+ paddingTop: INPUT_PAD_V,
200
+ paddingBottom: INPUT_PAD_V,
201
+ color: night.color.text,
202
+ fontSize: night.font.row
203
+ // No `lineHeight` here on purpose. A multiline TextInput on iOS lays out
204
+ // with the paragraph line height AND the font's own leading, so setting
205
+ // it made a one-line box measure ~56pt instead of 40 — the pill towered
206
+ // over the 40pt send/stop button beside it and the row read as crooked.
207
+ },
208
+ // Exactly the button's height, so the two read as one level row.
209
+ inputEmpty: {
210
+ height: MIN_INPUT_HEIGHT
211
+ },
212
+ button: {
213
+ width: 40,
214
+ height: 40,
215
+ borderRadius: 20,
216
+ alignItems: "center",
217
+ justifyContent: "center"
218
+ },
219
+ sendGlyph: {
220
+ fontSize: 20,
221
+ fontWeight: "700",
222
+ lineHeight: 22
223
+ },
224
+ sendOn: {
225
+ backgroundColor: night.color.accent
226
+ },
227
+ sendOff: {
228
+ backgroundColor: night.color.fill
229
+ },
230
+ stop: {
231
+ backgroundColor: night.color.fillTertiary
232
+ },
233
+ // Outlined rather than filled: it sits beside Stop, and two solid buttons
234
+ // read as one control with two halves.
235
+ queue: {
236
+ backgroundColor: "transparent",
237
+ borderWidth: StyleSheet.hairlineWidth,
238
+ borderColor: night.color.accentBorderStrong
239
+ },
240
+ stopGlyph: {
241
+ width: 12,
242
+ height: 12,
243
+ borderRadius: 2,
244
+ backgroundColor: night.color.text
245
+ },
246
+ pressed: {
247
+ opacity: 0.7
248
+ }
249
+ });
250
+ //# sourceMappingURL=Composer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useEffect","useRef","useState","Platform","Pressable","StyleSheet","Text","TextInput","View","night","jsx","_jsx","jsxs","_jsxs","MIN_INPUT_HEIGHT","MAX_INPUT_HEIGHT","INPUT_PAD_V","OS","INPUT_PAD_H","Composer","onSend","onStop","busy","draft","onDraftTaken","disabled","placeholder","focusKey","canFocus","text","setText","inputRef","current","focus","submit","value","trim","canSend","length","canQueue","style","styles","wrap","children","field","fieldDisabled","ref","testID","input","inputEmpty","onChangeText","placeholderTextColor","color","multiline","editable","keyboardType","autoCorrect","autoCapitalize","blurOnSubmit","onSubmitEditing","returnKeyType","maxLength","accessibilityRole","accessibilityLabel","onPress","pressed","button","queue","sendGlyph","accent","stop","stopGlyph","sendOn","sendOff","onAccent","textTertiary","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":";;AAAA;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;AACA,SAASA,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAChE,SACEC,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,IAAI,EACJC,SAAS,EACTC,IAAI,QACC,cAAc;AACrB,SAASC,KAAK,QAAQ,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAyB3C;AACA;AACA;AAC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,EAAE3C,KAAK,CAAC2C,KAAK,CAACvB,IAAI;IACvBsE,QAAQ,EAAE1F,KAAK,CAAC2F,IAAI,CAACC;IACrB;IACA;IACA;IACA;EACF,CAAC;EACD;EACApD,UAAU,EAAE;IAAEqD,MAAM,EAAExF;EAAiB,CAAC;EACxCoD,MAAM,EAAE;IACNqC,KAAK,EAAE,EAAE;IACTD,MAAM,EAAE,EAAE;IACVT,YAAY,EAAE,EAAE;IAChBf,UAAU,EAAE,QAAQ;IACpBc,cAAc,EAAE;EAClB,CAAC;EACDxB,SAAS,EAAE;IAAE+B,QAAQ,EAAE,EAAE;IAAEK,UAAU,EAAE,KAAK;IAAEC,UAAU,EAAE;EAAG,CAAC;EAC9DjC,MAAM,EAAE;IAAEgB,eAAe,EAAE/E,KAAK,CAAC2C,KAAK,CAACiB;EAAO,CAAC;EAC/CI,OAAO,EAAE;IAAEe,eAAe,EAAE/E,KAAK,CAAC2C,KAAK,CAACsD;EAAK,CAAC;EAC9CpC,IAAI,EAAE;IAAEkB,eAAe,EAAE/E,KAAK,CAAC2C,KAAK,CAACuD;EAAa,CAAC;EACnD;EACA;EACAxC,KAAK,EAAE;IACLqB,eAAe,EAAE,aAAa;IAC9BM,WAAW,EAAEzF,UAAU,CAACgF,aAAa;IACrCU,WAAW,EAAEtF,KAAK,CAAC2C,KAAK,CAACwD;EAC3B,CAAC;EACDrC,SAAS,EAAE;IACTgC,KAAK,EAAE,EAAE;IACTD,MAAM,EAAE,EAAE;IACVT,YAAY,EAAE,CAAC;IACfL,eAAe,EAAE/E,KAAK,CAAC2C,KAAK,CAACvB;EAC/B,CAAC;EACDoC,OAAO,EAAE;IAAEgC,OAAO,EAAE;EAAI;AAC1B,CAAC,CAAC","ignoreList":[]}
@@ -1 +1,156 @@
1
- "use strict";import{Pressable,StyleSheet,Text,View}from"react-native";import{ChevronRight,night,NightSectionLabel}from"@buoy-gg/shared-ui";import{pickSuggestions}from"../store/suggestions";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const isRelease="undefined"!=typeof __DEV__&&!__DEV__;export function EmptyState({configured:e,onPick:t,availableToolIds:o=[],readOnly:i=!1}){const s=pickSuggestions({availableToolIds:o,readOnly:i,isRelease:isRelease});return _jsxs(View,e?{style:styles.wrap,testID:"buoy-ask-buoy-empty",children:[_jsx(Text,{style:styles.title,children:"Ask about this app"}),_jsx(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."}),_jsx(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."}),_jsxs(View,{style:styles.group,children:[_jsx(NightSectionLabel,{children:"Try asking"}),_jsx(View,{style:styles.card,children:s.map((e,o)=>_jsx(Suggestion,{text:e,onPick:t,last:o===s.length-1},e))})]})]}:{style:styles.wrap,testID:"buoy-ask-buoy-unconfigured",children:[_jsx(Text,{style:styles.title,children:"Not set up yet"}),_jsxs(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 ",_jsx(Text,{style:styles.code,children:"askBuoy"})," prop to"," ",_jsx(Text,{style:styles.code,children:"<FloatingDevTools />"})," with your team's endpoint and model."]})]})}function Suggestion({text:e,onPick:t,last:o}){return _jsxs(Pressable,{testID:`buoy-ask-buoy-suggestion-${e.slice(0,12)}`,accessibilityRole:"button",onPress:()=>t(e),style:({pressed:e})=>[styles.row,!o&&styles.rowDivider,e&&styles.pressed],children:[_jsx(Text,{style:styles.rowText,children:e}),_jsx(ChevronRight,{size:14,color:night.color.textTertiary})]})}const styles=StyleSheet.create({wrap:{flex:1,justifyContent:"center",paddingHorizontal:night.gutter,paddingVertical:24,gap:8},title:{color:night.color.text,fontSize:22,fontWeight:"700",letterSpacing:-.3},body:{color:night.color.textSecondary,fontSize:night.font.body,lineHeight:20},code:{color:night.color.text,fontFamily:"Menlo"},buildLine:{marginTop:8,color:night.color.textTertiary,fontSize:night.font.micro,lineHeight:15},group:{marginTop:night.groupGap-8},card:{borderRadius:night.radius.card,borderWidth:StyleSheet.hairlineWidth,borderColor:night.color.border,backgroundColor:night.color.surface,overflow:"hidden"},row:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:night.rowPadH,paddingVertical:13},rowDivider:{borderBottomWidth:StyleSheet.hairlineWidth,borderBottomColor:night.color.separator},rowText:{flex:1,color:night.color.text,fontSize:night.font.body,lineHeight:19},pressed:{backgroundColor:night.color.fill}});
1
+ "use strict";
2
+
3
+ /**
4
+ * The first screen.
5
+ *
6
+ * Written for someone who has never used a devtool. The suggestions are not
7
+ * decoration — they are the fastest way to teach a tester what kind of sentence
8
+ * works here, and they are phrased as outcomes ("why is this screen empty?")
9
+ * rather than as tool names, because the tools are the thing this feature
10
+ * exists to hide.
11
+ */
12
+ import { Pressable, StyleSheet, Text, View } from "react-native";
13
+ import { ChevronRight, night, NightSectionLabel } from "@buoy-gg/shared-ui";
14
+ import { pickSuggestions } from "../store/suggestions";
15
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
+ const isRelease = typeof __DEV__ !== "undefined" && !__DEV__;
17
+ export function EmptyState({
18
+ configured,
19
+ onPick,
20
+ availableToolIds = [],
21
+ readOnly = false
22
+ }) {
23
+ const suggestions = pickSuggestions({
24
+ availableToolIds,
25
+ readOnly,
26
+ isRelease
27
+ });
28
+ if (!configured) {
29
+ return /*#__PURE__*/_jsxs(View, {
30
+ style: styles.wrap,
31
+ testID: "buoy-ask-buoy-unconfigured",
32
+ children: [/*#__PURE__*/_jsx(Text, {
33
+ style: styles.title,
34
+ children: "Not set up yet"
35
+ }), /*#__PURE__*/_jsxs(Text, {
36
+ style: styles.body,
37
+ children: ["Ask Buoy talks to your own company's AI endpoint \u2014 nothing goes to Buoy. A developer needs to add the ", /*#__PURE__*/_jsx(Text, {
38
+ style: styles.code,
39
+ children: "askBuoy"
40
+ }), " prop to", " ", /*#__PURE__*/_jsx(Text, {
41
+ style: styles.code,
42
+ children: "<FloatingDevTools />"
43
+ }), " with your team's endpoint and model."]
44
+ })]
45
+ });
46
+ }
47
+ return /*#__PURE__*/_jsxs(View, {
48
+ style: styles.wrap,
49
+ testID: "buoy-ask-buoy-empty",
50
+ children: [/*#__PURE__*/_jsx(Text, {
51
+ style: styles.title,
52
+ children: "Ask about this app"
53
+ }), /*#__PURE__*/_jsx(Text, {
54
+ style: styles.body,
55
+ 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."
56
+ }), /*#__PURE__*/_jsx(Text, {
57
+ style: styles.buildLine,
58
+ testID: "buoy-ask-buoy-build-line",
59
+ 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."
60
+ }), /*#__PURE__*/_jsxs(View, {
61
+ style: styles.group,
62
+ children: [/*#__PURE__*/_jsx(NightSectionLabel, {
63
+ children: "Try asking"
64
+ }), /*#__PURE__*/_jsx(View, {
65
+ style: styles.card,
66
+ children: suggestions.map((s, i) => /*#__PURE__*/_jsx(Suggestion, {
67
+ text: s,
68
+ onPick: onPick,
69
+ last: i === suggestions.length - 1
70
+ }, s))
71
+ })]
72
+ })]
73
+ });
74
+ }
75
+ function Suggestion({
76
+ text,
77
+ onPick,
78
+ last
79
+ }) {
80
+ return /*#__PURE__*/_jsxs(Pressable, {
81
+ testID: `buoy-ask-buoy-suggestion-${text.slice(0, 12)}`,
82
+ accessibilityRole: "button",
83
+ onPress: () => onPick(text),
84
+ style: ({
85
+ pressed
86
+ }) => [styles.row, !last && styles.rowDivider, pressed && styles.pressed],
87
+ children: [/*#__PURE__*/_jsx(Text, {
88
+ style: styles.rowText,
89
+ children: text
90
+ }), /*#__PURE__*/_jsx(ChevronRight, {
91
+ size: 14,
92
+ color: night.color.textTertiary
93
+ })]
94
+ });
95
+ }
96
+ const styles = StyleSheet.create({
97
+ wrap: {
98
+ flex: 1,
99
+ justifyContent: "center",
100
+ paddingHorizontal: night.gutter,
101
+ paddingVertical: 24,
102
+ gap: 8
103
+ },
104
+ title: {
105
+ color: night.color.text,
106
+ fontSize: 22,
107
+ fontWeight: "700",
108
+ letterSpacing: -0.3
109
+ },
110
+ body: {
111
+ color: night.color.textSecondary,
112
+ fontSize: night.font.body,
113
+ lineHeight: 20
114
+ },
115
+ code: {
116
+ color: night.color.text,
117
+ fontFamily: "Menlo"
118
+ },
119
+ buildLine: {
120
+ marginTop: 8,
121
+ color: night.color.textTertiary,
122
+ fontSize: night.font.micro,
123
+ lineHeight: 15
124
+ },
125
+ group: {
126
+ marginTop: night.groupGap - 8
127
+ },
128
+ card: {
129
+ borderRadius: night.radius.card,
130
+ borderWidth: StyleSheet.hairlineWidth,
131
+ borderColor: night.color.border,
132
+ backgroundColor: night.color.surface,
133
+ overflow: "hidden"
134
+ },
135
+ row: {
136
+ flexDirection: "row",
137
+ alignItems: "center",
138
+ gap: 10,
139
+ paddingHorizontal: night.rowPadH,
140
+ paddingVertical: 13
141
+ },
142
+ rowDivider: {
143
+ borderBottomWidth: StyleSheet.hairlineWidth,
144
+ borderBottomColor: night.color.separator
145
+ },
146
+ rowText: {
147
+ flex: 1,
148
+ color: night.color.text,
149
+ fontSize: night.font.body,
150
+ lineHeight: 19
151
+ },
152
+ pressed: {
153
+ backgroundColor: night.color.fill
154
+ }
155
+ });
156
+ //# sourceMappingURL=EmptyState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Pressable","StyleSheet","Text","View","ChevronRight","night","NightSectionLabel","pickSuggestions","jsx","_jsx","jsxs","_jsxs","isRelease","__DEV__","EmptyState","configured","onPick","availableToolIds","readOnly","suggestions","style","styles","wrap","testID","children","title","body","code","buildLine","group","card","map","s","i","Suggestion","text","last","length","slice","accessibilityRole","onPress","pressed","row","rowDivider","rowText","size","color","textTertiary","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":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,UAAU,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAChE,SAASC,YAAY,EAAEC,KAAK,EAAEC,iBAAiB,QAAQ,oBAAoB;AAE3E,SAASC,eAAe,QAAQ,sBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEvD,MAAMC,SAAS,GAAG,OAAOC,OAAO,KAAK,WAAW,IAAI,CAACA,OAAO;AAW5D,OAAO,SAASC,UAAUA,CAAC;EAAEC,UAAU;EAAEC,MAAM;EAAEC,gBAAgB,GAAG,EAAE;EAAEC,QAAQ,GAAG;AAAuB,CAAC,EAAE;EAC3G,MAAMC,WAAW,GAAGZ,eAAe,CAAC;IAAEU,gBAAgB;IAAEC,QAAQ;IAAEN;EAAU,CAAC,CAAC;EAC9E,IAAI,CAACG,UAAU,EAAE;IACf,oBACEJ,KAAA,CAACR,IAAI;MAACiB,KAAK,EAAEC,MAAM,CAACC,IAAK;MAACC,MAAM,EAAC,4BAA4B;MAAAC,QAAA,gBAC3Df,IAAA,CAACP,IAAI;QAACkB,KAAK,EAAEC,MAAM,CAACI,KAAM;QAAAD,QAAA,EAAC;MAAc,CAAM,CAAC,eAChDb,KAAA,CAACT,IAAI;QAACkB,KAAK,EAAEC,MAAM,CAACK,IAAK;QAAAF,QAAA,GAAC,6GAEK,eAAAf,IAAA,CAACP,IAAI;UAACkB,KAAK,EAAEC,MAAM,CAACM,IAAK;UAAAH,QAAA,EAAC;QAAO,CAAM,CAAC,YAAQ,EAAC,GAAG,eACjFf,IAAA,CAACP,IAAI;UAACkB,KAAK,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CAAC;EACtDjC,SAAS,EAAE;IACTkC,SAAS,EAAE,CAAC;IACZhB,KAAK,EAAEzC,KAAK,CAACyC,KAAK,CAACC,YAAY;IAC/BQ,QAAQ,EAAElD,KAAK,CAACsD,IAAI,CAACI,KAAK;IAC1BH,UAAU,EAAE;EACd,CAAC;EACD/B,KAAK,EAAE;IAAEiC,SAAS,EAAEzD,KAAK,CAAC2D,QAAQ,GAAG;EAAE,CAAC;EACxClC,IAAI,EAAE;IACJmC,YAAY,EAAE5D,KAAK,CAAC6D,MAAM,CAACpC,IAAI;IAC/BqC,WAAW,EAAElE,UAAU,CAACmE,aAAa;IACrCC,WAAW,EAAEhE,KAAK,CAACyC,KAAK,CAACwB,MAAM;IAC/BC,eAAe,EAAElE,KAAK,CAACyC,KAAK,CAAC0B,OAAO;IACpCC,QAAQ,EAAE;EACZ,CAAC;EACD/B,GAAG,EAAE;IACHgC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBrB,GAAG,EAAE,EAAE;IACPH,iBAAiB,EAAE9C,KAAK,CAACuE,OAAO;IAChCvB,eAAe,EAAE;EACnB,CAAC;EACDV,UAAU,EAAE;IACVkC,iBAAiB,EAAE5E,UAAU,CAACmE,aAAa;IAC3CU,iBAAiB,EAAEzE,KAAK,CAACyC,KAAK,CAACiC;EACjC,CAAC;EACDnC,OAAO,EAAE;IAAEK,IAAI,EAAE,CAAC;IAAEH,KAAK,EAAEzC,KAAK,CAACyC,KAAK,CAACX,IAAI;IAAEoB,QAAQ,EAAElD,KAAK,CAACsD,IAAI,CAACjC,IAAI;IAAEkC,UAAU,EAAE;EAAG,CAAC;EACxFnB,OAAO,EAAE;IAAE8B,eAAe,EAAElE,KAAK,CAACyC,KAAK,CAACkC;EAAK;AAC/C,CAAC,CAAC","ignoreList":[]}
@@ -1 +1,75 @@
1
- "use strict";import{useEffect,useRef}from"react";import{Animated,Easing,Keyboard,Platform,StyleSheet}from"react-native";import{jsx as _jsx}from"react/jsx-runtime";export function KeyboardPad({children:e}){const t=useRef(null),r=useRef(new Animated.Value(0)).current;return useEffect(()=>{if("ios"!==Platform.OS)return;const e=(e,t)=>{Animated.timing(r,{toValue:e,duration:t.duration||250,easing:Easing.bezier(.17,.59,.4,.77),useNativeDriver:!1}).start()},a=[Keyboard.addListener("keyboardWillChangeFrame",r=>{const a=t.current;a&&a.measureInWindow((t,a,n,i)=>{const s=a+i-r.endCoordinates.screenY;e(Math.max(0,s),r)})}),Keyboard.addListener("keyboardWillHide",t=>e(0,t))];return()=>a.forEach(e=>e.remove())},[r]),_jsx(Animated.View,{ref:t,style:[styles.flex,{paddingBottom:r}],children:e})}const styles=StyleSheet.create({flex:{flex:1}});
1
+ "use strict";
2
+
3
+ /**
4
+ * Keeps the composer above the iOS keyboard.
5
+ *
6
+ * Why not `KeyboardAvoidingView`: it takes its frame from `onLayout`, which
7
+ * is RELATIVE TO ITS PARENT, and compares that to the keyboard's SCREEN
8
+ * position. That only agrees when the view starts at the window's origin.
9
+ * Ask Buoy is a JsModal — an absolutely positioned sheet anchored to the
10
+ * bottom of the app tree — so the view's local bottom (a few hundred points
11
+ * into the sheet) sits well above the keyboard's screen Y, the overlap comes
12
+ * out as zero, and nothing moves. The keyboard drew over the composer with
13
+ * a "working" `KeyboardAvoidingView` around it.
14
+ *
15
+ * This measures the SAME thing in the SAME coordinate space: the wrapper's
16
+ * bottom edge in window coordinates via `measureInWindow`, against the
17
+ * keyboard's `endCoordinates.screenY`. The difference is the overlap, and it
18
+ * becomes bottom padding animated over the keyboard's own duration so the
19
+ * composer rides the keyboard instead of jumping after it.
20
+ *
21
+ * The wrapper is `flex: 1` inside a fixed-height sheet body, so its OUTER
22
+ * bounds never change when its padding does — re-measuring on a later
23
+ * frame-change event (a predictive-text bar appearing, an emoji keyboard)
24
+ * gives the same bottom edge.
25
+ *
26
+ * iOS only. Android's window resizes under the keyboard
27
+ * (`softwareKeyboardLayoutMode: "resize"`, both the Expo and the RN CLI
28
+ * template default) and a bottom-anchored sheet rides up for free; padding
29
+ * there would lift it twice. Web has no keyboard events and no keyboard.
30
+ */
31
+ import { useEffect, useRef } from "react";
32
+ import { Animated, Easing, Keyboard, Platform, StyleSheet } from "react-native";
33
+ import { jsx as _jsx } from "react/jsx-runtime";
34
+ export function KeyboardPad({
35
+ children
36
+ }) {
37
+ const ref = useRef(null);
38
+ const pad = useRef(new Animated.Value(0)).current;
39
+ useEffect(() => {
40
+ if (Platform.OS !== "ios") return;
41
+ const animateTo = (value, event) => {
42
+ Animated.timing(pad, {
43
+ toValue: value,
44
+ duration: event.duration || 250,
45
+ // iOS's keyboard curve; `keyboard` is the matching Easing preset.
46
+ easing: Easing.bezier(0.17, 0.59, 0.4, 0.77),
47
+ useNativeDriver: false
48
+ }).start();
49
+ };
50
+ const onChange = event => {
51
+ const node = ref.current;
52
+ if (!node) return;
53
+ node.measureInWindow((_x, y, _w, h) => {
54
+ const overlap = y + h - event.endCoordinates.screenY;
55
+ animateTo(Math.max(0, overlap), event);
56
+ });
57
+ };
58
+ const onHide = event => animateTo(0, event);
59
+ const subs = [Keyboard.addListener("keyboardWillChangeFrame", onChange), Keyboard.addListener("keyboardWillHide", onHide)];
60
+ return () => subs.forEach(s => s.remove());
61
+ }, [pad]);
62
+ return /*#__PURE__*/_jsx(Animated.View, {
63
+ ref: ref,
64
+ style: [styles.flex, {
65
+ paddingBottom: pad
66
+ }],
67
+ children: children
68
+ });
69
+ }
70
+ const styles = StyleSheet.create({
71
+ flex: {
72
+ flex: 1
73
+ }
74
+ });
75
+ //# sourceMappingURL=KeyboardPad.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useRef","Animated","Easing","Keyboard","Platform","StyleSheet","jsx","_jsx","KeyboardPad","children","ref","pad","Value","current","OS","animateTo","value","event","timing","toValue","duration","easing","bezier","useNativeDriver","start","onChange","node","measureInWindow","_x","y","_w","h","overlap","endCoordinates","screenY","Math","max","onHide","subs","addListener","forEach","s","remove","View","style","styles","flex","paddingBottom","create"],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