@git-diff-view/react 0.0.24 → 0.0.26
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.development.js +187 -131
- package/dist/cjs/index.development.js.map +1 -1
- package/dist/cjs/index.production.js +187 -131
- package/dist/cjs/index.production.js.map +1 -1
- package/dist/css/diff-view-pure.css +662 -0
- package/dist/css/diff-view.css +1150 -5
- package/dist/esm/index.mjs +189 -131
- package/dist/esm/index.mjs.map +1 -1
- package/index.d.ts +33 -120
- package/package.json +11 -10
- package/styles/diff-view-pure.css +662 -0
- package/styles/diff-view.css +1168 -0
package/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { CSSProperties, ForwardedRef, ReactNode } from 'react';
|
|
|
4
4
|
|
|
5
5
|
declare class Cache$1<K, V> extends Map<K, V> {
|
|
6
6
|
name: string;
|
|
7
|
+
get maxLength(): number;
|
|
7
8
|
setMaxLength(length: number): void;
|
|
8
9
|
set(key: K, value: V): this;
|
|
9
10
|
}
|
|
@@ -58,8 +59,8 @@ export declare class DiffFile {
|
|
|
58
59
|
splitLineLength: number;
|
|
59
60
|
unifiedLineLength: number;
|
|
60
61
|
fileLineLength: number;
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
additionLength: number;
|
|
63
|
+
deletionLength: number;
|
|
63
64
|
hasSomeLineCollapsed: boolean;
|
|
64
65
|
static createInstance(data: FileData_1, bundle?: ReturnType<DiffFile["getBundle"] | DiffFile["_getFullBundle"]>): DiffFile;
|
|
65
66
|
static createInstance(data: FileData_2, bundle?: ReturnType<DiffFile["getBundle"] | DiffFile["_getFullBundle"]>): DiffFile;
|
|
@@ -84,7 +85,11 @@ export declare class DiffFile {
|
|
|
84
85
|
getUnifiedHunkLine: (index: number) => DiffHunkItem;
|
|
85
86
|
onUnifiedHunkExpand: (dir: "up" | "down" | "all", index: number, needTrigger?: boolean) => void;
|
|
86
87
|
onAllExpand: (mode: "split" | "unified") => void;
|
|
88
|
+
get hasExpandSplitAll(): boolean;
|
|
89
|
+
get hasExpandUnifiedAll(): boolean;
|
|
87
90
|
onAllCollapse: (mode: "split" | "unified") => void;
|
|
91
|
+
getOldFileContent: () => string;
|
|
92
|
+
getNewFileContent: () => string;
|
|
88
93
|
getOldSyntaxLine: (lineNumber: number) => SyntaxLine;
|
|
89
94
|
getNewSyntaxLine: (lineNumber: number) => SyntaxLine;
|
|
90
95
|
subscribe: (listener: (() => void) & {
|
|
@@ -109,6 +114,8 @@ export declare class DiffFile {
|
|
|
109
114
|
splitLineLength: number;
|
|
110
115
|
unifiedLineLength: number;
|
|
111
116
|
fileLineLength: number;
|
|
117
|
+
additionLength: number;
|
|
118
|
+
deletionLength: number;
|
|
112
119
|
splitLeftLines: SplitLineItem[];
|
|
113
120
|
splitRightLines: SplitLineItem[];
|
|
114
121
|
splitHunkLines: Record<string, DiffHunkItem>;
|
|
@@ -118,6 +125,12 @@ export declare class DiffFile {
|
|
|
118
125
|
highlighterType: string;
|
|
119
126
|
composeByDiff: boolean;
|
|
120
127
|
hasSomeLineCollapsed: boolean;
|
|
128
|
+
hasExpandSplitAll: {
|
|
129
|
+
state: boolean;
|
|
130
|
+
};
|
|
131
|
+
hasExpandUnifiedAll: {
|
|
132
|
+
state: boolean;
|
|
133
|
+
};
|
|
121
134
|
version: string;
|
|
122
135
|
theme: "light" | "dark";
|
|
123
136
|
isFullMerge: boolean;
|
|
@@ -150,6 +163,8 @@ export declare class DiffFile {
|
|
|
150
163
|
splitLineLength: number;
|
|
151
164
|
unifiedLineLength: number;
|
|
152
165
|
fileLineLength: number;
|
|
166
|
+
additionLength: number;
|
|
167
|
+
deletionLength: number;
|
|
153
168
|
splitLeftLines: SplitLineItem[];
|
|
154
169
|
splitRightLines: SplitLineItem[];
|
|
155
170
|
splitHunkLines: Record<string, DiffHunkItem>;
|
|
@@ -159,6 +174,12 @@ export declare class DiffFile {
|
|
|
159
174
|
highlighterType: string;
|
|
160
175
|
composeByDiff: boolean;
|
|
161
176
|
hasSomeLineCollapsed: boolean;
|
|
177
|
+
hasExpandSplitAll: {
|
|
178
|
+
state: boolean;
|
|
179
|
+
};
|
|
180
|
+
hasExpandUnifiedAll: {
|
|
181
|
+
state: boolean;
|
|
182
|
+
};
|
|
162
183
|
version: string;
|
|
163
184
|
theme: "light" | "dark";
|
|
164
185
|
};
|
|
@@ -353,6 +374,7 @@ export declare const HiddenBidiCharsRegex: RegExp;
|
|
|
353
374
|
export declare const _cacheMap: Cache$1<string, File$1>;
|
|
354
375
|
export declare const checkDiffLineIncludeChange: (diffLine?: DiffLine) => boolean;
|
|
355
376
|
export declare const composeLen = 40;
|
|
377
|
+
export declare const disableCache: () => void;
|
|
356
378
|
export declare const getDiffRange: (additions: DiffLine[], deletions: DiffLine[], { getAdditionRaw, getDeletionRaw, }: {
|
|
357
379
|
getAdditionRaw: (lineNumber: number) => string;
|
|
358
380
|
getDeletionRaw: (lineNumber: number) => string;
|
|
@@ -627,125 +649,16 @@ export type SyntaxNode = {
|
|
|
627
649
|
};
|
|
628
650
|
children?: SyntaxNode[];
|
|
629
651
|
};
|
|
630
|
-
declare
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
setMode: (_mode: DiffModeEnum) => DiffModeEnum;
|
|
635
|
-
enableWrap: import("reactivity-store").Ref<boolean, boolean>;
|
|
636
|
-
setEnableWrap: (_enableWrap: boolean) => boolean;
|
|
637
|
-
enableAddWidget: import("reactivity-store").Ref<boolean, boolean>;
|
|
638
|
-
setEnableAddWidget: (_enableAddWidget: boolean) => boolean;
|
|
639
|
-
enableHighlight: import("reactivity-store").Ref<boolean, boolean>;
|
|
640
|
-
setEnableHighlight: (_enableHighlight: boolean) => boolean;
|
|
641
|
-
fontSize: import("reactivity-store").Ref<number, number>;
|
|
642
|
-
setFontSize: (_fontSize: number) => number;
|
|
643
|
-
extendData: import("reactivity-store").Ref<{
|
|
644
|
-
oldFile: {
|
|
645
|
-
[x: string]: {
|
|
646
|
-
data: any;
|
|
647
|
-
};
|
|
648
|
-
};
|
|
649
|
-
newFile: {
|
|
650
|
-
[x: string]: {
|
|
651
|
-
data: any;
|
|
652
|
-
};
|
|
653
|
-
};
|
|
654
|
-
}, {
|
|
655
|
-
oldFile: {
|
|
656
|
-
[x: string]: {
|
|
657
|
-
data: any;
|
|
658
|
-
};
|
|
659
|
-
};
|
|
660
|
-
newFile: {
|
|
661
|
-
[x: string]: {
|
|
662
|
-
data: any;
|
|
663
|
-
};
|
|
664
|
-
};
|
|
665
|
-
} | {
|
|
666
|
-
oldFile: {
|
|
667
|
-
[x: string]: {
|
|
668
|
-
data: any;
|
|
669
|
-
};
|
|
670
|
-
};
|
|
671
|
-
newFile: {
|
|
672
|
-
[x: string]: {
|
|
673
|
-
data: any;
|
|
674
|
-
};
|
|
675
|
-
};
|
|
676
|
-
}>;
|
|
677
|
-
setExtendData: (_extendData: DiffViewProps<any>["extendData"]) => void;
|
|
678
|
-
renderWidgetLine: import("reactivity-store").Ref<({ diffFile, side, lineNumber, onClose, }: {
|
|
679
|
-
lineNumber: number;
|
|
680
|
-
side: SplitSide;
|
|
681
|
-
diffFile: DiffFile;
|
|
682
|
-
onClose: () => void;
|
|
683
|
-
}) => import("react").ReactNode, ({ diffFile, side, lineNumber, onClose, }: {
|
|
684
|
-
lineNumber: number;
|
|
685
|
-
side: SplitSide;
|
|
686
|
-
diffFile: DiffFile;
|
|
687
|
-
onClose: () => void;
|
|
688
|
-
}) => import("react").ReactNode>;
|
|
689
|
-
setRenderWidgetLine: (_renderWidgetLine: ({ diffFile, side, lineNumber, onClose, }: {
|
|
690
|
-
lineNumber: number;
|
|
691
|
-
side: SplitSide;
|
|
692
|
-
diffFile: DiffFile;
|
|
693
|
-
onClose: () => void;
|
|
694
|
-
}) => import("react").ReactNode) => ({ diffFile, side, lineNumber, onClose, }: {
|
|
695
|
-
lineNumber: number;
|
|
696
|
-
side: SplitSide;
|
|
697
|
-
diffFile: DiffFile;
|
|
698
|
-
onClose: () => void;
|
|
699
|
-
}) => import("react").ReactNode;
|
|
700
|
-
renderExtendLine: import("reactivity-store").Ref<({ diffFile, side, data, lineNumber, onUpdate, }: {
|
|
701
|
-
lineNumber: number;
|
|
702
|
-
side: SplitSide;
|
|
703
|
-
data: any;
|
|
704
|
-
diffFile: DiffFile;
|
|
705
|
-
onUpdate: () => void;
|
|
706
|
-
}) => import("react").ReactNode, ({ diffFile, side, data, lineNumber, onUpdate, }: {
|
|
707
|
-
lineNumber: number;
|
|
708
|
-
side: SplitSide;
|
|
709
|
-
data: any;
|
|
710
|
-
diffFile: DiffFile;
|
|
711
|
-
onUpdate: () => void;
|
|
712
|
-
}) => import("react").ReactNode>;
|
|
713
|
-
setRenderExtendLine: (_renderExtendLine: ({ diffFile, side, data, lineNumber, onUpdate, }: {
|
|
714
|
-
lineNumber: number;
|
|
715
|
-
side: SplitSide;
|
|
716
|
-
data: any;
|
|
717
|
-
diffFile: DiffFile;
|
|
718
|
-
onUpdate: () => void;
|
|
719
|
-
}) => import("react").ReactNode) => ({ diffFile, side, data, lineNumber, onUpdate, }: {
|
|
720
|
-
lineNumber: number;
|
|
721
|
-
side: SplitSide;
|
|
722
|
-
data: any;
|
|
723
|
-
diffFile: DiffFile;
|
|
724
|
-
onUpdate: () => void;
|
|
725
|
-
}) => import("react").ReactNode;
|
|
726
|
-
onAddWidgetClick: {
|
|
727
|
-
current: (lineNumber: number, side: SplitSide) => void;
|
|
728
|
-
};
|
|
729
|
-
setOnAddWidgetClick: (_onAddWidgetClick: {
|
|
730
|
-
current: (lineNumber: number, side: SplitSide) => void;
|
|
731
|
-
}) => (lineNumber: number, side: SplitSide) => void;
|
|
732
|
-
}>;
|
|
652
|
+
export declare enum SplitSide {
|
|
653
|
+
old = 1,
|
|
654
|
+
new = 2
|
|
655
|
+
}
|
|
733
656
|
export declare enum DiffModeEnum {
|
|
734
657
|
SplitGitHub = 1,
|
|
735
658
|
SplitGitLab = 2,
|
|
736
659
|
Split = 3,
|
|
737
660
|
Unified = 4
|
|
738
661
|
}
|
|
739
|
-
export declare const DiffViewContext: import("react").Context<{
|
|
740
|
-
useDiffContext: ReturnType<typeof createDiffConfigStore>;
|
|
741
|
-
}>;
|
|
742
|
-
export declare const useDiffViewContext: () => {
|
|
743
|
-
useDiffContext: ReturnType<typeof createDiffConfigStore>;
|
|
744
|
-
};
|
|
745
|
-
export declare enum SplitSide {
|
|
746
|
-
old = 1,
|
|
747
|
-
new = 2
|
|
748
|
-
}
|
|
749
662
|
export type DiffViewProps<T> = {
|
|
750
663
|
data?: {
|
|
751
664
|
oldFile?: {
|
|
@@ -827,17 +740,17 @@ export type DiffViewProps_2<T> = Omit<DiffViewProps<T>, "data"> & {
|
|
|
827
740
|
hunks: string[];
|
|
828
741
|
};
|
|
829
742
|
};
|
|
830
|
-
declare function
|
|
743
|
+
declare function ReactDiffView<T>(props: DiffViewProps_1<T> & {
|
|
831
744
|
ref?: ForwardedRef<{
|
|
832
745
|
getDiffFileInstance: () => DiffFile;
|
|
833
746
|
}>;
|
|
834
|
-
}):
|
|
835
|
-
declare function
|
|
747
|
+
}): JSX.Element;
|
|
748
|
+
declare function ReactDiffView<T>(props: DiffViewProps_2<T> & {
|
|
836
749
|
ref?: ForwardedRef<{
|
|
837
750
|
getDiffFileInstance: () => DiffFile;
|
|
838
751
|
}>;
|
|
839
|
-
}):
|
|
840
|
-
export declare const DiffView: typeof
|
|
752
|
+
}): JSX.Element;
|
|
753
|
+
export declare const DiffView: typeof ReactDiffView;
|
|
841
754
|
export declare const version: string;
|
|
842
755
|
|
|
843
756
|
export {
|
package/package.json
CHANGED
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
"description": "@git-diff-view/react",
|
|
4
4
|
"author": "MrWangJustToDo",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.26",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"types": "index.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
|
+
"styles",
|
|
11
12
|
"index.js",
|
|
12
13
|
"index.d.ts"
|
|
13
14
|
],
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
},
|
|
29
30
|
"buildOptions": [
|
|
30
31
|
{
|
|
31
|
-
"input": "./src/index.
|
|
32
|
+
"input": "./src/index.ts",
|
|
32
33
|
"output": [
|
|
33
34
|
{
|
|
34
35
|
"dir": "./dist",
|
|
@@ -59,7 +60,7 @@
|
|
|
59
60
|
"react diff component"
|
|
60
61
|
],
|
|
61
62
|
"dependencies": {
|
|
62
|
-
"@git-diff-view/core": "^0.0.
|
|
63
|
+
"@git-diff-view/core": "^0.0.26",
|
|
63
64
|
"@types/hast": "^3.0.0",
|
|
64
65
|
"fast-diff": "^1.3.0",
|
|
65
66
|
"highlight.js": "^11.11.0",
|
|
@@ -70,18 +71,18 @@
|
|
|
70
71
|
"devDependencies": {
|
|
71
72
|
"@types/use-sync-external-store": "^0.0.6",
|
|
72
73
|
"autoprefixer": "^10.4.20",
|
|
73
|
-
"postcss": "^8.
|
|
74
|
-
"postcss-cli": "^11.0.0",
|
|
75
|
-
"postcss-import": "^16.1.0",
|
|
74
|
+
"postcss": "^8.5.1",
|
|
76
75
|
"react": "^18.0.0",
|
|
77
|
-
"tailwindcss": "^3.4.
|
|
76
|
+
"tailwindcss": "^3.4.17"
|
|
78
77
|
},
|
|
79
78
|
"peerDependencies": {
|
|
80
|
-
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
81
|
-
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
79
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
80
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
82
81
|
},
|
|
83
82
|
"scripts": {
|
|
84
83
|
"gen:type": "dts-bundle-generator -o index.d.ts dist/types/index.d.ts",
|
|
85
|
-
"gen:
|
|
84
|
+
"gen:css1": "postcss src/tailwind.css -o dist/css/diff-view.css",
|
|
85
|
+
"gen:css2": "postcss src/tailwind_pure.css -o dist/css/diff-view-pure.css",
|
|
86
|
+
"gen:css": "npm run gen:css1 && npm run gen:css2"
|
|
86
87
|
}
|
|
87
88
|
}
|