@yuhufe/wtool-vdiff 0.0.6 → 0.0.7

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.
@@ -1,7 +1,7 @@
1
1
  import { DiffEditorOptions, WtoolDiffViewerProps, ModelOptions } from '../types';
2
2
  declare const _default: import('../../node_modules/vue/dist/vue.esm-bundler.js').DefineComponent<WtoolDiffViewerProps, {}, {}, {}, {}, import('../../node_modules/vue/dist/vue.esm-bundler.js').ComponentOptionsMixin, import('../../node_modules/vue/dist/vue.esm-bundler.js').ComponentOptionsMixin, {}, string, import('../../node_modules/vue/dist/vue.esm-bundler.js').PublicProps, Readonly<WtoolDiffViewerProps> & Readonly<{}>, {
3
- language: string;
4
3
  options: DiffEditorOptions;
4
+ language: string;
5
5
  modelOptions: ModelOptions;
6
6
  diffPair: {
7
7
  filename: string;
@@ -13,10 +13,10 @@ declare const _default: import('../../node_modules/vue/dist/vue.esm-bundler.js')
13
13
  }, string, import('../../node_modules/vue/dist/vue.esm-bundler.js').PublicProps, Readonly<__VLS_Props> & Readonly<{
14
14
  onRenderComplete?: (() => any) | undefined;
15
15
  }>, {
16
+ options: DiffEditorOptions;
16
17
  originalCode: string;
17
18
  modifiedCode: string;
18
19
  language: string;
19
- options: DiffEditorOptions;
20
20
  modelOptions: ModelOptions;
21
21
  }, {}, {}, {}, string, import('../../node_modules/vue/dist/vue.esm-bundler.js').ComponentProvideOptions, false, {
22
22
  containerEl: HTMLDivElement;
@@ -0,0 +1 @@
1
+ export declare const HEIGHT_TOP_BAR = 32;
@@ -1,5 +1,6 @@
1
1
  import { WtoolDiffViewerProps } from '../../types';
2
- export declare const autoHeight: ({ patch, pair, maxHeight, minHeight, unchangedVisiable, unchangedCtxLineNum, }: {
2
+ export declare const autoHeight: ({ id, patch, pair, maxHeight, minHeight, unchangedVisiable, unchangedCtxLineNum, }: {
3
+ id: string;
3
4
  patch?: string;
4
5
  pair?: WtoolDiffViewerProps["diffPair"];
5
6
  maxHeight: string;
@@ -2,21 +2,6 @@ export interface FilePair {
2
2
  filename: string;
3
3
  content: string;
4
4
  }
5
- export interface Hunk {
6
- origStart: number;
7
- origCount: number;
8
- modStart: number;
9
- modCount: number;
10
- lines: string[];
11
- }
12
- /**
13
- * 解析 unified diff patch,提取文件名与所有 hunk
14
- */
15
- export declare function parseHunks(patch: string): {
16
- origFilename: string;
17
- modFilename: string;
18
- hunks: Hunk[];
19
- };
20
5
  /**
21
6
  * 将 unified diff patch 转换为 [original, modified] 文件对。
22
7
  *
package/dist/types.d.ts CHANGED
@@ -18,3 +18,9 @@ export interface WtoolDiffViewerStyle {
18
18
  minHeight?: string;
19
19
  maxHeight?: string;
20
20
  }
21
+ export interface FileTree {
22
+ isDir?: boolean;
23
+ name: string;
24
+ type?: string;
25
+ children?: FileTree[];
26
+ }
@@ -0,0 +1,20 @@
1
+ export interface Hunk {
2
+ origStart: number;
3
+ origCount: number;
4
+ modStart: number;
5
+ modCount: number;
6
+ lines: string[];
7
+ }
8
+ export interface PatchFilenames {
9
+ origFilename: string;
10
+ modFilename: string;
11
+ }
12
+ /**
13
+ * 从 unified diff patch 解析 --- / +++ 行中的文件名。
14
+ * 文件名位于 patch 头部,遇到首个 @@ hunk 或已解析到两侧文件名后即停止扫描。
15
+ */
16
+ export declare function parsePatchFilenames(patch: string): PatchFilenames;
17
+ /**
18
+ * 从 unified diff patch 解析所有 hunk(@@ 块)
19
+ */
20
+ export declare function parsePatchHunks(patch: string): Hunk[];