@pierre/diffs 1.2.0-beta.5 → 1.2.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 +19 -4
- package/dist/components/CodeView.d.ts.map +1 -1
- package/dist/components/CodeView.js +148 -32
- package/dist/components/CodeView.js.map +1 -1
- package/dist/components/File.d.ts +5 -0
- package/dist/components/File.d.ts.map +1 -1
- package/dist/components/File.js +54 -10
- package/dist/components/File.js.map +1 -1
- package/dist/components/FileDiff.d.ts +5 -1
- package/dist/components/FileDiff.d.ts.map +1 -1
- package/dist/components/FileDiff.js +56 -14
- package/dist/components/FileDiff.js.map +1 -1
- package/dist/components/FileStream.js +1 -0
- package/dist/components/FileStream.js.map +1 -1
- package/dist/components/UnresolvedFile.d.ts.map +1 -1
- package/dist/components/UnresolvedFile.js +1 -1
- package/dist/components/VirtualizedFile.d.ts +1 -0
- package/dist/components/VirtualizedFile.d.ts.map +1 -1
- package/dist/components/VirtualizedFile.js +19 -6
- package/dist/components/VirtualizedFile.js.map +1 -1
- package/dist/components/VirtualizedFileDiff.d.ts +6 -0
- package/dist/components/VirtualizedFileDiff.d.ts.map +1 -1
- package/dist/components/VirtualizedFileDiff.js +75 -35
- package/dist/components/VirtualizedFileDiff.js.map +1 -1
- package/dist/components/Virtualizer.js +1 -1
- package/dist/components/Virtualizer.js.map +1 -1
- package/dist/constants.js +0 -1
- package/dist/constants.js.map +1 -1
- package/dist/highlighter/shared_highlighter.js +14 -0
- package/dist/highlighter/shared_highlighter.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +8 -4
- package/dist/managers/InteractionManager.d.ts.map +1 -1
- package/dist/managers/ResizeManager.d.ts +7 -2
- package/dist/managers/ResizeManager.d.ts.map +1 -1
- package/dist/managers/ResizeManager.js +52 -16
- package/dist/managers/ResizeManager.js.map +1 -1
- package/dist/react/CodeView.d.ts +1 -0
- package/dist/react/CodeView.d.ts.map +1 -1
- package/dist/react/CodeView.js +9 -0
- package/dist/react/CodeView.js.map +1 -1
- package/dist/renderers/DiffHunksRenderer.d.ts +2 -0
- package/dist/renderers/DiffHunksRenderer.d.ts.map +1 -1
- package/dist/renderers/DiffHunksRenderer.js +34 -21
- package/dist/renderers/DiffHunksRenderer.js.map +1 -1
- package/dist/renderers/FileRenderer.d.ts +3 -0
- package/dist/renderers/FileRenderer.d.ts.map +1 -1
- package/dist/renderers/FileRenderer.js +37 -23
- package/dist/renderers/FileRenderer.js.map +1 -1
- package/dist/style.js +1 -1
- package/dist/style.js.map +1 -1
- package/dist/types.d.ts +4 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/areDiffTargetsEqual.d.ts +7 -0
- package/dist/utils/areDiffTargetsEqual.d.ts.map +1 -0
- package/dist/utils/areDiffTargetsEqual.js +8 -0
- package/dist/utils/areDiffTargetsEqual.js.map +1 -0
- package/dist/utils/areFileRenderOptionsEqual.d.ts +7 -0
- package/dist/utils/areFileRenderOptionsEqual.d.ts.map +1 -0
- package/dist/utils/areFileRenderOptionsEqual.js +10 -0
- package/dist/utils/areFileRenderOptionsEqual.js.map +1 -0
- package/dist/utils/areWorkerStatsEqual.js +1 -1
- package/dist/utils/areWorkerStatsEqual.js.map +1 -1
- package/dist/utils/computeVirtualFileMetrics.d.ts +11 -0
- package/dist/utils/computeVirtualFileMetrics.d.ts.map +1 -0
- package/dist/utils/{resolveVirtualFileMetrics.js → computeVirtualFileMetrics.js} +7 -10
- package/dist/utils/computeVirtualFileMetrics.js.map +1 -0
- package/dist/utils/detachString.d.ts +6 -0
- package/dist/utils/detachString.d.ts.map +1 -0
- package/dist/utils/detachString.js +21 -0
- package/dist/utils/detachString.js.map +1 -0
- package/dist/utils/isStyleNode.d.ts +5 -0
- package/dist/utils/isStyleNode.d.ts.map +1 -0
- package/dist/utils/isStyleNode.js +10 -0
- package/dist/utils/isStyleNode.js.map +1 -0
- package/dist/utils/parsePatchFiles.d.ts +1 -7
- package/dist/utils/parsePatchFiles.d.ts.map +1 -1
- package/dist/utils/parsePatchFiles.js +180 -59
- package/dist/utils/parsePatchFiles.js.map +1 -1
- package/dist/utils/prefersReducedMotion.d.ts +5 -0
- package/dist/utils/prefersReducedMotion.d.ts.map +1 -0
- package/dist/utils/prefersReducedMotion.js +9 -0
- package/dist/utils/prefersReducedMotion.js.map +1 -0
- package/dist/worker/WorkerPoolManager.d.ts +33 -5
- package/dist/worker/WorkerPoolManager.d.ts.map +1 -1
- package/dist/worker/WorkerPoolManager.js +278 -79
- package/dist/worker/WorkerPoolManager.js.map +1 -1
- package/dist/worker/types.d.ts +7 -3
- package/dist/worker/types.d.ts.map +1 -1
- package/dist/worker/worker-portable.js +9 -10
- package/dist/worker/worker-portable.js.map +1 -1
- package/dist/worker/worker.js +3 -1
- package/dist/worker/worker.js.map +1 -1
- package/package.json +2 -6
- package/dist/utils/resolveVirtualFileMetrics.d.ts +0 -10
- package/dist/utils/resolveVirtualFileMetrics.d.ts.map +0 -1
- package/dist/utils/resolveVirtualFileMetrics.js.map +0 -1
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","CodeViewScrollBehavior","FileContents","SupportedLanguages","HighlighterTypes","DiffsThemeNames","ThemesType","Record","DiffsHighlighter","ChangeTypes","ParsedPatch","FileDiffMetadata","ContextContent","ChangeContent","Hunk","MergeConflictMarkerRowType","MergeConflictMarkerRow","HunkLineType","ThemeTypes","HunkSeparators","LineDiffTypes","DiffIndicators","BaseCodeOptions","BaseDiffOptions","BaseDiffOptionsWithDefaults","Omit","Required","CustomPreProperties","PrePropertiesConfig","Pick","FileHeaderRenderMode","RenderHeaderMetadataCallback","Element","RenderHeaderPrefixCallback","RenderFileMetadata","ExtensionFormatMap","AnnotationSide","SelectionSide","SelectedLineRange","OptionalMetadata","T","LineAnnotation","DiffLineAnnotation","CodeViewFileItem","CodeViewDiffItem","CodeViewItem","CodeViewPositionScrollTarget","CodeViewLineScrollTarget","CodeViewRangeScrollTarget","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","CodeViewLayout","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 type DiffIndicators = 'classic' | 'bars' | '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?: DiffIndicators;\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';\nexport interface SelectedLineRange {\n start: number;\n side?: SelectionSide;\n end: number;\n endSide?: SelectionSide;\n}\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 CodeViewFileItem<T = undefined> = {\n id: string;\n type: 'file';\n file: FileContents;\n annotations?: LineAnnotation<T>[];\n version?: number;\n collapsed?: boolean;\n};\nexport type CodeViewDiffItem<T = undefined> = {\n id: string;\n type: 'diff';\n fileDiff: FileDiffMetadata;\n annotations?: DiffLineAnnotation<T>[];\n version?: number;\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 CodeViewRangeScrollTarget {\n type: 'range';\n id: string;\n range: SelectedLineRange;\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 | CodeViewRangeScrollTarget | 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 CodeViewLayout {\n /** Top padding applied to the CodeView sticky container offset. */\n paddingTop: number;\n /** Bottom padding added after the final rendered item in CodeView. */\n paddingBottom: number;\n /** Vertical gap between virtualized CodeView items. */\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 scrollbarGutter: number | 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,C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4E,iBAAAA;SACN5E,kBAAkBE,yBAAyBF;;;gBAGpCe;;;UAGD8D,gBAAAA;UACLT;WACCO;;UAEIG,gBAAAA;UACLR;WACCM;;UAEIG,oBAAAA;QACPlF;;WAEG8E;UACDP;eACKY;;UAEAC,oBAAAA;QACP3E;;WAEGsE;UACDN;eACKU;;UAEAA,WAAAA;;;;;;UAMAE,YAAAA;;;;UAIAC,kBAAAA;;;;;;UAMAC,kBAAAA;;;;;;;;;;;;;;;;;;;;UAoBAC,cAAAA;;;;;;;;UAQAC,oBAAAA;;;;;;;;;;;;;;;;;;;;UAoBAC,cAAAA;;QAEPvD;;KAEEwD,wBAAAA;KACAC,qBAAAA;UACKC,0BAAAA;QACPF;;;;;;;;;;UAUOG,uBAAAA;;;;;;;;;;;;;;;;UAgBAC,sBAAAA;SACN5F,kBAAkBC;;aAEdY;;;;UAIEgF,WAAAA"}
|
|
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","DiffIndicators","BaseCodeOptions","BaseDiffOptions","BaseDiffOptionsWithDefaults","Omit","Required","CustomPreProperties","PrePropertiesConfig","Pick","FileHeaderRenderMode","RenderHeaderMetadataCallback","Element","RenderHeaderPrefixCallback","RenderFileMetadata","ExtensionFormatMap","AnnotationSide","SelectionSide","SelectedLineRange","OptionalMetadata","T","LineAnnotation","DiffLineAnnotation","CodeViewFileItem","CodeViewDiffItem","CodeViewItem","CodeViewPositionScrollTarget","CodeViewLineScrollTarget","CodeViewRangeScrollTarget","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","CodeViewLayout","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-dark-soft' | 'pierre-light' | 'pierre-light-soft' | (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 type DiffIndicators = 'classic' | 'bars' | '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?: DiffIndicators;\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';\nexport interface SelectedLineRange {\n start: number;\n side?: SelectionSide;\n end: number;\n endSide?: SelectionSide;\n}\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 CodeViewFileItem<T = undefined> = {\n id: string;\n type: 'file';\n file: FileContents;\n annotations?: LineAnnotation<T>[];\n version?: number;\n collapsed?: boolean;\n};\nexport type CodeViewDiffItem<T = undefined> = {\n id: string;\n type: 'diff';\n fileDiff: FileDiffMetadata;\n annotations?: DiffLineAnnotation<T>[];\n version?: number;\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 CodeViewRangeScrollTarget {\n type: 'range';\n id: string;\n range: SelectedLineRange;\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 | CodeViewRangeScrollTarget | 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. Only set this\n * if you customized the size of hunk separators via unsafeCSS */\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 CodeViewLayout {\n /** Top padding applied to the CodeView sticky container offset. */\n paddingTop: number;\n /** Bottom padding added after the final rendered item in CodeView. */\n paddingBottom: number;\n /** Vertical gap between virtualized CodeView items. */\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 scrollbarGutter: number | 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,kBAAA,GAAA,cAAA,GAAA,mBAAA,GAAA,CAAA,MAAA,GAAA,CAAA,CAAA,CAAA;AACpCyB,KAzPAX,UAAAA,GAAaC,MAyPD,CAAA,MAAA,GAAA,OAAA,EAzP0BF,eAyP1B,CAAA;AACxB;AAIA;AACA;AACA;AACA;;;AAIgBa,KA7PJV,gB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UAGD8D,gBAAAA;UACLT;WACCO;;UAEIG,gBAAAA;UACLR;WACCM;;UAEIG,oBAAAA;QACPlF;;WAEG8E;UACDP;eACKY;;UAEAC,oBAAAA;QACP3E;;WAEGsE;UACDN;eACKU;;UAEAA,WAAAA;;;;;;UAMAE,YAAAA;;;;UAIAC,kBAAAA;;;;;;UAMAC,kBAAAA;;;;;;;;;;;;;;;;;;;;;UAqBAC,cAAAA;;;;;;;;UAQAC,oBAAAA;;;;;;;;;;;;;;;;;;;;UAoBAC,cAAAA;;QAEPvD;;KAEEwD,wBAAAA;KACAC,qBAAAA;UACKC,0BAAAA;QACPF;;;;;;;;;;UAUOG,uBAAAA;;;;;;;;;;;;;;;;UAgBAC,sBAAAA;SACN5F,kBAAkBC;;aAEdY;;;;UAIEgF,WAAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FileDiffMetadata } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/areDiffTargetsEqual.d.ts
|
|
4
|
+
declare function areDiffTargetsEqual(diffA: FileDiffMetadata | undefined, diffB: FileDiffMetadata | undefined): boolean;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { areDiffTargetsEqual };
|
|
7
|
+
//# sourceMappingURL=areDiffTargetsEqual.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"areDiffTargetsEqual.d.ts","names":["FileDiffMetadata","areDiffTargetsEqual"],"sources":["../../src/utils/areDiffTargetsEqual.d.ts"],"sourcesContent":["import type { FileDiffMetadata } from '../types';\nexport declare function areDiffTargetsEqual(diffA: FileDiffMetadata | undefined, diffB: FileDiffMetadata | undefined): boolean;\n//# sourceMappingURL=areDiffTargetsEqual.d.ts.map"],"mappings":";;;iBACwBC,mBAAAA,QAA2BD,qCAAqCA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/utils/areDiffTargetsEqual.ts
|
|
2
|
+
function areDiffTargetsEqual(diffA, diffB) {
|
|
3
|
+
return diffA === diffB || diffA?.cacheKey != null && diffA.cacheKey === diffB?.cacheKey;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
export { areDiffTargetsEqual };
|
|
8
|
+
//# sourceMappingURL=areDiffTargetsEqual.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"areDiffTargetsEqual.js","names":[],"sources":["../../src/utils/areDiffTargetsEqual.ts"],"sourcesContent":["import type { FileDiffMetadata } from '../types';\n\n// Because FileDiffMetadata is a potentially unbounded and structurally deep\n// object, we only check for top level equality or a cache key, otherwise we\n// just assume it's different every time\nexport function areDiffTargetsEqual(\n diffA: FileDiffMetadata | undefined,\n diffB: FileDiffMetadata | undefined\n): boolean {\n return (\n diffA === diffB ||\n (diffA?.cacheKey != null && diffA.cacheKey === diffB?.cacheKey)\n );\n}\n"],"mappings":";AAKA,SAAgB,oBACd,OACA,OACS;AACT,QACE,UAAU,SACT,OAAO,YAAY,QAAQ,MAAM,aAAa,OAAO"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RenderFileOptions } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/areFileRenderOptionsEqual.d.ts
|
|
4
|
+
declare function areFileRenderOptionsEqual(optionsA: RenderFileOptions, optionsB: RenderFileOptions): boolean;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { areFileRenderOptionsEqual };
|
|
7
|
+
//# sourceMappingURL=areFileRenderOptionsEqual.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"areFileRenderOptionsEqual.d.ts","names":["RenderFileOptions","areFileRenderOptionsEqual"],"sources":["../../src/utils/areFileRenderOptionsEqual.d.ts"],"sourcesContent":["import type { RenderFileOptions } from '../types';\nexport declare function areFileRenderOptionsEqual(optionsA: RenderFileOptions, optionsB: RenderFileOptions): boolean;\n//# sourceMappingURL=areFileRenderOptionsEqual.d.ts.map"],"mappings":";;;iBACwBC,yBAAAA,WAAoCD,6BAA6BA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { areThemesEqual } from "./areThemesEqual.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/areFileRenderOptionsEqual.ts
|
|
4
|
+
function areFileRenderOptionsEqual(optionsA, optionsB) {
|
|
5
|
+
return areThemesEqual(optionsA.theme, optionsB.theme) && optionsA.useTokenTransformer === optionsB.useTokenTransformer && optionsA.tokenizeMaxLineLength === optionsB.tokenizeMaxLineLength;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { areFileRenderOptionsEqual };
|
|
10
|
+
//# sourceMappingURL=areFileRenderOptionsEqual.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"areFileRenderOptionsEqual.js","names":[],"sources":["../../src/utils/areFileRenderOptionsEqual.ts"],"sourcesContent":["import type { RenderFileOptions } from '../types';\nimport { areThemesEqual } from './areThemesEqual';\n\nexport function areFileRenderOptionsEqual(\n optionsA: RenderFileOptions,\n optionsB: RenderFileOptions\n): boolean {\n return (\n areThemesEqual(optionsA.theme, optionsB.theme) &&\n optionsA.useTokenTransformer === optionsB.useTokenTransformer &&\n optionsA.tokenizeMaxLineLength === optionsB.tokenizeMaxLineLength\n );\n}\n"],"mappings":";;;AAGA,SAAgB,0BACd,UACA,UACS;AACT,QACE,eAAe,SAAS,OAAO,SAAS,MAAM,IAC9C,SAAS,wBAAwB,SAAS,uBAC1C,SAAS,0BAA0B,SAAS"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region src/utils/areWorkerStatsEqual.ts
|
|
2
2
|
function areWorkerStatsEqual(statsA, statsB) {
|
|
3
3
|
if (statsA == null || statsB == null) return statsA === statsB;
|
|
4
|
-
return statsA.busyWorkers === statsB.busyWorkers && statsA.diffCacheSize === statsB.diffCacheSize && statsA.fileCacheSize === statsB.fileCacheSize && statsA.managerState === statsB.managerState && statsA.
|
|
4
|
+
return statsA.busyWorkers === statsB.busyWorkers && statsA.diffCacheSize === statsB.diffCacheSize && statsA.fileCacheSize === statsB.fileCacheSize && statsA.managerState === statsB.managerState && statsA.activeTasks === statsB.activeTasks && statsA.queuedTasks === statsB.queuedTasks && statsA.themeSubscribers === statsB.themeSubscribers && statsA.totalWorkers === statsB.totalWorkers && statsA.workersFailed === statsB.workersFailed;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"areWorkerStatsEqual.js","names":[],"sources":["../../src/utils/areWorkerStatsEqual.ts"],"sourcesContent":["import type { WorkerStats } from '../worker';\n\nexport function areWorkerStatsEqual(\n statsA: WorkerStats | undefined,\n statsB: WorkerStats | undefined\n): boolean {\n if (statsA == null || statsB == null) {\n return statsA === statsB;\n }\n return (\n statsA.busyWorkers === statsB.busyWorkers &&\n statsA.diffCacheSize === statsB.diffCacheSize &&\n statsA.fileCacheSize === statsB.fileCacheSize &&\n statsA.managerState === statsB.managerState &&\n statsA.
|
|
1
|
+
{"version":3,"file":"areWorkerStatsEqual.js","names":[],"sources":["../../src/utils/areWorkerStatsEqual.ts"],"sourcesContent":["import type { WorkerStats } from '../worker';\n\nexport function areWorkerStatsEqual(\n statsA: WorkerStats | undefined,\n statsB: WorkerStats | undefined\n): boolean {\n if (statsA == null || statsB == null) {\n return statsA === statsB;\n }\n return (\n statsA.busyWorkers === statsB.busyWorkers &&\n statsA.diffCacheSize === statsB.diffCacheSize &&\n statsA.fileCacheSize === statsB.fileCacheSize &&\n statsA.managerState === statsB.managerState &&\n statsA.activeTasks === statsB.activeTasks &&\n statsA.queuedTasks === statsB.queuedTasks &&\n statsA.themeSubscribers === statsB.themeSubscribers &&\n statsA.totalWorkers === statsB.totalWorkers &&\n statsA.workersFailed === statsB.workersFailed\n );\n}\n"],"mappings":";AAEA,SAAgB,oBACd,QACA,QACS;AACT,KAAI,UAAU,QAAQ,UAAU,KAC9B,QAAO,WAAW;AAEpB,QACE,OAAO,gBAAgB,OAAO,eAC9B,OAAO,kBAAkB,OAAO,iBAChC,OAAO,kBAAkB,OAAO,iBAChC,OAAO,iBAAiB,OAAO,gBAC/B,OAAO,gBAAgB,OAAO,eAC9B,OAAO,gBAAgB,OAAO,eAC9B,OAAO,qBAAqB,OAAO,oBACnC,OAAO,iBAAiB,OAAO,gBAC/B,OAAO,kBAAkB,OAAO"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HunkSeparators, VirtualFileMetrics } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/computeVirtualFileMetrics.d.ts
|
|
4
|
+
declare function computeVirtualFileMetrics(metrics?: Partial<VirtualFileMetrics>): VirtualFileMetrics;
|
|
5
|
+
declare function getVirtualFileHeaderRegion(metrics: VirtualFileMetrics, disableFileHeader: boolean): number;
|
|
6
|
+
declare function getVirtualFilePaddingTop(metrics: VirtualFileMetrics, disableFileHeader: boolean): number;
|
|
7
|
+
declare function getVirtualFilePaddingBottom(metrics: VirtualFileMetrics): number;
|
|
8
|
+
declare function getDefaultHunkSeparatorHeight(type: HunkSeparators): number;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { computeVirtualFileMetrics, getDefaultHunkSeparatorHeight, getVirtualFileHeaderRegion, getVirtualFilePaddingBottom, getVirtualFilePaddingTop };
|
|
11
|
+
//# sourceMappingURL=computeVirtualFileMetrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeVirtualFileMetrics.d.ts","names":["HunkSeparators","VirtualFileMetrics","computeVirtualFileMetrics","Partial","getVirtualFileHeaderRegion","getVirtualFilePaddingTop","getVirtualFilePaddingBottom","getDefaultHunkSeparatorHeight"],"sources":["../../src/utils/computeVirtualFileMetrics.d.ts"],"sourcesContent":["import type { HunkSeparators, VirtualFileMetrics } from '../types';\nexport declare function computeVirtualFileMetrics(metrics?: Partial<VirtualFileMetrics>): VirtualFileMetrics;\nexport declare function getVirtualFileHeaderRegion(metrics: VirtualFileMetrics, disableFileHeader: boolean): number;\nexport declare function getVirtualFilePaddingTop(metrics: VirtualFileMetrics, disableFileHeader: boolean): number;\nexport declare function getVirtualFilePaddingBottom(metrics: VirtualFileMetrics): number;\nexport declare function getDefaultHunkSeparatorHeight(type: HunkSeparators): number;\n//# sourceMappingURL=computeVirtualFileMetrics.d.ts.map"],"mappings":";;;iBACwBE,yBAAAA,WAAoCC,QAAQF,sBAAsBA;iBAClEG,0BAAAA,UAAoCH;AADpCC,iBAEAG,wBAAAA,CAFyB,OAAA,EAESJ,kBAFT,EAAA,iBAAA,EAAA,OAAA,CAAA,EAAA,MAAA;AAAmBA,iBAG5CK,2BAAAA,CAH4CL,OAAAA,EAGPA,kBAHOA,CAAAA,EAAAA,MAAAA;AAARE,iBAIpCI,6BAAAA,CAJoCJ,IAAAA,EAIAH,cAJAG,CAAAA,EAAAA,MAAAA"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { DEFAULT_VIRTUAL_FILE_METRICS } from "../constants.js";
|
|
2
2
|
|
|
3
|
-
//#region src/utils/
|
|
4
|
-
function
|
|
5
|
-
|
|
3
|
+
//#region src/utils/computeVirtualFileMetrics.ts
|
|
4
|
+
function computeVirtualFileMetrics(metrics) {
|
|
5
|
+
return {
|
|
6
6
|
...DEFAULT_VIRTUAL_FILE_METRICS,
|
|
7
|
-
...
|
|
7
|
+
...metrics
|
|
8
8
|
};
|
|
9
|
-
metrics.hunkSeparatorHeight = getHunkSeparatorHeight(hunkSeparators, metricsOverride?.hunkSeparatorHeight);
|
|
10
|
-
return metrics;
|
|
11
9
|
}
|
|
12
10
|
function getVirtualFileHeaderRegion(metrics, disableFileHeader) {
|
|
13
11
|
const paddingTop = getVirtualFilePaddingTop(metrics, disableFileHeader);
|
|
@@ -19,8 +17,7 @@ function getVirtualFilePaddingTop(metrics, disableFileHeader) {
|
|
|
19
17
|
function getVirtualFilePaddingBottom(metrics) {
|
|
20
18
|
return metrics.paddingBottom ?? metrics.spacing;
|
|
21
19
|
}
|
|
22
|
-
function
|
|
23
|
-
if (customHeight != null) return customHeight;
|
|
20
|
+
function getDefaultHunkSeparatorHeight(type) {
|
|
24
21
|
switch (type) {
|
|
25
22
|
case "simple": return 4;
|
|
26
23
|
case "metadata":
|
|
@@ -31,5 +28,5 @@ function getHunkSeparatorHeight(type, customHeight) {
|
|
|
31
28
|
}
|
|
32
29
|
|
|
33
30
|
//#endregion
|
|
34
|
-
export { getVirtualFileHeaderRegion, getVirtualFilePaddingBottom, getVirtualFilePaddingTop
|
|
35
|
-
//# sourceMappingURL=
|
|
31
|
+
export { computeVirtualFileMetrics, getDefaultHunkSeparatorHeight, getVirtualFileHeaderRegion, getVirtualFilePaddingBottom, getVirtualFilePaddingTop };
|
|
32
|
+
//# sourceMappingURL=computeVirtualFileMetrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeVirtualFileMetrics.js","names":[],"sources":["../../src/utils/computeVirtualFileMetrics.ts"],"sourcesContent":["import { DEFAULT_VIRTUAL_FILE_METRICS } from '../constants';\nimport type { HunkSeparators, VirtualFileMetrics } from '../types';\n\nexport function computeVirtualFileMetrics(\n metrics?: Partial<VirtualFileMetrics>\n): VirtualFileMetrics {\n return {\n ...DEFAULT_VIRTUAL_FILE_METRICS,\n ...metrics,\n };\n}\n\nexport function getVirtualFileHeaderRegion(\n metrics: VirtualFileMetrics,\n disableFileHeader: boolean\n): number {\n const paddingTop = getVirtualFilePaddingTop(metrics, disableFileHeader);\n return disableFileHeader ? paddingTop : metrics.diffHeaderHeight + paddingTop;\n}\n\nexport function getVirtualFilePaddingTop(\n metrics: VirtualFileMetrics,\n disableFileHeader: boolean\n): number {\n return metrics.paddingTop ?? (disableFileHeader ? metrics.spacing : 0);\n}\n\nexport function getVirtualFilePaddingBottom(\n metrics: VirtualFileMetrics\n): number {\n return metrics.paddingBottom ?? metrics.spacing;\n}\n\nexport function getDefaultHunkSeparatorHeight(type: HunkSeparators): number {\n switch (type) {\n case 'simple':\n return 4;\n case 'metadata':\n case 'line-info':\n case 'line-info-basic':\n case 'custom':\n return 32;\n }\n}\n"],"mappings":";;;AAGA,SAAgB,0BACd,SACoB;AACpB,QAAO;EACL,GAAG;EACH,GAAG;EACJ;;AAGH,SAAgB,2BACd,SACA,mBACQ;CACR,MAAM,aAAa,yBAAyB,SAAS,kBAAkB;AACvE,QAAO,oBAAoB,aAAa,QAAQ,mBAAmB;;AAGrE,SAAgB,yBACd,SACA,mBACQ;AACR,QAAO,QAAQ,eAAe,oBAAoB,QAAQ,UAAU;;AAGtE,SAAgB,4BACd,SACQ;AACR,QAAO,QAAQ,iBAAiB,QAAQ;;AAG1C,SAAgB,8BAA8B,MAA8B;AAC1E,SAAQ,MAAR;EACE,KAAK,SACH,QAAO;EACT,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,SACH,QAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detachString.d.ts","names":["releaseStringDetachBuffer","detachString"],"sources":["../../src/utils/detachString.d.ts"],"sourcesContent":["export declare function releaseStringDetachBuffer(): void;\nexport declare function detachString(value: string): string;\n//# sourceMappingURL=detachString.d.ts.map"],"mappings":";iBAAwBA,yBAAAA,CAAAA;AAAAA,iBACAC,YAAAA,CADyB,KAAA,EAAA,MAAA,CAAA,EAAA,MAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/utils/detachString.ts
|
|
2
|
+
const stringDetachEncoder = new TextEncoder();
|
|
3
|
+
const stringDetachDecoder = new TextDecoder("utf-8", { ignoreBOM: true });
|
|
4
|
+
const SURROGATE_CODE_UNIT_PATTERN = /[\uD800-\uDFFF]/;
|
|
5
|
+
const STRING_DETACH_INITIAL_BUFFER_SIZE = 1024;
|
|
6
|
+
let stringDetachBuffer = new Uint8Array(STRING_DETACH_INITIAL_BUFFER_SIZE);
|
|
7
|
+
function releaseStringDetachBuffer() {
|
|
8
|
+
if (stringDetachBuffer.length !== STRING_DETACH_INITIAL_BUFFER_SIZE) stringDetachBuffer = new Uint8Array(STRING_DETACH_INITIAL_BUFFER_SIZE);
|
|
9
|
+
}
|
|
10
|
+
function detachString(value) {
|
|
11
|
+
if (value.length === 0) return value;
|
|
12
|
+
if (SURROGATE_CODE_UNIT_PATTERN.test(value)) return JSON.parse(JSON.stringify(value));
|
|
13
|
+
const requiredByteLength = value.length * 3;
|
|
14
|
+
if (stringDetachBuffer.length < requiredByteLength) stringDetachBuffer = new Uint8Array(requiredByteLength);
|
|
15
|
+
const { written } = stringDetachEncoder.encodeInto(value, stringDetachBuffer);
|
|
16
|
+
return stringDetachDecoder.decode(stringDetachBuffer.subarray(0, written));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { detachString, releaseStringDetachBuffer };
|
|
21
|
+
//# sourceMappingURL=detachString.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detachString.js","names":[],"sources":["../../src/utils/detachString.ts"],"sourcesContent":["const stringDetachEncoder = new TextEncoder();\nconst stringDetachDecoder = new TextDecoder('utf-8', { ignoreBOM: true });\nconst SURROGATE_CODE_UNIT_PATTERN = /[\\uD800-\\uDFFF]/;\nconst STRING_DETACH_INITIAL_BUFFER_SIZE = 1024;\nlet stringDetachBuffer = new Uint8Array(STRING_DETACH_INITIAL_BUFFER_SIZE);\n\n// Drops the reusable scratch buffer after a parsing run so one unusually long\n// line does not pin that peak allocation for the lifetime of the process.\nexport function releaseStringDetachBuffer(): void {\n if (stringDetachBuffer.length !== STRING_DETACH_INITIAL_BUFFER_SIZE) {\n stringDetachBuffer = new Uint8Array(STRING_DETACH_INITIAL_BUFFER_SIZE);\n }\n}\n\n// Forces a fresh backing string so a retained substring does not keep the\n// original raw patch/file text alive.\nexport function detachString(value: string): string {\n if (value.length === 0) {\n return value;\n }\n\n // TextEncoder replaces lone surrogate code units with U+FFFD, but diff input\n // can contain arbitrary text. JSON round-tripping preserves those code units\n // while still forcing V8 to allocate a fresh backing string.\n if (SURROGATE_CODE_UNIT_PATTERN.test(value)) {\n return JSON.parse(JSON.stringify(value)) as string;\n }\n\n // Without surrogates, each UTF-16 code unit encodes to at most 3 UTF-8 bytes.\n // Reusing this scratch buffer avoids allocating a new Uint8Array for every\n // parsed line while keeping retained line strings detached from the raw patch.\n const requiredByteLength = value.length * 3;\n if (stringDetachBuffer.length < requiredByteLength) {\n stringDetachBuffer = new Uint8Array(requiredByteLength);\n }\n\n const { written } = stringDetachEncoder.encodeInto(value, stringDetachBuffer);\n // Decoding only the written bytes materializes a compact string, preserving\n // the low post-GC memory profile that the old TextEncoder/TextDecoder path had.\n return stringDetachDecoder.decode(stringDetachBuffer.subarray(0, written));\n}\n"],"mappings":";AAAA,MAAM,sBAAsB,IAAI,aAAa;AAC7C,MAAM,sBAAsB,IAAI,YAAY,SAAS,EAAE,WAAW,MAAM,CAAC;AACzE,MAAM,8BAA8B;AACpC,MAAM,oCAAoC;AAC1C,IAAI,qBAAqB,IAAI,WAAW,kCAAkC;AAI1E,SAAgB,4BAAkC;AAChD,KAAI,mBAAmB,WAAW,kCAChC,sBAAqB,IAAI,WAAW,kCAAkC;;AAM1E,SAAgB,aAAa,OAAuB;AAClD,KAAI,MAAM,WAAW,EACnB,QAAO;AAMT,KAAI,4BAA4B,KAAK,MAAM,CACzC,QAAO,KAAK,MAAM,KAAK,UAAU,MAAM,CAAC;CAM1C,MAAM,qBAAqB,MAAM,SAAS;AAC1C,KAAI,mBAAmB,SAAS,mBAC9B,sBAAqB,IAAI,WAAW,mBAAmB;CAGzD,MAAM,EAAE,YAAY,oBAAoB,WAAW,OAAO,mBAAmB;AAG7E,QAAO,oBAAoB,OAAO,mBAAmB,SAAS,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isStyleNode.d.ts","names":["isStyleNode","Element","HTMLStyleElement"],"sources":["../../src/utils/isStyleNode.d.ts"],"sourcesContent":["export declare function isStyleNode(element: Element): element is HTMLStyleElement;\n//# sourceMappingURL=isStyleNode.d.ts.map"],"mappings":";iBAAwBA,WAAAA,UAAqBC,qBAAqBC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/utils/isStyleNode.ts
|
|
2
|
+
function isStyleNode(element) {
|
|
3
|
+
if (typeof HTMLStyleElement !== "undefined" && element instanceof HTMLStyleElement) return true;
|
|
4
|
+
const tagName = element.tagName ?? element.nodeName;
|
|
5
|
+
return typeof tagName === "string" && tagName.toLowerCase() === "style";
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { isStyleNode };
|
|
10
|
+
//# sourceMappingURL=isStyleNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isStyleNode.js","names":[],"sources":["../../src/utils/isStyleNode.ts"],"sourcesContent":["export function isStyleNode(element: Element): element is HTMLStyleElement {\n if (\n typeof HTMLStyleElement !== 'undefined' &&\n element instanceof HTMLStyleElement\n ) {\n return true;\n }\n\n const tagName = element.tagName ?? element.nodeName;\n return typeof tagName === 'string' && tagName.toLowerCase() === 'style';\n}\n"],"mappings":";AAAA,SAAgB,YAAY,SAA+C;AACzE,KACE,OAAO,qBAAqB,eAC5B,mBAAmB,iBAEnB,QAAO;CAGT,MAAM,UAAU,QAAQ,WAAW,QAAQ;AAC3C,QAAO,OAAO,YAAY,YAAY,QAAQ,aAAa,KAAK"}
|
|
@@ -9,13 +9,7 @@ interface ProcessFileOptions {
|
|
|
9
9
|
newFile?: FileContents;
|
|
10
10
|
throwOnError?: boolean;
|
|
11
11
|
}
|
|
12
|
-
declare function processFile(fileDiffString: string,
|
|
13
|
-
cacheKey,
|
|
14
|
-
isGitDiff,
|
|
15
|
-
oldFile,
|
|
16
|
-
newFile,
|
|
17
|
-
throwOnError
|
|
18
|
-
}?: ProcessFileOptions): FileDiffMetadata | undefined;
|
|
12
|
+
declare function processFile(fileDiffString: string, options?: ProcessFileOptions): FileDiffMetadata | undefined;
|
|
19
13
|
/**
|
|
20
14
|
* Parses a patch file string into an array of parsed patches.
|
|
21
15
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parsePatchFiles.d.ts","names":["FileContents","FileDiffMetadata","ParsedPatch","processPatch","ProcessFileOptions","processFile","
|
|
1
|
+
{"version":3,"file":"parsePatchFiles.d.ts","names":["FileContents","FileDiffMetadata","ParsedPatch","processPatch","ProcessFileOptions","processFile","parsePatchFiles"],"sources":["../../src/utils/parsePatchFiles.d.ts"],"sourcesContent":["import type { FileContents, FileDiffMetadata, ParsedPatch } from '../types';\nexport declare function processPatch(data: string, cacheKeyPrefix?: string, throwOnError?: boolean): ParsedPatch;\ninterface ProcessFileOptions {\n cacheKey?: string;\n isGitDiff?: boolean;\n oldFile?: FileContents;\n newFile?: FileContents;\n throwOnError?: boolean;\n}\nexport declare function processFile(fileDiffString: string, options?: ProcessFileOptions): FileDiffMetadata | undefined;\n/**\n * Parses a patch file string into an array of parsed patches.\n *\n * @param data - The raw patch file content (supports multi-commit patches)\n * @param cacheKeyPrefix - Optional prefix for generating cache keys. When provided,\n * each file in the patch will get a cache key in the format `prefix-patchIndex-fileIndex`.\n * This enables caching of rendered diff results in the worker pool.\n */\nexport declare function parsePatchFiles(data: string, cacheKeyPrefix?: string, throwOnError?: boolean): ParsedPatch[];\nexport {};\n//# sourceMappingURL=parsePatchFiles.d.ts.map"],"mappings":";;;iBACwBG,YAAAA,iEAA6ED;UAC3FE,kBAAAA;EADcD,QAAAA,CAAAA,EAAAA,MAAY;EAC1BC,SAAAA,CAAAA,EAAAA,OAAAA;EAOcC,OAAAA,CAAAA,EAJVL,YAIqB;EASXM,OAAAA,CAAAA,EAZVN,YAYyB;;;iBATfK,WAAAA,mCAA8CD,qBAAqBH;;;;;;;;;iBASnEK,eAAAA,iEAAgFJ"}
|