@buoy-gg/ask-buoy 7.0.41 → 7.0.42

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 (313) hide show
  1. package/README.md +13 -98
  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 -783
  6. package/lib/commonjs/blocks/ExtraBlocks.js +1 -1862
  7. package/lib/commonjs/blocks/MediaBlocks.js +1 -158
  8. package/lib/commonjs/blocks/ReceiptBlocks.js +2 -592
  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/blocks/ruleStates.js +1 -39
  20. package/lib/commonjs/components/ApprovalCard.js +1 -297
  21. package/lib/commonjs/components/AskBuoyHeader.js +1 -196
  22. package/lib/commonjs/components/AskBuoyIcon.js +1 -19
  23. package/lib/commonjs/components/AskBuoyModal.js +2 -482
  24. package/lib/commonjs/components/AskBuoySettings.js +1 -181
  25. package/lib/commonjs/components/ChangesBar.js +1 -212
  26. package/lib/commonjs/components/Composer.js +1 -255
  27. package/lib/commonjs/components/EmptyState.js +1 -161
  28. package/lib/commonjs/components/KeyboardPad.js +1 -80
  29. package/lib/commonjs/components/Markdown.js +1 -310
  30. package/lib/commonjs/components/MessageList.js +1 -970
  31. package/lib/commonjs/components/QueuedMessages.js +1 -145
  32. package/lib/commonjs/components/ThinkingStrip.js +1 -223
  33. package/lib/commonjs/components/TypingDots.js +1 -63
  34. package/lib/commonjs/components/markdownParse.js +1 -131
  35. package/lib/commonjs/components/markdownParse.test.js +1 -99
  36. package/lib/commonjs/components/useCopyAction.js +1 -50
  37. package/lib/commonjs/index.js +1 -252
  38. package/lib/commonjs/preset.js +1 -91
  39. package/lib/commonjs/store/activityGroups.js +1 -110
  40. package/lib/commonjs/store/activityGroups.test.js +1 -78
  41. package/lib/commonjs/store/askBuoySettings.js +1 -72
  42. package/lib/commonjs/store/askBuoyStore.js +2 -588
  43. package/lib/commonjs/store/blockPlacement.js +1 -64
  44. package/lib/commonjs/store/blockPlacement.test.js +1 -123
  45. package/lib/commonjs/store/queue.test.js +1 -150
  46. package/lib/commonjs/store/resetConversation.js +1 -77
  47. package/lib/commonjs/store/restorePending.test.js +1 -63
  48. package/lib/commonjs/store/restoredIds.test.js +1 -47
  49. package/lib/commonjs/store/suggestions.js +1 -54
  50. package/lib/commonjs/store/suggestions.test.js +1 -58
  51. package/lib/commonjs/store/systemLine.test.js +1 -77
  52. package/lib/commonjs/store/ticketPrompt.js +1 -17
  53. package/lib/commonjs/store/traceText.js +1 -81
  54. package/lib/commonjs/store/traceText.test.js +1 -112
  55. package/lib/commonjs/store/transcriptPersistence.js +1 -297
  56. package/lib/commonjs/store/transcriptPersistence.test.js +1 -333
  57. package/lib/commonjs/store/turnRendering.test.js +1 -151
  58. package/lib/commonjs/store/useAskBuoy.js +1 -651
  59. package/lib/commonjs/store/useAskBuoySettings.js +1 -14
  60. package/lib/commonjs/sync/askBuoySyncAdapter.js +1 -153
  61. package/lib/commonjs/sync/askBuoySyncAdapter.test.js +1 -141
  62. package/lib/commonjs/sync/wire.js +1 -58
  63. package/lib/commonjs/types.js +1 -6
  64. package/lib/module/blocks/AskBlocks.js +1 -331
  65. package/lib/module/blocks/BlockRenderer.js +1 -257
  66. package/lib/module/blocks/ChromePrototypes.js +1 -503
  67. package/lib/module/blocks/DataBlocks.js +1 -769
  68. package/lib/module/blocks/ExtraBlocks.js +1 -1835
  69. package/lib/module/blocks/MediaBlocks.js +1 -153
  70. package/lib/module/blocks/ReceiptBlocks.js +2 -580
  71. package/lib/module/blocks/blockText.js +1 -55
  72. package/lib/module/blocks/blockText.test.js +1 -53
  73. package/lib/module/blocks/context.js +1 -35
  74. package/lib/module/blocks/icons.js +1 -91
  75. package/lib/module/blocks/index.js +1 -8
  76. package/lib/module/blocks/listRow.test.js +1 -56
  77. package/lib/module/blocks/pageState.js +1 -30
  78. package/lib/module/blocks/pageState.test.js +1 -56
  79. package/lib/module/blocks/primitives.js +1 -445
  80. package/lib/module/blocks/primitivesIndex.js +1 -5
  81. package/lib/module/blocks/ruleStates.js +1 -35
  82. package/lib/module/components/ApprovalCard.js +1 -292
  83. package/lib/module/components/AskBuoyHeader.js +1 -193
  84. package/lib/module/components/AskBuoyIcon.js +1 -8
  85. package/lib/module/components/AskBuoyModal.js +2 -477
  86. package/lib/module/components/AskBuoySettings.js +1 -176
  87. package/lib/module/components/ChangesBar.js +1 -206
  88. package/lib/module/components/Composer.js +1 -250
  89. package/lib/module/components/EmptyState.js +1 -156
  90. package/lib/module/components/KeyboardPad.js +1 -75
  91. package/lib/module/components/Markdown.js +1 -305
  92. package/lib/module/components/MessageList.js +1 -964
  93. package/lib/module/components/QueuedMessages.js +1 -140
  94. package/lib/module/components/ThinkingStrip.js +1 -218
  95. package/lib/module/components/TypingDots.js +1 -58
  96. package/lib/module/components/markdownParse.js +1 -125
  97. package/lib/module/components/markdownParse.test.js +1 -98
  98. package/lib/module/components/useCopyAction.js +1 -46
  99. package/lib/module/index.js +1 -34
  100. package/lib/module/preset.js +1 -74
  101. package/lib/module/store/activityGroups.js +1 -103
  102. package/lib/module/store/activityGroups.test.js +1 -77
  103. package/lib/module/store/askBuoySettings.js +1 -67
  104. package/lib/module/store/askBuoyStore.js +2 -582
  105. package/lib/module/store/blockPlacement.js +1 -59
  106. package/lib/module/store/blockPlacement.test.js +1 -122
  107. package/lib/module/store/queue.test.js +1 -149
  108. package/lib/module/store/resetConversation.js +1 -72
  109. package/lib/module/store/restorePending.test.js +1 -62
  110. package/lib/module/store/restoredIds.test.js +1 -46
  111. package/lib/module/store/suggestions.js +1 -49
  112. package/lib/module/store/suggestions.test.js +1 -57
  113. package/lib/module/store/systemLine.test.js +1 -76
  114. package/lib/module/store/ticketPrompt.js +1 -13
  115. package/lib/module/store/traceText.js +1 -75
  116. package/lib/module/store/traceText.test.js +1 -111
  117. package/lib/module/store/transcriptPersistence.js +1 -287
  118. package/lib/module/store/transcriptPersistence.test.js +1 -332
  119. package/lib/module/store/turnRendering.test.js +1 -150
  120. package/lib/module/store/useAskBuoy.js +1 -646
  121. package/lib/module/store/useAskBuoySettings.js +1 -9
  122. package/lib/module/sync/askBuoySyncAdapter.js +1 -148
  123. package/lib/module/sync/askBuoySyncAdapter.test.js +1 -140
  124. package/lib/module/sync/wire.js +1 -47
  125. package/lib/module/types.js +1 -4
  126. package/lib/web/index.mjs +11 -12
  127. package/package.json +8 -8
  128. package/lib/commonjs/blocks/AskBlocks.js.map +0 -1
  129. package/lib/commonjs/blocks/BlockRenderer.js.map +0 -1
  130. package/lib/commonjs/blocks/ChromePrototypes.js.map +0 -1
  131. package/lib/commonjs/blocks/DataBlocks.js.map +0 -1
  132. package/lib/commonjs/blocks/ExtraBlocks.js.map +0 -1
  133. package/lib/commonjs/blocks/MediaBlocks.js.map +0 -1
  134. package/lib/commonjs/blocks/ReceiptBlocks.js.map +0 -1
  135. package/lib/commonjs/blocks/blockText.js.map +0 -1
  136. package/lib/commonjs/blocks/blockText.test.js.map +0 -1
  137. package/lib/commonjs/blocks/context.js.map +0 -1
  138. package/lib/commonjs/blocks/icons.js.map +0 -1
  139. package/lib/commonjs/blocks/index.js.map +0 -1
  140. package/lib/commonjs/blocks/listRow.test.js.map +0 -1
  141. package/lib/commonjs/blocks/pageState.js.map +0 -1
  142. package/lib/commonjs/blocks/pageState.test.js.map +0 -1
  143. package/lib/commonjs/blocks/primitives.js.map +0 -1
  144. package/lib/commonjs/blocks/primitivesIndex.js.map +0 -1
  145. package/lib/commonjs/blocks/ruleStates.js.map +0 -1
  146. package/lib/commonjs/components/ApprovalCard.js.map +0 -1
  147. package/lib/commonjs/components/AskBuoyHeader.js.map +0 -1
  148. package/lib/commonjs/components/AskBuoyIcon.js.map +0 -1
  149. package/lib/commonjs/components/AskBuoyModal.js.map +0 -1
  150. package/lib/commonjs/components/AskBuoySettings.js.map +0 -1
  151. package/lib/commonjs/components/ChangesBar.js.map +0 -1
  152. package/lib/commonjs/components/Composer.js.map +0 -1
  153. package/lib/commonjs/components/EmptyState.js.map +0 -1
  154. package/lib/commonjs/components/KeyboardPad.js.map +0 -1
  155. package/lib/commonjs/components/Markdown.js.map +0 -1
  156. package/lib/commonjs/components/MessageList.js.map +0 -1
  157. package/lib/commonjs/components/QueuedMessages.js.map +0 -1
  158. package/lib/commonjs/components/ThinkingStrip.js.map +0 -1
  159. package/lib/commonjs/components/TypingDots.js.map +0 -1
  160. package/lib/commonjs/components/markdownParse.js.map +0 -1
  161. package/lib/commonjs/components/markdownParse.test.js.map +0 -1
  162. package/lib/commonjs/components/useCopyAction.js.map +0 -1
  163. package/lib/commonjs/index.js.map +0 -1
  164. package/lib/commonjs/preset.js.map +0 -1
  165. package/lib/commonjs/store/activityGroups.js.map +0 -1
  166. package/lib/commonjs/store/activityGroups.test.js.map +0 -1
  167. package/lib/commonjs/store/askBuoySettings.js.map +0 -1
  168. package/lib/commonjs/store/askBuoyStore.js.map +0 -1
  169. package/lib/commonjs/store/blockPlacement.js.map +0 -1
  170. package/lib/commonjs/store/blockPlacement.test.js.map +0 -1
  171. package/lib/commonjs/store/queue.test.js.map +0 -1
  172. package/lib/commonjs/store/resetConversation.js.map +0 -1
  173. package/lib/commonjs/store/restorePending.test.js.map +0 -1
  174. package/lib/commonjs/store/restoredIds.test.js.map +0 -1
  175. package/lib/commonjs/store/suggestions.js.map +0 -1
  176. package/lib/commonjs/store/suggestions.test.js.map +0 -1
  177. package/lib/commonjs/store/systemLine.test.js.map +0 -1
  178. package/lib/commonjs/store/ticketPrompt.js.map +0 -1
  179. package/lib/commonjs/store/traceText.js.map +0 -1
  180. package/lib/commonjs/store/traceText.test.js.map +0 -1
  181. package/lib/commonjs/store/transcriptPersistence.js.map +0 -1
  182. package/lib/commonjs/store/transcriptPersistence.test.js.map +0 -1
  183. package/lib/commonjs/store/turnRendering.test.js.map +0 -1
  184. package/lib/commonjs/store/useAskBuoy.js.map +0 -1
  185. package/lib/commonjs/store/useAskBuoySettings.js.map +0 -1
  186. package/lib/commonjs/sync/askBuoySyncAdapter.js.map +0 -1
  187. package/lib/commonjs/sync/askBuoySyncAdapter.test.js.map +0 -1
  188. package/lib/commonjs/sync/wire.js.map +0 -1
  189. package/lib/commonjs/types.js.map +0 -1
  190. package/lib/module/blocks/AskBlocks.js.map +0 -1
  191. package/lib/module/blocks/BlockRenderer.js.map +0 -1
  192. package/lib/module/blocks/ChromePrototypes.js.map +0 -1
  193. package/lib/module/blocks/DataBlocks.js.map +0 -1
  194. package/lib/module/blocks/ExtraBlocks.js.map +0 -1
  195. package/lib/module/blocks/MediaBlocks.js.map +0 -1
  196. package/lib/module/blocks/ReceiptBlocks.js.map +0 -1
  197. package/lib/module/blocks/blockText.js.map +0 -1
  198. package/lib/module/blocks/blockText.test.js.map +0 -1
  199. package/lib/module/blocks/context.js.map +0 -1
  200. package/lib/module/blocks/icons.js.map +0 -1
  201. package/lib/module/blocks/index.js.map +0 -1
  202. package/lib/module/blocks/listRow.test.js.map +0 -1
  203. package/lib/module/blocks/pageState.js.map +0 -1
  204. package/lib/module/blocks/pageState.test.js.map +0 -1
  205. package/lib/module/blocks/primitives.js.map +0 -1
  206. package/lib/module/blocks/primitivesIndex.js.map +0 -1
  207. package/lib/module/blocks/ruleStates.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/blocks/ruleStates.d.ts.map +0 -1
  270. package/lib/typescript/components/ApprovalCard.d.ts.map +0 -1
  271. package/lib/typescript/components/AskBuoyHeader.d.ts.map +0 -1
  272. package/lib/typescript/components/AskBuoyIcon.d.ts.map +0 -1
  273. package/lib/typescript/components/AskBuoyModal.d.ts.map +0 -1
  274. package/lib/typescript/components/AskBuoySettings.d.ts.map +0 -1
  275. package/lib/typescript/components/ChangesBar.d.ts.map +0 -1
  276. package/lib/typescript/components/Composer.d.ts.map +0 -1
  277. package/lib/typescript/components/EmptyState.d.ts.map +0 -1
  278. package/lib/typescript/components/KeyboardPad.d.ts.map +0 -1
  279. package/lib/typescript/components/Markdown.d.ts.map +0 -1
  280. package/lib/typescript/components/MessageList.d.ts.map +0 -1
  281. package/lib/typescript/components/QueuedMessages.d.ts.map +0 -1
  282. package/lib/typescript/components/ThinkingStrip.d.ts.map +0 -1
  283. package/lib/typescript/components/TypingDots.d.ts.map +0 -1
  284. package/lib/typescript/components/markdownParse.d.ts.map +0 -1
  285. package/lib/typescript/components/markdownParse.test.d.ts.map +0 -1
  286. package/lib/typescript/components/useCopyAction.d.ts.map +0 -1
  287. package/lib/typescript/index.d.ts.map +0 -1
  288. package/lib/typescript/preset.d.ts.map +0 -1
  289. package/lib/typescript/store/activityGroups.d.ts.map +0 -1
  290. package/lib/typescript/store/activityGroups.test.d.ts.map +0 -1
  291. package/lib/typescript/store/askBuoySettings.d.ts.map +0 -1
  292. package/lib/typescript/store/askBuoyStore.d.ts.map +0 -1
  293. package/lib/typescript/store/blockPlacement.d.ts.map +0 -1
  294. package/lib/typescript/store/blockPlacement.test.d.ts.map +0 -1
  295. package/lib/typescript/store/queue.test.d.ts.map +0 -1
  296. package/lib/typescript/store/resetConversation.d.ts.map +0 -1
  297. package/lib/typescript/store/restorePending.test.d.ts.map +0 -1
  298. package/lib/typescript/store/restoredIds.test.d.ts.map +0 -1
  299. package/lib/typescript/store/suggestions.d.ts.map +0 -1
  300. package/lib/typescript/store/suggestions.test.d.ts.map +0 -1
  301. package/lib/typescript/store/systemLine.test.d.ts.map +0 -1
  302. package/lib/typescript/store/ticketPrompt.d.ts.map +0 -1
  303. package/lib/typescript/store/traceText.d.ts.map +0 -1
  304. package/lib/typescript/store/traceText.test.d.ts.map +0 -1
  305. package/lib/typescript/store/transcriptPersistence.d.ts.map +0 -1
  306. package/lib/typescript/store/transcriptPersistence.test.d.ts.map +0 -1
  307. package/lib/typescript/store/turnRendering.test.d.ts.map +0 -1
  308. package/lib/typescript/store/useAskBuoy.d.ts.map +0 -1
  309. package/lib/typescript/store/useAskBuoySettings.d.ts.map +0 -1
  310. package/lib/typescript/sync/askBuoySyncAdapter.d.ts.map +0 -1
  311. package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts.map +0 -1
  312. package/lib/typescript/sync/wire.d.ts.map +0 -1
  313. 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 as p,useRef as s}from"react";import{Animated as n,Easing as y,Keyboard as i,Platform as b,StyleSheet as g}from"react-native";import{jsx as h}from"react/jsx-runtime";export function KeyboardPad({children:d}){const o=s(null);const t=s(new n.Value(0)).current;p(()=>{if(b.OS!=="ios")return;const a=(e,r)=>{n.timing(t,{toValue:e,duration:r.duration||250,easing:y.bezier(.17,.59,.4,.77),useNativeDriver:false}).start()};const c=e=>{const r=o.current;if(!r)return;r.measureInWindow((v,f,C,m)=>{const x=f+m-e.endCoordinates.screenY;a(Math.max(0,x),e)})};const l=e=>a(0,e);const u=[i.addListener("keyboardWillChangeFrame",c),i.addListener("keyboardWillHide",l)];return()=>u.forEach(e=>e.remove())},[t]);return h(n.View,{ref:o,style:[w.flex,{paddingBottom:t}],children:d})}const w=g.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 as m}from"react";import{Pressable as w,ScrollView as y,StyleSheet as x,Text as c,View as p}from"react-native";import{night as t}from"@buoy-gg/shared-ui";import{parseBlocks as S,TABLE_PREVIEW_COLS as W,TABLE_PREVIEW_ROWS as k,tableTruncation as T}from"./markdownParse";import{jsx as r,jsxs as g}from"react/jsx-runtime";export function renderInline(d,i){const l=d.replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1");const o=[];const s=/(\*\*[^*]+\*\*|`[^`]+`|\*[^*\s][^*]*\*|_[^_\s][^_]*_)/g;let a=0;let h;let f=0;while(h=s.exec(l)){if(h.index>a)o.push(l.slice(a,h.index));const n=h[0];if(n.startsWith("**")){o.push(r(c,{style:[i,e.bold],children:n.slice(2,-2)},f++))}else if(n.startsWith("`")){o.push(r(c,{style:[i,e.code],children:n.slice(1,-1)},f++))}else{o.push(r(c,{style:[i,e.italic],children:n.slice(1,-1)},f++))}a=h.index+n.length}if(a<l.length)o.push(l.slice(a));return o}const C=d=>d.replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1");function z({header:d,rows:i}){const[l,o]=m(false);const s=T(d,i);const a=l?d:d.slice(0,W);const h=l?i:i.slice(0,k);const f=g(p,{style:l&&e.tableWide,children:[r(p,{style:e.tableHead,children:a.map((n,u)=>r(c,{style:[e.th,u===0&&e.firstCol,l&&e.colFixed],numberOfLines:1,children:n.replace(/\*\*/g,"")},u))}),h.map((n,u)=>r(p,{style:[e.tr,u>0&&e.trDivider],children:a.map((_,b)=>r(c,{style:[e.td,b===0&&e.firstCol,b===0&&e.tdFirst,l&&e.colFixed],numberOfLines:l?3:2,children:renderInline(C(n[b]??""),e.td)},b))},u))]});return g(p,{style:e.table,testID:"buoy-ask-buoy-md-table",children:[l?r(y,{style:e.tableScrollV,nestedScrollEnabled:true,children:r(y,{horizontal:true,showsHorizontalScrollIndicator:true,children:f})}):f,s?g(w,{testID:"buoy-ask-buoy-md-table-toggle",accessibilityRole:"button",accessibilityLabel:l?"Show fewer rows":"Show all rows and columns",onPress:()=>o(n=>!n),style:({pressed:n})=>[e.tfoot,n&&e.pressed],children:[r(c,{style:e.tfootText,children:l?`All ${i.length} rows \xB7 ${d.length} columns`:s}),r(c,{style:e.tfootAction,children:l?"Show fewer":"Show all"})]}):null]})}export function Markdown({text:d,style:i}){const l=S(d);return r(p,{style:e.wrap,children:l.map((o,s)=>{if(o.kind==="table")return r(z,{header:o.header,rows:o.rows},s);if(o.kind==="code"){return r(y,{horizontal:true,style:e.codeBlock,contentContainerStyle:e.codeBlockContent,testID:"buoy-ask-buoy-md-code",children:r(c,{style:e.codeText,selectable:true,children:o.text})},s)}if(o.kind==="li"){return g(p,{style:[e.li,{paddingLeft:4+o.depth*14}],children:[r(c,{style:[i,e.marker],children:o.marker}),r(c,{style:[i,e.liText],selectable:true,children:renderInline(o.text,i)})]},s)}return r(c,{style:[i,o.kind==="h"&&e.bold],selectable:true,children:renderInline(o.text,i)},s)})})}const e=x.create({wrap:{gap:8},bold:{fontWeight:"600"},italic:{fontStyle:"italic"},code:{fontFamily:"Menlo",fontSize:13,color:t.color.accent,backgroundColor:t.color.fill},codeBlock:{borderRadius:t.radius.row,borderWidth:x.hairlineWidth,borderColor:t.color.border,backgroundColor:t.color.surface},codeBlockContent:{paddingHorizontal:12,paddingVertical:10},codeText:{fontFamily:"Menlo",fontSize:12,lineHeight:18,color:t.color.text},li:{flexDirection:"row",gap:8},table:{borderRadius:t.radius.row,borderWidth:x.hairlineWidth,borderColor:t.color.border,backgroundColor:t.color.surface,overflow:"hidden"},tableWide:{minWidth:"100%"},tableScrollV:{maxHeight:320},tableHead:{flexDirection:"row",paddingHorizontal:10,paddingVertical:6,gap:8,backgroundColor:t.color.fill},th:{flex:1,color:t.color.textTertiary,fontSize:t.font.micro,fontWeight:"700",letterSpacing:.6,textTransform:"uppercase"},tr:{flexDirection:"row",paddingHorizontal:10,paddingVertical:7,gap:8},trDivider:{borderTopWidth:x.hairlineWidth,borderTopColor:t.color.separator},td:{flex:1,color:t.color.textSecondary,fontSize:t.font.caption,lineHeight:17},tdFirst:{color:t.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:x.hairlineWidth,borderTopColor:t.color.border},tfootText:{color:t.color.textSecondary,fontSize:t.font.micro},tfootAction:{color:t.color.accent,fontSize:t.font.micro,fontWeight:"600"},pressed:{opacity:.7},marker:{color:t.color.textSecondary,minWidth:14,textAlign:"right"},liText:{flex:1}});