@pierre/diffs 1.1.19 → 1.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/CodeView.d.ts +324 -0
- package/dist/components/CodeView.d.ts.map +1 -0
- package/dist/components/CodeView.js +1245 -0
- package/dist/components/CodeView.js.map +1 -0
- package/dist/components/File.d.ts +13 -12
- package/dist/components/File.d.ts.map +1 -1
- package/dist/components/File.js +68 -28
- package/dist/components/File.js.map +1 -1
- package/dist/components/FileDiff.d.ts +9 -10
- package/dist/components/FileDiff.d.ts.map +1 -1
- package/dist/components/FileDiff.js +57 -30
- package/dist/components/FileDiff.js.map +1 -1
- package/dist/components/FileStream.js +9 -3
- package/dist/components/FileStream.js.map +1 -1
- package/dist/components/VirtualizedFile.d.ts +28 -5
- package/dist/components/VirtualizedFile.d.ts.map +1 -1
- package/dist/components/VirtualizedFile.js +225 -45
- package/dist/components/VirtualizedFile.js.map +1 -1
- package/dist/components/VirtualizedFileDiff.d.ts +28 -5
- package/dist/components/VirtualizedFileDiff.d.ts.map +1 -1
- package/dist/components/VirtualizedFileDiff.js +285 -49
- package/dist/components/VirtualizedFileDiff.js.map +1 -1
- package/dist/components/Virtualizer.d.ts +6 -3
- package/dist/components/Virtualizer.d.ts.map +1 -1
- package/dist/components/Virtualizer.js +4 -6
- package/dist/components/Virtualizer.js.map +1 -1
- package/dist/components/VirtulizerDevelopment.d.ts +2 -2
- package/dist/components/VirtulizerDevelopment.d.ts.map +1 -1
- package/dist/constants.d.ts +6 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +17 -2
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.js +11 -10
- package/dist/managers/InteractionManager.d.ts +11 -7
- package/dist/managers/InteractionManager.d.ts.map +1 -1
- package/dist/managers/InteractionManager.js +38 -25
- package/dist/managers/InteractionManager.js.map +1 -1
- package/dist/managers/ResizeManager.d.ts +4 -4
- package/dist/managers/ResizeManager.d.ts.map +1 -1
- package/dist/managers/ResizeManager.js +89 -54
- package/dist/managers/ResizeManager.js.map +1 -1
- package/dist/managers/UniversalRenderingManager.d.ts +2 -1
- package/dist/managers/UniversalRenderingManager.d.ts.map +1 -1
- package/dist/managers/UniversalRenderingManager.js +13 -16
- package/dist/managers/UniversalRenderingManager.js.map +1 -1
- package/dist/react/CodeView.d.ts +45 -0
- package/dist/react/CodeView.d.ts.map +1 -0
- package/dist/react/CodeView.js +241 -0
- package/dist/react/CodeView.js.map +1 -0
- package/dist/react/File.d.ts +0 -1
- package/dist/react/File.d.ts.map +1 -1
- package/dist/react/File.js +2 -3
- package/dist/react/File.js.map +1 -1
- package/dist/react/FileDiff.d.ts +0 -1
- package/dist/react/FileDiff.d.ts.map +1 -1
- package/dist/react/FileDiff.js +3 -4
- package/dist/react/FileDiff.js.map +1 -1
- package/dist/react/MultiFileDiff.d.ts +0 -1
- package/dist/react/MultiFileDiff.d.ts.map +1 -1
- package/dist/react/MultiFileDiff.js +3 -4
- package/dist/react/MultiFileDiff.js.map +1 -1
- package/dist/react/PatchDiff.d.ts +0 -1
- package/dist/react/PatchDiff.d.ts.map +1 -1
- package/dist/react/PatchDiff.js +3 -4
- package/dist/react/PatchDiff.js.map +1 -1
- package/dist/react/UnresolvedFile.d.ts +0 -1
- package/dist/react/UnresolvedFile.d.ts.map +1 -1
- package/dist/react/UnresolvedFile.js +3 -4
- package/dist/react/UnresolvedFile.js.map +1 -1
- package/dist/react/index.d.ts +3 -2
- package/dist/react/index.js +5 -4
- package/dist/react/jsx.d.ts.map +1 -1
- package/dist/react/types.d.ts +0 -8
- package/dist/react/types.d.ts.map +1 -1
- package/dist/react/utils/renderDiffChildren.d.ts +0 -2
- package/dist/react/utils/renderDiffChildren.d.ts.map +1 -1
- package/dist/react/utils/renderDiffChildren.js +3 -4
- package/dist/react/utils/renderDiffChildren.js.map +1 -1
- package/dist/react/utils/renderFileChildren.d.ts +0 -2
- package/dist/react/utils/renderFileChildren.d.ts.map +1 -1
- package/dist/react/utils/renderFileChildren.js +3 -4
- package/dist/react/utils/renderFileChildren.js.map +1 -1
- package/dist/react/utils/useFileDiffInstance.js +12 -7
- package/dist/react/utils/useFileDiffInstance.js.map +1 -1
- package/dist/react/utils/useFileInstance.js +12 -7
- package/dist/react/utils/useFileInstance.js.map +1 -1
- package/dist/react/utils/useUnresolvedFileInstance.js +6 -2
- package/dist/react/utils/useUnresolvedFileInstance.js.map +1 -1
- package/dist/renderers/DiffHunksRenderer.d.ts +2 -1
- package/dist/renderers/DiffHunksRenderer.d.ts.map +1 -1
- package/dist/renderers/DiffHunksRenderer.js +35 -20
- package/dist/renderers/DiffHunksRenderer.js.map +1 -1
- package/dist/renderers/FileRenderer.d.ts +2 -1
- package/dist/renderers/FileRenderer.d.ts.map +1 -1
- package/dist/renderers/FileRenderer.js +34 -20
- package/dist/renderers/FileRenderer.js.map +1 -1
- package/dist/ssr/index.d.ts +2 -2
- package/dist/ssr/preloadDiffs.js +1 -1
- package/dist/style.js +1 -1
- package/dist/style.js.map +1 -1
- package/dist/types.d.ts +98 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/areManagedSnapshotsEqual.d.ts +7 -0
- package/dist/utils/areManagedSnapshotsEqual.d.ts.map +1 -0
- package/dist/utils/areManagedSnapshotsEqual.js +15 -0
- package/dist/utils/areManagedSnapshotsEqual.js.map +1 -0
- package/dist/utils/areOptionsEqual.d.ts +2 -1
- package/dist/utils/areOptionsEqual.d.ts.map +1 -1
- package/dist/utils/areOptionsEqual.js +1 -1
- package/dist/utils/areOptionsEqual.js.map +1 -1
- package/dist/utils/createFileHeaderElement.d.ts +3 -1
- package/dist/utils/createFileHeaderElement.d.ts.map +1 -1
- package/dist/utils/createFileHeaderElement.js +3 -2
- package/dist/utils/createFileHeaderElement.js.map +1 -1
- package/dist/utils/createWindowFromScrollPosition.d.ts +3 -3
- package/dist/utils/createWindowFromScrollPosition.d.ts.map +1 -1
- package/dist/utils/createWindowFromScrollPosition.js +6 -6
- package/dist/utils/createWindowFromScrollPosition.js.map +1 -1
- package/dist/utils/iterateOverDiff.d.ts +2 -1
- package/dist/utils/iterateOverDiff.d.ts.map +1 -1
- package/dist/utils/iterateOverDiff.js +135 -7
- package/dist/utils/iterateOverDiff.js.map +1 -1
- package/dist/utils/parsePatchFiles.js +2 -2
- package/dist/utils/parsePatchFiles.js.map +1 -1
- package/dist/utils/renderFileWithHighlighter.js +1 -1
- package/dist/utils/resolveVirtualFileMetrics.d.ts +4 -1
- package/dist/utils/resolveVirtualFileMetrics.d.ts.map +1 -1
- package/dist/utils/resolveVirtualFileMetrics.js +11 -1
- package/dist/utils/resolveVirtualFileMetrics.js.map +1 -1
- package/dist/utils/roundToDevicePixel.d.ts +14 -0
- package/dist/utils/roundToDevicePixel.d.ts.map +1 -0
- package/dist/utils/roundToDevicePixel.js +18 -0
- package/dist/utils/roundToDevicePixel.js.map +1 -0
- package/dist/worker/worker-portable.js +195 -14
- package/dist/worker/worker-portable.js.map +1 -1
- package/dist/worker/worker.js +146 -7
- package/dist/worker/worker.js.map +1 -1
- package/package.json +10 -1
- package/dist/components/AdvancedVirtualizedFileDiff.d.ts +0 -40
- package/dist/components/AdvancedVirtualizedFileDiff.d.ts.map +0 -1
- package/dist/components/AdvancedVirtualizedFileDiff.js +0 -140
- package/dist/components/AdvancedVirtualizedFileDiff.js.map +0 -1
- package/dist/components/AdvancedVirtualizer.d.ts +0 -38
- package/dist/components/AdvancedVirtualizer.d.ts.map +0 -1
- package/dist/components/AdvancedVirtualizer.js +0 -201
- package/dist/components/AdvancedVirtualizer.js.map +0 -1
package/dist/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { CreatePatchOptionsNonabortable } from "diff";
|
|
|
3
3
|
import { ElementContent } from "hast";
|
|
4
4
|
|
|
5
5
|
//#region src/types.d.ts
|
|
6
|
-
|
|
6
|
+
type CodeViewScrollBehavior = 'instant' | 'smooth' | 'smooth-auto';
|
|
7
7
|
/**
|
|
8
8
|
* Represents a file's contents for generating diffs via `parseDiffFromFile` or
|
|
9
9
|
* for when rendering a file directly using the File components
|
|
@@ -290,10 +290,12 @@ interface BaseCodeOptions {
|
|
|
290
290
|
collapsed?: boolean;
|
|
291
291
|
disableFileHeader?: boolean;
|
|
292
292
|
disableVirtualizationBuffers?: boolean;
|
|
293
|
+
stickyHeader?: boolean;
|
|
293
294
|
preferredHighlighter?: HighlighterTypes;
|
|
294
295
|
useCSSClasses?: boolean;
|
|
295
296
|
useTokenTransformer?: boolean;
|
|
296
297
|
tokenizeMaxLineLength?: number;
|
|
298
|
+
tokenizeMaxLength?: number;
|
|
297
299
|
unsafeCSS?: string;
|
|
298
300
|
}
|
|
299
301
|
interface BaseDiffOptions extends BaseCodeOptions {
|
|
@@ -339,6 +341,51 @@ type DiffLineAnnotation<T = undefined> = {
|
|
|
339
341
|
side: AnnotationSide;
|
|
340
342
|
lineNumber: number;
|
|
341
343
|
} & OptionalMetadata<T>;
|
|
344
|
+
type CodeViewItemVersion = string | number;
|
|
345
|
+
type CodeViewFileItem<T = undefined> = {
|
|
346
|
+
id: string;
|
|
347
|
+
type: 'file';
|
|
348
|
+
file: FileContents;
|
|
349
|
+
annotations?: LineAnnotation<T>[];
|
|
350
|
+
version?: CodeViewItemVersion;
|
|
351
|
+
collapsed?: boolean;
|
|
352
|
+
};
|
|
353
|
+
type CodeViewDiffItem<T = undefined> = {
|
|
354
|
+
id: string;
|
|
355
|
+
type: 'diff';
|
|
356
|
+
fileDiff: FileDiffMetadata;
|
|
357
|
+
annotations?: DiffLineAnnotation<T>[];
|
|
358
|
+
version?: CodeViewItemVersion;
|
|
359
|
+
collapsed?: boolean;
|
|
360
|
+
};
|
|
361
|
+
type CodeViewItem<T = undefined> = CodeViewFileItem<T> | CodeViewDiffItem<T>;
|
|
362
|
+
interface CodeViewPositionScrollTarget {
|
|
363
|
+
type: 'position';
|
|
364
|
+
position: number;
|
|
365
|
+
behavior?: CodeViewScrollBehavior;
|
|
366
|
+
}
|
|
367
|
+
interface CodeViewLineScrollTarget {
|
|
368
|
+
type: 'line';
|
|
369
|
+
id: string;
|
|
370
|
+
lineNumber: number;
|
|
371
|
+
side?: SelectionSide;
|
|
372
|
+
align?: 'start' | 'center' | 'end' | 'nearest';
|
|
373
|
+
offset?: number;
|
|
374
|
+
behavior?: CodeViewScrollBehavior;
|
|
375
|
+
}
|
|
376
|
+
interface NumericScrollLineAnchor {
|
|
377
|
+
lineNumber: number;
|
|
378
|
+
top: number;
|
|
379
|
+
side?: SelectionSide;
|
|
380
|
+
}
|
|
381
|
+
interface CodeViewItemScrollTarget {
|
|
382
|
+
type: 'item';
|
|
383
|
+
id: string;
|
|
384
|
+
align?: 'start' | 'center' | 'end' | 'nearest';
|
|
385
|
+
offset?: number;
|
|
386
|
+
behavior?: CodeViewScrollBehavior;
|
|
387
|
+
}
|
|
388
|
+
type CodeViewScrollTarget = CodeViewPositionScrollTarget | CodeViewLineScrollTarget | CodeViewItemScrollTarget;
|
|
342
389
|
type MergeConflictResolution = 'current' | 'incoming' | 'both';
|
|
343
390
|
interface MergeConflictRegion {
|
|
344
391
|
conflictIndex: number;
|
|
@@ -510,15 +557,58 @@ interface RenderWindow {
|
|
|
510
557
|
bottom: number;
|
|
511
558
|
}
|
|
512
559
|
interface VirtualWindowSpecs {
|
|
560
|
+
/** Absolute top edge of the active virtual window in scroll-space pixels. */
|
|
513
561
|
top: number;
|
|
562
|
+
/** Absolute bottom edge of the active virtual window in scroll-space pixels. */
|
|
514
563
|
bottom: number;
|
|
515
564
|
}
|
|
516
565
|
interface VirtualFileMetrics {
|
|
566
|
+
/** Number of rendered lines per hunk chunk when virtualization batches line rendering. */
|
|
517
567
|
hunkLineCount: number;
|
|
568
|
+
/** Estimated single-line row height used before a line is measured. */
|
|
518
569
|
lineHeight: number;
|
|
570
|
+
/** Height reserved for the file or diff header region. */
|
|
519
571
|
diffHeaderHeight: number;
|
|
572
|
+
/** Height reserved for each collapsed-context separator row. */
|
|
520
573
|
hunkSeparatorHeight: number;
|
|
521
|
-
|
|
574
|
+
/** Vertical spacing used around hunks and file-level padding. You should not
|
|
575
|
+
* change this from the default if you aren't applying custom CSS */
|
|
576
|
+
spacing: number;
|
|
577
|
+
/** Optional top padding applied after the file header, or before content
|
|
578
|
+
* when the header is disabled. Defaults to 0 with a header, otherwise
|
|
579
|
+
* defaults to spacing if header is disabled */
|
|
580
|
+
paddingTop?: number;
|
|
581
|
+
/** Optional bottom padding applied after file content, and only if there is
|
|
582
|
+
* code for the diff. Defaults to spacing if none provided */
|
|
583
|
+
paddingBottom?: number;
|
|
584
|
+
}
|
|
585
|
+
interface CodeViewMetrics {
|
|
586
|
+
/** Top padding applied to the viewer's sticky container offset. */
|
|
587
|
+
paddingTop: number;
|
|
588
|
+
/** Bottom padding added after the final rendered item in the viewer. */
|
|
589
|
+
paddingBottom: number;
|
|
590
|
+
/** Vertical gap between virtualized items in the viewer. */
|
|
591
|
+
gap: number;
|
|
592
|
+
}
|
|
593
|
+
interface SmoothScrollSettings {
|
|
594
|
+
/**
|
|
595
|
+
* Natural frequency of the critically-damped spring, in rad/ms. 99% settle
|
|
596
|
+
* takes roughly `6.6 / omega`; 0.015 gives ~440ms. Raise for a snappier
|
|
597
|
+
* animation; lower for a longer glide.
|
|
598
|
+
*/
|
|
599
|
+
omega: number;
|
|
600
|
+
/**
|
|
601
|
+
* Distance from destination (in CSS pixels) below which the spring is
|
|
602
|
+
* considered settled. Must also clear `velocityEpsilon` before the
|
|
603
|
+
* animation actually stops and snaps to destination.
|
|
604
|
+
*/
|
|
605
|
+
positionEpsilon: number;
|
|
606
|
+
/**
|
|
607
|
+
* Velocity magnitude (in CSS pixels per millisecond) below which the
|
|
608
|
+
* spring is considered effectively stationary. Pairs with
|
|
609
|
+
* `positionEpsilon` to gate the settle transition.
|
|
610
|
+
*/
|
|
611
|
+
velocityEpsilon: number;
|
|
522
612
|
}
|
|
523
613
|
interface SelectionPoint {
|
|
524
614
|
lineNumber: number;
|
|
@@ -554,10 +644,15 @@ interface ProcessFileConflictData {
|
|
|
554
644
|
endMarkerContentIndex: number;
|
|
555
645
|
}
|
|
556
646
|
interface AppliedThemeStyleCache {
|
|
647
|
+
theme: DiffsThemeNames | ThemesType;
|
|
557
648
|
themeStyles: string;
|
|
558
649
|
themeType: ThemeTypes;
|
|
559
650
|
baseThemeType: 'light' | 'dark' | undefined;
|
|
560
651
|
}
|
|
652
|
+
interface StickySpecs {
|
|
653
|
+
topOffset: number;
|
|
654
|
+
height: number;
|
|
655
|
+
}
|
|
561
656
|
//#endregion
|
|
562
|
-
export { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, type BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, type CodeToHastOptions, ConflictResolverTypes, ContextContent, type CreatePatchOptionsNonabortable, CustomPreProperties, type DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsHighlighter, DiffsThemeNames, ExpansionDirections, ExtensionFormatMap, FileContents, FileDiffMetadata, FileHeaderRenderMode, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, type LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MergeConflictActionPayload, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PrePropertiesConfig, ProcessFileConflictData, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, SelectionPoint, SelectionSide, SharedRenderState, type ShikiTransformer, SupportedLanguages, type ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, type ThemedToken, ThemesType, TokenEventBase, VirtualFileMetrics, VirtualWindowSpecs };
|
|
657
|
+
export { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, type BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, type CodeToHastOptions, CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemScrollTarget, CodeViewItemVersion, CodeViewLineScrollTarget, CodeViewMetrics, CodeViewPositionScrollTarget, CodeViewScrollBehavior, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, type CreatePatchOptionsNonabortable, CustomPreProperties, type DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsHighlighter, DiffsThemeNames, ExpansionDirections, ExtensionFormatMap, FileContents, FileDiffMetadata, FileHeaderRenderMode, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, type LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MergeConflictActionPayload, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PrePropertiesConfig, ProcessFileConflictData, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, SelectionPoint, SelectionSide, SharedRenderState, type ShikiTransformer, SmoothScrollSettings, StickySpecs, SupportedLanguages, type ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, type ThemedToken, ThemesType, TokenEventBase, VirtualFileMetrics, VirtualWindowSpecs };
|
|
563
658
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":["CreatePatchOptionsNonabortable","ElementContent","BundledLanguage","BundledTheme","CodeToHastOptions","DecorationItem","HighlighterGeneric","LanguageRegistration","ShikiTransformer","ThemedToken","ThemeRegistrationResolved","FileContents","SupportedLanguages","HighlighterTypes","DiffsThemeNames","ThemesType","Record","DiffsHighlighter","ChangeTypes","ParsedPatch","FileDiffMetadata","ContextContent","ChangeContent","Hunk","MergeConflictMarkerRowType","MergeConflictMarkerRow","HunkLineType","ThemeTypes","HunkSeparators","LineDiffTypes","BaseCodeOptions","BaseDiffOptions","BaseDiffOptionsWithDefaults","Omit","Required","CustomPreProperties","PrePropertiesConfig","Pick","FileHeaderRenderMode","RenderHeaderMetadataCallback","Element","RenderHeaderPrefixCallback","RenderFileMetadata","ExtensionFormatMap","AnnotationSide","SelectionSide","OptionalMetadata","T","LineAnnotation","DiffLineAnnotation","MergeConflictResolution","MergeConflictRegion","MergeConflictActionPayload","GapSpan","LineSpans","AnnotationSpan","LineTypes","LineInfo","SharedRenderState","LineEventBaseProps","HTMLElement","DiffLineEventBaseProps","TokenEventBase","DiffTokenEventBaseProps","ObservedAnnotationNodes","ObservedGridNodes","CodeColumnType","HunkData","AnnotationLineMap","LAnnotation","ExpansionDirections","ThemedFileResult","RenderDiffFilesResult","ThemedDiffResult","HunkExpansionRegion","ForceDiffPlainTextOptions","Map","ForceFilePlainTextOptions","RenderFileOptions","RenderDiffOptions","RenderFileResult","RenderDiffResult","RenderedFileASTCache","RenderRange","RenderedDiffASTCache","RenderWindow","VirtualWindowSpecs","VirtualFileMetrics","SelectionPoint","DiffAcceptRejectHunkType","ConflictResolverTypes","DiffAcceptRejectHunkConfig","ProcessFileConflictData","AppliedThemeStyleCache"],"sources":["../src/types.d.ts"],"sourcesContent":["import type { CreatePatchOptionsNonabortable } from 'diff';\nimport type { ElementContent } from 'hast';\nimport type { BundledLanguage, BundledTheme, CodeToHastOptions, DecorationItem, HighlighterGeneric, LanguageRegistration, ShikiTransformer, ThemedToken, ThemeRegistrationResolved } from 'shiki';\nexport type { CreatePatchOptionsNonabortable };\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 HighlighterTypes = 'shiki-js' | 'shiki-wasm';\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 MergeConflictMarkerRowType = 'marker-start' | 'marker-base' | 'marker-separator' | 'marker-end';\nexport interface MergeConflictMarkerRow {\n type: MergeConflictMarkerRowType;\n hunkIndex: number;\n /** Index into `hunk.hunkContent` for the structural block this row belongs to. */\n contentIndex: number;\n conflictIndex: number;\n lineText: string;\n /** Unified rendered-row index where this virtual row should be injected. */\n lineIndex: number;\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 collapsed?: boolean;\n disableFileHeader?: boolean;\n disableVirtualizationBuffers?: boolean;\n preferredHighlighter?: HighlighterTypes;\n useCSSClasses?: boolean;\n useTokenTransformer?: 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 /**\n * Options forwarded to the underlying diff algorithm when computing diffs\n * from file contents (oldFile/newFile). Has no effect on pre-parsed patches.\n */\n parseDiffOptions?: CreatePatchOptionsNonabortable;\n}\nexport type BaseDiffOptionsWithDefaults = Required<Omit<BaseDiffOptions, 'unsafeCSS' | 'preferredHighlighter' | 'parseDiffOptions'>>;\nexport type CustomPreProperties = Record<string, string | number | undefined>;\nexport interface PrePropertiesConfig extends Required<Pick<BaseDiffOptions, 'diffIndicators' | 'disableBackground' | 'disableLineNumbers' | 'overflow'>> {\n type: 'diff' | 'file';\n split: boolean;\n totalLines: number;\n customProperties?: CustomPreProperties;\n}\nexport type FileHeaderRenderMode = 'default' | 'custom';\nexport type RenderHeaderMetadataCallback = (fileDiff: FileDiffMetadata) => Element | string | number | null | undefined;\nexport type RenderHeaderPrefixCallback = (fileDiff: FileDiffMetadata) => Element | string | number | null | undefined;\nexport type RenderFileMetadata = (file: FileContents) => Element | string | number | null | undefined;\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 type MergeConflictResolution = 'current' | 'incoming' | 'both';\nexport interface MergeConflictRegion {\n conflictIndex: number;\n startLineIndex: number;\n startLineNumber: number;\n separatorLineIndex: number;\n separatorLineNumber: number;\n endLineIndex: number;\n endLineNumber: number;\n baseMarkerLineIndex?: number;\n baseMarkerLineNumber?: number;\n}\nexport interface MergeConflictActionPayload {\n resolution: MergeConflictResolution;\n conflict: MergeConflictRegion;\n}\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 TokenEventBase {\n type: 'token';\n lineNumber: number;\n lineCharStart: number;\n lineCharEnd: number;\n tokenText: string;\n tokenElement: HTMLElement;\n}\nexport interface DiffTokenEventBaseProps extends TokenEventBase {\n side: AnnotationSide;\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 useTokenTransformer: boolean;\n tokenizeMaxLineLength: number;\n}\nexport interface RenderDiffOptions {\n theme: DiffsThemeNames | Record<'dark' | 'light', DiffsThemeNames>;\n useTokenTransformer: boolean;\n tokenizeMaxLineLength: number;\n lineDiffType: LineDiffTypes;\n maxLineDiffLength: number;\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}\nexport interface SelectionPoint {\n lineNumber: number;\n side: SelectionSide | undefined;\n}\nexport type DiffAcceptRejectHunkType = 'accept' | 'reject' | 'both';\nexport type ConflictResolverTypes = 'current' | 'incoming' | 'both';\nexport interface DiffAcceptRejectHunkConfig {\n type: DiffAcceptRejectHunkType;\n changeIndex: number;\n}\n/**\n * Unresolved merge conflict indexes use three different coordinate spaces:\n * - source line indexes live on `conflict.*LineIndex`\n * - hunk-content indexes live on the fields below, with `startContentIndex`\n * serving as both the conflict-range start and the start-marker anchor\n * - rendered row indexes live on unresolved `markerRows`\n */\nexport interface ProcessFileConflictData {\n /** Index of the hunk that owns this unresolved conflict. */\n hunkIndex: number;\n /** First hunk-content entry that belongs to the conflict region. */\n startContentIndex: number;\n /** Last hunk-content entry that belongs to the conflict region. */\n endContentIndex: number;\n /** Hunk-content index for the current/ours change block. */\n currentContentIndex?: number;\n /** Hunk-content index for the optional base context block. */\n baseContentIndex?: number;\n /** Hunk-content index for the incoming/theirs change block. */\n incomingContentIndex?: number;\n /** Hunk-content index that anchors the end marker row. */\n endMarkerContentIndex: number;\n}\nexport interface AppliedThemeStyleCache {\n themeStyles: string;\n themeType: ThemeTypes;\n baseThemeType: 'light' | 'dark' | undefined;\n}\n//# sourceMappingURL=types.d.ts.map"],"mappings":";;;;;;;AAQA;AAgBA;AAEA;AACYe,UAnBKJ,YAAAA,CAmBiCG;EAQtCG;;EAA0DH,IAAAA,EAAAA,MAAAA;EAAvCR;EAAkB,QAAA,EAAA,MAAA;EASrCY;AAKZ;EAYiBG,IAAAA,CAAAA,EA7CNT,kBA6CoB;EAoBdU;EAqBAC,MAAAA,CAAI,EAAA,MAAA;EA0FJH;;;EAiCNG,QAAAA,CAAAA,EAAAA,MAAAA;;AAuCCC,KAhPAX,gBAAAA,GAgPAW,UAA0B,GAAA,YAAA;AAW1BZ,KAzPAE,eAAAA,GAAkBX,YAyPGD,GAAAA,aAAe,GAAA,cAAA,GAAA,CAAA,MAAA,GAAA,CAAA,CAAA,CAAA;AACpCwB,KAzPAX,UAAAA,GAAaC,MAyPD,CAAA,MAAA,GAAA,OAAA,EAzP0BF,eAyP1B,CAAA;AACxB;AAIA;AACA;AACA;;;;AAQ2BD,KAhQfI,gBAAAA,GAAmBX,kBAgQJO,CAhQuBD,kBAgQvBC,EAhQ2CC,eAgQ3CD,CAAAA;;AAM3B;;;;;;AAgBA;AAAwDkB,KA7Q5Cb,WAAAA,GA6Q4Ca,QAAAA,GAAAA,aAAAA,GAAAA,gBAAAA,GAAAA,KAAAA,GAAAA,SAAAA;;;;AACxD;AACiBK,UA1QAjB,WAAAA,CA0QmB;EAAuBY;;EAIpCI,aAAAA,CAAAA,EAAAA,MAAAA;EAJsBD;EAAQ,KA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AYF;;;UAGfG,yBAAAA;;;;;;UAMAC,iBAAAA;SACNhE,kBAAkBE,yBAAyBF;;;;UAIrCiE,iBAAAA;SACNjE,kBAAkBE,yBAAyBF;;;gBAGpCe;;;UAGDmD,gBAAAA;UACLT;WACCO;;UAEIG,gBAAAA;UACLR;WACCM;;UAEIG,oBAAAA;QACPvE;;WAEGmE;UACDP;eACKY;;UAEAC,oBAAAA;QACPhE;;WAEG2D;UACDN;eACKU;;UAEAA,WAAAA;;;;;;UAMAE,YAAAA;;;;UAIAC,kBAAAA;;;;UAIAC,kBAAAA;;;;;;;UAOAC,cAAAA;;QAEP3C;;KAEE4C,wBAAAA;KACAC,qBAAAA;UACKC,0BAAAA;QACPF;;;;;;;;;;UAUOG,uBAAAA;;;;;;;;;;;;;;;;UAgBAC,sBAAAA;;aAEFlE"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":["CreatePatchOptionsNonabortable","ElementContent","BundledLanguage","BundledTheme","CodeToHastOptions","DecorationItem","HighlighterGeneric","LanguageRegistration","ShikiTransformer","ThemedToken","ThemeRegistrationResolved","CodeViewScrollBehavior","FileContents","SupportedLanguages","HighlighterTypes","DiffsThemeNames","ThemesType","Record","DiffsHighlighter","ChangeTypes","ParsedPatch","FileDiffMetadata","ContextContent","ChangeContent","Hunk","MergeConflictMarkerRowType","MergeConflictMarkerRow","HunkLineType","ThemeTypes","HunkSeparators","LineDiffTypes","BaseCodeOptions","BaseDiffOptions","BaseDiffOptionsWithDefaults","Omit","Required","CustomPreProperties","PrePropertiesConfig","Pick","FileHeaderRenderMode","RenderHeaderMetadataCallback","Element","RenderHeaderPrefixCallback","RenderFileMetadata","ExtensionFormatMap","AnnotationSide","SelectionSide","OptionalMetadata","T","LineAnnotation","DiffLineAnnotation","CodeViewItemVersion","CodeViewFileItem","CodeViewDiffItem","CodeViewItem","CodeViewPositionScrollTarget","CodeViewLineScrollTarget","NumericScrollLineAnchor","CodeViewItemScrollTarget","CodeViewScrollTarget","MergeConflictResolution","MergeConflictRegion","MergeConflictActionPayload","GapSpan","LineSpans","AnnotationSpan","LineTypes","LineInfo","SharedRenderState","LineEventBaseProps","HTMLElement","DiffLineEventBaseProps","TokenEventBase","DiffTokenEventBaseProps","ObservedAnnotationNodes","ObservedGridNodes","CodeColumnType","HunkData","AnnotationLineMap","LAnnotation","ExpansionDirections","ThemedFileResult","RenderDiffFilesResult","ThemedDiffResult","HunkExpansionRegion","ForceDiffPlainTextOptions","Map","ForceFilePlainTextOptions","RenderFileOptions","RenderDiffOptions","RenderFileResult","RenderDiffResult","RenderedFileASTCache","RenderRange","RenderedDiffASTCache","RenderWindow","VirtualWindowSpecs","VirtualFileMetrics","CodeViewMetrics","SmoothScrollSettings","SelectionPoint","DiffAcceptRejectHunkType","ConflictResolverTypes","DiffAcceptRejectHunkConfig","ProcessFileConflictData","AppliedThemeStyleCache","StickySpecs"],"sources":["../src/types.d.ts"],"sourcesContent":["import type { CreatePatchOptionsNonabortable } from 'diff';\nimport type { ElementContent } from 'hast';\nimport type { BundledLanguage, BundledTheme, CodeToHastOptions, DecorationItem, HighlighterGeneric, LanguageRegistration, ShikiTransformer, ThemedToken, ThemeRegistrationResolved } from 'shiki';\nexport type { CreatePatchOptionsNonabortable };\nexport type CodeViewScrollBehavior = 'instant' | 'smooth' | 'smooth-auto';\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 HighlighterTypes = 'shiki-js' | 'shiki-wasm';\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 MergeConflictMarkerRowType = 'marker-start' | 'marker-base' | 'marker-separator' | 'marker-end';\nexport interface MergeConflictMarkerRow {\n type: MergeConflictMarkerRowType;\n hunkIndex: number;\n /** Index into `hunk.hunkContent` for the structural block this row belongs to. */\n contentIndex: number;\n conflictIndex: number;\n lineText: string;\n /** Unified rendered-row index where this virtual row should be injected. */\n lineIndex: number;\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 collapsed?: boolean;\n disableFileHeader?: boolean;\n disableVirtualizationBuffers?: boolean;\n stickyHeader?: boolean;\n preferredHighlighter?: HighlighterTypes;\n useCSSClasses?: boolean;\n useTokenTransformer?: boolean;\n tokenizeMaxLineLength?: number;\n tokenizeMaxLength?: 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 /**\n * Options forwarded to the underlying diff algorithm when computing diffs\n * from file contents (oldFile/newFile). Has no effect on pre-parsed patches.\n */\n parseDiffOptions?: CreatePatchOptionsNonabortable;\n}\nexport type BaseDiffOptionsWithDefaults = Required<Omit<BaseDiffOptions, 'unsafeCSS' | 'preferredHighlighter' | 'parseDiffOptions'>>;\nexport type CustomPreProperties = Record<string, string | number | undefined>;\nexport interface PrePropertiesConfig extends Required<Pick<BaseDiffOptions, 'diffIndicators' | 'disableBackground' | 'disableLineNumbers' | 'overflow'>> {\n type: 'diff' | 'file';\n split: boolean;\n totalLines: number;\n customProperties?: CustomPreProperties;\n}\nexport type FileHeaderRenderMode = 'default' | 'custom';\nexport type RenderHeaderMetadataCallback = (fileDiff: FileDiffMetadata) => Element | string | number | null | undefined;\nexport type RenderHeaderPrefixCallback = (fileDiff: FileDiffMetadata) => Element | string | number | null | undefined;\nexport type RenderFileMetadata = (file: FileContents) => Element | string | number | null | undefined;\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 type CodeViewItemVersion = string | number;\nexport type CodeViewFileItem<T = undefined> = {\n id: string;\n type: 'file';\n file: FileContents;\n annotations?: LineAnnotation<T>[];\n version?: CodeViewItemVersion;\n collapsed?: boolean;\n};\nexport type CodeViewDiffItem<T = undefined> = {\n id: string;\n type: 'diff';\n fileDiff: FileDiffMetadata;\n annotations?: DiffLineAnnotation<T>[];\n version?: CodeViewItemVersion;\n collapsed?: boolean;\n};\nexport type CodeViewItem<T = undefined> = CodeViewFileItem<T> | CodeViewDiffItem<T>;\nexport interface CodeViewPositionScrollTarget {\n type: 'position';\n position: number;\n behavior?: CodeViewScrollBehavior;\n}\nexport interface CodeViewLineScrollTarget {\n type: 'line';\n id: string;\n lineNumber: number;\n side?: SelectionSide;\n align?: 'start' | 'center' | 'end' | 'nearest';\n offset?: number;\n behavior?: CodeViewScrollBehavior;\n}\nexport interface NumericScrollLineAnchor {\n lineNumber: number;\n top: number;\n side?: SelectionSide;\n}\nexport interface CodeViewItemScrollTarget {\n type: 'item';\n id: string;\n align?: 'start' | 'center' | 'end' | 'nearest';\n offset?: number;\n behavior?: CodeViewScrollBehavior;\n}\nexport type CodeViewScrollTarget = CodeViewPositionScrollTarget | CodeViewLineScrollTarget | CodeViewItemScrollTarget;\nexport type MergeConflictResolution = 'current' | 'incoming' | 'both';\nexport interface MergeConflictRegion {\n conflictIndex: number;\n startLineIndex: number;\n startLineNumber: number;\n separatorLineIndex: number;\n separatorLineNumber: number;\n endLineIndex: number;\n endLineNumber: number;\n baseMarkerLineIndex?: number;\n baseMarkerLineNumber?: number;\n}\nexport interface MergeConflictActionPayload {\n resolution: MergeConflictResolution;\n conflict: MergeConflictRegion;\n}\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 TokenEventBase {\n type: 'token';\n lineNumber: number;\n lineCharStart: number;\n lineCharEnd: number;\n tokenText: string;\n tokenElement: HTMLElement;\n}\nexport interface DiffTokenEventBaseProps extends TokenEventBase {\n side: AnnotationSide;\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 useTokenTransformer: boolean;\n tokenizeMaxLineLength: number;\n}\nexport interface RenderDiffOptions {\n theme: DiffsThemeNames | Record<'dark' | 'light', DiffsThemeNames>;\n useTokenTransformer: boolean;\n tokenizeMaxLineLength: number;\n lineDiffType: LineDiffTypes;\n maxLineDiffLength: number;\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 /** Absolute top edge of the active virtual window in scroll-space pixels. */\n top: number;\n /** Absolute bottom edge of the active virtual window in scroll-space pixels. */\n bottom: number;\n}\nexport interface VirtualFileMetrics {\n /** Number of rendered lines per hunk chunk when virtualization batches line rendering. */\n hunkLineCount: number;\n /** Estimated single-line row height used before a line is measured. */\n lineHeight: number;\n /** Height reserved for the file or diff header region. */\n diffHeaderHeight: number;\n /** Height reserved for each collapsed-context separator row. */\n hunkSeparatorHeight: number;\n /** Vertical spacing used around hunks and file-level padding. You should not\n * change this from the default if you aren't applying custom CSS */\n spacing: number;\n /** Optional top padding applied after the file header, or before content\n * when the header is disabled. Defaults to 0 with a header, otherwise\n * defaults to spacing if header is disabled */\n paddingTop?: number;\n /** Optional bottom padding applied after file content, and only if there is\n * code for the diff. Defaults to spacing if none provided */\n paddingBottom?: number;\n}\nexport interface CodeViewMetrics {\n /** Top padding applied to the viewer's sticky container offset. */\n paddingTop: number;\n /** Bottom padding added after the final rendered item in the viewer. */\n paddingBottom: number;\n /** Vertical gap between virtualized items in the viewer. */\n gap: number;\n}\nexport interface SmoothScrollSettings {\n /**\n * Natural frequency of the critically-damped spring, in rad/ms. 99% settle\n * takes roughly `6.6 / omega`; 0.015 gives ~440ms. Raise for a snappier\n * animation; lower for a longer glide.\n */\n omega: number;\n /**\n * Distance from destination (in CSS pixels) below which the spring is\n * considered settled. Must also clear `velocityEpsilon` before the\n * animation actually stops and snaps to destination.\n */\n positionEpsilon: number;\n /**\n * Velocity magnitude (in CSS pixels per millisecond) below which the\n * spring is considered effectively stationary. Pairs with\n * `positionEpsilon` to gate the settle transition.\n */\n velocityEpsilon: number;\n}\nexport interface SelectionPoint {\n lineNumber: number;\n side: SelectionSide | undefined;\n}\nexport type DiffAcceptRejectHunkType = 'accept' | 'reject' | 'both';\nexport type ConflictResolverTypes = 'current' | 'incoming' | 'both';\nexport interface DiffAcceptRejectHunkConfig {\n type: DiffAcceptRejectHunkType;\n changeIndex: number;\n}\n/**\n * Unresolved merge conflict indexes use three different coordinate spaces:\n * - source line indexes live on `conflict.*LineIndex`\n * - hunk-content indexes live on the fields below, with `startContentIndex`\n * serving as both the conflict-range start and the start-marker anchor\n * - rendered row indexes live on unresolved `markerRows`\n */\nexport interface ProcessFileConflictData {\n /** Index of the hunk that owns this unresolved conflict. */\n hunkIndex: number;\n /** First hunk-content entry that belongs to the conflict region. */\n startContentIndex: number;\n /** Last hunk-content entry that belongs to the conflict region. */\n endContentIndex: number;\n /** Hunk-content index for the current/ours change block. */\n currentContentIndex?: number;\n /** Hunk-content index for the optional base context block. */\n baseContentIndex?: number;\n /** Hunk-content index for the incoming/theirs change block. */\n incomingContentIndex?: number;\n /** Hunk-content index that anchors the end marker row. */\n endMarkerContentIndex: number;\n}\nexport interface AppliedThemeStyleCache {\n theme: DiffsThemeNames | ThemesType;\n themeStyles: string;\n themeType: ThemeTypes;\n baseThemeType: 'light' | 'dark' | undefined;\n}\nexport interface StickySpecs {\n topOffset: number;\n height: number;\n}\n//# sourceMappingURL=types.d.ts.map"],"mappings":";;;;;KAIYW,sBAAAA;AAAZ;AAKA;AAgBA;AAEA;AACYK,UAnBKJ,YAAAA,CAmBiCG;EAQtCG;;EAA0DH,IAAAA,EAAAA,MAAAA;EAAvCT;EAAkB,QAAA,EAAA,MAAA;EASrCa;AAKZ;EAYiBG,IAAAA,CAAAA,EA7CNT,kBA6CoB;EAoBdU;EAqBAC,MAAAA,CAAI,EAAA,MAAA;EA0FJH;;;EAiCNG,QAAAA,CAAAA,EAAAA,MAAAA;;AAuCCC,KAhPAX,gBAAAA,GAgPAW,UAA0B,GAAA,YAAA;AAW1BZ,KAzPAE,eAAAA,GAAkBZ,YAyPGD,GAAAA,aAAe,GAAA,cAAA,GAAA,CAAA,MAAA,GAAA,CAAA,CAAA,CAAA;AACpCyB,KAzPAX,UAAAA,GAAaC,MAyPD,CAAA,MAAA,GAAA,OAAA,EAzP0BF,eAyP1B,CAAA;AACxB;AAIA;AACA;AACA;;;;AAS2BD,KAjQfI,gBAAAA,GAAmBZ,kBAiQJQ,CAjQuBD,kBAiQvBC,EAjQ2CC,eAiQ3CD,CAAAA;;AAO3B;;;;;;AAgBA;AAAwDkB,KA/Q5Cb,WAAAA,GA+Q4Ca,QAAAA,GAAAA,aAAAA,GAAAA,gBAAAA,GAAAA,KAAAA,GAAAA,SAAAA;;;;AACxD;AACiBK,UA5QAjB,WAAAA,CA4QmB;EAAuBY;;EAIpCI,aAAAA,CAAAA,EAAAA,MAAAA;EAJsBD;EAAQ,KAAA,EAvQ1Cd,gBAuQ0C,EAAA;AAMrD;AACA;AACA;AAC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A"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CodeViewRenderedItem } from "../components/CodeView.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/areManagedSnapshotsEqual.d.ts
|
|
4
|
+
declare function areManagedSnapshotsEqual<LAnnotation>(previous: CodeViewRenderedItem<LAnnotation>[] | undefined, next: CodeViewRenderedItem<LAnnotation>[] | undefined): boolean;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { areManagedSnapshotsEqual };
|
|
7
|
+
//# sourceMappingURL=areManagedSnapshotsEqual.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"areManagedSnapshotsEqual.d.ts","names":["CodeViewRenderedItem","areManagedSnapshotsEqual","LAnnotation"],"sources":["../../src/utils/areManagedSnapshotsEqual.d.ts"],"sourcesContent":["import type { CodeViewRenderedItem } from '../components/CodeView';\nexport declare function areManagedSnapshotsEqual<LAnnotation>(previous: CodeViewRenderedItem<LAnnotation>[] | undefined, next: CodeViewRenderedItem<LAnnotation>[] | undefined): boolean;\n//# sourceMappingURL=areManagedSnapshotsEqual.d.ts.map"],"mappings":";;;iBACwBC,gDAAgDD,qBAAqBE,kCAAkCF,qBAAqBE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/utils/areManagedSnapshotsEqual.ts
|
|
2
|
+
function areManagedSnapshotsEqual(previous, next) {
|
|
3
|
+
if (previous == null || next == null) return previous === next;
|
|
4
|
+
if (previous.length !== next.length) return false;
|
|
5
|
+
for (let index = 0; index < previous.length; index++) {
|
|
6
|
+
const previousItem = previous[index];
|
|
7
|
+
const nextItem = next[index];
|
|
8
|
+
if (previousItem == null || nextItem == null || previousItem.id !== nextItem.id || previousItem.type !== nextItem.type || previousItem.element !== nextItem.element || previousItem.version !== nextItem.version) return false;
|
|
9
|
+
}
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { areManagedSnapshotsEqual };
|
|
15
|
+
//# sourceMappingURL=areManagedSnapshotsEqual.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"areManagedSnapshotsEqual.js","names":[],"sources":["../../src/utils/areManagedSnapshotsEqual.ts"],"sourcesContent":["import type { CodeViewRenderedItem } from '../components/CodeView';\n\nexport function areManagedSnapshotsEqual<LAnnotation>(\n previous: CodeViewRenderedItem<LAnnotation>[] | undefined,\n next: CodeViewRenderedItem<LAnnotation>[] | undefined\n): boolean {\n if (previous == null || next == null) {\n return previous === next;\n }\n\n if (previous.length !== next.length) {\n return false;\n }\n\n for (let index = 0; index < previous.length; index++) {\n const previousItem = previous[index];\n const nextItem = next[index];\n if (\n previousItem == null ||\n nextItem == null ||\n previousItem.id !== nextItem.id ||\n previousItem.type !== nextItem.type ||\n previousItem.element !== nextItem.element ||\n previousItem.version !== nextItem.version\n ) {\n return false;\n }\n }\n\n return true;\n}\n"],"mappings":";AAEA,SAAgB,yBACd,UACA,MACS;AACT,KAAI,YAAY,QAAQ,QAAQ,KAC9B,QAAO,aAAa;AAGtB,KAAI,SAAS,WAAW,KAAK,OAC3B,QAAO;AAGT,MAAK,IAAI,QAAQ,GAAG,QAAQ,SAAS,QAAQ,SAAS;EACpD,MAAM,eAAe,SAAS;EAC9B,MAAM,WAAW,KAAK;AACtB,MACE,gBAAgB,QAChB,YAAY,QACZ,aAAa,OAAO,SAAS,MAC7B,aAAa,SAAS,SAAS,QAC/B,aAAa,YAAY,SAAS,WAClC,aAAa,YAAY,SAAS,QAElC,QAAO;;AAIX,QAAO"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { FileOptions } from "../components/File.js";
|
|
2
2
|
import "../react/index.js";
|
|
3
3
|
import { FileDiffOptions } from "../components/FileDiff.js";
|
|
4
|
+
import { CodeViewOptions } from "../components/CodeView.js";
|
|
4
5
|
|
|
5
6
|
//#region src/utils/areOptionsEqual.d.ts
|
|
6
|
-
type AnyOptions<L> = FileOptions<L> | FileDiffOptions<L> | undefined;
|
|
7
|
+
type AnyOptions<L> = CodeViewOptions<L> | FileOptions<L> | FileDiffOptions<L> | undefined;
|
|
7
8
|
declare function areOptionsEqual<LAnnotation>(optionsA: AnyOptions<LAnnotation>, optionsB: AnyOptions<LAnnotation>): boolean;
|
|
8
9
|
//#endregion
|
|
9
10
|
export { areOptionsEqual };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"areOptionsEqual.d.ts","names":["FileDiffOptions","FileOptions","AnyOptions","L","areOptionsEqual","LAnnotation"],"sources":["../../src/utils/areOptionsEqual.d.ts"],"sourcesContent":["import type { FileDiffOptions } from '../components/FileDiff';\nimport type { FileOptions } from '../react';\ntype AnyOptions<L> = FileOptions<L> | FileDiffOptions<L> | undefined;\nexport declare function areOptionsEqual<LAnnotation>(optionsA: AnyOptions<LAnnotation>, optionsB: AnyOptions<LAnnotation>): boolean;\nexport {};\n//# sourceMappingURL=areOptionsEqual.d.ts.map"],"mappings":"
|
|
1
|
+
{"version":3,"file":"areOptionsEqual.d.ts","names":["CodeViewOptions","FileDiffOptions","FileOptions","AnyOptions","L","areOptionsEqual","LAnnotation"],"sources":["../../src/utils/areOptionsEqual.d.ts"],"sourcesContent":["import type { CodeViewOptions } from '../components/CodeView';\nimport type { FileDiffOptions } from '../components/FileDiff';\nimport type { FileOptions } from '../react';\ntype AnyOptions<L> = CodeViewOptions<L> | FileOptions<L> | FileDiffOptions<L> | undefined;\nexport declare function areOptionsEqual<LAnnotation>(optionsA: AnyOptions<LAnnotation>, optionsB: AnyOptions<LAnnotation>): boolean;\nexport {};\n//# sourceMappingURL=areOptionsEqual.d.ts.map"],"mappings":";;;;;;KAGKG,gBAAgBH,gBAAgBI,KAAKF,YAAYE,KAAKH,gBAAgBG;iBACnDC,uCAAuCF,WAAWG,wBAAwBH,WAAWG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_THEMES } from "../constants.js";
|
|
2
|
-
import { areThemesEqual } from "./areThemesEqual.js";
|
|
3
2
|
import { areObjectsEqual } from "./areObjectsEqual.js";
|
|
3
|
+
import { areThemesEqual } from "./areThemesEqual.js";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/areOptionsEqual.ts
|
|
6
6
|
function areOptionsEqual(optionsA, optionsB) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"areOptionsEqual.js","names":[],"sources":["../../src/utils/areOptionsEqual.ts"],"sourcesContent":["import type { CreatePatchOptionsNonabortable } from 'diff';\n\nimport type { FileDiffOptions } from '../components/FileDiff';\nimport { DEFAULT_THEMES } from '../constants';\nimport type { FileOptions } from '../react';\nimport { areObjectsEqual } from './areObjectsEqual';\nimport { areThemesEqual } from './areThemesEqual';\n\ntype AnyOptions<L>
|
|
1
|
+
{"version":3,"file":"areOptionsEqual.js","names":[],"sources":["../../src/utils/areOptionsEqual.ts"],"sourcesContent":["import type { CreatePatchOptionsNonabortable } from 'diff';\n\nimport type { CodeViewOptions } from '../components/CodeView';\nimport type { FileDiffOptions } from '../components/FileDiff';\nimport { DEFAULT_THEMES } from '../constants';\nimport type { FileOptions } from '../react';\nimport { areObjectsEqual } from './areObjectsEqual';\nimport { areThemesEqual } from './areThemesEqual';\n\ntype AnyOptions<L> =\n | CodeViewOptions<L>\n | FileOptions<L>\n | FileDiffOptions<L>\n | undefined;\n\nexport function areOptionsEqual<LAnnotation>(\n optionsA: AnyOptions<LAnnotation>,\n optionsB: AnyOptions<LAnnotation>\n): boolean {\n const themeA = optionsA?.theme ?? DEFAULT_THEMES;\n const themeB = optionsB?.theme ?? DEFAULT_THEMES;\n const diffOptsA = getParseDiffOptions(optionsA);\n const diffOptsB = getParseDiffOptions(optionsB);\n return (\n areThemesEqual(themeA, themeB) &&\n areObjectsEqual(optionsA, optionsB, [\n 'theme',\n 'parseDiffOptions' as keyof typeof optionsA,\n ]) &&\n areObjectsEqual(diffOptsA, diffOptsB)\n );\n}\n\nfunction getParseDiffOptions<L>(\n options: AnyOptions<L>\n): CreatePatchOptionsNonabortable | undefined {\n if (options != null && 'parseDiffOptions' in options) {\n return options.parseDiffOptions;\n }\n return undefined;\n}\n"],"mappings":";;;;;AAeA,SAAgB,gBACd,UACA,UACS;CACT,MAAM,SAAS,UAAU,SAAS;CAClC,MAAM,SAAS,UAAU,SAAS;CAClC,MAAM,YAAY,oBAAoB,SAAS;CAC/C,MAAM,YAAY,oBAAoB,SAAS;AAC/C,QACE,eAAe,QAAQ,OAAO,IAC9B,gBAAgB,UAAU,UAAU,CAClC,SACA,mBACD,CAAC,IACF,gBAAgB,WAAW,UAAU;;AAIzC,SAAS,oBACP,SAC4C;AAC5C,KAAI,WAAW,QAAQ,sBAAsB,QAC3C,QAAO,QAAQ"}
|
|
@@ -5,10 +5,12 @@ import { Element } from "hast";
|
|
|
5
5
|
interface CreateFileHeaderElementProps {
|
|
6
6
|
fileOrDiff: FileDiffMetadata | FileContents;
|
|
7
7
|
mode: FileHeaderRenderMode;
|
|
8
|
+
stickyHeader: boolean;
|
|
8
9
|
}
|
|
9
10
|
declare function createFileHeaderElement({
|
|
10
11
|
fileOrDiff,
|
|
11
|
-
mode
|
|
12
|
+
mode,
|
|
13
|
+
stickyHeader
|
|
12
14
|
}: CreateFileHeaderElementProps): Element;
|
|
13
15
|
//#endregion
|
|
14
16
|
export { CreateFileHeaderElementProps, createFileHeaderElement };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFileHeaderElement.d.ts","names":["Element","HASTElement","FileContents","FileDiffMetadata","FileHeaderRenderMode","CreateFileHeaderElementProps","createFileHeaderElement","fileOrDiff","mode"],"sources":["../../src/utils/createFileHeaderElement.d.ts"],"sourcesContent":["import type { Element as HASTElement } from 'hast';\nimport type { FileContents, FileDiffMetadata, FileHeaderRenderMode } from '../types';\nexport interface CreateFileHeaderElementProps {\n fileOrDiff: FileDiffMetadata | FileContents;\n mode: FileHeaderRenderMode;\n}\nexport declare function createFileHeaderElement({ fileOrDiff, mode }: CreateFileHeaderElementProps): HASTElement;\n//# sourceMappingURL=createFileHeaderElement.d.ts.map"],"mappings":";;;;UAEiBK,4BAAAA;cACDF,mBAAmBD;EADlBG,IAAAA,EAEPD,oBAFOC;;
|
|
1
|
+
{"version":3,"file":"createFileHeaderElement.d.ts","names":["Element","HASTElement","FileContents","FileDiffMetadata","FileHeaderRenderMode","CreateFileHeaderElementProps","createFileHeaderElement","fileOrDiff","mode","stickyHeader"],"sources":["../../src/utils/createFileHeaderElement.d.ts"],"sourcesContent":["import type { Element as HASTElement } from 'hast';\nimport type { FileContents, FileDiffMetadata, FileHeaderRenderMode } from '../types';\nexport interface CreateFileHeaderElementProps {\n fileOrDiff: FileDiffMetadata | FileContents;\n mode: FileHeaderRenderMode;\n stickyHeader: boolean;\n}\nexport declare function createFileHeaderElement({ fileOrDiff, mode, stickyHeader }: CreateFileHeaderElementProps): HASTElement;\n//# sourceMappingURL=createFileHeaderElement.d.ts.map"],"mappings":";;;;UAEiBK,4BAAAA;cACDF,mBAAmBD;EADlBG,IAAAA,EAEPD,oBAFOC;EACDF,YAAAA,EAAAA,OAAAA;;AACNC,iBAGcE,uBAAAA,CAHdF;EAAAA,UAAAA;EAAAA,IAAAA;EAAAA;AAAAA,CAAAA,EAG0EC,4BAH1ED,CAAAA,EAGyGH,OAHzGG"}
|
|
@@ -3,11 +3,12 @@ import { createHastElement, createIconElement, createTextNodeElement } from "./h
|
|
|
3
3
|
import { getIconForType } from "./getIconForType.js";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/createFileHeaderElement.ts
|
|
6
|
-
function createFileHeaderElement({ fileOrDiff, mode }) {
|
|
6
|
+
function createFileHeaderElement({ fileOrDiff, mode, stickyHeader }) {
|
|
7
7
|
const fileDiff = "type" in fileOrDiff ? fileOrDiff : void 0;
|
|
8
8
|
const properties = {
|
|
9
9
|
"data-diffs-header": mode,
|
|
10
|
-
"data-change-type": fileDiff?.type
|
|
10
|
+
"data-change-type": fileDiff?.type,
|
|
11
|
+
"data-sticky": stickyHeader ? "" : void 0
|
|
11
12
|
};
|
|
12
13
|
return createHastElement({
|
|
13
14
|
tagName: "div",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFileHeaderElement.js","names":["properties: Properties","children: ElementContent[]"],"sources":["../../src/utils/createFileHeaderElement.ts"],"sourcesContent":["import type { ElementContent, Element as HASTElement, Properties } from 'hast';\n\nimport {\n CUSTOM_HEADER_SLOT_ID,\n HEADER_METADATA_SLOT_ID,\n HEADER_PREFIX_SLOT_ID,\n} from '../constants';\nimport type {\n ChangeTypes,\n FileContents,\n FileDiffMetadata,\n FileHeaderRenderMode,\n} from '../types';\nimport { getIconForType } from './getIconForType';\nimport {\n createHastElement,\n createIconElement,\n createTextNodeElement,\n} from './hast_utils';\n\nexport interface CreateFileHeaderElementProps {\n fileOrDiff: FileDiffMetadata | FileContents;\n mode: FileHeaderRenderMode;\n}\n\nexport function createFileHeaderElement({\n fileOrDiff,\n mode,\n}: CreateFileHeaderElementProps): HASTElement {\n const fileDiff = 'type' in fileOrDiff ? fileOrDiff : undefined;\n const properties: Properties = {\n 'data-diffs-header': mode,\n 'data-change-type': fileDiff?.type,\n };\n\n return createHastElement({\n tagName: 'div',\n children: [\n mode === 'custom'\n ? createHastElement({\n tagName: 'slot',\n properties: { name: CUSTOM_HEADER_SLOT_ID },\n })\n : createHeaderElement({\n name: fileOrDiff.name,\n prevName:\n 'prevName' in fileOrDiff ? fileOrDiff.prevName : undefined,\n iconType: fileDiff?.type ?? 'file',\n }),\n ...(mode === 'custom' ? [] : [createMetadataElement(fileDiff)]),\n ],\n properties,\n });\n}\n\ninterface CreateHeaderElementOptions {\n name: string;\n prevName?: string;\n iconType: ChangeTypes | 'file';\n}\n\nfunction createHeaderElement({\n name,\n prevName,\n iconType,\n}: CreateHeaderElementOptions): HASTElement {\n const children: ElementContent[] = [\n createHastElement({\n tagName: 'slot',\n properties: { name: HEADER_PREFIX_SLOT_ID },\n }),\n createIconElement({\n name: getIconForType(iconType),\n properties: { 'data-change-icon': iconType },\n }),\n ];\n if (prevName != null) {\n children.push(\n createHastElement({\n tagName: 'div',\n children: [\n createHastElement({\n tagName: 'bdi',\n children: [createTextNodeElement(prevName)],\n }),\n ],\n properties: {\n 'data-prev-name': '',\n },\n })\n );\n children.push(\n createIconElement({\n name: 'diffs-icon-arrow-right-short',\n properties: {\n 'data-rename-icon': '',\n },\n })\n );\n }\n children.push(\n createHastElement({\n tagName: 'div',\n children: [\n createHastElement({\n tagName: 'bdi',\n children: [createTextNodeElement(name)],\n }),\n ],\n properties: { 'data-title': '' },\n })\n );\n return createHastElement({\n tagName: 'div',\n children,\n properties: { 'data-header-content': '' },\n });\n}\n\nfunction createMetadataElement(\n fileDiff: FileDiffMetadata | undefined\n): HASTElement {\n const children: ElementContent[] = [];\n if (fileDiff != null) {\n let additions = 0;\n let deletions = 0;\n for (const hunk of fileDiff.hunks) {\n additions += hunk.additionLines;\n deletions += hunk.deletionLines;\n }\n if (deletions > 0 || additions === 0) {\n children.push(\n createHastElement({\n tagName: 'span',\n children: [createTextNodeElement(`-${deletions}`)],\n properties: { 'data-deletions-count': '' },\n })\n );\n }\n if (additions > 0 || deletions === 0) {\n children.push(\n createHastElement({\n tagName: 'span',\n children: [createTextNodeElement(`+${additions}`)],\n properties: { 'data-additions-count': '' },\n })\n );\n }\n }\n children.push(\n createHastElement({\n tagName: 'slot',\n properties: { name: HEADER_METADATA_SLOT_ID },\n })\n );\n return createHastElement({\n tagName: 'div',\n children,\n properties: { 'data-metadata': '' },\n });\n}\n"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"createFileHeaderElement.js","names":["properties: Properties","children: ElementContent[]"],"sources":["../../src/utils/createFileHeaderElement.ts"],"sourcesContent":["import type { ElementContent, Element as HASTElement, Properties } from 'hast';\n\nimport {\n CUSTOM_HEADER_SLOT_ID,\n HEADER_METADATA_SLOT_ID,\n HEADER_PREFIX_SLOT_ID,\n} from '../constants';\nimport type {\n ChangeTypes,\n FileContents,\n FileDiffMetadata,\n FileHeaderRenderMode,\n} from '../types';\nimport { getIconForType } from './getIconForType';\nimport {\n createHastElement,\n createIconElement,\n createTextNodeElement,\n} from './hast_utils';\n\nexport interface CreateFileHeaderElementProps {\n fileOrDiff: FileDiffMetadata | FileContents;\n mode: FileHeaderRenderMode;\n stickyHeader: boolean;\n}\n\nexport function createFileHeaderElement({\n fileOrDiff,\n mode,\n stickyHeader,\n}: CreateFileHeaderElementProps): HASTElement {\n const fileDiff = 'type' in fileOrDiff ? fileOrDiff : undefined;\n const properties: Properties = {\n 'data-diffs-header': mode,\n 'data-change-type': fileDiff?.type,\n 'data-sticky': stickyHeader ? '' : undefined,\n };\n\n return createHastElement({\n tagName: 'div',\n children: [\n mode === 'custom'\n ? createHastElement({\n tagName: 'slot',\n properties: { name: CUSTOM_HEADER_SLOT_ID },\n })\n : createHeaderElement({\n name: fileOrDiff.name,\n prevName:\n 'prevName' in fileOrDiff ? fileOrDiff.prevName : undefined,\n iconType: fileDiff?.type ?? 'file',\n }),\n ...(mode === 'custom' ? [] : [createMetadataElement(fileDiff)]),\n ],\n properties,\n });\n}\n\ninterface CreateHeaderElementOptions {\n name: string;\n prevName?: string;\n iconType: ChangeTypes | 'file';\n}\n\nfunction createHeaderElement({\n name,\n prevName,\n iconType,\n}: CreateHeaderElementOptions): HASTElement {\n const children: ElementContent[] = [\n createHastElement({\n tagName: 'slot',\n properties: { name: HEADER_PREFIX_SLOT_ID },\n }),\n createIconElement({\n name: getIconForType(iconType),\n properties: { 'data-change-icon': iconType },\n }),\n ];\n if (prevName != null) {\n children.push(\n createHastElement({\n tagName: 'div',\n children: [\n createHastElement({\n tagName: 'bdi',\n children: [createTextNodeElement(prevName)],\n }),\n ],\n properties: {\n 'data-prev-name': '',\n },\n })\n );\n children.push(\n createIconElement({\n name: 'diffs-icon-arrow-right-short',\n properties: {\n 'data-rename-icon': '',\n },\n })\n );\n }\n children.push(\n createHastElement({\n tagName: 'div',\n children: [\n createHastElement({\n tagName: 'bdi',\n children: [createTextNodeElement(name)],\n }),\n ],\n properties: { 'data-title': '' },\n })\n );\n return createHastElement({\n tagName: 'div',\n children,\n properties: { 'data-header-content': '' },\n });\n}\n\nfunction createMetadataElement(\n fileDiff: FileDiffMetadata | undefined\n): HASTElement {\n const children: ElementContent[] = [];\n if (fileDiff != null) {\n let additions = 0;\n let deletions = 0;\n for (const hunk of fileDiff.hunks) {\n additions += hunk.additionLines;\n deletions += hunk.deletionLines;\n }\n if (deletions > 0 || additions === 0) {\n children.push(\n createHastElement({\n tagName: 'span',\n children: [createTextNodeElement(`-${deletions}`)],\n properties: { 'data-deletions-count': '' },\n })\n );\n }\n if (additions > 0 || deletions === 0) {\n children.push(\n createHastElement({\n tagName: 'span',\n children: [createTextNodeElement(`+${additions}`)],\n properties: { 'data-additions-count': '' },\n })\n );\n }\n }\n children.push(\n createHastElement({\n tagName: 'slot',\n properties: { name: HEADER_METADATA_SLOT_ID },\n })\n );\n return createHastElement({\n tagName: 'div',\n children,\n properties: { 'data-metadata': '' },\n });\n}\n"],"mappings":";;;;;AA0BA,SAAgB,wBAAwB,EACtC,YACA,MACA,gBAC4C;CAC5C,MAAM,WAAW,UAAU,aAAa,aAAa;CACrD,MAAMA,aAAyB;EAC7B,qBAAqB;EACrB,oBAAoB,UAAU;EAC9B,eAAe,eAAe,KAAK;EACpC;AAED,QAAO,kBAAkB;EACvB,SAAS;EACT,UAAU,CACR,SAAS,WACL,kBAAkB;GAChB,SAAS;GACT,YAAY,EAAE,MAAM,uBAAuB;GAC5C,CAAC,GACF,oBAAoB;GAClB,MAAM,WAAW;GACjB,UACE,cAAc,aAAa,WAAW,WAAW;GACnD,UAAU,UAAU,QAAQ;GAC7B,CAAC,EACN,GAAI,SAAS,WAAW,EAAE,GAAG,CAAC,sBAAsB,SAAS,CAAC,CAC/D;EACD;EACD,CAAC;;AASJ,SAAS,oBAAoB,EAC3B,MACA,UACA,YAC0C;CAC1C,MAAMC,WAA6B,CACjC,kBAAkB;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T,YAAY,EAAE,MAAM,yBAAyB;EAC9C,CAAC,CACH;AACD,QAAO,kBAAkB;EACvB,SAAS;EACT;EACA,YAAY,EAAE,iBAAiB,IAAI;EACpC,CAAC"}
|
|
@@ -5,16 +5,16 @@ interface WindowFromScrollPositionProps {
|
|
|
5
5
|
scrollTop: number;
|
|
6
6
|
height: number;
|
|
7
7
|
scrollHeight: number;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
fitPerfectly?: boolean;
|
|
9
|
+
fitPerfectlyOverscroll?: number;
|
|
10
10
|
overscrollSize: number;
|
|
11
11
|
}
|
|
12
12
|
declare function createWindowFromScrollPosition({
|
|
13
13
|
scrollTop,
|
|
14
14
|
scrollHeight,
|
|
15
15
|
height,
|
|
16
|
-
containerOffset,
|
|
17
16
|
fitPerfectly,
|
|
17
|
+
fitPerfectlyOverscroll,
|
|
18
18
|
overscrollSize
|
|
19
19
|
}: WindowFromScrollPositionProps): VirtualWindowSpecs;
|
|
20
20
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createWindowFromScrollPosition.d.ts","names":["VirtualWindowSpecs","WindowFromScrollPositionProps","createWindowFromScrollPosition","scrollTop","scrollHeight","height","
|
|
1
|
+
{"version":3,"file":"createWindowFromScrollPosition.d.ts","names":["VirtualWindowSpecs","WindowFromScrollPositionProps","createWindowFromScrollPosition","scrollTop","scrollHeight","height","fitPerfectly","fitPerfectlyOverscroll","overscrollSize"],"sources":["../../src/utils/createWindowFromScrollPosition.d.ts"],"sourcesContent":["import type { VirtualWindowSpecs } from '../types';\ninterface WindowFromScrollPositionProps {\n scrollTop: number;\n height: number;\n scrollHeight: number;\n fitPerfectly?: boolean;\n fitPerfectlyOverscroll?: number;\n overscrollSize: number;\n}\nexport declare function createWindowFromScrollPosition({ scrollTop, scrollHeight, height, fitPerfectly, fitPerfectlyOverscroll, overscrollSize }: WindowFromScrollPositionProps): VirtualWindowSpecs;\nexport {};\n//# sourceMappingURL=createWindowFromScrollPosition.d.ts.map"],"mappings":";;;UACUC,6BAAAA;;EAAAA,MAAAA,EAAAA,MAAAA;EAQcC,YAAAA,EAAAA,MAAAA;EAAiCC,YAAAA,CAAAA,EAAAA,OAAAA;EAAWC,sBAAAA,CAAAA,EAAAA,MAAAA;EAAcC,cAAAA,EAAAA,MAAAA;;AAAsBE,iBAAhFL,8BAAAA,CAAgFK;EAAAA,SAAAA;EAAAA,YAAAA;EAAAA,MAAAA;EAAAA,YAAAA;EAAAA,sBAAAA;EAAAA;AAAAA,CAAAA,EAA0CN,6BAA1CM,CAAAA,EAA0EP,kBAA1EO"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
//#region src/utils/createWindowFromScrollPosition.ts
|
|
2
|
-
function createWindowFromScrollPosition({ scrollTop, scrollHeight, height,
|
|
2
|
+
function createWindowFromScrollPosition({ scrollTop, scrollHeight, height, fitPerfectly = false, fitPerfectlyOverscroll = 0, overscrollSize }) {
|
|
3
3
|
const windowHeight = height + overscrollSize * 2;
|
|
4
|
-
const effectiveHeight = fitPerfectly ? height : windowHeight;
|
|
4
|
+
const effectiveHeight = fitPerfectly ? height + fitPerfectlyOverscroll * 2 : windowHeight;
|
|
5
5
|
scrollHeight = Math.max(scrollHeight, effectiveHeight);
|
|
6
6
|
if (windowHeight >= scrollHeight || fitPerfectly) {
|
|
7
|
-
const top$1 = Math.max(scrollTop -
|
|
8
|
-
const bottom$1 = Math.min(scrollTop + effectiveHeight, scrollHeight)
|
|
7
|
+
const top$1 = Math.max(scrollTop - fitPerfectlyOverscroll, 0);
|
|
8
|
+
const bottom$1 = Math.min(scrollTop + effectiveHeight, scrollHeight);
|
|
9
9
|
return {
|
|
10
10
|
top: top$1,
|
|
11
11
|
bottom: Math.max(bottom$1, top$1)
|
|
@@ -15,10 +15,10 @@ function createWindowFromScrollPosition({ scrollTop, scrollHeight, height, conta
|
|
|
15
15
|
let bottom = top + windowHeight;
|
|
16
16
|
if (top < 0) top = 0;
|
|
17
17
|
if (bottom > scrollHeight) bottom = scrollHeight;
|
|
18
|
-
top = Math.floor(Math.max(top
|
|
18
|
+
top = Math.floor(Math.max(top, 0));
|
|
19
19
|
return {
|
|
20
20
|
top,
|
|
21
|
-
bottom: Math.ceil(Math.max(Math.min(bottom, scrollHeight)
|
|
21
|
+
bottom: Math.ceil(Math.max(Math.min(bottom, scrollHeight), top))
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createWindowFromScrollPosition.js","names":["top","bottom"],"sources":["../../src/utils/createWindowFromScrollPosition.ts"],"sourcesContent":["import type { VirtualWindowSpecs } from '../types';\n\ninterface WindowFromScrollPositionProps {\n scrollTop: number;\n height: number;\n scrollHeight: number;\n
|
|
1
|
+
{"version":3,"file":"createWindowFromScrollPosition.js","names":["top","bottom"],"sources":["../../src/utils/createWindowFromScrollPosition.ts"],"sourcesContent":["import type { VirtualWindowSpecs } from '../types';\n\ninterface WindowFromScrollPositionProps {\n scrollTop: number;\n height: number;\n scrollHeight: number;\n fitPerfectly?: boolean;\n fitPerfectlyOverscroll?: number;\n overscrollSize: number;\n}\n\nexport function createWindowFromScrollPosition({\n scrollTop,\n scrollHeight,\n height,\n fitPerfectly = false,\n fitPerfectlyOverscroll = 0,\n overscrollSize,\n}: WindowFromScrollPositionProps): VirtualWindowSpecs {\n const windowHeight = height + overscrollSize * 2;\n const effectiveHeight = fitPerfectly\n ? height + fitPerfectlyOverscroll * 2\n : windowHeight;\n scrollHeight = Math.max(scrollHeight, effectiveHeight);\n\n if (windowHeight >= scrollHeight || fitPerfectly) {\n const top = Math.max(scrollTop - fitPerfectlyOverscroll, 0);\n const bottom = Math.min(scrollTop + effectiveHeight, scrollHeight);\n return {\n top,\n bottom: Math.max(bottom, top),\n };\n }\n\n const scrollCenter = scrollTop + height / 2;\n let top = scrollCenter - windowHeight / 2;\n let bottom = top + windowHeight;\n if (top < 0) {\n top = 0;\n }\n if (bottom > scrollHeight) {\n bottom = scrollHeight;\n }\n top = Math.floor(Math.max(top, 0));\n return {\n top,\n bottom: Math.ceil(Math.max(Math.min(bottom, scrollHeight), top)),\n };\n}\n"],"mappings":";AAWA,SAAgB,+BAA+B,EAC7C,WACA,cACA,QACA,eAAe,OACf,yBAAyB,GACzB,kBACoD;CACpD,MAAM,eAAe,SAAS,iBAAiB;CAC/C,MAAM,kBAAkB,eACpB,SAAS,yBAAyB,IAClC;AACJ,gBAAe,KAAK,IAAI,cAAc,gBAAgB;AAEtD,KAAI,gBAAgB,gBAAgB,cAAc;EAChD,MAAMA,QAAM,KAAK,IAAI,YAAY,wBAAwB,EAAE;EAC3D,MAAMC,WAAS,KAAK,IAAI,YAAY,iBAAiB,aAAa;AAClE,SAAO;GACL;GACA,QAAQ,KAAK,IAAIA,UAAQD,MAAI;GAC9B;;CAIH,IAAI,MADiB,YAAY,SAAS,IACjB,eAAe;CACxC,IAAI,SAAS,MAAM;AACnB,KAAI,MAAM,EACR,OAAM;AAER,KAAI,SAAS,aACX,UAAS;AAEX,OAAM,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,CAAC;AAClC,QAAO;EACL;EACA,QAAQ,KAAK,KAAK,KAAK,IAAI,KAAK,IAAI,QAAQ,aAAa,EAAE,IAAI,CAAC;EACjE"}
|
|
@@ -30,10 +30,11 @@ interface DiffLineCallbackChangeAddition extends DiffLineCallbackBase {
|
|
|
30
30
|
additionLine: DiffLineMetadata;
|
|
31
31
|
}
|
|
32
32
|
type DiffLineCallbackProps = DiffLineCallbackContextChange | DiffLineCallbackChangeDeletion | DiffLineCallbackChangeAddition;
|
|
33
|
+
type DiffStyle = 'unified' | 'split' | 'both';
|
|
33
34
|
type DiffLineCallback = (props: DiffLineCallbackProps) => boolean | void;
|
|
34
35
|
interface IterateOverDiffProps {
|
|
35
36
|
diff: FileDiffMetadata;
|
|
36
|
-
diffStyle:
|
|
37
|
+
diffStyle: DiffStyle;
|
|
37
38
|
startingLine?: number;
|
|
38
39
|
totalLines?: number;
|
|
39
40
|
expandedHunks?: Map<number, HunkExpansionRegion> | true;
|
|
@@ -1 +1 @@
|
|
|
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:
|
|
1
|
+
{"version":3,"file":"iterateOverDiff.d.ts","names":["FileDiffMetadata","Hunk","HunkExpansionRegion","DiffLineMetadata","DiffLineCallbackBase","DiffLineCallbackContextChange","DiffLineCallbackChangeDeletion","DiffLineCallbackChangeAddition","DiffLineCallbackProps","DiffStyle","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;\ntype DiffStyle = 'unified' | 'split' | 'both';\nexport type DiffLineCallback = (props: DiffLineCallbackProps) => boolean | void;\nexport interface IterateOverDiffProps {\n diff: FileDiffMetadata;\n diffStyle: DiffStyle;\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,OAA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