@buoy-gg/ask-buoy 7.0.38 → 7.0.39
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/lib/commonjs/blocks/AskBlocks.js +338 -1
- package/lib/commonjs/blocks/AskBlocks.js.map +1 -0
- package/lib/commonjs/blocks/BlockRenderer.js +262 -1
- package/lib/commonjs/blocks/BlockRenderer.js.map +1 -0
- package/lib/commonjs/blocks/ChromePrototypes.js +514 -1
- package/lib/commonjs/blocks/ChromePrototypes.js.map +1 -0
- package/lib/commonjs/blocks/DataBlocks.js +781 -1
- package/lib/commonjs/blocks/DataBlocks.js.map +1 -0
- package/lib/commonjs/blocks/ExtraBlocks.js +1860 -1
- package/lib/commonjs/blocks/ExtraBlocks.js.map +1 -0
- package/lib/commonjs/blocks/MediaBlocks.js +156 -1
- package/lib/commonjs/blocks/MediaBlocks.js.map +1 -0
- package/lib/commonjs/blocks/ReceiptBlocks.js +586 -1
- package/lib/commonjs/blocks/ReceiptBlocks.js.map +1 -0
- package/lib/commonjs/blocks/blockText.js +60 -1
- package/lib/commonjs/blocks/blockText.js.map +1 -0
- package/lib/commonjs/blocks/blockText.test.js +53 -1
- package/lib/commonjs/blocks/blockText.test.js.map +1 -0
- package/lib/commonjs/blocks/context.js +42 -1
- package/lib/commonjs/blocks/context.js.map +1 -0
- package/lib/commonjs/blocks/icons.js +96 -1
- package/lib/commonjs/blocks/icons.js.map +1 -0
- package/lib/commonjs/blocks/index.js +95 -1
- package/lib/commonjs/blocks/index.js.map +1 -0
- package/lib/commonjs/blocks/listRow.test.js +55 -1
- package/lib/commonjs/blocks/listRow.test.js.map +1 -0
- package/lib/commonjs/blocks/pageState.js +34 -1
- package/lib/commonjs/blocks/pageState.js.map +1 -0
- package/lib/commonjs/blocks/pageState.test.js +57 -1
- package/lib/commonjs/blocks/pageState.test.js.map +1 -0
- package/lib/commonjs/blocks/primitives.js +457 -1
- package/lib/commonjs/blocks/primitives.js.map +1 -0
- package/lib/commonjs/blocks/primitivesIndex.js +62 -1
- package/lib/commonjs/blocks/primitivesIndex.js.map +1 -0
- package/lib/commonjs/components/ApprovalCard.js +297 -1
- package/lib/commonjs/components/ApprovalCard.js.map +1 -0
- package/lib/commonjs/components/AskBuoyHeader.js +196 -1
- package/lib/commonjs/components/AskBuoyHeader.js.map +1 -0
- package/lib/commonjs/components/AskBuoyIcon.js +19 -1
- package/lib/commonjs/components/AskBuoyIcon.js.map +1 -0
- package/lib/commonjs/components/AskBuoyModal.js +479 -1
- package/lib/commonjs/components/AskBuoyModal.js.map +1 -0
- package/lib/commonjs/components/AskBuoySettings.js +181 -1
- package/lib/commonjs/components/AskBuoySettings.js.map +1 -0
- package/lib/commonjs/components/ChangesBar.js +211 -1
- package/lib/commonjs/components/ChangesBar.js.map +1 -0
- package/lib/commonjs/components/Composer.js +255 -1
- package/lib/commonjs/components/Composer.js.map +1 -0
- package/lib/commonjs/components/EmptyState.js +161 -1
- package/lib/commonjs/components/EmptyState.js.map +1 -0
- package/lib/commonjs/components/KeyboardPad.js +80 -1
- package/lib/commonjs/components/KeyboardPad.js.map +1 -0
- package/lib/commonjs/components/Markdown.js +310 -1
- package/lib/commonjs/components/Markdown.js.map +1 -0
- package/lib/commonjs/components/MessageList.js +970 -1
- package/lib/commonjs/components/MessageList.js.map +1 -0
- package/lib/commonjs/components/QueuedMessages.js +145 -1
- package/lib/commonjs/components/QueuedMessages.js.map +1 -0
- package/lib/commonjs/components/ThinkingStrip.js +223 -1
- package/lib/commonjs/components/ThinkingStrip.js.map +1 -0
- package/lib/commonjs/components/TypingDots.js +63 -1
- package/lib/commonjs/components/TypingDots.js.map +1 -0
- package/lib/commonjs/components/markdownParse.js +131 -1
- package/lib/commonjs/components/markdownParse.js.map +1 -0
- package/lib/commonjs/components/markdownParse.test.js +99 -1
- package/lib/commonjs/components/markdownParse.test.js.map +1 -0
- package/lib/commonjs/components/useCopyAction.js +50 -1
- package/lib/commonjs/components/useCopyAction.js.map +1 -0
- package/lib/commonjs/index.js +252 -1
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/preset.js +91 -1
- package/lib/commonjs/preset.js.map +1 -0
- package/lib/commonjs/store/activityGroups.js +110 -1
- package/lib/commonjs/store/activityGroups.js.map +1 -0
- package/lib/commonjs/store/activityGroups.test.js +78 -1
- package/lib/commonjs/store/activityGroups.test.js.map +1 -0
- package/lib/commonjs/store/askBuoySettings.js +72 -1
- package/lib/commonjs/store/askBuoySettings.js.map +1 -0
- package/lib/commonjs/store/askBuoyStore.js +589 -1
- package/lib/commonjs/store/askBuoyStore.js.map +1 -0
- package/lib/commonjs/store/blockPlacement.js +64 -1
- package/lib/commonjs/store/blockPlacement.js.map +1 -0
- package/lib/commonjs/store/blockPlacement.test.js +123 -1
- package/lib/commonjs/store/blockPlacement.test.js.map +1 -0
- package/lib/commonjs/store/queue.test.js +150 -1
- package/lib/commonjs/store/queue.test.js.map +1 -0
- package/lib/commonjs/store/resetConversation.js +77 -1
- package/lib/commonjs/store/resetConversation.js.map +1 -0
- package/lib/commonjs/store/restorePending.test.js +63 -1
- package/lib/commonjs/store/restorePending.test.js.map +1 -0
- package/lib/commonjs/store/restoredIds.test.js +47 -1
- package/lib/commonjs/store/restoredIds.test.js.map +1 -0
- package/lib/commonjs/store/suggestions.js +54 -1
- package/lib/commonjs/store/suggestions.js.map +1 -0
- package/lib/commonjs/store/suggestions.test.js +58 -1
- package/lib/commonjs/store/suggestions.test.js.map +1 -0
- package/lib/commonjs/store/systemLine.test.js +77 -1
- package/lib/commonjs/store/systemLine.test.js.map +1 -0
- package/lib/commonjs/store/ticketPrompt.js +17 -1
- package/lib/commonjs/store/ticketPrompt.js.map +1 -0
- package/lib/commonjs/store/traceText.js +81 -1
- package/lib/commonjs/store/traceText.js.map +1 -0
- package/lib/commonjs/store/traceText.test.js +112 -1
- package/lib/commonjs/store/traceText.test.js.map +1 -0
- package/lib/commonjs/store/transcriptPersistence.js +297 -1
- package/lib/commonjs/store/transcriptPersistence.js.map +1 -0
- package/lib/commonjs/store/transcriptPersistence.test.js +333 -1
- package/lib/commonjs/store/transcriptPersistence.test.js.map +1 -0
- package/lib/commonjs/store/turnRendering.test.js +151 -1
- package/lib/commonjs/store/turnRendering.test.js.map +1 -0
- package/lib/commonjs/store/useAskBuoy.js +651 -1
- package/lib/commonjs/store/useAskBuoy.js.map +1 -0
- package/lib/commonjs/store/useAskBuoySettings.js +14 -1
- package/lib/commonjs/store/useAskBuoySettings.js.map +1 -0
- package/lib/commonjs/sync/askBuoySyncAdapter.js +153 -1
- package/lib/commonjs/sync/askBuoySyncAdapter.js.map +1 -0
- package/lib/commonjs/sync/askBuoySyncAdapter.test.js +141 -1
- package/lib/commonjs/sync/askBuoySyncAdapter.test.js.map +1 -0
- package/lib/commonjs/sync/wire.js +58 -1
- package/lib/commonjs/sync/wire.js.map +1 -0
- package/lib/commonjs/types.js +6 -1
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/blocks/AskBlocks.js +331 -1
- package/lib/module/blocks/AskBlocks.js.map +1 -0
- package/lib/module/blocks/BlockRenderer.js +257 -1
- package/lib/module/blocks/BlockRenderer.js.map +1 -0
- package/lib/module/blocks/ChromePrototypes.js +503 -1
- package/lib/module/blocks/ChromePrototypes.js.map +1 -0
- package/lib/module/blocks/DataBlocks.js +767 -1
- package/lib/module/blocks/DataBlocks.js.map +1 -0
- package/lib/module/blocks/ExtraBlocks.js +1833 -1
- package/lib/module/blocks/ExtraBlocks.js.map +1 -0
- package/lib/module/blocks/MediaBlocks.js +151 -1
- package/lib/module/blocks/MediaBlocks.js.map +1 -0
- package/lib/module/blocks/ReceiptBlocks.js +574 -1
- package/lib/module/blocks/ReceiptBlocks.js.map +1 -0
- package/lib/module/blocks/blockText.js +55 -1
- package/lib/module/blocks/blockText.js.map +1 -0
- package/lib/module/blocks/blockText.test.js +53 -1
- package/lib/module/blocks/blockText.test.js.map +1 -0
- package/lib/module/blocks/context.js +35 -1
- package/lib/module/blocks/context.js.map +1 -0
- package/lib/module/blocks/icons.js +91 -1
- package/lib/module/blocks/icons.js.map +1 -0
- package/lib/module/blocks/index.js +8 -1
- package/lib/module/blocks/index.js.map +1 -0
- package/lib/module/blocks/listRow.test.js +56 -1
- package/lib/module/blocks/listRow.test.js.map +1 -0
- package/lib/module/blocks/pageState.js +30 -1
- package/lib/module/blocks/pageState.js.map +1 -0
- package/lib/module/blocks/pageState.test.js +56 -1
- package/lib/module/blocks/pageState.test.js.map +1 -0
- package/lib/module/blocks/primitives.js +445 -1
- package/lib/module/blocks/primitives.js.map +1 -0
- package/lib/module/blocks/primitivesIndex.js +5 -1
- package/lib/module/blocks/primitivesIndex.js.map +1 -0
- package/lib/module/components/ApprovalCard.js +292 -1
- package/lib/module/components/ApprovalCard.js.map +1 -0
- package/lib/module/components/AskBuoyHeader.js +193 -1
- package/lib/module/components/AskBuoyHeader.js.map +1 -0
- package/lib/module/components/AskBuoyIcon.js +8 -1
- package/lib/module/components/AskBuoyIcon.js.map +1 -0
- package/lib/module/components/AskBuoyModal.js +474 -1
- package/lib/module/components/AskBuoyModal.js.map +1 -0
- package/lib/module/components/AskBuoySettings.js +176 -1
- package/lib/module/components/AskBuoySettings.js.map +1 -0
- package/lib/module/components/ChangesBar.js +206 -1
- package/lib/module/components/ChangesBar.js.map +1 -0
- package/lib/module/components/Composer.js +250 -1
- package/lib/module/components/Composer.js.map +1 -0
- package/lib/module/components/EmptyState.js +156 -1
- package/lib/module/components/EmptyState.js.map +1 -0
- package/lib/module/components/KeyboardPad.js +75 -1
- package/lib/module/components/KeyboardPad.js.map +1 -0
- package/lib/module/components/Markdown.js +305 -1
- package/lib/module/components/Markdown.js.map +1 -0
- package/lib/module/components/MessageList.js +964 -1
- package/lib/module/components/MessageList.js.map +1 -0
- package/lib/module/components/QueuedMessages.js +140 -1
- package/lib/module/components/QueuedMessages.js.map +1 -0
- package/lib/module/components/ThinkingStrip.js +218 -1
- package/lib/module/components/ThinkingStrip.js.map +1 -0
- package/lib/module/components/TypingDots.js +58 -1
- package/lib/module/components/TypingDots.js.map +1 -0
- package/lib/module/components/markdownParse.js +125 -1
- package/lib/module/components/markdownParse.js.map +1 -0
- package/lib/module/components/markdownParse.test.js +98 -1
- package/lib/module/components/markdownParse.test.js.map +1 -0
- package/lib/module/components/useCopyAction.js +46 -1
- package/lib/module/components/useCopyAction.js.map +1 -0
- package/lib/module/index.js +34 -1
- package/lib/module/index.js.map +1 -0
- package/lib/module/preset.js +74 -1
- package/lib/module/preset.js.map +1 -0
- package/lib/module/store/activityGroups.js +103 -1
- package/lib/module/store/activityGroups.js.map +1 -0
- package/lib/module/store/activityGroups.test.js +77 -1
- package/lib/module/store/activityGroups.test.js.map +1 -0
- package/lib/module/store/askBuoySettings.js +67 -1
- package/lib/module/store/askBuoySettings.js.map +1 -0
- package/lib/module/store/askBuoyStore.js +583 -1
- package/lib/module/store/askBuoyStore.js.map +1 -0
- package/lib/module/store/blockPlacement.js +59 -1
- package/lib/module/store/blockPlacement.js.map +1 -0
- package/lib/module/store/blockPlacement.test.js +122 -1
- package/lib/module/store/blockPlacement.test.js.map +1 -0
- package/lib/module/store/queue.test.js +149 -1
- package/lib/module/store/queue.test.js.map +1 -0
- package/lib/module/store/resetConversation.js +72 -1
- package/lib/module/store/resetConversation.js.map +1 -0
- package/lib/module/store/restorePending.test.js +62 -1
- package/lib/module/store/restorePending.test.js.map +1 -0
- package/lib/module/store/restoredIds.test.js +46 -1
- package/lib/module/store/restoredIds.test.js.map +1 -0
- package/lib/module/store/suggestions.js +49 -1
- package/lib/module/store/suggestions.js.map +1 -0
- package/lib/module/store/suggestions.test.js +57 -1
- package/lib/module/store/suggestions.test.js.map +1 -0
- package/lib/module/store/systemLine.test.js +76 -1
- package/lib/module/store/systemLine.test.js.map +1 -0
- package/lib/module/store/ticketPrompt.js +13 -1
- package/lib/module/store/ticketPrompt.js.map +1 -0
- package/lib/module/store/traceText.js +75 -1
- package/lib/module/store/traceText.js.map +1 -0
- package/lib/module/store/traceText.test.js +111 -1
- package/lib/module/store/traceText.test.js.map +1 -0
- package/lib/module/store/transcriptPersistence.js +287 -1
- package/lib/module/store/transcriptPersistence.js.map +1 -0
- package/lib/module/store/transcriptPersistence.test.js +332 -1
- package/lib/module/store/transcriptPersistence.test.js.map +1 -0
- package/lib/module/store/turnRendering.test.js +150 -1
- package/lib/module/store/turnRendering.test.js.map +1 -0
- package/lib/module/store/useAskBuoy.js +646 -1
- package/lib/module/store/useAskBuoy.js.map +1 -0
- package/lib/module/store/useAskBuoySettings.js +9 -1
- package/lib/module/store/useAskBuoySettings.js.map +1 -0
- package/lib/module/sync/askBuoySyncAdapter.js +148 -1
- package/lib/module/sync/askBuoySyncAdapter.js.map +1 -0
- package/lib/module/sync/askBuoySyncAdapter.test.js +140 -1
- package/lib/module/sync/askBuoySyncAdapter.test.js.map +1 -0
- package/lib/module/sync/wire.js +47 -1
- package/lib/module/sync/wire.js.map +1 -0
- package/lib/module/types.js +4 -1
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/blocks/AskBlocks.d.ts.map +1 -0
- package/lib/typescript/blocks/BlockRenderer.d.ts.map +1 -0
- package/lib/typescript/blocks/ChromePrototypes.d.ts.map +1 -0
- package/lib/typescript/blocks/DataBlocks.d.ts.map +1 -0
- package/lib/typescript/blocks/ExtraBlocks.d.ts.map +1 -0
- package/lib/typescript/blocks/MediaBlocks.d.ts.map +1 -0
- package/lib/typescript/blocks/ReceiptBlocks.d.ts.map +1 -0
- package/lib/typescript/blocks/blockText.d.ts.map +1 -0
- package/lib/typescript/blocks/blockText.test.d.ts.map +1 -0
- package/lib/typescript/blocks/context.d.ts.map +1 -0
- package/lib/typescript/blocks/icons.d.ts.map +1 -0
- package/lib/typescript/blocks/index.d.ts.map +1 -0
- package/lib/typescript/blocks/listRow.test.d.ts.map +1 -0
- package/lib/typescript/blocks/pageState.d.ts.map +1 -0
- package/lib/typescript/blocks/pageState.test.d.ts.map +1 -0
- package/lib/typescript/blocks/primitives.d.ts.map +1 -0
- package/lib/typescript/blocks/primitivesIndex.d.ts.map +1 -0
- package/lib/typescript/components/ApprovalCard.d.ts.map +1 -0
- package/lib/typescript/components/AskBuoyHeader.d.ts.map +1 -0
- package/lib/typescript/components/AskBuoyIcon.d.ts.map +1 -0
- package/lib/typescript/components/AskBuoyModal.d.ts.map +1 -0
- package/lib/typescript/components/AskBuoySettings.d.ts.map +1 -0
- package/lib/typescript/components/ChangesBar.d.ts.map +1 -0
- package/lib/typescript/components/Composer.d.ts.map +1 -0
- package/lib/typescript/components/EmptyState.d.ts.map +1 -0
- package/lib/typescript/components/KeyboardPad.d.ts.map +1 -0
- package/lib/typescript/components/Markdown.d.ts.map +1 -0
- package/lib/typescript/components/MessageList.d.ts.map +1 -0
- package/lib/typescript/components/QueuedMessages.d.ts.map +1 -0
- package/lib/typescript/components/ThinkingStrip.d.ts.map +1 -0
- package/lib/typescript/components/TypingDots.d.ts.map +1 -0
- package/lib/typescript/components/markdownParse.d.ts.map +1 -0
- package/lib/typescript/components/markdownParse.test.d.ts.map +1 -0
- package/lib/typescript/components/useCopyAction.d.ts.map +1 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/preset.d.ts.map +1 -0
- package/lib/typescript/store/activityGroups.d.ts.map +1 -0
- package/lib/typescript/store/activityGroups.test.d.ts.map +1 -0
- package/lib/typescript/store/askBuoySettings.d.ts.map +1 -0
- package/lib/typescript/store/askBuoyStore.d.ts.map +1 -0
- package/lib/typescript/store/blockPlacement.d.ts.map +1 -0
- package/lib/typescript/store/blockPlacement.test.d.ts.map +1 -0
- package/lib/typescript/store/queue.test.d.ts.map +1 -0
- package/lib/typescript/store/resetConversation.d.ts.map +1 -0
- package/lib/typescript/store/restorePending.test.d.ts.map +1 -0
- package/lib/typescript/store/restoredIds.test.d.ts.map +1 -0
- package/lib/typescript/store/suggestions.d.ts.map +1 -0
- package/lib/typescript/store/suggestions.test.d.ts.map +1 -0
- package/lib/typescript/store/systemLine.test.d.ts.map +1 -0
- package/lib/typescript/store/ticketPrompt.d.ts.map +1 -0
- package/lib/typescript/store/traceText.d.ts.map +1 -0
- package/lib/typescript/store/traceText.test.d.ts.map +1 -0
- package/lib/typescript/store/transcriptPersistence.d.ts.map +1 -0
- package/lib/typescript/store/transcriptPersistence.test.d.ts.map +1 -0
- package/lib/typescript/store/turnRendering.test.d.ts.map +1 -0
- package/lib/typescript/store/useAskBuoy.d.ts.map +1 -0
- package/lib/typescript/store/useAskBuoySettings.d.ts.map +1 -0
- package/lib/typescript/sync/askBuoySyncAdapter.d.ts.map +1 -0
- package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts.map +1 -0
- package/lib/typescript/sync/wire.d.ts.map +1 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/package.json +8 -8
|
@@ -1 +1,781 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Chart=Chart,exports.Code=Code,exports.Diff=Diff,exports.Finding=Finding,exports.KeyValue=KeyValue,exports.List=List,exports.Notice=Notice,exports.Steps=Steps,exports.Table=Table,exports.listRowBehaviour=listRowBehaviour;var _react=require("react"),_reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_dataViewer=require("@buoy-gg/shared-ui/dataViewer"),_agentCore=require("@buoy-gg/agent-core"),_primitivesIndex=require("./primitivesIndex"),_Markdown=require("../components/Markdown"),_useCopyAction=require("../components/useCopyAction"),_blockText=require("./blockText"),_icons=require("./icons"),_jsxRuntime=require("react/jsx-runtime");function fmt(e){if(void 0===e)return"—";if(null===e)return"null";if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return String(e);try{const t=JSON.stringify(e);return t.length>120?`${t.slice(0,117)}…`:t}catch{return String(e)}}function Table({block:e}){const t=(0,_primitivesIndex.usePaged)(e.rows,_agentCore.CAPS.tableRows),{visible:i}=t,s=e.columns.slice(0,4);return(0,_jsxRuntime.jsxs)(_primitivesIndex.Card,{title:e.title,source:e.source,testID:`buoy-block-table-${e.id}`,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tableHead,children:s.map((e,t)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.th,0===t&&styles.firstCol],numberOfLines:1,children:e},e))}),i.map((e,t)=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.tr,t>0&&_primitivesIndex.blockStyles.rowDivider],children:s.map((t,i)=>{const s=e[i],r="string"==typeof s?s:s?.text??"",n="string"==typeof s?void 0:s?.tone;return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.td,0===i&&styles.firstCol,0===i&&styles.tdFirst,n&&{color:(0,_primitivesIndex.toneColor)(n)}],numberOfLines:2,children:(0,_Markdown.renderInline)(r,styles.td)},i)})},t)),(0,_jsxRuntime.jsx)(_primitivesIndex.More,{paged:t})]})}function KeyValue({block:e}){const t=(0,_primitivesIndex.usePaged)(e.pairs,_agentCore.CAPS.keyValuePairs),{visible:i}=t,[s,r]=(0,_react.useState)(null);return(0,_jsxRuntime.jsxs)(_primitivesIndex.Card,{title:e.title,source:e.source,testID:`buoy-block-keyvalue-${e.id}`,children:[i.map((e,t)=>{const i="object"==typeof e.value&&null!==e.value,n=s===e.key;return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:i?()=>r(n?null:e.key):void 0,style:[styles.kvRow,t>0&&_primitivesIndex.blockStyles.rowDivider],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.kvKey,numberOfLines:1,children:e.key}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.kvValue,n&&_primitivesIndex.blockStyles.mono],numberOfLines:n?void 0:2,selectable:!0,children:n?JSON.stringify(e.value,null,2):fmt(e.value)})]},e.key)}),(0,_jsxRuntime.jsx)(_primitivesIndex.More,{paged:t})]})}function listRowBehaviour(e){const t=Boolean(e.image);return{canExpand:t,rowRunsAction:Boolean(e.action)&&!t,actionIsOwnControl:Boolean(e.action)&&t}}function List({block:e}){const t=(0,_primitivesIndex.useBlockHandlers)(),i=(0,_primitivesIndex.usePaged)(e.items,_agentCore.CAPS.listItems),{visible:s}=i,[r,n]=(0,_react.useState)(null);return(0,_jsxRuntime.jsxs)(_primitivesIndex.Card,{title:e.title,source:e.source,testID:`buoy-block-list-${e.id}`,children:[s.map((i,s)=>{const o=`${i.id??i.title}-${s}`,l=r===o,{canExpand:a,rowRunsAction:c,actionIsOwnControl:d}=listRowBehaviour(i),u=a||c?_reactNative.Pressable:_reactNative.View,x=a?{onPress:()=>n(l?null:o),accessibilityRole:"button",accessibilityState:{expanded:l},accessibilityLabel:`${i.title}, ${l?"hide":"show"} picture`,testID:`buoy-block-list-row-${o}`}:c?{onPress:()=>{t.runAction(i.action,e.id)},accessibilityRole:"button"}:{};return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:s>0?_primitivesIndex.blockStyles.rowDivider:void 0,children:[l&&i.image?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>n(null),accessibilityRole:"button",accessibilityLabel:`Hide ${i.title}`,testID:`buoy-block-list-hero-${o}`,style:styles.listHero,children:(0,_jsxRuntime.jsx)(_reactNative.Image,{source:{uri:i.image},style:styles.listHeroImage,resizeMode:"contain",accessibilityLabel:i.title})}):null,(0,_jsxRuntime.jsxs)(u,{...x,style:_primitivesIndex.blockStyles.row,children:[i.image&&!l?(0,_jsxRuntime.jsx)(_reactNative.Image,{source:{uri:i.image},style:styles.thumb,resizeMode:"contain",accessibilityLabel:i.title}):i.icon?(0,_jsxRuntime.jsx)(_icons.BlockIcon,{name:i.icon}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.flex,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitivesIndex.blockStyles.rowTitle,i.tone&&{color:(0,_primitivesIndex.toneColor)(i.tone)}],numberOfLines:l?void 0:2,children:(0,_Markdown.renderInline)(i.title,_primitivesIndex.blockStyles.rowTitle)}),i.subtitle?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitivesIndex.blockStyles.rowSub,numberOfLines:l?void 0:2,children:(0,_Markdown.renderInline)(i.subtitle,_primitivesIndex.blockStyles.rowSub)}):null]}),i.trailing?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitivesIndex.blockStyles.rowTrailing,i.tone&&{color:(0,_primitivesIndex.toneColor)(i.tone)}],numberOfLines:1,children:i.trailing}):null,i.action?d?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>{t.runAction(i.action,e.id)},accessibilityRole:"button",accessibilityLabel:i.action.label,hitSlop:8,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowAction,children:i.action.label})}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowAction,children:i.action.label}):null]})]},o)}),(0,_jsxRuntime.jsx)(_primitivesIndex.More,{paged:i})]})}function isStructured(e){return null!==e&&"object"==typeof e}function diffSummary(e){const t=e.map(e=>e.path),i=t.slice(0,3).join(", "),s=t.length-3;return`${1===t.length?"1 field":`${t.length} fields`} · ${i}${s>0?`, +${s}`:""}`}function Diff({block:e}){const t=(0,_primitivesIndex.usePaged)(e.changes,_agentCore.CAPS.keyValuePairs);return(0,_jsxRuntime.jsxs)(_primitivesIndex.Card,{title:e.title??"What changed",source:e.source,testID:`buoy-block-diff-${e.id}`,collapsible:!0,summary:diffSummary(e.changes),children:[t.visible.map((e,t)=>{const i=void 0===e.before&&void 0!==e.after,s=void 0===e.after&&void 0!==e.before;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.diffRow,t>0&&_primitivesIndex.blockStyles.rowDivider],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.diffPath,numberOfLines:1,children:e.path}),isStructured(e.before)||isStructured(e.after)?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.diffTree,children:(0,_jsxRuntime.jsx)(_dataViewer.TreeDiffViewer,{oldValue:e.before,newValue:e.after,showUnchanged:!1,scrollEnabled:!1})}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[i?null:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffLine,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.diffMark,{color:_sharedUi.night.color.danger}],children:"−"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.diffValue,{color:_sharedUi.night.color.danger}],numberOfLines:3,selectable:!0,children:fmt(e.before)})]}),s?null:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffLine,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.diffMark,{color:_sharedUi.night.color.accent}],children:"+"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.diffValue,{color:_sharedUi.night.color.accent}],numberOfLines:3,selectable:!0,children:fmt(e.after)})]})]})]},`${e.path}-${t}`)}),(0,_jsxRuntime.jsx)(_primitivesIndex.More,{paged:t})]})}function Chart({block:e}){const t=e.bars.slice(0,_agentCore.CAPS.chartBars),i=e.max??Math.max(1,...t.map(e=>e.value));return(0,_jsxRuntime.jsx)(_primitivesIndex.Card,{title:e.title,source:e.source,testID:`buoy-block-chart-${e.id}`,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.chart,children:t.map((e,t)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.barRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.barLabel,numberOfLines:1,children:e.label}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.barTrack,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.bar,{width:`${Math.max(2,Math.round(e.value/i*100))}%`,backgroundColor:(0,_primitivesIndex.toneColor)(e.tone??"accent")}]})}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.barValue,numberOfLines:1,children:[e.value,e.unit?` ${e.unit}`:""]})]},`${e.label}-${t}`))})})}function Steps({block:e}){return(0,_jsxRuntime.jsx)(_primitivesIndex.Card,{title:e.title,testID:`buoy-block-steps-${e.id}`,children:e.steps.map((e,t)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.step,t>0&&_primitivesIndex.blockStyles.rowDivider],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.stepMark,"done"===e.state&&styles.stepDone,"failed"===e.state&&styles.stepFailed],children:"done"===e.state?(0,_jsxRuntime.jsx)(_sharedUi.Check,{size:10,color:_sharedUi.night.color.onAccent}):"failed"===e.state?(0,_jsxRuntime.jsx)(_sharedUi.X,{size:10,color:_sharedUi.night.color.text}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.stepNum,children:t+1})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitivesIndex.blockStyles.rowTitle,"done"===e.state&&styles.stepTextDone],children:e.text})]},t))})}function parseJson(e){try{const t=JSON.parse(e);return null!==t&&"object"==typeof t?t:void 0}catch{return}}function JsonCode({block:e,value:t}){return(0,_jsxRuntime.jsx)(_primitivesIndex.Card,{title:e.title,testID:`buoy-block-code-${e.id}`,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.viewer,children:(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{title:e.title??"Payload",data:t,initialExpanded:!0,showTypeFilter:!1,testIDPrefix:`buoy-block-code-${e.id}`})})})}function TextCode({block:e}){return(0,_jsxRuntime.jsx)(_primitivesIndex.Card,{title:e.title,testID:`buoy-block-code-${e.id}`,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitivesIndex.blockStyles.mono,styles.code],selectable:!0,children:e.text})})}function Code({block:e}){const t=parseJson(e.text);return void 0===t?(0,_jsxRuntime.jsx)(TextCode,{block:e}):(0,_jsxRuntime.jsx)(JsonCode,{block:e,value:t})}function Notice({block:e}){const t="danger"===e.tone?_sharedUi.night.color.danger:"warning"===e.tone?_sharedUi.night.color.warning:_sharedUi.night.color.info,i="info"===e.tone?_sharedUi.Info:_sharedUi.AlertTriangle;return(0,_jsxRuntime.jsxs)(_primitivesIndex.Card,{tone:e.tone,testID:`buoy-block-notice-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.noticeRow,children:[(0,_jsxRuntime.jsx)(i,{size:14,color:t}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.noticeText,children:e.text})]}),(0,_jsxRuntime.jsx)(_primitivesIndex.ActionRow,{actions:e.actions,blockId:e.id})]})}function Finding({block:e}){const{copied:t,copy:i}=(0,_useCopyAction.useCopyAction)(()=>(0,_blockText.blockToText)(e)??e.title);return(0,_jsxRuntime.jsxs)(_primitivesIndex.Card,{title:e.title,source:e.source,testID:`buoy-block-finding-${e.id}`,tone:"warning",children:[e.evidence.map((e,t)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.kvRow,t>0&&_primitivesIndex.blockStyles.rowDivider],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.kvKey,numberOfLines:1,children:e.label}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.kvValue,e.tone&&{color:(0,_primitivesIndex.toneColor)(e.tone)}],selectable:!0,children:e.value})]},`${e.label}-${t}`)),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.findingFoot,children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:`buoy-block-finding-copy-${e.id}`,accessibilityRole:"button",accessibilityLabel:t?"Copied":"Copy this finding",onPress:i,style:({pressed:e})=>[styles.findingCopy,e&&{opacity:.7}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.findingCopyText,t&&{color:_sharedUi.night.color.accent}],children:t?"Copied":"Copy finding"})})}),(0,_jsxRuntime.jsx)(_primitivesIndex.ActionRow,{actions:e.actions,blockId:e.id})]})}const styles=_reactNative.StyleSheet.create({flex:{flex:1},tableHead:{flexDirection:"row",paddingHorizontal:12,paddingVertical:6,gap:8,backgroundColor:_sharedUi.night.color.fill},th:{flex:1,color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro,fontWeight:"700",letterSpacing:.6,textTransform:"uppercase"},tr:{flexDirection:"row",paddingHorizontal:12,paddingVertical:8,gap:8,alignItems:"center"},td:{flex:1,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,lineHeight:17},tdFirst:{color:_sharedUi.night.color.text,fontWeight:"500"},firstCol:{flex:1.4},kvRow:{flexDirection:"row",gap:12,paddingHorizontal:12,paddingVertical:8,alignItems:"flex-start"},kvKey:{width:110,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,paddingTop:1},kvValue:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,lineHeight:17},findingFoot:{flexDirection:"row",paddingHorizontal:12,paddingVertical:8,borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_sharedUi.night.color.separator},findingCopy:{paddingHorizontal:10,paddingVertical:5,borderRadius:_sharedUi.night.radius.badge,backgroundColor:_sharedUi.night.color.fill},findingCopyText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro,fontWeight:"600"},thumb:{width:40,height:40,borderRadius:8,backgroundColor:_sharedUi.night.color.fill},listHero:{paddingHorizontal:12,paddingTop:12},listHeroImage:{width:"100%",height:240,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.fill},rowAction:{color:_sharedUi.night.color.accent,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},diffRow:{paddingHorizontal:12,paddingVertical:8,gap:3},diffPath:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro,fontWeight:"600",letterSpacing:.3},diffLine:{flexDirection:"row",gap:8,alignItems:"flex-start"},diffMark:{fontFamily:"Menlo",fontSize:12,width:10},diffValue:{flex:1,fontFamily:"Menlo",fontSize:12,lineHeight:16},diffTree:{borderRadius:_sharedUi.night.radius.row,overflow:"hidden"},chart:{paddingHorizontal:12,paddingVertical:10,gap:8},barRow:{flexDirection:"row",alignItems:"center",gap:8},barLabel:{width:96,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption},barTrack:{flex:1,height:10,borderRadius:5,backgroundColor:_sharedUi.night.color.fill,overflow:"hidden"},bar:{height:10,borderRadius:5},barValue:{width:72,textAlign:"right",color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},step:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:12,paddingVertical:9},stepMark:{width:20,height:20,borderRadius:10,backgroundColor:_sharedUi.night.color.fillTertiary,alignItems:"center",justifyContent:"center"},stepDone:{backgroundColor:_sharedUi.night.color.accent},stepFailed:{backgroundColor:_sharedUi.night.color.danger},stepNum:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.micro,fontWeight:"700"},stepTextDone:{color:_sharedUi.night.color.textSecondary},viewer:{paddingHorizontal:4,paddingBottom:8},code:{paddingHorizontal:12,paddingVertical:10,lineHeight:17},noticeRow:{flexDirection:"row",alignItems:"flex-start",gap:8,paddingHorizontal:12,paddingTop:10,paddingBottom:4},noticeText:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,lineHeight:18}});
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Chart = Chart;
|
|
7
|
+
exports.Code = Code;
|
|
8
|
+
exports.Diff = Diff;
|
|
9
|
+
exports.Finding = Finding;
|
|
10
|
+
exports.KeyValue = KeyValue;
|
|
11
|
+
exports.List = List;
|
|
12
|
+
exports.Notice = Notice;
|
|
13
|
+
exports.Steps = Steps;
|
|
14
|
+
exports.Table = Table;
|
|
15
|
+
exports.listRowBehaviour = listRowBehaviour;
|
|
16
|
+
var _react = require("react");
|
|
17
|
+
var _reactNative = require("react-native");
|
|
18
|
+
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
19
|
+
var _dataViewer = require("@buoy-gg/shared-ui/dataViewer");
|
|
20
|
+
var _agentCore = require("@buoy-gg/agent-core");
|
|
21
|
+
var _primitivesIndex = require("./primitivesIndex");
|
|
22
|
+
var _Markdown = require("../components/Markdown");
|
|
23
|
+
var _useCopyAction = require("../components/useCopyAction");
|
|
24
|
+
var _blockText = require("./blockText");
|
|
25
|
+
var _icons = require("./icons");
|
|
26
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
|
+
/**
|
|
28
|
+
* Show blocks — data the user should see rather than read.
|
|
29
|
+
* Every one honours a cap and says "+N more" rather than growing the page.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
function fmt(v) {
|
|
33
|
+
if (v === undefined) return "—";
|
|
34
|
+
if (v === null) return "null";
|
|
35
|
+
if (typeof v === "string") return v;
|
|
36
|
+
if (typeof v === "number" || typeof v === "boolean") return String(v);
|
|
37
|
+
try {
|
|
38
|
+
const s = JSON.stringify(v);
|
|
39
|
+
return s.length > 120 ? `${s.slice(0, 117)}…` : s;
|
|
40
|
+
} catch {
|
|
41
|
+
return String(v);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function Table({
|
|
45
|
+
block
|
|
46
|
+
}) {
|
|
47
|
+
const paged = (0, _primitivesIndex.usePaged)(block.rows, _agentCore.CAPS.tableRows);
|
|
48
|
+
const {
|
|
49
|
+
visible
|
|
50
|
+
} = paged;
|
|
51
|
+
const cols = block.columns.slice(0, 4);
|
|
52
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitivesIndex.Card, {
|
|
53
|
+
title: block.title,
|
|
54
|
+
source: block.source,
|
|
55
|
+
testID: `buoy-block-table-${block.id}`,
|
|
56
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
57
|
+
style: styles.tableHead,
|
|
58
|
+
children: cols.map((c, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
59
|
+
style: [styles.th, i === 0 && styles.firstCol],
|
|
60
|
+
numberOfLines: 1,
|
|
61
|
+
children: c
|
|
62
|
+
}, c))
|
|
63
|
+
}), visible.map((row, r) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
64
|
+
style: [styles.tr, r > 0 && _primitivesIndex.blockStyles.rowDivider],
|
|
65
|
+
children: cols.map((_, i) => {
|
|
66
|
+
const cell = row[i];
|
|
67
|
+
const text = typeof cell === "string" ? cell : cell?.text ?? "";
|
|
68
|
+
const tone = typeof cell === "string" ? undefined : cell?.tone;
|
|
69
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
70
|
+
style: [styles.td, i === 0 && styles.firstCol, i === 0 && styles.tdFirst, tone && {
|
|
71
|
+
color: (0, _primitivesIndex.toneColor)(tone)
|
|
72
|
+
}],
|
|
73
|
+
numberOfLines: 2,
|
|
74
|
+
children: (0, _Markdown.renderInline)(text, styles.td)
|
|
75
|
+
}, i);
|
|
76
|
+
})
|
|
77
|
+
}, r)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitivesIndex.More, {
|
|
78
|
+
paged: paged
|
|
79
|
+
})]
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function KeyValue({
|
|
83
|
+
block
|
|
84
|
+
}) {
|
|
85
|
+
const paged = (0, _primitivesIndex.usePaged)(block.pairs, _agentCore.CAPS.keyValuePairs);
|
|
86
|
+
const {
|
|
87
|
+
visible
|
|
88
|
+
} = paged;
|
|
89
|
+
const [open, setOpen] = (0, _react.useState)(null);
|
|
90
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitivesIndex.Card, {
|
|
91
|
+
title: block.title,
|
|
92
|
+
source: block.source,
|
|
93
|
+
testID: `buoy-block-keyvalue-${block.id}`,
|
|
94
|
+
children: [visible.map((p, i) => {
|
|
95
|
+
const long = typeof p.value === "object" && p.value !== null;
|
|
96
|
+
const isOpen = open === p.key;
|
|
97
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
|
|
98
|
+
onPress: long ? () => setOpen(isOpen ? null : p.key) : undefined,
|
|
99
|
+
style: [styles.kvRow, i > 0 && _primitivesIndex.blockStyles.rowDivider],
|
|
100
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
101
|
+
style: styles.kvKey,
|
|
102
|
+
numberOfLines: 1,
|
|
103
|
+
children: p.key
|
|
104
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
105
|
+
style: [styles.kvValue, isOpen && _primitivesIndex.blockStyles.mono],
|
|
106
|
+
numberOfLines: isOpen ? undefined : 2,
|
|
107
|
+
selectable: true,
|
|
108
|
+
children: isOpen ? JSON.stringify(p.value, null, 2) : fmt(p.value)
|
|
109
|
+
})]
|
|
110
|
+
}, p.key);
|
|
111
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitivesIndex.More, {
|
|
112
|
+
paged: paged
|
|
113
|
+
})]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Keys carry the index as well as the id.
|
|
119
|
+
*
|
|
120
|
+
* The ids in here come from the app's own data, and app data is not required
|
|
121
|
+
* to be unique — a Poké Mart bag in this repo holds two lines sharing one
|
|
122
|
+
* `lineId`, which is a bug in that app but must not be one in a devtool
|
|
123
|
+
* rendering it. Paging made it visible: the duplicate sat past the initial cap,
|
|
124
|
+
* so React only saw the collision on the first "Show more".
|
|
125
|
+
*/
|
|
126
|
+
/**
|
|
127
|
+
* What a tapped list row does.
|
|
128
|
+
*
|
|
129
|
+
* A row can carry a picture and an action, and they want the same gesture. The
|
|
130
|
+
* picture wins the row body — looking at a thing must not fire it — and the
|
|
131
|
+
* action keeps its label as its own control. A row with no picture is
|
|
132
|
+
* unchanged: the whole row runs the action, which is what it did before rows
|
|
133
|
+
* could open.
|
|
134
|
+
*/
|
|
135
|
+
function listRowBehaviour(item) {
|
|
136
|
+
const canExpand = Boolean(item.image);
|
|
137
|
+
return {
|
|
138
|
+
canExpand,
|
|
139
|
+
rowRunsAction: Boolean(item.action) && !canExpand,
|
|
140
|
+
actionIsOwnControl: Boolean(item.action) && canExpand
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function List({
|
|
144
|
+
block
|
|
145
|
+
}) {
|
|
146
|
+
const h = (0, _primitivesIndex.useBlockHandlers)();
|
|
147
|
+
const paged = (0, _primitivesIndex.usePaged)(block.items, _agentCore.CAPS.listItems);
|
|
148
|
+
const {
|
|
149
|
+
visible
|
|
150
|
+
} = paged;
|
|
151
|
+
// One row open at a time, keyed the same way the row is — the list can hold
|
|
152
|
+
// duplicate ids (see the note above), so the index is part of the key.
|
|
153
|
+
const [open, setOpen] = (0, _react.useState)(null);
|
|
154
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitivesIndex.Card, {
|
|
155
|
+
title: block.title,
|
|
156
|
+
source: block.source,
|
|
157
|
+
testID: `buoy-block-list-${block.id}`,
|
|
158
|
+
children: [visible.map((it, i) => {
|
|
159
|
+
const key = `${it.id ?? it.title}-${i}`;
|
|
160
|
+
const expanded = open === key;
|
|
161
|
+
// A row with a picture opens it; a row without one keeps the old
|
|
162
|
+
// behaviour, where the whole row runs its action. When an item has
|
|
163
|
+
// BOTH, the body toggles the image and the action label becomes its
|
|
164
|
+
// own control — otherwise the two gestures would sit on one target and
|
|
165
|
+
// looking at a thing would fire it.
|
|
166
|
+
const {
|
|
167
|
+
canExpand,
|
|
168
|
+
rowRunsAction,
|
|
169
|
+
actionIsOwnControl
|
|
170
|
+
} = listRowBehaviour(it);
|
|
171
|
+
const Row = canExpand || rowRunsAction ? _reactNative.Pressable : _reactNative.View;
|
|
172
|
+
const rowProps = canExpand ? {
|
|
173
|
+
onPress: () => setOpen(expanded ? null : key),
|
|
174
|
+
accessibilityRole: "button",
|
|
175
|
+
accessibilityState: {
|
|
176
|
+
expanded
|
|
177
|
+
},
|
|
178
|
+
accessibilityLabel: `${it.title}, ${expanded ? "hide" : "show"} picture`,
|
|
179
|
+
testID: `buoy-block-list-row-${key}`
|
|
180
|
+
} : rowRunsAction ? {
|
|
181
|
+
onPress: () => void h.runAction(it.action, block.id),
|
|
182
|
+
accessibilityRole: "button"
|
|
183
|
+
} : {};
|
|
184
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
185
|
+
style: i > 0 ? _primitivesIndex.blockStyles.rowDivider : undefined,
|
|
186
|
+
children: [expanded && it.image ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
187
|
+
onPress: () => setOpen(null),
|
|
188
|
+
accessibilityRole: "button",
|
|
189
|
+
accessibilityLabel: `Hide ${it.title}`,
|
|
190
|
+
testID: `buoy-block-list-hero-${key}`,
|
|
191
|
+
style: styles.listHero,
|
|
192
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
|
|
193
|
+
source: {
|
|
194
|
+
uri: it.image
|
|
195
|
+
},
|
|
196
|
+
style: styles.listHeroImage,
|
|
197
|
+
resizeMode: "contain",
|
|
198
|
+
accessibilityLabel: it.title
|
|
199
|
+
})
|
|
200
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(Row, {
|
|
201
|
+
...rowProps,
|
|
202
|
+
style: _primitivesIndex.blockStyles.row,
|
|
203
|
+
children: [it.image && !expanded ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
|
|
204
|
+
source: {
|
|
205
|
+
uri: it.image
|
|
206
|
+
},
|
|
207
|
+
style: styles.thumb,
|
|
208
|
+
resizeMode: "contain",
|
|
209
|
+
accessibilityLabel: it.title
|
|
210
|
+
}) : it.icon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.BlockIcon, {
|
|
211
|
+
name: it.icon
|
|
212
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
213
|
+
style: styles.flex,
|
|
214
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
215
|
+
style: [_primitivesIndex.blockStyles.rowTitle, it.tone && {
|
|
216
|
+
color: (0, _primitivesIndex.toneColor)(it.tone)
|
|
217
|
+
}],
|
|
218
|
+
numberOfLines: expanded ? undefined : 2,
|
|
219
|
+
children: (0, _Markdown.renderInline)(it.title, _primitivesIndex.blockStyles.rowTitle)
|
|
220
|
+
}), it.subtitle ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
221
|
+
style: _primitivesIndex.blockStyles.rowSub,
|
|
222
|
+
numberOfLines: expanded ? undefined : 2,
|
|
223
|
+
children: (0, _Markdown.renderInline)(it.subtitle, _primitivesIndex.blockStyles.rowSub)
|
|
224
|
+
}) : null]
|
|
225
|
+
}), it.trailing ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
226
|
+
style: [_primitivesIndex.blockStyles.rowTrailing, it.tone && {
|
|
227
|
+
color: (0, _primitivesIndex.toneColor)(it.tone)
|
|
228
|
+
}],
|
|
229
|
+
numberOfLines: 1,
|
|
230
|
+
children: it.trailing
|
|
231
|
+
}) : null, it.action ? actionIsOwnControl ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
232
|
+
onPress: () => void h.runAction(it.action, block.id),
|
|
233
|
+
accessibilityRole: "button",
|
|
234
|
+
accessibilityLabel: it.action.label,
|
|
235
|
+
hitSlop: 8,
|
|
236
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
237
|
+
style: styles.rowAction,
|
|
238
|
+
children: it.action.label
|
|
239
|
+
})
|
|
240
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
241
|
+
style: styles.rowAction,
|
|
242
|
+
children: it.action.label
|
|
243
|
+
}) : null]
|
|
244
|
+
})]
|
|
245
|
+
}, key);
|
|
246
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitivesIndex.More, {
|
|
247
|
+
paged: paged
|
|
248
|
+
})]
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/** An object or an array — something the tree viewer can drill into. */
|
|
253
|
+
function isStructured(v) {
|
|
254
|
+
return v !== null && typeof v === "object";
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* The line that stands in for a folded diff: how many fields, and which.
|
|
259
|
+
* Names beat a bare count — "1 field · lines" tells you whether to open it.
|
|
260
|
+
*/
|
|
261
|
+
function diffSummary(changes) {
|
|
262
|
+
const names = changes.map(c => c.path);
|
|
263
|
+
const shown = names.slice(0, 3).join(", ");
|
|
264
|
+
const rest = names.length - 3;
|
|
265
|
+
const noun = names.length === 1 ? "1 field" : `${names.length} fields`;
|
|
266
|
+
return `${noun} · ${shown}${rest > 0 ? `, +${rest}` : ""}`;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* What a write changed. Folded by default (see `Card`), and drilled into
|
|
271
|
+
* rather than dumped.
|
|
272
|
+
*
|
|
273
|
+
* A changed field is rendered by the same tree diff viewer the Zustand and
|
|
274
|
+
* Storage tools use, with unchanged branches hidden — so editing one line of a
|
|
275
|
+
* bag shows `qty 4 => 14` and not both copies of a fifty-key array serialised
|
|
276
|
+
* to JSON, which is what the reader was given before and could not read. Only
|
|
277
|
+
* a scalar keeps the plain −/+ pair: a tree of one root node says less than
|
|
278
|
+
* the two values side by side.
|
|
279
|
+
*/
|
|
280
|
+
function Diff({
|
|
281
|
+
block
|
|
282
|
+
}) {
|
|
283
|
+
const paged = (0, _primitivesIndex.usePaged)(block.changes, _agentCore.CAPS.keyValuePairs);
|
|
284
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitivesIndex.Card, {
|
|
285
|
+
title: block.title ?? "What changed",
|
|
286
|
+
source: block.source,
|
|
287
|
+
testID: `buoy-block-diff-${block.id}`,
|
|
288
|
+
collapsible: true,
|
|
289
|
+
summary: diffSummary(block.changes),
|
|
290
|
+
children: [paged.visible.map((c, i) => {
|
|
291
|
+
const added = c.before === undefined && c.after !== undefined;
|
|
292
|
+
const removed = c.after === undefined && c.before !== undefined;
|
|
293
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
294
|
+
style: [styles.diffRow, i > 0 && _primitivesIndex.blockStyles.rowDivider],
|
|
295
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
296
|
+
style: styles.diffPath,
|
|
297
|
+
numberOfLines: 1,
|
|
298
|
+
children: c.path
|
|
299
|
+
}), isStructured(c.before) || isStructured(c.after) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
300
|
+
style: styles.diffTree,
|
|
301
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_dataViewer.TreeDiffViewer, {
|
|
302
|
+
oldValue: c.before,
|
|
303
|
+
newValue: c.after,
|
|
304
|
+
showUnchanged: false,
|
|
305
|
+
scrollEnabled: false
|
|
306
|
+
})
|
|
307
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
308
|
+
children: [!added ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
309
|
+
style: styles.diffLine,
|
|
310
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
311
|
+
style: [styles.diffMark, {
|
|
312
|
+
color: _sharedUi.night.color.danger
|
|
313
|
+
}],
|
|
314
|
+
children: "\u2212"
|
|
315
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
316
|
+
style: [styles.diffValue, {
|
|
317
|
+
color: _sharedUi.night.color.danger
|
|
318
|
+
}],
|
|
319
|
+
numberOfLines: 3,
|
|
320
|
+
selectable: true,
|
|
321
|
+
children: fmt(c.before)
|
|
322
|
+
})]
|
|
323
|
+
}) : null, !removed ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
324
|
+
style: styles.diffLine,
|
|
325
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
326
|
+
style: [styles.diffMark, {
|
|
327
|
+
color: _sharedUi.night.color.accent
|
|
328
|
+
}],
|
|
329
|
+
children: "+"
|
|
330
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
331
|
+
style: [styles.diffValue, {
|
|
332
|
+
color: _sharedUi.night.color.accent
|
|
333
|
+
}],
|
|
334
|
+
numberOfLines: 3,
|
|
335
|
+
selectable: true,
|
|
336
|
+
children: fmt(c.after)
|
|
337
|
+
})]
|
|
338
|
+
}) : null]
|
|
339
|
+
})]
|
|
340
|
+
}, `${c.path}-${i}`);
|
|
341
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitivesIndex.More, {
|
|
342
|
+
paged: paged
|
|
343
|
+
})]
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
function Chart({
|
|
347
|
+
block
|
|
348
|
+
}) {
|
|
349
|
+
const bars = block.bars.slice(0, _agentCore.CAPS.chartBars);
|
|
350
|
+
const max = block.max ?? Math.max(1, ...bars.map(x => x.value));
|
|
351
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitivesIndex.Card, {
|
|
352
|
+
title: block.title,
|
|
353
|
+
source: block.source,
|
|
354
|
+
testID: `buoy-block-chart-${block.id}`,
|
|
355
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
356
|
+
style: styles.chart,
|
|
357
|
+
children: bars.map((x, i) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
358
|
+
style: styles.barRow,
|
|
359
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
360
|
+
style: styles.barLabel,
|
|
361
|
+
numberOfLines: 1,
|
|
362
|
+
children: x.label
|
|
363
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
364
|
+
style: styles.barTrack,
|
|
365
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
366
|
+
style: [styles.bar, {
|
|
367
|
+
width: `${Math.max(2, Math.round(x.value / max * 100))}%`,
|
|
368
|
+
backgroundColor: (0, _primitivesIndex.toneColor)(x.tone ?? "accent")
|
|
369
|
+
}]
|
|
370
|
+
})
|
|
371
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
372
|
+
style: styles.barValue,
|
|
373
|
+
numberOfLines: 1,
|
|
374
|
+
children: [x.value, x.unit ? ` ${x.unit}` : ""]
|
|
375
|
+
})]
|
|
376
|
+
}, `${x.label}-${i}`))
|
|
377
|
+
})
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
function Steps({
|
|
381
|
+
block
|
|
382
|
+
}) {
|
|
383
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitivesIndex.Card, {
|
|
384
|
+
title: block.title,
|
|
385
|
+
testID: `buoy-block-steps-${block.id}`,
|
|
386
|
+
children: block.steps.map((s, i) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
387
|
+
style: [styles.step, i > 0 && _primitivesIndex.blockStyles.rowDivider],
|
|
388
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
389
|
+
style: [styles.stepMark, s.state === "done" && styles.stepDone, s.state === "failed" && styles.stepFailed],
|
|
390
|
+
children: s.state === "done" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Check, {
|
|
391
|
+
size: 10,
|
|
392
|
+
color: _sharedUi.night.color.onAccent
|
|
393
|
+
}) : s.state === "failed" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.X, {
|
|
394
|
+
size: 10,
|
|
395
|
+
color: _sharedUi.night.color.text
|
|
396
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
397
|
+
style: styles.stepNum,
|
|
398
|
+
children: i + 1
|
|
399
|
+
})
|
|
400
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
401
|
+
style: [_primitivesIndex.blockStyles.rowTitle, s.state === "done" && styles.stepTextDone],
|
|
402
|
+
children: s.text
|
|
403
|
+
})]
|
|
404
|
+
}, i))
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Parsed JSON, or `undefined` when the payload is not JSON at all.
|
|
410
|
+
*
|
|
411
|
+
* A bare string, number or boolean parses fine and is deliberately rejected:
|
|
412
|
+
* `"hello"` is valid JSON and a tree of one leaf is a worse way to read it
|
|
413
|
+
* than the line itself.
|
|
414
|
+
*/
|
|
415
|
+
function parseJson(text) {
|
|
416
|
+
try {
|
|
417
|
+
const value = JSON.parse(text);
|
|
418
|
+
return value !== null && typeof value === "object" ? value : undefined;
|
|
419
|
+
} catch {
|
|
420
|
+
return undefined;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* A JSON payload, in the same explorer Storage and Network use.
|
|
426
|
+
*
|
|
427
|
+
* Worth the weight over a pretty-printed string: it collapses, it types its
|
|
428
|
+
* values, and the thing you are usually hunting — one wrong field deep in a
|
|
429
|
+
* response body — is findable instead of buried in forty lines of monospace.
|
|
430
|
+
* The explorer's own lists run `scrollEnabled={false}` and grow to their
|
|
431
|
+
* content, so nothing nests a scroller inside the transcript.
|
|
432
|
+
*/
|
|
433
|
+
function JsonCode({
|
|
434
|
+
block,
|
|
435
|
+
value
|
|
436
|
+
}) {
|
|
437
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitivesIndex.Card, {
|
|
438
|
+
title: block.title,
|
|
439
|
+
testID: `buoy-block-code-${block.id}`,
|
|
440
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
441
|
+
style: styles.viewer,
|
|
442
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_dataViewer.DataViewer, {
|
|
443
|
+
title: block.title ?? "Payload",
|
|
444
|
+
data: value,
|
|
445
|
+
initialExpanded: true,
|
|
446
|
+
showTypeFilter: false,
|
|
447
|
+
testIDPrefix: `buoy-block-code-${block.id}`
|
|
448
|
+
})
|
|
449
|
+
})
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/** Anything that is not a JSON object: a log line, a stack, a snippet. */
|
|
454
|
+
function TextCode({
|
|
455
|
+
block
|
|
456
|
+
}) {
|
|
457
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitivesIndex.Card, {
|
|
458
|
+
title: block.title,
|
|
459
|
+
testID: `buoy-block-code-${block.id}`,
|
|
460
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
461
|
+
style: [_primitivesIndex.blockStyles.mono, styles.code],
|
|
462
|
+
selectable: true,
|
|
463
|
+
children: block.text
|
|
464
|
+
})
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Router, per rule4: two specialised components rather than one that changes
|
|
470
|
+
* shape. A `cond ? <A/> : <B/>` inside a single component is the Fabric
|
|
471
|
+
* view-index hazard, and these two subtrees have nothing in common.
|
|
472
|
+
*/
|
|
473
|
+
function Code({
|
|
474
|
+
block
|
|
475
|
+
}) {
|
|
476
|
+
const value = parseJson(block.text);
|
|
477
|
+
if (value === undefined) return /*#__PURE__*/(0, _jsxRuntime.jsx)(TextCode, {
|
|
478
|
+
block: block
|
|
479
|
+
});
|
|
480
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(JsonCode, {
|
|
481
|
+
block: block,
|
|
482
|
+
value: value
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
function Notice({
|
|
486
|
+
block
|
|
487
|
+
}) {
|
|
488
|
+
const color = block.tone === "danger" ? _sharedUi.night.color.danger : block.tone === "warning" ? _sharedUi.night.color.warning : _sharedUi.night.color.info;
|
|
489
|
+
const Icon = block.tone === "info" ? _sharedUi.Info : _sharedUi.AlertTriangle;
|
|
490
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitivesIndex.Card, {
|
|
491
|
+
tone: block.tone,
|
|
492
|
+
testID: `buoy-block-notice-${block.id}`,
|
|
493
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
494
|
+
style: styles.noticeRow,
|
|
495
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, {
|
|
496
|
+
size: 14,
|
|
497
|
+
color: color
|
|
498
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
499
|
+
style: styles.noticeText,
|
|
500
|
+
children: block.text
|
|
501
|
+
})]
|
|
502
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitivesIndex.ActionRow, {
|
|
503
|
+
actions: block.actions,
|
|
504
|
+
blockId: block.id
|
|
505
|
+
})]
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
function Finding({
|
|
509
|
+
block
|
|
510
|
+
}) {
|
|
511
|
+
// A finding exists to leave the phone. Its own Copy, with the title and
|
|
512
|
+
// every evidence row — the conversation-wide Copy includes it too, but a
|
|
513
|
+
// ticket wants just this.
|
|
514
|
+
const {
|
|
515
|
+
copied,
|
|
516
|
+
copy
|
|
517
|
+
} = (0, _useCopyAction.useCopyAction)(() => (0, _blockText.blockToText)(block) ?? block.title);
|
|
518
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitivesIndex.Card, {
|
|
519
|
+
title: block.title,
|
|
520
|
+
source: block.source,
|
|
521
|
+
testID: `buoy-block-finding-${block.id}`,
|
|
522
|
+
tone: "warning",
|
|
523
|
+
children: [block.evidence.map((e, i) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
524
|
+
style: [styles.kvRow, i > 0 && _primitivesIndex.blockStyles.rowDivider],
|
|
525
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
526
|
+
style: styles.kvKey,
|
|
527
|
+
numberOfLines: 1,
|
|
528
|
+
children: e.label
|
|
529
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
530
|
+
style: [styles.kvValue, e.tone && {
|
|
531
|
+
color: (0, _primitivesIndex.toneColor)(e.tone)
|
|
532
|
+
}],
|
|
533
|
+
selectable: true,
|
|
534
|
+
children: e.value
|
|
535
|
+
})]
|
|
536
|
+
}, `${e.label}-${i}`)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
537
|
+
style: styles.findingFoot,
|
|
538
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
539
|
+
testID: `buoy-block-finding-copy-${block.id}`,
|
|
540
|
+
accessibilityRole: "button",
|
|
541
|
+
accessibilityLabel: copied ? "Copied" : "Copy this finding",
|
|
542
|
+
onPress: copy,
|
|
543
|
+
style: ({
|
|
544
|
+
pressed
|
|
545
|
+
}) => [styles.findingCopy, pressed && {
|
|
546
|
+
opacity: 0.7
|
|
547
|
+
}],
|
|
548
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
549
|
+
style: [styles.findingCopyText, copied && {
|
|
550
|
+
color: _sharedUi.night.color.accent
|
|
551
|
+
}],
|
|
552
|
+
children: copied ? "Copied" : "Copy finding"
|
|
553
|
+
})
|
|
554
|
+
})
|
|
555
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitivesIndex.ActionRow, {
|
|
556
|
+
actions: block.actions,
|
|
557
|
+
blockId: block.id
|
|
558
|
+
})]
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
const styles = _reactNative.StyleSheet.create({
|
|
562
|
+
flex: {
|
|
563
|
+
flex: 1
|
|
564
|
+
},
|
|
565
|
+
tableHead: {
|
|
566
|
+
flexDirection: "row",
|
|
567
|
+
paddingHorizontal: 12,
|
|
568
|
+
paddingVertical: 6,
|
|
569
|
+
gap: 8,
|
|
570
|
+
backgroundColor: _sharedUi.night.color.fill
|
|
571
|
+
},
|
|
572
|
+
th: {
|
|
573
|
+
flex: 1,
|
|
574
|
+
color: _sharedUi.night.color.textTertiary,
|
|
575
|
+
fontSize: _sharedUi.night.font.micro,
|
|
576
|
+
fontWeight: "700",
|
|
577
|
+
letterSpacing: 0.6,
|
|
578
|
+
textTransform: "uppercase"
|
|
579
|
+
},
|
|
580
|
+
tr: {
|
|
581
|
+
flexDirection: "row",
|
|
582
|
+
paddingHorizontal: 12,
|
|
583
|
+
paddingVertical: 8,
|
|
584
|
+
gap: 8,
|
|
585
|
+
alignItems: "center"
|
|
586
|
+
},
|
|
587
|
+
td: {
|
|
588
|
+
flex: 1,
|
|
589
|
+
color: _sharedUi.night.color.textSecondary,
|
|
590
|
+
fontSize: _sharedUi.night.font.caption,
|
|
591
|
+
lineHeight: 17
|
|
592
|
+
},
|
|
593
|
+
tdFirst: {
|
|
594
|
+
color: _sharedUi.night.color.text,
|
|
595
|
+
fontWeight: "500"
|
|
596
|
+
},
|
|
597
|
+
firstCol: {
|
|
598
|
+
flex: 1.4
|
|
599
|
+
},
|
|
600
|
+
kvRow: {
|
|
601
|
+
flexDirection: "row",
|
|
602
|
+
gap: 12,
|
|
603
|
+
paddingHorizontal: 12,
|
|
604
|
+
paddingVertical: 8,
|
|
605
|
+
alignItems: "flex-start"
|
|
606
|
+
},
|
|
607
|
+
kvKey: {
|
|
608
|
+
width: 110,
|
|
609
|
+
color: _sharedUi.night.color.textSecondary,
|
|
610
|
+
fontSize: _sharedUi.night.font.caption,
|
|
611
|
+
paddingTop: 1
|
|
612
|
+
},
|
|
613
|
+
kvValue: {
|
|
614
|
+
flex: 1,
|
|
615
|
+
color: _sharedUi.night.color.text,
|
|
616
|
+
fontSize: _sharedUi.night.font.caption,
|
|
617
|
+
lineHeight: 17
|
|
618
|
+
},
|
|
619
|
+
findingFoot: {
|
|
620
|
+
flexDirection: "row",
|
|
621
|
+
paddingHorizontal: 12,
|
|
622
|
+
paddingVertical: 8,
|
|
623
|
+
borderTopWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
624
|
+
borderTopColor: _sharedUi.night.color.separator
|
|
625
|
+
},
|
|
626
|
+
findingCopy: {
|
|
627
|
+
paddingHorizontal: 10,
|
|
628
|
+
paddingVertical: 5,
|
|
629
|
+
borderRadius: _sharedUi.night.radius.badge,
|
|
630
|
+
backgroundColor: _sharedUi.night.color.fill
|
|
631
|
+
},
|
|
632
|
+
findingCopyText: {
|
|
633
|
+
color: _sharedUi.night.color.textSecondary,
|
|
634
|
+
fontSize: _sharedUi.night.font.micro,
|
|
635
|
+
fontWeight: "600"
|
|
636
|
+
},
|
|
637
|
+
thumb: {
|
|
638
|
+
width: 40,
|
|
639
|
+
height: 40,
|
|
640
|
+
borderRadius: 8,
|
|
641
|
+
backgroundColor: _sharedUi.night.color.fill
|
|
642
|
+
},
|
|
643
|
+
// The enlarged picture, sitting above the row it belongs to. Same height and
|
|
644
|
+
// fitting as `imageGrid`'s hero so the two blocks enlarge alike.
|
|
645
|
+
listHero: {
|
|
646
|
+
paddingHorizontal: 12,
|
|
647
|
+
paddingTop: 12
|
|
648
|
+
},
|
|
649
|
+
listHeroImage: {
|
|
650
|
+
width: "100%",
|
|
651
|
+
height: 240,
|
|
652
|
+
borderRadius: _sharedUi.night.radius.row,
|
|
653
|
+
backgroundColor: _sharedUi.night.color.fill
|
|
654
|
+
},
|
|
655
|
+
rowAction: {
|
|
656
|
+
color: _sharedUi.night.color.accent,
|
|
657
|
+
fontSize: _sharedUi.night.font.caption,
|
|
658
|
+
fontWeight: "600"
|
|
659
|
+
},
|
|
660
|
+
diffRow: {
|
|
661
|
+
paddingHorizontal: 12,
|
|
662
|
+
paddingVertical: 8,
|
|
663
|
+
gap: 3
|
|
664
|
+
},
|
|
665
|
+
diffPath: {
|
|
666
|
+
color: _sharedUi.night.color.textSecondary,
|
|
667
|
+
fontSize: _sharedUi.night.font.micro,
|
|
668
|
+
fontWeight: "600",
|
|
669
|
+
letterSpacing: 0.3
|
|
670
|
+
},
|
|
671
|
+
diffLine: {
|
|
672
|
+
flexDirection: "row",
|
|
673
|
+
gap: 8,
|
|
674
|
+
alignItems: "flex-start"
|
|
675
|
+
},
|
|
676
|
+
diffMark: {
|
|
677
|
+
fontFamily: "Menlo",
|
|
678
|
+
fontSize: 12,
|
|
679
|
+
width: 10
|
|
680
|
+
},
|
|
681
|
+
diffValue: {
|
|
682
|
+
flex: 1,
|
|
683
|
+
fontFamily: "Menlo",
|
|
684
|
+
fontSize: 12,
|
|
685
|
+
lineHeight: 16
|
|
686
|
+
},
|
|
687
|
+
// The tree viewer paints its own ground; round it so it reads as a well
|
|
688
|
+
// inside the card rather than a second card butted against the first.
|
|
689
|
+
diffTree: {
|
|
690
|
+
borderRadius: _sharedUi.night.radius.row,
|
|
691
|
+
overflow: "hidden"
|
|
692
|
+
},
|
|
693
|
+
chart: {
|
|
694
|
+
paddingHorizontal: 12,
|
|
695
|
+
paddingVertical: 10,
|
|
696
|
+
gap: 8
|
|
697
|
+
},
|
|
698
|
+
barRow: {
|
|
699
|
+
flexDirection: "row",
|
|
700
|
+
alignItems: "center",
|
|
701
|
+
gap: 8
|
|
702
|
+
},
|
|
703
|
+
barLabel: {
|
|
704
|
+
width: 96,
|
|
705
|
+
color: _sharedUi.night.color.textSecondary,
|
|
706
|
+
fontSize: _sharedUi.night.font.caption
|
|
707
|
+
},
|
|
708
|
+
barTrack: {
|
|
709
|
+
flex: 1,
|
|
710
|
+
height: 10,
|
|
711
|
+
borderRadius: 5,
|
|
712
|
+
backgroundColor: _sharedUi.night.color.fill,
|
|
713
|
+
overflow: "hidden"
|
|
714
|
+
},
|
|
715
|
+
bar: {
|
|
716
|
+
height: 10,
|
|
717
|
+
borderRadius: 5
|
|
718
|
+
},
|
|
719
|
+
barValue: {
|
|
720
|
+
width: 72,
|
|
721
|
+
textAlign: "right",
|
|
722
|
+
color: _sharedUi.night.color.text,
|
|
723
|
+
fontSize: _sharedUi.night.font.caption,
|
|
724
|
+
fontWeight: "600"
|
|
725
|
+
},
|
|
726
|
+
step: {
|
|
727
|
+
flexDirection: "row",
|
|
728
|
+
alignItems: "center",
|
|
729
|
+
gap: 10,
|
|
730
|
+
paddingHorizontal: 12,
|
|
731
|
+
paddingVertical: 9
|
|
732
|
+
},
|
|
733
|
+
stepMark: {
|
|
734
|
+
width: 20,
|
|
735
|
+
height: 20,
|
|
736
|
+
borderRadius: 10,
|
|
737
|
+
backgroundColor: _sharedUi.night.color.fillTertiary,
|
|
738
|
+
alignItems: "center",
|
|
739
|
+
justifyContent: "center"
|
|
740
|
+
},
|
|
741
|
+
stepDone: {
|
|
742
|
+
backgroundColor: _sharedUi.night.color.accent
|
|
743
|
+
},
|
|
744
|
+
stepFailed: {
|
|
745
|
+
backgroundColor: _sharedUi.night.color.danger
|
|
746
|
+
},
|
|
747
|
+
stepNum: {
|
|
748
|
+
color: _sharedUi.night.color.text,
|
|
749
|
+
fontSize: _sharedUi.night.font.micro,
|
|
750
|
+
fontWeight: "700"
|
|
751
|
+
},
|
|
752
|
+
stepTextDone: {
|
|
753
|
+
color: _sharedUi.night.color.textSecondary
|
|
754
|
+
},
|
|
755
|
+
// The explorer draws its own rows; this is only the inset that keeps them
|
|
756
|
+
// off the card's edge, matching every other block's 12pt gutter.
|
|
757
|
+
viewer: {
|
|
758
|
+
paddingHorizontal: 4,
|
|
759
|
+
paddingBottom: 8
|
|
760
|
+
},
|
|
761
|
+
code: {
|
|
762
|
+
paddingHorizontal: 12,
|
|
763
|
+
paddingVertical: 10,
|
|
764
|
+
lineHeight: 17
|
|
765
|
+
},
|
|
766
|
+
noticeRow: {
|
|
767
|
+
flexDirection: "row",
|
|
768
|
+
alignItems: "flex-start",
|
|
769
|
+
gap: 8,
|
|
770
|
+
paddingHorizontal: 12,
|
|
771
|
+
paddingTop: 10,
|
|
772
|
+
paddingBottom: 4
|
|
773
|
+
},
|
|
774
|
+
noticeText: {
|
|
775
|
+
flex: 1,
|
|
776
|
+
color: _sharedUi.night.color.text,
|
|
777
|
+
fontSize: _sharedUi.night.font.caption,
|
|
778
|
+
lineHeight: 18
|
|
779
|
+
}
|
|
780
|
+
});
|
|
781
|
+
//# sourceMappingURL=DataBlocks.js.map
|