@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,457 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ActionRow = ActionRow;
|
|
7
|
-
exports.Card = Card;
|
|
8
|
-
exports.More = More;
|
|
9
|
-
exports.MoreNote = MoreNote;
|
|
10
|
-
exports.ProvenanceBadge = ProvenanceBadge;
|
|
11
|
-
exports.blockStyles = void 0;
|
|
12
|
-
exports.toneColor = toneColor;
|
|
13
|
-
exports.usePaged = usePaged;
|
|
14
|
-
var _react = require("react");
|
|
15
|
-
var _reactNative = require("react-native");
|
|
16
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
17
|
-
var _context = require("./context");
|
|
18
|
-
var _pageState = require("./pageState");
|
|
19
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
/**
|
|
21
|
-
* The few visual pieces every block shares: the card, its title row with the
|
|
22
|
-
* provenance badge, a "+N more" expander, and the two-button action row.
|
|
23
|
-
* Night tokens only — a block must look like every other Buoy surface.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
function toneColor(tone) {
|
|
27
|
-
switch (tone) {
|
|
28
|
-
case "accent":
|
|
29
|
-
return _sharedUi.night.color.accent;
|
|
30
|
-
case "warning":
|
|
31
|
-
return _sharedUi.night.color.warning;
|
|
32
|
-
case "danger":
|
|
33
|
-
return _sharedUi.night.color.danger;
|
|
34
|
-
case "info":
|
|
35
|
-
return _sharedUi.night.color.info;
|
|
36
|
-
case "muted":
|
|
37
|
-
return _sharedUi.night.color.textTertiary;
|
|
38
|
-
default:
|
|
39
|
-
return _sharedUi.night.color.text;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/** Quiet when live; loud when the data was changed, mocked, or invented. */
|
|
44
|
-
function ProvenanceBadge({
|
|
45
|
-
source
|
|
46
|
-
}) {
|
|
47
|
-
if (!source || source === "live") return null;
|
|
48
|
-
const label = source === "changed" ? "CHANGED BY ASK BUOY" : source === "mocked" ? "MOCKED" : "FROM THE MODEL";
|
|
49
|
-
const color = source === "changed" ? _sharedUi.night.color.warning : source === "mocked" ? _sharedUi.night.color.danger : _sharedUi.night.color.textTertiary;
|
|
50
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
51
|
-
style: [styles.badge, {
|
|
52
|
-
borderColor: color
|
|
53
|
-
}],
|
|
54
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
55
|
-
style: [styles.badgeText, {
|
|
56
|
-
color
|
|
57
|
-
}],
|
|
58
|
-
children: label
|
|
59
|
-
})
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* The block card. Optionally folds its body away behind a one-line summary.
|
|
65
|
-
*
|
|
66
|
-
* A card is `collapsible` when its body is reference material rather than the
|
|
67
|
-
* answer — raw JSON, a field-by-field diff, anything a person reads only when
|
|
68
|
-
* they have a reason to. It stays folded until asked, because the chat is what
|
|
69
|
-
* the reader came for and a screen of `promoCode: null` buries it. What must
|
|
70
|
-
* NEVER fold is the part that carries meaning without being read: the title
|
|
71
|
-
* and the provenance badge stay on the face of the card in both states, so
|
|
72
|
-
* "CHANGED BY ASK BUOY" can't be hidden by the same tap that hides the detail.
|
|
73
|
-
*/
|
|
74
|
-
function Card({
|
|
75
|
-
title,
|
|
76
|
-
source,
|
|
77
|
-
children,
|
|
78
|
-
testID,
|
|
79
|
-
tone,
|
|
80
|
-
collapsible,
|
|
81
|
-
summary
|
|
82
|
-
}) {
|
|
83
|
-
const [expanded, setExpanded] = (0, _react.useState)(false);
|
|
84
|
-
const folded = !!collapsible && !expanded;
|
|
85
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
86
|
-
style: [styles.card, tone === "warning" && styles.cardWarning, tone === "danger" && styles.cardDanger, tone === "info" && styles.cardInfo],
|
|
87
|
-
testID: testID,
|
|
88
|
-
children: [(title || source && source !== "live") && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
89
|
-
style: styles.titleRow,
|
|
90
|
-
children: [title ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
91
|
-
style: styles.title,
|
|
92
|
-
numberOfLines: 2,
|
|
93
|
-
children: title
|
|
94
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
95
|
-
style: styles.flex
|
|
96
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(ProvenanceBadge, {
|
|
97
|
-
source: source
|
|
98
|
-
})]
|
|
99
|
-
}), collapsible ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
|
|
100
|
-
testID: testID ? `${testID}-toggle` : undefined,
|
|
101
|
-
onPress: () => setExpanded(v => !v),
|
|
102
|
-
accessibilityRole: "button",
|
|
103
|
-
accessibilityState: {
|
|
104
|
-
expanded
|
|
105
|
-
},
|
|
106
|
-
accessibilityLabel: `${summary ?? "Details"}, ${expanded ? "hide" : "show"}`,
|
|
107
|
-
style: ({
|
|
108
|
-
pressed
|
|
109
|
-
}) => [styles.disclosure, !folded && styles.disclosureOpen, pressed && styles.pressed],
|
|
110
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
111
|
-
style: styles.disclosureText,
|
|
112
|
-
numberOfLines: 1,
|
|
113
|
-
children: summary ?? "Details"
|
|
114
|
-
}), folded ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChevronDown, {
|
|
115
|
-
size: 12,
|
|
116
|
-
color: _sharedUi.night.color.textTertiary
|
|
117
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChevronUp, {
|
|
118
|
-
size: 12,
|
|
119
|
-
color: _sharedUi.night.color.textTertiary
|
|
120
|
-
})]
|
|
121
|
-
}) : null, folded ? null : children]
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* How many rows one tap of "Show N more" reveals.
|
|
127
|
-
*
|
|
128
|
-
* Deliberately smaller than any block's initial cap. Expanding used to be
|
|
129
|
-
* all-or-nothing, so a hundred-row list arrived in one tap and buried the
|
|
130
|
-
* answer it was attached to under a scroll the reader had to fight back up.
|
|
131
|
-
* A page at a time keeps the conversation the thing you are reading.
|
|
132
|
-
*/
|
|
133
|
-
const PAGE_STEP = 5;
|
|
134
|
-
/**
|
|
135
|
-
* A capped list that grows a page at a time.
|
|
136
|
-
*
|
|
137
|
-
* The callers used to spell the expander's enabled-ness out themselves
|
|
138
|
-
* (`items.length > visible.length || expanded ? toggle : undefined`) at seven
|
|
139
|
-
* call sites, and getting it wrong rendered a "+N more" that did nothing when
|
|
140
|
-
* tapped. Both halves live here now so a call site cannot express that state.
|
|
141
|
-
*/
|
|
142
|
-
function usePaged(items, cap, step = PAGE_STEP) {
|
|
143
|
-
const [limit, setLimit] = (0, _react.useState)(cap);
|
|
144
|
-
const {
|
|
145
|
-
hidden,
|
|
146
|
-
next,
|
|
147
|
-
expanded,
|
|
148
|
-
canExpand,
|
|
149
|
-
canCollapse
|
|
150
|
-
} = (0, _pageState.pageState)(items.length, cap, limit, step);
|
|
151
|
-
return {
|
|
152
|
-
visible: items.slice(0, limit),
|
|
153
|
-
hidden,
|
|
154
|
-
next,
|
|
155
|
-
expanded,
|
|
156
|
-
showMore: canExpand ? () => setLimit(n => n + step) : undefined,
|
|
157
|
-
showLess: canCollapse ? () => setLimit(cap) : undefined
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* The footer of a paged list: reveal one more page, or fold back to the cap.
|
|
163
|
-
*
|
|
164
|
-
* It knows nothing about any `total` the source reported, and that is the
|
|
165
|
-
* point. The old version drew its count from that number while drawing its tap
|
|
166
|
-
* target from the array actually in hand — so a block holding five items and
|
|
167
|
-
* claiming six rendered "+1 more" with nothing behind it. The engine hands the
|
|
168
|
-
* whole list over now (see agent-core's receipts), so what this can show and
|
|
169
|
-
* what it can reveal are the same thing by construction.
|
|
170
|
-
*/
|
|
171
|
-
function More({
|
|
172
|
-
paged
|
|
173
|
-
}) {
|
|
174
|
-
const {
|
|
175
|
-
next,
|
|
176
|
-
showMore,
|
|
177
|
-
showLess
|
|
178
|
-
} = paged;
|
|
179
|
-
if (!showMore && !showLess) return null;
|
|
180
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
181
|
-
style: styles.moreRow,
|
|
182
|
-
children: [showMore ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
|
|
183
|
-
testID: "buoy-block-show-more",
|
|
184
|
-
onPress: showMore,
|
|
185
|
-
style: [styles.more, styles.moreCell],
|
|
186
|
-
accessibilityRole: "button",
|
|
187
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
188
|
-
style: styles.moreText,
|
|
189
|
-
children: ["Show ", next, " more"]
|
|
190
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChevronDown, {
|
|
191
|
-
size: 12,
|
|
192
|
-
color: _sharedUi.night.color.textTertiary
|
|
193
|
-
})]
|
|
194
|
-
}) : null, showLess ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
|
|
195
|
-
testID: "buoy-block-show-fewer",
|
|
196
|
-
onPress: showLess,
|
|
197
|
-
style: [styles.more, styles.moreCell],
|
|
198
|
-
accessibilityRole: "button",
|
|
199
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
200
|
-
style: styles.moreText,
|
|
201
|
-
children: "Show fewer"
|
|
202
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChevronUp, {
|
|
203
|
-
size: 12,
|
|
204
|
-
color: _sharedUi.night.color.textTertiary
|
|
205
|
-
})]
|
|
206
|
-
}) : null]
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* A list that CANNOT grow: the cap was applied where the block was built, so
|
|
212
|
-
* the rest was never sent. Stated, never offered as a tap.
|
|
213
|
-
*/
|
|
214
|
-
function MoreNote({
|
|
215
|
-
shown,
|
|
216
|
-
total
|
|
217
|
-
}) {
|
|
218
|
-
if (!total || total <= shown) return null;
|
|
219
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
220
|
-
style: styles.more,
|
|
221
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
222
|
-
style: styles.moreNote,
|
|
223
|
-
children: [shown, " of ", total, " shown"]
|
|
224
|
-
})
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/** Up to two buttons. One primary (accent, dark ink), one plate. */
|
|
229
|
-
function ActionRow({
|
|
230
|
-
actions,
|
|
231
|
-
blockId,
|
|
232
|
-
align = "left"
|
|
233
|
-
}) {
|
|
234
|
-
const h = (0, _context.useBlockHandlers)();
|
|
235
|
-
if (!actions?.length) return null;
|
|
236
|
-
const supported = actions.filter(a => {
|
|
237
|
-
if (a.openTool) return h.supports?.openTool !== false;
|
|
238
|
-
if (a.minimize) return h.supports?.minimize !== false;
|
|
239
|
-
if (a.dispatch) return h.supports?.dispatch !== false;
|
|
240
|
-
return true;
|
|
241
|
-
});
|
|
242
|
-
if (supported.length === 0) return null;
|
|
243
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
244
|
-
style: [styles.actions, align === "right" && styles.actionsRight],
|
|
245
|
-
children: supported.slice(0, 2).map(a => {
|
|
246
|
-
const state = h.actionState?.[(0, _context.actionKey)(blockId, a)];
|
|
247
|
-
const disabled = !!h.busy || state === "running" || state === "done";
|
|
248
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
|
|
249
|
-
accessibilityRole: "button",
|
|
250
|
-
accessibilityLabel: a.label,
|
|
251
|
-
testID: `buoy-block-action-${a.label.toLowerCase().replace(/\s+/g, "-")}`,
|
|
252
|
-
disabled: disabled,
|
|
253
|
-
onPress: () => void h.runAction(a, blockId),
|
|
254
|
-
style: ({
|
|
255
|
-
pressed
|
|
256
|
-
}) => [styles.button, a.primary ? styles.buttonPrimary : styles.buttonPlate, disabled && styles.buttonDisabled, pressed && !disabled && styles.pressed],
|
|
257
|
-
children: [state === "running" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
|
|
258
|
-
size: "small",
|
|
259
|
-
color: a.primary ? _sharedUi.night.color.onAccent : _sharedUi.night.color.text
|
|
260
|
-
}) : state === "done" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Check, {
|
|
261
|
-
size: 12,
|
|
262
|
-
color: a.primary ? _sharedUi.night.color.onAccent : _sharedUi.night.color.accent
|
|
263
|
-
}) : state === "failed" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.X, {
|
|
264
|
-
size: 12,
|
|
265
|
-
color: _sharedUi.night.color.danger
|
|
266
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
267
|
-
style: [styles.buttonText, a.primary ? styles.buttonTextPrimary : styles.buttonTextPlate],
|
|
268
|
-
children: a.label
|
|
269
|
-
})]
|
|
270
|
-
}, a.label);
|
|
271
|
-
})
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
const blockStyles = exports.blockStyles = _reactNative.StyleSheet.create({
|
|
275
|
-
row: {
|
|
276
|
-
flexDirection: "row",
|
|
277
|
-
alignItems: "center",
|
|
278
|
-
gap: 10,
|
|
279
|
-
paddingHorizontal: 12,
|
|
280
|
-
paddingVertical: 9
|
|
281
|
-
},
|
|
282
|
-
rowDivider: {
|
|
283
|
-
borderTopWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
284
|
-
borderTopColor: _sharedUi.night.color.separator
|
|
285
|
-
},
|
|
286
|
-
rowTitle: {
|
|
287
|
-
flex: 1,
|
|
288
|
-
color: _sharedUi.night.color.text,
|
|
289
|
-
fontSize: _sharedUi.night.font.body,
|
|
290
|
-
lineHeight: 19
|
|
291
|
-
},
|
|
292
|
-
rowSub: {
|
|
293
|
-
color: _sharedUi.night.color.textSecondary,
|
|
294
|
-
fontSize: _sharedUi.night.font.caption,
|
|
295
|
-
lineHeight: 17
|
|
296
|
-
},
|
|
297
|
-
rowTrailing: {
|
|
298
|
-
color: _sharedUi.night.color.textTertiary,
|
|
299
|
-
fontSize: _sharedUi.night.font.caption,
|
|
300
|
-
maxWidth: 120,
|
|
301
|
-
textAlign: "right"
|
|
302
|
-
},
|
|
303
|
-
mono: {
|
|
304
|
-
fontFamily: "Menlo",
|
|
305
|
-
fontSize: 12,
|
|
306
|
-
color: _sharedUi.night.color.text
|
|
307
|
-
},
|
|
308
|
-
pill: {
|
|
309
|
-
paddingHorizontal: 7,
|
|
310
|
-
paddingVertical: 2,
|
|
311
|
-
borderRadius: _sharedUi.night.radius.badge,
|
|
312
|
-
backgroundColor: _sharedUi.night.color.fill
|
|
313
|
-
},
|
|
314
|
-
pillText: {
|
|
315
|
-
fontSize: _sharedUi.night.font.micro,
|
|
316
|
-
fontWeight: "700",
|
|
317
|
-
letterSpacing: 0.4,
|
|
318
|
-
color: _sharedUi.night.color.textSecondary
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
const styles = _reactNative.StyleSheet.create({
|
|
322
|
-
card: {
|
|
323
|
-
borderRadius: _sharedUi.night.radius.card,
|
|
324
|
-
borderWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
325
|
-
borderColor: _sharedUi.night.color.border,
|
|
326
|
-
backgroundColor: _sharedUi.night.color.surface,
|
|
327
|
-
overflow: "hidden"
|
|
328
|
-
},
|
|
329
|
-
cardWarning: {
|
|
330
|
-
borderColor: _sharedUi.night.color.warning,
|
|
331
|
-
backgroundColor: _sharedUi.night.color.warningSoft
|
|
332
|
-
},
|
|
333
|
-
cardDanger: {
|
|
334
|
-
borderColor: _sharedUi.night.color.danger,
|
|
335
|
-
backgroundColor: _sharedUi.night.color.dangerSoft
|
|
336
|
-
},
|
|
337
|
-
cardInfo: {
|
|
338
|
-
borderColor: _sharedUi.night.color.accentBorderStrong,
|
|
339
|
-
backgroundColor: _sharedUi.night.color.accentSoft
|
|
340
|
-
},
|
|
341
|
-
titleRow: {
|
|
342
|
-
flexDirection: "row",
|
|
343
|
-
alignItems: "center",
|
|
344
|
-
gap: 8,
|
|
345
|
-
paddingHorizontal: 12,
|
|
346
|
-
paddingTop: 10,
|
|
347
|
-
paddingBottom: 6
|
|
348
|
-
},
|
|
349
|
-
flex: {
|
|
350
|
-
flex: 1
|
|
351
|
-
},
|
|
352
|
-
title: {
|
|
353
|
-
flex: 1,
|
|
354
|
-
color: _sharedUi.night.color.text,
|
|
355
|
-
fontSize: _sharedUi.night.font.caption,
|
|
356
|
-
fontWeight: "600"
|
|
357
|
-
},
|
|
358
|
-
disclosure: {
|
|
359
|
-
flexDirection: "row",
|
|
360
|
-
alignItems: "center",
|
|
361
|
-
gap: 8,
|
|
362
|
-
paddingHorizontal: 12,
|
|
363
|
-
paddingVertical: 9
|
|
364
|
-
},
|
|
365
|
-
// Only when open: closed, the card ends at this row and a rule under it
|
|
366
|
-
// would draw a line beneath nothing.
|
|
367
|
-
disclosureOpen: {
|
|
368
|
-
borderBottomWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
369
|
-
borderBottomColor: _sharedUi.night.color.separator
|
|
370
|
-
},
|
|
371
|
-
disclosureText: {
|
|
372
|
-
flex: 1,
|
|
373
|
-
color: _sharedUi.night.color.textSecondary,
|
|
374
|
-
fontSize: _sharedUi.night.font.caption
|
|
375
|
-
},
|
|
376
|
-
badge: {
|
|
377
|
-
borderWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
378
|
-
borderRadius: _sharedUi.night.radius.badge,
|
|
379
|
-
paddingHorizontal: 6,
|
|
380
|
-
paddingVertical: 2
|
|
381
|
-
},
|
|
382
|
-
badgeText: {
|
|
383
|
-
fontSize: 9,
|
|
384
|
-
fontWeight: "700",
|
|
385
|
-
letterSpacing: 0.6
|
|
386
|
-
},
|
|
387
|
-
// The footer splits into up to three cells; each keeps the full-width rule
|
|
388
|
-
// above it so the list still reads as ending at a line.
|
|
389
|
-
moreRow: {
|
|
390
|
-
flexDirection: "row"
|
|
391
|
-
},
|
|
392
|
-
more: {
|
|
393
|
-
flexDirection: "row",
|
|
394
|
-
alignItems: "center",
|
|
395
|
-
justifyContent: "center",
|
|
396
|
-
gap: 4,
|
|
397
|
-
paddingVertical: 9,
|
|
398
|
-
paddingHorizontal: 8,
|
|
399
|
-
borderTopWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
400
|
-
borderTopColor: _sharedUi.night.color.separator
|
|
401
|
-
},
|
|
402
|
-
// Only inside `moreRow` — a bare `MoreNote` sits in the Card's column,
|
|
403
|
-
// where flex:1 means "grow vertically".
|
|
404
|
-
moreCell: {
|
|
405
|
-
flex: 1
|
|
406
|
-
},
|
|
407
|
-
moreText: {
|
|
408
|
-
color: _sharedUi.night.color.textSecondary,
|
|
409
|
-
fontSize: _sharedUi.night.font.caption,
|
|
410
|
-
fontWeight: "600"
|
|
411
|
-
},
|
|
412
|
-
moreNote: {
|
|
413
|
-
color: _sharedUi.night.color.textTertiary,
|
|
414
|
-
fontSize: _sharedUi.night.font.caption
|
|
415
|
-
},
|
|
416
|
-
actions: {
|
|
417
|
-
flexDirection: "row",
|
|
418
|
-
gap: 8,
|
|
419
|
-
paddingHorizontal: 12,
|
|
420
|
-
paddingVertical: 10,
|
|
421
|
-
flexWrap: "wrap"
|
|
422
|
-
},
|
|
423
|
-
actionsRight: {
|
|
424
|
-
justifyContent: "flex-end"
|
|
425
|
-
},
|
|
426
|
-
button: {
|
|
427
|
-
flexDirection: "row",
|
|
428
|
-
alignItems: "center",
|
|
429
|
-
gap: 6,
|
|
430
|
-
paddingHorizontal: 14,
|
|
431
|
-
paddingVertical: 9,
|
|
432
|
-
borderRadius: _sharedUi.night.radius.row
|
|
433
|
-
},
|
|
434
|
-
buttonPrimary: {
|
|
435
|
-
backgroundColor: _sharedUi.night.color.accent
|
|
436
|
-
},
|
|
437
|
-
buttonPlate: {
|
|
438
|
-
backgroundColor: _sharedUi.night.color.button
|
|
439
|
-
},
|
|
440
|
-
buttonDisabled: {
|
|
441
|
-
opacity: 0.55
|
|
442
|
-
},
|
|
443
|
-
buttonText: {
|
|
444
|
-
fontSize: _sharedUi.night.font.caption,
|
|
445
|
-
fontWeight: "600"
|
|
446
|
-
},
|
|
447
|
-
buttonTextPrimary: {
|
|
448
|
-
color: _sharedUi.night.color.onAccent
|
|
449
|
-
},
|
|
450
|
-
buttonTextPlate: {
|
|
451
|
-
color: _sharedUi.night.color.text
|
|
452
|
-
},
|
|
453
|
-
pressed: {
|
|
454
|
-
opacity: 0.7
|
|
455
|
-
}
|
|
456
|
-
});
|
|
457
|
-
//# sourceMappingURL=primitives.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ActionRow=ActionRow;exports.Card=Card;exports.More=More;exports.MoreNote=MoreNote;exports.ProvenanceBadge=ProvenanceBadge;exports.blockStyles=void 0;exports.toneColor=toneColor;exports.usePaged=usePaged;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _context=require("./context");var _pageState=require("./pageState");var _jsxRuntime=require("react/jsx-runtime");function toneColor(e){switch(e){case"accent":return _sharedUi.night.color.accent;case"warning":return _sharedUi.night.color.warning;case"danger":return _sharedUi.night.color.danger;case"info":return _sharedUi.night.color.info;case"muted":return _sharedUi.night.color.textTertiary;default:return _sharedUi.night.color.text}}function ProvenanceBadge({source:e}){if(!e||e==="live")return null;const o=e==="changed"?"CHANGED BY ASK BUOY":e==="mocked"?"MOCKED":"FROM THE MODEL";const n=e==="changed"?_sharedUi.night.color.warning:e==="mocked"?_sharedUi.night.color.danger:_sharedUi.night.color.textTertiary;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.badge,{borderColor:n}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.badgeText,{color:n}],children:o})})}function Card({title:e,source:o,children:n,testID:r,tone:l,collapsible:t,summary:i}){const[c,a]=(0,_react.useState)(false);const s=!!t&&!c;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.card,l==="warning"&&styles.cardWarning,l==="danger"&&styles.cardDanger,l==="info"&&styles.cardInfo],testID:r,children:[(e||o&&o!=="live")&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.titleRow,children:[e?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.title,numberOfLines:2,children:e}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.flex}),(0,_jsxRuntime.jsx)(ProvenanceBadge,{source:o})]}),t?(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:r?`${r}-toggle`:void 0,onPress:()=>a(d=>!d),accessibilityRole:"button",accessibilityState:{expanded:c},accessibilityLabel:`${i??"Details"}, ${c?"hide":"show"}`,style:({pressed:d})=>[styles.disclosure,!s&&styles.disclosureOpen,d&&styles.pressed],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.disclosureText,numberOfLines:1,children:i??"Details"}),s?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:12,color:_sharedUi.night.color.textTertiary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronUp,{size:12,color:_sharedUi.night.color.textTertiary})]}):null,s?null:n]})}const PAGE_STEP=5;function usePaged(e,o,n=PAGE_STEP){const[r,l]=(0,_react.useState)(o);const{hidden:t,next:i,expanded:c,canExpand:a,canCollapse:s}=(0,_pageState.pageState)(e.length,o,r,n);return{visible:e.slice(0,r),hidden:t,next:i,expanded:c,showMore:a?()=>l(d=>d+n):void 0,showLess:s?()=>l(o):void 0}}function More({paged:e}){const{next:o,showMore:n,showLess:r}=e;if(!n&&!r)return null;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.moreRow,children:[n?(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:"buoy-block-show-more",onPress:n,style:[styles.more,styles.moreCell],accessibilityRole:"button",children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.moreText,children:["Show ",o," more"]}),(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:12,color:_sharedUi.night.color.textTertiary})]}):null,r?(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:"buoy-block-show-fewer",onPress:r,style:[styles.more,styles.moreCell],accessibilityRole:"button",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.moreText,children:"Show fewer"}),(0,_jsxRuntime.jsx)(_sharedUi.ChevronUp,{size:12,color:_sharedUi.night.color.textTertiary})]}):null]})}function MoreNote({shown:e,total:o}){if(!o||o<=e)return null;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.more,children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.moreNote,children:[e," of ",o," shown"]})})}function ActionRow({actions:e,blockId:o,align:n="left"}){const r=(0,_context.useBlockHandlers)();if(!e?.length)return null;const l=e.filter(t=>{if(t.openTool)return r.supports?.openTool!==false;if(t.minimize)return r.supports?.minimize!==false;if(t.dispatch)return r.supports?.dispatch!==false;return true});if(l.length===0)return null;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.actions,n==="right"&&styles.actionsRight],children:l.slice(0,2).map(t=>{const i=r.actionState?.[(0,_context.actionKey)(o,t)];const c=!!r.busy||i==="running"||i==="done";return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:t.label,testID:`buoy-block-action-${t.label.toLowerCase().replace(/\s+/g,"-")}`,disabled:c,onPress:()=>void r.runAction(t,o),style:({pressed:a})=>[styles.button,t.primary?styles.buttonPrimary:styles.buttonPlate,c&&styles.buttonDisabled,a&&!c&&styles.pressed],children:[i==="running"?(0,_jsxRuntime.jsx)(_reactNative.ActivityIndicator,{size:"small",color:t.primary?_sharedUi.night.color.onAccent:_sharedUi.night.color.text}):i==="done"?(0,_jsxRuntime.jsx)(_sharedUi.Check,{size:12,color:t.primary?_sharedUi.night.color.onAccent:_sharedUi.night.color.accent}):i==="failed"?(0,_jsxRuntime.jsx)(_sharedUi.X,{size:12,color:_sharedUi.night.color.danger}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.buttonText,t.primary?styles.buttonTextPrimary:styles.buttonTextPlate],children:t.label})]},t.label)})})}const blockStyles=exports.blockStyles=_reactNative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:12,paddingVertical:9},rowDivider:{borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_sharedUi.night.color.separator},rowTitle:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.body,lineHeight:19},rowSub:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,lineHeight:17},rowTrailing:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.caption,maxWidth:120,textAlign:"right"},mono:{fontFamily:"Menlo",fontSize:12,color:_sharedUi.night.color.text},pill:{paddingHorizontal:7,paddingVertical:2,borderRadius:_sharedUi.night.radius.badge,backgroundColor:_sharedUi.night.color.fill},pillText:{fontSize:_sharedUi.night.font.micro,fontWeight:"700",letterSpacing:.4,color:_sharedUi.night.color.textSecondary}});const styles=_reactNative.StyleSheet.create({card:{borderRadius:_sharedUi.night.radius.card,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface,overflow:"hidden"},cardWarning:{borderColor:_sharedUi.night.color.warning,backgroundColor:_sharedUi.night.color.warningSoft},cardDanger:{borderColor:_sharedUi.night.color.danger,backgroundColor:_sharedUi.night.color.dangerSoft},cardInfo:{borderColor:_sharedUi.night.color.accentBorderStrong,backgroundColor:_sharedUi.night.color.accentSoft},titleRow:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingTop:10,paddingBottom:6},flex:{flex:1},title:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},disclosure:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingVertical:9},disclosureOpen:{borderBottomWidth:_reactNative.StyleSheet.hairlineWidth,borderBottomColor:_sharedUi.night.color.separator},disclosureText:{flex:1,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption},badge:{borderWidth:_reactNative.StyleSheet.hairlineWidth,borderRadius:_sharedUi.night.radius.badge,paddingHorizontal:6,paddingVertical:2},badgeText:{fontSize:9,fontWeight:"700",letterSpacing:.6},moreRow:{flexDirection:"row"},more:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:4,paddingVertical:9,paddingHorizontal:8,borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_sharedUi.night.color.separator},moreCell:{flex:1},moreText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},moreNote:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.caption},actions:{flexDirection:"row",gap:8,paddingHorizontal:12,paddingVertical:10,flexWrap:"wrap"},actionsRight:{justifyContent:"flex-end"},button:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:14,paddingVertical:9,borderRadius:_sharedUi.night.radius.row},buttonPrimary:{backgroundColor:_sharedUi.night.color.accent},buttonPlate:{backgroundColor:_sharedUi.night.color.button},buttonDisabled:{opacity:.55},buttonText:{fontSize:_sharedUi.night.font.caption,fontWeight:"600"},buttonTextPrimary:{color:_sharedUi.night.color.onAccent},buttonTextPlate:{color:_sharedUi.night.color.text},pressed:{opacity:.7}});
|
|
@@ -1,62 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "ActionRow", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _primitives.ActionRow;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "Card", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _primitives.Card;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "More", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _primitives.More;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "MoreNote", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _primitives.MoreNote;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "ProvenanceBadge", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _primitives.ProvenanceBadge;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "blockStyles", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _primitives.blockStyles;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "toneColor", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () {
|
|
45
|
-
return _primitives.toneColor;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, "useBlockHandlers", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function () {
|
|
51
|
-
return _context.useBlockHandlers;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(exports, "usePaged", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () {
|
|
57
|
-
return _primitives.usePaged;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
var _primitives = require("./primitives");
|
|
61
|
-
var _context = require("./context");
|
|
62
|
-
//# sourceMappingURL=primitivesIndex.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"ActionRow",{enumerable:true,get:function(){return _primitives.ActionRow}});Object.defineProperty(exports,"Card",{enumerable:true,get:function(){return _primitives.Card}});Object.defineProperty(exports,"More",{enumerable:true,get:function(){return _primitives.More}});Object.defineProperty(exports,"MoreNote",{enumerable:true,get:function(){return _primitives.MoreNote}});Object.defineProperty(exports,"ProvenanceBadge",{enumerable:true,get:function(){return _primitives.ProvenanceBadge}});Object.defineProperty(exports,"blockStyles",{enumerable:true,get:function(){return _primitives.blockStyles}});Object.defineProperty(exports,"toneColor",{enumerable:true,get:function(){return _primitives.toneColor}});Object.defineProperty(exports,"useBlockHandlers",{enumerable:true,get:function(){return _context.useBlockHandlers}});Object.defineProperty(exports,"usePaged",{enumerable:true,get:function(){return _primitives.usePaged}});var _primitives=require("./primitives");var _context=require("./context");
|
|
@@ -1,39 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ruleStatesFrom = ruleStatesFrom;
|
|
7
|
-
/**
|
|
8
|
-
* What the ledger knows about each override rule since its card was drawn.
|
|
9
|
-
*
|
|
10
|
-
* A rule card is a receipt: it records the rule as the call left it. Undo
|
|
11
|
-
* then deleted the rule and the card kept saying ON, with a "Turn off" button
|
|
12
|
-
* aimed at a rule that no longer existed. The ledger has the later facts, so
|
|
13
|
-
* the card reads them from here instead of trusting its own snapshot.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
function ruleStatesFrom(entries) {
|
|
17
|
-
const out = {};
|
|
18
|
-
for (const e of entries) {
|
|
19
|
-
const fx = e.effect;
|
|
20
|
-
if (fx.kind === "network-override") {
|
|
21
|
-
out[fx.ruleId] = e.undoneAt ? {
|
|
22
|
-
deleted: true
|
|
23
|
-
} : {
|
|
24
|
-
enabled: true
|
|
25
|
-
};
|
|
26
|
-
} else if (fx.kind === "inverse-call" && fx.toolId === "network" && fx.action === "setOverrideRuleEnabled" && typeof fx.params.id === "string") {
|
|
27
|
-
// The entry holds the INVERSE: while it is outstanding the rule is the
|
|
28
|
-
// opposite of it; once undone, the inverse is what the rule is.
|
|
29
|
-
const inverse = fx.params.enabled === true;
|
|
30
|
-
const prev = out[fx.params.id];
|
|
31
|
-
if (prev?.deleted) continue;
|
|
32
|
-
out[fx.params.id] = {
|
|
33
|
-
enabled: e.undoneAt ? inverse : !inverse
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return out;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=ruleStates.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ruleStatesFrom=ruleStatesFrom;function ruleStatesFrom(o){const t={};for(const r of o){const e=r.effect;if(e.kind==="network-override"){t[e.ruleId]=r.undoneAt?{deleted:true}:{enabled:true}}else if(e.kind==="inverse-call"&&e.toolId==="network"&&e.action==="setOverrideRuleEnabled"&&typeof e.params.id==="string"){const n=e.params.enabled===true;const d=t[e.params.id];if(d?.deleted)continue;t[e.params.id]={enabled:r.undoneAt?n:!n}}}return t}
|