@git-diff-view/react 0.0.9 → 0.0.11

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.11" + "--" + 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,13 @@ 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
+ NewLineSymbol[NewLineSymbol["NEWLINE"] = 4] = "NEWLINE";
410
+ })(exports.NewLineSymbol || (exports.NewLineSymbol = {}));
404
411
  const maxLength = 1000;
405
412
  /** Get the maximum position in the range. */
406
413
  function rangeMax(range) {
@@ -424,25 +431,41 @@ function commonLength(stringA, rangeA, stringB, rangeB, reverse) {
424
431
  function isInValidString(s) {
425
432
  return s.trim().length === 0 || s.length >= maxLength;
426
433
  }
434
+ // TODO maybe could use the original content line
427
435
  /** Get the changed ranges in the strings, relative to each other. */
428
- function relativeChanges(stringA, stringB) {
436
+ function relativeChanges(addition, deletion) {
437
+ const stringA = addition.text;
438
+ const stringB = deletion.text;
429
439
  let bRange = { location: 0, length: stringB.length };
430
440
  let aRange = { location: 0, length: stringA.length };
431
441
  const _stringA = stringA.trimEnd();
432
442
  const _stringB = stringB.trimEnd();
433
443
  const aEndStr = stringA.slice(-2);
434
444
  const bEndStr = stringB.slice(-2);
435
- if (_stringA === _stringB && aEndStr !== bEndStr && (aEndStr === "\r\n" || bEndStr === "\r\n")) {
445
+ const hasNewLineChanged = addition.noTrailingNewLine !== deletion.noTrailingNewLine;
446
+ if (_stringA === _stringB && (hasNewLineChanged || aEndStr !== bEndStr)) {
436
447
  return {
437
448
  stringARange: {
438
449
  location: _stringA.length,
439
450
  length: stringA.length - _stringA.length,
440
- isNewLineSymbolChanged: true,
451
+ newLineSymbol: hasNewLineChanged
452
+ ? exports.NewLineSymbol.NEWLINE
453
+ : aEndStr === "\r\n"
454
+ ? exports.NewLineSymbol.CRLF
455
+ : aEndStr.endsWith("\r")
456
+ ? exports.NewLineSymbol.CR
457
+ : exports.NewLineSymbol.LF,
441
458
  },
442
459
  stringBRange: {
443
460
  location: _stringB.length,
444
461
  length: stringB.length - _stringB.length,
445
- isNewLineSymbolChanged: true,
462
+ newLineSymbol: hasNewLineChanged
463
+ ? exports.NewLineSymbol.NEWLINE
464
+ : bEndStr === "\r\n"
465
+ ? exports.NewLineSymbol.CRLF
466
+ : bEndStr.endsWith("\r")
467
+ ? exports.NewLineSymbol.CR
468
+ : exports.NewLineSymbol.LF,
446
469
  },
447
470
  };
448
471
  }
@@ -466,10 +489,12 @@ function relativeChanges(stringA, stringB) {
466
489
  return { stringARange: aRange, stringBRange: bRange };
467
490
  }
468
491
  /** Check two string have a diff range */
469
- function hasRelativeChange(stringA, stringB) {
470
- const _stringA = stringA.trim();
471
- const _stringB = stringB.trim();
472
- const { stringARange, stringBRange } = relativeChanges(_stringA, _stringB);
492
+ function hasRelativeChange(addition, deletion) {
493
+ const _stringA = addition.text.trim();
494
+ const _stringB = deletion.text.trim();
495
+ const _addition = addition.clone(_stringA);
496
+ const _deletion = deletion.clone(_stringB);
497
+ const { stringARange, stringBRange } = relativeChanges(_addition, _deletion);
473
498
  return (stringARange.location > 0 ||
474
499
  stringBRange.location > 0 ||
475
500
  stringARange.length < _stringA.length ||
@@ -517,6 +542,9 @@ class DiffLine {
517
542
  this.newLineNumber === other.newLineNumber &&
518
543
  this.noTrailingNewLine === other.noTrailingNewLine);
519
544
  }
545
+ clone(text) {
546
+ return new DiffLine(text, this.type, this.originalLineNumber, this.oldLineNumber, this.newLineNumber);
547
+ }
520
548
  }
521
549
  const checkDiffLineIncludeChange = (diffLine) => {
522
550
  if (!diffLine)
@@ -677,9 +705,9 @@ const getDiffRange = (additions, deletions) => {
677
705
  for (let i = 0; i < len; i++) {
678
706
  const addition = additions[i];
679
707
  const deletion = deletions[i];
680
- const hasDiffRange = hasRelativeChange(addition.text, deletion.text);
708
+ const hasDiffRange = hasRelativeChange(addition, deletion);
681
709
  if (hasDiffRange) {
682
- const { stringARange, stringBRange } = relativeChanges(addition.text, deletion.text);
710
+ const { stringARange, stringBRange } = relativeChanges(addition, deletion);
683
711
  addition.needRematch = true;
684
712
  addition.range = stringARange;
685
713
  deletion.needRematch = true;
@@ -1064,7 +1092,7 @@ class DiffFile {
1064
1092
  _DiffFile_updateCount.set(this, 0);
1065
1093
  _DiffFile_composeByDiff.set(this, false);
1066
1094
  _DiffFile_highlighterName.set(this, void 0);
1067
- this._version_ = "0.0.9";
1095
+ this._version_ = "0.0.11";
1068
1096
  this._oldFileContent = "";
1069
1097
  this._oldFileLang = "";
1070
1098
  this._newFileContent = "";
@@ -1810,31 +1838,33 @@ _DiffFile_oldFileResult = new WeakMap(), _DiffFile_newFileResult = new WeakMap()
1810
1838
  let oldLineNumber = 1;
1811
1839
  let oldFileContent = "";
1812
1840
  let newFileContent = "";
1813
- while (oldLineNumber <= this.diffLineLength) {
1814
- const index = oldLineNumber++;
1815
- const diffLine = __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getOldDiffLine).call(this, index);
1816
- if (diffLine) {
1817
- oldFileContent += diffLine.text;
1841
+ let hasSymbolChanged = false;
1842
+ while (oldLineNumber <= this.diffLineLength || newLineNumber <= this.diffLineLength) {
1843
+ const oldIndex = oldLineNumber++;
1844
+ const newIndex = newLineNumber++;
1845
+ const oldDiffLine = __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getOldDiffLine).call(this, oldIndex);
1846
+ const newDiffLine = __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getNewDiffLine).call(this, newIndex);
1847
+ if (oldDiffLine) {
1848
+ oldFileContent += oldDiffLine.text;
1818
1849
  }
1819
1850
  else {
1820
1851
  // empty line for placeholder
1821
1852
  oldFileContent += "\n";
1822
- oldFilePlaceholderLines[index] = true;
1853
+ oldFilePlaceholderLines[oldIndex] = true;
1823
1854
  }
1824
- }
1825
- while (newLineNumber <= this.diffLineLength) {
1826
- const index = newLineNumber++;
1827
- const diffLine = __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getNewDiffLine).call(this, index);
1828
- if (diffLine) {
1829
- newFileContent += diffLine.text;
1855
+ if (newDiffLine) {
1856
+ newFileContent += newDiffLine.text;
1830
1857
  }
1831
1858
  else {
1832
1859
  // empty line for placeholder
1833
1860
  newFileContent += "\n";
1834
- newFilePlaceholderLines[index] = true;
1861
+ newFilePlaceholderLines[newIndex] = true;
1862
+ }
1863
+ if (!hasSymbolChanged && oldDiffLine && newDiffLine) {
1864
+ hasSymbolChanged = hasSymbolChanged || oldDiffLine.noTrailingNewLine !== newDiffLine.noTrailingNewLine;
1835
1865
  }
1836
1866
  }
1837
- if (oldFileContent === newFileContent)
1867
+ if (!hasSymbolChanged && oldFileContent === newFileContent)
1838
1868
  return;
1839
1869
  this._oldFileContent = oldFileContent;
1840
1870
  this._newFileContent = newFileContent;
@@ -1849,17 +1879,25 @@ _DiffFile_oldFileResult = new WeakMap(), _DiffFile_newFileResult = new WeakMap()
1849
1879
  let newLineNumber = 1;
1850
1880
  let oldLineNumber = 1;
1851
1881
  let newFileContent = "";
1882
+ let hasSymbolChanged = false;
1852
1883
  while (oldLineNumber <= __classPrivateFieldGet(this, _DiffFile_oldFileResult, "f").maxLineNumber) {
1853
1884
  const newDiffLine = __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getNewDiffLine).call(this, newLineNumber++);
1885
+ const oldDiffLine = __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getOldDiffLine).call(this, oldLineNumber);
1854
1886
  if (newDiffLine) {
1855
1887
  newFileContent += newDiffLine.text;
1856
1888
  oldLineNumber = newDiffLine.oldLineNumber ? newDiffLine.oldLineNumber + 1 : oldLineNumber;
1857
1889
  }
1858
1890
  else {
1859
- newFileContent += __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getOldRawLine).call(this, oldLineNumber++);
1891
+ if (!oldDiffLine) {
1892
+ newFileContent += __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getOldRawLine).call(this, oldLineNumber);
1893
+ }
1894
+ oldLineNumber++;
1895
+ }
1896
+ if (!hasSymbolChanged && newDiffLine && oldDiffLine) {
1897
+ hasSymbolChanged = hasSymbolChanged || newDiffLine.noTrailingNewLine !== oldDiffLine.noTrailingNewLine;
1860
1898
  }
1861
1899
  }
1862
- if (newFileContent === this._oldFileContent)
1900
+ if (!hasSymbolChanged && newFileContent === this._oldFileContent)
1863
1901
  return;
1864
1902
  this._newFileContent = newFileContent;
1865
1903
  __classPrivateFieldSet(this, _DiffFile_newFileResult, getFile(this._newFileContent, this._newFileLang, this._newFileName), "f");
@@ -1868,17 +1906,25 @@ _DiffFile_oldFileResult = new WeakMap(), _DiffFile_newFileResult = new WeakMap()
1868
1906
  let oldLineNumber = 1;
1869
1907
  let newLineNumber = 1;
1870
1908
  let oldFileContent = "";
1909
+ let hasSymbolChanged = false;
1871
1910
  while (newLineNumber <= __classPrivateFieldGet(this, _DiffFile_newFileResult, "f").maxLineNumber) {
1872
1911
  const oldDiffLine = __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getOldDiffLine).call(this, oldLineNumber++);
1912
+ const newDiffLine = __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getNewDiffLine).call(this, newLineNumber);
1873
1913
  if (oldDiffLine) {
1874
1914
  oldFileContent += oldDiffLine.text;
1875
1915
  newLineNumber = oldDiffLine.newLineNumber ? oldDiffLine.newLineNumber + 1 : newLineNumber;
1876
1916
  }
1877
1917
  else {
1878
- oldFileContent += __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getNewRawLine).call(this, newLineNumber++);
1918
+ if (!newDiffLine) {
1919
+ oldFileContent += __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getNewRawLine).call(this, newLineNumber);
1920
+ }
1921
+ newLineNumber++;
1922
+ }
1923
+ if (!hasSymbolChanged && newDiffLine && oldDiffLine) {
1924
+ hasSymbolChanged = hasSymbolChanged || newDiffLine.noTrailingNewLine !== oldDiffLine.noTrailingNewLine;
1879
1925
  }
1880
1926
  }
1881
- if (oldFileContent === this._newFileContent)
1927
+ if (!hasSymbolChanged && oldFileContent === this._newFileContent)
1882
1928
  return;
1883
1929
  this._oldFileContent = oldFileContent;
1884
1930
  __classPrivateFieldSet(this, _DiffFile_oldFileResult, getFile(this._oldFileContent, this._oldFileLang, this._oldFileName), "f");
@@ -2076,7 +2122,7 @@ const getUnifiedContentLine = (diffFile) => {
2076
2122
  return lines.filter((line) => line.type === exports.DiffFileLineType.content);
2077
2123
  };
2078
2124
 
2079
- const versions = "0.0.9";
2125
+ const versions = "0.0.11";
2080
2126
 
2081
2127
  const useUnmount = (cb, deps) => {
2082
2128
  const ref = React.useRef(cb);
@@ -2174,14 +2220,18 @@ const useDomWidth = ({ selector, enable }) => {
2174
2220
 
2175
2221
  exports.DiffModeEnum = void 0;
2176
2222
  (function (DiffModeEnum) {
2177
- DiffModeEnum[DiffModeEnum["Split"] = 1] = "Split";
2178
- DiffModeEnum[DiffModeEnum["Unified"] = 2] = "Unified";
2223
+ // github like
2224
+ DiffModeEnum[DiffModeEnum["SplitGitHub"] = 1] = "SplitGitHub";
2225
+ // gitlab like
2226
+ DiffModeEnum[DiffModeEnum["SplitGitLab"] = 2] = "SplitGitLab";
2227
+ DiffModeEnum[DiffModeEnum["Split"] = 3] = "Split";
2228
+ DiffModeEnum[DiffModeEnum["Unified"] = 4] = "Unified";
2179
2229
  })(exports.DiffModeEnum || (exports.DiffModeEnum = {}));
2180
2230
  const DiffViewContext = React.createContext(null);
2181
2231
  DiffViewContext.displayName = "DiffViewContext";
2182
2232
  const useDiffViewContext = () => React.useContext(DiffViewContext);
2183
2233
 
2184
- const useSyncHeight = ({ selector, side, enable, }) => {
2234
+ const useSyncHeight = ({ selector, side, enable }) => {
2185
2235
  const { useDiffContext } = useDiffViewContext();
2186
2236
  const id = useDiffContext(React.useCallback((s) => s.id, []));
2187
2237
  useSafeLayout(() => {
@@ -2366,7 +2416,7 @@ const memoFunc = (func) => {
2366
2416
  };
2367
2417
  const asideWidth = "--diff-aside-width--";
2368
2418
 
2369
- const _DiffSplitHunkLine = ({ index, diffFile, side, lineNumber, }) => {
2419
+ const _DiffSplitHunkLineGitHub = ({ index, diffFile, side, lineNumber, }) => {
2370
2420
  var _a;
2371
2421
  const currentHunk = diffFile.getSplitHunkLine(index);
2372
2422
  const expandEnabled = diffFile.getExpandEnabled();
@@ -2405,6 +2455,55 @@ const _DiffSplitHunkLine = ({ index, diffFile, side, lineNumber, }) => {
2405
2455
  } }, ((_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
2456
  React__namespace.createElement("div", { className: "min-h-[28px]" }, "\u2002")))));
2407
2457
  };
2458
+ const _DiffSplitHunkLineGitLab = ({ index, diffFile, side, lineNumber, }) => {
2459
+ var _a;
2460
+ const currentHunk = diffFile.getSplitHunkLine(index);
2461
+ const expandEnabled = diffFile.getExpandEnabled();
2462
+ useSyncHeight({
2463
+ selector: `tr[data-line="${lineNumber}-hunk"]`,
2464
+ side: exports.SplitSide[exports.SplitSide.old],
2465
+ enable: side === exports.SplitSide.new,
2466
+ });
2467
+ const couldExpand = expandEnabled && currentHunk && currentHunk.splitInfo;
2468
+ const isExpandAll = currentHunk &&
2469
+ currentHunk.splitInfo &&
2470
+ currentHunk.splitInfo.endHiddenIndex - currentHunk.splitInfo.startHiddenIndex < composeLen;
2471
+ const isFirstLine = currentHunk && currentHunk.index === 0;
2472
+ const isLastLine = currentHunk && currentHunk.isLast;
2473
+ return (React__namespace.createElement("tr", { "data-line": `${lineNumber}-hunk`, "data-state": "hunk", "data-side": exports.SplitSide[side], className: "diff-line diff-line-hunk" },
2474
+ React__namespace.createElement("td", { className: "diff-line-hunk-action sticky left-0 p-[1px] w-[1%] min-w-[40px] select-none", style: {
2475
+ backgroundColor: `var(${hunkLineNumberBGName})`,
2476
+ color: `var(${plainLineNumberColorName})`,
2477
+ width: `var(${asideWidth})`,
2478
+ minWidth: `var(${asideWidth})`,
2479
+ maxWidth: `var(${asideWidth})`,
2480
+ } }, 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) },
2481
+ 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: () => {
2482
+ diffFile.onSplitHunkExpand("down", index);
2483
+ } },
2484
+ 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) },
2485
+ React__namespace.createElement(ExpandAll, { className: "fill-current" }))) : (React__namespace.createElement(React__namespace.Fragment, null,
2486
+ 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) },
2487
+ React__namespace.createElement(ExpandDown, { className: "fill-current" })),
2488
+ 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) },
2489
+ React__namespace.createElement(ExpandUp, { className: "fill-current" }))))) : (React__namespace.createElement("div", { className: "min-h-[28px]" }, "\u2002"))),
2490
+ React__namespace.createElement("td", { className: "diff-line-hunk-content pr-[10px] align-middle", style: { backgroundColor: `var(${hunkContentBGName})` } },
2491
+ React__namespace.createElement("div", { className: "pl-[1.5em]", style: {
2492
+ color: `var(${hunkContentColorName})`,
2493
+ } }, ((_a = currentHunk.splitInfo) === null || _a === void 0 ? void 0 : _a.plainText) || currentHunk.text))));
2494
+ };
2495
+ const _DiffSplitHunkLine = ({ index, diffFile, side, lineNumber, }) => {
2496
+ const { useDiffContext } = useDiffViewContext();
2497
+ const diffViewMode = useDiffContext(React__namespace.useCallback((s) => s.mode, []));
2498
+ if (diffViewMode === exports.DiffModeEnum.SplitGitHub ||
2499
+ diffViewMode === exports.DiffModeEnum.Split ||
2500
+ diffViewMode === exports.DiffModeEnum.Unified) {
2501
+ return React__namespace.createElement(_DiffSplitHunkLineGitHub, { index: index, diffFile: diffFile, side: side, lineNumber: lineNumber });
2502
+ }
2503
+ else {
2504
+ return React__namespace.createElement(_DiffSplitHunkLineGitLab, { index: index, diffFile: diffFile, side: side, lineNumber: lineNumber });
2505
+ }
2506
+ };
2408
2507
  const DiffSplitHunkLine$1 = ({ index, diffFile, side, lineNumber, }) => {
2409
2508
  const currentHunk = diffFile.getSplitHunkLine(index);
2410
2509
  const currentIsShow = currentHunk &&
@@ -2418,8 +2517,8 @@ const DiffSplitHunkLine$1 = ({ index, diffFile, side, lineNumber, }) => {
2418
2517
 
2419
2518
  const DiffSplitAddWidget = ({ side, className, lineNumber, onWidgetClick, onOpenAddWidget, }) => {
2420
2519
  return (React__namespace.createElement("div", { className: "diff-add-widget-wrapper" + (className ? " " + className : ""), style: {
2421
- width: "calc(var(--diff-font-size--) * 1.4)",
2422
- height: "calc(var(--diff-font-size--) * 1.4)",
2520
+ width: `calc(var(${diffFontSizeName}) * 1.4)`,
2521
+ height: `calc(var(${diffFontSizeName}) * 1.4)`,
2423
2522
  } },
2424
2523
  React__namespace.createElement("button", { className: "diff-add-widget w-full h-full invisible cursor-pointer rounded-md flex items-center justify-center transition-transform origin-center group-hover:visible hover:scale-110", style: {
2425
2524
  color: `var(${addWidgetColorName})`,
@@ -2433,8 +2532,8 @@ const DiffSplitAddWidget = ({ side, className, lineNumber, onWidgetClick, onOpen
2433
2532
  };
2434
2533
  const DiffUnifiedAddWidget = ({ lineNumber, side, onWidgetClick, onOpenAddWidget, }) => {
2435
2534
  return (React__namespace.createElement("div", { className: "diff-add-widget-wrapper absolute left-[100%] top-[1px] translate-x-[-50%]", style: {
2436
- width: "calc(var(--diff-font-size--) * 1.4)",
2437
- height: "calc(var(--diff-font-size--) * 1.4)",
2535
+ width: `calc(var(${diffFontSizeName}) * 1.4)`,
2536
+ height: `calc(var(${diffFontSizeName}) * 1.4)`,
2438
2537
  } },
2439
2538
  React__namespace.createElement("button", { className: "diff-add-widget w-full h-full invisible cursor-pointer rounded-md flex items-center justify-center transition-transform origin-center group-hover:visible hover:scale-110", style: {
2440
2539
  color: `var(${addWidgetColorName})`,
@@ -2447,6 +2546,12 @@ const DiffUnifiedAddWidget = ({ lineNumber, side, onWidgetClick, onOpenAddWidget
2447
2546
  } }, "+")));
2448
2547
  };
2449
2548
 
2549
+ const DiffNoNewLine = () => {
2550
+ return (React__namespace.createElement("svg", { "aria-label": "No newline at end of file", role: "img", viewBox: "0 0 16 16", version: "1.1", fill: "currentColor" },
2551
+ React__namespace.createElement("path", { d: "M4.25 7.25a.75.75 0 0 0 0 1.5h7.5a.75.75 0 0 0 0-1.5h-7.5Z" }),
2552
+ React__namespace.createElement("path", { d: "M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 1 0-13 0 6.5 6.5 0 0 0 13 0Z" })));
2553
+ };
2554
+
2450
2555
  const temp = {};
2451
2556
  const formatStringToCamelCase = (str) => {
2452
2557
  const splitted = str.split("-");
@@ -2471,38 +2576,46 @@ const getStyleObjectFromString = memoFunc((str) => {
2471
2576
  });
2472
2577
  return style;
2473
2578
  });
2474
- const DiffString = ({ rawLine, diffLine, operator, }) => {
2579
+ const DiffString = ({ rawLine, diffLine, operator, enableWrap, }) => {
2475
2580
  const range = diffLine === null || diffLine === void 0 ? void 0 : diffLine.range;
2476
2581
  if (range) {
2477
2582
  const str1 = rawLine.slice(0, range.location);
2478
2583
  const str2 = rawLine.slice(range.location, range.location + range.length);
2479
2584
  const str3 = rawLine.slice(range.location + range.length);
2480
- const isNewLineSymbolChanged = range.isNewLineSymbolChanged;
2585
+ const isLast = str2.includes("\n");
2586
+ const _str2 = isLast ? str2.replace("\n", "") : str2;
2587
+ const isNewLineSymbolChanged = range.newLineSymbol;
2481
2588
  return (React__namespace.createElement("span", { className: "diff-line-content-raw" },
2482
2589
  React__namespace.createElement("span", { "data-range-start": range.location, "data-range-end": range.location + range.length },
2483
2590
  str1,
2484
2591
  React__namespace.createElement("span", { "data-diff-highlight": true, className: "rounded-[0.2em]", style: {
2485
2592
  backgroundColor: operator === "add" ? `var(${addContentHighlightBGName})` : `var(${delContentHighlightBGName})`,
2486
- } }, isNewLineSymbolChanged
2487
- ? str2 === "\r"
2488
- ? ""
2489
- : str2 === "\n"
2490
- ? ""
2491
- : str2 === "\r\n"
2593
+ } }, isLast
2594
+ ? `${_str2}${isNewLineSymbolChanged === exports.NewLineSymbol.LF
2595
+ ? ""
2596
+ : isNewLineSymbolChanged === exports.NewLineSymbol.CR
2597
+ ? ""
2598
+ : isNewLineSymbolChanged === exports.NewLineSymbol.CRLF
2492
2599
  ? "␍␊"
2493
- : str2
2600
+ : ""}`
2494
2601
  : str2),
2495
- str3)));
2602
+ str3),
2603
+ isNewLineSymbolChanged === exports.NewLineSymbol.NEWLINE && diffLine.noTrailingNewLine && (React__namespace.createElement("span", { "data-no-newline-at-end-of-file": true, className: enableWrap ? "block text-red-500" : "inline-block align-middle text-red-500", style: {
2604
+ width: `var(${diffFontSizeName})`,
2605
+ height: `var(${diffFontSizeName})`,
2606
+ } },
2607
+ React__namespace.createElement(DiffNoNewLine, null)))));
2496
2608
  }
2497
2609
  return React__namespace.createElement("span", { className: "diff-line-content-raw" }, rawLine);
2498
2610
  };
2499
- const DiffSyntax = ({ rawLine, diffLine, operator, syntaxLine, }) => {
2611
+ const DiffSyntax = ({ rawLine, diffLine, operator, syntaxLine, enableWrap, }) => {
2500
2612
  var _a, _b;
2501
2613
  if (!syntaxLine) {
2502
2614
  return React__namespace.createElement(DiffString, { rawLine: rawLine, diffLine: diffLine, operator: operator });
2503
2615
  }
2504
2616
  const range = diffLine === null || diffLine === void 0 ? void 0 : diffLine.range;
2505
2617
  if (range) {
2618
+ const isNewLineSymbolChanged = range.newLineSymbol;
2506
2619
  return (React__namespace.createElement("span", { className: "diff-line-syntax-raw" },
2507
2620
  React__namespace.createElement("span", { "data-range-start": range.location, "data-range-end": range.location + range.length }, (_a = syntaxLine.nodeList) === null || _a === void 0 ? void 0 : _a.map(({ node, wrapper }, index) => {
2508
2621
  var _a, _b, _c, _d, _e, _f;
@@ -2517,27 +2630,33 @@ const DiffSyntax = ({ rawLine, diffLine, operator, syntaxLine, }) => {
2517
2630
  const str3 = node.value.slice(index1 + range.length);
2518
2631
  const isStart = str1.length || range.location === node.startIndex;
2519
2632
  const isEnd = str3.length || node.endIndex === range.location + range.length - 1;
2520
- const isNewLineSymbolChanged = range.isNewLineSymbolChanged;
2633
+ const isLast = str2.includes("\n");
2634
+ const _str2 = isLast ? str2.replace("\n", "") : str2;
2521
2635
  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
2636
  str1,
2523
2637
  React__namespace.createElement("span", { "data-diff-highlight": true, style: {
2524
2638
  backgroundColor: operator === "add" ? `var(${addContentHighlightBGName})` : `var(${delContentHighlightBGName})`,
2525
2639
  borderTopLeftRadius: isStart ? "0.2em" : undefined,
2526
2640
  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"
2641
+ borderTopRightRadius: isEnd || isLast ? "0.2em" : undefined,
2642
+ borderBottomRightRadius: isEnd || isLast ? "0.2em" : undefined,
2643
+ } }, isLast
2644
+ ? `${_str2}${isNewLineSymbolChanged === exports.NewLineSymbol.LF
2645
+ ? ""
2646
+ : isNewLineSymbolChanged === exports.NewLineSymbol.CR
2647
+ ? ""
2648
+ : isNewLineSymbolChanged === exports.NewLineSymbol.CRLF
2535
2649
  ? "␍␊"
2536
- : str2
2650
+ : ""}`
2537
2651
  : str2),
2538
2652
  str3));
2539
2653
  }
2540
- }))));
2654
+ })),
2655
+ isNewLineSymbolChanged === exports.NewLineSymbol.NEWLINE && diffLine.noTrailingNewLine && (React__namespace.createElement("span", { "data-no-newline-at-end-of-file": true, className: enableWrap ? "block text-red-500" : "inline-block align-middle text-red-500", style: {
2656
+ width: `var(${diffFontSizeName})`,
2657
+ height: `var(${diffFontSizeName})`,
2658
+ } },
2659
+ React__namespace.createElement(DiffNoNewLine, null)))));
2541
2660
  }
2542
2661
  return (React__namespace.createElement("span", { className: "diff-line-syntax-raw" }, (_b = syntaxLine === null || syntaxLine === void 0 ? void 0 : syntaxLine.nodeList) === null || _b === void 0 ? void 0 : _b.map(({ node, wrapper }, index) => {
2543
2662
  var _a, _b, _c;
@@ -2554,7 +2673,7 @@ const DiffContent = ({ diffLine, rawLine, syntaxLine, enableWrap, enableHighligh
2554
2673
  wordBreak: enableWrap ? "break-all" : "initial",
2555
2674
  } },
2556
2675
  React__namespace.createElement("span", { "data-operator": isAdded ? "+" : isDelete ? "-" : undefined, className: "diff-line-content-operator inline-block w-[1.5em] ml-[-1.5em] indent-[0.2em] select-none" }, isAdded ? "+" : isDelete ? "-" : " "),
2557
- enableHighlight && syntaxLine && !isMaxLineLengthToIgnoreSyntax ? (React__namespace.createElement(DiffSyntax, { operator: isAdded ? "add" : isDelete ? "del" : undefined, rawLine: rawLine, diffLine: diffLine, syntaxLine: syntaxLine })) : (React__namespace.createElement(DiffString, { operator: isAdded ? "add" : isDelete ? "del" : undefined, rawLine: rawLine, diffLine: diffLine }))));
2676
+ enableHighlight && syntaxLine && !isMaxLineLengthToIgnoreSyntax ? (React__namespace.createElement(DiffSyntax, { operator: isAdded ? "add" : isDelete ? "del" : undefined, rawLine: rawLine, diffLine: diffLine, syntaxLine: syntaxLine, enableWrap: enableWrap })) : (React__namespace.createElement(DiffString, { operator: isAdded ? "add" : isDelete ? "del" : undefined, rawLine: rawLine, diffLine: diffLine, enableWrap: enableWrap }))));
2558
2677
  };
