@git-diff-view/react 0.0.9 → 0.0.10

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.
@@ -392,7 +392,7 @@ _File_instances = new WeakSet(), _File_doCheck = function _File_doCheck() {
392
392
  }
393
393
  };
394
394
  const getFile = (raw, lang, fileName) => {
395
- const key = raw + "--" + "0.0.9" + "--" + lang;
395
+ const key = raw + "--" + "0.0.10" + "--" + lang;
396
396
  if (map.has(key))
397
397
  return map.get(key);
398
398
  const file = new File(raw, lang, fileName);
@@ -401,6 +401,12 @@ const getFile = (raw, lang, fileName) => {
401
401
  };
402
402
  const _cacheMap = map;
403
403
 
404
+ exports.NewLineSymbol = void 0;
405
+ (function (NewLineSymbol) {
406
+ NewLineSymbol[NewLineSymbol["CRLF"] = 1] = "CRLF";
407
+ NewLineSymbol[NewLineSymbol["CR"] = 2] = "CR";
408
+ NewLineSymbol[NewLineSymbol["LF"] = 3] = "LF";
409
+ })(exports.NewLineSymbol || (exports.NewLineSymbol = {}));
404
410
  const maxLength = 1000;
405
411
  /** Get the maximum position in the range. */
406
412
  function rangeMax(range) {
@@ -437,12 +443,12 @@ function relativeChanges(stringA, stringB) {
437
443
  stringARange: {
438
444
  location: _stringA.length,
439
445
  length: stringA.length - _stringA.length,
440
- isNewLineSymbolChanged: true,
446
+ newLineSymbol: aEndStr === "\r\n" ? exports.NewLineSymbol.CRLF : aEndStr.endsWith("\r") ? exports.NewLineSymbol.CR : exports.NewLineSymbol.LF,
441
447
  },
442
448
  stringBRange: {
443
449
  location: _stringB.length,
444
450
  length: stringB.length - _stringB.length,
445
- isNewLineSymbolChanged: true,
451
+ newLineSymbol: bEndStr === "\r\n" ? exports.NewLineSymbol.CRLF : bEndStr.endsWith("\r") ? exports.NewLineSymbol.CR : exports.NewLineSymbol.LF,
446
452
  },
447
453
  };
448
454
  }
@@ -1064,7 +1070,7 @@ class DiffFile {
1064
1070
  _DiffFile_updateCount.set(this, 0);
1065
1071
  _DiffFile_composeByDiff.set(this, false);
1066
1072
  _DiffFile_highlighterName.set(this, void 0);
1067
- this._version_ = "0.0.9";
1073
+ this._version_ = "0.0.10";
1068
1074
  this._oldFileContent = "";
1069
1075
  this._oldFileLang = "";
1070
1076
  this._newFileContent = "";
@@ -1856,7 +1862,11 @@ _DiffFile_oldFileResult = new WeakMap(), _DiffFile_newFileResult = new WeakMap()
1856
1862
  oldLineNumber = newDiffLine.oldLineNumber ? newDiffLine.oldLineNumber + 1 : oldLineNumber;
1857
1863
  }
1858
1864
  else {
1859
- newFileContent += __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getOldRawLine).call(this, oldLineNumber++);
1865
+ const oldDiffLine = __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getOldDiffLine).call(this, oldLineNumber);
1866
+ if (!oldDiffLine) {
1867
+ newFileContent += __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getOldRawLine).call(this, oldLineNumber);
1868
+ }
1869
+ oldLineNumber++;
1860
1870
  }
1861
1871
  }
1862
1872
  if (newFileContent === this._oldFileContent)
@@ -1875,7 +1885,11 @@ _DiffFile_oldFileResult = new WeakMap(), _DiffFile_newFileResult = new WeakMap()
1875
1885
  newLineNumber = oldDiffLine.newLineNumber ? oldDiffLine.newLineNumber + 1 : newLineNumber;
1876
1886
  }
1877
1887
  else {
1878
- oldFileContent += __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getNewRawLine).call(this, newLineNumber++);
1888
+ const newDiffLine = __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getNewDiffLine).call(this, newLineNumber);
1889
+ if (!newDiffLine) {
1890
+ oldFileContent += __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getNewRawLine).call(this, newLineNumber);
1891
+ }
1892
+ newLineNumber++;
1879
1893
  }
1880
1894
  }
1881
1895
  if (oldFileContent === this._newFileContent)
@@ -2076,7 +2090,7 @@ const getUnifiedContentLine = (diffFile) => {
2076
2090
  return lines.filter((line) => line.type === exports.DiffFileLineType.content);
2077
2091
  };
2078
2092
 
2079
- const versions = "0.0.9";
2093
+ const versions = "0.0.10";
2080
2094
 
