@buoy-gg/ask-buoy 7.0.40 → 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 (314) hide show
  1. package/README.md +13 -94
  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 +2 -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/blocks/ruleStates.js +1 -0
  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 -478
  24. package/lib/commonjs/components/AskBuoySettings.js +1 -181
  25. package/lib/commonjs/components/ChangesBar.js +1 -211
  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 -767
  68. package/lib/module/blocks/ExtraBlocks.js +1 -1833
  69. package/lib/module/blocks/MediaBlocks.js +1 -151
  70. package/lib/module/blocks/ReceiptBlocks.js +2 -574
  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 -0
  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 -473
  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/typescript/blocks/context.d.ts +3 -0
  127. package/lib/typescript/blocks/ruleStates.d.ts +15 -0
  128. package/lib/typescript/components/ChangesBar.d.ts +2 -1
  129. package/lib/typescript/sync/askBuoySyncAdapter.d.ts +2 -2
  130. package/lib/web/index.mjs +15 -0
  131. package/package.json +44 -11
  132. package/lib/commonjs/blocks/AskBlocks.js.map +0 -1
  133. package/lib/commonjs/blocks/BlockRenderer.js.map +0 -1
  134. package/lib/commonjs/blocks/ChromePrototypes.js.map +0 -1
  135. package/lib/commonjs/blocks/DataBlocks.js.map +0 -1
  136. package/lib/commonjs/blocks/ExtraBlocks.js.map +0 -1
  137. package/lib/commonjs/blocks/MediaBlocks.js.map +0 -1
  138. package/lib/commonjs/blocks/ReceiptBlocks.js.map +0 -1
  139. package/lib/commonjs/blocks/blockText.js.map +0 -1
  140. package/lib/commonjs/blocks/blockText.test.js.map +0 -1
  141. package/lib/commonjs/blocks/context.js.map +0 -1
  142. package/lib/commonjs/blocks/icons.js.map +0 -1
  143. package/lib/commonjs/blocks/index.js.map +0 -1
  144. package/lib/commonjs/blocks/listRow.test.js.map +0 -1
  145. package/lib/commonjs/blocks/pageState.js.map +0 -1
  146. package/lib/commonjs/blocks/pageState.test.js.map +0 -1
  147. package/lib/commonjs/blocks/primitives.js.map +0 -1
  148. package/lib/commonjs/blocks/primitivesIndex.js.map +0 -1
  149. package/lib/commonjs/components/ApprovalCard.js.map +0 -1
  150. package/lib/commonjs/components/AskBuoyHeader.js.map +0 -1
  151. package/lib/commonjs/components/AskBuoyIcon.js.map +0 -1
  152. package/lib/commonjs/components/AskBuoyModal.js.map +0 -1
  153. package/lib/commonjs/components/AskBuoySettings.js.map +0 -1
  154. package/lib/commonjs/components/ChangesBar.js.map +0 -1
  155. package/lib/commonjs/components/Composer.js.map +0 -1
  156. package/lib/commonjs/components/EmptyState.js.map +0 -1
  157. package/lib/commonjs/components/KeyboardPad.js.map +0 -1
  158. package/lib/commonjs/components/Markdown.js.map +0 -1
  159. package/lib/commonjs/components/MessageList.js.map +0 -1
  160. package/lib/commonjs/components/QueuedMessages.js.map +0 -1
  161. package/lib/commonjs/components/ThinkingStrip.js.map +0 -1
  162. package/lib/commonjs/components/TypingDots.js.map +0 -1
  163. package/lib/commonjs/components/markdownParse.js.map +0 -1
  164. package/lib/commonjs/components/markdownParse.test.js.map +0 -1
  165. package/lib/commonjs/components/useCopyAction.js.map +0 -1
  166. package/lib/commonjs/index.js.map +0 -1
  167. package/lib/commonjs/preset.js.map +0 -1
  168. package/lib/commonjs/store/activityGroups.js.map +0 -1
  169. package/lib/commonjs/store/activityGroups.test.js.map +0 -1
  170. package/lib/commonjs/store/askBuoySettings.js.map +0 -1
  171. package/lib/commonjs/store/askBuoyStore.js.map +0 -1
  172. package/lib/commonjs/store/blockPlacement.js.map +0 -1
  173. package/lib/commonjs/store/blockPlacement.test.js.map +0 -1
  174. package/lib/commonjs/store/queue.test.js.map +0 -1
  175. package/lib/commonjs/store/resetConversation.js.map +0 -1
  176. package/lib/commonjs/store/restorePending.test.js.map +0 -1
  177. package/lib/commonjs/store/restoredIds.test.js.map +0 -1
  178. package/lib/commonjs/store/suggestions.js.map +0 -1
  179. package/lib/commonjs/store/suggestions.test.js.map +0 -1
  180. package/lib/commonjs/store/systemLine.test.js.map +0 -1
  181. package/lib/commonjs/store/ticketPrompt.js.map +0 -1
  182. package/lib/commonjs/store/traceText.js.map +0 -1
  183. package/lib/commonjs/store/traceText.test.js.map +0 -1
  184. package/lib/commonjs/store/transcriptPersistence.js.map +0 -1
  185. package/lib/commonjs/store/transcriptPersistence.test.js.map +0 -1
  186. package/lib/commonjs/store/turnRendering.test.js.map +0 -1
  187. package/lib/commonjs/store/useAskBuoy.js.map +0 -1
  188. package/lib/commonjs/store/useAskBuoySettings.js.map +0 -1
  189. package/lib/commonjs/sync/askBuoySyncAdapter.js.map +0 -1
  190. package/lib/commonjs/sync/askBuoySyncAdapter.test.js.map +0 -1
  191. package/lib/commonjs/sync/wire.js.map +0 -1
  192. package/lib/commonjs/types.js.map +0 -1
  193. package/lib/module/blocks/AskBlocks.js.map +0 -1
  194. package/lib/module/blocks/BlockRenderer.js.map +0 -1
  195. package/lib/module/blocks/ChromePrototypes.js.map +0 -1
  196. package/lib/module/blocks/DataBlocks.js.map +0 -1
  197. package/lib/module/blocks/ExtraBlocks.js.map +0 -1
  198. package/lib/module/blocks/MediaBlocks.js.map +0 -1
  199. package/lib/module/blocks/ReceiptBlocks.js.map +0 -1
  200. package/lib/module/blocks/blockText.js.map +0 -1
  201. package/lib/module/blocks/blockText.test.js.map +0 -1
  202. package/lib/module/blocks/context.js.map +0 -1
  203. package/lib/module/blocks/icons.js.map +0 -1
  204. package/lib/module/blocks/index.js.map +0 -1
  205. package/lib/module/blocks/listRow.test.js.map +0 -1
  206. package/lib/module/blocks/pageState.js.map +0 -1
  207. package/lib/module/blocks/pageState.test.js.map +0 -1
  208. package/lib/module/blocks/primitives.js.map +0 -1
  209. package/lib/module/blocks/primitivesIndex.js.map +0 -1
  210. package/lib/module/components/ApprovalCard.js.map +0 -1
  211. package/lib/module/components/AskBuoyHeader.js.map +0 -1
  212. package/lib/module/components/AskBuoyIcon.js.map +0 -1
  213. package/lib/module/components/AskBuoyModal.js.map +0 -1
  214. package/lib/module/components/AskBuoySettings.js.map +0 -1
  215. package/lib/module/components/ChangesBar.js.map +0 -1
  216. package/lib/module/components/Composer.js.map +0 -1
  217. package/lib/module/components/EmptyState.js.map +0 -1
  218. package/lib/module/components/KeyboardPad.js.map +0 -1
  219. package/lib/module/components/Markdown.js.map +0 -1
  220. package/lib/module/components/MessageList.js.map +0 -1
  221. package/lib/module/components/QueuedMessages.js.map +0 -1
  222. package/lib/module/components/ThinkingStrip.js.map +0 -1
  223. package/lib/module/components/TypingDots.js.map +0 -1
  224. package/lib/module/components/markdownParse.js.map +0 -1
  225. package/lib/module/components/markdownParse.test.js.map +0 -1
  226. package/lib/module/components/useCopyAction.js.map +0 -1
  227. package/lib/module/index.js.map +0 -1
  228. package/lib/module/preset.js.map +0 -1
  229. package/lib/module/store/activityGroups.js.map +0 -1
  230. package/lib/module/store/activityGroups.test.js.map +0 -1
  231. package/lib/module/store/askBuoySettings.js.map +0 -1
  232. package/lib/module/store/askBuoyStore.js.map +0 -1
  233. package/lib/module/store/blockPlacement.js.map +0 -1
  234. package/lib/module/store/blockPlacement.test.js.map +0 -1
  235. package/lib/module/store/queue.test.js.map +0 -1
  236. package/lib/module/store/resetConversation.js.map +0 -1
  237. package/lib/module/store/restorePending.test.js.map +0 -1
  238. package/lib/module/store/restoredIds.test.js.map +0 -1
  239. package/lib/module/store/suggestions.js.map +0 -1
  240. package/lib/module/store/suggestions.test.js.map +0 -1
  241. package/lib/module/store/systemLine.test.js.map +0 -1
  242. package/lib/module/store/ticketPrompt.js.map +0 -1
  243. package/lib/module/store/traceText.js.map +0 -1
  244. package/lib/module/store/traceText.test.js.map +0 -1
  245. package/lib/module/store/transcriptPersistence.js.map +0 -1
  246. package/lib/module/store/transcriptPersistence.test.js.map +0 -1
  247. package/lib/module/store/turnRendering.test.js.map +0 -1
  248. package/lib/module/store/useAskBuoy.js.map +0 -1
  249. package/lib/module/store/useAskBuoySettings.js.map +0 -1
  250. package/lib/module/sync/askBuoySyncAdapter.js.map +0 -1
  251. package/lib/module/sync/askBuoySyncAdapter.test.js.map +0 -1
  252. package/lib/module/sync/wire.js.map +0 -1
  253. package/lib/module/types.js.map +0 -1
  254. package/lib/typescript/blocks/AskBlocks.d.ts.map +0 -1
  255. package/lib/typescript/blocks/BlockRenderer.d.ts.map +0 -1
  256. package/lib/typescript/blocks/ChromePrototypes.d.ts.map +0 -1
  257. package/lib/typescript/blocks/DataBlocks.d.ts.map +0 -1
  258. package/lib/typescript/blocks/ExtraBlocks.d.ts.map +0 -1
  259. package/lib/typescript/blocks/MediaBlocks.d.ts.map +0 -1
  260. package/lib/typescript/blocks/ReceiptBlocks.d.ts.map +0 -1
  261. package/lib/typescript/blocks/blockText.d.ts.map +0 -1
  262. package/lib/typescript/blocks/blockText.test.d.ts.map +0 -1
  263. package/lib/typescript/blocks/context.d.ts.map +0 -1
  264. package/lib/typescript/blocks/icons.d.ts.map +0 -1
  265. package/lib/typescript/blocks/index.d.ts.map +0 -1
  266. package/lib/typescript/blocks/listRow.test.d.ts.map +0 -1
  267. package/lib/typescript/blocks/pageState.d.ts.map +0 -1
  268. package/lib/typescript/blocks/pageState.test.d.ts.map +0 -1
  269. package/lib/typescript/blocks/primitives.d.ts.map +0 -1
  270. package/lib/typescript/blocks/primitivesIndex.d.ts.map +0 -1
  271. package/lib/typescript/components/ApprovalCard.d.ts.map +0 -1
  272. package/lib/typescript/components/AskBuoyHeader.d.ts.map +0 -1
  273. package/lib/typescript/components/AskBuoyIcon.d.ts.map +0 -1
  274. package/lib/typescript/components/AskBuoyModal.d.ts.map +0 -1
  275. package/lib/typescript/components/AskBuoySettings.d.ts.map +0 -1
  276. package/lib/typescript/components/ChangesBar.d.ts.map +0 -1
  277. package/lib/typescript/components/Composer.d.ts.map +0 -1
  278. package/lib/typescript/components/EmptyState.d.ts.map +0 -1
  279. package/lib/typescript/components/KeyboardPad.d.ts.map +0 -1
  280. package/lib/typescript/components/Markdown.d.ts.map +0 -1
  281. package/lib/typescript/components/MessageList.d.ts.map +0 -1
  282. package/lib/typescript/components/QueuedMessages.d.ts.map +0 -1
  283. package/lib/typescript/components/ThinkingStrip.d.ts.map +0 -1
  284. package/lib/typescript/components/TypingDots.d.ts.map +0 -1
  285. package/lib/typescript/components/markdownParse.d.ts.map +0 -1
  286. package/lib/typescript/components/markdownParse.test.d.ts.map +0 -1
  287. package/lib/typescript/components/useCopyAction.d.ts.map +0 -1
  288. package/lib/typescript/index.d.ts.map +0 -1
  289. package/lib/typescript/preset.d.ts.map +0 -1
  290. package/lib/typescript/store/activityGroups.d.ts.map +0 -1
  291. package/lib/typescript/store/activityGroups.test.d.ts.map +0 -1
  292. package/lib/typescript/store/askBuoySettings.d.ts.map +0 -1
  293. package/lib/typescript/store/askBuoyStore.d.ts.map +0 -1
  294. package/lib/typescript/store/blockPlacement.d.ts.map +0 -1
  295. package/lib/typescript/store/blockPlacement.test.d.ts.map +0 -1
  296. package/lib/typescript/store/queue.test.d.ts.map +0 -1
  297. package/lib/typescript/store/resetConversation.d.ts.map +0 -1
  298. package/lib/typescript/store/restorePending.test.d.ts.map +0 -1
  299. package/lib/typescript/store/restoredIds.test.d.ts.map +0 -1
  300. package/lib/typescript/store/suggestions.d.ts.map +0 -1
  301. package/lib/typescript/store/suggestions.test.d.ts.map +0 -1
  302. package/lib/typescript/store/systemLine.test.d.ts.map +0 -1
  303. package/lib/typescript/store/ticketPrompt.d.ts.map +0 -1
  304. package/lib/typescript/store/traceText.d.ts.map +0 -1
  305. package/lib/typescript/store/traceText.test.d.ts.map +0 -1
  306. package/lib/typescript/store/transcriptPersistence.d.ts.map +0 -1
  307. package/lib/typescript/store/transcriptPersistence.test.d.ts.map +0 -1
  308. package/lib/typescript/store/turnRendering.test.d.ts.map +0 -1
  309. package/lib/typescript/store/useAskBuoy.d.ts.map +0 -1
  310. package/lib/typescript/store/useAskBuoySettings.d.ts.map +0 -1
  311. package/lib/typescript/sync/askBuoySyncAdapter.d.ts.map +0 -1
  312. package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts.map +0 -1
  313. package/lib/typescript/sync/wire.d.ts.map +0 -1
  314. package/lib/typescript/types.d.ts.map +0 -1
