@git-diff-view/react 0.0.15 → 0.0.17
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 +508 -477
- package/dist/cjs/index.development.js.map +1 -1
- package/dist/cjs/index.production.js +508 -477
- package/dist/cjs/index.production.js.map +1 -1
- package/dist/css/diff-view.css +13 -3
- package/dist/esm/index.mjs +496 -465
- package/dist/esm/index.mjs.map +1 -1
- package/index.d.ts +9 -4
- package/package.json +8 -5
package/index.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ declare class Cache$1<K, V> extends Map<K, V> {
|
|
|
6
6
|
name: string;
|
|
7
7
|
setMaxLength(length: number): void;
|
|
8
8
|
set(key: K, value: V): this;
|
|
9
|
-
_checkLength(): void;
|
|
10
9
|
}
|
|
11
10
|
declare class File$1 {
|
|
12
11
|
readonly raw: string;
|
|
@@ -23,8 +22,9 @@ declare class File$1 {
|
|
|
23
22
|
maxLineNumber: number;
|
|
24
23
|
static createInstance(data: File$1): File$1;
|
|
25
24
|
constructor(raw: string, lang: string, fileName?: string);
|
|
26
|
-
doSyntax({ registerHighlighter }: {
|
|
25
|
+
doSyntax({ registerHighlighter, theme, }: {
|
|
27
26
|
registerHighlighter?: Omit<DiffHighlighter, "getHighlighterEngine">;
|
|
27
|
+
theme?: "light" | "dark";
|
|
28
28
|
}): void;
|
|
29
29
|
doRaw(): void;
|
|
30
30
|
}
|
|
@@ -76,6 +76,7 @@ export declare class DiffFile {
|
|
|
76
76
|
initId(): void;
|
|
77
77
|
getId(): string;
|
|
78
78
|
clearId(): void;
|
|
79
|
+
initTheme(theme?: "light" | "dark"): void;
|
|
79
80
|
initRaw(): void;
|
|
80
81
|
initSyntax({ registerHighlighter }?: {
|
|
81
82
|
registerHighlighter?: Omit<DiffHighlighter, "getHighlighterEngine">;
|
|
@@ -125,11 +126,13 @@ export declare class DiffFile {
|
|
|
125
126
|
composeByDiff: boolean;
|
|
126
127
|
hasSomeLineCollapsed: boolean;
|
|
127
128
|
version: string;
|
|
129
|
+
theme: "light" | "dark";
|
|
128
130
|
isFullMerge: boolean;
|
|
129
131
|
};
|
|
130
132
|
mergeBundle: (data: ReturnType<DiffFile["getBundle"]>) => void;
|
|
131
133
|
_getHighlighterName: () => string;
|
|
132
134
|
_getIsPureDiffRender: () => boolean;
|
|
135
|
+
_getTheme: () => "light" | "dark";
|
|
133
136
|
_addClonedInstance: (instance: DiffFile) => void;
|
|
134
137
|
_notifyOthers: (instance: DiffFile) => void;
|
|
135
138
|
_delClonedInstance: (instance: DiffFile) => void;
|
|
@@ -163,6 +166,7 @@ export declare class DiffFile {
|
|
|
163
166
|
composeByDiff: boolean;
|
|
164
167
|
hasSomeLineCollapsed: boolean;
|
|
165
168
|
version: string;
|
|
169
|
+
theme: "light" | "dark";
|
|
166
170
|
};
|
|
167
171
|
_mergeFullBundle: (data: ReturnType<DiffFile["_getFullBundle"]>) => void;
|
|
168
172
|
_destroy: () => void;
|
|
@@ -356,7 +360,7 @@ export declare const _cacheMap: Cache$1<string, File$1>;
|
|
|
356
360
|
export declare const checkDiffLineIncludeChange: (diffLine?: DiffLine) => boolean;
|
|
357
361
|
export declare const composeLen = 40;
|
|
358
362
|
export declare const getDiffRange: (additions: DiffLine[], deletions: DiffLine[]) => void;
|
|
359
|
-
export declare const getFile: (raw: string, lang: string, fileName?: string, uuid?: string) => File$1;
|
|
363
|
+
export declare const getFile: (raw: string, lang: string, theme: "light" | "dark", fileName?: string, uuid?: string) => File$1;
|
|
360
364
|
export declare const getLang: (fileName: string) => string;
|
|
361
365
|
export declare const getSplitContentLines: (diffFile: DiffFile) => DiffSplitContentLineItem[];
|
|
362
366
|
export declare const getSplitLines: (diffFile: DiffFile) => DiffSplitLineItem[];
|
|
@@ -521,7 +525,7 @@ export type DiffHighlighter = {
|
|
|
521
525
|
setMaxLineToIgnoreSyntax: (v: number) => void;
|
|
522
526
|
ignoreSyntaxHighlightList: (string | RegExp)[];
|
|
523
527
|
setIgnoreSyntaxHighlightList: (v: (string | RegExp)[]) => void;
|
|
524
|
-
getAST: (raw: string, fileName?: string, lang?: string) => DiffAST;
|
|
528
|
+
getAST: (raw: string, fileName?: string, lang?: string, theme?: "light" | "dark") => DiffAST;
|
|
525
529
|
processAST: (ast: DiffAST) => {
|
|
526
530
|
syntaxFileObject: Record<number, SyntaxLine>;
|
|
527
531
|
syntaxFileLineNumber: number;
|
|
@@ -712,6 +716,7 @@ export type DiffViewProps<T> = {
|
|
|
712
716
|
registerHighlighter?: Omit<DiffHighlighter, "getHighlighterEngine">;
|
|
713
717
|
diffViewMode?: DiffModeEnum;
|
|
714
718
|
diffViewWrap?: boolean;
|
|
719
|
+
diffViewTheme?: "light" | "dark";
|
|
715
720
|
diffViewFontSize?: number;
|
|
716
721
|
diffViewHighlight?: boolean;
|
|
717
722
|
diffViewAddWidget?: boolean;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "@git-diff-view/react",
|
|
4
4
|
"author": "MrWangJustToDo",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.17",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"types": "index.d.ts",
|
|
9
9
|
"files": [
|
|
@@ -57,19 +57,21 @@
|
|
|
57
57
|
"react diff component"
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@git-diff-view/core": "^0.0.
|
|
60
|
+
"@git-diff-view/core": "^0.0.17",
|
|
61
61
|
"@types/hast": "^3.0.0",
|
|
62
|
+
"fast-diff": "^1.3.0",
|
|
62
63
|
"highlight.js": "^11.9.0",
|
|
63
64
|
"lowlight": "^3.1.0",
|
|
64
|
-
"reactivity-store": "^0.3.
|
|
65
|
+
"reactivity-store": "^0.3.6",
|
|
65
66
|
"use-sync-external-store": "^1.2.2"
|
|
66
67
|
},
|
|
67
68
|
"devDependencies": {
|
|
68
69
|
"@types/use-sync-external-store": "^0.0.3",
|
|
69
70
|
"autoprefixer": "^10.4.20",
|
|
70
71
|
"postcss": "^8.4.43",
|
|
72
|
+
"postcss-cli": "^11.0.0",
|
|
73
|
+
"postcss-import": "^16.1.0",
|
|
71
74
|
"react": "^18.0.0",
|
|
72
|
-
"tailwind-scrollbar-hide": "^1.1.7",
|
|
73
75
|
"tailwindcss": "^3.4.10"
|
|
74
76
|
},
|
|
75
77
|
"peerDependencies": {
|
|
@@ -77,6 +79,7 @@
|
|
|
77
79
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
78
80
|
},
|
|
79
81
|
"scripts": {
|
|
80
|
-
"gen:type": "dts-bundle-generator -o index.d.ts dist/types/index.d.ts"
|
|
82
|
+
"gen:type": "dts-bundle-generator -o index.d.ts dist/types/index.d.ts",
|
|
83
|
+
"gen:css": "postcss src/style --dir dist/css"
|
|
81
84
|
}
|
|
82
85
|
}
|