2081
2095
  const useUnmount = (cb, deps) => {
2082
2096
  const ref = React.useRef(cb);
@@ -2174,14 +2188,18 @@ const useDomWidth = ({ selector, enable }) => {
2174
2188
 
2175
2189
  exports.DiffModeEnum = void 0;
2176
2190
  (function (DiffModeEnum) {
2177
- DiffModeEnum[DiffModeEnum["Split"] = 1] = "Split";
2178
- DiffModeEnum[DiffModeEnum["Unified"] = 2] = "Unified";
2191
+ // github like
2192
+ DiffModeEnum[DiffModeEnum["SplitGitHub"] = 1] = "SplitGitHub";
2193
+ // gitlab like
2194
+ DiffModeEnum[DiffModeEnum["SplitGitLab"] = 2] = "SplitGitLab";
2195
+ DiffModeEnum[DiffModeEnum["Split"] = 3] = "Split";
2196
+ DiffModeEnum[DiffModeEnum["Unified"] = 4] = "Unified";
2179
2197
  })(exports.DiffModeEnum || (exports.DiffModeEnum = {}));
2180
2198
  const DiffViewContext = React.createContext(null);
2181
2199
  DiffViewContext.displayName = "DiffViewContext";
2182
2200
  const useDiffViewContext = () => React.useContext(DiffViewContext);
2183
2201
 
2184
- const useSyncHeight = ({ selector, side, enable, }) => {
2202
+ const useSyncHeight = ({ selector, side, enable }) => {
2185
2203
  const { useDiffContext } = useDiffViewContext();
2186
2204
  const id = useDiffContext(React.useCallback((s) => s.id, []));
2187
2205
  useSafeLayout(() => {
@@ -2366,7 +2384,7 @@ const memoFunc = (func) => {
2366
2384
  };
2367
2385
  const asideWidth = "--diff-aside-width--";
2368
2386
 
2369
- const _DiffSplitHunkLine = ({ index, diffFile, side, lineNumber, }) => {
2387
+ const _DiffSplitHunkLineGitHub = ({ index, diffFile, side, lineNumber, }) => {
2370
2388
  var _a;
2371
2389
  const currentHunk = diffFile.getSplitHunkLine(index);
2372
2390
  const expandEnabled = diffFile.getExpandEnabled();
@@ -2405,6 +2423,50 @@ const _DiffSplitHunkLine = ({ index, diffFile, side, lineNumber, }) => {
2405
2423
  } }, ((_a = currentHunk.splitInfo) === null || _a === void 0 ? void 0 : _a.plainText) || currentHunk.text)))) : (React__namespace.createElement("td", { className: "diff-line-hunk-placeholder select-none", colSpan: 2, style: { backgroundColor: `var(${hunkContentBGName})` } },
2406
2424
  React__namespace.createElement("div", { className: "min-h-[28px]" }, "\u2002")))));
2407
2425
  };
