@git-diff-view/react 0.0.17 → 0.0.18

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
  } },
@@ -587,17 +591,11 @@ const useSyncHeight = ({ selector, wrapper, side, enable, }) => {
587
591
  ele2.style.height = "auto";
588
592
  const rect1 = ele1.getBoundingClientRect();
589
593
  const rect2 = ele2.getBoundingClientRect();
590
- if (rect1.height !== rect2.height) {
591
- const maxHeight = Math.max(rect1.height, rect2.height);
592
- wrapper1.style.height = maxHeight + "px";
593
- wrapper2.style.height = maxHeight + "px";
594
- wrapper1.setAttribute("data-sync-height", String(maxHeight));
595
- wrapper2.setAttribute("data-sync-height", String(maxHeight));
596
- }
597
- else {
598
- wrapper1.removeAttribute("data-sync-height");
599
- wrapper2.removeAttribute("data-sync-height");
600
- }
594
+ const maxHeight = Math.max(rect1.height, rect2.height);
595
+ wrapper1.style.height = maxHeight + "px";
596
+ wrapper2.style.height = maxHeight + "px";
597
+ wrapper1.setAttribute("data-sync-height", String(maxHeight));
598
+ wrapper2.setAttribute("data-sync-height", String(maxHeight));
601
599
  };
602
600
  cb();
603
601
  const observer = new ResizeObserver(cb);
@@ -641,7 +639,7 @@ const _DiffSplitExtendLine$1 = ({ index, diffFile, oldLineExtend, newLineExtend,
641
639
  data: currentExtend.data,
642
640
  onUpdate: diffFile.notifyAll,
643
641
  }))))) : (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")))));
642
+ React__namespace.createElement("div", { "data-line": `${lineNumber}-extend-content`, "data-side": exports.SplitSide[side] })))));
645
643
  };
646
644
  const DiffSplitExtendLine$1 = ({ index, diffFile, side, lineNumber, }) => {
647
645
  const { useDiffContext } = useDiffViewContext();
@@ -799,7 +797,7 @@ const _DiffSplitWidgetLine$1 = ({ diffFile, side, lineNumber, currentLine, setWi
799
797
  lineNumber: currentLine.lineNumber,
800
798
  onClose: () => setWidget({}),
801
799
  }))))) : (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")))));
800
+ React__namespace.createElement("div", { "data-line": `${lineNumber}-widget-content`, "data-side": exports.SplitSide[side] })))));
803
801
  };
804
802
  const DiffSplitWidgetLine$1 = ({ index, diffFile, side, lineNumber, }) => {
805
803
  const { useWidget } = useDiffWidgetContext();
@@ -1550,7 +1548,7 @@ const _InternalDiffView = (props) => {
1550
1548
  }, [diffFile]);
1551
1549
  const value = React.useMemo(() => ({ useDiffContext }), [useDiffContext]);
1552
1550
  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 },
1551
+ React__namespace.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-theme": diffFile._getTheme() || "light", "data-version": "0.0.18", "data-highlighter": diffFile._getHighlighterName(), ref: wrapperRef },
1554
1552
  React__namespace.createElement("div", { className: "diff-style-root", style: {
1555
1553
  // @ts-ignore
1556
1554
  [diffFontSizeName]: diffViewFontSize + "px",
@@ -1602,7 +1600,8 @@ const DiffViewWithRef = (props, ref) => {
1602
1600
  };
1603
1601
  }
1604
1602
  }, [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]);
1603
+ // fix react strict mode error
1604
+ useUnmount(() => { var _a; return (_a = diffFile === null || diffFile === void 0 ? void 0 : diffFile._destroy) === null || _a === void 0 ? void 0 : _a.call(diffFile); }, [diffFile]);
1606
1605
  React.useImperativeHandle(ref, () => ({ getDiffFileInstance: () => diffFile }), [diffFile]);
1607
1606
  if (!diffFile)
1608
1607
  return null;
@@ -1610,7 +1609,7 @@ const DiffViewWithRef = (props, ref) => {
1610
1609
  };
1611
1610
  const DiffView = React.forwardRef(DiffViewWithRef);
1612
1611
  DiffView.displayName = "DiffView";
1613
- const version = "0.0.17";
1612
+ const version = "0.0.18";
1614
1613
 
1615
1614
  exports.DiffView = DiffView;
1616
1615
  exports.DiffViewContext = DiffViewContext;