Skip to content

Commit 6efb753

Browse files
improve code
1 parent 731aec6 commit 6efb753

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+210
-206
lines changed

packages/react/src/components/DiffAddWidget.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1+
import { addWidgetBGName, addWidgetColorName, diffFontSizeName } from "@git-diff-view/utils";
12
import * as React from "react";
23

3-
import { addWidgetBGName, addWidgetColorName } from "./color";
4-
import { diffFontSizeName } from "./tools";
5-
64
import type { SplitSide } from "./DiffView";
75
import type { DiffFile } from "@git-diff-view/core";
86

packages/react/src/components/DiffContent.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { DiffLineType, NewLineSymbol, type DiffFile, type DiffLine, type SyntaxLine } from "@git-diff-view/core";
2+
import { memoFunc, addContentHighlightBGName, delContentHighlightBGName, diffFontSizeName } from "@git-diff-view/utils";
23
import * as React from "react";
34

4-
import { addContentHighlightBGName, delContentHighlightBGName } from "./color";
55
import { DiffNoNewLine } from "./DiffNoNewLine";
6-
import { diffFontSizeName, memoFunc } from "./tools";
76

87
const temp = {};
98

packages/react/src/components/DiffContent_v2.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ import {
66
type diffChanges,
77
type SyntaxLine,
88
} from "@git-diff-view/core";
9+
import { addContentHighlightBGName, delContentHighlightBGName, diffFontSizeName } from "@git-diff-view/utils";
910
import * as React from "react";
1011

11-
import { addContentHighlightBGName, delContentHighlightBGName } from "./color";
1212
import { getStyleObjectFromString, getSymbol } from "./DiffContent";
1313
import { DiffNoNewLine } from "./DiffNoNewLine";
14-
import { diffFontSizeName } from "./tools";
1514

1615
const RenderRange = ({
1716
str,

packages/react/src/components/DiffSplitContentLineNormal.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import { DiffLineType, type DiffFile, checkDiffLineIncludeChange } from "@git-diff-view/core";
2+
import {
3+
getContentBG,
4+
getLineNumberBG,
5+
plainLineNumberColorName,
6+
diffAsideWidthName,
7+
emptyBGName,
8+
} from "@git-diff-view/utils";
29
import * as React from "react";
310

411
import { useDiffViewContext, SplitSide } from "..";
512

6-
import { emptyBGName, getContentBG, getLineNumberBG, plainLineNumberColorName } from "./color";
713
import { DiffSplitAddWidget } from "./DiffAddWidget";
814
import { DiffContent } from "./DiffContent";
915
// import { DiffContent_v2 } from "./DiffContent_v2";
1016
import { useDiffWidgetContext } from "./DiffWidgetContext";
11-
import { diffAsideWidthName } from "./tools";
1217

1318
const _DiffSplitLine = ({
1419
index,

packages/react/src/components/DiffSplitContentLineWrap.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
import { DiffLineType, type DiffFile, checkDiffLineIncludeChange } from "@git-diff-view/core";
2+
import {
3+
getContentBG,
4+
getLineNumberBG,
5+
plainLineNumberColorName,
6+
emptyBGName,
7+
borderColorName,
8+
} from "@git-diff-view/utils";
29
import * as React from "react";
310

411
import { SplitSide, useDiffViewContext } from "..";
512

6-
import { borderColorName, emptyBGName, getContentBG, getLineNumberBG, plainLineNumberColorName } from "./color";
713
import { DiffSplitAddWidget } from "./DiffAddWidget";
814
import { DiffContent } from "./DiffContent";
915
// import { DiffContent_v2 } from "./DiffContent_v2";

packages/react/src/components/DiffSplitExtendLineNormal.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1+
import { emptyBGName } from "@git-diff-view/utils";
12
import * as React from "react";
23

34
import { useDiffViewContext, SplitSide } from "..";
45
import { useDomWidth } from "../hooks/useDomWidth";
56
import { useSyncHeight } from "../hooks/useSyncHeight";
67

7-
import { emptyBGName } from "./color";
8-
98
import type { DiffFile } from "@git-diff-view/core";
109

1110
const _DiffSplitExtendLine = ({

packages/react/src/components/DiffSplitExtendLineWrap.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
import { emptyBGName, borderColorName } from "@git-diff-view/utils";
12
import * as React from "react";
23

34
import { useDiffViewContext, SplitSide } from "..";
45

5-
import { borderColorName, emptyBGName } from "./color";
6-
76
import type { DiffFile } from "@git-diff-view/core";
87

98
const _DiffSplitExtendLine = ({

packages/react/src/components/DiffSplitHunkLineNormal.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
import { composeLen, type DiffFile } from "@git-diff-view/core";
2+
import {
3+
hunkLineNumberBGName,
4+
plainLineNumberColorName,
5+
diffAsideWidthName,
6+
hunkContentBGName,
7+
hunkContentColorName,
8+
} from "@git-diff-view/utils";
29
import * as React from "react";
310

411
import { DiffModeEnum, SplitSide, useDiffViewContext } from "..";
512
import { useSyncHeight } from "../hooks/useSyncHeight";
613

7-
import { hunkContentBGName, hunkContentColorName, hunkLineNumberBGName, plainLineNumberColorName } from "./color";
814
import { ExpandAll, ExpandDown, ExpandUp } from "./DiffExpand";
9-
import { diffAsideWidthName } from "./tools";
1015

1116
const _DiffSplitHunkLineGitHub = ({
1217
index,

packages/react/src/components/DiffSplitHunkLineWrap.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { composeLen, type DiffFile } from "@git-diff-view/core";
2+
import {
3+
hunkLineNumberBGName,
4+
plainLineNumberColorName,
5+
hunkContentBGName,
6+
hunkContentColorName,
7+
borderColorName,
8+
} from "@git-diff-view/utils";
29
import * as React from "react";
310

411
import { DiffModeEnum, useDiffViewContext } from "..";
512

6-
import {
7-
borderColorName,
8-
hunkContentBGName,
9-
hunkContentColorName,
10-
hunkLineNumberBGName,
11-
plainLineNumberColorName,
12-
} from "./color";
1313
import { ExpandAll, ExpandDown, ExpandUp } from "./DiffExpand";
1414

1515
const DiffSplitHunkLineGitHub = ({

packages/react/src/components/DiffSplitViewNormal.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
/* eslint-disable @typescript-eslint/ban-ts-comment */
22
import { getSplitContentLines, type DiffFile } from "@git-diff-view/core";
3+
import { removeAllSelection, syncScroll, diffFontSizeName, borderColorName, diffAsideWidthName } from "@git-diff-view/utils";
34
import { Fragment, memo, useEffect, useRef } from "react";
45
import * as React from "react";
56
import { useSyncExternalStore } from "use-sync-external-store/shim/index.js";
67

78
import { useDiffViewContext } from "..";
89
import { useTextWidth } from "../hooks/useTextWidth";
910

10-
import { borderColorName } from "./color";
1111
import { DiffSplitContentLine } from "./DiffSplitContentLineNormal";
1212
import { DiffSplitExtendLine } from "./DiffSplitExtendLineNormal";
1313
import { DiffSplitHunkLine } from "./DiffSplitHunkLineNormal";
1414
import { DiffSplitWidgetLine } from "./DiffSplitWidgetLineNormal";
1515
import { SplitSide } from "./DiffView";
16-
import { diffAsideWidthName, diffFontSizeName, removeAllSelection, syncScroll } from "./tools";
1716

1817
import type { MouseEventHandler } from "react";
1918

0 commit comments

Comments
 (0)