2426
+ const _DiffSplitHunkLineGitLab = ({ index, diffFile, side, lineNumber, }) => {
2427
+ var _a;
2428
+ const currentHunk = diffFile.getSplitHunkLine(index);
2429
+ const expandEnabled = diffFile.getExpandEnabled();
2430
+ const couldExpand = expandEnabled && currentHunk && currentHunk.splitInfo;
2431
+ const isExpandAll = currentHunk &&
2432
+ currentHunk.splitInfo &&
2433
+ currentHunk.splitInfo.endHiddenIndex - currentHunk.splitInfo.startHiddenIndex < composeLen;
2434
+ const isFirstLine = currentHunk && currentHunk.index === 0;
2435
+ const isLastLine = currentHunk && currentHunk.isLast;
2436
+ return (React__namespace.createElement("tr", { "data-line": `${lineNumber}-hunk`, "data-state": "hunk", "data-side": exports.SplitSide[side], className: "diff-line diff-line-hunk" },
2437
+ React__namespace.createElement("td", { className: "diff-line-hunk-action sticky left-0 p-[1px] w-[1%] min-w-[40px] select-none", style: {
2438
+ backgroundColor: `var(${hunkLineNumberBGName})`,
2439
+ color: `var(${plainLineNumberColorName})`,
2440
+ width: `var(${asideWidth})`,
2441
+ minWidth: `var(${asideWidth})`,
2442
+ maxWidth: `var(${asideWidth})`,
2443
+ } }, couldExpand ? (isFirstLine ? (React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[6px] cursor-pointer rounded-[2px]", title: "Expand Up", "data-title": "Expand Up", onClick: () => diffFile.onSplitHunkExpand("up", index) },
2444
+ React__namespace.createElement(ExpandUp, { className: "fill-current" }))) : isLastLine ? (React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[6px] cursor-pointer rounded-[2px] relative", title: "Expand Down", "data-title": "Expand Down", onClick: () => {
2445
+ diffFile.onSplitHunkExpand("down", index);
2446
+ } },
2447
+ React__namespace.createElement(ExpandDown, { className: "fill-current" }))) : isExpandAll ? (React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[6px] cursor-pointer rounded-[2px]", title: "Expand All", "data-title": "Expand All", onClick: () => diffFile.onSplitHunkExpand("all", index) },
2448
+ React__namespace.createElement(ExpandAll, { className: "fill-current" }))) : (React__namespace.createElement(React__namespace.Fragment, null,
2449
+ React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[2px] cursor-pointer rounded-[2px]", title: "Expand Down", "data-title": "Expand Down", onClick: () => diffFile.onSplitHunkExpand("down", index) },
2450
+ React__namespace.createElement(ExpandDown, { className: "fill-current" })),
2451
+ React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[2px] cursor-pointer rounded-[2px]", title: "Expand Up", "data-title": "Expand Up", onClick: () => diffFile.onSplitHunkExpand("up", index) },
2452
+ React__namespace.createElement(ExpandUp, { className: "fill-current" }))))) : (React__namespace.createElement("div", { className: "min-h-[28px]" }, "\u2002"))),
2453
+ React__namespace.createElement("td", { className: "diff-line-hunk-content pr-[10px] align-middle", style: { backgroundColor: `var(${hunkContentBGName})` } },
2454
+ React__namespace.createElement("div", { className: "pl-[1.5em]", style: {
2455
+ color: `var(${hunkContentColorName})`,
2456
+ } }, ((_a = currentHunk.splitInfo) === null || _a === void 0 ? void 0 : _a.plainText) || currentHunk.text))));
2457
+ };
2458
+ const _DiffSplitHunkLine = ({ index, diffFile, side, lineNumber, }) => {
2459
+ const { useDiffContext } = useDiffViewContext();
2460
+ const diffViewMode = useDiffContext(React__namespace.useCallback((s) => s.mode, []));
2461
+ if (diffViewMode === exports.DiffModeEnum.SplitGitHub ||
2462
+ diffViewMode === exports.DiffModeEnum.Split ||
2463
+ diffViewMode === exports.DiffModeEnum.Unified) {
2464
+ return React__namespace.createElement(_DiffSplitHunkLineGitHub, { index: index, diffFile: diffFile, side: side, lineNumber: lineNumber });
2465
+ }
2466
+ else {
2467
+ return React__namespace.createElement(_DiffSplitHunkLineGitLab, { index: index, diffFile: diffFile, side: side, lineNumber: lineNumber });
2468
+ }
2469
+ };
2408
2470
  const DiffSplitHunkLine$1 = ({ index, diffFile, side, lineNumber, }) => {
2409
2471
  const currentHunk = diffFile.getSplitHunkLine(index);
2410
2472
  const currentIsShow = currentHunk &&
@@ -2477,20 +2539,20 @@ const DiffString = ({ rawLine, diffLine, operator, }) => {
2477
2539
  const str1 = rawLine.slice(0, range.location);
2478
2540
  const str2 = rawLine.slice(range.location, range.location + range.length);
2479
2541
  const str3 = rawLine.slice(range.location + range.length);
2480
- const isNewLineSymbolChanged = range.isNewLineSymbolChanged;
2542
+ const isLast = str2.includes("\n");
2543
+ const _str2 = isLast ? str2.replace("\n", "") : str2;
2544
+ const isNewLineSymbolChanged = range.newLineSymbol;
2481
2545
  return (React__namespace.createElement("span", { className: "diff-line-content-raw" },
2482
2546
  React__namespace.createElement("span", { "data-range-start": range.location, "data-range-end": range.location + range.length },
2483
2547
  str1,
2484
2548
  React__namespace.createElement("span", { "data-diff-highlight": true, className: "rounded-[0.2em]", style: {
2485
2549
  backgroundColor: operator === "add" ? `var(${addContentHighlightBGName})` : `var(${delContentHighlightBGName})`,
2486
- } }, isNewLineSymbolChanged
2487
- ? str2 === "\r"
2488
- ? ""
2489
- : str2 === "\n"
2490
- ? ""
2491
- : str2 === "\r\n"
2492
- ? "␍␊"
2493
- : str2
2550
+ } }, isLast
2551
+ ? `${_str2}${isNewLineSymbolChanged === exports.NewLineSymbol.LF
2552
+ ? ""
2553
+ : isNewLineSymbolChanged === exports.NewLineSymbol.CR
2554
+ ? ""
2555
+ : "␍␊"}`
2494
2556
  : str2),
2495
2557
  str3)));
2496
2558
  }
