@buoy-gg/ask-buoy 7.0.36 → 7.0.38

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 (312) hide show
  1. package/README.md +58 -27
  2. package/lib/commonjs/blocks/AskBlocks.js +1 -338
  3. package/lib/commonjs/blocks/BlockRenderer.js +1 -262
  4. package/lib/commonjs/blocks/ChromePrototypes.js +1 -514
  5. package/lib/commonjs/blocks/DataBlocks.js +1 -781
  6. package/lib/commonjs/blocks/ExtraBlocks.js +1 -1860
  7. package/lib/commonjs/blocks/MediaBlocks.js +1 -156
  8. package/lib/commonjs/blocks/ReceiptBlocks.js +1 -586
  9. package/lib/commonjs/blocks/blockText.js +1 -60
  10. package/lib/commonjs/blocks/blockText.test.js +1 -53
  11. package/lib/commonjs/blocks/context.js +1 -42
  12. package/lib/commonjs/blocks/icons.js +1 -96
  13. package/lib/commonjs/blocks/index.js +1 -95
  14. package/lib/commonjs/blocks/listRow.test.js +1 -55
  15. package/lib/commonjs/blocks/pageState.js +1 -34
  16. package/lib/commonjs/blocks/pageState.test.js +1 -57
  17. package/lib/commonjs/blocks/primitives.js +1 -457
  18. package/lib/commonjs/blocks/primitivesIndex.js +1 -62
  19. package/lib/commonjs/components/ApprovalCard.js +1 -244
  20. package/lib/commonjs/components/AskBuoyHeader.js +1 -196
  21. package/lib/commonjs/components/AskBuoyIcon.js +1 -19
  22. package/lib/commonjs/components/AskBuoyModal.js +1 -479
  23. package/lib/commonjs/components/AskBuoySettings.js +1 -119
  24. package/lib/commonjs/components/ChangesBar.js +1 -211
  25. package/lib/commonjs/components/Composer.js +1 -255
  26. package/lib/commonjs/components/EmptyState.js +1 -161
  27. package/lib/commonjs/components/KeyboardPad.js +1 -80
  28. package/lib/commonjs/components/Markdown.js +1 -310
  29. package/lib/commonjs/components/MessageList.js +1 -930
  30. package/lib/commonjs/components/QueuedMessages.js +1 -145
  31. package/lib/commonjs/components/ThinkingStrip.js +1 -223
  32. package/lib/commonjs/components/TypingDots.js +1 -63
  33. package/lib/commonjs/components/markdownParse.js +1 -131
  34. package/lib/commonjs/components/markdownParse.test.js +1 -99
  35. package/lib/commonjs/components/useCopyAction.js +1 -50
  36. package/lib/commonjs/index.js +1 -252
  37. package/lib/commonjs/preset.js +1 -90
  38. package/lib/commonjs/store/activityGroups.js +1 -110
  39. package/lib/commonjs/store/activityGroups.test.js +1 -78
  40. package/lib/commonjs/store/askBuoySettings.js +1 -72
  41. package/lib/commonjs/store/askBuoyStore.js +1 -547
  42. package/lib/commonjs/store/blockPlacement.js +1 -64
  43. package/lib/commonjs/store/blockPlacement.test.js +1 -123
  44. package/lib/commonjs/store/queue.test.js +1 -150
  45. package/lib/commonjs/store/resetConversation.js +1 -77
  46. package/lib/commonjs/store/restorePending.test.js +1 -63
  47. package/lib/commonjs/store/restoredIds.test.js +1 -47
  48. package/lib/commonjs/store/suggestions.js +1 -54
  49. package/lib/commonjs/store/suggestions.test.js +1 -58
  50. package/lib/commonjs/store/systemLine.test.js +1 -77
  51. package/lib/commonjs/store/ticketPrompt.js +1 -17
  52. package/lib/commonjs/store/traceText.js +1 -81
  53. package/lib/commonjs/store/traceText.test.js +1 -112
  54. package/lib/commonjs/store/transcriptPersistence.js +1 -297
  55. package/lib/commonjs/store/transcriptPersistence.test.js +1 -333
  56. package/lib/commonjs/store/turnRendering.test.js +1 -151
  57. package/lib/commonjs/store/useAskBuoy.js +1 -622
  58. package/lib/commonjs/store/useAskBuoySettings.js +1 -14
  59. package/lib/commonjs/sync/askBuoySyncAdapter.js +1 -140
  60. package/lib/commonjs/sync/askBuoySyncAdapter.test.js +1 -141
  61. package/lib/commonjs/sync/wire.js +1 -58
  62. package/lib/commonjs/types.js +1 -6
  63. package/lib/module/blocks/AskBlocks.js +1 -331
  64. package/lib/module/blocks/BlockRenderer.js +1 -257
  65. package/lib/module/blocks/ChromePrototypes.js +1 -503
  66. package/lib/module/blocks/DataBlocks.js +1 -767
  67. package/lib/module/blocks/ExtraBlocks.js +1 -1833
  68. package/lib/module/blocks/MediaBlocks.js +1 -151
  69. package/lib/module/blocks/ReceiptBlocks.js +1 -574
  70. package/lib/module/blocks/blockText.js +1 -55
  71. package/lib/module/blocks/blockText.test.js +1 -53
  72. package/lib/module/blocks/context.js +1 -35
  73. package/lib/module/blocks/icons.js +1 -91
  74. package/lib/module/blocks/index.js +1 -8
  75. package/lib/module/blocks/listRow.test.js +1 -56
  76. package/lib/module/blocks/pageState.js +1 -30
  77. package/lib/module/blocks/pageState.test.js +1 -56
  78. package/lib/module/blocks/primitives.js +1 -445
  79. package/lib/module/blocks/primitivesIndex.js +1 -5
  80. package/lib/module/components/ApprovalCard.js +1 -239
  81. package/lib/module/components/AskBuoyHeader.js +1 -193
  82. package/lib/module/components/AskBuoyIcon.js +1 -8
  83. package/lib/module/components/AskBuoyModal.js +1 -474
  84. package/lib/module/components/AskBuoySettings.js +1 -114
  85. package/lib/module/components/ChangesBar.js +1 -206
  86. package/lib/module/components/Composer.js +1 -250
  87. package/lib/module/components/EmptyState.js +1 -156
  88. package/lib/module/components/KeyboardPad.js +1 -75
  89. package/lib/module/components/Markdown.js +1 -305
  90. package/lib/module/components/MessageList.js +1 -924
  91. package/lib/module/components/QueuedMessages.js +1 -140
  92. package/lib/module/components/ThinkingStrip.js +1 -218
  93. package/lib/module/components/TypingDots.js +1 -58
  94. package/lib/module/components/markdownParse.js +1 -125
  95. package/lib/module/components/markdownParse.test.js +1 -98
  96. package/lib/module/components/useCopyAction.js +1 -46
  97. package/lib/module/index.js +1 -34
  98. package/lib/module/preset.js +1 -73
  99. package/lib/module/store/activityGroups.js +1 -103
  100. package/lib/module/store/activityGroups.test.js +1 -77
  101. package/lib/module/store/askBuoySettings.js +1 -67
  102. package/lib/module/store/askBuoyStore.js +1 -541
  103. package/lib/module/store/blockPlacement.js +1 -59
  104. package/lib/module/store/blockPlacement.test.js +1 -122
  105. package/lib/module/store/queue.test.js +1 -149
  106. package/lib/module/store/resetConversation.js +1 -72
  107. package/lib/module/store/restorePending.test.js +1 -62
  108. package/lib/module/store/restoredIds.test.js +1 -46
  109. package/lib/module/store/suggestions.js +1 -49
  110. package/lib/module/store/suggestions.test.js +1 -57
  111. package/lib/module/store/systemLine.test.js +1 -76
  112. package/lib/module/store/ticketPrompt.js +1 -13
  113. package/lib/module/store/traceText.js +1 -75
  114. package/lib/module/store/traceText.test.js +1 -111
  115. package/lib/module/store/transcriptPersistence.js +1 -287
  116. package/lib/module/store/transcriptPersistence.test.js +1 -332
  117. package/lib/module/store/turnRendering.test.js +1 -150
  118. package/lib/module/store/useAskBuoy.js +1 -616
  119. package/lib/module/store/useAskBuoySettings.js +1 -9
  120. package/lib/module/sync/askBuoySyncAdapter.js +1 -135
  121. package/lib/module/sync/askBuoySyncAdapter.test.js +1 -140
  122. package/lib/module/sync/wire.js +1 -47
  123. package/lib/module/types.js +1 -4
  124. package/lib/typescript/components/ApprovalCard.d.ts +9 -1
  125. package/lib/typescript/preset.d.ts +4 -2
  126. package/lib/typescript/store/askBuoyStore.d.ts +32 -4
  127. package/lib/typescript/store/useAskBuoy.d.ts +3 -2
  128. package/lib/typescript/sync/askBuoySyncAdapter.d.ts +3 -0
  129. package/package.json +9 -9
  130. package/lib/commonjs/blocks/AskBlocks.js.map +0 -1
  131. package/lib/commonjs/blocks/BlockRenderer.js.map +0 -1
  132. package/lib/commonjs/blocks/ChromePrototypes.js.map +0 -1
  133. package/lib/commonjs/blocks/DataBlocks.js.map +0 -1
  134. package/lib/commonjs/blocks/ExtraBlocks.js.map +0 -1
  135. package/lib/commonjs/blocks/MediaBlocks.js.map +0 -1
  136. package/lib/commonjs/blocks/ReceiptBlocks.js.map +0 -1
  137. package/lib/commonjs/blocks/blockText.js.map +0 -1
  138. package/lib/commonjs/blocks/blockText.test.js.map +0 -1
  139. package/lib/commonjs/blocks/context.js.map +0 -1
  140. package/lib/commonjs/blocks/icons.js.map +0 -1
  141. package/lib/commonjs/blocks/index.js.map +0 -1
  142. package/lib/commonjs/blocks/listRow.test.js.map +0 -1
  143. package/lib/commonjs/blocks/pageState.js.map +0 -1
  144. package/lib/commonjs/blocks/pageState.test.js.map +0 -1
  145. package/lib/commonjs/blocks/primitives.js.map +0 -1
  146. package/lib/commonjs/blocks/primitivesIndex.js.map +0 -1
  147. package/lib/commonjs/components/ApprovalCard.js.map +0 -1
  148. package/lib/commonjs/components/AskBuoyHeader.js.map +0 -1
  149. package/lib/commonjs/components/AskBuoyIcon.js.map +0 -1
  150. package/lib/commonjs/components/AskBuoyModal.js.map +0 -1
  151. package/lib/commonjs/components/AskBuoySettings.js.map +0 -1
  152. package/lib/commonjs/components/ChangesBar.js.map +0 -1
  153. package/lib/commonjs/components/Composer.js.map +0 -1
  154. package/lib/commonjs/components/EmptyState.js.map +0 -1
  155. package/lib/commonjs/components/KeyboardPad.js.map +0 -1
  156. package/lib/commonjs/components/Markdown.js.map +0 -1
  157. package/lib/commonjs/components/MessageList.js.map +0 -1
  158. package/lib/commonjs/components/QueuedMessages.js.map +0 -1
  159. package/lib/commonjs/components/ThinkingStrip.js.map +0 -1
  160. package/lib/commonjs/components/TypingDots.js.map +0 -1
  161. package/lib/commonjs/components/markdownParse.js.map +0 -1
  162. package/lib/commonjs/components/markdownParse.test.js.map +0 -1
  163. package/lib/commonjs/components/useCopyAction.js.map +0 -1
  164. package/lib/commonjs/index.js.map +0 -1
  165. package/lib/commonjs/preset.js.map +0 -1
  166. package/lib/commonjs/store/activityGroups.js.map +0 -1
  167. package/lib/commonjs/store/activityGroups.test.js.map +0 -1
  168. package/lib/commonjs/store/askBuoySettings.js.map +0 -1
  169. package/lib/commonjs/store/askBuoyStore.js.map +0 -1
  170. package/lib/commonjs/store/blockPlacement.js.map +0 -1
  171. package/lib/commonjs/store/blockPlacement.test.js.map +0 -1
  172. package/lib/commonjs/store/queue.test.js.map +0 -1
  173. package/lib/commonjs/store/resetConversation.js.map +0 -1
  174. package/lib/commonjs/store/restorePending.test.js.map +0 -1
  175. package/lib/commonjs/store/restoredIds.test.js.map +0 -1
  176. package/lib/commonjs/store/suggestions.js.map +0 -1
  177. package/lib/commonjs/store/suggestions.test.js.map +0 -1
  178. package/lib/commonjs/store/systemLine.test.js.map +0 -1
  179. package/lib/commonjs/store/ticketPrompt.js.map +0 -1
  180. package/lib/commonjs/store/traceText.js.map +0 -1
  181. package/lib/commonjs/store/traceText.test.js.map +0 -1
  182. package/lib/commonjs/store/transcriptPersistence.js.map +0 -1
  183. package/lib/commonjs/store/transcriptPersistence.test.js.map +0 -1
  184. package/lib/commonjs/store/turnRendering.test.js.map +0 -1
  185. package/lib/commonjs/store/useAskBuoy.js.map +0 -1
  186. package/lib/commonjs/store/useAskBuoySettings.js.map +0 -1
  187. package/lib/commonjs/sync/askBuoySyncAdapter.js.map +0 -1
  188. package/lib/commonjs/sync/askBuoySyncAdapter.test.js.map +0 -1
  189. package/lib/commonjs/sync/wire.js.map +0 -1
  190. package/lib/commonjs/types.js.map +0 -1
  191. package/lib/module/blocks/AskBlocks.js.map +0 -1
  192. package/lib/module/blocks/BlockRenderer.js.map +0 -1
  193. package/lib/module/blocks/ChromePrototypes.js.map +0 -1
  194. package/lib/module/blocks/DataBlocks.js.map +0 -1
  195. package/lib/module/blocks/ExtraBlocks.js.map +0 -1
  196. package/lib/module/blocks/MediaBlocks.js.map +0 -1
  197. package/lib/module/blocks/ReceiptBlocks.js.map +0 -1
  198. package/lib/module/blocks/blockText.js.map +0 -1
  199. package/lib/module/blocks/blockText.test.js.map +0 -1
  200. package/lib/module/blocks/context.js.map +0 -1
  201. package/lib/module/blocks/icons.js.map +0 -1
  202. package/lib/module/blocks/index.js.map +0 -1
  203. package/lib/module/blocks/listRow.test.js.map +0 -1
  204. package/lib/module/blocks/pageState.js.map +0 -1
  205. package/lib/module/blocks/pageState.test.js.map +0 -1
  206. package/lib/module/blocks/primitives.js.map +0 -1
  207. package/lib/module/blocks/primitivesIndex.js.map +0 -1
  208. package/lib/module/components/ApprovalCard.js.map +0 -1
  209. package/lib/module/components/AskBuoyHeader.js.map +0 -1
  210. package/lib/module/components/AskBuoyIcon.js.map +0 -1
  211. package/lib/module/components/AskBuoyModal.js.map +0 -1
  212. package/lib/module/components/AskBuoySettings.js.map +0 -1
  213. package/lib/module/components/ChangesBar.js.map +0 -1
  214. package/lib/module/components/Composer.js.map +0 -1
  215. package/lib/module/components/EmptyState.js.map +0 -1
  216. package/lib/module/components/KeyboardPad.js.map +0 -1
  217. package/lib/module/components/Markdown.js.map +0 -1
  218. package/lib/module/components/MessageList.js.map +0 -1
  219. package/lib/module/components/QueuedMessages.js.map +0 -1
  220. package/lib/module/components/ThinkingStrip.js.map +0 -1
  221. package/lib/module/components/TypingDots.js.map +0 -1
  222. package/lib/module/components/markdownParse.js.map +0 -1
  223. package/lib/module/components/markdownParse.test.js.map +0 -1
  224. package/lib/module/components/useCopyAction.js.map +0 -1
  225. package/lib/module/index.js.map +0 -1
  226. package/lib/module/preset.js.map +0 -1
  227. package/lib/module/store/activityGroups.js.map +0 -1
  228. package/lib/module/store/activityGroups.test.js.map +0 -1
  229. package/lib/module/store/askBuoySettings.js.map +0 -1
  230. package/lib/module/store/askBuoyStore.js.map +0 -1
  231. package/lib/module/store/blockPlacement.js.map +0 -1
  232. package/lib/module/store/blockPlacement.test.js.map +0 -1
  233. package/lib/module/store/queue.test.js.map +0 -1
  234. package/lib/module/store/resetConversation.js.map +0 -1
  235. package/lib/module/store/restorePending.test.js.map +0 -1
  236. package/lib/module/store/restoredIds.test.js.map +0 -1
  237. package/lib/module/store/suggestions.js.map +0 -1
  238. package/lib/module/store/suggestions.test.js.map +0 -1
  239. package/lib/module/store/systemLine.test.js.map +0 -1
  240. package/lib/module/store/ticketPrompt.js.map +0 -1
  241. package/lib/module/store/traceText.js.map +0 -1
  242. package/lib/module/store/traceText.test.js.map +0 -1
  243. package/lib/module/store/transcriptPersistence.js.map +0 -1
  244. package/lib/module/store/transcriptPersistence.test.js.map +0 -1
  245. package/lib/module/store/turnRendering.test.js.map +0 -1
  246. package/lib/module/store/useAskBuoy.js.map +0 -1
  247. package/lib/module/store/useAskBuoySettings.js.map +0 -1
  248. package/lib/module/sync/askBuoySyncAdapter.js.map +0 -1
  249. package/lib/module/sync/askBuoySyncAdapter.test.js.map +0 -1
  250. package/lib/module/sync/wire.js.map +0 -1
  251. package/lib/module/types.js.map +0 -1
  252. package/lib/typescript/blocks/AskBlocks.d.ts.map +0 -1
  253. package/lib/typescript/blocks/BlockRenderer.d.ts.map +0 -1
  254. package/lib/typescript/blocks/ChromePrototypes.d.ts.map +0 -1
  255. package/lib/typescript/blocks/DataBlocks.d.ts.map +0 -1
  256. package/lib/typescript/blocks/ExtraBlocks.d.ts.map +0 -1
  257. package/lib/typescript/blocks/MediaBlocks.d.ts.map +0 -1
  258. package/lib/typescript/blocks/ReceiptBlocks.d.ts.map +0 -1
  259. package/lib/typescript/blocks/blockText.d.ts.map +0 -1
  260. package/lib/typescript/blocks/blockText.test.d.ts.map +0 -1
  261. package/lib/typescript/blocks/context.d.ts.map +0 -1
  262. package/lib/typescript/blocks/icons.d.ts.map +0 -1
  263. package/lib/typescript/blocks/index.d.ts.map +0 -1
  264. package/lib/typescript/blocks/listRow.test.d.ts.map +0 -1
  265. package/lib/typescript/blocks/pageState.d.ts.map +0 -1
  266. package/lib/typescript/blocks/pageState.test.d.ts.map +0 -1
  267. package/lib/typescript/blocks/primitives.d.ts.map +0 -1
  268. package/lib/typescript/blocks/primitivesIndex.d.ts.map +0 -1
  269. package/lib/typescript/components/ApprovalCard.d.ts.map +0 -1
  270. package/lib/typescript/components/AskBuoyHeader.d.ts.map +0 -1
  271. package/lib/typescript/components/AskBuoyIcon.d.ts.map +0 -1
  272. package/lib/typescript/components/AskBuoyModal.d.ts.map +0 -1
  273. package/lib/typescript/components/AskBuoySettings.d.ts.map +0 -1
  274. package/lib/typescript/components/ChangesBar.d.ts.map +0 -1
  275. package/lib/typescript/components/Composer.d.ts.map +0 -1
  276. package/lib/typescript/components/EmptyState.d.ts.map +0 -1
  277. package/lib/typescript/components/KeyboardPad.d.ts.map +0 -1
  278. package/lib/typescript/components/Markdown.d.ts.map +0 -1
  279. package/lib/typescript/components/MessageList.d.ts.map +0 -1
  280. package/lib/typescript/components/QueuedMessages.d.ts.map +0 -1
  281. package/lib/typescript/components/ThinkingStrip.d.ts.map +0 -1
  282. package/lib/typescript/components/TypingDots.d.ts.map +0 -1
  283. package/lib/typescript/components/markdownParse.d.ts.map +0 -1
  284. package/lib/typescript/components/markdownParse.test.d.ts.map +0 -1
  285. package/lib/typescript/components/useCopyAction.d.ts.map +0 -1
  286. package/lib/typescript/index.d.ts.map +0 -1
  287. package/lib/typescript/preset.d.ts.map +0 -1
  288. package/lib/typescript/store/activityGroups.d.ts.map +0 -1
  289. package/lib/typescript/store/activityGroups.test.d.ts.map +0 -1
  290. package/lib/typescript/store/askBuoySettings.d.ts.map +0 -1
  291. package/lib/typescript/store/askBuoyStore.d.ts.map +0 -1
  292. package/lib/typescript/store/blockPlacement.d.ts.map +0 -1
  293. package/lib/typescript/store/blockPlacement.test.d.ts.map +0 -1
  294. package/lib/typescript/store/queue.test.d.ts.map +0 -1
  295. package/lib/typescript/store/resetConversation.d.ts.map +0 -1
  296. package/lib/typescript/store/restorePending.test.d.ts.map +0 -1
  297. package/lib/typescript/store/restoredIds.test.d.ts.map +0 -1
  298. package/lib/typescript/store/suggestions.d.ts.map +0 -1
  299. package/lib/typescript/store/suggestions.test.d.ts.map +0 -1
  300. package/lib/typescript/store/systemLine.test.d.ts.map +0 -1
  301. package/lib/typescript/store/ticketPrompt.d.ts.map +0 -1
  302. package/lib/typescript/store/traceText.d.ts.map +0 -1
  303. package/lib/typescript/store/traceText.test.d.ts.map +0 -1
  304. package/lib/typescript/store/transcriptPersistence.d.ts.map +0 -1
  305. package/lib/typescript/store/transcriptPersistence.test.d.ts.map +0 -1
  306. package/lib/typescript/store/turnRendering.test.d.ts.map +0 -1
  307. package/lib/typescript/store/useAskBuoy.d.ts.map +0 -1
  308. package/lib/typescript/store/useAskBuoySettings.d.ts.map +0 -1
  309. package/lib/typescript/sync/askBuoySyncAdapter.d.ts.map +0 -1
  310. package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts.map +0 -1
  311. package/lib/typescript/sync/wire.d.ts.map +0 -1
  312. package/lib/typescript/types.d.ts.map +0 -1
