Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-diff-view

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-diff-view - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

2

esm/Decoration/index.d.ts

@@ -8,2 +8,2 @@ import { ReactNode } from 'react';

}
export default function Decoration(props: DecorationProps): JSX.Element;
export default function Decoration(props: DecorationProps): import("react/jsx-runtime").JSX.Element;

@@ -1,3 +0,2 @@

/// <reference types="react" />
import { ActualDecorationProps } from './interface';
export default function SplitDecoration(props: ActualDecorationProps): JSX.Element;
export default function SplitDecoration(props: ActualDecorationProps): import("react/jsx-runtime").JSX.Element;

@@ -1,3 +0,2 @@

/// <reference types="react" />
import { ActualDecorationProps } from './interface';
export default function UnifiedDecoration(props: ActualDecorationProps): JSX.Element;
export default function UnifiedDecoration(props: ActualDecorationProps): import("react/jsx-runtime").JSX.Element;

@@ -27,4 +27,4 @@ import { ReactElement, ReactNode } from 'react';

}
declare function Diff(props: DiffProps): JSX.Element;
declare function Diff(props: DiffProps): import("react/jsx-runtime").JSX.Element;
declare const _default: import("react").MemoExoticComponent<typeof Diff>;
export default _default;

@@ -7,4 +7,4 @@ import { ComponentType } from 'react';

oldSource: Source;
}): JSX.Element;
}): import("react/jsx-runtime").JSX.Element;
displayName: string;
};

@@ -10,4 +10,4 @@ import { ComponentType } from 'react';

onToggleChangeSelection: (args: ChangeEventArgs) => void;
}): JSX.Element;
}): import("react/jsx-runtime").JSX.Element;
displayName: string;
};

@@ -9,4 +9,4 @@ import { ComponentType } from 'react';

onExpandRange: (start: number, end: number) => void;
}): JSX.Element;
}): import("react/jsx-runtime").JSX.Element;
displayName: string;
};

@@ -13,5 +13,5 @@ import { ComponentType } from 'react';

export default function withTokenizeWorkerwithTokenizeWorker<T extends TokenizePayload>(worker: Worker, options?: ToeknizeWorkerHocOptions<T>): <P>(ComponentIn: ComponentType<P & TokenizeResult>) => {
(props: P & RequiredProps): JSX.Element;
(props: P & RequiredProps): import("react/jsx-runtime").JSX.Element;
displayName: string;
};
export {};

@@ -5,2 +5,3 @@ import { HTMLAttributes } from 'react';

export interface CodeCellProps extends HTMLAttributes<HTMLTableCellElement> {
changeKey: string;
text: string;

@@ -10,4 +11,4 @@ tokens: TokenNode[] | null;

}
declare function CodeCell(props: CodeCellProps): JSX.Element;
declare function CodeCell(props: CodeCellProps): import("react/jsx-runtime").JSX.Element;
declare const _default: import("react").MemoExoticComponent<typeof CodeCell>;
export default _default;

