@buoy-gg/ask-buoy 7.0.41 → 7.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -98
- package/lib/commonjs/blocks/AskBlocks.js +1 -338
- package/lib/commonjs/blocks/BlockRenderer.js +1 -262
- package/lib/commonjs/blocks/ChromePrototypes.js +1 -514
- package/lib/commonjs/blocks/DataBlocks.js +1 -783
- package/lib/commonjs/blocks/ExtraBlocks.js +1 -1862
- package/lib/commonjs/blocks/MediaBlocks.js +1 -158
- package/lib/commonjs/blocks/ReceiptBlocks.js +2 -592
- package/lib/commonjs/blocks/blockText.js +1 -60
- package/lib/commonjs/blocks/blockText.test.js +1 -53
- package/lib/commonjs/blocks/context.js +1 -42
- package/lib/commonjs/blocks/icons.js +1 -96
- package/lib/commonjs/blocks/index.js +1 -95
- package/lib/commonjs/blocks/listRow.test.js +1 -55
- package/lib/commonjs/blocks/pageState.js +1 -34
- package/lib/commonjs/blocks/pageState.test.js +1 -57
- package/lib/commonjs/blocks/primitives.js +1 -457
- package/lib/commonjs/blocks/primitivesIndex.js +1 -62
- package/lib/commonjs/blocks/ruleStates.js +1 -39
- package/lib/commonjs/components/ApprovalCard.js +1 -297
- package/lib/commonjs/components/AskBuoyHeader.js +1 -196
- package/lib/commonjs/components/AskBuoyIcon.js +1 -19
- package/lib/commonjs/components/AskBuoyModal.js +2 -482
- package/lib/commonjs/components/AskBuoySettings.js +1 -181
- package/lib/commonjs/components/ChangesBar.js +1 -212
- package/lib/commonjs/components/Composer.js +1 -255
- package/lib/commonjs/components/EmptyState.js +1 -161
- package/lib/commonjs/components/KeyboardPad.js +1 -80
- package/lib/commonjs/components/Markdown.js +1 -310
- package/lib/commonjs/components/MessageList.js +1 -970
- package/lib/commonjs/components/QueuedMessages.js +1 -145
- package/lib/commonjs/components/ThinkingStrip.js +1 -223
- package/lib/commonjs/components/TypingDots.js +1 -63
- package/lib/commonjs/components/markdownParse.js +1 -131
- package/lib/commonjs/components/markdownParse.test.js +1 -99
- package/lib/commonjs/components/useCopyAction.js +1 -50
- package/lib/commonjs/index.js +1 -252
- package/lib/commonjs/preset.js +1 -91
- package/lib/commonjs/store/activityGroups.js +1 -110
- package/lib/commonjs/store/activityGroups.test.js +1 -78
- package/lib/commonjs/store/askBuoySettings.js +1 -72
- package/lib/commonjs/store/askBuoyStore.js +2 -588
- package/lib/commonjs/store/blockPlacement.js +1 -64
- package/lib/commonjs/store/blockPlacement.test.js +1 -123
- package/lib/commonjs/store/queue.test.js +1 -150
- package/lib/commonjs/store/resetConversation.js +1 -77
- package/lib/commonjs/store/restorePending.test.js +1 -63
- package/lib/commonjs/store/restoredIds.test.js +1 -47
- package/lib/commonjs/store/suggestions.js +1 -54
- package/lib/commonjs/store/suggestions.test.js +1 -58
- package/lib/commonjs/store/systemLine.test.js +1 -77
- package/lib/commonjs/store/ticketPrompt.js +1 -17
- package/lib/commonjs/store/traceText.js +1 -81
- package/lib/commonjs/store/traceText.test.js +1 -112
- package/lib/commonjs/store/transcriptPersistence.js +1 -297
- package/lib/commonjs/store/transcriptPersistence.test.js +1 -333
- package/lib/commonjs/store/turnRendering.test.js +1 -151
- package/lib/commonjs/store/useAskBuoy.js +1 -651
- package/lib/commonjs/store/useAskBuoySettings.js +1 -14
- package/lib/commonjs/sync/askBuoySyncAdapter.js +1 -153
- package/lib/commonjs/sync/askBuoySyncAdapter.test.js +1 -141
- package/lib/commonjs/sync/wire.js +1 -58
- package/lib/commonjs/types.js +1 -6
- package/lib/module/blocks/AskBlocks.js +1 -331
- package/lib/module/blocks/BlockRenderer.js +1 -257
- package/lib/module/blocks/ChromePrototypes.js +1 -503
- package/lib/module/blocks/DataBlocks.js +1 -769
- package/lib/module/blocks/ExtraBlocks.js +1 -1835
- package/lib/module/blocks/MediaBlocks.js +1 -153
- package/lib/module/blocks/ReceiptBlocks.js +2 -580
- package/lib/module/blocks/blockText.js +1 -55
- package/lib/module/blocks/blockText.test.js +1 -53
- package/lib/module/blocks/context.js +1 -35
- package/lib/module/blocks/icons.js +1 -91
- package/lib/module/blocks/index.js +1 -8
- package/lib/module/blocks/listRow.test.js +1 -56
- package/lib/module/blocks/pageState.js +1 -30
- package/lib/module/blocks/pageState.test.js +1 -56
- package/lib/module/blocks/primitives.js +1 -445
- package/lib/module/blocks/primitivesIndex.js +1 -5
- package/lib/module/blocks/ruleStates.js +1 -35
- package/lib/module/components/ApprovalCard.js +1 -292
- package/lib/module/components/AskBuoyHeader.js +1 -193
- package/lib/module/components/AskBuoyIcon.js +1 -8
- package/lib/module/components/AskBuoyModal.js +2 -477
- package/lib/module/components/AskBuoySettings.js +1 -176
- package/lib/module/components/ChangesBar.js +1 -206
- package/lib/module/components/Composer.js +1 -250
- package/lib/module/components/EmptyState.js +1 -156
- package/lib/module/components/KeyboardPad.js +1 -75
- package/lib/module/components/Markdown.js +1 -305
- package/lib/module/components/MessageList.js +1 -964
- package/lib/module/components/QueuedMessages.js +1 -140
- package/lib/module/components/ThinkingStrip.js +1 -218
- package/lib/module/components/TypingDots.js +1 -58
- package/lib/module/components/markdownParse.js +1 -125
- package/lib/module/components/markdownParse.test.js +1 -98
- package/lib/module/components/useCopyAction.js +1 -46
- package/lib/module/index.js +1 -34
- package/lib/module/preset.js +1 -74
- package/lib/module/store/activityGroups.js +1 -103
- package/lib/module/store/activityGroups.test.js +1 -77
- package/lib/module/store/askBuoySettings.js +1 -67
- package/lib/module/store/askBuoyStore.js +2 -582
- package/lib/module/store/blockPlacement.js +1 -59
- package/lib/module/store/blockPlacement.test.js +1 -122
- package/lib/module/store/queue.test.js +1 -149
- package/lib/module/store/resetConversation.js +1 -72
- package/lib/module/store/restorePending.test.js +1 -62
- package/lib/module/store/restoredIds.test.js +1 -46
- package/lib/module/store/suggestions.js +1 -49
- package/lib/module/store/suggestions.test.js +1 -57
- package/lib/module/store/systemLine.test.js +1 -76
- package/lib/module/store/ticketPrompt.js +1 -13
- package/lib/module/store/traceText.js +1 -75
- package/lib/module/store/traceText.test.js +1 -111
- package/lib/module/store/transcriptPersistence.js +1 -287
- package/lib/module/store/transcriptPersistence.test.js +1 -332
- package/lib/module/store/turnRendering.test.js +1 -150
- package/lib/module/store/useAskBuoy.js +1 -646
- package/lib/module/store/useAskBuoySettings.js +1 -9
- package/lib/module/sync/askBuoySyncAdapter.js +1 -148
- package/lib/module/sync/askBuoySyncAdapter.test.js +1 -140
- package/lib/module/sync/wire.js +1 -47
- package/lib/module/types.js +1 -4
- package/lib/web/index.mjs +11 -12
- package/package.json +8 -8
- package/lib/commonjs/blocks/AskBlocks.js.map +0 -1
- package/lib/commonjs/blocks/BlockRenderer.js.map +0 -1
- package/lib/commonjs/blocks/ChromePrototypes.js.map +0 -1
- package/lib/commonjs/blocks/DataBlocks.js.map +0 -1
- package/lib/commonjs/blocks/ExtraBlocks.js.map +0 -1
- package/lib/commonjs/blocks/MediaBlocks.js.map +0 -1
- package/lib/commonjs/blocks/ReceiptBlocks.js.map +0 -1
- package/lib/commonjs/blocks/blockText.js.map +0 -1
- package/lib/commonjs/blocks/blockText.test.js.map +0 -1
- package/lib/commonjs/blocks/context.js.map +0 -1
- package/lib/commonjs/blocks/icons.js.map +0 -1
- package/lib/commonjs/blocks/index.js.map +0 -1
- package/lib/commonjs/blocks/listRow.test.js.map +0 -1
- package/lib/commonjs/blocks/pageState.js.map +0 -1
- package/lib/commonjs/blocks/pageState.test.js.map +0 -1
- package/lib/commonjs/blocks/primitives.js.map +0 -1
- package/lib/commonjs/blocks/primitivesIndex.js.map +0 -1
- package/lib/commonjs/blocks/ruleStates.js.map +0 -1
- package/lib/commonjs/components/ApprovalCard.js.map +0 -1
- package/lib/commonjs/components/AskBuoyHeader.js.map +0 -1
- package/lib/commonjs/components/AskBuoyIcon.js.map +0 -1
- package/lib/commonjs/components/AskBuoyModal.js.map +0 -1
- package/lib/commonjs/components/AskBuoySettings.js.map +0 -1
- package/lib/commonjs/components/ChangesBar.js.map +0 -1
- package/lib/commonjs/components/Composer.js.map +0 -1
- package/lib/commonjs/components/EmptyState.js.map +0 -1
- package/lib/commonjs/components/KeyboardPad.js.map +0 -1
- package/lib/commonjs/components/Markdown.js.map +0 -1
- package/lib/commonjs/components/MessageList.js.map +0 -1
- package/lib/commonjs/components/QueuedMessages.js.map +0 -1
- package/lib/commonjs/components/ThinkingStrip.js.map +0 -1
- package/lib/commonjs/components/TypingDots.js.map +0 -1
- package/lib/commonjs/components/markdownParse.js.map +0 -1
- package/lib/commonjs/components/markdownParse.test.js.map +0 -1
- package/lib/commonjs/components/useCopyAction.js.map +0 -1
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/preset.js.map +0 -1
- package/lib/commonjs/store/activityGroups.js.map +0 -1
- package/lib/commonjs/store/activityGroups.test.js.map +0 -1
- package/lib/commonjs/store/askBuoySettings.js.map +0 -1
- package/lib/commonjs/store/askBuoyStore.js.map +0 -1
- package/lib/commonjs/store/blockPlacement.js.map +0 -1
- package/lib/commonjs/store/blockPlacement.test.js.map +0 -1
- package/lib/commonjs/store/queue.test.js.map +0 -1
- package/lib/commonjs/store/resetConversation.js.map +0 -1
- package/lib/commonjs/store/restorePending.test.js.map +0 -1
- package/lib/commonjs/store/restoredIds.test.js.map +0 -1
- package/lib/commonjs/store/suggestions.js.map +0 -1
- package/lib/commonjs/store/suggestions.test.js.map +0 -1
- package/lib/commonjs/store/systemLine.test.js.map +0 -1
- package/lib/commonjs/store/ticketPrompt.js.map +0 -1
- package/lib/commonjs/store/traceText.js.map +0 -1
- package/lib/commonjs/store/traceText.test.js.map +0 -1
- package/lib/commonjs/store/transcriptPersistence.js.map +0 -1
- package/lib/commonjs/store/transcriptPersistence.test.js.map +0 -1
- package/lib/commonjs/store/turnRendering.test.js.map +0 -1
- package/lib/commonjs/store/useAskBuoy.js.map +0 -1
- package/lib/commonjs/store/useAskBuoySettings.js.map +0 -1
- package/lib/commonjs/sync/askBuoySyncAdapter.js.map +0 -1
- package/lib/commonjs/sync/askBuoySyncAdapter.test.js.map +0 -1
- package/lib/commonjs/sync/wire.js.map +0 -1
- package/lib/commonjs/types.js.map +0 -1
- package/lib/module/blocks/AskBlocks.js.map +0 -1
- package/lib/module/blocks/BlockRenderer.js.map +0 -1
- package/lib/module/blocks/ChromePrototypes.js.map +0 -1
- package/lib/module/blocks/DataBlocks.js.map +0 -1
- package/lib/module/blocks/ExtraBlocks.js.map +0 -1
- package/lib/module/blocks/MediaBlocks.js.map +0 -1
- package/lib/module/blocks/ReceiptBlocks.js.map +0 -1
- package/lib/module/blocks/blockText.js.map +0 -1
- package/lib/module/blocks/blockText.test.js.map +0 -1
- package/lib/module/blocks/context.js.map +0 -1
- package/lib/module/blocks/icons.js.map +0 -1
- package/lib/module/blocks/index.js.map +0 -1
- package/lib/module/blocks/listRow.test.js.map +0 -1
- package/lib/module/blocks/pageState.js.map +0 -1
- package/lib/module/blocks/pageState.test.js.map +0 -1
- package/lib/module/blocks/primitives.js.map +0 -1
- package/lib/module/blocks/primitivesIndex.js.map +0 -1
- package/lib/module/blocks/ruleStates.js.map +0 -1
- package/lib/module/components/ApprovalCard.js.map +0 -1
- package/lib/module/components/AskBuoyHeader.js.map +0 -1
- package/lib/module/components/AskBuoyIcon.js.map +0 -1
- package/lib/module/components/AskBuoyModal.js.map +0 -1
- package/lib/module/components/AskBuoySettings.js.map +0 -1
- package/lib/module/components/ChangesBar.js.map +0 -1
- package/lib/module/components/Composer.js.map +0 -1
- package/lib/module/components/EmptyState.js.map +0 -1
- package/lib/module/components/KeyboardPad.js.map +0 -1
- package/lib/module/components/Markdown.js.map +0 -1
- package/lib/module/components/MessageList.js.map +0 -1
- package/lib/module/components/QueuedMessages.js.map +0 -1
- package/lib/module/components/ThinkingStrip.js.map +0 -1
- package/lib/module/components/TypingDots.js.map +0 -1
- package/lib/module/components/markdownParse.js.map +0 -1
- package/lib/module/components/markdownParse.test.js.map +0 -1
- package/lib/module/components/useCopyAction.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/preset.js.map +0 -1
- package/lib/module/store/activityGroups.js.map +0 -1
- package/lib/module/store/activityGroups.test.js.map +0 -1
- package/lib/module/store/askBuoySettings.js.map +0 -1
- package/lib/module/store/askBuoyStore.js.map +0 -1
- package/lib/module/store/blockPlacement.js.map +0 -1
- package/lib/module/store/blockPlacement.test.js.map +0 -1
- package/lib/module/store/queue.test.js.map +0 -1
- package/lib/module/store/resetConversation.js.map +0 -1
- package/lib/module/store/restorePending.test.js.map +0 -1
- package/lib/module/store/restoredIds.test.js.map +0 -1
- package/lib/module/store/suggestions.js.map +0 -1
- package/lib/module/store/suggestions.test.js.map +0 -1
- package/lib/module/store/systemLine.test.js.map +0 -1
- package/lib/module/store/ticketPrompt.js.map +0 -1
- package/lib/module/store/traceText.js.map +0 -1
- package/lib/module/store/traceText.test.js.map +0 -1
- package/lib/module/store/transcriptPersistence.js.map +0 -1
- package/lib/module/store/transcriptPersistence.test.js.map +0 -1
- package/lib/module/store/turnRendering.test.js.map +0 -1
- package/lib/module/store/useAskBuoy.js.map +0 -1
- package/lib/module/store/useAskBuoySettings.js.map +0 -1
- package/lib/module/sync/askBuoySyncAdapter.js.map +0 -1
- package/lib/module/sync/askBuoySyncAdapter.test.js.map +0 -1
- package/lib/module/sync/wire.js.map +0 -1
- package/lib/module/types.js.map +0 -1
- package/lib/typescript/blocks/AskBlocks.d.ts.map +0 -1
- package/lib/typescript/blocks/BlockRenderer.d.ts.map +0 -1
- package/lib/typescript/blocks/ChromePrototypes.d.ts.map +0 -1
- package/lib/typescript/blocks/DataBlocks.d.ts.map +0 -1
- package/lib/typescript/blocks/ExtraBlocks.d.ts.map +0 -1
- package/lib/typescript/blocks/MediaBlocks.d.ts.map +0 -1
- package/lib/typescript/blocks/ReceiptBlocks.d.ts.map +0 -1
- package/lib/typescript/blocks/blockText.d.ts.map +0 -1
- package/lib/typescript/blocks/blockText.test.d.ts.map +0 -1
- package/lib/typescript/blocks/context.d.ts.map +0 -1
- package/lib/typescript/blocks/icons.d.ts.map +0 -1
- package/lib/typescript/blocks/index.d.ts.map +0 -1
- package/lib/typescript/blocks/listRow.test.d.ts.map +0 -1
- package/lib/typescript/blocks/pageState.d.ts.map +0 -1
- package/lib/typescript/blocks/pageState.test.d.ts.map +0 -1
- package/lib/typescript/blocks/primitives.d.ts.map +0 -1
- package/lib/typescript/blocks/primitivesIndex.d.ts.map +0 -1
- package/lib/typescript/blocks/ruleStates.d.ts.map +0 -1
- package/lib/typescript/components/ApprovalCard.d.ts.map +0 -1
- package/lib/typescript/components/AskBuoyHeader.d.ts.map +0 -1
- package/lib/typescript/components/AskBuoyIcon.d.ts.map +0 -1
- package/lib/typescript/components/AskBuoyModal.d.ts.map +0 -1
- package/lib/typescript/components/AskBuoySettings.d.ts.map +0 -1
- package/lib/typescript/components/ChangesBar.d.ts.map +0 -1
- package/lib/typescript/components/Composer.d.ts.map +0 -1
- package/lib/typescript/components/EmptyState.d.ts.map +0 -1
- package/lib/typescript/components/KeyboardPad.d.ts.map +0 -1
- package/lib/typescript/components/Markdown.d.ts.map +0 -1
- package/lib/typescript/components/MessageList.d.ts.map +0 -1
- package/lib/typescript/components/QueuedMessages.d.ts.map +0 -1
- package/lib/typescript/components/ThinkingStrip.d.ts.map +0 -1
- package/lib/typescript/components/TypingDots.d.ts.map +0 -1
- package/lib/typescript/components/markdownParse.d.ts.map +0 -1
- package/lib/typescript/components/markdownParse.test.d.ts.map +0 -1
- package/lib/typescript/components/useCopyAction.d.ts.map +0 -1
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
- package/lib/typescript/store/activityGroups.d.ts.map +0 -1
- package/lib/typescript/store/activityGroups.test.d.ts.map +0 -1
- package/lib/typescript/store/askBuoySettings.d.ts.map +0 -1
- package/lib/typescript/store/askBuoyStore.d.ts.map +0 -1
- package/lib/typescript/store/blockPlacement.d.ts.map +0 -1
- package/lib/typescript/store/blockPlacement.test.d.ts.map +0 -1
- package/lib/typescript/store/queue.test.d.ts.map +0 -1
- package/lib/typescript/store/resetConversation.d.ts.map +0 -1
- package/lib/typescript/store/restorePending.test.d.ts.map +0 -1
- package/lib/typescript/store/restoredIds.test.d.ts.map +0 -1
- package/lib/typescript/store/suggestions.d.ts.map +0 -1
- package/lib/typescript/store/suggestions.test.d.ts.map +0 -1
- package/lib/typescript/store/systemLine.test.d.ts.map +0 -1
- package/lib/typescript/store/ticketPrompt.d.ts.map +0 -1
- package/lib/typescript/store/traceText.d.ts.map +0 -1
- package/lib/typescript/store/traceText.test.d.ts.map +0 -1
- package/lib/typescript/store/transcriptPersistence.d.ts.map +0 -1
- package/lib/typescript/store/transcriptPersistence.test.d.ts.map +0 -1
- package/lib/typescript/store/turnRendering.test.d.ts.map +0 -1
- package/lib/typescript/store/useAskBuoy.d.ts.map +0 -1
- package/lib/typescript/store/useAskBuoySettings.d.ts.map +0 -1
- package/lib/typescript/sync/askBuoySyncAdapter.d.ts.map +0 -1
- package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts.map +0 -1
- package/lib/typescript/sync/wire.d.ts.map +0 -1
- package/lib/typescript/types.d.ts.map +0 -1
|
@@ -1,53 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { describe, expect, it } from "vitest";
|
|
4
|
-
import { blockToText, blocksToText } from "./blockText";
|
|
5
|
-
describe("blockToText", () => {
|
|
6
|
-
it("writes a finding as title and evidence rows", () => {
|
|
7
|
-
expect(blockToText({
|
|
8
|
-
id: "f1",
|
|
9
|
-
kind: "finding",
|
|
10
|
-
title: "Bag screen empty after /api/bag 500",
|
|
11
|
-
evidence: [{
|
|
12
|
-
label: "Steps",
|
|
13
|
-
value: "Open Bag as user 4412"
|
|
14
|
-
}, {
|
|
15
|
-
label: "Observed",
|
|
16
|
-
value: "empty state, no error shown",
|
|
17
|
-
tone: "danger"
|
|
18
|
-
}]
|
|
19
|
-
})).toBe("Bag screen empty after /api/bag 500\nSteps: Open Bag as user 4412\nObserved: empty state, no error shown");
|
|
20
|
-
});
|
|
21
|
-
it("writes a table with its cut noted", () => {
|
|
22
|
-
expect(blockToText({
|
|
23
|
-
id: "t1",
|
|
24
|
-
kind: "table",
|
|
25
|
-
columns: ["Item", "Qty"],
|
|
26
|
-
rows: [["Charizard", {
|
|
27
|
-
text: "14"
|
|
28
|
-
}]],
|
|
29
|
-
total: 30
|
|
30
|
-
})).toBe("Item | Qty\nCharizard | 14\n… 29 more rows");
|
|
31
|
-
});
|
|
32
|
-
it("names a card it cannot flatten instead of skipping it", () => {
|
|
33
|
-
expect(blockToText({
|
|
34
|
-
id: "d1",
|
|
35
|
-
kind: "diff",
|
|
36
|
-
title: "Bag store",
|
|
37
|
-
before: {},
|
|
38
|
-
after: {}
|
|
39
|
-
})).toBe("[diff card: Bag store]");
|
|
40
|
-
});
|
|
41
|
-
it("drops blocks with nothing to say", () => {
|
|
42
|
-
expect(blocksToText([{
|
|
43
|
-
id: "p",
|
|
44
|
-
kind: "peek"
|
|
45
|
-
}, {
|
|
46
|
-
id: "n",
|
|
47
|
-
kind: "notice",
|
|
48
|
-
tone: "info",
|
|
49
|
-
text: "hi"
|
|
50
|
-
}])).toEqual(["hi"]);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
//# sourceMappingURL=blockText.test.js.map
|
|
1
|
+
"use strict";import{describe as a,expect as e,it as t}from"vitest";import{blockToText as i,blocksToText as n}from"./blockText";a("blockToText",()=>{t("writes a finding as title and evidence rows",()=>{e(i({id:"f1",kind:"finding",title:"Bag screen empty after /api/bag 500",evidence:[{label:"Steps",value:"Open Bag as user 4412"},{label:"Observed",value:"empty state, no error shown",tone:"danger"}]})).toBe("Bag screen empty after /api/bag 500\nSteps: Open Bag as user 4412\nObserved: empty state, no error shown")});t("writes a table with its cut noted",()=>{e(i({id:"t1",kind:"table",columns:["Item","Qty"],rows:[["Charizard",{text:"14"}]],total:30})).toBe("Item | Qty\nCharizard | 14\n\u2026 29 more rows")});t("names a card it cannot flatten instead of skipping it",()=>{e(i({id:"d1",kind:"diff",title:"Bag store",before:{},after:{}})).toBe("[diff card: Bag store]")});t("drops blocks with nothing to say",()=>{e(n([{id:"p",kind:"peek"},{id:"n",kind:"notice",tone:"info",text:"hi"}])).toEqual(["hi"])})});
|
|
@@ -1,35 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* How a block talks back to the sheet.
|
|
5
|
-
*
|
|
6
|
-
* Blocks are pure data; everything that happens when one is tapped goes
|
|
7
|
-
* through this context so the same renderers work inside the real transcript,
|
|
8
|
-
* on the example app's review page, and (later) on the desktop with a
|
|
9
|
-
* different set of handlers behind them.
|
|
10
|
-
*/
|
|
11
|
-
import { createContext, useContext } from "react";
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
const noop = {
|
|
14
|
-
answer: () => {},
|
|
15
|
-
runAction: () => {},
|
|
16
|
-
answered: {},
|
|
17
|
-
supports: {}
|
|
18
|
-
};
|
|
19
|
-
const Ctx = /*#__PURE__*/createContext(noop);
|
|
20
|
-
export function BlockHandlersProvider({
|
|
21
|
-
value,
|
|
22
|
-
children
|
|
23
|
-
}) {
|
|
24
|
-
return /*#__PURE__*/_jsx(Ctx.Provider, {
|
|
25
|
-
value: value,
|
|
26
|
-
children: children
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
export function useBlockHandlers() {
|
|
30
|
-
return useContext(Ctx);
|
|
31
|
-
}
|
|
32
|
-
export function actionKey(blockId, action) {
|
|
33
|
-
return `${blockId}:${action.label}`;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=context.js.map
|
|
1
|
+
"use strict";import{createContext as o,useContext as n}from"react";import{jsx as s}from"react/jsx-runtime";const c={answer:()=>{},runAction:()=>{},answered:{},supports:{}};const t=o(c);export function BlockHandlersProvider({value:r,children:e}){return s(t.Provider,{value:r,children:e})}export function useBlockHandlers(){return n(t)}export function actionKey(r,e){return`${r}:${e.label}`}
|
|
@@ -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 as a,StyleSheet as l}from"react-native";import{AlertTriangle as i,Check as u,Clock as g,Database as m,Eye as f,Globe as h,Image as w,Info as y,Layers as t,Navigation as k,night as c,User as d}from"@buoy-gg/shared-ui";import{jsx as r}from"react/jsx-runtime";export function BlockIcon({name:n,size:e=14}){const o=c.color.textSecondary;const s=(()=>{switch(n){case"network":return r(h,{size:e,color:o});case"storage":return r(m,{size:e,color:o});case"route":return r(k,{size:e,color:o});case"screen":return r(f,{size:e,color:o});case"user":return r(d,{size:e,color:o});case"image":return r(w,{size:e,color:o});case"check":return r(u,{size:e,color:c.color.accent});case"warn":return r(i,{size:e,color:c.color.warning});case"info":return r(y,{size:e,color:c.color.info});case"store":return r(t,{size:e,color:o});case"query":return r(t,{size:e,color:o});case"clock":return r(g,{size:e,color:o})}})();return r(a,{style:p.wrap,children:s})}const p=l.create({wrap:{width:24,height:24,borderRadius:6,backgroundColor:c.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 as a,expect as t,it as o}from"vitest";import{listRowBehaviour as n}from"./DataBlocks";a("listRowBehaviour",()=>{o("a plain row does nothing on tap",()=>{t(n({})).toEqual({canExpand:false,rowRunsAction:false,actionIsOwnControl:false})});o("a row with a picture opens it",()=>{t(n({image:"https://x/1.png"})).toEqual({canExpand:true,rowRunsAction:false,actionIsOwnControl:false})});o("a row with only an action keeps running it from the whole row",()=>{t(n({action:{label:"Retry",send:"retry"}})).toEqual({canExpand:false,rowRunsAction:true,actionIsOwnControl:false})});o("with BOTH, the body opens the picture and the action gets its own control",()=>{const e=n({image:"https://x/1.png",action:{label:"Retry",send:"retry"}});t(e).toEqual({canExpand:true,rowRunsAction:false,actionIsOwnControl:true});t(e.rowRunsAction).toBe(false)})});
|
|
@@ -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,a,e,d){const h=Math.min(e,n);const t=Math.max(0,n-h);const s=e>a&&n>a;return{hidden:t,next:Math.min(t,d),expanded:s,canExpand:t>0,canCollapse:s}}
|
|
@@ -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 as l,expect as e,it as o}from"vitest";import{pageState as r}from"./pageState";const n=10;const f=5;const t=(a,s)=>r(a,n,s,f);l("what the footer offers",()=>{o("offers nothing when everything already fits",()=>{const a=t(4,n);e(a.hidden).toBe(0);e(a.canExpand).toBe(false);e(a.canCollapse).toBe(false)});o("never offers an expand that reveals nothing",()=>{e(t(5,n).canExpand).toBe(false)});o("reveals a page at a time rather than the whole list",()=>{e(t(100,10).next).toBe(5);e(t(100,15).next).toBe(5);e(t(100,20).hidden).toBe(80)});o("offers only the remainder on the last page",()=>{e(t(12,10).next).toBe(2);e(t(12,12).canExpand).toBe(false)});o("offers the way back only once something is expanded",()=>{e(t(100,10).canCollapse).toBe(false);e(t(100,15).canCollapse).toBe(true);e(t(100,15).expanded).toBe(true)});o("does not offer a collapse that moves nothing",()=>{const a=t(3,20);e(a.canCollapse).toBe(false);e(a.expanded).toBe(false);e(a.hidden).toBe(0)})});
|