@pierre/diffs 1.3.5 → 1.4.0
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/components/CodeView.d.ts +113 -68
- package/dist/components/CodeView.d.ts.map +1 -1
- package/dist/components/CodeView.js +153 -58
- package/dist/components/CodeView.js.map +1 -1
- package/dist/components/File.d.ts +75 -15
- package/dist/components/File.d.ts.map +1 -1
- package/dist/components/File.js +223 -62
- package/dist/components/File.js.map +1 -1
- package/dist/components/FileDiff.d.ts +97 -21
- package/dist/components/FileDiff.d.ts.map +1 -1
- package/dist/components/FileDiff.js +400 -100
- package/dist/components/FileDiff.js.map +1 -1
- package/dist/components/UnresolvedFile.d.ts +2 -2
- package/dist/components/UnresolvedFile.d.ts.map +1 -1
- package/dist/components/UnresolvedFile.js +2 -2
- package/dist/components/UnresolvedFile.js.map +1 -1
- package/dist/components/VirtualizedFile.d.ts +16 -7
- package/dist/components/VirtualizedFile.d.ts.map +1 -1
- package/dist/components/VirtualizedFile.js +140 -51
- package/dist/components/VirtualizedFile.js.map +1 -1
- package/dist/components/VirtualizedFileDiff.d.ts +14 -8
- package/dist/components/VirtualizedFileDiff.d.ts.map +1 -1
- package/dist/components/VirtualizedFileDiff.js +183 -93
- package/dist/components/VirtualizedFileDiff.js.map +1 -1
- package/dist/components/VirtulizerDevelopment.d.ts +1 -1
- package/dist/components/VirtulizerDevelopment.d.ts.map +1 -1
- package/dist/edit/index.d.ts +7 -4
- package/dist/edit/index.js +5 -1
- package/dist/editor/EditStateManager.d.ts +56 -0
- package/dist/editor/EditStateManager.d.ts.map +1 -0
- package/dist/editor/EditStateManager.js +135 -0
- package/dist/editor/EditStateManager.js.map +1 -0
- package/dist/editor/cloneRetainedDiffSessionSnapshot.d.ts +7 -0
- package/dist/editor/cloneRetainedDiffSessionSnapshot.d.ts.map +1 -0
- package/dist/editor/cloneRetainedDiffSessionSnapshot.js +16 -0
- package/dist/editor/cloneRetainedDiffSessionSnapshot.js.map +1 -0
- package/dist/editor/editPrediction.d.ts +76 -0
- package/dist/editor/editPrediction.d.ts.map +1 -0
- package/dist/editor/editPrediction.js +365 -0
- package/dist/editor/editPrediction.js.map +1 -0
- package/dist/editor/editStack.d.ts +19 -40
- package/dist/editor/editStack.d.ts.map +1 -1
- package/dist/editor/editStack.js +67 -4
- package/dist/editor/editStack.js.map +1 -1
- package/dist/editor/editor.d.ts +118 -29
- package/dist/editor/editor.d.ts.map +1 -1
- package/dist/editor/editor.js +1196 -403
- package/dist/editor/editor.js.map +1 -1
- package/dist/editor/editor2.js +1 -1
- package/dist/editor/languages.d.ts +3 -3
- package/dist/editor/languages.d.ts.map +1 -1
- package/dist/editor/languages.js.map +1 -1
- package/dist/editor/lineAnnotations.d.ts +3 -3
- package/dist/editor/lineAnnotations.d.ts.map +1 -1
- package/dist/editor/lineAnnotations.js +16 -7
- package/dist/editor/lineAnnotations.js.map +1 -1
- package/dist/editor/marker.d.ts +2 -2
- package/dist/editor/marker.d.ts.map +1 -1
- package/dist/editor/marker.js.map +1 -1
- package/dist/editor/matchBrackets.d.ts +2 -2
- package/dist/editor/matchBrackets.d.ts.map +1 -1
- package/dist/editor/matchBrackets.js.map +1 -1
- package/dist/editor/pieceTable.d.ts +1 -1
- package/dist/editor/pieceTable.js.map +1 -1
- package/dist/editor/searchPanel.d.ts +2 -2
- package/dist/editor/searchPanel.d.ts.map +1 -1
- package/dist/editor/searchPanel.js +3 -2
- package/dist/editor/searchPanel.js.map +1 -1
- package/dist/editor/selection.d.ts +33 -23
- package/dist/editor/selection.d.ts.map +1 -1
- package/dist/editor/selection.js +3 -3
- package/dist/editor/selection.js.map +1 -1
- package/dist/editor/selectionAction.d.ts +3 -3
- package/dist/editor/selectionAction.d.ts.map +1 -1
- package/dist/editor/selectionAction.js.map +1 -1
- package/dist/editor/textDocument.d.ts +11 -8
- package/dist/editor/textDocument.d.ts.map +1 -1
- package/dist/editor/textDocument.js +28 -5
- package/dist/editor/textDocument.js.map +1 -1
- package/dist/editor/textDocumentChangeTransaction.d.ts +15 -0
- package/dist/editor/textDocumentChangeTransaction.d.ts.map +1 -0
- package/dist/editor/textDocumentChangeTransaction.js +12 -0
- package/dist/editor/textDocumentChangeTransaction.js.map +1 -0
- package/dist/editor/textMeasure.d.ts +5 -0
- package/dist/editor/textMeasure.d.ts.map +1 -1
- package/dist/editor/textMeasure.js +10 -0
- package/dist/editor/textMeasure.js.map +1 -1
- package/dist/editor/tokenizer.d.ts +1 -1
- package/dist/editor/tokenizer.d.ts.map +1 -1
- package/dist/editor/tokenizer.js +6 -3
- package/dist/editor/tokenizer.js.map +1 -1
- package/dist/editor/types.d.ts +267 -0
- package/dist/editor/types.d.ts.map +1 -0
- package/dist/editor/types.js +0 -0
- package/dist/editor/utils.d.ts +2 -1
- package/dist/editor/utils.d.ts.map +1 -1
- package/dist/editor/utils.js +4 -1
- package/dist/editor/utils.js.map +1 -1
- package/dist/index.d.ts +8 -6
- package/dist/index.js +9 -8
- package/dist/managers/InteractionManager.d.ts.map +1 -1
- package/dist/managers/InteractionManager.js +7 -0
- package/dist/managers/InteractionManager.js.map +1 -1
- package/dist/react/CodeView.d.ts +36 -25
- package/dist/react/CodeView.d.ts.map +1 -1
- package/dist/react/CodeView.js +15 -14
- package/dist/react/CodeView.js.map +1 -1
- package/dist/react/EditContext.d.ts +8 -11
- package/dist/react/EditContext.d.ts.map +1 -1
- package/dist/react/EditContext.js +2 -9
- package/dist/react/EditContext.js.map +1 -1
- package/dist/react/File.d.ts +10 -6
- package/dist/react/File.d.ts.map +1 -1
- package/dist/react/File.js +8 -4
- package/dist/react/File.js.map +1 -1
- package/dist/react/FileDiff.d.ts +10 -5
- package/dist/react/FileDiff.d.ts.map +1 -1
- package/dist/react/FileDiff.js +8 -4
- package/dist/react/FileDiff.js.map +1 -1
- package/dist/react/MultiFileDiff.d.ts +8 -5
- package/dist/react/MultiFileDiff.d.ts.map +1 -1
- package/dist/react/MultiFileDiff.js +8 -12
- package/dist/react/MultiFileDiff.js.map +1 -1
- package/dist/react/PatchDiff.d.ts +7 -4
- package/dist/react/PatchDiff.d.ts.map +1 -1
- package/dist/react/PatchDiff.js +8 -4
- package/dist/react/PatchDiff.js.map +1 -1
- package/dist/react/UnresolvedFile.d.ts +3 -3
- package/dist/react/UnresolvedFile.d.ts.map +1 -1
- package/dist/react/UnresolvedFile.js.map +1 -1
- package/dist/react/index.d.ts +8 -5
- package/dist/react/types.d.ts +46 -9
- package/dist/react/types.d.ts.map +1 -1
- package/dist/react/utils/renderDiffChildren.d.ts +14 -12
- package/dist/react/utils/renderDiffChildren.d.ts.map +1 -1
- package/dist/react/utils/renderDiffChildren.js +2 -2
- package/dist/react/utils/renderDiffChildren.js.map +1 -1
- package/dist/react/utils/renderFileChildren.d.ts +14 -12
- package/dist/react/utils/renderFileChildren.d.ts.map +1 -1
- package/dist/react/utils/renderFileChildren.js +2 -2
- package/dist/react/utils/renderFileChildren.js.map +1 -1
- package/dist/react/utils/useFileDiffInstance.d.ts +22 -10
- package/dist/react/utils/useFileDiffInstance.d.ts.map +1 -1
- package/dist/react/utils/useFileDiffInstance.js +112 -22
- package/dist/react/utils/useFileDiffInstance.js.map +1 -1
- package/dist/react/utils/useFileInstance.d.ts +15 -9
- package/dist/react/utils/useFileInstance.d.ts.map +1 -1
- package/dist/react/utils/useFileInstance.js +84 -25
- package/dist/react/utils/useFileInstance.js.map +1 -1
- package/dist/renderers/DiffHunksRenderer.d.ts +30 -15
- package/dist/renderers/DiffHunksRenderer.d.ts.map +1 -1
- package/dist/renderers/DiffHunksRenderer.js +172 -108
- package/dist/renderers/DiffHunksRenderer.js.map +1 -1
- package/dist/renderers/FileRenderer.d.ts +27 -11
- package/dist/renderers/FileRenderer.d.ts.map +1 -1
- package/dist/renderers/FileRenderer.js +138 -64
- package/dist/renderers/FileRenderer.js.map +1 -1
- package/dist/renderers/UnresolvedFileHunksRenderer.d.ts +2 -2
- package/dist/renderers/UnresolvedFileHunksRenderer.d.ts.map +1 -1
- package/dist/renderers/UnresolvedFileHunksRenderer.js +2 -2
- package/dist/renderers/UnresolvedFileHunksRenderer.js.map +1 -1
- package/dist/shiki-stream/tokenizer.d.ts.map +1 -1
- package/dist/shiki-stream/tokenizer.js +2 -1
- package/dist/shiki-stream/tokenizer.js.map +1 -1
- package/dist/ssr/index.d.ts +2 -2
- package/dist/ssr/preloadDiffs.d.ts +21 -21
- package/dist/ssr/preloadDiffs.d.ts.map +1 -1
- package/dist/ssr/preloadDiffs.js +1 -1
- package/dist/ssr/preloadDiffs.js.map +1 -1
- package/dist/ssr/preloadFile.d.ts +6 -6
- package/dist/ssr/preloadFile.d.ts.map +1 -1
- package/dist/ssr/preloadFile.js.map +1 -1
- package/dist/ssr/preloadPatchFile.d.ts +4 -4
- package/dist/ssr/preloadPatchFile.d.ts.map +1 -1
- package/dist/ssr/preloadPatchFile.js.map +1 -1
- package/dist/style.js +1 -1
- package/dist/types.d.ts +13 -263
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/appendItems.d.ts +5 -0
- package/dist/utils/appendItems.d.ts.map +1 -0
- package/dist/utils/appendItems.js +8 -0
- package/dist/utils/appendItems.js.map +1 -0
- package/dist/utils/areDiffTargetsEqual.js +1 -1
- package/dist/utils/areDiffTargetsEqual.js.map +1 -1
- package/dist/utils/areFileTargetsEqual.d.ts +7 -0
- package/dist/utils/areFileTargetsEqual.d.ts.map +1 -0
- package/dist/utils/areFileTargetsEqual.js +8 -0
- package/dist/utils/areFileTargetsEqual.js.map +1 -0
- package/dist/utils/areManagedSnapshotsEqual.d.ts +1 -1
- package/dist/utils/areManagedSnapshotsEqual.d.ts.map +1 -1
- package/dist/utils/areManagedSnapshotsEqual.js.map +1 -1
- package/dist/utils/areOptionsEqual.d.ts +3 -3
- package/dist/utils/areOptionsEqual.d.ts.map +1 -1
- package/dist/utils/areOptionsEqual.js.map +1 -1
- package/dist/utils/cloneFileDiffMetadata.d.ts +3 -2
- package/dist/utils/cloneFileDiffMetadata.d.ts.map +1 -1
- package/dist/utils/cloneFileDiffMetadata.js +8 -5
- package/dist/utils/cloneFileDiffMetadata.js.map +1 -1
- package/dist/utils/composeCacheKey.d.ts +6 -0
- package/dist/utils/composeCacheKey.d.ts.map +1 -0
- package/dist/utils/composeCacheKey.js +10 -0
- package/dist/utils/composeCacheKey.js.map +1 -0
- package/dist/utils/editSessionAnnotations.d.ts +69 -0
- package/dist/utils/editSessionAnnotations.d.ts.map +1 -0
- package/dist/utils/editSessionAnnotations.js +64 -0
- package/dist/utils/editSessionAnnotations.js.map +1 -0
- package/dist/utils/editSessionHunks.d.ts +5 -3
- package/dist/utils/editSessionHunks.d.ts.map +1 -1
- package/dist/utils/editSessionHunks.js +7 -5
- package/dist/utils/editSessionHunks.js.map +1 -1
- package/dist/utils/getDiffHunksRendererOptions.d.ts +1 -1
- package/dist/utils/getDiffHunksRendererOptions.d.ts.map +1 -1
- package/dist/utils/getDiffHunksRendererOptions.js.map +1 -1
- package/dist/utils/getFileRendererOptions.d.ts +1 -1
- package/dist/utils/getFileRendererOptions.d.ts.map +1 -1
- package/dist/utils/getFileRendererOptions.js.map +1 -1
- package/dist/utils/hydratePartialDiff.d.ts.map +1 -1
- package/dist/utils/hydratePartialDiff.js +2 -1
- package/dist/utils/hydratePartialDiff.js.map +1 -1
- package/dist/utils/lineAnnotationIdentity.d.ts +16 -0
- package/dist/utils/lineAnnotationIdentity.d.ts.map +1 -0
- package/dist/utils/lineAnnotationIdentity.js +17 -0
- package/dist/utils/lineAnnotationIdentity.js.map +1 -0
- package/dist/utils/parseDiffFromFile.d.ts +2 -2
- package/dist/utils/parseDiffFromFile.d.ts.map +1 -1
- package/dist/utils/parseDiffFromFile.js +6 -6
- package/dist/utils/parseDiffFromFile.js.map +1 -1
- package/dist/utils/parsePatchFiles.d.ts +6 -3
- package/dist/utils/parsePatchFiles.d.ts.map +1 -1
- package/dist/utils/parsePatchFiles.js +34 -9
- package/dist/utils/parsePatchFiles.js.map +1 -1
- package/dist/utils/renderDiffWithHighlighter.d.ts.map +1 -1
- package/dist/utils/renderDiffWithHighlighter.js +6 -5
- package/dist/utils/renderDiffWithHighlighter.js.map +1 -1
- package/dist/utils/renderFileWithHighlighter.d.ts.map +1 -1
- package/dist/utils/renderFileWithHighlighter.js +7 -4
- package/dist/utils/renderFileWithHighlighter.js.map +1 -1
- package/dist/utils/trimPatchContext.d.ts.map +1 -1
- package/dist/utils/trimPatchContext.js +3 -2
- package/dist/utils/trimPatchContext.js.map +1 -1
- package/dist/utils/updateDiffHunks.js +1 -1
- package/dist/utils/virtualDiffLayout.js +1 -1
- package/dist/worker/WorkerPoolManager.d.ts +4 -3
- package/dist/worker/WorkerPoolManager.d.ts.map +1 -1
- package/dist/worker/WorkerPoolManager.js +33 -4
- package/dist/worker/WorkerPoolManager.js.map +1 -1
- package/dist/worker/types.d.ts +5 -0
- package/dist/worker/types.d.ts.map +1 -1
- package/dist/worker/worker-portable.js +14 -6
- package/dist/worker/worker-portable.js.map +1 -1
- package/dist/worker/worker.js +14 -6
- package/dist/worker/worker.js.map +1 -1
- package/package.json +9 -1
- package/dist/editor/stateStorage.d.ts +0 -15
- package/dist/editor/stateStorage.d.ts.map +0 -1
- package/dist/editor/stateStorage.js +0 -65
- package/dist/editor/stateStorage.js.map +0 -1
package/dist/react/FileDiff.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { FileDiffMetadata } from "../types.js";
|
|
2
|
+
import { FileDiffEditCompleteEvent } from "../editor/types.js";
|
|
3
|
+
import { FileDiffEditChangeHandler, FileDiffEditCompleteHandler } from "../components/FileDiff.js";
|
|
2
4
|
import { DiffBasePropsReact } from "./types.js";
|
|
3
5
|
|
|
4
6
|
//#region src/react/FileDiff.d.ts
|
|
5
|
-
interface FileDiffProps<LAnnotation> extends DiffBasePropsReact<LAnnotation> {
|
|
7
|
+
interface FileDiffProps<LAnnotation, Caret> extends DiffBasePropsReact<LAnnotation, Caret> {
|
|
6
8
|
fileDiff: FileDiffMetadata;
|
|
7
9
|
disableWorkerPool?: boolean;
|
|
8
10
|
}
|
|
9
|
-
declare function FileDiff<LAnnotation = undefined>({
|
|
11
|
+
declare function FileDiff<LAnnotation = undefined, Caret = undefined>({
|
|
10
12
|
fileDiff,
|
|
11
13
|
options,
|
|
12
14
|
editorOptions,
|
|
15
|
+
editStateKey,
|
|
13
16
|
metrics,
|
|
14
17
|
lineAnnotations,
|
|
15
18
|
selectedLines,
|
|
@@ -23,8 +26,10 @@ declare function FileDiff<LAnnotation = undefined>({
|
|
|
23
26
|
renderHeaderMetadata,
|
|
24
27
|
renderGutterUtility,
|
|
25
28
|
disableWorkerPool,
|
|
26
|
-
edit
|
|
27
|
-
|
|
29
|
+
edit,
|
|
30
|
+
onEditChange,
|
|
31
|
+
onEditComplete
|
|
32
|
+
}: FileDiffProps<LAnnotation, Caret>): React.JSX.Element;
|
|
28
33
|
//#endregion
|
|
29
|
-
export { FileDiff, type FileDiffMetadata, FileDiffProps };
|
|
34
|
+
export { FileDiff, type FileDiffEditChangeHandler, type FileDiffEditCompleteEvent, type FileDiffEditCompleteHandler, type FileDiffMetadata, FileDiffProps };
|
|
30
35
|
//# sourceMappingURL=FileDiff.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileDiff.d.ts","names":[],"sources":["../../src/react/FileDiff.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"FileDiff.d.ts","names":[],"sources":["../../src/react/FileDiff.tsx"],"mappings":";;;;;;UAqBiB,aAAA,6BAA0C,kBAAA,CACzD,WAAA,EACA,KAAA;EAEA,QAAA,EAAU,gBAAA;EACV,iBAAA;AAAA;AAAA,iBAGc,QAAA;EACd,QAAA;EACA,OAAA;EACA,aAAA;EACA,YAAA;EACA,OAAA;EACA,eAAA;EACA,aAAA;EACA,SAAA;EACA,KAAA;EACA,eAAA;EACA,gBAAA;EACA,kBAAA;EACA,kBAAA;EACA,0BAAA;EACA,oBAAA;EACA,mBAAA;EACA,iBAAA;EACA,IAAA;EACA,YAAA;EACA;AAAA,GACC,aAAA,CAAc,WAAA,EAAa,KAAA,IAAS,KAAA,CAAM,GAAA,CAAI,OAAA"}
|
package/dist/react/FileDiff.js
CHANGED
|
@@ -5,11 +5,12 @@ import { templateRender } from "./utils/templateRender.js";
|
|
|
5
5
|
import { useFileDiffInstance } from "./utils/useFileDiffInstance.js";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
//#region src/react/FileDiff.tsx
|
|
8
|
-
function FileDiff({ fileDiff, options, editorOptions, metrics, lineAnnotations, selectedLines, className, style, prerenderedHTML, renderAnnotation, renderCustomHeader, renderHeaderPrefix, renderHeaderFilenameSuffix, renderHeaderMetadata, renderGutterUtility, disableWorkerPool = false, edit = false }) {
|
|
9
|
-
const { ref, getHoveredLine } = useFileDiffInstance({
|
|
8
|
+
function FileDiff({ fileDiff, options, editorOptions, editStateKey, metrics, lineAnnotations, selectedLines, className, style, prerenderedHTML, renderAnnotation, renderCustomHeader, renderHeaderPrefix, renderHeaderFilenameSuffix, renderHeaderMetadata, renderGutterUtility, disableWorkerPool = false, edit = false, onEditChange, onEditComplete }) {
|
|
9
|
+
const { ref, getHoveredLine, getAnnotationSlotName } = useFileDiffInstance({
|
|
10
10
|
fileDiff,
|
|
11
11
|
options,
|
|
12
12
|
editorOptions,
|
|
13
|
+
editStateKey,
|
|
13
14
|
metrics,
|
|
14
15
|
lineAnnotations,
|
|
15
16
|
selectedLines,
|
|
@@ -17,7 +18,9 @@ function FileDiff({ fileDiff, options, editorOptions, metrics, lineAnnotations,
|
|
|
17
18
|
hasGutterRenderUtility: renderGutterUtility != null,
|
|
18
19
|
hasCustomHeader: renderCustomHeader != null,
|
|
19
20
|
disableWorkerPool,
|
|
20
|
-
edit
|
|
21
|
+
edit,
|
|
22
|
+
onEditChange,
|
|
23
|
+
onEditComplete
|
|
21
24
|
});
|
|
22
25
|
return /* @__PURE__ */ jsx(DIFFS_TAG_NAME, {
|
|
23
26
|
ref,
|
|
@@ -32,7 +35,8 @@ function FileDiff({ fileDiff, options, editorOptions, metrics, lineAnnotations,
|
|
|
32
35
|
renderAnnotation,
|
|
33
36
|
renderGutterUtility,
|
|
34
37
|
lineAnnotations,
|
|
35
|
-
getHoveredLine
|
|
38
|
+
getHoveredLine,
|
|
39
|
+
getAnnotationSlotName
|
|
36
40
|
}), prerenderedHTML)
|
|
37
41
|
});
|
|
38
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileDiff.js","names":[],"sources":["../../src/react/FileDiff.tsx"],"sourcesContent":["'use client';\n\nimport { DIFFS_TAG_NAME } from '../constants';\nimport type { FileDiffMetadata } from '../types';\nimport type { DiffBasePropsReact } from './types';\nimport { renderDiffChildren } from './utils/renderDiffChildren';\nimport { templateRender } from './utils/templateRender';\nimport { useFileDiffInstance } from './utils/useFileDiffInstance';\n\nexport type {
|
|
1
|
+
{"version":3,"file":"FileDiff.js","names":[],"sources":["../../src/react/FileDiff.tsx"],"sourcesContent":["'use client';\n\nimport type {\n FileDiffEditChangeHandler,\n FileDiffEditCompleteEvent,\n FileDiffEditCompleteHandler,\n} from '../components/FileDiff';\nimport { DIFFS_TAG_NAME } from '../constants';\nimport type { FileDiffMetadata } from '../types';\nimport type { DiffBasePropsReact } from './types';\nimport { renderDiffChildren } from './utils/renderDiffChildren';\nimport { templateRender } from './utils/templateRender';\nimport { useFileDiffInstance } from './utils/useFileDiffInstance';\n\nexport type {\n FileDiffEditChangeHandler,\n FileDiffEditCompleteEvent,\n FileDiffEditCompleteHandler,\n FileDiffMetadata,\n};\n\nexport interface FileDiffProps<LAnnotation, Caret> extends DiffBasePropsReact<\n LAnnotation,\n Caret\n> {\n fileDiff: FileDiffMetadata;\n disableWorkerPool?: boolean;\n}\n\nexport function FileDiff<LAnnotation = undefined, Caret = undefined>({\n fileDiff,\n options,\n editorOptions,\n editStateKey,\n metrics,\n lineAnnotations,\n selectedLines,\n className,\n style,\n prerenderedHTML,\n renderAnnotation,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderFilenameSuffix,\n renderHeaderMetadata,\n renderGutterUtility,\n disableWorkerPool = false,\n edit = false,\n onEditChange,\n onEditComplete,\n}: FileDiffProps<LAnnotation, Caret>): React.JSX.Element {\n const { ref, getHoveredLine, getAnnotationSlotName } = useFileDiffInstance({\n fileDiff,\n options,\n editorOptions,\n editStateKey,\n metrics,\n lineAnnotations,\n selectedLines,\n prerenderedHTML,\n hasGutterRenderUtility: renderGutterUtility != null,\n hasCustomHeader: renderCustomHeader != null,\n disableWorkerPool,\n edit,\n onEditChange,\n onEditComplete,\n });\n const children = renderDiffChildren({\n fileDiff,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderFilenameSuffix,\n renderHeaderMetadata,\n renderAnnotation,\n renderGutterUtility,\n lineAnnotations,\n getHoveredLine,\n getAnnotationSlotName,\n });\n return (\n <DIFFS_TAG_NAME ref={ref} className={className} style={style}>\n {templateRender(children, prerenderedHTML)}\n </DIFFS_TAG_NAME>\n );\n}\n"],"mappings":";;;;;;;AA6BA,SAAgB,SAAqD,EACnE,UACA,SACA,eACA,cACA,SACA,iBACA,eACA,WACA,OACA,iBACA,kBACA,oBACA,oBACA,4BACA,sBACA,qBACA,oBAAoB,OACpB,OAAO,OACP,cACA,kBACuD;CACvD,MAAM,EAAE,KAAK,gBAAgB,0BAA0B,oBAAoB;EACzE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,wBAAwB,uBAAuB;EAC/C,iBAAiB,sBAAsB;EACvC;EACA;EACA;EACA;CACF,CAAC;CAaD,OACE,oBAAC,gBAAD;EAAqB;EAAgB;EAAkB;YACpD,eAdY,mBAAmB;GAClC;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAG2B,GAAG,eAAe;CAC3B,CAAA;AAEpB"}
|
|
@@ -2,15 +2,16 @@ import { DiffFileInput, FileContents } from "../types.js";
|
|
|
2
2
|
import { DiffBasePropsReact } from "./types.js";
|
|
3
3
|
|
|
4
4
|
//#region src/react/MultiFileDiff.d.ts
|
|
5
|
-
interface MultiFileDiffBaseProps<LAnnotation> extends DiffBasePropsReact<LAnnotation> {
|
|
5
|
+
interface MultiFileDiffBaseProps<LAnnotation, Caret> extends DiffBasePropsReact<LAnnotation, Caret> {
|
|
6
6
|
disableWorkerPool?: boolean;
|
|
7
7
|
}
|
|
8
|
-
type MultiFileDiffProps<LAnnotation> = MultiFileDiffBaseProps<LAnnotation> & DiffFileInput;
|
|
9
|
-
declare function MultiFileDiff<LAnnotation = undefined>({
|
|
8
|
+
type MultiFileDiffProps<LAnnotation, Caret> = MultiFileDiffBaseProps<LAnnotation, Caret> & DiffFileInput;
|
|
9
|
+
declare function MultiFileDiff<LAnnotation = undefined, Caret = undefined>({
|
|
10
10
|
oldFile,
|
|
11
11
|
newFile,
|
|
12
12
|
options,
|
|
13
13
|
editorOptions,
|
|
14
|
+
editStateKey,
|
|
14
15
|
metrics,
|
|
15
16
|
lineAnnotations,
|
|
16
17
|
selectedLines,
|
|
@@ -24,8 +25,10 @@ declare function MultiFileDiff<LAnnotation = undefined>({
|
|
|
24
25
|
renderHeaderMetadata,
|
|
25
26
|
renderGutterUtility,
|
|
26
27
|
disableWorkerPool,
|
|
27
|
-
edit
|
|
28
|
-
|
|
28
|
+
edit,
|
|
29
|
+
onEditChange,
|
|
30
|
+
onEditComplete
|
|
31
|
+
}: MultiFileDiffProps<LAnnotation, Caret>): React.JSX.Element;
|
|
29
32
|
//#endregion
|
|
30
33
|
export { type FileContents, MultiFileDiff, MultiFileDiffProps };
|
|
31
34
|
//# sourceMappingURL=MultiFileDiff.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiFileDiff.d.ts","names":[],"sources":["../../src/react/MultiFileDiff.tsx"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"MultiFileDiff.d.ts","names":[],"sources":["../../src/react/MultiFileDiff.tsx"],"mappings":";;;;UAWU,sBAAA,6BAAmD,kBAAA,CAC3D,WAAA,EACA,KAAA;EAEA,iBAAA;AAAA;AAAA,KAGU,kBAAA,uBAAyC,sBAAA,CACnD,WAAA,EACA,KAAA,IAEA,aAAA;AAAA,iBAEc,aAAA;EACd,OAAA;EACA,OAAA;EACA,OAAA;EACA,aAAA;EACA,YAAA;EACA,OAAA;EACA,eAAA;EACA,aAAA;EACA,SAAA;EACA,KAAA;EACA,eAAA;EACA,gBAAA;EACA,kBAAA;EACA,kBAAA;EACA,0BAAA;EACA,oBAAA;EACA,mBAAA;EACA,iBAAA;EACA,IAAA;EACA,YAAA;EACA;AAAA,GACC,kBAAA,CAAmB,WAAA,EAAa,KAAA,IAAS,KAAA,CAAM,GAAA,CAAI,OAAA"}
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { DIFFS_TAG_NAME } from "../constants.js";
|
|
3
|
-
import { parseDiffFromFile } from "../utils/parseDiffFromFile.js";
|
|
4
3
|
import { renderDiffChildren } from "./utils/renderDiffChildren.js";
|
|
5
4
|
import { templateRender } from "./utils/templateRender.js";
|
|
6
5
|
import { useFileDiffInstance } from "./utils/useFileDiffInstance.js";
|
|
7
|
-
import { useMemo } from "react";
|
|
8
6
|
import { jsx } from "react/jsx-runtime";
|
|
9
7
|
//#region src/react/MultiFileDiff.tsx
|
|
10
|
-
function MultiFileDiff({ oldFile, newFile, options, editorOptions, metrics, lineAnnotations, selectedLines, className, style, prerenderedHTML, renderAnnotation, renderCustomHeader, renderHeaderPrefix, renderHeaderFilenameSuffix, renderHeaderMetadata, renderGutterUtility, disableWorkerPool = false, edit = false }) {
|
|
11
|
-
const fileDiff =
|
|
12
|
-
return parseDiffFromFile(oldFile, newFile, options?.parseDiffOptions);
|
|
13
|
-
}, [
|
|
8
|
+
function MultiFileDiff({ oldFile, newFile, options, editorOptions, editStateKey, metrics, lineAnnotations, selectedLines, className, style, prerenderedHTML, renderAnnotation, renderCustomHeader, renderHeaderPrefix, renderHeaderFilenameSuffix, renderHeaderMetadata, renderGutterUtility, disableWorkerPool = false, edit = false, onEditChange, onEditComplete }) {
|
|
9
|
+
const { fileDiff, ref, getHoveredLine, getAnnotationSlotName } = useFileDiffInstance({
|
|
14
10
|
oldFile,
|
|
15
11
|
newFile,
|
|
16
|
-
options?.parseDiffOptions
|
|
17
|
-
]);
|
|
18
|
-
const { ref, getHoveredLine } = useFileDiffInstance({
|
|
19
|
-
fileDiff,
|
|
20
12
|
options,
|
|
21
13
|
editorOptions,
|
|
14
|
+
editStateKey,
|
|
22
15
|
metrics,
|
|
23
16
|
lineAnnotations,
|
|
24
17
|
selectedLines,
|
|
@@ -26,7 +19,9 @@ function MultiFileDiff({ oldFile, newFile, options, editorOptions, metrics, line
|
|
|
26
19
|
hasGutterRenderUtility: renderGutterUtility != null,
|
|
27
20
|
hasCustomHeader: renderCustomHeader != null,
|
|
28
21
|
disableWorkerPool,
|
|
29
|
-
edit
|
|
22
|
+
edit,
|
|
23
|
+
onEditChange,
|
|
24
|
+
onEditComplete
|
|
30
25
|
});
|
|
31
26
|
return /* @__PURE__ */ jsx(DIFFS_TAG_NAME, {
|
|
32
27
|
ref,
|
|
@@ -41,7 +36,8 @@ function MultiFileDiff({ oldFile, newFile, options, editorOptions, metrics, line
|
|
|
41
36
|
renderAnnotation,
|
|
42
37
|
lineAnnotations,
|
|
43
38
|
renderGutterUtility,
|
|
44
|
-
getHoveredLine
|
|
39
|
+
getHoveredLine,
|
|
40
|
+
getAnnotationSlotName
|
|
45
41
|
}), prerenderedHTML)
|
|
46
42
|
});
|
|
47
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiFileDiff.js","names":[],"sources":["../../src/react/MultiFileDiff.tsx"],"sourcesContent":["'use client';\n\nimport {
|
|
1
|
+
{"version":3,"file":"MultiFileDiff.js","names":[],"sources":["../../src/react/MultiFileDiff.tsx"],"sourcesContent":["'use client';\n\nimport { DIFFS_TAG_NAME } from '../constants';\nimport type { DiffFileInput, FileContents } from '../types';\nimport type { DiffBasePropsReact } from './types';\nimport { renderDiffChildren } from './utils/renderDiffChildren';\nimport { templateRender } from './utils/templateRender';\nimport { useFileDiffInstance } from './utils/useFileDiffInstance';\n\nexport type { FileContents };\n\ninterface MultiFileDiffBaseProps<LAnnotation, Caret> extends DiffBasePropsReact<\n LAnnotation,\n Caret\n> {\n disableWorkerPool?: boolean;\n}\n\nexport type MultiFileDiffProps<LAnnotation, Caret> = MultiFileDiffBaseProps<\n LAnnotation,\n Caret\n> &\n DiffFileInput;\n\nexport function MultiFileDiff<LAnnotation = undefined, Caret = undefined>({\n oldFile,\n newFile,\n options,\n editorOptions,\n editStateKey,\n metrics,\n lineAnnotations,\n selectedLines,\n className,\n style,\n prerenderedHTML,\n renderAnnotation,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderFilenameSuffix,\n renderHeaderMetadata,\n renderGutterUtility,\n disableWorkerPool = false,\n edit = false,\n onEditChange,\n onEditComplete,\n}: MultiFileDiffProps<LAnnotation, Caret>): React.JSX.Element {\n const { fileDiff, ref, getHoveredLine, getAnnotationSlotName } =\n useFileDiffInstance({\n oldFile,\n newFile,\n options,\n editorOptions,\n editStateKey,\n metrics,\n lineAnnotations,\n selectedLines,\n prerenderedHTML,\n hasGutterRenderUtility: renderGutterUtility != null,\n hasCustomHeader: renderCustomHeader != null,\n disableWorkerPool,\n edit,\n onEditChange,\n onEditComplete,\n });\n const children = renderDiffChildren({\n fileDiff,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderFilenameSuffix,\n renderHeaderMetadata,\n renderAnnotation,\n lineAnnotations,\n renderGutterUtility,\n getHoveredLine,\n getAnnotationSlotName,\n });\n return (\n <DIFFS_TAG_NAME ref={ref} className={className} style={style}>\n {templateRender(children, prerenderedHTML)}\n </DIFFS_TAG_NAME>\n );\n}\n"],"mappings":";;;;;;;AAwBA,SAAgB,cAA0D,EACxE,SACA,SACA,SACA,eACA,cACA,SACA,iBACA,eACA,WACA,OACA,iBACA,kBACA,oBACA,oBACA,4BACA,sBACA,qBACA,oBAAoB,OACpB,OAAO,OACP,cACA,kBAC4D;CAC5D,MAAM,EAAE,UAAU,KAAK,gBAAgB,0BACrC,oBAAoB;EAClB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,wBAAwB,uBAAuB;EAC/C,iBAAiB,sBAAsB;EACvC;EACA;EACA;EACA;CACF,CAAC;CAaH,OACE,oBAAC,gBAAD;EAAqB;EAAgB;EAAkB;YACpD,eAdY,mBAAmB;GAClC;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAG2B,GAAG,eAAe;CAC3B,CAAA;AAEpB"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { DiffBasePropsReact } from "./types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/react/PatchDiff.d.ts
|
|
4
|
-
interface PatchDiffProps<LAnnotation> extends DiffBasePropsReact<LAnnotation> {
|
|
4
|
+
interface PatchDiffProps<LAnnotation, Caret> extends DiffBasePropsReact<LAnnotation, Caret> {
|
|
5
5
|
patch: string;
|
|
6
6
|
disableWorkerPool?: boolean;
|
|
7
7
|
}
|
|
8
|
-
declare function PatchDiff<LAnnotation = undefined>({
|
|
8
|
+
declare function PatchDiff<LAnnotation = undefined, Caret = undefined>({
|
|
9
9
|
patch,
|
|
10
10
|
options,
|
|
11
11
|
editorOptions,
|
|
12
|
+
editStateKey,
|
|
12
13
|
metrics,
|
|
13
14
|
lineAnnotations,
|
|
14
15
|
selectedLines,
|
|
@@ -22,8 +23,10 @@ declare function PatchDiff<LAnnotation = undefined>({
|
|
|
22
23
|
renderHeaderMetadata,
|
|
23
24
|
renderGutterUtility,
|
|
24
25
|
disableWorkerPool,
|
|
25
|
-
edit
|
|
26
|
-
|
|
26
|
+
edit,
|
|
27
|
+
onEditChange,
|
|
28
|
+
onEditComplete
|
|
29
|
+
}: PatchDiffProps<LAnnotation, Caret>): React.JSX.Element;
|
|
27
30
|
//#endregion
|
|
28
31
|
export { PatchDiff, PatchDiffProps };
|
|
29
32
|
//# sourceMappingURL=PatchDiff.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PatchDiff.d.ts","names":[],"sources":["../../src/react/PatchDiff.tsx"],"mappings":";;;UAYiB,cAAA,
|
|
1
|
+
{"version":3,"file":"PatchDiff.d.ts","names":[],"sources":["../../src/react/PatchDiff.tsx"],"mappings":";;;UAYiB,cAAA,6BAA2C,kBAAA,CAC1D,WAAA,EACA,KAAA;EAEA,KAAA;EACA,iBAAA;AAAA;AAAA,iBAGc,SAAA;EACd,KAAA;EACA,OAAA;EACA,aAAA;EACA,YAAA;EACA,OAAA;EACA,eAAA;EACA,aAAA;EACA,SAAA;EACA,KAAA;EACA,eAAA;EACA,gBAAA;EACA,kBAAA;EACA,kBAAA;EACA,0BAAA;EACA,oBAAA;EACA,mBAAA;EACA,iBAAA;EACA,IAAA;EACA,YAAA;EACA;AAAA,GACC,cAAA,CAAe,WAAA,EAAa,KAAA,IAAS,KAAA,CAAM,GAAA,CAAI,OAAA"}
|
package/dist/react/PatchDiff.js
CHANGED
|
@@ -7,12 +7,13 @@ import { useFileDiffInstance } from "./utils/useFileDiffInstance.js";
|
|
|
7
7
|
import { useMemo } from "react";
|
|
8
8
|
import { jsx } from "react/jsx-runtime";
|
|
9
9
|
//#region src/react/PatchDiff.tsx
|
|
10
|
-
function PatchDiff({ patch, options, editorOptions, metrics, lineAnnotations, selectedLines, className, style, prerenderedHTML, renderAnnotation, renderCustomHeader, renderHeaderPrefix, renderHeaderFilenameSuffix, renderHeaderMetadata, renderGutterUtility, disableWorkerPool = false, edit = false }) {
|
|
10
|
+
function PatchDiff({ patch, options, editorOptions, editStateKey, metrics, lineAnnotations, selectedLines, className, style, prerenderedHTML, renderAnnotation, renderCustomHeader, renderHeaderPrefix, renderHeaderFilenameSuffix, renderHeaderMetadata, renderGutterUtility, disableWorkerPool = false, edit = false, onEditChange, onEditComplete }) {
|
|
11
11
|
const fileDiff = usePatch(patch);
|
|
12
|
-
const { ref, getHoveredLine } = useFileDiffInstance({
|
|
12
|
+
const { ref, getHoveredLine, getAnnotationSlotName } = useFileDiffInstance({
|
|
13
13
|
fileDiff,
|
|
14
14
|
options,
|
|
15
15
|
editorOptions,
|
|
16
|
+
editStateKey,
|
|
16
17
|
metrics,
|
|
17
18
|
lineAnnotations,
|
|
18
19
|
selectedLines,
|
|
@@ -20,7 +21,9 @@ function PatchDiff({ patch, options, editorOptions, metrics, lineAnnotations, se
|
|
|
20
21
|
hasGutterRenderUtility: renderGutterUtility != null,
|
|
21
22
|
hasCustomHeader: renderCustomHeader != null,
|
|
22
23
|
disableWorkerPool,
|
|
23
|
-
edit
|
|
24
|
+
edit,
|
|
25
|
+
onEditChange,
|
|
26
|
+
onEditComplete
|
|
24
27
|
});
|
|
25
28
|
return /* @__PURE__ */ jsx(DIFFS_TAG_NAME, {
|
|
26
29
|
ref,
|
|
@@ -35,7 +38,8 @@ function PatchDiff({ patch, options, editorOptions, metrics, lineAnnotations, se
|
|
|
35
38
|
renderAnnotation,
|
|
36
39
|
lineAnnotations,
|
|
37
40
|
renderGutterUtility,
|
|
38
|
-
getHoveredLine
|
|
41
|
+
getHoveredLine,
|
|
42
|
+
getAnnotationSlotName
|
|
39
43
|
}), prerenderedHTML)
|
|
40
44
|
});
|
|
41
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PatchDiff.js","names":[],"sources":["../../src/react/PatchDiff.tsx"],"sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\n\nimport { DIFFS_TAG_NAME } from '../constants';\nimport type { FileDiffMetadata } from '../types';\nimport { getSingularPatch } from '../utils/getSingularPatch';\nimport type { DiffBasePropsReact } from './types';\nimport { renderDiffChildren } from './utils/renderDiffChildren';\nimport { templateRender } from './utils/templateRender';\nimport { useFileDiffInstance } from './utils/useFileDiffInstance';\n\nexport interface PatchDiffProps
|
|
1
|
+
{"version":3,"file":"PatchDiff.js","names":[],"sources":["../../src/react/PatchDiff.tsx"],"sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\n\nimport { DIFFS_TAG_NAME } from '../constants';\nimport type { FileDiffMetadata } from '../types';\nimport { getSingularPatch } from '../utils/getSingularPatch';\nimport type { DiffBasePropsReact } from './types';\nimport { renderDiffChildren } from './utils/renderDiffChildren';\nimport { templateRender } from './utils/templateRender';\nimport { useFileDiffInstance } from './utils/useFileDiffInstance';\n\nexport interface PatchDiffProps<LAnnotation, Caret> extends DiffBasePropsReact<\n LAnnotation,\n Caret\n> {\n patch: string;\n disableWorkerPool?: boolean;\n}\n\nexport function PatchDiff<LAnnotation = undefined, Caret = undefined>({\n patch,\n options,\n editorOptions,\n editStateKey,\n metrics,\n lineAnnotations,\n selectedLines,\n className,\n style,\n prerenderedHTML,\n renderAnnotation,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderFilenameSuffix,\n renderHeaderMetadata,\n renderGutterUtility,\n disableWorkerPool = false,\n edit = false,\n onEditChange,\n onEditComplete,\n}: PatchDiffProps<LAnnotation, Caret>): React.JSX.Element {\n const fileDiff = usePatch(patch);\n const { ref, getHoveredLine, getAnnotationSlotName } = useFileDiffInstance({\n fileDiff,\n options,\n editorOptions,\n editStateKey,\n metrics,\n lineAnnotations,\n selectedLines,\n prerenderedHTML,\n hasGutterRenderUtility: renderGutterUtility != null,\n hasCustomHeader: renderCustomHeader != null,\n disableWorkerPool,\n edit,\n onEditChange,\n onEditComplete,\n });\n const children = renderDiffChildren({\n fileDiff,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderFilenameSuffix,\n renderHeaderMetadata,\n renderAnnotation,\n lineAnnotations,\n renderGutterUtility,\n getHoveredLine,\n getAnnotationSlotName,\n });\n return (\n <DIFFS_TAG_NAME ref={ref} className={className} style={style}>\n {templateRender(children, prerenderedHTML)}\n </DIFFS_TAG_NAME>\n );\n}\n\nfunction usePatch(patch: string): FileDiffMetadata {\n return useMemo<FileDiffMetadata>(() => getSingularPatch(patch), [patch]);\n}\n"],"mappings":";;;;;;;;;AAoBA,SAAgB,UAAsD,EACpE,OACA,SACA,eACA,cACA,SACA,iBACA,eACA,WACA,OACA,iBACA,kBACA,oBACA,oBACA,4BACA,sBACA,qBACA,oBAAoB,OACpB,OAAO,OACP,cACA,kBACwD;CACxD,MAAM,WAAW,SAAS,KAAK;CAC/B,MAAM,EAAE,KAAK,gBAAgB,0BAA0B,oBAAoB;EACzE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,wBAAwB,uBAAuB;EAC/C,iBAAiB,sBAAsB;EACvC;EACA;EACA;EACA;CACF,CAAC;CAaD,OACE,oBAAC,gBAAD;EAAqB;EAAgB;EAAkB;YACpD,eAdY,mBAAmB;GAClC;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAG2B,GAAG,eAAe;CAC3B,CAAA;AAEpB;AAEA,SAAS,SAAS,OAAiC;CACjD,OAAO,cAAgC,iBAAiB,KAAK,GAAG,CAAC,KAAK,CAAC;AACzE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FileContents, HunkSeparators, MergeConflictResolution, PostRenderPhase } from "../types.js";
|
|
2
|
-
import { FileDiffOptions } from "../components/FileDiff.js";
|
|
3
2
|
import { MergeConflictDiffAction } from "../utils/parseMergeConflictDiffFromFile.js";
|
|
4
3
|
import { UnresolvedFileHunksRendererOptions } from "../renderers/UnresolvedFileHunksRenderer.js";
|
|
5
4
|
import { UnresolvedFile as UnresolvedFile$1 } from "../components/UnresolvedFile.js";
|
|
5
|
+
import { FileDiffOptions } from "./types.js";
|
|
6
6
|
import { FileDiffProps } from "./FileDiff.js";
|
|
7
7
|
import { ReactNode } from "react";
|
|
8
8
|
|
|
@@ -12,12 +12,12 @@ interface RenderMergeConflictActionContext {
|
|
|
12
12
|
}
|
|
13
13
|
type RenderMergeConflictActions = (action: MergeConflictDiffAction, context: RenderMergeConflictActionContext) => ReactNode;
|
|
14
14
|
type MergeConflictActionsTypeOption = 'none' | 'default' | RenderMergeConflictActions;
|
|
15
|
-
interface UnresolvedFileReactOptions<LAnnotation> extends Omit<FileDiffOptions<LAnnotation>, 'hunkSeparators' | 'diffStyle' | 'onMergeConflictAction' | 'onPostRender'>, UnresolvedFileHunksRendererOptions {
|
|
15
|
+
interface UnresolvedFileReactOptions<LAnnotation> extends Omit<FileDiffOptions<LAnnotation, undefined>, 'hunkSeparators' | 'diffStyle' | 'onMergeConflictAction' | 'onPostRender'>, UnresolvedFileHunksRendererOptions {
|
|
16
16
|
hunkSeparators?: HunkSeparators;
|
|
17
17
|
onPostRender?(node: HTMLElement, instance: UnresolvedFile$1<LAnnotation>, phase: PostRenderPhase): unknown;
|
|
18
18
|
maxContextLines?: number;
|
|
19
19
|
}
|
|
20
|
-
interface UnresolvedFileProps<LAnnotation> extends Omit<FileDiffProps<LAnnotation>, 'fileDiff' | 'options' | 'edit' | 'editorOptions'> {
|
|
20
|
+
interface UnresolvedFileProps<LAnnotation> extends Omit<FileDiffProps<LAnnotation, undefined>, 'fileDiff' | 'options' | 'edit' | 'editorOptions' | 'onEditChange' | 'onEditComplete'> {
|
|
21
21
|
file: FileContents;
|
|
22
22
|
options?: UnresolvedFileReactOptions<LAnnotation>;
|
|
23
23
|
renderMergeConflictUtility?(action: MergeConflictDiffAction, getInstance: () => UnresolvedFile$1<LAnnotation> | undefined): ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnresolvedFile.d.ts","names":[],"sources":["../../src/react/UnresolvedFile.tsx"],"mappings":";;;;;;;;;UAoBiB,gCAAA;EACf,eAAA,CAAgB,UAAA,EAAY,uBAAuB;AAAA;AAAA,KAGzC,0BAAA,IACV,MAAA,EAAQ,uBAAA,EACR,OAAA,EAAS,gCAAA,KACN,SAAA;AAAA,KAEO,8BAAA,wBAGR,0BAA0B;AAAA,UAEb,0BAAA,sBAEb,IAAA,CACE,eAAA,CAAgB,WAAA
|
|
1
|
+
{"version":3,"file":"UnresolvedFile.d.ts","names":[],"sources":["../../src/react/UnresolvedFile.tsx"],"mappings":";;;;;;;;;UAoBiB,gCAAA;EACf,eAAA,CAAgB,UAAA,EAAY,uBAAuB;AAAA;AAAA,KAGzC,0BAAA,IACV,MAAA,EAAQ,uBAAA,EACR,OAAA,EAAS,gCAAA,KACN,SAAA;AAAA,KAEO,8BAAA,wBAGR,0BAA0B;AAAA,UAEb,0BAAA,sBAEb,IAAA,CACE,eAAA,CAAgB,WAAA,0FAGlB,kCAAA;EACF,cAAA,GAAiB,cAAA;EACjB,YAAA,EACE,IAAA,EAAM,WAAA,EACN,QAAA,EAAU,gBAAA,CAAoB,WAAA,GAC9B,KAAA,EAAO,eAAA;EAET,eAAA;AAAA;AAAA,UAGe,mBAAA,sBAAyC,IAAA,CACxD,aAAA,CAAc,WAAA;EAQd,IAAA,EAAM,YAAA;EACN,OAAA,GAAU,0BAAA,CAA2B,WAAA;EACrC,0BAAA,EACE,MAAA,EAAQ,uBAAA,EACR,WAAA,QAAmB,gBAAA,CAAoB,WAAA,gBACtC,SAAA;EACH,iBAAA;AAAA;AAAA,iBAGc,cAAA;EACd,IAAA;EACA,OAAA;EACA,eAAA;EACA,aAAA;EACA,SAAA;EACA,KAAA;EACA,eAAA;EACA,gBAAA;EACA,kBAAA;EACA,kBAAA;EACA,0BAAA;EACA,oBAAA;EACA,mBAAA;EACA,0BAAA;EACA;AAAA,GACC,mBAAA,CAAoB,WAAA,IAAe,KAAA,CAAM,GAAA,CAAI,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnresolvedFile.js","names":[],"sources":["../../src/react/UnresolvedFile.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\n\nimport type {
|
|
1
|
+
{"version":3,"file":"UnresolvedFile.js","names":[],"sources":["../../src/react/UnresolvedFile.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\n\nimport type { UnresolvedFile as UnresolvedFileClass } from '../components/UnresolvedFile';\nimport { DIFFS_TAG_NAME } from '../constants';\nimport type { UnresolvedFileHunksRendererOptions } from '../renderers/UnresolvedFileHunksRenderer';\nimport type {\n FileContents,\n HunkSeparators,\n MergeConflictResolution,\n PostRenderPhase,\n} from '../types';\nimport { type MergeConflictDiffAction } from '../utils/parseMergeConflictDiffFromFile';\nimport type { FileDiffProps } from './FileDiff';\nimport type { FileDiffOptions } from './types';\nimport { renderDiffChildren } from './utils/renderDiffChildren';\nimport { templateRender } from './utils/templateRender';\nimport { useUnresolvedFileInstance } from './utils/useUnresolvedFileInstance';\n\nexport interface RenderMergeConflictActionContext {\n resolveConflict(resolution: MergeConflictResolution): void;\n}\n\nexport type RenderMergeConflictActions = (\n action: MergeConflictDiffAction,\n context: RenderMergeConflictActionContext\n) => ReactNode;\n\nexport type MergeConflictActionsTypeOption =\n | 'none'\n | 'default'\n | RenderMergeConflictActions;\n\nexport interface UnresolvedFileReactOptions<LAnnotation>\n extends\n Omit<\n FileDiffOptions<LAnnotation, undefined>,\n 'hunkSeparators' | 'diffStyle' | 'onMergeConflictAction' | 'onPostRender'\n >,\n UnresolvedFileHunksRendererOptions {\n hunkSeparators?: HunkSeparators;\n onPostRender?(\n node: HTMLElement,\n instance: UnresolvedFileClass<LAnnotation>,\n phase: PostRenderPhase\n ): unknown;\n maxContextLines?: number;\n}\n\nexport interface UnresolvedFileProps<LAnnotation> extends Omit<\n FileDiffProps<LAnnotation, undefined>,\n | 'fileDiff'\n | 'options'\n | 'edit'\n | 'editorOptions'\n | 'onEditChange'\n | 'onEditComplete'\n> {\n file: FileContents;\n options?: UnresolvedFileReactOptions<LAnnotation>;\n renderMergeConflictUtility?(\n action: MergeConflictDiffAction,\n getInstance: () => UnresolvedFileClass<LAnnotation> | undefined\n ): ReactNode;\n disableWorkerPool?: boolean;\n}\n\nexport function UnresolvedFile<LAnnotation = undefined>({\n file,\n options,\n lineAnnotations,\n selectedLines,\n className,\n style,\n prerenderedHTML,\n renderAnnotation,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderFilenameSuffix,\n renderHeaderMetadata,\n renderGutterUtility,\n renderMergeConflictUtility,\n disableWorkerPool = false,\n}: UnresolvedFileProps<LAnnotation>): React.JSX.Element {\n const { ref, getHoveredLine, fileDiff, actions, getInstance } =\n useUnresolvedFileInstance({\n file,\n options,\n lineAnnotations,\n selectedLines,\n prerenderedHTML,\n hasConflictUtility: renderMergeConflictUtility != null,\n hasGutterRenderUtility: renderGutterUtility != null,\n hasCustomHeader: renderCustomHeader != null,\n disableWorkerPool,\n });\n const children = renderDiffChildren({\n fileDiff,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderFilenameSuffix,\n renderHeaderMetadata,\n renderAnnotation,\n renderGutterUtility,\n lineAnnotations,\n getHoveredLine,\n actions,\n renderMergeConflictUtility,\n getInstance,\n });\n return (\n <DIFFS_TAG_NAME ref={ref} className={className} style={style}>\n {templateRender(children, prerenderedHTML)}\n </DIFFS_TAG_NAME>\n );\n}\n"],"mappings":";;;;;;;AAoEA,SAAgB,eAAwC,EACtD,MACA,SACA,iBACA,eACA,WACA,OACA,iBACA,kBACA,oBACA,oBACA,4BACA,sBACA,qBACA,4BACA,oBAAoB,SACkC;CACtD,MAAM,EAAE,KAAK,gBAAgB,UAAU,SAAS,gBAC9C,0BAA0B;EACxB;EACA;EACA;EACA;EACA;EACA,oBAAoB,8BAA8B;EAClD,wBAAwB,uBAAuB;EAC/C,iBAAiB,sBAAsB;EACvC;CACF,CAAC;CAeH,OACE,oBAAC,gBAAD;EAAqB;EAAgB;EAAkB;YACpD,eAhBY,mBAAmB;GAClC;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAG2B,GAAG,eAAe;CAC3B,CAAA;AAEpB"}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, CodeToHastOptions,
|
|
1
|
+
import { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, CodeToHastOptions, CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemScrollTarget, CodeViewLayout, CodeViewLineScrollTarget, CodeViewPositionScrollTarget, CodeViewRangeScrollTarget, CodeViewScrollBehavior, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, CreatePatchOptionsNonabortable, CustomPreProperties, DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffFileInput, DiffIndicators, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsHighlighter, DiffsThemeNames, ExpansionDirections, ExtensionFormatMap, FileContents, FileDiffContentsLoader, FileDiffLoadedChangedFiles, FileDiffLoadedFiles, FileDiffLoadedPureRenamedFile, FileDiffMetadata, FileHeaderRenderMode, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, HighlightedToken, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MaybeDiffFileInput, MergeConflictActionPayload, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PendingCodeViewLayoutReset, PostRenderPhase, PrePropertiesConfig, ProcessFileConflictData, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderFilenameSuffixCallback, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, SelectedLineRange, SelectionPoint, SelectionSide, SharedRenderState, ShikiTransformer, SmoothScrollSettings, StickySpecs, SupportedLanguages, ThemeRegistration, ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, ThemedToken, ThemesType, TokenEventBase, VirtualFileMetrics, VirtualWindowSpecs } from "../types.js";
|
|
2
|
+
import { EditorFactory, FileDiffEditCompleteEvent, FileEditCompleteEvent } from "../editor/types.js";
|
|
2
3
|
import { WorkerInitializationRenderOptions, WorkerPoolOptions } from "../worker/types.js";
|
|
3
|
-
import {
|
|
4
|
+
import { FileEditChangeHandler, FileEditCompleteHandler } from "../components/File.js";
|
|
5
|
+
import { FileDiffEditChangeHandler, FileDiffEditCompleteHandler } from "../components/FileDiff.js";
|
|
6
|
+
import { CodeViewItemEditCompleteHandler } from "../components/CodeView.js";
|
|
4
7
|
import { CodeView, CodeViewHandle, CodeViewProps, CodeViewReactOptions, ControlledCodeViewProps, UncontrolledCodeViewProps } from "./CodeView.js";
|
|
5
|
-
import { DiffBasePropsReact, FileProps } from "./types.js";
|
|
8
|
+
import { DiffBasePropsReact, FileDiffOptions, FileOptions, FileProps } from "./types.js";
|
|
6
9
|
import { File } from "./File.js";
|
|
7
10
|
import { FileDiff, FileDiffProps } from "./FileDiff.js";
|
|
8
11
|
import { MergeConflictActionsTypeOption, RenderMergeConflictActionContext, RenderMergeConflictActions, UnresolvedFile, UnresolvedFileProps, UnresolvedFileReactOptions } from "./UnresolvedFile.js";
|
|
@@ -10,7 +13,7 @@ import { MultiFileDiff, MultiFileDiffProps } from "./MultiFileDiff.js";
|
|
|
10
13
|
import { PatchDiff, PatchDiffProps } from "./PatchDiff.js";
|
|
11
14
|
import { Virtualizer, VirtualizerContext, useVirtualizer } from "./Virtualizer.js";
|
|
12
15
|
import { WorkerPoolContext, WorkerPoolContextProvider, useWorkerPool } from "./WorkerPoolContext.js";
|
|
13
|
-
import {
|
|
16
|
+
import { EditContext, EditProvider, EditProviderProps, useCreateEditor } from "./EditContext.js";
|
|
14
17
|
import { GutterUtilitySlotStyles, MergeConflictSlotStyles, noopRender } from "./constants.js";
|
|
15
18
|
import { renderDiffChildren } from "./utils/renderDiffChildren.js";
|
|
16
19
|
import { renderFileChildren } from "./utils/renderFileChildren.js";
|
|
@@ -18,4 +21,4 @@ import { templateRender } from "./utils/templateRender.js";
|
|
|
18
21
|
import { useFileDiffInstance } from "./utils/useFileDiffInstance.js";
|
|
19
22
|
import { useFileInstance } from "./utils/useFileInstance.js";
|
|
20
23
|
import { useStableCallback } from "./utils/useStableCallback.js";
|
|
21
|
-
export { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, type BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, type CodeToHastOptions, CodeView,
|
|
24
|
+
export { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, type BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, type CodeToHastOptions, CodeView, CodeViewDiffItem, CodeViewFileItem, CodeViewHandle, CodeViewItem, type CodeViewItemEditCompleteHandler, CodeViewItemScrollTarget, CodeViewLayout, CodeViewLineScrollTarget, CodeViewPositionScrollTarget, CodeViewProps, CodeViewRangeScrollTarget, CodeViewReactOptions, CodeViewScrollBehavior, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, ControlledCodeViewProps, type CreatePatchOptionsNonabortable, CustomPreProperties, type DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffBasePropsReact, DiffFileInput, DiffIndicators, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsHighlighter, DiffsThemeNames, EditContext, EditProvider, EditProviderProps, type EditorFactory, ExpansionDirections, ExtensionFormatMap, File, FileContents, FileDiff, FileDiffContentsLoader, type FileDiffEditChangeHandler, type FileDiffEditCompleteEvent, type FileDiffEditCompleteHandler, FileDiffLoadedChangedFiles, FileDiffLoadedFiles, FileDiffLoadedPureRenamedFile, FileDiffMetadata, FileDiffOptions, FileDiffProps, type FileEditChangeHandler, type FileEditCompleteEvent, type FileEditCompleteHandler, FileHeaderRenderMode, FileOptions, FileProps, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, GutterUtilitySlotStyles, HighlightedToken, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, type LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MaybeDiffFileInput, MergeConflictActionPayload, MergeConflictActionsTypeOption, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, MergeConflictSlotStyles, MultiFileDiff, MultiFileDiffProps, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PatchDiff, PatchDiffProps, PendingCodeViewLayoutReset, PostRenderPhase, PrePropertiesConfig, ProcessFileConflictData, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderFilenameSuffixCallback, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderMergeConflictActionContext, RenderMergeConflictActions, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, SelectedLineRange, SelectionPoint, SelectionSide, SharedRenderState, type ShikiTransformer, SmoothScrollSettings, StickySpecs, SupportedLanguages, type ThemeRegistration, type ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, type ThemedToken, ThemesType, TokenEventBase, UncontrolledCodeViewProps, UnresolvedFile, UnresolvedFileProps, UnresolvedFileReactOptions, VirtualFileMetrics, VirtualWindowSpecs, Virtualizer, VirtualizerContext, type WorkerInitializationRenderOptions, WorkerPoolContext, WorkerPoolContextProvider, type WorkerPoolOptions, noopRender, renderDiffChildren, renderFileChildren, templateRender, useCreateEditor, useFileDiffInstance, useFileInstance, useStableCallback, useVirtualizer, useWorkerPool };
|
package/dist/react/types.d.ts
CHANGED
|
@@ -1,17 +1,39 @@
|
|
|
1
1
|
import { DiffLineAnnotation, FileContents, FileDiffMetadata, LineAnnotation, SelectedLineRange, VirtualFileMetrics } from "../types.js";
|
|
2
2
|
import { GetHoveredLineResult } from "../managers/InteractionManager.js";
|
|
3
|
-
import { FileOptions } from "../components/File.js";
|
|
4
|
-
import { FileDiffOptions } from "../components/FileDiff.js";
|
|
3
|
+
import { FileEditChangeHandler, FileEditCompleteHandler, FileOptions as FileOptions$1 } from "../components/File.js";
|
|
4
|
+
import { FileDiffEditChangeHandler, FileDiffEditCompleteHandler, FileDiffOptions as FileDiffOptions$1 } from "../components/FileDiff.js";
|
|
5
5
|
import { EditorOptions } from "../editor/editor.js";
|
|
6
6
|
import { CSSProperties, ReactNode } from "react";
|
|
7
7
|
|
|
8
8
|
//#region src/react/types.d.ts
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
type ReactOwnedEditCallbacks = 'onEditChange' | 'onEditComplete';
|
|
10
|
+
type FileDiffOptions<LAnnotation, Caret> = Omit<FileDiffOptions$1<LAnnotation, Caret>, ReactOwnedEditCallbacks>;
|
|
11
|
+
type FileOptions<LAnnotation, Caret> = Omit<FileOptions$1<LAnnotation, Caret>, ReactOwnedEditCallbacks>;
|
|
12
|
+
interface DiffBasePropsReact<LAnnotation, Caret> {
|
|
13
|
+
options?: FileDiffOptions<LAnnotation, Caret>;
|
|
11
14
|
/** Whether this surface has an active edit session. */
|
|
12
15
|
edit?: boolean;
|
|
13
16
|
/** Creation-time options passed to the nearest EditProvider factory. */
|
|
14
|
-
editorOptions?: EditorOptions<LAnnotation>;
|
|
17
|
+
editorOptions?: EditorOptions<'file-diff', LAnnotation, Caret>;
|
|
18
|
+
/** Retain this editable draft and its undo/redo history in memory. */
|
|
19
|
+
editStateKey?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Fired for every document change of an active edit session, with the same
|
|
22
|
+
* `EditorChangeEvent` the editor reports through its own `onChange`. Don't
|
|
23
|
+
* feed this data back into the component.
|
|
24
|
+
*
|
|
25
|
+
* When editing a diff, you are editing the contents of the new file. You
|
|
26
|
+
* cannot edit the contents of the old file. You are not getting back an
|
|
27
|
+
* update `fileDiff` during this edit session.
|
|
28
|
+
*/
|
|
29
|
+
onEditChange?: FileDiffEditChangeHandler<LAnnotation, Caret>;
|
|
30
|
+
/**
|
|
31
|
+
* Fired when `edit` toggles false or the component unmounts. Return `'accept'`
|
|
32
|
+
* to install the completed diff and annotations or `'reject'` to restore the
|
|
33
|
+
* external values. The event contains the detached editor with its final
|
|
34
|
+
* state.
|
|
35
|
+
*/
|
|
36
|
+
onEditComplete?: FileDiffEditCompleteHandler<LAnnotation, Caret>;
|
|
15
37
|
metrics?: VirtualFileMetrics;
|
|
16
38
|
lineAnnotations?: DiffLineAnnotation<LAnnotation>[];
|
|
17
39
|
selectedLines?: SelectedLineRange | null;
|
|
@@ -25,13 +47,28 @@ interface DiffBasePropsReact<LAnnotation> {
|
|
|
25
47
|
style?: CSSProperties;
|
|
26
48
|
prerenderedHTML?: string;
|
|
27
49
|
}
|
|
28
|
-
interface FileProps<LAnnotation> {
|
|
50
|
+
interface FileProps<LAnnotation, Caret> {
|
|
29
51
|
file: FileContents;
|
|
30
|
-
options?: FileOptions<LAnnotation>;
|
|
52
|
+
options?: FileOptions<LAnnotation, Caret>;
|
|
31
53
|
/** Whether this surface has an active edit session. */
|
|
32
54
|
edit?: boolean;
|
|
33
55
|
/** Creation-time options passed to the nearest EditProvider factory. */
|
|
34
|
-
editorOptions?: EditorOptions<LAnnotation>;
|
|
56
|
+
editorOptions?: EditorOptions<'file', LAnnotation, Caret>;
|
|
57
|
+
/** Retain this editable draft and its undo/redo history in memory. */
|
|
58
|
+
editStateKey?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Fired for every document change of an active edit session, with the same
|
|
61
|
+
* `EditorChangeEvent` the editor reports through its own `onChange`. Don't
|
|
62
|
+
* feed this data back into the component.
|
|
63
|
+
*/
|
|
64
|
+
onEditChange?: FileEditChangeHandler<LAnnotation, Caret>;
|
|
65
|
+
/**
|
|
66
|
+
* Fired when `edit` toggles false or the component unmounts. Return `'accept'`
|
|
67
|
+
* to install the completed file and annotations or `'reject'` to restore the
|
|
68
|
+
* external values. The event contains the detached editor with its final
|
|
69
|
+
* state.
|
|
70
|
+
*/
|
|
71
|
+
onEditComplete?: FileEditCompleteHandler<LAnnotation, Caret>;
|
|
35
72
|
metrics?: VirtualFileMetrics;
|
|
36
73
|
lineAnnotations?: LineAnnotation<LAnnotation>[];
|
|
37
74
|
selectedLines?: SelectedLineRange | null;
|
|
@@ -47,5 +84,5 @@ interface FileProps<LAnnotation> {
|
|
|
47
84
|
disableWorkerPool?: boolean;
|
|
48
85
|
}
|
|
49
86
|
//#endregion
|
|
50
|
-
export { DiffBasePropsReact, FileProps };
|
|
87
|
+
export { DiffBasePropsReact, FileDiffOptions, FileOptions, FileProps };
|
|
51
88
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/react/types.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/react/types.ts"],"mappings":";;;;;;;;KAuBK,uBAAA;AAAA,KAEO,eAAA,uBAAsC,IAAA,CAChD,iBAAA,CAAqB,WAAA,EAAa,KAAA,GAClC,uBAAA;AAAA,KAGU,WAAA,uBAAkC,IAAA,CAC5C,aAAA,CAAiB,WAAA,EAAa,KAAA,GAC9B,uBAAA;AAAA,UAGe,kBAAA;EACf,OAAA,GAAU,eAAA,CAAgB,WAAA,EAAa,KAAA;;EAEvC,IAAA;EAf0B;EAiB1B,aAAA,GAAgB,aAAA,cAA2B,WAAA,EAAa,KAAA;EAf/B;EAiBzB,YAAA;EAhBqB;;;;;;;;;EA0BrB,YAAA,GAAe,yBAAA,CAA0B,WAAA,EAAa,KAAA;EA1BtD;;;;;AACuB;EAgCvB,cAAA,GAAiB,2BAAA,CAA4B,WAAA,EAAa,KAAA;EAC1D,OAAA,GAAU,kBAAA;EACV,eAAA,GAAkB,kBAAA,CAAmB,WAAA;EACrC,aAAA,GAAgB,iBAAA;EAChB,gBAAA,EAAkB,WAAA,EAAa,kBAAA,CAAmB,WAAA,IAAe,SAAA;EACjE,kBAAA,EAAoB,QAAA,EAAU,gBAAA,GAAmB,SAAA;EACjD,kBAAA,EAAoB,QAAA,EAAU,gBAAA,GAAmB,SAAA;EACjD,0BAAA,EAA4B,QAAA,EAAU,gBAAA,GAAmB,SAAA;EACzD,oBAAA,EAAsB,QAAA,EAAU,gBAAA,GAAmB,SAAA;EACnD,mBAAA,EACE,cAAA,QAAsB,oBAAA,uBACrB,SAAA;EACH,SAAA;EACA,KAAA,GAAQ,aAAA;EACR,eAAA;AAAA;AAAA,UAGe,SAAA;EACf,IAAA,EAAM,YAAA;EACN,OAAA,GAAU,WAAA,CAAY,WAAA,EAAa,KAAA;EA9CZ;EAgDvB,IAAA;EA7Ce;EA+Cf,aAAA,GAAgB,aAAA,SAAsB,WAAA,EAAa,KAAA;EA/ClB;EAiDjC,YAAA;EAhDuC;;;;;EAsDvC,YAAA,GAAe,qBAAA,CAAsB,WAAA,EAAa,KAAA;EAtCI;;;;;;EA6CtD,cAAA,GAAiB,uBAAA,CAAwB,WAAA,EAAa,KAAA;EACtD,OAAA,GAAU,kBAAA;EACV,eAAA,GAAkB,cAAA,CAAe,WAAA;EACjC,aAAA,GAAgB,iBAAA;EAChB,gBAAA,EAAkB,WAAA,EAAa,cAAA,CAAe,WAAA,IAAe,SAAA;EAC7D,kBAAA,EAAoB,IAAA,EAAM,YAAA,GAAe,SAAA;EACzC,kBAAA,EAAoB,IAAA,EAAM,YAAA,GAAe,SAAA;EACzC,0BAAA,EAA4B,IAAA,EAAM,YAAA,GAAe,SAAA;EACjD,oBAAA,EAAsB,IAAA,EAAM,YAAA,GAAe,SAAA;EAC3C,mBAAA,EACE,cAAA,QAAsB,oBAAA,uBACrB,SAAA;EACH,SAAA;EACA,KAAA,GAAQ,aAAA;EACR,eAAA;EACA,iBAAA;AAAA"}
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { FileDiffMetadata } from "../../types.js";
|
|
1
|
+
import { DiffLineAnnotation, FileDiffMetadata } from "../../types.js";
|
|
2
2
|
import { GetHoveredLineResult } from "../../managers/InteractionManager.js";
|
|
3
3
|
import { MergeConflictDiffAction } from "../../utils/parseMergeConflictDiffFromFile.js";
|
|
4
4
|
import { DiffBasePropsReact } from "../types.js";
|
|
5
5
|
import { ReactNode } from "react";
|
|
6
6
|
|
|
7
7
|
//#region src/react/utils/renderDiffChildren.d.ts
|
|
8
|
-
interface RenderDiffChildrenProps<LAnnotation, T> {
|
|
8
|
+
interface RenderDiffChildrenProps<LAnnotation, Caret, T> {
|
|
9
9
|
fileDiff: FileDiffMetadata;
|
|
10
10
|
actions?: (MergeConflictDiffAction | undefined)[];
|
|
11
|
-
renderCustomHeader: DiffBasePropsReact<LAnnotation>['renderCustomHeader'];
|
|
12
|
-
renderHeaderPrefix: DiffBasePropsReact<LAnnotation>['renderHeaderPrefix'];
|
|
13
|
-
renderHeaderFilenameSuffix?: DiffBasePropsReact<LAnnotation>['renderHeaderFilenameSuffix'];
|
|
14
|
-
renderHeaderMetadata: DiffBasePropsReact<LAnnotation>['renderHeaderMetadata'];
|
|
15
|
-
renderAnnotation: DiffBasePropsReact<LAnnotation>['renderAnnotation'];
|
|
16
|
-
renderGutterUtility: DiffBasePropsReact<LAnnotation>['renderGutterUtility'];
|
|
11
|
+
renderCustomHeader: DiffBasePropsReact<LAnnotation, Caret>['renderCustomHeader'];
|
|
12
|
+
renderHeaderPrefix: DiffBasePropsReact<LAnnotation, Caret>['renderHeaderPrefix'];
|
|
13
|
+
renderHeaderFilenameSuffix?: DiffBasePropsReact<LAnnotation, Caret>['renderHeaderFilenameSuffix'];
|
|
14
|
+
renderHeaderMetadata: DiffBasePropsReact<LAnnotation, Caret>['renderHeaderMetadata'];
|
|
15
|
+
renderAnnotation: DiffBasePropsReact<LAnnotation, Caret>['renderAnnotation'];
|
|
16
|
+
renderGutterUtility: DiffBasePropsReact<LAnnotation, Caret>['renderGutterUtility'];
|
|
17
17
|
renderMergeConflictUtility?(action: MergeConflictDiffAction, getInstance: () => T | undefined): ReactNode;
|
|
18
|
-
lineAnnotations: DiffBasePropsReact<LAnnotation>['lineAnnotations'];
|
|
18
|
+
lineAnnotations: DiffBasePropsReact<LAnnotation, Caret>['lineAnnotations'];
|
|
19
19
|
getHoveredLine(): GetHoveredLineResult<'diff'> | undefined;
|
|
20
20
|
getInstance?(): T | undefined;
|
|
21
|
+
getAnnotationSlotName?(annotation: DiffLineAnnotation<LAnnotation>): string;
|
|
21
22
|
}
|
|
22
|
-
declare function renderDiffChildren<LAnnotation, T>({
|
|
23
|
+
declare function renderDiffChildren<LAnnotation, Caret, T>({
|
|
23
24
|
fileDiff,
|
|
24
25
|
actions,
|
|
25
26
|
renderCustomHeader,
|
|
@@ -31,8 +32,9 @@ declare function renderDiffChildren<LAnnotation, T>({
|
|
|
31
32
|
renderMergeConflictUtility,
|
|
32
33
|
lineAnnotations,
|
|
33
34
|
getHoveredLine,
|
|
34
|
-
getInstance
|
|
35
|
-
|
|
35
|
+
getInstance,
|
|
36
|
+
getAnnotationSlotName
|
|
37
|
+
}: RenderDiffChildrenProps<LAnnotation, Caret, T>): ReactNode;
|
|
36
38
|
//#endregion
|
|
37
39
|
export { renderDiffChildren };
|
|
38
40
|
//# sourceMappingURL=renderDiffChildren.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderDiffChildren.d.ts","names":[],"sources":["../../../src/react/utils/renderDiffChildren.tsx"],"mappings":";;;;;;;UAmBU,uBAAA;EACR,QAAA,EAAU,gBAAA;EACV,OAAA,IAAW,uBAAA;EACX,kBAAA,EAAoB,kBAAA,
|
|
1
|
+
{"version":3,"file":"renderDiffChildren.d.ts","names":[],"sources":["../../../src/react/utils/renderDiffChildren.tsx"],"mappings":";;;;;;;UAmBU,uBAAA;EACR,QAAA,EAAU,gBAAA;EACV,OAAA,IAAW,uBAAA;EACX,kBAAA,EAAoB,kBAAA,CAClB,WAAA,EACA,KAAA;EAEF,kBAAA,EAAoB,kBAAA,CAClB,WAAA,EACA,KAAA;EAEF,0BAAA,GAA6B,kBAAA,CAC3B,WAAA,EACA,KAAA;EAEF,oBAAA,EAAsB,kBAAA,CACpB,WAAA,EACA,KAAA;EAEF,gBAAA,EAAkB,kBAAA,CAAmB,WAAA,EAAa,KAAA;EAClD,mBAAA,EAAqB,kBAAA,CACnB,WAAA,EACA,KAAA;EAEF,0BAAA,EACE,MAAA,EAAQ,uBAAA,EACR,WAAA,QAAmB,CAAA,eAClB,SAAA;EACH,eAAA,EAAiB,kBAAA,CAAmB,WAAA,EAAa,KAAA;EACjD,cAAA,IAAkB,oBAAA;EAClB,WAAA,KAAgB,CAAA;EAChB,qBAAA,EAAuB,UAAA,EAAY,kBAAA,CAAmB,WAAA;AAAA;AAAA,iBAGxC,kBAAA;EACd,QAAA;EACA,OAAA;EACA,kBAAA;EACA,kBAAA;EACA,0BAAA;EACA,oBAAA;EACA,gBAAA;EACA,mBAAA;EACA,0BAAA;EACA,eAAA;EACA,cAAA;EACA,WAAA;EACA;AAAA,GACC,uBAAA,CAAwB,WAAA,EAAa,KAAA,EAAO,CAAA,IAAK,SAAA"}
|
|
@@ -5,7 +5,7 @@ import { getMergeConflictActionAnchor } from "../../utils/parseMergeConflictDiff
|
|
|
5
5
|
import { GutterUtilitySlotStyles, MergeConflictSlotStyles } from "../constants.js";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
//#region src/react/utils/renderDiffChildren.tsx
|
|
8
|
-
function renderDiffChildren({ fileDiff, actions, renderCustomHeader, renderHeaderPrefix, renderHeaderFilenameSuffix, renderHeaderMetadata, renderAnnotation, renderGutterUtility, renderMergeConflictUtility, lineAnnotations, getHoveredLine, getInstance }) {
|
|
8
|
+
function renderDiffChildren({ fileDiff, actions, renderCustomHeader, renderHeaderPrefix, renderHeaderFilenameSuffix, renderHeaderMetadata, renderAnnotation, renderGutterUtility, renderMergeConflictUtility, lineAnnotations, getHoveredLine, getInstance, getAnnotationSlotName = getLineAnnotationName }) {
|
|
9
9
|
const customHeader = renderCustomHeader?.(fileDiff);
|
|
10
10
|
const prefix = renderHeaderPrefix?.(fileDiff);
|
|
11
11
|
const suffix = renderHeaderFilenameSuffix?.(fileDiff);
|
|
@@ -29,7 +29,7 @@ function renderDiffChildren({ fileDiff, actions, renderCustomHeader, renderHeade
|
|
|
29
29
|
})
|
|
30
30
|
] }),
|
|
31
31
|
renderAnnotation != null && lineAnnotations?.map((annotation, index) => /* @__PURE__ */ jsx("div", {
|
|
32
|
-
slot:
|
|
32
|
+
slot: getAnnotationSlotName(annotation),
|
|
33
33
|
children: renderAnnotation(annotation)
|
|
34
34
|
}, index)),
|
|
35
35
|
actions != null && renderMergeConflictUtility != null && getInstance != null && actions.map((action) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderDiffChildren.js","names":[],"sources":["../../../src/react/utils/renderDiffChildren.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport {\n CUSTOM_HEADER_SLOT_ID,\n HEADER_FILENAME_SUFFIX_SLOT_ID,\n HEADER_METADATA_SLOT_ID,\n HEADER_PREFIX_SLOT_ID,\n} from '../../constants';\nimport type { GetHoveredLineResult } from '../../managers/InteractionManager';\nimport type { FileDiffMetadata } from '../../types';\nimport { getLineAnnotationName } from '../../utils/getLineAnnotationName';\nimport { getMergeConflictActionSlotName } from '../../utils/getMergeConflictActionSlotName';\nimport {\n getMergeConflictActionAnchor,\n type MergeConflictDiffAction,\n} from '../../utils/parseMergeConflictDiffFromFile';\nimport { GutterUtilitySlotStyles, MergeConflictSlotStyles } from '../constants';\nimport type { DiffBasePropsReact } from '../types';\n\ninterface RenderDiffChildrenProps<LAnnotation, T> {\n fileDiff: FileDiffMetadata;\n actions?: (MergeConflictDiffAction | undefined)[];\n renderCustomHeader: DiffBasePropsReact
|
|
1
|
+
{"version":3,"file":"renderDiffChildren.js","names":[],"sources":["../../../src/react/utils/renderDiffChildren.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport {\n CUSTOM_HEADER_SLOT_ID,\n HEADER_FILENAME_SUFFIX_SLOT_ID,\n HEADER_METADATA_SLOT_ID,\n HEADER_PREFIX_SLOT_ID,\n} from '../../constants';\nimport type { GetHoveredLineResult } from '../../managers/InteractionManager';\nimport type { DiffLineAnnotation, FileDiffMetadata } from '../../types';\nimport { getLineAnnotationName } from '../../utils/getLineAnnotationName';\nimport { getMergeConflictActionSlotName } from '../../utils/getMergeConflictActionSlotName';\nimport {\n getMergeConflictActionAnchor,\n type MergeConflictDiffAction,\n} from '../../utils/parseMergeConflictDiffFromFile';\nimport { GutterUtilitySlotStyles, MergeConflictSlotStyles } from '../constants';\nimport type { DiffBasePropsReact } from '../types';\n\ninterface RenderDiffChildrenProps<LAnnotation, Caret, T> {\n fileDiff: FileDiffMetadata;\n actions?: (MergeConflictDiffAction | undefined)[];\n renderCustomHeader: DiffBasePropsReact<\n LAnnotation,\n Caret\n >['renderCustomHeader'];\n renderHeaderPrefix: DiffBasePropsReact<\n LAnnotation,\n Caret\n >['renderHeaderPrefix'];\n renderHeaderFilenameSuffix?: DiffBasePropsReact<\n LAnnotation,\n Caret\n >['renderHeaderFilenameSuffix'];\n renderHeaderMetadata: DiffBasePropsReact<\n LAnnotation,\n Caret\n >['renderHeaderMetadata'];\n renderAnnotation: DiffBasePropsReact<LAnnotation, Caret>['renderAnnotation'];\n renderGutterUtility: DiffBasePropsReact<\n LAnnotation,\n Caret\n >['renderGutterUtility'];\n renderMergeConflictUtility?(\n action: MergeConflictDiffAction,\n getInstance: () => T | undefined\n ): ReactNode;\n lineAnnotations: DiffBasePropsReact<LAnnotation, Caret>['lineAnnotations'];\n getHoveredLine(): GetHoveredLineResult<'diff'> | undefined;\n getInstance?(): T | undefined;\n getAnnotationSlotName?(annotation: DiffLineAnnotation<LAnnotation>): string;\n}\n\nexport function renderDiffChildren<LAnnotation, Caret, T>({\n fileDiff,\n actions,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderFilenameSuffix,\n renderHeaderMetadata,\n renderAnnotation,\n renderGutterUtility,\n renderMergeConflictUtility,\n lineAnnotations,\n getHoveredLine,\n getInstance,\n getAnnotationSlotName = getLineAnnotationName,\n}: RenderDiffChildrenProps<LAnnotation, Caret, T>): ReactNode {\n const customHeader = renderCustomHeader?.(fileDiff);\n const prefix = renderHeaderPrefix?.(fileDiff);\n const suffix = renderHeaderFilenameSuffix?.(fileDiff);\n const metadata = renderHeaderMetadata?.(fileDiff);\n return (\n <>\n {customHeader != null ? (\n <div slot={CUSTOM_HEADER_SLOT_ID}>{customHeader}</div>\n ) : (\n <>\n {prefix != null && <div slot={HEADER_PREFIX_SLOT_ID}>{prefix}</div>}\n {suffix != null && (\n <div slot={HEADER_FILENAME_SUFFIX_SLOT_ID}>{suffix}</div>\n )}\n {metadata != null && (\n <div slot={HEADER_METADATA_SLOT_ID}>{metadata}</div>\n )}\n </>\n )}\n {renderAnnotation != null &&\n lineAnnotations?.map((annotation, index) => (\n <div key={index} slot={getAnnotationSlotName(annotation)}>\n {renderAnnotation(annotation)}\n </div>\n ))}\n {actions != null &&\n renderMergeConflictUtility != null &&\n getInstance != null &&\n actions.map((action) => {\n if (action == null) {\n return undefined;\n }\n const slot = getSlotName(action, fileDiff);\n return (\n <div key={slot} slot={slot} style={MergeConflictSlotStyles}>\n {renderMergeConflictUtility(action, getInstance)}\n </div>\n );\n })}\n {renderGutterUtility != null && (\n <div slot=\"gutter-utility-slot\" style={GutterUtilitySlotStyles}>\n {renderGutterUtility(getHoveredLine)}\n </div>\n )}\n </>\n );\n}\n\nfunction getSlotName(\n action: MergeConflictDiffAction,\n fileDiff: FileDiffMetadata\n): string | undefined {\n const anchor = getMergeConflictActionAnchor(action, fileDiff);\n return anchor != null\n ? getMergeConflictActionSlotName({\n hunkIndex: anchor.hunkIndex,\n lineIndex: anchor.lineIndex,\n conflictIndex: action.conflictIndex,\n })\n : undefined;\n}\n"],"mappings":";;;;;;;AAqDA,SAAgB,mBAA0C,EACxD,UACA,SACA,oBACA,oBACA,4BACA,sBACA,kBACA,qBACA,4BACA,iBACA,gBACA,aACA,wBAAwB,yBACoC;CAC5D,MAAM,eAAe,qBAAqB,QAAQ;CAClD,MAAM,SAAS,qBAAqB,QAAQ;CAC5C,MAAM,SAAS,6BAA6B,QAAQ;CACpD,MAAM,WAAW,uBAAuB,QAAQ;CAChD,OACE,qBAAA,UAAA,EAAA,UAAA;EACG,gBAAgB,OACf,oBAAC,OAAD;GAAK,MAAM;aAAwB;EAAkB,CAAA,IAErD,qBAAA,UAAA,EAAA,UAAA;GACG,UAAU,QAAQ,oBAAC,OAAD;IAAK,MAAA;cAA8B;GAAY,CAAA;GACjE,UAAU,QACT,oBAAC,OAAD;IAAK,MAAA;cAAuC;GAAY,CAAA;GAEzD,YAAY,QACX,oBAAC,OAAD;IAAK,MAAA;cAAgC;GAAc,CAAA;EAErD,EAAA,CAAA;EAEH,oBAAoB,QACnB,iBAAiB,KAAK,YAAY,UAChC,oBAAC,OAAD;GAAiB,MAAM,sBAAsB,UAAU;aACpD,iBAAiB,UAAU;EACzB,GAFK,KAEL,CACN;EACF,WAAW,QACV,8BAA8B,QAC9B,eAAe,QACf,QAAQ,KAAK,WAAW;GACtB,IAAI,UAAU,MACZ;GAEF,MAAM,OAAO,YAAY,QAAQ,QAAQ;GACzC,OACE,oBAAC,OAAD;IAAsB;IAAM,OAAO;cAChC,2BAA2B,QAAQ,WAAW;GAC5C,GAFK,IAEL;EAET,CAAC;EACF,uBAAuB,QACtB,oBAAC,OAAD;GAAK,MAAK;GAAsB,OAAO;aACpC,oBAAoB,cAAc;EAChC,CAAA;CAEP,EAAA,CAAA;AAEN;AAEA,SAAS,YACP,QACA,UACoB;CACpB,MAAM,SAAS,6BAA6B,QAAQ,QAAQ;CAC5D,OAAO,UAAU,OACb,+BAA+B;EAC7B,WAAW,OAAO;EAClB,WAAW,OAAO;EAClB,eAAe,OAAO;CACxB,CAAC,IACD,KAAA;AACN"}
|