@@ -20,9 +20,16 @@ import { jsx as _jsx } from "react/jsx-runtime";

};
function isEmptyToken(tokens) {
if (tokens.length > 1) {
return false;
}
const [token] = tokens;
return token.type === 'text' && !token.value;
}
function CodeCell(props) {
const { text, tokens, renderToken, ...attributes } = props;
const { changeKey, text, tokens, renderToken, ...attributes } = props;
const actualRenderToken = renderToken
? (token, i) => renderToken(token, defaultRenderToken, i)
: defaultRenderToken;
return (_jsx("td", { ...attributes, children: tokens
? (tokens.length ? tokens.map(actualRenderToken) : ' ')
return (_jsx("td", { ...attributes, "data-change-key": changeKey, children: tokens
? (isEmptyToken(tokens) ? ' ' : tokens.map(actualRenderToken))
: (text || ' ') }));

@@ -29,0 +36,0 @@ }

@@ -1,2 +0,1 @@

/// <reference types="react" />
import { HunkData } from '../utils';

@@ -6,3 +5,3 @@ export interface HunkProps {

}
declare function Hunk({ hunk }: HunkProps): JSX.Element;
declare function Hunk({ hunk }: HunkProps): import("react/jsx-runtime").JSX.Element;
export default Hunk;

@@ -1,3 +0,2 @@

/// <reference types="react" />
import { ActualHunkProps } from '../interface';
export default function SplitHunk(props: ActualHunkProps): JSX.Element;
export default function SplitHunk(props: ActualHunkProps): import("react/jsx-runtime").JSX.Element;

@@ -15,4 +15,4 @@ /// <reference types="react" />

}
declare function SplitChange(props: SplitChangeProps): JSX.Element;
declare function SplitChange(props: SplitChangeProps): import("react/jsx-runtime").JSX.Element;
declare const _default: import("react").MemoExoticComponent<typeof SplitChange>;
export default _default;

@@ -5,2 +5,3 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";

import { mapValues } from 'lodash';
import { getChangeKey } from '../../utils';
import CodeCell from '../CodeCell';

@@ -35,2 +36,3 @@ import { composeCallback, renderDefaultBy, wrapInAnchorBy } from '../utils';

const { type, content } = change;
const changeKey = getChangeKey(change);
const sideName = side === SIDE_OLD ? 'old' : 'new';

@@ -59,4 +61,4 @@ const gutterClassNameValue = classNames('diff-gutter', `diff-gutter-${type}`, {

return [
!hideGutter && _jsx("td", { ...gutterProps }, "gutter"),
_jsx(CodeCell, { className: codeClassNameValue, text: content, tokens: tokens, renderToken: renderToken, ...codeEvents }, "code"),
!hideGutter && _jsx("td", { ...gutterProps, "data-change-key": changeKey }, "gutter"),
_jsx(CodeCell, { className: codeClassNameValue, changeKey: changeKey, text: content, tokens: tokens, renderToken: renderToken, ...codeEvents }, "code"),
];

@@ -63,0 +65,0 @@ }

@@ -8,2 +8,2 @@ import { ReactNode } from 'react';

}
export default function SplitWidget({ hideGutter, oldElement, newElement, monotonous }: SplitWidgetProps): JSX.Element;
export default function SplitWidget({ hideGutter, oldElement, newElement, monotonous }: SplitWidgetProps): import("react/jsx-runtime").JSX.Element;

@@ -1,3 +0,2 @@

/// <reference types="react" />
import { ActualHunkProps } from '../interface';
export default function UnifiedHunk(props: ActualHunkProps): JSX.Element;
export default function UnifiedHunk(props: ActualHunkProps): import("react/jsx-runtime").JSX.Element;

@@ -11,4 +11,4 @@ /// <reference types="react" />

}
declare function UnifiedChange(props: UnifiedChangeProps): JSX.Element;
declare function UnifiedChange(props: UnifiedChangeProps): import("react/jsx-runtime").JSX.Element;
declare const _default: import("react").MemoExoticComponent<typeof UnifiedChange>;
export default _default;

@@ -5,2 +5,3 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";

import { mapValues } from 'lodash';
import { getChangeKey } from '../../utils';
import CodeCell from '../CodeCell';

@@ -22,3 +23,3 @@ import { composeCallback, renderDefaultBy, wrapInAnchorBy } from '../utils';

}
function renderGutterCell(className, change, side, gutterAnchor, anchorTarget, events, inHoverState, renderGutter) {
function renderGutterCell(className, change, changeKey, side, gutterAnchor, anchorTarget, events, inHoverState, renderGutter) {
const gutterOptions = {

@@ -31,3 +32,3 @@ change,

};
return (_jsx("td", { className: className, ...events, children: renderGutter(gutterOptions) }));
return (_jsx("td", { className: className, ...events, "data-change-key": changeKey, children: renderGutter(gutterOptions) }));
}

@@ -37,2 +38,3 @@ function UnifiedChange(props) {

const { type, content } = change;
const changeKey = getChangeKey(change);
const [hover, hoverOn, hoverOff] = useBoolean();

@@ -45,5 +47,5 @@ const eventArg = useMemo(() => ({ change }), [change]);

const codeClassNameValue = classNames('diff-code', `diff-code-${type}`, codeClassName, { 'diff-code-selected': selected });
return (_jsxs("tr", { id: anchorID, className: classNames('diff-line', className), children: [!hideGutter && renderGutterCell(gutterClassNameValue, change, 'old', gutterAnchor, anchorID, boundGutterEvents, hover, renderGutter), !hideGutter && renderGutterCell(gutterClassNameValue, change, 'new', gutterAnchor, anchorID, boundGutterEvents, hover, renderGutter), _jsx(CodeCell, { className: codeClassNameValue, text: content, tokens: tokens, renderToken: renderToken, ...boundCodeEvents })] }));
return (_jsxs("tr", { id: anchorID, className: classNames('diff-line', className), children: [!hideGutter && renderGutterCell(gutterClassNameValue, change, changeKey, 'old', gutterAnchor, anchorID, boundGutterEvents, hover, renderGutter), !hideGutter && renderGutterCell(gutterClassNameValue, change, changeKey, 'new', gutterAnchor, anchorID, boundGutterEvents, hover, renderGutter), _jsx(CodeCell, { className: codeClassNameValue, changeKey: changeKey, text: content, tokens: tokens, renderToken: renderToken, ...boundCodeEvents })] }));
}
export default memo(UnifiedChange);
//# sourceMappingURL=UnifiedChange.js.map

@@ -6,2 +6,2 @@ import { ReactNode } from 'react';

}
export default function UnifiedWidget({ hideGutter, element }: UnifiedWidgetProps): JSX.Element;
export default function UnifiedWidget({ hideGutter, element }: UnifiedWidgetProps): import("react/jsx-runtime").JSX.Element;

