virtual-react-json-diff 1.0.2 → 1.0.4

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.
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from "@storybook/react";
2
- import { VirtualDiffViewer } from "../..";
3
2
  import type { DifferOptions } from "json-diff-kit";
3
+ import { VirtualDiffViewer } from "../..";
4
4
  type StoryProps = React.ComponentProps<typeof VirtualDiffViewer> & {
5
5
  detectCircular?: boolean;
6
6
  maxDepth?: number;
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
- import { DiffMinimapProps } from "../types";
2
+ import type { DiffMinimapProps } from "../types";
3
3
  export declare const DiffMinimap: React.FC<DiffMinimapProps>;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { VirtualizedDiffViewerProps } from "../types";
2
+ import type { VirtualizedDiffViewerProps } from "../types";
3
3
  import "../styles/JsonDiffCustomTheme.css";
4
4
  export declare const VirtualizedDiffViewer: React.FC<VirtualizedDiffViewerProps>;
5
5
  export default VirtualizedDiffViewer;
@@ -1,33 +1,33 @@
1
- import { DiffResult, DifferOptions } from "json-diff-kit";
2
- export interface DiffRow extends DiffResult {
1
+ import type { DifferOptions, DiffResult } from "json-diff-kit";
2
+ export type DiffRow = {
3
3
  originalIndex: number;
4
- }
4
+ } & DiffResult;
5
5
  export type DiffRowOrCollapsed = DiffRow | CollapsedLine;
6
- export interface SegmentItem {
6
+ export type SegmentItem = {
7
7
  start: number;
8
8
  end: number;
9
9
  isEqual: boolean;
10
10
  isExpanded?: boolean;
11
11
  originalStart?: number;
12
12
  originalEnd?: number;
13
- }
14
- export interface HiddenUnchangedLinesInfo extends SegmentItem {
13
+ };
14
+ export type HiddenUnchangedLinesInfo = {
15
15
  hasLinesBefore: boolean;
16
16
  hasLinesAfter: boolean;
17
- }
18
- export interface CollapsedLine {
17
+ } & SegmentItem;
18
+ export type CollapsedLine = {
19
19
  type: "collapsed";
20
20
  segmentIndex: number;
21
21
  originalIndex: number;
22
22
  level: number;
23
23
  text: string;
24
- }
25
- export interface SearchState {
24
+ };
25
+ export type SearchState = {
26
26
  term: string;
27
27
  results: number[];
28
28
  currentIndex: number;
29
- }
30
- export interface VirtualizedDiffViewerProps {
29
+ };
30
+ export type VirtualizedDiffViewerProps = {
31
31
  oldValue: object;
32
32
  newValue: object;
33
33
  height: number;
@@ -38,8 +38,9 @@ export interface VirtualizedDiffViewerProps {
38
38
  onSearchMatch?: (index: number) => void;
39
39
  differOptions?: DifferOptions;
40
40
  className?: string;
41
- }
42
- export interface DiffMinimapProps {
41
+ miniMapWidth?: number;
42
+ };
43
+ export type DiffMinimapProps = {
43
44
  leftDiff: DiffRowOrCollapsed[];
44
45
  rightDiff: DiffRowOrCollapsed[];
45
46
  height: number;
@@ -47,4 +48,5 @@ export interface DiffMinimapProps {
47
48
  currentScrollTop: number;
48
49
  searchResults?: number[];
49
50
  currentMatchIndex?: number;
50
- }
51
+ miniMapWidth?: number;
52
+ };
@@ -1,3 +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;
1
+ import type { DiffRowOrCollapsed } from "../types";
2
+ export declare function performSearch(term: string, leftView: DiffRowOrCollapsed[]): number[];
3
+ export declare function highlightMatches(term: string, className?: string): void;
@@ -1,5 +1,5 @@
1
- import { DiffResult } from "json-diff-kit";
2
- import { SegmentItem, DiffRowOrCollapsed } from "../types";
1
+ import type { DiffResult } from "json-diff-kit";
2
+ import type { DiffRowOrCollapsed, SegmentItem } from "../types";
3
3
  export declare function preprocessDiffs(diff: DiffResult[], contextSize?: number, collapseThreshold?: number): DiffRowOrCollapsed[];
4
4
  export declare function generateSegments(diff: DiffResult[], contextSize?: number): SegmentItem[];
5
5
  export declare function buildViewFromSegments(segments: SegmentItem[], diff: DiffResult[], contextSize?: number): DiffRowOrCollapsed[];
@@ -1 +1 @@
1
- export declare const SearchIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ export declare function SearchIcon(): import("react/jsx-runtime").JSX.Element;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { DifferOptions } from 'json-diff-kit';
3
3
 
4
- interface VirtualizedDiffViewerProps {
4
+ type VirtualizedDiffViewerProps = {
5
5
  oldValue: object;
6
6
  newValue: object;
7
7
  height: number;
@@ -12,7 +12,8 @@ interface VirtualizedDiffViewerProps {
12
12
  onSearchMatch?: (index: number) => void;
13
13
  differOptions?: DifferOptions;
14
14
  className?: string;
15
- }
15
+ miniMapWidth?: number;
16
+ };
16
17
 
17
18
  declare const VirtualizedDiffViewer: React.FC<VirtualizedDiffViewerProps>;
18
19
 
package/package.json CHANGED
@@ -1,19 +1,13 @@
1
1
  {
2
2
  "name": "virtual-react-json-diff",
3
- "version": "1.0.2",
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"
3
+ "type": "module",
4
+ "version": "1.0.4",
5
+ "description": "Fast, virtualized React component for visually comparing large JSON objects. Includes search, theming, and minimap.",
6
+ "author": {
7
+ "name": "Utku Akyüz"
16
8
  },
9
+ "license": "MIT",
10
+ "homepage": "https://virtual-react-json-diff.netlify.app",
17
11
  "repository": {
18
12
  "type": "git",
19
13
  "url": "https://github.com/utkuakyuz/virtual-react-json-diff"
@@ -21,24 +15,45 @@
21
15
  "bugs": {
22
16
  "url": "https://github.com/utkuakyuz/virtual-react-json-diff/issues"
23
17
  },
24
- "homepage": "https://virtual-react-json-diff.netlify.app",
25
- "author": {
26
- "name": "Utku Akyüz"
27
- },
28
- "license": "MIT",
29
- "type": "module",
30
18
  "keywords": [
31
19
  "react",
32
20
  "json",
33
21
  "diff",
34
- "json-diff",
35
- "viewer",
36
- "json-diff-kit",
37
- "virtual-scroll",
38
- "theme",
39
- "search"
22
+ "json diff",
23
+ "json compare",
24
+ "diff viewer",
25
+ "react json diff",
26
+ "json visualizer",
27
+ "json viewer",
28
+ "virtual scroll",
29
+ "large json",
30
+ "compare json",
31
+ "react diff viewer"
32
+ ],
33
+ "main": "dist/cjs/index.js",
34
+ "types": "dist/index.d.ts",
35
+ "files": [
36
+ "dist"
40
37
  ],
38
+ "scripts": {
39
+ "build": "bun run rollup",
40
+ "prepublishOnly": "bun run build",
41
+ "rollup": "rollup -c --bundleConfigAsCjs",
42
+ "storybook": "storybook dev -p 6006",
43
+ "build-storybook": "storybook build",
44
+ "lint": "eslint",
45
+ "lint:fix": "eslint --fix"
46
+ },
47
+ "peerDependencies": {
48
+ "react": "^18.0.0"
49
+ },
50
+ "dependencies": {
51
+ "json-diff-kit": "^1.0.32",
52
+ "react-window": "^1.8.11"
53
+ },
41
54
  "devDependencies": {
55
+ "@antfu/eslint-config": "^5.2.1",
56
+ "@eslint-react/eslint-plugin": "^1.52.6",
42
57
  "@fontsource/inter": "^5.1.1",
43
58
  "@rollup/plugin-commonjs": "^25.0.3",
44
59
  "@rollup/plugin-image": "^3.0.3",
@@ -55,22 +70,26 @@
55
70
  "@types/node": "^22.14.1",
56
71
  "@types/react": "^18.2.15",
57
72
  "@types/react-window": "^1.8.8",
73
+ "eslint": "^9.33.0",
74
+ "eslint-plugin-format": "^1.0.1",
75
+ "eslint-plugin-react-hooks": "^5.2.0",
76
+ "eslint-plugin-react-refresh": "^0.4.20",
77
+ "lint-staged": "^16.1.5",
58
78
  "postcss": "^8.5.1",
59
- "prettier": "^2.5.1",
60
79
  "react": "^18.2.0",
61
80
  "rollup": "^3.26.3",
62
81
  "rollup-plugin-dts": "^5.3.0",
63
82
  "rollup-plugin-peer-deps-external": "^2.2.4",
64
83
  "rollup-plugin-postcss": "^4.0.2",
84
+ "simple-git-hooks": "^2.13.1",
65
85
  "storybook": "8.6.0-alpha.0",
66
86
  "tslib": "^2.6.0",
67
87
  "typescript": "^5.1.6"
68
88
  },
69
- "peerDependencies": {
70
- "react": "^18.0.0"
89
+ "simple-git-hooks": {
90
+ "pre-commit": "pnpm lint-staged"
71
91
  },
72
- "dependencies": {
73
- "json-diff-kit": "^1.0.32",
74
- "react-window": "^1.8.11"
92
+ "lint-staged": {
93
+ "*.{js,jsx,ts,tsx,vue,html,md,json,yaml,css,scss}": "eslint --fix"
75
94
  }
76
95
  }