@@ -1,75 +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
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,305 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * Just enough Markdown for a chat answer.
5
- *
6
- * Models write `**bold**`, bullet lists and `code` whether or not the prompt
7
- * asks for prose, and the asterisks rendered raw made every answer look like
8
- * a broken template. This handles the subset a chat actually receives —
9
- * paragraphs, `-`/`*`/`1.` lists, `#` headings (rendered bold, not huge),
10
- * pipe tables, fenced code, bold, italics and inline code — with no
11
- * dependency and no HTML. Anything it does not understand falls through as
12
- * plain text, never as a blank. The parser lives in markdownParse.ts so it
13
- * can be tested without React Native.
14
- */
15
- import { useState } from "react";
16
- import { Pressable, ScrollView, StyleSheet, Text, View } from "react-native";
17
- import { night } from "@buoy-gg/shared-ui";
18
- import { parseBlocks, TABLE_PREVIEW_COLS, TABLE_PREVIEW_ROWS, tableTruncation } from "./markdownParse";
19
-
20
- /**
21
- * `**bold**`, `*italic*` / `_italic_`, `` `code` `` → styled spans. Links and
22
- * images collapse to their text: a phone chat has nowhere to open a URL, and
23
- * `![Snorlax](https://raw.githubusercontent.com/…/143.png)` printed raw is
24
- * three lines of noise for one word of meaning.
25
- */
26
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
27
- export function renderInline(source, base) {
28
- const text = source.replace(/!?\[([^\]]*)\]\([^)]*\)/g, "$1");
29
- const out = [];
30
- const re = /(\*\*[^*]+\*\*|`[^`]+`|\*[^*\s][^*]*\*|_[^_\s][^_]*_)/g;
31
- let last = 0;
32
- let m;
33
- let i = 0;
34
- while (m = re.exec(text)) {
35
- if (m.index > last) out.push(text.slice(last, m.index));
36
- const tok = m[0];
37
- if (tok.startsWith("**")) {
38
- out.push(/*#__PURE__*/_jsx(Text, {
39
- style: [base, styles.bold],
40
- children: tok.slice(2, -2)
41
- }, i++));
42
- } else if (tok.startsWith("`")) {
43
- out.push(/*#__PURE__*/_jsx(Text, {
44
- style: [base, styles.code],
45
- children: tok.slice(1, -1)
46
- }, i++));
47
- } else {
48
- out.push(/*#__PURE__*/_jsx(Text, {
49
- style: [base, styles.italic],
50
- children: tok.slice(1, -1)
51
- }, i++));
52
- }
53
- last = m.index + tok.length;
54
- }
55
- if (last < text.length) out.push(text.slice(last));
56
- return out;
57
- }
58
- const stripLinks = s => s.replace(/!?\[([^\]]*)\]\([^)]*\)/g, "$1");
59
-
60
- /**
61
- * A pipe table, cut to a preview that SAYS it is cut.
62
- *
63
- * It used to slice to four columns and twelve rows in silence. A model asked
64
- * for "all 30 bag lines" sent 30; the tester read 12 and filed "the bag only
65
- * has 12 items". Evidence that is cut must say so — a footer names what is
66
- * missing and Show all expands to every row and column inside a capped,
67
- * horizontally scrollable box, the same shape the approval card uses for its
68
- * long description.
69
- */
70
- function MarkdownTable({
71
- header,
72
- rows
73
- }) {
74
- const [expanded, setExpanded] = useState(false);
75
- const truncation = tableTruncation(header, rows);
76
- const cols = expanded ? header : header.slice(0, TABLE_PREVIEW_COLS);
77
- const shownRows = expanded ? rows : rows.slice(0, TABLE_PREVIEW_ROWS);
78
- const body = /*#__PURE__*/_jsxs(View, {
79
- style: expanded && styles.tableWide,
80
- children: [/*#__PURE__*/_jsx(View, {
81
- style: styles.tableHead,
82
- children: cols.map((c, k) => /*#__PURE__*/_jsx(Text, {
83
- style: [styles.th, k === 0 && styles.firstCol, expanded && styles.colFixed],
84
- numberOfLines: 1,
85
- children: c.replace(/\*\*/g, "")
86
- }, k))
87
- }), shownRows.map((r, ri) => /*#__PURE__*/_jsx(View, {
88
- style: [styles.tr, ri > 0 && styles.trDivider],
89
- children: cols.map((_, k) => /*#__PURE__*/_jsx(Text, {
90
- style: [styles.td, k === 0 && styles.firstCol, k === 0 && styles.tdFirst, expanded && styles.colFixed],
91
- numberOfLines: expanded ? 3 : 2,
92
- children: renderInline(stripLinks(r[k] ?? ""), styles.td)
93
- }, k))
94
- }, ri))]
95
- });
96
- return /*#__PURE__*/_jsxs(View, {
97
- style: styles.table,
98
- testID: "buoy-ask-buoy-md-table",
99
- children: [expanded ?
100
- /*#__PURE__*/
101
- // Capped both ways: every column gets a real width and scrolls
102
- // sideways; the rows scroll inside the card rather than taking the
103
- // whole transcript with them.
104
- _jsx(ScrollView, {
105
- style: styles.tableScrollV,
106
- nestedScrollEnabled: true,
107
- children: /*#__PURE__*/_jsx(ScrollView, {
108
- horizontal: true,
109
- showsHorizontalScrollIndicator: true,
110
- children: body
111
- })
112
- }) : body, truncation ? /*#__PURE__*/_jsxs(Pressable, {
113
- testID: "buoy-ask-buoy-md-table-toggle",
114
- accessibilityRole: "button",
115
- accessibilityLabel: expanded ? "Show fewer rows" : "Show all rows and columns",
116
- onPress: () => setExpanded(v => !v),
117
- style: ({
118
- pressed
119
- }) => [styles.tfoot, pressed && styles.pressed],
120
- children: [/*#__PURE__*/_jsx(Text, {
121
- style: styles.tfootText,
122
- children: expanded ? `All ${rows.length} rows · ${header.length} columns` : truncation
123
- }), /*#__PURE__*/_jsx(Text, {
124
- style: styles.tfootAction,
125
- children: expanded ? "Show fewer" : "Show all"
126
- })]
127
- }) : null]
128
- });
129
- }
130
- export function Markdown({
131
- text,
132
- style
133
- }) {
134
- const blocks = parseBlocks(text);
135
- return /*#__PURE__*/_jsx(View, {
136
- style: styles.wrap,
137
- children: blocks.map((b, i) => {
138
- if (b.kind === "table") return /*#__PURE__*/_jsx(MarkdownTable, {
139
- header: b.header,
140
- rows: b.rows
141
- }, i);
142
- if (b.kind === "code") {
143
- return (
144
- /*#__PURE__*/
145
- // Newlines and indentation kept; long lines scroll sideways rather
146
- // than wrapping a JSON object into soup.
147
- _jsx(ScrollView, {
148
- horizontal: true,
149
- style: styles.codeBlock,
150
- contentContainerStyle: styles.codeBlockContent,
151
- testID: "buoy-ask-buoy-md-code",
152
- children: /*#__PURE__*/_jsx(Text, {
153
- style: styles.codeText,
154
- selectable: true,
155
- children: b.text
156
- })
157
- }, i)
158
- );
159
- }
160
- if (b.kind === "li") {
161
- return /*#__PURE__*/_jsxs(View, {
162
- style: [styles.li, {
163
- paddingLeft: 4 + b.depth * 14
164
- }],
165
- children: [/*#__PURE__*/_jsx(Text, {
166
- style: [style, styles.marker],
167
- children: b.marker
168
- }), /*#__PURE__*/_jsx(Text, {
169
- style: [style, styles.liText],
170
- selectable: true,
171
- children: renderInline(b.text, style)
172
- })]
173
- }, i);
174
- }
175
- return /*#__PURE__*/_jsx(Text, {
176
- style: [style, b.kind === "h" && styles.bold],
177
- selectable: true,
178
- children: renderInline(b.text, style)
179
- }, i);
180
- })
181
- });
182
- }
183
- const styles = StyleSheet.create({
184
- wrap: {
185
- gap: 8
186
- },
187
- bold: {
188
- fontWeight: "600"
189
- },
190
- italic: {
191
- fontStyle: "italic"
192
- },
193
- code: {
194
- fontFamily: "Menlo",
195
- fontSize: 13,
196
- color: night.color.accent,
197
- backgroundColor: night.color.fill
198
- },
199
- codeBlock: {
200
- borderRadius: night.radius.row,
201
- borderWidth: StyleSheet.hairlineWidth,
202
- borderColor: night.color.border,
203
- backgroundColor: night.color.surface
204
- },
205
- codeBlockContent: {
206
- paddingHorizontal: 12,
207
- paddingVertical: 10
208
- },
209
- codeText: {
210
- fontFamily: "Menlo",
211
- fontSize: 12,
212
- lineHeight: 18,
213
- color: night.color.text
214
- },
215
- li: {
216
- flexDirection: "row",
217
- gap: 8
218
- },
219
- table: {
220
- borderRadius: night.radius.row,
221
- borderWidth: StyleSheet.hairlineWidth,
222
- borderColor: night.color.border,
223
- backgroundColor: night.color.surface,
224
- overflow: "hidden"
225
- },
226
- tableWide: {
227
- minWidth: "100%"
228
- },
229
- tableScrollV: {
230
- maxHeight: 320
231
- },
232
- tableHead: {
233
- flexDirection: "row",
234
- paddingHorizontal: 10,
235
- paddingVertical: 6,
236
- gap: 8,
237
- backgroundColor: night.color.fill
238
- },
239
- th: {
240
- flex: 1,
241
- color: night.color.textTertiary,
242
- fontSize: night.font.micro,
243
- fontWeight: "700",
244
- letterSpacing: 0.6,
245
- textTransform: "uppercase"
246
- },
247
- tr: {
248
- flexDirection: "row",
249
- paddingHorizontal: 10,
250
- paddingVertical: 7,
251
- gap: 8
252
- },
253
- trDivider: {
254
- borderTopWidth: StyleSheet.hairlineWidth,
255
- borderTopColor: night.color.separator
256
- },
257
- td: {
258
- flex: 1,
259
- color: night.color.textSecondary,
260
- fontSize: night.font.caption,
261
- lineHeight: 17
262
- },
263
- tdFirst: {
264
- color: night.color.text,
265
- fontWeight: "500"
266
- },
267
- firstCol: {
268
- flex: 1.3
269
- },
270
- // Expanded: a real width per column so six of them don't share one row.
271
- colFixed: {
272
- flex: 0,
273
- width: 110
274
- },
275
- tfoot: {
276
- flexDirection: "row",
277
- justifyContent: "space-between",
278
- alignItems: "center",
279
- paddingHorizontal: 10,
280
- paddingVertical: 8,
281
- borderTopWidth: StyleSheet.hairlineWidth,
282
- borderTopColor: night.color.border
283
- },
284
- tfootText: {
285
- color: night.color.textSecondary,
286
- fontSize: night.font.micro
287
- },
288
- tfootAction: {
289
- color: night.color.accent,
290
- fontSize: night.font.micro,
291
- fontWeight: "600"
292
- },
293
- pressed: {
294
- opacity: 0.7
295
- },
296
- marker: {
297
- color: night.color.textSecondary,
298
- minWidth: 14,
299
- textAlign: "right"
300
- },
301
- liText: {
302
- flex: 1
303
- }
304
- });
305
- //# sourceMappingURL=Markdown.js.map
1
+ "use strict";import{useState}from"react";import{Pressable,ScrollView,StyleSheet,Text,View}from"react-native";import{night}from"@buoy-gg/shared-ui";import{parseBlocks,TABLE_PREVIEW_COLS,TABLE_PREVIEW_ROWS,tableTruncation}from"./markdownParse";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export function renderInline(e,t){const l=e.replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1"),o=[],r=/(\*\*[^*]+\*\*|`[^`]+`|\*[^*\s][^*]*\*|_[^_\s][^_]*_)/g;let i,s=0,n=0;for(;i=r.exec(l);){i.index>s&&o.push(l.slice(s,i.index));const e=i[0];e.startsWith("**")?o.push(_jsx(Text,{style:[t,styles.bold],children:e.slice(2,-2)},n++)):e.startsWith("`")?o.push(_jsx(Text,{style:[t,styles.code],children:e.slice(1,-1)},n++)):o.push(_jsx(Text,{style:[t,styles.italic],children:e.slice(1,-1)},n++)),s=i.index+e.length}return s<l.length&&o.push(l.slice(s)),o}const stripLinks=e=>e.replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1");function MarkdownTable({header:e,rows:t}){const[l,o]=useState(!1),r=tableTruncation(e,t),i=l?e:e.slice(0,TABLE_PREVIEW_COLS),s=l?t:t.slice(0,TABLE_PREVIEW_ROWS),n=_jsxs(View,{style:l&&styles.tableWide,children:[_jsx(View,{style:styles.tableHead,children:i.map((e,t)=>_jsx(Text,{style:[styles.th,0===t&&styles.firstCol,l&&styles.colFixed],numberOfLines:1,children:e.replace(/\*\*/g,"")},t))}),s.map((e,t)=>_jsx(View,{style:[styles.tr,t>0&&styles.trDivider],children:i.map((t,o)=>_jsx(Text,{style:[styles.td,0===o&&styles.firstCol,0===o&&styles.tdFirst,l&&styles.colFixed],numberOfLines:l?3:2,children:renderInline(stripLinks(e[o]??""),styles.td)},o))},t))]});return _jsxs(View,{style:styles.table,testID:"buoy-ask-buoy-md-table",children:[l?_jsx(ScrollView,{style:styles.tableScrollV,nestedScrollEnabled:!0,children:_jsx(ScrollView,{horizontal:!0,showsHorizontalScrollIndicator:!0,children:n})}):n,r?_jsxs(Pressable,{testID:"buoy-ask-buoy-md-table-toggle",accessibilityRole:"button",accessibilityLabel:l?"Show fewer rows":"Show all rows and columns",onPress:()=>o(e=>!e),style:({pressed:e})=>[styles.tfoot,e&&styles.pressed],children:[_jsx(Text,{style:styles.tfootText,children:l?`All ${t.length} rows · ${e.length} columns`:r}),_jsx(Text,{style:styles.tfootAction,children:l?"Show fewer":"Show all"})]}):null]})}export function Markdown({text:e,style:t}){const l=parseBlocks(e);return _jsx(View,{style:styles.wrap,children:l.map((e,l)=>"table"===e.kind?_jsx(MarkdownTable,{header:e.header,rows:e.rows},l):"code"===e.kind?_jsx(ScrollView,{horizontal:!0,style:styles.codeBlock,contentContainerStyle:styles.codeBlockContent,testID:"buoy-ask-buoy-md-code",children:_jsx(Text,{style:styles.codeText,selectable:!0,children:e.text})},l):"li"===e.kind?_jsxs(View,{style:[styles.li,{paddingLeft:4+14*e.depth}],children:[_jsx(Text,{style:[t,styles.marker],children:e.marker}),_jsx(Text,{style:[t,styles.liText],selectable:!0,children:renderInline(e.text,t)})]},l):_jsx(Text,{style:[t,"h"===e.kind&&styles.bold],selectable:!0,children:renderInline(e.text,t)},l))})}const styles=StyleSheet.create({wrap:{gap:8},bold:{fontWeight:"600"},italic:{fontStyle:"italic"},code:{fontFamily:"Menlo",fontSize:13,color:night.color.accent,backgroundColor:night.color.fill},codeBlock:{borderRadius:night.radius.row,borderWidth:StyleSheet.hairlineWidth,borderColor:night.color.border,backgroundColor:night.color.surface},codeBlockContent:{paddingHorizontal:12,paddingVertical:10},codeText:{fontFamily:"Menlo",fontSize:12,lineHeight:18,color:night.color.text},li:{flexDirection:"row",gap:8},table:{borderRadius:night.radius.row,borderWidth:StyleSheet.hairlineWidth,borderColor:night.color.border,backgroundColor:night.color.surface,overflow:"hidden"},tableWide:{minWidth:"100%"},tableScrollV:{maxHeight:320},tableHead:{flexDirection:"row",paddingHorizontal:10,paddingVertical:6,gap:8,backgroundColor:night.color.fill},th:{flex:1,color:night.color.textTertiary,fontSize:night.font.micro,fontWeight:"700",letterSpacing:.6,textTransform:"uppercase"},tr:{flexDirection:"row",paddingHorizontal:10,paddingVertical:7,gap:8},trDivider:{borderTopWidth:StyleSheet.hairlineWidth,borderTopColor:night.color.separator},td:{flex:1,color:night.color.textSecondary,fontSize:night.font.caption,lineHeight:17},tdFirst:{color:night.color.text,fontWeight:"500"},firstCol:{flex:1.3},colFixed:{flex:0,width:110},tfoot:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingHorizontal:10,paddingVertical:8,borderTopWidth:StyleSheet.hairlineWidth,borderTopColor:night.color.border},tfootText:{color:night.color.textSecondary,fontSize:night.font.micro},tfootAction:{color:night.color.accent,fontSize:night.font.micro,fontWeight:"600"},pressed:{opacity:.7},marker:{color:night.color.textSecondary,minWidth:14,textAlign:"right"},liText:{flex:1}});