@pierre/diffs 1.1.2 → 1.1.4
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/AdvancedVirtualizedFileDiff.d.ts.map +1 -1
- package/dist/components/File.d.ts.map +1 -1
- package/dist/components/FileDiff.d.ts +4 -4
- package/dist/components/FileDiff.d.ts.map +1 -1
- package/dist/components/FileDiff.js.map +1 -1
- package/dist/components/UnresolvedFile.d.ts +18 -9
- package/dist/components/UnresolvedFile.d.ts.map +1 -1
- package/dist/components/UnresolvedFile.js +199 -57
- package/dist/components/UnresolvedFile.js.map +1 -1
- package/dist/components/VirtulizerDevelopment.d.ts.map +1 -1
- package/dist/constants.d.ts +5 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +5 -1
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/index.js +5 -4
- package/dist/react/UnresolvedFile.d.ts +3 -1
- package/dist/react/UnresolvedFile.d.ts.map +1 -1
- package/dist/react/UnresolvedFile.js.map +1 -1
- package/dist/react/index.d.ts +2 -2
- package/dist/react/jsx.d.ts.map +1 -1
- package/dist/react/utils/renderDiffChildren.d.ts +1 -1
- package/dist/react/utils/renderDiffChildren.d.ts.map +1 -1
- package/dist/react/utils/renderDiffChildren.js +6 -4
- package/dist/react/utils/renderDiffChildren.js.map +1 -1
- package/dist/react/utils/useUnresolvedFileInstance.d.ts +5 -4
- package/dist/react/utils/useUnresolvedFileInstance.d.ts.map +1 -1
- package/dist/react/utils/useUnresolvedFileInstance.js +15 -12
- package/dist/react/utils/useUnresolvedFileInstance.js.map +1 -1
- package/dist/renderers/DiffHunksRenderer.d.ts +15 -7
- package/dist/renderers/DiffHunksRenderer.d.ts.map +1 -1
- package/dist/renderers/DiffHunksRenderer.js +9 -7
- package/dist/renderers/DiffHunksRenderer.js.map +1 -1
- package/dist/renderers/UnresolvedFileHunksRenderer.d.ts +11 -16
- package/dist/renderers/UnresolvedFileHunksRenderer.d.ts.map +1 -1
- package/dist/renderers/UnresolvedFileHunksRenderer.js +68 -75
- package/dist/renderers/UnresolvedFileHunksRenderer.js.map +1 -1
- package/dist/ssr/index.d.ts +2 -2
- package/dist/ssr/preloadDiffs.d.ts +2 -2
- package/dist/ssr/preloadDiffs.d.ts.map +1 -1
- package/dist/ssr/preloadDiffs.js +4 -3
- package/dist/ssr/preloadDiffs.js.map +1 -1
- package/dist/style.js +1 -1
- package/dist/style.js.map +1 -1
- package/dist/types.d.ts +41 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/areMergeConflictActionsEqual.js +1 -1
- package/dist/utils/areMergeConflictActionsEqual.js.map +1 -1
- package/dist/utils/diffAcceptRejectHunk.d.ts +3 -2
- package/dist/utils/diffAcceptRejectHunk.d.ts.map +1 -1
- package/dist/utils/diffAcceptRejectHunk.js +24 -89
- package/dist/utils/diffAcceptRejectHunk.js.map +1 -1
- package/dist/utils/getMergeConflictActionSlotName.d.ts +4 -6
- package/dist/utils/getMergeConflictActionSlotName.d.ts.map +1 -1
- package/dist/utils/getMergeConflictActionSlotName.js +2 -2
- package/dist/utils/getMergeConflictActionSlotName.js.map +1 -1
- package/dist/utils/getMergeConflictLineTypes.d.ts +1 -2
- package/dist/utils/getMergeConflictLineTypes.d.ts.map +1 -1
- package/dist/utils/getMergeConflictLineTypes.js +7 -12
- package/dist/utils/getMergeConflictLineTypes.js.map +1 -1
- package/dist/utils/normalizeDiffResolution.d.ts +7 -0
- package/dist/utils/normalizeDiffResolution.d.ts.map +1 -0
- package/dist/utils/normalizeDiffResolution.js +11 -0
- package/dist/utils/normalizeDiffResolution.js.map +1 -0
- package/dist/utils/parseMergeConflictDiffFromFile.d.ts +16 -12
- package/dist/utils/parseMergeConflictDiffFromFile.d.ts.map +1 -1
- package/dist/utils/parseMergeConflictDiffFromFile.js +474 -117
- package/dist/utils/parseMergeConflictDiffFromFile.js.map +1 -1
- package/dist/utils/resolveConflict.d.ts +7 -0
- package/dist/utils/resolveConflict.d.ts.map +1 -0
- package/dist/utils/resolveConflict.js +23 -0
- package/dist/utils/resolveConflict.js.map +1 -0
- package/dist/utils/resolveRegion.d.ts +14 -0
- package/dist/utils/resolveRegion.d.ts.map +1 -0
- package/dist/utils/resolveRegion.js +215 -0
- package/dist/utils/resolveRegion.js.map +1 -0
- package/dist/utils/trimPatchContext.js +19 -20
- package/dist/utils/trimPatchContext.js.map +1 -1
- package/dist/worker/{wasm-BlUZCxHM.js → wasm-BaDzIkIn.js} +2 -2
- package/dist/worker/wasm-BaDzIkIn.js.map +1 -0
- package/dist/worker/worker-portable.js +4880 -4810
- package/dist/worker/worker-portable.js.map +1 -1
- package/dist/worker/worker.js.map +1 -1
- package/package.json +2 -1
- package/dist/utils/resolveMergeConflict.d.ts +0 -7
- package/dist/utils/resolveMergeConflict.d.ts.map +0 -1
- package/dist/utils/resolveMergeConflict.js +0 -30
- package/dist/utils/resolveMergeConflict.js.map +0 -1
- package/dist/worker/wasm-BlUZCxHM.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FileContents, FileDiffMetadata, MergeConflictActionPayload, MergeConflictResolution } from "../types.js";
|
|
1
|
+
import { FileContents, FileDiffMetadata, MergeConflictActionPayload, MergeConflictMarkerRow, MergeConflictResolution } from "../types.js";
|
|
2
2
|
import { WorkerPoolManager } from "../worker/WorkerPoolManager.js";
|
|
3
3
|
import "../worker/index.js";
|
|
4
4
|
import { HunksRenderResult } from "../renderers/DiffHunksRenderer.js";
|
|
@@ -9,27 +9,34 @@ import { FileDiff, FileDiffOptions, FileDiffRenderProps } from "./FileDiff.js";
|
|
|
9
9
|
//#region src/components/UnresolvedFile.d.ts
|
|
10
10
|
type RenderMergeConflictActions<LAnnotation> = (action: MergeConflictDiffAction, instance: UnresolvedFile<LAnnotation>) => HTMLElement | DocumentFragment | null | undefined;
|
|
11
11
|
type MergeConflictActionsTypeOption<LAnnotation> = 'none' | 'default' | RenderMergeConflictActions<LAnnotation>;
|
|
12
|
-
interface UnresolvedFileOptions<LAnnotation> extends FileDiffOptions<LAnnotation> {
|
|
12
|
+
interface UnresolvedFileOptions<LAnnotation> extends Omit<FileDiffOptions<LAnnotation>, 'diffStyle'> {
|
|
13
13
|
onPostRender?(node: HTMLElement, instance: UnresolvedFile<LAnnotation>): unknown;
|
|
14
14
|
mergeConflictActionsType?: MergeConflictActionsTypeOption<LAnnotation>;
|
|
15
15
|
onMergeConflictAction?(payload: MergeConflictActionPayload, instance: UnresolvedFile<LAnnotation>): void;
|
|
16
16
|
onMergeConflictResolve?(file: FileContents, payload: MergeConflictActionPayload): void;
|
|
17
|
+
maxContextLines?: number;
|
|
17
18
|
}
|
|
18
19
|
interface UnresolvedFileRenderProps<LAnnotation> extends Omit<FileDiffRenderProps<LAnnotation>, 'oldFile' | 'newFile'> {
|
|
19
20
|
file?: FileContents;
|
|
20
|
-
actions?: MergeConflictDiffAction[];
|
|
21
|
+
actions?: (MergeConflictDiffAction | undefined)[];
|
|
22
|
+
markerRows?: MergeConflictMarkerRow[];
|
|
21
23
|
}
|
|
22
24
|
interface UnresolvedFileHydrationProps<LAnnotation> extends Omit<UnresolvedFileRenderProps<LAnnotation>, 'file'> {
|
|
23
25
|
file?: FileContents;
|
|
24
|
-
fileDiff?: FileDiffMetadata;
|
|
25
|
-
actions?: MergeConflictDiffAction[];
|
|
26
26
|
fileContainer: HTMLElement;
|
|
27
27
|
prerenderedHTML?: string;
|
|
28
28
|
}
|
|
29
29
|
interface GetOrComputeDiffProps {
|
|
30
30
|
file: FileContents | undefined;
|
|
31
31
|
fileDiff: FileDiffMetadata | undefined;
|
|
32
|
-
actions: MergeConflictDiffAction[] | undefined;
|
|
32
|
+
actions: (MergeConflictDiffAction | undefined)[] | undefined;
|
|
33
|
+
markerRows: MergeConflictMarkerRow[] | undefined;
|
|
34
|
+
}
|
|
35
|
+
interface ResolveConflictReturn {
|
|
36
|
+
file: FileContents;
|
|
37
|
+
fileDiff: FileDiffMetadata;
|
|
38
|
+
actions: (MergeConflictDiffAction | undefined)[];
|
|
39
|
+
markerRows: MergeConflictMarkerRow[];
|
|
33
40
|
}
|
|
34
41
|
type UnresolvedFileDataCache = GetOrComputeDiffProps;
|
|
35
42
|
declare class UnresolvedFile<LAnnotation = undefined> extends FileDiff<LAnnotation> {
|
|
@@ -37,6 +44,7 @@ declare class UnresolvedFile<LAnnotation = undefined> extends FileDiff<LAnnotati
|
|
|
37
44
|
readonly __id: string;
|
|
38
45
|
protected computedCache: UnresolvedFileDataCache;
|
|
39
46
|
private conflictActions;
|
|
47
|
+
private markerRows;
|
|
40
48
|
private conflictActionCache;
|
|
41
49
|
constructor(options?: UnresolvedFileOptions<LAnnotation>, workerManager?: WorkerPoolManager | undefined, isContainerManaged?: boolean);
|
|
42
50
|
setOptions(options: UnresolvedFileOptions<LAnnotation> | undefined): void;
|
|
@@ -48,14 +56,15 @@ declare class UnresolvedFile<LAnnotation = undefined> extends FileDiff<LAnnotati
|
|
|
48
56
|
hydrate(props: UnresolvedFileHydrationProps<LAnnotation>): void;
|
|
49
57
|
rerender(): void;
|
|
50
58
|
render(props?: UnresolvedFileRenderProps<LAnnotation>): boolean;
|
|
51
|
-
resolveConflict(conflictIndex: number, resolution: MergeConflictResolution,
|
|
59
|
+
resolveConflict(conflictIndex: number, resolution: MergeConflictResolution, fileDiff?: FileDiffMetadata | undefined): ResolveConflictReturn | undefined;
|
|
52
60
|
private resolveConflictAndRender;
|
|
53
|
-
private
|
|
61
|
+
private setActiveMergeConflictState;
|
|
54
62
|
private handleMergeConflictActionClick;
|
|
55
63
|
private renderMergeConflictActionSlots;
|
|
56
64
|
private renderMergeConflictAction;
|
|
57
65
|
private clearMergeConflictActionCache;
|
|
58
66
|
}
|
|
67
|
+
declare function getUnresolvedDiffHunksRendererOptions<LAnnotation>(options?: UnresolvedFileOptions<LAnnotation>, baseOptions?: UnresolvedFileOptions<LAnnotation>): UnresolvedFileHunksRendererOptions;
|
|
59
68
|
//#endregion
|
|
60
|
-
export { MergeConflictActionsTypeOption, RenderMergeConflictActions, UnresolvedFile, UnresolvedFileHydrationProps, UnresolvedFileOptions, UnresolvedFileRenderProps };
|
|
69
|
+
export { MergeConflictActionsTypeOption, RenderMergeConflictActions, UnresolvedFile, UnresolvedFileHydrationProps, UnresolvedFileOptions, UnresolvedFileRenderProps, getUnresolvedDiffHunksRendererOptions };
|
|
61
70
|
//# sourceMappingURL=UnresolvedFile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnresolvedFile.d.ts","names":["HunksRenderResult","UnresolvedFileHunksRenderer","UnresolvedFileHunksRendererOptions","FileContents","FileDiffMetadata","MergeConflictActionPayload","MergeConflictResolution","MergeConflictDiffAction","WorkerPoolManager","FileDiff","FileDiffOptions","FileDiffRenderProps","RenderMergeConflictActions","LAnnotation","UnresolvedFile","HTMLElement","DocumentFragment","MergeConflictActionsTypeOption","UnresolvedFileOptions","
|
|
1
|
+
{"version":3,"file":"UnresolvedFile.d.ts","names":["HunksRenderResult","UnresolvedFileHunksRenderer","UnresolvedFileHunksRendererOptions","FileContents","FileDiffMetadata","MergeConflictActionPayload","MergeConflictMarkerRow","MergeConflictResolution","MergeConflictDiffAction","WorkerPoolManager","FileDiff","FileDiffOptions","FileDiffRenderProps","RenderMergeConflictActions","LAnnotation","UnresolvedFile","HTMLElement","DocumentFragment","MergeConflictActionsTypeOption","UnresolvedFileOptions","Omit","UnresolvedFileRenderProps","UnresolvedFileHydrationProps","GetOrComputeDiffProps","ResolveConflictReturn","UnresolvedFileDataCache","HTMLPreElement","getUnresolvedDiffHunksRendererOptions"],"sources":["../../src/components/UnresolvedFile.d.ts"],"sourcesContent":["import type { HunksRenderResult } from '../renderers/DiffHunksRenderer';\nimport { UnresolvedFileHunksRenderer, type UnresolvedFileHunksRendererOptions } from '../renderers/UnresolvedFileHunksRenderer';\nimport type { FileContents, FileDiffMetadata, MergeConflictActionPayload, MergeConflictMarkerRow, MergeConflictResolution } from '../types';\nimport { type MergeConflictDiffAction } from '../utils/parseMergeConflictDiffFromFile';\nimport type { WorkerPoolManager } from '../worker';\nimport { FileDiff, type FileDiffOptions, type FileDiffRenderProps } from './FileDiff';\nexport type RenderMergeConflictActions<LAnnotation> = (action: MergeConflictDiffAction, instance: UnresolvedFile<LAnnotation>) => HTMLElement | DocumentFragment | null | undefined;\nexport type MergeConflictActionsTypeOption<LAnnotation> = 'none' | 'default' | RenderMergeConflictActions<LAnnotation>;\nexport interface UnresolvedFileOptions<LAnnotation> extends Omit<FileDiffOptions<LAnnotation>, 'diffStyle'> {\n onPostRender?(node: HTMLElement, instance: UnresolvedFile<LAnnotation>): unknown;\n mergeConflictActionsType?: MergeConflictActionsTypeOption<LAnnotation>;\n onMergeConflictAction?(payload: MergeConflictActionPayload, instance: UnresolvedFile<LAnnotation>): void;\n onMergeConflictResolve?(file: FileContents, payload: MergeConflictActionPayload): void;\n maxContextLines?: number;\n}\nexport interface UnresolvedFileRenderProps<LAnnotation> extends Omit<FileDiffRenderProps<LAnnotation>, 'oldFile' | 'newFile'> {\n file?: FileContents;\n actions?: (MergeConflictDiffAction | undefined)[];\n markerRows?: MergeConflictMarkerRow[];\n}\nexport interface UnresolvedFileHydrationProps<LAnnotation> extends Omit<UnresolvedFileRenderProps<LAnnotation>, 'file'> {\n file?: FileContents;\n fileContainer: HTMLElement;\n prerenderedHTML?: string;\n}\ninterface GetOrComputeDiffProps {\n file: FileContents | undefined;\n fileDiff: FileDiffMetadata | undefined;\n actions: (MergeConflictDiffAction | undefined)[] | undefined;\n markerRows: MergeConflictMarkerRow[] | undefined;\n}\ninterface ResolveConflictReturn {\n file: FileContents;\n fileDiff: FileDiffMetadata;\n actions: (MergeConflictDiffAction | undefined)[];\n markerRows: MergeConflictMarkerRow[];\n}\ntype UnresolvedFileDataCache = GetOrComputeDiffProps;\nexport declare class UnresolvedFile<LAnnotation = undefined> extends FileDiff<LAnnotation> {\n options: UnresolvedFileOptions<LAnnotation>;\n readonly __id: string;\n protected computedCache: UnresolvedFileDataCache;\n private conflictActions;\n private markerRows;\n private conflictActionCache;\n constructor(options?: UnresolvedFileOptions<LAnnotation>, workerManager?: WorkerPoolManager | undefined, isContainerManaged?: boolean);\n setOptions(options: UnresolvedFileOptions<LAnnotation> | undefined): void;\n protected createHunksRenderer(options: UnresolvedFileOptions<LAnnotation>): UnresolvedFileHunksRenderer<LAnnotation>;\n protected getHunksRendererOptions(options: UnresolvedFileOptions<LAnnotation>): UnresolvedFileHunksRendererOptions;\n protected applyPreNodeAttributes(pre: HTMLPreElement, result: HunksRenderResult): void;\n cleanUp(): void;\n private getOrComputeDiff;\n hydrate(props: UnresolvedFileHydrationProps<LAnnotation>): void;\n rerender(): void;\n render(props?: UnresolvedFileRenderProps<LAnnotation>): boolean;\n resolveConflict(conflictIndex: number, resolution: MergeConflictResolution, fileDiff?: FileDiffMetadata | undefined): ResolveConflictReturn | undefined;\n private resolveConflictAndRender;\n private setActiveMergeConflictState;\n private handleMergeConflictActionClick;\n private renderMergeConflictActionSlots;\n private renderMergeConflictAction;\n private clearMergeConflictActionCache;\n}\nexport declare function getUnresolvedDiffHunksRendererOptions<LAnnotation>(options?: UnresolvedFileOptions<LAnnotation>, baseOptions?: UnresolvedFileOptions<LAnnotation>): UnresolvedFileHunksRendererOptions;\nexport {};\n//# sourceMappingURL=UnresolvedFile.d.ts.map"],"mappings":";;;;;;;;;KAMYa,mDAAmDL,mCAAmCO,eAAeD,iBAAiBE,cAAcC;KACpIC,mEAAmEL,2BAA2BC;UACzFK,2CAA2CC,KAAKT,gBAAgBG;EAFrED,YAAAA,EAAAA,IAAAA,EAGYG,WAHc,EAAA,QAAAF,EAGSC,cAHT,CAGwBD,WAHxB,CAAA,CAAA,EAAA,OAAA;EAAyBN,wBAAAA,CAAAA,EAIhCU,8BAJgCV,CAIDM,WAJCN,CAAAA;EAAkDM,qBAAAA,EAAAA,OAAAA,EAK7ET,0BAL6ES,EAAAA,QAAAA,EAKvCC,cALuCD,CAKxBA,WALwBA,CAAAA,CAAAA,EAAAA,IAAAA;EAAfC,sBAAAA,EAAAA,IAAAA,EAMhEZ,YANgEY,EAAAA,OAAAA,EAMzCV,0BANyCU,CAAAA,EAAAA,IAAAA;EAAgCC,eAAAA,CAAAA,EAAAA,MAAAA;;AAA8B,UAS/IK,yBAT+I,CAAA,WAAA,CAAA,SAShGD,IATgG,CAS3FR,mBAT2F,CASvEE,WATuE,CAAA,EAAA,SAAA,GAAA,SAAA,CAAA,CAAA;EACpJI,IAAAA,CAAAA,EASDf,YATCe;EACKC,OAAAA,CAAAA,EAAAA,CASFX,uBATuBM,GAAAA,SAAAA,CAAA,EAAA;EAA2CA,UAAAA,CAAAA,EAUhER,sBAVgEQ,EAAAA;;AACzDE,UAWPM,4BAXON,CAAAA,WAAAA,CAAAA,SAW2CI,IAX3CJ,CAWgDK,yBAXhDL,CAW0EF,WAX1EE,CAAAA,EAAAA,MAAAA,CAAAA,CAAAA;EAAsCF,IAAAA,CAAAA,EAYnDX,YAZmDW;EAAfC,aAAAA,EAa5BC,WAb4BD;EACeD,eAAAA,CAAAA,EAAAA,MAAAA;;UAepDS,qBAAAA,CAd0BlB;EAAqDS,IAAAA,EAe/EX,YAf+EW,GAAAA,SAAAA;EAAfC,QAAAA,EAgB5DX,gBAhB4DW,GAAAA,SAAAA;EACxCZ,OAAAA,EAAAA,CAgBpBK,uBAhBoBL,GAAAA,SAAAA,CAAAA,EAAAA,GAAAA,SAAAA;EAAuBE,UAAAA,EAiBzCC,sBAjByCD,EAAAA,GAAAA,SAAAA;;UAmB/CmB,qBAAAA,CAvBsD;EAO/CH,IAAAA,EAiBPlB,YAjBOkB;EAAwEP,QAAAA,EAkB3EV,gBAlB2EU;EAApBF,OAAAA,EAAAA,CAmBvDJ,uBAnBuDI,GAAAA,SAAAA,CAAAA,EAAAA;EAC1DT,UAAAA,EAmBKG,sBAnBLH,EAAAA;;KAqBNsB,uBAAAA,GAA0BF,qBAnBdjB;AAH+Cc,cAuB3CL,cAvB2CK,CAAAA,cAAAA,SAAAA,CAAAA,SAuBKV,QAvBLU,CAuBcN,WAvBdM,CAAAA,CAAAA;EAAI,OAAA,EAwBvDD,qBAxBuD,CAwBjCL,WAxBiC,CAAA;EAKnDQ,SAAAA,IAAAA,EAAAA,MAAAA;EAAiFR,UAAAA,aAAAA,EAqBrEW,uBArBqEX;EAA1BO,QAAAA,eAAAA;EAC7DlB,QAAAA,UAAAA;EACQa,QAAAA,mBAAAA;EAFgDI,WAAAA,CAAAA,OAAAA,CAAAA,EAyBzCD,qBAzByCC,CAyBnBN,WAzBmBM,CAAAA,EAAAA,aAAAA,CAAAA,EAyBWX,iBAzBXW,GAAAA,SAAAA,EAAAA,kBAAAA,CAAAA,EAAAA,OAAAA;EAAI,UAAA,CAAA,OAAA,EA0B/CD,qBA1B+C,CA0BzBL,WA1ByB,CAAA,GAAA,SAAA,CAAA,EAAA,IAAA;EAK7DS,UAAAA,mBAAqB,CAAA,OAAA,EAsBYJ,qBAtBZ,CAsBkCL,WAtBlC,CAAA,CAAA,EAsBiDb,2BAtBjD,CAsB6Ea,WAtB7E,CAAA;EACrBX,UAAAA,uBAAAA,CAAAA,OAAAA,EAsBqCgB,qBAtBrChB,CAsB2DW,WAtB3DX,CAAAA,CAAAA,EAsB0ED,kCAtB1EC;EACIC,UAAAA,sBAAAA,CAAAA,GAAAA,EAsB4BsB,cAtB5BtB,EAAAA,MAAAA,EAsBoDJ,iBAtBpDI,CAAAA,EAAAA,IAAAA;EACAI,OAAAA,CAAAA,CAAAA,EAAAA,IAAAA;EACEF,QAAAA,gBAAAA;EAAsB,OAAA,CAAA,KAAA,EAuBnBgB,4BAvBmB,CAuBUR,WAvBV,CAAA,CAAA,EAAA,IAAA;EAE5BU,QAAAA,CAAAA,CAAAA,EAAAA,IAAAA;EACArB,MAAAA,CAAAA,KAAAA,CAAAA,EAsBSkB,yBAtBTlB,CAsBmCW,WAtBnCX,CAAAA,CAAAA,EAAAA,OAAAA;EACIC,eAAAA,CAAAA,aAAAA,EAAAA,MAAAA,EAAAA,UAAAA,EAsByCG,uBAtBzCH,EAAAA,QAAAA,CAAAA,EAsB6EA,gBAtB7EA,GAAAA,SAAAA,CAAAA,EAsB4GoB,qBAtB5GpB,GAAAA,SAAAA;EACAI,QAAAA,wBAAAA;EACEF,QAAAA,2BAAAA;EAAsB,QAAA,8BAAA;EAEjCmB,QAAAA,8BAAuB;EACPV,QAAAA,yBAAcD;EAA2CA,QAAAA,6BAAAA;;AACjEK,iBAwBWQ,qCAxBXR,CAAAA,WAAAA,CAAAA,CAAAA,OAAAA,CAAAA,EAwBwEA,qBAxBxEA,CAwB8FL,WAxB9FK,CAAAA,EAAAA,WAAAA,CAAAA,EAwB0HA,qBAxB1HA,CAwBgJL,WAxBhJK,CAAAA,CAAAA,EAwB+JjB,kCAxB/JiB"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { DEFAULT_THEMES } from "../constants.js";
|
|
1
|
+
import { DEFAULT_THEMES, UNSAFE_CSS_ATTRIBUTE } from "../constants.js";
|
|
2
2
|
import { pluckInteractionOptions } from "../managers/InteractionManager.js";
|
|
3
|
+
import { splitFileContents } from "../utils/splitFileContents.js";
|
|
3
4
|
import { areFilesEqual } from "../utils/areFilesEqual.js";
|
|
4
5
|
import { createAnnotationWrapperNode } from "../utils/createAnnotationWrapperNode.js";
|
|
6
|
+
import { prerenderHTMLIfNecessary } from "../utils/prerenderHTMLIfNecessary.js";
|
|
5
7
|
import { FileDiff } from "./FileDiff.js";
|
|
6
8
|
import { getMergeConflictActionSlotName } from "../utils/getMergeConflictActionSlotName.js";
|
|
7
|
-
import { getMergeConflictActionAnchor, parseMergeConflictDiffFromFile } from "../utils/parseMergeConflictDiffFromFile.js";
|
|
9
|
+
import { buildMergeConflictMarkerRows, getMergeConflictActionAnchor, parseMergeConflictDiffFromFile } from "../utils/parseMergeConflictDiffFromFile.js";
|
|
8
10
|
import { UnresolvedFileHunksRenderer } from "../renderers/UnresolvedFileHunksRenderer.js";
|
|
9
11
|
import { areMergeConflictActionsEqual } from "../utils/areMergeConflictActionsEqual.js";
|
|
10
|
-
import {
|
|
12
|
+
import { resolveConflict } from "../utils/resolveConflict.js";
|
|
11
13
|
|
|
12
14
|
//#region src/components/UnresolvedFile.ts
|
|
13
15
|
let instanceId = -1;
|
|
@@ -16,9 +18,11 @@ var UnresolvedFile = class extends FileDiff {
|
|
|
16
18
|
computedCache = {
|
|
17
19
|
file: void 0,
|
|
18
20
|
fileDiff: void 0,
|
|
19
|
-
actions: void 0
|
|
21
|
+
actions: void 0,
|
|
22
|
+
markerRows: void 0
|
|
20
23
|
};
|
|
21
24
|
conflictActions = [];
|
|
25
|
+
markerRows = [];
|
|
22
26
|
conflictActionCache = /* @__PURE__ */ new Map();
|
|
23
27
|
constructor(options = { theme: DEFAULT_THEMES }, workerManager, isContainerManaged = false) {
|
|
24
28
|
super(void 0, workerManager, isContainerManaged);
|
|
@@ -37,11 +41,7 @@ var UnresolvedFile = class extends FileDiff {
|
|
|
37
41
|
return new UnresolvedFileHunksRenderer(this.getHunksRendererOptions(options), this.handleHighlightRender, this.workerManager);
|
|
38
42
|
}
|
|
39
43
|
getHunksRendererOptions(options) {
|
|
40
|
-
return
|
|
41
|
-
...this.options,
|
|
42
|
-
hunkSeparators: typeof options.hunkSeparators === "function" ? "custom" : options.hunkSeparators,
|
|
43
|
-
mergeConflictActionsType: typeof options.mergeConflictActionsType === "function" ? "custom" : options.mergeConflictActionsType
|
|
44
|
-
};
|
|
44
|
+
return getUnresolvedDiffHunksRendererOptions(options, this.options);
|
|
45
45
|
}
|
|
46
46
|
applyPreNodeAttributes(pre, result) {
|
|
47
47
|
super.applyPreNodeAttributes(pre, result, { "data-has-merge-conflict": "" });
|
|
@@ -51,73 +51,124 @@ var UnresolvedFile = class extends FileDiff {
|
|
|
51
51
|
this.computedCache = {
|
|
52
52
|
file: void 0,
|
|
53
53
|
fileDiff: void 0,
|
|
54
|
-
actions: void 0
|
|
54
|
+
actions: void 0,
|
|
55
|
+
markerRows: void 0
|
|
55
56
|
};
|
|
56
57
|
this.conflictActions = [];
|
|
57
58
|
super.cleanUp();
|
|
58
59
|
}
|
|
59
|
-
getOrComputeDiff({ file, fileDiff, actions }) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
getOrComputeDiff({ file, fileDiff, actions, markerRows }) {
|
|
61
|
+
const { maxContextLines, onMergeConflictAction } = this.options;
|
|
62
|
+
wrapper: if (onMergeConflictAction != null) {
|
|
63
|
+
const hasFileDiff = fileDiff != null;
|
|
64
|
+
if (hasFileDiff !== (actions != null) || hasFileDiff !== (markerRows != null)) throw new Error("UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows must be passed together");
|
|
65
|
+
if (fileDiff != null && actions != null && markerRows != null) {
|
|
63
66
|
this.computedCache = {
|
|
64
67
|
file: file ?? this.computedCache.file,
|
|
65
68
|
fileDiff,
|
|
66
|
-
actions
|
|
69
|
+
actions,
|
|
70
|
+
markerRows
|
|
67
71
|
};
|
|
68
72
|
break wrapper;
|
|
69
73
|
} else if (file != null || this.computedCache.file != null) {
|
|
74
|
+
if (file != null && this.computedCache.file != null && !areFilesEqual(file, this.computedCache.file) && this.computedCache.fileDiff != null && this.computedCache.actions != null) throw new Error("UnresolvedFile.getOrComputeDiff: file can only be used to initialize unresolved state once. Pass fileDiff and actions for subsequent updates.");
|
|
70
75
|
file ??= this.computedCache.file;
|
|
71
76
|
if (file == null) throw new Error("UnresolvedFile.getOrComputeDiff: file is null, should be impossible");
|
|
72
77
|
if (!areFilesEqual(file, this.computedCache.file) || this.computedCache.fileDiff == null || this.computedCache.actions == null) {
|
|
73
|
-
const computed = parseMergeConflictDiffFromFile(file);
|
|
78
|
+
const computed = parseMergeConflictDiffFromFile(file, maxContextLines);
|
|
74
79
|
this.computedCache = {
|
|
75
80
|
file,
|
|
76
81
|
fileDiff: computed.fileDiff,
|
|
77
|
-
actions: computed.actions
|
|
82
|
+
actions: computed.actions,
|
|
83
|
+
markerRows: computed.markerRows
|
|
78
84
|
};
|
|
79
85
|
}
|
|
80
86
|
fileDiff = this.computedCache.fileDiff;
|
|
81
87
|
actions = this.computedCache.actions;
|
|
88
|
+
markerRows = this.computedCache.markerRows;
|
|
82
89
|
break wrapper;
|
|
83
90
|
} else {
|
|
84
91
|
fileDiff = this.computedCache.fileDiff;
|
|
85
92
|
actions = this.computedCache.actions;
|
|
93
|
+
markerRows = this.computedCache.markerRows;
|
|
86
94
|
break wrapper;
|
|
87
95
|
}
|
|
88
96
|
} else {
|
|
89
|
-
if (fileDiff != null || actions != null) throw new Error("UnresolvedFile.getOrComputeDiff: fileDiff and
|
|
97
|
+
if (fileDiff != null || actions != null || markerRows != null) throw new Error("UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows are only usable in controlled mode, you must pass in `onMergeConflictAction`");
|
|
98
|
+
if (file != null && this.computedCache.file != null && !areFilesEqual(file, this.computedCache.file)) throw new Error("UnresolvedFile.getOrComputeDiff: uncontrolled unresolved files parse the file only once. Later updates must come from the cached diff state.");
|
|
90
99
|
this.computedCache.file ??= file;
|
|
91
100
|
if (this.computedCache.fileDiff == null && this.computedCache.file != null) {
|
|
92
|
-
const computed = parseMergeConflictDiffFromFile(this.computedCache.file);
|
|
101
|
+
const computed = parseMergeConflictDiffFromFile(this.computedCache.file, maxContextLines);
|
|
93
102
|
this.computedCache.fileDiff = computed.fileDiff;
|
|
94
103
|
this.computedCache.actions = computed.actions;
|
|
104
|
+
this.computedCache.markerRows = computed.markerRows;
|
|
95
105
|
}
|
|
96
106
|
fileDiff = this.computedCache.fileDiff;
|
|
97
107
|
actions = this.computedCache.actions;
|
|
108
|
+
markerRows = this.computedCache.markerRows;
|
|
98
109
|
break wrapper;
|
|
99
110
|
}
|
|
100
|
-
if (fileDiff == null || actions == null) return;
|
|
111
|
+
if (fileDiff == null || actions == null || markerRows == null) return;
|
|
101
112
|
return {
|
|
102
113
|
fileDiff,
|
|
103
|
-
actions
|
|
114
|
+
actions,
|
|
115
|
+
markerRows
|
|
104
116
|
};
|
|
105
117
|
}
|
|
106
118
|
hydrate(props) {
|
|
107
|
-
const { file, fileDiff, actions, lineAnnotations, preventEmit = false
|
|
119
|
+
const { file, fileDiff, actions, markerRows, lineAnnotations, fileContainer, prerenderedHTML, preventEmit = false } = props;
|
|
108
120
|
const source = this.getOrComputeDiff({
|
|
109
121
|
file,
|
|
110
122
|
fileDiff,
|
|
111
|
-
actions
|
|
123
|
+
actions,
|
|
124
|
+
markerRows
|
|
112
125
|
});
|
|
126
|
+
const { overflow = "scroll" } = this.options;
|
|
113
127
|
if (source == null) return;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
128
|
+
prerenderHTMLIfNecessary(fileContainer, prerenderedHTML);
|
|
129
|
+
for (const element of fileContainer.shadowRoot?.children ?? []) {
|
|
130
|
+
if (element instanceof SVGElement) {
|
|
131
|
+
this.spriteSVG = element;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (!(element instanceof HTMLElement)) continue;
|
|
135
|
+
if (element instanceof HTMLPreElement) {
|
|
136
|
+
this.pre = element;
|
|
137
|
+
for (const code of element.children) {
|
|
138
|
+
if (!(code instanceof HTMLElement) || code.tagName.toLowerCase() !== "code") continue;
|
|
139
|
+
if ("deletions" in code.dataset) this.codeDeletions = code;
|
|
140
|
+
if ("additions" in code.dataset) this.codeAdditions = code;
|
|
141
|
+
if ("unified" in code.dataset) this.codeUnified = code;
|
|
142
|
+
}
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
if ("diffsHeader" in element.dataset) {
|
|
146
|
+
this.headerElement = element;
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
if (element instanceof HTMLStyleElement && element.hasAttribute(UNSAFE_CSS_ATTRIBUTE)) {
|
|
150
|
+
this.unsafeCSSStyle = element;
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (this.pre != null) this.syncCodeNodesFromPre(this.pre);
|
|
155
|
+
this.setActiveMergeConflictState(source.actions, source.markerRows);
|
|
156
|
+
if (this.pre == null) this.render({
|
|
157
|
+
...props,
|
|
119
158
|
preventEmit: true
|
|
120
159
|
});
|
|
160
|
+
else {
|
|
161
|
+
this.fileContainer = fileContainer;
|
|
162
|
+
delete this.pre.dataset.dehydrated;
|
|
163
|
+
this.lineAnnotations = lineAnnotations ?? this.lineAnnotations;
|
|
164
|
+
this.fileDiff = source.fileDiff;
|
|
165
|
+
this.hunksRenderer.hydrate(this.fileDiff);
|
|
166
|
+
this.renderAnnotations();
|
|
167
|
+
this.renderGutterUtility();
|
|
168
|
+
this.injectUnsafeCSS();
|
|
169
|
+
this.interactionManager.setup(this.pre);
|
|
170
|
+
this.resizeManager.setup(this.pre, overflow === "wrap");
|
|
171
|
+
}
|
|
121
172
|
this.renderMergeConflictActionSlots();
|
|
122
173
|
if (!preventEmit) this.emitPostRender();
|
|
123
174
|
}
|
|
@@ -129,27 +180,30 @@ var UnresolvedFile = class extends FileDiff {
|
|
|
129
180
|
});
|
|
130
181
|
}
|
|
131
182
|
render(props = {}) {
|
|
132
|
-
let { file, fileDiff, actions, lineAnnotations, preventEmit = false,...rest } = props;
|
|
183
|
+
let { file, fileDiff, actions, markerRows, lineAnnotations, preventEmit = false,...rest } = props;
|
|
133
184
|
const source = this.getOrComputeDiff({
|
|
134
185
|
file,
|
|
135
186
|
fileDiff,
|
|
136
|
-
actions
|
|
187
|
+
actions,
|
|
188
|
+
markerRows
|
|
137
189
|
});
|
|
138
190
|
if (source == null) return false;
|
|
139
|
-
this.
|
|
191
|
+
this.setActiveMergeConflictState(source.actions, source.markerRows);
|
|
140
192
|
const didRender = super.render({
|
|
141
193
|
...rest,
|
|
142
194
|
fileDiff: source.fileDiff,
|
|
143
195
|
lineAnnotations,
|
|
144
196
|
preventEmit: true
|
|
145
197
|
});
|
|
146
|
-
|
|
147
|
-
|
|
198
|
+
if (didRender) {
|
|
199
|
+
this.renderMergeConflictActionSlots();
|
|
200
|
+
if (!preventEmit) this.emitPostRender();
|
|
201
|
+
}
|
|
148
202
|
return didRender;
|
|
149
203
|
}
|
|
150
|
-
resolveConflict(conflictIndex, resolution,
|
|
204
|
+
resolveConflict(conflictIndex, resolution, fileDiff = this.computedCache.fileDiff) {
|
|
151
205
|
const action = this.conflictActions[conflictIndex];
|
|
152
|
-
if (
|
|
206
|
+
if (fileDiff == null || action == null) return;
|
|
153
207
|
if (action.conflictIndex !== conflictIndex) {
|
|
154
208
|
console.error({
|
|
155
209
|
conflictIndex,
|
|
@@ -157,15 +211,20 @@ var UnresolvedFile = class extends FileDiff {
|
|
|
157
211
|
});
|
|
158
212
|
throw new Error("UnresolvedFile.resolveConflict: conflictIndex and conflictAction don't match");
|
|
159
213
|
}
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
214
|
+
const newFileDiff = resolveConflict(fileDiff, action, resolution);
|
|
215
|
+
const previousFile = this.computedCache.file;
|
|
216
|
+
const { file, actions, markerRows } = rebuildFileAndActions({
|
|
217
|
+
fileDiff: newFileDiff,
|
|
218
|
+
previousActions: this.conflictActions,
|
|
219
|
+
resolvedConflictIndex: conflictIndex,
|
|
220
|
+
previousFile,
|
|
221
|
+
resolution
|
|
163
222
|
});
|
|
164
|
-
if (contents === file.contents) return;
|
|
165
223
|
return {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
224
|
+
file,
|
|
225
|
+
fileDiff: newFileDiff,
|
|
226
|
+
actions,
|
|
227
|
+
markerRows
|
|
169
228
|
};
|
|
170
229
|
}
|
|
171
230
|
resolveConflictAndRender(conflictIndex, resolution) {
|
|
@@ -182,18 +241,23 @@ var UnresolvedFile = class extends FileDiff {
|
|
|
182
241
|
resolution,
|
|
183
242
|
conflict: action.conflict
|
|
184
243
|
};
|
|
185
|
-
const
|
|
186
|
-
if (
|
|
187
|
-
this.computedCache
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
244
|
+
const { file, fileDiff, actions, markerRows } = this.resolveConflict(conflictIndex, resolution) ?? {};
|
|
245
|
+
if (file == null || fileDiff == null || actions == null || markerRows == null) return;
|
|
246
|
+
this.computedCache = {
|
|
247
|
+
file,
|
|
248
|
+
fileDiff,
|
|
249
|
+
actions,
|
|
250
|
+
markerRows
|
|
251
|
+
};
|
|
252
|
+
this.setActiveMergeConflictState(actions, markerRows);
|
|
253
|
+
if (this.workerManager != null) this.hunksRenderer.renderDiff(fileDiff);
|
|
254
|
+
else this.render({ forceRender: true });
|
|
255
|
+
this.options.onMergeConflictResolve?.(file, payload);
|
|
193
256
|
}
|
|
194
|
-
|
|
257
|
+
setActiveMergeConflictState(actions = this.conflictActions, markerRows = this.markerRows) {
|
|
195
258
|
this.conflictActions = actions;
|
|
196
|
-
|
|
259
|
+
this.markerRows = markerRows;
|
|
260
|
+
if (this.computedCache.fileDiff != null && this.hunksRenderer instanceof UnresolvedFileHunksRenderer) this.hunksRenderer.setConflictState(this.options.mergeConflictActionsType === "none" ? [] : actions, markerRows, this.computedCache.fileDiff);
|
|
197
261
|
}
|
|
198
262
|
handleMergeConflictActionClick = (target) => {
|
|
199
263
|
const action = this.conflictActions[target.conflictIndex];
|
|
@@ -216,7 +280,8 @@ var UnresolvedFile = class extends FileDiff {
|
|
|
216
280
|
this.resolveConflictAndRender(target.conflictIndex, target.resolution);
|
|
217
281
|
};
|
|
218
282
|
renderMergeConflictActionSlots() {
|
|
219
|
-
|
|
283
|
+
const { fileDiff } = this.computedCache;
|
|
284
|
+
if (this.isContainerManaged || this.fileContainer == null || typeof this.options.mergeConflictActionsType !== "function" || this.conflictActions.length === 0 || fileDiff == null) {
|
|
220
285
|
this.clearMergeConflictActionCache();
|
|
221
286
|
return;
|
|
222
287
|
}
|
|
@@ -231,12 +296,12 @@ var UnresolvedFile = class extends FileDiff {
|
|
|
231
296
|
});
|
|
232
297
|
throw new Error("UnresolvedFile.renderMergeConflictActionSlots: conflictIndex and conflictAction don't match");
|
|
233
298
|
}
|
|
234
|
-
const anchor = getMergeConflictActionAnchor(action);
|
|
299
|
+
const anchor = getMergeConflictActionAnchor(action, fileDiff);
|
|
235
300
|
if (anchor == null) continue;
|
|
236
301
|
const conflictIndex = action.conflictIndex;
|
|
237
302
|
const slotName = getMergeConflictActionSlotName({
|
|
238
|
-
|
|
239
|
-
|
|
303
|
+
hunkIndex: anchor.hunkIndex,
|
|
304
|
+
lineIndex: anchor.lineIndex,
|
|
240
305
|
conflictIndex
|
|
241
306
|
});
|
|
242
307
|
const id = `${actionIndex}-${slotName}`;
|
|
@@ -278,7 +343,84 @@ var UnresolvedFile = class extends FileDiff {
|
|
|
278
343
|
this.conflictActionCache.clear();
|
|
279
344
|
}
|
|
280
345
|
};
|
|
346
|
+
function rebuildFileAndActions({ fileDiff, previousActions, resolvedConflictIndex, previousFile, resolution }) {
|
|
347
|
+
const resolvedAction = previousActions[resolvedConflictIndex];
|
|
348
|
+
if (resolvedAction == null) throw new Error("rebuildFileAndActions: missing resolved action for unresolved file rebuild");
|
|
349
|
+
const actions = updateConflictActionsAfterResolution(previousActions, resolvedConflictIndex, resolvedAction, resolution);
|
|
350
|
+
const markerRows = buildMergeConflictMarkerRows(fileDiff, actions);
|
|
351
|
+
return {
|
|
352
|
+
file: rebuildUnresolvedFile({
|
|
353
|
+
fileDiff,
|
|
354
|
+
resolvedAction,
|
|
355
|
+
resolvedConflictIndex,
|
|
356
|
+
previousFile,
|
|
357
|
+
resolution
|
|
358
|
+
}),
|
|
359
|
+
actions,
|
|
360
|
+
markerRows
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
function rebuildUnresolvedFile({ resolvedAction, resolvedConflictIndex, previousFile, fileDiff, resolution }) {
|
|
364
|
+
const lines = splitFileContents(previousFile?.contents ?? "");
|
|
365
|
+
const { conflict } = resolvedAction;
|
|
366
|
+
const replacementLines = getResolvedConflictReplacementLines(lines, conflict, resolution);
|
|
367
|
+
const contents = [
|
|
368
|
+
...lines.slice(0, conflict.startLineIndex),
|
|
369
|
+
...replacementLines,
|
|
370
|
+
...lines.slice(conflict.endLineIndex + 1)
|
|
371
|
+
].join("");
|
|
372
|
+
return {
|
|
373
|
+
name: previousFile?.name ?? fileDiff.name,
|
|
374
|
+
contents,
|
|
375
|
+
cacheKey: previousFile?.cacheKey != null ? `${previousFile.cacheKey}:mc-${resolvedConflictIndex}-${resolution}` : void 0
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
function getResolvedConflictReplacementLines(lines, conflict, resolution) {
|
|
379
|
+
const currentLines = lines.slice(conflict.startLineIndex + 1, conflict.baseMarkerLineIndex ?? conflict.separatorLineIndex);
|
|
380
|
+
const incomingLines = lines.slice(conflict.separatorLineIndex + 1, conflict.endLineIndex);
|
|
381
|
+
if (resolution === "current") return currentLines;
|
|
382
|
+
if (resolution === "incoming") return incomingLines;
|
|
383
|
+
return [...currentLines, ...incomingLines];
|
|
384
|
+
}
|
|
385
|
+
function updateConflictActionsAfterResolution(previousActions, resolvedConflictIndex, resolvedAction, resolution) {
|
|
386
|
+
const lineDelta = getResolvedConflictLineDelta(resolvedAction.conflict, resolution);
|
|
387
|
+
return previousActions.map((action, index) => {
|
|
388
|
+
if (index === resolvedConflictIndex) return;
|
|
389
|
+
if (action == null) return;
|
|
390
|
+
if (action.conflict.startLineIndex > resolvedAction.conflict.endLineIndex) return {
|
|
391
|
+
...action,
|
|
392
|
+
conflict: shiftMergeConflictRegion(action.conflict, lineDelta)
|
|
393
|
+
};
|
|
394
|
+
return action;
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
function getResolvedConflictLineDelta(conflict, resolution) {
|
|
398
|
+
const currentLineCount = (conflict.baseMarkerLineIndex ?? conflict.separatorLineIndex) - conflict.startLineIndex - 1;
|
|
399
|
+
const incomingLineCount = conflict.endLineIndex - conflict.separatorLineIndex - 1;
|
|
400
|
+
return (resolution === "current" ? currentLineCount : resolution === "incoming" ? incomingLineCount : currentLineCount + incomingLineCount) - (conflict.endLineIndex - conflict.startLineIndex + 1);
|
|
401
|
+
}
|
|
402
|
+
function shiftMergeConflictRegion(conflict, lineDelta) {
|
|
403
|
+
return {
|
|
404
|
+
...conflict,
|
|
405
|
+
startLineIndex: conflict.startLineIndex + lineDelta,
|
|
406
|
+
startLineNumber: conflict.startLineNumber + lineDelta,
|
|
407
|
+
separatorLineIndex: conflict.separatorLineIndex + lineDelta,
|
|
408
|
+
separatorLineNumber: conflict.separatorLineNumber + lineDelta,
|
|
409
|
+
endLineIndex: conflict.endLineIndex + lineDelta,
|
|
410
|
+
endLineNumber: conflict.endLineNumber + lineDelta,
|
|
411
|
+
baseMarkerLineIndex: conflict.baseMarkerLineIndex != null ? conflict.baseMarkerLineIndex + lineDelta : void 0,
|
|
412
|
+
baseMarkerLineNumber: conflict.baseMarkerLineNumber != null ? conflict.baseMarkerLineNumber + lineDelta : void 0
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
function getUnresolvedDiffHunksRendererOptions(options, baseOptions) {
|
|
416
|
+
return {
|
|
417
|
+
...baseOptions,
|
|
418
|
+
...options,
|
|
419
|
+
hunkSeparators: typeof options?.hunkSeparators === "function" ? "custom" : options?.hunkSeparators,
|
|
420
|
+
mergeConflictActionsType: typeof options?.mergeConflictActionsType === "function" ? "custom" : options?.mergeConflictActionsType
|
|
421
|
+
};
|
|
422
|
+
}
|
|
281
423
|
|
|
282
424
|
//#endregion
|
|
283
|
-
export { UnresolvedFile };
|
|
425
|
+
export { UnresolvedFile, getUnresolvedDiffHunksRendererOptions };
|
|
284
426
|
//# sourceMappingURL=UnresolvedFile.js.map
|