@@ -2517,23 +2579,23 @@ const DiffSyntax = ({ rawLine, diffLine, operator, syntaxLine, }) => {
2517
2579
  const str3 = node.value.slice(index1 + range.length);
2518
2580
  const isStart = str1.length || range.location === node.startIndex;
2519
2581
  const isEnd = str3.length || node.endIndex === range.location + range.length - 1;
2520
- const isNewLineSymbolChanged = range.isNewLineSymbolChanged;
2582
+ const isLast = str2.includes("\n");
2583
+ const _str2 = isLast ? str2.replace("\n", "") : str2;
2584
+ const isNewLineSymbolChanged = range.newLineSymbol;
2521
2585
  return (React__namespace.createElement("span", { key: index, "data-start": node.startIndex, "data-end": node.endIndex, className: (_e = (_d = wrapper === null || wrapper === void 0 ? void 0 : wrapper.properties) === null || _d === void 0 ? void 0 : _d.className) === null || _e === void 0 ? void 0 : _e.join(" "), style: getStyleObjectFromString(((_f = wrapper === null || wrapper === void 0 ? void 0 : wrapper.properties) === null || _f === void 0 ? void 0 : _f.style) || "") },
2522
2586
  str1,
2523
2587
  React__namespace.createElement("span", { "data-diff-highlight": true, style: {
2524
2588
  backgroundColor: operator === "add" ? `var(${addContentHighlightBGName})` : `var(${delContentHighlightBGName})`,
2525
2589
  borderTopLeftRadius: isStart ? "0.2em" : undefined,
2526
2590
  borderBottomLeftRadius: isStart ? "0.2em" : undefined,
2527
- borderTopRightRadius: isEnd ? "0.2em" : undefined,
2528
- borderBottomRightRadius: isEnd ? "0.2em" : undefined,
2529
- } }, isNewLineSymbolChanged
2530
- ? str2 === "\r"
2531
- ? ""
2532
- : str2 === "\n"
2533
- ? ""
2534
- : str2 === "\r\n"
2535
- ? "␍␊"
2536
- : str2
2591
+ borderTopRightRadius: isEnd || isLast ? "0.2em" : undefined,
2592
+ borderBottomRightRadius: isEnd || isLast ? "0.2em" : undefined,
2593
+ } }, isLast
2594
+ ? `${_str2}${isNewLineSymbolChanged === exports.NewLineSymbol.LF
2595
+ ? ""
2596
+ : isNewLineSymbolChanged === exports.NewLineSymbol.CR
2597
+ ? ""
2598
+ : "␍␊"}`
2537
2599
  : str2),
2538
2600
  str3));
2539
2601
  }
@@ -2698,7 +2760,7 @@ const DiffSplitViewNormal = React.memo(({ diffFile }) => {
2698
2760
  });
2699
2761
  const width = Math.max(40, _width + 25);