2559
2678
 
2560
2679
  const DiffWidgetContext = React.createContext(null);
@@ -2698,21 +2817,21 @@ const DiffSplitViewNormal = React.memo(({ diffFile }) => {
2698
2817
  });
2699
2818
  const width = Math.max(40, _width + 25);
2700
2819
  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: {
2820
+ 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
2821
  // @ts-ignore
2703
2822
  [asideWidth]: `${Math.round(width)}px`,
2704
2823
  overscrollBehaviorX: "none",
2705
2824
  fontFamily: "Menlo, Consolas, monospace",
2706
- fontSize: "var(--diff-font-size--)",
2825
+ fontSize: `var(${diffFontSizeName})`,
2707
2826
  } },
2708
2827
  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: {
2828
+ React__namespace.createElement("div", { className: "diff-split-line w-[1.5px] bg-[rgb(222,222,222)]" }),
2829
+ 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
2830
  // @ts-ignore
2712
2831
  [asideWidth]: `${Math.round(width)}px`,
2713
2832
  overscrollBehaviorX: "none",
2714
2833
  fontFamily: "Menlo, Consolas, monospace",
2715
- fontSize: "var(--diff-font-size--)",
2834
+ fontSize: `var(${diffFontSizeName})`,
2716
2835
  } },
2717
2836
  React__namespace.createElement(DiffSplitViewTable, { side: exports.SplitSide.new, diffFile: diffFile }))));