@@ -71,3 +71,2 @@ import { findIndex, flatMap, flatten } from 'lodash';

function diffText(x, y) {
// @ts-expect-error official types incorrect
const dmp = new DiffMatchPatch();

@@ -74,0 +73,0 @@ const diffs = dmp.diff_main(x, y);

{
"name": "react-diff-view",
"version": "3.1.0",
"version": "3.2.0",
"description": "A git diff component to consume the git unified diff output.",

@@ -39,47 +39,43 @@ "main": "./cjs/index.js",

"devDependencies": {
"@ant-design/icons": "^5.0.1",
"@babel/core": "^7.21.0",
"@babel/eslint-parser": "^7.19.1",
"@babel/eslint-plugin": "^7.19.1",
"@ant-design/icons": "^5.2.6",
"@babel/core": "^7.23.3",
"@babel/eslint-parser": "^7.23.3",
"@babel/eslint-plugin": "^7.22.10",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.21.0",
"@babel/plugin-proposal-export-default-from": "^7.18.10",
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@ecomfe/eslint-config": "^7.4.0",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@reskript/cli": "5.7.4",
"@reskript/cli-build": "5.7.4",
"@reskript/cli-dev": "5.7.4",
"@reskript/settings": "5.7.4",
"@rollup/plugin-typescript": "^11.0.0",
"@types/dedent": "^0.7.0",
"@types/diff-match-patch": "^1.0.32",
"@types/lodash": "^4.14.191",
"@types/react-test-renderer": "^18.0.0",
"@babel/preset-env": "^7.23.3",
"@babel/preset-react": "^7.23.3",
"@ecomfe/eslint-config": "^8.0.0",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@reskript/cli": "6.0.3",
"@reskript/cli-build": "6.0.3",
"@reskript/cli-dev": "6.0.3",
"@reskript/settings": "6.0.3",
"@rollup/plugin-typescript": "^11.1.5",
"@types/dedent": "^0.7.2",
"@types/diff-match-patch": "^1.0.36",
"@types/lodash": "^4.14.201",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"@types/react-test-renderer": "^18.0.6",
"@types/refractor": "^2.8.0",
"@types/sha1": "^1.1.3",
"@types/warning": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"antd": "^5.3.1",
"autoprefixer": "^10.4.14",
"@types/sha1": "^1.1.5",
"@types/warning": "^3.0.3",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"antd": "^5.11.1",
"autoprefixer": "^10.4.16",
"babel-plugin-add-react-displayname": "0.0.5",
"babel-plugin-import": "^1.13.6",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-react-require": "^3.1.3",
"core-js": "^3.29.1",
"cssnano": "^5.1.15",
"dedent": "^0.7.0",
"eslint": "^8.36.0",
"eslint-plugin-react": "^7.32.2",
"core-js": "^3.33.2",
"cssnano": "^6.0.1",
"dedent": "^1.5.1",
"eslint": "^8.53.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^8.0.3",
"nanoid": "^4.0.1",
"postcss": "^8.4.21",
"nanoid": "^5.0.3",
"postcss": "^8.4.31",
"postcss-cli": "^10.1.0",
"postcss-custom-properties": "^13.1.4",
"postcss-custom-properties": "^13.3.2",
"prism-color-variables": "^1.0.1",

@@ -89,7 +85,6 @@ "react": "^18.2.0",

"react-infinite-scroller": "^1.2.6",
"react-markdown": "^8.0.5",
"react-test-renderer": "^18.2.0",
"react-timeago": "^7.1.0",
"react-timeago": "^7.2.0",
"refractor": "^2.10.1",
"rollup": "^3.19.1",
"rollup": "^4.4.0",
"rollup-plugin-auto-external": "^2.0.0",

@@ -103,6 +98,6 @@ "rollup-plugin-babel": "^4.4.0",

"standard-version": "^9.5.0",
"typescript": "^4.9.5",
"unidiff": "^1.0.2",
"vitest": "^0.29.2",
"webpack": "^5.76.1"
"typescript": "^5.2.2",
"unidiff": "^1.0.4",
"vitest": "^0.34.6",
"webpack": "^5.89.0"
},

@@ -135,3 +130,3 @@ "peerDependencies": {

],
"packageManager": "yarn@3.4.1"
"packageManager": "yarn@4.0.1"
}

@@ -8,2 +8,2 @@ import { ReactNode } from 'react';

}
export default function Decoration(props: DecorationProps): JSX.Element;
export default function Decoration(props: DecorationProps): import("react/jsx-runtime").JSX.Element;

