@buoy-gg/ask-buoy 7.0.35 → 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 (286) hide show
  1. package/README.md +73 -15
  2. package/lib/commonjs/blocks/AskBlocks.js +1 -338
  3. package/lib/commonjs/blocks/BlockRenderer.js +1 -250
  4. package/lib/commonjs/blocks/ChromePrototypes.js +1 -514
  5. package/lib/commonjs/blocks/DataBlocks.js +1 -688
  6. package/lib/commonjs/blocks/ExtraBlocks.js +1 -1854
  7. package/lib/commonjs/blocks/MediaBlocks.js +1 -140
  8. package/lib/commonjs/blocks/ReceiptBlocks.js +1 -586
  9. package/lib/commonjs/blocks/blockText.js +1 -0
  10. package/lib/commonjs/blocks/blockText.test.js +1 -0
  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 -401
  18. package/lib/commonjs/blocks/primitivesIndex.js +1 -62
  19. package/lib/commonjs/components/ApprovalCard.js +1 -140
  20. package/lib/commonjs/components/AskBuoyHeader.js +1 -164
  21. package/lib/commonjs/components/AskBuoyIcon.js +1 -19
  22. package/lib/commonjs/components/AskBuoyModal.js +1 -353
  23. package/lib/commonjs/components/AskBuoySettings.js +1 -69
  24. package/lib/commonjs/components/ChangesBar.js +1 -211
  25. package/lib/commonjs/components/Composer.js +1 -175
  26. package/lib/commonjs/components/EmptyState.js +1 -154
  27. package/lib/commonjs/components/KeyboardPad.js +1 -0
  28. package/lib/commonjs/components/Markdown.js +1 -252
  29. package/lib/commonjs/components/MessageList.js +1 -683
  30. package/lib/commonjs/components/QueuedMessages.js +1 -0
  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 -0
  34. package/lib/commonjs/components/markdownParse.test.js +1 -0
  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 -0
  39. package/lib/commonjs/store/activityGroups.test.js +1 -0
  40. package/lib/commonjs/store/askBuoySettings.js +1 -67
  41. package/lib/commonjs/store/askBuoyStore.js +1 -365
  42. package/lib/commonjs/store/blockPlacement.js +1 -0
  43. package/lib/commonjs/store/blockPlacement.test.js +1 -0
  44. package/lib/commonjs/store/queue.test.js +1 -0
  45. package/lib/commonjs/store/resetConversation.js +1 -0
  46. package/lib/commonjs/store/restorePending.test.js +1 -0
  47. package/lib/commonjs/store/restoredIds.test.js +1 -47
  48. package/lib/commonjs/store/suggestions.js +1 -0
  49. package/lib/commonjs/store/suggestions.test.js +1 -0
  50. package/lib/commonjs/store/systemLine.test.js +1 -0
  51. package/lib/commonjs/store/ticketPrompt.js +1 -0
  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 -208
  55. package/lib/commonjs/store/transcriptPersistence.test.js +1 -185
  56. package/lib/commonjs/store/turnRendering.test.js +1 -0
  57. package/lib/commonjs/store/useAskBuoy.js +1 -400
  58. package/lib/commonjs/store/useAskBuoySettings.js +1 -14
  59. package/lib/commonjs/sync/askBuoySyncAdapter.js +1 -119
  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 -245
  65. package/lib/module/blocks/ChromePrototypes.js +1 -503
  66. package/lib/module/blocks/DataBlocks.js +1 -674
  67. package/lib/module/blocks/ExtraBlocks.js +1 -1827
  68. package/lib/module/blocks/MediaBlocks.js +1 -135
  69. package/lib/module/blocks/ReceiptBlocks.js +1 -574
  70. package/lib/module/blocks/blockText.js +1 -0
  71. package/lib/module/blocks/blockText.test.js +1 -0
  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 -389
  79. package/lib/module/blocks/primitivesIndex.js +1 -5
  80. package/lib/module/components/ApprovalCard.js +1 -135
  81. package/lib/module/components/AskBuoyHeader.js +1 -161
  82. package/lib/module/components/AskBuoyIcon.js +1 -8
  83. package/lib/module/components/AskBuoyModal.js +1 -348
  84. package/lib/module/components/AskBuoySettings.js +1 -64
  85. package/lib/module/components/ChangesBar.js +1 -206
  86. package/lib/module/components/Composer.js +1 -170
  87. package/lib/module/components/EmptyState.js +1 -149
  88. package/lib/module/components/KeyboardPad.js +1 -0
  89. package/lib/module/components/Markdown.js +1 -246
  90. package/lib/module/components/MessageList.js +1 -677
  91. package/lib/module/components/QueuedMessages.js +1 -0
  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 -0
  95. package/lib/module/components/markdownParse.test.js +1 -0
  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 -0
  100. package/lib/module/store/activityGroups.test.js +1 -0
  101. package/lib/module/store/askBuoySettings.js +1 -62
  102. package/lib/module/store/askBuoyStore.js +1 -361
  103. package/lib/module/store/blockPlacement.js +1 -0
  104. package/lib/module/store/blockPlacement.test.js +1 -0
  105. package/lib/module/store/queue.test.js +1 -0
  106. package/lib/module/store/resetConversation.js +1 -0
  107. package/lib/module/store/restorePending.test.js +1 -0
  108. package/lib/module/store/restoredIds.test.js +1 -46
  109. package/lib/module/store/suggestions.js +1 -0
  110. package/lib/module/store/suggestions.test.js +1 -0
  111. package/lib/module/store/systemLine.test.js +1 -0
  112. package/lib/module/store/ticketPrompt.js +1 -0
  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 -198
  116. package/lib/module/store/transcriptPersistence.test.js +1 -184
  117. package/lib/module/store/turnRendering.test.js +1 -0
  118. package/lib/module/store/useAskBuoy.js +1 -394
  119. package/lib/module/store/useAskBuoySettings.js +1 -9
  120. package/lib/module/sync/askBuoySyncAdapter.js +1 -114
  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/blocks/DataBlocks.d.ts +11 -0
  125. package/lib/typescript/blocks/ExtraBlocks.d.ts +18 -2
  126. package/lib/typescript/blocks/blockText.d.ts +14 -0
  127. package/lib/typescript/blocks/blockText.test.d.ts +2 -0
  128. package/lib/typescript/blocks/primitives.d.ts +16 -1
  129. package/lib/typescript/components/ApprovalCard.d.ts +9 -1
  130. package/lib/typescript/components/AskBuoyHeader.d.ts +31 -1
  131. package/lib/typescript/components/Composer.d.ts +16 -1
  132. package/lib/typescript/components/EmptyState.d.ts +5 -1
  133. package/lib/typescript/components/KeyboardPad.d.ts +33 -0
  134. package/lib/typescript/components/Markdown.d.ts +0 -10
  135. package/lib/typescript/components/MessageList.d.ts +7 -2
  136. package/lib/typescript/components/QueuedMessages.d.ts +10 -0
  137. package/lib/typescript/components/markdownParse.d.ts +49 -0
  138. package/lib/typescript/components/markdownParse.test.d.ts +2 -0
  139. package/lib/typescript/preset.d.ts +4 -2
  140. package/lib/typescript/store/activityGroups.d.ts +29 -0
  141. package/lib/typescript/store/activityGroups.test.d.ts +2 -0
  142. package/lib/typescript/store/askBuoySettings.d.ts +22 -0
  143. package/lib/typescript/store/askBuoyStore.d.ts +174 -9
  144. package/lib/typescript/store/blockPlacement.d.ts +30 -0
  145. package/lib/typescript/store/blockPlacement.test.d.ts +2 -0
  146. package/lib/typescript/store/queue.test.d.ts +2 -0
  147. package/lib/typescript/store/resetConversation.d.ts +38 -0
  148. package/lib/typescript/store/restorePending.test.d.ts +2 -0
  149. package/lib/typescript/store/suggestions.d.ts +32 -0
  150. package/lib/typescript/store/suggestions.test.d.ts +2 -0
  151. package/lib/typescript/store/systemLine.test.d.ts +2 -0
  152. package/lib/typescript/store/ticketPrompt.d.ts +11 -0
  153. package/lib/typescript/store/transcriptPersistence.d.ts +41 -2
  154. package/lib/typescript/store/turnRendering.test.d.ts +2 -0
  155. package/lib/typescript/store/useAskBuoy.d.ts +26 -3
  156. package/lib/typescript/sync/askBuoySyncAdapter.d.ts +29 -6
  157. package/package.json +10 -10
  158. package/lib/commonjs/blocks/AskBlocks.js.map +0 -1
  159. package/lib/commonjs/blocks/BlockRenderer.js.map +0 -1
  160. package/lib/commonjs/blocks/ChromePrototypes.js.map +0 -1
  161. package/lib/commonjs/blocks/DataBlocks.js.map +0 -1
  162. package/lib/commonjs/blocks/ExtraBlocks.js.map +0 -1
  163. package/lib/commonjs/blocks/MediaBlocks.js.map +0 -1
  164. package/lib/commonjs/blocks/ReceiptBlocks.js.map +0 -1
  165. package/lib/commonjs/blocks/context.js.map +0 -1
  166. package/lib/commonjs/blocks/icons.js.map +0 -1
  167. package/lib/commonjs/blocks/index.js.map +0 -1
  168. package/lib/commonjs/blocks/listRow.test.js.map +0 -1
  169. package/lib/commonjs/blocks/pageState.js.map +0 -1
  170. package/lib/commonjs/blocks/pageState.test.js.map +0 -1
  171. package/lib/commonjs/blocks/primitives.js.map +0 -1
  172. package/lib/commonjs/blocks/primitivesIndex.js.map +0 -1
  173. package/lib/commonjs/components/ApprovalCard.js.map +0 -1
  174. package/lib/commonjs/components/AskBuoyHeader.js.map +0 -1
  175. package/lib/commonjs/components/AskBuoyIcon.js.map +0 -1
  176. package/lib/commonjs/components/AskBuoyModal.js.map +0 -1
  177. package/lib/commonjs/components/AskBuoySettings.js.map +0 -1
  178. package/lib/commonjs/components/ChangesBar.js.map +0 -1
  179. package/lib/commonjs/components/Composer.js.map +0 -1
  180. package/lib/commonjs/components/EmptyState.js.map +0 -1
  181. package/lib/commonjs/components/Markdown.js.map +0 -1
  182. package/lib/commonjs/components/MessageList.js.map +0 -1
  183. package/lib/commonjs/components/ThinkingStrip.js.map +0 -1
  184. package/lib/commonjs/components/TypingDots.js.map +0 -1
  185. package/lib/commonjs/components/useCopyAction.js.map +0 -1
  186. package/lib/commonjs/index.js.map +0 -1
  187. package/lib/commonjs/preset.js.map +0 -1
  188. package/lib/commonjs/store/askBuoySettings.js.map +0 -1
  189. package/lib/commonjs/store/askBuoyStore.js.map +0 -1
  190. package/lib/commonjs/store/restoredIds.test.js.map +0 -1
  191. package/lib/commonjs/store/traceText.js.map +0 -1
  192. package/lib/commonjs/store/traceText.test.js.map +0 -1
  193. package/lib/commonjs/store/transcriptPersistence.js.map +0 -1
  194. package/lib/commonjs/store/transcriptPersistence.test.js.map +0 -1
  195. package/lib/commonjs/store/useAskBuoy.js.map +0 -1
  196. package/lib/commonjs/store/useAskBuoySettings.js.map +0 -1
  197. package/lib/commonjs/sync/askBuoySyncAdapter.js.map +0 -1
  198. package/lib/commonjs/sync/askBuoySyncAdapter.test.js.map +0 -1
  199. package/lib/commonjs/sync/wire.js.map +0 -1
  200. package/lib/commonjs/types.js.map +0 -1
  201. package/lib/module/blocks/AskBlocks.js.map +0 -1
  202. package/lib/module/blocks/BlockRenderer.js.map +0 -1
  203. package/lib/module/blocks/ChromePrototypes.js.map +0 -1
  204. package/lib/module/blocks/DataBlocks.js.map +0 -1
  205. package/lib/module/blocks/ExtraBlocks.js.map +0 -1
  206. package/lib/module/blocks/MediaBlocks.js.map +0 -1
  207. package/lib/module/blocks/ReceiptBlocks.js.map +0 -1
  208. package/lib/module/blocks/context.js.map +0 -1
  209. package/lib/module/blocks/icons.js.map +0 -1
  210. package/lib/module/blocks/index.js.map +0 -1
  211. package/lib/module/blocks/listRow.test.js.map +0 -1
  212. package/lib/module/blocks/pageState.js.map +0 -1
  213. package/lib/module/blocks/pageState.test.js.map +0 -1
  214. package/lib/module/blocks/primitives.js.map +0 -1
  215. package/lib/module/blocks/primitivesIndex.js.map +0 -1
  216. package/lib/module/components/ApprovalCard.js.map +0 -1
  217. package/lib/module/components/AskBuoyHeader.js.map +0 -1
  218. package/lib/module/components/AskBuoyIcon.js.map +0 -1
  219. package/lib/module/components/AskBuoyModal.js.map +0 -1
  220. package/lib/module/components/AskBuoySettings.js.map +0 -1
  221. package/lib/module/components/ChangesBar.js.map +0 -1
  222. package/lib/module/components/Composer.js.map +0 -1
  223. package/lib/module/components/EmptyState.js.map +0 -1
  224. package/lib/module/components/Markdown.js.map +0 -1
  225. package/lib/module/components/MessageList.js.map +0 -1
  226. package/lib/module/components/ThinkingStrip.js.map +0 -1
  227. package/lib/module/components/TypingDots.js.map +0 -1
  228. package/lib/module/components/useCopyAction.js.map +0 -1
  229. package/lib/module/index.js.map +0 -1
  230. package/lib/module/preset.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/restoredIds.test.js.map +0 -1
  234. package/lib/module/store/traceText.js.map +0 -1
  235. package/lib/module/store/traceText.test.js.map +0 -1
  236. package/lib/module/store/transcriptPersistence.js.map +0 -1
  237. package/lib/module/store/transcriptPersistence.test.js.map +0 -1
  238. package/lib/module/store/useAskBuoy.js.map +0 -1
  239. package/lib/module/store/useAskBuoySettings.js.map +0 -1
  240. package/lib/module/sync/askBuoySyncAdapter.js.map +0 -1
  241. package/lib/module/sync/askBuoySyncAdapter.test.js.map +0 -1
  242. package/lib/module/sync/wire.js.map +0 -1
  243. package/lib/module/types.js.map +0 -1
  244. package/lib/typescript/blocks/AskBlocks.d.ts.map +0 -1
  245. package/lib/typescript/blocks/BlockRenderer.d.ts.map +0 -1
  246. package/lib/typescript/blocks/ChromePrototypes.d.ts.map +0 -1
  247. package/lib/typescript/blocks/DataBlocks.d.ts.map +0 -1
  248. package/lib/typescript/blocks/ExtraBlocks.d.ts.map +0 -1
  249. package/lib/typescript/blocks/MediaBlocks.d.ts.map +0 -1
  250. package/lib/typescript/blocks/ReceiptBlocks.d.ts.map +0 -1
  251. package/lib/typescript/blocks/context.d.ts.map +0 -1
  252. package/lib/typescript/blocks/icons.d.ts.map +0 -1
  253. package/lib/typescript/blocks/index.d.ts.map +0 -1
  254. package/lib/typescript/blocks/listRow.test.d.ts.map +0 -1
  255. package/lib/typescript/blocks/pageState.d.ts.map +0 -1
  256. package/lib/typescript/blocks/pageState.test.d.ts.map +0 -1
  257. package/lib/typescript/blocks/primitives.d.ts.map +0 -1
  258. package/lib/typescript/blocks/primitivesIndex.d.ts.map +0 -1
  259. package/lib/typescript/components/ApprovalCard.d.ts.map +0 -1
  260. package/lib/typescript/components/AskBuoyHeader.d.ts.map +0 -1
  261. package/lib/typescript/components/AskBuoyIcon.d.ts.map +0 -1
  262. package/lib/typescript/components/AskBuoyModal.d.ts.map +0 -1
  263. package/lib/typescript/components/AskBuoySettings.d.ts.map +0 -1
  264. package/lib/typescript/components/ChangesBar.d.ts.map +0 -1
  265. package/lib/typescript/components/Composer.d.ts.map +0 -1
  266. package/lib/typescript/components/EmptyState.d.ts.map +0 -1
  267. package/lib/typescript/components/Markdown.d.ts.map +0 -1
  268. package/lib/typescript/components/MessageList.d.ts.map +0 -1
  269. package/lib/typescript/components/ThinkingStrip.d.ts.map +0 -1
  270. package/lib/typescript/components/TypingDots.d.ts.map +0 -1
  271. package/lib/typescript/components/useCopyAction.d.ts.map +0 -1
  272. package/lib/typescript/index.d.ts.map +0 -1
  273. package/lib/typescript/preset.d.ts.map +0 -1
  274. package/lib/typescript/store/askBuoySettings.d.ts.map +0 -1
  275. package/lib/typescript/store/askBuoyStore.d.ts.map +0 -1
  276. package/lib/typescript/store/restoredIds.test.d.ts.map +0 -1
  277. package/lib/typescript/store/traceText.d.ts.map +0 -1
  278. package/lib/typescript/store/traceText.test.d.ts.map +0 -1
  279. package/lib/typescript/store/transcriptPersistence.d.ts.map +0 -1
  280. package/lib/typescript/store/transcriptPersistence.test.d.ts.map +0 -1
  281. package/lib/typescript/store/useAskBuoy.d.ts.map +0 -1
  282. package/lib/typescript/store/useAskBuoySettings.d.ts.map +0 -1
  283. package/lib/typescript/sync/askBuoySyncAdapter.d.ts.map +0 -1
  284. package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts.map +0 -1
  285. package/lib/typescript/sync/wire.d.ts.map +0 -1
  286. package/lib/typescript/types.d.ts.map +0 -1