2700
2762
  return (React__namespace.createElement("div", { className: "split-diff-view split-diff-view-wrap w-full flex basis-[50%]" },
2701
- React__namespace.createElement("div", { className: "old-diff-table-wrapper overflow-auto w-full scrollbar-hide scrollbar-disable", ref: ref1, style: {
2763
+ React__namespace.createElement("div", { className: "old-diff-table-wrapper overflow-x-auto overflow-y-hidden w-full scrollbar-hide scrollbar-disable", ref: ref1, style: {
2702
2764
  // @ts-ignore
2703
2765
  [asideWidth]: `${Math.round(width)}px`,
2704
2766
  overscrollBehaviorX: "none",
@@ -2706,8 +2768,8 @@ const DiffSplitViewNormal = React.memo(({ diffFile }) => {
2706
2768
  fontSize: "var(--diff-font-size--)",
2707
2769
  } },
2708
2770
  React__namespace.createElement(DiffSplitViewTable, { side: exports.SplitSide.old, diffFile: diffFile })),
2709
- React__namespace.createElement("div", { className: "diff-split-line w-[1.5px] bg-[#ccc]" }),
2710
- React__namespace.createElement("div", { className: "new-diff-table-wrapper overflow-auto w-full scrollbar-hide scrollbar-disable", ref: ref2, style: {
2771
+ React__namespace.createElement("div", { className: "diff-split-line w-[1.5px] bg-[rgb(222,222,222)]" }),
2772
+ React__namespace.createElement("div", { className: "new-diff-table-wrapper overflow-x-auto overflow-y-hidden w-full scrollbar-hide scrollbar-disable", ref: ref2, style: {
2711
2773
  // @ts-ignore
2712
2774
  [asideWidth]: `${Math.round(width)}px`,
2713
2775
  overscrollBehaviorX: "none",
@@ -2737,7 +2799,7 @@ const _DiffSplitExtendLine = ({ index, diffFile, lineNumber, oldLineExtend, newL
2737
2799
  onUpdate: diffFile.notifyAll,
2738
2800
  }))))) : (React__namespace.createElement("td", { className: "diff-line-extend-old-placeholder p-0 select-none", style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
2739
2801
  React__namespace.createElement("span", null, "\u2002"))),
2740
- newLineExtend ? (React__namespace.createElement("td", { className: "diff-line-extend-new-content p-0 border-l-[1px] border-l-[#ccc]", colSpan: 2 },
2802
+ newLineExtend ? (React__namespace.createElement("td", { className: "diff-line-extend-new-content p-0 border-l-[1px] border-l-[rgb(222,222,222)]", colSpan: 2 },
2741
2803
  React__namespace.createElement("div", { className: "diff-line-extend-wrapper" }, (newLineExtend === null || newLineExtend === void 0 ? void 0 : newLineExtend.data) &&
2742
2804
  (renderExtendLine === null || renderExtendLine === void 0 ? void 0 : renderExtendLine({
2743
2805
  diffFile,
@@ -2745,7 +2807,7 @@ const _DiffSplitExtendLine = ({ index, diffFile, lineNumber, oldLineExtend, newL
2745
2807
  lineNumber: newLine.lineNumber,
2746
2808
  data: newLineExtend.data,
2747
2809
  onUpdate: diffFile.notifyAll,
2748
- }))))) : (React__namespace.createElement("td", { className: "diff-line-extend-new-placeholder p-0 border-l-[1px] border-l-[#ccc] select-none", style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
2810
+ }))))) : (React__namespace.createElement("td", { className: "diff-line-extend-new-placeholder p-0 border-l-[1px] border-l-[rgb(222,222,222)] select-none", style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
2749
2811
  React__namespace.createElement("span", null, "\u2002")))));
2750
2812
  };
2751
2813
  const DiffSplitExtendLine = ({ index, diffFile, lineNumber, }) => {
@@ -2768,7 +2830,7 @@ const DiffSplitExtendLine = ({ index, diffFile, lineNumber, }) => {
2768
2830
  return (React__namespace.createElement(_DiffSplitExtendLine, { index: index, diffFile: diffFile, lineNumber: lineNumber, oldLineExtend: oldLineExtend, newLineExtend: newLineExtend }));
2769
2831
  };
2770
2832
 
2771
- const DiffSplitHunkLine = ({ index, diffFile, lineNumber, }) => {
2833
+ const DiffSplitHunkLineGitHub = ({ index, diffFile, lineNumber, }) => {
2772
2834
  var _a;
2773
2835
  const currentHunk = diffFile.getSplitHunkLine(index);
2774
2836
  const expandEnabled = diffFile.getExpandEnabled();
@@ -2801,6 +2863,66 @@ const DiffSplitHunkLine = ({ index, diffFile, lineNumber, }) => {
2801
2863
  color: `var(${hunkContentColorName})`,
2802
2864
  } }, ((_a = currentHunk.splitInfo) === null || _a === void 0 ? void 0 : _a.plainText) || currentHunk.text))));
2803
2865
  };
2866
+ const DiffSplitHunkLineGitLab = ({ index, diffFile, lineNumber, }) => {
2867
+ var _a, _b;
2868
+ const currentHunk = diffFile.getSplitHunkLine(index);
2869
+ const expandEnabled = diffFile.getExpandEnabled();
2870
+ const couldExpand = expandEnabled && currentHunk && currentHunk.splitInfo;
2871
+ const isExpandAll = currentHunk &&
2872
+ currentHunk.splitInfo &&
2873
+ currentHunk.splitInfo.endHiddenIndex - currentHunk.splitInfo.startHiddenIndex < composeLen;
2874
+ const currentIsShow = currentHunk &&
2875
+ currentHunk.splitInfo &&
2876
+ currentHunk.splitInfo.startHiddenIndex < currentHunk.splitInfo.endHiddenIndex;
2877
+ const currentIsPureHunk = currentHunk && diffFile._getIsPureDiffRender() && !currentHunk.splitInfo;
2878
+ const isFirstLine = currentHunk && currentHunk.index === 0;
2879
+ const isLastLine = currentHunk && currentHunk.isLast;
2880
+ if (!currentIsShow && !currentIsPureHunk)
2881
+ return null;
2882
+ return (React__namespace.createElement("tr", { "data-line": `${lineNumber}-hunk`, "data-state": "hunk", className: "diff-line diff-line-hunk" },
2883
+ React__namespace.createElement("td", { className: "diff-line-hunk-action p-[1px] w-[1%] min-w-[40px] select-none relative", style: {
2884
+ backgroundColor: `var(${hunkLineNumberBGName})`,
2885
+ color: `var(${plainLineNumberColorName})`,
2886
+ } }, couldExpand ? (isFirstLine ? (React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[6px] cursor-pointer rounded-[2px]", title: "Expand Up", "data-title": "Expand Up", onClick: () => diffFile.onSplitHunkExpand("up", index) },
2887
+ React__namespace.createElement(ExpandUp, { className: "fill-current" }))) : isLastLine ? (React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[6px] cursor-pointer rounded-[2px]", title: "Expand Down", "data-title": "Expand Down", onClick: () => diffFile.onSplitHunkExpand("down", index) },
2888
+ React__namespace.createElement(ExpandDown, { className: "fill-current" }))) : isExpandAll ? (React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[6px] cursor-pointer rounded-[2px]", title: "Expand All", "data-title": "Expand All", onClick: () => diffFile.onSplitHunkExpand("all", index) },
2889
+ React__namespace.createElement(ExpandAll, { className: "fill-current" }))) : (React__namespace.createElement(React__namespace.Fragment, null,
2890
+ React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[2px] cursor-pointer rounded-[2px]", title: "Expand Down", "data-title": "Expand Down", onClick: () => diffFile.onSplitHunkExpand("down", index) },
2891
+ React__namespace.createElement(ExpandDown, { className: "fill-current" })),
2892
+ React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[2px] cursor-pointer rounded-[2px]", title: "Expand Up", "data-title": "Expand Up", onClick: () => diffFile.onSplitHunkExpand("up", index) },
2893
+ React__namespace.createElement(ExpandUp, { className: "fill-current" }))))) : (React__namespace.createElement("div", { className: "min-h-[28px]" }, "\u2002"))),
2894
+ React__namespace.createElement("td", { className: "diff-line-hunk-content pr-[10px] align-middle", style: { backgroundColor: `var(${hunkContentBGName})` } },
2895
+ React__namespace.createElement("div", { className: "pl-[1.5em]", style: {
2896
+ color: `var(${hunkContentColorName})`,
2897
+ } }, ((_a = currentHunk.splitInfo) === null || _a === void 0 ? void 0 : _a.plainText) || currentHunk.text)),
2898
+ React__namespace.createElement("td", { className: "diff-line-hunk-action p-[1px] w-[1%] min-w-[40px] select-none relative border-l-[1px] border-l-[rgb(222,222,222)]", style: {
2899
+ backgroundColor: `var(${hunkLineNumberBGName})`,
2900
+ color: `var(${plainLineNumberColorName})`,
2901
+ } }, couldExpand ? (isFirstLine ? (React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[6px] cursor-pointer rounded-[2px]", title: "Expand Up", "data-title": "Expand Up", onClick: () => diffFile.onSplitHunkExpand("up", index) },
2902
+ React__namespace.createElement(ExpandUp, { className: "fill-current" }))) : isLastLine ? (React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[6px] cursor-pointer rounded-[2px]", title: "Expand Down", "data-title": "Expand Down", onClick: () => diffFile.onSplitHunkExpand("down", index) },
2903
+ React__namespace.createElement(ExpandDown, { className: "fill-current" }))) : isExpandAll ? (React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[6px] cursor-pointer rounded-[2px]", title: "Expand All", "data-title": "Expand All", onClick: () => diffFile.onSplitHunkExpand("all", index) },
2904
+ React__namespace.createElement(ExpandAll, { className: "fill-current" }))) : (React__namespace.createElement(React__namespace.Fragment, null,
2905
+ React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[2px] cursor-pointer rounded-[2px]", title: "Expand Down", "data-title": "Expand Down", onClick: () => diffFile.onSplitHunkExpand("down", index) },
2906
+ React__namespace.createElement(ExpandDown, { className: "fill-current" })),
2907
+ React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[2px] cursor-pointer rounded-[2px]", title: "Expand Up", "data-title": "Expand Up", onClick: () => diffFile.onSplitHunkExpand("up", index) },
2908
+ React__namespace.createElement(ExpandUp, { className: "fill-current" }))))) : (React__namespace.createElement("div", { className: "min-h-[28px]" }, "\u2002"))),
2909
+ React__namespace.createElement("td", { className: "diff-line-hunk-content pr-[10px] align-middle", style: { backgroundColor: `var(${hunkContentBGName})` } },
2910
+ React__namespace.createElement("div", { className: "pl-[1.5em]", style: {
2911
+ color: `var(${hunkContentColorName})`,
2912
+ } }, ((_b = currentHunk.splitInfo) === null || _b === void 0 ? void 0 : _b.plainText) || currentHunk.text))));
2913
+ };
2914
+ const DiffSplitHunkLine = ({ index, diffFile, lineNumber, }) => {
2915
+ const { useDiffContext } = useDiffViewContext();
2916
+ const diffViewMode = useDiffContext(React__namespace.useCallback((s) => s.mode, []));
2917
+ if (diffViewMode === exports.DiffModeEnum.SplitGitHub ||
2918
+ diffViewMode === exports.DiffModeEnum.Split ||
2919
+ diffViewMode === exports.DiffModeEnum.Unified) {
2920
+ return React__namespace.createElement(DiffSplitHunkLineGitHub, { index: index, diffFile: diffFile, lineNumber: lineNumber });
2921
+ }
2922
+ else {
2923
+ return React__namespace.createElement(DiffSplitHunkLineGitLab, { index: index, diffFile: diffFile, lineNumber: lineNumber });
2924
+ }
2925
+ };
2804
2926
 
