@dexto/tui 1.15.0-beta.0 → 1.15.0-beta.1
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/dist/InkCLIRefactored.cjs +30 -24
- package/dist/InkCLIRefactored.d.ts.map +1 -1
- package/dist/InkCLIRefactored.js +30 -24
- package/dist/components/ApprovalPrompt.cjs +128 -40
- package/dist/components/ApprovalPrompt.d.ts +2 -0
- package/dist/components/ApprovalPrompt.d.ts.map +1 -1
- package/dist/components/ApprovalPrompt.js +128 -41
- package/dist/components/CustomInput.cjs +4 -3
- package/dist/components/CustomInput.d.ts.map +1 -1
- package/dist/components/CustomInput.js +4 -3
- package/dist/components/DeckArea.cjs +43 -0
- package/dist/components/DeckArea.d.ts +14 -0
- package/dist/components/DeckArea.d.ts.map +1 -0
- package/dist/components/DeckArea.js +19 -0
- package/dist/components/EditableMultiLineInput.cjs +9 -8
- package/dist/components/EditableMultiLineInput.d.ts.map +1 -1
- package/dist/components/EditableMultiLineInput.js +9 -8
- package/dist/components/ElicitationForm.cjs +78 -18
- package/dist/components/ElicitationForm.d.ts.map +1 -1
- package/dist/components/ElicitationForm.js +78 -18
- package/dist/components/ErrorBoundary.cjs +15 -5
- package/dist/components/ErrorBoundary.d.ts.map +1 -1
- package/dist/components/ErrorBoundary.js +15 -5
- package/dist/components/Footer.cjs +37 -113
- package/dist/components/Footer.d.ts +2 -2
- package/dist/components/Footer.d.ts.map +1 -1
- package/dist/components/Footer.js +40 -119
- package/dist/components/HistorySearchBar.cjs +6 -5
- package/dist/components/HistorySearchBar.d.ts.map +1 -1
- package/dist/components/HistorySearchBar.js +6 -5
- package/dist/components/MultiLineInput.cjs +6 -5
- package/dist/components/MultiLineInput.d.ts.map +1 -1
- package/dist/components/MultiLineInput.js +6 -5
- package/dist/components/ResourceAutocomplete.cjs +5 -4
- package/dist/components/ResourceAutocomplete.d.ts.map +1 -1
- package/dist/components/ResourceAutocomplete.js +5 -4
- package/dist/components/SignalGates.test.cjs +215 -0
- package/dist/components/SignalGates.test.d.ts +2 -0
- package/dist/components/SignalGates.test.d.ts.map +1 -0
- package/dist/components/SignalGates.test.js +217 -0
- package/dist/components/SlashCommandAutocomplete.cjs +4 -3
- package/dist/components/SlashCommandAutocomplete.d.ts.map +1 -1
- package/dist/components/SlashCommandAutocomplete.js +4 -3
- package/dist/components/StatusBar.cjs +13 -30
- package/dist/components/StatusBar.d.ts +1 -3
- package/dist/components/StatusBar.d.ts.map +1 -1
- package/dist/components/StatusBar.js +13 -30
- package/dist/components/TextBufferInput.cjs +13 -12
- package/dist/components/TextBufferInput.d.ts.map +1 -1
- package/dist/components/TextBufferInput.js +13 -12
- package/dist/components/TodoPanel.cjs +23 -16
- package/dist/components/TodoPanel.d.ts.map +1 -1
- package/dist/components/TodoPanel.js +23 -16
- package/dist/components/base/BaseAutocomplete.cjs +7 -6
- package/dist/components/base/BaseAutocomplete.d.ts.map +1 -1
- package/dist/components/base/BaseAutocomplete.js +7 -6
- package/dist/components/base/BaseSelector.cjs +5 -4
- package/dist/components/base/BaseSelector.d.ts.map +1 -1
- package/dist/components/base/BaseSelector.js +5 -4
- package/dist/components/chat/Footer.cjs +2 -1
- package/dist/components/chat/Footer.d.ts.map +1 -1
- package/dist/components/chat/Footer.js +2 -1
- package/dist/components/chat/Header.cjs +20 -16
- package/dist/components/chat/Header.d.ts.map +1 -1
- package/dist/components/chat/Header.js +20 -16
- package/dist/components/chat/MessageItem.cjs +47 -30
- package/dist/components/chat/MessageItem.d.ts.map +1 -1
- package/dist/components/chat/MessageItem.js +52 -29
- package/dist/components/chat/MessageList.cjs +3 -2
- package/dist/components/chat/MessageList.d.ts.map +1 -1
- package/dist/components/chat/MessageList.js +3 -2
- package/dist/components/chat/QueuedMessagesDisplay.cjs +17 -5
- package/dist/components/chat/QueuedMessagesDisplay.d.ts.map +1 -1
- package/dist/components/chat/QueuedMessagesDisplay.js +18 -6
- package/dist/components/chat/SignalMessage.cjs +116 -0
- package/dist/components/chat/SignalMessage.d.ts +18 -0
- package/dist/components/chat/SignalMessage.d.ts.map +1 -0
- package/dist/components/chat/SignalMessage.js +96 -0
- package/dist/components/chat/SignalMessage.test.cjs +112 -0
- package/dist/components/chat/SignalMessage.test.d.ts +2 -0
- package/dist/components/chat/SignalMessage.test.d.ts.map +1 -0
- package/dist/components/chat/SignalMessage.test.js +116 -0
- package/dist/components/chat/ToolIcon.cjs +6 -5
- package/dist/components/chat/ToolIcon.d.ts.map +1 -1
- package/dist/components/chat/ToolIcon.js +6 -5
- package/dist/components/chat/styled-boxes/ConfigBox.cjs +8 -7
- package/dist/components/chat/styled-boxes/ConfigBox.d.ts.map +1 -1
- package/dist/components/chat/styled-boxes/ConfigBox.js +8 -7
- package/dist/components/chat/styled-boxes/HelpBox.cjs +4 -3
- package/dist/components/chat/styled-boxes/HelpBox.d.ts.map +1 -1
- package/dist/components/chat/styled-boxes/HelpBox.js +4 -3
- package/dist/components/chat/styled-boxes/LogConfigBox.cjs +11 -3
- package/dist/components/chat/styled-boxes/LogConfigBox.d.ts.map +1 -1
- package/dist/components/chat/styled-boxes/LogConfigBox.js +11 -3
- package/dist/components/chat/styled-boxes/SessionHistoryBox.cjs +8 -7
- package/dist/components/chat/styled-boxes/SessionHistoryBox.d.ts.map +1 -1
- package/dist/components/chat/styled-boxes/SessionHistoryBox.js +8 -7
- package/dist/components/chat/styled-boxes/SessionListBox.cjs +19 -11
- package/dist/components/chat/styled-boxes/SessionListBox.d.ts.map +1 -1
- package/dist/components/chat/styled-boxes/SessionListBox.js +19 -11
- package/dist/components/chat/styled-boxes/ShortcutsBox.cjs +4 -3
- package/dist/components/chat/styled-boxes/ShortcutsBox.d.ts.map +1 -1
- package/dist/components/chat/styled-boxes/ShortcutsBox.js +4 -3
- package/dist/components/chat/styled-boxes/StatsBox.cjs +13 -5
- package/dist/components/chat/styled-boxes/StatsBox.d.ts.map +1 -1
- package/dist/components/chat/styled-boxes/StatsBox.js +13 -5
- package/dist/components/chat/styled-boxes/StyledBox.cjs +7 -6
- package/dist/components/chat/styled-boxes/StyledBox.d.ts.map +1 -1
- package/dist/components/chat/styled-boxes/StyledBox.js +7 -6
- package/dist/components/chat/styled-boxes/SyspromptBox.cjs +2 -1
- package/dist/components/chat/styled-boxes/SyspromptBox.d.ts.map +1 -1
- package/dist/components/chat/styled-boxes/SyspromptBox.js +2 -1
- package/dist/components/modes/AlternateBufferCLI.cjs +53 -43
- package/dist/components/modes/AlternateBufferCLI.d.ts.map +1 -1
- package/dist/components/modes/AlternateBufferCLI.js +53 -43
- package/dist/components/modes/StaticCLI.cjs +53 -42
- package/dist/components/modes/StaticCLI.d.ts.map +1 -1
- package/dist/components/modes/StaticCLI.js +53 -42
- package/dist/components/overlays/ApiKeyInput.cjs +12 -11
- package/dist/components/overlays/ApiKeyInput.d.ts.map +1 -1
- package/dist/components/overlays/ApiKeyInput.js +12 -11
- package/dist/components/overlays/ChatGPTUsageCapOverlay.cjs +7 -6
- package/dist/components/overlays/ChatGPTUsageCapOverlay.d.ts.map +1 -1
- package/dist/components/overlays/ChatGPTUsageCapOverlay.js +7 -6
- package/dist/components/overlays/CommandOutputOverlay.cjs +2 -1
- package/dist/components/overlays/CommandOutputOverlay.d.ts.map +1 -1
- package/dist/components/overlays/CommandOutputOverlay.js +2 -1
- package/dist/components/overlays/ConnectOverlay.cjs +10 -9
- package/dist/components/overlays/ConnectOverlay.d.ts.map +1 -1
- package/dist/components/overlays/ConnectOverlay.js +10 -9
- package/dist/components/overlays/ContextStatsOverlay.cjs +48 -37
- package/dist/components/overlays/ContextStatsOverlay.d.ts.map +1 -1
- package/dist/components/overlays/ContextStatsOverlay.js +48 -37
- package/dist/components/overlays/CustomModelWizard.cjs +5 -4
- package/dist/components/overlays/CustomModelWizard.d.ts.map +1 -1
- package/dist/components/overlays/CustomModelWizard.js +5 -4
- package/dist/components/overlays/ExportWizard.cjs +28 -27
- package/dist/components/overlays/ExportWizard.d.ts.map +1 -1
- package/dist/components/overlays/ExportWizard.js +28 -27
- package/dist/components/overlays/InsufficientCreditsOverlay.cjs +8 -7
- package/dist/components/overlays/InsufficientCreditsOverlay.d.ts.map +1 -1
- package/dist/components/overlays/InsufficientCreditsOverlay.js +8 -7
- package/dist/components/overlays/LogLevelSelector.cjs +6 -5
- package/dist/components/overlays/LogLevelSelector.d.ts.map +1 -1
- package/dist/components/overlays/LogLevelSelector.js +6 -5
- package/dist/components/overlays/LoginOverlay.cjs +7 -6
- package/dist/components/overlays/LoginOverlay.d.ts.map +1 -1
- package/dist/components/overlays/LoginOverlay.js +7 -6
- package/dist/components/overlays/LogoutOverlay.cjs +10 -9
- package/dist/components/overlays/LogoutOverlay.d.ts.map +1 -1
- package/dist/components/overlays/LogoutOverlay.js +10 -9
- package/dist/components/overlays/MarketplaceAddPrompt.cjs +12 -11
- package/dist/components/overlays/MarketplaceAddPrompt.d.ts.map +1 -1
- package/dist/components/overlays/MarketplaceAddPrompt.js +12 -11
- package/dist/components/overlays/MarketplaceBrowser.cjs +27 -26
- package/dist/components/overlays/MarketplaceBrowser.d.ts.map +1 -1
- package/dist/components/overlays/MarketplaceBrowser.js +27 -26
- package/dist/components/overlays/McpAddChoice.cjs +4 -3
- package/dist/components/overlays/McpAddChoice.d.ts.map +1 -1
- package/dist/components/overlays/McpAddChoice.js +4 -3
- package/dist/components/overlays/McpAddSelector.cjs +4 -3
- package/dist/components/overlays/McpAddSelector.d.ts.map +1 -1
- package/dist/components/overlays/McpAddSelector.js +4 -3
- package/dist/components/overlays/McpCustomTypeSelector.cjs +4 -3
- package/dist/components/overlays/McpCustomTypeSelector.d.ts.map +1 -1
- package/dist/components/overlays/McpCustomTypeSelector.js +4 -3
- package/dist/components/overlays/McpCustomWizard.cjs +9 -8
- package/dist/components/overlays/McpCustomWizard.d.ts.map +1 -1
- package/dist/components/overlays/McpCustomWizard.js +9 -8
- package/dist/components/overlays/McpRemoveSelector.cjs +5 -4
- package/dist/components/overlays/McpRemoveSelector.d.ts.map +1 -1
- package/dist/components/overlays/McpRemoveSelector.js +5 -4
- package/dist/components/overlays/McpSelector.cjs +4 -3
- package/dist/components/overlays/McpSelector.d.ts.map +1 -1
- package/dist/components/overlays/McpSelector.js +4 -3
- package/dist/components/overlays/McpServerActions.cjs +7 -6
- package/dist/components/overlays/McpServerActions.d.ts.map +1 -1
- package/dist/components/overlays/McpServerActions.js +7 -6
- package/dist/components/overlays/McpServerList.cjs +6 -5
- package/dist/components/overlays/McpServerList.d.ts.map +1 -1
- package/dist/components/overlays/McpServerList.js +6 -5
- package/dist/components/overlays/ModelSelectorRefactored.cjs +32 -17
- package/dist/components/overlays/ModelSelectorRefactored.d.ts.map +1 -1
- package/dist/components/overlays/ModelSelectorRefactored.js +32 -17
- package/dist/components/overlays/PermissionsSelector.cjs +6 -5
- package/dist/components/overlays/PermissionsSelector.d.ts.map +1 -1
- package/dist/components/overlays/PermissionsSelector.js +6 -5
- package/dist/components/overlays/PluginActions.cjs +7 -6
- package/dist/components/overlays/PluginActions.d.ts.map +1 -1
- package/dist/components/overlays/PluginActions.js +7 -6
- package/dist/components/overlays/PluginList.cjs +12 -11
- package/dist/components/overlays/PluginList.d.ts.map +1 -1
- package/dist/components/overlays/PluginList.js +12 -11
- package/dist/components/overlays/PluginManager.cjs +13 -5
- package/dist/components/overlays/PluginManager.d.ts.map +1 -1
- package/dist/components/overlays/PluginManager.js +13 -5
- package/dist/components/overlays/PromptAddChoice.cjs +5 -4
- package/dist/components/overlays/PromptAddChoice.d.ts.map +1 -1
- package/dist/components/overlays/PromptAddChoice.js +5 -4
- package/dist/components/overlays/PromptAddWizard.cjs +10 -9
- package/dist/components/overlays/PromptAddWizard.d.ts.map +1 -1
- package/dist/components/overlays/PromptAddWizard.js +10 -9
- package/dist/components/overlays/PromptDeleteSelector.cjs +6 -5
- package/dist/components/overlays/PromptDeleteSelector.d.ts.map +1 -1
- package/dist/components/overlays/PromptDeleteSelector.js +6 -5
- package/dist/components/overlays/PromptList.cjs +10 -9
- package/dist/components/overlays/PromptList.d.ts.map +1 -1
- package/dist/components/overlays/PromptList.js +10 -9
- package/dist/components/overlays/ReasoningOverlay.cjs +30 -23
- package/dist/components/overlays/ReasoningOverlay.d.ts.map +1 -1
- package/dist/components/overlays/ReasoningOverlay.js +30 -23
- package/dist/components/overlays/SearchOverlay.cjs +15 -14
- package/dist/components/overlays/SearchOverlay.d.ts.map +1 -1
- package/dist/components/overlays/SearchOverlay.js +15 -14
- package/dist/components/overlays/SessionRenameOverlay.cjs +9 -8
- package/dist/components/overlays/SessionRenameOverlay.d.ts.map +1 -1
- package/dist/components/overlays/SessionRenameOverlay.js +9 -8
- package/dist/components/overlays/SessionSelectorRefactored.cjs +4 -3
- package/dist/components/overlays/SessionSelectorRefactored.d.ts.map +1 -1
- package/dist/components/overlays/SessionSelectorRefactored.js +4 -3
- package/dist/components/overlays/SessionSubcommandSelector.cjs +4 -3
- package/dist/components/overlays/SessionSubcommandSelector.d.ts.map +1 -1
- package/dist/components/overlays/SessionSubcommandSelector.js +4 -3
- package/dist/components/overlays/SoundsSelector.cjs +15 -7
- package/dist/components/overlays/SoundsSelector.d.ts.map +1 -1
- package/dist/components/overlays/SoundsSelector.js +15 -7
- package/dist/components/overlays/StreamSelector.cjs +5 -4
- package/dist/components/overlays/StreamSelector.d.ts.map +1 -1
- package/dist/components/overlays/StreamSelector.js +5 -4
- package/dist/components/overlays/ToolBrowser.cjs +73 -56
- package/dist/components/overlays/ToolBrowser.d.ts.map +1 -1
- package/dist/components/overlays/ToolBrowser.js +73 -56
- package/dist/components/overlays/custom-model-wizard/LocalModelWizard.cjs +103 -69
- package/dist/components/overlays/custom-model-wizard/LocalModelWizard.d.ts.map +1 -1
- package/dist/components/overlays/custom-model-wizard/LocalModelWizard.js +103 -69
- package/dist/components/overlays/custom-model-wizard/shared/ApiKeyStep.cjs +3 -2
- package/dist/components/overlays/custom-model-wizard/shared/ApiKeyStep.d.ts.map +1 -1
- package/dist/components/overlays/custom-model-wizard/shared/ApiKeyStep.js +3 -2
- package/dist/components/overlays/custom-model-wizard/shared/ProviderSelector.cjs +5 -4
- package/dist/components/overlays/custom-model-wizard/shared/ProviderSelector.d.ts.map +1 -1
- package/dist/components/overlays/custom-model-wizard/shared/ProviderSelector.js +5 -4
- package/dist/components/overlays/custom-model-wizard/shared/SetupInfoBanner.cjs +4 -3
- package/dist/components/overlays/custom-model-wizard/shared/SetupInfoBanner.d.ts.map +1 -1
- package/dist/components/overlays/custom-model-wizard/shared/SetupInfoBanner.js +4 -3
- package/dist/components/overlays/custom-model-wizard/shared/WizardStepInput.cjs +7 -6
- package/dist/components/overlays/custom-model-wizard/shared/WizardStepInput.d.ts.map +1 -1
- package/dist/components/overlays/custom-model-wizard/shared/WizardStepInput.js +7 -6
- package/dist/components/renderers/DiffRenderer.cjs +5 -4
- package/dist/components/renderers/DiffRenderer.d.ts.map +1 -1
- package/dist/components/renderers/DiffRenderer.js +5 -4
- package/dist/components/renderers/FilePreviewRenderer.cjs +23 -13
- package/dist/components/renderers/FilePreviewRenderer.d.ts.map +1 -1
- package/dist/components/renderers/FilePreviewRenderer.js +23 -13
- package/dist/components/renderers/FileRenderer.cjs +9 -8
- package/dist/components/renderers/FileRenderer.d.ts.map +1 -1
- package/dist/components/renderers/FileRenderer.js +9 -8
- package/dist/components/renderers/GenericRenderer.cjs +5 -4
- package/dist/components/renderers/GenericRenderer.d.ts.map +1 -1
- package/dist/components/renderers/GenericRenderer.js +5 -4
- package/dist/components/renderers/SearchRenderer.cjs +4 -3
- package/dist/components/renderers/SearchRenderer.d.ts.map +1 -1
- package/dist/components/renderers/SearchRenderer.js +4 -3
- package/dist/components/renderers/ShellRenderer.cjs +6 -5
- package/dist/components/renderers/ShellRenderer.d.ts.map +1 -1
- package/dist/components/renderers/ShellRenderer.js +6 -5
- package/dist/components/renderers/SignalDiff.cjs +139 -0
- package/dist/components/renderers/SignalDiff.d.ts +21 -0
- package/dist/components/renderers/SignalDiff.d.ts.map +1 -0
- package/dist/components/renderers/SignalDiff.js +106 -0
- package/dist/components/renderers/SignalDiff.test.cjs +78 -0
- package/dist/components/renderers/SignalDiff.test.d.ts +2 -0
- package/dist/components/renderers/SignalDiff.test.d.ts.map +1 -0
- package/dist/components/renderers/SignalDiff.test.js +77 -0
- package/dist/components/renderers/diff-shared.cjs +13 -7
- package/dist/components/renderers/diff-shared.d.ts +5 -0
- package/dist/components/renderers/diff-shared.d.ts.map +1 -1
- package/dist/components/renderers/diff-shared.js +12 -7
- package/dist/components/shared/FocusOverlayFrame.cjs +3 -2
- package/dist/components/shared/FocusOverlayFrame.d.ts.map +1 -1
- package/dist/components/shared/FocusOverlayFrame.js +3 -2
- package/dist/components/shared/HintBar.cjs +2 -1
- package/dist/components/shared/HintBar.d.ts.map +1 -1
- package/dist/components/shared/HintBar.js +2 -1
- package/dist/components/shared/MarkdownText.cjs +36 -53
- package/dist/components/shared/MarkdownText.d.ts +2 -0
- package/dist/components/shared/MarkdownText.d.ts.map +1 -1
- package/dist/components/shared/MarkdownText.js +36 -54
- package/dist/components/shared/VirtualizedList.cjs +2 -1
- package/dist/components/shared/VirtualizedList.d.ts.map +1 -1
- package/dist/components/shared/VirtualizedList.js +2 -1
- package/dist/containers/OverlayContainer.cjs +2 -4
- package/dist/containers/OverlayContainer.d.ts.map +1 -1
- package/dist/containers/OverlayContainer.js +2 -4
- package/dist/contexts/KeypressContext.cjs +7 -1
- package/dist/contexts/KeypressContext.d.ts.map +1 -1
- package/dist/contexts/KeypressContext.js +7 -1
- package/dist/contexts/KeypressContext.test.cjs +82 -0
- package/dist/contexts/KeypressContext.test.d.ts +2 -0
- package/dist/contexts/KeypressContext.test.d.ts.map +1 -0
- package/dist/contexts/KeypressContext.test.js +81 -0
- package/dist/hooks/useAgentEvents.cjs +1 -74
- package/dist/hooks/useAgentEvents.d.ts.map +1 -1
- package/dist/hooks/useAgentEvents.js +1 -74
- package/dist/hooks/useCLIState.cjs +0 -3
- package/dist/hooks/useCLIState.d.ts.map +1 -1
- package/dist/hooks/useCLIState.js +0 -3
- package/dist/hooks/useContextStats.cjs +91 -0
- package/dist/hooks/useContextStats.d.ts +13 -0
- package/dist/hooks/useContextStats.d.ts.map +1 -0
- package/dist/hooks/useContextStats.js +67 -0
- package/dist/hooks/useDeckState.cjs +140 -0
- package/dist/hooks/useDeckState.d.ts +20 -0
- package/dist/hooks/useDeckState.d.ts.map +1 -0
- package/dist/hooks/useDeckState.js +123 -0
- package/dist/hooks/useDextoCredits.cjs +81 -0
- package/dist/hooks/useDextoCredits.d.ts +14 -0
- package/dist/hooks/useDextoCredits.d.ts.map +1 -0
- package/dist/hooks/useDextoCredits.js +56 -0
- package/dist/hooks/useDextoCredits.test.cjs +73 -0
- package/dist/hooks/useDextoCredits.test.d.ts +2 -0
- package/dist/hooks/useDextoCredits.test.d.ts.map +1 -0
- package/dist/hooks/useDextoCredits.test.js +72 -0
- package/dist/hooks/useElapsedTime.cjs +13 -24
- package/dist/hooks/useElapsedTime.d.ts +3 -1
- package/dist/hooks/useElapsedTime.d.ts.map +1 -1
- package/dist/hooks/useElapsedTime.js +13 -24
- package/dist/hooks/useElapsedTime.test.cjs +35 -0
- package/dist/hooks/useElapsedTime.test.d.ts +2 -0
- package/dist/hooks/useElapsedTime.test.d.ts.map +1 -0
- package/dist/hooks/useElapsedTime.test.js +34 -0
- package/dist/hooks/useGitDirtyFiles.cjs +59 -0
- package/dist/hooks/useGitDirtyFiles.d.ts +5 -0
- package/dist/hooks/useGitDirtyFiles.d.ts.map +1 -0
- package/dist/hooks/useGitDirtyFiles.js +34 -0
- package/dist/hooks/useGitDirtyFiles.test.cjs +9 -0
- package/dist/hooks/useGitDirtyFiles.test.d.ts +2 -0
- package/dist/hooks/useGitDirtyFiles.test.d.ts.map +1 -0
- package/dist/hooks/useGitDirtyFiles.test.js +8 -0
- package/dist/hooks/useHeldValue.cjs +33 -0
- package/dist/hooks/useHeldValue.d.ts +3 -0
- package/dist/hooks/useHeldValue.d.ts.map +1 -0
- package/dist/hooks/useHeldValue.js +9 -0
- package/dist/hooks/useHeldValue.test.cjs +31 -0
- package/dist/hooks/useHeldValue.test.d.ts +2 -0
- package/dist/hooks/useHeldValue.test.d.ts.map +1 -0
- package/dist/hooks/useHeldValue.test.js +30 -0
- package/dist/hooks/useInputOrchestrator.cjs +22 -30
- package/dist/hooks/useInputOrchestrator.d.ts +2 -0
- package/dist/hooks/useInputOrchestrator.d.ts.map +1 -1
- package/dist/hooks/useInputOrchestrator.js +21 -30
- package/dist/hooks/useInputOrchestrator.test.cjs +24 -0
- package/dist/hooks/useInputOrchestrator.test.d.ts +2 -0
- package/dist/hooks/useInputOrchestrator.test.d.ts.map +1 -0
- package/dist/hooks/useInputOrchestrator.test.js +23 -0
- package/dist/interactive-commands/command-parser.cjs +13 -21
- package/dist/interactive-commands/command-parser.d.ts.map +1 -1
- package/dist/interactive-commands/command-parser.js +13 -11
- package/dist/interactive-commands/general-commands.cjs +8 -7
- package/dist/interactive-commands/general-commands.d.ts.map +1 -1
- package/dist/interactive-commands/general-commands.js +8 -7
- package/dist/services/processStream.cjs +31 -19
- package/dist/services/processStream.d.ts.map +1 -1
- package/dist/services/processStream.js +32 -20
- package/dist/services/processStream.test.cjs +51 -3
- package/dist/services/processStream.test.js +51 -3
- package/dist/signal/background.cjs +154 -0
- package/dist/signal/background.d.ts +43 -0
- package/dist/signal/background.d.ts.map +1 -0
- package/dist/signal/background.js +124 -0
- package/dist/signal/background.test.cjs +186 -0
- package/dist/signal/background.test.d.ts +2 -0
- package/dist/signal/background.test.d.ts.map +1 -0
- package/dist/signal/background.test.js +192 -0
- package/dist/signal/caps.cjs +100 -0
- package/dist/signal/caps.d.ts +23 -0
- package/dist/signal/caps.d.ts.map +1 -0
- package/dist/signal/caps.js +73 -0
- package/dist/signal/caps.test.cjs +56 -0
- package/dist/signal/caps.test.d.ts +2 -0
- package/dist/signal/caps.test.d.ts.map +1 -0
- package/dist/signal/caps.test.js +55 -0
- package/dist/signal/components.cjs +257 -0
- package/dist/signal/components.d.ts +120 -0
- package/dist/signal/components.d.ts.map +1 -0
- package/dist/signal/components.js +226 -0
- package/dist/signal/components.test.cjs +156 -0
- package/dist/signal/components.test.d.ts +2 -0
- package/dist/signal/components.test.d.ts.map +1 -0
- package/dist/signal/components.test.js +133 -0
- package/dist/signal/cut.cjs +103 -0
- package/dist/signal/cut.d.ts +11 -0
- package/dist/signal/cut.d.ts.map +1 -0
- package/dist/signal/cut.js +77 -0
- package/dist/signal/cut.test.cjs +20 -0
- package/dist/signal/cut.test.d.ts +2 -0
- package/dist/signal/cut.test.d.ts.map +1 -0
- package/dist/signal/cut.test.js +19 -0
- package/dist/signal/deck-layout.cjs +57 -0
- package/dist/signal/deck-layout.d.ts +29 -0
- package/dist/signal/deck-layout.d.ts.map +1 -0
- package/dist/signal/deck-layout.js +30 -0
- package/dist/signal/deck-parts.cjs +243 -0
- package/dist/signal/deck-parts.d.ts +55 -0
- package/dist/signal/deck-parts.d.ts.map +1 -0
- package/dist/signal/deck-parts.js +205 -0
- package/dist/signal/deck.test.cjs +311 -0
- package/dist/signal/deck.test.d.ts +2 -0
- package/dist/signal/deck.test.d.ts.map +1 -0
- package/dist/signal/deck.test.js +288 -0
- package/dist/signal/glyphs.cjs +195 -0
- package/dist/signal/glyphs.d.ts +8 -0
- package/dist/signal/glyphs.d.ts.map +1 -0
- package/dist/signal/glyphs.js +171 -0
- package/dist/signal/glyphs.test.cjs +17 -0
- package/dist/signal/glyphs.test.d.ts +2 -0
- package/dist/signal/glyphs.test.d.ts.map +1 -0
- package/dist/signal/glyphs.test.js +16 -0
- package/dist/signal/harness.cjs +103 -0
- package/dist/signal/harness.d.ts +70 -0
- package/dist/signal/harness.d.ts.map +1 -0
- package/dist/signal/harness.js +67 -0
- package/dist/signal/harness.test.cjs +84 -0
- package/dist/signal/harness.test.d.ts +2 -0
- package/dist/signal/harness.test.d.ts.map +1 -0
- package/dist/signal/harness.test.js +61 -0
- package/dist/signal/index.cjs +76 -0
- package/dist/signal/index.d.ts +8 -0
- package/dist/signal/index.d.ts.map +1 -0
- package/dist/signal/index.js +45 -0
- package/dist/signal/kit.snapshot.test.cjs +56 -0
- package/dist/signal/kit.snapshot.test.d.ts +2 -0
- package/dist/signal/kit.snapshot.test.d.ts.map +1 -0
- package/dist/signal/kit.snapshot.test.js +55 -0
- package/dist/signal/no-raw-colours.test.cjs +32 -0
- package/dist/signal/no-raw-colours.test.d.ts +2 -0
- package/dist/signal/no-raw-colours.test.d.ts.map +1 -0
- package/dist/signal/no-raw-colours.test.js +30 -0
- package/dist/signal/paint.cjs +76 -0
- package/dist/signal/paint.d.ts +15 -0
- package/dist/signal/paint.d.ts.map +1 -0
- package/dist/signal/paint.js +41 -0
- package/dist/signal/paint.test.cjs +98 -0
- package/dist/signal/paint.test.d.ts +2 -0
- package/dist/signal/paint.test.d.ts.map +1 -0
- package/dist/signal/paint.test.js +75 -0
- package/dist/signal/tone.cjs +109 -0
- package/dist/signal/tone.d.ts +17 -0
- package/dist/signal/tone.d.ts.map +1 -0
- package/dist/signal/tone.js +83 -0
- package/dist/signal/tone.test.cjs +70 -0
- package/dist/signal/tone.test.d.ts +2 -0
- package/dist/signal/tone.test.d.ts.map +1 -0
- package/dist/signal/tone.test.js +69 -0
- package/dist/signal/trace.cjs +142 -0
- package/dist/signal/trace.d.ts +41 -0
- package/dist/signal/trace.d.ts.map +1 -0
- package/dist/signal/trace.js +113 -0
- package/dist/signal/trace.test.cjs +50 -0
- package/dist/signal/trace.test.d.ts +2 -0
- package/dist/signal/trace.test.d.ts.map +1 -0
- package/dist/signal/trace.test.js +49 -0
- package/dist/signal/use-trace.cjs +73 -0
- package/dist/signal/use-trace.d.ts +5 -0
- package/dist/signal/use-trace.d.ts.map +1 -0
- package/dist/signal/use-trace.js +48 -0
- package/dist/signal/wordmark-art.generated.cjs +375 -0
- package/dist/signal/wordmark-art.generated.d.ts +3 -0
- package/dist/signal/wordmark-art.generated.d.ts.map +1 -0
- package/dist/signal/wordmark-art.generated.js +351 -0
- package/dist/signal/wordmark.cjs +60 -0
- package/dist/signal/wordmark.d.ts +23 -0
- package/dist/signal/wordmark.d.ts.map +1 -0
- package/dist/signal/wordmark.js +34 -0
- package/dist/signal/wordmark.test.cjs +71 -0
- package/dist/signal/wordmark.test.d.ts +2 -0
- package/dist/signal/wordmark.test.d.ts.map +1 -0
- package/dist/signal/wordmark.test.js +70 -0
- package/dist/state/initialState.cjs +0 -3
- package/dist/state/initialState.d.ts.map +1 -1
- package/dist/state/initialState.js +0 -3
- package/dist/state/types.d.ts +13 -7
- package/dist/state/types.d.ts.map +1 -1
- package/dist/utils/approval-response.cjs +45 -0
- package/dist/utils/approval-response.d.ts +14 -0
- package/dist/utils/approval-response.d.ts.map +1 -0
- package/dist/utils/approval-response.js +21 -0
- package/dist/utils/approval-response.test.cjs +49 -0
- package/dist/utils/approval-response.test.d.ts +2 -0
- package/dist/utils/approval-response.test.d.ts.map +1 -0
- package/dist/utils/approval-response.test.js +55 -0
- package/dist/utils/approvalScope.cjs +12 -0
- package/dist/utils/approvalScope.d.ts.map +1 -1
- package/dist/utils/approvalScope.js +12 -0
- package/dist/utils/approvalScope.test.cjs +23 -0
- package/dist/utils/approvalScope.test.d.ts +2 -0
- package/dist/utils/approvalScope.test.d.ts.map +1 -0
- package/dist/utils/approvalScope.test.js +22 -0
- package/dist/utils/background-failure.cjs +51 -0
- package/dist/utils/background-failure.d.ts +12 -0
- package/dist/utils/background-failure.d.ts.map +1 -0
- package/dist/utils/background-failure.js +26 -0
- package/dist/utils/chatgpt-rate-limit.cjs +10 -0
- package/dist/utils/chatgpt-rate-limit.d.ts +9 -0
- package/dist/utils/chatgpt-rate-limit.d.ts.map +1 -1
- package/dist/utils/chatgpt-rate-limit.js +9 -0
- package/dist/utils/chatgpt-rate-limit.test.cjs +10 -0
- package/dist/utils/chatgpt-rate-limit.test.js +11 -0
- package/dist/utils/deck-state.cjs +107 -0
- package/dist/utils/deck-state.d.ts +79 -0
- package/dist/utils/deck-state.d.ts.map +1 -0
- package/dist/utils/deck-state.js +76 -0
- package/dist/utils/deck-state.test.cjs +208 -0
- package/dist/utils/deck-state.test.d.ts +2 -0
- package/dist/utils/deck-state.test.d.ts.map +1 -0
- package/dist/utils/deck-state.test.js +216 -0
- package/dist/utils/fault-block.cjs +37 -0
- package/dist/utils/fault-block.d.ts +13 -0
- package/dist/utils/fault-block.d.ts.map +1 -0
- package/dist/utils/fault-block.js +13 -0
- package/dist/utils/fault-block.test.cjs +23 -0
- package/dist/utils/fault-block.test.d.ts +2 -0
- package/dist/utils/fault-block.test.d.ts.map +1 -0
- package/dist/utils/fault-block.test.js +22 -0
- package/dist/utils/messageFormatting.cjs +26 -23
- package/dist/utils/messageFormatting.d.ts +5 -2
- package/dist/utils/messageFormatting.d.ts.map +1 -1
- package/dist/utils/messageFormatting.js +25 -21
- package/dist/utils/messageFormatting.test.cjs +34 -0
- package/dist/utils/messageFormatting.test.js +35 -1
- package/dist/utils/reasoning-variant.cjs +35 -0
- package/dist/utils/reasoning-variant.d.ts +13 -0
- package/dist/utils/reasoning-variant.d.ts.map +1 -0
- package/dist/utils/reasoning-variant.js +11 -0
- package/dist/utils/resize-reflow.cjs +119 -0
- package/dist/utils/resize-reflow.d.ts +18 -0
- package/dist/utils/resize-reflow.d.ts.map +1 -0
- package/dist/utils/resize-reflow.js +83 -0
- package/dist/utils/resize-reflow.test.cjs +100 -0
- package/dist/utils/resize-reflow.test.d.ts +2 -0
- package/dist/utils/resize-reflow.test.d.ts.map +1 -0
- package/dist/utils/resize-reflow.test.js +99 -0
- package/dist/utils/tool-step.cjs +183 -0
- package/dist/utils/tool-step.d.ts +28 -0
- package/dist/utils/tool-step.d.ts.map +1 -0
- package/dist/utils/tool-step.js +156 -0
- package/dist/utils/tool-step.test.cjs +263 -0
- package/dist/utils/tool-step.test.d.ts +2 -0
- package/dist/utils/tool-step.test.d.ts.map +1 -0
- package/dist/utils/tool-step.test.js +262 -0
- package/package.json +7 -3
- package/dist/components/BackgroundTasksPanel.cjs +0 -117
- package/dist/components/BackgroundTasksPanel.d.ts +0 -18
- package/dist/components/BackgroundTasksPanel.d.ts.map +0 -1
- package/dist/components/BackgroundTasksPanel.js +0 -93
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var SignalDiff_exports = {};
|
|
30
|
+
__export(SignalDiff_exports, {
|
|
31
|
+
SignalDiff: () => SignalDiff,
|
|
32
|
+
diffRows: () => diffRows,
|
|
33
|
+
numberCells: () => numberCells
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(SignalDiff_exports);
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var import_ink = require("ink");
|
|
38
|
+
var import_string_width = __toESM(require("string-width"), 1);
|
|
39
|
+
var import_signal = require("../../signal/index.js");
|
|
40
|
+
var import_diff_shared = require("./diff-shared.js");
|
|
41
|
+
function diffRows(hunk) {
|
|
42
|
+
let oldLine = hunk.oldStart;
|
|
43
|
+
let newLine = hunk.newStart;
|
|
44
|
+
const rows = hunk.lines.map((line) => ({
|
|
45
|
+
kind: line.type,
|
|
46
|
+
oldLine: line.type === "addition" ? null : oldLine++,
|
|
47
|
+
newLine: line.type === "deletion" ? null : newLine++,
|
|
48
|
+
content: line.content,
|
|
49
|
+
parts: null
|
|
50
|
+
}));
|
|
51
|
+
rows.forEach((row, i) => {
|
|
52
|
+
const next = rows[i + 1];
|
|
53
|
+
if (row.kind !== "deletion" || next?.kind !== "addition") return;
|
|
54
|
+
const { oldParts, newParts } = (0, import_diff_shared.computeWordDiff)(row.content, next.content);
|
|
55
|
+
row.parts = oldParts;
|
|
56
|
+
next.parts = newParts;
|
|
57
|
+
});
|
|
58
|
+
return rows;
|
|
59
|
+
}
|
|
60
|
+
const MIN_NUMBER_CELLS = 4;
|
|
61
|
+
function numberCells(hunks) {
|
|
62
|
+
const largest = hunks.flatMap((hunk) => diffRows(hunk)).flatMap((row) => [row.oldLine ?? 0, row.newLine ?? 0]).reduce((a, b) => Math.max(a, b), 0);
|
|
63
|
+
return Math.max(MIN_NUMBER_CELLS, String(largest).length);
|
|
64
|
+
}
|
|
65
|
+
function gutterCells(cells) {
|
|
66
|
+
return cells * 2 + 4;
|
|
67
|
+
}
|
|
68
|
+
function cell(line, cells) {
|
|
69
|
+
return (line === null ? "" : String(line)).padStart(cells, " ");
|
|
70
|
+
}
|
|
71
|
+
const ROW_STYLE = {
|
|
72
|
+
addition: { bg: "addBg", strong: "addBg2", sign: "+", role: "add" },
|
|
73
|
+
deletion: { bg: "delBg", strong: "delBg2", sign: "\u2212", role: "del" },
|
|
74
|
+
context: { bg: null, strong: null, sign: " ", role: "dim" }
|
|
75
|
+
};
|
|
76
|
+
function RowText({ row, width, cells }) {
|
|
77
|
+
const tone = (0, import_signal.useTone)();
|
|
78
|
+
const { glyphs } = (0, import_signal.useCaps)();
|
|
79
|
+
const style = ROW_STYLE[row.kind];
|
|
80
|
+
const bg = style.bg === null ? {} : { backgroundColor: tone(style.bg) };
|
|
81
|
+
const parts = (row.parts ?? [{ value: row.content }]).map((part) => ({
|
|
82
|
+
...part,
|
|
83
|
+
value: part.value.replace(/\t/g, " ")
|
|
84
|
+
}));
|
|
85
|
+
const gutter = gutterCells(cells);
|
|
86
|
+
const room = Math.max(1, width - gutter);
|
|
87
|
+
const used = (0, import_string_width.default)(parts.map((part) => part.value).join(""));
|
|
88
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Box, { children: [
|
|
89
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Box, { width: gutter, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Text, { ...bg, children: [
|
|
90
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
91
|
+
import_ink.Text,
|
|
92
|
+
{
|
|
93
|
+
color: tone("faint"),
|
|
94
|
+
children: `${cell(row.oldLine, cells)} ${cell(row.newLine, cells)} `
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Text, { bold: true, color: tone(style.role), children: [
|
|
98
|
+
(0, import_signal.glyphText)(style.sign, glyphs),
|
|
99
|
+
" "
|
|
100
|
+
] })
|
|
101
|
+
] }) }),
|
|
102
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Box, { width: room, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Text, { wrap: "wrap", ...bg, children: [
|
|
103
|
+
parts.map((part, i) => {
|
|
104
|
+
const strong = part.added || part.removed ? style.strong : null;
|
|
105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
106
|
+
import_ink.Text,
|
|
107
|
+
{
|
|
108
|
+
color: tone(
|
|
109
|
+
strong !== null ? "hi" : row.kind === "context" ? "dim" : "fg"
|
|
110
|
+
),
|
|
111
|
+
...strong !== null ? { backgroundColor: tone(strong) } : {},
|
|
112
|
+
children: part.value
|
|
113
|
+
},
|
|
114
|
+
i
|
|
115
|
+
);
|
|
116
|
+
}),
|
|
117
|
+
style.bg !== null && used < room ? " ".repeat(room - used) : ""
|
|
118
|
+
] }) })
|
|
119
|
+
] });
|
|
120
|
+
}
|
|
121
|
+
function SignalDiff({ data, width }) {
|
|
122
|
+
const tone = (0, import_signal.useTone)();
|
|
123
|
+
const { glyphs } = (0, import_signal.useCaps)();
|
|
124
|
+
const hunks = (0, import_diff_shared.parseUnifiedDiff)(data.unified);
|
|
125
|
+
const cells = numberCells(hunks);
|
|
126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Box, { flexDirection: "column", children: hunks.map((hunk, h) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Box, { flexDirection: "column", children: [
|
|
127
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Text, { wrap: "truncate-end", children: [
|
|
128
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { color: tone("ghost"), children: (0, import_signal.glyphText)("\u250A ", glyphs) }),
|
|
129
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { color: tone("tealDim"), children: (0, import_signal.glyphText)(hunk.header.replace(/ -(\d)/, " \u2212$1"), glyphs) })
|
|
130
|
+
] }),
|
|
131
|
+
diffRows(hunk).map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RowText, { row, width, cells }, i))
|
|
132
|
+
] }, h)) });
|
|
133
|
+
}
|
|
134
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
135
|
+
0 && (module.exports = {
|
|
136
|
+
SignalDiff,
|
|
137
|
+
diffRows,
|
|
138
|
+
numberCells
|
|
139
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { DiffDisplayData } from '@dexto/core';
|
|
2
|
+
import { type ParsedHunk, type WordDiffPart } from './diff-shared.js';
|
|
3
|
+
export interface DiffRow {
|
|
4
|
+
kind: 'context' | 'addition' | 'deletion';
|
|
5
|
+
oldLine: number | null;
|
|
6
|
+
newLine: number | null;
|
|
7
|
+
content: string;
|
|
8
|
+
/** Word-level parts, when this line is one side of a change. */
|
|
9
|
+
parts: WordDiffPart[] | null;
|
|
10
|
+
}
|
|
11
|
+
/** One hunk's rows, each with both line numbers, and word diffs across a -/+ pair. */
|
|
12
|
+
export declare function diffRows(hunk: ParsedHunk): DiffRow[];
|
|
13
|
+
/** Cells for a line number: wide enough for the largest in the diff, the same on every row. */
|
|
14
|
+
export declare function numberCells(hunks: ParsedHunk[]): number;
|
|
15
|
+
export interface SignalDiffProps {
|
|
16
|
+
data: DiffDisplayData;
|
|
17
|
+
/** Columns the diff may fill. */
|
|
18
|
+
width: number;
|
|
19
|
+
}
|
|
20
|
+
export declare function SignalDiff({ data, width }: SignalDiffProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
//# sourceMappingURL=SignalDiff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignalDiff.d.ts","sourceRoot":"","sources":["../../../src/components/renderers/SignalDiff.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAGH,KAAK,UAAU,EACf,KAAK,YAAY,EACpB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,OAAO;IACpB,IAAI,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;IAC1C,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,KAAK,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;CAChC;AAED,sFAAsF;AACtF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,EAAE,CAkBpD;AAID,+FAA+F;AAC/F,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,MAAM,CAMvD;AAkED,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,eAAe,CAAC;IACtB,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,eAAe,2CAsB1D"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
import stringWidth from "string-width";
|
|
4
|
+
import { glyphText, useCaps, useTone } from "../../signal/index.js";
|
|
5
|
+
import {
|
|
6
|
+
computeWordDiff,
|
|
7
|
+
parseUnifiedDiff
|
|
8
|
+
} from "./diff-shared.js";
|
|
9
|
+
function diffRows(hunk) {
|
|
10
|
+
let oldLine = hunk.oldStart;
|
|
11
|
+
let newLine = hunk.newStart;
|
|
12
|
+
const rows = hunk.lines.map((line) => ({
|
|
13
|
+
kind: line.type,
|
|
14
|
+
oldLine: line.type === "addition" ? null : oldLine++,
|
|
15
|
+
newLine: line.type === "deletion" ? null : newLine++,
|
|
16
|
+
content: line.content,
|
|
17
|
+
parts: null
|
|
18
|
+
}));
|
|
19
|
+
rows.forEach((row, i) => {
|
|
20
|
+
const next = rows[i + 1];
|
|
21
|
+
if (row.kind !== "deletion" || next?.kind !== "addition") return;
|
|
22
|
+
const { oldParts, newParts } = computeWordDiff(row.content, next.content);
|
|
23
|
+
row.parts = oldParts;
|
|
24
|
+
next.parts = newParts;
|
|
25
|
+
});
|
|
26
|
+
return rows;
|
|
27
|
+
}
|
|
28
|
+
const MIN_NUMBER_CELLS = 4;
|
|
29
|
+
function numberCells(hunks) {
|
|
30
|
+
const largest = hunks.flatMap((hunk) => diffRows(hunk)).flatMap((row) => [row.oldLine ?? 0, row.newLine ?? 0]).reduce((a, b) => Math.max(a, b), 0);
|
|
31
|
+
return Math.max(MIN_NUMBER_CELLS, String(largest).length);
|
|
32
|
+
}
|
|
33
|
+
function gutterCells(cells) {
|
|
34
|
+
return cells * 2 + 4;
|
|
35
|
+
}
|
|
36
|
+
function cell(line, cells) {
|
|
37
|
+
return (line === null ? "" : String(line)).padStart(cells, " ");
|
|
38
|
+
}
|
|
39
|
+
const ROW_STYLE = {
|
|
40
|
+
addition: { bg: "addBg", strong: "addBg2", sign: "+", role: "add" },
|
|
41
|
+
deletion: { bg: "delBg", strong: "delBg2", sign: "\u2212", role: "del" },
|
|
42
|
+
context: { bg: null, strong: null, sign: " ", role: "dim" }
|
|
43
|
+
};
|
|
44
|
+
function RowText({ row, width, cells }) {
|
|
45
|
+
const tone = useTone();
|
|
46
|
+
const { glyphs } = useCaps();
|
|
47
|
+
const style = ROW_STYLE[row.kind];
|
|
48
|
+
const bg = style.bg === null ? {} : { backgroundColor: tone(style.bg) };
|
|
49
|
+
const parts = (row.parts ?? [{ value: row.content }]).map((part) => ({
|
|
50
|
+
...part,
|
|
51
|
+
value: part.value.replace(/\t/g, " ")
|
|
52
|
+
}));
|
|
53
|
+
const gutter = gutterCells(cells);
|
|
54
|
+
const room = Math.max(1, width - gutter);
|
|
55
|
+
const used = stringWidth(parts.map((part) => part.value).join(""));
|
|
56
|
+
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
57
|
+
/* @__PURE__ */ jsx(Box, { width: gutter, flexShrink: 0, children: /* @__PURE__ */ jsxs(Text, { ...bg, children: [
|
|
58
|
+
/* @__PURE__ */ jsx(
|
|
59
|
+
Text,
|
|
60
|
+
{
|
|
61
|
+
color: tone("faint"),
|
|
62
|
+
children: `${cell(row.oldLine, cells)} ${cell(row.newLine, cells)} `
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
/* @__PURE__ */ jsxs(Text, { bold: true, color: tone(style.role), children: [
|
|
66
|
+
glyphText(style.sign, glyphs),
|
|
67
|
+
" "
|
|
68
|
+
] })
|
|
69
|
+
] }) }),
|
|
70
|
+
/* @__PURE__ */ jsx(Box, { width: room, flexShrink: 0, children: /* @__PURE__ */ jsxs(Text, { wrap: "wrap", ...bg, children: [
|
|
71
|
+
parts.map((part, i) => {
|
|
72
|
+
const strong = part.added || part.removed ? style.strong : null;
|
|
73
|
+
return /* @__PURE__ */ jsx(
|
|
74
|
+
Text,
|
|
75
|
+
{
|
|
76
|
+
color: tone(
|
|
77
|
+
strong !== null ? "hi" : row.kind === "context" ? "dim" : "fg"
|
|
78
|
+
),
|
|
79
|
+
...strong !== null ? { backgroundColor: tone(strong) } : {},
|
|
80
|
+
children: part.value
|
|
81
|
+
},
|
|
82
|
+
i
|
|
83
|
+
);
|
|
84
|
+
}),
|
|
85
|
+
style.bg !== null && used < room ? " ".repeat(room - used) : ""
|
|
86
|
+
] }) })
|
|
87
|
+
] });
|
|
88
|
+
}
|
|
89
|
+
function SignalDiff({ data, width }) {
|
|
90
|
+
const tone = useTone();
|
|
91
|
+
const { glyphs } = useCaps();
|
|
92
|
+
const hunks = parseUnifiedDiff(data.unified);
|
|
93
|
+
const cells = numberCells(hunks);
|
|
94
|
+
return /* @__PURE__ */ jsx(Box, { flexDirection: "column", children: hunks.map((hunk, h) => /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
|
|
95
|
+
/* @__PURE__ */ jsxs(Text, { wrap: "truncate-end", children: [
|
|
96
|
+
/* @__PURE__ */ jsx(Text, { color: tone("ghost"), children: glyphText("\u250A ", glyphs) }),
|
|
97
|
+
/* @__PURE__ */ jsx(Text, { color: tone("tealDim"), children: glyphText(hunk.header.replace(/ -(\d)/, " \u2212$1"), glyphs) })
|
|
98
|
+
] }),
|
|
99
|
+
diffRows(hunk).map((row, i) => /* @__PURE__ */ jsx(RowText, { row, width, cells }, i))
|
|
100
|
+
] }, h)) });
|
|
101
|
+
}
|
|
102
|
+
export {
|
|
103
|
+
SignalDiff,
|
|
104
|
+
diffRows,
|
|
105
|
+
numberCells
|
|
106
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var import_react = require("react");
|
|
3
|
+
var import_vitest = require("vitest");
|
|
4
|
+
var import_harness = require("../../signal/harness.js");
|
|
5
|
+
var import_diff_shared = require("./diff-shared.js");
|
|
6
|
+
var import_SignalDiff = require("./SignalDiff.js");
|
|
7
|
+
const UNIFIED = [
|
|
8
|
+
"--- a.ts",
|
|
9
|
+
"+++ a.ts",
|
|
10
|
+
"@@ -41,3 +41,3 @@ export function parse",
|
|
11
|
+
" keep",
|
|
12
|
+
"-const old = 1;",
|
|
13
|
+
"+const fresh = 1;",
|
|
14
|
+
" tail"
|
|
15
|
+
].join("\n");
|
|
16
|
+
(0, import_vitest.describe)("diffRows", () => {
|
|
17
|
+
const rows = (0, import_SignalDiff.diffRows)((0, import_diff_shared.parseUnifiedDiff)(UNIFIED)[0]);
|
|
18
|
+
(0, import_vitest.it)("numbers each row on the side it exists on", () => {
|
|
19
|
+
(0, import_vitest.expect)(rows.map((r) => [r.oldLine, r.newLine])).toEqual([
|
|
20
|
+
[41, 41],
|
|
21
|
+
[42, null],
|
|
22
|
+
[null, 42],
|
|
23
|
+
[43, 43]
|
|
24
|
+
]);
|
|
25
|
+
});
|
|
26
|
+
(0, import_vitest.it)("word-diffs a removed line against the added line after it", () => {
|
|
27
|
+
(0, import_vitest.expect)(rows[1]?.parts?.some((p) => p.removed && p.value.includes("old"))).toBe(true);
|
|
28
|
+
(0, import_vitest.expect)(rows[2]?.parts?.some((p) => p.added && p.value.includes("fresh"))).toBe(true);
|
|
29
|
+
(0, import_vitest.expect)(rows[0]?.parts).toBeNull();
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
(0, import_vitest.describe)("SignalDiff", () => {
|
|
33
|
+
const data = {
|
|
34
|
+
type: "diff",
|
|
35
|
+
unified: UNIFIED,
|
|
36
|
+
filename: "a.ts",
|
|
37
|
+
additions: 1,
|
|
38
|
+
deletions: 1
|
|
39
|
+
};
|
|
40
|
+
(0, import_vitest.it)("draws the hunk header, both line numbers and signs", () => {
|
|
41
|
+
const frame = (0, import_harness.renderFrame)((0, import_react.createElement)(import_SignalDiff.SignalDiff, { data, width: 60 }), {
|
|
42
|
+
columns: 60,
|
|
43
|
+
terminal: "no-color"
|
|
44
|
+
});
|
|
45
|
+
const lines = frame.split("\n").map((l) => l.trimEnd());
|
|
46
|
+
(0, import_vitest.expect)(lines[0]).toBe("\u250A @@ \u221241,3 +41,3 @@ export function parse");
|
|
47
|
+
(0, import_vitest.expect)(lines[1]).toBe(" 41 41 keep");
|
|
48
|
+
(0, import_vitest.expect)(lines[2]).toBe(" 42 \u2212 const old = 1;");
|
|
49
|
+
(0, import_vitest.expect)(lines[3]).toBe(" 42 + const fresh = 1;");
|
|
50
|
+
});
|
|
51
|
+
(0, import_vitest.it)("wraps a long line so none of it is hidden", () => {
|
|
52
|
+
const long = { ...data, unified: `@@ -1 +1 @@
|
|
53
|
+
+${"x".repeat(200)}` };
|
|
54
|
+
const frame = (0, import_harness.renderFrame)((0, import_react.createElement)(import_SignalDiff.SignalDiff, { data: long, width: 40 }), {
|
|
55
|
+
columns: 40,
|
|
56
|
+
terminal: "no-color"
|
|
57
|
+
});
|
|
58
|
+
(0, import_vitest.expect)(frame.match(/x/g)).toHaveLength(200);
|
|
59
|
+
for (const line of frame.split("\n")) (0, import_vitest.expect)(line.length).toBeLessThanOrEqual(40);
|
|
60
|
+
});
|
|
61
|
+
(0, import_vitest.it)("widens the gutter for large line numbers and keeps rows aligned", () => {
|
|
62
|
+
const large = { ...data, unified: "@@ -100000,1 +100000,1 @@\n-old\n+new" };
|
|
63
|
+
const lines = (0, import_harness.renderFrame)((0, import_react.createElement)(import_SignalDiff.SignalDiff, { data: large, width: 60 }), {
|
|
64
|
+
columns: 60,
|
|
65
|
+
terminal: "no-color"
|
|
66
|
+
}).split("\n");
|
|
67
|
+
(0, import_vitest.expect)(lines[1]?.trimEnd()).toBe("100000 \u2212 old");
|
|
68
|
+
(0, import_vitest.expect)(lines[2]?.trimEnd()).toBe(" 100000 + new");
|
|
69
|
+
});
|
|
70
|
+
(0, import_vitest.it)("falls back to plain signs on an ASCII terminal", () => {
|
|
71
|
+
const frame = (0, import_harness.renderFrame)((0, import_react.createElement)(import_SignalDiff.SignalDiff, { data, width: 60 }), {
|
|
72
|
+
columns: 60,
|
|
73
|
+
terminal: "ascii"
|
|
74
|
+
});
|
|
75
|
+
(0, import_vitest.expect)(frame).not.toContain("\u250A");
|
|
76
|
+
(0, import_vitest.expect)(frame).not.toContain("\u2212");
|
|
77
|
+
});
|
|
78
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignalDiff.test.d.ts","sourceRoot":"","sources":["../../../src/components/renderers/SignalDiff.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { renderFrame } from "../../signal/harness.js";
|
|
4
|
+
import { parseUnifiedDiff } from "./diff-shared.js";
|
|
5
|
+
import { SignalDiff, diffRows } from "./SignalDiff.js";
|
|
6
|
+
const UNIFIED = [
|
|
7
|
+
"--- a.ts",
|
|
8
|
+
"+++ a.ts",
|
|
9
|
+
"@@ -41,3 +41,3 @@ export function parse",
|
|
10
|
+
" keep",
|
|
11
|
+
"-const old = 1;",
|
|
12
|
+
"+const fresh = 1;",
|
|
13
|
+
" tail"
|
|
14
|
+
].join("\n");
|
|
15
|
+
describe("diffRows", () => {
|
|
16
|
+
const rows = diffRows(parseUnifiedDiff(UNIFIED)[0]);
|
|
17
|
+
it("numbers each row on the side it exists on", () => {
|
|
18
|
+
expect(rows.map((r) => [r.oldLine, r.newLine])).toEqual([
|
|
19
|
+
[41, 41],
|
|
20
|
+
[42, null],
|
|
21
|
+
[null, 42],
|
|
22
|
+
[43, 43]
|
|
23
|
+
]);
|
|
24
|
+
});
|
|
25
|
+
it("word-diffs a removed line against the added line after it", () => {
|
|
26
|
+
expect(rows[1]?.parts?.some((p) => p.removed && p.value.includes("old"))).toBe(true);
|
|
27
|
+
expect(rows[2]?.parts?.some((p) => p.added && p.value.includes("fresh"))).toBe(true);
|
|
28
|
+
expect(rows[0]?.parts).toBeNull();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
describe("SignalDiff", () => {
|
|
32
|
+
const data = {
|
|
33
|
+
type: "diff",
|
|
34
|
+
unified: UNIFIED,
|
|
35
|
+
filename: "a.ts",
|
|
36
|
+
additions: 1,
|
|
37
|
+
deletions: 1
|
|
38
|
+
};
|
|
39
|
+
it("draws the hunk header, both line numbers and signs", () => {
|
|
40
|
+
const frame = renderFrame(createElement(SignalDiff, { data, width: 60 }), {
|
|
41
|
+
columns: 60,
|
|
42
|
+
terminal: "no-color"
|
|
43
|
+
});
|
|
44
|
+
const lines = frame.split("\n").map((l) => l.trimEnd());
|
|
45
|
+
expect(lines[0]).toBe("\u250A @@ \u221241,3 +41,3 @@ export function parse");
|
|
46
|
+
expect(lines[1]).toBe(" 41 41 keep");
|
|
47
|
+
expect(lines[2]).toBe(" 42 \u2212 const old = 1;");
|
|
48
|
+
expect(lines[3]).toBe(" 42 + const fresh = 1;");
|
|
49
|
+
});
|
|
50
|
+
it("wraps a long line so none of it is hidden", () => {
|
|
51
|
+
const long = { ...data, unified: `@@ -1 +1 @@
|
|
52
|
+
+${"x".repeat(200)}` };
|
|
53
|
+
const frame = renderFrame(createElement(SignalDiff, { data: long, width: 40 }), {
|
|
54
|
+
columns: 40,
|
|
55
|
+
terminal: "no-color"
|
|
56
|
+
});
|
|
57
|
+
expect(frame.match(/x/g)).toHaveLength(200);
|
|
58
|
+
for (const line of frame.split("\n")) expect(line.length).toBeLessThanOrEqual(40);
|
|
59
|
+
});
|
|
60
|
+
it("widens the gutter for large line numbers and keeps rows aligned", () => {
|
|
61
|
+
const large = { ...data, unified: "@@ -100000,1 +100000,1 @@\n-old\n+new" };
|
|
62
|
+
const lines = renderFrame(createElement(SignalDiff, { data: large, width: 60 }), {
|
|
63
|
+
columns: 60,
|
|
64
|
+
terminal: "no-color"
|
|
65
|
+
}).split("\n");
|
|
66
|
+
expect(lines[1]?.trimEnd()).toBe("100000 \u2212 old");
|
|
67
|
+
expect(lines[2]?.trimEnd()).toBe(" 100000 + new");
|
|
68
|
+
});
|
|
69
|
+
it("falls back to plain signs on an ASCII terminal", () => {
|
|
70
|
+
const frame = renderFrame(createElement(SignalDiff, { data, width: 60 }), {
|
|
71
|
+
columns: 60,
|
|
72
|
+
terminal: "ascii"
|
|
73
|
+
});
|
|
74
|
+
expect(frame).not.toContain("\u250A");
|
|
75
|
+
expect(frame).not.toContain("\u2212");
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var diff_shared_exports = {};
|
|
20
20
|
__export(diff_shared_exports, {
|
|
21
|
+
DiffInsetContext: () => DiffInsetContext,
|
|
21
22
|
DiffLine: () => DiffLine,
|
|
22
23
|
HunkSeparator: () => HunkSeparator,
|
|
23
24
|
computeWordDiff: () => computeWordDiff,
|
|
@@ -28,8 +29,10 @@ __export(diff_shared_exports, {
|
|
|
28
29
|
});
|
|
29
30
|
module.exports = __toCommonJS(diff_shared_exports);
|
|
30
31
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var import_react = require("react");
|
|
31
33
|
var import_ink = require("ink");
|
|
32
34
|
var import_diff = require("diff");
|
|
35
|
+
var import_signal = require("../../signal/index.js");
|
|
33
36
|
function parseUnifiedDiff(unified) {
|
|
34
37
|
const lines = unified.split("\n");
|
|
35
38
|
const hunks = [];
|
|
@@ -50,6 +53,7 @@ function parseUnifiedDiff(unified) {
|
|
|
50
53
|
currentHunk = {
|
|
51
54
|
oldStart: oldLine,
|
|
52
55
|
newStart: newLine,
|
|
56
|
+
header: line,
|
|
53
57
|
lines: []
|
|
54
58
|
};
|
|
55
59
|
continue;
|
|
@@ -115,18 +119,19 @@ function getLineNumWidth(maxLineNum) {
|
|
|
115
119
|
function formatLineNum(num, width) {
|
|
116
120
|
return String(num).padStart(width, " ");
|
|
117
121
|
}
|
|
122
|
+
const DiffInsetContext = (0, import_react.createContext)(0);
|
|
118
123
|
function DiffLine({ type, lineNum, lineNumWidth, content, wordDiffParts }) {
|
|
119
124
|
const { stdout } = (0, import_ink.useStdout)();
|
|
120
|
-
const terminalWidth = stdout?.columns ?? 80;
|
|
125
|
+
const terminalWidth = (stdout?.columns ?? 80) - (0, import_react.useContext)(DiffInsetContext);
|
|
121
126
|
const lineNumStr = formatLineNum(lineNum, lineNumWidth);
|
|
122
127
|
const gutterWidth = lineNumWidth + 3;
|
|
123
128
|
const contentWidth = Math.max(20, terminalWidth - gutterWidth - 4);
|
|
124
129
|
const getColors = () => {
|
|
125
130
|
switch (type) {
|
|
126
131
|
case "deletion":
|
|
127
|
-
return { bg: "
|
|
132
|
+
return { bg: (0, import_signal.tone)("delBg"), fg: (0, import_signal.tone)("hi"), symbol: "-", symbolColor: (0, import_signal.tone)("red") };
|
|
128
133
|
case "addition":
|
|
129
|
-
return { bg: "
|
|
134
|
+
return { bg: (0, import_signal.tone)("addBg"), fg: (0, import_signal.tone)("hi"), symbol: "+", symbolColor: (0, import_signal.tone)("fg") };
|
|
130
135
|
default:
|
|
131
136
|
return { bg: void 0, fg: void 0, symbol: " ", symbolColor: void 0 };
|
|
132
137
|
}
|
|
@@ -136,9 +141,9 @@ function DiffLine({ type, lineNum, lineNumWidth, content, wordDiffParts }) {
|
|
|
136
141
|
if (wordDiffParts && wordDiffParts.length > 0) {
|
|
137
142
|
return wordDiffParts.map((part, i) => {
|
|
138
143
|
if (type === "deletion" && part.removed) {
|
|
139
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { backgroundColor: "
|
|
144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { backgroundColor: (0, import_signal.tone)("delBg2"), children: part.value }, i);
|
|
140
145
|
} else if (type === "addition" && part.added) {
|
|
141
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { backgroundColor: "
|
|
146
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { backgroundColor: (0, import_signal.tone)("addBg2"), children: part.value }, i);
|
|
142
147
|
}
|
|
143
148
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { children: part.value }, i);
|
|
144
149
|
});
|
|
@@ -147,7 +152,7 @@ function DiffLine({ type, lineNum, lineNumWidth, content, wordDiffParts }) {
|
|
|
147
152
|
};
|
|
148
153
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Box, { children: [
|
|
149
154
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Box, { width: gutterWidth, flexShrink: 0, children: [
|
|
150
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { color: "
|
|
155
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { color: (0, import_signal.tone)("dim"), children: lineNumStr }),
|
|
151
156
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Text, { color: colors.symbolColor, children: [
|
|
152
157
|
" ",
|
|
153
158
|
colors.symbol,
|
|
@@ -158,10 +163,11 @@ function DiffLine({ type, lineNum, lineNumWidth, content, wordDiffParts }) {
|
|
|
158
163
|
] });
|
|
159
164
|
}
|
|
160
165
|
function HunkSeparator() {
|
|
161
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { color: "
|
|
166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { color: (0, import_signal.tone)("dim"), children: "..." }) });
|
|
162
167
|
}
|
|
163
168
|
// Annotate the CommonJS export names for ESM import in node:
|
|
164
169
|
0 && (module.exports = {
|
|
170
|
+
DiffInsetContext,
|
|
165
171
|
DiffLine,
|
|
166
172
|
HunkSeparator,
|
|
167
173
|
computeWordDiff,
|
|
@@ -4,9 +4,12 @@
|
|
|
4
4
|
* Common code for DiffRenderer and FilePreviewRenderer.
|
|
5
5
|
* Handles unified diff parsing, word-level diff highlighting, and line rendering.
|
|
6
6
|
*/
|
|
7
|
+
import React from 'react';
|
|
7
8
|
export interface ParsedHunk {
|
|
8
9
|
oldStart: number;
|
|
9
10
|
newStart: number;
|
|
11
|
+
/** The hunk's own "@@ -1,2 +1,3 @@ context" line. */
|
|
12
|
+
header: string;
|
|
10
13
|
lines: ParsedLine[];
|
|
11
14
|
}
|
|
12
15
|
export interface ParsedLine {
|
|
@@ -39,6 +42,8 @@ export declare function computeWordDiff(oldStr: string, newStr: string): {
|
|
|
39
42
|
};
|
|
40
43
|
export declare function getLineNumWidth(maxLineNum: number): number;
|
|
41
44
|
export declare function formatLineNum(num: number, width: number): string;
|
|
45
|
+
/** Columns a surrounding frame takes from the terminal, so diff rows fit inside it. */
|
|
46
|
+
export declare const DiffInsetContext: React.Context<number>;
|
|
42
47
|
interface DiffLineProps {
|
|
43
48
|
type: 'context' | 'addition' | 'deletion';
|
|
44
49
|
lineNum: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-shared.d.ts","sourceRoot":"","sources":["../../../src/components/renderers/diff-shared.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"diff-shared.d.ts","sourceRoot":"","sources":["../../../src/components/renderers/diff-shared.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAoC,MAAM,OAAO,CAAC;AASzD,MAAM,WAAW,UAAU;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,UAAU,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAMD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,EAAE,CA0D9D;AAED;;GAEG;AACH,wBAAgB,aAAa,CACzB,KAAK,EAAE,UAAU,EAAE,GACpB,GAAG,CAAC,MAAM,EAAE;IAAE,GAAG,EAAE,UAAU,CAAC;IAAC,GAAG,EAAE,UAAU,CAAA;CAAE,CAAC,CAanD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC3B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACf;IAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;IAAC,QAAQ,EAAE,YAAY,EAAE,CAAA;CAAE,CAkBxD;AAMD,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhE;AAMD,uFAAuF;AACvF,eAAO,MAAM,gBAAgB,uBAAmB,CAAC;AAEjD,UAAU,aAAa;IACnB,IAAI,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;CAClC;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,EAAE,aAAa,2CAgE9F;AAED;;GAEG;AACH,wBAAgB,aAAa,4CAM5B"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
2
3
|
import { Box, Text, useStdout } from "ink";
|
|
3
4
|
import { diffWords } from "diff";
|
|
5
|
+
import { tone } from "../../signal/index.js";
|
|
4
6
|
function parseUnifiedDiff(unified) {
|
|
5
7
|
const lines = unified.split("\n");
|
|
6
8
|
const hunks = [];
|
|
@@ -21,6 +23,7 @@ function parseUnifiedDiff(unified) {
|
|
|
21
23
|
currentHunk = {
|
|
22
24
|
oldStart: oldLine,
|
|
23
25
|
newStart: newLine,
|
|
26
|
+
header: line,
|
|
24
27
|
lines: []
|
|
25
28
|
};
|
|
26
29
|
continue;
|
|
@@ -86,18 +89,19 @@ function getLineNumWidth(maxLineNum) {
|
|
|
86
89
|
function formatLineNum(num, width) {
|
|
87
90
|
return String(num).padStart(width, " ");
|
|
88
91
|
}
|
|
92
|
+
const DiffInsetContext = createContext(0);
|
|
89
93
|
function DiffLine({ type, lineNum, lineNumWidth, content, wordDiffParts }) {
|
|
90
94
|
const { stdout } = useStdout();
|
|
91
|
-
const terminalWidth = stdout?.columns ?? 80;
|
|
95
|
+
const terminalWidth = (stdout?.columns ?? 80) - useContext(DiffInsetContext);
|
|
92
96
|
const lineNumStr = formatLineNum(lineNum, lineNumWidth);
|
|
93
97
|
const gutterWidth = lineNumWidth + 3;
|
|
94
98
|
const contentWidth = Math.max(20, terminalWidth - gutterWidth - 4);
|
|
95
99
|
const getColors = () => {
|
|
96
100
|
switch (type) {
|
|
97
101
|
case "deletion":
|
|
98
|
-
return { bg: "
|
|
102
|
+
return { bg: tone("delBg"), fg: tone("hi"), symbol: "-", symbolColor: tone("red") };
|
|
99
103
|
case "addition":
|
|
100
|
-
return { bg: "
|
|
104
|
+
return { bg: tone("addBg"), fg: tone("hi"), symbol: "+", symbolColor: tone("fg") };
|
|
101
105
|
default:
|
|
102
106
|
return { bg: void 0, fg: void 0, symbol: " ", symbolColor: void 0 };
|
|
103
107
|
}
|
|
@@ -107,9 +111,9 @@ function DiffLine({ type, lineNum, lineNumWidth, content, wordDiffParts }) {
|
|
|
107
111
|
if (wordDiffParts && wordDiffParts.length > 0) {
|
|
108
112
|
return wordDiffParts.map((part, i) => {
|
|
109
113
|
if (type === "deletion" && part.removed) {
|
|
110
|
-
return /* @__PURE__ */ jsx(Text, { backgroundColor: "
|
|
114
|
+
return /* @__PURE__ */ jsx(Text, { backgroundColor: tone("delBg2"), children: part.value }, i);
|
|
111
115
|
} else if (type === "addition" && part.added) {
|
|
112
|
-
return /* @__PURE__ */ jsx(Text, { backgroundColor: "
|
|
116
|
+
return /* @__PURE__ */ jsx(Text, { backgroundColor: tone("addBg2"), children: part.value }, i);
|
|
113
117
|
}
|
|
114
118
|
return /* @__PURE__ */ jsx(Text, { children: part.value }, i);
|
|
115
119
|
});
|
|
@@ -118,7 +122,7 @@ function DiffLine({ type, lineNum, lineNumWidth, content, wordDiffParts }) {
|
|
|
118
122
|
};
|
|
119
123
|
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
120
124
|
/* @__PURE__ */ jsxs(Box, { width: gutterWidth, flexShrink: 0, children: [
|
|
121
|
-
/* @__PURE__ */ jsx(Text, { color: "
|
|
125
|
+
/* @__PURE__ */ jsx(Text, { color: tone("dim"), children: lineNumStr }),
|
|
122
126
|
/* @__PURE__ */ jsxs(Text, { color: colors.symbolColor, children: [
|
|
123
127
|
" ",
|
|
124
128
|
colors.symbol,
|
|
@@ -129,9 +133,10 @@ function DiffLine({ type, lineNum, lineNumWidth, content, wordDiffParts }) {
|
|
|
129
133
|
] });
|
|
130
134
|
}
|
|
131
135
|
function HunkSeparator() {
|
|
132
|
-
return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { color: "
|
|
136
|
+
return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { color: tone("dim"), children: "..." }) });
|
|
133
137
|
}
|
|
134
138
|
export {
|
|
139
|
+
DiffInsetContext,
|
|
135
140
|
DiffLine,
|
|
136
141
|
HunkSeparator,
|
|
137
142
|
computeWordDiff,
|
|
@@ -24,13 +24,14 @@ module.exports = __toCommonJS(FocusOverlayFrame_exports);
|
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
25
|
var import_ink = require("ink");
|
|
26
26
|
var import_useTerminalSize = require("../../hooks/useTerminalSize.js");
|
|
27
|
+
var import_signal = require("../../signal/index.js");
|
|
27
28
|
function FocusOverlayFrame({ children }) {
|
|
28
29
|
const { columns } = (0, import_useTerminalSize.useTerminalSize)();
|
|
29
30
|
const divider = "\u2500".repeat(Math.max(0, columns));
|
|
30
31
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Box, { flexDirection: "column", width: columns, children: [
|
|
31
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { color: "
|
|
32
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { color: (0, import_signal.tone)("dim"), children: divider }),
|
|
32
33
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Box, { paddingX: 1, flexDirection: "column", children }),
|
|
33
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { color: "
|
|
34
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { color: (0, import_signal.tone)("dim"), children: divider })
|
|
34
35
|
] });
|
|
35
36
|
}
|
|
36
37
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FocusOverlayFrame.d.ts","sourceRoot":"","sources":["../../../src/components/shared/FocusOverlayFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FocusOverlayFrame.d.ts","sourceRoot":"","sources":["../../../src/components/shared/FocusOverlayFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,UAAU,sBAAsB;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,wBAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,EAAE,sBAAsB,2CAarE"}
|