@pierre/diffs 1.1.0-beta.6 → 1.1.0-beta.8
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 +40 -0
- package/dist/components/AdvancedVirtualizedFileDiff.d.ts.map +1 -0
- package/dist/components/AdvancedVirtualizedFileDiff.js +145 -0
- package/dist/components/AdvancedVirtualizedFileDiff.js.map +1 -0
- package/dist/components/AdvancedVirtualizer.d.ts +38 -0
- package/dist/components/AdvancedVirtualizer.d.ts.map +1 -0
- package/dist/components/AdvancedVirtualizer.js +201 -0
- package/dist/components/AdvancedVirtualizer.js.map +1 -0
- package/dist/components/File.d.ts +58 -33
- package/dist/components/File.d.ts.map +1 -1
- package/dist/components/File.js +223 -22
- package/dist/components/File.js.map +1 -1
- package/dist/components/FileDiff.d.ts +42 -16
- package/dist/components/FileDiff.d.ts.map +1 -1
- package/dist/components/FileDiff.js +505 -65
- package/dist/components/FileDiff.js.map +1 -1
- package/dist/components/FileStream.d.ts +5 -0
- package/dist/components/FileStream.d.ts.map +1 -1
- package/dist/components/FileStream.js +66 -8
- package/dist/components/FileStream.js.map +1 -1
- package/dist/components/VirtualizedFile.d.ts +33 -0
- package/dist/components/VirtualizedFile.d.ts.map +1 -0
- package/dist/components/VirtualizedFile.js +227 -0
- package/dist/components/VirtualizedFile.js.map +1 -0
- package/dist/components/VirtualizedFileDiff.d.ts +39 -0
- package/dist/components/VirtualizedFileDiff.d.ts.map +1 -0
- package/dist/components/VirtualizedFileDiff.js +316 -0
- package/dist/components/VirtualizedFileDiff.js.map +1 -0
- package/dist/components/Virtualizer.d.ts +63 -0
- package/dist/components/Virtualizer.d.ts.map +1 -0
- package/dist/components/Virtualizer.js +369 -0
- package/dist/components/Virtualizer.js.map +1 -0
- package/dist/components/VirtulizerDevelopment.d.ts +14 -0
- package/dist/components/VirtulizerDevelopment.d.ts.map +1 -0
- package/dist/components/web-components.d.ts +1 -1
- package/dist/components/web-components.d.ts.map +1 -1
- package/dist/constants.d.ts +4 -7
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +14 -6
- package/dist/constants.js.map +1 -1
- package/dist/highlighter/languages/areLanguagesAttached.d.ts.map +1 -1
- package/dist/highlighter/languages/attachResolvedLanguages.d.ts.map +1 -1
- package/dist/highlighter/languages/cleanUpResolvedLanguages.d.ts.map +1 -1
- package/dist/highlighter/languages/constants.d.ts.map +1 -1
- package/dist/highlighter/languages/getResolvedLanguages.d.ts.map +1 -1
- package/dist/highlighter/languages/getResolvedOrResolveLanguage.d.ts +1 -1
- package/dist/highlighter/languages/getResolvedOrResolveLanguage.d.ts.map +1 -1
- package/dist/highlighter/languages/hasResolvedLanguages.d.ts.map +1 -1
- package/dist/highlighter/languages/registerCustomLanguage.d.ts +11 -4
- package/dist/highlighter/languages/registerCustomLanguage.d.ts.map +1 -1
- package/dist/highlighter/languages/resolveLanguage.d.ts +1 -1
- package/dist/highlighter/languages/resolveLanguage.d.ts.map +1 -1
- package/dist/highlighter/languages/resolveLanguages.d.ts.map +1 -1
- package/dist/highlighter/shared_highlighter.d.ts.map +1 -1
- package/dist/highlighter/shared_highlighter.js.map +1 -1
- package/dist/highlighter/themes/areThemesAttached.d.ts.map +1 -1
- package/dist/highlighter/themes/attachResolvedThemes.d.ts.map +1 -1
- package/dist/highlighter/themes/cleanUpResolvedThemes.d.ts.map +1 -1
- package/dist/highlighter/themes/constants.d.ts.map +1 -1
- package/dist/highlighter/themes/getResolvedOrResolveTheme.d.ts.map +1 -1
- package/dist/highlighter/themes/getResolvedThemes.d.ts.map +1 -1
- package/dist/highlighter/themes/hasResolvedThemes.d.ts.map +1 -1
- package/dist/highlighter/themes/registerCustomCSSVariableTheme.d.ts.map +1 -1
- package/dist/highlighter/themes/registerCustomTheme.d.ts.map +1 -1
- package/dist/highlighter/themes/resolveTheme.d.ts.map +1 -1
- package/dist/highlighter/themes/resolveThemes.d.ts.map +1 -1
- package/dist/index.d.ts +13 -10
- package/dist/index.js +10 -7
- package/dist/managers/LineSelectionManager.d.ts +14 -15
- package/dist/managers/LineSelectionManager.d.ts.map +1 -1
- package/dist/managers/LineSelectionManager.js +60 -71
- package/dist/managers/LineSelectionManager.js.map +1 -1
- package/dist/managers/MouseEventManager.d.ts +13 -6
- package/dist/managers/MouseEventManager.d.ts.map +1 -1
- package/dist/managers/MouseEventManager.js +161 -47
- package/dist/managers/MouseEventManager.js.map +1 -1
- package/dist/managers/ResizeManager.d.ts +6 -1
- package/dist/managers/ResizeManager.d.ts.map +1 -1
- package/dist/managers/ResizeManager.js +114 -64
- package/dist/managers/ResizeManager.js.map +1 -1
- package/dist/managers/ScrollSyncManager.d.ts.map +1 -1
- package/dist/managers/UniversalRenderingManager.d.ts.map +1 -1
- package/dist/react/File.d.ts +1 -0
- package/dist/react/File.d.ts.map +1 -1
- package/dist/react/File.js +2 -1
- package/dist/react/File.js.map +1 -1
- package/dist/react/FileDiff.d.ts +1 -0
- package/dist/react/FileDiff.d.ts.map +1 -1
- package/dist/react/FileDiff.js +2 -1
- package/dist/react/FileDiff.js.map +1 -1
- package/dist/react/MultiFileDiff.d.ts +1 -0
- package/dist/react/MultiFileDiff.d.ts.map +1 -1
- package/dist/react/MultiFileDiff.js +2 -1
- package/dist/react/MultiFileDiff.js.map +1 -1
- package/dist/react/PatchDiff.d.ts +1 -0
- package/dist/react/PatchDiff.d.ts.map +1 -1
- package/dist/react/PatchDiff.js +3 -2
- package/dist/react/PatchDiff.js.map +1 -1
- package/dist/react/Virtualizer.d.ts +25 -0
- package/dist/react/Virtualizer.d.ts.map +1 -0
- package/dist/react/Virtualizer.js +38 -0
- package/dist/react/Virtualizer.js.map +1 -0
- package/dist/react/WorkerPoolContext.d.ts.map +1 -1
- package/dist/react/WorkerPoolContext.js +1 -1
- package/dist/react/WorkerPoolContext.js.map +1 -1
- package/dist/react/constants.d.ts.map +1 -1
- package/dist/react/index.d.ts +3 -2
- package/dist/react/index.js +2 -1
- package/dist/react/jsx.d.ts.map +1 -1
- package/dist/react/types.d.ts +5 -3
- package/dist/react/types.d.ts.map +1 -1
- package/dist/react/utils/renderDiffChildren.d.ts +5 -5
- package/dist/react/utils/renderDiffChildren.d.ts.map +1 -1
- package/dist/react/utils/renderFileChildren.d.ts +5 -5
- package/dist/react/utils/renderFileChildren.d.ts.map +1 -1
- package/dist/react/utils/templateRender.d.ts.map +1 -1
- package/dist/react/utils/useFileDiffInstance.d.ts +5 -3
- package/dist/react/utils/useFileDiffInstance.d.ts.map +1 -1
- package/dist/react/utils/useFileDiffInstance.js +6 -2
- package/dist/react/utils/useFileDiffInstance.js.map +1 -1
- package/dist/react/utils/useFileInstance.d.ts +5 -3
- package/dist/react/utils/useFileInstance.d.ts.map +1 -1
- package/dist/react/utils/useFileInstance.js +6 -2
- package/dist/react/utils/useFileInstance.js.map +1 -1
- package/dist/react/utils/useStableCallback.d.ts.map +1 -1
- package/dist/react/utils/useStableCallback.js.map +1 -1
- package/dist/renderers/DiffHunksRenderer.d.ts +15 -10
- package/dist/renderers/DiffHunksRenderer.d.ts.map +1 -1
- package/dist/renderers/DiffHunksRenderer.js +240 -136
- package/dist/renderers/DiffHunksRenderer.js.map +1 -1
- package/dist/renderers/FileRenderer.d.ts +12 -5
- package/dist/renderers/FileRenderer.d.ts.map +1 -1
- package/dist/renderers/FileRenderer.js +90 -31
- package/dist/renderers/FileRenderer.js.map +1 -1
- package/dist/shiki-stream/stream.d.ts +2 -2
- 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 +2 -2
- 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 +18 -18
- package/dist/shiki-stream/types.d.ts.map +1 -1
- package/dist/sprite.d.ts +1 -1
- package/dist/sprite.d.ts.map +1 -1
- package/dist/ssr/FileDiffReact.d.ts.map +1 -1
- package/dist/ssr/FileDiffReact.js +1 -1
- package/dist/ssr/index.d.ts +2 -2
- package/dist/ssr/preloadDiffs.d.ts.map +1 -1
- package/dist/ssr/preloadFile.d.ts.map +1 -1
- package/dist/ssr/preloadPatchFile.d.ts.map +1 -1
- package/dist/ssr/preloadPatchFile.js.map +1 -1
- package/dist/ssr/renderHTML.d.ts.map +1 -1
- package/dist/style.js +1 -1
- package/dist/style.js.map +1 -1
- package/dist/types.d.ts +191 -172
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/areDiffLineAnnotationsEqual.d.ts.map +1 -1
- package/dist/utils/areDiffLineAnnotationsEqual.js.map +1 -1
- package/dist/utils/areFilesEqual.d.ts.map +1 -1
- package/dist/utils/areHunkDataEqual.d.ts.map +1 -1
- package/dist/utils/areLineAnnotationsEqual.d.ts.map +1 -1
- package/dist/utils/areObjectsEqual.d.ts.map +1 -1
- package/dist/utils/areOptionsEqual.d.ts +1 -1
- package/dist/utils/areOptionsEqual.d.ts.map +1 -1
- package/dist/utils/arePrePropertiesEqual.d.ts.map +1 -1
- package/dist/utils/arePrePropertiesEqual.js +1 -1
- package/dist/utils/arePrePropertiesEqual.js.map +1 -1
- package/dist/utils/areRenderRangesEqual.d.ts.map +1 -1
- package/dist/utils/areSelectionsEqual.d.ts.map +1 -1
- package/dist/utils/areThemesEqual.d.ts.map +1 -1
- package/dist/utils/areVirtualWindowSpecsEqual.d.ts.map +1 -1
- package/dist/utils/areWorkerStatsEqual.d.ts.map +1 -1
- package/dist/utils/cleanLastNewline.d.ts.map +1 -1
- package/dist/utils/createAnnotationElement.d.ts.map +1 -1
- package/dist/utils/createAnnotationWrapperNode.d.ts.map +1 -1
- package/dist/utils/createContentColumn.d.ts +7 -0
- package/dist/utils/createContentColumn.d.ts.map +1 -0
- package/dist/utils/createContentColumn.js +17 -0
- package/dist/utils/createContentColumn.js.map +1 -0
- package/dist/utils/createEmptyRowBuffer.d.ts.map +1 -1
- package/dist/utils/createEmptyRowBuffer.js +2 -1
- package/dist/utils/createEmptyRowBuffer.js.map +1 -1
- package/dist/utils/createFileHeaderElement.d.ts.map +1 -1
- package/dist/utils/createHoverContentNode.d.ts.map +1 -1
- package/dist/utils/createNoNewlineElement.d.ts +2 -1
- package/dist/utils/createNoNewlineElement.d.ts.map +1 -1
- package/dist/utils/createNoNewlineElement.js +3 -6
- package/dist/utils/createNoNewlineElement.js.map +1 -1
- package/dist/utils/createPreElement.d.ts +2 -1
- package/dist/utils/createPreElement.d.ts.map +1 -1
- package/dist/utils/createPreElement.js +4 -3
- package/dist/utils/createPreElement.js.map +1 -1
- package/dist/utils/createRowNodes.d.ts.map +1 -1
- package/dist/utils/createSeparator.d.ts.map +1 -1
- package/dist/utils/createSeparator.js +1 -1
- package/dist/utils/createSeparator.js.map +1 -1
- package/dist/utils/createSpanNodeFromToken.d.ts.map +1 -1
- package/dist/utils/createSpanNodeFromToken.js.map +1 -1
- package/dist/utils/createStyleElement.d.ts.map +1 -1
- package/dist/utils/createTransformerWithState.d.ts.map +1 -1
- package/dist/utils/createUnsafeCSSStyleNode.d.ts.map +1 -1
- package/dist/utils/createWindowFromScrollPosition.d.ts.map +1 -1
- package/dist/utils/cssWrappers.d.ts.map +1 -1
- package/dist/utils/diffAcceptRejectHunk.d.ts +1 -1
- package/dist/utils/diffAcceptRejectHunk.d.ts.map +1 -1
- package/dist/utils/formatCSSVariablePrefix.d.ts +1 -1
- package/dist/utils/formatCSSVariablePrefix.d.ts.map +1 -1
- package/dist/utils/getFiletypeFromFileName.d.ts.map +1 -1
- package/dist/utils/getHighlighterOptions.d.ts.map +1 -1
- package/dist/utils/getHighlighterThemeStyles.d.ts.map +1 -1
- package/dist/utils/getHunkSeparatorSlotName.d.ts +3 -1
- package/dist/utils/getHunkSeparatorSlotName.d.ts.map +1 -1
- package/dist/utils/getHunkSeparatorSlotName.js.map +1 -1
- package/dist/utils/getIconForType.d.ts +1 -1
- package/dist/utils/getIconForType.d.ts.map +1 -1
- package/dist/utils/getLineAnnotationName.d.ts.map +1 -1
- package/dist/utils/getLineEndingType.d.ts +1 -1
- package/dist/utils/getLineEndingType.d.ts.map +1 -1
- package/dist/utils/getLineNodes.d.ts.map +1 -1
- package/dist/utils/getOrCreateCodeNode.d.ts +4 -2
- package/dist/utils/getOrCreateCodeNode.d.ts.map +1 -1
- package/dist/utils/getOrCreateCodeNode.js +9 -6
- package/dist/utils/getOrCreateCodeNode.js.map +1 -1
- package/dist/utils/getSingularPatch.d.ts.map +1 -1
- package/dist/utils/getThemes.d.ts.map +1 -1
- package/dist/utils/getTotalLineCountFromHunks.d.ts.map +1 -1
- package/dist/utils/hast_utils.d.ts +6 -3
- package/dist/utils/hast_utils.d.ts.map +1 -1
- package/dist/utils/hast_utils.js +28 -4
- package/dist/utils/hast_utils.js.map +1 -1
- package/dist/utils/isDefaultRenderRange.d.ts.map +1 -1
- package/dist/utils/isWorkerContext.d.ts.map +1 -1
- package/dist/utils/iterateOverDiff.d.ts +26 -13
- package/dist/utils/iterateOverDiff.d.ts.map +1 -1
- package/dist/utils/iterateOverDiff.js +94 -55
- package/dist/utils/iterateOverDiff.js.map +1 -1
- package/dist/utils/iterateOverFile.d.ts +50 -0
- package/dist/utils/iterateOverFile.d.ts.map +1 -0
- package/dist/utils/iterateOverFile.js +49 -0
- package/dist/utils/iterateOverFile.js.map +1 -0
- package/dist/utils/parseDiffDecorations.d.ts.map +1 -1
- package/dist/utils/parseDiffFromFile.d.ts +6 -6
- package/dist/utils/parseDiffFromFile.d.ts.map +1 -1
- package/dist/utils/parseDiffFromFile.js +3 -2
- package/dist/utils/parseDiffFromFile.js.map +1 -1
- package/dist/utils/parseLineType.d.ts +1 -1
- package/dist/utils/parseLineType.d.ts.map +1 -1
- package/dist/utils/parsePatchFiles.d.ts +12 -10
- package/dist/utils/parsePatchFiles.d.ts.map +1 -1
- package/dist/utils/parsePatchFiles.js +16 -9
- package/dist/utils/parsePatchFiles.js.map +1 -1
- package/dist/utils/prerenderHTMLIfNecessary.d.ts.map +1 -1
- package/dist/utils/processLine.d.ts.map +1 -1
- package/dist/utils/processLine.js +7 -24
- package/dist/utils/processLine.js.map +1 -1
- package/dist/utils/renderDiffWithHighlighter.d.ts +2 -2
- package/dist/utils/renderDiffWithHighlighter.d.ts.map +1 -1
- package/dist/utils/renderDiffWithHighlighter.js +15 -14
- package/dist/utils/renderDiffWithHighlighter.js.map +1 -1
- package/dist/utils/renderFileWithHighlighter.d.ts +7 -2
- package/dist/utils/renderFileWithHighlighter.d.ts.map +1 -1
- package/dist/utils/renderFileWithHighlighter.js +30 -4
- package/dist/utils/renderFileWithHighlighter.js.map +1 -1
- package/dist/utils/resolveVirtualFileMetrics.d.ts +7 -0
- package/dist/utils/resolveVirtualFileMetrics.d.ts.map +1 -0
- package/dist/utils/resolveVirtualFileMetrics.js +24 -0
- package/dist/utils/resolveVirtualFileMetrics.js.map +1 -0
- package/dist/utils/setLanguageOverride.d.ts.map +1 -1
- package/dist/utils/setWrapperNodeProps.d.ts +1 -0
- package/dist/utils/setWrapperNodeProps.d.ts.map +1 -1
- package/dist/utils/setWrapperNodeProps.js +19 -12
- package/dist/utils/setWrapperNodeProps.js.map +1 -1
- package/dist/utils/splitFileContents.d.ts +12 -0
- package/dist/utils/splitFileContents.d.ts.map +1 -0
- package/dist/utils/splitFileContents.js +17 -0
- package/dist/utils/splitFileContents.js.map +1 -0
- package/dist/utils/trimPatchContext.d.ts +5 -5
- package/dist/utils/trimPatchContext.d.ts.map +1 -1
- package/dist/worker/WorkerPoolManager.d.ts +2 -2
- package/dist/worker/WorkerPoolManager.d.ts.map +1 -1
- package/dist/worker/WorkerPoolManager.js +36 -24
- package/dist/worker/WorkerPoolManager.js.map +1 -1
- package/dist/worker/getOrCreateWorkerPoolSingleton.d.ts.map +1 -1
- package/dist/worker/getOrCreateWorkerPoolSingleton.js.map +1 -1
- package/dist/worker/types.d.ts +26 -26
- package/dist/worker/types.d.ts.map +1 -1
- package/dist/worker/worker-portable.js +323 -143
- package/dist/worker/worker-portable.js.map +1 -1
- package/dist/worker/worker.js +206 -106
- package/dist/worker/worker.js.map +1 -1
- package/package.json +52 -53
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/utils/getLineEndingType.d.ts
|
|
2
|
-
declare function getLineEndingType(content: string):
|
|
2
|
+
declare function getLineEndingType(content: string): 'CRLF' | 'CR' | 'LF' | 'none';
|
|
3
3
|
//#endregion
|
|
4
4
|
export { getLineEndingType };
|
|
5
5
|
//# sourceMappingURL=getLineEndingType.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLineEndingType.d.ts","names":[],"sources":["../../src/utils/getLineEndingType.ts"],"sourcesContent":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"getLineEndingType.d.ts","names":["getLineEndingType"],"sources":["../../src/utils/getLineEndingType.d.ts"],"sourcesContent":["export declare function getLineEndingType(content: string): 'CRLF' | 'CR' | 'LF' | 'none';\n//# sourceMappingURL=getLineEndingType.d.ts.map"],"mappings":";iBAAwBA,iBAAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLineNodes.d.ts","names":[],"sources":["../../src/utils/getLineNodes.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getLineNodes.d.ts","names":["ElementContent","Root","getLineNodes"],"sources":["../../src/utils/getLineNodes.d.ts"],"sourcesContent":["import type { ElementContent, Root } from 'hast';\nexport declare function getLineNodes(nodes: Root): ElementContent[];\n//# sourceMappingURL=getLineNodes.d.ts.map"],"mappings":";;;iBACwBE,YAAAA,QAAoBD,OAAOD"}
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
interface CreateCodeNodeProps {
|
|
3
3
|
pre?: HTMLPreElement;
|
|
4
4
|
code?: HTMLElement;
|
|
5
|
-
columnType?:
|
|
5
|
+
columnType?: 'additions' | 'deletions' | 'unified';
|
|
6
|
+
rowSpan?: number;
|
|
6
7
|
}
|
|
7
8
|
declare function getOrCreateCodeNode({
|
|
8
9
|
code,
|
|
9
10
|
pre,
|
|
10
|
-
columnType
|
|
11
|
+
columnType,
|
|
12
|
+
rowSpan
|
|
11
13
|
}?: CreateCodeNodeProps): HTMLElement;
|
|
12
14
|
//#endregion
|
|
13
15
|
export { getOrCreateCodeNode };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOrCreateCodeNode.d.ts","names":[],"sources":["../../src/utils/getOrCreateCodeNode.ts"],"sourcesContent":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"getOrCreateCodeNode.d.ts","names":["CreateCodeNodeProps","HTMLPreElement","HTMLElement","getOrCreateCodeNode","code","pre","columnType","rowSpan"],"sources":["../../src/utils/getOrCreateCodeNode.d.ts"],"sourcesContent":["interface CreateCodeNodeProps {\n pre?: HTMLPreElement;\n code?: HTMLElement;\n columnType?: 'additions' | 'deletions' | 'unified';\n rowSpan?: number;\n}\nexport declare function getOrCreateCodeNode({ code, pre, columnType, rowSpan }?: CreateCodeNodeProps): HTMLElement;\nexport {};\n//# sourceMappingURL=getOrCreateCodeNode.d.ts.map"],"mappings":";UAAUA,mBAAAA;EAAAA,GAAAA,CAAAA,EACAC,cADAD;EAMcG,IAAAA,CAAAA,EAJbD,WAIaC;EAAsBC,UAAAA,CAAAA,EAAAA,WAAAA,GAAAA,WAAAA,GAAAA,SAAAA;EAAMC,OAAAA,CAAAA,EAAAA,MAAAA;;AAAiBE,iBAA7CJ,mBAAAA,CAA6CI;EAAAA,IAAAA;EAAAA,GAAAA;EAAAA,UAAAA;EAAAA;AAAAA,CAAAA,CAAAA,EAAYP,mBAAZO,CAAAA,EAAkCL,WAAlCK"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
//#region src/utils/getOrCreateCodeNode.ts
|
|
2
|
-
function getOrCreateCodeNode({ code, pre, columnType } = {}) {
|
|
3
|
-
if (code
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
function getOrCreateCodeNode({ code, pre, columnType, rowSpan } = {}) {
|
|
3
|
+
if (code == null) {
|
|
4
|
+
code = document.createElement("code");
|
|
5
|
+
code.dataset.code = "";
|
|
6
|
+
if (columnType != null) code.dataset[columnType] = "";
|
|
7
|
+
pre?.appendChild(code);
|
|
8
|
+
}
|
|
9
|
+
if (rowSpan != null) code.style.setProperty("grid-row", `span ${rowSpan}`);
|
|
10
|
+
else code.style.removeProperty("grid-row");
|
|
8
11
|
return code;
|
|
9
12
|
}
|
|
10
13
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOrCreateCodeNode.js","names":[],"sources":["../../src/utils/getOrCreateCodeNode.ts"],"sourcesContent":["interface CreateCodeNodeProps {\n pre?: HTMLPreElement;\n code?: HTMLElement;\n columnType?: 'additions' | 'deletions' | 'unified';\n}\n\nexport function getOrCreateCodeNode({\n code,\n pre,\n columnType,\n}: CreateCodeNodeProps = {}): HTMLElement {\n if (code
|
|
1
|
+
{"version":3,"file":"getOrCreateCodeNode.js","names":[],"sources":["../../src/utils/getOrCreateCodeNode.ts"],"sourcesContent":["interface CreateCodeNodeProps {\n pre?: HTMLPreElement;\n code?: HTMLElement;\n columnType?: 'additions' | 'deletions' | 'unified';\n rowSpan?: number;\n}\n\nexport function getOrCreateCodeNode({\n code,\n pre,\n columnType,\n rowSpan,\n}: CreateCodeNodeProps = {}): HTMLElement {\n if (code == null) {\n code = document.createElement('code');\n code.dataset.code = '';\n if (columnType != null) {\n code.dataset[columnType] = '';\n }\n pre?.appendChild(code);\n }\n if (rowSpan != null) {\n code.style.setProperty('grid-row', `span ${rowSpan}`);\n } else {\n code.style.removeProperty('grid-row');\n }\n return code;\n}\n"],"mappings":";AAOA,SAAgB,oBAAoB,EAClC,MACA,KACA,YACA,YACuB,EAAE,EAAe;AACxC,KAAI,QAAQ,MAAM;AAChB,SAAO,SAAS,cAAc,OAAO;AACrC,OAAK,QAAQ,OAAO;AACpB,MAAI,cAAc,KAChB,MAAK,QAAQ,cAAc;AAE7B,OAAK,YAAY,KAAK;;AAExB,KAAI,WAAW,KACb,MAAK,MAAM,YAAY,YAAY,QAAQ,UAAU;KAErD,MAAK,MAAM,eAAe,WAAW;AAEvC,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSingularPatch.d.ts","names":[],"sources":["../../src/utils/getSingularPatch.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getSingularPatch.d.ts","names":["FileDiffMetadata","getSingularPatch"],"sources":["../../src/utils/getSingularPatch.d.ts"],"sourcesContent":["import type { FileDiffMetadata } from '../types';\nexport declare function getSingularPatch(patch: string): FileDiffMetadata;\n//# sourceMappingURL=getSingularPatch.d.ts.map"],"mappings":";;;iBACwBC,gBAAAA,iBAAiCD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getThemes.d.ts","names":[],"sources":["../../src/utils/getThemes.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getThemes.d.ts","names":["DiffsThemeNames","ThemesType","getThemes"],"sources":["../../src/utils/getThemes.d.ts"],"sourcesContent":["import type { DiffsThemeNames, ThemesType } from '../types';\nexport declare function getThemes(theme?: DiffsThemeNames | ThemesType): DiffsThemeNames[];\n//# sourceMappingURL=getThemes.d.ts.map"],"mappings":";;;iBACwBE,SAAAA,SAAkBF,kBAAkBC,aAAaD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTotalLineCountFromHunks.d.ts","names":[],"sources":["../../src/utils/getTotalLineCountFromHunks.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getTotalLineCountFromHunks.d.ts","names":["Hunk","getTotalLineCountFromHunks"],"sources":["../../src/utils/getTotalLineCountFromHunks.d.ts"],"sourcesContent":["import type { Hunk } from '../types';\nexport declare function getTotalLineCountFromHunks(hunks: Hunk[]): number;\n//# sourceMappingURL=getTotalLineCountFromHunks.d.ts.map"],"mappings":";;;iBACwBC,0BAAAA,QAAkCD"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { LineTypes } from "../types.js";
|
|
1
2
|
import { SVGSpriteNames } from "../sprite.js";
|
|
2
3
|
import { Element, ElementContent, Properties, Root, Text } from "hast";
|
|
3
4
|
|
|
4
5
|
//#region src/utils/hast_utils.d.ts
|
|
5
6
|
declare function createTextNodeElement(value: string): Text;
|
|
6
7
|
interface CreateHastElementProps {
|
|
7
|
-
tagName:
|
|
8
|
+
tagName: 'span' | 'div' | 'code' | 'pre' | 'slot' | 'svg' | 'use' | 'style' | 'template';
|
|
8
9
|
children?: ElementContent[];
|
|
9
10
|
properties?: Properties;
|
|
10
11
|
}
|
|
@@ -26,7 +27,9 @@ declare function createIconElement({
|
|
|
26
27
|
properties
|
|
27
28
|
}: CreateIconProps): Element;
|
|
28
29
|
declare function findCodeElement(nodes: Root | Element): Element | undefined;
|
|
29
|
-
declare function
|
|
30
|
+
declare function createGutterWrapper(children?: ElementContent[]): Element;
|
|
31
|
+
declare function createGutterItem(lineType: LineTypes | 'buffer' | 'separator' | 'annotation', lineNumber: number, lineIndex: string): Element;
|
|
32
|
+
declare function createGutterGap(type: LineTypes | undefined, bufferType: 'annotation' | 'buffer' | 'metadata', size: number): Element;
|
|
30
33
|
//#endregion
|
|
31
|
-
export {
|
|
34
|
+
export { createGutterGap, createGutterItem, createGutterWrapper, createHastElement, createIconElement, createTextNodeElement, findCodeElement };
|
|
32
35
|
//# sourceMappingURL=hast_utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hast_utils.d.ts","names":[],"sources":["../../src/utils/hast_utils.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hast_utils.d.ts","names":["ElementContent","Element","HASTElement","Properties","Root","Text","SVGSpriteNames","LineTypes","createTextNodeElement","CreateHastElementProps","createHastElement","tagName","children","properties","CreateIconProps","createIconElement","name","width","height","findCodeElement","createGutterWrapper","createGutterItem","createGutterGap"],"sources":["../../src/utils/hast_utils.d.ts"],"sourcesContent":["import type { ElementContent, Element as HASTElement, Properties, Root, Text } from 'hast';\nimport type { SVGSpriteNames } from '../sprite';\nimport type { LineTypes } from '../types';\nexport declare function createTextNodeElement(value: string): Text;\ninterface CreateHastElementProps {\n tagName: 'span' | 'div' | 'code' | 'pre' | 'slot' | 'svg' | 'use' | 'style' | 'template';\n children?: ElementContent[];\n properties?: Properties;\n}\nexport declare function createHastElement({ tagName, children, properties }: CreateHastElementProps): HASTElement;\ninterface CreateIconProps {\n name: SVGSpriteNames;\n width?: number;\n height?: number;\n properties?: Properties;\n}\nexport declare function createIconElement({ name, width, height, properties }: CreateIconProps): HASTElement;\nexport declare function findCodeElement(nodes: Root | HASTElement): HASTElement | undefined;\nexport declare function createGutterWrapper(children?: ElementContent[]): HASTElement;\nexport declare function createGutterItem(lineType: LineTypes | 'buffer' | 'separator' | 'annotation', lineNumber: number, lineIndex: string): HASTElement;\nexport declare function createGutterGap(type: LineTypes | undefined, bufferType: 'annotation' | 'buffer' | 'metadata', size: number): HASTElement;\nexport {};\n//# sourceMappingURL=hast_utils.d.ts.map"],"mappings":";;;;;iBAGwBQ,qBAAAA,iBAAsCH;UACpDI,sBAAAA;EADcD,OAAAA,EAAAA,MAAAA,GAAAA,KAAAA,GAAqB,MAAA,GAAiBH,KAAI,GAAA,MAAA,GAAA,KAAA,GAAA,KAAA,GAAA,OAAA,GAAA,UAAA;EACxDI,QAAAA,CAAAA,EAEKT,cAFiB,EAAA;EAKRU,UAAAA,CAAAA,EAFPP,UAEwB;;AAAYS,iBAA7BF,iBAAAA,CAA6BE;EAAAA,OAAAA;EAAAA,QAAAA;EAAAA;AAAAA,CAAAA,EAAwBH,sBAAxBG,CAAAA,EAAiDV,OAAjDU;UAC3CE,eAAAA,CADqDD;EAAcJ,IAAAA,EAEnEH,cAFmEG;EAAyBP,KAAAA,CAAAA,EAAAA,MAAAA;EAAW,MAAA,CAAA,EAAA,MAAA;EACvGY,UAAAA,CAAAA,EAIOX,UAJQ;AAMzB;AAA4Ca,iBAApBD,iBAAAA,CAAoBC;EAAAA,IAAAA;EAAAA,KAAAA;EAAAA,MAAAA;EAAAA;AAAAA,CAAAA,EAAmCF,eAAnCE,CAAAA,EAAqDd,OAArDc;AAAMC,iBAC1BE,eAAAA,CAD0BF,KAAAA,EACHb,IADGa,GACIf,OADJe,CAAAA,EACkBf,OADlBe,GAAAA,SAAAA;AAAOC,iBAEjCE,mBAAAA,CAFiCF,QAAAA,CAAAA,EAEFlB,cAFEkB,EAAAA,CAAAA,EAEiBhB,OAFjBgB;AAAQL,iBAGzCQ,gBAAAA,CAHyCR,QAAAA,EAGdN,SAHcM,GAAAA,QAAAA,GAAAA,WAAAA,GAAAA,YAAAA,EAAAA,UAAAA,EAAAA,MAAAA,EAAAA,SAAAA,EAAAA,MAAAA,CAAAA,EAG6EX,OAH7EW;AAAcC,iBAIvDQ,eAAAA,CAJuDR,IAAAA,EAIjCP,SAJiCO,GAAAA,SAAAA,EAAAA,UAAAA,EAAAA,YAAAA,GAAAA,QAAAA,GAAAA,UAAAA,EAAAA,IAAAA,EAAAA,MAAAA,CAAAA,EAIuDZ,OAJvDY"}
|
package/dist/utils/hast_utils.js
CHANGED
|
@@ -36,16 +36,40 @@ function findCodeElement(nodes) {
|
|
|
36
36
|
else firstChild = null;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function createGutterWrapper(children) {
|
|
40
|
+
return createHastElement({
|
|
41
|
+
tagName: "div",
|
|
42
|
+
properties: { "data-gutter": "" },
|
|
43
|
+
children
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function createGutterItem(lineType, lineNumber, lineIndex) {
|
|
47
|
+
return createHastElement({
|
|
48
|
+
tagName: "div",
|
|
49
|
+
properties: {
|
|
50
|
+
"data-line-type": lineType,
|
|
51
|
+
"data-column-number": lineNumber,
|
|
52
|
+
"data-line-index": lineIndex
|
|
53
|
+
},
|
|
54
|
+
children: lineNumber != null ? [createHastElement({
|
|
55
|
+
tagName: "span",
|
|
56
|
+
properties: { "data-line-number-content": "" },
|
|
57
|
+
children: [createTextNodeElement(`${lineNumber}`)]
|
|
58
|
+
})] : void 0
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function createGutterGap(type, bufferType, size) {
|
|
40
62
|
return createHastElement({
|
|
41
63
|
tagName: "div",
|
|
42
64
|
properties: {
|
|
43
|
-
"data-
|
|
44
|
-
|
|
65
|
+
"data-gutter-buffer": bufferType,
|
|
66
|
+
"data-buffer-size": size,
|
|
67
|
+
"data-line-type": bufferType === "annotation" ? void 0 : type,
|
|
68
|
+
style: bufferType === "annotation" ? `grid-row: span ${size};` : `grid-row: span ${size};min-height:calc(${size} * 1lh);`
|
|
45
69
|
}
|
|
46
70
|
});
|
|
47
71
|
}
|
|
48
72
|
|
|
49
73
|
//#endregion
|
|
50
|
-
export {
|
|
74
|
+
export { createGutterGap, createGutterItem, createGutterWrapper, createHastElement, createIconElement, createTextNodeElement, findCodeElement };
|
|
51
75
|
//# sourceMappingURL=hast_utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hast_utils.js","names":["firstChild: RootContent | HASTElement | Root | null"],"sources":["../../src/utils/hast_utils.ts"],"sourcesContent":["import type {\n ElementContent,\n Element as HASTElement,\n Properties,\n Root,\n RootContent,\n Text,\n} from 'hast';\n\nimport type { SVGSpriteNames } from '../sprite';\n\nexport function createTextNodeElement(value: string): Text {\n return { type: 'text', value };\n}\n\ninterface CreateHastElementProps {\n tagName:\n | 'span'\n | 'div'\n | 'code'\n | 'pre'\n | 'slot'\n | 'svg'\n | 'use'\n | 'style'\n | 'template';\n children?: ElementContent[];\n properties?: Properties;\n}\n\nexport function createHastElement({\n tagName,\n children = [],\n properties = {},\n}: CreateHastElementProps): HASTElement {\n return {\n type: 'element',\n tagName,\n properties,\n children,\n };\n}\n\ninterface CreateIconProps {\n name: SVGSpriteNames;\n width?: number;\n height?: number;\n properties?: Properties;\n}\n\nexport function createIconElement({\n name,\n width = 16,\n height = 16,\n properties,\n}: CreateIconProps): HASTElement {\n return createHastElement({\n tagName: 'svg',\n properties: { width, height, viewBox: '0 0 16 16', ...properties },\n children: [\n createHastElement({\n tagName: 'use',\n properties: { href: `#${name.replace(/^#/, '')}` },\n }),\n ],\n });\n}\n\nexport function findCodeElement(\n nodes: Root | HASTElement\n): HASTElement | undefined {\n let firstChild: RootContent | HASTElement | Root | null = nodes.children[0];\n while (firstChild != null) {\n if (firstChild.type === 'element' && firstChild.tagName === 'code') {\n return firstChild;\n }\n if ('children' in firstChild) {\n firstChild = firstChild.children[0];\n } else {\n firstChild = null;\n }\n }\n return undefined;\n}\n\nexport function
|
|
1
|
+
{"version":3,"file":"hast_utils.js","names":["firstChild: RootContent | HASTElement | Root | null"],"sources":["../../src/utils/hast_utils.ts"],"sourcesContent":["import type {\n ElementContent,\n Element as HASTElement,\n Properties,\n Root,\n RootContent,\n Text,\n} from 'hast';\n\nimport type { SVGSpriteNames } from '../sprite';\nimport type { LineTypes } from '../types';\n\nexport function createTextNodeElement(value: string): Text {\n return { type: 'text', value };\n}\n\ninterface CreateHastElementProps {\n tagName:\n | 'span'\n | 'div'\n | 'code'\n | 'pre'\n | 'slot'\n | 'svg'\n | 'use'\n | 'style'\n | 'template';\n children?: ElementContent[];\n properties?: Properties;\n}\n\nexport function createHastElement({\n tagName,\n children = [],\n properties = {},\n}: CreateHastElementProps): HASTElement {\n return {\n type: 'element',\n tagName,\n properties,\n children,\n };\n}\n\ninterface CreateIconProps {\n name: SVGSpriteNames;\n width?: number;\n height?: number;\n properties?: Properties;\n}\n\nexport function createIconElement({\n name,\n width = 16,\n height = 16,\n properties,\n}: CreateIconProps): HASTElement {\n return createHastElement({\n tagName: 'svg',\n properties: { width, height, viewBox: '0 0 16 16', ...properties },\n children: [\n createHastElement({\n tagName: 'use',\n properties: { href: `#${name.replace(/^#/, '')}` },\n }),\n ],\n });\n}\n\nexport function findCodeElement(\n nodes: Root | HASTElement\n): HASTElement | undefined {\n let firstChild: RootContent | HASTElement | Root | null = nodes.children[0];\n while (firstChild != null) {\n if (firstChild.type === 'element' && firstChild.tagName === 'code') {\n return firstChild;\n }\n if ('children' in firstChild) {\n firstChild = firstChild.children[0];\n } else {\n firstChild = null;\n }\n }\n return undefined;\n}\n\nexport function createGutterWrapper(children?: ElementContent[]): HASTElement {\n return createHastElement({\n tagName: 'div',\n properties: { 'data-gutter': '' },\n children,\n });\n}\n\nexport function createGutterItem(\n lineType: LineTypes | 'buffer' | 'separator' | 'annotation',\n lineNumber: number,\n lineIndex: string\n): HASTElement {\n return createHastElement({\n tagName: 'div',\n properties: {\n 'data-line-type': lineType,\n 'data-column-number': lineNumber,\n 'data-line-index': lineIndex,\n },\n children:\n lineNumber != null\n ? [\n createHastElement({\n tagName: 'span',\n properties: { 'data-line-number-content': '' },\n children: [createTextNodeElement(`${lineNumber}`)],\n }),\n ]\n : undefined,\n });\n}\n\nexport function createGutterGap(\n type: LineTypes | undefined,\n bufferType: 'annotation' | 'buffer' | 'metadata',\n size: number\n): HASTElement {\n return createHastElement({\n tagName: 'div',\n properties: {\n 'data-gutter-buffer': bufferType,\n 'data-buffer-size': size,\n 'data-line-type': bufferType === 'annotation' ? undefined : type,\n style:\n bufferType === 'annotation'\n ? `grid-row: span ${size};`\n : `grid-row: span ${size};min-height:calc(${size} * 1lh);`,\n },\n });\n}\n"],"mappings":";AAYA,SAAgB,sBAAsB,OAAqB;AACzD,QAAO;EAAE,MAAM;EAAQ;EAAO;;AAkBhC,SAAgB,kBAAkB,EAChC,SACA,WAAW,EAAE,EACb,aAAa,EAAE,IACuB;AACtC,QAAO;EACL,MAAM;EACN;EACA;EACA;EACD;;AAUH,SAAgB,kBAAkB,EAChC,MACA,QAAQ,IACR,SAAS,IACT,cAC+B;AAC/B,QAAO,kBAAkB;EACvB,SAAS;EACT,YAAY;GAAE;GAAO;GAAQ,SAAS;GAAa,GAAG;GAAY;EAClE,UAAU,CACR,kBAAkB;GAChB,SAAS;GACT,YAAY,EAAE,MAAM,IAAI,KAAK,QAAQ,MAAM,GAAG,IAAI;GACnD,CAAC,CACH;EACF,CAAC;;AAGJ,SAAgB,gBACd,OACyB;CACzB,IAAIA,aAAsD,MAAM,SAAS;AACzE,QAAO,cAAc,MAAM;AACzB,MAAI,WAAW,SAAS,aAAa,WAAW,YAAY,OAC1D,QAAO;AAET,MAAI,cAAc,WAChB,cAAa,WAAW,SAAS;MAEjC,cAAa;;;AAMnB,SAAgB,oBAAoB,UAA0C;AAC5E,QAAO,kBAAkB;EACvB,SAAS;EACT,YAAY,EAAE,eAAe,IAAI;EACjC;EACD,CAAC;;AAGJ,SAAgB,iBACd,UACA,YACA,WACa;AACb,QAAO,kBAAkB;EACvB,SAAS;EACT,YAAY;GACV,kBAAkB;GAClB,sBAAsB;GACtB,mBAAmB;GACpB;EACD,UACE,cAAc,OACV,CACE,kBAAkB;GAChB,SAAS;GACT,YAAY,EAAE,4BAA4B,IAAI;GAC9C,UAAU,CAAC,sBAAsB,GAAG,aAAa,CAAC;GACnD,CAAC,CACH,GACD;EACP,CAAC;;AAGJ,SAAgB,gBACd,MACA,YACA,MACa;AACb,QAAO,kBAAkB;EACvB,SAAS;EACT,YAAY;GACV,sBAAsB;GACtB,oBAAoB;GACpB,kBAAkB,eAAe,eAAe,SAAY;GAC5D,OACE,eAAe,eACX,kBAAkB,KAAK,KACvB,kBAAkB,KAAK,mBAAmB,KAAK;GACtD;EACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isDefaultRenderRange.d.ts","names":[],"sources":["../../src/utils/isDefaultRenderRange.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"isDefaultRenderRange.d.ts","names":["RenderRange","isDefaultRenderRange"],"sources":["../../src/utils/isDefaultRenderRange.d.ts"],"sourcesContent":["import type { RenderRange } from '../types';\nexport declare function isDefaultRenderRange(renderRange: RenderRange): boolean;\n//# sourceMappingURL=isDefaultRenderRange.d.ts.map"],"mappings":";;;iBACwBC,oBAAAA,cAAkCD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isWorkerContext.d.ts","names":[],"sources":["../../src/utils/isWorkerContext.ts"],"sourcesContent":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"isWorkerContext.d.ts","names":["isWorkerContext"],"sources":["../../src/utils/isWorkerContext.d.ts"],"sourcesContent":["export declare function isWorkerContext(): boolean;\n//# sourceMappingURL=isWorkerContext.d.ts.map"],"mappings":";iBAAwBA,eAAAA,CAAAA"}
|
|
@@ -1,26 +1,39 @@
|
|
|
1
1
|
import { FileDiffMetadata, Hunk, HunkExpansionRegion } from "../types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/iterateOverDiff.d.ts
|
|
4
|
-
interface
|
|
4
|
+
interface DiffLineMetadata {
|
|
5
|
+
unifiedLineIndex: number;
|
|
6
|
+
splitLineIndex: number;
|
|
7
|
+
lineIndex: number;
|
|
8
|
+
lineNumber: number;
|
|
9
|
+
noEOFCR: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface DiffLineCallbackBase {
|
|
5
12
|
hunkIndex: number;
|
|
6
13
|
hunk: Hunk | undefined;
|
|
7
14
|
collapsedBefore: number;
|
|
8
15
|
collapsedAfter: number;
|
|
9
|
-
unifiedDeletionLineIndex: number | undefined;
|
|
10
|
-
unifiedAdditionLineIndex: number | undefined;
|
|
11
|
-
splitLineIndex: number;
|
|
12
|
-
additionLineIndex: number | undefined;
|
|
13
|
-
deletionLineIndex: number | undefined;
|
|
14
|
-
additionLineNumber: number | undefined;
|
|
15
|
-
deletionLineNumber: number | undefined;
|
|
16
|
-
type: "context" | "context-expanded" | "change";
|
|
17
|
-
noEOFCRAddition: boolean;
|
|
18
|
-
noEOFCRDeletion: boolean;
|
|
19
16
|
}
|
|
17
|
+
interface DiffLineCallbackContextChange extends DiffLineCallbackBase {
|
|
18
|
+
type: 'change' | 'context' | 'context-expanded';
|
|
19
|
+
deletionLine: DiffLineMetadata;
|
|
20
|
+
additionLine: DiffLineMetadata;
|
|
21
|
+
}
|
|
22
|
+
interface DiffLineCallbackChangeDeletion extends DiffLineCallbackBase {
|
|
23
|
+
type: 'change';
|
|
24
|
+
deletionLine: DiffLineMetadata;
|
|
25
|
+
additionLine?: undefined;
|
|
26
|
+
}
|
|
27
|
+
interface DiffLineCallbackChangeAddition extends DiffLineCallbackBase {
|
|
28
|
+
type: 'change';
|
|
29
|
+
deletionLine?: undefined;
|
|
30
|
+
additionLine: DiffLineMetadata;
|
|
31
|
+
}
|
|
32
|
+
type DiffLineCallbackProps = DiffLineCallbackContextChange | DiffLineCallbackChangeDeletion | DiffLineCallbackChangeAddition;
|
|
20
33
|
type DiffLineCallback = (props: DiffLineCallbackProps) => boolean | void;
|
|
21
34
|
interface IterateOverDiffProps {
|
|
22
35
|
diff: FileDiffMetadata;
|
|
23
|
-
diffStyle:
|
|
36
|
+
diffStyle: 'unified' | 'split' | 'both';
|
|
24
37
|
startingLine?: number;
|
|
25
38
|
totalLines?: number;
|
|
26
39
|
expandedHunks?: Map<number, HunkExpansionRegion> | true;
|
|
@@ -37,5 +50,5 @@ declare function iterateOverDiff({
|
|
|
37
50
|
callback
|
|
38
51
|
}: IterateOverDiffProps): void;
|
|
39
52
|
//#endregion
|
|
40
|
-
export { DiffLineCallback, DiffLineCallbackProps, IterateOverDiffProps, iterateOverDiff };
|
|
53
|
+
export { DiffLineCallback, DiffLineCallbackBase, DiffLineCallbackProps, DiffLineMetadata, IterateOverDiffProps, iterateOverDiff };
|
|
41
54
|
//# sourceMappingURL=iterateOverDiff.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iterateOverDiff.d.ts","names":[],"sources":["../../src/utils/iterateOverDiff.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"iterateOverDiff.d.ts","names":["FileDiffMetadata","Hunk","HunkExpansionRegion","DiffLineMetadata","DiffLineCallbackBase","DiffLineCallbackContextChange","DiffLineCallbackChangeDeletion","DiffLineCallbackChangeAddition","DiffLineCallbackProps","DiffLineCallback","IterateOverDiffProps","Map","iterateOverDiff","diff","diffStyle","startingLine","totalLines","expandedHunks","collapsedContextThreshold","callback"],"sources":["../../src/utils/iterateOverDiff.d.ts"],"sourcesContent":["import type { FileDiffMetadata, Hunk, HunkExpansionRegion } from '../types';\nexport interface DiffLineMetadata {\n unifiedLineIndex: number;\n splitLineIndex: number;\n lineIndex: number;\n lineNumber: number;\n noEOFCR: boolean;\n}\nexport interface DiffLineCallbackBase {\n hunkIndex: number;\n hunk: Hunk | undefined;\n collapsedBefore: number;\n collapsedAfter: number;\n}\ninterface DiffLineCallbackContextChange extends DiffLineCallbackBase {\n type: 'change' | 'context' | 'context-expanded';\n deletionLine: DiffLineMetadata;\n additionLine: DiffLineMetadata;\n}\ninterface DiffLineCallbackChangeDeletion extends DiffLineCallbackBase {\n type: 'change';\n deletionLine: DiffLineMetadata;\n additionLine?: undefined;\n}\ninterface DiffLineCallbackChangeAddition extends DiffLineCallbackBase {\n type: 'change';\n deletionLine?: undefined;\n additionLine: DiffLineMetadata;\n}\nexport type DiffLineCallbackProps = DiffLineCallbackContextChange | DiffLineCallbackChangeDeletion | DiffLineCallbackChangeAddition;\nexport type DiffLineCallback = (props: DiffLineCallbackProps) => boolean | void;\nexport interface IterateOverDiffProps {\n diff: FileDiffMetadata;\n diffStyle: 'unified' | 'split' | 'both';\n startingLine?: number;\n totalLines?: number;\n expandedHunks?: Map<number, HunkExpansionRegion> | true;\n collapsedContextThreshold?: number;\n callback: DiffLineCallback;\n}\nexport declare function iterateOverDiff({ diff, diffStyle, startingLine, totalLines, expandedHunks, collapsedContextThreshold, callback }: IterateOverDiffProps): void;\nexport {};\n//# sourceMappingURL=iterateOverDiff.d.ts.map"],"mappings":";;;UACiBG,gBAAAA;;EAAAA,cAAAA,EAAAA,MAAgB;EAOhBC,SAAAA,EAAAA,MAAAA;EAMPC,UAAAA,EAAAA,MAAAA;EAEQF,OAAAA,EAAAA,OAAAA;;AAF8BC,UAN/BA,oBAAAA,CAM+BA;EAAoB,SAAA,EAAA,MAAA;EAK1DE,IAAAA,EATAL,IASAK,GAAAA,SAAAA;EAKAC,eAAAA,EAAAA,MAAAA;EAKEC,cAAAA,EAAAA,MAAAA;;UAfFH,6BAAAA,SAAsCD,oBAeoBE,CAAAA;EAAiCC,IAAAA,EAAAA,QAAAA,GAAAA,SAAAA,GAAAA,kBAAAA;EAA8B,YAAA,EAbjHJ,gBAaiH;EACvHM,YAAAA,EAbMN,gBAaU;AAC5B;UAZUG,8BAAAA,SAAuCF,oBAavCJ,CAAAA;EAIsBE,IAAAA,EAAAA,QAAAA;EAAZS,YAAAA,EAfFR,gBAeEQ;EAENF,YAAAA,CAAAA,EAAAA,SAAAA;;AAEd,UAhBUF,8BAAAA,SAAuCH,oBAgBV,CAAA;EAAGS,IAAAA,EAAAA,QAAAA;EAAMC,YAAAA,CAAAA,EAAAA,SAAAA;EAAWC,YAAAA,EAbzCZ,gBAayCY;;AAA0BE,KAXzET,qBAAAA,GAAwBH,6BAWiDY,GAXjBX,8BAWiBW,GAXgBV,8BAWhBU;AAAeC,KAVxFT,gBAAAA,GAUwFS,CAAAA,KAAAA,EAV7DV,qBAU6DU,EAAAA,GAAAA,OAAAA,GAAAA,IAAAA;AAA2BC,UAT9GT,oBAAAA,CAS8GS;EAAYT,IAAAA,EARjIV,gBAQiIU;EAAoB,SAAA,EAAA,SAAA,GAAA,OAAA,GAAA,MAAA;;;kBAJ3IC,YAAYT;;YAElBO;;iBAEUG,eAAAA;;;;;;;;GAAmHF"}
|
|
@@ -88,16 +88,21 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
88
88
|
hunk,
|
|
89
89
|
collapsedBefore: 0,
|
|
90
90
|
collapsedAfter: 0,
|
|
91
|
-
unifiedDeletionLineIndex: unifiedLineIndex$1 + index,
|
|
92
|
-
unifiedAdditionLineIndex: unifiedLineIndex$1 + index,
|
|
93
|
-
splitLineIndex: splitLineIndex$1 + index,
|
|
94
|
-
deletionLineIndex: deletionLineIndex$1 + index,
|
|
95
|
-
additionLineIndex: additionLineIndex$1 + index,
|
|
96
|
-
deletionLineNumber: deletionLineNumber$1 + index,
|
|
97
|
-
additionLineNumber: additionLineNumber$1 + index,
|
|
98
91
|
type: "context-expanded",
|
|
99
|
-
|
|
100
|
-
|
|
92
|
+
deletionLine: {
|
|
93
|
+
lineNumber: deletionLineNumber$1 + index,
|
|
94
|
+
lineIndex: deletionLineIndex$1 + index,
|
|
95
|
+
noEOFCR: false,
|
|
96
|
+
unifiedLineIndex: unifiedLineIndex$1 + index,
|
|
97
|
+
splitLineIndex: splitLineIndex$1 + index
|
|
98
|
+
},
|
|
99
|
+
additionLine: {
|
|
100
|
+
unifiedLineIndex: unifiedLineIndex$1 + index,
|
|
101
|
+
splitLineIndex: splitLineIndex$1 + index,
|
|
102
|
+
lineIndex: additionLineIndex$1 + index,
|
|
103
|
+
lineNumber: additionLineNumber$1 + index,
|
|
104
|
+
noEOFCR: false
|
|
105
|
+
}
|
|
101
106
|
})) break hunkIterator;
|
|
102
107
|
} else state.incrementCounts(1, 1);
|
|
103
108
|
index++;
|
|
@@ -116,16 +121,21 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
116
121
|
hunk,
|
|
117
122
|
collapsedBefore: getPendingCollapsed(),
|
|
118
123
|
collapsedAfter: 0,
|
|
119
|
-
unifiedDeletionLineIndex: unifiedLineIndex$1 + index,
|
|
120
|
-
unifiedAdditionLineIndex: unifiedLineIndex$1 + index,
|
|
121
|
-
splitLineIndex: splitLineIndex$1 + index,
|
|
122
|
-
deletionLineIndex: deletionLineIndex$1 + index,
|
|
123
|
-
additionLineIndex: additionLineIndex$1 + index,
|
|
124
|
-
deletionLineNumber: deletionLineNumber$1 + index,
|
|
125
|
-
additionLineNumber: additionLineNumber$1 + index,
|
|
126
124
|
type: "context-expanded",
|
|
127
|
-
|
|
128
|
-
|
|
125
|
+
deletionLine: {
|
|
126
|
+
lineNumber: deletionLineNumber$1 + index,
|
|
127
|
+
lineIndex: deletionLineIndex$1 + index,
|
|
128
|
+
noEOFCR: false,
|
|
129
|
+
unifiedLineIndex: unifiedLineIndex$1 + index,
|
|
130
|
+
splitLineIndex: splitLineIndex$1 + index
|
|
131
|
+
},
|
|
132
|
+
additionLine: {
|
|
133
|
+
unifiedLineIndex: unifiedLineIndex$1 + index,
|
|
134
|
+
splitLineIndex: splitLineIndex$1 + index,
|
|
135
|
+
lineIndex: additionLineIndex$1 + index,
|
|
136
|
+
lineNumber: additionLineNumber$1 + index,
|
|
137
|
+
noEOFCR: false
|
|
138
|
+
}
|
|
129
139
|
})) break hunkIterator;
|
|
130
140
|
} else state.incrementCounts(1, 1);
|
|
131
141
|
index++;
|
|
@@ -157,16 +167,21 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
157
167
|
hunk,
|
|
158
168
|
collapsedBefore: getPendingCollapsed(),
|
|
159
169
|
collapsedAfter: getTrailingCollapsedAfter(unifiedRowIndex, splitRowIndex),
|
|
160
|
-
unifiedDeletionLineIndex: unifiedRowIndex,
|
|
161
|
-
unifiedAdditionLineIndex: unifiedRowIndex,
|
|
162
|
-
splitLineIndex: splitRowIndex,
|
|
163
|
-
deletionLineIndex: deletionLineIndex + index,
|
|
164
|
-
additionLineIndex: additionLineIndex + index,
|
|
165
|
-
deletionLineNumber: deletionLineNumber + index,
|
|
166
|
-
additionLineNumber: additionLineNumber + index,
|
|
167
170
|
type: "context",
|
|
168
|
-
|
|
169
|
-
|
|
171
|
+
deletionLine: {
|
|
172
|
+
lineNumber: deletionLineNumber + index,
|
|
173
|
+
lineIndex: deletionLineIndex + index,
|
|
174
|
+
noEOFCR: isLastLine && hunk.noEOFCRDeletions,
|
|
175
|
+
unifiedLineIndex: unifiedRowIndex,
|
|
176
|
+
splitLineIndex: splitRowIndex
|
|
177
|
+
},
|
|
178
|
+
additionLine: {
|
|
179
|
+
unifiedLineIndex: unifiedRowIndex,
|
|
180
|
+
splitLineIndex: splitRowIndex,
|
|
181
|
+
lineIndex: additionLineIndex + index,
|
|
182
|
+
lineNumber: additionLineNumber + index,
|
|
183
|
+
noEOFCR: isLastLine && hunk.noEOFCRAdditions
|
|
184
|
+
}
|
|
170
185
|
})) break hunkIterator;
|
|
171
186
|
} else state.incrementCounts(1, 1);
|
|
172
187
|
index++;
|
|
@@ -231,16 +246,21 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
231
246
|
hunk: void 0,
|
|
232
247
|
collapsedBefore: 0,
|
|
233
248
|
collapsedAfter: isLastLine ? collapsedLines : 0,
|
|
234
|
-
unifiedDeletionLineIndex: unifiedLineIndex + index,
|
|
235
|
-
unifiedAdditionLineIndex: unifiedLineIndex + index,
|
|
236
|
-
splitLineIndex: splitLineIndex + index,
|
|
237
|
-
additionLineIndex: additionLineIndex + index,
|
|
238
|
-
deletionLineIndex: deletionLineIndex + index,
|
|
239
|
-
additionLineNumber: additionLineNumber + index,
|
|
240
|
-
deletionLineNumber: deletionLineNumber + index,
|
|
241
249
|
type: "context-expanded",
|
|
242
|
-
|
|
243
|
-
|
|
250
|
+
deletionLine: {
|
|
251
|
+
lineNumber: deletionLineNumber + index,
|
|
252
|
+
lineIndex: deletionLineIndex + index,
|
|
253
|
+
noEOFCR: false,
|
|
254
|
+
unifiedLineIndex: unifiedLineIndex + index,
|
|
255
|
+
splitLineIndex: splitLineIndex + index
|
|
256
|
+
},
|
|
257
|
+
additionLine: {
|
|
258
|
+
unifiedLineIndex: unifiedLineIndex + index,
|
|
259
|
+
splitLineIndex: splitLineIndex + index,
|
|
260
|
+
lineIndex: additionLineIndex + index,
|
|
261
|
+
lineNumber: additionLineNumber + index,
|
|
262
|
+
noEOFCR: false
|
|
263
|
+
}
|
|
244
264
|
})) break hunkIterator;
|
|
245
265
|
} else state.incrementCounts(1, 1);
|
|
246
266
|
index++;
|
|
@@ -319,37 +339,56 @@ function getChangeIterationRanges(state, content, diffStyle) {
|
|
|
319
339
|
return merged;
|
|
320
340
|
}
|
|
321
341
|
function getChangeLineData({ hunkIndex, hunk, collapsedAfter, collapsedBefore, diffStyle, index, unifiedLineIndex, splitLineIndex, additionLineIndex, deletionLineIndex, additionLineNumber, deletionLineNumber, content, isLastContent, unifiedCount, splitCount }) {
|
|
322
|
-
|
|
342
|
+
const unifiedDeletionLineIndex = index < content.deletions ? unifiedLineIndex + index : void 0;
|
|
343
|
+
const unifiedAdditionLineIndex = diffStyle === "unified" ? index >= content.deletions ? unifiedLineIndex + index : void 0 : index < content.additions ? unifiedLineIndex + content.deletions + index : void 0;
|
|
344
|
+
const resolvedSplitLineIndex = diffStyle === "unified" ? splitLineIndex + (index < content.deletions ? index : index - content.deletions) : splitLineIndex + index;
|
|
345
|
+
const deletionLineIndexValue = index < content.deletions ? deletionLineIndex + index : void 0;
|
|
346
|
+
const deletionLineNumberValue = index < content.deletions ? deletionLineNumber + index : void 0;
|
|
347
|
+
const additionLineIndexValue = diffStyle === "unified" ? index >= content.deletions ? additionLineIndex + (index - content.deletions) : void 0 : index < content.additions ? additionLineIndex + index : void 0;
|
|
348
|
+
const additionLineNumberValue = diffStyle === "unified" ? index >= content.deletions ? additionLineNumber + (index - content.deletions) : void 0 : index < content.additions ? additionLineNumber + index : void 0;
|
|
349
|
+
const noEOFCRDeletion = diffStyle === "unified" ? isLastContent && index === content.deletions - 1 && hunk.noEOFCRDeletions : isLastContent && index === splitCount - 1 && hunk.noEOFCRDeletions;
|
|
350
|
+
const noEOFCRAddition = diffStyle === "unified" ? isLastContent && index === unifiedCount - 1 && hunk.noEOFCRAdditions : isLastContent && index === splitCount - 1 && hunk.noEOFCRAdditions;
|
|
351
|
+
const deletionLine = deletionLineIndexValue != null && deletionLineNumberValue != null && unifiedDeletionLineIndex != null ? {
|
|
352
|
+
lineNumber: deletionLineNumberValue,
|
|
353
|
+
lineIndex: deletionLineIndexValue,
|
|
354
|
+
noEOFCR: noEOFCRDeletion,
|
|
355
|
+
unifiedLineIndex: unifiedDeletionLineIndex,
|
|
356
|
+
splitLineIndex: resolvedSplitLineIndex
|
|
357
|
+
} : void 0;
|
|
358
|
+
const additionLine = additionLineIndexValue != null && additionLineNumberValue != null && unifiedAdditionLineIndex != null ? {
|
|
359
|
+
unifiedLineIndex: unifiedAdditionLineIndex,
|
|
360
|
+
splitLineIndex: resolvedSplitLineIndex,
|
|
361
|
+
lineIndex: additionLineIndexValue,
|
|
362
|
+
lineNumber: additionLineNumberValue,
|
|
363
|
+
noEOFCR: noEOFCRAddition
|
|
364
|
+
} : void 0;
|
|
365
|
+
if (deletionLine == null && additionLine != null) return {
|
|
323
366
|
type: "change",
|
|
324
367
|
hunkIndex,
|
|
325
368
|
hunk,
|
|
326
369
|
collapsedAfter,
|
|
327
370
|
collapsedBefore,
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
splitLineIndex: splitLineIndex + (index < content.deletions ? index : index - content.deletions),
|
|
331
|
-
additionLineIndex: index >= content.deletions ? additionLineIndex + (index - content.deletions) : void 0,
|
|
332
|
-
additionLineNumber: index >= content.deletions ? additionLineNumber + (index - content.deletions) : void 0,
|
|
333
|
-
deletionLineIndex: index < content.deletions ? deletionLineIndex + index : void 0,
|
|
334
|
-
deletionLineNumber: index < content.deletions ? deletionLineNumber + index : void 0,
|
|
335
|
-
noEOFCRDeletion: isLastContent && index === content.deletions - 1 && hunk.noEOFCRDeletions,
|
|
336
|
-
noEOFCRAddition: isLastContent && index === unifiedCount - 1 && hunk.noEOFCRAdditions
|
|
371
|
+
deletionLine: void 0,
|
|
372
|
+
additionLine
|
|
337
373
|
};
|
|
374
|
+
else if (deletionLine != null && additionLine == null) return {
|
|
375
|
+
type: "change",
|
|
376
|
+
hunkIndex,
|
|
377
|
+
hunk,
|
|
378
|
+
collapsedAfter,
|
|
379
|
+
collapsedBefore,
|
|
380
|
+
deletionLine,
|
|
381
|
+
additionLine: void 0
|
|
382
|
+
};
|
|
383
|
+
if (deletionLine == null || additionLine == null) throw new Error("iterateOverDiff: missing change line data");
|
|
338
384
|
return {
|
|
339
385
|
type: "change",
|
|
340
386
|
hunkIndex,
|
|
341
387
|
hunk,
|
|
342
388
|
collapsedAfter,
|
|
343
389
|
collapsedBefore,
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
splitLineIndex: splitLineIndex + index,
|
|
347
|
-
additionLineIndex: index < content.additions ? additionLineIndex + index : void 0,
|
|
348
|
-
additionLineNumber: index < content.additions ? additionLineNumber + index : void 0,
|
|
349
|
-
deletionLineIndex: index < content.deletions ? deletionLineIndex + index : void 0,
|
|
350
|
-
deletionLineNumber: index < content.deletions ? deletionLineNumber + index : void 0,
|
|
351
|
-
noEOFCRDeletion: isLastContent && index === splitCount - 1 && hunk.noEOFCRDeletions,
|
|
352
|
-
noEOFCRAddition: isLastContent && index === splitCount - 1 && hunk.noEOFCRAdditions
|
|
390
|
+
deletionLine,
|
|
391
|
+
additionLine
|
|
353
392
|
};
|
|
354
393
|
}
|
|
355
394
|
|