@git-diff-view/react 0.0.35 → 0.0.37

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.
@@ -6,14 +6,7 @@ import {
6
6
  getPlainDiffTemplate,
7
7
  getPlainLineTemplate,
8
8
  } from "@git-diff-view/core";
9
- import {
10
- memoFunc,
11
- addContentHighlightBGName,
12
- delContentHighlightBGName,
13
- diffFontSizeName,
14
- getSymbol,
15
- NewLineSymbol,
16
- } from "@git-diff-view/utils";
9
+ import { memoFunc, diffFontSizeName, NewLineSymbol } from "@git-diff-view/utils";
17
10
  import * as React from "react";
18
11
 
19
12
  import { DiffNoNewLine } from "./DiffNoNewLine";
@@ -54,25 +47,23 @@ const DiffString = ({
54
47
  operator,
55
48
  plainLine,
56
49
  enableWrap,
57
- enableTemplate,
58
50
  }: {
59
51
  rawLine: string;
60
52
  diffLine?: DiffLine;
61
53
  operator?: "add" | "del";
62
54
  plainLine?: File["plainFile"][number];
63
55
  enableWrap?: boolean;
64
- enableTemplate?: boolean;
65
56
  }) => {
66
57
  const changes = diffLine?.changes;
67
58
 
68
59
  if (changes?.hasLineChange) {
69
60
  const isNewLineSymbolChanged = changes.newLineSymbol;
70
61
 
71
- if (enableTemplate && !diffLine?.plainTemplate && typeof getPlainDiffTemplate === "function") {
62
+ if (!diffLine?.plainTemplate && typeof getPlainDiffTemplate === "function") {
72
63
  getPlainDiffTemplate({ diffLine, rawLine, operator });
73
64
  }
74
65
 
75
- if (enableTemplate && diffLine?.plainTemplate) {
66
+ if (diffLine?.plainTemplate) {
76
67
  return (
77
68
  <span className="diff-line-content-raw">
78
69
  <span data-template dangerouslySetInnerHTML={{ __html: diffLine.plainTemplate }} />
@@ -90,59 +81,14 @@ const DiffString = ({
90
81
  )}
91
82
  </span>
92
83
  );
93
- } else {
94
- // TODO remove
95
- const range = changes.range;
96
- const str1 = rawLine.slice(0, range.location);
97
- const str2 = rawLine.slice(range.location, range.location + range.length);
98
- const str3 = rawLine.slice(range.location + range.length);
99
- const isLast = str2.includes("\n");
100
- const _str2 = isLast ? str2.replace("\n", "").replace("\r", "") : str2;
101
- return (
102
- <span className="diff-line-content-raw">
103
- <span data-range-start={range.location} data-range-end={range.location + range.length}>
104
- {str1}
105
- <span
106
- data-diff-highlight
107
- className="rounded-[0.2em]"
108
- style={{
109
- backgroundColor:
110
- operator === "add" ? `var(${addContentHighlightBGName})` : `var(${delContentHighlightBGName})`,
111
- }}
112
- >
113
- {isLast ? (
114
- <>
115
- {_str2}
116
- <span data-newline-symbol>{getSymbol(isNewLineSymbolChanged)}</span>
117
- </>
118
- ) : (
119
- str2
120
- )}
121
- </span>
122
- {str3}
123
- </span>
124
- {isNewLineSymbolChanged === NewLineSymbol.NEWLINE && (
125
- <span
126
- data-no-newline-at-end-of-file-symbol
127
- className={enableWrap ? "block !text-red-500" : "inline-block align-middle !text-red-500"}
128
- style={{
129
- width: `var(${diffFontSizeName})`,
130
- height: `var(${diffFontSizeName})`,
131
- }}
132
- >
133
- <DiffNoNewLine />
134
- </span>
135
- )}
136
- </span>
137
- );
138
84
  }
139
85
  }
140
86
 
141
- if (enableTemplate && plainLine && !plainLine?.template) {
87
+ if (plainLine && !plainLine?.template) {
142
88
  plainLine.template = getPlainLineTemplate(plainLine.value);
143
89
  }
144
90
 
145
- if (enableTemplate && plainLine?.template) {
91
+ if (plainLine?.template) {
146
92
  return (
147
93
  <span className="diff-line-content-raw">
148
94
  <span data-template dangerouslySetInnerHTML={{ __html: plainLine.template }} />
@@ -155,29 +101,21 @@ const DiffString = ({
155
101
 
156
102
  const DiffSyntax = ({
157
103
  rawLine,
104
+ diffFile,
158
105
  diffLine,
159
106
  operator,
160
107
  syntaxLine,
161
108
  enableWrap,
162
- enableTemplate,
163
109
  }: {
164
110
  rawLine: string;
111
+ diffFile: DiffFile;
165
112
  diffLine?: DiffLine;
166
113
  syntaxLine?: File["syntaxFile"][number];
167
114
  operator?: "add" | "del";
168
115
  enableWrap?: boolean;
169
- enableTemplate?: boolean;
170
116
  }) => {
171
117
  if (!syntaxLine) {
172
- return (
173
- <DiffString
174
- rawLine={rawLine}
175
- diffLine={diffLine}
176
- operator={operator}
177
- enableWrap={enableWrap}
178
- enableTemplate={enableTemplate}
179
- />
180
- );
118
+ return <DiffString rawLine={rawLine} diffLine={diffLine} operator={operator} enableWrap={enableWrap} />;
181
119
  }
182
120
 
183
121
  const changes = diffLine?.changes;
@@ -185,11 +123,11 @@ const DiffSyntax = ({
185
123
  if (changes?.hasLineChange) {
186
124
  const isNewLineSymbolChanged = changes.newLineSymbol;
187
125
 
188
- if (enableTemplate && !diffLine?.syntaxTemplate && typeof getSyntaxDiffTemplate === "function") {
189
- getSyntaxDiffTemplate({ diffLine, syntaxLine, operator });
126
+ if (!diffLine?.syntaxTemplate && typeof getSyntaxDiffTemplate === "function") {
127
+ getSyntaxDiffTemplate({ diffFile, diffLine, syntaxLine, operator });
190
128
  }
191
129
 
192
- if (enableTemplate && diffLine?.syntaxTemplate) {
130
+ if (diffLine?.syntaxTemplate) {
193
131
  return (
194
132
  <span className="diff-line-syntax-raw">
195
133
  <span data-template dangerouslySetInnerHTML={{ __html: diffLine.syntaxTemplate }} />
@@ -207,95 +145,14 @@ const DiffSyntax = ({
207
145
  )}
208
146
  </span>
209
147
  );
210
- } else {
211
- // TODO remove
212
- const range = changes.range;
213
-
214
- return (
215
- <span className="diff-line-syntax-raw">
216
- <span data-range-start={range.location} data-range-end={range.location + range.length}>
217
- {syntaxLine.nodeList?.map(({ node, wrapper }, index) => {
218
- if (node.endIndex < range.location || range.location + range.length < node.startIndex) {
219
- return (
220
- <span
221
- key={index}
222
- data-start={node.startIndex}
223
- data-end={node.endIndex}
224
- className={wrapper?.properties?.className?.join(" ")}
225
- style={getStyleObjectFromString(wrapper?.properties?.style || "")}
226
- >
227
- {node.value}
228
- </span>
229
- );
230
- } else {
231
- const index1 = range.location - node.startIndex;
232
- const index2 = index1 < 0 ? 0 : index1;
233
- const str1 = node.value.slice(0, index2);
234
- const str2 = node.value.slice(index2, index1 + range.length);
235
- const str3 = node.value.slice(index1 + range.length);
236
- const isStart = str1.length || range.location === node.startIndex;
237
- const isEnd = str3.length || node.endIndex === range.location + range.length - 1;
238
- const isLast = str2.includes("\n");
239
- const _str2 = isLast ? str2.replace("\n", "").replace("\r", "") : str2;
240
- return (
241
- <span
242
- key={index}
243
- data-start={node.startIndex}
244
- data-end={node.endIndex}
245
- className={wrapper?.properties?.className?.join(" ")}
246
- style={getStyleObjectFromString(wrapper?.properties?.style || "")}
247
- >
248
- {str1}
249
- <span
250
- data-diff-highlight
251
- style={{
252
- backgroundColor:
253
- operator === "add"
254
- ? `var(${addContentHighlightBGName})`
255
- : `var(${delContentHighlightBGName})`,
256
- borderTopLeftRadius: isStart ? "0.2em" : undefined,
257
- borderBottomLeftRadius: isStart ? "0.2em" : undefined,
258
- borderTopRightRadius: isEnd || isLast ? "0.2em" : undefined,
259
- borderBottomRightRadius: isEnd || isLast ? "0.2em" : undefined,
260
- }}
261
- >
262
- {isLast ? (
263
- <>
264
- {_str2}
265
- <span data-newline-symbol>{getSymbol(isNewLineSymbolChanged)}</span>
266
- </>
267
- ) : (
268
- str2
269
- )}
270
- </span>
271
- {str3}
272
- </span>
273
- );
274
- }
275
- })}
276
- </span>
277
- {isNewLineSymbolChanged === NewLineSymbol.NEWLINE && (
278
- <span
279
- data-no-newline-at-end-of-file-symbol
280
- className={enableWrap ? "block !text-red-500" : "inline-block align-middle !text-red-500"}
281
- style={{
282
- width: `var(${diffFontSizeName})`,
283
- height: `var(${diffFontSizeName})`,
284
- }}
285
- >
286
- <DiffNoNewLine />
287
- </span>
288
- )}
289
- </span>
290
- );
291
148
  }
292
149
  }
293
150
 
294
- if (enableTemplate && !syntaxLine.template) {
151
+ if (!syntaxLine.template) {
295
152
  syntaxLine.template = getSyntaxLineTemplate(syntaxLine);
296
153
  }
297
154
 
298
- if (enableTemplate && syntaxLine?.template) {
155
+ if (syntaxLine?.template) {
299
156
  return (
300
157
  <span className="diff-line-syntax-raw">
301
158
  <span data-template dangerouslySetInnerHTML={{ __html: syntaxLine.template }} />
@@ -321,8 +178,8 @@ const DiffSyntax = ({
321
178
  };
322
179
 
323
180
  export const DiffContent = ({
324
- diffLine,
325
181
  diffFile,
182
+ diffLine,
326
183
  rawLine,
327
184
  plainLine,
328
185
  syntaxLine,
@@ -343,8 +200,6 @@ export const DiffContent = ({
343
200
 
344
201
  const isMaxLineLengthToIgnoreSyntax = syntaxLine?.nodeList?.length > 150;
345
202
 
346
- const isEnableTemplate = diffFile.getIsEnableTemplate?.() ?? true;
347
-
348
203
  return (
349
204
  <div
350
205
  className="diff-line-content-item pl-[2.0em]"
@@ -364,10 +219,10 @@ export const DiffContent = ({
364
219
  <DiffSyntax
365
220
  operator={isAdded ? "add" : isDelete ? "del" : undefined}
366
221
  rawLine={rawLine}
222
+ diffFile={diffFile}
367
223
  diffLine={diffLine}
368
224
  syntaxLine={syntaxLine}
369
225
  enableWrap={enableWrap}
370
- enableTemplate={isEnableTemplate}
371
226
  />
372
227
  ) : (
373
228
  <DiffString
@@ -376,7 +231,6 @@ export const DiffContent = ({
376
231
  diffLine={diffLine}
377
232
  plainLine={plainLine}
378
233
  enableWrap={enableWrap}
379
- enableTemplate={isEnableTemplate}
380
234
  />
381
235
  )}
382
236
  </div>
@@ -12,7 +12,6 @@ import {
12
12
  expandLineNumberColorName,
13
13
  } from "@git-diff-view/utils";
14
14
  import * as React from "react";
15
- import { memo } from "react";
16
15
 
17
16
  import { SplitSide } from "..";
18
17
 
@@ -167,148 +166,144 @@ const DiffUnifiedNewLine = ({
167
166
  );
168
167
  };
169
168
 
170
- const _DiffUnifiedLine = memo(
171
- ({
172
- index,
173
- diffFile,
174
- lineNumber,
175
- enableWrap,
176
- enableAddWidget,
177
- enableHighlight,
178
- }: {
179
- index: number;
180
- diffFile: DiffFile;
181
- lineNumber: number;
182
- enableWrap: boolean;
183
- enableHighlight: boolean;
184
- enableAddWidget: boolean;
185
- }) => {
186
- const unifiedLine = diffFile.getUnifiedLine(index);
169
+ const InternalDiffUnifiedLine = ({
170
+ index,
171
+ diffFile,
172
+ lineNumber,
173
+ enableWrap,
174
+ enableAddWidget,
175
+ enableHighlight,
176
+ }: {
177
+ index: number;
178
+ diffFile: DiffFile;
179
+ lineNumber: number;
180
+ enableWrap: boolean;
181
+ enableHighlight: boolean;
182
+ enableAddWidget: boolean;
183
+ }) => {
184
+ const unifiedLine = diffFile.getUnifiedLine(index);
187
185
 
188
- const { useDiffContext } = useDiffViewContext();
186
+ const { useDiffContext } = useDiffViewContext();
189
187
 
190
- const onAddWidgetClick = useDiffContext.getReadonlyState().onAddWidgetClick;
188
+ const onAddWidgetClick = useDiffContext.getReadonlyState().onAddWidgetClick;
191
189
 
192
- const { useWidget } = useDiffWidgetContext();
190
+ const { useWidget } = useDiffWidgetContext();
193
191
 
194
- const setWidget = useWidget.getReadonlyState().setWidget;
192
+ const setWidget = useWidget.getReadonlyState().setWidget;
195
193
 
196
- const hasDiff = unifiedLine.diff;
194
+ const hasDiff = unifiedLine.diff;
197
195
 
198
- const hasChange = checkDiffLineIncludeChange(unifiedLine.diff);
196
+ const hasChange = checkDiffLineIncludeChange(unifiedLine.diff);
199
197
 
200
- const rawLine = unifiedLine.value || "";
198
+ const rawLine = unifiedLine.value || "";
201
199
 
202
- const diffLine = unifiedLine.diff;
200
+ const diffLine = unifiedLine.diff;
203
201
 
204
- const newLineNumber = unifiedLine.newLineNumber;
202
+ const newLineNumber = unifiedLine.newLineNumber;
205
203
 
206
- const oldLinenumber = unifiedLine.oldLineNumber;
204
+ const oldLinenumber = unifiedLine.oldLineNumber;
207
205
 
208
- const syntaxLine = newLineNumber
209
- ? diffFile.getNewSyntaxLine(newLineNumber)
210
- : oldLinenumber
211
- ? diffFile.getOldSyntaxLine(oldLinenumber)
212
- : undefined;
206
+ const syntaxLine = newLineNumber
207
+ ? diffFile.getNewSyntaxLine(newLineNumber)
208
+ : oldLinenumber
209
+ ? diffFile.getOldSyntaxLine(oldLinenumber)
210
+ : undefined;
213
211
 
214
- const plainLine = newLineNumber
215
- ? diffFile.getNewPlainLine(newLineNumber)
216
- : oldLinenumber
217
- ? diffFile.getOldPlainLine(oldLinenumber)
218
- : undefined;
212
+ const plainLine = newLineNumber
213
+ ? diffFile.getNewPlainLine(newLineNumber)
214
+ : oldLinenumber
215
+ ? diffFile.getOldPlainLine(oldLinenumber)
216
+ : undefined;
219
217
 
220
- if (hasChange) {
221
- if (unifiedLine.oldLineNumber) {
222
- return (
223
- <DiffUnifiedOldLine
224
- index={lineNumber}
218
+ if (hasChange) {
219
+ if (unifiedLine.oldLineNumber) {
220
+ return (
221
+ <DiffUnifiedOldLine
222
+ index={lineNumber}
223
+ enableWrap={enableWrap}
224
+ diffFile={diffFile}
225
+ rawLine={rawLine}
226
+ diffLine={diffLine}
227
+ setWidget={setWidget}
228
+ plainLine={plainLine}
229
+ syntaxLine={syntaxLine}
230
+ enableHighlight={enableHighlight}
231
+ enableAddWidget={enableAddWidget}
232
+ lineNumber={unifiedLine.oldLineNumber}
233
+ onAddWidgetClick={(...props) => onAddWidgetClick.current?.(...props)}
234
+ />
235
+ );
236
+ } else {
237
+ return (
238
+ <DiffUnifiedNewLine
239
+ index={lineNumber}
240
+ enableWrap={enableWrap}
241
+ rawLine={rawLine}
242
+ diffLine={diffLine}
243
+ diffFile={diffFile}
244
+ setWidget={setWidget}
245
+ plainLine={plainLine}
246
+ syntaxLine={syntaxLine}
247
+ enableHighlight={enableHighlight}
248
+ enableAddWidget={enableAddWidget}
249
+ lineNumber={unifiedLine.newLineNumber!}
250
+ onAddWidgetClick={(...props) => onAddWidgetClick.current?.(...props)}
251
+ />
252
+ );
253
+ }
254
+ } else {
255
+ return (
256
+ <tr data-line={lineNumber} data-state={unifiedLine.diff ? "diff" : "plain"} className="diff-line group">
257
+ <td
258
+ className="diff-line-num sticky left-0 z-[1] w-[1%] min-w-[100px] select-none whitespace-nowrap pl-[10px] pr-[10px] text-right align-top"
259
+ style={{
260
+ color: `var(${hasDiff ? plainLineNumberColorName : expandLineNumberColorName})`,
261
+ width: `calc(calc(var(${diffAsideWidthName}) + 5px) * 2)`,
262
+ maxWidth: `calc(calc(var(${diffAsideWidthName}) + 5px) * 2)`,
263
+ minWidth: `calc(calc(var(${diffAsideWidthName}) + 5px) * 2)`,
264
+ backgroundColor: hasDiff ? `var(${plainLineNumberBGName})` : `var(${expandContentBGName})`,
265
+ }}
266
+ >
267
+ {enableAddWidget && hasDiff && (
268
+ <DiffUnifiedAddWidget
269
+ index={index}
270
+ diffFile={diffFile}
271
+ lineNumber={unifiedLine.newLineNumber}
272
+ side={SplitSide.new}
273
+ onWidgetClick={(...props) => onAddWidgetClick.current?.(...props)}
274
+ onOpenAddWidget={(lineNumber, side) => setWidget({ lineNumber, side })}
275
+ />
276
+ )}
277
+ <div className="flex opacity-[0.5]">
278
+ <span data-line-old-num={unifiedLine.oldLineNumber} className="inline-block w-[50%]">
279
+ {unifiedLine.oldLineNumber}
280
+ </span>
281
+ <span className="w-[10px] shrink-0" />
282
+ <span data-line-new-num={unifiedLine.newLineNumber} className="inline-block w-[50%]">
283
+ {unifiedLine.newLineNumber}
284
+ </span>
285
+ </div>
286
+ </td>
287
+ <td
288
+ className="diff-line-content pr-[10px] align-top"
289
+ style={{
290
+ backgroundColor: hasDiff ? `var(${plainContentBGName})` : `var(${expandContentBGName})`,
291
+ }}
292
+ >
293
+ <DiffContent
225
294
  enableWrap={enableWrap}
226
295
  diffFile={diffFile}
227
- rawLine={rawLine}
228
- diffLine={diffLine}
229
- setWidget={setWidget}
230
- plainLine={plainLine}
231
- syntaxLine={syntaxLine}
232
296
  enableHighlight={enableHighlight}
233
- enableAddWidget={enableAddWidget}
234
- lineNumber={unifiedLine.oldLineNumber}
235
- onAddWidgetClick={(...props) => onAddWidgetClick.current?.(...props)}
236
- />
237
- );
238
- } else {
239
- return (
240
- <DiffUnifiedNewLine
241
- index={lineNumber}
242
- enableWrap={enableWrap}
243
297
  rawLine={rawLine}
244
298
  diffLine={diffLine}
245
- diffFile={diffFile}
246
- setWidget={setWidget}
247
299
  plainLine={plainLine}
248
300
  syntaxLine={syntaxLine}
249
- enableHighlight={enableHighlight}
250
- enableAddWidget={enableAddWidget}
251
- lineNumber={unifiedLine.newLineNumber!}
252
- onAddWidgetClick={(...props) => onAddWidgetClick.current?.(...props)}
253
301
  />
254
- );
255
- }
256
- } else {
257
- return (
258
- <tr data-line={lineNumber} data-state={unifiedLine.diff ? "diff" : "plain"} className="diff-line group">
259
- <td
260
- className="diff-line-num sticky left-0 z-[1] w-[1%] min-w-[100px] select-none whitespace-nowrap pl-[10px] pr-[10px] text-right align-top"
261
- style={{
262
- color: `var(${hasDiff ? plainLineNumberColorName : expandLineNumberColorName})`,
263
- width: `calc(calc(var(${diffAsideWidthName}) + 5px) * 2)`,
264
- maxWidth: `calc(calc(var(${diffAsideWidthName}) + 5px) * 2)`,
265
- minWidth: `calc(calc(var(${diffAsideWidthName}) + 5px) * 2)`,
266
- backgroundColor: hasDiff ? `var(${plainLineNumberBGName})` : `var(${expandContentBGName})`,
267
- }}
268
- >
269
- {enableAddWidget && hasDiff && (
270
- <DiffUnifiedAddWidget
271
- index={index}
272
- diffFile={diffFile}
273
- lineNumber={unifiedLine.newLineNumber}
274
- side={SplitSide.new}
275
- onWidgetClick={(...props) => onAddWidgetClick.current?.(...props)}
276
- onOpenAddWidget={(lineNumber, side) => setWidget({ lineNumber, side })}
277
- />
278
- )}
279
- <div className="flex opacity-[0.5]">
280
- <span data-line-old-num={unifiedLine.oldLineNumber} className="inline-block w-[50%]">
281
- {unifiedLine.oldLineNumber}
282
- </span>
283
- <span className="w-[10px] shrink-0" />
284
- <span data-line-new-num={unifiedLine.newLineNumber} className="inline-block w-[50%]">
285
- {unifiedLine.newLineNumber}
286
- </span>
287
- </div>
288
- </td>
289
- <td
290
- className="diff-line-content pr-[10px] align-top"
291
- style={{
292
- backgroundColor: hasDiff ? `var(${plainContentBGName})` : `var(${expandContentBGName})`,
293
- }}
294
- >
295
- <DiffContent
296
- enableWrap={enableWrap}
297
- diffFile={diffFile}
298
- enableHighlight={enableHighlight}
299
- rawLine={rawLine}
300
- diffLine={diffLine}
301
- plainLine={plainLine}
302
- syntaxLine={syntaxLine}
303
- />
304
- </td>
305
- </tr>
306
- );
307
- }
302
+ </td>
303
+ </tr>
304
+ );
308
305
  }
309
- );
310
-
311
- _DiffUnifiedLine.displayName = "_DiffUnifiedLine";
306
+ };
312
307
 
313
308
  export const DiffUnifiedContentLine = ({
314
309
  index,
@@ -330,7 +325,7 @@ export const DiffUnifiedContentLine = ({
330
325
  if (unifiedLine?.isHidden) return null;
331
326
 
332
327
  return (
333
- <_DiffUnifiedLine
328
+ <InternalDiffUnifiedLine
334
329
  index={index}
335
330
  diffFile={diffFile}
336
331
  lineNumber={lineNumber}
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-unnecessary-type-constraint */
2
2
  /* eslint-disable @typescript-eslint/ban-ts-comment */
3
- import { DiffFile, _cacheMap, SplitSide } from "@git-diff-view/core";
3
+ import { DiffFile, _cacheMap, SplitSide, highlighter as buildInHighlighter } from "@git-diff-view/core";
4
4
  import { diffFontSizeName, DiffModeEnum } from "@git-diff-view/utils";
5
5
  import { memo, useEffect, useMemo, forwardRef, useImperativeHandle, useRef } from "react";
6
6
  import * as React from "react";
@@ -315,10 +315,19 @@ const DiffViewWithRef = <T extends unknown>(
315
315
  if (!diffFile) return;
316
316
 
317
317
  if (props.diffViewHighlight) {
318
- diffFile.initSyntax({ registerHighlighter });
318
+ const finalHighlighter = registerHighlighter || buildInHighlighter;
319
+
320
+ if (
321
+ finalHighlighter.name !== diffFile._getHighlighterName() ||
322
+ finalHighlighter.type !== diffFile._getHighlighterType()
323
+ ) {
324
+ diffFile.initSyntax({ registerHighlighter: finalHighlighter });
325
+ diffFile.notifyAll();
326
+ } else {
327
+ diffFile.initSyntax({ registerHighlighter: finalHighlighter });
328
+ if (finalHighlighter.type !== "class") diffFile.notifyAll();
329
+ }
319
330
  }
320
-
321
- diffFile.notifyAll();
322
331
  }, [diffFile, props.diffViewHighlight, registerHighlighter, diffViewTheme]);
323
332
 
324
333
  useEffect(() => {
@@ -334,7 +343,7 @@ const DiffViewWithRef = <T extends unknown>(
334
343
  const cb = diffFile.subscribe(init);
335
344
 
336
345
  return cb;
337
- }, [diffFile]);
346
+ }, [diffFile, diffViewTheme]);
338
347
 
339
348
  // fix react strict mode error
340
349
  useUnmount(() => (__DEV__ ? diffFile?._destroy?.() : diffFile?.clear?.()), [diffFile]);
@@ -187,9 +187,6 @@
187
187
  .diff-tailwindcss-wrapper .break-all {
188
188
  word-break: break-all;
189
189
  }
190
- .diff-tailwindcss-wrapper .rounded-\[0\.2em\] {
191
- border-radius: 0.2em;
192
- }
193
190
  .diff-tailwindcss-wrapper .rounded-\[2px\] {
194
191
  border-radius: 2px;
195
192
  }