@git-diff-view/react 0.0.17 → 0.0.19

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.
@@ -339,6 +339,8 @@ const DiffNoNewLine = () => {
339
339
 
340
340
  const temp = {};
341
341
  const formatStringToCamelCase = (str) => {
342
+ if (str.startsWith("--"))
343
+ return str;
342
344
  const splitted = str.split("-");
343
345
  if (splitted.length === 1)
344
346
  return splitted[0];
@@ -455,7 +457,9 @@ const DiffContent = ({ diffLine, rawLine, syntaxLine, enableWrap, enableHighligh
455
457
  const isAdded = (diffLine === null || diffLine === void 0 ? void 0 : diffLine.type) === core.DiffLineType.Add;
456
458
  const isDelete = (diffLine === null || diffLine === void 0 ? void 0 : diffLine.type) === core.DiffLineType.Delete;
457
459
  const isMaxLineLengthToIgnoreSyntax = ((_a = syntaxLine === null || syntaxLine === void 0 ? void 0 : syntaxLine.nodeList) === null || _a === void 0 ? void 0 : _a.length) > 150;
458
- return (React__namespace.createElement("div", { className: "diff-line-content-item pl-[2.0em]", "data-val": rawLine, style: {
460
+ return (React__namespace.createElement("div", { className: "diff-line-content-item pl-[2.0em]",
461
+ // data-val={rawLine}
462
+ style: {
459
463
  whiteSpace: enableWrap ? "pre-wrap" : "pre",
460
464
  wordBreak: enableWrap ? "break-all" : "initial",
461
465
  } },
@@ -571,43 +575,45 @@ const useDiffViewContext = () => React.useContext(DiffViewContext);
571
575
  const useSyncHeight = ({ selector, wrapper, side, enable, }) => {
572
576
  const { useDiffContext } = useDiffViewContext();
573
577
  const id = useDiffContext(React.useCallback((s) => s.id, []));
574
- useSafeLayout(() => {
578
+ React.useEffect(() => {
575
579
  if (enable) {
576
- const container = document.querySelector(`#diff-root${id}`);
577
- const elements = Array.from((container === null || container === void 0 ? void 0 : container.querySelectorAll(selector)) || []);
578
- const wrappers = wrapper ? Array.from((container === null || container === void 0 ? void 0 : container.querySelectorAll(wrapper)) || []) : elements;
579
- if (elements.length === 2 && wrappers.length === 2) {
580
- const ele1 = elements[0];
581
- const ele2 = elements[1];
582
- const wrapper1 = wrappers[0];
583
- const wrapper2 = wrappers[1];
584
- const target = ele1.getAttribute("data-side") === side ? ele1 : ele2;
585
- const cb = () => {
586
- ele1.style.height = "auto";
587
- ele2.style.height = "auto";
588
- const rect1 = ele1.getBoundingClientRect();
589
- const rect2 = ele2.getBoundingClientRect();
590
- if (rect1.height !== rect2.height) {
580
+ let clean = () => { };
581
+ // fix the dom delay update
582
+ const timer = setTimeout(() => {
583
+ const container = document.querySelector(`#diff-root${id}`);
584
+ const elements = Array.from((container === null || container === void 0 ? void 0 : container.querySelectorAll(selector)) || []);
585
+ const wrappers = wrapper ? Array.from((container === null || container === void 0 ? void 0 : container.querySelectorAll(wrapper)) || []) : elements;
586
+ if (elements.length === 2 && wrappers.length === 2) {
587
+ const ele1 = elements[0];
588
+ const ele2 = elements[1];
589
+ const wrapper1 = wrappers[0];
590
+ const wrapper2 = wrappers[1];
591
+ const target = ele1.getAttribute("data-side") === side ? ele1 : ele2;
592
+ const cb = () => {
593
+ ele1.style.height = "auto";
594
+ ele2.style.height = "auto";
595
+ const rect1 = ele1.getBoundingClientRect();
596
+ const rect2 = ele2.getBoundingClientRect();
591
597
  const maxHeight = Math.max(rect1.height, rect2.height);
592
598
  wrapper1.style.height = maxHeight + "px";
593
599
  wrapper2.style.height = maxHeight + "px";
594
600
  wrapper1.setAttribute("data-sync-height", String(maxHeight));
595
601
  wrapper2.setAttribute("data-sync-height", String(maxHeight));
596
- }
597
- else {
598
- wrapper1.removeAttribute("data-sync-height");
599
- wrapper2.removeAttribute("data-sync-height");
600
- }
601
- };
602
- cb();
603
- const observer = new ResizeObserver(cb);
604
- observer.observe(target);
605
- target.setAttribute("data-observe", "height");
606
- return () => {
607
- observer.disconnect();
608
- target === null || target === void 0 ? void 0 : target.removeAttribute("data-observe");
609
- };
610
- }
602
+ };
603
+ cb();
604
+ const observer = new ResizeObserver(cb);
605
+ observer.observe(target);
606
+ target.setAttribute("data-observe", "height");
607
+ clean = () => {
608
+ observer.disconnect();
609
+ target === null || target === void 0 ? void 0 : target.removeAttribute("data-observe");
610
+ };
611
+ }
612
+ });
613
+ return () => {
614
+ clean();
615
+ clearTimeout(timer);
616
+ };
611
617
  }
612
618
  }, [selector, enable, side, id, wrapper]);
613
619
  };
@@ -619,29 +625,30 @@ const _DiffSplitExtendLine$1 = ({ index, diffFile, oldLineExtend, newLineExtend,
619
625
  const renderExtendLine = useDiffContext.useShallowStableSelector((s) => s.renderExtendLine);
620
626
  const currentExtend = side === exports.SplitSide.old ? oldLineExtend : newLineExtend;
621
627
  const currentLineNumber = side === exports.SplitSide.old ? oldLine.lineNumber : newLine.lineNumber;
628
+ const hasExtend = (currentExtend === null || currentExtend === void 0 ? void 0 : currentExtend.data) !== undefined && (currentExtend === null || currentExtend === void 0 ? void 0 : currentExtend.data) !== null;
629
+ const currentExtendRendered = hasExtend &&
630
+ (renderExtendLine === null || renderExtendLine === void 0 ? void 0 : renderExtendLine({
631
+ diffFile,
632
+ side,
633
+ lineNumber: currentLineNumber,
634
+ data: currentExtend.data,
635
+ onUpdate: diffFile.notifyAll,
636
+ }));
622
637
  useSyncHeight({
623
638
  selector: `div[data-line="${lineNumber}-extend-content"]`,
624
639
  wrapper: `tr[data-line="${lineNumber}-extend"]`,
625
640
  side: exports.SplitSide[side],
626
- enable: !!(currentExtend === null || currentExtend === void 0 ? void 0 : currentExtend.data) && typeof renderExtendLine === "function",
641
+ enable: hasExtend && typeof renderExtendLine === "function",
627
642
  });
628
643
  const width = useDomWidth({
629
644
  selector: side === exports.SplitSide.old ? ".old-diff-table-wrapper" : ".new-diff-table-wrapper",
630
- enable: !!(currentExtend === null || currentExtend === void 0 ? void 0 : currentExtend.data) && typeof renderExtendLine === "function",
645
+ enable: hasExtend && typeof renderExtendLine === "function",
631
646
  });
632
647
  if (!renderExtendLine)
633
648
  return null;
634
- return (React__namespace.createElement("tr", { "data-line": `${lineNumber}-extend`, "data-state": "extend", "data-side": exports.SplitSide[side], className: "diff-line diff-line-extend" }, currentExtend ? (React__namespace.createElement("td", { className: `diff-line-extend-${exports.SplitSide[side]}-content p-0`, colSpan: 2 },
635
- React__namespace.createElement("div", { "data-line": `${lineNumber}-extend-content`, "data-side": exports.SplitSide[side], className: "diff-line-extend-wrapper sticky left-0", style: { width } }, width > 0 &&
636
- (currentExtend === null || currentExtend === void 0 ? void 0 : currentExtend.data) &&
637
- (renderExtendLine === null || renderExtendLine === void 0 ? void 0 : renderExtendLine({
638
- diffFile,
639
- side,
640
- lineNumber: currentLineNumber,
641
- data: currentExtend.data,
642
- onUpdate: diffFile.notifyAll,
643
- }))))) : (React__namespace.createElement("td", { className: `diff-line-extend-${exports.SplitSide[side]}-placeholder select-none p-0`, style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
644
- React__namespace.createElement("div", { "data-line": `${lineNumber}-extend-content`, "data-side": exports.SplitSide[side] }, "\u2002")))));
649
+ return (React__namespace.createElement("tr", { "data-line": `${lineNumber}-extend`, "data-state": "extend", "data-side": exports.SplitSide[side], className: "diff-line diff-line-extend" }, hasExtend ? (React__namespace.createElement("td", { className: `diff-line-extend-${exports.SplitSide[side]}-content p-0`, colSpan: 2 },
650
+ React__namespace.createElement("div", { "data-line": `${lineNumber}-extend-content`, "data-side": exports.SplitSide[side], className: "diff-line-extend-wrapper sticky left-0", style: { width } }, width > 0 && currentExtendRendered))) : (React__namespace.createElement("td", { className: `diff-line-extend-${exports.SplitSide[side]}-placeholder select-none p-0`, style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
651
+ React__namespace.createElement("div", { "data-line": `${lineNumber}-extend-content`, "data-side": exports.SplitSide[side] })))));
645
652
  };
646
653
  const DiffSplitExtendLine$1 = ({ index, diffFile, side, lineNumber, }) => {
647
654
  const { useDiffContext } = useDiffViewContext();
@@ -779,11 +786,18 @@ const DiffSplitHunkLine$1 = ({ index, diffFile, side, lineNumber, }) => {
779
786
  const _DiffSplitWidgetLine$1 = ({ diffFile, side, lineNumber, currentLine, setWidget, currentWidget, }) => {
780
787
  const { useDiffContext } = useDiffViewContext();
781
788
  const renderWidgetLine = useDiffContext.useShallowStableSelector((s) => s.renderWidgetLine);
789
+ const currentWidgetRendered = currentWidget &&
790
+ (renderWidgetLine === null || renderWidgetLine === void 0 ? void 0 : renderWidgetLine({
791
+ diffFile,
792
+ side,
793
+ lineNumber: currentLine.lineNumber,
794
+ onClose: () => setWidget({}),
795
+ }));
782
796
  useSyncHeight({
783
797
  selector: `div[data-line="${lineNumber}-widget-content"]`,
784
798
  wrapper: `tr[data-line="${lineNumber}-widget"]`,
785
799
  side: exports.SplitSide[side],
786
- enable: currentWidget && typeof renderWidgetLine === "function",
800
+ enable: !!currentWidget && typeof renderWidgetLine === "function",
787
801
  });
788
802
  const width = useDomWidth({
789
803
  selector: side === exports.SplitSide.old ? ".old-diff-table-wrapper" : ".new-diff-table-wrapper",
@@ -792,14 +806,8 @@ const _DiffSplitWidgetLine$1 = ({ diffFile, side, lineNumber, currentLine, setWi
792
806
  if (!renderWidgetLine)
793
807
  return null;
794
808
  return (React__namespace.createElement("tr", { "data-line": `${lineNumber}-widget`, "data-state": "widget", "data-side": exports.SplitSide[side], className: "diff-line diff-line-widget" }, currentWidget ? (React__namespace.createElement("td", { className: `diff-line-widget-${exports.SplitSide[side]}-content p-0`, colSpan: 2 },
795
- React__namespace.createElement("div", { "data-line": `${lineNumber}-widget-content`, "data-side": exports.SplitSide[side], className: "diff-line-widget-wrapper sticky left-0", style: { width } }, width > 0 &&
796
- (renderWidgetLine === null || renderWidgetLine === void 0 ? void 0 : renderWidgetLine({
797
- diffFile,
798
- side,
799
- lineNumber: currentLine.lineNumber,
800
- onClose: () => setWidget({}),
801
- }))))) : (React__namespace.createElement("td", { className: `diff-line-widget-${exports.SplitSide[side]}-placeholder p-0`, style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
802
- React__namespace.createElement("div", { "data-line": `${lineNumber}-widget-content`, "data-side": exports.SplitSide[side] }, "\u2002")))));
809
+ React__namespace.createElement("div", { "data-line": `${lineNumber}-widget-content`, "data-side": exports.SplitSide[side], className: "diff-line-widget-wrapper sticky left-0", style: { width } }, width > 0 && currentWidgetRendered))) : (React__namespace.createElement("td", { className: `diff-line-widget-${exports.SplitSide[side]}-placeholder p-0`, style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
810
+ React__namespace.createElement("div", { "data-line": `${lineNumber}-widget-content`, "data-side": exports.SplitSide[side] })))));
803
811
  };
804
812
  const DiffSplitWidgetLine$1 = ({ index, diffFile, side, lineNumber, }) => {
805
813
  const { useWidget } = useDiffWidgetContext();
@@ -955,27 +963,27 @@ const _DiffSplitExtendLine = ({ index, diffFile, lineNumber, oldLineExtend, newL
955
963
  const renderExtendLine = useDiffContext.useShallowStableSelector((s) => s.renderExtendLine);
956
964
  if (!renderExtendLine)
957
965
  return null;
966
+ const oldExtendRendered = (oldLineExtend === null || oldLineExtend === void 0 ? void 0 : oldLineExtend.data) &&
967
+ (renderExtendLine === null || renderExtendLine === void 0 ? void 0 : renderExtendLine({
968
+ diffFile,
969
+ side: exports.SplitSide.old,
970
+ lineNumber: oldLine.lineNumber,
971
+ data: oldLineExtend.data,
972
+ onUpdate: diffFile.notifyAll,
973
+ }));
974
+ const newExtendRendered = (newLineExtend === null || newLineExtend === void 0 ? void 0 : newLineExtend.data) &&
975
+ (renderExtendLine === null || renderExtendLine === void 0 ? void 0 : renderExtendLine({
976
+ diffFile,
977
+ side: exports.SplitSide.new,
978
+ lineNumber: newLine.lineNumber,
979
+ data: newLineExtend.data,
980
+ onUpdate: diffFile.notifyAll,
981
+ }));
958
982
  return (React__namespace.createElement("tr", { "data-line": `${lineNumber}-extend`, "data-state": "extend", className: "diff-line diff-line-extend" },
959
- oldLineExtend ? (React__namespace.createElement("td", { className: "diff-line-extend-old-content p-0", colSpan: 2 },
960
- React__namespace.createElement("div", { className: "diff-line-extend-wrapper" }, (oldLineExtend === null || oldLineExtend === void 0 ? void 0 : oldLineExtend.data) &&
961
- (renderExtendLine === null || renderExtendLine === void 0 ? void 0 : renderExtendLine({
962
- diffFile,
963
- side: exports.SplitSide.old,
964
- lineNumber: oldLine.lineNumber,
965
- data: oldLineExtend.data,
966
- onUpdate: diffFile.notifyAll,
967
- }))))) : (React__namespace.createElement("td", { className: "diff-line-extend-old-placeholder select-none p-0", style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
968
- React__namespace.createElement("span", null, "\u2002"))),
969
- newLineExtend ? (React__namespace.createElement("td", { className: "diff-line-extend-new-content border-l-[1px] p-0", style: { borderLeftColor: `var(${borderColorName})` }, colSpan: 2 },
970
- React__namespace.createElement("div", { className: "diff-line-extend-wrapper" }, (newLineExtend === null || newLineExtend === void 0 ? void 0 : newLineExtend.data) &&
971
- (renderExtendLine === null || renderExtendLine === void 0 ? void 0 : renderExtendLine({
972
- diffFile,
973
- side: exports.SplitSide.new,
974
- lineNumber: newLine.lineNumber,
975
- data: newLineExtend.data,
976
- onUpdate: diffFile.notifyAll,
977
- }))))) : (React__namespace.createElement("td", { className: "diff-line-extend-new-placeholder select-none border-l-[1px] p-0", style: { backgroundColor: `var(${emptyBGName})`, borderLeftColor: `var(${borderColorName})` }, colSpan: 2 },
978
- React__namespace.createElement("span", null, "\u2002")))));
983
+ oldExtendRendered ? (React__namespace.createElement("td", { className: "diff-line-extend-old-content p-0", colSpan: 2 },
984
+ React__namespace.createElement("div", { className: "diff-line-extend-wrapper" }, oldExtendRendered))) : (React__namespace.createElement("td", { className: "diff-line-extend-old-placeholder select-none p-0", style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 }, newExtendRendered && React__namespace.createElement("span", null, "\u2002"))),
985
+ newExtendRendered ? (React__namespace.createElement("td", { className: "diff-line-extend-new-content border-l-[1px] p-0", style: { borderLeftColor: `var(${borderColorName})` }, colSpan: 2 },
986
+ React__namespace.createElement("div", { className: "diff-line-extend-wrapper" }, newExtendRendered))) : (React__namespace.createElement("td", { className: "diff-line-extend-new-placeholder select-none border-l-[1px] p-0", style: { backgroundColor: `var(${emptyBGName})`, borderLeftColor: `var(${borderColorName})` }, colSpan: 2 }, oldExtendRendered && React__namespace.createElement("span", null, "\u2002")))));
979
987
  };
980
988
  const DiffSplitExtendLine = ({ index, diffFile, lineNumber, }) => {
981
989
  const { useDiffContext } = useDiffViewContext();
@@ -1097,25 +1105,17 @@ const _DiffSplitWidgetLine = ({ index, diffFile, lineNumber, oldLineWidget, newL
1097
1105
  const renderWidgetLine = useDiffContext.useShallowStableSelector((s) => s.renderWidgetLine);
1098
1106
  const oldLine = diffFile.getSplitLeftLine(index);
1099
1107
  const newLine = diffFile.getSplitRightLine(index);
1108
+ const oldWidgetRendered = oldLineWidget &&
1109
+ (renderWidgetLine === null || renderWidgetLine === void 0 ? void 0 : renderWidgetLine({ diffFile, side: exports.SplitSide.old, lineNumber: oldLine.lineNumber, onClose: () => setWidget({}) }));
1110
+ const newWidgetRendered = newLineWidget &&
1111
+ (renderWidgetLine === null || renderWidgetLine === void 0 ? void 0 : renderWidgetLine({ diffFile, side: exports.SplitSide.new, lineNumber: newLine.lineNumber, onClose: () => setWidget({}) }));
1100
1112
  if (!renderWidgetLine)
1101
1113
  return null;
1102
1114
  return (React__namespace.createElement("tr", { "data-line": `${lineNumber}-widget`, "data-state": "widget", className: "diff-line diff-line-widget" },
1103
- oldLineWidget ? (React__namespace.createElement("td", { className: "diff-line-widget-old-content p-0", colSpan: 2 },
1104
- React__namespace.createElement("div", { className: "diff-line-widget-wrapper" }, renderWidgetLine === null || renderWidgetLine === void 0 ? void 0 : renderWidgetLine({
1105
- diffFile,
1106
- side: exports.SplitSide.old,
1107
- lineNumber: oldLine.lineNumber,
1108
- onClose: () => setWidget({}),
1109
- })))) : (React__namespace.createElement("td", { className: "diff-line-widget-old-placeholder select-none p-0", style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
1110
- React__namespace.createElement("span", null, "\u2002"))),
1111
- newLineWidget ? (React__namespace.createElement("td", { className: "diff-line-widget-new-content border-l-[1px] p-0", colSpan: 2, style: { borderLeftColor: `var(${borderColorName})` } },
1112
- React__namespace.createElement("div", { className: "diff-line-widget-wrapper" }, renderWidgetLine === null || renderWidgetLine === void 0 ? void 0 : renderWidgetLine({
1113
- diffFile,
1114
- side: exports.SplitSide.new,
1115
- lineNumber: newLine.lineNumber,
1116
- onClose: () => setWidget({}),
1117
- })))) : (React__namespace.createElement("td", { className: "diff-line-widget-new-placeholder select-none border-l-[1px] p-0", style: { backgroundColor: `var(${emptyBGName})`, borderLeftColor: `var(${borderColorName})` }, colSpan: 2 },
1118
- React__namespace.createElement("span", null, "\u2002")))));
1115
+ oldWidgetRendered ? (React__namespace.createElement("td", { className: "diff-line-widget-old-content p-0", colSpan: 2 },
1116
+ React__namespace.createElement("div", { className: "diff-line-widget-wrapper" }, oldWidgetRendered))) : (React__namespace.createElement("td", { className: "diff-line-widget-old-placeholder select-none p-0", style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 }, newWidgetRendered && React__namespace.createElement("span", null, "\u2002"))),
1117
+ newWidgetRendered ? (React__namespace.createElement("td", { className: "diff-line-widget-new-content border-l-[1px] p-0", colSpan: 2, style: { borderLeftColor: `var(${borderColorName})` } },
1118
+ React__namespace.createElement("div", { className: "diff-line-widget-wrapper" }, newWidgetRendered))) : (React__namespace.createElement("td", { className: "diff-line-widget-new-placeholder select-none border-l-[1px] p-0", style: { backgroundColor: `var(${emptyBGName})`, borderLeftColor: `var(${borderColorName})` }, colSpan: 2 }, oldWidgetRendered && React__namespace.createElement("span", null, "\u2002")))));
1119
1119
  };
1120
1120
  const DiffSplitWidgetLine = ({ index, diffFile, lineNumber, }) => {
1121
1121
  const { useWidget } = useDiffWidgetContext();
@@ -1327,7 +1327,8 @@ const _DiffUnifiedExtendLine = ({ index, diffFile, lineNumber, oldLineExtend, ne
1327
1327
  React__namespace.createElement("td", { className: "diff-line-extend-content p-0 align-top", colSpan: 2 },
1328
1328
  React__namespace.createElement("div", { className: "diff-line-extend-wrapper sticky left-0", style: { width } },
1329
1329
  width > 0 &&
1330
- (oldLineExtend === null || oldLineExtend === void 0 ? void 0 : oldLineExtend.data) &&
1330
+ (oldLineExtend === null || oldLineExtend === void 0 ? void 0 : oldLineExtend.data) !== undefined &&
1331
+ (oldLineExtend === null || oldLineExtend === void 0 ? void 0 : oldLineExtend.data) !== null &&
1331
1332
  (renderExtendLine === null || renderExtendLine === void 0 ? void 0 : renderExtendLine({
1332
1333
  diffFile,
1333
1334
  side: exports.SplitSide.old,
@@ -1336,7 +1337,8 @@ const _DiffUnifiedExtendLine = ({ index, diffFile, lineNumber, oldLineExtend, ne
1336
1337
  onUpdate: diffFile.notifyAll,
1337
1338
  })),
1338
1339
  width > 0 &&
1339
- (newLineExtend === null || newLineExtend === void 0 ? void 0 : newLineExtend.data) &&
1340
+ (newLineExtend === null || newLineExtend === void 0 ? void 0 : newLineExtend.data) !== undefined &&
1341
+ (newLineExtend === null || newLineExtend === void 0 ? void 0 : newLineExtend.data) !== null &&
1340
1342
  (renderExtendLine === null || renderExtendLine === void 0 ? void 0 : renderExtendLine({
1341
1343
  diffFile,
1342
1344
  side: exports.SplitSide.new,
@@ -1543,14 +1545,15 @@ const _InternalDiffView = (props) => {
1543
1545
  ]);
1544
1546
  React.useEffect(() => {
1545
1547
  const cb = diffFile.subscribe(() => {
1546
- var _a;
1548
+ var _a, _b;
1547
1549
  (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.setAttribute("data-theme", diffFile._getTheme() || "light");
1550
+ (_b = wrapperRef.current) === null || _b === void 0 ? void 0 : _b.setAttribute("data-highlighter", diffFile._getHighlighterName());
1548
1551
  });
1549
1552
  return cb;
1550
1553
  }, [diffFile]);
1551
1554
  const value = React.useMemo(() => ({ useDiffContext }), [useDiffContext]);
1552
1555
  return (React__namespace.createElement(DiffViewContext.Provider, { value: value },
1553
- React__namespace.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-theme": diffFile._getTheme() || "light", "data-version": "0.0.17", "data-highlighter": diffFile._getHighlighterName(), ref: wrapperRef },
1556
+ React__namespace.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-theme": diffFile._getTheme() || "light", "data-version": "0.0.19", "data-highlighter": diffFile._getHighlighterName(), ref: wrapperRef },
1554
1557
  React__namespace.createElement("div", { className: "diff-style-root", style: {
1555
1558
  // @ts-ignore
1556
1559
  [diffFontSizeName]: diffViewFontSize + "px",
@@ -1564,6 +1567,9 @@ const DiffViewWithRef = (props, ref) => {
1564
1567
  const diffFile = React.useMemo(() => {
1565
1568
  var _a, _b, _c, _d, _e, _f;
1566
1569
  if (_diffFile) {
1570
+ // missing data for plain file render
1571
+ // TODO next release update ?
1572
+ // will cause more complex for diffFile flow control, keep current
1567
1573
  const diffFile = core.DiffFile.createInstance({});
1568
1574
  diffFile._mergeFullBundle(_diffFile._getFullBundle());
1569
1575
  return diffFile;
@@ -1578,6 +1584,14 @@ const DiffViewWithRef = (props, ref) => {
1578
1584
  (_b = (_a = diffFileRef.current).clear) === null || _b === void 0 ? void 0 : _b.call(_a);
1579
1585
  diffFileRef.current = diffFile;
1580
1586
  }
1587
+ React.useEffect(() => {
1588
+ if (_diffFile && diffFile) {
1589
+ _diffFile._addClonedInstance(diffFile);
1590
+ return () => {
1591
+ _diffFile._delClonedInstance(diffFile);
1592
+ };
1593
+ }
1594
+ }, [diffFile, _diffFile]);
1581
1595
  React.useEffect(() => {
1582
1596
  if (!diffFile)
1583
1597
  return;
@@ -1594,15 +1608,8 @@ const DiffViewWithRef = (props, ref) => {
1594
1608
  diffFile.notifyAll();
1595
1609
  }
1596
1610
  }, [diffFile, props.diffViewHighlight, registerHighlighter, diffViewTheme]);
1597
- React.useEffect(() => {
1598
- if (_diffFile && diffFile) {
1599
- _diffFile._addClonedInstance(diffFile);
1600
- return () => {
1601
- _diffFile._delClonedInstance(diffFile);
1602
- };
1603
- }
1604
- }, [diffFile, _diffFile]);
1605
- useUnmount(() => { var _a; return (_a = diffFile === null || diffFile === void 0 ? void 0 : diffFile.clear) === null || _a === void 0 ? void 0 : _a.call(diffFile); }, [diffFile]);
1611
+ // fix react strict mode error
1612
+ useUnmount(() => { var _b; return ((_b = diffFile === null || diffFile === void 0 ? void 0 : diffFile.clear) === null || _b === void 0 ? void 0 : _b.call(diffFile)); }, [diffFile]);
1606
1613
  React.useImperativeHandle(ref, () => ({ getDiffFileInstance: () => diffFile }), [diffFile]);
1607
1614
  if (!diffFile)
1608
1615
  return null;
@@ -1610,7 +1617,7 @@ const DiffViewWithRef = (props, ref) => {
1610
1617
  };
1611
1618
  const DiffView = React.forwardRef(DiffViewWithRef);
1612
1619
  DiffView.displayName = "DiffView";
1613
- const version = "0.0.17";
1620
+ const version = "0.0.19";
1614
1621
 
1615
1622
  exports.DiffView = DiffView;
1616
1623
  exports.DiffViewContext = DiffViewContext;