@pierre/diffs 1.1.0-beta.8 → 1.1.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/README.md +7 -18
- package/dist/components/AdvancedVirtualizedFileDiff.js +2 -7
- package/dist/components/AdvancedVirtualizedFileDiff.js.map +1 -1
- package/dist/components/AdvancedVirtualizer.js +1 -1
- package/dist/components/AdvancedVirtualizer.js.map +1 -1
- package/dist/components/File.d.ts +17 -7
- package/dist/components/File.d.ts.map +1 -1
- package/dist/components/File.js +111 -54
- package/dist/components/File.js.map +1 -1
- package/dist/components/FileDiff.d.ts +32 -14
- package/dist/components/FileDiff.d.ts.map +1 -1
- package/dist/components/FileDiff.js +156 -81
- package/dist/components/FileDiff.js.map +1 -1
- package/dist/components/UnresolvedFile.d.ts +60 -0
- package/dist/components/UnresolvedFile.d.ts.map +1 -0
- package/dist/components/UnresolvedFile.js +280 -0
- package/dist/components/UnresolvedFile.js.map +1 -0
- package/dist/components/VirtualizedFile.js +8 -5
- package/dist/components/VirtualizedFile.js.map +1 -1
- package/dist/components/VirtualizedFileDiff.d.ts +1 -1
- package/dist/components/VirtualizedFileDiff.d.ts.map +1 -1
- package/dist/components/VirtualizedFileDiff.js +15 -11
- package/dist/components/VirtualizedFileDiff.js.map +1 -1
- package/dist/components/Virtualizer.d.ts +3 -1
- package/dist/components/Virtualizer.d.ts.map +1 -1
- package/dist/components/Virtualizer.js +50 -24
- package/dist/components/Virtualizer.js.map +1 -1
- package/dist/constants.d.ts +3 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +8 -1
- package/dist/constants.js.map +1 -1
- package/dist/highlighter/shared_highlighter.d.ts +4 -2
- package/dist/highlighter/shared_highlighter.d.ts.map +1 -1
- package/dist/highlighter/shared_highlighter.js +15 -7
- package/dist/highlighter/shared_highlighter.js.map +1 -1
- package/dist/index.d.ts +9 -7
- package/dist/index.js +8 -6
- package/dist/managers/InteractionManager.d.ts +146 -0
- package/dist/managers/InteractionManager.d.ts.map +1 -0
- package/dist/managers/InteractionManager.js +813 -0
- package/dist/managers/InteractionManager.js.map +1 -0
- package/dist/managers/ResizeManager.d.ts +0 -2
- package/dist/managers/ResizeManager.d.ts.map +1 -1
- package/dist/managers/ResizeManager.js +43 -32
- package/dist/managers/ResizeManager.js.map +1 -1
- package/dist/react/File.d.ts +2 -0
- package/dist/react/File.d.ts.map +1 -1
- package/dist/react/File.js +3 -1
- package/dist/react/File.js.map +1 -1
- package/dist/react/FileDiff.d.ts +2 -0
- package/dist/react/FileDiff.d.ts.map +1 -1
- package/dist/react/FileDiff.js +3 -1
- package/dist/react/FileDiff.js.map +1 -1
- package/dist/react/MultiFileDiff.d.ts +2 -0
- package/dist/react/MultiFileDiff.d.ts.map +1 -1
- package/dist/react/MultiFileDiff.js +3 -1
- package/dist/react/MultiFileDiff.js.map +1 -1
- package/dist/react/PatchDiff.d.ts +2 -0
- package/dist/react/PatchDiff.d.ts.map +1 -1
- package/dist/react/PatchDiff.js +3 -1
- package/dist/react/PatchDiff.js.map +1 -1
- package/dist/react/UnresolvedFile.d.ts +36 -0
- package/dist/react/UnresolvedFile.d.ts.map +1 -0
- package/dist/react/UnresolvedFile.js +42 -0
- package/dist/react/UnresolvedFile.js.map +1 -0
- package/dist/react/constants.d.ts +3 -2
- package/dist/react/constants.d.ts.map +1 -1
- package/dist/react/constants.js +3 -2
- package/dist/react/constants.js.map +1 -1
- package/dist/react/index.d.ts +4 -3
- package/dist/react/index.js +3 -2
- package/dist/react/types.d.ts +11 -2
- package/dist/react/types.d.ts.map +1 -1
- package/dist/react/utils/renderDiffChildren.d.ts +16 -5
- package/dist/react/utils/renderDiffChildren.d.ts.map +1 -1
- package/dist/react/utils/renderDiffChildren.js +34 -7
- package/dist/react/utils/renderDiffChildren.js.map +1 -1
- package/dist/react/utils/renderFileChildren.d.ts +5 -1
- package/dist/react/utils/renderFileChildren.d.ts.map +1 -1
- package/dist/react/utils/renderFileChildren.js +13 -7
- package/dist/react/utils/renderFileChildren.js.map +1 -1
- package/dist/react/utils/useFileDiffInstance.d.ts +1 -2
- package/dist/react/utils/useFileDiffInstance.d.ts.map +1 -1
- package/dist/react/utils/useFileDiffInstance.js +2 -2
- package/dist/react/utils/useFileDiffInstance.js.map +1 -1
- package/dist/react/utils/useFileInstance.d.ts +1 -2
- package/dist/react/utils/useFileInstance.d.ts.map +1 -1
- package/dist/react/utils/useFileInstance.js.map +1 -1
- package/dist/react/utils/useUnresolvedFileInstance.d.ts +33 -0
- package/dist/react/utils/useUnresolvedFileInstance.d.ts.map +1 -0
- package/dist/react/utils/useUnresolvedFileInstance.js +87 -0
- package/dist/react/utils/useUnresolvedFileInstance.js.map +1 -0
- package/dist/renderers/DiffHunksRenderer.d.ts +50 -6
- package/dist/renderers/DiffHunksRenderer.d.ts.map +1 -1
- package/dist/renderers/DiffHunksRenderer.js +146 -45
- package/dist/renderers/DiffHunksRenderer.js.map +1 -1
- package/dist/renderers/FileRenderer.js +1 -1
- package/dist/renderers/UnresolvedFileHunksRenderer.d.ts +46 -0
- package/dist/renderers/UnresolvedFileHunksRenderer.d.ts.map +1 -0
- package/dist/renderers/UnresolvedFileHunksRenderer.js +207 -0
- package/dist/renderers/UnresolvedFileHunksRenderer.js.map +1 -0
- package/dist/shiki-stream/stream.d.ts +1 -1
- package/dist/shiki-stream/stream.d.ts.map +1 -1
- package/dist/shiki-stream/stream.js.map +1 -1
- package/dist/shiki-stream/tokenizer.d.ts +1 -1
- package/dist/shiki-stream/tokenizer.d.ts.map +1 -1
- package/dist/shiki-stream/tokenizer.js.map +1 -1
- package/dist/shiki-stream/types.d.ts +1 -1
- package/dist/shiki-stream/types.d.ts.map +1 -1
- package/dist/sprite.d.ts +2 -2
- package/dist/sprite.d.ts.map +1 -1
- package/dist/sprite.js +3 -0
- package/dist/sprite.js.map +1 -1
- package/dist/ssr/index.d.ts +3 -3
- package/dist/ssr/index.js +2 -2
- package/dist/ssr/preloadDiffs.d.ts +23 -14
- package/dist/ssr/preloadDiffs.d.ts.map +1 -1
- package/dist/ssr/preloadDiffs.js +40 -14
- 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 +29 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/areMergeConflictActionsEqual.d.ts +7 -0
- package/dist/utils/areMergeConflictActionsEqual.d.ts.map +1 -0
- package/dist/utils/areMergeConflictActionsEqual.js +11 -0
- package/dist/utils/areMergeConflictActionsEqual.js.map +1 -0
- package/dist/utils/arePrePropertiesEqual.js +10 -1
- package/dist/utils/arePrePropertiesEqual.js.map +1 -1
- package/dist/utils/areSelectionPointsEqual.d.ts +7 -0
- package/dist/utils/areSelectionPointsEqual.d.ts.map +1 -0
- package/dist/utils/areSelectionPointsEqual.js +8 -0
- package/dist/utils/areSelectionPointsEqual.js.map +1 -0
- package/dist/utils/areSelectionsEqual.d.ts +1 -1
- package/dist/utils/areSelectionsEqual.d.ts.map +1 -1
- package/dist/utils/areSelectionsEqual.js.map +1 -1
- package/dist/utils/createFileHeaderElement.js +5 -2
- package/dist/utils/createFileHeaderElement.js.map +1 -1
- package/dist/utils/createGutterUtilityContentNode.d.ts +5 -0
- package/dist/utils/createGutterUtilityContentNode.d.ts.map +1 -0
- package/dist/utils/createGutterUtilityContentNode.js +15 -0
- package/dist/utils/createGutterUtilityContentNode.js.map +1 -0
- package/dist/utils/createGutterUtilityElement.d.ts +7 -0
- package/dist/utils/createGutterUtilityElement.d.ts.map +1 -0
- package/dist/utils/createGutterUtilityElement.js +20 -0
- package/dist/utils/createGutterUtilityElement.js.map +1 -0
- package/dist/utils/createPreElement.d.ts +2 -1
- package/dist/utils/createPreElement.d.ts.map +1 -1
- package/dist/utils/createPreElement.js +2 -1
- package/dist/utils/createPreElement.js.map +1 -1
- package/dist/utils/createSeparator.js +1 -1
- package/dist/utils/createSeparator.js.map +1 -1
- package/dist/utils/createWindowFromScrollPosition.js +12 -11
- package/dist/utils/createWindowFromScrollPosition.js.map +1 -1
- package/dist/utils/getHighlighterOptions.d.ts +7 -2
- package/dist/utils/getHighlighterOptions.d.ts.map +1 -1
- package/dist/utils/getHighlighterOptions.js +3 -2
- package/dist/utils/getHighlighterOptions.js.map +1 -1
- package/dist/utils/getMergeConflictActionSlotName.d.ts +16 -0
- package/dist/utils/getMergeConflictActionSlotName.d.ts.map +1 -0
- package/dist/utils/getMergeConflictActionSlotName.js +8 -0
- package/dist/utils/getMergeConflictActionSlotName.js.map +1 -0
- package/dist/utils/getMergeConflictLineTypes.d.ts +15 -0
- package/dist/utils/getMergeConflictLineTypes.d.ts.map +1 -0
- package/dist/utils/getMergeConflictLineTypes.js +81 -0
- package/dist/utils/getMergeConflictLineTypes.js.map +1 -0
- package/dist/utils/getOrCreateCodeNode.d.ts +3 -1
- package/dist/utils/getOrCreateCodeNode.d.ts.map +1 -1
- package/dist/utils/getOrCreateCodeNode.js +5 -3
- package/dist/utils/getOrCreateCodeNode.js.map +1 -1
- package/dist/utils/hast_utils.d.ts +2 -2
- package/dist/utils/hast_utils.d.ts.map +1 -1
- package/dist/utils/hast_utils.js +3 -2
- package/dist/utils/hast_utils.js.map +1 -1
- package/dist/utils/parseMergeConflictDiffFromFile.d.ts +26 -0
- package/dist/utils/parseMergeConflictDiffFromFile.d.ts.map +1 -0
- package/dist/utils/parseMergeConflictDiffFromFile.js +143 -0
- package/dist/utils/parseMergeConflictDiffFromFile.js.map +1 -0
- package/dist/utils/resolveMergeConflict.d.ts +7 -0
- package/dist/utils/resolveMergeConflict.d.ts.map +1 -0
- package/dist/utils/resolveMergeConflict.js +30 -0
- package/dist/utils/resolveMergeConflict.js.map +1 -0
- package/dist/utils/resolveVirtualFileMetrics.js +1 -0
- package/dist/utils/resolveVirtualFileMetrics.js.map +1 -1
- package/dist/utils/setWrapperNodeProps.d.ts +2 -1
- package/dist/utils/setWrapperNodeProps.d.ts.map +1 -1
- package/dist/utils/setWrapperNodeProps.js +5 -1
- package/dist/utils/setWrapperNodeProps.js.map +1 -1
- package/dist/worker/WorkerPoolManager.d.ts +4 -2
- package/dist/worker/WorkerPoolManager.d.ts.map +1 -1
- package/dist/worker/WorkerPoolManager.js +16 -9
- package/dist/worker/WorkerPoolManager.js.map +1 -1
- package/dist/worker/types.d.ts +3 -1
- package/dist/worker/types.d.ts.map +1 -1
- package/dist/worker/wasm-BlUZCxHM.js +10 -0
- package/dist/worker/wasm-BlUZCxHM.js.map +1 -0
- package/dist/worker/worker-portable.js +10546 -10106
- package/dist/worker/worker-portable.js.map +1 -1
- package/dist/worker/worker.js +27 -19
- package/dist/worker/worker.js.map +1 -1
- package/package.json +3 -7
- package/dist/managers/LineSelectionManager.d.ts +0 -64
- package/dist/managers/LineSelectionManager.d.ts.map +0 -1
- package/dist/managers/LineSelectionManager.js +0 -270
- package/dist/managers/LineSelectionManager.js.map +0 -1
- package/dist/managers/MouseEventManager.d.ts +0 -71
- package/dist/managers/MouseEventManager.d.ts.map +0 -1
- package/dist/managers/MouseEventManager.js +0 -358
- package/dist/managers/MouseEventManager.js.map +0 -1
- package/dist/themes/pierre-dark.js +0 -1328
- package/dist/themes/pierre-dark.js.map +0 -1
- package/dist/themes/pierre-light.js +0 -1328
- package/dist/themes/pierre-light.js.map +0 -1
- package/dist/utils/createHoverContentNode.d.ts +0 -5
- package/dist/utils/createHoverContentNode.d.ts.map +0 -1
- package/dist/utils/createHoverContentNode.js +0 -15
- package/dist/utils/createHoverContentNode.js.map +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FileContents, MergeConflictResolution } from "../types.js";
|
|
2
|
+
import { MergeConflictDiffAction } from "../utils/parseMergeConflictDiffFromFile.js";
|
|
3
|
+
import { UnresolvedFileHunksRendererOptions } from "../renderers/UnresolvedFileHunksRenderer.js";
|
|
4
|
+
import { UnresolvedFile as UnresolvedFile$1 } from "../components/UnresolvedFile.js";
|
|
5
|
+
import { FileDiffProps } from "./FileDiff.js";
|
|
6
|
+
import { ReactNode } from "react";
|
|
7
|
+
|
|
8
|
+
//#region src/react/UnresolvedFile.d.ts
|
|
9
|
+
interface RenderMergeConflictActionContext {
|
|
10
|
+
resolveConflict(resolution: MergeConflictResolution): void;
|
|
11
|
+
}
|
|
12
|
+
type RenderMergeConflictActions = (action: MergeConflictDiffAction, context: RenderMergeConflictActionContext) => ReactNode;
|
|
13
|
+
type MergeConflictActionsTypeOption = 'none' | 'default' | RenderMergeConflictActions;
|
|
14
|
+
interface UnresolvedFileProps<LAnnotation> extends Omit<FileDiffProps<LAnnotation>, 'fileDiff' | 'options'> {
|
|
15
|
+
file: FileContents;
|
|
16
|
+
options?: Omit<UnresolvedFileHunksRendererOptions, 'onMergeConflictAction'>;
|
|
17
|
+
renderMergeConflictUtility?(action: MergeConflictDiffAction, getInstance: () => UnresolvedFile$1<LAnnotation> | undefined): ReactNode;
|
|
18
|
+
}
|
|
19
|
+
declare function UnresolvedFile<LAnnotation = undefined>({
|
|
20
|
+
file,
|
|
21
|
+
options,
|
|
22
|
+
lineAnnotations,
|
|
23
|
+
selectedLines,
|
|
24
|
+
className,
|
|
25
|
+
style,
|
|
26
|
+
prerenderedHTML,
|
|
27
|
+
renderAnnotation,
|
|
28
|
+
renderHeaderPrefix,
|
|
29
|
+
renderHeaderMetadata,
|
|
30
|
+
renderGutterUtility,
|
|
31
|
+
renderHoverUtility,
|
|
32
|
+
renderMergeConflictUtility
|
|
33
|
+
}: UnresolvedFileProps<LAnnotation>): React.JSX.Element;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { MergeConflictActionsTypeOption, RenderMergeConflictActionContext, RenderMergeConflictActions, UnresolvedFile, UnresolvedFileProps };
|
|
36
|
+
//# sourceMappingURL=UnresolvedFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnresolvedFile.d.ts","names":["ReactNode","UnresolvedFile","UnresolvedFileClass","UnresolvedFileHunksRendererOptions","FileContents","MergeConflictResolution","MergeConflictDiffAction","FileDiffProps","RenderMergeConflictActionContext","RenderMergeConflictActions","MergeConflictActionsTypeOption","UnresolvedFileProps","LAnnotation","Omit","file","options","lineAnnotations","selectedLines","className","style","prerenderedHTML","renderAnnotation","renderHeaderPrefix","renderHeaderMetadata","renderGutterUtility","renderHoverUtility","renderMergeConflictUtility","React","JSX","Element"],"sources":["../../src/react/UnresolvedFile.d.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { UnresolvedFile as UnresolvedFileClass } from '../components/UnresolvedFile';\nimport type { UnresolvedFileHunksRendererOptions } from '../renderers/UnresolvedFileHunksRenderer';\nimport type { FileContents, MergeConflictResolution } from '../types';\nimport { type MergeConflictDiffAction } from '../utils/parseMergeConflictDiffFromFile';\nimport type { FileDiffProps } from './FileDiff';\nexport interface RenderMergeConflictActionContext {\n resolveConflict(resolution: MergeConflictResolution): void;\n}\nexport type RenderMergeConflictActions = (action: MergeConflictDiffAction, context: RenderMergeConflictActionContext) => ReactNode;\nexport type MergeConflictActionsTypeOption = 'none' | 'default' | RenderMergeConflictActions;\nexport interface UnresolvedFileProps<LAnnotation> extends Omit<FileDiffProps<LAnnotation>, 'fileDiff' | 'options'> {\n file: FileContents;\n options?: Omit<UnresolvedFileHunksRendererOptions, 'onMergeConflictAction'>;\n renderMergeConflictUtility?(action: MergeConflictDiffAction, getInstance: () => UnresolvedFileClass<LAnnotation> | undefined): ReactNode;\n}\nexport declare function UnresolvedFile<LAnnotation = undefined>({ file, options, lineAnnotations, selectedLines, className, style, prerenderedHTML, renderAnnotation, renderHeaderPrefix, renderHeaderMetadata, renderGutterUtility, renderHoverUtility, renderMergeConflictUtility }: UnresolvedFileProps<LAnnotation>): React.JSX.Element;\n//# sourceMappingURL=UnresolvedFile.d.ts.map"],"mappings":";;;;;;;;UAMiBQ,gCAAAA;8BACeH;AADhC;AAGYI,KAAAA,0BAAAA,GAA0B,CAAA,MAAA,EAAYH,uBAAZ,EAAA,OAAA,EAA8CE,gCAA9C,EAAA,GAAmFR,SAAnF;AAAYM,KACtCI,8BAAAA,GADsCJ,MAAAA,GAAAA,SAAAA,GACgBG,0BADhBH;AAAkCE,UAEnEG,mBAFmEH,CAAAA,WAAAA,CAAAA,SAE1BK,IAF0BL,CAErBD,aAFqBC,CAEPI,WAFOJ,CAAAA,EAAAA,UAAAA,GAAAA,SAAAA,CAAAA,CAAAA;EAAqCR,IAAAA,EAG/GI,YAH+GJ;EAAS,OAAA,CAAA,EAIpHa,IAJoH,CAI/GV,kCAJ+G,EAAA,uBAAA,CAAA;EACtHO,0BAAAA,EAAAA,MAA8B,EAIFJ,uBAJ0BG,EAAAA,WAAAA,EAA0B,GAAA,GAIRP,gBAJQ,CAIYU,WAJZ,CAAA,GAAA,SAAA,CAAA,EAIuCZ,SAJvC;AAC5F;AAA6EY,iBAKrDX,cALqDW,CAAAA,cAAAA,SAAAA,CAAAA,CAAAA;EAAAA,IAAAA;EAAAA,OAAAA;EAAAA,eAAAA;EAAAA,aAAAA;EAAAA,SAAAA;EAAAA,KAAAA;EAAAA,eAAAA;EAAAA,gBAAAA;EAAAA,kBAAAA;EAAAA,oBAAAA;EAAAA,mBAAAA;EAAAA,kBAAAA;EAAAA;AAAAA,CAAAA,EAK0MD,mBAL1MC,CAK8NA,WAL9NA,CAAAA,CAAAA,EAK6Oe,KAAAA,CAAMC,GAAAA,CAAIC,OALvPjB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { DIFFS_TAG_NAME } from "../constants.js";
|
|
5
|
+
import { templateRender } from "./utils/templateRender.js";
|
|
6
|
+
import { renderDiffChildren } from "./utils/renderDiffChildren.js";
|
|
7
|
+
import { useUnresolvedFileInstance } from "./utils/useUnresolvedFileInstance.js";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
|
|
10
|
+
//#region src/react/UnresolvedFile.tsx
|
|
11
|
+
function UnresolvedFile({ file, options, lineAnnotations, selectedLines, className, style, prerenderedHTML, renderAnnotation, renderHeaderPrefix, renderHeaderMetadata, renderGutterUtility, renderHoverUtility, renderMergeConflictUtility }) {
|
|
12
|
+
const { ref, getHoveredLine, fileDiff, actions, getInstance } = useUnresolvedFileInstance({
|
|
13
|
+
file,
|
|
14
|
+
options,
|
|
15
|
+
lineAnnotations,
|
|
16
|
+
selectedLines,
|
|
17
|
+
prerenderedHTML,
|
|
18
|
+
hasConflictUtility: renderMergeConflictUtility != null
|
|
19
|
+
});
|
|
20
|
+
return /* @__PURE__ */ jsx(DIFFS_TAG_NAME, {
|
|
21
|
+
ref,
|
|
22
|
+
className,
|
|
23
|
+
style,
|
|
24
|
+
children: templateRender(renderDiffChildren({
|
|
25
|
+
fileDiff,
|
|
26
|
+
renderHeaderPrefix,
|
|
27
|
+
renderHeaderMetadata,
|
|
28
|
+
renderAnnotation,
|
|
29
|
+
renderGutterUtility,
|
|
30
|
+
renderHoverUtility,
|
|
31
|
+
lineAnnotations,
|
|
32
|
+
getHoveredLine,
|
|
33
|
+
actions,
|
|
34
|
+
renderMergeConflictUtility,
|
|
35
|
+
getInstance
|
|
36
|
+
}), prerenderedHTML)
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { UnresolvedFile };
|
|
42
|
+
//# sourceMappingURL=UnresolvedFile.js.map
|
|
@@ -0,0 +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 { UnresolvedFile as UnresolvedFileClass } from '../components/UnresolvedFile';\nimport { DIFFS_TAG_NAME } from '../constants';\nimport type { UnresolvedFileHunksRendererOptions } from '../renderers/UnresolvedFileHunksRenderer';\nimport type { FileContents, MergeConflictResolution } from '../types';\nimport { type MergeConflictDiffAction } from '../utils/parseMergeConflictDiffFromFile';\nimport type { FileDiffProps } from './FileDiff';\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 UnresolvedFileProps<LAnnotation> extends Omit<\n FileDiffProps<LAnnotation>,\n 'fileDiff' | 'options'\n> {\n file: FileContents;\n options?: Omit<UnresolvedFileHunksRendererOptions, 'onMergeConflictAction'>;\n renderMergeConflictUtility?(\n action: MergeConflictDiffAction,\n getInstance: () => UnresolvedFileClass<LAnnotation> | undefined\n ): ReactNode;\n}\n\nexport function UnresolvedFile<LAnnotation = undefined>({\n file,\n options,\n lineAnnotations,\n selectedLines,\n className,\n style,\n prerenderedHTML,\n renderAnnotation,\n renderHeaderPrefix,\n renderHeaderMetadata,\n renderGutterUtility,\n renderHoverUtility,\n renderMergeConflictUtility,\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 });\n const children = renderDiffChildren({\n fileDiff,\n renderHeaderPrefix,\n renderHeaderMetadata,\n renderAnnotation,\n renderGutterUtility,\n renderHoverUtility,\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":";;;;;;;;;;AAwCA,SAAgB,eAAwC,EACtD,MACA,SACA,iBACA,eACA,WACA,OACA,iBACA,kBACA,oBACA,sBACA,qBACA,oBACA,8BACsD;CACtD,MAAM,EAAE,KAAK,gBAAgB,UAAU,SAAS,gBAC9C,0BAA0B;EACxB;EACA;EACA;EACA;EACA;EACA,oBAAoB,8BAA8B;EACnD,CAAC;AAcJ,QACE,oBAAC;EAAoB;EAAgB;EAAkB;YACpD,eAfY,mBAAmB;GAClC;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CAAC,EAG4B,gBAAgB;GAC3B"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { CSSProperties } from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/react/constants.d.ts
|
|
4
|
-
declare const
|
|
4
|
+
declare const GutterUtilitySlotStyles: CSSProperties;
|
|
5
|
+
declare const MergeConflictSlotStyles: CSSProperties;
|
|
5
6
|
//#endregion
|
|
6
|
-
export {
|
|
7
|
+
export { GutterUtilitySlotStyles, MergeConflictSlotStyles };
|
|
7
8
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","names":["CSSProperties","
|
|
1
|
+
{"version":3,"file":"constants.d.ts","names":["CSSProperties","GutterUtilitySlotStyles","MergeConflictSlotStyles"],"sources":["../../src/react/constants.d.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\nexport declare const GutterUtilitySlotStyles: CSSProperties;\nexport declare const MergeConflictSlotStyles: CSSProperties;\n//# sourceMappingURL=constants.d.ts.map"],"mappings":";;;cACqBC,yBAAyBD;cACzBE,yBAAyBF"}
|
package/dist/react/constants.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
//#region src/react/constants.ts
|
|
2
|
-
const
|
|
2
|
+
const GutterUtilitySlotStyles = {
|
|
3
3
|
position: "absolute",
|
|
4
4
|
top: 0,
|
|
5
5
|
bottom: 0,
|
|
6
6
|
textAlign: "center"
|
|
7
7
|
};
|
|
8
|
+
const MergeConflictSlotStyles = { display: "contents" };
|
|
8
9
|
|
|
9
10
|
//#endregion
|
|
10
|
-
export {
|
|
11
|
+
export { GutterUtilitySlotStyles, MergeConflictSlotStyles };
|
|
11
12
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["
|
|
1
|
+
{"version":3,"file":"constants.js","names":["GutterUtilitySlotStyles: CSSProperties","MergeConflictSlotStyles: CSSProperties"],"sources":["../../src/react/constants.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\n\nexport const GutterUtilitySlotStyles: CSSProperties = {\n position: 'absolute',\n top: 0,\n bottom: 0,\n textAlign: 'center',\n};\n\nexport const MergeConflictSlotStyles: CSSProperties = {\n display: 'contents',\n};\n"],"mappings":";AAEA,MAAaA,0BAAyC;CACpD,UAAU;CACV,KAAK;CACL,QAAQ;CACR,WAAW;CACZ;AAED,MAAaC,0BAAyC,EACpD,SAAS,YACV"}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { AnnotationLineMap, AnnotationSide, AnnotationSpan, BaseCodeOptions, BaseDiffOptions, BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, CodeToHastOptions, ContextContent, DecorationItem, DiffLineAnnotation, DiffLineEventBaseProps, DiffsHighlighter, DiffsThemeNames, ExpansionDirections, ExtensionFormatMap, FileContents, FileDiffMetadata, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PrePropertiesConfig, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderMetadataCallback, RenderHeaderMetadataProps, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, SelectionSide, SharedRenderState, ShikiTransformer, SupportedLanguages, ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, ThemedToken, ThemesType, VirtualFileMetrics, VirtualWindowSpecs } from "../types.js";
|
|
1
|
+
import { AnnotationLineMap, AnnotationSide, AnnotationSpan, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, CodeToHastOptions, ContextContent, CustomPreProperties, DecorationItem, DiffLineAnnotation, DiffLineEventBaseProps, DiffsHighlighter, DiffsThemeNames, ExpansionDirections, ExtensionFormatMap, FileContents, FileDiffMetadata, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MergeConflictActionPayload, MergeConflictRegion, MergeConflictResolution, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PrePropertiesConfig, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderMetadataCallback, RenderHeaderMetadataProps, RenderHeaderPrefixCallback, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, SelectionPoint, SelectionSide, SharedRenderState, ShikiTransformer, SupportedLanguages, ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, ThemedToken, ThemesType, VirtualFileMetrics, VirtualWindowSpecs } from "../types.js";
|
|
2
2
|
import { WorkerInitializationRenderOptions, WorkerPoolOptions } from "../worker/types.js";
|
|
3
3
|
import { FileOptions } from "../components/File.js";
|
|
4
4
|
import { DiffBasePropsReact, FileProps } from "./types.js";
|
|
5
5
|
import { File } from "./File.js";
|
|
6
6
|
import { FileDiff, FileDiffProps } from "./FileDiff.js";
|
|
7
|
+
import { MergeConflictActionsTypeOption, RenderMergeConflictActionContext, RenderMergeConflictActions, UnresolvedFile, UnresolvedFileProps } from "./UnresolvedFile.js";
|
|
7
8
|
import { MultiFileDiff, MultiFileDiffProps } from "./MultiFileDiff.js";
|
|
8
9
|
import { PatchDiff, PatchDiffProps } from "./PatchDiff.js";
|
|
9
10
|
import { Virtualizer, VirtualizerContext, useVirtualizer } from "./Virtualizer.js";
|
|
10
11
|
import { WorkerPoolContext, WorkerPoolContextProvider, useWorkerPool } from "./WorkerPoolContext.js";
|
|
11
|
-
import {
|
|
12
|
+
import { GutterUtilitySlotStyles, MergeConflictSlotStyles } from "./constants.js";
|
|
12
13
|
import { renderDiffChildren } from "./utils/renderDiffChildren.js";
|
|
13
14
|
import { renderFileChildren } from "./utils/renderFileChildren.js";
|
|
14
15
|
import { templateRender } from "./utils/templateRender.js";
|
|
15
16
|
import { useFileDiffInstance } from "./utils/useFileDiffInstance.js";
|
|
16
17
|
import { useFileInstance } from "./utils/useFileInstance.js";
|
|
17
18
|
import { useStableCallback } from "./utils/useStableCallback.js";
|
|
18
|
-
export { AnnotationLineMap, AnnotationSide, AnnotationSpan, BaseCodeOptions, BaseDiffOptions, BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, CodeToHastOptions, ContextContent, DecorationItem, DiffBasePropsReact, DiffLineAnnotation, DiffLineEventBaseProps, DiffsHighlighter, DiffsThemeNames, ExpansionDirections, ExtensionFormatMap, File, FileContents, FileDiff, FileDiffMetadata, FileDiffProps, FileOptions, FileProps, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan,
|
|
19
|
+
export { AnnotationLineMap, AnnotationSide, AnnotationSpan, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, CodeToHastOptions, ContextContent, CustomPreProperties, DecorationItem, DiffBasePropsReact, DiffLineAnnotation, DiffLineEventBaseProps, DiffsHighlighter, DiffsThemeNames, ExpansionDirections, ExtensionFormatMap, File, FileContents, FileDiff, FileDiffMetadata, FileDiffProps, FileOptions, FileProps, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, GutterUtilitySlotStyles, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MergeConflictActionPayload, MergeConflictActionsTypeOption, MergeConflictRegion, MergeConflictResolution, MergeConflictSlotStyles, MultiFileDiff, MultiFileDiffProps, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PatchDiff, PatchDiffProps, PrePropertiesConfig, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderMetadataCallback, RenderHeaderMetadataProps, RenderHeaderPrefixCallback, RenderMergeConflictActionContext, RenderMergeConflictActions, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, SelectionPoint, SelectionSide, SharedRenderState, ShikiTransformer, SupportedLanguages, ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, ThemedToken, ThemesType, UnresolvedFile, UnresolvedFileProps, VirtualFileMetrics, VirtualWindowSpecs, Virtualizer, VirtualizerContext, WorkerInitializationRenderOptions, WorkerPoolContext, WorkerPoolContextProvider, WorkerPoolOptions, renderDiffChildren, renderFileChildren, templateRender, useFileDiffInstance, useFileInstance, useStableCallback, useVirtualizer, useWorkerPool };
|
package/dist/react/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GutterUtilitySlotStyles, MergeConflictSlotStyles } from "./constants.js";
|
|
2
2
|
import { renderFileChildren } from "./utils/renderFileChildren.js";
|
|
3
3
|
import { templateRender } from "./utils/templateRender.js";
|
|
4
4
|
import { Virtualizer, VirtualizerContext, useVirtualizer } from "./Virtualizer.js";
|
|
@@ -11,5 +11,6 @@ import { useFileDiffInstance } from "./utils/useFileDiffInstance.js";
|
|
|
11
11
|
import { FileDiff } from "./FileDiff.js";
|
|
12
12
|
import { MultiFileDiff } from "./MultiFileDiff.js";
|
|
13
13
|
import { PatchDiff } from "./PatchDiff.js";
|
|
14
|
+
import { UnresolvedFile } from "./UnresolvedFile.js";
|
|
14
15
|
|
|
15
|
-
export { File, FileDiff,
|
|
16
|
+
export { File, FileDiff, GutterUtilitySlotStyles, MergeConflictSlotStyles, MultiFileDiff, PatchDiff, UnresolvedFile, Virtualizer, VirtualizerContext, WorkerPoolContext, WorkerPoolContextProvider, renderDiffChildren, renderFileChildren, templateRender, useFileDiffInstance, useFileInstance, useStableCallback, useVirtualizer, useWorkerPool };
|
package/dist/react/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DiffLineAnnotation, FileContents, LineAnnotation, RenderHeaderMetadataProps, VirtualFileMetrics } from "../types.js";
|
|
2
|
-
import { SelectedLineRange } from "../managers/
|
|
3
|
-
import { GetHoveredLineResult } from "../managers/MouseEventManager.js";
|
|
2
|
+
import { GetHoveredLineResult, SelectedLineRange } from "../managers/InteractionManager.js";
|
|
4
3
|
import { FileOptions } from "../components/File.js";
|
|
5
4
|
import { FileDiffOptions } from "../components/FileDiff.js";
|
|
6
5
|
import { CSSProperties, ReactNode } from "react";
|
|
@@ -12,7 +11,12 @@ interface DiffBasePropsReact<LAnnotation> {
|
|
|
12
11
|
lineAnnotations?: DiffLineAnnotation<LAnnotation>[];
|
|
13
12
|
selectedLines?: SelectedLineRange | null;
|
|
14
13
|
renderAnnotation?(annotations: DiffLineAnnotation<LAnnotation>): ReactNode;
|
|
14
|
+
renderHeaderPrefix?(props: RenderHeaderMetadataProps): ReactNode;
|
|
15
15
|
renderHeaderMetadata?(props: RenderHeaderMetadataProps): ReactNode;
|
|
16
|
+
renderGutterUtility?(getHoveredLine: () => GetHoveredLineResult<'diff'> | undefined): ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use `renderGutterUtility` instead.
|
|
19
|
+
*/
|
|
16
20
|
renderHoverUtility?(getHoveredLine: () => GetHoveredLineResult<'diff'> | undefined): ReactNode;
|
|
17
21
|
className?: string;
|
|
18
22
|
style?: CSSProperties;
|
|
@@ -25,7 +29,12 @@ interface FileProps<LAnnotation> {
|
|
|
25
29
|
lineAnnotations?: LineAnnotation<LAnnotation>[];
|
|
26
30
|
selectedLines?: SelectedLineRange | null;
|
|
27
31
|
renderAnnotation?(annotations: LineAnnotation<LAnnotation>): ReactNode;
|
|
32
|
+
renderHeaderPrefix?(file: FileContents): ReactNode;
|
|
28
33
|
renderHeaderMetadata?(file: FileContents): ReactNode;
|
|
34
|
+
renderGutterUtility?(getHoveredLine: () => GetHoveredLineResult<'file'> | undefined): ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated Use `renderGutterUtility` instead.
|
|
37
|
+
*/
|
|
29
38
|
renderHoverUtility?(getHoveredLine: () => GetHoveredLineResult<'file'> | undefined): ReactNode;
|
|
30
39
|
className?: string;
|
|
31
40
|
style?: CSSProperties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":["CSSProperties","ReactNode","FileOptions","FileDiffOptions","
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":["CSSProperties","ReactNode","FileOptions","FileDiffOptions","GetHoveredLineResult","SelectedLineRange","DiffLineAnnotation","FileContents","LineAnnotation","RenderHeaderMetadataProps","VirtualFileMetrics","DiffBasePropsReact","LAnnotation","FileProps"],"sources":["../../src/react/types.d.ts"],"sourcesContent":["import { type CSSProperties, type ReactNode } from 'react';\nimport type { FileOptions } from '../components/File';\nimport type { FileDiffOptions } from '../components/FileDiff';\nimport type { GetHoveredLineResult, SelectedLineRange } from '../managers/InteractionManager';\nimport type { DiffLineAnnotation, FileContents, LineAnnotation, RenderHeaderMetadataProps, VirtualFileMetrics } from '../types';\nexport interface DiffBasePropsReact<LAnnotation> {\n options?: FileDiffOptions<LAnnotation>;\n metrics?: VirtualFileMetrics;\n lineAnnotations?: DiffLineAnnotation<LAnnotation>[];\n selectedLines?: SelectedLineRange | null;\n renderAnnotation?(annotations: DiffLineAnnotation<LAnnotation>): ReactNode;\n renderHeaderPrefix?(props: RenderHeaderMetadataProps): ReactNode;\n renderHeaderMetadata?(props: RenderHeaderMetadataProps): ReactNode;\n renderGutterUtility?(getHoveredLine: () => GetHoveredLineResult<'diff'> | undefined): ReactNode;\n /**\n * @deprecated Use `renderGutterUtility` instead.\n */\n renderHoverUtility?(getHoveredLine: () => GetHoveredLineResult<'diff'> | undefined): ReactNode;\n className?: string;\n style?: CSSProperties;\n prerenderedHTML?: string;\n}\nexport interface FileProps<LAnnotation> {\n file: FileContents;\n options?: FileOptions<LAnnotation>;\n metrics?: VirtualFileMetrics;\n lineAnnotations?: LineAnnotation<LAnnotation>[];\n selectedLines?: SelectedLineRange | null;\n renderAnnotation?(annotations: LineAnnotation<LAnnotation>): ReactNode;\n renderHeaderPrefix?(file: FileContents): ReactNode;\n renderHeaderMetadata?(file: FileContents): ReactNode;\n renderGutterUtility?(getHoveredLine: () => GetHoveredLineResult<'file'> | undefined): ReactNode;\n /**\n * @deprecated Use `renderGutterUtility` instead.\n */\n renderHoverUtility?(getHoveredLine: () => GetHoveredLineResult<'file'> | undefined): ReactNode;\n className?: string;\n style?: CSSProperties;\n prerenderedHTML?: string;\n}\n//# sourceMappingURL=types.d.ts.map"],"mappings":";;;;;;;UAKiBW;YACHR,gBAAgBS;EADbD,OAAAA,CAAAA,EAEHD,kBAFqBE;EACLA,eAAAA,CAAAA,EAERN,kBAFQM,CAEWA,WAFXA,CAAAA,EAAAA;EAAhBT,aAAAA,CAAAA,EAGME,iBAHNF,GAAAA,IAAAA;EACAO,gBAAAA,EAAAA,WAAAA,EAGqBJ,kBAHrBI,CAGwCE,WAHxCF,CAAAA,CAAAA,EAGuDT,SAHvDS;EAC2BE,kBAAAA,EAAAA,KAAAA,EAGVH,yBAHUG,CAAAA,EAGkBX,SAHlBW;EAAnBN,oBAAAA,EAAAA,KAAAA,EAIWG,yBAJXH,CAAAA,EAIuCL,SAJvCK;EACFD,mBAAAA,EAAAA,cAAAA,EAAAA,GAAAA,GAI2BD,oBAJ3BC,CAAAA,MAAAA,CAAAA,GAAAA,SAAAA,CAAAA,EAIsEJ,SAJtEI;EACkCO;;;EACvBH,kBAAAA,EAAAA,cAAAA,EAAAA,GAAAA,GAMeL,oBANfK,CAAAA,MAAAA,CAAAA,GAAAA,SAAAA,CAAAA,EAM0DR,SAN1DQ;EAA4BR,SAAAA,CAAAA,EAAAA,MAAAA;EAC1BQ,KAAAA,CAAAA,EAOrBT,aAPqBS;EAA4BR,eAAAA,CAAAA,EAAAA,MAAAA;;AAC6BA,UASzEY,SATyEZ,CAAAA,WAAAA,CAAAA,CAAAA;EAI5CG,IAAAA,EAMpCG,YANoCH;EAA2CH,OAAAA,CAAAA,EAO3EC,WAP2ED,CAO/DW,WAP+DX,CAAAA;EAE7ED,OAAAA,CAAAA,EAMEU,kBANFV;EAAa,eAAA,CAAA,EAOHQ,cAPG,CAOYI,WAPZ,CAAA,EAAA;EAGRC,aAAS,CAAA,EAKNR,iBALMO,GAAA,IAAA;EAChBL,gBAAAA,EAAAA,WAAAA,EAKyBC,cALzBD,CAKwCK,WALxCL,CAAAA,CAAAA,EAKuDN,SALvDM;EACgBK,kBAAAA,EAAAA,IAAAA,EAKIL,YALJK,CAAAA,EAKmBX,SALnBW;EAAZV,oBAAAA,EAAAA,IAAAA,EAMkBK,YANlBL,CAAAA,EAMiCD,SANjCC;EACAQ,mBAAAA,EAAAA,cAAAA,EAAAA,GAAAA,GAMiCN,oBANjCM,CAAAA,MAAAA,CAAAA,GAAAA,SAAAA,CAAAA,EAM4ET,SAN5ES;EACuBE;;;EAEaA,kBAAAA,EAAAA,cAAAA,EAAAA,GAAAA,GAOJR,oBAPIQ,CAAAA,MAAAA,CAAAA,GAAAA,SAAAA,CAAAA,EAOuCX,SAPvCW;EAAfJ,SAAAA,CAAAA,EAAAA,MAAAA;EAA8BP,KAAAA,CAAAA,EASrDD,aATqDC;EACnCM,eAAAA,CAAAA,EAAAA,MAAAA"}
|
|
@@ -1,29 +1,40 @@
|
|
|
1
1
|
import { FileContents, FileDiffMetadata } from "../../types.js";
|
|
2
|
-
import { GetHoveredLineResult } from "../../managers/
|
|
2
|
+
import { GetHoveredLineResult } from "../../managers/InteractionManager.js";
|
|
3
|
+
import { MergeConflictDiffAction } from "../../utils/parseMergeConflictDiffFromFile.js";
|
|
3
4
|
import { DiffBasePropsReact } from "../types.js";
|
|
4
5
|
import { ReactNode } from "react";
|
|
5
6
|
|
|
6
7
|
//#region src/react/utils/renderDiffChildren.d.ts
|
|
7
|
-
interface RenderDiffChildrenProps<LAnnotation> {
|
|
8
|
+
interface RenderDiffChildrenProps<LAnnotation, T> {
|
|
8
9
|
fileDiff?: FileDiffMetadata;
|
|
10
|
+
actions?: MergeConflictDiffAction[];
|
|
9
11
|
deletionFile?: FileContents;
|
|
10
12
|
additionFile?: FileContents;
|
|
13
|
+
renderHeaderPrefix: DiffBasePropsReact<LAnnotation>['renderHeaderPrefix'];
|
|
11
14
|
renderHeaderMetadata: DiffBasePropsReact<LAnnotation>['renderHeaderMetadata'];
|
|
12
15
|
renderAnnotation: DiffBasePropsReact<LAnnotation>['renderAnnotation'];
|
|
16
|
+
renderGutterUtility: DiffBasePropsReact<LAnnotation>['renderGutterUtility'];
|
|
13
17
|
renderHoverUtility: DiffBasePropsReact<LAnnotation>['renderHoverUtility'];
|
|
18
|
+
renderMergeConflictUtility?(action: MergeConflictDiffAction, getInstance: () => T | undefined): ReactNode;
|
|
14
19
|
lineAnnotations: DiffBasePropsReact<LAnnotation>['lineAnnotations'];
|
|
15
20
|
getHoveredLine(): GetHoveredLineResult<'diff'> | undefined;
|
|
21
|
+
getInstance?(): T | undefined;
|
|
16
22
|
}
|
|
17
|
-
declare function renderDiffChildren<LAnnotation>({
|
|
23
|
+
declare function renderDiffChildren<LAnnotation, T>({
|
|
18
24
|
fileDiff,
|
|
25
|
+
actions,
|
|
19
26
|
deletionFile,
|
|
20
27
|
additionFile,
|
|
28
|
+
renderHeaderPrefix,
|
|
21
29
|
renderHeaderMetadata,
|
|
22
30
|
renderAnnotation,
|
|
31
|
+
renderGutterUtility,
|
|
23
32
|
renderHoverUtility,
|
|
33
|
+
renderMergeConflictUtility,
|
|
24
34
|
lineAnnotations,
|
|
25
|
-
getHoveredLine
|
|
26
|
-
|
|
35
|
+
getHoveredLine,
|
|
36
|
+
getInstance
|
|
37
|
+
}: RenderDiffChildrenProps<LAnnotation, T>): ReactNode;
|
|
27
38
|
//#endregion
|
|
28
39
|
export { renderDiffChildren };
|
|
29
40
|
//# sourceMappingURL=renderDiffChildren.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderDiffChildren.d.ts","names":["ReactNode","GetHoveredLineResult","FileContents","FileDiffMetadata","DiffBasePropsReact","RenderDiffChildrenProps","LAnnotation","renderDiffChildren","fileDiff","deletionFile","additionFile","renderHeaderMetadata","renderAnnotation","renderHoverUtility","lineAnnotations","getHoveredLine"],"sources":["../../../src/react/utils/renderDiffChildren.d.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { GetHoveredLineResult } from '../../managers/
|
|
1
|
+
{"version":3,"file":"renderDiffChildren.d.ts","names":["ReactNode","GetHoveredLineResult","FileContents","FileDiffMetadata","MergeConflictDiffAction","DiffBasePropsReact","RenderDiffChildrenProps","LAnnotation","T","renderDiffChildren","fileDiff","actions","deletionFile","additionFile","renderHeaderPrefix","renderHeaderMetadata","renderAnnotation","renderGutterUtility","renderHoverUtility","renderMergeConflictUtility","lineAnnotations","getHoveredLine","getInstance"],"sources":["../../../src/react/utils/renderDiffChildren.d.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { GetHoveredLineResult } from '../../managers/InteractionManager';\nimport type { FileContents, FileDiffMetadata } from '../../types';\nimport { type MergeConflictDiffAction } from '../../utils/parseMergeConflictDiffFromFile';\nimport type { DiffBasePropsReact } from '../types';\ninterface RenderDiffChildrenProps<LAnnotation, T> {\n fileDiff?: FileDiffMetadata;\n actions?: MergeConflictDiffAction[];\n deletionFile?: FileContents;\n additionFile?: FileContents;\n renderHeaderPrefix: DiffBasePropsReact<LAnnotation>['renderHeaderPrefix'];\n renderHeaderMetadata: DiffBasePropsReact<LAnnotation>['renderHeaderMetadata'];\n renderAnnotation: DiffBasePropsReact<LAnnotation>['renderAnnotation'];\n renderGutterUtility: DiffBasePropsReact<LAnnotation>['renderGutterUtility'];\n renderHoverUtility: DiffBasePropsReact<LAnnotation>['renderHoverUtility'];\n renderMergeConflictUtility?(action: MergeConflictDiffAction, getInstance: () => T | undefined): ReactNode;\n lineAnnotations: DiffBasePropsReact<LAnnotation>['lineAnnotations'];\n getHoveredLine(): GetHoveredLineResult<'diff'> | undefined;\n getInstance?(): T | undefined;\n}\nexport declare function renderDiffChildren<LAnnotation, T>({ fileDiff, actions, deletionFile, additionFile, renderHeaderPrefix, renderHeaderMetadata, renderAnnotation, renderGutterUtility, renderHoverUtility, renderMergeConflictUtility, lineAnnotations, getHoveredLine, getInstance }: RenderDiffChildrenProps<LAnnotation, T>): ReactNode;\nexport {};\n//# sourceMappingURL=renderDiffChildren.d.ts.map"],"mappings":";;;;;;;UAKUM;aACKH;EADLG,OAAAA,CAAAA,EAEIF,uBAFmBG,EAAAA;EAClBJ,YAAAA,CAAAA,EAEID,YAFJC;EACDC,YAAAA,CAAAA,EAEKF,YAFLE;EACKF,kBAAAA,EAEKG,kBAFLH,CAEwBK,WAFxBL,CAAAA,CAAAA,oBAAAA,CAAAA;EACAA,oBAAAA,EAEOG,kBAFPH,CAE0BK,WAF1BL,CAAAA,CAAAA,sBAAAA,CAAAA;EACwBK,gBAAAA,EAErBF,kBAFqBE,CAEFA,WAFEA,CAAAA,CAAAA,kBAAAA,CAAAA;EAAnBF,mBAAAA,EAGCA,kBAHDA,CAGoBE,WAHpBF,CAAAA,CAAAA,qBAAAA,CAAAA;EACqBE,kBAAAA,EAGrBF,kBAHqBE,CAGFA,WAHEA,CAAAA,CAAAA,oBAAAA,CAAAA;EAAnBF,0BAAAA,EAAAA,MAAAA,EAIcD,uBAJdC,EAAAA,WAAAA,EAAAA,GAAAA,GAI0DG,CAJ1DH,GAAAA,SAAAA,CAAAA,EAI0EL,SAJ1EK;EACeE,eAAAA,EAIpBF,kBAJoBE,CAIDA,WAJCA,CAAAA,CAAAA,iBAAAA,CAAAA;EAAnBF,cAAAA,EAAAA,EAKAJ,oBALAI,CAAAA,MAAAA,CAAAA,GAAAA,SAAAA;EACsBE,WAAAA,GAAAA,EAKxBC,CALwBD,GAAAA,SAAAA;;AACDA,iBAMnBE,kBANmBF,CAAAA,WAAAA,EAAAA,CAAAA,CAAAA,CAAAA;EAAAA,QAAAA;EAAAA,OAAAA;EAAAA,YAAAA;EAAAA,YAAAA;EAAAA,kBAAAA;EAAAA,oBAAAA;EAAAA,gBAAAA;EAAAA,mBAAAA;EAAAA,kBAAAA;EAAAA,0BAAAA;EAAAA,eAAAA;EAAAA,cAAAA;EAAAA;AAAAA,CAAAA,EAMkPD,uBANlPC,CAM0QA,WAN1QA,EAMuRC,CANvRD,CAAAA,CAAAA,EAM4RP,SAN5RO"}
|
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
import { HEADER_METADATA_SLOT_ID } from "../../constants.js";
|
|
1
|
+
import { HEADER_METADATA_SLOT_ID, HEADER_PREFIX_SLOT_ID } from "../../constants.js";
|
|
2
2
|
import { getLineAnnotationName } from "../../utils/getLineAnnotationName.js";
|
|
3
|
-
import {
|
|
3
|
+
import { getMergeConflictActionSlotName } from "../../utils/getMergeConflictActionSlotName.js";
|
|
4
|
+
import { getMergeConflictActionAnchor } from "../../utils/parseMergeConflictDiffFromFile.js";
|
|
5
|
+
import { GutterUtilitySlotStyles, MergeConflictSlotStyles } from "../constants.js";
|
|
4
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
7
|
|
|
6
8
|
//#region src/react/utils/renderDiffChildren.tsx
|
|
7
|
-
function renderDiffChildren({ fileDiff, deletionFile, additionFile, renderHeaderMetadata, renderAnnotation, renderHoverUtility, lineAnnotations, getHoveredLine }) {
|
|
9
|
+
function renderDiffChildren({ fileDiff, actions, deletionFile, additionFile, renderHeaderPrefix, renderHeaderMetadata, renderAnnotation, renderGutterUtility, renderHoverUtility, renderMergeConflictUtility, lineAnnotations, getHoveredLine, getInstance }) {
|
|
10
|
+
const gutterUtility = renderGutterUtility ?? renderHoverUtility;
|
|
11
|
+
const prefix = renderHeaderPrefix?.({
|
|
12
|
+
fileDiff,
|
|
13
|
+
deletionFile,
|
|
14
|
+
additionFile
|
|
15
|
+
});
|
|
8
16
|
const metadata = renderHeaderMetadata?.({
|
|
9
17
|
fileDiff,
|
|
10
18
|
deletionFile,
|
|
11
19
|
additionFile
|
|
12
20
|
});
|
|
13
21
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22
|
+
prefix != null && /* @__PURE__ */ jsx("div", {
|
|
23
|
+
slot: HEADER_PREFIX_SLOT_ID,
|
|
24
|
+
children: prefix
|
|
25
|
+
}),
|
|
14
26
|
metadata != null && /* @__PURE__ */ jsx("div", {
|
|
15
27
|
slot: HEADER_METADATA_SLOT_ID,
|
|
16
28
|
children: metadata
|
|
@@ -19,13 +31,28 @@ function renderDiffChildren({ fileDiff, deletionFile, additionFile, renderHeader
|
|
|
19
31
|
slot: getLineAnnotationName(annotation),
|
|
20
32
|
children: renderAnnotation(annotation)
|
|
21
33
|
}, index)),
|
|
22
|
-
|
|
23
|
-
slot
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
actions != null && renderMergeConflictUtility != null && getInstance != null && actions.map((action) => {
|
|
35
|
+
const slot = getSlotName(action);
|
|
36
|
+
return /* @__PURE__ */ jsx("div", {
|
|
37
|
+
slot,
|
|
38
|
+
style: MergeConflictSlotStyles,
|
|
39
|
+
children: renderMergeConflictUtility(action, getInstance)
|
|
40
|
+
}, slot);
|
|
41
|
+
}),
|
|
42
|
+
gutterUtility != null && /* @__PURE__ */ jsx("div", {
|
|
43
|
+
slot: "gutter-utility-slot",
|
|
44
|
+
style: GutterUtilitySlotStyles,
|
|
45
|
+
children: gutterUtility(getHoveredLine)
|
|
26
46
|
})
|
|
27
47
|
] });
|
|
28
48
|
}
|
|
49
|
+
function getSlotName(action) {
|
|
50
|
+
const anchor = getMergeConflictActionAnchor(action);
|
|
51
|
+
return anchor != null ? getMergeConflictActionSlotName({
|
|
52
|
+
...anchor,
|
|
53
|
+
conflictIndex: action.conflictIndex
|
|
54
|
+
}) : void 0;
|
|
55
|
+
}
|
|
29
56
|
|
|
30
57
|
//#endregion
|
|
31
58
|
export { renderDiffChildren };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderDiffChildren.js","names":[],"sources":["../../../src/react/utils/renderDiffChildren.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport {
|
|
1
|
+
{"version":3,"file":"renderDiffChildren.js","names":[],"sources":["../../../src/react/utils/renderDiffChildren.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport {\n HEADER_METADATA_SLOT_ID,\n HEADER_PREFIX_SLOT_ID,\n} from '../../constants';\nimport type { GetHoveredLineResult } from '../../managers/InteractionManager';\nimport type { FileContents, 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[];\n deletionFile?: FileContents;\n additionFile?: FileContents;\n renderHeaderPrefix: DiffBasePropsReact<LAnnotation>['renderHeaderPrefix'];\n renderHeaderMetadata: DiffBasePropsReact<LAnnotation>['renderHeaderMetadata'];\n renderAnnotation: DiffBasePropsReact<LAnnotation>['renderAnnotation'];\n renderGutterUtility: DiffBasePropsReact<LAnnotation>['renderGutterUtility'];\n renderHoverUtility: DiffBasePropsReact<LAnnotation>['renderHoverUtility'];\n renderMergeConflictUtility?(\n action: MergeConflictDiffAction,\n getInstance: () => T | undefined\n ): ReactNode;\n lineAnnotations: DiffBasePropsReact<LAnnotation>['lineAnnotations'];\n getHoveredLine(): GetHoveredLineResult<'diff'> | undefined;\n getInstance?(): T | undefined;\n}\n\nexport function renderDiffChildren<LAnnotation, T>({\n fileDiff,\n actions,\n deletionFile,\n additionFile,\n renderHeaderPrefix,\n renderHeaderMetadata,\n renderAnnotation,\n renderGutterUtility,\n renderHoverUtility,\n renderMergeConflictUtility,\n lineAnnotations,\n getHoveredLine,\n getInstance,\n}: RenderDiffChildrenProps<LAnnotation, T>): ReactNode {\n const gutterUtility = renderGutterUtility ?? renderHoverUtility;\n const prefix = renderHeaderPrefix?.({\n fileDiff,\n deletionFile,\n additionFile,\n });\n const metadata = renderHeaderMetadata?.({\n fileDiff,\n deletionFile,\n additionFile,\n });\n return (\n <>\n {prefix != null && <div slot={HEADER_PREFIX_SLOT_ID}>{prefix}</div>}\n {metadata != null && <div slot={HEADER_METADATA_SLOT_ID}>{metadata}</div>}\n {renderAnnotation != null &&\n lineAnnotations?.map((annotation, index) => (\n <div key={index} slot={getLineAnnotationName(annotation)}>\n {renderAnnotation(annotation)}\n </div>\n ))}\n {actions != null &&\n renderMergeConflictUtility != null &&\n getInstance != null &&\n actions.map((action) => {\n const slot = getSlotName(action);\n return (\n <div key={slot} slot={slot} style={MergeConflictSlotStyles}>\n {renderMergeConflictUtility(action, getInstance)}\n </div>\n );\n })}\n {gutterUtility != null && (\n <div slot=\"gutter-utility-slot\" style={GutterUtilitySlotStyles}>\n {gutterUtility(getHoveredLine)}\n </div>\n )}\n </>\n );\n}\n\nfunction getSlotName(action: MergeConflictDiffAction): string | undefined {\n const anchor = getMergeConflictActionAnchor(action);\n return anchor != null\n ? getMergeConflictActionSlotName({\n ...anchor,\n conflictIndex: action.conflictIndex,\n })\n : undefined;\n}\n"],"mappings":";;;;;;;;AAoCA,SAAgB,mBAAmC,EACjD,UACA,SACA,cACA,cACA,oBACA,sBACA,kBACA,qBACA,oBACA,4BACA,iBACA,gBACA,eACqD;CACrD,MAAM,gBAAgB,uBAAuB;CAC7C,MAAM,SAAS,qBAAqB;EAClC;EACA;EACA;EACD,CAAC;CACF,MAAM,WAAW,uBAAuB;EACtC;EACA;EACA;EACD,CAAC;AACF,QACE;EACG,UAAU,QAAQ,oBAAC;GAAI,MAAM;aAAwB;IAAa;EAClE,YAAY,QAAQ,oBAAC;GAAI,MAAM;aAA0B;IAAe;EACxE,oBAAoB,QACnB,iBAAiB,KAAK,YAAY,UAChC,oBAAC;GAAgB,MAAM,sBAAsB,WAAW;aACrD,iBAAiB,WAAW;KADrB,MAEJ,CACN;EACH,WAAW,QACV,8BAA8B,QAC9B,eAAe,QACf,QAAQ,KAAK,WAAW;GACtB,MAAM,OAAO,YAAY,OAAO;AAChC,UACE,oBAAC;IAAqB;IAAM,OAAO;cAChC,2BAA2B,QAAQ,YAAY;MADxC,KAEJ;IAER;EACH,iBAAiB,QAChB,oBAAC;GAAI,MAAK;GAAsB,OAAO;aACpC,cAAc,eAAe;IAC1B;KAEP;;AAIP,SAAS,YAAY,QAAqD;CACxE,MAAM,SAAS,6BAA6B,OAAO;AACnD,QAAO,UAAU,OACb,+BAA+B;EAC7B,GAAG;EACH,eAAe,OAAO;EACvB,CAAC,GACF"}
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import { FileContents } from "../../types.js";
|
|
2
|
-
import { GetHoveredLineResult } from "../../managers/
|
|
2
|
+
import { GetHoveredLineResult } from "../../managers/InteractionManager.js";
|
|
3
3
|
import { FileProps } from "../types.js";
|
|
4
4
|
import { ReactNode } from "react";
|
|
5
5
|
|
|
6
6
|
//#region src/react/utils/renderFileChildren.d.ts
|
|
7
7
|
interface RenderFileChildrenProps<LAnnotation> {
|
|
8
8
|
file: FileContents;
|
|
9
|
+
renderHeaderPrefix: FileProps<LAnnotation>['renderHeaderPrefix'];
|
|
9
10
|
renderHeaderMetadata: FileProps<LAnnotation>['renderHeaderMetadata'];
|
|
10
11
|
renderAnnotation: FileProps<LAnnotation>['renderAnnotation'];
|
|
11
12
|
lineAnnotations: FileProps<LAnnotation>['lineAnnotations'];
|
|
13
|
+
renderGutterUtility: FileProps<LAnnotation>['renderGutterUtility'];
|
|
12
14
|
renderHoverUtility: FileProps<LAnnotation>['renderHoverUtility'];
|
|
13
15
|
getHoveredLine(): GetHoveredLineResult<'file'> | undefined;
|
|
14
16
|
}
|
|
15
17
|
declare function renderFileChildren<LAnnotation>({
|
|
16
18
|
file,
|
|
19
|
+
renderHeaderPrefix,
|
|
17
20
|
renderHeaderMetadata,
|
|
18
21
|
renderAnnotation,
|
|
19
22
|
lineAnnotations,
|
|
23
|
+
renderGutterUtility,
|
|
20
24
|
renderHoverUtility,
|
|
21
25
|
getHoveredLine
|
|
22
26
|
}: RenderFileChildrenProps<LAnnotation>): ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderFileChildren.d.ts","names":["ReactNode","GetHoveredLineResult","FileContents","FileProps","RenderFileChildrenProps","LAnnotation","renderFileChildren","file","renderHeaderMetadata","renderAnnotation","lineAnnotations","renderHoverUtility","getHoveredLine"],"sources":["../../../src/react/utils/renderFileChildren.d.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { GetHoveredLineResult } from '../../managers/
|
|
1
|
+
{"version":3,"file":"renderFileChildren.d.ts","names":["ReactNode","GetHoveredLineResult","FileContents","FileProps","RenderFileChildrenProps","LAnnotation","renderFileChildren","file","renderHeaderPrefix","renderHeaderMetadata","renderAnnotation","lineAnnotations","renderGutterUtility","renderHoverUtility","getHoveredLine"],"sources":["../../../src/react/utils/renderFileChildren.d.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { GetHoveredLineResult } from '../../managers/InteractionManager';\nimport type { FileContents } from '../../types';\nimport type { FileProps } from '../types';\ninterface RenderFileChildrenProps<LAnnotation> {\n file: FileContents;\n renderHeaderPrefix: FileProps<LAnnotation>['renderHeaderPrefix'];\n renderHeaderMetadata: FileProps<LAnnotation>['renderHeaderMetadata'];\n renderAnnotation: FileProps<LAnnotation>['renderAnnotation'];\n lineAnnotations: FileProps<LAnnotation>['lineAnnotations'];\n renderGutterUtility: FileProps<LAnnotation>['renderGutterUtility'];\n renderHoverUtility: FileProps<LAnnotation>['renderHoverUtility'];\n getHoveredLine(): GetHoveredLineResult<'file'> | undefined;\n}\nexport declare function renderFileChildren<LAnnotation>({ file, renderHeaderPrefix, renderHeaderMetadata, renderAnnotation, lineAnnotations, renderGutterUtility, renderHoverUtility, getHoveredLine }: RenderFileChildrenProps<LAnnotation>): ReactNode;\nexport {};\n//# sourceMappingURL=renderFileChildren.d.ts.map"],"mappings":";;;;;;UAIUI;QACAF;EADAE,kBAAAA,EAEcD,SAFS,CAECE,WAFDA,CAAAA,CAAAA,oBAAA,CAAA;EACvBH,oBAAAA,EAEgBC,SAFhBD,CAE0BG,WAF1BH,CAAAA,CAAAA,sBAAAA,CAAAA;EACwBG,gBAAAA,EAEZF,SAFYE,CAEFA,WAFEA,CAAAA,CAAAA,kBAAAA,CAAAA;EAAVF,eAAAA,EAGHA,SAHGA,CAGOE,WAHPF,CAAAA,CAAAA,iBAAAA,CAAAA;EACYE,mBAAAA,EAGXF,SAHWE,CAGDA,WAHCA,CAAAA,CAAAA,qBAAAA,CAAAA;EAAVF,kBAAAA,EAIFA,SAJEA,CAIQE,WAJRF,CAAAA,CAAAA,oBAAAA,CAAAA;EACME,cAAAA,EAAAA,EAIVJ,oBAJUI,CAAAA,MAAAA,CAAAA,GAAAA,SAAAA;;AACDA,iBAKPC,kBALOD,CAAAA,WAAAA,CAAAA,CAAAA;EAAAA,IAAAA;EAAAA,kBAAAA;EAAAA,oBAAAA;EAAAA,gBAAAA;EAAAA,eAAAA;EAAAA,mBAAAA;EAAAA,kBAAAA;EAAAA;AAAAA,CAAAA,EAKyKD,uBALzKC,CAKiMA,WALjMA,CAAAA,CAAAA,EAKgNL,SALhNK"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import { HEADER_METADATA_SLOT_ID } from "../../constants.js";
|
|
1
|
+
import { HEADER_METADATA_SLOT_ID, HEADER_PREFIX_SLOT_ID } from "../../constants.js";
|
|
2
2
|
import { getLineAnnotationName } from "../../utils/getLineAnnotationName.js";
|
|
3
|
-
import {
|
|
3
|
+
import { GutterUtilitySlotStyles } from "../constants.js";
|
|
4
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/react/utils/renderFileChildren.tsx
|
|
7
|
-
function renderFileChildren({ file, renderHeaderMetadata, renderAnnotation, lineAnnotations, renderHoverUtility, getHoveredLine }) {
|
|
7
|
+
function renderFileChildren({ file, renderHeaderPrefix, renderHeaderMetadata, renderAnnotation, lineAnnotations, renderGutterUtility, renderHoverUtility, getHoveredLine }) {
|
|
8
|
+
const gutterUtility = renderGutterUtility ?? renderHoverUtility;
|
|
9
|
+
const prefix = renderHeaderPrefix?.(file);
|
|
8
10
|
const metadata = renderHeaderMetadata?.(file);
|
|
9
11
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12
|
+
prefix != null && /* @__PURE__ */ jsx("div", {
|
|
13
|
+
slot: HEADER_PREFIX_SLOT_ID,
|
|
14
|
+
children: prefix
|
|
15
|
+
}),
|
|
10
16
|
metadata != null && /* @__PURE__ */ jsx("div", {
|
|
11
17
|
slot: HEADER_METADATA_SLOT_ID,
|
|
12
18
|
children: metadata
|
|
@@ -15,10 +21,10 @@ function renderFileChildren({ file, renderHeaderMetadata, renderAnnotation, line
|
|
|
15
21
|
slot: getLineAnnotationName(annotation),
|
|
16
22
|
children: renderAnnotation(annotation)
|
|
17
23
|
}, index)),
|
|
18
|
-
|
|
19
|
-
slot: "
|
|
20
|
-
style:
|
|
21
|
-
children:
|
|
24
|
+
gutterUtility != null && /* @__PURE__ */ jsx("div", {
|
|
25
|
+
slot: "gutter-utility-slot",
|
|
26
|
+
style: GutterUtilitySlotStyles,
|
|
27
|
+
children: gutterUtility(getHoveredLine)
|
|
22
28
|
})
|
|
23
29
|
] });
|
|
24
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderFileChildren.js","names":[],"sources":["../../../src/react/utils/renderFileChildren.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport {
|
|
1
|
+
{"version":3,"file":"renderFileChildren.js","names":[],"sources":["../../../src/react/utils/renderFileChildren.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport {\n HEADER_METADATA_SLOT_ID,\n HEADER_PREFIX_SLOT_ID,\n} from '../../constants';\nimport type { GetHoveredLineResult } from '../../managers/InteractionManager';\nimport type { FileContents } from '../../types';\nimport { getLineAnnotationName } from '../../utils/getLineAnnotationName';\nimport { GutterUtilitySlotStyles } from '../constants';\nimport type { FileProps } from '../types';\n\ninterface RenderFileChildrenProps<LAnnotation> {\n file: FileContents;\n renderHeaderPrefix: FileProps<LAnnotation>['renderHeaderPrefix'];\n renderHeaderMetadata: FileProps<LAnnotation>['renderHeaderMetadata'];\n renderAnnotation: FileProps<LAnnotation>['renderAnnotation'];\n lineAnnotations: FileProps<LAnnotation>['lineAnnotations'];\n renderGutterUtility: FileProps<LAnnotation>['renderGutterUtility'];\n renderHoverUtility: FileProps<LAnnotation>['renderHoverUtility'];\n getHoveredLine(): GetHoveredLineResult<'file'> | undefined;\n}\n\nexport function renderFileChildren<LAnnotation>({\n file,\n renderHeaderPrefix,\n renderHeaderMetadata,\n renderAnnotation,\n lineAnnotations,\n renderGutterUtility,\n renderHoverUtility,\n getHoveredLine,\n}: RenderFileChildrenProps<LAnnotation>): ReactNode {\n const gutterUtility = renderGutterUtility ?? renderHoverUtility;\n const prefix = renderHeaderPrefix?.(file);\n const metadata = renderHeaderMetadata?.(file);\n return (\n <>\n {prefix != null && <div slot={HEADER_PREFIX_SLOT_ID}>{prefix}</div>}\n {metadata != null && <div slot={HEADER_METADATA_SLOT_ID}>{metadata}</div>}\n {renderAnnotation != null &&\n lineAnnotations?.map((annotation, index) => (\n <div key={index} slot={getLineAnnotationName(annotation)}>\n {renderAnnotation(annotation)}\n </div>\n ))}\n {gutterUtility != null && (\n <div slot=\"gutter-utility-slot\" style={GutterUtilitySlotStyles}>\n {gutterUtility(getHoveredLine)}\n </div>\n )}\n </>\n );\n}\n"],"mappings":";;;;;;AAuBA,SAAgB,mBAAgC,EAC9C,MACA,oBACA,sBACA,kBACA,iBACA,qBACA,oBACA,kBACkD;CAClD,MAAM,gBAAgB,uBAAuB;CAC7C,MAAM,SAAS,qBAAqB,KAAK;CACzC,MAAM,WAAW,uBAAuB,KAAK;AAC7C,QACE;EACG,UAAU,QAAQ,oBAAC;GAAI,MAAM;aAAwB;IAAa;EAClE,YAAY,QAAQ,oBAAC;GAAI,MAAM;aAA0B;IAAe;EACxE,oBAAoB,QACnB,iBAAiB,KAAK,YAAY,UAChC,oBAAC;GAAgB,MAAM,sBAAsB,WAAW;aACrD,iBAAiB,WAAW;KADrB,MAEJ,CACN;EACH,iBAAiB,QAChB,oBAAC;GAAI,MAAK;GAAsB,OAAO;aACpC,cAAc,eAAe;IAC1B;KAEP"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DiffLineAnnotation, FileContents, FileDiffMetadata, VirtualFileMetrics } from "../../types.js";
|
|
2
|
-
import { SelectedLineRange } from "../../managers/
|
|
3
|
-
import { GetHoveredLineResult } from "../../managers/MouseEventManager.js";
|
|
2
|
+
import { GetHoveredLineResult, SelectedLineRange } from "../../managers/InteractionManager.js";
|
|
4
3
|
import { FileDiffOptions } from "../../components/FileDiff.js";
|
|
5
4
|
|
|
6
5
|
//#region src/react/utils/useFileDiffInstance.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFileDiffInstance.d.ts","names":["FileDiffOptions","
|
|
1
|
+
{"version":3,"file":"useFileDiffInstance.d.ts","names":["FileDiffOptions","GetHoveredLineResult","SelectedLineRange","DiffLineAnnotation","FileContents","FileDiffMetadata","VirtualFileMetrics","UseFileDiffInstanceProps","LAnnotation","UseFileDiffInstanceReturn","HTMLElement","useFileDiffInstance","oldFile","newFile","fileDiff","options","lineAnnotations","selectedLines","prerenderedHTML","metrics"],"sources":["../../../src/react/utils/useFileDiffInstance.d.ts"],"sourcesContent":["import { type FileDiffOptions } from '../../components/FileDiff';\nimport type { GetHoveredLineResult, SelectedLineRange } from '../../managers/InteractionManager';\nimport type { DiffLineAnnotation, FileContents, FileDiffMetadata, VirtualFileMetrics } from '../../types';\ninterface UseFileDiffInstanceProps<LAnnotation> {\n oldFile?: FileContents;\n newFile?: FileContents;\n fileDiff?: FileDiffMetadata;\n options: FileDiffOptions<LAnnotation> | undefined;\n lineAnnotations: DiffLineAnnotation<LAnnotation>[] | undefined;\n selectedLines: SelectedLineRange | null | undefined;\n prerenderedHTML: string | undefined;\n metrics?: VirtualFileMetrics;\n}\ninterface UseFileDiffInstanceReturn {\n ref(node: HTMLElement | null): void;\n getHoveredLine(): GetHoveredLineResult<'diff'> | undefined;\n}\nexport declare function useFileDiffInstance<LAnnotation>({ oldFile, newFile, fileDiff, options, lineAnnotations, selectedLines, prerenderedHTML, metrics }: UseFileDiffInstanceProps<LAnnotation>): UseFileDiffInstanceReturn;\nexport {};\n//# sourceMappingURL=useFileDiffInstance.d.ts.map"],"mappings":";;;;;UAGUO;YACIH;EADJG,OAAAA,CAAAA,EAEIH,YAFJG;EACIH,QAAAA,CAAAA,EAECC,gBAFDD;EACAA,OAAAA,EAEDJ,eAFCI,CAEeI,WAFfJ,CAAAA,GAAAA,SAAAA;EACCC,eAAAA,EAEMF,kBAFNE,CAEyBG,WAFzBH,CAAAA,EAAAA,GAAAA,SAAAA;EACcG,aAAAA,EAEVN,iBAFUM,GAAAA,IAAAA,GAAAA,SAAAA;EAAhBR,eAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAC2BQ,OAAAA,CAAAA,EAG1BF,kBAH0BE;;UAK9BC,yBAAAA,CAJSP;EAELI,GAAAA,CAAAA,IAAAA,EAGAI,WAHAJ,GAAAA,IAAAA,CAAAA,EAAAA,IAAAA;EAAkB,cAAA,EAAA,EAIVL,oBAJU,CAAA,MAAA,CAAA,GAAA,SAAA;AAAA;AAMRU,iBAAAA,mBAAmBH,CAAAA,WAAA,CAAA,CAAA;EAAA,OAAA;EAAA,OAAA;EAAA,QAAA;EAAA,OAAA;EAAA,eAAA;EAAA,aAAA;EAAA,eAAA;EAAA;AAAA,CAAA,EAAiHD,wBAAjH,CAA0IC,WAA1I,CAAA,CAAA,EAAyJC,yBAAzJ"}
|
|
@@ -32,8 +32,8 @@ function useFileDiffInstance({ oldFile, newFile, fileDiff, options, lineAnnotati
|
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
useIsometricEffect(() => {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
const { current: instance } = instanceRef;
|
|
36
|
+
if (instance == null) return;
|
|
37
37
|
const forceRender = !areOptionsEqual(instance.options, options);
|
|
38
38
|
instance.setOptions(options);
|
|
39
39
|
instance.render({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFileDiffInstance.js","names":[],"sources":["../../../src/react/utils/useFileDiffInstance.ts"],"sourcesContent":["import {\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n} from 'react';\n\nimport { FileDiff, type FileDiffOptions } from '../../components/FileDiff';\nimport { VirtualizedFileDiff } from '../../components/VirtualizedFileDiff';\nimport type {
|
|
1
|
+
{"version":3,"file":"useFileDiffInstance.js","names":[],"sources":["../../../src/react/utils/useFileDiffInstance.ts"],"sourcesContent":["import {\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n} from 'react';\n\nimport { FileDiff, type FileDiffOptions } from '../../components/FileDiff';\nimport { VirtualizedFileDiff } from '../../components/VirtualizedFileDiff';\nimport type {\n GetHoveredLineResult,\n SelectedLineRange,\n} from '../../managers/InteractionManager';\nimport type {\n DiffLineAnnotation,\n FileContents,\n FileDiffMetadata,\n VirtualFileMetrics,\n} from '../../types';\nimport { areOptionsEqual } from '../../utils/areOptionsEqual';\nimport { useVirtualizer } from '../Virtualizer';\nimport { WorkerPoolContext } from '../WorkerPoolContext';\nimport { useStableCallback } from './useStableCallback';\n\nconst useIsometricEffect =\n typeof window === 'undefined' ? useEffect : useLayoutEffect;\n\ninterface UseFileDiffInstanceProps<LAnnotation> {\n oldFile?: FileContents;\n newFile?: FileContents;\n fileDiff?: FileDiffMetadata;\n options: FileDiffOptions<LAnnotation> | undefined;\n lineAnnotations: DiffLineAnnotation<LAnnotation>[] | undefined;\n selectedLines: SelectedLineRange | null | undefined;\n prerenderedHTML: string | undefined;\n metrics?: VirtualFileMetrics;\n}\n\ninterface UseFileDiffInstanceReturn {\n ref(node: HTMLElement | null): void;\n getHoveredLine(): GetHoveredLineResult<'diff'> | undefined;\n}\n\nexport function useFileDiffInstance<LAnnotation>({\n oldFile,\n newFile,\n fileDiff,\n options,\n lineAnnotations,\n selectedLines,\n prerenderedHTML,\n metrics,\n}: UseFileDiffInstanceProps<LAnnotation>): UseFileDiffInstanceReturn {\n const simpleVirtualizer = useVirtualizer();\n const poolManager = useContext(WorkerPoolContext);\n const instanceRef = useRef<\n FileDiff<LAnnotation> | VirtualizedFileDiff<LAnnotation> | null\n >(null);\n const ref = useStableCallback((fileContainer: HTMLElement | null) => {\n if (fileContainer != null) {\n if (instanceRef.current != null) {\n throw new Error(\n 'useFileDiffInstance: An instance should not already exist when a node is created'\n );\n }\n if (simpleVirtualizer != null) {\n instanceRef.current = new VirtualizedFileDiff(\n options,\n simpleVirtualizer,\n metrics,\n poolManager,\n true\n );\n } else {\n instanceRef.current = new FileDiff(options, poolManager, true);\n }\n void instanceRef.current.hydrate({\n fileDiff,\n oldFile,\n newFile,\n fileContainer,\n lineAnnotations,\n prerenderedHTML,\n });\n } else {\n if (instanceRef.current == null) {\n throw new Error(\n 'useFileDiffInstance: A FileDiff instance should exist when unmounting'\n );\n }\n instanceRef.current.cleanUp();\n instanceRef.current = null;\n }\n });\n\n useIsometricEffect(() => {\n const { current: instance } = instanceRef;\n if (instance == null) return;\n const forceRender = !areOptionsEqual(instance.options, options);\n instance.setOptions(options);\n void instance.render({\n forceRender,\n fileDiff,\n oldFile,\n newFile,\n lineAnnotations,\n });\n if (selectedLines !== undefined) {\n instance.setSelectedLines(selectedLines);\n }\n });\n\n const getHoveredLine = useCallback(():\n | GetHoveredLineResult<'diff'>\n | undefined => {\n return instanceRef.current?.getHoveredLine();\n }, []);\n\n return { ref, getHoveredLine };\n}\n"],"mappings":";;;;;;;;;AAyBA,MAAM,qBACJ,OAAO,WAAW,cAAc,YAAY;AAkB9C,SAAgB,oBAAiC,EAC/C,SACA,SACA,UACA,SACA,iBACA,eACA,iBACA,WACmE;CACnE,MAAM,oBAAoB,gBAAgB;CAC1C,MAAM,cAAc,WAAW,kBAAkB;CACjD,MAAM,cAAc,OAElB,KAAK;CACP,MAAM,MAAM,mBAAmB,kBAAsC;AACnE,MAAI,iBAAiB,MAAM;AACzB,OAAI,YAAY,WAAW,KACzB,OAAM,IAAI,MACR,mFACD;AAEH,OAAI,qBAAqB,KACvB,aAAY,UAAU,IAAI,oBACxB,SACA,mBACA,SACA,aACA,KACD;OAED,aAAY,UAAU,IAAI,SAAS,SAAS,aAAa,KAAK;AAEhE,GAAK,YAAY,QAAQ,QAAQ;IAC/B;IACA;IACA;IACA;IACA;IACA;IACD,CAAC;SACG;AACL,OAAI,YAAY,WAAW,KACzB,OAAM,IAAI,MACR,wEACD;AAEH,eAAY,QAAQ,SAAS;AAC7B,eAAY,UAAU;;GAExB;AAEF,0BAAyB;EACvB,MAAM,EAAE,SAAS,aAAa;AAC9B,MAAI,YAAY,KAAM;EACtB,MAAM,cAAc,CAAC,gBAAgB,SAAS,SAAS,QAAQ;AAC/D,WAAS,WAAW,QAAQ;AAC5B,EAAK,SAAS,OAAO;GACnB;GACA;GACA;GACA;GACA;GACD,CAAC;AACF,MAAI,kBAAkB,OACpB,UAAS,iBAAiB,cAAc;GAE1C;AAQF,QAAO;EAAE;EAAK,gBANS,kBAEN;AACf,UAAO,YAAY,SAAS,gBAAgB;KAC3C,EAAE,CAAC;EAEwB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FileContents, LineAnnotation, VirtualFileMetrics } from "../../types.js";
|
|
2
|
-
import { SelectedLineRange } from "../../managers/
|
|
3
|
-
import { GetHoveredLineResult } from "../../managers/MouseEventManager.js";
|
|
2
|
+
import { GetHoveredLineResult, SelectedLineRange } from "../../managers/InteractionManager.js";
|
|
4
3
|
import { FileOptions } from "../../components/File.js";
|
|
5
4
|
|
|
6
5
|
//#region src/react/utils/useFileInstance.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFileInstance.d.ts","names":["FileOptions","
|
|
1
|
+
{"version":3,"file":"useFileInstance.d.ts","names":["FileOptions","GetHoveredLineResult","SelectedLineRange","FileContents","LineAnnotation","VirtualFileMetrics","UseFileInstanceProps","LAnnotation","UseFileInstanceReturn","HTMLElement","useFileInstance","file","options","lineAnnotations","selectedLines","prerenderedHTML","metrics"],"sources":["../../../src/react/utils/useFileInstance.d.ts"],"sourcesContent":["import { type FileOptions } from '../../components/File';\nimport type { GetHoveredLineResult, SelectedLineRange } from '../../managers/InteractionManager';\nimport type { FileContents, LineAnnotation, VirtualFileMetrics } from '../../types';\ninterface UseFileInstanceProps<LAnnotation> {\n file: FileContents;\n options: FileOptions<LAnnotation> | undefined;\n lineAnnotations: LineAnnotation<LAnnotation>[] | undefined;\n selectedLines: SelectedLineRange | null | undefined;\n prerenderedHTML: string | undefined;\n metrics?: VirtualFileMetrics;\n}\ninterface UseFileInstanceReturn {\n ref(node: HTMLElement | null): void;\n getHoveredLine(): GetHoveredLineResult<'file'> | undefined;\n}\nexport declare function useFileInstance<LAnnotation>({ file, options, lineAnnotations, selectedLines, prerenderedHTML, metrics }: UseFileInstanceProps<LAnnotation>): UseFileInstanceReturn;\nexport {};\n//# sourceMappingURL=useFileInstance.d.ts.map"],"mappings":";;;;;UAGUM;QACAH;EADAG,OAAAA,EAEGN,WAFHM,CAEeC,WAFKA,CAAAA,GAAAA,SAAAA;EACpBJ,eAAAA,EAEWC,cAFXD,CAE0BI,WAF1BJ,CAAAA,EAAAA,GAAAA,SAAAA;EACeI,aAAAA,EAENL,iBAFMK,GAAAA,IAAAA,GAAAA,SAAAA;EAAZP,eAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EACuBO,OAAAA,CAAAA,EAGtBF,kBAHsBE;;UAK1BC,qBAAAA,CAJSN;EAELG,GAAAA,CAAAA,IAAAA,EAGAI,WAHAJ,GAAAA,IAAAA,CAAAA,EAAAA,IAAAA;EAAkB,cAAA,EAAA,EAIVJ,oBAJU,CAAA,MAAA,CAAA,GAAA,SAAA;AAAA;AAMRS,iBAAAA,eAAeH,CAAAA,WAAA,CAAA,CAAA;EAAA,IAAA;EAAA,OAAA;EAAA,eAAA;EAAA,aAAA;EAAA,eAAA;EAAA;AAAA,CAAA,EAA2FD,oBAA3F,CAAgHC,WAAhH,CAAA,CAAA,EAA+HC,qBAA/H"}
|