mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-21 15:55:50 +00:00
更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121)
* style(B1-1): 格式化 ink/buddy/cli/context/screens/tasks/services/keybindings/state (43 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 修复了 Box.tsx 和 ScrollBox.tsx 中无效的 global.d.ts import。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-2): 格式化 commands (79 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-3): 格式化 components/messages,permissions,mcp,sandbox,shell (104 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-4): 格式化 components/PromptInput,FeedbackSurvey,tasks,agents,skills,design-system,wizard (73 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-5): 格式化 components其余 + hooks + tools (232 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-6): 格式化 main/entrypoints/utils/moreright (21 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: 更新 README,新增 Run.ps1/TODO.md,删除 V6.md - README.md: 大幅重写,更详细版本历史和配置示例 - Run.ps1: 新增 Windows 启动脚本 - TODO.md: 新增包完成清单 - V6.md: 删除(架构重构规划已不适用) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: 修复以前的问题 * fix: 修复 login 面板的问题 --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,165 +1,77 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import { basename } from 'path';
|
||||
import React from 'react';
|
||||
import type { z } from 'zod/v4';
|
||||
import { Text } from '../../../ink.js';
|
||||
import { NotebookEditTool } from '../../../tools/NotebookEditTool/NotebookEditTool.js';
|
||||
import { logError } from '../../../utils/log.js';
|
||||
import { FilePermissionDialog } from '../FilePermissionDialog/FilePermissionDialog.js';
|
||||
import type { PermissionRequestProps } from '../PermissionRequest.js';
|
||||
import { NotebookEditToolDiff } from './NotebookEditToolDiff.js';
|
||||
type NotebookEditInput = z.infer<typeof NotebookEditTool.inputSchema>;
|
||||
export function NotebookEditPermissionRequest(props) {
|
||||
const $ = _c(52);
|
||||
const parseInput = _temp;
|
||||
let T0;
|
||||
let T1;
|
||||
let T2;
|
||||
let language;
|
||||
let notebook_path;
|
||||
let parsed;
|
||||
let t0;
|
||||
let t1;
|
||||
let t10;
|
||||
let t2;
|
||||
let t3;
|
||||
let t4;
|
||||
let t5;
|
||||
let t6;
|
||||
let t7;
|
||||
let t8;
|
||||
let t9;
|
||||
if ($[0] !== props.onDone || $[1] !== props.onReject || $[2] !== props.toolUseConfirm || $[3] !== props.toolUseContext || $[4] !== props.workerBadge) {
|
||||
parsed = parseInput(props.toolUseConfirm.input);
|
||||
const {
|
||||
notebook_path: t11,
|
||||
edit_mode,
|
||||
cell_type
|
||||
} = parsed;
|
||||
notebook_path = t11;
|
||||
language = cell_type === "markdown" ? "markdown" : "python";
|
||||
const editTypeText = edit_mode === "insert" ? "insert this cell into" : edit_mode === "delete" ? "delete this cell from" : "make this edit to";
|
||||
T2 = FilePermissionDialog;
|
||||
t5 = props.toolUseConfirm;
|
||||
t6 = props.toolUseContext;
|
||||
t7 = props.onDone;
|
||||
t8 = props.onReject;
|
||||
t9 = props.workerBadge;
|
||||
t10 = "Edit notebook";
|
||||
T1 = Text;
|
||||
t2 = "Do you want to ";
|
||||
t3 = editTypeText;
|
||||
t4 = " ";
|
||||
T0 = Text;
|
||||
t0 = true;
|
||||
t1 = basename(notebook_path);
|
||||
$[0] = props.onDone;
|
||||
$[1] = props.onReject;
|
||||
$[2] = props.toolUseConfirm;
|
||||
$[3] = props.toolUseContext;
|
||||
$[4] = props.workerBadge;
|
||||
$[5] = T0;
|
||||
$[6] = T1;
|
||||
$[7] = T2;
|
||||
$[8] = language;
|
||||
$[9] = notebook_path;
|
||||
$[10] = parsed;
|
||||
$[11] = t0;
|
||||
$[12] = t1;
|
||||
$[13] = t10;
|
||||
$[14] = t2;
|
||||
$[15] = t3;
|
||||
$[16] = t4;
|
||||
$[17] = t5;
|
||||
$[18] = t6;
|
||||
$[19] = t7;
|
||||
$[20] = t8;
|
||||
$[21] = t9;
|
||||
} else {
|
||||
T0 = $[5];
|
||||
T1 = $[6];
|
||||
T2 = $[7];
|
||||
language = $[8];
|
||||
notebook_path = $[9];
|
||||
parsed = $[10];
|
||||
t0 = $[11];
|
||||
t1 = $[12];
|
||||
t10 = $[13];
|
||||
t2 = $[14];
|
||||
t3 = $[15];
|
||||
t4 = $[16];
|
||||
t5 = $[17];
|
||||
t6 = $[18];
|
||||
t7 = $[19];
|
||||
t8 = $[20];
|
||||
t9 = $[21];
|
||||
import { basename } from 'path'
|
||||
import React from 'react'
|
||||
import type { z } from 'zod/v4'
|
||||
import { Text } from '../../../ink.js'
|
||||
import { NotebookEditTool } from '../../../tools/NotebookEditTool/NotebookEditTool.js'
|
||||
import { logError } from '../../../utils/log.js'
|
||||
import { FilePermissionDialog } from '../FilePermissionDialog/FilePermissionDialog.js'
|
||||
import type { PermissionRequestProps } from '../PermissionRequest.js'
|
||||
import { NotebookEditToolDiff } from './NotebookEditToolDiff.js'
|
||||
|
||||
type NotebookEditInput = z.infer<typeof NotebookEditTool.inputSchema>
|
||||
|
||||
export function NotebookEditPermissionRequest(
|
||||
props: PermissionRequestProps,
|
||||
): React.ReactNode {
|
||||
const parseInput = (input: unknown): NotebookEditInput => {
|
||||
const result = NotebookEditTool.inputSchema.safeParse(input)
|
||||
if (!result.success) {
|
||||
logError(
|
||||
new Error(
|
||||
`Failed to parse notebook edit input: ${result.error.message}`,
|
||||
),
|
||||
)
|
||||
// Return a default value to avoid crashing
|
||||
return {
|
||||
notebook_path: '',
|
||||
new_source: '',
|
||||
cell_id: '',
|
||||
} as NotebookEditInput
|
||||
}
|
||||
return result.data
|
||||
}
|
||||
let t11;
|
||||
if ($[22] !== T0 || $[23] !== t0 || $[24] !== t1) {
|
||||
t11 = <T0 bold={t0}>{t1}</T0>;
|
||||
$[22] = T0;
|
||||
$[23] = t0;
|
||||
$[24] = t1;
|
||||
$[25] = t11;
|
||||
} else {
|
||||
t11 = $[25];
|
||||
}
|
||||
let t12;
|
||||
if ($[26] !== T1 || $[27] !== t11 || $[28] !== t2 || $[29] !== t3 || $[30] !== t4) {
|
||||
t12 = <T1>{t2}{t3}{t4}{t11}?</T1>;
|
||||
$[26] = T1;
|
||||
$[27] = t11;
|
||||
$[28] = t2;
|
||||
$[29] = t3;
|
||||
$[30] = t4;
|
||||
$[31] = t12;
|
||||
} else {
|
||||
t12 = $[31];
|
||||
}
|
||||
const t13 = props.verbose ? 120 : 80;
|
||||
let t14;
|
||||
if ($[32] !== parsed.cell_id || $[33] !== parsed.cell_type || $[34] !== parsed.edit_mode || $[35] !== parsed.new_source || $[36] !== parsed.notebook_path || $[37] !== props.verbose || $[38] !== t13) {
|
||||
t14 = <NotebookEditToolDiff notebook_path={parsed.notebook_path} cell_id={parsed.cell_id} new_source={parsed.new_source} cell_type={parsed.cell_type} edit_mode={parsed.edit_mode} verbose={props.verbose} width={t13} />;
|
||||
$[32] = parsed.cell_id;
|
||||
$[33] = parsed.cell_type;
|
||||
$[34] = parsed.edit_mode;
|
||||
$[35] = parsed.new_source;
|
||||
$[36] = parsed.notebook_path;
|
||||
$[37] = props.verbose;
|
||||
$[38] = t13;
|
||||
$[39] = t14;
|
||||
} else {
|
||||
t14 = $[39];
|
||||
}
|
||||
let t15;
|
||||
if ($[40] !== T2 || $[41] !== language || $[42] !== notebook_path || $[43] !== t10 || $[44] !== t12 || $[45] !== t14 || $[46] !== t5 || $[47] !== t6 || $[48] !== t7 || $[49] !== t8 || $[50] !== t9) {
|
||||
t15 = <T2 toolUseConfirm={t5} toolUseContext={t6} onDone={t7} onReject={t8} workerBadge={t9} title={t10} question={t12} content={t14} path={notebook_path} completionType="tool_use_single" languageName={language} parseInput={parseInput} />;
|
||||
$[40] = T2;
|
||||
$[41] = language;
|
||||
$[42] = notebook_path;
|
||||
$[43] = t10;
|
||||
$[44] = t12;
|
||||
$[45] = t14;
|
||||
$[46] = t5;
|
||||
$[47] = t6;
|
||||
$[48] = t7;
|
||||
$[49] = t8;
|
||||
$[50] = t9;
|
||||
$[51] = t15;
|
||||
} else {
|
||||
t15 = $[51];
|
||||
}
|
||||
return t15;
|
||||
}
|
||||
function _temp(input) {
|
||||
const result = NotebookEditTool.inputSchema.safeParse(input);
|
||||
if (!result.success) {
|
||||
logError(new Error(`Failed to parse notebook edit input: ${result.error.message}`));
|
||||
return {
|
||||
notebook_path: "",
|
||||
new_source: "",
|
||||
cell_id: ""
|
||||
} as NotebookEditInput;
|
||||
}
|
||||
return result.data;
|
||||
|
||||
const parsed = parseInput(props.toolUseConfirm.input)
|
||||
const { notebook_path, edit_mode, cell_type } = parsed
|
||||
|
||||
const language = cell_type === 'markdown' ? 'markdown' : 'python'
|
||||
|
||||
const editTypeText =
|
||||
edit_mode === 'insert'
|
||||
? 'insert this cell into'
|
||||
: edit_mode === 'delete'
|
||||
? 'delete this cell from'
|
||||
: 'make this edit to'
|
||||
|
||||
return (
|
||||
<FilePermissionDialog
|
||||
toolUseConfirm={props.toolUseConfirm}
|
||||
toolUseContext={props.toolUseContext}
|
||||
onDone={props.onDone}
|
||||
onReject={props.onReject}
|
||||
workerBadge={props.workerBadge}
|
||||
title="Edit notebook"
|
||||
question={
|
||||
<Text>
|
||||
Do you want to {editTypeText}{' '}
|
||||
<Text bold>{basename(notebook_path)}</Text>?
|
||||
</Text>
|
||||
}
|
||||
content={
|
||||
<NotebookEditToolDiff
|
||||
notebook_path={parsed.notebook_path}
|
||||
cell_id={parsed.cell_id}
|
||||
new_source={parsed.new_source}
|
||||
cell_type={parsed.cell_type}
|
||||
edit_mode={parsed.edit_mode}
|
||||
verbose={props.verbose}
|
||||
width={props.verbose ? 120 : 80}
|
||||
/>
|
||||
}
|
||||
path={notebook_path}
|
||||
completionType="tool_use_single"
|
||||
languageName={language}
|
||||
parseInput={parseInput}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,234 +1,172 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import { relative } from 'path';
|
||||
import * as React from 'react';
|
||||
import { Suspense, use, useMemo } from 'react';
|
||||
import { Box, NoSelect, Text } from '../../../ink.js';
|
||||
import type { NotebookCellType, NotebookContent } from '../../../types/notebook.js';
|
||||
import { intersperse } from '../../../utils/array.js';
|
||||
import { getCwd } from '../../../utils/cwd.js';
|
||||
import { getPatchForDisplay } from '../../../utils/diff.js';
|
||||
import { getFsImplementation } from '../../../utils/fsOperations.js';
|
||||
import { safeParseJSON } from '../../../utils/json.js';
|
||||
import { parseCellId } from '../../../utils/notebook.js';
|
||||
import { HighlightedCode } from '../../HighlightedCode.js';
|
||||
import { StructuredDiff } from '../../StructuredDiff.js';
|
||||
import { relative } from 'path'
|
||||
import * as React from 'react'
|
||||
import { Suspense, use, useMemo } from 'react'
|
||||
import { Box, NoSelect, Text } from '../../../ink.js'
|
||||
import type {
|
||||
NotebookCellType,
|
||||
NotebookContent,
|
||||
} from '../../../types/notebook.js'
|
||||
import { intersperse } from '../../../utils/array.js'
|
||||
import { getCwd } from '../../../utils/cwd.js'
|
||||
import { getPatchForDisplay } from '../../../utils/diff.js'
|
||||
import { getFsImplementation } from '../../../utils/fsOperations.js'
|
||||
import { safeParseJSON } from '../../../utils/json.js'
|
||||
import { parseCellId } from '../../../utils/notebook.js'
|
||||
import { HighlightedCode } from '../../HighlightedCode.js'
|
||||
import { StructuredDiff } from '../../StructuredDiff.js'
|
||||
|
||||
type Props = {
|
||||
notebook_path: string;
|
||||
cell_id: string | undefined;
|
||||
new_source: string;
|
||||
cell_type?: NotebookCellType;
|
||||
edit_mode?: string;
|
||||
verbose: boolean;
|
||||
width: number;
|
||||
};
|
||||
notebook_path: string
|
||||
cell_id: string | undefined
|
||||
new_source: string
|
||||
cell_type?: NotebookCellType
|
||||
edit_mode?: string
|
||||
verbose: boolean
|
||||
width: number
|
||||
}
|
||||
|
||||
type InnerProps = {
|
||||
notebook_path: string;
|
||||
cell_id: string | undefined;
|
||||
new_source: string;
|
||||
cell_type?: NotebookCellType;
|
||||
edit_mode?: string;
|
||||
verbose: boolean;
|
||||
width: number;
|
||||
promise: Promise<NotebookContent | null>;
|
||||
};
|
||||
export function NotebookEditToolDiff(props: Props) {
|
||||
const $ = _c(5);
|
||||
let t0;
|
||||
if ($[0] !== props.notebook_path) {
|
||||
t0 = getFsImplementation().readFile(props.notebook_path, {
|
||||
encoding: "utf-8"
|
||||
}).then(_temp).catch(_temp2);
|
||||
$[0] = props.notebook_path;
|
||||
$[1] = t0;
|
||||
} else {
|
||||
t0 = $[1];
|
||||
}
|
||||
const notebookDataPromise = t0;
|
||||
let t1;
|
||||
if ($[2] !== notebookDataPromise || $[3] !== props) {
|
||||
t1 = <Suspense fallback={null}><NotebookEditToolDiffInner {...props} promise={notebookDataPromise} /></Suspense>;
|
||||
$[2] = notebookDataPromise;
|
||||
$[3] = props;
|
||||
$[4] = t1;
|
||||
} else {
|
||||
t1 = $[4];
|
||||
}
|
||||
return t1;
|
||||
notebook_path: string
|
||||
cell_id: string | undefined
|
||||
new_source: string
|
||||
cell_type?: NotebookCellType
|
||||
edit_mode?: string
|
||||
verbose: boolean
|
||||
width: number
|
||||
promise: Promise<NotebookContent | null>
|
||||
}
|
||||
function _temp2() {
|
||||
return null;
|
||||
|
||||
export function NotebookEditToolDiff(props: Props): React.ReactNode {
|
||||
// Create a promise that never rejects so we can handle errors inline.
|
||||
// Memoized on notebook_path so we don't re-read on every render.
|
||||
const notebookDataPromise = useMemo(
|
||||
() =>
|
||||
getFsImplementation()
|
||||
.readFile(props.notebook_path, { encoding: 'utf-8' })
|
||||
.then(content => safeParseJSON(content) as NotebookContent | null)
|
||||
.catch(() => null),
|
||||
[props.notebook_path],
|
||||
)
|
||||
|
||||
return (
|
||||
<Suspense fallback={null}>
|
||||
<NotebookEditToolDiffInner {...props} promise={notebookDataPromise} />
|
||||
</Suspense>
|
||||
)
|
||||
}
|
||||
function _temp(content) {
|
||||
return safeParseJSON(content) as NotebookContent | null;
|
||||
}
|
||||
function NotebookEditToolDiffInner(t0: InnerProps) {
|
||||
const $ = _c(34);
|
||||
const {
|
||||
notebook_path,
|
||||
cell_id,
|
||||
new_source,
|
||||
cell_type,
|
||||
edit_mode: t1,
|
||||
verbose,
|
||||
width,
|
||||
promise
|
||||
} = t0;
|
||||
const edit_mode = t1 === undefined ? "replace" : t1;
|
||||
const notebookData = use(promise);
|
||||
let t2;
|
||||
if ($[0] !== cell_id || $[1] !== notebookData) {
|
||||
bb0: {
|
||||
if (!notebookData || !cell_id) {
|
||||
t2 = "";
|
||||
break bb0;
|
||||
}
|
||||
const cellIndex = parseCellId(cell_id);
|
||||
if (cellIndex !== undefined) {
|
||||
if (notebookData.cells[cellIndex]) {
|
||||
const source = notebookData.cells[cellIndex].source;
|
||||
let t3;
|
||||
if ($[3] !== source) {
|
||||
t3 = Array.isArray(source) ? source.join("") : source;
|
||||
$[3] = source;
|
||||
$[4] = t3;
|
||||
} else {
|
||||
t3 = $[4];
|
||||
}
|
||||
t2 = t3;
|
||||
break bb0;
|
||||
}
|
||||
t2 = "";
|
||||
break bb0;
|
||||
}
|
||||
let t3;
|
||||
if ($[5] !== cell_id) {
|
||||
t3 = cell => cell.id === cell_id;
|
||||
$[5] = cell_id;
|
||||
$[6] = t3;
|
||||
} else {
|
||||
t3 = $[6];
|
||||
}
|
||||
const cell_0 = notebookData.cells.find(t3);
|
||||
if (!cell_0) {
|
||||
t2 = "";
|
||||
break bb0;
|
||||
}
|
||||
t2 = Array.isArray(cell_0.source) ? cell_0.source.join("") : cell_0.source;
|
||||
|
||||
function NotebookEditToolDiffInner({
|
||||
notebook_path,
|
||||
cell_id,
|
||||
new_source,
|
||||
cell_type,
|
||||
edit_mode = 'replace',
|
||||
verbose,
|
||||
width,
|
||||
promise,
|
||||
}: InnerProps): React.ReactNode {
|
||||
const notebookData = use(promise)
|
||||
|
||||
const oldSource = useMemo(() => {
|
||||
if (!notebookData || !cell_id) {
|
||||
return ''
|
||||
}
|
||||
$[0] = cell_id;
|
||||
$[1] = notebookData;
|
||||
$[2] = t2;
|
||||
} else {
|
||||
t2 = $[2];
|
||||
}
|
||||
const oldSource = t2;
|
||||
let t3;
|
||||
bb1: {
|
||||
if (!notebookData || edit_mode === "insert" || edit_mode === "delete") {
|
||||
t3 = null;
|
||||
break bb1;
|
||||
const cellIndex = parseCellId(cell_id)
|
||||
if (cellIndex !== undefined) {
|
||||
if (notebookData.cells[cellIndex]) {
|
||||
const source = notebookData.cells[cellIndex].source
|
||||
return Array.isArray(source) ? source.join('') : source
|
||||
}
|
||||
return ''
|
||||
}
|
||||
let t4;
|
||||
if ($[7] !== new_source || $[8] !== notebook_path || $[9] !== oldSource) {
|
||||
t4 = getPatchForDisplay({
|
||||
filePath: notebook_path,
|
||||
fileContents: oldSource,
|
||||
edits: [{
|
||||
const cell = notebookData.cells.find(cell => cell.id === cell_id)
|
||||
if (!cell) {
|
||||
return ''
|
||||
}
|
||||
return Array.isArray(cell.source) ? cell.source.join('') : cell.source
|
||||
}, [notebookData, cell_id])
|
||||
|
||||
const hunks = useMemo(() => {
|
||||
if (!notebookData || edit_mode === 'insert' || edit_mode === 'delete') {
|
||||
return null
|
||||
}
|
||||
// Create a "fake" file content with just the cell source
|
||||
// This allows us to use the regular diff mechanism
|
||||
return getPatchForDisplay({
|
||||
filePath: notebook_path,
|
||||
fileContents: oldSource,
|
||||
edits: [
|
||||
{
|
||||
old_string: oldSource,
|
||||
new_string: new_source,
|
||||
replace_all: false
|
||||
}],
|
||||
ignoreWhitespace: false
|
||||
});
|
||||
$[7] = new_source;
|
||||
$[8] = notebook_path;
|
||||
$[9] = oldSource;
|
||||
$[10] = t4;
|
||||
} else {
|
||||
t4 = $[10];
|
||||
}
|
||||
t3 = t4;
|
||||
}
|
||||
const hunks = t3;
|
||||
let editTypeDescription;
|
||||
bb2: switch (edit_mode) {
|
||||
case "insert":
|
||||
{
|
||||
editTypeDescription = "Insert new cell";
|
||||
break bb2;
|
||||
}
|
||||
case "delete":
|
||||
{
|
||||
editTypeDescription = "Delete cell";
|
||||
break bb2;
|
||||
}
|
||||
replace_all: false,
|
||||
},
|
||||
],
|
||||
ignoreWhitespace: false,
|
||||
})
|
||||
}, [notebookData, notebook_path, oldSource, new_source, edit_mode])
|
||||
|
||||
let editTypeDescription: string
|
||||
switch (edit_mode) {
|
||||
case 'insert':
|
||||
editTypeDescription = 'Insert new cell'
|
||||
break
|
||||
case 'delete':
|
||||
editTypeDescription = 'Delete cell'
|
||||
break
|
||||
default:
|
||||
{
|
||||
editTypeDescription = "Replace cell contents";
|
||||
}
|
||||
editTypeDescription = 'Replace cell contents'
|
||||
}
|
||||
let t4;
|
||||
if ($[11] !== notebook_path || $[12] !== verbose) {
|
||||
t4 = verbose ? notebook_path : relative(getCwd(), notebook_path);
|
||||
$[11] = notebook_path;
|
||||
$[12] = verbose;
|
||||
$[13] = t4;
|
||||
} else {
|
||||
t4 = $[13];
|
||||
}
|
||||
let t5;
|
||||
if ($[14] !== t4) {
|
||||
t5 = <Text bold={true}>{t4}</Text>;
|
||||
$[14] = t4;
|
||||
$[15] = t5;
|
||||
} else {
|
||||
t5 = $[15];
|
||||
}
|
||||
const t6 = cell_type ? ` (${cell_type})` : "";
|
||||
let t7;
|
||||
if ($[16] !== cell_id || $[17] !== editTypeDescription || $[18] !== t6) {
|
||||
t7 = <Text dimColor={true}>{editTypeDescription} for cell {cell_id}{t6}</Text>;
|
||||
$[16] = cell_id;
|
||||
$[17] = editTypeDescription;
|
||||
$[18] = t6;
|
||||
$[19] = t7;
|
||||
} else {
|
||||
t7 = $[19];
|
||||
}
|
||||
let t8;
|
||||
if ($[20] !== t5 || $[21] !== t7) {
|
||||
t8 = <Box paddingBottom={1} flexDirection="column">{t5}{t7}</Box>;
|
||||
$[20] = t5;
|
||||
$[21] = t7;
|
||||
$[22] = t8;
|
||||
} else {
|
||||
t8 = $[22];
|
||||
}
|
||||
let t9;
|
||||
if ($[23] !== cell_type || $[24] !== edit_mode || $[25] !== hunks || $[26] !== new_source || $[27] !== notebook_path || $[28] !== oldSource || $[29] !== width) {
|
||||
t9 = edit_mode === "delete" ? <Box flexDirection="column" paddingLeft={2}><HighlightedCode code={oldSource} filePath={notebook_path} /></Box> : edit_mode === "insert" ? <Box flexDirection="column" paddingLeft={2}><HighlightedCode code={new_source} filePath={cell_type === "markdown" ? "file.md" : notebook_path} /></Box> : hunks ? intersperse(hunks.map(_ => <StructuredDiff key={_.newStart} patch={_} dim={false} width={width} filePath={notebook_path} firstLine={new_source.split("\n")[0] ?? null} fileContent={oldSource} />), _temp3) : <HighlightedCode code={new_source} filePath={cell_type === "markdown" ? "file.md" : notebook_path} />;
|
||||
$[23] = cell_type;
|
||||
$[24] = edit_mode;
|
||||
$[25] = hunks;
|
||||
$[26] = new_source;
|
||||
$[27] = notebook_path;
|
||||
$[28] = oldSource;
|
||||
$[29] = width;
|
||||
$[30] = t9;
|
||||
} else {
|
||||
t9 = $[30];
|
||||
}
|
||||
let t10;
|
||||
if ($[31] !== t8 || $[32] !== t9) {
|
||||
t10 = <Box flexDirection="column"><Box borderStyle="round" flexDirection="column" paddingX={1}>{t8}{t9}</Box></Box>;
|
||||
$[31] = t8;
|
||||
$[32] = t9;
|
||||
$[33] = t10;
|
||||
} else {
|
||||
t10 = $[33];
|
||||
}
|
||||
return t10;
|
||||
}
|
||||
function _temp3(i) {
|
||||
return <NoSelect fromLeftEdge={true} key={`ellipsis-${i}`}><Text dimColor={true}>...</Text></NoSelect>;
|
||||
|
||||
return (
|
||||
<Box flexDirection="column">
|
||||
<Box borderStyle="round" flexDirection="column" paddingX={1}>
|
||||
<Box paddingBottom={1} flexDirection="column">
|
||||
<Text bold>
|
||||
{verbose ? notebook_path : relative(getCwd(), notebook_path)}
|
||||
</Text>
|
||||
<Text dimColor>
|
||||
{editTypeDescription} for cell {cell_id}
|
||||
{cell_type ? ` (${cell_type})` : ''}
|
||||
</Text>
|
||||
</Box>
|
||||
{edit_mode === 'delete' ? (
|
||||
<Box flexDirection="column" paddingLeft={2}>
|
||||
<HighlightedCode code={oldSource} filePath={notebook_path} />
|
||||
</Box>
|
||||
) : edit_mode === 'insert' ? (
|
||||
<Box flexDirection="column" paddingLeft={2}>
|
||||
<HighlightedCode
|
||||
code={new_source}
|
||||
filePath={cell_type === 'markdown' ? 'file.md' : notebook_path}
|
||||
/>
|
||||
</Box>
|
||||
) : hunks ? (
|
||||
intersperse(
|
||||
hunks.map(_ => (
|
||||
<StructuredDiff
|
||||
key={_.newStart}
|
||||
patch={_}
|
||||
dim={false}
|
||||
width={width}
|
||||
filePath={notebook_path}
|
||||
firstLine={new_source.split('\n')[0] ?? null}
|
||||
fileContent={oldSource}
|
||||
/>
|
||||
)),
|
||||
i => (
|
||||
<NoSelect fromLeftEdge key={`ellipsis-${i}`}>
|
||||
<Text dimColor>...</Text>
|
||||
</NoSelect>
|
||||
),
|
||||
)
|
||||
) : (
|
||||
<HighlightedCode
|
||||
code={new_source}
|
||||
filePath={cell_type === 'markdown' ? 'file.md' : notebook_path}
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user