@yuhufe/wtool-vdiff 0.0.7 → 0.0.8
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/README.md +140 -41
- package/dist/DiffFiles/DiffFiles.vue.d.ts +12 -0
- package/dist/DiffFiles/DiffList/DiffList.vue.d.ts +94 -0
- package/dist/DiffFiles/FileExplore/FileExplore.vue.d.ts +510 -0
- package/dist/DiffFiles/FileExplore/FileSearch.vue.d.ts +11 -0
- package/dist/DiffFiles/FileExplore/fileTree.d.ts +17 -0
- package/dist/DiffFiles/createDiffFiles.d.ts +13 -0
- package/dist/DiffFiles/index.d.ts +3 -0
- package/dist/DiffFiles/types.d.ts +12 -0
- package/dist/DiffFiles/useDiffFiles.d.ts +23 -0
- package/dist/DiffViewer/DiffViewer.vue.d.ts +15 -4
- package/dist/DiffViewer/TopBar.vue.d.ts +2 -0
- package/dist/DiffViewer/const.d.ts +7 -0
- package/dist/DiffViewer/utils/autoHeight.d.ts +3 -1
- package/dist/DiffViewer/utils/patch2Pair.d.ts +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/types.d.ts +15 -5
- package/dist/wtool-vdiff.cjs.js +42 -39
- package/dist/wtool-vdiff.es.js +9306 -5945
- package/package.json +6 -7
- package/src/DiffFiles/DiffFiles.vue +97 -18
- package/src/DiffFiles/DiffList/DiffList.vue +125 -0
- package/src/DiffFiles/FileExplore/FileExplore.vue +165 -7
- package/src/DiffFiles/FileExplore/FileSearch.vue +81 -0
- package/src/DiffFiles/FileExplore/fileTree.ts +102 -0
- package/src/DiffFiles/createDiffFiles.ts +70 -0
- package/src/DiffFiles/index.ts +11 -0
- package/src/DiffFiles/types.ts +15 -0
- package/src/DiffFiles/useDiffFiles.ts +56 -0
- package/src/DiffViewer/DiffViewer.vue +22 -8
- package/src/DiffViewer/MonacoDiffViewer.vue +21 -2
- package/src/DiffViewer/TopBar.vue +23 -4
- package/src/DiffViewer/const.ts +10 -0
- package/src/DiffViewer/utils/autoHeight.ts +83 -29
- package/src/DiffViewer/utils/patch2Pair.ts +37 -9
- package/src/assets/file.svg +4 -0
- package/src/assets/folder.svg +4 -0
- package/src/index.ts +1 -0
- package/src/types.ts +17 -5
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/** 顶部工具栏的固定高度,单位:像素。 */
|
|
1
2
|
export declare const HEIGHT_TOP_BAR = 32;
|
|
3
|
+
/** Diff 编辑器中单行代码的默认高度,单位:像素。 */
|
|
4
|
+
export declare const HEIGHT_CODE_LINE = 18;
|
|
5
|
+
/** 未变更代码折叠区域占用的固定高度,单位:像素。 */
|
|
6
|
+
export declare const HEIGHT_HIDDEN_REGION = 24;
|
|
7
|
+
/** Diff 编辑器横向滚动条的默认高度,单位:像素。 */
|
|
8
|
+
export declare const HEIGHT_HORIZONTAL_SCROLLBAR = 8;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { WtoolDiffViewerProps } from '../../types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const height2Num: (heightStr: string) => number;
|
|
3
|
+
export declare const autoHeight: ({ id, patch, pair, maxHeight, minHeight, unchangedVisiable, unchangedCtxLineNum, unchangedMinLineNum, }: {
|
|
3
4
|
id: string;
|
|
4
5
|
patch?: string;
|
|
5
6
|
pair?: WtoolDiffViewerProps["diffPair"];
|
|
@@ -7,4 +8,5 @@ export declare const autoHeight: ({ id, patch, pair, maxHeight, minHeight, uncha
|
|
|
7
8
|
minHeight: string;
|
|
8
9
|
unchangedVisiable: boolean;
|
|
9
10
|
unchangedCtxLineNum: number;
|
|
11
|
+
unchangedMinLineNum?: number;
|
|
10
12
|
}) => number;
|
|
@@ -2,6 +2,15 @@ export interface FilePair {
|
|
|
2
2
|
filename: string;
|
|
3
3
|
content: string;
|
|
4
4
|
}
|
|
5
|
+
export interface PatchChangedLineBlock {
|
|
6
|
+
start: number;
|
|
7
|
+
end: number;
|
|
8
|
+
}
|
|
9
|
+
export interface PatchPairLayout {
|
|
10
|
+
pair: FilePair[];
|
|
11
|
+
changedLineBlocks: PatchChangedLineBlock[];
|
|
12
|
+
totalLines: number;
|
|
13
|
+
}
|
|
5
14
|
/**
|
|
6
15
|
* 将 unified diff patch 转换为 [original, modified] 文件对。
|
|
7
16
|
*
|
|
@@ -12,4 +21,5 @@ export interface FilePair {
|
|
|
12
21
|
* - 连续的删除('-')/ 新增('+')块:收集后成对对齐写入,
|
|
13
22
|
* 行数较少的一侧补空行,使 Monaco 能在同一视觉行渲染替换关系
|
|
14
23
|
*/
|
|
24
|
+
export declare const patch2PairWithLayout: (patch: string) => PatchPairLayout;
|
|
15
25
|
export declare const patch2Pair: (patch: string) => FilePair[];
|
package/dist/index.d.ts
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type * as Monaco from 'monaco-editor';
|
|
|
2
2
|
export type DiffEditorOptions = Monaco.editor.IStandaloneDiffEditorConstructionOptions;
|
|
3
3
|
export type ModelOptions = Monaco.editor.ITextModelUpdateOptions;
|
|
4
4
|
export interface WtoolDiffViewerProps {
|
|
5
|
+
fileId?: string;
|
|
5
6
|
diffPair?: {
|
|
6
7
|
filename: string;
|
|
7
8
|
content: string | null;
|
|
@@ -17,10 +18,19 @@ export interface WtoolDiffViewerStyle {
|
|
|
17
18
|
height?: string;
|
|
18
19
|
minHeight?: string;
|
|
19
20
|
maxHeight?: string;
|
|
21
|
+
viewed?: boolean;
|
|
22
|
+
rawed?: boolean;
|
|
20
23
|
}
|
|
21
|
-
export interface
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
export interface DiffFile {
|
|
25
|
+
fullPath?: string;
|
|
26
|
+
diffPair?: WtoolDiffViewerProps['diffPair'];
|
|
27
|
+
diffPatch?: string;
|
|
28
|
+
viewerStyle?: WtoolDiffViewerStyle;
|
|
29
|
+
}
|
|
30
|
+
/** @deprecated Use DiffFile. Nested directory input is no longer supported. */
|
|
31
|
+
export type FileTree = DiffFile;
|
|
32
|
+
export interface WtoolDiffFilesProps {
|
|
33
|
+
diffFiles?: DiffFile[];
|
|
34
|
+
fileOverScan?: number;
|
|
35
|
+
viewerStyle?: WtoolDiffViewerStyle;
|
|
26
36
|
}
|