@@ -1,3 +0,2 @@

/// <reference types="react" />
import { ActualDecorationProps } from './interface';
export default function SplitDecoration(props: ActualDecorationProps): JSX.Element;
export default function SplitDecoration(props: ActualDecorationProps): import("react/jsx-runtime").JSX.Element;

@@ -1,3 +0,2 @@

/// <reference types="react" />
import { ActualDecorationProps } from './interface';
export default function UnifiedDecoration(props: ActualDecorationProps): JSX.Element;
export default function UnifiedDecoration(props: ActualDecorationProps): import("react/jsx-runtime").JSX.Element;

@@ -27,4 +27,4 @@ import { ReactElement, ReactNode } from 'react';

}
declare function Diff(props: DiffProps): JSX.Element;
declare function Diff(props: DiffProps): import("react/jsx-runtime").JSX.Element;
declare const _default: import("react").MemoExoticComponent<typeof Diff>;
export default _default;

@@ -7,4 +7,4 @@ import { ComponentType } from 'react';

oldSource: Source;
}): JSX.Element;
}): import("react/jsx-runtime").JSX.Element;
displayName: string;
};

@@ -10,4 +10,4 @@ import { ComponentType } from 'react';

onToggleChangeSelection: (args: ChangeEventArgs) => void;
}): JSX.Element;
}): import("react/jsx-runtime").JSX.Element;
displayName: string;
};