2718
2837
  });
@@ -2737,7 +2856,7 @@ const _DiffSplitExtendLine = ({ index, diffFile, lineNumber, oldLineExtend, newL
2737
2856
  onUpdate: diffFile.notifyAll,
2738
2857
  }))))) : (React__namespace.createElement("td", { className: "diff-line-extend-old-placeholder p-0 select-none", style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
2739
2858
  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 },
2859
+ 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
2860
  React__namespace.createElement("div", { className: "diff-line-extend-wrapper" }, (newLineExtend === null || newLineExtend === void 0 ? void 0 : newLineExtend.data) &&
2742
2861
  (renderExtendLine === null || renderExtendLine === void 0 ? void 0 : renderExtendLine({
2743
2862
  diffFile,
@@ -2745,7 +2864,7 @@ const _DiffSplitExtendLine = ({ index, diffFile, lineNumber, oldLineExtend, newL
2745
2864
  lineNumber: newLine.lineNumber,
2746
2865
  data: newLineExtend.data,
2747
2866
  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 },
2867
+ }))))) : (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
2868
  React__namespace.createElement("span", null, "\u2002")))));
2750
2869
  };
2751
2870
  const DiffSplitExtendLine = ({ index, diffFile, lineNumber, }) => {
@@ -2768,7 +2887,7 @@ const DiffSplitExtendLine = ({ index, diffFile, lineNumber, }) => {
2768
2887
  return (React__namespace.createElement(_DiffSplitExtendLine, { index: index, diffFile: diffFile, lineNumber: lineNumber, oldLineExtend: oldLineExtend, newLineExtend: newLineExtend }));
2769
2888
  };
2770
2889
 
2771
- const DiffSplitHunkLine = ({ index, diffFile, lineNumber, }) => {
2890
+ const DiffSplitHunkLineGitHub = ({ index, diffFile, lineNumber, }) => {
2772
2891
  var _a;
2773
2892
  const currentHunk = diffFile.getSplitHunkLine(index);
2774
2893
  const expandEnabled = diffFile.getExpandEnabled();
@@ -2801,6 +2920,66 @@ const DiffSplitHunkLine = ({ index, diffFile, lineNumber, }) => {
2801
2920
  color: `var(${hunkContentColorName})`,
2802
2921
  } }, ((_a = currentHunk.splitInfo) === null || _a === void 0 ? void 0 : _a.plainText) || currentHunk.text))));
