@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,80 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.KeyboardPad = KeyboardPad;
7
- var _react = require("react");
8
- var _reactNative = require("react-native");
9
- var _jsxRuntime = require("react/jsx-runtime");
10
- /**
11
- * Keeps the composer above the iOS keyboard.
12
- *
13
- * Why not `KeyboardAvoidingView`: it takes its frame from `onLayout`, which
14
- * is RELATIVE TO ITS PARENT, and compares that to the keyboard's SCREEN
15
- * position. That only agrees when the view starts at the window's origin.
16
- * Ask Buoy is a JsModal — an absolutely positioned sheet anchored to the
17
- * bottom of the app tree — so the view's local bottom (a few hundred points
18
- * into the sheet) sits well above the keyboard's screen Y, the overlap comes
19
- * out as zero, and nothing moves. The keyboard drew over the composer with
20
- * a "working" `KeyboardAvoidingView` around it.
21
- *
22
- * This measures the SAME thing in the SAME coordinate space: the wrapper's
23
- * bottom edge in window coordinates via `measureInWindow`, against the
24
- * keyboard's `endCoordinates.screenY`. The difference is the overlap, and it
25
- * becomes bottom padding animated over the keyboard's own duration so the
26
- * composer rides the keyboard instead of jumping after it.
27
- *
28
- * The wrapper is `flex: 1` inside a fixed-height sheet body, so its OUTER
29
- * bounds never change when its padding does — re-measuring on a later
30
- * frame-change event (a predictive-text bar appearing, an emoji keyboard)
31
- * gives the same bottom edge.
32
- *
33
- * iOS only. Android's window resizes under the keyboard
34
- * (`softwareKeyboardLayoutMode: "resize"`, both the Expo and the RN CLI
35
- * template default) and a bottom-anchored sheet rides up for free; padding
36
- * there would lift it twice. Web has no keyboard events and no keyboard.
37
- */
38
-
39
- function KeyboardPad({
40
- children
41
- }) {
42
- const ref = (0, _react.useRef)(null);
43
- const pad = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
44
- (0, _react.useEffect)(() => {
45
- if (_reactNative.Platform.OS !== "ios") return;
46
- const animateTo = (value, event) => {
47
- _reactNative.Animated.timing(pad, {
48
- toValue: value,
49
- duration: event.duration || 250,
50
- // iOS's keyboard curve; `keyboard` is the matching Easing preset.
51
- easing: _reactNative.Easing.bezier(0.17, 0.59, 0.4, 0.77),
52
- useNativeDriver: false
53
- }).start();
54
- };
55
- const onChange = event => {
56
- const node = ref.current;
57
- if (!node) return;
58
- node.measureInWindow((_x, y, _w, h) => {
59
- const overlap = y + h - event.endCoordinates.screenY;
60
- animateTo(Math.max(0, overlap), event);
61
- });
62
- };
63
- const onHide = event => animateTo(0, event);
64
- const subs = [_reactNative.Keyboard.addListener("keyboardWillChangeFrame", onChange), _reactNative.Keyboard.addListener("keyboardWillHide", onHide)];
65
- return () => subs.forEach(s => s.remove());
66
- }, [pad]);
67
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
68
- ref: ref,
69
- style: [styles.flex, {
70
- paddingBottom: pad
71
- }],
72
- children: children
73
- });
74
- }
75
- const styles = _reactNative.StyleSheet.create({
76
- flex: {
77
- flex: 1
78
- }
79
- });
80
- //# sourceMappingURL=KeyboardPad.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KeyboardPad=KeyboardPad;var _react=require("react"),_reactNative=require("react-native"),_jsxRuntime=require("react/jsx-runtime");function KeyboardPad({children:e}){const t=(0,_react.useRef)(null),r=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;return(0,_react.useEffect)(()=>{if("ios"!==_reactNative.Platform.OS)return;const e=(e,t)=>{_reactNative.Animated.timing(r,{toValue:e,duration:t.duration||250,easing:_reactNative.Easing.bezier(.17,.59,.4,.77),useNativeDriver:!1}).start()},a=[_reactNative.Keyboard.addListener("keyboardWillChangeFrame",r=>{const a=t.current;a&&a.measureInWindow((t,a,i,n)=>{const c=a+n-r.endCoordinates.screenY;e(Math.max(0,c),r)})}),_reactNative.Keyboard.addListener("keyboardWillHide",t=>e(0,t))];return()=>a.forEach(e=>e.remove())},[r]),(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{ref:t,style:[styles.flex,{paddingBottom:r}],children:e})}const styles=_reactNative.StyleSheet.create({flex:{flex:1}});
@@ -1,310 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Markdown = Markdown;
7
- exports.renderInline = renderInline;
8
- var _react = require("react");
9
- var _reactNative = require("react-native");
10
- var _sharedUi = require("@buoy-gg/shared-ui");
11
- var _markdownParse = require("./markdownParse");
12
- var _jsxRuntime = require("react/jsx-runtime");
13
- /**
14
- * Just enough Markdown for a chat answer.
15
- *
16
- * Models write `**bold**`, bullet lists and `code` whether or not the prompt
17
- * asks for prose, and the asterisks rendered raw made every answer look like
18
- * a broken template. This handles the subset a chat actually receives —
19
- * paragraphs, `-`/`*`/`1.` lists, `#` headings (rendered bold, not huge),
20
- * pipe tables, fenced code, bold, italics and inline code — with no
21
- * dependency and no HTML. Anything it does not understand falls through as
22
- * plain text, never as a blank. The parser lives in markdownParse.ts so it
23
- * can be tested without React Native.
24
- */
25
-
26
- /**
27
- * `**bold**`, `*italic*` / `_italic_`, `` `code` `` → styled spans. Links and
28
- * images collapse to their text: a phone chat has nowhere to open a URL, and
29
- * `![Snorlax](https://raw.githubusercontent.com/…/143.png)` printed raw is
30
- * three lines of noise for one word of meaning.
31
- */
32
- function renderInline(source, base) {
33
- const text = source.replace(/!?\[([^\]]*)\]\([^)]*\)/g, "$1");
34
- const out = [];
35
- const re = /(\*\*[^*]+\*\*|`[^`]+`|\*[^*\s][^*]*\*|_[^_\s][^_]*_)/g;
36
- let last = 0;
37
- let m;
38
- let i = 0;
39
- while (m = re.exec(text)) {
40
- if (m.index > last) out.push(text.slice(last, m.index));
41
- const tok = m[0];
42
- if (tok.startsWith("**")) {
43
- out.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
44
- style: [base, styles.bold],
45
- children: tok.slice(2, -2)
46
- }, i++));
47
- } else if (tok.startsWith("`")) {
48
- out.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
49
- style: [base, styles.code],
50
- children: tok.slice(1, -1)
51
- }, i++));
52
- } else {
53
- out.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
54
- style: [base, styles.italic],
55
- children: tok.slice(1, -1)
56
- }, i++));
57
- }
58
- last = m.index + tok.length;
59
- }
60
- if (last < text.length) out.push(text.slice(last));
61
- return out;
62
- }
63
- const stripLinks = s => s.replace(/!?\[([^\]]*)\]\([^)]*\)/g, "$1");
64
-
65
- /**
66
- * A pipe table, cut to a preview that SAYS it is cut.
67
- *
68
- * It used to slice to four columns and twelve rows in silence. A model asked
69
- * for "all 30 bag lines" sent 30; the tester read 12 and filed "the bag only
70
- * has 12 items". Evidence that is cut must say so — a footer names what is
71
- * missing and Show all expands to every row and column inside a capped,
72
- * horizontally scrollable box, the same shape the approval card uses for its
73
- * long description.
74
- */
75
- function MarkdownTable({
76
- header,
77
- rows
78
- }) {
79
- const [expanded, setExpanded] = (0, _react.useState)(false);
80
- const truncation = (0, _markdownParse.tableTruncation)(header, rows);
81
- const cols = expanded ? header : header.slice(0, _markdownParse.TABLE_PREVIEW_COLS);
82
- const shownRows = expanded ? rows : rows.slice(0, _markdownParse.TABLE_PREVIEW_ROWS);
83
- const body = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
84
- style: expanded && styles.tableWide,
85
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
86
- style: styles.tableHead,
87
- children: cols.map((c, k) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
88
- style: [styles.th, k === 0 && styles.firstCol, expanded && styles.colFixed],
89
- numberOfLines: 1,
90
- children: c.replace(/\*\*/g, "")
91
- }, k))
92
- }), shownRows.map((r, ri) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
93
- style: [styles.tr, ri > 0 && styles.trDivider],
94
- children: cols.map((_, k) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
95
- style: [styles.td, k === 0 && styles.firstCol, k === 0 && styles.tdFirst, expanded && styles.colFixed],
96
- numberOfLines: expanded ? 3 : 2,
97
- children: renderInline(stripLinks(r[k] ?? ""), styles.td)
98
- }, k))
99
- }, ri))]
100
- });
101
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
102
- style: styles.table,
103
- testID: "buoy-ask-buoy-md-table",
104
- children: [expanded ?
105
- /*#__PURE__*/
106
- // Capped both ways: every column gets a real width and scrolls
107
- // sideways; the rows scroll inside the card rather than taking the
108
- // whole transcript with them.
109
- (0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
110
- style: styles.tableScrollV,
111
- nestedScrollEnabled: true,
112
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
113
- horizontal: true,
114
- showsHorizontalScrollIndicator: true,
115
- children: body
116
- })
117
- }) : body, truncation ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
118
- testID: "buoy-ask-buoy-md-table-toggle",
119
- accessibilityRole: "button",
120
- accessibilityLabel: expanded ? "Show fewer rows" : "Show all rows and columns",
121
- onPress: () => setExpanded(v => !v),
122
- style: ({
123
- pressed
124
- }) => [styles.tfoot, pressed && styles.pressed],
125
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
126
- style: styles.tfootText,
127
- children: expanded ? `All ${rows.length} rows · ${header.length} columns` : truncation
128
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
129
- style: styles.tfootAction,
130
- children: expanded ? "Show fewer" : "Show all"
131
- })]
132
- }) : null]
133
- });
134
- }
135
- function Markdown({
136
- text,
137
- style
138
- }) {
139
- const blocks = (0, _markdownParse.parseBlocks)(text);
140
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
141
- style: styles.wrap,
142
- children: blocks.map((b, i) => {
143
- if (b.kind === "table") return /*#__PURE__*/(0, _jsxRuntime.jsx)(MarkdownTable, {
144
- header: b.header,
145
- rows: b.rows
146
- }, i);
147
- if (b.kind === "code") {
148
- return (
149
- /*#__PURE__*/
150
- // Newlines and indentation kept; long lines scroll sideways rather
151
- // than wrapping a JSON object into soup.
152
- (0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
153
- horizontal: true,
154
- style: styles.codeBlock,
155
- contentContainerStyle: styles.codeBlockContent,
156
- testID: "buoy-ask-buoy-md-code",
157
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
158
- style: styles.codeText,
159
- selectable: true,
160
- children: b.text
161
- })
162
- }, i)
163
- );
164
- }
165
- if (b.kind === "li") {
166
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
167
- style: [styles.li, {
168
- paddingLeft: 4 + b.depth * 14
169
- }],
170
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
171
- style: [style, styles.marker],
172
- children: b.marker
173
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
174
- style: [style, styles.liText],
175
- selectable: true,
176
- children: renderInline(b.text, style)
177
- })]
178
- }, i);
179
- }
180
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
181
- style: [style, b.kind === "h" && styles.bold],
182
- selectable: true,
183
- children: renderInline(b.text, style)
184
- }, i);
185
- })
186
- });
187
- }
188
- const styles = _reactNative.StyleSheet.create({
189
- wrap: {
190
- gap: 8
191
- },
192
- bold: {
193
- fontWeight: "600"
194
- },
195
- italic: {
196
- fontStyle: "italic"
197
- },
198
- code: {
199
- fontFamily: "Menlo",
200
- fontSize: 13,
201
- color: _sharedUi.night.color.accent,
202
- backgroundColor: _sharedUi.night.color.fill
203
- },
204
- codeBlock: {
205
- borderRadius: _sharedUi.night.radius.row,
206
- borderWidth: _reactNative.StyleSheet.hairlineWidth,
207
- borderColor: _sharedUi.night.color.border,
208
- backgroundColor: _sharedUi.night.color.surface
209
- },
210
- codeBlockContent: {
211
- paddingHorizontal: 12,
212
- paddingVertical: 10
213
- },
214
- codeText: {
215
- fontFamily: "Menlo",
216
- fontSize: 12,
217
- lineHeight: 18,
218
- color: _sharedUi.night.color.text
219
- },
220
- li: {
221
- flexDirection: "row",
222
- gap: 8
223
- },
224
- table: {
225
- borderRadius: _sharedUi.night.radius.row,
226
- borderWidth: _reactNative.StyleSheet.hairlineWidth,
227
- borderColor: _sharedUi.night.color.border,
228
- backgroundColor: _sharedUi.night.color.surface,
229
- overflow: "hidden"
230
- },
231
- tableWide: {
232
- minWidth: "100%"
233
- },
234
- tableScrollV: {
235
- maxHeight: 320
236
- },
237
- tableHead: {
238
- flexDirection: "row",
239
- paddingHorizontal: 10,
240
- paddingVertical: 6,
241
- gap: 8,
242
- backgroundColor: _sharedUi.night.color.fill
243
- },
244
- th: {
245
- flex: 1,
246
- color: _sharedUi.night.color.textTertiary,
247
- fontSize: _sharedUi.night.font.micro,
248
- fontWeight: "700",
249
- letterSpacing: 0.6,
250
- textTransform: "uppercase"
251
- },
252
- tr: {
253
- flexDirection: "row",
254
- paddingHorizontal: 10,
255
- paddingVertical: 7,
256
- gap: 8
257
- },
258
- trDivider: {
259
- borderTopWidth: _reactNative.StyleSheet.hairlineWidth,
260
- borderTopColor: _sharedUi.night.color.separator
261
- },
262
- td: {
263
- flex: 1,
264
- color: _sharedUi.night.color.textSecondary,
265
- fontSize: _sharedUi.night.font.caption,
266
- lineHeight: 17
267
- },
268
- tdFirst: {
269
- color: _sharedUi.night.color.text,
270
- fontWeight: "500"
271
- },
272
- firstCol: {
273
- flex: 1.3
274
- },
275
- // Expanded: a real width per column so six of them don't share one row.
276
- colFixed: {
277
- flex: 0,
278
- width: 110
279
- },
280
- tfoot: {
281
- flexDirection: "row",
282
- justifyContent: "space-between",
283
- alignItems: "center",
284
- paddingHorizontal: 10,
285
- paddingVertical: 8,
286
- borderTopWidth: _reactNative.StyleSheet.hairlineWidth,
287
- borderTopColor: _sharedUi.night.color.border
288
- },
289
- tfootText: {
290
- color: _sharedUi.night.color.textSecondary,
291
- fontSize: _sharedUi.night.font.micro
292
- },
293
- tfootAction: {
294
- color: _sharedUi.night.color.accent,
295
- fontSize: _sharedUi.night.font.micro,
296
- fontWeight: "600"
297
- },
298
- pressed: {
299
- opacity: 0.7
300
- },
301
- marker: {
302
- color: _sharedUi.night.color.textSecondary,
303
- minWidth: 14,
304
- textAlign: "right"
305
- },
306
- liText: {
307
- flex: 1
308
- }
309
- });
310
- //# sourceMappingURL=Markdown.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Markdown=Markdown,exports.renderInline=renderInline;var _react=require("react"),_reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_markdownParse=require("./markdownParse"),_jsxRuntime=require("react/jsx-runtime");function renderInline(e,t){const r=e.replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1"),i=[],s=/(\*\*[^*]+\*\*|`[^`]+`|\*[^*\s][^*]*\*|_[^_\s][^_]*_)/g;let l,o=0,n=0;for(;l=s.exec(r);){l.index>o&&i.push(r.slice(o,l.index));const e=l[0];e.startsWith("**")?i.push((0,_jsxRuntime.jsx)(_reactNative.Text,{style:[t,styles.bold],children:e.slice(2,-2)},n++)):e.startsWith("`")?i.push((0,_jsxRuntime.jsx)(_reactNative.Text,{style:[t,styles.code],children:e.slice(1,-1)},n++)):i.push((0,_jsxRuntime.jsx)(_reactNative.Text,{style:[t,styles.italic],children:e.slice(1,-1)},n++)),o=l.index+e.length}return o<r.length&&i.push(r.slice(o)),i}const stripLinks=e=>e.replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1");function MarkdownTable({header:e,rows:t}){const[r,i]=(0,_react.useState)(!1),s=(0,_markdownParse.tableTruncation)(e,t),l=r?e:e.slice(0,_markdownParse.TABLE_PREVIEW_COLS),o=r?t:t.slice(0,_markdownParse.TABLE_PREVIEW_ROWS),n=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:r&&styles.tableWide,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tableHead,children:l.map((e,t)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.th,0===t&&styles.firstCol,r&&styles.colFixed],numberOfLines:1,children:e.replace(/\*\*/g,"")},t))}),o.map((e,t)=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.tr,t>0&&styles.trDivider],children:l.map((t,i)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.td,0===i&&styles.firstCol,0===i&&styles.tdFirst,r&&styles.colFixed],numberOfLines:r?3:2,children:renderInline(stripLinks(e[i]??""),styles.td)},i))},t))]});return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.table,testID:"buoy-ask-buoy-md-table",children:[r?(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:styles.tableScrollV,nestedScrollEnabled:!0,children:(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{horizontal:!0,showsHorizontalScrollIndicator:!0,children:n})}):n,s?(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:"buoy-ask-buoy-md-table-toggle",accessibilityRole:"button",accessibilityLabel:r?"Show fewer rows":"Show all rows and columns",onPress:()=>i(e=>!e),style:({pressed:e})=>[styles.tfoot,e&&styles.pressed],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.tfootText,children:r?`All ${t.length} rows · ${e.length} columns`:s}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.tfootAction,children:r?"Show fewer":"Show all"})]}):null]})}function Markdown({text:e,style:t}){const r=(0,_markdownParse.parseBlocks)(e);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.wrap,children:r.map((e,r)=>"table"===e.kind?(0,_jsxRuntime.jsx)(MarkdownTable,{header:e.header,rows:e.rows},r):"code"===e.kind?(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{horizontal:!0,style:styles.codeBlock,contentContainerStyle:styles.codeBlockContent,testID:"buoy-ask-buoy-md-code",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.codeText,selectable:!0,children:e.text})},r):"li"===e.kind?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.li,{paddingLeft:4+14*e.depth}],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[t,styles.marker],children:e.marker}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[t,styles.liText],selectable:!0,children:renderInline(e.text,t)})]},r):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[t,"h"===e.kind&&styles.bold],selectable:!0,children:renderInline(e.text,t)},r))})}const styles=_reactNative.StyleSheet.create({wrap:{gap:8},bold:{fontWeight:"600"},italic:{fontStyle:"italic"},code:{fontFamily:"Menlo",fontSize:13,color:_sharedUi.night.color.accent,backgroundColor:_sharedUi.night.color.fill},codeBlock:{borderRadius:_sharedUi.night.radius.row,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface},codeBlockContent:{paddingHorizontal:12,paddingVertical:10},codeText:{fontFamily:"Menlo",fontSize:12,lineHeight:18,color:_sharedUi.night.color.text},li:{flexDirection:"row",gap:8},table:{borderRadius:_sharedUi.night.radius.row,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface,overflow:"hidden"},tableWide:{minWidth:"100%"},tableScrollV:{maxHeight:320},tableHead:{flexDirection:"row",paddingHorizontal:10,paddingVertical:6,gap:8,backgroundColor:_sharedUi.night.color.fill},th:{flex:1,color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro,fontWeight:"700",letterSpacing:.6,textTransform:"uppercase"},tr:{flexDirection:"row",paddingHorizontal:10,paddingVertical:7,gap:8},trDivider:{borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_sharedUi.night.color.separator},td:{flex:1,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,lineHeight:17},tdFirst:{color:_sharedUi.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:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_sharedUi.night.color.border},tfootText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro},tfootAction:{color:_sharedUi.night.color.accent,fontSize:_sharedUi.night.font.micro,fontWeight:"600"},pressed:{opacity:.7},marker:{color:_sharedUi.night.color.textSecondary,minWidth:14,textAlign:"right"},liText:{flex:1}});