virtual-react-json-diff 1.0.13 → 1.0.15

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,6 +6,8 @@ export type Config = {
6
6
  miniMapWidth: number;
7
7
  hideSearch: boolean;
8
8
  height: number;
9
+ showLineCount: boolean;
10
+ showObjectCountStats: boolean;
9
11
  detectCircular: boolean;
10
12
  maxDepth: number;
11
13
  showModifications: boolean;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import type { LineCountStats } from "../types";
3
+ type LineCountDisplayProps = {
4
+ stats: LineCountStats;
5
+ };
6
+ export declare const LineCountDisplay: React.FC<LineCountDisplayProps>;
7
+ export default LineCountDisplay;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import type { ObjectCountStats } from "../types";
3
+ type ObjectCountDisplayProps = {
4
+ stats: ObjectCountStats;
5
+ };
6
+ export declare const ObjectCountDisplay: React.FC<ObjectCountDisplayProps>;
7
+ export default ObjectCountDisplay;
@@ -12,7 +12,6 @@ type ListDataType = {
12
12
  type VirtualDiffGridProps = {
13
13
  leftDiff: DiffRowOrCollapsed[];
14
14
  rightDiff: DiffRowOrCollapsed[];
15
- outerRef: React.RefObject<Node | null>;
16
15
  listRef: React.RefObject<List<ListDataType>>;
17
16
  height: number;
18
17
  inlineDiffOptions?: InlineDiffOptions;
@@ -20,6 +19,8 @@ type VirtualDiffGridProps = {
20
19
  setScrollTop: Dispatch<React.SetStateAction<number>>;
21
20
  onExpand: (segmentIndex: number) => void;
22
21
  overScanCount?: number;
22
+ viewerRef?: React.RefObject<HTMLDivElement>;
23
+ listContainerRef?: React.RefObject<HTMLDivElement>;
23
24
  };
24
25
  declare const VirtualDiffGrid: React.FC<VirtualDiffGridProps>;
25
26
  export default VirtualDiffGrid;
@@ -1,2 +1,2 @@
1
1
  import type { DiffRowOrCollapsed } from "../types";
2
- export declare function useRowHeights(leftView: DiffRowOrCollapsed[]): number[];
2
+ export declare function useRowHeights(leftView: DiffRowOrCollapsed[], viewerRef?: React.RefObject<HTMLDivElement | null>): number[];
@@ -1,5 +1,5 @@
1
1
  import type { DiffRowOrCollapsed, SearchState } from "../types";
2
- export declare function useSearch(leftView: DiffRowOrCollapsed[], initialTerm?: string, onSearchMatch?: (index: number) => void): {
2
+ export declare function useSearch(leftView: DiffRowOrCollapsed[], initialTerm?: string, onSearchMatch?: (index: number) => void, viewerRef?: React.RefObject<HTMLDivElement | null>, listContainerRef?: React.RefObject<HTMLDivElement | null>): {
3
3
  searchState: SearchState;
4
4
  handleSearch: (term: string) => void;
5
5
  navigateMatch: (direction: "next" | "prev") => number | undefined;
@@ -27,6 +27,18 @@ export type SearchState = {
27
27
  results: number[];
28
28
  currentIndex: number;
29
29
  };
30
+ export type LineCountStats = {
31
+ added: number;
32
+ removed: number;
33
+ modified: number;
34
+ total: number;
35
+ };
36
+ export type ObjectCountStats = {
37
+ added: number;
38
+ removed: number;
39
+ modified: number;
40
+ total: number;
41
+ };
30
42
  export type VirtualizedDiffViewerProps = {
31
43
  oldValue: object;
32
44
  newValue: object;
@@ -44,6 +56,8 @@ export type VirtualizedDiffViewerProps = {
44
56
  miniMapWidth?: number;
45
57
  inlineDiffOptions?: InlineDiffOptions;
46
58
  overScanCount?: number;
59
+ showLineCount?: boolean;
60
+ showObjectCountStats?: boolean;
47
61
  };
48
62
  export type DiffMinimapProps = {
49
63
  leftDiff: DiffRowOrCollapsed[];
@@ -1,3 +1,3 @@
1
1
  import type { DiffRowOrCollapsed } from "../types";
2
2
  export declare function performSearch(term: string, leftView: DiffRowOrCollapsed[]): number[];
3
- export declare function highlightMatches(term: string, className?: string): void;
3
+ export declare function highlightMatches(term: string, container: HTMLDivElement): void;
@@ -0,0 +1,3 @@
1
+ import type { DiffResult } from "json-diff-kit";
2
+ import type { LineCountStats } from "../types";
3
+ export declare function calculateLineCountStats(diffData: [DiffResult[], DiffResult[]]): LineCountStats;
@@ -0,0 +1,5 @@
1
+ import type { ObjectCountStats } from "../types";
2
+ /**
3
+ * Calculates object count statistics for compare-key method
4
+ */
5
+ export declare function calculateObjectCountStats(oldValue: any, newValue: any, compareKey: string): ObjectCountStats;
@@ -1,2 +1,3 @@
1
1
  export { default as VirtualDiffViewer } from "./components/DiffViewer";
2
+ export { calculateObjectCountStats } from "./components/DiffViewer/utils/objectCountUtils";
2
3
  export { Differ, type DiffResult } from "json-diff-kit";
package/dist/index.d.ts CHANGED
@@ -2,6 +2,12 @@ import React from 'react';
2
2
  import { DiffResult, DifferOptions, Differ, InlineDiffOptions } from 'json-diff-kit';
3
3
  export { DiffResult, Differ } from 'json-diff-kit';
4
4
 
5
+ type ObjectCountStats = {
6
+ added: number;
7
+ removed: number;
8
+ modified: number;
9
+ total: number;
10
+ };
5
11
  type VirtualizedDiffViewerProps = {
6
12
  oldValue: object;
7
13
  newValue: object;
@@ -19,8 +25,15 @@ type VirtualizedDiffViewerProps = {
19
25
  miniMapWidth?: number;
20
26
  inlineDiffOptions?: InlineDiffOptions;
21
27
  overScanCount?: number;
28
+ showLineCount?: boolean;
29
+ showObjectCountStats?: boolean;
22
30
  };
23
31
 
24
32
  declare const VirtualizedDiffViewer: React.FC<VirtualizedDiffViewerProps>;
25
33
 
26
- export { VirtualizedDiffViewer as VirtualDiffViewer };
34
+ /**
35
+ * Calculates object count statistics for compare-key method
36
+ */
37
+ declare function calculateObjectCountStats(oldValue: any, newValue: any, compareKey: string): ObjectCountStats;
38
+
39
+ export { VirtualizedDiffViewer as VirtualDiffViewer, calculateObjectCountStats };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "virtual-react-json-diff",
3
3
  "type": "module",
4
- "version": "1.0.13",
4
+ "version": "1.0.15",
5
5
  "description": "Fast, virtualized React component for visually comparing large JSON objects. Includes search, theming, and minimap.",
6
6
  "author": {
7
7
  "name": "Utku Akyüz"
@@ -85,6 +85,7 @@
85
85
  "pre-commit": "pnpm lint-staged"
86
86
  },
87
87
  "lint-staged": {
88
- "*.{js,jsx,ts,tsx,vue,html,md,json,yaml,css,scss}": "eslint --fix"
88
+ "*.{js,jsx,ts,tsx,vue,html,json,yaml,css,scss}": "eslint --fix",
89
+ "*.md": "echo 'Skipping markdown files in lint-staged'"
89
90
  }
90
91
  }