@git-diff-view/react 0.0.36 → 0.0.38
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 +36 -109
- package/dist/cjs/index.development.js.map +1 -1
- package/dist/cjs/index.production.js +36 -109
- package/dist/cjs/index.production.js.map +1 -1
- package/dist/css/diff-view-pure.css +0 -3
- package/dist/css/diff-view.css +0 -3
- package/dist/esm/index.mjs +37 -110
- package/dist/esm/index.mjs.map +1 -1
- package/index.d.ts +12 -9
- package/package.json +2 -2
- package/src/components/DiffContent.tsx +15 -161
- package/src/components/DiffUnifiedContentLine.tsx +117 -122
- package/src/components/DiffView.tsx +14 -5
- package/styles/diff-view-pure.css +0 -3
- package/styles/diff-view.css +0 -3
package/dist/css/diff-view.css
CHANGED
package/dist/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { SplitSide, DiffLineType, getSyntaxDiffTemplate, getSyntaxLineTemplate, getPlainDiffTemplate, getPlainLineTemplate, checkDiffLineIncludeChange, composeLen, getSplitContentLines, getUnifiedContentLine, _cacheMap, DiffFile } from '@git-diff-view/core';
|
|
2
|
+
import { SplitSide, DiffLineType, getSyntaxDiffTemplate, getSyntaxLineTemplate, getPlainDiffTemplate, getPlainLineTemplate, checkDiffLineIncludeChange, composeLen, getSplitContentLines, getUnifiedContentLine, _cacheMap, DiffFile, highlighter } from '@git-diff-view/core';
|
|
3
3
|
export * from '@git-diff-view/core';
|
|
4
4
|
export { SplitSide } from '@git-diff-view/core';
|
|
5
5
|
import * as React from 'react';
|
|
@@ -132,8 +132,6 @@ const expandLineNumberBGName = "--diff-expand-lineNumber--";
|
|
|
132
132
|
const hunkContentBGName = "--diff-hunk-content--";
|
|
133
133
|
const hunkContentColorName = "--diff-hunk-content-color--";
|
|
134
134
|
const hunkLineNumberBGName = "--diff-hunk-lineNumber--";
|
|
135
|
-
const addContentHighlightBGName = "--diff-add-content-highlight--";
|
|
136
|
-
const delContentHighlightBGName = "--diff-del-content-highlight--";
|
|
137
135
|
const addWidgetBGName = "--diff-add-widget--";
|
|
138
136
|
const addWidgetColorName = "--diff-add-widget-color--";
|
|
139
137
|
const emptyBGName = "--diff-empty-content--";
|
|
@@ -157,10 +155,8 @@ const getLineNumberBG = (isAdded, isDelete, hasDiff) => {
|
|
|
157
155
|
};
|
|
158
156
|
|
|
159
157
|
const removeAllSelection = () => {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
selection.removeRange(selection.getRangeAt(i));
|
|
163
|
-
}
|
|
158
|
+
var _a;
|
|
159
|
+
(_a = window.getSelection()) === null || _a === void 0 ? void 0 : _a.removeAllRanges();
|
|
164
160
|
};
|
|
165
161
|
const syncScroll = (left, right) => {
|
|
166
162
|
const onScroll = function (event) {
|
|
@@ -242,18 +238,6 @@ var NewLineSymbol;
|
|
|
242
238
|
NewLineSymbol[NewLineSymbol["NORMAL"] = 5] = "NORMAL";
|
|
243
239
|
NewLineSymbol[NewLineSymbol["NULL"] = 6] = "NULL";
|
|
244
240
|
})(NewLineSymbol || (NewLineSymbol = {}));
|
|
245
|
-
const getSymbol = (symbol) => {
|
|
246
|
-
switch (symbol) {
|
|
247
|
-
case NewLineSymbol.LF:
|
|
248
|
-
return "␊";
|
|
249
|
-
case NewLineSymbol.CR:
|
|
250
|
-
return "␍";
|
|
251
|
-
case NewLineSymbol.CRLF:
|
|
252
|
-
return "␍␊";
|
|
253
|
-
default:
|
|
254
|
-
return "";
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
241
|
var DiffModeEnum;
|
|
258
242
|
(function (DiffModeEnum) {
|
|
259
243
|
// github like
|
|
@@ -359,14 +343,14 @@ const getStyleObjectFromString = memoFunc((str) => {
|
|
|
359
343
|
});
|
|
360
344
|
return style;
|
|
361
345
|
});
|
|
362
|
-
const DiffString = ({ rawLine, diffLine, operator, plainLine, enableWrap,
|
|
346
|
+
const DiffString = ({ rawLine, diffLine, operator, plainLine, enableWrap, }) => {
|
|
363
347
|
const changes = diffLine === null || diffLine === void 0 ? void 0 : diffLine.changes;
|
|
364
348
|
if (changes === null || changes === void 0 ? void 0 : changes.hasLineChange) {
|
|
365
349
|
const isNewLineSymbolChanged = changes.newLineSymbol;
|
|
366
|
-
if (
|
|
350
|
+
if (!(diffLine === null || diffLine === void 0 ? void 0 : diffLine.plainTemplate) && typeof getPlainDiffTemplate === "function") {
|
|
367
351
|
getPlainDiffTemplate({ diffLine, rawLine, operator });
|
|
368
352
|
}
|
|
369
|
-
if (
|
|
353
|
+
if (diffLine === null || diffLine === void 0 ? void 0 : diffLine.plainTemplate) {
|
|
370
354
|
return (React.createElement("span", { className: "diff-line-content-raw" },
|
|
371
355
|
React.createElement("span", { "data-template": true, dangerouslySetInnerHTML: { __html: diffLine.plainTemplate } }),
|
|
372
356
|
isNewLineSymbolChanged === NewLineSymbol.NEWLINE && (React.createElement("span", { "data-no-newline-at-end-of-file-symbol": true, className: enableWrap ? "block !text-red-500" : "inline-block align-middle !text-red-500", style: {
|
|
@@ -375,51 +359,28 @@ const DiffString = ({ rawLine, diffLine, operator, plainLine, enableWrap, enable
|
|
|
375
359
|
} },
|
|
376
360
|
React.createElement(DiffNoNewLine, null)))));
|
|
377
361
|
}
|
|
378
|
-
else {
|
|
379
|
-
// TODO remove
|
|
380
|
-
const range = changes.range;
|
|
381
|
-
const str1 = rawLine.slice(0, range.location);
|
|
382
|
-
const str2 = rawLine.slice(range.location, range.location + range.length);
|
|
383
|
-
const str3 = rawLine.slice(range.location + range.length);
|
|
384
|
-
const isLast = str2.includes("\n");
|
|
385
|
-
const _str2 = isLast ? str2.replace("\n", "").replace("\r", "") : str2;
|
|
386
|
-
return (React.createElement("span", { className: "diff-line-content-raw" },
|
|
387
|
-
React.createElement("span", { "data-range-start": range.location, "data-range-end": range.location + range.length },
|
|
388
|
-
str1,
|
|
389
|
-
React.createElement("span", { "data-diff-highlight": true, className: "rounded-[0.2em]", style: {
|
|
390
|
-
backgroundColor: operator === "add" ? `var(${addContentHighlightBGName})` : `var(${delContentHighlightBGName})`,
|
|
391
|
-
} }, isLast ? (React.createElement(React.Fragment, null,
|
|
392
|
-
_str2,
|
|
393
|
-
React.createElement("span", { "data-newline-symbol": true }, getSymbol(isNewLineSymbolChanged)))) : (str2)),
|
|
394
|
-
str3),
|
|
395
|
-
isNewLineSymbolChanged === NewLineSymbol.NEWLINE && (React.createElement("span", { "data-no-newline-at-end-of-file-symbol": true, className: enableWrap ? "block !text-red-500" : "inline-block align-middle !text-red-500", style: {
|
|
396
|
-
width: `var(${diffFontSizeName})`,
|
|
397
|
-
height: `var(${diffFontSizeName})`,
|
|
398
|
-
} },
|
|
399
|
-
React.createElement(DiffNoNewLine, null)))));
|
|
400
|
-
}
|
|
401
362
|
}
|
|
402
|
-
if (
|
|
363
|
+
if (plainLine && !(plainLine === null || plainLine === void 0 ? void 0 : plainLine.template)) {
|
|
403
364
|
plainLine.template = getPlainLineTemplate(plainLine.value);
|
|
404
365
|
}
|
|
405
|
-
if (
|
|
366
|
+
if (plainLine === null || plainLine === void 0 ? void 0 : plainLine.template) {
|
|
406
367
|
return (React.createElement("span", { className: "diff-line-content-raw" },
|
|
407
368
|
React.createElement("span", { "data-template": true, dangerouslySetInnerHTML: { __html: plainLine.template } })));
|
|
408
369
|
}
|
|
409
370
|
return React.createElement("span", { className: "diff-line-content-raw" }, rawLine);
|
|
410
371
|
};
|
|
411
|
-
const DiffSyntax = ({ rawLine, diffLine, operator, syntaxLine, enableWrap,
|
|
412
|
-
var _a
|
|
372
|
+
const DiffSyntax = ({ rawLine, diffFile, diffLine, operator, syntaxLine, enableWrap, }) => {
|
|
373
|
+
var _a;
|
|
413
374
|
if (!syntaxLine) {
|
|
414
|
-
return
|
|
375
|
+
return React.createElement(DiffString, { rawLine: rawLine, diffLine: diffLine, operator: operator, enableWrap: enableWrap });
|
|
415
376
|
}
|
|
416
377
|
const changes = diffLine === null || diffLine === void 0 ? void 0 : diffLine.changes;
|
|
417
378
|
if (changes === null || changes === void 0 ? void 0 : changes.hasLineChange) {
|
|
418
379
|
const isNewLineSymbolChanged = changes.newLineSymbol;
|
|
419
|
-
if (
|
|
420
|
-
getSyntaxDiffTemplate({ diffLine, syntaxLine, operator });
|
|
380
|
+
if (!(diffLine === null || diffLine === void 0 ? void 0 : diffLine.syntaxTemplate) && typeof getSyntaxDiffTemplate === "function") {
|
|
381
|
+
getSyntaxDiffTemplate({ diffFile, diffLine, syntaxLine, operator });
|
|
421
382
|
}
|
|
422
|
-
if (
|
|
383
|
+
if (diffLine === null || diffLine === void 0 ? void 0 : diffLine.syntaxTemplate) {
|
|
423
384
|
return (React.createElement("span", { className: "diff-line-syntax-raw" },
|
|
424
385
|
React.createElement("span", { "data-template": true, dangerouslySetInnerHTML: { __html: diffLine.syntaxTemplate } }),
|
|
425
386
|
isNewLineSymbolChanged === NewLineSymbol.NEWLINE && (React.createElement("span", { "data-no-newline-at-end-of-file-symbol": true, className: enableWrap ? "block !text-red-500" : "inline-block align-middle !text-red-500", style: {
|
|
@@ -428,66 +389,24 @@ const DiffSyntax = ({ rawLine, diffLine, operator, syntaxLine, enableWrap, enabl
|
|
|
428
389
|
} },
|
|
429
390
|
React.createElement(DiffNoNewLine, null)))));
|
|
430
391
|
}
|
|
431
|
-
else {
|
|
432
|
-
// TODO remove
|
|
433
|
-
const range = changes.range;
|
|
434
|
-
return (React.createElement("span", { className: "diff-line-syntax-raw" },
|
|
435
|
-
React.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) => {
|
|
436
|
-
var _a, _b, _c, _d, _e, _f;
|
|
437
|
-
if (node.endIndex < range.location || range.location + range.length < node.startIndex) {
|
|
438
|
-
return (React.createElement("span", { key: index, "data-start": node.startIndex, "data-end": node.endIndex, className: (_b = (_a = wrapper === null || wrapper === void 0 ? void 0 : wrapper.properties) === null || _a === void 0 ? void 0 : _a.className) === null || _b === void 0 ? void 0 : _b.join(" "), style: getStyleObjectFromString(((_c = wrapper === null || wrapper === void 0 ? void 0 : wrapper.properties) === null || _c === void 0 ? void 0 : _c.style) || "") }, node.value));
|
|
439
|
-
}
|
|
440
|
-
else {
|
|
441
|
-
const index1 = range.location - node.startIndex;
|
|
442
|
-
const index2 = index1 < 0 ? 0 : index1;
|
|
443
|
-
const str1 = node.value.slice(0, index2);
|
|
444
|
-
const str2 = node.value.slice(index2, index1 + range.length);
|
|
445
|
-
const str3 = node.value.slice(index1 + range.length);
|
|
446
|
-
const isStart = str1.length || range.location === node.startIndex;
|
|
447
|
-
const isEnd = str3.length || node.endIndex === range.location + range.length - 1;
|
|
448
|
-
const isLast = str2.includes("\n");
|
|
449
|
-
const _str2 = isLast ? str2.replace("\n", "").replace("\r", "") : str2;
|
|
450
|
-
return (React.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) || "") },
|
|
451
|
-
str1,
|
|
452
|
-
React.createElement("span", { "data-diff-highlight": true, style: {
|
|
453
|
-
backgroundColor: operator === "add"
|
|
454
|
-
? `var(${addContentHighlightBGName})`
|
|
455
|
-
: `var(${delContentHighlightBGName})`,
|
|
456
|
-
borderTopLeftRadius: isStart ? "0.2em" : undefined,
|
|
457
|
-
borderBottomLeftRadius: isStart ? "0.2em" : undefined,
|
|
458
|
-
borderTopRightRadius: isEnd || isLast ? "0.2em" : undefined,
|
|
459
|
-
borderBottomRightRadius: isEnd || isLast ? "0.2em" : undefined,
|
|
460
|
-
} }, isLast ? (React.createElement(React.Fragment, null,
|
|
461
|
-
_str2,
|
|
462
|
-
React.createElement("span", { "data-newline-symbol": true }, getSymbol(isNewLineSymbolChanged)))) : (str2)),
|
|
463
|
-
str3));
|
|
464
|
-
}
|
|
465
|
-
})),
|
|
466
|
-
isNewLineSymbolChanged === NewLineSymbol.NEWLINE && (React.createElement("span", { "data-no-newline-at-end-of-file-symbol": true, className: enableWrap ? "block !text-red-500" : "inline-block align-middle !text-red-500", style: {
|
|
467
|
-
width: `var(${diffFontSizeName})`,
|
|
468
|
-
height: `var(${diffFontSizeName})`,
|
|
469
|
-
} },
|
|
470
|
-
React.createElement(DiffNoNewLine, null)))));
|
|
471
|
-
}
|
|
472
392
|
}
|
|
473
|
-
if (
|
|
393
|
+
if (!syntaxLine.template) {
|
|
474
394
|
syntaxLine.template = getSyntaxLineTemplate(syntaxLine);
|
|
475
395
|
}
|
|
476
|
-
if (
|
|
396
|
+
if (syntaxLine === null || syntaxLine === void 0 ? void 0 : syntaxLine.template) {
|
|
477
397
|
return (React.createElement("span", { className: "diff-line-syntax-raw" },
|
|
478
398
|
React.createElement("span", { "data-template": true, dangerouslySetInnerHTML: { __html: syntaxLine.template } })));
|
|
479
399
|
}
|
|
480
|
-
return (React.createElement("span", { className: "diff-line-syntax-raw" }, (
|
|
400
|
+
return (React.createElement("span", { className: "diff-line-syntax-raw" }, (_a = syntaxLine === null || syntaxLine === void 0 ? void 0 : syntaxLine.nodeList) === null || _a === void 0 ? void 0 : _a.map(({ node, wrapper }, index) => {
|
|
481
401
|
var _a, _b, _c;
|
|
482
402
|
return (React.createElement("span", { key: index, "data-start": node.startIndex, "data-end": node.endIndex, className: (_b = (_a = wrapper === null || wrapper === void 0 ? void 0 : wrapper.properties) === null || _a === void 0 ? void 0 : _a.className) === null || _b === void 0 ? void 0 : _b.join(" "), style: getStyleObjectFromString(((_c = wrapper === null || wrapper === void 0 ? void 0 : wrapper.properties) === null || _c === void 0 ? void 0 : _c.style) || "") }, node.value));
|
|
483
403
|
})));
|
|
484
404
|
};
|
|
485
|
-
const DiffContent = ({
|
|
486
|
-
var _a
|
|
405
|
+
const DiffContent = ({ diffFile, diffLine, rawLine, plainLine, syntaxLine, enableWrap, enableHighlight, }) => {
|
|
406
|
+
var _a;
|
|
487
407
|
const isAdded = (diffLine === null || diffLine === void 0 ? void 0 : diffLine.type) === DiffLineType.Add;
|
|
488
408
|
const isDelete = (diffLine === null || diffLine === void 0 ? void 0 : diffLine.type) === DiffLineType.Delete;
|
|
489
409
|
const isMaxLineLengthToIgnoreSyntax = ((_a = syntaxLine === null || syntaxLine === void 0 ? void 0 : syntaxLine.nodeList) === null || _a === void 0 ? void 0 : _a.length) > 150;
|
|
490
|
-
const isEnableTemplate = (_c = (_b = diffFile.getIsEnableTemplate) === null || _b === void 0 ? void 0 : _b.call(diffFile)) !== null && _c !== void 0 ? _c : true;
|
|
491
410
|
return (React.createElement("div", { className: "diff-line-content-item pl-[2.0em]",
|
|
492
411
|
// data-val={rawLine}
|
|
493
412
|
style: {
|
|
@@ -495,7 +414,7 @@ const DiffContent = ({ diffLine, diffFile, rawLine, plainLine, syntaxLine, enabl
|
|
|
495
414
|
wordBreak: enableWrap ? "break-all" : "initial",
|
|
496
415
|
} },
|
|
497
416
|
React.createElement("span", { "data-operator": isAdded ? "+" : isDelete ? "-" : undefined, className: "diff-line-content-operator ml-[-1.5em] inline-block w-[1.5em] select-none indent-[0.2em]" }, isAdded ? "+" : isDelete ? "-" : " "),
|
|
498
|
-
enableHighlight && syntaxLine && !isMaxLineLengthToIgnoreSyntax ? (React.createElement(DiffSyntax, { operator: isAdded ? "add" : isDelete ? "del" : undefined, rawLine: rawLine, diffLine: diffLine, syntaxLine: syntaxLine, enableWrap: enableWrap
|
|
417
|
+
enableHighlight && syntaxLine && !isMaxLineLengthToIgnoreSyntax ? (React.createElement(DiffSyntax, { operator: isAdded ? "add" : isDelete ? "del" : undefined, rawLine: rawLine, diffFile: diffFile, diffLine: diffLine, syntaxLine: syntaxLine, enableWrap: enableWrap })) : (React.createElement(DiffString, { operator: isAdded ? "add" : isDelete ? "del" : undefined, rawLine: rawLine, diffLine: diffLine, plainLine: plainLine, enableWrap: enableWrap }))));
|
|
499
418
|
};
|
|
500
419
|
|
|
501
420
|
const DiffViewContext = createContext(null);
|
|
@@ -1501,7 +1420,7 @@ const DiffUnifiedNewLine = ({ index, diffLine, rawLine, plainLine, syntaxLine, l
|
|
|
1501
1420
|
React.createElement("td", { className: "diff-line-content pr-[10px] align-top", style: { backgroundColor: `var(${addContentBGName})` } },
|
|
1502
1421
|
React.createElement(DiffContent, { enableWrap: enableWrap, diffFile: diffFile, enableHighlight: enableHighlight, rawLine: rawLine, diffLine: diffLine, plainLine: plainLine, syntaxLine: syntaxLine }))));
|
|
1503
1422
|
};
|
|
1504
|
-
const
|
|
1423
|
+
const InternalDiffUnifiedLine = ({ index, diffFile, lineNumber, enableWrap, enableAddWidget, enableHighlight, }) => {
|
|
1505
1424
|
const unifiedLine = diffFile.getUnifiedLine(index);
|
|
1506
1425
|
const { useDiffContext } = useDiffViewContext();
|
|
1507
1426
|
const onAddWidgetClick = useDiffContext.getReadonlyState().onAddWidgetClick;
|
|
@@ -1550,13 +1469,12 @@ const _DiffUnifiedLine = memo(({ index, diffFile, lineNumber, enableWrap, enable
|
|
|
1550
1469
|
} },
|
|
1551
1470
|
React.createElement(DiffContent, { enableWrap: enableWrap, diffFile: diffFile, enableHighlight: enableHighlight, rawLine: rawLine, diffLine: diffLine, plainLine: plainLine, syntaxLine: syntaxLine }))));
|
|
1552
1471
|
}
|
|
1553
|
-
}
|
|
1554
|
-
_DiffUnifiedLine.displayName = "_DiffUnifiedLine";
|
|
1472
|
+
};
|
|
1555
1473
|
const DiffUnifiedContentLine = ({ index, diffFile, lineNumber, enableWrap, enableHighlight, enableAddWidget, }) => {
|
|
1556
1474
|
const unifiedLine = diffFile.getUnifiedLine(index);
|
|
1557
1475
|
if (unifiedLine === null || unifiedLine === void 0 ? void 0 : unifiedLine.isHidden)
|
|
1558
1476
|
return null;
|
|
1559
|
-
return (React.createElement(
|
|
1477
|
+
return (React.createElement(InternalDiffUnifiedLine, { index: index, diffFile: diffFile, lineNumber: lineNumber, enableWrap: enableWrap, enableHighlight: enableHighlight, enableAddWidget: enableAddWidget }));
|
|
1560
1478
|
};
|
|
1561
1479
|
|
|
1562
1480
|
const InternalDiffUnifiedExtendLine = ({ index, diffFile, lineNumber, enableWrap, oldLineExtend, newLineExtend, }) => {
|
|
@@ -1869,7 +1787,7 @@ const InternalDiffView = (props) => {
|
|
|
1869
1787
|
}, [useDiffContext, wrapperRef]);
|
|
1870
1788
|
const value = useMemo(() => ({ useDiffContext }), [useDiffContext]);
|
|
1871
1789
|
return (React.createElement(DiffViewContext.Provider, { value: value },
|
|
1872
|
-
React.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-theme": diffFile._getTheme() || "light", "data-version": "0.0.
|
|
1790
|
+
React.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-theme": diffFile._getTheme() || "light", "data-version": "0.0.38", "data-highlighter": diffFile._getHighlighterName(), ref: wrapperRef },
|
|
1873
1791
|
React.createElement("div", { className: "diff-style-root", style: {
|
|
1874
1792
|
// @ts-ignore
|
|
1875
1793
|
[diffFontSizeName]: diffViewFontSize + "px",
|
|
@@ -1922,9 +1840,18 @@ const DiffViewWithRef = (props, ref) => {
|
|
|
1922
1840
|
if (!diffFile)
|
|
1923
1841
|
return;
|
|
1924
1842
|
if (props.diffViewHighlight) {
|
|
1925
|
-
|
|
1843
|
+
const finalHighlighter = registerHighlighter || highlighter;
|
|
1844
|
+
if (finalHighlighter.name !== diffFile._getHighlighterName() ||
|
|
1845
|
+
finalHighlighter.type !== diffFile._getHighlighterType()) {
|
|
1846
|
+
diffFile.initSyntax({ registerHighlighter: finalHighlighter });
|
|
1847
|
+
diffFile.notifyAll();
|
|
1848
|
+
}
|
|
1849
|
+
else {
|
|
1850
|
+
diffFile.initSyntax({ registerHighlighter: finalHighlighter });
|
|
1851
|
+
if (finalHighlighter.type !== "class")
|
|
1852
|
+
diffFile.notifyAll();
|
|
1853
|
+
}
|
|
1926
1854
|
}
|
|
1927
|
-
diffFile.notifyAll();
|
|
1928
1855
|
}, [diffFile, props.diffViewHighlight, registerHighlighter, diffViewTheme]);
|
|
1929
1856
|
useEffect(() => {
|
|
1930
1857
|
if (!diffFile)
|
|
@@ -1937,7 +1864,7 @@ const DiffViewWithRef = (props, ref) => {
|
|
|
1937
1864
|
init();
|
|
1938
1865
|
const cb = diffFile.subscribe(init);
|
|
1939
1866
|
return cb;
|
|
1940
|
-
}, [diffFile]);
|
|
1867
|
+
}, [diffFile, diffViewTheme]);
|
|
1941
1868
|
// fix react strict mode error
|
|
1942
1869
|
useUnmount(() => { var _a, _b; return (process.env.NODE_ENV === "development" ? (_a = diffFile === null || diffFile === void 0 ? void 0 : diffFile._destroy) === null || _a === void 0 ? void 0 : _a.call(diffFile) : (_b = diffFile === null || diffFile === void 0 ? void 0 : diffFile.clear) === null || _b === void 0 ? void 0 : _b.call(diffFile)); }, [diffFile]);
|
|
1943
1870
|
useImperativeHandle(ref, () => ({ getDiffFileInstance: () => diffFile }), [diffFile]);
|
|
@@ -1948,7 +1875,7 @@ const DiffViewWithRef = (props, ref) => {
|
|
|
1948
1875
|
const InnerDiffView = forwardRef(DiffViewWithRef);
|
|
1949
1876
|
InnerDiffView.displayName = "DiffView";
|
|
1950
1877
|
const DiffView = InnerDiffView;
|
|
1951
|
-
const version = "0.0.
|
|
1878
|
+
const version = "0.0.38";
|
|
1952
1879
|
|
|
1953
1880
|
export { DiffModeEnum, DiffView, version };
|
|
1954
1881
|
//# sourceMappingURL=index.mjs.map
|