@pierre/diffs 1.1.0-beta.1 → 1.1.0-beta.10
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 +60 -29
- package/dist/components/File.d.ts.map +1 -1
- package/dist/components/File.js +226 -26
- package/dist/components/File.js.map +1 -1
- package/dist/components/FileDiff.d.ts +44 -12
- package/dist/components/FileDiff.d.ts.map +1 -1
- package/dist/components/FileDiff.js +510 -71
- 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 +6 -8
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +16 -7
- 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 +3 -1
- package/dist/highlighter/languages/constants.d.ts.map +1 -1
- package/dist/highlighter/languages/constants.js +2 -1
- package/dist/highlighter/languages/constants.js.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 +19 -0
- package/dist/highlighter/languages/registerCustomLanguage.d.ts.map +1 -0
- package/dist/highlighter/languages/registerCustomLanguage.js +21 -0
- package/dist/highlighter/languages/registerCustomLanguage.js.map +1 -0
- package/dist/highlighter/languages/resolveLanguage.d.ts +1 -1
- package/dist/highlighter/languages/resolveLanguage.d.ts.map +1 -1
- package/dist/highlighter/languages/resolveLanguage.js +4 -3
- package/dist/highlighter/languages/resolveLanguage.js.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 +17 -12
- package/dist/index.js +14 -9
- 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 +249 -140
- 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 +198 -165
- 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 +2 -2
- 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 +2 -1
- package/dist/utils/getFiletypeFromFileName.d.ts.map +1 -1
- package/dist/utils/getFiletypeFromFileName.js +14 -4
- package/dist/utils/getFiletypeFromFileName.js.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 +28 -13
- package/dist/utils/iterateOverDiff.d.ts.map +1 -1
- package/dist/utils/iterateOverDiff.js +101 -60
- 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 +20 -11
- 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 +4 -3
- package/dist/utils/renderDiffWithHighlighter.d.ts.map +1 -1
- package/dist/utils/renderDiffWithHighlighter.js +18 -16
- 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 +25 -0
- package/dist/utils/resolveVirtualFileMetrics.js.map +1 -0
- package/dist/utils/setLanguageOverride.d.ts +2 -1
- package/dist/utils/setLanguageOverride.d.ts.map +1 -1
- package/dist/utils/setLanguageOverride.js.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 +11 -0
- package/dist/utils/trimPatchContext.d.ts.map +1 -0
- package/dist/utils/trimPatchContext.js +99 -0
- package/dist/utils/trimPatchContext.js.map +1 -0
- package/dist/worker/WorkerPoolManager.d.ts +3 -3
- package/dist/worker/WorkerPoolManager.d.ts.map +1 -1
- package/dist/worker/WorkerPoolManager.js +39 -26
- 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 +352 -154
- package/dist/worker/worker-portable.js.map +1 -1
- package/dist/worker/worker.js +222 -113
- package/dist/worker/worker.js.map +1 -1
- package/package.json +52 -53
package/dist/types.d.ts
CHANGED
|
@@ -4,163 +4,163 @@ import { ElementContent } from "hast";
|
|
|
4
4
|
//#region src/types.d.ts
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Represents a file's contents for generating diffs via `parseDiffFromFile` or
|
|
8
|
-
* for when rendering a file directly using the File components
|
|
9
|
-
*/
|
|
7
|
+
* Represents a file's contents for generating diffs via `parseDiffFromFile` or
|
|
8
|
+
* for when rendering a file directly using the File components
|
|
9
|
+
*/
|
|
10
10
|
interface FileContents {
|
|
11
11
|
/** Filename used for display in headers and for inferring the language for
|
|
12
|
-
|
|
12
|
+
* syntax highlighting. */
|
|
13
13
|
name: string;
|
|
14
14
|
/** The raw text contents of the file. */
|
|
15
15
|
contents: string;
|
|
16
16
|
/** Explicitly set the syntax highlighting language instead of inferring from
|
|
17
|
-
|
|
17
|
+
* filename. Generally you should not be setting this. */
|
|
18
18
|
lang?: SupportedLanguages;
|
|
19
19
|
/** Optional header passed to the jsdiff library's `createTwoFilesPatch`. */
|
|
20
20
|
header?: string;
|
|
21
21
|
/** This unique key is only used for Worker Pools to avoid subsequent requests
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
* if we've already highlighted the file. Please note that if you modify the
|
|
23
|
+
* `contents` or `name`, you must update the `cacheKey`. */
|
|
24
24
|
cacheKey?: string;
|
|
25
25
|
}
|
|
26
|
-
type DiffsThemeNames = BundledTheme |
|
|
27
|
-
type ThemesType = Record<
|
|
26
|
+
type DiffsThemeNames = BundledTheme | 'pierre-dark' | 'pierre-light' | (string & {});
|
|
27
|
+
type ThemesType = Record<'dark' | 'light', DiffsThemeNames>;
|
|
28
28
|
/**
|
|
29
|
-
* A Shiki highlighter instance configured with the library's supported
|
|
30
|
-
* languages and themes. Used internally to generate syntax-highlighted AST
|
|
31
|
-
* from file contents. By default diffs will ensure that only 1 highlighter is
|
|
32
|
-
* instantiated per thread and shared for all syntax highlighting. This
|
|
33
|
-
* applies to the main thread and worker threads.
|
|
34
|
-
*/
|
|
29
|
+
* A Shiki highlighter instance configured with the library's supported
|
|
30
|
+
* languages and themes. Used internally to generate syntax-highlighted AST
|
|
31
|
+
* from file contents. By default diffs will ensure that only 1 highlighter is
|
|
32
|
+
* instantiated per thread and shared for all syntax highlighting. This
|
|
33
|
+
* applies to the main thread and worker threads.
|
|
34
|
+
*/
|
|
35
35
|
type DiffsHighlighter = HighlighterGeneric<SupportedLanguages, DiffsThemeNames>;
|
|
36
36
|
/**
|
|
37
|
-
* Describes the type of change for a file in a diff.
|
|
38
|
-
* - `change`: File content was modified, name unchanged.
|
|
39
|
-
* - `rename-pure`: File was renamed/moved without content changes (100% similarity).
|
|
40
|
-
* - `rename-changed`: File was renamed/moved and content was also modified.
|
|
41
|
-
* - `new`: A new file was added.
|
|
42
|
-
* - `deleted`: An existing file was removed.
|
|
43
|
-
*/
|
|
44
|
-
type ChangeTypes =
|
|
37
|
+
* Describes the type of change for a file in a diff.
|
|
38
|
+
* - `change`: File content was modified, name unchanged.
|
|
39
|
+
* - `rename-pure`: File was renamed/moved without content changes (100% similarity).
|
|
40
|
+
* - `rename-changed`: File was renamed/moved and content was also modified.
|
|
41
|
+
* - `new`: A new file was added.
|
|
42
|
+
* - `deleted`: An existing file was removed.
|
|
43
|
+
*/
|
|
44
|
+
type ChangeTypes = 'change' | 'rename-pure' | 'rename-changed' | 'new' | 'deleted';
|
|
45
45
|
/**
|
|
46
|
-
* Represents a parsed patch file, typically corresponding to a single commit.
|
|
47
|
-
* Returned by `parsePatchFiles` when parsing raw patch/diff strings.
|
|
48
|
-
*/
|
|
46
|
+
* Represents a parsed patch file, typically corresponding to a single commit.
|
|
47
|
+
* Returned by `parsePatchFiles` when parsing raw patch/diff strings.
|
|
48
|
+
*/
|
|
49
49
|
interface ParsedPatch {
|
|
50
50
|
/** Optional raw introductory text before the file diffs that may have been
|
|
51
|
-
|
|
51
|
+
* included in the patch (e.g., commit message, author, date). */
|
|
52
52
|
patchMetadata?: string;
|
|
53
53
|
/** Array of file changes contained in the patch. */
|
|
54
54
|
files: FileDiffMetadata[];
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
* Represents a block of unchanged context lines within a hunk. Basically a
|
|
58
|
-
* batch of lines in a hunk that are prefixed with a space ` `. Consecutive
|
|
59
|
-
* lines prefixed with a ` ` are grouped together into a single ContextContent.
|
|
60
|
-
*/
|
|
57
|
+
* Represents a block of unchanged context lines within a hunk. Basically a
|
|
58
|
+
* batch of lines in a hunk that are prefixed with a space ` `. Consecutive
|
|
59
|
+
* lines prefixed with a ` ` are grouped together into a single ContextContent.
|
|
60
|
+
*/
|
|
61
61
|
interface ContextContent {
|
|
62
|
-
type:
|
|
62
|
+
type: 'context';
|
|
63
63
|
/** Number of unchanged lines in this context block. */
|
|
64
64
|
lines: number;
|
|
65
65
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
* Zero-based index into `FileDiffMetadata.additionLines` where this context
|
|
67
|
+
* block starts.
|
|
68
|
+
*/
|
|
69
69
|
additionLineIndex: number;
|
|
70
70
|
/**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
* Zero-based index into `FileDiffMetadata.deletionLines` where this context
|
|
72
|
+
* block starts.
|
|
73
|
+
*/
|
|
74
74
|
deletionLineIndex: number;
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
|
-
* Represents a block of changes (additions and/or deletions) within a hunk.
|
|
78
|
-
* Consecutive `+` and `-` lines are grouped together into a single
|
|
79
|
-
* ChangeContent.
|
|
80
|
-
*/
|
|
77
|
+
* Represents a block of changes (additions and/or deletions) within a hunk.
|
|
78
|
+
* Consecutive `+` and `-` lines are grouped together into a single
|
|
79
|
+
* ChangeContent.
|
|
80
|
+
*/
|
|
81
81
|
interface ChangeContent {
|
|
82
|
-
type:
|
|
82
|
+
type: 'change';
|
|
83
83
|
/** Number of lines prefixed with `-` in this change block. */
|
|
84
84
|
deletions: number;
|
|
85
85
|
/**
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
* Zero-based index into `FileDiffMetadata.deletionLines` where the deleted
|
|
87
|
+
* lines start.
|
|
88
|
+
*/
|
|
89
89
|
deletionLineIndex: number;
|
|
90
90
|
/** Number of lines prefixed with `+` in this change block. */
|
|
91
91
|
additions: number;
|
|
92
92
|
/**
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
* Zero-based index into `FileDiffMetadata.additionLines` where the added
|
|
94
|
+
* lines start.
|
|
95
|
+
*/
|
|
96
96
|
additionLineIndex: number;
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
|
-
* Represents a single hunk from a diff, corresponding to
|
|
100
|
-
* one `@@ ... @@` block.
|
|
101
|
-
*/
|
|
99
|
+
* Represents a single hunk from a diff, corresponding to
|
|
100
|
+
* one `@@ ... @@` block.
|
|
101
|
+
*/
|
|
102
102
|
interface Hunk {
|
|
103
103
|
/**
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
* Number of unchanged lines between the previous hunk (or file start) and
|
|
105
|
+
* this hunk.
|
|
106
|
+
*/
|
|
107
107
|
collapsedBefore: number;
|
|
108
108
|
/**
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
* Starting line number in the new file version, parsed from the `+X`
|
|
110
|
+
* in the hunk header.
|
|
111
|
+
*/
|
|
112
112
|
additionStart: number;
|
|
113
113
|
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
* Total line count in the new file version for this hunk, parsed from
|
|
115
|
+
* `+X,count` in the hunk header. If this hunk was viewed in `diffStyle:
|
|
116
|
+
* split` this would correspond to the number of lines in the right
|
|
117
|
+
* `additions` column. It includes both `context` lines and lines
|
|
118
|
+
* prefixed with `+`.
|
|
119
|
+
*/
|
|
120
120
|
additionCount: number;
|
|
121
121
|
/** This corresponds to the number of lines prefixed with `+` in this hunk. */
|
|
122
122
|
additionLines: number;
|
|
123
123
|
/**
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
* Zero-based index into `FileDiffMetadata.additionLines` where this hunk's
|
|
125
|
+
* content starts.
|
|
126
|
+
*/
|
|
127
127
|
additionLineIndex: number;
|
|
128
128
|
/**
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
* Starting line number in the old file version, parsed from the `-X`
|
|
130
|
+
* in the hunk header.
|
|
131
|
+
*/
|
|
132
132
|
deletionStart: number;
|
|
133
133
|
/**
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
134
|
+
* Total line count in the old file version for this hunk, parsed from
|
|
135
|
+
* `-X,count` in the hunk header. If this hunk was viewed in `diffStyle:
|
|
136
|
+
* split` this would correspond to the number of lines in the left
|
|
137
|
+
* `deletions` column. It includes both `context` lines and lines
|
|
138
|
+
* prefixed with `-`.
|
|
139
|
+
*/
|
|
140
140
|
deletionCount: number;
|
|
141
141
|
/** This corresponds to the number of lines prefixed with `-` in this hunk. */
|
|
142
142
|
deletionLines: number;
|
|
143
143
|
/**
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
* Zero-based index into `FileDiffMetadata.deletionLines` where this hunk's
|
|
145
|
+
* content starts.
|
|
146
|
+
*/
|
|
147
147
|
deletionLineIndex: number;
|
|
148
148
|
/**
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
* Array of content segments within this hunk, each representing either
|
|
150
|
+
* a context line group or a change group.
|
|
151
|
+
*/
|
|
152
152
|
hunkContent: (ContextContent | ChangeContent)[];
|
|
153
153
|
/**
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
* Function/method name that appears after the `@@` markers if it existed in
|
|
155
|
+
* the diff.
|
|
156
|
+
*/
|
|
157
157
|
hunkContext?: string;
|
|
158
158
|
/** Raw hunk header string (e.g., `@@ -1,5 +1,7 @@`). */
|
|
159
159
|
hunkSpecs?: string;
|
|
160
160
|
/**
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
* Starting line index for this hunk when rendered in split (side-by-side)
|
|
162
|
+
* view.
|
|
163
|
+
*/
|
|
164
164
|
splitLineStart: number;
|
|
165
165
|
/** Total rendered line count for this hunk in split view. */
|
|
166
166
|
splitLineCount: number;
|
|
@@ -169,95 +169,110 @@ interface Hunk {
|
|
|
169
169
|
/** Total rendered line count for this hunk in unified view. */
|
|
170
170
|
unifiedLineCount: number;
|
|
171
171
|
/**
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
172
|
+
* True if the old file version has no trailing newline at end of file. This
|
|
173
|
+
* is parsed from the patch file directly at the end of the hunk. If the
|
|
174
|
+
* final hunkContent is a `context` group, then both values will be true or
|
|
175
|
+
* false together. If it's from a `change` content group, then it may differ
|
|
176
|
+
* depending on the patch.
|
|
177
|
+
*/
|
|
178
178
|
noEOFCRDeletions: boolean;
|
|
179
179
|
/**
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
180
|
+
* True if the new file version has no trailing newline at end of file. This
|
|
181
|
+
* is parsed from the patch file directly at the end of the hunk. If the
|
|
182
|
+
* final hunkContent is a `context` group, then both values will be true or
|
|
183
|
+
* false together. If it's from a `change` content group, then it may differ
|
|
184
|
+
* depending on the patch.
|
|
185
|
+
*/
|
|
186
186
|
noEOFCRAdditions: boolean;
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
|
-
* Metadata and content for a single file's diff. Think of this as a JSON
|
|
190
|
-
* compatible representation of a diff for a single file.
|
|
191
|
-
*/
|
|
189
|
+
* Metadata and content for a single file's diff. Think of this as a JSON
|
|
190
|
+
* compatible representation of a diff for a single file.
|
|
191
|
+
*/
|
|
192
192
|
interface FileDiffMetadata {
|
|
193
193
|
/** The file's name and path. */
|
|
194
194
|
name: string;
|
|
195
195
|
/** Previous file path, present only if file was renamed or moved. */
|
|
196
196
|
prevName?: string;
|
|
197
197
|
/**
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
198
|
+
* Explicitly override the syntax highlighting language instead of inferring
|
|
199
|
+
* from filename. This will never be set by default, since all internal diff
|
|
200
|
+
* APIs will attempt to detect the language automatically. If you'd like to
|
|
201
|
+
* specify a language override, you can do so via the method `setLanguageOverride`
|
|
202
|
+
*/
|
|
203
203
|
lang?: SupportedLanguages;
|
|
204
|
-
/**
|
|
205
|
-
|
|
204
|
+
/**
|
|
205
|
+
* Object ID for the new file content parsed from the `index` line in a
|
|
206
|
+
* patch file.
|
|
207
|
+
*/
|
|
208
|
+
newObjectId?: string;
|
|
209
|
+
/**
|
|
210
|
+
* Object ID for the previous file content parsed from the `index` line in a
|
|
211
|
+
* patch file.
|
|
212
|
+
*/
|
|
213
|
+
prevObjectId?: string;
|
|
214
|
+
/**
|
|
215
|
+
* Git file mode parsed from the diff (e.g., `100644` for regular files) when
|
|
216
|
+
* present in the patch metadata.
|
|
217
|
+
*/
|
|
206
218
|
mode?: string;
|
|
207
219
|
/** Previous git file mode, present if the mode changed. */
|
|
208
220
|
prevMode?: string;
|
|
209
221
|
/** The type of change for this file. */
|
|
210
222
|
type: ChangeTypes;
|
|
211
223
|
/** Array of diff hunks containing line-level change information. Each hunk
|
|
212
|
-
|
|
224
|
+
* corresponds to a `@@ -X,X +X,X @@` group in a diff. */
|
|
213
225
|
hunks: Hunk[];
|
|
214
226
|
/** Pre-computed line size for this diff if rendered in `split` diffStyle. */
|
|
215
227
|
splitLineCount: number;
|
|
216
228
|
/** Pre-computed line size for this diff if rendered in `unified` diffStyle. */
|
|
217
229
|
unifiedLineCount: number;
|
|
218
230
|
/**
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
231
|
+
* Whether the diff was parsed from a patch file (true) or generated from
|
|
232
|
+
* full file contents (false).
|
|
233
|
+
*
|
|
234
|
+
* When true, `deletionLines`/`additionLines` contain only the lines present
|
|
235
|
+
* in the patch and hunk expansion is unavailable.
|
|
236
|
+
*
|
|
237
|
+
* When false, they contain the complete file contents.
|
|
238
|
+
*/
|
|
227
239
|
isPartial: boolean;
|
|
228
240
|
/**
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
241
|
+
* Array of lines from previous version of the file. If `isPartial` is false,
|
|
242
|
+
* it means that `deletionLines` can be considered the entire contents of the
|
|
243
|
+
* old version of the file. Otherwise `deletionLines` will just be an array
|
|
244
|
+
* of all the content processed from the `context` and `deletion` lines of
|
|
245
|
+
* the patch.
|
|
246
|
+
*/
|
|
235
247
|
deletionLines: string[];
|
|
236
248
|
/**
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
249
|
+
* Array of lines from new version of the file. If `isPartial` is false, it
|
|
250
|
+
* means that `additionLines` can be considered the entire contents of the
|
|
251
|
+
* new version of the file. Otherwise `additionLines` will just be an array
|
|
252
|
+
* of all the content processed from the `context` and `addition` lines of
|
|
253
|
+
* the patch.
|
|
254
|
+
*/
|
|
243
255
|
additionLines: string[];
|
|
244
256
|
/**
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
257
|
+
* This unique key is only used for Worker Pools to avoid subsequent requests
|
|
258
|
+
* to highlight if we've already highlighted the diff. Please note that if
|
|
259
|
+
* you modify the contents of the diff in any way, you will need to update
|
|
260
|
+
* the `cacheKey`.
|
|
261
|
+
*/
|
|
250
262
|
cacheKey?: string;
|
|
251
263
|
}
|
|
252
|
-
type SupportedLanguages = BundledLanguage |
|
|
253
|
-
type HunkLineType =
|
|
254
|
-
type ThemeTypes =
|
|
255
|
-
|
|
256
|
-
|
|
264
|
+
type SupportedLanguages = BundledLanguage | 'text' | 'ansi' | (string & {});
|
|
265
|
+
type HunkLineType = 'context' | 'expanded' | 'addition' | 'deletion' | 'metadata';
|
|
266
|
+
type ThemeTypes = 'system' | 'light' | 'dark';
|
|
267
|
+
/**
|
|
268
|
+
* The `'custom'` variant is deprecated and will be removed in a future version.
|
|
269
|
+
*/
|
|
270
|
+
type HunkSeparators = 'simple' | 'metadata' | 'line-info' | 'line-info-basic' | 'custom';
|
|
271
|
+
type LineDiffTypes = 'word-alt' | 'word' | 'char' | 'none';
|
|
257
272
|
interface BaseCodeOptions {
|
|
258
273
|
theme?: DiffsThemeNames | ThemesType;
|
|
259
274
|
disableLineNumbers?: boolean;
|
|
260
|
-
overflow?:
|
|
275
|
+
overflow?: 'scroll' | 'wrap';
|
|
261
276
|
themeType?: ThemeTypes;
|
|
262
277
|
disableFileHeader?: boolean;
|
|
263
278
|
disableVirtualizationBuffers?: boolean;
|
|
@@ -266,16 +281,18 @@ interface BaseCodeOptions {
|
|
|
266
281
|
unsafeCSS?: string;
|
|
267
282
|
}
|
|
268
283
|
interface BaseDiffOptions extends BaseCodeOptions {
|
|
269
|
-
diffStyle?:
|
|
270
|
-
diffIndicators?:
|
|
284
|
+
diffStyle?: 'unified' | 'split';
|
|
285
|
+
diffIndicators?: 'classic' | 'bars' | 'none';
|
|
271
286
|
disableBackground?: boolean;
|
|
272
287
|
hunkSeparators?: HunkSeparators;
|
|
273
288
|
expandUnchanged?: boolean;
|
|
289
|
+
collapsedContextThreshold?: number;
|
|
274
290
|
lineDiffType?: LineDiffTypes;
|
|
275
291
|
maxLineDiffLength?: number;
|
|
276
292
|
expansionLineCount?: number;
|
|
277
293
|
}
|
|
278
|
-
interface PrePropertiesConfig extends Required<Pick<BaseDiffOptions,
|
|
294
|
+
interface PrePropertiesConfig extends Required<Pick<BaseDiffOptions, 'diffIndicators' | 'disableBackground' | 'disableLineNumbers' | 'overflow' | 'themeType'>> {
|
|
295
|
+
type: 'diff' | 'file';
|
|
279
296
|
split: boolean;
|
|
280
297
|
themeStyles: string;
|
|
281
298
|
totalLines: number;
|
|
@@ -288,7 +305,8 @@ interface RenderHeaderMetadataProps {
|
|
|
288
305
|
type RenderHeaderMetadataCallback = (props: RenderHeaderMetadataProps) => Element | null | undefined | string | number;
|
|
289
306
|
type RenderFileMetadata = (file: FileContents) => Element | null | undefined | string | number;
|
|
290
307
|
type ExtensionFormatMap = Record<string, SupportedLanguages | undefined>;
|
|
291
|
-
type AnnotationSide =
|
|
308
|
+
type AnnotationSide = 'deletions' | 'additions';
|
|
309
|
+
type SelectionSide = 'deletions' | 'additions';
|
|
292
310
|
type OptionalMetadata<T> = T extends undefined ? {
|
|
293
311
|
metadata?: undefined;
|
|
294
312
|
} : {
|
|
@@ -302,11 +320,11 @@ type DiffLineAnnotation<T = undefined> = {
|
|
|
302
320
|
lineNumber: number;
|
|
303
321
|
} & OptionalMetadata<T>;
|
|
304
322
|
interface GapSpan {
|
|
305
|
-
type:
|
|
323
|
+
type: 'gap';
|
|
306
324
|
rows: number;
|
|
307
325
|
}
|
|
308
326
|
type LineSpans = GapSpan | AnnotationSpan;
|
|
309
|
-
type LineTypes =
|
|
327
|
+
type LineTypes = 'change-deletion' | 'change-addition' | 'context' | 'context-expanded';
|
|
310
328
|
interface LineInfo {
|
|
311
329
|
type: LineTypes;
|
|
312
330
|
lineNumber: number;
|
|
@@ -317,25 +335,25 @@ interface SharedRenderState {
|
|
|
317
335
|
lineInfo: (LineInfo | undefined)[] | ((shikiLineNumber: number) => LineInfo);
|
|
318
336
|
}
|
|
319
337
|
interface AnnotationSpan {
|
|
320
|
-
type:
|
|
338
|
+
type: 'annotation';
|
|
321
339
|
hunkIndex: number;
|
|
322
340
|
lineIndex: number;
|
|
323
341
|
annotations: string[];
|
|
324
342
|
}
|
|
325
343
|
interface LineEventBaseProps {
|
|
326
|
-
type:
|
|
344
|
+
type: 'line';
|
|
327
345
|
lineNumber: number;
|
|
328
346
|
lineElement: HTMLElement;
|
|
329
|
-
numberElement: HTMLElement
|
|
347
|
+
numberElement: HTMLElement;
|
|
330
348
|
numberColumn: boolean;
|
|
331
349
|
}
|
|
332
|
-
interface DiffLineEventBaseProps extends Omit<LineEventBaseProps,
|
|
333
|
-
type:
|
|
350
|
+
interface DiffLineEventBaseProps extends Omit<LineEventBaseProps, 'type'> {
|
|
351
|
+
type: 'diff-line';
|
|
334
352
|
annotationSide: AnnotationSide;
|
|
335
353
|
lineType: LineTypes;
|
|
336
354
|
}
|
|
337
355
|
interface ObservedAnnotationNodes {
|
|
338
|
-
type:
|
|
356
|
+
type: 'annotations';
|
|
339
357
|
column1: {
|
|
340
358
|
container: HTMLElement;
|
|
341
359
|
child: HTMLElement;
|
|
@@ -346,20 +364,21 @@ interface ObservedAnnotationNodes {
|
|
|
346
364
|
child: HTMLElement;
|
|
347
365
|
childHeight: number;
|
|
348
366
|
};
|
|
349
|
-
currentHeight: number |
|
|
367
|
+
currentHeight: number | 'auto';
|
|
350
368
|
}
|
|
351
369
|
interface ObservedGridNodes {
|
|
352
|
-
type:
|
|
370
|
+
type: 'code';
|
|
353
371
|
codeElement: HTMLElement;
|
|
354
372
|
numberElement: HTMLElement | null;
|
|
355
|
-
codeWidth: number |
|
|
373
|
+
codeWidth: number | 'auto';
|
|
356
374
|
numberWidth: number;
|
|
357
375
|
}
|
|
376
|
+
type CodeColumnType = 'unified' | 'additions' | 'deletions';
|
|
358
377
|
interface HunkData {
|
|
359
378
|
slotName: string;
|
|
360
379
|
hunkIndex: number;
|
|
361
380
|
lines: number;
|
|
362
|
-
type:
|
|
381
|
+
type: CodeColumnType;
|
|
363
382
|
expandable?: {
|
|
364
383
|
chunked: boolean;
|
|
365
384
|
up: boolean;
|
|
@@ -367,11 +386,11 @@ interface HunkData {
|
|
|
367
386
|
};
|
|
368
387
|
}
|
|
369
388
|
type AnnotationLineMap<LAnnotation> = Record<number, DiffLineAnnotation<LAnnotation>[] | undefined>;
|
|
370
|
-
type ExpansionDirections =
|
|
389
|
+
type ExpansionDirections = 'up' | 'down' | 'both';
|
|
371
390
|
interface ThemedFileResult {
|
|
372
391
|
code: ElementContent[];
|
|
373
392
|
themeStyles: string;
|
|
374
|
-
baseThemeType:
|
|
393
|
+
baseThemeType: 'light' | 'dark' | undefined;
|
|
375
394
|
}
|
|
376
395
|
interface RenderDiffFilesResult {
|
|
377
396
|
deletionLines: ElementContent[];
|
|
@@ -380,24 +399,31 @@ interface RenderDiffFilesResult {
|
|
|
380
399
|
interface ThemedDiffResult {
|
|
381
400
|
code: RenderDiffFilesResult;
|
|
382
401
|
themeStyles: string;
|
|
383
|
-
baseThemeType:
|
|
402
|
+
baseThemeType: 'light' | 'dark' | undefined;
|
|
384
403
|
}
|
|
385
404
|
interface HunkExpansionRegion {
|
|
386
405
|
fromStart: number;
|
|
387
406
|
fromEnd: number;
|
|
388
407
|
}
|
|
389
|
-
interface
|
|
408
|
+
interface ForceDiffPlainTextOptions {
|
|
390
409
|
forcePlainText: boolean;
|
|
391
410
|
startingLine?: number;
|
|
392
411
|
totalLines?: number;
|
|
393
412
|
expandedHunks?: Map<number, HunkExpansionRegion> | true;
|
|
413
|
+
collapsedContextThreshold?: number;
|
|
414
|
+
}
|
|
415
|
+
interface ForceFilePlainTextOptions {
|
|
416
|
+
forcePlainText: boolean;
|
|
417
|
+
startingLine?: number;
|
|
418
|
+
totalLines?: number;
|
|
419
|
+
lines?: string[];
|
|
394
420
|
}
|
|
395
421
|
interface RenderFileOptions {
|
|
396
|
-
theme: DiffsThemeNames | Record<
|
|
422
|
+
theme: DiffsThemeNames | Record<'dark' | 'light', DiffsThemeNames>;
|
|
397
423
|
tokenizeMaxLineLength: number;
|
|
398
424
|
}
|
|
399
425
|
interface RenderDiffOptions {
|
|
400
|
-
theme: DiffsThemeNames | Record<
|
|
426
|
+
theme: DiffsThemeNames | Record<'dark' | 'light', DiffsThemeNames>;
|
|
401
427
|
tokenizeMaxLineLength: number;
|
|
402
428
|
lineDiffType: LineDiffTypes;
|
|
403
429
|
}
|
|
@@ -437,6 +463,13 @@ interface VirtualWindowSpecs {
|
|
|
437
463
|
top: number;
|
|
438
464
|
bottom: number;
|
|
439
465
|
}
|
|
466
|
+
interface VirtualFileMetrics {
|
|
467
|
+
hunkLineCount: number;
|
|
468
|
+
lineHeight: number;
|
|
469
|
+
diffHeaderHeight: number;
|
|
470
|
+
hunkSeparatorHeight: number;
|
|
471
|
+
fileGap: number;
|
|
472
|
+
}
|
|
440
473
|
//#endregion
|
|
441
|
-
export { AnnotationLineMap, AnnotationSide, AnnotationSpan, BaseCodeOptions, BaseDiffOptions, type BundledLanguage, ChangeContent, ChangeTypes, type CodeToHastOptions, ContextContent, type DecorationItem, DiffLineAnnotation, DiffLineEventBaseProps, DiffsHighlighter, DiffsThemeNames, ExpansionDirections, ExtensionFormatMap, FileContents, FileDiffMetadata,
|
|
474
|
+
export { AnnotationLineMap, AnnotationSide, AnnotationSpan, BaseCodeOptions, BaseDiffOptions, type BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, type CodeToHastOptions, ContextContent, type DecorationItem, DiffLineAnnotation, DiffLineEventBaseProps, DiffsHighlighter, DiffsThemeNames, ExpansionDirections, ExtensionFormatMap, FileContents, FileDiffMetadata, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, type 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, type ShikiTransformer, SupportedLanguages, type ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, type ThemedToken, ThemesType, VirtualFileMetrics, VirtualWindowSpecs };
|
|
442
475
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":["ElementContent","BundledLanguage","BundledTheme","CodeToHastOptions","DecorationItem","HighlighterGeneric","LanguageRegistration","ShikiTransformer","ThemedToken","ThemeRegistrationResolved","FileContents","SupportedLanguages","DiffsThemeNames","ThemesType","Record","DiffsHighlighter","ChangeTypes","ParsedPatch","FileDiffMetadata","ContextContent","ChangeContent","Hunk","HunkLineType","ThemeTypes","HunkSeparators","LineDiffTypes","BaseCodeOptions","BaseDiffOptions","PrePropertiesConfig","Pick","Required","RenderHeaderMetadataProps","RenderHeaderMetadataCallback","Element","RenderFileMetadata","ExtensionFormatMap","AnnotationSide","SelectionSide","OptionalMetadata","T","LineAnnotation","DiffLineAnnotation","GapSpan","LineSpans","AnnotationSpan","LineTypes","LineInfo","SharedRenderState","LineEventBaseProps","HTMLElement","DiffLineEventBaseProps","Omit","ObservedAnnotationNodes","ObservedGridNodes","CodeColumnType","HunkData","AnnotationLineMap","LAnnotation","ExpansionDirections","ThemedFileResult","RenderDiffFilesResult","ThemedDiffResult","HunkExpansionRegion","ForceDiffPlainTextOptions","Map","ForceFilePlainTextOptions","RenderFileOptions","RenderDiffOptions","RenderFileResult","RenderDiffResult","RenderedFileASTCache","RenderRange","RenderedDiffASTCache","RenderWindow","VirtualWindowSpecs","VirtualFileMetrics"],"sources":["../src/types.d.ts"],"sourcesContent":["import type { ElementContent } from 'hast';\nimport type { BundledLanguage, BundledTheme, CodeToHastOptions, DecorationItem, HighlighterGeneric, LanguageRegistration, ShikiTransformer, ThemedToken, ThemeRegistrationResolved } from 'shiki';\n/**\n * Represents a file's contents for generating diffs via `parseDiffFromFile` or\n * for when rendering a file directly using the File components\n */\nexport interface FileContents {\n /** Filename used for display in headers and for inferring the language for\n * syntax highlighting. */\n name: string;\n /** The raw text contents of the file. */\n contents: string;\n /** Explicitly set the syntax highlighting language instead of inferring from\n * filename. Generally you should not be setting this. */\n lang?: SupportedLanguages;\n /** Optional header passed to the jsdiff library's `createTwoFilesPatch`. */\n header?: string;\n /** This unique key is only used for Worker Pools to avoid subsequent requests\n * if we've already highlighted the file. Please note that if you modify the\n * `contents` or `name`, you must update the `cacheKey`. */\n cacheKey?: string;\n}\nexport type { BundledLanguage, CodeToHastOptions, DecorationItem, LanguageRegistration, ShikiTransformer, ThemeRegistrationResolved, ThemedToken, };\nexport type DiffsThemeNames = BundledTheme | 'pierre-dark' | 'pierre-light' | (string & {});\nexport type ThemesType = Record<'dark' | 'light', DiffsThemeNames>;\n/**\n * A Shiki highlighter instance configured with the library's supported\n * languages and themes. Used internally to generate syntax-highlighted AST\n * from file contents. By default diffs will ensure that only 1 highlighter is\n * instantiated per thread and shared for all syntax highlighting. This\n * applies to the main thread and worker threads.\n */\nexport type DiffsHighlighter = HighlighterGeneric<SupportedLanguages, DiffsThemeNames>;\n/**\n * Describes the type of change for a file in a diff.\n * - `change`: File content was modified, name unchanged.\n * - `rename-pure`: File was renamed/moved without content changes (100% similarity).\n * - `rename-changed`: File was renamed/moved and content was also modified.\n * - `new`: A new file was added.\n * - `deleted`: An existing file was removed.\n */\nexport type ChangeTypes = 'change' | 'rename-pure' | 'rename-changed' | 'new' | 'deleted';\n/**\n * Represents a parsed patch file, typically corresponding to a single commit.\n * Returned by `parsePatchFiles` when parsing raw patch/diff strings.\n */\nexport interface ParsedPatch {\n /** Optional raw introductory text before the file diffs that may have been\n * included in the patch (e.g., commit message, author, date). */\n patchMetadata?: string;\n /** Array of file changes contained in the patch. */\n files: FileDiffMetadata[];\n}\n/**\n * Represents a block of unchanged context lines within a hunk. Basically a\n * batch of lines in a hunk that are prefixed with a space ` `. Consecutive\n * lines prefixed with a ` ` are grouped together into a single ContextContent.\n */\nexport interface ContextContent {\n type: 'context';\n /** Number of unchanged lines in this context block. */\n lines: number;\n /**\n * Zero-based index into `FileDiffMetadata.additionLines` where this context\n * block starts.\n */\n additionLineIndex: number;\n /**\n * Zero-based index into `FileDiffMetadata.deletionLines` where this context\n * block starts.\n */\n deletionLineIndex: number;\n}\n/**\n * Represents a block of changes (additions and/or deletions) within a hunk.\n * Consecutive `+` and `-` lines are grouped together into a single\n * ChangeContent.\n */\nexport interface ChangeContent {\n type: 'change';\n /** Number of lines prefixed with `-` in this change block. */\n deletions: number;\n /**\n * Zero-based index into `FileDiffMetadata.deletionLines` where the deleted\n * lines start.\n */\n deletionLineIndex: number;\n /** Number of lines prefixed with `+` in this change block. */\n additions: number;\n /**\n * Zero-based index into `FileDiffMetadata.additionLines` where the added\n * lines start.\n */\n additionLineIndex: number;\n}\n/**\n * Represents a single hunk from a diff, corresponding to\n * one `@@ ... @@` block.\n */\nexport interface Hunk {\n /**\n * Number of unchanged lines between the previous hunk (or file start) and\n * this hunk.\n */\n collapsedBefore: number;\n /**\n * Starting line number in the new file version, parsed from the `+X`\n * in the hunk header.\n */\n additionStart: number;\n /**\n * Total line count in the new file version for this hunk, parsed from\n * `+X,count` in the hunk header. If this hunk was viewed in `diffStyle:\n * split` this would correspond to the number of lines in the right\n * `additions` column. It includes both `context` lines and lines\n * prefixed with `+`.\n */\n additionCount: number;\n /** This corresponds to the number of lines prefixed with `+` in this hunk. */\n additionLines: number;\n /**\n * Zero-based index into `FileDiffMetadata.additionLines` where this hunk's\n * content starts.\n */\n additionLineIndex: number;\n /**\n * Starting line number in the old file version, parsed from the `-X`\n * in the hunk header.\n */\n deletionStart: number;\n /**\n * Total line count in the old file version for this hunk, parsed from\n * `-X,count` in the hunk header. If this hunk was viewed in `diffStyle:\n * split` this would correspond to the number of lines in the left\n * `deletions` column. It includes both `context` lines and lines\n * prefixed with `-`.\n */\n deletionCount: number;\n /** This corresponds to the number of lines prefixed with `-` in this hunk. */\n deletionLines: number;\n /**\n * Zero-based index into `FileDiffMetadata.deletionLines` where this hunk's\n * content starts.\n */\n deletionLineIndex: number;\n /**\n * Array of content segments within this hunk, each representing either\n * a context line group or a change group.\n */\n hunkContent: (ContextContent | ChangeContent)[];\n /**\n * Function/method name that appears after the `@@` markers if it existed in\n * the diff.\n */\n hunkContext?: string;\n /** Raw hunk header string (e.g., `@@ -1,5 +1,7 @@`). */\n hunkSpecs?: string;\n /**\n * Starting line index for this hunk when rendered in split (side-by-side)\n * view.\n */\n splitLineStart: number;\n /** Total rendered line count for this hunk in split view. */\n splitLineCount: number;\n /** Starting line index for this hunk when rendered in unified view. */\n unifiedLineStart: number;\n /** Total rendered line count for this hunk in unified view. */\n unifiedLineCount: number;\n /**\n * True if the old file version has no trailing newline at end of file. This\n * is parsed from the patch file directly at the end of the hunk. If the\n * final hunkContent is a `context` group, then both values will be true or\n * false together. If it's from a `change` content group, then it may differ\n * depending on the patch.\n */\n noEOFCRDeletions: boolean;\n /**\n * True if the new file version has no trailing newline at end of file. This\n * is parsed from the patch file directly at the end of the hunk. If the\n * final hunkContent is a `context` group, then both values will be true or\n * false together. If it's from a `change` content group, then it may differ\n * depending on the patch.\n */\n noEOFCRAdditions: boolean;\n}\n/**\n * Metadata and content for a single file's diff. Think of this as a JSON\n * compatible representation of a diff for a single file.\n */\nexport interface FileDiffMetadata {\n /** The file's name and path. */\n name: string;\n /** Previous file path, present only if file was renamed or moved. */\n prevName?: string;\n /**\n * Explicitly override the syntax highlighting language instead of inferring\n * from filename. This will never be set by default, since all internal diff\n * APIs will attempt to detect the language automatically. If you'd like to\n * specify a language override, you can do so via the method `setLanguageOverride`\n */\n lang?: SupportedLanguages;\n /**\n * Object ID for the new file content parsed from the `index` line in a\n * patch file.\n */\n newObjectId?: string;\n /**\n * Object ID for the previous file content parsed from the `index` line in a\n * patch file.\n */\n prevObjectId?: string;\n /**\n * Git file mode parsed from the diff (e.g., `100644` for regular files) when\n * present in the patch metadata.\n */\n mode?: string;\n /** Previous git file mode, present if the mode changed. */\n prevMode?: string;\n /** The type of change for this file. */\n type: ChangeTypes;\n /** Array of diff hunks containing line-level change information. Each hunk\n * corresponds to a `@@ -X,X +X,X @@` group in a diff. */\n hunks: Hunk[];\n /** Pre-computed line size for this diff if rendered in `split` diffStyle. */\n splitLineCount: number;\n /** Pre-computed line size for this diff if rendered in `unified` diffStyle. */\n unifiedLineCount: number;\n /**\n * Whether the diff was parsed from a patch file (true) or generated from\n * full file contents (false).\n *\n * When true, `deletionLines`/`additionLines` contain only the lines present\n * in the patch and hunk expansion is unavailable.\n *\n * When false, they contain the complete file contents.\n */\n isPartial: boolean;\n /**\n * Array of lines from previous version of the file. If `isPartial` is false,\n * it means that `deletionLines` can be considered the entire contents of the\n * old version of the file. Otherwise `deletionLines` will just be an array\n * of all the content processed from the `context` and `deletion` lines of\n * the patch.\n */\n deletionLines: string[];\n /**\n * Array of lines from new version of the file. If `isPartial` is false, it\n * means that `additionLines` can be considered the entire contents of the\n * new version of the file. Otherwise `additionLines` will just be an array\n * of all the content processed from the `context` and `addition` lines of\n * the patch.\n */\n additionLines: string[];\n /**\n * This unique key is only used for Worker Pools to avoid subsequent requests\n * to highlight if we've already highlighted the diff. Please note that if\n * you modify the contents of the diff in any way, you will need to update\n * the `cacheKey`.\n */\n cacheKey?: string;\n}\nexport type SupportedLanguages = BundledLanguage | 'text' | 'ansi' | (string & {});\nexport type HunkLineType = 'context' | 'expanded' | 'addition' | 'deletion' | 'metadata';\nexport type ThemeTypes = 'system' | 'light' | 'dark';\n/**\n * The `'custom'` variant is deprecated and will be removed in a future version.\n */\nexport type HunkSeparators = 'simple' | 'metadata' | 'line-info' | 'line-info-basic' | 'custom';\nexport type LineDiffTypes = 'word-alt' | 'word' | 'char' | 'none';\nexport interface BaseCodeOptions {\n theme?: DiffsThemeNames | ThemesType;\n disableLineNumbers?: boolean;\n overflow?: 'scroll' | 'wrap';\n themeType?: ThemeTypes;\n disableFileHeader?: boolean;\n disableVirtualizationBuffers?: boolean;\n useCSSClasses?: boolean;\n tokenizeMaxLineLength?: number;\n unsafeCSS?: string;\n}\nexport interface BaseDiffOptions extends BaseCodeOptions {\n diffStyle?: 'unified' | 'split';\n diffIndicators?: 'classic' | 'bars' | 'none';\n disableBackground?: boolean;\n hunkSeparators?: HunkSeparators;\n expandUnchanged?: boolean;\n collapsedContextThreshold?: number;\n lineDiffType?: LineDiffTypes;\n maxLineDiffLength?: number;\n expansionLineCount?: number;\n}\nexport interface PrePropertiesConfig extends Required<Pick<BaseDiffOptions, 'diffIndicators' | 'disableBackground' | 'disableLineNumbers' | 'overflow' | 'themeType'>> {\n type: 'diff' | 'file';\n split: boolean;\n themeStyles: string;\n totalLines: number;\n}\nexport interface RenderHeaderMetadataProps {\n deletionFile?: FileContents;\n additionFile?: FileContents;\n fileDiff?: FileDiffMetadata;\n}\nexport type RenderHeaderMetadataCallback = (props: RenderHeaderMetadataProps) => Element | null | undefined | string | number;\nexport type RenderFileMetadata = (file: FileContents) => Element | null | undefined | string | number;\nexport type ExtensionFormatMap = Record<string, SupportedLanguages | undefined>;\nexport type AnnotationSide = 'deletions' | 'additions';\nexport type SelectionSide = 'deletions' | 'additions';\ntype OptionalMetadata<T> = T extends undefined ? {\n metadata?: undefined;\n} : {\n metadata: T;\n};\nexport type LineAnnotation<T = undefined> = {\n lineNumber: number;\n} & OptionalMetadata<T>;\nexport type DiffLineAnnotation<T = undefined> = {\n side: AnnotationSide;\n lineNumber: number;\n} & OptionalMetadata<T>;\nexport interface GapSpan {\n type: 'gap';\n rows: number;\n}\nexport type LineSpans = GapSpan | AnnotationSpan;\nexport type LineTypes = 'change-deletion' | 'change-addition' | 'context' | 'context-expanded';\nexport interface LineInfo {\n type: LineTypes;\n lineNumber: number;\n altLineNumber?: number;\n lineIndex: number | `${number},${number}`;\n}\nexport interface SharedRenderState {\n lineInfo: (LineInfo | undefined)[] | ((shikiLineNumber: number) => LineInfo);\n}\nexport interface AnnotationSpan {\n type: 'annotation';\n hunkIndex: number;\n lineIndex: number;\n annotations: string[];\n}\nexport interface LineEventBaseProps {\n type: 'line';\n lineNumber: number;\n lineElement: HTMLElement;\n numberElement: HTMLElement;\n numberColumn: boolean;\n}\nexport interface DiffLineEventBaseProps extends Omit<LineEventBaseProps, 'type'> {\n type: 'diff-line';\n annotationSide: AnnotationSide;\n lineType: LineTypes;\n}\nexport interface ObservedAnnotationNodes {\n type: 'annotations';\n column1: {\n container: HTMLElement;\n child: HTMLElement;\n childHeight: number;\n };\n column2: {\n container: HTMLElement;\n child: HTMLElement;\n childHeight: number;\n };\n currentHeight: number | 'auto';\n}\nexport interface ObservedGridNodes {\n type: 'code';\n codeElement: HTMLElement;\n numberElement: HTMLElement | null;\n codeWidth: number | 'auto';\n numberWidth: number;\n}\nexport type CodeColumnType = 'unified' | 'additions' | 'deletions';\nexport interface HunkData {\n slotName: string;\n hunkIndex: number;\n lines: number;\n type: CodeColumnType;\n expandable?: {\n chunked: boolean;\n up: boolean;\n down: boolean;\n };\n}\nexport type AnnotationLineMap<LAnnotation> = Record<number, DiffLineAnnotation<LAnnotation>[] | undefined>;\nexport type ExpansionDirections = 'up' | 'down' | 'both';\nexport interface ThemedFileResult {\n code: ElementContent[];\n themeStyles: string;\n baseThemeType: 'light' | 'dark' | undefined;\n}\nexport interface RenderDiffFilesResult {\n deletionLines: ElementContent[];\n additionLines: ElementContent[];\n}\nexport interface ThemedDiffResult {\n code: RenderDiffFilesResult;\n themeStyles: string;\n baseThemeType: 'light' | 'dark' | undefined;\n}\nexport interface HunkExpansionRegion {\n fromStart: number;\n fromEnd: number;\n}\nexport interface ForceDiffPlainTextOptions {\n forcePlainText: boolean;\n startingLine?: number;\n totalLines?: number;\n expandedHunks?: Map<number, HunkExpansionRegion> | true;\n collapsedContextThreshold?: number;\n}\nexport interface ForceFilePlainTextOptions {\n forcePlainText: boolean;\n startingLine?: number;\n totalLines?: number;\n lines?: string[];\n}\nexport interface RenderFileOptions {\n theme: DiffsThemeNames | Record<'dark' | 'light', DiffsThemeNames>;\n tokenizeMaxLineLength: number;\n}\nexport interface RenderDiffOptions {\n theme: DiffsThemeNames | Record<'dark' | 'light', DiffsThemeNames>;\n tokenizeMaxLineLength: number;\n lineDiffType: LineDiffTypes;\n}\nexport interface RenderFileResult {\n result: ThemedFileResult;\n options: RenderFileOptions;\n}\nexport interface RenderDiffResult {\n result: ThemedDiffResult;\n options: RenderDiffOptions;\n}\nexport interface RenderedFileASTCache {\n file: FileContents;\n highlighted: boolean;\n options: RenderFileOptions;\n result: ThemedFileResult | undefined;\n renderRange: RenderRange | undefined;\n}\nexport interface RenderedDiffASTCache {\n diff: FileDiffMetadata;\n highlighted: boolean;\n options: RenderDiffOptions;\n result: ThemedDiffResult | undefined;\n renderRange: RenderRange | undefined;\n}\nexport interface RenderRange {\n startingLine: number;\n totalLines: number;\n bufferBefore: number;\n bufferAfter: number;\n}\nexport interface RenderWindow {\n top: number;\n bottom: number;\n}\nexport interface VirtualWindowSpecs {\n top: number;\n bottom: number;\n}\nexport interface VirtualFileMetrics {\n hunkLineCount: number;\n lineHeight: number;\n diffHeaderHeight: number;\n hunkSeparatorHeight: number;\n fileGap: number;\n}\n//# sourceMappingURL=types.d.ts.map"],"mappings":"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"}
|