@stigmer/react 3.0.9-dev.20260616060535 → 3.1.0
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/execution/ApprovalCard.d.ts +47 -3
- package/execution/ApprovalCard.d.ts.map +1 -1
- package/execution/ApprovalCard.js +138 -70
- package/execution/ApprovalCard.js.map +1 -1
- package/execution/ApprovalContext.d.ts +72 -0
- package/execution/ApprovalContext.d.ts.map +1 -0
- package/execution/ApprovalContext.js +41 -0
- package/execution/ApprovalContext.js.map +1 -0
- package/execution/ArtifactCard.d.ts.map +1 -1
- package/execution/ArtifactCard.js +3 -1
- package/execution/ArtifactCard.js.map +1 -1
- package/execution/ArtifactPreviewModal.d.ts.map +1 -1
- package/execution/ArtifactPreviewModal.js +5 -3
- package/execution/ArtifactPreviewModal.js.map +1 -1
- package/execution/EmptyChangeNotice.d.ts +38 -0
- package/execution/EmptyChangeNotice.d.ts.map +1 -0
- package/execution/EmptyChangeNotice.js +27 -0
- package/execution/EmptyChangeNotice.js.map +1 -0
- package/execution/FileChangesView.d.ts +81 -0
- package/execution/FileChangesView.d.ts.map +1 -0
- package/execution/FileChangesView.js +164 -0
- package/execution/FileChangesView.js.map +1 -0
- package/execution/FilePathLink.d.ts +24 -4
- package/execution/FilePathLink.d.ts.map +1 -1
- package/execution/FilePathLink.js +31 -9
- package/execution/FilePathLink.js.map +1 -1
- package/execution/FileReviewCard.d.ts +111 -0
- package/execution/FileReviewCard.d.ts.map +1 -0
- package/execution/FileReviewCard.js +558 -0
- package/execution/FileReviewCard.js.map +1 -0
- package/execution/FileReviewContext.d.ts +35 -0
- package/execution/FileReviewContext.d.ts.map +1 -0
- package/execution/FileReviewContext.js +23 -0
- package/execution/FileReviewContext.js.map +1 -0
- package/execution/FileReviewDock.d.ts +73 -0
- package/execution/FileReviewDock.d.ts.map +1 -0
- package/execution/FileReviewDock.js +65 -0
- package/execution/FileReviewDock.js.map +1 -0
- package/execution/McpToolDetail.d.ts.map +1 -1
- package/execution/McpToolDetail.js +38 -5
- package/execution/McpToolDetail.js.map +1 -1
- package/execution/MessageThread.d.ts +42 -3
- package/execution/MessageThread.d.ts.map +1 -1
- package/execution/MessageThread.js +263 -18
- package/execution/MessageThread.js.map +1 -1
- package/execution/PlanArtifactCard.d.ts.map +1 -1
- package/execution/PlanArtifactCard.js +3 -1
- package/execution/PlanArtifactCard.js.map +1 -1
- package/execution/PlanCompletionCard.d.ts +1 -1
- package/execution/PlanCompletionCard.js +1 -1
- package/execution/ResultView.d.ts +19 -1
- package/execution/ResultView.d.ts.map +1 -1
- package/execution/ResultView.js +141 -40
- package/execution/ResultView.js.map +1 -1
- package/execution/SubAgentSection.d.ts.map +1 -1
- package/execution/SubAgentSection.js +45 -6
- package/execution/SubAgentSection.js.map +1 -1
- package/execution/TerminalSession.d.ts +34 -0
- package/execution/TerminalSession.d.ts.map +1 -0
- package/execution/TerminalSession.js +34 -0
- package/execution/TerminalSession.js.map +1 -0
- package/execution/TodoCard.d.ts +53 -0
- package/execution/TodoCard.d.ts.map +1 -0
- package/execution/TodoCard.js +77 -0
- package/execution/TodoCard.js.map +1 -0
- package/execution/ToolArgsView.d.ts +7 -1
- package/execution/ToolArgsView.d.ts.map +1 -1
- package/execution/ToolArgsView.js +10 -9
- package/execution/ToolArgsView.js.map +1 -1
- package/execution/ToolCallDetail.d.ts +10 -1
- package/execution/ToolCallDetail.d.ts.map +1 -1
- package/execution/ToolCallDetail.js +66 -19
- package/execution/ToolCallDetail.js.map +1 -1
- package/execution/ToolCallGroup.d.ts +28 -18
- package/execution/ToolCallGroup.d.ts.map +1 -1
- package/execution/ToolCallGroup.js +39 -148
- package/execution/ToolCallGroup.js.map +1 -1
- package/execution/ToolCallItem.d.ts +36 -8
- package/execution/ToolCallItem.d.ts.map +1 -1
- package/execution/ToolCallItem.js +140 -21
- package/execution/ToolCallItem.js.map +1 -1
- package/execution/ToolRunGroup.d.ts +48 -0
- package/execution/ToolRunGroup.d.ts.map +1 -0
- package/execution/ToolRunGroup.js +168 -0
- package/execution/ToolRunGroup.js.map +1 -0
- package/execution/approval-provenance.d.ts +2 -0
- package/execution/approval-provenance.d.ts.map +1 -0
- package/execution/approval-provenance.js +6 -0
- package/execution/approval-provenance.js.map +1 -0
- package/execution/artifact-utils.d.ts +0 -10
- package/execution/artifact-utils.d.ts.map +1 -1
- package/execution/artifact-utils.js +0 -17
- package/execution/artifact-utils.js.map +1 -1
- package/execution/execution-phases.d.ts +1 -6
- package/execution/execution-phases.d.ts.map +1 -1
- package/execution/execution-phases.js +4 -14
- package/execution/execution-phases.js.map +1 -1
- package/execution/file-path-resolver.d.ts +28 -0
- package/execution/file-path-resolver.d.ts.map +1 -1
- package/execution/file-path-resolver.js +24 -0
- package/execution/file-path-resolver.js.map +1 -1
- package/execution/file-review-status.d.ts +127 -0
- package/execution/file-review-status.d.ts.map +1 -0
- package/execution/file-review-status.js +135 -0
- package/execution/file-review-status.js.map +1 -0
- package/execution/index.d.ts +39 -5
- package/execution/index.d.ts.map +1 -1
- package/execution/index.js +23 -3
- package/execution/index.js.map +1 -1
- package/execution/segment-tool-calls.d.ts +46 -0
- package/execution/segment-tool-calls.d.ts.map +1 -0
- package/execution/segment-tool-calls.js +71 -0
- package/execution/segment-tool-calls.js.map +1 -0
- package/execution/tool-categories.d.ts +62 -1
- package/execution/tool-categories.d.ts.map +1 -1
- package/execution/tool-categories.js +96 -2
- package/execution/tool-categories.js.map +1 -1
- package/execution/tool-presenter.d.ts +38 -2
- package/execution/tool-presenter.d.ts.map +1 -1
- package/execution/tool-presenter.js +23 -1
- package/execution/tool-presenter.js.map +1 -1
- package/execution/tool-rendering-primitives.d.ts.map +1 -1
- package/execution/tool-rendering-primitives.js +3 -2
- package/execution/tool-rendering-primitives.js.map +1 -1
- package/execution/useArtifactDownload.d.ts +44 -0
- package/execution/useArtifactDownload.d.ts.map +1 -0
- package/execution/useArtifactDownload.js +80 -0
- package/execution/useArtifactDownload.js.map +1 -0
- package/execution/useArtifactDownloadUrl.d.ts +67 -0
- package/execution/useArtifactDownloadUrl.d.ts.map +1 -0
- package/execution/useArtifactDownloadUrl.js +59 -0
- package/execution/useArtifactDownloadUrl.js.map +1 -0
- package/execution/useFileChangeContent.d.ts +61 -0
- package/execution/useFileChangeContent.d.ts.map +1 -0
- package/execution/useFileChangeContent.js +89 -0
- package/execution/useFileChangeContent.js.map +1 -0
- package/execution/useFileReview.d.ts +89 -0
- package/execution/useFileReview.d.ts.map +1 -0
- package/execution/useFileReview.js +106 -0
- package/execution/useFileReview.js.map +1 -0
- package/execution/useSubmitApproval.d.ts +17 -2
- package/execution/useSubmitApproval.d.ts.map +1 -1
- package/execution/useSubmitApproval.js +27 -23
- package/execution/useSubmitApproval.js.map +1 -1
- package/execution/useToolOutputContent.d.ts +44 -0
- package/execution/useToolOutputContent.d.ts.map +1 -0
- package/execution/useToolOutputContent.js +31 -0
- package/execution/useToolOutputContent.js.map +1 -0
- package/index.d.ts +6 -6
- package/index.d.ts.map +1 -1
- package/index.js +3 -3
- package/index.js.map +1 -1
- package/internal/ApprovalPeekBar.d.ts +23 -0
- package/internal/ApprovalPeekBar.d.ts.map +1 -0
- package/internal/ApprovalPeekBar.js +25 -0
- package/internal/ApprovalPeekBar.js.map +1 -0
- package/internal/BoundedContent.d.ts +49 -0
- package/internal/BoundedContent.d.ts.map +1 -0
- package/internal/BoundedContent.js +50 -0
- package/internal/BoundedContent.js.map +1 -0
- package/internal/DecisionButton.d.ts +47 -0
- package/internal/DecisionButton.d.ts.map +1 -0
- package/internal/DecisionButton.js +42 -0
- package/internal/DecisionButton.js.map +1 -0
- package/internal/InCardDecisionError.d.ts +31 -0
- package/internal/InCardDecisionError.d.ts.map +1 -0
- package/internal/InCardDecisionError.js +23 -0
- package/internal/InCardDecisionError.js.map +1 -0
- package/internal/RevealToggle.d.ts +36 -0
- package/internal/RevealToggle.d.ts.map +1 -0
- package/internal/RevealToggle.js +32 -0
- package/internal/RevealToggle.js.map +1 -0
- package/internal/VirtualizedThread.d.ts +7 -1
- package/internal/VirtualizedThread.d.ts.map +1 -1
- package/internal/VirtualizedThread.js +7 -3
- package/internal/VirtualizedThread.js.map +1 -1
- package/internal/useAutoDisclosure.d.ts +34 -0
- package/internal/useAutoDisclosure.d.ts.map +1 -0
- package/internal/useAutoDisclosure.js +53 -0
- package/internal/useAutoDisclosure.js.map +1 -0
- package/internal/useElapsedSince.d.ts +30 -0
- package/internal/useElapsedSince.d.ts.map +1 -0
- package/internal/useElapsedSince.js +70 -0
- package/internal/useElapsedSince.js.map +1 -0
- package/internal/useIsOverflowing.d.ts +30 -0
- package/internal/useIsOverflowing.d.ts.map +1 -0
- package/internal/useIsOverflowing.js +47 -0
- package/internal/useIsOverflowing.js.map +1 -0
- package/internal/useIsTextTruncated.d.ts +24 -0
- package/internal/useIsTextTruncated.d.ts.map +1 -0
- package/internal/useIsTextTruncated.js +41 -0
- package/internal/useIsTextTruncated.js.map +1 -0
- package/internal/useKeyedSubmission.d.ts +49 -0
- package/internal/useKeyedSubmission.d.ts.map +1 -0
- package/internal/useKeyedSubmission.js +67 -0
- package/internal/useKeyedSubmission.js.map +1 -0
- package/package.json +4 -4
- package/session/SessionViewer.d.ts +2 -2
- package/session/SessionViewer.d.ts.map +1 -1
- package/session/SessionViewer.js +10 -4
- package/session/SessionViewer.js.map +1 -1
- package/session/index.d.ts +2 -0
- package/session/index.d.ts.map +1 -1
- package/session/index.js +1 -0
- package/session/index.js.map +1 -1
- package/session/inspector/ChangesTab.d.ts +8 -5
- package/session/inspector/ChangesTab.d.ts.map +1 -1
- package/session/inspector/ChangesTab.js +11 -8
- package/session/inspector/ChangesTab.js.map +1 -1
- package/session/inspector/SessionInspector.d.ts +4 -4
- package/session/inspector/SessionInspector.d.ts.map +1 -1
- package/session/inspector/SessionInspector.js +4 -4
- package/session/inspector/SessionInspector.js.map +1 -1
- package/session/inspector/index.d.ts +0 -2
- package/session/inspector/index.d.ts.map +1 -1
- package/session/inspector/index.js +0 -1
- package/session/inspector/index.js.map +1 -1
- package/session/inspector/useSessionInspector.d.ts +8 -4
- package/session/inspector/useSessionInspector.d.ts.map +1 -1
- package/session/inspector/useSessionInspector.js +27 -20
- package/session/inspector/useSessionInspector.js.map +1 -1
- package/session/useSessionConversation.d.ts +37 -3
- package/session/useSessionConversation.d.ts.map +1 -1
- package/session/useSessionConversation.js +18 -2
- package/session/useSessionConversation.js.map +1 -1
- package/session/useSessionFileChanges.d.ts +74 -0
- package/session/useSessionFileChanges.d.ts.map +1 -0
- package/session/useSessionFileChanges.js +178 -0
- package/session/useSessionFileChanges.js.map +1 -0
- package/src/__tests__/styles-border-layer-invariant.test.ts +105 -0
- package/src/execution/ApprovalCard.tsx +368 -230
- package/src/execution/ApprovalContext.ts +109 -0
- package/src/execution/ArtifactCard.tsx +10 -6
- package/src/execution/ArtifactPreviewModal.tsx +12 -6
- package/src/execution/EmptyChangeNotice.tsx +62 -0
- package/src/execution/FileChangesView.tsx +383 -0
- package/src/execution/FilePathLink.tsx +65 -12
- package/src/execution/FileReviewCard.tsx +1118 -0
- package/src/execution/FileReviewContext.ts +53 -0
- package/src/execution/FileReviewDock.tsx +157 -0
- package/src/execution/McpToolDetail.tsx +98 -32
- package/src/execution/MessageThread.tsx +374 -9
- package/src/execution/PlanArtifactCard.tsx +9 -6
- package/src/execution/PlanCompletionCard.tsx +1 -1
- package/src/execution/ResultView.tsx +333 -162
- package/src/execution/SubAgentSection.tsx +58 -11
- package/src/execution/TerminalSession.tsx +91 -0
- package/src/execution/TodoCard.tsx +186 -0
- package/src/execution/ToolArgsView.tsx +28 -17
- package/src/execution/ToolCallDetail.tsx +137 -26
- package/src/execution/ToolCallGroup.tsx +68 -296
- package/src/execution/ToolCallItem.tsx +265 -67
- package/src/execution/ToolRunGroup.tsx +302 -0
- package/src/execution/__tests__/ApprovalCard.test.tsx +395 -5
- package/src/execution/__tests__/ArtifactPreviewModal.test.tsx +0 -1
- package/src/execution/__tests__/EmptyChangeNotice.test.tsx +24 -0
- package/src/execution/__tests__/FileChangesView.test.tsx +296 -0
- package/src/execution/__tests__/FilePathLink.test.tsx +92 -0
- package/src/execution/__tests__/FileReviewCard.test.tsx +1044 -0
- package/src/execution/__tests__/FileReviewDock.test.tsx +134 -0
- package/src/execution/__tests__/McpToolDetail.test.tsx +79 -0
- package/src/execution/__tests__/MessageThread.test.tsx +324 -0
- package/src/execution/__tests__/PlanArtifactCard.test.tsx +37 -16
- package/src/execution/__tests__/ResultView.test.tsx +280 -2
- package/src/execution/__tests__/SubAgentSection.test.tsx +180 -0
- package/src/execution/__tests__/TerminalSession.test.tsx +72 -0
- package/src/execution/__tests__/TodoCard.test.tsx +102 -0
- package/src/execution/__tests__/ToolArgsView.test.tsx +48 -0
- package/src/execution/__tests__/ToolCallDetail.test.tsx +195 -0
- package/src/execution/__tests__/ToolCallGroup.test.tsx +132 -0
- package/src/execution/__tests__/ToolCallItem.test.tsx +521 -0
- package/src/execution/__tests__/ToolRunGroup.test.tsx +137 -0
- package/src/execution/__tests__/blanked-narration.test.tsx +149 -0
- package/src/execution/__tests__/buildThreadItems-approvals.test.ts +304 -0
- package/src/execution/__tests__/buildThreadItems-file-review.test.ts +331 -0
- package/src/execution/__tests__/file-path-resolver.test.ts +44 -0
- package/src/execution/__tests__/file-review-status.test.ts +343 -0
- package/src/execution/__tests__/segment-tool-calls.test.ts +124 -0
- package/src/execution/__tests__/subagent-file-review-badge.test.tsx +273 -0
- package/src/execution/__tests__/thread-keys.test.ts +195 -0
- package/src/execution/__tests__/tool-presenter.test.tsx +95 -0
- package/src/execution/__tests__/useArtifactDownload.test.tsx +67 -0
- package/src/execution/__tests__/useArtifactDownloadUrl.test.tsx +51 -0
- package/src/execution/__tests__/useFileChangeContent.test.tsx +240 -0
- package/src/execution/__tests__/useFileReview.test.tsx +236 -0
- package/src/execution/__tests__/useSubmitApproval.test.tsx +165 -0
- package/src/execution/__tests__/useToolOutputContent.test.tsx +82 -0
- package/src/execution/approval-provenance.ts +8 -0
- package/src/execution/artifact-utils.ts +0 -18
- package/src/execution/execution-phases.ts +4 -16
- package/src/execution/file-path-resolver.ts +38 -0
- package/src/execution/file-review-status.ts +219 -0
- package/src/execution/index.ts +84 -4
- package/src/execution/segment-tool-calls.ts +101 -0
- package/src/execution/tool-categories.ts +128 -1
- package/src/execution/tool-presenter.ts +58 -3
- package/src/execution/tool-rendering-primitives.tsx +11 -14
- package/src/execution/useArtifactDownload.ts +109 -0
- package/src/execution/useArtifactDownloadUrl.ts +116 -0
- package/src/execution/useFileChangeContent.ts +149 -0
- package/src/execution/useFileReview.ts +197 -0
- package/src/execution/useSubmitApproval.ts +49 -27
- package/src/execution/useToolOutputContent.ts +70 -0
- package/src/index.ts +60 -1
- package/src/internal/ApprovalPeekBar.tsx +73 -0
- package/src/internal/BoundedContent.tsx +97 -0
- package/src/internal/DecisionButton.tsx +127 -0
- package/src/internal/InCardDecisionError.tsx +47 -0
- package/src/internal/RevealToggle.tsx +91 -0
- package/src/internal/VirtualizedThread.tsx +28 -2
- package/src/internal/__tests__/ApprovalPeekBar.test.tsx +34 -0
- package/src/internal/__tests__/BoundedContent.test.tsx +92 -0
- package/src/internal/__tests__/DecisionButton.test.tsx +107 -0
- package/src/internal/__tests__/RevealToggle.test.tsx +61 -0
- package/src/internal/__tests__/useAutoDisclosure.test.ts +74 -0
- package/src/internal/__tests__/useElapsedSince.test.tsx +68 -0
- package/src/internal/__tests__/useIsOverflowing.test.ts +36 -0
- package/src/internal/__tests__/useKeyedSubmission.test.tsx +126 -0
- package/src/internal/useAutoDisclosure.ts +58 -0
- package/src/internal/useElapsedSince.ts +72 -0
- package/src/internal/useIsOverflowing.ts +61 -0
- package/src/internal/useIsTextTruncated.ts +55 -0
- package/src/internal/useKeyedSubmission.ts +101 -0
- package/src/session/SessionViewer.tsx +21 -4
- package/src/session/__tests__/SessionViewer-fileReviewDock.test.tsx +198 -0
- package/src/session/__tests__/audienceWiring.test.tsx +4 -0
- package/src/session/__tests__/useSessionFileChanges.test.ts +303 -0
- package/src/session/index.ts +3 -0
- package/src/session/inspector/ChangesTab.tsx +20 -17
- package/src/session/inspector/SessionInspector.tsx +12 -10
- package/src/session/inspector/__tests__/ArtifactsTab.test.tsx +0 -1
- package/src/session/inspector/__tests__/ChangesTab.test.tsx +38 -0
- package/src/session/inspector/__tests__/useSessionInspector.test.ts +46 -61
- package/src/session/inspector/index.ts +0 -3
- package/src/session/inspector/useSessionInspector.ts +27 -20
- package/src/session/useSessionConversation.ts +80 -3
- package/src/session/useSessionFileChanges.ts +207 -0
- package/src/styles.css +35 -10
- package/src/version-history/DiffViewer.tsx +10 -7
- package/src/version-history/UnifiedDiffView.tsx +66 -0
- package/src/version-history/__tests__/DiffViewer.test.tsx +57 -0
- package/src/version-history/__tests__/UnifiedDiffView.test.tsx +50 -0
- package/src/version-history/__tests__/computeDiff.test.ts +35 -0
- package/src/version-history/__tests__/parseUnifiedDiff.test.ts +82 -0
- package/src/version-history/computeDiff.ts +6 -37
- package/src/version-history/diff-hunks.ts +63 -0
- package/src/version-history/index.ts +1 -0
- package/src/version-history/parseUnifiedDiff.ts +34 -0
- package/src/workflow/WorkflowExecutionApprovalCard.tsx +49 -24
- package/src/workflow/WorkflowExecutionTimeline.tsx +15 -4
- package/src/workflow/WorkflowExecutionTimelineEvent.tsx +8 -3
- package/src/workflow/WorkflowExecutionViewer.tsx +72 -28
- package/src/workflow/WorkflowFileReviewList.tsx +152 -0
- package/src/workflow/WorkflowTaskApprovalCard.tsx +37 -85
- package/src/workflow/__tests__/ExecutionInspector.test.tsx +30 -2
- package/src/workflow/__tests__/WorkflowExecutionApprovalCard.test.tsx +129 -0
- package/src/workflow/__tests__/WorkflowFileReviewList.test.tsx +129 -0
- package/src/workflow/__tests__/WorkflowTaskApprovalCard.test.tsx +43 -11
- package/src/workflow/__tests__/useWorkflowExecutionActions.test.tsx +276 -0
- package/src/workflow/execution-inspector/ExecutionInspector.tsx +42 -18
- package/src/workflow/index.ts +5 -0
- package/src/workflow/useWorkflowExecutionActions.ts +177 -29
- package/styles.css +1 -1
- package/version-history/DiffViewer.d.ts.map +1 -1
- package/version-history/DiffViewer.js +9 -3
- package/version-history/DiffViewer.js.map +1 -1
- package/version-history/UnifiedDiffView.d.ts +29 -0
- package/version-history/UnifiedDiffView.d.ts.map +1 -0
- package/version-history/UnifiedDiffView.js +36 -0
- package/version-history/UnifiedDiffView.js.map +1 -0
- package/version-history/computeDiff.d.ts +3 -1
- package/version-history/computeDiff.d.ts.map +1 -1
- package/version-history/computeDiff.js +5 -35
- package/version-history/computeDiff.js.map +1 -1
- package/version-history/diff-hunks.d.ts +21 -0
- package/version-history/diff-hunks.d.ts.map +1 -0
- package/version-history/diff-hunks.js +58 -0
- package/version-history/diff-hunks.js.map +1 -0
- package/version-history/index.d.ts +1 -0
- package/version-history/index.d.ts.map +1 -1
- package/version-history/index.js +1 -0
- package/version-history/index.js.map +1 -1
- package/version-history/parseUnifiedDiff.d.ts +22 -0
- package/version-history/parseUnifiedDiff.d.ts.map +1 -0
- package/version-history/parseUnifiedDiff.js +34 -0
- package/version-history/parseUnifiedDiff.js.map +1 -0
- package/workflow/WorkflowExecutionApprovalCard.d.ts +8 -1
- package/workflow/WorkflowExecutionApprovalCard.d.ts.map +1 -1
- package/workflow/WorkflowExecutionApprovalCard.js +17 -3
- package/workflow/WorkflowExecutionApprovalCard.js.map +1 -1
- package/workflow/WorkflowExecutionTimeline.d.ts +11 -2
- package/workflow/WorkflowExecutionTimeline.d.ts.map +1 -1
- package/workflow/WorkflowExecutionTimeline.js +2 -2
- package/workflow/WorkflowExecutionTimeline.js.map +1 -1
- package/workflow/WorkflowExecutionTimelineEvent.d.ts +4 -1
- package/workflow/WorkflowExecutionTimelineEvent.d.ts.map +1 -1
- package/workflow/WorkflowExecutionTimelineEvent.js +2 -2
- package/workflow/WorkflowExecutionTimelineEvent.js.map +1 -1
- package/workflow/WorkflowExecutionViewer.d.ts.map +1 -1
- package/workflow/WorkflowExecutionViewer.js +18 -10
- package/workflow/WorkflowExecutionViewer.js.map +1 -1
- package/workflow/WorkflowFileReviewList.d.ts +46 -0
- package/workflow/WorkflowFileReviewList.d.ts.map +1 -0
- package/workflow/WorkflowFileReviewList.js +48 -0
- package/workflow/WorkflowFileReviewList.js.map +1 -0
- package/workflow/WorkflowTaskApprovalCard.d.ts +8 -1
- package/workflow/WorkflowTaskApprovalCard.d.ts.map +1 -1
- package/workflow/WorkflowTaskApprovalCard.js +12 -19
- package/workflow/WorkflowTaskApprovalCard.js.map +1 -1
- package/workflow/execution-inspector/ExecutionInspector.d.ts +21 -4
- package/workflow/execution-inspector/ExecutionInspector.d.ts.map +1 -1
- package/workflow/execution-inspector/ExecutionInspector.js +6 -3
- package/workflow/execution-inspector/ExecutionInspector.js.map +1 -1
- package/workflow/index.d.ts +1 -0
- package/workflow/index.d.ts.map +1 -1
- package/workflow/index.js +1 -0
- package/workflow/index.js.map +1 -1
- package/workflow/useWorkflowExecutionActions.d.ts +62 -4
- package/workflow/useWorkflowExecutionActions.d.ts.map +1 -1
- package/workflow/useWorkflowExecutionActions.js +94 -18
- package/workflow/useWorkflowExecutionActions.js.map +1 -1
- package/session/inspector/PlanTab.d.ts +0 -15
- package/session/inspector/PlanTab.d.ts.map +0 -1
- package/session/inspector/PlanTab.js +0 -19
- package/session/inspector/PlanTab.js.map +0 -1
- package/src/session/inspector/PlanTab.tsx +0 -31
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DecisionButton.js","sourceRoot":"","sources":["../../src/internal/DecisionButton.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAsCpC,MAAM,IAAI,GAAG,EAAE,CACb,wEAAwE,EACxE,uCAAuC,EACvC,qGAAqG;AACrG,+EAA+E;AAC/E,4EAA4E;AAC5E,8EAA8E,CAC/E,CAAC;AAEF,mCAAmC;AACnC,MAAM,OAAO,GAAoC;IAC/C,8EAA8E;IAC9E,6EAA6E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3
|
+
/** The failure to surface. Its `message` is shown verbatim (the actionable part). */
|
|
4
|
+
readonly error: Error;
|
|
5
|
+
/**
|
|
6
|
+
* The verb phrase completing "Couldn't ___" — e.g. `"submit decision"` or
|
|
7
|
+
* `"save"`. Kept short; the server `message` carries the detail.
|
|
8
|
+
*/
|
|
9
|
+
readonly leadIn: string;
|
|
10
|
+
/** Stable hook for e2e/visual targeting (`data-cursor-target`). */
|
|
11
|
+
readonly cursorTarget: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The shared in-card failure notice for a decision that did not take — used by
|
|
15
|
+
* every decision surface that surfaces errors beside the control that failed:
|
|
16
|
+
* the agent tool gate ({@link ApprovalCard}/{@link ApprovalCardBody}) and the
|
|
17
|
+
* file-review card ({@link FileReviewCard}, whole-set and per-file).
|
|
18
|
+
*
|
|
19
|
+
* One source of truth so those surfaces can never drift in tone, copy shape, or
|
|
20
|
+
* accessibility. `role="alert"` (matching the thread's other inline failures)
|
|
21
|
+
* announces it the moment it appears, since it is a dynamic reaction to the
|
|
22
|
+
* reviewer's action — by the time it renders the optimistic verdict has already
|
|
23
|
+
* reverted, and this explains why. The server `message` is shown verbatim
|
|
24
|
+
* because it is the actionable part (e.g. a digest mismatch means the captured
|
|
25
|
+
* content moved on); the lead-in stays short. Every visual property flows
|
|
26
|
+
* through `--stgm-*` tokens.
|
|
27
|
+
*
|
|
28
|
+
* @internal Not part of the public API.
|
|
29
|
+
*/
|
|
30
|
+
export declare function InCardDecisionError({ error, leadIn, cursorTarget, }: InCardDecisionErrorProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
//# sourceMappingURL=InCardDecisionError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InCardDecisionError.d.ts","sourceRoot":"","sources":["../../src/internal/InCardDecisionError.tsx"],"names":[],"mappings":"AAEA,6CAA6C;AAC7C,MAAM,WAAW,wBAAwB;IACvC,qFAAqF;IACrF,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,mEAAmE;IACnE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,MAAM,EACN,YAAY,GACb,EAAE,wBAAwB,2CAU1B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* The shared in-card failure notice for a decision that did not take — used by
|
|
5
|
+
* every decision surface that surfaces errors beside the control that failed:
|
|
6
|
+
* the agent tool gate ({@link ApprovalCard}/{@link ApprovalCardBody}) and the
|
|
7
|
+
* file-review card ({@link FileReviewCard}, whole-set and per-file).
|
|
8
|
+
*
|
|
9
|
+
* One source of truth so those surfaces can never drift in tone, copy shape, or
|
|
10
|
+
* accessibility. `role="alert"` (matching the thread's other inline failures)
|
|
11
|
+
* announces it the moment it appears, since it is a dynamic reaction to the
|
|
12
|
+
* reviewer's action — by the time it renders the optimistic verdict has already
|
|
13
|
+
* reverted, and this explains why. The server `message` is shown verbatim
|
|
14
|
+
* because it is the actionable part (e.g. a digest mismatch means the captured
|
|
15
|
+
* content moved on); the lead-in stays short. Every visual property flows
|
|
16
|
+
* through `--stgm-*` tokens.
|
|
17
|
+
*
|
|
18
|
+
* @internal Not part of the public API.
|
|
19
|
+
*/
|
|
20
|
+
export function InCardDecisionError({ error, leadIn, cursorTarget, }) {
|
|
21
|
+
return (_jsxs("p", { role: "alert", className: "text-[11px] text-destructive", "data-cursor-target": cursorTarget, children: ["Couldn\u2019t ", leadIn, " \u2014 ", error.message] }));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=InCardDecisionError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InCardDecisionError.js","sourceRoot":"","sources":["../../src/internal/InCardDecisionError.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAeb;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,KAAK,EACL,MAAM,EACN,YAAY,GACa;IACzB,OAAO,CACL,aACE,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,8BAA8B,wBACpB,YAAY,+BAEhB,MAAM,cAAK,KAAK,CAAC,OAAO,IACtC,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Props for {@link RevealToggle}. */
|
|
2
|
+
export interface RevealToggleProps {
|
|
3
|
+
/** Whether the governed content is currently fully revealed. */
|
|
4
|
+
readonly expanded: boolean;
|
|
5
|
+
/** Flips the reveal state. */
|
|
6
|
+
readonly onToggle: () => void;
|
|
7
|
+
/** Label shown while collapsed. Defaults to `"Show more"`. */
|
|
8
|
+
readonly moreLabel?: string;
|
|
9
|
+
/** Label shown while expanded. Defaults to `"Show less"`. */
|
|
10
|
+
readonly lessLabel?: string;
|
|
11
|
+
/** Stable hook for e2e/visual targeting (`data-cursor-target`). */
|
|
12
|
+
readonly cursorTarget?: string;
|
|
13
|
+
/** Additional CSS class names for the control. */
|
|
14
|
+
readonly className?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The single "reveal more / less" control for every bounded block on the
|
|
18
|
+
* execution surface — the diff/gate clamp ({@link BoundedContent}) and the
|
|
19
|
+
* line-count text/terminal blocks ({@link CollapsiblePre} / {@link
|
|
20
|
+
* CollapsibleCode}).
|
|
21
|
+
*
|
|
22
|
+
* It is the Cursor-style affordance the design calls for: a light, centered
|
|
23
|
+
* chevron at the bottom-middle (down to reveal, up to collapse) with a quiet
|
|
24
|
+
* label. Extracting it is what guarantees one disclosure *language* across two
|
|
25
|
+
* truncation *mechanisms* (pixel clamp for visual blocks, line count for text)
|
|
26
|
+
* — the surfaces can never visually drift because they render the same control.
|
|
27
|
+
*
|
|
28
|
+
* Presentational only: it owns no state. The caller holds the reveal state and
|
|
29
|
+
* passes `expanded` + `onToggle`. It carries `aria-expanded` for the block it
|
|
30
|
+
* governs; the owning tool-call row's header chevron (when present) carries the
|
|
31
|
+
* row-level disclosure, so the two axes never collide.
|
|
32
|
+
*
|
|
33
|
+
* @internal Not part of the public API.
|
|
34
|
+
*/
|
|
35
|
+
export declare function RevealToggle({ expanded, onToggle, moreLabel, lessLabel, cursorTarget, className, }: RevealToggleProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
//# sourceMappingURL=RevealToggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RevealToggle.d.ts","sourceRoot":"","sources":["../../src/internal/RevealToggle.tsx"],"names":[],"mappings":"AAIA,sCAAsC;AACtC,MAAM,WAAW,iBAAiB;IAChC,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,8BAA8B;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;IAC9B,8DAA8D;IAC9D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,6DAA6D;IAC7D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,kDAAkD;IAClD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,QAAQ,EACR,SAAuB,EACvB,SAAuB,EACvB,YAAY,EACZ,SAAS,GACV,EAAE,iBAAiB,2CAkBnB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "@stigmer/theme";
|
|
4
|
+
/**
|
|
5
|
+
* The single "reveal more / less" control for every bounded block on the
|
|
6
|
+
* execution surface — the diff/gate clamp ({@link BoundedContent}) and the
|
|
7
|
+
* line-count text/terminal blocks ({@link CollapsiblePre} / {@link
|
|
8
|
+
* CollapsibleCode}).
|
|
9
|
+
*
|
|
10
|
+
* It is the Cursor-style affordance the design calls for: a light, centered
|
|
11
|
+
* chevron at the bottom-middle (down to reveal, up to collapse) with a quiet
|
|
12
|
+
* label. Extracting it is what guarantees one disclosure *language* across two
|
|
13
|
+
* truncation *mechanisms* (pixel clamp for visual blocks, line count for text)
|
|
14
|
+
* — the surfaces can never visually drift because they render the same control.
|
|
15
|
+
*
|
|
16
|
+
* Presentational only: it owns no state. The caller holds the reveal state and
|
|
17
|
+
* passes `expanded` + `onToggle`. It carries `aria-expanded` for the block it
|
|
18
|
+
* governs; the owning tool-call row's header chevron (when present) carries the
|
|
19
|
+
* row-level disclosure, so the two axes never collide.
|
|
20
|
+
*
|
|
21
|
+
* @internal Not part of the public API.
|
|
22
|
+
*/
|
|
23
|
+
export function RevealToggle({ expanded, onToggle, moreLabel = "Show more", lessLabel = "Show less", cursorTarget, className, }) {
|
|
24
|
+
return (_jsxs("button", { type: "button", onClick: onToggle, "aria-expanded": expanded, "data-cursor-target": cursorTarget, className: cn("mt-1 flex w-full items-center justify-center gap-1 rounded py-0.5", "text-xs font-medium text-muted-foreground transition-colors hover:text-foreground", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", className), children: [_jsx("span", { children: expanded ? lessLabel : moreLabel }), _jsx(ChevronIcon, { expanded: expanded })] }));
|
|
25
|
+
}
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
// Inline SVG icon
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
function ChevronIcon({ expanded }) {
|
|
30
|
+
return (_jsx("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", className: cn("shrink-0 transition-transform duration-150", expanded && "rotate-180"), "aria-hidden": "true", children: _jsx("path", { d: "M2.5 3.5L5 6.5L7.5 3.5" }) }));
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=RevealToggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RevealToggle.js","sourceRoot":"","sources":["../../src/internal/RevealToggle.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAkBpC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,QAAQ,EACR,QAAQ,EACR,SAAS,GAAG,WAAW,EACvB,SAAS,GAAG,WAAW,EACvB,YAAY,EACZ,SAAS,GACS;IAClB,OAAO,CACL,kBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,QAAQ,mBACF,QAAQ,wBACH,YAAY,EAChC,SAAS,EAAE,EAAE,CACX,mEAAmE,EACnE,mFAAmF,EACnF,yEAAyE,EACzE,SAAS,CACV,aAED,yBAAO,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,GAAQ,EAC/C,KAAC,WAAW,IAAC,QAAQ,EAAE,QAAQ,GAAI,IAC5B,CACV,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAE9E,SAAS,WAAW,CAAC,EAAE,QAAQ,EAAyB;IACtD,OAAO,CACL,cACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EACtB,SAAS,EAAE,EAAE,CACX,4CAA4C,EAC5C,QAAQ,IAAI,YAAY,CACzB,iBACW,MAAM,YAElB,eAAM,CAAC,EAAC,wBAAwB,GAAG,GAC/B,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -3,13 +3,19 @@ import { ApprovalAction } from "@stigmer/protos/ai/stigmer/agentic/agentexecutio
|
|
|
3
3
|
import { type ThreadItem } from "../execution/MessageThread";
|
|
4
4
|
import { type FilePathContextValue } from "../execution/FilePathContext";
|
|
5
5
|
import { type SandboxContextValue } from "../execution/SandboxContext";
|
|
6
|
+
import { type ApprovalContextValue } from "../execution/ApprovalContext";
|
|
7
|
+
import { type FileReviewContextValue } from "../execution/FileReviewContext";
|
|
6
8
|
export interface VirtualizedThreadProps {
|
|
7
9
|
readonly items: readonly ThreadItem[];
|
|
8
10
|
readonly formatToolCallSummary?: (toolCalls: readonly ToolCall[]) => string;
|
|
9
11
|
readonly onApprovalSubmit?: (toolCallId: string, action: ApprovalAction, comment?: string) => void;
|
|
10
12
|
readonly submittingApprovalIds?: ReadonlySet<string>;
|
|
13
|
+
readonly approvalErrors?: ReadonlyMap<string, Error>;
|
|
11
14
|
readonly filePathCtx: FilePathContextValue;
|
|
12
15
|
readonly sandboxCtx: SandboxContextValue;
|
|
16
|
+
readonly approvalCtx: ApprovalContextValue;
|
|
17
|
+
readonly fileReviewCtx: FileReviewContextValue;
|
|
18
|
+
readonly unresolvedApprovalCount: number;
|
|
13
19
|
readonly onBuildFromPlan?: () => void;
|
|
14
20
|
readonly org?: string;
|
|
15
21
|
readonly planActionsDisabled?: boolean;
|
|
@@ -28,5 +34,5 @@ export interface VirtualizedThreadProps {
|
|
|
28
34
|
*
|
|
29
35
|
* @internal
|
|
30
36
|
*/
|
|
31
|
-
export declare function VirtualizedThread({ items, formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, filePathCtx, sandboxCtx, onBuildFromPlan, org, planActionsDisabled, centerContent, onRetrySend, onRetryExecution, onEditMessage, }: VirtualizedThreadProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export declare function VirtualizedThread({ items, formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, approvalErrors, filePathCtx, sandboxCtx, approvalCtx, fileReviewCtx, unresolvedApprovalCount, onBuildFromPlan, org, planActionsDisabled, centerContent, onRetrySend, onRetryExecution, onEditMessage, }: VirtualizedThreadProps): import("react/jsx-runtime").JSX.Element;
|
|
32
38
|
//# sourceMappingURL=VirtualizedThread.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualizedThread.d.ts","sourceRoot":"","sources":["../../src/internal/VirtualizedThread.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iEAAiE,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAC9F,OAAO,EAEL,KAAK,UAAU,EAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"VirtualizedThread.d.ts","sourceRoot":"","sources":["../../src/internal/VirtualizedThread.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iEAAiE,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAC9F,OAAO,EAEL,KAAK,UAAU,EAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAAqB,KAAK,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAUhG,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;IACtC,QAAQ,CAAC,qBAAqB,CAAC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,WAAW,EACX,gBAAgB,EAChB,aAAa,GACd,EAAE,sBAAsB,2CAuFxB"}
|
|
@@ -6,8 +6,11 @@ import { cn } from "@stigmer/theme";
|
|
|
6
6
|
import { ThreadItemRenderer, } from "../execution/MessageThread";
|
|
7
7
|
import { FilePathContext } from "../execution/FilePathContext";
|
|
8
8
|
import { SandboxContext } from "../execution/SandboxContext";
|
|
9
|
+
import { ApprovalContext } from "../execution/ApprovalContext";
|
|
10
|
+
import { FileReviewContext } from "../execution/FileReviewContext";
|
|
9
11
|
import { DevProfiler, useDomNodeCount } from "./dev";
|
|
10
12
|
import { JumpToLatestButton } from "./JumpToLatestButton";
|
|
13
|
+
import { ApprovalPeekBar } from "./ApprovalPeekBar";
|
|
11
14
|
import { ThreadItemWrapper } from "./ThreadItemWrapper";
|
|
12
15
|
// ---------------------------------------------------------------------------
|
|
13
16
|
// Scrollbar classes shared with the non-virtualized path
|
|
@@ -33,7 +36,7 @@ const NEAR_BOTTOM_THRESHOLD_PX = 80;
|
|
|
33
36
|
*
|
|
34
37
|
* @internal
|
|
35
38
|
*/
|
|
36
|
-
export function VirtualizedThread({ items, formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, filePathCtx, sandboxCtx, onBuildFromPlan, org, planActionsDisabled, centerContent, onRetrySend, onRetryExecution, onEditMessage, }) {
|
|
39
|
+
export function VirtualizedThread({ items, formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, approvalErrors, filePathCtx, sandboxCtx, approvalCtx, fileReviewCtx, unresolvedApprovalCount, onBuildFromPlan, org, planActionsDisabled, centerContent, onRetrySend, onRetryExecution, onEditMessage, }) {
|
|
37
40
|
const virtuosoRef = useRef(null);
|
|
38
41
|
const scrollerRef = useRef(null);
|
|
39
42
|
const [isAtBottom, setIsAtBottom] = useState(true);
|
|
@@ -52,13 +55,14 @@ export function VirtualizedThread({ items, formatToolCallSummary, onApprovalSubm
|
|
|
52
55
|
formatToolCallSummary,
|
|
53
56
|
onApprovalSubmit,
|
|
54
57
|
submittingApprovalIds,
|
|
58
|
+
approvalErrors,
|
|
55
59
|
onBuildFromPlan,
|
|
56
60
|
org,
|
|
57
61
|
planActionsDisabled,
|
|
58
62
|
onRetrySend,
|
|
59
63
|
onRetryExecution,
|
|
60
64
|
onEditMessage,
|
|
61
|
-
}), [formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, onBuildFromPlan, org, planActionsDisabled, onRetrySend, onRetryExecution, onEditMessage]);
|
|
62
|
-
return (_jsxs(_Fragment, { children: [_jsx(SandboxContext.Provider, { value: sandboxCtx, children: _jsx(FilePathContext.Provider, { value: filePathCtx, children: _jsx(DevProfiler, { id: "MessageThread:virtualized", children: _jsx(Virtuoso, { ref: virtuosoRef, data: items, alignToBottom: true, followOutput: handleFollowOutput, atBottomStateChange: setIsAtBottom, atBottomThreshold: NEAR_BOTTOM_THRESHOLD_PX, computeItemKey: (_index, item) => item.key, increaseViewportBy: { top: 200, bottom: 200 }, scrollerRef: handleScrollerRef, className: "h-full", components: { Scroller: ScrollerWithA11y }, itemContent: (index, item) => (_jsx("div", { className: cn("pb-4 pt-0 first:pt-6", centerContent && "mx-auto w-full max-w-3xl px-4"), children: _jsx(ThreadItemWrapper, { animate: index >= items.length - 2, children: _jsx(ThreadItemRenderer, { item: item, ...renderProps }) }) })) }) }) }) }), _jsx(JumpToLatestButton, { onClick: jumpToLatest, visible: !isAtBottom })] }));
|
|
65
|
+
}), [formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, approvalErrors, onBuildFromPlan, org, planActionsDisabled, onRetrySend, onRetryExecution, onEditMessage]);
|
|
66
|
+
return (_jsxs(_Fragment, { children: [_jsx(SandboxContext.Provider, { value: sandboxCtx, children: _jsx(FilePathContext.Provider, { value: filePathCtx, children: _jsx(ApprovalContext.Provider, { value: approvalCtx, children: _jsx(FileReviewContext.Provider, { value: fileReviewCtx, children: _jsx(DevProfiler, { id: "MessageThread:virtualized", children: _jsx(Virtuoso, { ref: virtuosoRef, data: items, alignToBottom: true, followOutput: handleFollowOutput, atBottomStateChange: setIsAtBottom, atBottomThreshold: NEAR_BOTTOM_THRESHOLD_PX, computeItemKey: (_index, item) => item.key, increaseViewportBy: { top: 200, bottom: 200 }, scrollerRef: handleScrollerRef, className: "h-full", components: { Scroller: ScrollerWithA11y }, itemContent: (index, item) => (_jsx("div", { className: cn("pb-4 pt-0 first:pt-6", centerContent && "mx-auto w-full max-w-3xl px-4"), children: _jsx(ThreadItemWrapper, { animate: index >= items.length - 2, children: _jsx(ThreadItemRenderer, { item: item, ...renderProps }) }) })) }) }) }) }) }) }), _jsx(JumpToLatestButton, { onClick: jumpToLatest, visible: !isAtBottom && unresolvedApprovalCount === 0 }), _jsx(ApprovalPeekBar, { visible: !isAtBottom && unresolvedApprovalCount > 0, count: unresolvedApprovalCount, onClick: jumpToLatest })] }));
|
|
63
67
|
}
|
|
64
68
|
//# sourceMappingURL=VirtualizedThread.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualizedThread.js","sourceRoot":"","sources":["../../src/internal/VirtualizedThread.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,UAAU,EACV,WAAW,EACX,OAAO,EACP,MAAM,EACN,QAAQ,GAET,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,QAAQ,EAAuB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAGpC,OAAO,EACL,kBAAkB,GAEnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,eAAe,EAA6B,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAAE,cAAc,EAA4B,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{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C,YACnD,KAAC,kBAAkB,IACjB,IAAI,EAAE,IAAI,KACN,WAAW,GACf,GACgB,GAChB,CACP,GACD,GACU,GACe,GACF,GACA,GACD,EAG1B,KAAC,kBAAkB,IACjB,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,CAAC,UAAU,IAAI,uBAAuB,KAAK,CAAC,GACrD,EACF,KAAC,eAAe,IACd,OAAO,EAAE,CAAC,UAAU,IAAI,uBAAuB,GAAG,CAAC,EACnD,KAAK,EAAE,uBAAuB,EAC9B,OAAO,EAAE,YAAY,GACrB,IACD,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disclosure state machine for progressively-revealed thread sections
|
|
3
|
+
* (tool-call groups, individual tool rows, sub-agent cards).
|
|
4
|
+
*
|
|
5
|
+
* The challenge it solves: a section should open and close *on its own* as
|
|
6
|
+
* the agent works (open while a tool runs, settle closed when it finishes),
|
|
7
|
+
* yet a user's explicit click must win and never be stomped by the next
|
|
8
|
+
* stream frame. Three components hand-rolled this same "auto unless the user
|
|
9
|
+
* intervened" logic; this hook is the single source of that shape.
|
|
10
|
+
*
|
|
11
|
+
* `autoOpen` is the component's live opinion of whether the section *should*
|
|
12
|
+
* be open right now (e.g. `isRunning || hasPendingApproval`). While the user
|
|
13
|
+
* has not toggled, `open` tracks `autoOpen`. Once the user toggles, their
|
|
14
|
+
* choice sticks for the lifetime of the component — the auto signal is
|
|
15
|
+
* ignored from then on, so the section never reopens or recollapses under
|
|
16
|
+
* them mid-stream.
|
|
17
|
+
*
|
|
18
|
+
* @param autoOpen Whether the section should auto-open given current state.
|
|
19
|
+
* @param options.initialOpen First-render open state. Defaults to `autoOpen`.
|
|
20
|
+
* Use it to honour a caller-provided `defaultExpanded` before the first
|
|
21
|
+
* effect runs.
|
|
22
|
+
* @returns A `[open, toggle]` tuple. `toggle` flips the state and marks it
|
|
23
|
+
* user-controlled.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* const [open, toggle] = useAutoDisclosure(isRunning || hasPendingApproval);
|
|
28
|
+
* <button aria-expanded={open} onClick={toggle}>…</button>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function useAutoDisclosure(autoOpen: boolean, options?: {
|
|
32
|
+
readonly initialOpen?: boolean;
|
|
33
|
+
}): readonly [open: boolean, toggle: () => void];
|
|
34
|
+
//# sourceMappingURL=useAutoDisclosure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoDisclosure.d.ts","sourceRoot":"","sources":["../../src/internal/useAutoDisclosure.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,OAAO,EACjB,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,GAC3C,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,CAoB9C"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Disclosure state machine for progressively-revealed thread sections
|
|
5
|
+
* (tool-call groups, individual tool rows, sub-agent cards).
|
|
6
|
+
*
|
|
7
|
+
* The challenge it solves: a section should open and close *on its own* as
|
|
8
|
+
* the agent works (open while a tool runs, settle closed when it finishes),
|
|
9
|
+
* yet a user's explicit click must win and never be stomped by the next
|
|
10
|
+
* stream frame. Three components hand-rolled this same "auto unless the user
|
|
11
|
+
* intervened" logic; this hook is the single source of that shape.
|
|
12
|
+
*
|
|
13
|
+
* `autoOpen` is the component's live opinion of whether the section *should*
|
|
14
|
+
* be open right now (e.g. `isRunning || hasPendingApproval`). While the user
|
|
15
|
+
* has not toggled, `open` tracks `autoOpen`. Once the user toggles, their
|
|
16
|
+
* choice sticks for the lifetime of the component — the auto signal is
|
|
17
|
+
* ignored from then on, so the section never reopens or recollapses under
|
|
18
|
+
* them mid-stream.
|
|
19
|
+
*
|
|
20
|
+
* @param autoOpen Whether the section should auto-open given current state.
|
|
21
|
+
* @param options.initialOpen First-render open state. Defaults to `autoOpen`.
|
|
22
|
+
* Use it to honour a caller-provided `defaultExpanded` before the first
|
|
23
|
+
* effect runs.
|
|
24
|
+
* @returns A `[open, toggle]` tuple. `toggle` flips the state and marks it
|
|
25
|
+
* user-controlled.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* const [open, toggle] = useAutoDisclosure(isRunning || hasPendingApproval);
|
|
30
|
+
* <button aria-expanded={open} onClick={toggle}>…</button>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export function useAutoDisclosure(autoOpen, options) {
|
|
34
|
+
const [open, setOpen] = useState(options?.initialOpen ?? autoOpen);
|
|
35
|
+
const userToggledRef = useRef(false);
|
|
36
|
+
const prevAutoOpenRef = useRef(autoOpen);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
// Sync only on a genuine transition of the auto signal — never on mount,
|
|
39
|
+
// so `initialOpen` is honoured, and never against the user's choice.
|
|
40
|
+
if (prevAutoOpenRef.current === autoOpen)
|
|
41
|
+
return;
|
|
42
|
+
prevAutoOpenRef.current = autoOpen;
|
|
43
|
+
if (userToggledRef.current)
|
|
44
|
+
return;
|
|
45
|
+
setOpen(autoOpen);
|
|
46
|
+
}, [autoOpen]);
|
|
47
|
+
const toggle = useRef(() => {
|
|
48
|
+
userToggledRef.current = true;
|
|
49
|
+
setOpen((v) => !v);
|
|
50
|
+
}).current;
|
|
51
|
+
return [open, toggle];
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=useAutoDisclosure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoDisclosure.js","sourceRoot":"","sources":["../../src/internal/useAutoDisclosure.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,iBAAiB,CAC/B,QAAiB,EACjB,OAA4C;IAE5C,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,OAAO,EAAE,WAAW,IAAI,QAAQ,CAAC,CAAC;IACnE,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACrC,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAEzC,SAAS,CAAC,GAAG,EAAE;QACb,yEAAyE;QACzE,qEAAqE;QACrE,IAAI,eAAe,CAAC,OAAO,KAAK,QAAQ;YAAE,OAAO;QACjD,eAAe,CAAC,OAAO,GAAG,QAAQ,CAAC;QACnC,IAAI,cAAc,CAAC,OAAO;YAAE,OAAO;QACnC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpB,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,EAAE;QACzB,cAAc,CAAC,OAAO,GAAG,IAAI,CAAC;QAC9B,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC,OAAO,CAAC;IAEX,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live elapsed time since an ISO 8601 timestamp, re-rendering once per second.
|
|
3
|
+
*
|
|
4
|
+
* The shape behind every "how long has this been going" affordance in the
|
|
5
|
+
* thread: an approval gate waiting on a human, a sub-agent card whose nested
|
|
6
|
+
* activity cannot be streamed (the Cursor SDK returns sub-agent internals only
|
|
7
|
+
* at completion), a long-running tool. A ticking duration is the honest signal
|
|
8
|
+
* that work is progressing when there is nothing else to show — as opposed to
|
|
9
|
+
* fabricating intermediate state.
|
|
10
|
+
*
|
|
11
|
+
* Returns elapsed milliseconds (clamped to >= 0 against client/server clock
|
|
12
|
+
* skew), or `null` when the timestamp is absent or unparseable — callers
|
|
13
|
+
* render nothing rather than a bogus "0s". The interval is scoped to the
|
|
14
|
+
* component instance and torn down on unmount, so a thread full of settled
|
|
15
|
+
* cards costs zero timers.
|
|
16
|
+
*
|
|
17
|
+
* @param startedAt ISO 8601 timestamp the clock counts from (e.g.
|
|
18
|
+
* `ToolCall.approval_requested_at`, `SubAgentExecution.started_at`).
|
|
19
|
+
*/
|
|
20
|
+
export declare function useElapsedSince(startedAt: string): number | null;
|
|
21
|
+
/**
|
|
22
|
+
* Format an elapsed duration for the live tickers driven by
|
|
23
|
+
* {@link useElapsedSince}: `just now`, `42s`, `3m 12s`, `1h 5m`.
|
|
24
|
+
*
|
|
25
|
+
* Second-granularity (unlike ToolCallDetail's `formatDuration`, which keeps
|
|
26
|
+
* millisecond precision for completed calls) because a live counter that
|
|
27
|
+
* flickers sub-second digits reads as noise, not progress.
|
|
28
|
+
*/
|
|
29
|
+
export declare function formatElapsed(ms: number): string;
|
|
30
|
+
//# sourceMappingURL=useElapsedSince.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useElapsedSince.d.ts","sourceRoot":"","sources":["../../src/internal/useElapsedSince.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAsBhE;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAgBhD"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Live elapsed time since an ISO 8601 timestamp, re-rendering once per second.
|
|
5
|
+
*
|
|
6
|
+
* The shape behind every "how long has this been going" affordance in the
|
|
7
|
+
* thread: an approval gate waiting on a human, a sub-agent card whose nested
|
|
8
|
+
* activity cannot be streamed (the Cursor SDK returns sub-agent internals only
|
|
9
|
+
* at completion), a long-running tool. A ticking duration is the honest signal
|
|
10
|
+
* that work is progressing when there is nothing else to show — as opposed to
|
|
11
|
+
* fabricating intermediate state.
|
|
12
|
+
*
|
|
13
|
+
* Returns elapsed milliseconds (clamped to >= 0 against client/server clock
|
|
14
|
+
* skew), or `null` when the timestamp is absent or unparseable — callers
|
|
15
|
+
* render nothing rather than a bogus "0s". The interval is scoped to the
|
|
16
|
+
* component instance and torn down on unmount, so a thread full of settled
|
|
17
|
+
* cards costs zero timers.
|
|
18
|
+
*
|
|
19
|
+
* @param startedAt ISO 8601 timestamp the clock counts from (e.g.
|
|
20
|
+
* `ToolCall.approval_requested_at`, `SubAgentExecution.started_at`).
|
|
21
|
+
*/
|
|
22
|
+
export function useElapsedSince(startedAt) {
|
|
23
|
+
const startMs = useMemo(() => {
|
|
24
|
+
if (!startedAt)
|
|
25
|
+
return null;
|
|
26
|
+
const t = new Date(startedAt).getTime();
|
|
27
|
+
return Number.isNaN(t) ? null : t;
|
|
28
|
+
}, [startedAt]);
|
|
29
|
+
const [elapsed, setElapsed] = useState(null);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (startMs === null) {
|
|
32
|
+
setElapsed(null);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
setElapsed(Math.max(0, Date.now() - startMs));
|
|
36
|
+
const id = setInterval(() => {
|
|
37
|
+
setElapsed(Math.max(0, Date.now() - startMs));
|
|
38
|
+
}, 1000);
|
|
39
|
+
return () => clearInterval(id);
|
|
40
|
+
}, [startMs]);
|
|
41
|
+
return startMs === null ? null : elapsed;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Format an elapsed duration for the live tickers driven by
|
|
45
|
+
* {@link useElapsedSince}: `just now`, `42s`, `3m 12s`, `1h 5m`.
|
|
46
|
+
*
|
|
47
|
+
* Second-granularity (unlike ToolCallDetail's `formatDuration`, which keeps
|
|
48
|
+
* millisecond precision for completed calls) because a live counter that
|
|
49
|
+
* flickers sub-second digits reads as noise, not progress.
|
|
50
|
+
*/
|
|
51
|
+
export function formatElapsed(ms) {
|
|
52
|
+
if (ms < 1000)
|
|
53
|
+
return "just now";
|
|
54
|
+
const seconds = Math.floor(ms / 1000);
|
|
55
|
+
if (seconds < 60)
|
|
56
|
+
return `${seconds}s`;
|
|
57
|
+
const minutes = Math.floor(seconds / 60);
|
|
58
|
+
const remainingSeconds = seconds % 60;
|
|
59
|
+
if (minutes < 60) {
|
|
60
|
+
return remainingSeconds > 0
|
|
61
|
+
? `${minutes}m ${remainingSeconds}s`
|
|
62
|
+
: `${minutes}m`;
|
|
63
|
+
}
|
|
64
|
+
const hours = Math.floor(minutes / 60);
|
|
65
|
+
const remainingMinutes = minutes % 60;
|
|
66
|
+
return remainingMinutes > 0
|
|
67
|
+
? `${hours}h ${remainingMinutes}m`
|
|
68
|
+
: `${hours}h`;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=useElapsedSince.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useElapsedSince.js","sourceRoot":"","sources":["../../src/internal/useElapsedSince.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,eAAe,CAAC,SAAiB;IAC/C,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE;QAC3B,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC;QAC5B,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,C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M,gBAAgB,GAAG,OAAO,GAAG,EAAE,CAAC;IACtC,IAAI,OAAO,GAAG,EAAE,EAAE,CAAC;QACjB,OAAO,gBAAgB,GAAG,CAAC;YACzB,CAAC,CAAC,GAAG,OAAO,KAAK,gBAAgB,GAAG;YACpC,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC;IACpB,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACvC,MAAM,gBAAgB,GAAG,OAAO,GAAG,EAAE,CAAC;IACtC,OAAO,gBAAgB,GAAG,CAAC;QACzB,CAAC,CAAC,GAAG,KAAK,KAAK,gBAAgB,GAAG;QAClC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface UseIsOverflowingReturn<T extends HTMLElement> {
|
|
2
|
+
/** Attach to the element whose vertical overflow should be tracked. */
|
|
3
|
+
readonly ref: React.RefObject<T | null>;
|
|
4
|
+
/** `true` when the element's content is clipped by a vertical clamp (e.g. `overflow-hidden` + `max-h-*`). */
|
|
5
|
+
readonly isOverflowing: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Tracks whether a vertically-clamped element (e.g. one styled with
|
|
9
|
+
* `overflow-hidden max-h-*`) is actually clipping its content at the current
|
|
10
|
+
* height.
|
|
11
|
+
*
|
|
12
|
+
* The vertical analog of {@link useIsTextTruncated}: it measures
|
|
13
|
+
* `scrollHeight > clientHeight` synchronously via `useLayoutEffect` (so the
|
|
14
|
+
* first value is correct before paint — no flash) and keeps it in sync with
|
|
15
|
+
* content-size changes via a `ResizeObserver`. The state setter compares before
|
|
16
|
+
* writing, so a stable layout never triggers a re-render loop.
|
|
17
|
+
*
|
|
18
|
+
* Pass `enabled: false` to opt out entirely — the observer is not attached and
|
|
19
|
+
* `isOverflowing` stays `false`. Callers gate on this so only the elements that
|
|
20
|
+
* consume the signal pay for the measurement.
|
|
21
|
+
*
|
|
22
|
+
* Note: under a layout-free test environment (`happy-dom`) `scrollHeight` and
|
|
23
|
+
* `clientHeight` are both `0`, so this reports `false`; overflow-driven UI is
|
|
24
|
+
* therefore verified in the e2e (real-browser) layer, mirroring the split the
|
|
25
|
+
* rest of the SDK already documents.
|
|
26
|
+
*
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export declare function useIsOverflowing<T extends HTMLElement = HTMLElement>(enabled: boolean): UseIsOverflowingReturn<T>;
|
|
30
|
+
//# sourceMappingURL=useIsOverflowing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsOverflowing.d.ts","sourceRoot":"","sources":["../../src/internal/useIsOverflowing.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,sBAAsB,CAAC,CAAC,SAAS,WAAW;IAC3D,uEAAuE;IACvE,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACxC,6GAA6G;IAC7G,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAClE,OAAO,EAAE,OAAO,GACf,sBAAsB,CAAC,CAAC,CAAC,CA2B3B"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Tracks whether a vertically-clamped element (e.g. one styled with
|
|
4
|
+
* `overflow-hidden max-h-*`) is actually clipping its content at the current
|
|
5
|
+
* height.
|
|
6
|
+
*
|
|
7
|
+
* The vertical analog of {@link useIsTextTruncated}: it measures
|
|
8
|
+
* `scrollHeight > clientHeight` synchronously via `useLayoutEffect` (so the
|
|
9
|
+
* first value is correct before paint — no flash) and keeps it in sync with
|
|
10
|
+
* content-size changes via a `ResizeObserver`. The state setter compares before
|
|
11
|
+
* writing, so a stable layout never triggers a re-render loop.
|
|
12
|
+
*
|
|
13
|
+
* Pass `enabled: false` to opt out entirely — the observer is not attached and
|
|
14
|
+
* `isOverflowing` stays `false`. Callers gate on this so only the elements that
|
|
15
|
+
* consume the signal pay for the measurement.
|
|
16
|
+
*
|
|
17
|
+
* Note: under a layout-free test environment (`happy-dom`) `scrollHeight` and
|
|
18
|
+
* `clientHeight` are both `0`, so this reports `false`; overflow-driven UI is
|
|
19
|
+
* therefore verified in the e2e (real-browser) layer, mirroring the split the
|
|
20
|
+
* rest of the SDK already documents.
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export function useIsOverflowing(enabled) {
|
|
25
|
+
const ref = useRef(null);
|
|
26
|
+
const [isOverflowing, setIsOverflowing] = useState(false);
|
|
27
|
+
useLayoutEffect(() => {
|
|
28
|
+
if (!enabled) {
|
|
29
|
+
// Reset so an element that stops consuming the signal doesn't keep a stale true.
|
|
30
|
+
setIsOverflowing((prev) => (prev ? false : prev));
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const el = ref.current;
|
|
34
|
+
if (!el)
|
|
35
|
+
return;
|
|
36
|
+
const measure = () => {
|
|
37
|
+
const next = el.scrollHeight > el.clientHeight + 1;
|
|
38
|
+
setIsOverflowing((prev) => (prev === next ? prev : next));
|
|
39
|
+
};
|
|
40
|
+
measure();
|
|
41
|
+
const ro = new ResizeObserver(measure);
|
|
42
|
+
ro.observe(el);
|
|
43
|
+
return () => ro.disconnect();
|
|
44
|
+
}, [enabled]);
|
|
45
|
+
return { ref, isOverflowing };
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=useIsOverflowing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsOverflowing.js","sourceRoot":"","sources":["../../src/internal/useIsOverflowing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE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+
/** Attach to the element whose horizontal overflow should be tracked. */
|
|
3
|
+
readonly ref: React.RefObject<T | null>;
|
|
4
|
+
/** `true` when the element's content is clipped by `overflow` (e.g. `truncate`). */
|
|
5
|
+
readonly isTruncated: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Tracks whether a single-line, overflow-clipped element (e.g. one styled with
|
|
9
|
+
* Tailwind's `truncate`) is actually truncating its text at the current width.
|
|
10
|
+
*
|
|
11
|
+
* The horizontal analog of {@link useScrollShadows}: it measures
|
|
12
|
+
* `scrollWidth > clientWidth` synchronously via `useLayoutEffect` (so the first
|
|
13
|
+
* value is correct before paint — no flash) and keeps it in sync with width
|
|
14
|
+
* changes via a `ResizeObserver`. The state setter compares before writing, so a
|
|
15
|
+
* stable layout never triggers a re-render loop.
|
|
16
|
+
*
|
|
17
|
+
* Pass `enabled: false` to opt a row out entirely — the observer is not attached
|
|
18
|
+
* and `isTruncated` stays `false`. Callers gate on this so only the rows that
|
|
19
|
+
* consume the signal pay for the measurement.
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export declare function useIsTextTruncated<T extends HTMLElement = HTMLElement>(enabled: boolean): UseIsTextTruncatedReturn<T>;
|
|
24
|
+
//# sourceMappingURL=useIsTextTruncated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsTextTruncated.d.ts","sourceRoot":"","sources":["../../src/internal/useIsTextTruncated.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,wBAAwB,CAAC,CAAC,SAAS,WAAW;IAC7D,yEAAyE;IACzE,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACxC,oFAAoF;IACpF,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EACpE,OAAO,EAAE,OAAO,GACf,wBAAwB,CAAC,CAAC,CAAC,CA2B7B"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Tracks whether a single-line, overflow-clipped element (e.g. one styled with
|
|
4
|
+
* Tailwind's `truncate`) is actually truncating its text at the current width.
|
|
5
|
+
*
|
|
6
|
+
* The horizontal analog of {@link useScrollShadows}: it measures
|
|
7
|
+
* `scrollWidth > clientWidth` synchronously via `useLayoutEffect` (so the first
|
|
8
|
+
* value is correct before paint — no flash) and keeps it in sync with width
|
|
9
|
+
* changes via a `ResizeObserver`. The state setter compares before writing, so a
|
|
10
|
+
* stable layout never triggers a re-render loop.
|
|
11
|
+
*
|
|
12
|
+
* Pass `enabled: false` to opt a row out entirely — the observer is not attached
|
|
13
|
+
* and `isTruncated` stays `false`. Callers gate on this so only the rows that
|
|
14
|
+
* consume the signal pay for the measurement.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export function useIsTextTruncated(enabled) {
|
|
19
|
+
const ref = useRef(null);
|
|
20
|
+
const [isTruncated, setIsTruncated] = useState(false);
|
|
21
|
+
useLayoutEffect(() => {
|
|
22
|
+
if (!enabled) {
|
|
23
|
+
// Reset so a row that stops consuming the signal doesn't keep a stale true.
|
|
24
|
+
setIsTruncated((prev) => (prev ? false : prev));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const el = ref.current;
|
|
28
|
+
if (!el)
|
|
29
|
+
return;
|
|
30
|
+
const measure = () => {
|
|
31
|
+
const next = el.scrollWidth > el.clientWidth + 1;
|
|
32
|
+
setIsTruncated((prev) => (prev === next ? prev : next));
|
|
33
|
+
};
|
|
34
|
+
measure();
|
|
35
|
+
const ro = new ResizeObserver(measure);
|
|
36
|
+
ro.observe(el);
|
|
37
|
+
return () => ro.disconnect();
|
|
38
|
+
}, [enabled]);
|
|
39
|
+
return { ref, isTruncated };
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=useIsTextTruncated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsTextTruncated.js","sourceRoot":"","sources":["../../src/internal/useIsTextTruncated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAS1D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAgB;IAEhB,MAAM,GAAG,GAAG,MAAM,CAAW,IAAI,CAAC,CAAC;IACnC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEtD,eAAe,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,4EAA4E;YAC5E,cAAc,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YAChD,OAAO;QACT,CAAC;QAED,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC;QACvB,IAAI,CAAC,EAAE;YAAE,OAAO;QAEhB,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,MAAM,IAAI,GAAG,EAAE,CAAC,WAAW,GAAG,EAAE,CAAC,WAAW,GAAG,CAAC,CAAC;YACjD,cAAc,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1D,CAAC,CAAC;QAEF,OAAO,EAAE,CAAC;QAEV,MAAM,EAAE,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;QACvC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACf,OAAO,GAAG,EAAE,CAAC,EAAE,C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