@@ -9,4 +9,4 @@ import { ComponentType } from 'react';

onExpandRange: (start: number, end: number) => void;
}): JSX.Element;
}): import("react/jsx-runtime").JSX.Element;
displayName: string;
};

@@ -13,5 +13,5 @@ import { ComponentType } from 'react';

export default function withTokenizeWorkerwithTokenizeWorker<T extends TokenizePayload>(worker: Worker, options?: ToeknizeWorkerHocOptions<T>): <P>(ComponentIn: ComponentType<P & TokenizeResult>) => {
(props: P & RequiredProps): JSX.Element;
(props: P & RequiredProps): import("react/jsx-runtime").JSX.Element;
displayName: string;
};
export {};

@@ -5,2 +5,3 @@ import { HTMLAttributes } from 'react';

export interface CodeCellProps extends HTMLAttributes<HTMLTableCellElement> {
changeKey: string;
text: string;

@@ -10,4 +11,4 @@ tokens: TokenNode[] | null;

}
declare function CodeCell(props: CodeCellProps): JSX.Element;
declare function CodeCell(props: CodeCellProps): import("react/jsx-runtime").JSX.Element;
declare const _default: import("react").MemoExoticComponent<typeof CodeCell>;
export default _default;

@@ -1,2 +0,1 @@

/// <reference types="react" />
import { HunkData } from '../utils';

@@ -6,3 +5,3 @@ export interface HunkProps {

}
declare function Hunk({ hunk }: HunkProps): JSX.Element;
declare function Hunk({ hunk }: HunkProps): import("react/jsx-runtime").JSX.Element;
export default Hunk;

@@ -1,3 +0,2 @@

/// <reference types="react" />
import { ActualHunkProps } from '../interface';
export default function SplitHunk(props: ActualHunkProps): JSX.Element;
export default function SplitHunk(props: ActualHunkProps): import("react/jsx-runtime").JSX.Element;

@@ -15,4 +15,4 @@ /// <reference types="react" />

}
declare function SplitChange(props: SplitChangeProps): JSX.Element;
declare function SplitChange(props: SplitChangeProps): import("react/jsx-runtime").JSX.Element;
declare const _default: import("react").MemoExoticComponent<typeof SplitChange>;
export default _default;

@@ -8,2 +8,2 @@ import { ReactNode } from 'react';

}
export default function SplitWidget({ hideGutter, oldElement, newElement, monotonous }: SplitWidgetProps): JSX.Element;
export default function SplitWidget({ hideGutter, oldElement, newElement, monotonous }: SplitWidgetProps): import("react/jsx-runtime").JSX.Element;

@@ -1,3 +0,2 @@

/// <reference types="react" />
import { ActualHunkProps } from '../interface';
export default function UnifiedHunk(props: ActualHunkProps): JSX.Element;
export default function UnifiedHunk(props: ActualHunkProps): import("react/jsx-runtime").JSX.Element;

@@ -11,4 +11,4 @@ /// <reference types="react" />

}
declare function UnifiedChange(props: UnifiedChangeProps): JSX.Element;
declare function UnifiedChange(props: UnifiedChangeProps): import("react/jsx-runtime").JSX.Element;
declare const _default: import("react").MemoExoticComponent<typeof UnifiedChange>;
export default _default;

@@ -6,2 +6,2 @@ import { ReactNode } from 'react';

}
export default function UnifiedWidget({ hideGutter, element }: UnifiedWidgetProps): JSX.Element;
export default function UnifiedWidget({ hideGutter, element }: UnifiedWidgetProps): import("react/jsx-runtime").JSX.Element;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc