@git-diff-view/react 0.0.16 → 0.0.18

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/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;
@@ -19,12 +18,14 @@ declare class File$1 {
19
18
  syntaxFile: Record<number, SyntaxLine>;
20
19
  hasDoSyntax: boolean;
21
20
  syntaxLength?: number;
22
- highlighterName?: string;
21
+ highlighterName?: DiffHighlighter["name"];
22
+ highlighterType?: DiffHighlighter["type"];
23
23
  maxLineNumber: number;
24
24
  static createInstance(data: File$1): File$1;
25
25
  constructor(raw: string, lang: string, fileName?: string);
26
- doSyntax({ registerHighlighter }: {
26
+ doSyntax({ registerHighlighter, theme, }: {
27
27
  registerHighlighter?: Omit<DiffHighlighter, "getHighlighterEngine">;
28
+ theme?: "light" | "dark";
28
29
  }): void;
29
30
  doRaw(): void;
30
31
  }
@@ -76,6 +77,7 @@ export declare class DiffFile {
76
77
  initId(): void;
77
78
  getId(): string;
78
79
  clearId(): void;
80
+ initTheme(theme?: "light" | "dark"): void;
79
81
  initRaw(): void;
80
82
  initSyntax({ registerHighlighter }?: {
81
83
  registerHighlighter?: Omit<DiffHighlighter, "getHighlighterEngine">;
@@ -125,11 +127,13 @@ export declare class DiffFile {
125
127
  composeByDiff: boolean;
126
128
  hasSomeLineCollapsed: boolean;
127
129
  version: string;
130
+ theme: "light" | "dark";
128
131
  isFullMerge: boolean;
129
132
  };
130
133
  mergeBundle: (data: ReturnType<DiffFile["getBundle"]>) => void;
131
134
  _getHighlighterName: () => string;
132
135
  _getIsPureDiffRender: () => boolean;
136
+ _getTheme: () => "light" | "dark";
133
137
  _addClonedInstance: (instance: DiffFile) => void;
134
138
  _notifyOthers: (instance: DiffFile) => void;
135
139
  _delClonedInstance: (instance: DiffFile) => void;
@@ -163,6 +167,7 @@ export declare class DiffFile {
163
167
  composeByDiff: boolean;
164
168
  hasSomeLineCollapsed: boolean;
165
169
  version: string;
170
+ theme: "light" | "dark";
166
171
  };
167
172
  _mergeFullBundle: (data: ReturnType<DiffFile["_getFullBundle"]>) => void;
168
173
  _destroy: () => void;
@@ -356,7 +361,7 @@ export declare const _cacheMap: Cache$1<string, File$1>;
356
361
  export declare const checkDiffLineIncludeChange: (diffLine?: DiffLine) => boolean;
357
362
  export declare const composeLen = 40;
358
363
  export declare const getDiffRange: (additions: DiffLine[], deletions: DiffLine[]) => void;
359
- export declare const getFile: (raw: string, lang: string, fileName?: string, uuid?: string) => File$1;
364
+ export declare const getFile: (raw: string, lang: string, theme: "light" | "dark", fileName?: string, uuid?: string) => File$1;
360
365
  export declare const getLang: (fileName: string) => string;
361
366
  export declare const getSplitContentLines: (diffFile: DiffFile) => DiffSplitContentLineItem[];
362
367
  export declare const getSplitLines: (diffFile: DiffFile) => DiffSplitLineItem[];
@@ -517,11 +522,12 @@ export interface UnifiedLineItem {
517
522
  export type DiffAST = ReturnType<typeof lowlight.highlight>;
518
523
  export type DiffHighlighter = {
519
524
  name: string;
525
+ type: "class" | "style" | string;
520
526
  maxLineToIgnoreSyntax: number;
521
527
  setMaxLineToIgnoreSyntax: (v: number) => void;
522
528
  ignoreSyntaxHighlightList: (string | RegExp)[];
523
529
  setIgnoreSyntaxHighlightList: (v: (string | RegExp)[]) => void;
524
- getAST: (raw: string, fileName?: string, lang?: string) => DiffAST;
530
+ getAST: (raw: string, fileName?: string, lang?: string, theme?: "light" | "dark") => DiffAST;
525
531
  processAST: (ast: DiffAST) => {
526
532
  syntaxFileObject: Record<number, SyntaxLine>;
527
533
  syntaxFileLineNumber: number;
@@ -712,6 +718,7 @@ export type DiffViewProps<T> = {
712
718
  registerHighlighter?: Omit<DiffHighlighter, "getHighlighterEngine">;
713
719
  diffViewMode?: DiffModeEnum;
714
720
  diffViewWrap?: boolean;
721
+ diffViewTheme?: "light" | "dark";
715
722
  diffViewFontSize?: number;
716
723
  diffViewHighlight?: boolean;
717
724
  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.16",
6
+ "version": "0.0.18",
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.16",
60
+ "@git-diff-view/core": "^0.0.18",
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.5",
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
  }