react-diff-viewer-continued 3.2.2 → 3.2.4
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/.all-contributorsrc +34 -0
- package/.github/workflows/release.yml +3 -3
- package/.github/workflows/test.yml +3 -3
- package/CHANGELOG.md +14 -0
- package/README.md +36 -4
- package/lib/compute-lines.d.ts +6 -4
- package/lib/compute-lines.js +18 -9
- package/lib/index.d.ts +5 -5
- package/lib/index.js +16 -5
- package/lib/styles.d.ts +4 -0
- package/lib/styles.js +10 -0
- package/package.json +6 -6
- package/tsconfig.examples.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": [
|
|
3
|
+
"README.md"
|
|
4
|
+
],
|
|
5
|
+
"imageSize": 100,
|
|
6
|
+
"commit": false,
|
|
7
|
+
"commitConvention": "angular",
|
|
8
|
+
"contributors": [
|
|
9
|
+
{
|
|
10
|
+
"login": "ericmorgan1",
|
|
11
|
+
"name": "Eric M.",
|
|
12
|
+
"avatar_url": "https://avatars.githubusercontent.com/u/10346191?v=4",
|
|
13
|
+
"profile": "https://github.com/ericmorgan1",
|
|
14
|
+
"contributions": [
|
|
15
|
+
"code"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"login": "spyroid",
|
|
20
|
+
"name": "Andrei Kovalevsky",
|
|
21
|
+
"avatar_url": "https://avatars.githubusercontent.com/u/844495?v=4",
|
|
22
|
+
"profile": "https://github.com/spyroid",
|
|
23
|
+
"contributions": [
|
|
24
|
+
"code"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"contributorsPerLine": 7,
|
|
29
|
+
"skipCi": true,
|
|
30
|
+
"repoType": "github",
|
|
31
|
+
"repoHost": "https://github.com",
|
|
32
|
+
"projectName": "react-diff-viewer-continued",
|
|
33
|
+
"projectOwner": "Aeolun"
|
|
34
|
+
}
|
|
@@ -9,14 +9,14 @@ jobs:
|
|
|
9
9
|
runs-on: ubuntu-latest
|
|
10
10
|
steps:
|
|
11
11
|
- name: Checkout
|
|
12
|
-
uses: actions/checkout@
|
|
12
|
+
uses: actions/checkout@v3
|
|
13
13
|
with:
|
|
14
14
|
fetch-depth: 0
|
|
15
15
|
- name: Setup Node.js
|
|
16
|
-
uses: actions/setup-node@
|
|
16
|
+
uses: actions/setup-node@v3
|
|
17
17
|
with:
|
|
18
18
|
node-version: 'lts/*'
|
|
19
|
-
- uses: pnpm/action-setup@v2.2.
|
|
19
|
+
- uses: pnpm/action-setup@v2.2.4
|
|
20
20
|
with:
|
|
21
21
|
version: latest
|
|
22
22
|
- name: Install dependencies
|
|
@@ -9,14 +9,14 @@ jobs:
|
|
|
9
9
|
runs-on: ubuntu-latest
|
|
10
10
|
steps:
|
|
11
11
|
- name: Checkout
|
|
12
|
-
uses: actions/checkout@
|
|
12
|
+
uses: actions/checkout@v3
|
|
13
13
|
with:
|
|
14
14
|
fetch-depth: 0
|
|
15
15
|
- name: Setup Node.js
|
|
16
|
-
uses: actions/setup-node@
|
|
16
|
+
uses: actions/setup-node@v3
|
|
17
17
|
with:
|
|
18
18
|
node-version: 'lts/*'
|
|
19
|
-
- uses: pnpm/action-setup@v2.2.
|
|
19
|
+
- uses: pnpm/action-setup@v2.2.4
|
|
20
20
|
with:
|
|
21
21
|
version: latest
|
|
22
22
|
- name: Install dependencies
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [3.2.4](https://github.com/aeolun/react-diff-viewer-continued/compare/v3.2.3...v3.2.4) (2022-12-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* to deploy previous fixes ([06d8361](https://github.com/aeolun/react-diff-viewer-continued/commit/06d83614204d0c48c3ac654b06c43ba42f679c56))
|
|
7
|
+
|
|
8
|
+
## [3.2.3](https://github.com/aeolun/react-diff-viewer-continued/compare/v3.2.2...v3.2.3) (2022-11-11)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* update example with JSON ([f61c977](https://github.com/aeolun/react-diff-viewer-continued/commit/f61c977302415774dd32d48aca3addb7122ffa55))
|
|
14
|
+
|
|
1
15
|
## [3.2.2](https://github.com/aeolun/react-diff-viewer-continued/compare/v3.2.1...v3.2.2) (2022-10-10)
|
|
2
16
|
|
|
3
17
|
|
package/README.md
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
<img src='https://github.com/Aeolun/react-diff-viewer-continued/raw/master/logo_dark.png' width="100%" alt='React Diff Viewer' />
|
|
2
|
+
|
|
2
3
|
<br/>
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
6
|
+
[](#contributors)
|
|
7
|
+
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/react-diff-viewer-continued)
|
|
10
|
+
[](https://www.npmjs.com/package/react-diff-viewer-continued)
|
|
5
11
|
[](https://github.com/aeolun/react-diff-viewer-continued/blob/master/LICENSE)
|
|
6
12
|
|
|
7
13
|
A simple and beautiful text diff viewer component made with [Diff](https://github.com/kpdecker/jsdiff) and [React](https://reactjs.org).
|
|
8
14
|
|
|
9
|
-
Inspired
|
|
15
|
+
Inspired by the Github diff viewer, it includes features like split view, inline view, word diff, line highlight and more. It is highly customizable and it supports almost all languages.
|
|
10
16
|
|
|
11
17
|
Most credit goes to [Pranesh Ravi](https://praneshravi.in) who created the [original diff viewer](https://github.com/praneshr/react-diff-viewer). I've just made a few modifications and updated the dependencies so they work with modern stacks.
|
|
12
18
|
|
|
@@ -63,8 +69,8 @@ class Diff extends PureComponent {
|
|
|
63
69
|
|
|
64
70
|
| Prop | Type | Default | Description |
|
|
65
71
|
| ------------------------- | ------------------------- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
66
|
-
| oldValue | `string` | `''` | Old value as string. |
|
|
67
|
-
| newValue | `string` | `''` | New value as string. |
|
|
72
|
+
| oldValue | `string | Object` | `''` | Old value as string (or Object if using `diffJson`). |
|
|
73
|
+
| newValue | `string | Object` | `''` | New value as string (or Object if using `diffJson`). |
|
|
68
74
|
| splitView | `boolean` | `true` | Switch between `unified` and `split` view. |
|
|
69
75
|
| disableWordDiff | `boolean` | `false` | Show and hide word diff in a diff line. |
|
|
70
76
|
| compareMethod | `DiffMethod` | `DiffMethod.CHARS` | JsDiff text diff method used for diffing strings. Check out the [guide](https://github.com/praneshr/react-diff-viewer/tree/v3.0.0#text-block-diff-comparison) to use different methods. |
|
|
@@ -362,6 +368,32 @@ pnpm start:examples
|
|
|
362
368
|
|
|
363
369
|
Check package.json for more build scripts.
|
|
364
370
|
|
|
371
|
+
## Contributors
|
|
372
|
+
|
|
373
|
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
374
|
+
<!-- prettier-ignore-start -->
|
|
375
|
+
<!-- markdownlint-disable -->
|
|
376
|
+
<table>
|
|
377
|
+
<tbody>
|
|
378
|
+
<tr>
|
|
379
|
+
<td align="center"><a href="https://github.com/ericmorgan1"><img src="https://avatars.githubusercontent.com/u/10346191?v=4?s=100" width="100px;" alt="Eric M."/><br /><sub><b>Eric M.</b></sub></a><br /><a href="https://github.com/Aeolun/react-diff-viewer-continued/commits?author=ericmorgan1" title="Code">💻</a></td>
|
|
380
|
+
<td align="center"><a href="https://github.com/spyroid"><img src="https://avatars.githubusercontent.com/u/844495?v=4?s=100" width="100px;" alt="Andrei Kovalevsky"/><br /><sub><b>Andrei Kovalevsky</b></sub></a><br /><a href="https://github.com/Aeolun/react-diff-viewer-continued/commits?author=spyroid" title="Code">💻</a></td>
|
|
381
|
+
</tr>
|
|
382
|
+
</tbody>
|
|
383
|
+
</table>
|
|
384
|
+
|
|
385
|
+
<!-- markdownlint-restore -->
|
|
386
|
+
<!-- prettier-ignore-end -->
|
|
387
|
+
|
|
388
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
389
|
+
<!-- prettier-ignore-start -->
|
|
390
|
+
<!-- markdownlint-disable -->
|
|
391
|
+
|
|
392
|
+
<!-- markdownlint-restore -->
|
|
393
|
+
<!-- prettier-ignore-end -->
|
|
394
|
+
|
|
395
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
396
|
+
|
|
365
397
|
## License
|
|
366
398
|
|
|
367
399
|
MIT
|
package/lib/compute-lines.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export declare enum DiffType {
|
|
2
2
|
DEFAULT = 0,
|
|
3
3
|
ADDED = 1,
|
|
4
|
-
REMOVED = 2
|
|
4
|
+
REMOVED = 2,
|
|
5
|
+
CHANGED = 3
|
|
5
6
|
}
|
|
6
7
|
export declare enum DiffMethod {
|
|
7
8
|
CHARS = "diffChars",
|
|
@@ -10,7 +11,8 @@ export declare enum DiffMethod {
|
|
|
10
11
|
LINES = "diffLines",
|
|
11
12
|
TRIMMED_LINES = "diffTrimmedLines",
|
|
12
13
|
SENTENCES = "diffSentences",
|
|
13
|
-
CSS = "diffCss"
|
|
14
|
+
CSS = "diffCss",
|
|
15
|
+
JSON = "diffJson"
|
|
14
16
|
}
|
|
15
17
|
export interface DiffInformation {
|
|
16
18
|
value?: string | DiffInformation[];
|
|
@@ -45,8 +47,8 @@ export interface JsDiffChangeObject {
|
|
|
45
47
|
* @param oldString Old string to compare.
|
|
46
48
|
* @param newString New string to compare with old string.
|
|
47
49
|
* @param disableWordDiff Flag to enable/disable word diff.
|
|
48
|
-
* @param
|
|
50
|
+
* @param lineCompareMethod JsDiff text diff method from https://github.com/kpdecker/jsdiff/tree/v4.0.1#api
|
|
49
51
|
* @param linesOffset line number to start counting from
|
|
50
52
|
*/
|
|
51
|
-
declare const computeLineInformation: (oldString: string, newString: string, disableWordDiff?: boolean,
|
|
53
|
+
declare const computeLineInformation: (oldString: string | Object, newString: string | Object, disableWordDiff?: boolean, lineCompareMethod?: string, linesOffset?: number) => ComputedLineInformation;
|
|
52
54
|
export { computeLineInformation };
|
package/lib/compute-lines.js
CHANGED
|
@@ -8,6 +8,7 @@ var DiffType;
|
|
|
8
8
|
DiffType[DiffType["DEFAULT"] = 0] = "DEFAULT";
|
|
9
9
|
DiffType[DiffType["ADDED"] = 1] = "ADDED";
|
|
10
10
|
DiffType[DiffType["REMOVED"] = 2] = "REMOVED";
|
|
11
|
+
DiffType[DiffType["CHANGED"] = 3] = "CHANGED";
|
|
11
12
|
})(DiffType = exports.DiffType || (exports.DiffType = {}));
|
|
12
13
|
// See https://github.com/kpdecker/jsdiff/tree/v4.0.1#api for more info on the below JsDiff methods
|
|
13
14
|
var DiffMethod;
|
|
@@ -19,6 +20,7 @@ var DiffMethod;
|
|
|
19
20
|
DiffMethod["TRIMMED_LINES"] = "diffTrimmedLines";
|
|
20
21
|
DiffMethod["SENTENCES"] = "diffSentences";
|
|
21
22
|
DiffMethod["CSS"] = "diffCss";
|
|
23
|
+
DiffMethod["JSON"] = "diffJson";
|
|
22
24
|
})(DiffMethod = exports.DiffMethod || (exports.DiffMethod = {}));
|
|
23
25
|
/**
|
|
24
26
|
* Splits diff text by new line and computes final list of diff lines based on
|
|
@@ -79,15 +81,22 @@ const computeDiff = (oldValue, newValue, compareMethod = DiffMethod.CHARS) => {
|
|
|
79
81
|
* @param oldString Old string to compare.
|
|
80
82
|
* @param newString New string to compare with old string.
|
|
81
83
|
* @param disableWordDiff Flag to enable/disable word diff.
|
|
82
|
-
* @param
|
|
84
|
+
* @param lineCompareMethod JsDiff text diff method from https://github.com/kpdecker/jsdiff/tree/v4.0.1#api
|
|
83
85
|
* @param linesOffset line number to start counting from
|
|
84
86
|
*/
|
|
85
|
-
const computeLineInformation = (oldString, newString, disableWordDiff = false,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
const computeLineInformation = (oldString, newString, disableWordDiff = false, lineCompareMethod = DiffMethod.CHARS, linesOffset = 0) => {
|
|
88
|
+
let diffArray = [];
|
|
89
|
+
// Use diffLines for strings, and diffJson for objects...
|
|
90
|
+
if (typeof oldString === 'string' && typeof newString === 'string') {
|
|
91
|
+
diffArray = diff.diffLines(oldString.trimRight(), newString.trimRight(), {
|
|
92
|
+
newlineIsToken: false,
|
|
93
|
+
ignoreWhitespace: false,
|
|
94
|
+
ignoreCase: false,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
diffArray = diff.diffJson(oldString, newString);
|
|
99
|
+
}
|
|
91
100
|
let rightLineNumber = linesOffset;
|
|
92
101
|
let leftLineNumber = linesOffset;
|
|
93
102
|
let lineInformation = [];
|
|
@@ -135,13 +144,13 @@ const computeLineInformation = (oldString, newString, disableWordDiff = false, c
|
|
|
135
144
|
}
|
|
136
145
|
else {
|
|
137
146
|
right.type = type;
|
|
138
|
-
// Do
|
|
147
|
+
// Do char level diff and assign the corresponding values to the
|
|
139
148
|
// left and right diff information object.
|
|
140
149
|
if (disableWordDiff) {
|
|
141
150
|
right.value = rightValue;
|
|
142
151
|
}
|
|
143
152
|
else {
|
|
144
|
-
const computedDiff = computeDiff(line, rightValue,
|
|
153
|
+
const computedDiff = computeDiff(line, rightValue, lineCompareMethod);
|
|
145
154
|
right.value = computedDiff.right;
|
|
146
155
|
left.value = computedDiff.left;
|
|
147
156
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
3
|
+
import { DiffInformation, DiffMethod, DiffType, LineInformation } from './compute-lines';
|
|
4
4
|
import { ReactDiffViewerStyles, ReactDiffViewerStylesOverride } from './styles';
|
|
5
5
|
export declare enum LineNumberPrefix {
|
|
6
6
|
LEFT = "L",
|
|
7
7
|
RIGHT = "R"
|
|
8
8
|
}
|
|
9
9
|
export interface ReactDiffViewerProps {
|
|
10
|
-
oldValue: string;
|
|
11
|
-
newValue: string;
|
|
10
|
+
oldValue: string | Object;
|
|
11
|
+
newValue: string | Object;
|
|
12
12
|
splitView?: boolean;
|
|
13
13
|
linesOffset?: number;
|
|
14
14
|
disableWordDiff?: boolean;
|
|
@@ -41,8 +41,8 @@ declare class DiffViewer extends React.Component<ReactDiffViewerProps, ReactDiff
|
|
|
41
41
|
private styles;
|
|
42
42
|
static defaultProps: ReactDiffViewerProps;
|
|
43
43
|
static propTypes: {
|
|
44
|
-
oldValue: PropTypes.Validator<
|
|
45
|
-
newValue: PropTypes.Validator<
|
|
44
|
+
oldValue: PropTypes.Validator<any>;
|
|
45
|
+
newValue: PropTypes.Validator<any>;
|
|
46
46
|
splitView: PropTypes.Requireable<boolean>;
|
|
47
47
|
disableWordDiff: PropTypes.Requireable<boolean>;
|
|
48
48
|
compareMethod: PropTypes.Requireable<DiffMethod>;
|
package/lib/index.js
CHANGED
|
@@ -94,6 +94,7 @@ class DiffViewer extends React.Component {
|
|
|
94
94
|
this.props.highlightLines.includes(additionalLineNumberTemplate);
|
|
95
95
|
const added = type === compute_lines_1.DiffType.ADDED;
|
|
96
96
|
const removed = type === compute_lines_1.DiffType.REMOVED;
|
|
97
|
+
const changed = type === compute_lines_1.DiffType.CHANGED;
|
|
97
98
|
let content;
|
|
98
99
|
if (Array.isArray(value)) {
|
|
99
100
|
content = this.renderWordDiff(value, this.props.renderContent);
|
|
@@ -109,6 +110,7 @@ class DiffViewer extends React.Component {
|
|
|
109
110
|
[this.styles.emptyGutter]: !lineNumber,
|
|
110
111
|
[this.styles.diffAdded]: added,
|
|
111
112
|
[this.styles.diffRemoved]: removed,
|
|
113
|
+
[this.styles.diffChanged]: changed,
|
|
112
114
|
[this.styles.highlightedGutter]: highlightLine,
|
|
113
115
|
}) },
|
|
114
116
|
React.createElement("pre", { className: this.styles.lineNumber }, lineNumber))),
|
|
@@ -117,6 +119,7 @@ class DiffViewer extends React.Component {
|
|
|
117
119
|
[this.styles.emptyGutter]: !additionalLineNumber,
|
|
118
120
|
[this.styles.diffAdded]: added,
|
|
119
121
|
[this.styles.diffRemoved]: removed,
|
|
122
|
+
[this.styles.diffChanged]: changed,
|
|
120
123
|
[this.styles.highlightedGutter]: highlightLine,
|
|
121
124
|
}) },
|
|
122
125
|
React.createElement("pre", { className: this.styles.lineNumber }, additionalLineNumber))),
|
|
@@ -135,6 +138,7 @@ class DiffViewer extends React.Component {
|
|
|
135
138
|
[this.styles.emptyLine]: !content,
|
|
136
139
|
[this.styles.diffAdded]: added,
|
|
137
140
|
[this.styles.diffRemoved]: removed,
|
|
141
|
+
[this.styles.diffChanged]: changed,
|
|
138
142
|
[this.styles.highlightedLine]: highlightLine,
|
|
139
143
|
}) },
|
|
140
144
|
React.createElement("pre", null,
|
|
@@ -144,6 +148,7 @@ class DiffViewer extends React.Component {
|
|
|
144
148
|
[this.styles.emptyLine]: !content,
|
|
145
149
|
[this.styles.diffAdded]: added,
|
|
146
150
|
[this.styles.diffRemoved]: removed,
|
|
151
|
+
[this.styles.diffChanged]: changed,
|
|
147
152
|
[this.styles.highlightedLine]: highlightLine,
|
|
148
153
|
}) },
|
|
149
154
|
React.createElement("pre", { className: this.styles.contentText }, content))));
|
|
@@ -249,10 +254,14 @@ class DiffViewer extends React.Component {
|
|
|
249
254
|
typeof diffBlockStart === 'undefined') &&
|
|
250
255
|
!this.state.expandedBlocks.includes(diffBlockStart)) {
|
|
251
256
|
skippedLines.push(i + 1);
|
|
257
|
+
// show skipped line indicator only if there is more than one line to hide
|
|
252
258
|
if (i === lineInformation.length - 1 && skippedLines.length > 1) {
|
|
253
259
|
return this.renderSkippedLineIndicator(skippedLines.length, diffBlockStart, line.left.lineNumber, line.right.lineNumber);
|
|
260
|
+
// if we are trying to hide the last line, just show it
|
|
261
|
+
}
|
|
262
|
+
else if (i < lineInformation.length - 1) {
|
|
263
|
+
return null;
|
|
254
264
|
}
|
|
255
|
-
return null;
|
|
256
265
|
}
|
|
257
266
|
}
|
|
258
267
|
const diffNodes = splitView
|
|
@@ -270,8 +279,10 @@ class DiffViewer extends React.Component {
|
|
|
270
279
|
};
|
|
271
280
|
this.render = () => {
|
|
272
281
|
const { oldValue, newValue, useDarkTheme, leftTitle, rightTitle, splitView, hideLineNumbers, } = this.props;
|
|
273
|
-
if (
|
|
274
|
-
|
|
282
|
+
if (this.props.compareMethod !== compute_lines_1.DiffMethod.JSON) {
|
|
283
|
+
if (typeof oldValue !== 'string' || typeof newValue !== 'string') {
|
|
284
|
+
throw Error('"oldValue" and "newValue" should be strings');
|
|
285
|
+
}
|
|
275
286
|
}
|
|
276
287
|
this.styles = this.computeStyles(this.props.styles, useDarkTheme);
|
|
277
288
|
const nodes = this.renderDiff();
|
|
@@ -311,8 +322,8 @@ DiffViewer.defaultProps = {
|
|
|
311
322
|
linesOffset: 0,
|
|
312
323
|
};
|
|
313
324
|
DiffViewer.propTypes = {
|
|
314
|
-
oldValue: PropTypes.
|
|
315
|
-
newValue: PropTypes.
|
|
325
|
+
oldValue: PropTypes.any.isRequired,
|
|
326
|
+
newValue: PropTypes.any.isRequired,
|
|
316
327
|
splitView: PropTypes.bool,
|
|
317
328
|
disableWordDiff: PropTypes.bool,
|
|
318
329
|
compareMethod: PropTypes.oneOf(Object.values(compute_lines_1.DiffMethod)),
|
package/lib/styles.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export interface ReactDiffViewerStyles {
|
|
|
3
3
|
diffContainer?: string;
|
|
4
4
|
diffRemoved?: string;
|
|
5
5
|
diffAdded?: string;
|
|
6
|
+
diffChanged?: string;
|
|
6
7
|
line?: string;
|
|
7
8
|
highlightedGutter?: string;
|
|
8
9
|
contentText?: string;
|
|
@@ -32,6 +33,7 @@ export interface ReactDiffViewerStylesVariables {
|
|
|
32
33
|
addedColor?: string;
|
|
33
34
|
removedBackground?: string;
|
|
34
35
|
removedColor?: string;
|
|
36
|
+
changedBackground?: string;
|
|
35
37
|
wordAddedBackground?: string;
|
|
36
38
|
wordRemovedBackground?: string;
|
|
37
39
|
addedGutterBackground?: string;
|
|
@@ -56,6 +58,7 @@ export interface ReactDiffViewerStylesOverride {
|
|
|
56
58
|
diffContainer?: Interpolation;
|
|
57
59
|
diffRemoved?: Interpolation;
|
|
58
60
|
diffAdded?: Interpolation;
|
|
61
|
+
diffChanged?: Interpolation;
|
|
59
62
|
marker?: Interpolation;
|
|
60
63
|
emptyGutter?: Interpolation;
|
|
61
64
|
highlightedLine?: Interpolation;
|
|
@@ -68,6 +71,7 @@ export interface ReactDiffViewerStylesOverride {
|
|
|
68
71
|
wordAdded?: Interpolation;
|
|
69
72
|
wordRemoved?: Interpolation;
|
|
70
73
|
codeFoldGutter?: Interpolation;
|
|
74
|
+
codeFold?: Interpolation;
|
|
71
75
|
emptyLine?: Interpolation;
|
|
72
76
|
content?: Interpolation;
|
|
73
77
|
titleBlock?: Interpolation;
|
package/lib/styles.js
CHANGED
|
@@ -23,6 +23,7 @@ exports.default = (styleOverride, useDarkTheme = false) => {
|
|
|
23
23
|
addedColor: '#24292e',
|
|
24
24
|
removedBackground: '#ffeef0',
|
|
25
25
|
removedColor: '#24292e',
|
|
26
|
+
changedBackground: '#fffbdd',
|
|
26
27
|
wordAddedBackground: '#acf2bd',
|
|
27
28
|
wordRemovedBackground: '#fdb8c0',
|
|
28
29
|
addedGutterBackground: '#cdffd8',
|
|
@@ -49,6 +50,7 @@ exports.default = (styleOverride, useDarkTheme = false) => {
|
|
|
49
50
|
addedColor: 'white',
|
|
50
51
|
removedBackground: '#632F34',
|
|
51
52
|
removedColor: 'white',
|
|
53
|
+
changedBackground: '#3e302c',
|
|
52
54
|
wordAddedBackground: '#055d67',
|
|
53
55
|
wordRemovedBackground: '#7d383f',
|
|
54
56
|
addedGutterBackground: '#034148',
|
|
@@ -137,6 +139,13 @@ exports.default = (styleOverride, useDarkTheme = false) => {
|
|
|
137
139
|
},
|
|
138
140
|
label: 'diff-added',
|
|
139
141
|
});
|
|
142
|
+
const diffChanged = (0, emotion_1.css)({
|
|
143
|
+
background: variables.changedBackground,
|
|
144
|
+
[`.${lineNumber}`]: {
|
|
145
|
+
color: variables.gutterColor,
|
|
146
|
+
},
|
|
147
|
+
label: 'diff-changed',
|
|
148
|
+
});
|
|
140
149
|
const wordDiff = (0, emotion_1.css)({
|
|
141
150
|
padding: 2,
|
|
142
151
|
display: 'inline-flex',
|
|
@@ -246,6 +255,7 @@ exports.default = (styleOverride, useDarkTheme = false) => {
|
|
|
246
255
|
diffContainer,
|
|
247
256
|
diffRemoved,
|
|
248
257
|
diffAdded,
|
|
258
|
+
diffChanged,
|
|
249
259
|
splitView,
|
|
250
260
|
marker,
|
|
251
261
|
highlightedGutter,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-diff-viewer-continued",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.4",
|
|
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": [
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@babel/preset-typescript": "^7.18.6",
|
|
49
49
|
"@semantic-release/changelog": "6.0.1",
|
|
50
50
|
"@semantic-release/git": "10.0.1",
|
|
51
|
-
"@testing-library/react": "^
|
|
51
|
+
"@testing-library/react": "^13.4.0",
|
|
52
52
|
"@types/diff": "^5.0.2",
|
|
53
53
|
"@types/expect": "^1.20.3",
|
|
54
54
|
"@types/memoize-one": "^4.1.1",
|
|
@@ -77,8 +77,8 @@
|
|
|
77
77
|
"mocha": "^10.0.0",
|
|
78
78
|
"prettier": "^2.7.1",
|
|
79
79
|
"raw-loader": "^4.0.2",
|
|
80
|
-
"react": "^
|
|
81
|
-
"react-dom": "^
|
|
80
|
+
"react": "^18.0.0",
|
|
81
|
+
"react-dom": "^18.0.0",
|
|
82
82
|
"sass": "^1.53.0",
|
|
83
83
|
"sass-loader": "^13.0.2",
|
|
84
84
|
"semantic-release": "^19.0.3",
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
"webpack-dev-server": "^4.9.3"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
|
-
"react": "^15.3.0 || ^16.0.0 || ^17.0.0",
|
|
95
|
-
"react-dom": "^15.3.0 || ^16.0.0 || ^17.0.0"
|
|
94
|
+
"react": "^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
95
|
+
"react-dom": "^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0"
|
|
96
96
|
},
|
|
97
97
|
"engines": {
|
|
98
98
|
"node": ">= 8"
|