react-diff-viewer-continued 4.0.6 → 4.1.1
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/.claude/settings.local.json +21 -0
- package/.github/workflows/publish.yml +48 -0
- package/.github/workflows/release.yml +23 -8
- package/CHANGELOG.md +20 -0
- package/README.md +147 -29
- package/lib/cjs/src/compute-hidden-blocks.js +1 -4
- package/lib/cjs/src/compute-lines.d.ts +27 -3
- package/lib/cjs/src/compute-lines.js +330 -51
- package/lib/cjs/src/computeWorker.d.ts +1 -0
- package/lib/cjs/src/computeWorker.js +10 -0
- package/lib/cjs/src/expand.js +3 -6
- package/lib/cjs/src/fold.js +3 -6
- package/lib/cjs/src/index.d.ts +111 -2
- package/lib/cjs/src/index.js +737 -130
- package/lib/cjs/src/styles.d.ts +3 -0
- package/lib/cjs/src/styles.js +68 -29
- package/lib/esm/src/compute-lines.js +325 -10
- package/lib/esm/src/computeWorker.js +10 -0
- package/lib/esm/src/index.js +696 -52
- package/lib/esm/src/styles.js +65 -21
- package/package.json +32 -32
- package/playwright-report/index.html +76 -0
- package/publish-examples.sh +0 -0
- package/test-results/.last-run.json +4 -0
- package/tsconfig.json +1 -1
package/lib/esm/src/styles.js
CHANGED
|
@@ -36,15 +36,15 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
36
36
|
...{
|
|
37
37
|
diffViewerBackground: "#2e303c",
|
|
38
38
|
diffViewerColor: "#FFF",
|
|
39
|
-
addedBackground: "#
|
|
39
|
+
addedBackground: "#2ea04326",
|
|
40
40
|
addedColor: "white",
|
|
41
|
-
removedBackground: "#
|
|
41
|
+
removedBackground: "#f851491a",
|
|
42
42
|
removedColor: "white",
|
|
43
43
|
changedBackground: "#3e302c",
|
|
44
|
-
wordAddedBackground: "#
|
|
45
|
-
wordRemovedBackground: "#
|
|
46
|
-
addedGutterBackground: "#
|
|
47
|
-
removedGutterBackground: "#
|
|
44
|
+
wordAddedBackground: "#2ea04366",
|
|
45
|
+
wordRemovedBackground: "#f8514966",
|
|
46
|
+
addedGutterBackground: "#3fb9504d",
|
|
47
|
+
removedGutterBackground: "#f851494d",
|
|
48
48
|
gutterBackground: "#2c2f3a",
|
|
49
49
|
gutterBackgroundDark: "#262933",
|
|
50
50
|
highlightBackground: "#2a3967",
|
|
@@ -52,12 +52,12 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
52
52
|
codeFoldGutterBackground: "#262831",
|
|
53
53
|
codeFoldBackground: "#262831",
|
|
54
54
|
emptyLineBackground: "#363946",
|
|
55
|
-
gutterColor: "#
|
|
56
|
-
addedGutterColor: "#
|
|
57
|
-
removedGutterColor: "#
|
|
58
|
-
codeFoldContentColor: "#
|
|
55
|
+
gutterColor: "#f0f6fc",
|
|
56
|
+
addedGutterColor: "#f0f6fc",
|
|
57
|
+
removedGutterColor: "#f0f6fc",
|
|
58
|
+
codeFoldContentColor: "#9198a1",
|
|
59
59
|
diffViewerTitleBackground: "#2f323e",
|
|
60
|
-
diffViewerTitleColor: "#
|
|
60
|
+
diffViewerTitleColor: "#f0f6fc",
|
|
61
61
|
diffViewerTitleBorderColor: "#353846",
|
|
62
62
|
},
|
|
63
63
|
...(overrideVariables.dark || {}),
|
|
@@ -67,11 +67,18 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
67
67
|
const { css, cx } = createEmotion({ key: "react-diff", nonce });
|
|
68
68
|
const content = css({
|
|
69
69
|
width: "auto",
|
|
70
|
+
overflow: "hidden",
|
|
70
71
|
label: "content",
|
|
71
72
|
});
|
|
72
73
|
const splitView = css({
|
|
73
74
|
label: "split-view",
|
|
74
75
|
});
|
|
76
|
+
const stickyHeader = css({
|
|
77
|
+
position: "sticky",
|
|
78
|
+
top: 0,
|
|
79
|
+
zIndex: 2,
|
|
80
|
+
label: "sticky-header",
|
|
81
|
+
});
|
|
75
82
|
const summary = css({
|
|
76
83
|
background: variables.diffViewerTitleBackground,
|
|
77
84
|
color: variables.diffViewerTitleColor,
|
|
@@ -80,13 +87,19 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
80
87
|
alignItems: "center",
|
|
81
88
|
gap: "0.5em",
|
|
82
89
|
fontFamily: "monospace",
|
|
90
|
+
fontSize: 12,
|
|
83
91
|
fill: variables.diffViewerTitleColor,
|
|
84
92
|
});
|
|
93
|
+
const columnHeaders = css({
|
|
94
|
+
display: "flex",
|
|
95
|
+
label: "column-headers",
|
|
96
|
+
});
|
|
85
97
|
const diffContainer = css({
|
|
86
98
|
width: "100%",
|
|
87
99
|
minWidth: "1000px",
|
|
88
100
|
overflowX: "auto",
|
|
89
101
|
tableLayout: "fixed",
|
|
102
|
+
fontSize: 12,
|
|
90
103
|
background: variables.diffViewerBackground,
|
|
91
104
|
pre: {
|
|
92
105
|
margin: 0,
|
|
@@ -96,6 +109,9 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
96
109
|
},
|
|
97
110
|
label: "diff-container",
|
|
98
111
|
borderCollapse: "collapse",
|
|
112
|
+
"@media (max-width: 768px)": {
|
|
113
|
+
minWidth: "unset",
|
|
114
|
+
},
|
|
99
115
|
});
|
|
100
116
|
const lineContent = css({
|
|
101
117
|
overflow: "hidden",
|
|
@@ -113,6 +129,16 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
113
129
|
userSelect: "none",
|
|
114
130
|
label: "unselectable",
|
|
115
131
|
});
|
|
132
|
+
const noWrap = css({
|
|
133
|
+
label: "no-wrap",
|
|
134
|
+
pre: {
|
|
135
|
+
whiteSpace: "pre",
|
|
136
|
+
},
|
|
137
|
+
[`.${contentText}`]: {
|
|
138
|
+
whiteSpace: "pre",
|
|
139
|
+
lineBreak: "auto",
|
|
140
|
+
},
|
|
141
|
+
});
|
|
116
142
|
const allExpandButton = css({
|
|
117
143
|
background: "transparent",
|
|
118
144
|
border: "none",
|
|
@@ -137,8 +163,13 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
137
163
|
overflow: "hidden",
|
|
138
164
|
width: "50%",
|
|
139
165
|
borderBottom: `1px solid ${variables.diffViewerTitleBorderColor}`,
|
|
166
|
+
boxSizing: "border-box",
|
|
167
|
+
fontSize: 12,
|
|
140
168
|
label: "title-block",
|
|
141
|
-
":
|
|
169
|
+
":only-child": {
|
|
170
|
+
width: "100%",
|
|
171
|
+
},
|
|
172
|
+
":last-child:not(:only-child)": {
|
|
142
173
|
borderLeft: `1px solid ${variables.diffViewerTitleBorderColor}`,
|
|
143
174
|
},
|
|
144
175
|
[`.${contentText}`]: {
|
|
@@ -179,20 +210,16 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
179
210
|
label: "diff-changed",
|
|
180
211
|
});
|
|
181
212
|
const wordDiff = css({
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
borderRadius: 4,
|
|
185
|
-
wordBreak: "break-all",
|
|
213
|
+
display: "inline",
|
|
214
|
+
textDecoration: "none",
|
|
186
215
|
label: "word-diff",
|
|
187
216
|
});
|
|
188
217
|
const wordAdded = css({
|
|
189
218
|
background: variables.wordAddedBackground,
|
|
190
|
-
textDecoration: "none",
|
|
191
219
|
label: "word-added",
|
|
192
220
|
});
|
|
193
221
|
const wordRemoved = css({
|
|
194
222
|
background: variables.wordRemovedBackground,
|
|
195
|
-
textDecoration: "none",
|
|
196
223
|
label: "word-removed",
|
|
197
224
|
});
|
|
198
225
|
const codeFoldGutter = css({
|
|
@@ -200,6 +227,8 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
200
227
|
label: "code-fold-gutter",
|
|
201
228
|
minWidth: "50px",
|
|
202
229
|
width: "50px",
|
|
230
|
+
textAlign: "center",
|
|
231
|
+
fill: variables.codeFoldContentColor,
|
|
203
232
|
});
|
|
204
233
|
const codeFoldContentContainer = css({
|
|
205
234
|
padding: "",
|
|
@@ -210,6 +239,7 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
210
239
|
display: "inline",
|
|
211
240
|
margin: 0,
|
|
212
241
|
border: "none",
|
|
242
|
+
fill: variables.codeFoldContentColor,
|
|
213
243
|
label: "code-fold-expand-button",
|
|
214
244
|
});
|
|
215
245
|
const codeFoldContent = css({
|
|
@@ -234,12 +264,20 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
234
264
|
});
|
|
235
265
|
const codeFold = css({
|
|
236
266
|
backgroundColor: variables.codeFoldBackground,
|
|
237
|
-
|
|
238
|
-
fontSize: 14,
|
|
267
|
+
fontSize: 12,
|
|
239
268
|
alignItems: "center",
|
|
240
269
|
userSelect: "none",
|
|
241
270
|
fontWeight: 700,
|
|
271
|
+
cursor: "pointer",
|
|
242
272
|
label: "code-fold",
|
|
273
|
+
"&:hover": {
|
|
274
|
+
color: variables.diffViewerColor,
|
|
275
|
+
fill: variables.diffViewerColor,
|
|
276
|
+
"& *": {
|
|
277
|
+
color: variables.diffViewerColor,
|
|
278
|
+
fill: variables.diffViewerColor,
|
|
279
|
+
},
|
|
280
|
+
},
|
|
243
281
|
a: {
|
|
244
282
|
textDecoration: "underline !important",
|
|
245
283
|
cursor: "pointer",
|
|
@@ -286,7 +324,8 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
286
324
|
padding: "0 10px",
|
|
287
325
|
whiteSpace: "nowrap",
|
|
288
326
|
label: "gutter",
|
|
289
|
-
textAlign: "
|
|
327
|
+
textAlign: "center",
|
|
328
|
+
color: variables.gutterColor,
|
|
290
329
|
background: variables.gutterBackground,
|
|
291
330
|
"&:hover": {
|
|
292
331
|
cursor: "pointer",
|
|
@@ -297,6 +336,8 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
297
336
|
},
|
|
298
337
|
pre: {
|
|
299
338
|
opacity: 0.5,
|
|
339
|
+
textAlign: "center",
|
|
340
|
+
width: "100%",
|
|
300
341
|
},
|
|
301
342
|
[`&.${diffAdded}`]: {
|
|
302
343
|
background: variables.addedGutterBackground,
|
|
@@ -344,6 +385,7 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
344
385
|
blockDeletion,
|
|
345
386
|
wordRemoved,
|
|
346
387
|
noSelect: unselectable,
|
|
388
|
+
noWrap,
|
|
347
389
|
codeFoldGutter,
|
|
348
390
|
codeFoldExpandButton,
|
|
349
391
|
codeFoldContentContainer,
|
|
@@ -355,6 +397,8 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
355
397
|
content,
|
|
356
398
|
column,
|
|
357
399
|
codeFoldContent,
|
|
400
|
+
stickyHeader,
|
|
401
|
+
columnHeaders,
|
|
358
402
|
titleBlock,
|
|
359
403
|
allExpandButton,
|
|
360
404
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-diff-viewer-continued",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Continuation of a simple and beautiful text diff viewer component made with diff and React",
|
|
6
6
|
"keywords": [
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"react-component",
|
|
14
14
|
"ui"
|
|
15
15
|
],
|
|
16
|
-
"repository": "
|
|
16
|
+
"repository": "https://github.com/Aeolun/react-diff-viewer-continued",
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"authors": [
|
|
19
19
|
"Pranesh Ravi<praneshpranesh@gmail.com>",
|
|
@@ -30,43 +30,32 @@
|
|
|
30
30
|
"main": "lib/cjs/src/index",
|
|
31
31
|
"module": "lib/esm/src/index",
|
|
32
32
|
"typings": "lib/cjs/src/index",
|
|
33
|
-
"scripts": {
|
|
34
|
-
"build": "tsc --project tsconfig.json && tsc --project tsconfig.esm.json",
|
|
35
|
-
"build:examples": "vite build examples",
|
|
36
|
-
"publish:examples": "NODE_ENV=production pnpm run build:examples && gh-pages -d examples/dist -r $GITHUB_REPO_URL",
|
|
37
|
-
"publish:examples:local": "NODE_ENV=production pnpm run build:examples && gh-pages -d examples/dist",
|
|
38
|
-
"start:examples": "vite examples",
|
|
39
|
-
"dev": "vite dev examples",
|
|
40
|
-
"test": "vitest",
|
|
41
|
-
"check": "biome check src/ test/",
|
|
42
|
-
"check:fix": "biome check --write --unsafe src/ test/"
|
|
43
|
-
},
|
|
44
33
|
"dependencies": {
|
|
45
34
|
"@emotion/css": "^11.13.5",
|
|
46
35
|
"@emotion/react": "^11.14.0",
|
|
47
36
|
"classnames": "^2.5.1",
|
|
48
|
-
"diff": "^
|
|
37
|
+
"diff": "^8.0.3",
|
|
38
|
+
"js-yaml": "^4.1.1",
|
|
49
39
|
"memoize-one": "^6.0.0"
|
|
50
40
|
},
|
|
51
41
|
"devDependencies": {
|
|
52
|
-
"@biomejs/biome": "^
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"@types/
|
|
57
|
-
"@types/
|
|
58
|
-
"@types/react": "^
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"react": "^
|
|
63
|
-
"react-dom": "^
|
|
64
|
-
"sass": "^1.
|
|
65
|
-
"semantic-release": "^24.2.1",
|
|
42
|
+
"@biomejs/biome": "^2.3.14",
|
|
43
|
+
"@testing-library/dom": "^10.4.1",
|
|
44
|
+
"@testing-library/react": "^16.3.2",
|
|
45
|
+
"@types/js-yaml": "^4.0.9",
|
|
46
|
+
"@types/node": "^25.2.0",
|
|
47
|
+
"@types/react": "^19.2.11",
|
|
48
|
+
"@types/react-dom": "^19.2.3",
|
|
49
|
+
"gh-pages": "^6.3.0",
|
|
50
|
+
"happy-dom": "^20.5.0",
|
|
51
|
+
"just-release": "^0.7.0",
|
|
52
|
+
"react": "^19.2.4",
|
|
53
|
+
"react-dom": "^19.2.4",
|
|
54
|
+
"sass": "^1.97.3",
|
|
66
55
|
"ts-node": "^10.9.2",
|
|
67
|
-
"typescript": "^5.
|
|
68
|
-
"vite": "^
|
|
69
|
-
"vitest": "^
|
|
56
|
+
"typescript": "^5.9.3",
|
|
57
|
+
"vite": "^7.3.1",
|
|
58
|
+
"vitest": "^4.0.18"
|
|
70
59
|
},
|
|
71
60
|
"peerDependencies": {
|
|
72
61
|
"react": "^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
@@ -74,5 +63,16 @@
|
|
|
74
63
|
},
|
|
75
64
|
"engines": {
|
|
76
65
|
"node": ">= 16"
|
|
66
|
+
},
|
|
67
|
+
"scripts": {
|
|
68
|
+
"build": "tsc --project tsconfig.json && tsc --project tsconfig.esm.json && sed -i 's/computeWorker\\.ts/computeWorker.js/g' lib/cjs/src/compute-lines.js lib/esm/src/compute-lines.js",
|
|
69
|
+
"build:examples": "vite build examples",
|
|
70
|
+
"publish:examples": "NODE_ENV=production pnpm run build:examples && gh-pages -d examples/dist -r $GITHUB_REPO_URL",
|
|
71
|
+
"publish:examples:local": "NODE_ENV=production pnpm run build:examples && gh-pages -d examples/dist",
|
|
72
|
+
"start:examples": "vite examples",
|
|
73
|
+
"dev": "vite dev examples",
|
|
74
|
+
"test": "vitest",
|
|
75
|
+
"check": "biome check src/ test/",
|
|
76
|
+
"check:fix": "biome check --write --unsafe src/ test/"
|
|
77
77
|
}
|
|
78
|
-
}
|
|
78
|
+
}
|