react-diff-viewer-continued 4.0.6 → 4.1.0
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 +16 -0
- package/.github/workflows/publish.yml +48 -0
- package/.github/workflows/release.yml +23 -8
- package/CHANGELOG.md +14 -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 +320 -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 +67 -2
- package/lib/cjs/src/index.js +495 -128
- package/lib/cjs/src/styles.d.ts +2 -0
- package/lib/cjs/src/styles.js +53 -29
- package/lib/esm/src/compute-lines.js +315 -10
- package/lib/esm/src/computeWorker.js +10 -0
- package/lib/esm/src/index.js +457 -49
- package/lib/esm/src/styles.js +50 -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 || {}),
|
|
@@ -72,6 +72,12 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
72
72
|
const splitView = css({
|
|
73
73
|
label: "split-view",
|
|
74
74
|
});
|
|
75
|
+
const stickyHeader = css({
|
|
76
|
+
position: "sticky",
|
|
77
|
+
top: 0,
|
|
78
|
+
zIndex: 2,
|
|
79
|
+
label: "sticky-header",
|
|
80
|
+
});
|
|
75
81
|
const summary = css({
|
|
76
82
|
background: variables.diffViewerTitleBackground,
|
|
77
83
|
color: variables.diffViewerTitleColor,
|
|
@@ -80,13 +86,19 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
80
86
|
alignItems: "center",
|
|
81
87
|
gap: "0.5em",
|
|
82
88
|
fontFamily: "monospace",
|
|
89
|
+
fontSize: 12,
|
|
83
90
|
fill: variables.diffViewerTitleColor,
|
|
84
91
|
});
|
|
92
|
+
const columnHeaders = css({
|
|
93
|
+
display: "flex",
|
|
94
|
+
label: "column-headers",
|
|
95
|
+
});
|
|
85
96
|
const diffContainer = css({
|
|
86
97
|
width: "100%",
|
|
87
98
|
minWidth: "1000px",
|
|
88
99
|
overflowX: "auto",
|
|
89
100
|
tableLayout: "fixed",
|
|
101
|
+
fontSize: 12,
|
|
90
102
|
background: variables.diffViewerBackground,
|
|
91
103
|
pre: {
|
|
92
104
|
margin: 0,
|
|
@@ -137,8 +149,13 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
137
149
|
overflow: "hidden",
|
|
138
150
|
width: "50%",
|
|
139
151
|
borderBottom: `1px solid ${variables.diffViewerTitleBorderColor}`,
|
|
152
|
+
boxSizing: "border-box",
|
|
153
|
+
fontSize: 12,
|
|
140
154
|
label: "title-block",
|
|
141
|
-
":
|
|
155
|
+
":only-child": {
|
|
156
|
+
width: "100%",
|
|
157
|
+
},
|
|
158
|
+
":last-child:not(:only-child)": {
|
|
142
159
|
borderLeft: `1px solid ${variables.diffViewerTitleBorderColor}`,
|
|
143
160
|
},
|
|
144
161
|
[`.${contentText}`]: {
|
|
@@ -179,20 +196,16 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
179
196
|
label: "diff-changed",
|
|
180
197
|
});
|
|
181
198
|
const wordDiff = css({
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
borderRadius: 4,
|
|
185
|
-
wordBreak: "break-all",
|
|
199
|
+
display: "inline",
|
|
200
|
+
textDecoration: "none",
|
|
186
201
|
label: "word-diff",
|
|
187
202
|
});
|
|
188
203
|
const wordAdded = css({
|
|
189
204
|
background: variables.wordAddedBackground,
|
|
190
|
-
textDecoration: "none",
|
|
191
205
|
label: "word-added",
|
|
192
206
|
});
|
|
193
207
|
const wordRemoved = css({
|
|
194
208
|
background: variables.wordRemovedBackground,
|
|
195
|
-
textDecoration: "none",
|
|
196
209
|
label: "word-removed",
|
|
197
210
|
});
|
|
198
211
|
const codeFoldGutter = css({
|
|
@@ -200,6 +213,8 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
200
213
|
label: "code-fold-gutter",
|
|
201
214
|
minWidth: "50px",
|
|
202
215
|
width: "50px",
|
|
216
|
+
textAlign: "center",
|
|
217
|
+
fill: variables.codeFoldContentColor,
|
|
203
218
|
});
|
|
204
219
|
const codeFoldContentContainer = css({
|
|
205
220
|
padding: "",
|
|
@@ -210,6 +225,7 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
210
225
|
display: "inline",
|
|
211
226
|
margin: 0,
|
|
212
227
|
border: "none",
|
|
228
|
+
fill: variables.codeFoldContentColor,
|
|
213
229
|
label: "code-fold-expand-button",
|
|
214
230
|
});
|
|
215
231
|
const codeFoldContent = css({
|
|
@@ -234,12 +250,20 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
234
250
|
});
|
|
235
251
|
const codeFold = css({
|
|
236
252
|
backgroundColor: variables.codeFoldBackground,
|
|
237
|
-
|
|
238
|
-
fontSize: 14,
|
|
253
|
+
fontSize: 12,
|
|
239
254
|
alignItems: "center",
|
|
240
255
|
userSelect: "none",
|
|
241
256
|
fontWeight: 700,
|
|
257
|
+
cursor: "pointer",
|
|
242
258
|
label: "code-fold",
|
|
259
|
+
"&:hover": {
|
|
260
|
+
color: variables.diffViewerColor,
|
|
261
|
+
fill: variables.diffViewerColor,
|
|
262
|
+
"& *": {
|
|
263
|
+
color: variables.diffViewerColor,
|
|
264
|
+
fill: variables.diffViewerColor,
|
|
265
|
+
},
|
|
266
|
+
},
|
|
243
267
|
a: {
|
|
244
268
|
textDecoration: "underline !important",
|
|
245
269
|
cursor: "pointer",
|
|
@@ -286,7 +310,8 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
286
310
|
padding: "0 10px",
|
|
287
311
|
whiteSpace: "nowrap",
|
|
288
312
|
label: "gutter",
|
|
289
|
-
textAlign: "
|
|
313
|
+
textAlign: "center",
|
|
314
|
+
color: variables.gutterColor,
|
|
290
315
|
background: variables.gutterBackground,
|
|
291
316
|
"&:hover": {
|
|
292
317
|
cursor: "pointer",
|
|
@@ -297,6 +322,8 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
297
322
|
},
|
|
298
323
|
pre: {
|
|
299
324
|
opacity: 0.5,
|
|
325
|
+
textAlign: "center",
|
|
326
|
+
width: "100%",
|
|
300
327
|
},
|
|
301
328
|
[`&.${diffAdded}`]: {
|
|
302
329
|
background: variables.addedGutterBackground,
|
|
@@ -355,6 +382,8 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
|
|
|
355
382
|
content,
|
|
356
383
|
column,
|
|
357
384
|
codeFoldContent,
|
|
385
|
+
stickyHeader,
|
|
386
|
+
columnHeaders,
|
|
358
387
|
titleBlock,
|
|
359
388
|
allExpandButton,
|
|
360
389
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-diff-viewer-continued",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
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",
|
|
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
|
+
}
|