2803
2922
  };
2923
+ const DiffSplitHunkLineGitLab = ({ index, diffFile, lineNumber, }) => {
2924
+ var _a, _b;
2925
+ const currentHunk = diffFile.getSplitHunkLine(index);
2926
+ const expandEnabled = diffFile.getExpandEnabled();
2927
+ const couldExpand = expandEnabled && currentHunk && currentHunk.splitInfo;
2928
+ const isExpandAll = currentHunk &&
2929
+ currentHunk.splitInfo &&
2930
+ currentHunk.splitInfo.endHiddenIndex - currentHunk.splitInfo.startHiddenIndex < composeLen;
2931
+ const currentIsShow = currentHunk &&
2932
+ currentHunk.splitInfo &&
2933
+ currentHunk.splitInfo.startHiddenIndex < currentHunk.splitInfo.endHiddenIndex;
2934
+ const currentIsPureHunk = currentHunk && diffFile._getIsPureDiffRender() && !currentHunk.splitInfo;
2935
+ const isFirstLine = currentHunk && currentHunk.index === 0;
2936
+ const isLastLine = currentHunk && currentHunk.isLast;
2937
+ if (!currentIsShow && !currentIsPureHunk)
2938
+ return null;
2939
+ return (React__namespace.createElement("tr", { "data-line": `${lineNumber}-hunk`, "data-state": "hunk", className: "diff-line diff-line-hunk" },
2940
+ React__namespace.createElement("td", { className: "diff-line-hunk-action p-[1px] w-[1%] min-w-[40px] select-none relative", style: {
2941
+ backgroundColor: `var(${hunkLineNumberBGName})`,
2942
+ color: `var(${plainLineNumberColorName})`,
2943
+ } }, 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) },
2944
+ 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) },
2945
+ 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) },
2946
+ React__namespace.createElement(ExpandAll, { className: "fill-current" }))) : (React__namespace.createElement(React__namespace.Fragment, null,
2947
+ 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) },
2948
+ React__namespace.createElement(ExpandDown, { className: "fill-current" })),
2949
+ 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) },
2950
+ React__namespace.createElement(ExpandUp, { className: "fill-current" }))))) : (React__namespace.createElement("div", { className: "min-h-[28px]" }, "\u2002"))),
2951
+ React__namespace.createElement("td", { className: "diff-line-hunk-content pr-[10px] align-middle", style: { backgroundColor: `var(${hunkContentBGName})` } },
2952
+ React__namespace.createElement("div", { className: "pl-[1.5em]", style: {
2953
+ color: `var(${hunkContentColorName})`,
2954
+ } }, ((_a = currentHunk.splitInfo) === null || _a === void 0 ? void 0 : _a.plainText) || currentHunk.text)),
2955
+ 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: {
2956
+ backgroundColor: `var(${hunkLineNumberBGName})`,
2957
+ color: `var(${plainLineNumberColorName})`,
2958
+ } }, 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) },
2959
+ 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) },
2960
+ 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) },
2961
+ React__namespace.createElement(ExpandAll, { className: "fill-current" }))) : (React__namespace.createElement(React__namespace.Fragment, null,
2962
+ 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) },
2963
+ React__namespace.createElement(ExpandDown, { className: "fill-current" })),
2964
+ 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) },
2965
+ React__namespace.createElement(ExpandUp, { className: "fill-current" }))))) : (React__namespace.createElement("div", { className: "min-h-[28px]" }, "\u2002"))),
2966
+ React__namespace.createElement("td", { className: "diff-line-hunk-content pr-[10px] align-middle", style: { backgroundColor: `var(${hunkContentBGName})` } },
2967
+ React__namespace.createElement("div", { className: "pl-[1.5em]", style: {
2968
+ color: `var(${hunkContentColorName})`,
2969
+ } }, ((_b = currentHunk.splitInfo) === null || _b === void 0 ? void 0 : _b.plainText) || currentHunk.text))));
2970
+ };
2971
+ const DiffSplitHunkLine = ({ index, diffFile, lineNumber, }) => {
2972
+ const { useDiffContext } = useDiffViewContext();
2973
+ const diffViewMode = useDiffContext(React__namespace.useCallback((s) => s.mode, []));
2974
+ if (diffViewMode === exports.DiffModeEnum.SplitGitHub ||
2975
+ diffViewMode === exports.DiffModeEnum.Split ||
2976
+ diffViewMode === exports.DiffModeEnum.Unified) {
2977
+ return React__namespace.createElement(DiffSplitHunkLineGitHub, { index: index, diffFile: diffFile, lineNumber: lineNumber });
2978
+ }
2979
+ else {
2980
+ return React__namespace.createElement(DiffSplitHunkLineGitLab, { index: index, diffFile: diffFile, lineNumber: lineNumber });
2981
+ }
2982
+ };
2804
2983
 
