kajji 0.1.0 → 0.1.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/bin/kajji +60 -0
- package/package.json +35 -55
- package/script/postinstall.mjs +50 -0
- package/LICENSE +0 -21
- package/README.md +0 -128
- package/bin/kajji.js +0 -2
- package/src/App.tsx +0 -229
- package/src/commander/bookmarks.ts +0 -129
- package/src/commander/diff.ts +0 -186
- package/src/commander/executor.ts +0 -285
- package/src/commander/files.ts +0 -87
- package/src/commander/log.ts +0 -99
- package/src/commander/operations.ts +0 -313
- package/src/commander/types.ts +0 -21
- package/src/components/AnsiText.tsx +0 -77
- package/src/components/BorderBox.tsx +0 -124
- package/src/components/FileTreeList.tsx +0 -105
- package/src/components/Layout.tsx +0 -48
- package/src/components/Panel.tsx +0 -143
- package/src/components/RevisionPicker.tsx +0 -165
- package/src/components/StatusBar.tsx +0 -158
- package/src/components/modals/BookmarkNameModal.tsx +0 -170
- package/src/components/modals/DescribeModal.tsx +0 -124
- package/src/components/modals/HelpModal.tsx +0 -372
- package/src/components/modals/RevisionPickerModal.tsx +0 -70
- package/src/components/modals/UndoModal.tsx +0 -75
- package/src/components/panels/BookmarksPanel.tsx +0 -768
- package/src/components/panels/CommandLogPanel.tsx +0 -40
- package/src/components/panels/LogPanel.tsx +0 -774
- package/src/components/panels/MainArea.tsx +0 -354
- package/src/context/command.tsx +0 -106
- package/src/context/commandlog.tsx +0 -45
- package/src/context/dialog.tsx +0 -217
- package/src/context/focus.tsx +0 -63
- package/src/context/helper.tsx +0 -24
- package/src/context/keybind.tsx +0 -51
- package/src/context/loading.tsx +0 -68
- package/src/context/sync.tsx +0 -868
- package/src/context/theme.tsx +0 -90
- package/src/context/types.ts +0 -51
- package/src/index.tsx +0 -15
- package/src/keybind/index.ts +0 -2
- package/src/keybind/parser.ts +0 -88
- package/src/keybind/types.ts +0 -83
- package/src/theme/index.ts +0 -3
- package/src/theme/presets/lazygit.ts +0 -45
- package/src/theme/presets/opencode.ts +0 -45
- package/src/theme/types.ts +0 -47
- package/src/utils/double-click.ts +0 -59
- package/src/utils/file-tree.ts +0 -154
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { useKeyboard } from "@opentui/solid"
|
|
2
|
-
import { createSignal } from "solid-js"
|
|
3
|
-
import type { Commit } from "../../commander/types"
|
|
4
|
-
import { useDialog } from "../../context/dialog"
|
|
5
|
-
import { useTheme } from "../../context/theme"
|
|
6
|
-
import { RevisionPicker } from "../RevisionPicker"
|
|
7
|
-
|
|
8
|
-
interface RevisionPickerModalProps {
|
|
9
|
-
title: string
|
|
10
|
-
commits: Commit[]
|
|
11
|
-
defaultRevision?: string
|
|
12
|
-
width?: number | "auto" | `${number}%`
|
|
13
|
-
height?: number
|
|
14
|
-
onSelect: (revision: string) => void
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function RevisionPickerModal(props: RevisionPickerModalProps) {
|
|
18
|
-
const dialog = useDialog()
|
|
19
|
-
const { colors, style } = useTheme()
|
|
20
|
-
|
|
21
|
-
const [selectedRevision, setSelectedRevision] = createSignal(
|
|
22
|
-
props.defaultRevision ?? props.commits[0]?.changeId ?? "",
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
const handleConfirm = () => {
|
|
26
|
-
const rev = selectedRevision()
|
|
27
|
-
if (!rev) return
|
|
28
|
-
dialog.close()
|
|
29
|
-
props.onSelect(rev)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
useKeyboard((evt) => {
|
|
33
|
-
if (evt.name === "escape") {
|
|
34
|
-
evt.preventDefault()
|
|
35
|
-
dialog.close()
|
|
36
|
-
} else if (evt.name === "return") {
|
|
37
|
-
evt.preventDefault()
|
|
38
|
-
handleConfirm()
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
const handleRevisionSelect = (commit: Commit) => {
|
|
43
|
-
setSelectedRevision(commit.changeId)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const pickerHeight = () => props.height ?? 12
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<box flexDirection="column" width={props.width ?? "60%"} gap={0}>
|
|
50
|
-
<box
|
|
51
|
-
flexDirection="column"
|
|
52
|
-
border
|
|
53
|
-
borderStyle={style().panel.borderStyle}
|
|
54
|
-
borderColor={colors().borderFocused}
|
|
55
|
-
backgroundColor={colors().background}
|
|
56
|
-
height={pickerHeight()}
|
|
57
|
-
padding={0}
|
|
58
|
-
title={props.title}
|
|
59
|
-
>
|
|
60
|
-
<RevisionPicker
|
|
61
|
-
commits={props.commits}
|
|
62
|
-
defaultRevision={props.defaultRevision}
|
|
63
|
-
focused={true}
|
|
64
|
-
onSelect={handleRevisionSelect}
|
|
65
|
-
height={pickerHeight() - 2}
|
|
66
|
-
/>
|
|
67
|
-
</box>
|
|
68
|
-
</box>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { useKeyboard } from "@opentui/solid"
|
|
2
|
-
import { Show, createResource } from "solid-js"
|
|
3
|
-
import { fetchOpLog } from "../../commander/operations"
|
|
4
|
-
import { useTheme } from "../../context/theme"
|
|
5
|
-
import { AnsiText } from "../AnsiText"
|
|
6
|
-
import { BorderBox } from "../BorderBox"
|
|
7
|
-
|
|
8
|
-
interface UndoModalProps {
|
|
9
|
-
type: "undo" | "redo" | "restore"
|
|
10
|
-
operationLines?: string[]
|
|
11
|
-
onConfirm: () => void
|
|
12
|
-
onCancel: () => void
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function UndoModal(props: UndoModalProps) {
|
|
16
|
-
const { colors, style } = useTheme()
|
|
17
|
-
|
|
18
|
-
const [fetchedDetails] = createResource(
|
|
19
|
-
() => !props.operationLines,
|
|
20
|
-
async () => {
|
|
21
|
-
const lines = await fetchOpLog(1)
|
|
22
|
-
return lines.join("\n")
|
|
23
|
-
},
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
const opDetails = () =>
|
|
27
|
-
props.operationLines?.join("\n") ?? fetchedDetails() ?? ""
|
|
28
|
-
|
|
29
|
-
useKeyboard((evt) => {
|
|
30
|
-
if (evt.name === "y" || evt.name === "return") {
|
|
31
|
-
evt.preventDefault()
|
|
32
|
-
props.onConfirm()
|
|
33
|
-
} else if (evt.name === "n" || evt.name === "escape") {
|
|
34
|
-
evt.preventDefault()
|
|
35
|
-
props.onCancel()
|
|
36
|
-
}
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
const title = () => {
|
|
40
|
-
if (props.type === "restore") return "Restore to this operation?"
|
|
41
|
-
return props.type === "undo"
|
|
42
|
-
? "Undo last operation?"
|
|
43
|
-
: "Redo last operation?"
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const hints = () => (
|
|
47
|
-
<text>
|
|
48
|
-
<span style={{ fg: colors().primary }}>y</span>
|
|
49
|
-
<span style={{ fg: colors().textMuted }}> confirm </span>
|
|
50
|
-
<span style={{ fg: colors().primary }}>n</span>
|
|
51
|
-
<span style={{ fg: colors().textMuted }}> cancel</span>
|
|
52
|
-
</text>
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<BorderBox
|
|
57
|
-
border
|
|
58
|
-
borderStyle={style().panel.borderStyle}
|
|
59
|
-
borderColor={colors().borderFocused}
|
|
60
|
-
backgroundColor={colors().background}
|
|
61
|
-
width="60%"
|
|
62
|
-
topLeft={<text fg={colors().text}>{title()}</text>}
|
|
63
|
-
bottomRight={hints()}
|
|
64
|
-
paddingLeft={1}
|
|
65
|
-
paddingRight={1}
|
|
66
|
-
>
|
|
67
|
-
<Show when={fetchedDetails.loading && !props.operationLines}>
|
|
68
|
-
<text fg={colors().textMuted}>Loading...</text>
|
|
69
|
-
</Show>
|
|
70
|
-
<Show when={!fetchedDetails.loading || props.operationLines}>
|
|
71
|
-
<AnsiText content={opDetails()} wrapMode="none" />
|
|
72
|
-
</Show>
|
|
73
|
-
</BorderBox>
|
|
74
|
-
)
|
|
75
|
-
}
|