@git-diff-view/react 0.0.32 → 0.0.33
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 +33 -2
- package/dist/cjs/index.development.js.map +1 -1
- package/dist/cjs/index.production.js +33 -2
- package/dist/cjs/index.production.js.map +1 -1
- package/dist/css/diff-view.css +1 -1
- package/dist/esm/index.mjs +33 -2
- package/dist/esm/index.mjs.map +1 -1
- package/index.d.ts +59 -100
- package/package.json +8 -8
- package/src/components/DiffSplitViewNormal.tsx +7 -0
- package/src/components/DiffSplitViewWrap.tsx +7 -1
- package/src/components/DiffUnifiedView.tsx +7 -1
- package/src/index.ts +2 -0
- package/styles/diff-view.css +1 -1
package/dist/css/diff-view.css
CHANGED
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
--tw-contain-paint: ;
|
|
106
106
|
--tw-contain-style: ;
|
|
107
107
|
}/*
|
|
108
|
-
! tailwindcss v3.4.
|
|
108
|
+
! tailwindcss v3.4.18 | MIT License | https://tailwindcss.com
|
|
109
109
|
*//*
|
|
110
110
|
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
|
|
111
111
|
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
|
package/dist/esm/index.mjs
CHANGED
|
@@ -196,6 +196,25 @@ const getElementRoot = (element) => {
|
|
|
196
196
|
}
|
|
197
197
|
return document;
|
|
198
198
|
};
|
|
199
|
+
const getDiffIdFromElement = (element) => {
|
|
200
|
+
if (element) {
|
|
201
|
+
if (typeof element.closest === "function") {
|
|
202
|
+
const diffRoot = element.closest('[data-component="git-diff-view"]');
|
|
203
|
+
const ele = diffRoot.querySelector(".diff-view-wrapper");
|
|
204
|
+
return ele.getAttribute("id");
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
let el = element;
|
|
208
|
+
while (el) {
|
|
209
|
+
if (el.getAttribute && el.getAttribute("data-component") === "git-diff-view") {
|
|
210
|
+
const ele = el.querySelector(".diff-view-wrapper");
|
|
211
|
+
return ele.getAttribute("id");
|
|
212
|
+
}
|
|
213
|
+
el = el.parentElement;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
};
|
|
199
218
|
|
|
200
219
|
const diffFontSizeName = "--diff-font-size--";
|
|
201
220
|
const diffAsideWidthName = "--diff-aside-width--";
|
|
@@ -922,6 +941,10 @@ const DiffSplitViewNormal = memo(({ diffFile }) => {
|
|
|
922
941
|
removeAllSelection();
|
|
923
942
|
return;
|
|
924
943
|
}
|
|
944
|
+
const id = getDiffIdFromElement(ele);
|
|
945
|
+
if (id && id !== `diff-root${diffFile.getId()}`) {
|
|
946
|
+
return;
|
|
947
|
+
}
|
|
925
948
|
while (ele && ele instanceof HTMLElement) {
|
|
926
949
|
const state = ele.getAttribute("data-state");
|
|
927
950
|
const side = ele.getAttribute("data-side");
|
|
@@ -1261,6 +1284,10 @@ const DiffSplitViewWrap = memo(({ diffFile }) => {
|
|
|
1261
1284
|
removeAllSelection();
|
|
1262
1285
|
return;
|
|
1263
1286
|
}
|
|
1287
|
+
const id = getDiffIdFromElement(ele);
|
|
1288
|
+
if (id && id !== `diff-root${diffFile.getId()}`) {
|
|
1289
|
+
return;
|
|
1290
|
+
}
|
|
1264
1291
|
while (ele && ele instanceof HTMLElement) {
|
|
1265
1292
|
const state = ele.getAttribute("data-state");
|
|
1266
1293
|
const side = ele.getAttribute("data-side");
|
|
@@ -1721,6 +1748,10 @@ const DiffUnifiedView = memo(({ diffFile }) => {
|
|
|
1721
1748
|
removeAllSelection();
|
|
1722
1749
|
return;
|
|
1723
1750
|
}
|
|
1751
|
+
const id = getDiffIdFromElement(ele);
|
|
1752
|
+
if (id && id !== `diff-root${diffFile.getId()}`) {
|
|
1753
|
+
return;
|
|
1754
|
+
}
|
|
1724
1755
|
while (ele && ele instanceof HTMLElement) {
|
|
1725
1756
|
const state = ele.getAttribute("data-state");
|
|
1726
1757
|
if (state) {
|
|
@@ -1837,7 +1868,7 @@ const InternalDiffView = (props) => {
|
|
|
1837
1868
|
}, [useDiffContext, wrapperRef]);
|
|
1838
1869
|
const value = useMemo(() => ({ useDiffContext }), [useDiffContext]);
|
|
1839
1870
|
return (React.createElement(DiffViewContext.Provider, { value: value },
|
|
1840
|
-
React.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-theme": diffFile._getTheme() || "light", "data-version": "0.0.
|
|
1871
|
+
React.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-theme": diffFile._getTheme() || "light", "data-version": "0.0.33", "data-highlighter": diffFile._getHighlighterName(), ref: wrapperRef },
|
|
1841
1872
|
React.createElement("div", { className: "diff-style-root", style: {
|
|
1842
1873
|
// @ts-ignore
|
|
1843
1874
|
[diffFontSizeName]: diffViewFontSize + "px",
|
|
@@ -1916,7 +1947,7 @@ const DiffViewWithRef = (props, ref) => {
|
|
|
1916
1947
|
const InnerDiffView = forwardRef(DiffViewWithRef);
|
|
1917
1948
|
InnerDiffView.displayName = "DiffView";
|
|
1918
1949
|
const DiffView = InnerDiffView;
|
|
1919
|
-
const version = "0.0.
|
|
1950
|
+
const version = "0.0.33";
|
|
1920
1951
|
|
|
1921
1952
|
export { DiffModeEnum, DiffView, version };
|
|
1922
1953
|
//# sourceMappingURL=index.mjs.map
|