@git-diff-view/react 0.1.1 → 0.1.3

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.
@@ -1805,7 +1805,7 @@ const InternalDiffView = (props) => {
1805
1805
  }, [useDiffContext, wrapperRef]);
1806
1806
  const value = React.useMemo(() => ({ useDiffContext }), [useDiffContext]);
1807
1807
  return (React__namespace.createElement(DiffViewContext.Provider, { value: value },
1808
- React__namespace.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-theme": diffFile._getTheme() || "light", "data-version": "0.1.1", "data-highlighter": diffFile._getHighlighterName(), ref: wrapperRef },
1808
+ React__namespace.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-theme": diffFile._getTheme() || "light", "data-version": "0.1.3", "data-highlighter": diffFile._getHighlighterName(), ref: wrapperRef },
1809
1809
  React__namespace.createElement("div", { className: "diff-style-root", style: {
1810
1810
  // @ts-ignore
1811
1811
  [diffFontSizeName]: diffViewFontSize + "px",
@@ -1895,7 +1895,7 @@ const DiffViewWithRef = (props, ref) => {
1895
1895
  const InnerDiffView = React.forwardRef(DiffViewWithRef);
1896
1896
  InnerDiffView.displayName = "DiffView";
1897
1897
  const DiffView = InnerDiffView;
1898
- const version = "0.1.1";
1898
+ const version = "0.1.3";
1899
1899
 
1900
1900
  Object.defineProperty(exports, "SplitSide", {
1901
1901
  enumerable: true,
@@ -1805,7 +1805,7 @@ const InternalDiffView = (props) => {
1805
1805
  }, [useDiffContext, wrapperRef]);
1806
1806
  const value = React.useMemo(() => ({ useDiffContext }), [useDiffContext]);
1807
1807
  return (React__namespace.createElement(DiffViewContext.Provider, { value: value },
1808
- React__namespace.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-theme": diffFile._getTheme() || "light", "data-version": "0.1.1", "data-highlighter": diffFile._getHighlighterName(), ref: wrapperRef },
1808
+ React__namespace.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-theme": diffFile._getTheme() || "light", "data-version": "0.1.3", "data-highlighter": diffFile._getHighlighterName(), ref: wrapperRef },
1809
1809
  React__namespace.createElement("div", { className: "diff-style-root", style: {
1810
1810
  // @ts-ignore
1811
1811
  [diffFontSizeName]: diffViewFontSize + "px",
@@ -1895,7 +1895,7 @@ const DiffViewWithRef = (props, ref) => {
1895
1895
  const InnerDiffView = React.forwardRef(DiffViewWithRef);
1896
1896
  InnerDiffView.displayName = "DiffView";
1897
1897
  const DiffView = InnerDiffView;
1898
- const version = "0.1.1";
1898
+ const version = "0.1.3";
1899
1899
 
1900
1900
  Object.defineProperty(exports, "SplitSide", {
1901
1901
  enumerable: true,
@@ -1787,7 +1787,7 @@ const InternalDiffView = (props) => {
1787
1787
  }, [useDiffContext, wrapperRef]);
1788
1788
  const value = useMemo(() => ({ useDiffContext }), [useDiffContext]);
1789
1789
  return (React.createElement(DiffViewContext.Provider, { value: value },
1790
- React.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-theme": diffFile._getTheme() || "light", "data-version": "0.1.1", "data-highlighter": diffFile._getHighlighterName(), ref: wrapperRef },
1790
+ React.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-theme": diffFile._getTheme() || "light", "data-version": "0.1.3", "data-highlighter": diffFile._getHighlighterName(), ref: wrapperRef },
1791
1791
  React.createElement("div", { className: "diff-style-root", style: {
1792
1792
  // @ts-ignore
1793
1793
  [diffFontSizeName]: diffViewFontSize + "px",
@@ -1877,7 +1877,7 @@ const DiffViewWithRef = (props, ref) => {
1877
1877
  const InnerDiffView = forwardRef(DiffViewWithRef);
1878
1878
  InnerDiffView.displayName = "DiffView";
1879
1879
  const DiffView = InnerDiffView;
1880
- const version = "0.1.1";
1880
+ const version = "0.1.3";
1881
1881
 
1882
1882
  export { DiffModeEnum, DiffView, version };
1883
1883
  //# sourceMappingURL=index.mjs.map
package/index.d.ts CHANGED
@@ -31,6 +31,9 @@ declare class File$1 {
31
31
  static createInstance(data: File$1): File$1;
32
32
  constructor(row: string, lang: DiffHighlighterLang, fileName?: string);
33
33
  constructor(row: string, lang: string, fileName?: string);
34
+ initId(): void;
35
+ getId(): string;
36
+ clearId(): void;
34
37
  doSyntax({ registerHighlighter, theme, }: {
35
38
  registerHighlighter?: Omit<DiffHighlighter, "getHighlighterEngine">;
36
39
  theme?: "light" | "dark";
@@ -637,6 +640,8 @@ export declare function diffChanges(addition: DiffLine, deletion: DiffLine): {
637
640
  delRange: DiffRange;
638
641
  };
639
642
  export declare function escapeHtml(string: unknown): string;
643
+ export declare function getFile(raw: string, lang: DiffHighlighterLang, theme: "light" | "dark", fileName?: string, uuid?: string): File$1;
644
+ export declare function getFile(raw: string, lang: string, theme: "light" | "dark", fileName?: string, uuid?: string): File$1;
640
645
  /** Get the changed ranges in the strings, relative to each other. */
641
646
  export declare function relativeChanges(addition: DiffLine, deletion: DiffLine): {
642
647
  addRange: IRange;
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.1.1",
6
+ "version": "0.1.3",
7
7
  "main": "index.js",
8
8
  "types": "index.d.ts",
9
9
  "files": [
@@ -61,12 +61,12 @@
61
61
  "react diff component"
62
62
  ],
63
63
  "dependencies": {
64
- "@git-diff-view/core": "^0.1.1",
64
+ "@git-diff-view/core": "^0.1.3",
65
65
  "@types/hast": "^3.0.0",
66
66
  "fast-diff": "^1.3.0",
67
67
  "highlight.js": "^11.11.0",
68
68
  "lowlight": "^3.3.0",
69
- "reactivity-store": "^0.3.12",
69
+ "reactivity-store": "^0.4.0",
70
70
  "use-sync-external-store": "^1.6.0"
71
71
  },
72
72
  "devDependencies": {
@@ -1,18 +0,0 @@
1
- import { useCallback, useRef } from "react";
2
-
3
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
4
- export const useCallbackRef = <T extends Function>(cb?: T): T => {
5
- const cbRef = useRef(cb);
6
-
7
- cbRef.current = cb;
8
-
9
- const stableCallback = useCallback((...args: any[]) => {
10
- if (args.length) {
11
- return cbRef.current?.(...args);
12
- } else {
13
- return cbRef.current?.();
14
- }
15
- }, []) as unknown as T;
16
-
17
- return stableCallback;
18
- };