@yuhufe/wtool-vdiff 0.0.1 → 0.0.3

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.
@@ -5,7 +5,7 @@ declare const _default: import('../../node_modules/vue/dist/vue.esm-bundler.js')
5
5
  modelOptions: ModelOptions;
6
6
  diffPair: {
7
7
  filename: string;
8
- content: string;
8
+ content: string | null;
9
9
  }[];
10
10
  diffPatch: string;
11
11
  }, {}, {}, {}, string, import('../../node_modules/vue/dist/vue.esm-bundler.js').ComponentProvideOptions, false, {}, HTMLDivElement>;
@@ -1,13 +1,13 @@
1
1
  type __VLS_Props = {
2
2
  diffPair?: {
3
3
  filename: string;
4
- content: string;
4
+ content: string | null;
5
5
  }[];
6
6
  };
7
7
  declare const _default: import('../../node_modules/vue/dist/vue.esm-bundler.js').DefineComponent<__VLS_Props, {}, {}, {}, {}, 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<__VLS_Props> & Readonly<{}>, {
8
8
  diffPair: {
9
9
  filename: string;
10
- content: string;
10
+ content: string | null;
11
11
  }[];
12
12
  }, {}, {}, {}, string, import('../../node_modules/vue/dist/vue.esm-bundler.js').ComponentProvideOptions, false, {}, HTMLDivElement>;
13
13
  export default _default;
@@ -20,8 +20,11 @@ export declare function parseHunks(patch: string): {
20
20
  /**
21
21
  * 将 unified diff patch 转换为 [original, modified] 文件对。
22
22
  *
23
- * Monaco diff editor 需要两个完整文件内容,而 patch 只记录变更片段。
24
- * 未改动的行(hunk 之外)用空行填充,使两侧行号与 hunk 声明的起始位置对齐,
25
- * 从而让 Monaco 能在正确的行号位置渲染增删差异。
23
+ * 策略:
24
+ * - hunk 之外的行(patch 未提供内容):两侧各补一个空行撑开行号,
25
+ * Monaco hideUnchangedRegions 会将这些相同的空行折叠并显示正确的行号范围
26
+ * - context 行(' '):两侧均写入真实内容
27
+ * - 连续的删除('-')/ 新增('+')块:收集后成对对齐写入,
28
+ * 行数较少的一侧补空行,使 Monaco 能在同一视觉行渲染替换关系
26
29
  */
27
30
  export declare const patch2Pair: (patch: string) => FilePair[];
package/dist/types.d.ts CHANGED
@@ -4,7 +4,7 @@ export type ModelOptions = Monaco.editor.ITextModelUpdateOptions;
4
4
  export interface WtoolDiffViewerProps {
5
5
  diffPair?: {
6
6
  filename: string;
7
- content: string;
7
+ content: string | null;
8
8
  }[];
9
9
  diffPatch?: string;
10
10
  language?: string;