2805
2984
  const _DiffSplitLine = ({ index, diffFile, lineNumber }) => {
2806
2985
  var _a, _b;
@@ -2836,12 +3015,12 @@ const _DiffSplitLine = ({ index, diffFile, lineNumber }) => {
2836
3015
  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
3016
  React__namespace.createElement("span", null, "\u2002"))),
2838
3017
  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})` } },
3018
+ 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
3019
  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
3020
  React__namespace.createElement("span", { "data-line-num": newLine.lineNumber, style: { opacity: hasChange ? undefined : 0.5 } }, newLine.lineNumber)),
2842
3021
  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
3022
  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 },
3023
+ 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
3024
  React__namespace.createElement("span", null, "\u2002")))));
2846
3025
  };
2847
3026
  const DiffSplitLine = ({ index, diffFile, lineNumber, }) => {
@@ -2870,13 +3049,13 @@ const _DiffSplitWidgetLine = ({ index, diffFile, lineNumber, oldLineWidget, newL
2870
3049
  onClose: () => setWidget({}),
2871
3050
  })))) : (React__namespace.createElement("td", { className: "diff-line-widget-old-placeholder p-0 select-none", style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
2872
3051
  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 },
3052
+ 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
3053
  React__namespace.createElement("div", { className: "diff-line-widget-wrapper" }, renderWidgetLine === null || renderWidgetLine === void 0 ? void 0 : renderWidgetLine({
2875
3054
  diffFile,
2876
3055
  side: exports.SplitSide.new,
2877
3056
  lineNumber: newLine.lineNumber,
2878
3057
  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 },
3058
+ })))) : (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
3059
  React__namespace.createElement("span", null, "\u2002")))));
2881
3060
  };
2882
3061
  const DiffSplitWidgetLine = ({ index, diffFile, lineNumber, }) => {
@@ -2894,7 +3073,7 @@ const DiffSplitWidgetLine = ({ index, diffFile, lineNumber, }) => {
2894
3073
 
2895
3074
  const Style = ({ useSelector, id, }) => {
2896
3075
  const splitRef = useSelector((s) => s.splitRef);
2897
- return (React__namespace.createElement("style", null, splitRef === exports.SplitSide.old
3076
+ return (React__namespace.createElement("style", { "data-select-style": true }, splitRef === exports.SplitSide.old
2898
3077
  ? `#${id} td[data-side="${exports.SplitSide[exports.SplitSide.new]}"] {user-select: none}`