@@ -1,401 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ActionRow = ActionRow;
7
- exports.Card = Card;
8
- exports.More = More;
9
- exports.MoreNote = MoreNote;
10
- exports.ProvenanceBadge = ProvenanceBadge;
11
- exports.blockStyles = void 0;
12
- exports.toneColor = toneColor;
13
- exports.usePaged = usePaged;
14
- var _react = require("react");
15
- var _reactNative = require("react-native");
16
- var _sharedUi = require("@buoy-gg/shared-ui");
17
- var _context = require("./context");
18
- var _pageState = require("./pageState");
19
- var _jsxRuntime = require("react/jsx-runtime");
20
- /**
21
- * The few visual pieces every block shares: the card, its title row with the
22
- * provenance badge, a "+N more" expander, and the two-button action row.
23
- * Night tokens only — a block must look like every other Buoy surface.
24
- */
25
-
26
- function toneColor(tone) {
27
- switch (tone) {
28
- case "accent":
29
- return _sharedUi.night.color.accent;
30
- case "warning":
31
- return _sharedUi.night.color.warning;
32
- case "danger":
33
- return _sharedUi.night.color.danger;
34
- case "info":
35
- return _sharedUi.night.color.info;
36
- case "muted":
37
- return _sharedUi.night.color.textTertiary;
38
- default:
39
- return _sharedUi.night.color.text;
40
- }
41
- }
42
-
43
- /** Quiet when live; loud when the data was changed, mocked, or invented. */
44
- function ProvenanceBadge({
45
- source
46
- }) {
47
- if (!source || source === "live") return null;
48
- const label = source === "changed" ? "CHANGED BY ASK BUOY" : source === "mocked" ? "MOCKED" : "FROM THE MODEL";
49
- const color = source === "changed" ? _sharedUi.night.color.warning : source === "mocked" ? _sharedUi.night.color.danger : _sharedUi.night.color.textTertiary;
50
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
51
- style: [styles.badge, {
52
- borderColor: color
53
- }],
54
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
55
- style: [styles.badgeText, {
56
- color
57
- }],
58
- children: label
59
- })
60
- });
61
- }
62
- function Card({
63
- title,
64
- source,
65
- children,
66
- testID,
67
- tone
68
- }) {
69
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
70
- style: [styles.card, tone === "warning" && styles.cardWarning, tone === "danger" && styles.cardDanger, tone === "info" && styles.cardInfo],
71
- testID: testID,
72
- children: [(title || source && source !== "live") && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
73
- style: styles.titleRow,
74
- children: [title ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
75
- style: styles.title,
76
- numberOfLines: 2,
77
- children: title
78
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
79
- style: styles.flex
80
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ProvenanceBadge, {
81
- source: source
82
- })]
83
- }), children]
84
- });
85
- }
86
-
87
- /**
88
- * How many rows one tap of "Show N more" reveals.
89
- *
90
- * Deliberately smaller than any block's initial cap. Expanding used to be
91
- * all-or-nothing, so a hundred-row list arrived in one tap and buried the
92
- * answer it was attached to under a scroll the reader had to fight back up.
93
- * A page at a time keeps the conversation the thing you are reading.
94
- */
95
- const PAGE_STEP = 5;
96
- /**
97
- * A capped list that grows a page at a time.
98
- *
99
- * The callers used to spell the expander's enabled-ness out themselves
100
- * (`items.length > visible.length || expanded ? toggle : undefined`) at seven
101
- * call sites, and getting it wrong rendered a "+N more" that did nothing when
102
- * tapped. Both halves live here now so a call site cannot express that state.
103
- */
104
- function usePaged(items, cap, step = PAGE_STEP) {
105
- const [limit, setLimit] = (0, _react.useState)(cap);
106
- const {
107
- hidden,
108
- next,
109
- expanded,
110
- canExpand,
111
- canCollapse
112
- } = (0, _pageState.pageState)(items.length, cap, limit, step);
113
- return {
114
- visible: items.slice(0, limit),
115
- hidden,
116
- next,
117
- expanded,
118
- showMore: canExpand ? () => setLimit(n => n + step) : undefined,
119
- showLess: canCollapse ? () => setLimit(cap) : undefined
120
- };
121
- }
122
-
123
- /**
124
- * The footer of a paged list: reveal one more page, or fold back to the cap.
125
- *
126
- * It knows nothing about any `total` the source reported, and that is the
127
- * point. The old version drew its count from that number while drawing its tap
128
- * target from the array actually in hand — so a block holding five items and
129
- * claiming six rendered "+1 more" with nothing behind it. The engine hands the
130
- * whole list over now (see agent-core's receipts), so what this can show and
131
- * what it can reveal are the same thing by construction.
132
- */
133
- function More({
134
- paged
135
- }) {
136
- const {
137
- next,
138
- showMore,
139
- showLess
140
- } = paged;
141
- if (!showMore && !showLess) return null;
142
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
143
- style: styles.moreRow,
144
- children: [showMore ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
145
- testID: "buoy-block-show-more",
146
- onPress: showMore,
147
- style: [styles.more, styles.moreCell],
148
- accessibilityRole: "button",
149
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
150
- style: styles.moreText,
151
- children: ["Show ", next, " more"]
152
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChevronDown, {
153
- size: 12,
154
- color: _sharedUi.night.color.textTertiary
155
- })]
156
- }) : null, showLess ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
157
- testID: "buoy-block-show-fewer",
158
- onPress: showLess,
159
- style: [styles.more, styles.moreCell],
160
- accessibilityRole: "button",
161
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
162
- style: styles.moreText,
163
- children: "Show fewer"
164
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChevronUp, {
165
- size: 12,
166
- color: _sharedUi.night.color.textTertiary
167
- })]
168
- }) : null]
169
- });
170
- }
171
-
172
- /**
173
- * A list that CANNOT grow: the cap was applied where the block was built, so
174
- * the rest was never sent. Stated, never offered as a tap.
175
- */
176
- function MoreNote({
177
- shown,
178
- total
179
- }) {
180
- if (!total || total <= shown) return null;
181
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
182
- style: styles.more,
183
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
184
- style: styles.moreNote,
185
- children: [shown, " of ", total, " shown"]
186
- })
187
- });
188
- }
189
-
190
- /** Up to two buttons. One primary (accent, dark ink), one plate. */
191
- function ActionRow({
192
- actions,
193
- blockId,
194
- align = "left"
195
- }) {
196
- const h = (0, _context.useBlockHandlers)();
197
- if (!actions?.length) return null;
198
- const supported = actions.filter(a => {
199
- if (a.openTool) return h.supports?.openTool !== false;
200
- if (a.minimize) return h.supports?.minimize !== false;
201
- if (a.dispatch) return h.supports?.dispatch !== false;
202
- return true;
203
- });
204
- if (supported.length === 0) return null;
205
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
206
- style: [styles.actions, align === "right" && styles.actionsRight],
207
- children: supported.slice(0, 2).map(a => {
208
- const state = h.actionState?.[(0, _context.actionKey)(blockId, a)];
209
- const disabled = !!h.busy || state === "running" || state === "done";
210
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
211
- accessibilityRole: "button",
212
- accessibilityLabel: a.label,
213
- testID: `buoy-block-action-${a.label.toLowerCase().replace(/\s+/g, "-")}`,
214
- disabled: disabled,
215
- onPress: () => void h.runAction(a, blockId),
216
- style: ({
217
- pressed
218
- }) => [styles.button, a.primary ? styles.buttonPrimary : styles.buttonPlate, disabled && styles.buttonDisabled, pressed && !disabled && styles.pressed],
219
- children: [state === "running" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
220
- size: "small",
221
- color: a.primary ? _sharedUi.night.color.onAccent : _sharedUi.night.color.text
222
- }) : state === "done" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Check, {
223
- size: 12,
224
- color: a.primary ? _sharedUi.night.color.onAccent : _sharedUi.night.color.accent
225
- }) : state === "failed" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.X, {
226
- size: 12,
227
- color: _sharedUi.night.color.danger
228
- }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
229
- style: [styles.buttonText, a.primary ? styles.buttonTextPrimary : styles.buttonTextPlate],
230
- children: a.label
231
- })]
232
- }, a.label);
233
- })
234
- });
235
- }
236
- const blockStyles = exports.blockStyles = _reactNative.StyleSheet.create({
237
- row: {
238
- flexDirection: "row",
239
- alignItems: "center",
240
- gap: 10,
241
- paddingHorizontal: 12,
242
- paddingVertical: 9
243
- },
244
- rowDivider: {
245
- borderTopWidth: _reactNative.StyleSheet.hairlineWidth,
246
- borderTopColor: _sharedUi.night.color.separator
247
- },
248
- rowTitle: {
249
- flex: 1,
250
- color: _sharedUi.night.color.text,
251
- fontSize: _sharedUi.night.font.body,
252
- lineHeight: 19
253
- },
254
- rowSub: {
255
- color: _sharedUi.night.color.textSecondary,
256
- fontSize: _sharedUi.night.font.caption,
257
- lineHeight: 17
258
- },
259
- rowTrailing: {
260
- color: _sharedUi.night.color.textTertiary,
261
- fontSize: _sharedUi.night.font.caption,
262
- maxWidth: 120,
263
- textAlign: "right"
264
- },
265
- mono: {
266
- fontFamily: "Menlo",
267
- fontSize: 12,
268
- color: _sharedUi.night.color.text
269
- },
270
- pill: {
271
- paddingHorizontal: 7,
272
- paddingVertical: 2,
273
- borderRadius: _sharedUi.night.radius.badge,
274
- backgroundColor: _sharedUi.night.color.fill
275
- },
276
- pillText: {
277
- fontSize: _sharedUi.night.font.micro,
278
- fontWeight: "700",
279
- letterSpacing: 0.4,
280
- color: _sharedUi.night.color.textSecondary
281
- }
282
- });
283
- const styles = _reactNative.StyleSheet.create({
284
- card: {
285
- borderRadius: _sharedUi.night.radius.card,
286
- borderWidth: _reactNative.StyleSheet.hairlineWidth,
287
- borderColor: _sharedUi.night.color.border,
288
- backgroundColor: _sharedUi.night.color.surface,
289
- overflow: "hidden"
290
- },
291
- cardWarning: {
292
- borderColor: _sharedUi.night.color.warning,
293
- backgroundColor: _sharedUi.night.color.warningSoft
294
- },
295
- cardDanger: {
296
- borderColor: _sharedUi.night.color.danger,
297
- backgroundColor: _sharedUi.night.color.dangerSoft
298
- },
299
- cardInfo: {
300
- borderColor: _sharedUi.night.color.accentBorderStrong,
301
- backgroundColor: _sharedUi.night.color.accentSoft
302
- },
303
- titleRow: {
304
- flexDirection: "row",
305
- alignItems: "center",
306
- gap: 8,
307
- paddingHorizontal: 12,
308
- paddingTop: 10,
309
- paddingBottom: 6
310
- },
311
- flex: {
312
- flex: 1
313
- },
314
- title: {
315
- flex: 1,
316
- color: _sharedUi.night.color.text,
317
- fontSize: _sharedUi.night.font.caption,
318
- fontWeight: "600"
319
- },
320
- badge: {
321
- borderWidth: _reactNative.StyleSheet.hairlineWidth,
322
- borderRadius: _sharedUi.night.radius.badge,
323
- paddingHorizontal: 6,
324
- paddingVertical: 2
325
- },
326
- badgeText: {
327
- fontSize: 9,
328
- fontWeight: "700",
329
- letterSpacing: 0.6
330
- },
331
- // The footer splits into up to three cells; each keeps the full-width rule
332
- // above it so the list still reads as ending at a line.
333
- moreRow: {
334
- flexDirection: "row"
335
- },
336
- more: {
337
- flexDirection: "row",
338
- alignItems: "center",
339
- justifyContent: "center",
340
- gap: 4,
341
- paddingVertical: 9,
342
- paddingHorizontal: 8,
343
- borderTopWidth: _reactNative.StyleSheet.hairlineWidth,
344
- borderTopColor: _sharedUi.night.color.separator
345
- },
346
- // Only inside `moreRow` — a bare `MoreNote` sits in the Card's column,
347
- // where flex:1 means "grow vertically".
348
- moreCell: {
349
- flex: 1
350
- },
351
- moreText: {
352
- color: _sharedUi.night.color.textSecondary,
353
- fontSize: _sharedUi.night.font.caption,
354
- fontWeight: "600"
355
- },
356
- moreNote: {
357
- color: _sharedUi.night.color.textTertiary,
358
- fontSize: _sharedUi.night.font.caption
359
- },
360
- actions: {
361
- flexDirection: "row",
362
- gap: 8,
363
- paddingHorizontal: 12,
364
- paddingVertical: 10,
365
- flexWrap: "wrap"
366
- },
367
- actionsRight: {
368
- justifyContent: "flex-end"
369
- },
370
- button: {
371
- flexDirection: "row",
372
- alignItems: "center",
373
- gap: 6,
374
- paddingHorizontal: 14,
375
- paddingVertical: 9,
376
- borderRadius: _sharedUi.night.radius.row
377
- },
378
- buttonPrimary: {
379
- backgroundColor: _sharedUi.night.color.accent
380
- },
381
- buttonPlate: {
382
- backgroundColor: _sharedUi.night.color.button
383
- },
384
- buttonDisabled: {
385
- opacity: 0.55
386
- },
387
- buttonText: {
388
- fontSize: _sharedUi.night.font.caption,
389
- fontWeight: "600"
390
- },
391
- buttonTextPrimary: {
392
- color: _sharedUi.night.color.onAccent
393
- },
394
- buttonTextPlate: {
395
- color: _sharedUi.night.color.text
396
- },
397
- pressed: {
398
- opacity: 0.7
399
- }
400
- });
401
- //# sourceMappingURL=primitives.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ActionRow=ActionRow,exports.Card=Card,exports.More=More,exports.MoreNote=MoreNote,exports.ProvenanceBadge=ProvenanceBadge,exports.blockStyles=void 0,exports.toneColor=toneColor,exports.usePaged=usePaged;var _react=require("react"),_reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_context=require("./context"),_pageState=require("./pageState"),_jsxRuntime=require("react/jsx-runtime");function toneColor(e){switch(e){case"accent":return _sharedUi.night.color.accent;case"warning":return _sharedUi.night.color.warning;case"danger":return _sharedUi.night.color.danger;case"info":return _sharedUi.night.color.info;case"muted":return _sharedUi.night.color.textTertiary;default:return _sharedUi.night.color.text}}function ProvenanceBadge({source:e}){if(!e||"live"===e)return null;const t="changed"===e?"CHANGED BY ASK BUOY":"mocked"===e?"MOCKED":"FROM THE MODEL",r="changed"===e?_sharedUi.night.color.warning:"mocked"===e?_sharedUi.night.color.danger:_sharedUi.night.color.textTertiary;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.badge,{borderColor:r}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.badgeText,{color:r}],children:t})})}function Card({title:e,source:t,children:r,testID:o,tone:i,collapsible:n,summary:s}){const[a,l]=(0,_react.useState)(!1),c=!!n&&!a;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.card,"warning"===i&&styles.cardWarning,"danger"===i&&styles.cardDanger,"info"===i&&styles.cardInfo],testID:o,children:[(e||t&&"live"!==t)&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.titleRow,children:[e?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.title,numberOfLines:2,children:e}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.flex}),(0,_jsxRuntime.jsx)(ProvenanceBadge,{source:t})]}),n?(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:o?`${o}-toggle`:void 0,onPress:()=>l(e=>!e),accessibilityRole:"button",accessibilityState:{expanded:a},accessibilityLabel:`${s??"Details"}, ${a?"hide":"show"}`,style:({pressed:e})=>[styles.disclosure,!c&&styles.disclosureOpen,e&&styles.pressed],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.disclosureText,numberOfLines:1,children:s??"Details"}),c?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:12,color:_sharedUi.night.color.textTertiary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronUp,{size:12,color:_sharedUi.night.color.textTertiary})]}):null,c?null:r]})}const PAGE_STEP=5;function usePaged(e,t,r=PAGE_STEP){const[o,i]=(0,_react.useState)(t),{hidden:n,next:s,expanded:a,canExpand:l,canCollapse:c}=(0,_pageState.pageState)(e.length,t,o,r);return{visible:e.slice(0,o),hidden:n,next:s,expanded:a,showMore:l?()=>i(e=>e+r):void 0,showLess:c?()=>i(t):void 0}}function More({paged:e}){const{next:t,showMore:r,showLess:o}=e;return r||o?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.moreRow,children:[r?(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:"buoy-block-show-more",onPress:r,style:[styles.more,styles.moreCell],accessibilityRole:"button",children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.moreText,children:["Show ",t," more"]}),(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:12,color:_sharedUi.night.color.textTertiary})]}):null,o?(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:"buoy-block-show-fewer",onPress:o,style:[styles.more,styles.moreCell],accessibilityRole:"button",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.moreText,children:"Show fewer"}),(0,_jsxRuntime.jsx)(_sharedUi.ChevronUp,{size:12,color:_sharedUi.night.color.textTertiary})]}):null]}):null}function MoreNote({shown:e,total:t}){return!t||t<=e?null:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.more,children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.moreNote,children:[e," of ",t," shown"]})})}function ActionRow({actions:e,blockId:t,align:r="left"}){const o=(0,_context.useBlockHandlers)();if(!e?.length)return null;const i=e.filter(e=>e.openTool?!1!==o.supports?.openTool:e.minimize?!1!==o.supports?.minimize:!e.dispatch||!1!==o.supports?.dispatch);return 0===i.length?null:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.actions,"right"===r&&styles.actionsRight],children:i.slice(0,2).map(e=>{const r=o.actionState?.[(0,_context.actionKey)(t,e)],i=!!o.busy||"running"===r||"done"===r;return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:e.label,testID:`buoy-block-action-${e.label.toLowerCase().replace(/\s+/g,"-")}`,disabled:i,onPress:()=>{o.runAction(e,t)},style:({pressed:t})=>[styles.button,e.primary?styles.buttonPrimary:styles.buttonPlate,i&&styles.buttonDisabled,t&&!i&&styles.pressed],children:["running"===r?(0,_jsxRuntime.jsx)(_reactNative.ActivityIndicator,{size:"small",color:e.primary?_sharedUi.night.color.onAccent:_sharedUi.night.color.text}):"done"===r?(0,_jsxRuntime.jsx)(_sharedUi.Check,{size:12,color:e.primary?_sharedUi.night.color.onAccent:_sharedUi.night.color.accent}):"failed"===r?(0,_jsxRuntime.jsx)(_sharedUi.X,{size:12,color:_sharedUi.night.color.danger}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.buttonText,e.primary?styles.buttonTextPrimary:styles.buttonTextPlate],children:e.label})]},e.label)})})}const blockStyles=exports.blockStyles=_reactNative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:12,paddingVertical:9},rowDivider:{borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_sharedUi.night.color.separator},rowTitle:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.body,lineHeight:19},rowSub:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,lineHeight:17},rowTrailing:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.caption,maxWidth:120,textAlign:"right"},mono:{fontFamily:"Menlo",fontSize:12,color:_sharedUi.night.color.text},pill:{paddingHorizontal:7,paddingVertical:2,borderRadius:_sharedUi.night.radius.badge,backgroundColor:_sharedUi.night.color.fill},pillText:{fontSize:_sharedUi.night.font.micro,fontWeight:"700",letterSpacing:.4,color:_sharedUi.night.color.textSecondary}}),styles=_reactNative.StyleSheet.create({card:{borderRadius:_sharedUi.night.radius.card,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface,overflow:"hidden"},cardWarning:{borderColor:_sharedUi.night.color.warning,backgroundColor:_sharedUi.night.color.warningSoft},cardDanger:{borderColor:_sharedUi.night.color.danger,backgroundColor:_sharedUi.night.color.dangerSoft},cardInfo:{borderColor:_sharedUi.night.color.accentBorderStrong,backgroundColor:_sharedUi.night.color.accentSoft},titleRow:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingTop:10,paddingBottom:6},flex:{flex:1},title:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},disclosure:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingVertical:9},disclosureOpen:{borderBottomWidth:_reactNative.StyleSheet.hairlineWidth,borderBottomColor:_sharedUi.night.color.separator},disclosureText:{flex:1,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption},badge:{borderWidth:_reactNative.StyleSheet.hairlineWidth,borderRadius:_sharedUi.night.radius.badge,paddingHorizontal:6,paddingVertical:2},badgeText:{fontSize:9,fontWeight:"700",letterSpacing:.6},moreRow:{flexDirection:"row"},more:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:4,paddingVertical:9,paddingHorizontal:8,borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_sharedUi.night.color.separator},moreCell:{flex:1},moreText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},moreNote:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.caption},actions:{flexDirection:"row",gap:8,paddingHorizontal:12,paddingVertical:10,flexWrap:"wrap"},actionsRight:{justifyContent:"flex-end"},button:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:14,paddingVertical:9,borderRadius:_sharedUi.night.radius.row},buttonPrimary:{backgroundColor:_sharedUi.night.color.accent},buttonPlate:{backgroundColor:_sharedUi.night.color.button},buttonDisabled:{opacity:.55},buttonText:{fontSize:_sharedUi.night.font.caption,fontWeight:"600"},buttonTextPrimary:{color:_sharedUi.night.color.onAccent},buttonTextPlate:{color:_sharedUi.night.color.text},pressed:{opacity:.7}});
@@ -1,62 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "ActionRow", {
7
- enumerable: true,
8
- get: function () {
9
- return _primitives.ActionRow;
10
- }
11
- });
12
- Object.defineProperty(exports, "Card", {
13
- enumerable: true,
14
- get: function () {
15
- return _primitives.Card;
16
- }
17
- });
18
- Object.defineProperty(exports, "More", {
19
- enumerable: true,
20
- get: function () {
21
- return _primitives.More;
22
- }
23
- });
24
- Object.defineProperty(exports, "MoreNote", {
25
- enumerable: true,
26
- get: function () {
27
- return _primitives.MoreNote;
28
- }
29
- });
30
- Object.defineProperty(exports, "ProvenanceBadge", {
31
- enumerable: true,
32
- get: function () {
33
- return _primitives.ProvenanceBadge;
34
- }
35
- });
36
- Object.defineProperty(exports, "blockStyles", {
37
- enumerable: true,
38
- get: function () {
39
- return _primitives.blockStyles;
40
- }
41
- });
42
- Object.defineProperty(exports, "toneColor", {
43
- enumerable: true,
44
- get: function () {
45
- return _primitives.toneColor;
46
- }
47
- });
48
- Object.defineProperty(exports, "useBlockHandlers", {
49
- enumerable: true,
50
- get: function () {
51
- return _context.useBlockHandlers;
52
- }
53
- });
54
- Object.defineProperty(exports, "usePaged", {
55
- enumerable: true,
56
- get: function () {
57
- return _primitives.usePaged;
58
- }
59
- });
60
- var _primitives = require("./primitives");
61
- var _context = require("./context");
62
- //# sourceMappingURL=primitivesIndex.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ActionRow",{enumerable:!0,get:function(){return _primitives.ActionRow}}),Object.defineProperty(exports,"Card",{enumerable:!0,get:function(){return _primitives.Card}}),Object.defineProperty(exports,"More",{enumerable:!0,get:function(){return _primitives.More}}),Object.defineProperty(exports,"MoreNote",{enumerable:!0,get:function(){return _primitives.MoreNote}}),Object.defineProperty(exports,"ProvenanceBadge",{enumerable:!0,get:function(){return _primitives.ProvenanceBadge}}),Object.defineProperty(exports,"blockStyles",{enumerable:!0,get:function(){return _primitives.blockStyles}}),Object.defineProperty(exports,"toneColor",{enumerable:!0,get:function(){return _primitives.toneColor}}),Object.defineProperty(exports,"useBlockHandlers",{enumerable:!0,get:function(){return _context.useBlockHandlers}}),Object.defineProperty(exports,"usePaged",{enumerable:!0,get:function(){return _primitives.usePaged}});var _primitives=require("./primitives"),_context=require("./context");
@@ -1,140 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ApprovalCard = ApprovalCard;
7
- var _reactNative = require("react-native");
8
- var _sharedUi = require("@buoy-gg/shared-ui");
9
- var _jsxRuntime = require("react/jsx-runtime");
10
- /**
11
- * The approval prompt, shown only when the app opted into `requireApproval`.
12
- *
13
- * It renders the EFFECT, not the payload. That is the whole design constraint:
14
- * every other agent product assumes a developer is reading the proposed
15
- * command before approving it, and the people this tool is for cannot evaluate
16
- * `redux_dispatch({type:'SET_ENTITLEMENTS', payload:{…}})`. An approval prompt
17
- * nobody can read is not oversight — it is a rubber stamp that looks like
18
- * oversight, which is worse than having no prompt at all.
19
- */
20
-
21
- function ApprovalCard({
22
- pending,
23
- onAnswer
24
- }) {
25
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
26
- style: styles.card,
27
- testID: "buoy-ask-buoy-approval",
28
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
29
- style: styles.titleRow,
30
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.AlertTriangle, {
31
- size: 14,
32
- color: _sharedUi.night.color.warning
33
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
34
- style: styles.title,
35
- children: "Allow this change?"
36
- })]
37
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
38
- style: styles.label,
39
- children: pending.label
40
- }), pending.description ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
41
- style: styles.description,
42
- children: pending.description
43
- }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
44
- style: styles.reason,
45
- children: pending.reason
46
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
47
- style: styles.actions,
48
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
49
- testID: "buoy-ask-buoy-approve",
50
- accessibilityRole: "button",
51
- onPress: () => onAnswer(true),
52
- style: ({
53
- pressed
54
- }) => [styles.button, styles.approve, pressed && styles.pressed],
55
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
56
- style: styles.approveText,
57
- children: "Allow"
58
- })
59
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
60
- testID: "buoy-ask-buoy-reject",
61
- accessibilityRole: "button",
62
- onPress: () => onAnswer(false),
63
- style: ({
64
- pressed
65
- }) => [styles.button, styles.reject, pressed && styles.pressed],
66
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
67
- style: styles.rejectText,
68
- children: "Not now"
69
- })
70
- })]
71
- })]
72
- });
73
- }
74
- const styles = _reactNative.StyleSheet.create({
75
- card: {
76
- marginHorizontal: _sharedUi.night.gutter,
77
- marginBottom: 10,
78
- padding: _sharedUi.night.cardPad,
79
- borderRadius: _sharedUi.night.radius.card,
80
- borderWidth: _reactNative.StyleSheet.hairlineWidth,
81
- borderColor: _sharedUi.night.color.accentBorderStrong,
82
- backgroundColor: _sharedUi.night.color.surface,
83
- gap: 6
84
- },
85
- titleRow: {
86
- flexDirection: "row",
87
- alignItems: "center",
88
- gap: 6
89
- },
90
- title: {
91
- color: _sharedUi.night.color.text,
92
- fontSize: _sharedUi.night.font.caption,
93
- fontWeight: "600"
94
- },
95
- label: {
96
- color: _sharedUi.night.color.text,
97
- fontSize: _sharedUi.night.font.row,
98
- fontWeight: "600",
99
- lineHeight: 20
100
- },
101
- description: {
102
- color: _sharedUi.night.color.textSecondary,
103
- fontSize: _sharedUi.night.font.caption,
104
- lineHeight: 18
105
- },
106
- reason: {
107
- color: _sharedUi.night.color.warning,
108
- fontSize: _sharedUi.night.font.caption,
109
- lineHeight: 18
110
- },
111
- actions: {
112
- flexDirection: "row",
113
- gap: 8,
114
- marginTop: 6
115
- },
116
- button: {
117
- paddingHorizontal: 16,
118
- paddingVertical: 9,
119
- borderRadius: _sharedUi.night.radius.row
120
- },
121
- approve: {
122
- backgroundColor: _sharedUi.night.color.accent
123
- },
124
- approveText: {
125
- color: _sharedUi.night.color.onAccent,
126
- fontWeight: "600",
127
- fontSize: _sharedUi.night.font.caption
128
- },
129
- reject: {
130
- backgroundColor: _sharedUi.night.color.button
131
- },
132
- rejectText: {
133
- color: _sharedUi.night.color.text,
134
- fontSize: _sharedUi.night.font.caption
135
- },
136
- pressed: {
137
- opacity: 0.7
138
- }
139
- });
140
- //# sourceMappingURL=ApprovalCard.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ApprovalCard=ApprovalCard;var _react=require("react"),_reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_jsxRuntime=require("react/jsx-runtime");function ApprovalCard({pending:e,onAnswer:t}){const[r,i]=(0,_react.useState)("");return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.card,testID:"buoy-ask-buoy-approval",children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.titleRow,children:[(0,_jsxRuntime.jsx)(_sharedUi.AlertTriangle,{size:14,color:_sharedUi.night.color.warning}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.title,children:"Allow this change?"})]}),e.restored?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.restored,testID:"buoy-ask-buoy-approval-restored",children:"Asked before the app restarted — check it still applies."}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.label,children:e.label}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.reason,children:e.reason}),e.description?(0,_jsxRuntime.jsx)(ApprovalDetails,{text:e.description}):null,(0,_jsxRuntime.jsx)(_reactNative.TextInput,{testID:"buoy-ask-buoy-approval-note",value:r,onChangeText:i,placeholder:"Add a note for the agent (optional)",placeholderTextColor:_sharedUi.night.color.textTertiary,style:styles.note,returnKeyType:"done",blurOnSubmit:!0}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actions,children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:"buoy-ask-buoy-approve",accessibilityRole:"button",onPress:()=>t({approved:!0,reason:r}),style:({pressed:e})=>[styles.button,styles.approve,e&&styles.pressed],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.approveText,children:"Allow"})}),e.restored?null:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:"buoy-ask-buoy-approve-trust",accessibilityRole:"button",onPress:()=>t({approved:!0,reason:r,trust:!0}),style:({pressed:e})=>[styles.button,styles.trust,e&&styles.pressed],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.trustText,children:"Allow for this chat"})}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:"buoy-ask-buoy-reject",accessibilityRole:"button",onPress:()=>t({approved:!1,reason:r}),style:({pressed:e})=>[styles.button,styles.reject,e&&styles.pressed],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rejectText,children:"Not now"})})]})]})}function ApprovalDetails({text:e}){const[t,r]=(0,_react.useState)(!1);return(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:"buoy-ask-buoy-approval-details",accessibilityRole:"button",accessibilityState:{expanded:t},onPress:()=>r(e=>!e),style:({pressed:e})=>[styles.disclosure,e&&styles.pressed],hitSlop:6,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:t?styles.chevronOpen:styles.chevronClosed,children:(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:12,color:_sharedUi.night.color.textTertiary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.disclosureText,children:t?"Hide details":"Details"})]}),t?(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:styles.detail,contentContainerStyle:styles.detailContent,nestedScrollEnabled:!0,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.description,children:e})}):null]})}const styles=_reactNative.StyleSheet.create({card:{marginHorizontal:_sharedUi.night.gutter,marginBottom:10,padding:_sharedUi.night.cardPad,borderRadius:_sharedUi.night.radius.card,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.accentBorderStrong,backgroundColor:_sharedUi.night.color.surface,gap:6},titleRow:{flexDirection:"row",alignItems:"center",gap:6},title:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},label:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.row,fontWeight:"600",lineHeight:20},description:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,lineHeight:18},reason:{color:_sharedUi.night.color.warning,fontSize:_sharedUi.night.font.caption,lineHeight:18},restored:{color:_sharedUi.night.color.info,backgroundColor:_sharedUi.night.color.infoSoft,fontSize:_sharedUi.night.font.micro,lineHeight:16,paddingHorizontal:8,paddingVertical:5,borderRadius:8},disclosure:{flexDirection:"row",alignItems:"center",gap:4,paddingVertical:4},disclosureText:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro,fontWeight:"600"},chevronOpen:{transform:[{rotate:"0deg"}]},chevronClosed:{transform:[{rotate:"-90deg"}]},detail:{maxHeight:150,marginTop:2},detailContent:{paddingBottom:2},note:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,paddingHorizontal:10,paddingVertical:7,borderRadius:_sharedUi.night.radius.row,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.button,marginTop:2},actions:{flexDirection:"row",flexWrap:"wrap",gap:8,marginTop:6},button:{paddingHorizontal:16,paddingVertical:9,borderRadius:_sharedUi.night.radius.row},approve:{backgroundColor:_sharedUi.night.color.accent},approveText:{color:_sharedUi.night.color.onAccent,fontWeight:"600",fontSize:_sharedUi.night.font.caption},trust:{backgroundColor:_sharedUi.night.color.button,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.accentBorderStrong},trustText:{color:_sharedUi.night.color.accent,fontWeight:"600",fontSize:_sharedUi.night.font.caption},reject:{backgroundColor:_sharedUi.night.color.button},rejectText:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption},pressed:{opacity:.7}});