@@ -1,161 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.EmptyState = EmptyState;
7
- var _reactNative = require("react-native");
8
- var _sharedUi = require("@buoy-gg/shared-ui");
9
- var _suggestions = require("../store/suggestions");
10
- var _jsxRuntime = require("react/jsx-runtime");
11
- /**
12
- * The first screen.
13
- *
14
- * Written for someone who has never used a devtool. The suggestions are not
15
- * decoration — they are the fastest way to teach a tester what kind of sentence
16
- * works here, and they are phrased as outcomes ("why is this screen empty?")
17
- * rather than as tool names, because the tools are the thing this feature
18
- * exists to hide.
19
- */
20
-
21
- const isRelease = typeof __DEV__ !== "undefined" && !__DEV__;
22
- function EmptyState({
23
- configured,
24
- onPick,
25
- availableToolIds = [],
26
- readOnly = false
27
- }) {
28
- const suggestions = (0, _suggestions.pickSuggestions)({
29
- availableToolIds,
30
- readOnly,
31
- isRelease
32
- });
33
- if (!configured) {
34
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
35
- style: styles.wrap,
36
- testID: "buoy-ask-buoy-unconfigured",
37
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
38
- style: styles.title,
39
- children: "Not set up yet"
40
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
41
- style: styles.body,
42
- children: ["Ask Buoy talks to your own company's AI endpoint \u2014 nothing goes to Buoy. A developer needs to add the ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
43
- style: styles.code,
44
- children: "askBuoy"
45
- }), " prop to", " ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
46
- style: styles.code,
47
- children: "<FloatingDevTools />"
48
- }), " with your team's endpoint and model."]
49
- })]
50
- });
51
- }
52
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
53
- style: styles.wrap,
54
- testID: "buoy-ask-buoy-empty",
55
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
56
- style: styles.title,
57
- children: "Ask about this app"
58
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
59
- style: styles.body,
60
- children: "Ask what the app is doing right now, or tell it to change something. Anything it changes shows up in a bar at the top, with what can be undone."
61
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
62
- style: styles.buildLine,
63
- testID: "buoy-ask-buoy-build-line",
64
- children: isRelease ? "Release build — reading, impersonation and navigation work; simulations (forcing server responses, driving the screen) need a dev build." : "Dev build — full simulation available."
65
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
66
- style: styles.group,
67
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.NightSectionLabel, {
68
- children: "Try asking"
69
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
70
- style: styles.card,
71
- children: suggestions.map((s, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Suggestion, {
72
- text: s,
73
- onPick: onPick,
74
- last: i === suggestions.length - 1
75
- }, s))
76
- })]
77
- })]
78
- });
79
- }
80
- function Suggestion({
81
- text,
82
- onPick,
83
- last
84
- }) {
85
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
86
- testID: `buoy-ask-buoy-suggestion-${text.slice(0, 12)}`,
87
- accessibilityRole: "button",
88
- onPress: () => onPick(text),
89
- style: ({
90
- pressed
91
- }) => [styles.row, !last && styles.rowDivider, pressed && styles.pressed],
92
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
93
- style: styles.rowText,
94
- children: text
95
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChevronRight, {
96
- size: 14,
97
- color: _sharedUi.night.color.textTertiary
98
- })]
99
- });
100
- }
101
- const styles = _reactNative.StyleSheet.create({
102
- wrap: {
103
- flex: 1,
104
- justifyContent: "center",
105
- paddingHorizontal: _sharedUi.night.gutter,
106
- paddingVertical: 24,
107
- gap: 8
108
- },
109
- title: {
110
- color: _sharedUi.night.color.text,
111
- fontSize: 22,
112
- fontWeight: "700",
113
- letterSpacing: -0.3
114
- },
115
- body: {
116
- color: _sharedUi.night.color.textSecondary,
117
- fontSize: _sharedUi.night.font.body,
118
- lineHeight: 20
119
- },
120
- code: {
121
- color: _sharedUi.night.color.text,
122
- fontFamily: "Menlo"
123
- },
124
- buildLine: {
125
- marginTop: 8,
126
- color: _sharedUi.night.color.textTertiary,
127
- fontSize: _sharedUi.night.font.micro,
128
- lineHeight: 15
129
- },
130
- group: {
131
- marginTop: _sharedUi.night.groupGap - 8
132
- },
133
- card: {
134
- borderRadius: _sharedUi.night.radius.card,
135
- borderWidth: _reactNative.StyleSheet.hairlineWidth,
136
- borderColor: _sharedUi.night.color.border,
137
- backgroundColor: _sharedUi.night.color.surface,
138
- overflow: "hidden"
139
- },
140
- row: {
141
- flexDirection: "row",
142
- alignItems: "center",
143
- gap: 10,
144
- paddingHorizontal: _sharedUi.night.rowPadH,
145
- paddingVertical: 13
146
- },
147
- rowDivider: {
148
- borderBottomWidth: _reactNative.StyleSheet.hairlineWidth,
149
- borderBottomColor: _sharedUi.night.color.separator
150
- },
151
- rowText: {
152
- flex: 1,
153
- color: _sharedUi.night.color.text,
154
- fontSize: _sharedUi.night.font.body,
155
- lineHeight: 19
156
- },
157
- pressed: {
158
- backgroundColor: _sharedUi.night.color.fill
159
- }
160
- });
161
- //# sourceMappingURL=EmptyState.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.EmptyState=EmptyState;var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _suggestions=require("../store/suggestions");var _jsxRuntime=require("react/jsx-runtime");const isRelease=typeof __DEV__!=="undefined"&&!__DEV__;function EmptyState({configured:e,onPick:t,availableToolIds:o=[],readOnly:i=false}){const r=(0,_suggestions.pickSuggestions)({availableToolIds:o,readOnly:i,isRelease});if(!e){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.wrap,testID:"buoy-ask-buoy-unconfigured",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.title,children:"Not set up yet"}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.body,children:["Ask Buoy talks to your own company's AI endpoint \u2014 nothing goes to Buoy. A developer needs to add the ",(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.code,children:"askBuoy"})," prop to"," ",(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.code,children:"<FloatingDevTools />"})," with your team's endpoint and model."]})]})}return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.wrap,testID:"buoy-ask-buoy-empty",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.title,children:"Ask about this app"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.body,children:"Ask what the app is doing right now, or tell it to change something. Anything it changes shows up in a bar at the top, with what can be undone."}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buildLine,testID:"buoy-ask-buoy-build-line",children:isRelease?"Release build \u2014 reading, impersonation and navigation work; simulations (forcing server responses, driving the screen) need a dev build.":"Dev build \u2014 full simulation available."}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.group,children:[(0,_jsxRuntime.jsx)(_sharedUi.NightSectionLabel,{children:"Try asking"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.card,children:r.map((n,s)=>(0,_jsxRuntime.jsx)(Suggestion,{text:n,onPick:t,last:s===r.length-1},n))})]})]})}function Suggestion({text:e,onPick:t,last:o}){return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:`buoy-ask-buoy-suggestion-${e.slice(0,12)}`,accessibilityRole:"button",onPress:()=>t(e),style:({pressed:i})=>[styles.row,!o&&styles.rowDivider,i&&styles.pressed],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowText,children:e}),(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:14,color:_sharedUi.night.color.textTertiary})]})}const styles=_reactNative.StyleSheet.create({wrap:{flex:1,justifyContent:"center",paddingHorizontal:_sharedUi.night.gutter,paddingVertical:24,gap:8},title:{color:_sharedUi.night.color.text,fontSize:22,fontWeight:"700",letterSpacing:-.3},body:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.body,lineHeight:20},code:{color:_sharedUi.night.color.text,fontFamily:"Menlo"},buildLine:{marginTop:8,color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro,lineHeight:15},group:{marginTop:_sharedUi.night.groupGap-8},card:{borderRadius:_sharedUi.night.radius.card,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface,overflow:"hidden"},row:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:_sharedUi.night.rowPadH,paddingVertical:13},rowDivider:{borderBottomWidth:_reactNative.StyleSheet.hairlineWidth,borderBottomColor:_sharedUi.night.color.separator},rowText:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.body,lineHeight:19},pressed:{backgroundColor:_sharedUi.night.color.fill}});
@@ -1,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:true});exports.KeyboardPad=KeyboardPad;var _react=require("react");var _reactNative=require("react-native");var _jsxRuntime=require("react/jsx-runtime");function KeyboardPad({children:i}){const a=(0,_react.useRef)(null);const t=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;(0,_react.useEffect)(()=>{if(_reactNative.Platform.OS!=="ios")return;const n=(e,r)=>{_reactNative.Animated.timing(t,{toValue:e,duration:r.duration||250,easing:_reactNative.Easing.bezier(.17,.59,.4,.77),useNativeDriver:false}).start()};const o=e=>{const r=a.current;if(!r)return;r.measureInWindow((f,u,m,c)=>{const l=u+c-e.endCoordinates.screenY;n(Math.max(0,l),e)})};const s=e=>n(0,e);const d=[_reactNative.Keyboard.addListener("keyboardWillChangeFrame",o),_reactNative.Keyboard.addListener("keyboardWillHide",s)];return()=>d.forEach(e=>e.remove())},[t]);return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{ref:a,style:[styles.flex,{paddingBottom:t}],children:i})}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:true});exports.Markdown=Markdown;exports.renderInline=renderInline;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _markdownParse=require("./markdownParse");var _jsxRuntime=require("react/jsx-runtime");function renderInline(i,o){const t=i.replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1");const e=[];const l=/(\*\*[^*]+\*\*|`[^`]+`|\*[^*\s][^*]*\*|_[^_\s][^_]*_)/g;let n=0;let c;let s=0;while(c=l.exec(t)){if(c.index>n)e.push(t.slice(n,c.index));const r=c[0];if(r.startsWith("**")){e.push((0,_jsxRuntime.jsx)(_reactNative.Text,{style:[o,styles.bold],children:r.slice(2,-2)},s++))}else if(r.startsWith("`")){e.push((0,_jsxRuntime.jsx)(_reactNative.Text,{style:[o,styles.code],children:r.slice(1,-1)},s++))}else{e.push((0,_jsxRuntime.jsx)(_reactNative.Text,{style:[o,styles.italic],children:r.slice(1,-1)},s++))}n=c.index+r.length}if(n<t.length)e.push(t.slice(n));return e}const stripLinks=i=>i.replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1");function MarkdownTable({header:i,rows:o}){const[t,e]=(0,_react.useState)(false);const l=(0,_markdownParse.tableTruncation)(i,o);const n=t?i:i.slice(0,_markdownParse.TABLE_PREVIEW_COLS);const c=t?o:o.slice(0,_markdownParse.TABLE_PREVIEW_ROWS);const s=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:t&&styles.tableWide,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tableHead,children:n.map((r,d)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.th,d===0&&styles.firstCol,t&&styles.colFixed],numberOfLines:1,children:r.replace(/\*\*/g,"")},d))}),c.map((r,d)=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.tr,d>0&&styles.trDivider],children:n.map((h,a)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.td,a===0&&styles.firstCol,a===0&&styles.tdFirst,t&&styles.colFixed],numberOfLines:t?3:2,children:renderInline(stripLinks(r[a]??""),styles.td)},a))},d))]});return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.table,testID:"buoy-ask-buoy-md-table",children:[t?(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:styles.tableScrollV,nestedScrollEnabled:true,children:(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:true,children:s})}):s,l?(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:"buoy-ask-buoy-md-table-toggle",accessibilityRole:"button",accessibilityLabel:t?"Show fewer rows":"Show all rows and columns",onPress:()=>e(r=>!r),style:({pressed:r})=>[styles.tfoot,r&&styles.pressed],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.tfootText,children:t?`All ${o.length} rows \xB7 ${i.length} columns`:l}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.tfootAction,children:t?"Show fewer":"Show all"})]}):null]})}function Markdown({text:i,style:o}){const t=(0,_markdownParse.parseBlocks)(i);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.wrap,children:t.map((e,l)=>{if(e.kind==="table")return(0,_jsxRuntime.jsx)(MarkdownTable,{header:e.header,rows:e.rows},l);if(e.kind==="code"){return(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{horizontal:true,style:styles.codeBlock,contentContainerStyle:styles.codeBlockContent,testID:"buoy-ask-buoy-md-code",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.codeText,selectable:true,children:e.text})},l)}if(e.kind==="li"){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.li,{paddingLeft:4+e.depth*14}],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[o,styles.marker],children:e.marker}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[o,styles.liText],selectable:true,children:renderInline(e.text,o)})]},l)}return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[o,e.kind==="h"&&styles.bold],selectable:true,children:renderInline(e.text,o)},l)})})}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}});