2805
2927
  const _DiffSplitLine = ({ index, diffFile, lineNumber }) => {
2806
2928
  var _a, _b;
@@ -2836,12 +2958,12 @@ const _DiffSplitLine = ({ index, diffFile, lineNumber }) => {
2836
2958
  React__namespace.createElement(DiffContent, { enableWrap: true, diffFile: diffFile, rawLine: oldLine.value, diffLine: oldLine.diff, syntaxLine: oldSyntaxLine, enableHighlight: enableHighlight })))) : (React__namespace.createElement("td", { className: "diff-line-old-placeholder select-none", "data-side": exports.SplitSide[exports.SplitSide.old], style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
2837
2959
  React__namespace.createElement("span", null, "\u2002"))),
2838
2960
  hasNewLine ? (React__namespace.createElement(React__namespace.Fragment, null,
2839
- React__namespace.createElement("td", { className: "diff-line-new-num group relative pl-[10px] pr-[10px] text-right align-top select-none w-[1%] min-w-[40px] border-l-[1px] border-l-[#ccc]", "data-side": exports.SplitSide[exports.SplitSide.new], style: { backgroundColor: newLineNumberBG, color: `var(${plainLineNumberColorName})` } },
2961
+ React__namespace.createElement("td", { className: "diff-line-new-num group relative pl-[10px] pr-[10px] text-right align-top select-none w-[1%] min-w-[40px] border-l-[1px] border-l-[rgb(222,222,222)]", "data-side": exports.SplitSide[exports.SplitSide.new], style: { backgroundColor: newLineNumberBG, color: `var(${plainLineNumberColorName})` } },
2840
2962
  hasDiff && enableAddWidget && (React__namespace.createElement(DiffSplitAddWidget, { index: index, lineNumber: newLine.lineNumber, side: exports.SplitSide.new, diffFile: diffFile, onWidgetClick: (...props) => { var _a; return (_a = onAddWidgetClick.current) === null || _a === void 0 ? void 0 : _a.call(onAddWidgetClick, ...props); }, className: "absolute left-[100%] translate-x-[-50%] z-[1]", onOpenAddWidget: (lineNumber, side) => setWidget({ lineNumber: lineNumber, side: side }) })),
2841
2963
  React__namespace.createElement("span", { "data-line-num": newLine.lineNumber, style: { opacity: hasChange ? undefined : 0.5 } }, newLine.lineNumber)),
2842
2964
  React__namespace.createElement("td", { className: "diff-line-new-content group relative pr-[10px] align-top", "data-side": exports.SplitSide[exports.SplitSide.new], style: { backgroundColor: newLineContentBG } },
2843
2965
  hasDiff && enableAddWidget && (React__namespace.createElement(DiffSplitAddWidget, { index: index, lineNumber: newLine.lineNumber, side: exports.SplitSide.new, diffFile: diffFile, onWidgetClick: (...props) => { var _a; return (_a = onAddWidgetClick.current) === null || _a === void 0 ? void 0 : _a.call(onAddWidgetClick, ...props); }, className: "absolute right-[100%] translate-x-[50%] z-[1] select-none", onOpenAddWidget: (lineNumber, side) => setWidget({ lineNumber: lineNumber, side: side }) })),
2844
- React__namespace.createElement(DiffContent, { enableWrap: true, diffFile: diffFile, rawLine: newLine.value || "", diffLine: newLine.diff, syntaxLine: newSyntaxLine, enableHighlight: enableHighlight })))) : (React__namespace.createElement("td", { className: "diff-line-new-placeholder select-none border-l-[1px] border-l-[#ccc]", style: { backgroundColor: `var(${emptyBGName})` }, "data-side": exports.SplitSide[exports.SplitSide.new], colSpan: 2 },
2966
+ React__namespace.createElement(DiffContent, { enableWrap: true, diffFile: diffFile, rawLine: newLine.value || "", diffLine: newLine.diff, syntaxLine: newSyntaxLine, enableHighlight: enableHighlight })))) : (React__namespace.createElement("td", { className: "diff-line-new-placeholder select-none border-l-[1px] border-l-[rgb(222,222,222)]", style: { backgroundColor: `var(${emptyBGName})` }, "data-side": exports.SplitSide[exports.SplitSide.new], colSpan: 2 },
2845
2967
  React__namespace.createElement("span", null, "\u2002")))));
