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