@buoy-gg/ask-buoy 7.0.34 → 7.0.35
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.
- package/README.md +1 -1
- package/lib/commonjs/blocks/AskBlocks.js +338 -1
- package/lib/commonjs/blocks/AskBlocks.js.map +1 -0
- package/lib/commonjs/blocks/BlockRenderer.js +250 -1
- package/lib/commonjs/blocks/BlockRenderer.js.map +1 -0
- package/lib/commonjs/blocks/ChromePrototypes.js +514 -1
- package/lib/commonjs/blocks/ChromePrototypes.js.map +1 -0
- package/lib/commonjs/blocks/DataBlocks.js +688 -1
- package/lib/commonjs/blocks/DataBlocks.js.map +1 -0
- package/lib/commonjs/blocks/ExtraBlocks.js +1854 -1
- package/lib/commonjs/blocks/ExtraBlocks.js.map +1 -0
- package/lib/commonjs/blocks/MediaBlocks.js +140 -1
- package/lib/commonjs/blocks/MediaBlocks.js.map +1 -0
- package/lib/commonjs/blocks/ReceiptBlocks.js +586 -1
- package/lib/commonjs/blocks/ReceiptBlocks.js.map +1 -0
- package/lib/commonjs/blocks/context.js +42 -1
- package/lib/commonjs/blocks/context.js.map +1 -0
- package/lib/commonjs/blocks/icons.js +96 -1
- package/lib/commonjs/blocks/icons.js.map +1 -0
- package/lib/commonjs/blocks/index.js +95 -1
- package/lib/commonjs/blocks/index.js.map +1 -0
- package/lib/commonjs/blocks/listRow.test.js +55 -0
- package/lib/commonjs/blocks/listRow.test.js.map +1 -0
- package/lib/commonjs/blocks/pageState.js +34 -0
- package/lib/commonjs/blocks/pageState.js.map +1 -0
- package/lib/commonjs/blocks/pageState.test.js +57 -0
- package/lib/commonjs/blocks/pageState.test.js.map +1 -0
- package/lib/commonjs/blocks/primitives.js +401 -1
- package/lib/commonjs/blocks/primitives.js.map +1 -0
- package/lib/commonjs/blocks/primitivesIndex.js +62 -1
- package/lib/commonjs/blocks/primitivesIndex.js.map +1 -0
- package/lib/commonjs/components/ApprovalCard.js +140 -1
- package/lib/commonjs/components/ApprovalCard.js.map +1 -0
- package/lib/commonjs/components/AskBuoyHeader.js +164 -1
- package/lib/commonjs/components/AskBuoyHeader.js.map +1 -0
- package/lib/commonjs/components/AskBuoyIcon.js +19 -1
- package/lib/commonjs/components/AskBuoyIcon.js.map +1 -0
- package/lib/commonjs/components/AskBuoyModal.js +353 -1
- package/lib/commonjs/components/AskBuoyModal.js.map +1 -0
- package/lib/commonjs/components/AskBuoySettings.js +69 -0
- package/lib/commonjs/components/AskBuoySettings.js.map +1 -0
- package/lib/commonjs/components/ChangesBar.js +211 -1
- package/lib/commonjs/components/ChangesBar.js.map +1 -0
- package/lib/commonjs/components/Composer.js +175 -1
- package/lib/commonjs/components/Composer.js.map +1 -0
- package/lib/commonjs/components/EmptyState.js +154 -1
- package/lib/commonjs/components/EmptyState.js.map +1 -0
- package/lib/commonjs/components/Markdown.js +252 -1
- package/lib/commonjs/components/Markdown.js.map +1 -0
- package/lib/commonjs/components/MessageList.js +683 -1
- package/lib/commonjs/components/MessageList.js.map +1 -0
- package/lib/commonjs/components/ThinkingStrip.js +223 -0
- package/lib/commonjs/components/ThinkingStrip.js.map +1 -0
- package/lib/commonjs/components/TypingDots.js +63 -1
- package/lib/commonjs/components/TypingDots.js.map +1 -0
- package/lib/commonjs/components/useCopyAction.js +50 -0
- package/lib/commonjs/components/useCopyAction.js.map +1 -0
- package/lib/commonjs/index.js +252 -1
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/preset.js +90 -1
- package/lib/commonjs/preset.js.map +1 -0
- package/lib/commonjs/store/askBuoySettings.js +67 -0
- package/lib/commonjs/store/askBuoySettings.js.map +1 -0
- package/lib/commonjs/store/askBuoyStore.js +365 -1
- package/lib/commonjs/store/askBuoyStore.js.map +1 -0
- package/lib/commonjs/store/restoredIds.test.js +47 -0
- package/lib/commonjs/store/restoredIds.test.js.map +1 -0
- package/lib/commonjs/store/traceText.js +81 -0
- package/lib/commonjs/store/traceText.js.map +1 -0
- package/lib/commonjs/store/traceText.test.js +112 -0
- package/lib/commonjs/store/traceText.test.js.map +1 -0
- package/lib/commonjs/store/transcriptPersistence.js +208 -0
- package/lib/commonjs/store/transcriptPersistence.js.map +1 -0
- package/lib/commonjs/store/transcriptPersistence.test.js +185 -0
- package/lib/commonjs/store/transcriptPersistence.test.js.map +1 -0
- package/lib/commonjs/store/useAskBuoy.js +400 -1
- package/lib/commonjs/store/useAskBuoy.js.map +1 -0
- package/lib/commonjs/store/useAskBuoySettings.js +14 -0
- package/lib/commonjs/store/useAskBuoySettings.js.map +1 -0
- package/lib/commonjs/sync/askBuoySyncAdapter.js +119 -1
- package/lib/commonjs/sync/askBuoySyncAdapter.js.map +1 -0
- package/lib/commonjs/sync/askBuoySyncAdapter.test.js +141 -1
- package/lib/commonjs/sync/askBuoySyncAdapter.test.js.map +1 -0
- package/lib/commonjs/sync/wire.js +58 -1
- package/lib/commonjs/sync/wire.js.map +1 -0
- package/lib/commonjs/types.js +6 -1
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/blocks/AskBlocks.js +331 -1
- package/lib/module/blocks/AskBlocks.js.map +1 -0
- package/lib/module/blocks/BlockRenderer.js +245 -1
- package/lib/module/blocks/BlockRenderer.js.map +1 -0
- package/lib/module/blocks/ChromePrototypes.js +503 -1
- package/lib/module/blocks/ChromePrototypes.js.map +1 -0
- package/lib/module/blocks/DataBlocks.js +674 -1
- package/lib/module/blocks/DataBlocks.js.map +1 -0
- package/lib/module/blocks/ExtraBlocks.js +1827 -1
- package/lib/module/blocks/ExtraBlocks.js.map +1 -0
- package/lib/module/blocks/MediaBlocks.js +135 -1
- package/lib/module/blocks/MediaBlocks.js.map +1 -0
- package/lib/module/blocks/ReceiptBlocks.js +574 -1
- package/lib/module/blocks/ReceiptBlocks.js.map +1 -0
- package/lib/module/blocks/context.js +35 -1
- package/lib/module/blocks/context.js.map +1 -0
- package/lib/module/blocks/icons.js +91 -1
- package/lib/module/blocks/icons.js.map +1 -0
- package/lib/module/blocks/index.js +8 -1
- package/lib/module/blocks/index.js.map +1 -0
- package/lib/module/blocks/listRow.test.js +56 -0
- package/lib/module/blocks/listRow.test.js.map +1 -0
- package/lib/module/blocks/pageState.js +30 -0
- package/lib/module/blocks/pageState.js.map +1 -0
- package/lib/module/blocks/pageState.test.js +56 -0
- package/lib/module/blocks/pageState.test.js.map +1 -0
- package/lib/module/blocks/primitives.js +389 -1
- package/lib/module/blocks/primitives.js.map +1 -0
- package/lib/module/blocks/primitivesIndex.js +5 -1
- package/lib/module/blocks/primitivesIndex.js.map +1 -0
- package/lib/module/components/ApprovalCard.js +135 -1
- package/lib/module/components/ApprovalCard.js.map +1 -0
- package/lib/module/components/AskBuoyHeader.js +161 -1
- package/lib/module/components/AskBuoyHeader.js.map +1 -0
- package/lib/module/components/AskBuoyIcon.js +8 -1
- package/lib/module/components/AskBuoyIcon.js.map +1 -0
- package/lib/module/components/AskBuoyModal.js +348 -1
- package/lib/module/components/AskBuoyModal.js.map +1 -0
- package/lib/module/components/AskBuoySettings.js +64 -0
- package/lib/module/components/AskBuoySettings.js.map +1 -0
- package/lib/module/components/ChangesBar.js +206 -1
- package/lib/module/components/ChangesBar.js.map +1 -0
- package/lib/module/components/Composer.js +170 -1
- package/lib/module/components/Composer.js.map +1 -0
- package/lib/module/components/EmptyState.js +149 -1
- package/lib/module/components/EmptyState.js.map +1 -0
- package/lib/module/components/Markdown.js +246 -1
- package/lib/module/components/Markdown.js.map +1 -0
- package/lib/module/components/MessageList.js +677 -1
- package/lib/module/components/MessageList.js.map +1 -0
- package/lib/module/components/ThinkingStrip.js +218 -0
- package/lib/module/components/ThinkingStrip.js.map +1 -0
- package/lib/module/components/TypingDots.js +58 -1
- package/lib/module/components/TypingDots.js.map +1 -0
- package/lib/module/components/useCopyAction.js +46 -0
- package/lib/module/components/useCopyAction.js.map +1 -0
- package/lib/module/index.js +34 -1
- package/lib/module/index.js.map +1 -0
- package/lib/module/preset.js +73 -1
- package/lib/module/preset.js.map +1 -0
- package/lib/module/store/askBuoySettings.js +62 -0
- package/lib/module/store/askBuoySettings.js.map +1 -0
- package/lib/module/store/askBuoyStore.js +361 -1
- package/lib/module/store/askBuoyStore.js.map +1 -0
- package/lib/module/store/restoredIds.test.js +46 -0
- package/lib/module/store/restoredIds.test.js.map +1 -0
- package/lib/module/store/traceText.js +75 -0
- package/lib/module/store/traceText.js.map +1 -0
- package/lib/module/store/traceText.test.js +111 -0
- package/lib/module/store/traceText.test.js.map +1 -0
- package/lib/module/store/transcriptPersistence.js +198 -0
- package/lib/module/store/transcriptPersistence.js.map +1 -0
- package/lib/module/store/transcriptPersistence.test.js +184 -0
- package/lib/module/store/transcriptPersistence.test.js.map +1 -0
- package/lib/module/store/useAskBuoy.js +394 -1
- package/lib/module/store/useAskBuoy.js.map +1 -0
- package/lib/module/store/useAskBuoySettings.js +9 -0
- package/lib/module/store/useAskBuoySettings.js.map +1 -0
- package/lib/module/sync/askBuoySyncAdapter.js +114 -1
- package/lib/module/sync/askBuoySyncAdapter.js.map +1 -0
- package/lib/module/sync/askBuoySyncAdapter.test.js +140 -1
- package/lib/module/sync/askBuoySyncAdapter.test.js.map +1 -0
- package/lib/module/sync/wire.js +47 -1
- package/lib/module/sync/wire.js.map +1 -0
- package/lib/module/types.js +4 -1
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/blocks/AskBlocks.d.ts.map +1 -0
- package/lib/typescript/blocks/BlockRenderer.d.ts.map +1 -0
- package/lib/typescript/blocks/ChromePrototypes.d.ts.map +1 -0
- package/lib/typescript/blocks/DataBlocks.d.ts +31 -0
- package/lib/typescript/blocks/DataBlocks.d.ts.map +1 -0
- package/lib/typescript/blocks/ExtraBlocks.d.ts +11 -0
- package/lib/typescript/blocks/ExtraBlocks.d.ts.map +1 -0
- package/lib/typescript/blocks/MediaBlocks.d.ts.map +1 -0
- package/lib/typescript/blocks/ReceiptBlocks.d.ts.map +1 -0
- package/lib/typescript/blocks/context.d.ts.map +1 -0
- package/lib/typescript/blocks/icons.d.ts.map +1 -0
- package/lib/typescript/blocks/index.d.ts.map +1 -0
- package/lib/typescript/blocks/listRow.test.d.ts +2 -0
- package/lib/typescript/blocks/listRow.test.d.ts.map +1 -0
- package/lib/typescript/blocks/pageState.d.ts +23 -0
- package/lib/typescript/blocks/pageState.d.ts.map +1 -0
- package/lib/typescript/blocks/pageState.test.d.ts +2 -0
- package/lib/typescript/blocks/pageState.test.d.ts.map +1 -0
- package/lib/typescript/blocks/primitives.d.ts +39 -9
- package/lib/typescript/blocks/primitives.d.ts.map +1 -0
- package/lib/typescript/blocks/primitivesIndex.d.ts +2 -1
- package/lib/typescript/blocks/primitivesIndex.d.ts.map +1 -0
- package/lib/typescript/components/ApprovalCard.d.ts.map +1 -0
- package/lib/typescript/components/AskBuoyHeader.d.ts +11 -1
- package/lib/typescript/components/AskBuoyHeader.d.ts.map +1 -0
- package/lib/typescript/components/AskBuoyIcon.d.ts.map +1 -0
- package/lib/typescript/components/AskBuoyModal.d.ts.map +1 -0
- package/lib/typescript/components/AskBuoySettings.d.ts +2 -0
- package/lib/typescript/components/AskBuoySettings.d.ts.map +1 -0
- package/lib/typescript/components/ChangesBar.d.ts.map +1 -0
- package/lib/typescript/components/Composer.d.ts.map +1 -0
- package/lib/typescript/components/EmptyState.d.ts.map +1 -0
- package/lib/typescript/components/Markdown.d.ts.map +1 -0
- package/lib/typescript/components/MessageList.d.ts +12 -5
- package/lib/typescript/components/MessageList.d.ts.map +1 -0
- package/lib/typescript/components/ThinkingStrip.d.ts +5 -0
- package/lib/typescript/components/ThinkingStrip.d.ts.map +1 -0
- package/lib/typescript/components/TypingDots.d.ts.map +1 -0
- package/lib/typescript/components/useCopyAction.d.ts +5 -0
- package/lib/typescript/components/useCopyAction.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +5 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/preset.d.ts.map +1 -0
- package/lib/typescript/store/askBuoySettings.d.ts +22 -0
- package/lib/typescript/store/askBuoySettings.d.ts.map +1 -0
- package/lib/typescript/store/askBuoyStore.d.ts +74 -13
- package/lib/typescript/store/askBuoyStore.d.ts.map +1 -0
- package/lib/typescript/store/restoredIds.test.d.ts +2 -0
- package/lib/typescript/store/restoredIds.test.d.ts.map +1 -0
- package/lib/typescript/store/traceText.d.ts +33 -0
- package/lib/typescript/store/traceText.d.ts.map +1 -0
- package/lib/typescript/store/traceText.test.d.ts +2 -0
- package/lib/typescript/store/traceText.test.d.ts.map +1 -0
- package/lib/typescript/store/transcriptPersistence.d.ts +40 -0
- package/lib/typescript/store/transcriptPersistence.d.ts.map +1 -0
- package/lib/typescript/store/transcriptPersistence.test.d.ts +2 -0
- package/lib/typescript/store/transcriptPersistence.test.d.ts.map +1 -0
- package/lib/typescript/store/useAskBuoy.d.ts.map +1 -0
- package/lib/typescript/store/useAskBuoySettings.d.ts +3 -0
- package/lib/typescript/store/useAskBuoySettings.d.ts.map +1 -0
- package/lib/typescript/sync/askBuoySyncAdapter.d.ts.map +1 -0
- package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts.map +1 -0
- package/lib/typescript/sync/wire.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +24 -1
- package/lib/typescript/types.d.ts.map +1 -0
- package/package.json +8 -8
|
@@ -1 +1,91 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["View","StyleSheet","AlertTriangle","Check","Clock","Database","Eye","Globe","Image","ImageIcon","Info","Layers","Navigation","night","User","jsx","_jsx","BlockIcon","name","size","c","color","textSecondary","icon","accent","warning","info","style","styles","wrap","children","create","width","height","borderRadius","backgroundColor","fill","alignItems","justifyContent"],"sourceRoot":"../../../src","sources":["blocks/icons.tsx"],"mappings":";;AAAA;AACA,SAASA,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAC/C,SAASC,aAAa,EAAEC,KAAK,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,GAAG,EAAEC,KAAK,EAAEC,KAAK,IAAIC,SAAS,EAAEC,IAAI,EAAEC,MAAM,EAAEC,UAAU,EAAEC,KAAK,EAAEC,IAAI,QAAQ,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGlJ,OAAO,SAASC,SAASA,CAAC;EAAEC,IAAI;EAAEC,IAAI,GAAG;AAAsC,CAAC,EAAE;EAChF,MAAMC,CAAC,GAAGP,KAAK,CAACQ,KAAK,CAACC,aAAa;EACnC,MAAMC,IAAI,GAAG,CAAC,MAAM;IAClB,QAAQL,IAAI;MACV,KAAK,SAAS;QAAE,oBAAOF,IAAA,CAACT,KAAK;UAACY,IAAI,EAAEA,IAAK;UAACE,KAAK,EAAED;QAAE,CAAE,CAAC;MACtD,KAAK,SAAS;QAAE,oBAAOJ,IAAA,CAACX,QAAQ;UAACc,IAAI,EAAEA,IAAK;UAACE,KAAK,EAAED;QAAE,CAAE,CAAC;MACzD,KAAK,OAAO;QAAE,oBAAOJ,IAAA,CAACJ,UAAU;UAACO,IAAI,EAAEA,IAAK;UAACE,KAAK,EAAED;QAAE,CAAE,CAAC;MACzD,KAAK,QAAQ;QAAE,oBAAOJ,IAAA,CAACV,GAAG;UAACa,IAAI,EAAEA,IAAK;UAACE,KAAK,EAAED;QAAE,CAAE,CAAC;MACnD,KAAK,MAAM;QAAE,oBAAOJ,IAAA,CAACF,IAAI;UAACK,IAAI,EAAEA,IAAK;UAACE,KAAK,EAAED;QAAE,CAAE,CAAC;MAClD,KAAK,OAAO;QAAE,oBAAOJ,IAAA,CAACP,SAAS;UAACU,IAAI,EAAEA,IAAK;UAACE,KAAK,EAAED;QAAE,CAAE,CAAC;MACxD,KAAK,OAAO;QAAE,oBAAOJ,IAAA,CAACb,KAAK;UAACgB,IAAI,EAAEA,IAAK;UAACE,KAAK,EAAER,KAAK,CAACQ,KAAK,CAACG;QAAO,CAAE,CAAC;MACrE,KAAK,MAAM;QAAE,oBAAOR,IAAA,CAACd,aAAa;UAACiB,IAAI,EAAEA,IAAK;UAACE,KAAK,EAAER,KAAK,CAACQ,KAAK,CAACI;QAAQ,CAAE,CAAC;MAC7E,KAAK,MAAM;QAAE,oBAAOT,IAAA,CAACN,IAAI;UAACS,IAAI,EAAEA,IAAK;UAACE,KAAK,EAAER,KAAK,CAACQ,KAAK,CAACK;QAAK,CAAE,CAAC;MACjE,KAAK,OAAO;QAAE,oBAAOV,IAAA,CAACL,MAAM;UAACQ,IAAI,EAAEA,IAAK;UAACE,KAAK,EAAED;QAAE,CAAE,CAAC;MACrD,KAAK,OAAO;QAAE,oBAAOJ,IAAA,CAACL,MAAM;UAACQ,IAAI,EAAEA,IAAK;UAACE,KAAK,EAAED;QAAE,CAAE,CAAC;MACrD,KAAK,OAAO;QAAE,oBAAOJ,IAAA,CAACZ,KAAK;UAACe,IAAI,EAAEA,IAAK;UAACE,KAAK,EAAED;QAAE,CAAE,CAAC;IACtD;EACF,CAAC,EAAE,CAAC;EACJ,oBAAOJ,IAAA,CAAChB,IAAI;IAAC2B,KAAK,EAAEC,MAAM,CAACC,IAAK;IAAAC,QAAA,EAAEP;EAAI,CAAO,CAAC;AAChD;AAEA,MAAMK,MAAM,GAAG3B,UAAU,CAAC8B,MAAM,CAAC;EAC/BF,IAAI,EAAE;IAAEG,KAAK,EAAE,EAAE;IAAEC,MAAM,EAAE,EAAE;IAAEC,YAAY,EAAE,CAAC;IAAEC,eAAe,EAAEtB,KAAK,CAACQ,KAAK,CAACe,IAAI;IAAEC,UAAU,EAAE,QAAQ;IAAEC,cAAc,EAAE;EAAS;AACpI,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BlockRenderer","BlockHandlersProvider","useBlockHandlers","Card","ActionRow","ProvenanceBadge","MessageActions","ReasoningStrip","ElapsedRow","QueuedComposer","ReloadDivider","Timestamp","EditableUserBubble","LivePill"],"sourceRoot":"../../../src","sources":["blocks/index.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,qBAAqB,EAAEC,gBAAgB,QAA4B,WAAW;AACvF,SAASC,IAAI,EAAEC,SAAS,EAAEC,eAAe,QAAQ,cAAc;AAC/D,SAASC,cAAc,EAAEC,cAAc,EAAEC,UAAU,EAAEC,cAAc,EAAEC,aAAa,EAAEC,SAAS,EAAEC,kBAAkB,QAAQ,oBAAoB;AAC7I,SAASC,QAAQ,QAAQ,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["describe","expect","it","listRowBehaviour","toEqual","canExpand","rowRunsAction","actionIsOwnControl","image","action","label","send","b","toBe"],"sourceRoot":"../../../src","sources":["blocks/listRow.test.ts"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAE7C,SAASC,gBAAgB,QAAQ,cAAc;;AAE/C;AACA;AACA;AACA;AACAH,QAAQ,CAAC,kBAAkB,EAAE,MAAM;EACjCE,EAAE,CAAC,iCAAiC,EAAE,MAAM;IAC1CD,MAAM,CAACE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAACC,OAAO,CAAC;MACnCC,SAAS,EAAE,KAAK;MAChBC,aAAa,EAAE,KAAK;MACpBC,kBAAkB,EAAE;IACtB,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFL,EAAE,CAAC,+BAA+B,EAAE,MAAM;IACxCD,MAAM,CAACE,gBAAgB,CAAC;MAAEK,KAAK,EAAE;IAAkB,CAAC,CAAC,CAAC,CAACJ,OAAO,CAAC;MAC7DC,SAAS,EAAE,IAAI;MACfC,aAAa,EAAE,KAAK;MACpBC,kBAAkB,EAAE;IACtB,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFL,EAAE,CAAC,+DAA+D,EAAE,MAAM;IACxED,MAAM,CAACE,gBAAgB,CAAC;MAAEM,MAAM,EAAE;QAAEC,KAAK,EAAE,OAAO;QAAEC,IAAI,EAAE;MAAQ;IAAE,CAAC,CAAC,CAAC,CAACP,OAAO,CAAC;MAC9EC,SAAS,EAAE,KAAK;MAChBC,aAAa,EAAE,IAAI;MACnBC,kBAAkB,EAAE;IACtB,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFL,EAAE,CAAC,2EAA2E,EAAE,MAAM;IACpF,MAAMU,CAAC,GAAGT,gBAAgB,CAAC;MAAEK,KAAK,EAAE,iBAAiB;MAAEC,MAAM,EAAE;QAAEC,KAAK,EAAE,OAAO;QAAEC,IAAI,EAAE;MAAQ;IAAE,CAAC,CAAC;IACnGV,MAAM,CAACW,CAAC,CAAC,CAACR,OAAO,CAAC;MAAEC,SAAS,EAAE,IAAI;MAAEC,aAAa,EAAE,KAAK;MAAEC,kBAAkB,EAAE;IAAK,CAAC,CAAC;IACtF;IACAN,MAAM,CAACW,CAAC,CAACN,aAAa,CAAC,CAACO,IAAI,CAAC,KAAK,CAAC;EACrC,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["pageState","count","cap","limit","step","shown","Math","min","hidden","max","expanded","next","canExpand","canCollapse"],"sourceRoot":"../../../src","sources":["blocks/pageState.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA,OAAO,SAASA,SAASA,CAACC,KAAa,EAAEC,GAAW,EAAEC,KAAa,EAAEC,IAAY,EAAa;EAC5F,MAAMC,KAAK,GAAGC,IAAI,CAACC,GAAG,CAACJ,KAAK,EAAEF,KAAK,CAAC;EACpC,MAAMO,MAAM,GAAGF,IAAI,CAACG,GAAG,CAAC,CAAC,EAAER,KAAK,GAAGI,KAAK,CAAC;EACzC;EACA;EACA;EACA,MAAMK,QAAQ,GAAGP,KAAK,GAAGD,GAAG,IAAID,KAAK,GAAGC,GAAG;EAC3C,OAAO;IACLM,MAAM;IACNG,IAAI,EAAEL,IAAI,CAACC,GAAG,CAACC,MAAM,EAAEJ,IAAI,CAAC;IAC5BM,QAAQ;IACRE,SAAS,EAAEJ,MAAM,GAAG,CAAC;IACrBK,WAAW,EAAEH;EACf,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["describe","expect","it","pageState","CAP","STEP","at","count","limit","s","hidden","toBe","canExpand","canCollapse","next","expanded"],"sourceRoot":"../../../src","sources":["blocks/pageState.test.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAE7C,SAASC,SAAS,QAAQ,aAAa;AAEvC,MAAMC,GAAG,GAAG,EAAE;AACd,MAAMC,IAAI,GAAG,CAAC;AACd,MAAMC,EAAE,GAAGA,CAACC,KAAa,EAAEC,KAAa,KAAKL,SAAS,CAACI,KAAK,EAAEH,GAAG,EAAEI,KAAK,EAAEH,IAAI,CAAC;AAE/EL,QAAQ,CAAC,wBAAwB,EAAE,MAAM;EACvCE,EAAE,CAAC,6CAA6C,EAAE,MAAM;IACtD,MAAMO,CAAC,GAAGH,EAAE,CAAC,CAAC,EAAEF,GAAG,CAAC;IACpBH,MAAM,CAACQ,CAAC,CAACC,MAAM,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC;IACxBV,MAAM,CAACQ,CAAC,CAACG,SAAS,CAAC,CAACD,IAAI,CAAC,KAAK,CAAC;IAC/BV,MAAM,CAACQ,CAAC,CAACI,WAAW,CAAC,CAACF,IAAI,CAAC,KAAK,CAAC;EACnC,CAAC,CAAC;EAEFT,EAAE,CAAC,6CAA6C,EAAE,MAAM;IACtD;IACA;IACA;IACAD,MAAM,CAACK,EAAE,CAAC,CAAC,EAAEF,GAAG,CAAC,CAACQ,SAAS,CAAC,CAACD,IAAI,CAAC,KAAK,CAAC;EAC1C,CAAC,CAAC;EAEFT,EAAE,CAAC,qDAAqD,EAAE,MAAM;IAC9D;IACAD,MAAM,CAACK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAACQ,IAAI,CAAC,CAACH,IAAI,CAAC,CAAC,CAAC;IAChCV,MAAM,CAACK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAACQ,IAAI,CAAC,CAACH,IAAI,CAAC,CAAC,CAAC;IAChCV,MAAM,CAACK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAACI,MAAM,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC;EACrC,CAAC,CAAC;EAEFT,EAAE,CAAC,4CAA4C,EAAE,MAAM;IACrD;IACAD,MAAM,CAACK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAACQ,IAAI,CAAC,CAACH,IAAI,CAAC,CAAC,CAAC;IAC/BV,MAAM,CAACK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAACM,SAAS,CAAC,CAACD,IAAI,CAAC,KAAK,CAAC;EAC1C,CAAC,CAAC;EAEFT,EAAE,CAAC,qDAAqD,EAAE,MAAM;IAC9DD,MAAM,CAACK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAACO,WAAW,CAAC,CAACF,IAAI,CAAC,KAAK,CAAC;IAC3CV,MAAM,CAACK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAACO,WAAW,CAAC,CAACF,IAAI,CAAC,IAAI,CAAC;IAC1CV,MAAM,CAACK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAACS,QAAQ,CAAC,CAACJ,IAAI,CAAC,IAAI,CAAC;EACzC,CAAC,CAAC;EAEFT,EAAE,CAAC,8CAA8C,EAAE,MAAM;IACvD;IACA;IACA;IACA,MAAMO,CAAC,GAAGH,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;IACnBL,MAAM,CAACQ,CAAC,CAACI,WAAW,CAAC,CAACF,IAAI,CAAC,KAAK,CAAC;IACjCV,MAAM,CAACQ,CAAC,CAACM,QAAQ,CAAC,CAACJ,IAAI,CAAC,KAAK,CAAC;IAC9BV,MAAM,CAACQ,CAAC,CAACC,MAAM,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC;EAC1B,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1,389 @@
|
|
|
1
|
-
"use strict";
|
|
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
|