virtual-react-json-diff 1.0.5 → 1.0.7
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/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/src/components/DiffViewer/components/ViewerRow.d.ts +9 -0
- package/dist/cjs/types/src/components/DiffViewer/hooks/useDiffSegments.d.ts +8 -0
- package/dist/cjs/types/src/components/DiffViewer/hooks/useDragScroll.d.ts +14 -0
- package/dist/cjs/types/src/components/DiffViewer/hooks/useMinimapDraw.d.ts +20 -0
- package/dist/cjs/types/src/components/DiffViewer/hooks/useRowHeights.d.ts +2 -0
- package/dist/cjs/types/src/components/DiffViewer/hooks/useSearch.d.ts +6 -0
- package/dist/cjs/types/src/components/DiffViewer/utils/constants.d.ts +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ListChildComponentProps } from "react-window";
|
|
2
|
+
import type { DiffRowOrCollapsed } from "../types";
|
|
3
|
+
declare function ViewerRow({ index, style, data, }: ListChildComponentProps<{
|
|
4
|
+
leftDiff: DiffRowOrCollapsed[];
|
|
5
|
+
rightDiff: DiffRowOrCollapsed[];
|
|
6
|
+
onExpand: (segmentIndex: number) => void;
|
|
7
|
+
searchTerm?: string;
|
|
8
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default ViewerRow;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DiffRowOrCollapsed, SegmentItem } from "../types";
|
|
2
|
+
export declare function useDiffSegments(oldValue: any, newValue: any, differOptions?: any): {
|
|
3
|
+
leftView: DiffRowOrCollapsed[];
|
|
4
|
+
rightView: DiffRowOrCollapsed[];
|
|
5
|
+
segments: SegmentItem[];
|
|
6
|
+
expandSegment: (segmentIndex: number) => void;
|
|
7
|
+
hideAllSegments: () => void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type UseDragScrollParams = {
|
|
2
|
+
height: number;
|
|
3
|
+
totalLines: number;
|
|
4
|
+
viewportHeight: number;
|
|
5
|
+
ROW_HEIGHT: number;
|
|
6
|
+
onScroll: (scrollTop: number) => void;
|
|
7
|
+
containerRef: React.RefObject<HTMLDivElement>;
|
|
8
|
+
};
|
|
9
|
+
type UseDragScrollReturn = {
|
|
10
|
+
handleMouseDown: (e: React.MouseEvent) => void;
|
|
11
|
+
isDragging: React.MutableRefObject<boolean>;
|
|
12
|
+
};
|
|
13
|
+
export declare function useDragScroll({ height, totalLines, viewportHeight, ROW_HEIGHT, onScroll, containerRef, }: UseDragScrollParams): UseDragScrollReturn;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DiffRowOrCollapsed } from "../types";
|
|
2
|
+
type Props = {
|
|
3
|
+
canvasRef: React.RefObject<HTMLCanvasElement>;
|
|
4
|
+
height: number;
|
|
5
|
+
miniMapWidth: number;
|
|
6
|
+
leftDiff: DiffRowOrCollapsed[];
|
|
7
|
+
rightDiff: DiffRowOrCollapsed[];
|
|
8
|
+
currentScrollTop: number;
|
|
9
|
+
searchResults: number[];
|
|
10
|
+
currentMatchIndex: number;
|
|
11
|
+
isDragging: React.MutableRefObject<boolean>;
|
|
12
|
+
totalLines: number;
|
|
13
|
+
ROW_HEIGHT: number;
|
|
14
|
+
viewportHeight: number;
|
|
15
|
+
};
|
|
16
|
+
export declare function useMinimapDraw({ canvasRef, height, miniMapWidth, leftDiff, rightDiff, currentScrollTop, searchResults, currentMatchIndex, isDragging, totalLines, ROW_HEIGHT, viewportHeight, }: Props): {
|
|
17
|
+
drawScrollBox: (ctx: CanvasRenderingContext2D, color: string) => void;
|
|
18
|
+
drawMinimap: () => void;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DiffRowOrCollapsed, SearchState } from "../types";
|
|
2
|
+
export declare function useSearch(leftView: DiffRowOrCollapsed[], initialTerm?: string, onSearchMatch?: (index: number) => void): {
|
|
3
|
+
searchState: SearchState;
|
|
4
|
+
handleSearch: (term: string) => void;
|
|
5
|
+
navigateMatch: (direction: "next" | "prev") => number | undefined;
|
|
6
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const DIFF_VIEWER_CLASS = "json-diff-viewer-theme-custom";
|
|
2
|
+
export declare const DEFAULT_ROW_HEIGHT = 20;
|
|
3
|
+
export declare function getRowHeightFromCSS(): number;
|
|
4
|
+
export declare const COLLAPSED_ROW_HEIGHT = 20;
|
|
5
|
+
export declare const SEARCH_DEBOUNCE_MS = 300;
|
|
6
|
+
export declare function isCollapsed(line: any): line is {
|
|
7
|
+
type: "collapsed";
|
|
8
|
+
segmentIndex: number;
|
|
9
|
+
};
|
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.
|
|
4
|
+
"version": "1.0.7",
|
|
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"
|