virtual-react-json-diff 1.0.1

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.
@@ -0,0 +1,46 @@
1
+ import type { StoryObj } from "@storybook/react";
2
+ declare const meta: {
3
+ title: string;
4
+ component: import("react").FC<import("./types").VirtualizedDiffViewerProps>;
5
+ parameters: {
6
+ layout: string;
7
+ };
8
+ tags: string[];
9
+ argTypes: {
10
+ className: {
11
+ description: string;
12
+ control: "text";
13
+ };
14
+ leftTitle: {
15
+ description: string;
16
+ control: "text";
17
+ };
18
+ rightTitle: {
19
+ description: string;
20
+ control: "text";
21
+ };
22
+ hideSearch: {
23
+ description: string;
24
+ control: "boolean";
25
+ };
26
+ height: {
27
+ description: string;
28
+ control: "number";
29
+ };
30
+ oldValue: {
31
+ description: string;
32
+ control: "object";
33
+ };
34
+ newValue: {
35
+ description: string;
36
+ control: "object";
37
+ };
38
+ differOptions: {
39
+ description: string;
40
+ control: "object";
41
+ };
42
+ };
43
+ };
44
+ export default meta;
45
+ type Story = StoryObj<typeof meta>;
46
+ export declare const Primary: Story;
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { DiffMinimapProps } from "../types";
3
+ export declare const DiffMinimap: React.FC<DiffMinimapProps>;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { VirtualizedDiffViewerProps } from "../types";
3
+ import "../styles/JsonDiffCustomTheme.css";
4
+ export declare const VirtualizedDiffViewer: React.FC<VirtualizedDiffViewerProps>;
5
+ export default VirtualizedDiffViewer;
@@ -0,0 +1 @@
1
+ export { default } from "./components/VirtualizedDiffViewer";
@@ -0,0 +1,50 @@
1
+ import { DiffResult, DifferOptions } from "json-diff-kit";
2
+ export interface DiffRow extends DiffResult {
3
+ originalIndex: number;
4
+ }
5
+ export type DiffRowOrCollapsed = DiffRow | CollapsedLine;
6
+ export interface SegmentItem {
7
+ start: number;
8
+ end: number;
9
+ isEqual: boolean;
10
+ isExpanded?: boolean;
11
+ originalStart?: number;
12
+ originalEnd?: number;
13
+ }
14
+ export interface HiddenUnchangedLinesInfo extends SegmentItem {
15
+ hasLinesBefore: boolean;
16
+ hasLinesAfter: boolean;
17
+ }
18
+ export interface CollapsedLine {
19
+ type: "collapsed";
20
+ segmentIndex: number;
21
+ originalIndex: number;
22
+ level: number;
23
+ text: string;
24
+ }
25
+ export interface SearchState {
26
+ term: string;
27
+ results: number[];
28
+ currentIndex: number;
29
+ }
30
+ export interface VirtualizedDiffViewerProps {
31
+ oldValue: object;
32
+ newValue: object;
33
+ height: number;
34
+ hideSearch?: boolean;
35
+ searchTerm?: string;
36
+ leftTitle?: string;
37
+ rightTitle?: string;
38
+ onSearchMatch?: (index: number) => void;
39
+ differOptions?: DifferOptions;
40
+ className?: string;
41
+ }
42
+ export interface DiffMinimapProps {
43
+ leftDiff: DiffRowOrCollapsed[];
44
+ rightDiff: DiffRowOrCollapsed[];
45
+ height: number;
46
+ onScroll: (scrollTop: number) => void;
47
+ currentScrollTop: number;
48
+ searchResults?: number[];
49
+ currentMatchIndex?: number;
50
+ }
@@ -0,0 +1,3 @@
1
+ import { DiffRowOrCollapsed } from "../types";
2
+ export declare const performSearch: (term: string, leftView: DiffRowOrCollapsed[]) => number[];
3
+ export declare const highlightMatches: (term: string, className?: string) => void;
@@ -0,0 +1,5 @@
1
+ import { DiffResult } from "json-diff-kit";
2
+ import { SegmentItem, DiffRowOrCollapsed } from "../types";
3
+ export declare function preprocessDiffs(diff: DiffResult[], contextSize?: number, collapseThreshold?: number): DiffRowOrCollapsed[];
4
+ export declare function generateSegments(diff: DiffResult[], contextSize?: number): SegmentItem[];
5
+ export declare function buildViewFromSegments(segments: SegmentItem[], diff: DiffResult[], contextSize?: number): DiffRowOrCollapsed[];
@@ -0,0 +1 @@
1
+ export declare const SearchIcon: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export { default as VirtualDiffViewer } from "./components/DiffViewer";
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { DifferOptions } from 'json-diff-kit';
3
+
4
+ interface VirtualizedDiffViewerProps {
5
+ oldValue: object;
6
+ newValue: object;
7
+ height: number;
8
+ hideSearch?: boolean;
9
+ searchTerm?: string;
10
+ leftTitle?: string;
11
+ rightTitle?: string;
12
+ onSearchMatch?: (index: number) => void;
13
+ differOptions?: DifferOptions;
14
+ className?: string;
15
+ }
16
+
17
+ declare const VirtualizedDiffViewer: React.FC<VirtualizedDiffViewerProps>;
18
+
19
+ export { VirtualizedDiffViewer as VirtualDiffViewer };
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "virtual-react-json-diff",
3
+ "version": "1.0.1",
4
+ "description": "A React UI component for visually comparing large JSON objects with virtual scrolling, search, and theming — built on top of json-diff-kit.",
5
+ "main": "dist/cjs/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "build": "bun run rollup",
12
+ "prepublishOnly": "bun run build",
13
+ "rollup": "rollup -c --bundleConfigAsCjs",
14
+ "storybook": "storybook dev -p 6006",
15
+ "build-storybook": "storybook build"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/utkuakyuz/virtual-react-json-diff"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/utkuakyuz/virtual-react-json-diff/issues"
23
+ },
24
+ "homepage": "https://virtual-react-json-diff.netlify.app",
25
+ "author": {
26
+ "name": "Utku Akyüz"
27
+ },
28
+ "license": "MIT",
29
+ "type": "module",
30
+ "keywords": [
31
+ "react",
32
+ "json",
33
+ "diff",
34
+ "json-diff",
35
+ "viewer",
36
+ "json-diff-kit",
37
+ "virtual-scroll",
38
+ "theme",
39
+ "search"
40
+ ],
41
+ "devDependencies": {
42
+ "@fontsource/inter": "^5.1.1",
43
+ "@rollup/plugin-commonjs": "^25.0.3",
44
+ "@rollup/plugin-image": "^3.0.3",
45
+ "@rollup/plugin-node-resolve": "^15.1.0",
46
+ "@rollup/plugin-terser": "^0.4.3",
47
+ "@rollup/plugin-typescript": "^11.1.2",
48
+ "@storybook/addon-essentials": "8.6.0-alpha.0",
49
+ "@storybook/addon-interactions": "8.6.0-alpha.0",
50
+ "@storybook/addon-onboarding": "8.6.0-alpha.0",
51
+ "@storybook/addon-styling-webpack": "^1.0.1",
52
+ "@storybook/blocks": "8.6.0-alpha.0",
53
+ "@storybook/react": "8.6.0-alpha.0",
54
+ "@storybook/react-vite": "8.6.0-alpha.0",
55
+ "@types/node": "^22.14.1",
56
+ "@types/react": "^18.2.15",
57
+ "@types/react-window": "^1.8.8",
58
+ "postcss": "^8.5.1",
59
+ "prettier": "^2.5.1",
60
+ "react": "^18.2.0",
61
+ "rollup": "^3.26.3",
62
+ "rollup-plugin-dts": "^5.3.0",
63
+ "rollup-plugin-peer-deps-external": "^2.2.4",
64
+ "rollup-plugin-postcss": "^4.0.2",
65
+ "storybook": "8.6.0-alpha.0",
66
+ "tslib": "^2.6.0",
67
+ "typescript": "^5.1.6"
68
+ },
69
+ "peerDependencies": {
70
+ "react": "^18.0.0"
71
+ },
72
+ "dependencies": {
73
+ "json-diff-kit": "^1.0.31",
74
+ "react-window": "^1.8.11"
75
+ }
76
+ }