@brimveyn/aimux 1.6.1 → 1.6.2
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/package.json +2 -2
- package/src/app-runtime/side-effects.ts +19 -0
- package/src/app.tsx +4 -0
- package/src/config.ts +19 -1
- package/src/git/diff-hash.ts +10 -0
- package/src/input/modes/types.ts +1 -0
- package/src/state/git-tree.ts +42 -16
- package/src/state/reducers/diff-cache.ts +64 -0
- package/src/state/reducers/git-mode-state.ts +91 -33
- package/src/state/reducers/git-panel-state.ts +33 -2
- package/src/state/store.ts +2 -0
- package/src/state/types.ts +58 -1
- package/src/ui/components/diff-renderer/pierre-diff.tsx +9 -31
- package/src/ui/components/diff-renderer/prepare-diff.ts +66 -0
- package/src/ui/components/diff-renderer/split-view.tsx +30 -5
- package/src/ui/components/diff-renderer/stacked-view.tsx +29 -4
- package/src/ui/components/diff-renderer/use-diff-prefetch.ts +191 -0
- package/src/ui/components/diff-renderer/use-diff-preparation.ts +106 -0
- package/src/ui/components/git-pane-widget.tsx +2 -0
- package/src/ui/components/git-panel.tsx +17 -7
- package/src/ui/components/git-view.tsx +19 -1
|
@@ -14,6 +14,7 @@ export const GitPaneWidget = memo(function GitPaneWidget({ pollingEnabled }: Git
|
|
|
14
14
|
const gitPanel = useAppStore((s) => s.gitPanel)
|
|
15
15
|
const gitMode = useAppStore((s) => s.gitMode)
|
|
16
16
|
const gitFileListMode = useAppStore((s) => s.gitPane.fileListMode)
|
|
17
|
+
const treeCompaction = useAppStore((s) => s.gitPane.treeCompaction)
|
|
17
18
|
const pathConfig = useAppStore((s) => s.gitPane.path)
|
|
18
19
|
const diffCountConfig = useAppStore((s) => s.gitPane.diffCount)
|
|
19
20
|
const currentSessionId = useAppStore((s) => s.currentSessionId)
|
|
@@ -40,6 +41,7 @@ export const GitPaneWidget = memo(function GitPaneWidget({ pollingEnabled }: Git
|
|
|
40
41
|
return (
|
|
41
42
|
<GitPanel
|
|
42
43
|
collapsedFolders={gitMode.collapsedFolders}
|
|
44
|
+
compact={treeCompaction}
|
|
43
45
|
diffCountConfig={diffCountConfig}
|
|
44
46
|
fileListMode={gitFileListMode}
|
|
45
47
|
gitPanel={display}
|
|
@@ -24,6 +24,7 @@ interface GitPanelProps {
|
|
|
24
24
|
pathConfig?: GitPanePathConfig
|
|
25
25
|
diffCountConfig?: GitPaneDiffCountConfig
|
|
26
26
|
headOffset?: number
|
|
27
|
+
compact?: boolean
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
function sectionTitle(section: GitFileSection, headOffset: number): string {
|
|
@@ -172,7 +173,10 @@ function renderFolderRow(row: GitTreeFolderRow, isSelected: boolean): ReactNode
|
|
|
172
173
|
<text fg={getCurrentTheme().colors['descriptionForeground']} bg={bg}>
|
|
173
174
|
{row.isCollapsed ? '▸' : '▾'}
|
|
174
175
|
</text>
|
|
175
|
-
<text fg={getCurrentTheme().colors['
|
|
176
|
+
<text fg={getCurrentTheme().colors['textLink.foreground']} bg={bg}>
|
|
177
|
+
{row.isCollapsed ? '\uf07b' : '\uf07c'}
|
|
178
|
+
</text>
|
|
179
|
+
<text fg={getCurrentTheme().colors['textLink.foreground']} bg={bg} wrapMode="none">
|
|
176
180
|
{row.name}
|
|
177
181
|
</text>
|
|
178
182
|
</box>
|
|
@@ -222,7 +226,8 @@ function renderTreeSection(
|
|
|
222
226
|
selectedEntryKey: string | null | undefined,
|
|
223
227
|
showListModeToggle: boolean,
|
|
224
228
|
pathConfig: GitPanePathConfig,
|
|
225
|
-
diffCountConfig: GitPaneDiffCountConfig
|
|
229
|
+
diffCountConfig: GitPaneDiffCountConfig,
|
|
230
|
+
marginTop: number
|
|
226
231
|
): ReactNode {
|
|
227
232
|
if (files.length === 0) return null
|
|
228
233
|
const nextFileListMode = fileListMode === 'tree' ? 'flat' : 'tree'
|
|
@@ -231,7 +236,7 @@ function renderTreeSection(
|
|
|
231
236
|
runSideEffectGlobal({ mode: nextFileListMode, type: 'persist-git-file-list-mode' })
|
|
232
237
|
}
|
|
233
238
|
return (
|
|
234
|
-
<box key={section} flexDirection="column">
|
|
239
|
+
<box key={section} flexDirection="column" marginTop={marginTop}>
|
|
235
240
|
<box flexDirection="row" justifyContent="space-between">
|
|
236
241
|
<text fg={getCurrentTheme().colors['terminal.ansiMagenta']}>
|
|
237
242
|
<strong>
|
|
@@ -327,6 +332,7 @@ const DEFAULT_DIFF_COUNT_CONFIG: GitPaneDiffCountConfig = { enabled: true }
|
|
|
327
332
|
|
|
328
333
|
export const GitPanel = memo(function GitPanel({
|
|
329
334
|
collapsedFolders = {},
|
|
335
|
+
compact = false,
|
|
330
336
|
diffCountConfig = DEFAULT_DIFF_COUNT_CONFIG,
|
|
331
337
|
fileListMode = 'tree',
|
|
332
338
|
gitPanel,
|
|
@@ -339,8 +345,8 @@ export const GitPanel = memo(function GitPanel({
|
|
|
339
345
|
const sectionOrder = headOffset > 0 ? HISTORICAL_SECTION_ORDER : BASE_SECTION_ORDER
|
|
340
346
|
const scrollRef = useRef<ScrollBoxRenderable | null>(null)
|
|
341
347
|
const tree = useMemo(
|
|
342
|
-
() => buildGitTreeRows(gitPanel.files, collapsedFolders, fileListMode),
|
|
343
|
-
[collapsedFolders, fileListMode, gitPanel.files]
|
|
348
|
+
() => buildGitTreeRows(gitPanel.files, collapsedFolders, fileListMode, compact),
|
|
349
|
+
[collapsedFolders, compact, fileListMode, gitPanel.files]
|
|
344
350
|
)
|
|
345
351
|
const { added: addedW, removed: removedW } = useMemo(
|
|
346
352
|
() => maxDigitWidth(gitPanel.files),
|
|
@@ -382,8 +388,11 @@ export const GitPanel = memo(function GitPanel({
|
|
|
382
388
|
viewportCulling
|
|
383
389
|
contentOptions={{ flexDirection: 'column', gap: 0 }}
|
|
384
390
|
>
|
|
385
|
-
{sectionOrder.map((key) => {
|
|
391
|
+
{sectionOrder.map((key, idx) => {
|
|
386
392
|
const section = tree.sections.find((entry) => entry.section === key)
|
|
393
|
+
const priorHasFiles = sectionOrder
|
|
394
|
+
.slice(0, idx)
|
|
395
|
+
.some((k) => (tree.sections.find((e) => e.section === k)?.files.length ?? 0) > 0)
|
|
387
396
|
return renderTreeSection(
|
|
388
397
|
key,
|
|
389
398
|
sectionTitle(key, headOffset),
|
|
@@ -395,7 +404,8 @@ export const GitPanel = memo(function GitPanel({
|
|
|
395
404
|
selectedEntryKey,
|
|
396
405
|
key === toggleSection,
|
|
397
406
|
pathConfig,
|
|
398
|
-
diffCountConfig
|
|
407
|
+
diffCountConfig,
|
|
408
|
+
priorHasFiles ? 1 : 0
|
|
399
409
|
)
|
|
400
410
|
})}
|
|
401
411
|
</scrollbox>
|
|
@@ -4,6 +4,7 @@ import { memo, useEffect, useRef } from 'react'
|
|
|
4
4
|
import type { DiffData, GitDiffView } from '../../state/types'
|
|
5
5
|
import type { ThemeId } from '../themes'
|
|
6
6
|
|
|
7
|
+
import { diffHash } from '../../git/diff-hash'
|
|
7
8
|
import { fetchDiff } from '../../git/git-diff'
|
|
8
9
|
import { useGitPanelPolling } from '../../git/git-poller'
|
|
9
10
|
import { useAppStore } from '../../state/app-store'
|
|
@@ -12,6 +13,7 @@ import { getSelectedGitFile, gitFileKey } from '../../state/git-tree'
|
|
|
12
13
|
import { setGitDiffScroller } from '../git-view-controls'
|
|
13
14
|
import { useTheme } from '../theme'
|
|
14
15
|
import { PierreDiff, type PierreDiffHandle } from './diff-renderer'
|
|
16
|
+
import { useDiffPrefetch } from './diff-renderer/use-diff-prefetch'
|
|
15
17
|
import { GitPanel } from './git-panel'
|
|
16
18
|
|
|
17
19
|
interface DiffStageProps {
|
|
@@ -124,6 +126,7 @@ export const GitView = memo(function GitView({ themeId }: GitViewProps) {
|
|
|
124
126
|
|
|
125
127
|
const selectedFile = getSelectedGitFile(gitPanel.files, {
|
|
126
128
|
collapsedFolders: gitMode.collapsedFolders,
|
|
129
|
+
compact: gitPane.treeCompaction,
|
|
127
130
|
fileListMode: gitPane.fileListMode,
|
|
128
131
|
selectedEntryKey: gitMode.selectedEntryKey,
|
|
129
132
|
})
|
|
@@ -147,6 +150,13 @@ export const GitView = memo(function GitView({ themeId }: GitViewProps) {
|
|
|
147
150
|
return () => setGitDiffScroller(null)
|
|
148
151
|
}, [])
|
|
149
152
|
|
|
153
|
+
useDiffPrefetch(gitMode.selectedEntryKey, gitPane.prefetchRadius, {
|
|
154
|
+
enabled: focusMode === 'git',
|
|
155
|
+
headOffset: gitMode.headOffset,
|
|
156
|
+
projectPath,
|
|
157
|
+
themeId,
|
|
158
|
+
})
|
|
159
|
+
|
|
150
160
|
useEffect(() => {
|
|
151
161
|
if (focusMode !== 'git') return
|
|
152
162
|
if (!selectedFile || !projectPath) return
|
|
@@ -154,7 +164,14 @@ export const GitView = memo(function GitView({ themeId }: GitViewProps) {
|
|
|
154
164
|
if (diff || loading) return
|
|
155
165
|
dispatchGlobal({ key: selectedDiffKey, loading: true, type: 'git-mode-set-loading' })
|
|
156
166
|
void fetchDiff(projectPath, selectedFile, gitMode.headOffset)
|
|
157
|
-
.then((d) =>
|
|
167
|
+
.then((d) =>
|
|
168
|
+
dispatchGlobal({
|
|
169
|
+
diff: d,
|
|
170
|
+
hash: diffHash(d.rawDiff),
|
|
171
|
+
key: selectedDiffKey,
|
|
172
|
+
type: 'git-mode-set-diff',
|
|
173
|
+
})
|
|
174
|
+
)
|
|
158
175
|
.catch(() =>
|
|
159
176
|
dispatchGlobal({ key: selectedDiffKey, loading: false, type: 'git-mode-set-loading' })
|
|
160
177
|
)
|
|
@@ -219,6 +236,7 @@ export const GitView = memo(function GitView({ themeId }: GitViewProps) {
|
|
|
219
236
|
</text>
|
|
220
237
|
<GitPanel
|
|
221
238
|
collapsedFolders={gitMode.collapsedFolders}
|
|
239
|
+
compact={gitPane.treeCompaction}
|
|
222
240
|
fileListMode={gitPane.fileListMode}
|
|
223
241
|
gitPanel={gitPanel}
|
|
224
242
|
headOffset={gitMode.headOffset}
|