react-diff-viewer-continued 4.3.0 → 4.4.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.
@@ -142,6 +142,30 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
142
142
  textDecoration: "none",
143
143
  label: "content-text",
144
144
  });
145
+ // Line content is laid out as two flex items: a fixed indent column carrying the
146
+ // line's leading whitespace, and a flexible body that wraps. This gives wrapped
147
+ // continuation lines a hanging indent — they align under the first character of
148
+ // the line's content instead of falling back to the cell's left edge.
149
+ const contentFlex = css({
150
+ display: "flex",
151
+ alignItems: "baseline",
152
+ label: "content-flex",
153
+ });
154
+ // The indent column. `pre` + `flex-shrink: 0` keep the whitespace intact and
155
+ // prevent it from ever collapsing or wrapping, so it sizes exactly to the indent.
156
+ const lineIndent = css({
157
+ whiteSpace: "pre",
158
+ wordBreak: "keep-all",
159
+ flex: "0 0 auto",
160
+ label: "line-indent",
161
+ });
162
+ // The wrapping body. `min-width: 0` is required so a long unbreakable run wraps
163
+ // within the flex item instead of overflowing the row.
164
+ const lineBody = css({
165
+ flex: "1 1 auto",
166
+ minWidth: 0,
167
+ label: "line-body",
168
+ });
145
169
  const unselectable = css({
146
170
  userSelect: "none",
147
171
  label: "unselectable",
@@ -252,14 +276,30 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
252
276
  const codeFoldContentContainer = css({
253
277
  // Neutralize host `:where(th,td){ padding }` on the fold content cell.
254
278
  padding: 0,
279
+ // Clip the button to the cell box so any residual misalignment can't bleed into the row flow.
280
+ overflow: "hidden",
281
+ // `diffContainer`'s `& td` isolation reset pins vertical-align:baseline at specificity
282
+ // (0,2,0), which out-ranks this single class and drags the fold cell back onto the row
283
+ // baseline (the ~2-3px offset). Self-chain the selector to (0,3,0) so the fold cell's
284
+ // middle alignment wins over that reset.
285
+ "&&&": {
286
+ verticalAlign: "middle",
287
+ },
255
288
  label: "code-fold-content-container",
256
289
  });
257
290
  const codeFoldExpandButton = css({
258
291
  background: variables.codeFoldBackground,
259
292
  cursor: "pointer",
260
- display: "inline",
293
+ // `display: inline` puts the button in the cell's line box, so baseline/line-height
294
+ // metrics nudge it ~2-3px down from the cell top and it spills past the bottom.
295
+ // A block box leaves the inline formatting context and sits flush.
296
+ display: "block",
261
297
  margin: 0,
298
+ padding: 0,
262
299
  border: "none",
300
+ font: "inherit",
301
+ lineHeight: "inherit",
302
+ textAlign: "left",
263
303
  fill: variables.codeFoldContentColor,
264
304
  label: "code-fold-expand-button",
265
305
  });
@@ -291,6 +331,14 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
291
331
  fontWeight: 700,
292
332
  cursor: "pointer",
293
333
  label: "code-fold",
334
+ // The fold row has empty/classless placeholder cells (spacer gutters, line-number
335
+ // stand-ins) that pin no padding of their own. Host `:where(th,td){ padding }`
336
+ // (daisyui `.table`) inflates their vertical padding and stretches the fold row
337
+ // out of line with the code rows. Zero block padding on every cell in the row.
338
+ "& td": {
339
+ paddingTop: 0,
340
+ paddingBottom: 0,
341
+ },
294
342
  "&:hover": {
295
343
  color: variables.diffViewerColor,
296
344
  fill: variables.diffViewerColor,
@@ -424,6 +472,9 @@ export default (styleOverride, useDarkTheme = false, nonce = "") => {
424
472
  emptyLine,
425
473
  lineNumber,
426
474
  contentText,
475
+ contentFlex,
476
+ lineIndent,
477
+ lineBody,
427
478
  content,
428
479
  column,
429
480
  codeFoldContent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-diff-viewer-continued",
3
- "version": "4.3.0",
3
+ "version": "4.4.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": [
@@ -39,7 +39,8 @@
39
39
  "classnames": "^2.5.1",
40
40
  "diff": "^9.0.0",
41
41
  "js-yaml": "^4.2.0",
42
- "memoize-one": "^6.0.0"
42
+ "memoize-one": "^6.0.0",
43
+ "refractor": "^5.0.0"
43
44
  },
44
45
  "devDependencies": {
45
46
  "@biomejs/biome": "^2.4.12",
@@ -47,14 +48,14 @@
47
48
  "@testing-library/react": "^16.3.2",
48
49
  "@types/js-yaml": "^4.0.9",
49
50
  "@types/node": "^25.6.0",
50
- "@types/react": "^19.2.14",
51
- "@types/react-dom": "^19.2.3",
51
+ "@types/react": "^18.3.12",
52
+ "@types/react-dom": "^18.3.1",
52
53
  "esbuild": "^0.28.1",
53
54
  "gh-pages": "^6.3.0",
54
55
  "happy-dom": "^20.10.6",
55
56
  "just-release": "^0.13.5",
56
- "react": "^19.2.5",
57
- "react-dom": "^19.2.5",
57
+ "react": "^18.3.1",
58
+ "react-dom": "^18.3.1",
58
59
  "sass": "^1.99.0",
59
60
  "ts-node": "^10.9.2",
60
61
  "typescript": "^6.0.3",