2846
2968
  };
2847
2969
  const DiffSplitLine = ({ index, diffFile, lineNumber, }) => {
@@ -2870,13 +2992,13 @@ const _DiffSplitWidgetLine = ({ index, diffFile, lineNumber, oldLineWidget, newL
2870
2992
  onClose: () => setWidget({}),
2871
2993
  })))) : (React__namespace.createElement("td", { className: "diff-line-widget-old-placeholder p-0 select-none", style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
2872
2994
  React__namespace.createElement("span", null, "\u2002"))),
2873
- newLineWidget ? (React__namespace.createElement("td", { className: "diff-line-widget-new-content p-0 border-l-[1px] border-l-[#ccc]", colSpan: 2 },
2995
+ newLineWidget ? (React__namespace.createElement("td", { className: "diff-line-widget-new-content p-0 border-l-[1px] border-l-[rgb(222,222,222)]", colSpan: 2 },
2874
2996
  React__namespace.createElement("div", { className: "diff-line-widget-wrapper" }, renderWidgetLine === null || renderWidgetLine === void 0 ? void 0 : renderWidgetLine({
2875
2997
  diffFile,
2876
2998
  side: exports.SplitSide.new,
2877
2999
  lineNumber: newLine.lineNumber,
2878
3000
  onClose: () => setWidget({}),
2879
- })))) : (React__namespace.createElement("td", { className: "diff-line-widget-new-placeholder p-0 border-l-[1px] border-l-[#ccc] select-none", style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
3001
+ })))) : (React__namespace.createElement("td", { className: "diff-line-widget-new-placeholder p-0 border-l-[1px] border-l-[rgb(222,222,222)] select-none", style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
2880
3002
  React__namespace.createElement("span", null, "\u2002")))));
