@git-diff-view/react 0.0.32 → 0.0.34
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 +34 -2
- package/dist/cjs/index.development.js.map +1 -1
- package/dist/cjs/index.production.js +34 -2
- package/dist/cjs/index.production.js.map +1 -1
- package/dist/css/diff-view.css +1 -1
- package/dist/esm/index.mjs +34 -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,26 @@ const getElementRoot = (element) => {
|
|
|
196
196
|
}
|
|
197
197
|
return document;
|
|
198
198
|
};
|
|
199
|
+
const getDiffIdFromElement = (element) => {
|
|
200
|
+
var _a, _b;
|
|
201
|
+
if (element) {
|
|
202
|
+
if (typeof element.closest === "function") {
|
|
203
|
+
const diffRoot = element.closest('[data-component="git-diff-view"]');
|
|
204
|
+
const ele = (_a = diffRoot === null || diffRoot === void 0 ? void 0 : diffRoot.querySelector) === null || _a === void 0 ? void 0 : _a.call(diffRoot, ".diff-view-wrapper");
|
|
205
|
+
return (_b = ele === null || ele === void 0 ? void 0 : ele.getAttribute) === null || _b === void 0 ? void 0 : _b.call(ele, "id");
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
let el = element;
|
|
209
|
+
while (el) {
|
|
210
|
+
if (el.getAttribute && el.getAttribute("data-component") === "git-diff-view") {
|
|
211
|
+
const ele = el.querySelector(".diff-view-wrapper");
|
|
212
|
+
return ele.getAttribute("id");
|
|
213
|
+
}
|
|
214
|
+
el = el.parentElement;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
};
|
|
199
219
|
|
|
200
220
|
const diffFontSizeName = "--diff-font-size--";
|
|
201
221
|
const diffAsideWidthName = "--diff-aside-width--";
|
|
@@ -922,6 +942,10 @@ const DiffSplitViewNormal = memo(({ diffFile }) => {
|
|
|
922
942
|
removeAllSelection();
|
|
923
943
|
return;
|
|
924
944
|
}
|
|
945
|
+
const id = getDiffIdFromElement(ele);
|
|
946
|
+
if (id && id !== `diff-root${diffFile.getId()}`) {
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
925
949
|
while (ele && ele instanceof HTMLElement) {
|
|
926
950
|
const state = ele.getAttribute("data-state");
|
|
927
951
|
const side = ele.getAttribute("data-side");
|
|
@@ -1261,6 +1285,10 @@ const DiffSplitViewWrap = memo(({ diffFile }) => {
|
|
|
1261
1285
|
removeAllSelection();
|
|
1262
1286
|
return;
|
|
1263
1287
|
}
|
|
1288
|
+
const id = getDiffIdFromElement(ele);
|
|
1289
|
+
if (id && id !== `diff-root${diffFile.getId()}`) {
|
|
1290
|
+
return;
|
|
1291
|
+
}
|
|
1264
1292
|
while (ele && ele instanceof HTMLElement) {
|
|
1265
1293
|
const state = ele.getAttribute("data-state");
|
|
1266
1294
|
const side = ele.getAttribute("data-side");
|
|
@@ -1721,6 +1749,10 @@ const DiffUnifiedView = memo(({ diffFile }) => {
|
|
|
1721
1749
|
removeAllSelection();
|
|
1722
1750
|
return;
|
|
1723
1751
|
}
|
|
1752
|
+
const id = getDiffIdFromElement(ele);
|
|
1753
|
+
if (id && id !== `diff-root${diffFile.getId()}`) {
|
|
1754
|
+
return;
|
|
1755
|
+
}
|
|
1724
1756
|
while (ele && ele instanceof HTMLElement) {
|
|
1725
1757
|
const state = ele.getAttribute("data-state");
|
|
1726
1758
|
if (state) {
|
|
@@ -1837,7 +1869,7 @@ const InternalDiffView = (props) => {
|
|
|
1837
1869
|
}, [useDiffContext, wrapperRef]);
|
|
1838
1870
|
const value = useMemo(() => ({ useDiffContext }), [useDiffContext]);
|
|
1839
1871
|
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.
|
|
1872
|
+
React.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-theme": diffFile._getTheme() || "light", "data-version": "0.0.34", "data-highlighter": diffFile._getHighlighterName(), ref: wrapperRef },
|
|
1841
1873
|
React.createElement("div", { className: "diff-style-root", style: {
|
|
1842
1874
|
// @ts-ignore
|
|
1843
1875
|
[diffFontSizeName]: diffViewFontSize + "px",
|
|
@@ -1916,7 +1948,7 @@ const DiffViewWithRef = (props, ref) => {
|
|
|
1916
1948
|
const InnerDiffView = forwardRef(DiffViewWithRef);
|
|
1917
1949
|
InnerDiffView.displayName = "DiffView";
|
|
1918
1950
|
const DiffView = InnerDiffView;
|
|
1919
|
-
const version = "0.0.
|
|
1951
|
+
const version = "0.0.34";
|
|
1920
1952
|
|
|
1921
1953
|
export { DiffModeEnum, DiffView, version };
|
|
1922
1954
|
//# sourceMappingURL=index.mjs.map
|