2899
3078
  : splitRef === exports.SplitSide.new
2900
3079
  ? `#${id} td[data-side="${exports.SplitSide[exports.SplitSide.old]}"] {user-select: none}`
@@ -2943,7 +3122,7 @@ const DiffSplitViewWrap = React.memo(({ diffFile }) => {
2943
3122
  return (React__namespace.createElement("div", { className: "split-diff-view split-diff-view-normal w-full" },
2944
3123
  React__namespace.createElement("div", { className: "diff-table-wrapper w-full", style: {
2945
3124
  fontFamily: "Menlo, Consolas, monospace",
2946
- fontSize: "var(--diff-font-size--)",
3125
+ fontSize: `var(${diffFontSizeName})`,
2947
3126
  } },
2948
3127
  React__namespace.createElement(Style, { useSelector: splitSideInfo, id: `diff-root${diffFile.getId()}` }),
2949
3128
  React__namespace.createElement("table", { className: "diff-table border-collapse table-fixed w-full" },
@@ -3252,11 +3431,11 @@ const DiffUnifiedView = React.memo(({ diffFile }) => {
3252
3431
  const lines = getUnifiedContentLine(diffFile);
3253
3432
  return (React__namespace.createElement(DiffWidgetContext.Provider, { value: contextValue },
3254
3433
  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: {
3434
+ React__namespace.createElement("div", { className: "unified-diff-table-wrapper overflow-x-auto overflow-y-hidden w-full scrollbar-hide scrollbar-disable", style: {
3256
3435
  // @ts-ignore
3257
3436
  [asideWidth]: `${Math.round(width)}px`,
3258
3437
  fontFamily: "Menlo, Consolas, monospace",
3259
- fontSize: "var(--diff-font-size--)",
3438
+ fontSize: `var(${diffFontSizeName})`,
3260
3439
  } },
3261
3440
  React__namespace.createElement("table", { className: "unified-diff-table border-collapse w-full" },
3262
3441
  React__namespace.createElement("colgroup", null,
@@ -3386,12 +3565,12 @@ const _InternalDiffView = (props) => {
3386
3565
  ]);
3387
3566
  const value = React.useMemo(() => ({ useDiffContext }), [useDiffContext]);
3388
3567
  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() },
3568
+ React__namespace.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-version": `${"0.0.11"}`, "data-highlighter": diffFile._getHighlighterName() },
3390
3569
  React__namespace.createElement("div", { className: "diff-style-root", style: {
3391
3570
  // @ts-ignore
3392
3571
  [diffFontSizeName]: diffViewFontSize + "px",
3393
3572
  } },
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 })))))));
3573
+ 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
3574
  };
3396
3575
  const InternalDiffView = React.memo(_InternalDiffView);
3397
3576
  const DiffViewWithRef = (props, ref) => {
@@ -3435,11 +3614,11 @@ const DiffViewWithRef = (props, ref) => {
3435
3614
  React.useImperativeHandle(ref, () => ({ getDiffFileInstance: () => diffFile }), [diffFile]);
3436
3615
  if (!diffFile)
3437
3616
  return null;
3438
- return (React__namespace.createElement(InternalDiffView, Object.assign({ key: diffFile.getId() }, restProps, { diffFile: diffFile, diffViewFontSize: restProps.diffViewFontSize || 14 })));
3617
+ return (React__namespace.createElement(InternalDiffView, Object.assign({ key: diffFile.getId() }, restProps, { diffFile: diffFile, diffViewMode: restProps.diffViewMode || exports.DiffModeEnum.SplitGitHub, diffViewFontSize: restProps.diffViewFontSize || 14 })));
3439
3618
  };
3440
3619
  const DiffView = React.forwardRef(DiffViewWithRef);
3441
3620
  DiffView.displayName = "DiffView";
3442
- const version = "0.0.9";
3621
+ const version = "0.0.11";
3443
3622
 
3444
3623
  exports.DefaultDiffExpansionStep = DefaultDiffExpansionStep;
3445
3624
  exports.DiffFile = DiffFile;
@@ -3451,6 +3630,7 @@ exports._cacheMap = _cacheMap;
3451
3630
  exports.assertNever = assertNever;
3452
3631
  exports.checkDiffLineIncludeChange = checkDiffLineIncludeChange;
3453
3632
  exports.composeLen = composeLen;
3633
+ exports.diffFontSizeName = diffFontSizeName;
3454
3634
  exports.getDiffRange = getDiffRange;
3455
3635
  exports.getFile = getFile;
3456
3636
  exports.getHunkHeaderExpansionType = getHunkHeaderExpansionType;