2881
3003
  };
2882
3004
  const DiffSplitWidgetLine = ({ index, diffFile, lineNumber, }) => {
@@ -2894,7 +3016,7 @@ const DiffSplitWidgetLine = ({ index, diffFile, lineNumber, }) => {
2894
3016
 
2895
3017
  const Style = ({ useSelector, id, }) => {
2896
3018
  const splitRef = useSelector((s) => s.splitRef);
2897
- return (React__namespace.createElement("style", null, splitRef === exports.SplitSide.old
3019
+ return (React__namespace.createElement("style", { "data-select-style": true }, splitRef === exports.SplitSide.old
2898
3020
  ? `#${id} td[data-side="${exports.SplitSide[exports.SplitSide.new]}"] {user-select: none}`
2899
3021
  : splitRef === exports.SplitSide.new
2900
3022
  ? `#${id} td[data-side="${exports.SplitSide[exports.SplitSide.old]}"] {user-select: none}`
@@ -3252,7 +3374,7 @@ const DiffUnifiedView = React.memo(({ diffFile }) => {
3252
3374
  const lines = getUnifiedContentLine(diffFile);
3253
3375
  return (React__namespace.createElement(DiffWidgetContext.Provider, { value: contextValue },
3254
3376
  React__namespace.createElement("div", { className: "unified-diff-view w-full" },
3255
- React__namespace.createElement("div", { className: "unified-diff-table-wrapper overflow-auto w-full scrollbar-hide scrollbar-disable", style: {
3377
+ React__namespace.createElement("div", { className: "unified-diff-table-wrapper overflow-x-auto overflow-y-hidden w-full scrollbar-hide scrollbar-disable", style: {
3256
3378
  // @ts-ignore
3257
3379
  [asideWidth]: `${Math.round(width)}px`,
3258
3380
  fontFamily: "Menlo, Consolas, monospace",
@@ -3386,12 +3508,12 @@ const _InternalDiffView = (props) => {
3386
3508
  ]);
3387
3509
  const value = React.useMemo(() => ({ useDiffContext }), [useDiffContext]);
3388
3510
  return (React__namespace.createElement(DiffViewContext.Provider, { value: value },
3389
- React__namespace.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-version": `${"0.0.9"}`, "data-highlighter": diffFile._getHighlighterName() },
3511
+ React__namespace.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-version": `${"0.0.10"}`, "data-highlighter": diffFile._getHighlighterName() },
3390
3512
  React__namespace.createElement("div", { className: "diff-style-root", style: {
3391
3513
  // @ts-ignore
3392
3514
  [diffFontSizeName]: diffViewFontSize + "px",
3393
3515
  } },
3394
- React__namespace.createElement("div", { id: `diff-root${diffFileId}`, className: "diff-view-wrapper" + (className ? ` ${className}` : ""), style: style }, diffViewMode === exports.DiffModeEnum.Split ? (React__namespace.createElement(DiffSplitView, { diffFile: diffFile })) : (React__namespace.createElement(DiffUnifiedView, { diffFile: diffFile })))))));
3516
+ React__namespace.createElement("div", { id: `diff-root${diffFileId}`, className: "diff-view-wrapper" + (className ? ` ${className}` : ""), style: style }, diffViewMode & exports.DiffModeEnum.Split ? (React__namespace.createElement(DiffSplitView, { diffFile: diffFile })) : (React__namespace.createElement(DiffUnifiedView, { diffFile: diffFile })))))));
3395
3517
  };
3396
3518
  const InternalDiffView = React.memo(_InternalDiffView);
3397
3519
  const DiffViewWithRef = (props, ref) => {
@@ -3435,11 +3557,11 @@ const DiffViewWithRef = (props, ref) => {
3435
3557
  React.useImperativeHandle(ref, () => ({ getDiffFileInstance: () => diffFile }), [diffFile]);
3436
3558
  if (!diffFile)
3437
3559
  return null;
3438
- return (React__namespace.createElement(InternalDiffView, Object.assign({ key: diffFile.getId() }, restProps, { diffFile: diffFile, diffViewFontSize: restProps.diffViewFontSize || 14 })));
3560
+ return (React__namespace.createElement(InternalDiffView, Object.assign({ key: diffFile.getId() }, restProps, { diffFile: diffFile, diffViewMode: restProps.diffViewMode || exports.DiffModeEnum.SplitGitHub, diffViewFontSize: restProps.diffViewFontSize || 14 })));
3439
3561
  };
3440
3562
  const DiffView = React.forwardRef(DiffViewWithRef);
3441
3563
  DiffView.displayName = "DiffView";
3442
- const version = "0.0.9";
3564
+ const version = "0.0.10";
3443
3565
 
3444
3566
  exports.DefaultDiffExpansionStep = DefaultDiffExpansionStep;
3445
3567
  exports.DiffFile = DiffFile;