@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,91 +1 @@
1
- "use strict";
2
-
3
- /** The small named icons a block may ask for. One place, one size. */
4
- import { View, StyleSheet } from "react-native";
5
- import { AlertTriangle, Check, Clock, Database, Eye, Globe, Image as ImageIcon, Info, Layers, Navigation, night, User } from "@buoy-gg/shared-ui";
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- export function BlockIcon({
8
- name,
9
- size = 14
10
- }) {
11
- const c = night.color.textSecondary;
12
- const icon = (() => {
13
- switch (name) {
14
- case "network":
15
- return /*#__PURE__*/_jsx(Globe, {
16
- size: size,
17
- color: c
18
- });
19
- case "storage":
20
- return /*#__PURE__*/_jsx(Database, {
21
- size: size,
22
- color: c
23
- });
24
- case "route":
25
- return /*#__PURE__*/_jsx(Navigation, {
26
- size: size,
27
- color: c
28
- });
29
- case "screen":
30
- return /*#__PURE__*/_jsx(Eye, {
31
- size: size,
32
- color: c
33
- });
34
- case "user":
35
- return /*#__PURE__*/_jsx(User, {
36
- size: size,
37
- color: c
38
- });
39
- case "image":
40
- return /*#__PURE__*/_jsx(ImageIcon, {
41
- size: size,
42
- color: c
43
- });
44
- case "check":
45
- return /*#__PURE__*/_jsx(Check, {
46
- size: size,
47
- color: night.color.accent
48
- });
49
- case "warn":
50
- return /*#__PURE__*/_jsx(AlertTriangle, {
51
- size: size,
52
- color: night.color.warning
53
- });
54
- case "info":
55
- return /*#__PURE__*/_jsx(Info, {
56
- size: size,
57
- color: night.color.info
58
- });
59
- case "store":
60
- return /*#__PURE__*/_jsx(Layers, {
61
- size: size,
62
- color: c
63
- });
64
- case "query":
65
- return /*#__PURE__*/_jsx(Layers, {
66
- size: size,
67
- color: c
68
- });
69
- case "clock":
70
- return /*#__PURE__*/_jsx(Clock, {
71
- size: size,
72
- color: c
73
- });
74
- }
75
- })();
76
- return /*#__PURE__*/_jsx(View, {
77
- style: styles.wrap,
78
- children: icon
79
- });
80
- }
81
- const styles = StyleSheet.create({
82
- wrap: {
83
- width: 24,
84
- height: 24,
85
- borderRadius: 6,
86
- backgroundColor: night.color.fill,
87
- alignItems: "center",
88
- justifyContent: "center"
89
- }
90
- });
91
- //# sourceMappingURL=icons.js.map
1
+ "use strict";import{View,StyleSheet}from"react-native";import{AlertTriangle,Check,Clock,Database,Eye,Globe,Image as ImageIcon,Info,Layers,Navigation,night,User}from"@buoy-gg/shared-ui";import{jsx as _jsx}from"react/jsx-runtime";export function BlockIcon({name:e,size:r=14}){const o=night.color.textSecondary,s=(()=>{switch(e){case"network":return _jsx(Globe,{size:r,color:o});case"storage":return _jsx(Database,{size:r,color:o});case"route":return _jsx(Navigation,{size:r,color:o});case"screen":return _jsx(Eye,{size:r,color:o});case"user":return _jsx(User,{size:r,color:o});case"image":return _jsx(ImageIcon,{size:r,color:o});case"check":return _jsx(Check,{size:r,color:night.color.accent});case"warn":return _jsx(AlertTriangle,{size:r,color:night.color.warning});case"info":return _jsx(Info,{size:r,color:night.color.info});case"store":case"query":return _jsx(Layers,{size:r,color:o});case"clock":return _jsx(Clock,{size:r,color:o})}})();return _jsx(View,{style:styles.wrap,children:s})}const styles=StyleSheet.create({wrap:{width:24,height:24,borderRadius:6,backgroundColor:night.color.fill,alignItems:"center",justifyContent:"center"}});
@@ -1,8 +1 @@
1
- "use strict";
2
-
3
- export { BlockRenderer } from "./BlockRenderer";
4
- export { BlockHandlersProvider, useBlockHandlers } from "./context";
5
- export { Card, ActionRow, ProvenanceBadge } from "./primitives";
6
- export { MessageActions, ReasoningStrip, ElapsedRow, QueuedComposer, ReloadDivider, Timestamp, EditableUserBubble } from "./ChromePrototypes";
7
- export { LivePill } from "./ExtraBlocks";
8
- //# sourceMappingURL=index.js.map
1
+ "use strict";export{BlockRenderer}from"./BlockRenderer";export{BlockHandlersProvider,useBlockHandlers}from"./context";export{Card,ActionRow,ProvenanceBadge}from"./primitives";export{MessageActions,ReasoningStrip,ElapsedRow,QueuedComposer,ReloadDivider,Timestamp,EditableUserBubble}from"./ChromePrototypes";export{LivePill}from"./ExtraBlocks";
@@ -1,56 +1 @@
1
- "use strict";
2
-
3
- import { describe, expect, it } from "vitest";
4
- import { listRowBehaviour } from "./DataBlocks";
5
-
6
- /**
7
- * A list row can carry a picture AND an action, and both want the tap. These
8
- * are the rules that keep them apart — see `listRowBehaviour`.
9
- */
10
- describe("listRowBehaviour", () => {
11
- it("a plain row does nothing on tap", () => {
12
- expect(listRowBehaviour({})).toEqual({
13
- canExpand: false,
14
- rowRunsAction: false,
15
- actionIsOwnControl: false
16
- });
17
- });
18
- it("a row with a picture opens it", () => {
19
- expect(listRowBehaviour({
20
- image: "https://x/1.png"
21
- })).toEqual({
22
- canExpand: true,
23
- rowRunsAction: false,
24
- actionIsOwnControl: false
25
- });
26
- });
27
- it("a row with only an action keeps running it from the whole row", () => {
28
- expect(listRowBehaviour({
29
- action: {
30
- label: "Retry",
31
- send: "retry"
32
- }
33
- })).toEqual({
34
- canExpand: false,
35
- rowRunsAction: true,
36
- actionIsOwnControl: false
37
- });
38
- });
39
- it("with BOTH, the body opens the picture and the action gets its own control", () => {
40
- const b = listRowBehaviour({
41
- image: "https://x/1.png",
42
- action: {
43
- label: "Retry",
44
- send: "retry"
45
- }
46
- });
47
- expect(b).toEqual({
48
- canExpand: true,
49
- rowRunsAction: false,
50
- actionIsOwnControl: true
51
- });
52
- // The row body must never be the action's target — that is the whole point.
53
- expect(b.rowRunsAction).toBe(false);
54
- });
55
- });
56
- //# sourceMappingURL=listRow.test.js.map
1
+ "use strict";import{describe,expect,it}from"vitest";import{listRowBehaviour}from"./DataBlocks";describe("listRowBehaviour",()=>{it("a plain row does nothing on tap",()=>{expect(listRowBehaviour({})).toEqual({canExpand:!1,rowRunsAction:!1,actionIsOwnControl:!1})}),it("a row with a picture opens it",()=>{expect(listRowBehaviour({image:"https://x/1.png"})).toEqual({canExpand:!0,rowRunsAction:!1,actionIsOwnControl:!1})}),it("a row with only an action keeps running it from the whole row",()=>{expect(listRowBehaviour({action:{label:"Retry",send:"retry"}})).toEqual({canExpand:!1,rowRunsAction:!0,actionIsOwnControl:!1})}),it("with BOTH, the body opens the picture and the action gets its own control",()=>{const t=listRowBehaviour({image:"https://x/1.png",action:{label:"Retry",send:"retry"}});expect(t).toEqual({canExpand:!0,rowRunsAction:!1,actionIsOwnControl:!0}),expect(t.rowRunsAction).toBe(!1)})});
@@ -1,30 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * The arithmetic behind a block's "+N more" footer, separated from the hook so
5
- * it can be tested without a renderer.
6
- *
7
- * The rule that matters: a control is offered ONLY when it changes what is on
8
- * screen. The previous version derived "+N more" from a `total` the source
9
- * reported while deriving the tap target from the array actually in hand, so a
10
- * block holding five items and claiming six rendered a "+1 more" with nothing
11
- * to reveal — a button that did nothing when tapped. This takes a count and a
12
- * limit and nothing else, so `canExpand` is the same fact as `hidden > 0`.
13
- */
14
-
15
- export function pageState(count, cap, limit, step) {
16
- const shown = Math.min(limit, count);
17
- const hidden = Math.max(0, count - shown);
18
- // A block can be re-rendered in place with a shorter list than the one the
19
- // limit was raised for; collapsing back to a cap nothing exceeds would move
20
- // nothing, so it is not offered.
21
- const expanded = limit > cap && count > cap;
22
- return {
23
- hidden,
24
- next: Math.min(hidden, step),
25
- expanded,
26
- canExpand: hidden > 0,
27
- canCollapse: expanded
28
- };
29
- }
30
- //# sourceMappingURL=pageState.js.map
1
+ "use strict";export function pageState(n,t,a,e){const c=Math.min(a,n),d=Math.max(0,n-c),i=a>t&&n>t;return{hidden:d,next:Math.min(d,e),expanded:i,canExpand:d>0,canCollapse:i}}
@@ -1,56 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * The "+N more" footer's arithmetic.
5
- *
6
- * The bug this covers: a list block showed "+1 more" that did nothing when
7
- * tapped. The count came from the `total` the model reported, the tap target
8
- * came from the array actually in hand, and the two disagreed — so the footer
9
- * advertised a row that was never sent. Every case below is about a control
10
- * being offered if and only if it changes the screen.
11
- */
12
- import { describe, expect, it } from "vitest";
13
- import { pageState } from "./pageState";
14
- const CAP = 10;
15
- const STEP = 5;
16
- const at = (count, limit) => pageState(count, CAP, limit, STEP);
17
- describe("what the footer offers", () => {
18
- it("offers nothing when everything already fits", () => {
19
- const s = at(4, CAP);
20
- expect(s.hidden).toBe(0);
21
- expect(s.canExpand).toBe(false);
22
- expect(s.canCollapse).toBe(false);
23
- });
24
- it("never offers an expand that reveals nothing", () => {
25
- // The dead "+1 more" this replaced: the label was drawn from a `total` the
26
- // source reported, the tap target from the array in hand. `pageState` is
27
- // given only the array, so a control it offers always moves something.
28
- expect(at(5, CAP).canExpand).toBe(false);
29
- });
30
- it("reveals a page at a time rather than the whole list", () => {
31
- // 100 items, cap 10: 10 → 15 → 20 → 25, exactly one step per tap.
32
- expect(at(100, 10).next).toBe(5);
33
- expect(at(100, 15).next).toBe(5);
34
- expect(at(100, 20).hidden).toBe(80);
35
- });
36
- it("offers only the remainder on the last page", () => {
37
- // 12 items shown to 10: two left, so the label promises two, not five.
38
- expect(at(12, 10).next).toBe(2);
39
- expect(at(12, 12).canExpand).toBe(false);
40
- });
41
- it("offers the way back only once something is expanded", () => {
42
- expect(at(100, 10).canCollapse).toBe(false);
43
- expect(at(100, 15).canCollapse).toBe(true);
44
- expect(at(100, 15).expanded).toBe(true);
45
- });
46
- it("does not offer a collapse that moves nothing", () => {
47
- // A block re-rendered in place with a shorter list than the limit was
48
- // raised for: 3 items under a limit of 20. Folding back to 10 would look
49
- // identical, so it is not offered.
50
- const s = at(3, 20);
51
- expect(s.canCollapse).toBe(false);
52
- expect(s.expanded).toBe(false);
53
- expect(s.hidden).toBe(0);
54
- });
55
- });
56
- //# sourceMappingURL=pageState.test.js.map
1
+ "use strict";import{describe,expect,it}from"vitest";import{pageState}from"./pageState";const CAP=10,STEP=5,at=(e,t)=>pageState(e,10,t,5);describe("what the footer offers",()=>{it("offers nothing when everything already fits",()=>{const e=at(4,10);expect(e.hidden).toBe(0),expect(e.canExpand).toBe(!1),expect(e.canCollapse).toBe(!1)}),it("never offers an expand that reveals nothing",()=>{expect(at(5,10).canExpand).toBe(!1)}),it("reveals a page at a time rather than the whole list",()=>{expect(at(100,10).next).toBe(5),expect(at(100,15).next).toBe(5),expect(at(100,20).hidden).toBe(80)}),it("offers only the remainder on the last page",()=>{expect(at(12,10).next).toBe(2),expect(at(12,12).canExpand).toBe(!1)}),it("offers the way back only once something is expanded",()=>{expect(at(100,10).canCollapse).toBe(!1),expect(at(100,15).canCollapse).toBe(!0),expect(at(100,15).expanded).toBe(!0)}),it("does not offer a collapse that moves nothing",()=>{const e=at(3,20);expect(e.canCollapse).toBe(!1),expect(e.expanded).toBe(!1),expect(e.hidden).toBe(0)})});
@@ -1,389 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * The few visual pieces every block shares: the card, its title row with the
5
- * provenance badge, a "+N more" expander, and the two-button action row.
6
- * Night tokens only — a block must look like every other Buoy surface.
7
- */
8
- import { useState } from "react";
9
- import { ActivityIndicator, Pressable, StyleSheet, Text, View } from "react-native";
10
- import { Check, ChevronDown, ChevronUp, night, X } from "@buoy-gg/shared-ui";
11
- import { actionKey, useBlockHandlers } from "./context";
12
- import { pageState } from "./pageState";
13
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- export function toneColor(tone) {
15
- switch (tone) {
16
- case "accent":
17
- return night.color.accent;
18
- case "warning":
19
- return night.color.warning;
20
- case "danger":
21
- return night.color.danger;
22
- case "info":
23
- return night.color.info;
24
- case "muted":
25
- return night.color.textTertiary;
26
- default:
27
- return night.color.text;
28
- }
29
- }
30
-
31
- /** Quiet when live; loud when the data was changed, mocked, or invented. */
32
- export function ProvenanceBadge({
33
- source
34
- }) {
35
- if (!source || source === "live") return null;
36
- const label = source === "changed" ? "CHANGED BY ASK BUOY" : source === "mocked" ? "MOCKED" : "FROM THE MODEL";
37
- const color = source === "changed" ? night.color.warning : source === "mocked" ? night.color.danger : night.color.textTertiary;
38
- return /*#__PURE__*/_jsx(View, {
39
- style: [styles.badge, {
40
- borderColor: color
41
- }],
42
- children: /*#__PURE__*/_jsx(Text, {
43
- style: [styles.badgeText, {
44
- color
45
- }],
46
- children: label
47
- })
48
- });
49
- }
50
- export function Card({
51
- title,
52
- source,
53
- children,
54
- testID,
55
- tone
56
- }) {
57
- return /*#__PURE__*/_jsxs(View, {
58
- style: [styles.card, tone === "warning" && styles.cardWarning, tone === "danger" && styles.cardDanger, tone === "info" && styles.cardInfo],
59
- testID: testID,
60
- children: [(title || source && source !== "live") && /*#__PURE__*/_jsxs(View, {
61
- style: styles.titleRow,
62
- children: [title ? /*#__PURE__*/_jsx(Text, {
63
- style: styles.title,
64
- numberOfLines: 2,
65
- children: title
66
- }) : /*#__PURE__*/_jsx(View, {
67
- style: styles.flex
68
- }), /*#__PURE__*/_jsx(ProvenanceBadge, {
69
- source: source
70
- })]
71
- }), children]
72
- });
73
- }
74
-
75
- /**
76
- * How many rows one tap of "Show N more" reveals.
77
- *
78
- * Deliberately smaller than any block's initial cap. Expanding used to be
79
- * all-or-nothing, so a hundred-row list arrived in one tap and buried the
80
- * answer it was attached to under a scroll the reader had to fight back up.
81
- * A page at a time keeps the conversation the thing you are reading.
82
- */
83
- const PAGE_STEP = 5;
84
- /**
85
- * A capped list that grows a page at a time.
86
- *
87
- * The callers used to spell the expander's enabled-ness out themselves
88
- * (`items.length > visible.length || expanded ? toggle : undefined`) at seven
89
- * call sites, and getting it wrong rendered a "+N more" that did nothing when
90
- * tapped. Both halves live here now so a call site cannot express that state.
91
- */
92
- export function usePaged(items, cap, step = PAGE_STEP) {
93
- const [limit, setLimit] = useState(cap);
94
- const {
95
- hidden,
96
- next,
97
- expanded,
98
- canExpand,
99
- canCollapse
100
- } = pageState(items.length, cap, limit, step);
101
- return {
102
- visible: items.slice(0, limit),
103
- hidden,
104
- next,
105
- expanded,
106
- showMore: canExpand ? () => setLimit(n => n + step) : undefined,
107
- showLess: canCollapse ? () => setLimit(cap) : undefined
108
- };
109
- }
110
-
111
- /**
112
- * The footer of a paged list: reveal one more page, or fold back to the cap.
113
- *
114
- * It knows nothing about any `total` the source reported, and that is the
115
- * point. The old version drew its count from that number while drawing its tap
116
- * target from the array actually in hand — so a block holding five items and
117
- * claiming six rendered "+1 more" with nothing behind it. The engine hands the
118
- * whole list over now (see agent-core's receipts), so what this can show and
119
- * what it can reveal are the same thing by construction.
120
- */
121
- export function More({
122
- paged
123
- }) {
124
- const {
125
- next,
126
- showMore,
127
- showLess
128
- } = paged;
129
- if (!showMore && !showLess) return null;
130
- return /*#__PURE__*/_jsxs(View, {
131
- style: styles.moreRow,
132
- children: [showMore ? /*#__PURE__*/_jsxs(Pressable, {
133
- testID: "buoy-block-show-more",
134
- onPress: showMore,
135
- style: [styles.more, styles.moreCell],
136
- accessibilityRole: "button",
137
- children: [/*#__PURE__*/_jsxs(Text, {
138
- style: styles.moreText,
139
- children: ["Show ", next, " more"]
140
- }), /*#__PURE__*/_jsx(ChevronDown, {
141
- size: 12,
142
- color: night.color.textTertiary
143
- })]
144
- }) : null, showLess ? /*#__PURE__*/_jsxs(Pressable, {
145
- testID: "buoy-block-show-fewer",
146
- onPress: showLess,
147
- style: [styles.more, styles.moreCell],
148
- accessibilityRole: "button",
149
- children: [/*#__PURE__*/_jsx(Text, {
150
- style: styles.moreText,
151
- children: "Show fewer"
152
- }), /*#__PURE__*/_jsx(ChevronUp, {
153
- size: 12,
154
- color: night.color.textTertiary
155
- })]
156
- }) : null]
157
- });
158
- }
159
-
160
- /**
161
- * A list that CANNOT grow: the cap was applied where the block was built, so
162
- * the rest was never sent. Stated, never offered as a tap.
163
- */
164
- export function MoreNote({
165
- shown,
166
- total
167
- }) {
168
- if (!total || total <= shown) return null;
169
- return /*#__PURE__*/_jsx(View, {
170
- style: styles.more,
171
- children: /*#__PURE__*/_jsxs(Text, {
172
- style: styles.moreNote,
173
- children: [shown, " of ", total, " shown"]
174
- })
175
- });
176
- }
177
-
178
- /** Up to two buttons. One primary (accent, dark ink), one plate. */
179
- export function ActionRow({
180
- actions,
181
- blockId,
182
- align = "left"
183
- }) {
184
- const h = useBlockHandlers();
185
- if (!actions?.length) return null;
186
- const supported = actions.filter(a => {
187
- if (a.openTool) return h.supports?.openTool !== false;
188
- if (a.minimize) return h.supports?.minimize !== false;
189
- if (a.dispatch) return h.supports?.dispatch !== false;
190
- return true;
191
- });
192
- if (supported.length === 0) return null;
193
- return /*#__PURE__*/_jsx(View, {
194
- style: [styles.actions, align === "right" && styles.actionsRight],
195
- children: supported.slice(0, 2).map(a => {
196
- const state = h.actionState?.[actionKey(blockId, a)];
197
- const disabled = !!h.busy || state === "running" || state === "done";
198
- return /*#__PURE__*/_jsxs(Pressable, {
199
- accessibilityRole: "button",
200
- accessibilityLabel: a.label,
201
- testID: `buoy-block-action-${a.label.toLowerCase().replace(/\s+/g, "-")}`,
202
- disabled: disabled,
203
- onPress: () => void h.runAction(a, blockId),
204
- style: ({
205
- pressed
206
- }) => [styles.button, a.primary ? styles.buttonPrimary : styles.buttonPlate, disabled && styles.buttonDisabled, pressed && !disabled && styles.pressed],
207
- children: [state === "running" ? /*#__PURE__*/_jsx(ActivityIndicator, {
208
- size: "small",
209
- color: a.primary ? night.color.onAccent : night.color.text
210
- }) : state === "done" ? /*#__PURE__*/_jsx(Check, {
211
- size: 12,
212
- color: a.primary ? night.color.onAccent : night.color.accent
213
- }) : state === "failed" ? /*#__PURE__*/_jsx(X, {
214
- size: 12,
215
- color: night.color.danger
216
- }) : null, /*#__PURE__*/_jsx(Text, {
217
- style: [styles.buttonText, a.primary ? styles.buttonTextPrimary : styles.buttonTextPlate],
218
- children: a.label
219
- })]
220
- }, a.label);
221
- })
222
- });
223
- }
224
- export const blockStyles = StyleSheet.create({
225
- row: {
226
- flexDirection: "row",
227
- alignItems: "center",
228
- gap: 10,
229
- paddingHorizontal: 12,
230
- paddingVertical: 9
231
- },
232
- rowDivider: {
233
- borderTopWidth: StyleSheet.hairlineWidth,
234
- borderTopColor: night.color.separator
235
- },
236
- rowTitle: {
237
- flex: 1,
238
- color: night.color.text,
239
- fontSize: night.font.body,
240
- lineHeight: 19
241
- },
242
- rowSub: {
243
- color: night.color.textSecondary,
244
- fontSize: night.font.caption,
245
- lineHeight: 17
246
- },
247
- rowTrailing: {
248
- color: night.color.textTertiary,
249
- fontSize: night.font.caption,
250
- maxWidth: 120,
251
- textAlign: "right"
252
- },
253
- mono: {
254
- fontFamily: "Menlo",
255
- fontSize: 12,
256
- color: night.color.text
257
- },
258
- pill: {
259
- paddingHorizontal: 7,
260
- paddingVertical: 2,
261
- borderRadius: night.radius.badge,
262
- backgroundColor: night.color.fill
263
- },
264
- pillText: {
265
- fontSize: night.font.micro,
266
- fontWeight: "700",
267
- letterSpacing: 0.4,
268
- color: night.color.textSecondary
269
- }
270
- });
271
- const styles = StyleSheet.create({
272
- card: {
273
- borderRadius: night.radius.card,
274
- borderWidth: StyleSheet.hairlineWidth,
275
- borderColor: night.color.border,
276
- backgroundColor: night.color.surface,
277
- overflow: "hidden"
278
- },
279
- cardWarning: {
280
- borderColor: night.color.warning,
281
- backgroundColor: night.color.warningSoft
282
- },
283
- cardDanger: {
284
- borderColor: night.color.danger,
285
- backgroundColor: night.color.dangerSoft
286
- },
287
- cardInfo: {
288
- borderColor: night.color.accentBorderStrong,
289
- backgroundColor: night.color.accentSoft
290
- },
291
- titleRow: {
292
- flexDirection: "row",
293
- alignItems: "center",
294
- gap: 8,
295
- paddingHorizontal: 12,
296
- paddingTop: 10,
297
- paddingBottom: 6
298
- },
299
- flex: {
300
- flex: 1
301
- },
302
- title: {
303
- flex: 1,
304
- color: night.color.text,
305
- fontSize: night.font.caption,
306
- fontWeight: "600"
307
- },
308
- badge: {
309
- borderWidth: StyleSheet.hairlineWidth,
310
- borderRadius: night.radius.badge,
311
- paddingHorizontal: 6,
312
- paddingVertical: 2
313
- },
314
- badgeText: {
315
- fontSize: 9,
316
- fontWeight: "700",
317
- letterSpacing: 0.6
318
- },
319
- // The footer splits into up to three cells; each keeps the full-width rule
320
- // above it so the list still reads as ending at a line.
321
- moreRow: {
322
- flexDirection: "row"
323
- },
324
- more: {
325
- flexDirection: "row",
326
- alignItems: "center",
327
- justifyContent: "center",
328
- gap: 4,
329
- paddingVertical: 9,
330
- paddingHorizontal: 8,
331
- borderTopWidth: StyleSheet.hairlineWidth,
332
- borderTopColor: night.color.separator
333
- },
334
- // Only inside `moreRow` — a bare `MoreNote` sits in the Card's column,
335
- // where flex:1 means "grow vertically".
336
- moreCell: {
337
- flex: 1
338
- },
339
- moreText: {
340
- color: night.color.textSecondary,
341
- fontSize: night.font.caption,
342
- fontWeight: "600"
343
- },
344
- moreNote: {
345
- color: night.color.textTertiary,
346
- fontSize: night.font.caption
347
- },
348
- actions: {
349
- flexDirection: "row",
350
- gap: 8,
351
- paddingHorizontal: 12,
352
- paddingVertical: 10,
353
- flexWrap: "wrap"
354
- },
355
- actionsRight: {
356
- justifyContent: "flex-end"
357
- },
358
- button: {
359
- flexDirection: "row",
360
- alignItems: "center",
361
- gap: 6,
362
- paddingHorizontal: 14,
363
- paddingVertical: 9,
364
- borderRadius: night.radius.row
365
- },
366
- buttonPrimary: {
367
- backgroundColor: night.color.accent
368
- },
369
- buttonPlate: {
370
- backgroundColor: night.color.button
371
- },
372
- buttonDisabled: {
373
- opacity: 0.55
374
- },
375
- buttonText: {
376
- fontSize: night.font.caption,
377
- fontWeight: "600"
378
- },
379
- buttonTextPrimary: {
380
- color: night.color.onAccent
381
- },
382
- buttonTextPlate: {
383
- color: night.color.text
384
- },
385
- pressed: {
386
- opacity: 0.7
387
- }
388
- });
389
- //# sourceMappingURL=primitives.js.map
1
+ "use strict";import{useState}from"react";import{ActivityIndicator,Pressable,StyleSheet,Text,View}from"react-native";import{Check,ChevronDown,ChevronUp,night,X}from"@buoy-gg/shared-ui";import{actionKey,useBlockHandlers}from"./context";import{pageState}from"./pageState";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export function toneColor(e){switch(e){case"accent":return night.color.accent;case"warning":return night.color.warning;case"danger":return night.color.danger;case"info":return night.color.info;case"muted":return night.color.textTertiary;default:return night.color.text}}export function ProvenanceBadge({source:e}){if(!e||"live"===e)return null;const t="changed"===e?"CHANGED BY ASK BUOY":"mocked"===e?"MOCKED":"FROM THE MODEL",o="changed"===e?night.color.warning:"mocked"===e?night.color.danger:night.color.textTertiary;return _jsx(View,{style:[styles.badge,{borderColor:o}],children:_jsx(Text,{style:[styles.badgeText,{color:o}],children:t})})}export function Card({title:e,source:t,children:o,testID:r,tone:n,collapsible:i,summary:l}){const[s,c]=useState(!1),a=!!i&&!s;return _jsxs(View,{style:[styles.card,"warning"===n&&styles.cardWarning,"danger"===n&&styles.cardDanger,"info"===n&&styles.cardInfo],testID:r,children:[(e||t&&"live"!==t)&&_jsxs(View,{style:styles.titleRow,children:[e?_jsx(Text,{style:styles.title,numberOfLines:2,children:e}):_jsx(View,{style:styles.flex}),_jsx(ProvenanceBadge,{source:t})]}),i?_jsxs(Pressable,{testID:r?`${r}-toggle`:void 0,onPress:()=>c(e=>!e),accessibilityRole:"button",accessibilityState:{expanded:s},accessibilityLabel:`${l??"Details"}, ${s?"hide":"show"}`,style:({pressed:e})=>[styles.disclosure,!a&&styles.disclosureOpen,e&&styles.pressed],children:[_jsx(Text,{style:styles.disclosureText,numberOfLines:1,children:l??"Details"}),_jsx(a?ChevronDown:ChevronUp,{size:12,color:night.color.textTertiary})]}):null,a?null:o]})}const PAGE_STEP=5;export function usePaged(e,t,o=5){const[r,n]=useState(t),{hidden:i,next:l,expanded:s,canExpand:c,canCollapse:a}=pageState(e.length,t,r,o);return{visible:e.slice(0,r),hidden:i,next:l,expanded:s,showMore:c?()=>n(e=>e+o):void 0,showLess:a?()=>n(t):void 0}}export function More({paged:e}){const{next:t,showMore:o,showLess:r}=e;return o||r?_jsxs(View,{style:styles.moreRow,children:[o?_jsxs(Pressable,{testID:"buoy-block-show-more",onPress:o,style:[styles.more,styles.moreCell],accessibilityRole:"button",children:[_jsxs(Text,{style:styles.moreText,children:["Show ",t," more"]}),_jsx(ChevronDown,{size:12,color:night.color.textTertiary})]}):null,r?_jsxs(Pressable,{testID:"buoy-block-show-fewer",onPress:r,style:[styles.more,styles.moreCell],accessibilityRole:"button",children:[_jsx(Text,{style:styles.moreText,children:"Show fewer"}),_jsx(ChevronUp,{size:12,color:night.color.textTertiary})]}):null]}):null}export function MoreNote({shown:e,total:t}){return!t||t<=e?null:_jsx(View,{style:styles.more,children:_jsxs(Text,{style:styles.moreNote,children:[e," of ",t," shown"]})})}export function ActionRow({actions:e,blockId:t,align:o="left"}){const r=useBlockHandlers();if(!e?.length)return null;const n=e.filter(e=>e.openTool?!1!==r.supports?.openTool:e.minimize?!1!==r.supports?.minimize:!e.dispatch||!1!==r.supports?.dispatch);return 0===n.length?null:_jsx(View,{style:[styles.actions,"right"===o&&styles.actionsRight],children:n.slice(0,2).map(e=>{const o=r.actionState?.[actionKey(t,e)],n=!!r.busy||"running"===o||"done"===o;return _jsxs(Pressable,{accessibilityRole:"button",accessibilityLabel:e.label,testID:`buoy-block-action-${e.label.toLowerCase().replace(/\s+/g,"-")}`,disabled:n,onPress:()=>{r.runAction(e,t)},style:({pressed:t})=>[styles.button,e.primary?styles.buttonPrimary:styles.buttonPlate,n&&styles.buttonDisabled,t&&!n&&styles.pressed],children:["running"===o?_jsx(ActivityIndicator,{size:"small",color:e.primary?night.color.onAccent:night.color.text}):"done"===o?_jsx(Check,{size:12,color:e.primary?night.color.onAccent:night.color.accent}):"failed"===o?_jsx(X,{size:12,color:night.color.danger}):null,_jsx(Text,{style:[styles.buttonText,e.primary?styles.buttonTextPrimary:styles.buttonTextPlate],children:e.label})]},e.label)})})}export const blockStyles=StyleSheet.create({row:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:12,paddingVertical:9},rowDivider:{borderTopWidth:StyleSheet.hairlineWidth,borderTopColor:night.color.separator},rowTitle:{flex:1,color:night.color.text,fontSize:night.font.body,lineHeight:19},rowSub:{color:night.color.textSecondary,fontSize:night.font.caption,lineHeight:17},rowTrailing:{color:night.color.textTertiary,fontSize:night.font.caption,maxWidth:120,textAlign:"right"},mono:{fontFamily:"Menlo",fontSize:12,color:night.color.text},pill:{paddingHorizontal:7,paddingVertical:2,borderRadius:night.radius.badge,backgroundColor:night.color.fill},pillText:{fontSize:night.font.micro,fontWeight:"700",letterSpacing:.4,color:night.color.textSecondary}});const styles=StyleSheet.create({card:{borderRadius:night.radius.card,borderWidth:StyleSheet.hairlineWidth,borderColor:night.color.border,backgroundColor:night.color.surface,overflow:"hidden"},cardWarning:{borderColor:night.color.warning,backgroundColor:night.color.warningSoft},cardDanger:{borderColor:night.color.danger,backgroundColor:night.color.dangerSoft},cardInfo:{borderColor:night.color.accentBorderStrong,backgroundColor:night.color.accentSoft},titleRow:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingTop:10,paddingBottom:6},flex:{flex:1},title:{flex:1,color:night.color.text,fontSize:night.font.caption,fontWeight:"600"},disclosure:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingVertical:9},disclosureOpen:{borderBottomWidth:StyleSheet.hairlineWidth,borderBottomColor:night.color.separator},disclosureText:{flex:1,color:night.color.textSecondary,fontSize:night.font.caption},badge:{borderWidth:StyleSheet.hairlineWidth,borderRadius: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:StyleSheet.hairlineWidth,borderTopColor:night.color.separator},moreCell:{flex:1},moreText:{color:night.color.textSecondary,fontSize:night.font.caption,fontWeight:"600"},moreNote:{color:night.color.textTertiary,fontSize: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:night.radius.row},buttonPrimary:{backgroundColor:night.color.accent},buttonPlate:{backgroundColor:night.color.button},buttonDisabled:{opacity:.55},buttonText:{fontSize:night.font.caption,fontWeight:"600"},buttonTextPrimary:{color:night.color.onAccent},buttonTextPlate:{color:night.color.text},pressed:{opacity:.7}});
@@ -1,5 +1 @@
1
- "use strict";
2
-
3
- export { ActionRow, blockStyles, Card, More, MoreNote, ProvenanceBadge, toneColor, usePaged } from "./primitives";
4
- export { useBlockHandlers } from "./context";
5
- //# sourceMappingURL=primitivesIndex.js.map
1
+ "use strict";export{ActionRow,blockStyles,Card,More,MoreNote,ProvenanceBadge,toneColor,usePaged}from"./primitives";export{useBlockHandlers}from"./context";