@git-diff-view/react 0.0.10 → 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.
- package/dist/cjs/index.development.js +107 -49
- package/dist/cjs/index.development.js.map +1 -1
- package/dist/cjs/index.production.js +107 -49
- package/dist/cjs/index.production.js.map +1 -1
- package/dist/css/diff-view.css +1 -1
- package/dist/esm/index.mjs +107 -50
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/components/DiffAddWidget.d.ts +1 -1
- package/dist/types/components/DiffAddWidget.d.ts.map +1 -1
- package/dist/types/components/DiffContent.d.ts.map +1 -1
- package/dist/types/components/DiffNoNewLine.d.ts +3 -0
- package/dist/types/components/DiffNoNewLine.d.ts.map +1 -0
- package/dist/types/components/DiffSplitHunkLineNormal.d.ts.map +1 -1
- package/dist/types/components/DiffView.d.ts +1 -0
- package/dist/types/components/DiffView.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -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.
|
|
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);
|
|
@@ -406,6 +406,7 @@ exports.NewLineSymbol = void 0;
|
|
|
406
406
|
NewLineSymbol[NewLineSymbol["CRLF"] = 1] = "CRLF";
|
|
407
407
|
NewLineSymbol[NewLineSymbol["CR"] = 2] = "CR";
|
|
408
408
|
NewLineSymbol[NewLineSymbol["LF"] = 3] = "LF";
|
|
409
|
+
NewLineSymbol[NewLineSymbol["NEWLINE"] = 4] = "NEWLINE";
|
|
409
410
|
})(exports.NewLineSymbol || (exports.NewLineSymbol = {}));
|
|
410
411
|
const maxLength = 1000;
|
|
411
412
|
/** Get the maximum position in the range. */
|
|
@@ -430,25 +431,41 @@ function commonLength(stringA, rangeA, stringB, rangeB, reverse) {
|
|
|
430
431
|
function isInValidString(s) {
|
|
431
432
|
return s.trim().length === 0 || s.length >= maxLength;
|
|
432
433
|
}
|
|
434
|
+
// TODO maybe could use the original content line
|
|
433
435
|
/** Get the changed ranges in the strings, relative to each other. */
|
|
434
|
-
function relativeChanges(
|
|
436
|
+
function relativeChanges(addition, deletion) {
|
|
437
|
+
const stringA = addition.text;
|
|
438
|
+
const stringB = deletion.text;
|
|
435
439
|
let bRange = { location: 0, length: stringB.length };
|
|
436
440
|
let aRange = { location: 0, length: stringA.length };
|
|
437
441
|
const _stringA = stringA.trimEnd();
|
|
438
442
|
const _stringB = stringB.trimEnd();
|
|
439
443
|
const aEndStr = stringA.slice(-2);
|
|
440
444
|
const bEndStr = stringB.slice(-2);
|
|
441
|
-
|
|
445
|
+
const hasNewLineChanged = addition.noTrailingNewLine !== deletion.noTrailingNewLine;
|
|
446
|
+
if (_stringA === _stringB && (hasNewLineChanged || aEndStr !== bEndStr)) {
|
|
442
447
|
return {
|
|
443
448
|
stringARange: {
|
|
444
449
|
location: _stringA.length,
|
|
445
450
|
length: stringA.length - _stringA.length,
|
|
446
|
-
newLineSymbol:
|
|
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,
|
|
447
458
|
},
|
|
448
459
|
stringBRange: {
|
|
449
460
|
location: _stringB.length,
|
|
450
461
|
length: stringB.length - _stringB.length,
|
|
451
|
-
newLineSymbol:
|
|
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,
|
|
452
469
|
},
|
|
453
470
|
};
|
|
454
471
|
}
|
|
@@ -472,10 +489,12 @@ function relativeChanges(stringA, stringB) {
|
|
|
472
489
|
return { stringARange: aRange, stringBRange: bRange };
|
|
473
490
|
}
|
|
474
491
|
/** Check two string have a diff range */
|
|
475
|
-
function hasRelativeChange(
|
|
476
|
-
const _stringA =
|
|
477
|
-
const _stringB =
|
|
478
|
-
const
|
|
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);
|
|
479
498
|
return (stringARange.location > 0 ||
|
|
480
499
|
stringBRange.location > 0 ||
|
|
481
500
|
stringARange.length < _stringA.length ||
|
|
@@ -523,6 +542,9 @@ class DiffLine {
|
|
|
523
542
|
this.newLineNumber === other.newLineNumber &&
|
|
524
543
|
this.noTrailingNewLine === other.noTrailingNewLine);
|
|
525
544
|
}
|
|
545
|
+
clone(text) {
|
|
546
|
+
return new DiffLine(text, this.type, this.originalLineNumber, this.oldLineNumber, this.newLineNumber);
|
|
547
|
+
}
|
|
526
548
|
}
|
|
527
549
|
const checkDiffLineIncludeChange = (diffLine) => {
|
|
528
550
|
if (!diffLine)
|
|
@@ -683,9 +705,9 @@ const getDiffRange = (additions, deletions) => {
|
|
|
683
705
|
for (let i = 0; i < len; i++) {
|
|
684
706
|
const addition = additions[i];
|
|
685
707
|
const deletion = deletions[i];
|
|
686
|
-
const hasDiffRange = hasRelativeChange(addition
|
|
708
|
+
const hasDiffRange = hasRelativeChange(addition, deletion);
|
|
687
709
|
if (hasDiffRange) {
|
|
688
|
-
const { stringARange, stringBRange } = relativeChanges(addition
|
|
710
|
+
const { stringARange, stringBRange } = relativeChanges(addition, deletion);
|
|
689
711
|
addition.needRematch = true;
|
|
690
712
|
addition.range = stringARange;
|
|
691
713
|
deletion.needRematch = true;
|
|
@@ -1070,7 +1092,7 @@ class DiffFile {
|
|
|
1070
1092
|
_DiffFile_updateCount.set(this, 0);
|
|
1071
1093
|
_DiffFile_composeByDiff.set(this, false);
|
|
1072
1094
|
_DiffFile_highlighterName.set(this, void 0);
|
|
1073
|
-
this._version_ = "0.0.
|
|
1095
|
+
this._version_ = "0.0.11";
|
|
1074
1096
|
this._oldFileContent = "";
|
|
1075
1097
|
this._oldFileLang = "";
|
|
1076
1098
|
this._newFileContent = "";
|
|
@@ -1816,31 +1838,33 @@ _DiffFile_oldFileResult = new WeakMap(), _DiffFile_newFileResult = new WeakMap()
|
|
|
1816
1838
|
let oldLineNumber = 1;
|
|
1817
1839
|
let oldFileContent = "";
|
|
1818
1840
|
let newFileContent = "";
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
const
|
|
1822
|
-
|
|
1823
|
-
|
|
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;
|
|
1824
1849
|
}
|
|
1825
1850
|
else {
|
|
1826
1851
|
// empty line for placeholder
|
|
1827
1852
|
oldFileContent += "\n";
|
|
1828
|
-
oldFilePlaceholderLines[
|
|
1853
|
+
oldFilePlaceholderLines[oldIndex] = true;
|
|
1829
1854
|
}
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
const index = newLineNumber++;
|
|
1833
|
-
const diffLine = __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getNewDiffLine).call(this, index);
|
|
1834
|
-
if (diffLine) {
|
|
1835
|
-
newFileContent += diffLine.text;
|
|
1855
|
+
if (newDiffLine) {
|
|
1856
|
+
newFileContent += newDiffLine.text;
|
|
1836
1857
|
}
|
|
1837
1858
|
else {
|
|
1838
1859
|
// empty line for placeholder
|
|
1839
1860
|
newFileContent += "\n";
|
|
1840
|
-
newFilePlaceholderLines[
|
|
1861
|
+
newFilePlaceholderLines[newIndex] = true;
|
|
1862
|
+
}
|
|
1863
|
+
if (!hasSymbolChanged && oldDiffLine && newDiffLine) {
|
|
1864
|
+
hasSymbolChanged = hasSymbolChanged || oldDiffLine.noTrailingNewLine !== newDiffLine.noTrailingNewLine;
|
|
1841
1865
|
}
|
|
1842
1866
|
}
|
|
1843
|
-
if (oldFileContent === newFileContent)
|
|
1867
|
+
if (!hasSymbolChanged && oldFileContent === newFileContent)
|
|
1844
1868
|
return;
|
|
1845
1869
|
this._oldFileContent = oldFileContent;
|
|
1846
1870
|
this._newFileContent = newFileContent;
|
|
@@ -1855,21 +1879,25 @@ _DiffFile_oldFileResult = new WeakMap(), _DiffFile_newFileResult = new WeakMap()
|
|
|
1855
1879
|
let newLineNumber = 1;
|
|
1856
1880
|
let oldLineNumber = 1;
|
|
1857
1881
|
let newFileContent = "";
|
|
1882
|
+
let hasSymbolChanged = false;
|
|
1858
1883
|
while (oldLineNumber <= __classPrivateFieldGet(this, _DiffFile_oldFileResult, "f").maxLineNumber) {
|
|
1859
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);
|
|
1860
1886
|
if (newDiffLine) {
|
|
1861
1887
|
newFileContent += newDiffLine.text;
|
|
1862
1888
|
oldLineNumber = newDiffLine.oldLineNumber ? newDiffLine.oldLineNumber + 1 : oldLineNumber;
|
|
1863
1889
|
}
|
|
1864
1890
|
else {
|
|
1865
|
-
const oldDiffLine = __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getOldDiffLine).call(this, oldLineNumber);
|
|
1866
1891
|
if (!oldDiffLine) {
|
|
1867
1892
|
newFileContent += __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getOldRawLine).call(this, oldLineNumber);
|
|
1868
1893
|
}
|
|
1869
1894
|
oldLineNumber++;
|
|
1870
1895
|
}
|
|
1896
|
+
if (!hasSymbolChanged && newDiffLine && oldDiffLine) {
|
|
1897
|
+
hasSymbolChanged = hasSymbolChanged || newDiffLine.noTrailingNewLine !== oldDiffLine.noTrailingNewLine;
|
|
1898
|
+
}
|
|
1871
1899
|
}
|
|
1872
|
-
if (newFileContent === this._oldFileContent)
|
|
1900
|
+
if (!hasSymbolChanged && newFileContent === this._oldFileContent)
|
|
1873
1901
|
return;
|
|
1874
1902
|
this._newFileContent = newFileContent;
|
|
1875
1903
|
__classPrivateFieldSet(this, _DiffFile_newFileResult, getFile(this._newFileContent, this._newFileLang, this._newFileName), "f");
|
|
@@ -1878,21 +1906,25 @@ _DiffFile_oldFileResult = new WeakMap(), _DiffFile_newFileResult = new WeakMap()
|
|
|
1878
1906
|
let oldLineNumber = 1;
|
|
1879
1907
|
let newLineNumber = 1;
|
|
1880
1908
|
let oldFileContent = "";
|
|
1909
|
+
let hasSymbolChanged = false;
|
|
1881
1910
|
while (newLineNumber <= __classPrivateFieldGet(this, _DiffFile_newFileResult, "f").maxLineNumber) {
|
|
1882
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);
|
|
1883
1913
|
if (oldDiffLine) {
|
|
1884
1914
|
oldFileContent += oldDiffLine.text;
|
|
1885
1915
|
newLineNumber = oldDiffLine.newLineNumber ? oldDiffLine.newLineNumber + 1 : newLineNumber;
|
|
1886
1916
|
}
|
|
1887
1917
|
else {
|
|
1888
|
-
const newDiffLine = __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getNewDiffLine).call(this, newLineNumber);
|
|
1889
1918
|
if (!newDiffLine) {
|
|
1890
1919
|
oldFileContent += __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getNewRawLine).call(this, newLineNumber);
|
|
1891
1920
|
}
|
|
1892
1921
|
newLineNumber++;
|
|
1893
1922
|
}
|
|
1923
|
+
if (!hasSymbolChanged && newDiffLine && oldDiffLine) {
|
|
1924
|
+
hasSymbolChanged = hasSymbolChanged || newDiffLine.noTrailingNewLine !== oldDiffLine.noTrailingNewLine;
|
|
1925
|
+
}
|
|
1894
1926
|
}
|
|
1895
|
-
if (oldFileContent === this._newFileContent)
|
|
1927
|
+
if (!hasSymbolChanged && oldFileContent === this._newFileContent)
|
|
1896
1928
|
return;
|
|
1897
1929
|
this._oldFileContent = oldFileContent;
|
|
1898
1930
|
__classPrivateFieldSet(this, _DiffFile_oldFileResult, getFile(this._oldFileContent, this._oldFileLang, this._oldFileName), "f");
|
|
@@ -2090,7 +2122,7 @@ const getUnifiedContentLine = (diffFile) => {
|
|
|
2090
2122
|
return lines.filter((line) => line.type === exports.DiffFileLineType.content);
|
|
2091
2123
|
};
|
|
2092
2124
|
|
|
2093
|
-
const versions = "0.0.
|
|
2125
|
+
const versions = "0.0.11";
|
|
2094
2126
|
|
|
2095
2127
|
const useUnmount = (cb, deps) => {
|
|
2096
2128
|
const ref = React.useRef(cb);
|
|
@@ -2427,6 +2459,11 @@ const _DiffSplitHunkLineGitLab = ({ index, diffFile, side, lineNumber, }) => {
|
|
|
2427
2459
|
var _a;
|
|
2428
2460
|
const currentHunk = diffFile.getSplitHunkLine(index);
|
|
2429
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
|
+
});
|
|
2430
2467
|
const couldExpand = expandEnabled && currentHunk && currentHunk.splitInfo;
|
|
2431
2468
|
const isExpandAll = currentHunk &&
|
|
2432
2469
|
currentHunk.splitInfo &&
|
|
@@ -2480,8 +2517,8 @@ const DiffSplitHunkLine$1 = ({ index, diffFile, side, lineNumber, }) => {
|
|
|
2480
2517
|
|
|
2481
2518
|
const DiffSplitAddWidget = ({ side, className, lineNumber, onWidgetClick, onOpenAddWidget, }) => {
|
|
2482
2519
|
return (React__namespace.createElement("div", { className: "diff-add-widget-wrapper" + (className ? " " + className : ""), style: {
|
|
2483
|
-
width:
|
|
2484
|
-
height:
|
|
2520
|
+
width: `calc(var(${diffFontSizeName}) * 1.4)`,
|
|
2521
|
+
height: `calc(var(${diffFontSizeName}) * 1.4)`,
|
|
2485
2522
|
} },
|
|
2486
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: {
|
|
2487
2524
|
color: `var(${addWidgetColorName})`,
|
|
@@ -2495,8 +2532,8 @@ const DiffSplitAddWidget = ({ side, className, lineNumber, onWidgetClick, onOpen
|
|
|
2495
2532
|
};
|
|
2496
2533
|
const DiffUnifiedAddWidget = ({ lineNumber, side, onWidgetClick, onOpenAddWidget, }) => {
|
|
2497
2534
|
return (React__namespace.createElement("div", { className: "diff-add-widget-wrapper absolute left-[100%] top-[1px] translate-x-[-50%]", style: {
|
|
2498
|
-
width:
|
|
2499
|
-
height:
|
|
2535
|
+
width: `calc(var(${diffFontSizeName}) * 1.4)`,
|
|
2536
|
+
height: `calc(var(${diffFontSizeName}) * 1.4)`,
|
|
2500
2537
|
} },
|
|
2501
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: {
|
|
2502
2539
|
color: `var(${addWidgetColorName})`,
|
|
@@ -2509,6 +2546,12 @@ const DiffUnifiedAddWidget = ({ lineNumber, side, onWidgetClick, onOpenAddWidget
|
|
|
2509
2546
|
} }, "+")));
|
|
2510
2547
|
};
|
|
2511
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
|
+
|
|
2512
2555
|
const temp = {};
|
|
2513
2556
|
const formatStringToCamelCase = (str) => {
|
|
2514
2557
|
const splitted = str.split("-");
|
|
@@ -2533,7 +2576,7 @@ const getStyleObjectFromString = memoFunc((str) => {
|
|
|
2533
2576
|
});
|
|
2534
2577
|
return style;
|
|
2535
2578
|
});
|
|
2536
|
-
const DiffString = ({ rawLine, diffLine, operator, }) => {
|
|
2579
|
+
const DiffString = ({ rawLine, diffLine, operator, enableWrap, }) => {
|
|
2537
2580
|
const range = diffLine === null || diffLine === void 0 ? void 0 : diffLine.range;
|
|
2538
2581
|
if (range) {
|
|
2539
2582
|
const str1 = rawLine.slice(0, range.location);
|
|
@@ -2552,19 +2595,27 @@ const DiffString = ({ rawLine, diffLine, operator, }) => {
|
|
|
2552
2595
|
? "␊"
|
|
2553
2596
|
: isNewLineSymbolChanged === exports.NewLineSymbol.CR
|
|
2554
2597
|
? "␍"
|
|
2555
|
-
:
|
|
2598
|
+
: isNewLineSymbolChanged === exports.NewLineSymbol.CRLF
|
|
2599
|
+
? "␍␊"
|
|
2600
|
+
: ""}`
|
|
2556
2601
|
: str2),
|
|
2557
|
-
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)))));
|
|
2558
2608
|
}
|
|
2559
2609
|
return React__namespace.createElement("span", { className: "diff-line-content-raw" }, rawLine);
|
|
2560
2610
|
};
|
|
2561
|
-
const DiffSyntax = ({ rawLine, diffLine, operator, syntaxLine, }) => {
|
|
2611
|
+
const DiffSyntax = ({ rawLine, diffLine, operator, syntaxLine, enableWrap, }) => {
|
|
2562
2612
|
var _a, _b;
|
|
2563
2613
|
if (!syntaxLine) {
|
|
2564
2614
|
return React__namespace.createElement(DiffString, { rawLine: rawLine, diffLine: diffLine, operator: operator });
|
|
2565
2615
|
}
|
|
2566
2616
|
const range = diffLine === null || diffLine === void 0 ? void 0 : diffLine.range;
|
|
2567
2617
|
if (range) {
|
|
2618
|
+
const isNewLineSymbolChanged = range.newLineSymbol;
|
|
2568
2619
|
return (React__namespace.createElement("span", { className: "diff-line-syntax-raw" },
|
|
2569
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) => {
|
|
2570
2621
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -2581,7 +2632,6 @@ const DiffSyntax = ({ rawLine, diffLine, operator, syntaxLine, }) => {
|
|
|
2581
2632
|
const isEnd = str3.length || node.endIndex === range.location + range.length - 1;
|
|
2582
2633
|
const isLast = str2.includes("\n");
|
|
2583
2634
|
const _str2 = isLast ? str2.replace("\n", "") : str2;
|
|
2584
|
-
const isNewLineSymbolChanged = range.newLineSymbol;
|
|
2585
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) || "") },
|
|
2586
2636
|
str1,
|
|
2587
2637
|
React__namespace.createElement("span", { "data-diff-highlight": true, style: {
|
|
@@ -2595,11 +2645,18 @@ const DiffSyntax = ({ rawLine, diffLine, operator, syntaxLine, }) => {
|
|
|
2595
2645
|
? "␊"
|
|
2596
2646
|
: isNewLineSymbolChanged === exports.NewLineSymbol.CR
|
|
2597
2647
|
? "␍"
|
|
2598
|
-
:
|
|
2648
|
+
: isNewLineSymbolChanged === exports.NewLineSymbol.CRLF
|
|
2649
|
+
? "␍␊"
|
|
2650
|
+
: ""}`
|
|
2599
2651
|
: str2),
|
|
2600
2652
|
str3));
|
|
2601
2653
|
}
|
|
2602
|
-
}))
|
|
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)))));
|
|
2603
2660
|
}
|
|
2604
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) => {
|
|
2605
2662
|
var _a, _b, _c;
|
|
@@ -2616,7 +2673,7 @@ const DiffContent = ({ diffLine, rawLine, syntaxLine, enableWrap, enableHighligh
|
|
|
2616
2673
|
wordBreak: enableWrap ? "break-all" : "initial",
|
|
2617
2674
|
} },
|
|
2618
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 ? "-" : " "),
|
|
2619
|
-
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 }))));
|
|
2620
2677
|
};
|
|
2621
2678
|
|
|
2622
2679
|
const DiffWidgetContext = React.createContext(null);
|
|
@@ -2765,7 +2822,7 @@ const DiffSplitViewNormal = React.memo(({ diffFile }) => {
|
|
|
2765
2822
|
[asideWidth]: `${Math.round(width)}px`,
|
|
2766
2823
|
overscrollBehaviorX: "none",
|
|
2767
2824
|
fontFamily: "Menlo, Consolas, monospace",
|
|
2768
|
-
fontSize:
|
|
2825
|
+
fontSize: `var(${diffFontSizeName})`,
|
|
2769
2826
|
} },
|
|
2770
2827
|
React__namespace.createElement(DiffSplitViewTable, { side: exports.SplitSide.old, diffFile: diffFile })),
|
|
2771
2828
|
React__namespace.createElement("div", { className: "diff-split-line w-[1.5px] bg-[rgb(222,222,222)]" }),
|
|
@@ -2774,7 +2831,7 @@ const DiffSplitViewNormal = React.memo(({ diffFile }) => {
|
|
|
2774
2831
|
[asideWidth]: `${Math.round(width)}px`,
|
|
2775
2832
|
overscrollBehaviorX: "none",
|
|
2776
2833
|
fontFamily: "Menlo, Consolas, monospace",
|
|
2777
|
-
fontSize:
|
|
2834
|
+
fontSize: `var(${diffFontSizeName})`,
|
|
2778
2835
|
} },
|
|
2779
2836
|
React__namespace.createElement(DiffSplitViewTable, { side: exports.SplitSide.new, diffFile: diffFile }))));
|
|
2780
2837
|
});
|
|
@@ -3065,7 +3122,7 @@ const DiffSplitViewWrap = React.memo(({ diffFile }) => {
|
|
|
3065
3122
|
return (React__namespace.createElement("div", { className: "split-diff-view split-diff-view-normal w-full" },
|
|
3066
3123
|
React__namespace.createElement("div", { className: "diff-table-wrapper w-full", style: {
|
|
3067
3124
|
fontFamily: "Menlo, Consolas, monospace",
|
|
3068
|
-
fontSize:
|
|
3125
|
+
fontSize: `var(${diffFontSizeName})`,
|
|
3069
3126
|
} },
|
|
3070
3127
|
React__namespace.createElement(Style, { useSelector: splitSideInfo, id: `diff-root${diffFile.getId()}` }),
|
|
3071
3128
|
React__namespace.createElement("table", { className: "diff-table border-collapse table-fixed w-full" },
|
|
@@ -3378,7 +3435,7 @@ const DiffUnifiedView = React.memo(({ diffFile }) => {
|
|
|
3378
3435
|
// @ts-ignore
|
|
3379
3436
|
[asideWidth]: `${Math.round(width)}px`,
|
|
3380
3437
|
fontFamily: "Menlo, Consolas, monospace",
|
|
3381
|
-
fontSize:
|
|
3438
|
+
fontSize: `var(${diffFontSizeName})`,
|
|
3382
3439
|
} },
|
|
3383
3440
|
React__namespace.createElement("table", { className: "unified-diff-table border-collapse w-full" },
|
|
3384
3441
|
React__namespace.createElement("colgroup", null,
|
|
@@ -3508,7 +3565,7 @@ const _InternalDiffView = (props) => {
|
|
|
3508
3565
|
]);
|
|
3509
3566
|
const value = React.useMemo(() => ({ useDiffContext }), [useDiffContext]);
|
|
3510
3567
|
return (React__namespace.createElement(DiffViewContext.Provider, { value: value },
|
|
3511
|
-
React__namespace.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-version": `${"0.0.
|
|
3568
|
+
React__namespace.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-version": `${"0.0.11"}`, "data-highlighter": diffFile._getHighlighterName() },
|
|
3512
3569
|
React__namespace.createElement("div", { className: "diff-style-root", style: {
|
|
3513
3570
|
// @ts-ignore
|
|
3514
3571
|
[diffFontSizeName]: diffViewFontSize + "px",
|
|
@@ -3561,7 +3618,7 @@ const DiffViewWithRef = (props, ref) => {
|
|
|
3561
3618
|
};
|
|
3562
3619
|
const DiffView = React.forwardRef(DiffViewWithRef);
|
|
3563
3620
|
DiffView.displayName = "DiffView";
|
|
3564
|
-
const version = "0.0.
|
|
3621
|
+
const version = "0.0.11";
|
|
3565
3622
|
|
|
3566
3623
|
exports.DefaultDiffExpansionStep = DefaultDiffExpansionStep;
|
|
3567
3624
|
exports.DiffFile = DiffFile;
|
|
@@ -3573,6 +3630,7 @@ exports._cacheMap = _cacheMap;
|
|
|
3573
3630
|
exports.assertNever = assertNever;
|
|
3574
3631
|
exports.checkDiffLineIncludeChange = checkDiffLineIncludeChange;
|
|
3575
3632
|
exports.composeLen = composeLen;
|
|
3633
|
+
exports.diffFontSizeName = diffFontSizeName;
|
|
3576
3634
|
exports.getDiffRange = getDiffRange;
|
|
3577
3635
|
exports.getFile = getFile;
|
|
3578
3636
|
exports.getHunkHeaderExpansionType = getHunkHeaderExpansionType;
|