@pierre/diffs 1.1.0-beta.9 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -18
- package/dist/components/AdvancedVirtualizedFileDiff.d.ts.map +1 -1
- package/dist/components/AdvancedVirtualizedFileDiff.js +2 -7
- package/dist/components/AdvancedVirtualizedFileDiff.js.map +1 -1
- package/dist/components/AdvancedVirtualizer.js +1 -1
- package/dist/components/AdvancedVirtualizer.js.map +1 -1
- package/dist/components/File.d.ts +17 -7
- package/dist/components/File.d.ts.map +1 -1
- package/dist/components/File.js +111 -54
- package/dist/components/File.js.map +1 -1
- package/dist/components/FileDiff.d.ts +32 -14
- package/dist/components/FileDiff.d.ts.map +1 -1
- package/dist/components/FileDiff.js +156 -81
- package/dist/components/FileDiff.js.map +1 -1
- package/dist/components/UnresolvedFile.d.ts +60 -0
- package/dist/components/UnresolvedFile.d.ts.map +1 -0
- package/dist/components/UnresolvedFile.js +280 -0
- package/dist/components/UnresolvedFile.js.map +1 -0
- package/dist/components/VirtualizedFile.js +8 -5
- package/dist/components/VirtualizedFile.js.map +1 -1
- package/dist/components/VirtualizedFileDiff.d.ts +1 -1
- package/dist/components/VirtualizedFileDiff.d.ts.map +1 -1
- package/dist/components/VirtualizedFileDiff.js +15 -11
- package/dist/components/VirtualizedFileDiff.js.map +1 -1
- package/dist/components/Virtualizer.d.ts +3 -1
- package/dist/components/Virtualizer.d.ts.map +1 -1
- package/dist/components/Virtualizer.js +50 -24
- package/dist/components/Virtualizer.js.map +1 -1
- package/dist/constants.d.ts +3 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +8 -1
- package/dist/constants.js.map +1 -1
- package/dist/highlighter/shared_highlighter.d.ts +4 -2
- package/dist/highlighter/shared_highlighter.d.ts.map +1 -1
- package/dist/highlighter/shared_highlighter.js +15 -7
- package/dist/highlighter/shared_highlighter.js.map +1 -1
- package/dist/index.d.ts +9 -7
- package/dist/index.js +8 -6
- package/dist/managers/InteractionManager.d.ts +146 -0
- package/dist/managers/InteractionManager.d.ts.map +1 -0
- package/dist/managers/InteractionManager.js +813 -0
- package/dist/managers/InteractionManager.js.map +1 -0
- package/dist/managers/ResizeManager.d.ts +0 -2
- package/dist/managers/ResizeManager.d.ts.map +1 -1
- package/dist/managers/ResizeManager.js +43 -32
- package/dist/managers/ResizeManager.js.map +1 -1
- package/dist/react/File.d.ts +2 -0
- package/dist/react/File.d.ts.map +1 -1
- package/dist/react/File.js +3 -1
- package/dist/react/File.js.map +1 -1
- package/dist/react/FileDiff.d.ts +2 -0
- package/dist/react/FileDiff.d.ts.map +1 -1
- package/dist/react/FileDiff.js +3 -1
- package/dist/react/FileDiff.js.map +1 -1
- package/dist/react/MultiFileDiff.d.ts +2 -0
- package/dist/react/MultiFileDiff.d.ts.map +1 -1
- package/dist/react/MultiFileDiff.js +3 -1
- package/dist/react/MultiFileDiff.js.map +1 -1
- package/dist/react/PatchDiff.d.ts +2 -0
- package/dist/react/PatchDiff.d.ts.map +1 -1
- package/dist/react/PatchDiff.js +3 -1
- package/dist/react/PatchDiff.js.map +1 -1
- package/dist/react/UnresolvedFile.d.ts +36 -0
- package/dist/react/UnresolvedFile.d.ts.map +1 -0
- package/dist/react/UnresolvedFile.js +42 -0
- package/dist/react/UnresolvedFile.js.map +1 -0
- package/dist/react/constants.d.ts +3 -2
- package/dist/react/constants.d.ts.map +1 -1
- package/dist/react/constants.js +3 -2
- package/dist/react/constants.js.map +1 -1
- package/dist/react/index.d.ts +4 -3
- package/dist/react/index.js +3 -2
- package/dist/react/types.d.ts +11 -2
- package/dist/react/types.d.ts.map +1 -1
- package/dist/react/utils/renderDiffChildren.d.ts +16 -5
- package/dist/react/utils/renderDiffChildren.d.ts.map +1 -1
- package/dist/react/utils/renderDiffChildren.js +34 -7
- package/dist/react/utils/renderDiffChildren.js.map +1 -1
- package/dist/react/utils/renderFileChildren.d.ts +5 -1
- package/dist/react/utils/renderFileChildren.d.ts.map +1 -1
- package/dist/react/utils/renderFileChildren.js +13 -7
- package/dist/react/utils/renderFileChildren.js.map +1 -1
- package/dist/react/utils/useFileDiffInstance.d.ts +1 -2
- package/dist/react/utils/useFileDiffInstance.d.ts.map +1 -1
- package/dist/react/utils/useFileDiffInstance.js +2 -2
- package/dist/react/utils/useFileDiffInstance.js.map +1 -1
- package/dist/react/utils/useFileInstance.d.ts +1 -2
- package/dist/react/utils/useFileInstance.d.ts.map +1 -1
- package/dist/react/utils/useFileInstance.js.map +1 -1
- package/dist/react/utils/useUnresolvedFileInstance.d.ts +33 -0
- package/dist/react/utils/useUnresolvedFileInstance.d.ts.map +1 -0
- package/dist/react/utils/useUnresolvedFileInstance.js +87 -0
- package/dist/react/utils/useUnresolvedFileInstance.js.map +1 -0
- package/dist/renderers/DiffHunksRenderer.d.ts +50 -6
- package/dist/renderers/DiffHunksRenderer.d.ts.map +1 -1
- package/dist/renderers/DiffHunksRenderer.js +145 -45
- package/dist/renderers/DiffHunksRenderer.js.map +1 -1
- package/dist/renderers/FileRenderer.js +1 -1
- package/dist/renderers/UnresolvedFileHunksRenderer.d.ts +46 -0
- package/dist/renderers/UnresolvedFileHunksRenderer.d.ts.map +1 -0
- package/dist/renderers/UnresolvedFileHunksRenderer.js +207 -0
- package/dist/renderers/UnresolvedFileHunksRenderer.js.map +1 -0
- package/dist/shiki-stream/stream.d.ts +1 -1
- package/dist/shiki-stream/stream.d.ts.map +1 -1
- package/dist/shiki-stream/stream.js.map +1 -1
- package/dist/shiki-stream/tokenizer.d.ts +1 -1
- package/dist/shiki-stream/tokenizer.d.ts.map +1 -1
- package/dist/shiki-stream/tokenizer.js.map +1 -1
- package/dist/shiki-stream/types.d.ts +1 -1
- package/dist/shiki-stream/types.d.ts.map +1 -1
- package/dist/sprite.d.ts +2 -2
- package/dist/sprite.d.ts.map +1 -1
- package/dist/sprite.js +3 -0
- package/dist/sprite.js.map +1 -1
- package/dist/ssr/index.d.ts +3 -3
- package/dist/ssr/index.js +2 -2
- package/dist/ssr/preloadDiffs.d.ts +23 -14
- package/dist/ssr/preloadDiffs.d.ts.map +1 -1
- package/dist/ssr/preloadDiffs.js +40 -14
- package/dist/ssr/preloadDiffs.js.map +1 -1
- package/dist/style.js +1 -1
- package/dist/style.js.map +1 -1
- package/dist/types.d.ts +29 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/areMergeConflictActionsEqual.d.ts +7 -0
- package/dist/utils/areMergeConflictActionsEqual.d.ts.map +1 -0
- package/dist/utils/areMergeConflictActionsEqual.js +11 -0
- package/dist/utils/areMergeConflictActionsEqual.js.map +1 -0
- package/dist/utils/arePrePropertiesEqual.js +10 -1
- package/dist/utils/arePrePropertiesEqual.js.map +1 -1
- package/dist/utils/areSelectionPointsEqual.d.ts +7 -0
- package/dist/utils/areSelectionPointsEqual.d.ts.map +1 -0
- package/dist/utils/areSelectionPointsEqual.js +8 -0
- package/dist/utils/areSelectionPointsEqual.js.map +1 -0
- package/dist/utils/areSelectionsEqual.d.ts +1 -1
- package/dist/utils/areSelectionsEqual.d.ts.map +1 -1
- package/dist/utils/areSelectionsEqual.js.map +1 -1
- package/dist/utils/createFileHeaderElement.js +5 -2
- package/dist/utils/createFileHeaderElement.js.map +1 -1
- package/dist/utils/createGutterUtilityContentNode.d.ts +5 -0
- package/dist/utils/createGutterUtilityContentNode.d.ts.map +1 -0
- package/dist/utils/createGutterUtilityContentNode.js +15 -0
- package/dist/utils/createGutterUtilityContentNode.js.map +1 -0
- package/dist/utils/createGutterUtilityElement.d.ts +7 -0
- package/dist/utils/createGutterUtilityElement.d.ts.map +1 -0
- package/dist/utils/createGutterUtilityElement.js +20 -0
- package/dist/utils/createGutterUtilityElement.js.map +1 -0
- package/dist/utils/createPreElement.d.ts +2 -1
- package/dist/utils/createPreElement.d.ts.map +1 -1
- package/dist/utils/createPreElement.js +2 -1
- package/dist/utils/createPreElement.js.map +1 -1
- package/dist/utils/createSeparator.js +1 -1
- package/dist/utils/createSeparator.js.map +1 -1
- package/dist/utils/createWindowFromScrollPosition.js +12 -11
- package/dist/utils/createWindowFromScrollPosition.js.map +1 -1
- package/dist/utils/getHighlighterOptions.d.ts +7 -2
- package/dist/utils/getHighlighterOptions.d.ts.map +1 -1
- package/dist/utils/getHighlighterOptions.js +3 -2
- package/dist/utils/getHighlighterOptions.js.map +1 -1
- package/dist/utils/getMergeConflictActionSlotName.d.ts +16 -0
- package/dist/utils/getMergeConflictActionSlotName.d.ts.map +1 -0
- package/dist/utils/getMergeConflictActionSlotName.js +8 -0
- package/dist/utils/getMergeConflictActionSlotName.js.map +1 -0
- package/dist/utils/getMergeConflictLineTypes.d.ts +15 -0
- package/dist/utils/getMergeConflictLineTypes.d.ts.map +1 -0
- package/dist/utils/getMergeConflictLineTypes.js +81 -0
- package/dist/utils/getMergeConflictLineTypes.js.map +1 -0
- package/dist/utils/getOrCreateCodeNode.d.ts +3 -1
- package/dist/utils/getOrCreateCodeNode.d.ts.map +1 -1
- package/dist/utils/getOrCreateCodeNode.js +5 -3
- package/dist/utils/getOrCreateCodeNode.js.map +1 -1
- package/dist/utils/hast_utils.d.ts +2 -2
- package/dist/utils/hast_utils.d.ts.map +1 -1
- package/dist/utils/hast_utils.js +3 -2
- package/dist/utils/hast_utils.js.map +1 -1
- package/dist/utils/parseMergeConflictDiffFromFile.d.ts +26 -0
- package/dist/utils/parseMergeConflictDiffFromFile.d.ts.map +1 -0
- package/dist/utils/parseMergeConflictDiffFromFile.js +143 -0
- package/dist/utils/parseMergeConflictDiffFromFile.js.map +1 -0
- package/dist/utils/resolveMergeConflict.d.ts +7 -0
- package/dist/utils/resolveMergeConflict.d.ts.map +1 -0
- package/dist/utils/resolveMergeConflict.js +30 -0
- package/dist/utils/resolveMergeConflict.js.map +1 -0
- package/dist/utils/resolveVirtualFileMetrics.js +1 -0
- package/dist/utils/resolveVirtualFileMetrics.js.map +1 -1
- package/dist/utils/setWrapperNodeProps.d.ts +2 -1
- package/dist/utils/setWrapperNodeProps.d.ts.map +1 -1
- package/dist/utils/setWrapperNodeProps.js +5 -1
- package/dist/utils/setWrapperNodeProps.js.map +1 -1
- package/dist/worker/WorkerPoolManager.d.ts +4 -2
- package/dist/worker/WorkerPoolManager.d.ts.map +1 -1
- package/dist/worker/WorkerPoolManager.js +16 -9
- package/dist/worker/WorkerPoolManager.js.map +1 -1
- package/dist/worker/types.d.ts +3 -1
- package/dist/worker/types.d.ts.map +1 -1
- package/dist/worker/wasm-BlUZCxHM.js +10 -0
- package/dist/worker/wasm-BlUZCxHM.js.map +1 -0
- package/dist/worker/worker-portable.js +10546 -10106
- package/dist/worker/worker-portable.js.map +1 -1
- package/dist/worker/worker.js +27 -19
- package/dist/worker/worker.js.map +1 -1
- package/package.json +3 -7
- package/dist/managers/LineSelectionManager.d.ts +0 -64
- package/dist/managers/LineSelectionManager.d.ts.map +0 -1
- package/dist/managers/LineSelectionManager.js +0 -270
- package/dist/managers/LineSelectionManager.js.map +0 -1
- package/dist/managers/MouseEventManager.d.ts +0 -71
- package/dist/managers/MouseEventManager.d.ts.map +0 -1
- package/dist/managers/MouseEventManager.js +0 -358
- package/dist/managers/MouseEventManager.js.map +0 -1
- package/dist/themes/pierre-dark.js +0 -1328
- package/dist/themes/pierre-dark.js.map +0 -1
- package/dist/themes/pierre-light.js +0 -1328
- package/dist/themes/pierre-light.js.map +0 -1
- package/dist/utils/createHoverContentNode.d.ts +0 -5
- package/dist/utils/createHoverContentNode.d.ts.map +0 -1
- package/dist/utils/createHoverContentNode.js +0 -15
- package/dist/utils/createHoverContentNode.js.map +0 -1
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":["ElementContent","BundledLanguage","BundledTheme","CodeToHastOptions","DecorationItem","HighlighterGeneric","LanguageRegistration","ShikiTransformer","ThemedToken","ThemeRegistrationResolved","FileContents","SupportedLanguages","DiffsThemeNames","ThemesType","Record","DiffsHighlighter","ChangeTypes","ParsedPatch","FileDiffMetadata","ContextContent","ChangeContent","Hunk","HunkLineType","ThemeTypes","HunkSeparators","LineDiffTypes","BaseCodeOptions","BaseDiffOptions","PrePropertiesConfig","Pick","Required","RenderHeaderMetadataProps","RenderHeaderMetadataCallback","Element","RenderFileMetadata","ExtensionFormatMap","AnnotationSide","SelectionSide","OptionalMetadata","T","LineAnnotation","DiffLineAnnotation","GapSpan","LineSpans","AnnotationSpan","LineTypes","LineInfo","SharedRenderState","LineEventBaseProps","HTMLElement","DiffLineEventBaseProps","Omit","ObservedAnnotationNodes","ObservedGridNodes","CodeColumnType","HunkData","AnnotationLineMap","LAnnotation","ExpansionDirections","ThemedFileResult","RenderDiffFilesResult","ThemedDiffResult","HunkExpansionRegion","ForceDiffPlainTextOptions","Map","ForceFilePlainTextOptions","RenderFileOptions","RenderDiffOptions","RenderFileResult","RenderDiffResult","RenderedFileASTCache","RenderRange","RenderedDiffASTCache","RenderWindow","VirtualWindowSpecs","VirtualFileMetrics"],"sources":["../src/types.d.ts"],"sourcesContent":["import type { ElementContent } from 'hast';\nimport type { BundledLanguage, BundledTheme, CodeToHastOptions, DecorationItem, HighlighterGeneric, LanguageRegistration, ShikiTransformer, ThemedToken, ThemeRegistrationResolved } from 'shiki';\n/**\n * Represents a file's contents for generating diffs via `parseDiffFromFile` or\n * for when rendering a file directly using the File components\n */\nexport interface FileContents {\n /** Filename used for display in headers and for inferring the language for\n * syntax highlighting. */\n name: string;\n /** The raw text contents of the file. */\n contents: string;\n /** Explicitly set the syntax highlighting language instead of inferring from\n * filename. Generally you should not be setting this. */\n lang?: SupportedLanguages;\n /** Optional header passed to the jsdiff library's `createTwoFilesPatch`. */\n header?: string;\n /** This unique key is only used for Worker Pools to avoid subsequent requests\n * if we've already highlighted the file. Please note that if you modify the\n * `contents` or `name`, you must update the `cacheKey`. */\n cacheKey?: string;\n}\nexport type { BundledLanguage, CodeToHastOptions, DecorationItem, LanguageRegistration, ShikiTransformer, ThemeRegistrationResolved, ThemedToken, };\nexport type DiffsThemeNames = BundledTheme | 'pierre-dark' | 'pierre-light' | (string & {});\nexport type ThemesType = Record<'dark' | 'light', DiffsThemeNames>;\n/**\n * A Shiki highlighter instance configured with the library's supported\n * languages and themes. Used internally to generate syntax-highlighted AST\n * from file contents. By default diffs will ensure that only 1 highlighter is\n * instantiated per thread and shared for all syntax highlighting. This\n * applies to the main thread and worker threads.\n */\nexport type DiffsHighlighter = HighlighterGeneric<SupportedLanguages, DiffsThemeNames>;\n/**\n * Describes the type of change for a file in a diff.\n * - `change`: File content was modified, name unchanged.\n * - `rename-pure`: File was renamed/moved without content changes (100% similarity).\n * - `rename-changed`: File was renamed/moved and content was also modified.\n * - `new`: A new file was added.\n * - `deleted`: An existing file was removed.\n */\nexport type ChangeTypes = 'change' | 'rename-pure' | 'rename-changed' | 'new' | 'deleted';\n/**\n * Represents a parsed patch file, typically corresponding to a single commit.\n * Returned by `parsePatchFiles` when parsing raw patch/diff strings.\n */\nexport interface ParsedPatch {\n /** Optional raw introductory text before the file diffs that may have been\n * included in the patch (e.g., commit message, author, date). */\n patchMetadata?: string;\n /** Array of file changes contained in the patch. */\n files: FileDiffMetadata[];\n}\n/**\n * Represents a block of unchanged context lines within a hunk. Basically a\n * batch of lines in a hunk that are prefixed with a space ` `. Consecutive\n * lines prefixed with a ` ` are grouped together into a single ContextContent.\n */\nexport interface ContextContent {\n type: 'context';\n /** Number of unchanged lines in this context block. */\n lines: number;\n /**\n * Zero-based index into `FileDiffMetadata.additionLines` where this context\n * block starts.\n */\n additionLineIndex: number;\n /**\n * Zero-based index into `FileDiffMetadata.deletionLines` where this context\n * block starts.\n */\n deletionLineIndex: number;\n}\n/**\n * Represents a block of changes (additions and/or deletions) within a hunk.\n * Consecutive `+` and `-` lines are grouped together into a single\n * ChangeContent.\n */\nexport interface ChangeContent {\n type: 'change';\n /** Number of lines prefixed with `-` in this change block. */\n deletions: number;\n /**\n * Zero-based index into `FileDiffMetadata.deletionLines` where the deleted\n * lines start.\n */\n deletionLineIndex: number;\n /** Number of lines prefixed with `+` in this change block. */\n additions: number;\n /**\n * Zero-based index into `FileDiffMetadata.additionLines` where the added\n * lines start.\n */\n additionLineIndex: number;\n}\n/**\n * Represents a single hunk from a diff, corresponding to\n * one `@@ ... @@` block.\n */\nexport interface Hunk {\n /**\n * Number of unchanged lines between the previous hunk (or file start) and\n * this hunk.\n */\n collapsedBefore: number;\n /**\n * Starting line number in the new file version, parsed from the `+X`\n * in the hunk header.\n */\n additionStart: number;\n /**\n * Total line count in the new file version for this hunk, parsed from\n * `+X,count` in the hunk header. If this hunk was viewed in `diffStyle:\n * split` this would correspond to the number of lines in the right\n * `additions` column. It includes both `context` lines and lines\n * prefixed with `+`.\n */\n additionCount: number;\n /** This corresponds to the number of lines prefixed with `+` in this hunk. */\n additionLines: number;\n /**\n * Zero-based index into `FileDiffMetadata.additionLines` where this hunk's\n * content starts.\n */\n additionLineIndex: number;\n /**\n * Starting line number in the old file version, parsed from the `-X`\n * in the hunk header.\n */\n deletionStart: number;\n /**\n * Total line count in the old file version for this hunk, parsed from\n * `-X,count` in the hunk header. If this hunk was viewed in `diffStyle:\n * split` this would correspond to the number of lines in the left\n * `deletions` column. It includes both `context` lines and lines\n * prefixed with `-`.\n */\n deletionCount: number;\n /** This corresponds to the number of lines prefixed with `-` in this hunk. */\n deletionLines: number;\n /**\n * Zero-based index into `FileDiffMetadata.deletionLines` where this hunk's\n * content starts.\n */\n deletionLineIndex: number;\n /**\n * Array of content segments within this hunk, each representing either\n * a context line group or a change group.\n */\n hunkContent: (ContextContent | ChangeContent)[];\n /**\n * Function/method name that appears after the `@@` markers if it existed in\n * the diff.\n */\n hunkContext?: string;\n /** Raw hunk header string (e.g., `@@ -1,5 +1,7 @@`). */\n hunkSpecs?: string;\n /**\n * Starting line index for this hunk when rendered in split (side-by-side)\n * view.\n */\n splitLineStart: number;\n /** Total rendered line count for this hunk in split view. */\n splitLineCount: number;\n /** Starting line index for this hunk when rendered in unified view. */\n unifiedLineStart: number;\n /** Total rendered line count for this hunk in unified view. */\n unifiedLineCount: number;\n /**\n * True if the old file version has no trailing newline at end of file. This\n * is parsed from the patch file directly at the end of the hunk. If the\n * final hunkContent is a `context` group, then both values will be true or\n * false together. If it's from a `change` content group, then it may differ\n * depending on the patch.\n */\n noEOFCRDeletions: boolean;\n /**\n * True if the new file version has no trailing newline at end of file. This\n * is parsed from the patch file directly at the end of the hunk. If the\n * final hunkContent is a `context` group, then both values will be true or\n * false together. If it's from a `change` content group, then it may differ\n * depending on the patch.\n */\n noEOFCRAdditions: boolean;\n}\n/**\n * Metadata and content for a single file's diff. Think of this as a JSON\n * compatible representation of a diff for a single file.\n */\nexport interface FileDiffMetadata {\n /** The file's name and path. */\n name: string;\n /** Previous file path, present only if file was renamed or moved. */\n prevName?: string;\n /**\n * Explicitly override the syntax highlighting language instead of inferring\n * from filename. This will never be set by default, since all internal diff\n * APIs will attempt to detect the language automatically. If you'd like to\n * specify a language override, you can do so via the method `setLanguageOverride`\n */\n lang?: SupportedLanguages;\n /**\n * Object ID for the new file content parsed from the `index` line in a\n * patch file.\n */\n newObjectId?: string;\n /**\n * Object ID for the previous file content parsed from the `index` line in a\n * patch file.\n */\n prevObjectId?: string;\n /**\n * Git file mode parsed from the diff (e.g., `100644` for regular files) when\n * present in the patch metadata.\n */\n mode?: string;\n /** Previous git file mode, present if the mode changed. */\n prevMode?: string;\n /** The type of change for this file. */\n type: ChangeTypes;\n /** Array of diff hunks containing line-level change information. Each hunk\n * corresponds to a `@@ -X,X +X,X @@` group in a diff. */\n hunks: Hunk[];\n /** Pre-computed line size for this diff if rendered in `split` diffStyle. */\n splitLineCount: number;\n /** Pre-computed line size for this diff if rendered in `unified` diffStyle. */\n unifiedLineCount: number;\n /**\n * Whether the diff was parsed from a patch file (true) or generated from\n * full file contents (false).\n *\n * When true, `deletionLines`/`additionLines` contain only the lines present\n * in the patch and hunk expansion is unavailable.\n *\n * When false, they contain the complete file contents.\n */\n isPartial: boolean;\n /**\n * Array of lines from previous version of the file. If `isPartial` is false,\n * it means that `deletionLines` can be considered the entire contents of the\n * old version of the file. Otherwise `deletionLines` will just be an array\n * of all the content processed from the `context` and `deletion` lines of\n * the patch.\n */\n deletionLines: string[];\n /**\n * Array of lines from new version of the file. If `isPartial` is false, it\n * means that `additionLines` can be considered the entire contents of the\n * new version of the file. Otherwise `additionLines` will just be an array\n * of all the content processed from the `context` and `addition` lines of\n * the patch.\n */\n additionLines: string[];\n /**\n * This unique key is only used for Worker Pools to avoid subsequent requests\n * to highlight if we've already highlighted the diff. Please note that if\n * you modify the contents of the diff in any way, you will need to update\n * the `cacheKey`.\n */\n cacheKey?: string;\n}\nexport type SupportedLanguages = BundledLanguage | 'text' | 'ansi' | (string & {});\nexport type HunkLineType = 'context' | 'expanded' | 'addition' | 'deletion' | 'metadata';\nexport type ThemeTypes = 'system' | 'light' | 'dark';\n/**\n * The `'custom'` variant is deprecated and will be removed in a future version.\n */\nexport type HunkSeparators = 'simple' | 'metadata' | 'line-info' | 'custom';\nexport type LineDiffTypes = 'word-alt' | 'word' | 'char' | 'none';\nexport interface BaseCodeOptions {\n theme?: DiffsThemeNames | ThemesType;\n disableLineNumbers?: boolean;\n overflow?: 'scroll' | 'wrap';\n themeType?: ThemeTypes;\n disableFileHeader?: boolean;\n disableVirtualizationBuffers?: boolean;\n useCSSClasses?: boolean;\n tokenizeMaxLineLength?: number;\n unsafeCSS?: string;\n}\nexport interface BaseDiffOptions extends BaseCodeOptions {\n diffStyle?: 'unified' | 'split';\n diffIndicators?: 'classic' | 'bars' | 'none';\n disableBackground?: boolean;\n hunkSeparators?: HunkSeparators;\n expandUnchanged?: boolean;\n collapsedContextThreshold?: number;\n lineDiffType?: LineDiffTypes;\n maxLineDiffLength?: number;\n expansionLineCount?: number;\n}\nexport interface PrePropertiesConfig extends Required<Pick<BaseDiffOptions, 'diffIndicators' | 'disableBackground' | 'disableLineNumbers' | 'overflow' | 'themeType'>> {\n type: 'diff' | 'file';\n split: boolean;\n themeStyles: string;\n totalLines: number;\n}\nexport interface RenderHeaderMetadataProps {\n deletionFile?: FileContents;\n additionFile?: FileContents;\n fileDiff?: FileDiffMetadata;\n}\nexport type RenderHeaderMetadataCallback = (props: RenderHeaderMetadataProps) => Element | null | undefined | string | number;\nexport type RenderFileMetadata = (file: FileContents) => Element | null | undefined | string | number;\nexport type ExtensionFormatMap = Record<string, SupportedLanguages | undefined>;\nexport type AnnotationSide = 'deletions' | 'additions';\nexport type SelectionSide = 'deletions' | 'additions';\ntype OptionalMetadata<T> = T extends undefined ? {\n metadata?: undefined;\n} : {\n metadata: T;\n};\nexport type LineAnnotation<T = undefined> = {\n lineNumber: number;\n} & OptionalMetadata<T>;\nexport type DiffLineAnnotation<T = undefined> = {\n side: AnnotationSide;\n lineNumber: number;\n} & OptionalMetadata<T>;\nexport interface GapSpan {\n type: 'gap';\n rows: number;\n}\nexport type LineSpans = GapSpan | AnnotationSpan;\nexport type LineTypes = 'change-deletion' | 'change-addition' | 'context' | 'context-expanded';\nexport interface LineInfo {\n type: LineTypes;\n lineNumber: number;\n altLineNumber?: number;\n lineIndex: number | `${number},${number}`;\n}\nexport interface SharedRenderState {\n lineInfo: (LineInfo | undefined)[] | ((shikiLineNumber: number) => LineInfo);\n}\nexport interface AnnotationSpan {\n type: 'annotation';\n hunkIndex: number;\n lineIndex: number;\n annotations: string[];\n}\nexport interface LineEventBaseProps {\n type: 'line';\n lineNumber: number;\n lineElement: HTMLElement;\n numberElement: HTMLElement;\n numberColumn: boolean;\n}\nexport interface DiffLineEventBaseProps extends Omit<LineEventBaseProps, 'type'> {\n type: 'diff-line';\n annotationSide: AnnotationSide;\n lineType: LineTypes;\n}\nexport interface ObservedAnnotationNodes {\n type: 'annotations';\n column1: {\n container: HTMLElement;\n child: HTMLElement;\n childHeight: number;\n };\n column2: {\n container: HTMLElement;\n child: HTMLElement;\n childHeight: number;\n };\n currentHeight: number | 'auto';\n}\nexport interface ObservedGridNodes {\n type: 'code';\n codeElement: HTMLElement;\n numberElement: HTMLElement | null;\n codeWidth: number | 'auto';\n numberWidth: number;\n}\nexport type CodeColumnType = 'unified' | 'additions' | 'deletions';\nexport interface HunkData {\n slotName: string;\n hunkIndex: number;\n lines: number;\n type: CodeColumnType;\n expandable?: {\n chunked: boolean;\n up: boolean;\n down: boolean;\n };\n}\nexport type AnnotationLineMap<LAnnotation> = Record<number, DiffLineAnnotation<LAnnotation>[] | undefined>;\nexport type ExpansionDirections = 'up' | 'down' | 'both';\nexport interface ThemedFileResult {\n code: ElementContent[];\n themeStyles: string;\n baseThemeType: 'light' | 'dark' | undefined;\n}\nexport interface RenderDiffFilesResult {\n deletionLines: ElementContent[];\n additionLines: ElementContent[];\n}\nexport interface ThemedDiffResult {\n code: RenderDiffFilesResult;\n themeStyles: string;\n baseThemeType: 'light' | 'dark' | undefined;\n}\nexport interface HunkExpansionRegion {\n fromStart: number;\n fromEnd: number;\n}\nexport interface ForceDiffPlainTextOptions {\n forcePlainText: boolean;\n startingLine?: number;\n totalLines?: number;\n expandedHunks?: Map<number, HunkExpansionRegion> | true;\n collapsedContextThreshold?: number;\n}\nexport interface ForceFilePlainTextOptions {\n forcePlainText: boolean;\n startingLine?: number;\n totalLines?: number;\n lines?: string[];\n}\nexport interface RenderFileOptions {\n theme: DiffsThemeNames | Record<'dark' | 'light', DiffsThemeNames>;\n tokenizeMaxLineLength: number;\n}\nexport interface RenderDiffOptions {\n theme: DiffsThemeNames | Record<'dark' | 'light', DiffsThemeNames>;\n tokenizeMaxLineLength: number;\n lineDiffType: LineDiffTypes;\n}\nexport interface RenderFileResult {\n result: ThemedFileResult;\n options: RenderFileOptions;\n}\nexport interface RenderDiffResult {\n result: ThemedDiffResult;\n options: RenderDiffOptions;\n}\nexport interface RenderedFileASTCache {\n file: FileContents;\n highlighted: boolean;\n options: RenderFileOptions;\n result: ThemedFileResult | undefined;\n renderRange: RenderRange | undefined;\n}\nexport interface RenderedDiffASTCache {\n diff: FileDiffMetadata;\n highlighted: boolean;\n options: RenderDiffOptions;\n result: ThemedDiffResult | undefined;\n renderRange: RenderRange | undefined;\n}\nexport interface RenderRange {\n startingLine: number;\n totalLines: number;\n bufferBefore: number;\n bufferAfter: number;\n}\nexport interface RenderWindow {\n top: number;\n bottom: number;\n}\nexport interface VirtualWindowSpecs {\n top: number;\n bottom: number;\n}\nexport interface VirtualFileMetrics {\n hunkLineCount: number;\n lineHeight: number;\n diffHeaderHeight: number;\n hunkSeparatorHeight: number;\n fileGap: number;\n}\n//# sourceMappingURL=types.d.ts.map"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":["ElementContent","BundledLanguage","BundledTheme","CodeToHastOptions","DecorationItem","HighlighterGeneric","LanguageRegistration","ShikiTransformer","ThemedToken","ThemeRegistrationResolved","FileContents","SupportedLanguages","HighlighterTypes","DiffsThemeNames","ThemesType","Record","DiffsHighlighter","ChangeTypes","ParsedPatch","FileDiffMetadata","ContextContent","ChangeContent","Hunk","HunkLineType","ThemeTypes","HunkSeparators","LineDiffTypes","BaseCodeOptions","BaseDiffOptions","BaseDiffOptionsWithDefaults","Omit","Required","CustomPreProperties","PrePropertiesConfig","Pick","RenderHeaderMetadataProps","RenderHeaderMetadataCallback","Element","RenderHeaderPrefixCallback","RenderFileMetadata","ExtensionFormatMap","AnnotationSide","SelectionSide","OptionalMetadata","T","LineAnnotation","DiffLineAnnotation","MergeConflictResolution","MergeConflictRegion","MergeConflictActionPayload","GapSpan","LineSpans","AnnotationSpan","LineTypes","LineInfo","SharedRenderState","LineEventBaseProps","HTMLElement","DiffLineEventBaseProps","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"],"sources":["../src/types.d.ts"],"sourcesContent":["import type { ElementContent } from 'hast';\nimport type { BundledLanguage, BundledTheme, CodeToHastOptions, DecorationItem, HighlighterGeneric, LanguageRegistration, ShikiTransformer, ThemedToken, ThemeRegistrationResolved } from 'shiki';\n/**\n * Represents a file's contents for generating diffs via `parseDiffFromFile` or\n * for when rendering a file directly using the File components\n */\nexport interface FileContents {\n /** Filename used for display in headers and for inferring the language for\n * syntax highlighting. */\n name: string;\n /** The raw text contents of the file. */\n contents: string;\n /** Explicitly set the syntax highlighting language instead of inferring from\n * filename. Generally you should not be setting this. */\n lang?: SupportedLanguages;\n /** Optional header passed to the jsdiff library's `createTwoFilesPatch`. */\n header?: string;\n /** This unique key is only used for Worker Pools to avoid subsequent requests\n * if we've already highlighted the file. Please note that if you modify the\n * `contents` or `name`, you must update the `cacheKey`. */\n cacheKey?: string;\n}\nexport type 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 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 tokenizeMaxLineLength?: number;\n unsafeCSS?: string;\n}\nexport interface BaseDiffOptions extends BaseCodeOptions {\n diffStyle?: 'unified' | 'split';\n diffIndicators?: 'classic' | 'bars' | 'none';\n disableBackground?: boolean;\n hunkSeparators?: HunkSeparators;\n expandUnchanged?: boolean;\n collapsedContextThreshold?: number;\n lineDiffType?: LineDiffTypes;\n maxLineDiffLength?: number;\n expansionLineCount?: number;\n}\nexport type BaseDiffOptionsWithDefaults = Required<Omit<BaseDiffOptions, 'unsafeCSS' | 'preferredHighlighter'>>;\nexport type CustomPreProperties = Record<string, string | number | undefined>;\nexport interface PrePropertiesConfig extends Required<Pick<BaseDiffOptions, 'diffIndicators' | 'disableBackground' | 'disableLineNumbers' | 'overflow' | 'themeType'>> {\n type: 'diff' | 'file';\n split: boolean;\n themeStyles: string;\n totalLines: number;\n customProperties?: CustomPreProperties;\n}\nexport interface RenderHeaderMetadataProps {\n deletionFile?: FileContents;\n additionFile?: FileContents;\n fileDiff?: FileDiffMetadata;\n}\nexport type RenderHeaderMetadataCallback = (props: RenderHeaderMetadataProps) => Element | null | undefined | string | number;\nexport type RenderHeaderPrefixCallback = (props: RenderHeaderMetadataProps) => Element | null | undefined | string | number;\nexport type RenderFileMetadata = (file: FileContents) => Element | null | undefined | string | number;\nexport type ExtensionFormatMap = Record<string, SupportedLanguages | undefined>;\nexport type AnnotationSide = 'deletions' | 'additions';\nexport type SelectionSide = 'deletions' | 'additions';\ntype OptionalMetadata<T> = T extends undefined ? {\n metadata?: undefined;\n} : {\n metadata: T;\n};\nexport type LineAnnotation<T = undefined> = {\n lineNumber: number;\n} & OptionalMetadata<T>;\nexport type DiffLineAnnotation<T = undefined> = {\n side: AnnotationSide;\n lineNumber: number;\n} & OptionalMetadata<T>;\nexport 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 ObservedAnnotationNodes {\n type: 'annotations';\n column1: {\n container: HTMLElement;\n child: HTMLElement;\n childHeight: number;\n };\n column2: {\n container: HTMLElement;\n child: HTMLElement;\n childHeight: number;\n };\n currentHeight: number | 'auto';\n}\nexport interface ObservedGridNodes {\n type: 'code';\n codeElement: HTMLElement;\n numberElement: HTMLElement | null;\n codeWidth: number | 'auto';\n numberWidth: number;\n}\nexport type CodeColumnType = 'unified' | 'additions' | 'deletions';\nexport interface HunkData {\n slotName: string;\n hunkIndex: number;\n lines: number;\n type: CodeColumnType;\n expandable?: {\n chunked: boolean;\n up: boolean;\n down: boolean;\n };\n}\nexport type AnnotationLineMap<LAnnotation> = Record<number, DiffLineAnnotation<LAnnotation>[] | undefined>;\nexport type ExpansionDirections = 'up' | 'down' | 'both';\nexport interface ThemedFileResult {\n code: ElementContent[];\n themeStyles: string;\n baseThemeType: 'light' | 'dark' | undefined;\n}\nexport interface RenderDiffFilesResult {\n deletionLines: ElementContent[];\n additionLines: ElementContent[];\n}\nexport interface ThemedDiffResult {\n code: RenderDiffFilesResult;\n themeStyles: string;\n baseThemeType: 'light' | 'dark' | undefined;\n}\nexport interface HunkExpansionRegion {\n fromStart: number;\n fromEnd: number;\n}\nexport interface ForceDiffPlainTextOptions {\n forcePlainText: boolean;\n startingLine?: number;\n totalLines?: number;\n expandedHunks?: Map<number, HunkExpansionRegion> | true;\n collapsedContextThreshold?: number;\n}\nexport interface ForceFilePlainTextOptions {\n forcePlainText: boolean;\n startingLine?: number;\n totalLines?: number;\n lines?: string[];\n}\nexport interface RenderFileOptions {\n theme: DiffsThemeNames | Record<'dark' | 'light', DiffsThemeNames>;\n tokenizeMaxLineLength: number;\n}\nexport interface RenderDiffOptions {\n theme: DiffsThemeNames | Record<'dark' | 'light', DiffsThemeNames>;\n tokenizeMaxLineLength: number;\n lineDiffType: LineDiffTypes;\n}\nexport interface RenderFileResult {\n result: ThemedFileResult;\n options: RenderFileOptions;\n}\nexport interface RenderDiffResult {\n result: ThemedDiffResult;\n options: RenderDiffOptions;\n}\nexport interface RenderedFileASTCache {\n file: FileContents;\n highlighted: boolean;\n options: RenderFileOptions;\n result: ThemedFileResult | undefined;\n renderRange: RenderRange | undefined;\n}\nexport interface RenderedDiffASTCache {\n diff: FileDiffMetadata;\n highlighted: boolean;\n options: RenderDiffOptions;\n result: ThemedDiffResult | undefined;\n renderRange: RenderRange | undefined;\n}\nexport interface RenderRange {\n startingLine: number;\n totalLines: number;\n bufferBefore: number;\n bufferAfter: number;\n}\nexport interface RenderWindow {\n top: number;\n bottom: number;\n}\nexport interface VirtualWindowSpecs {\n top: number;\n bottom: number;\n}\nexport interface VirtualFileMetrics {\n hunkLineCount: number;\n lineHeight: number;\n diffHeaderHeight: number;\n hunkSeparatorHeight: number;\n fileGap: number;\n}\nexport interface SelectionPoint {\n lineNumber: number;\n side: SelectionSide | undefined;\n}\n//# sourceMappingURL=types.d.ts.map"],"mappings":"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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MergeConflictDiffAction } from "./parseMergeConflictDiffFromFile.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/areMergeConflictActionsEqual.d.ts
|
|
4
|
+
declare function areMergeConflictActionsEqual(a: MergeConflictDiffAction, b: MergeConflictDiffAction): boolean;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { areMergeConflictActionsEqual };
|
|
7
|
+
//# sourceMappingURL=areMergeConflictActionsEqual.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"areMergeConflictActionsEqual.d.ts","names":["MergeConflictDiffAction","areMergeConflictActionsEqual"],"sources":["../../src/utils/areMergeConflictActionsEqual.d.ts"],"sourcesContent":["import type { MergeConflictDiffAction } from './parseMergeConflictDiffFromFile';\nexport declare function areMergeConflictActionsEqual(a: MergeConflictDiffAction, b: MergeConflictDiffAction): boolean;\n//# sourceMappingURL=areMergeConflictActionsEqual.d.ts.map"],"mappings":";;;iBACwBC,4BAAAA,IAAgCD,4BAA4BA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/utils/areMergeConflictActionsEqual.ts
|
|
2
|
+
function areMergeConflictActionsEqual(a, b) {
|
|
3
|
+
return a.actionOriginalLineIndex === b.actionOriginalLineIndex && a.actionOriginalLineNumber === b.actionOriginalLineNumber && a.currentLineNumber === b.currentLineNumber && a.incomingLineNumber === b.incomingLineNumber && a.conflictIndex === b.conflictIndex && areConflictsEqual(a.conflict, b.conflict);
|
|
4
|
+
}
|
|
5
|
+
function areConflictsEqual(a, b) {
|
|
6
|
+
return a.conflictIndex === b.conflictIndex && a.startLineIndex === b.startLineIndex && a.startLineNumber === b.startLineNumber && a.separatorLineIndex === b.separatorLineIndex && a.separatorLineNumber === b.separatorLineNumber && a.endLineIndex === b.endLineIndex && a.endLineNumber === b.endLineNumber && a.baseMarkerLineIndex === b.baseMarkerLineIndex && a.baseMarkerLineNumber === b.baseMarkerLineNumber;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { areMergeConflictActionsEqual };
|
|
11
|
+
//# sourceMappingURL=areMergeConflictActionsEqual.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"areMergeConflictActionsEqual.js","names":[],"sources":["../../src/utils/areMergeConflictActionsEqual.ts"],"sourcesContent":["import type { MergeConflictRegion } from '../types';\nimport type { MergeConflictDiffAction } from './parseMergeConflictDiffFromFile';\n\nexport function areMergeConflictActionsEqual(\n a: MergeConflictDiffAction,\n b: MergeConflictDiffAction\n): boolean {\n return (\n a.actionOriginalLineIndex === b.actionOriginalLineIndex &&\n a.actionOriginalLineNumber === b.actionOriginalLineNumber &&\n a.currentLineNumber === b.currentLineNumber &&\n a.incomingLineNumber === b.incomingLineNumber &&\n a.conflictIndex === b.conflictIndex &&\n areConflictsEqual(a.conflict, b.conflict)\n );\n}\n\nfunction areConflictsEqual(a: MergeConflictRegion, b: MergeConflictRegion) {\n return (\n a.conflictIndex === b.conflictIndex &&\n a.startLineIndex === b.startLineIndex &&\n a.startLineNumber === b.startLineNumber &&\n a.separatorLineIndex === b.separatorLineIndex &&\n a.separatorLineNumber === b.separatorLineNumber &&\n a.endLineIndex === b.endLineIndex &&\n a.endLineNumber === b.endLineNumber &&\n a.baseMarkerLineIndex === b.baseMarkerLineIndex &&\n a.baseMarkerLineNumber === b.baseMarkerLineNumber\n );\n}\n"],"mappings":";AAGA,SAAgB,6BACd,GACA,GACS;AACT,QACE,EAAE,4BAA4B,EAAE,2BAChC,EAAE,6BAA6B,EAAE,4BACjC,EAAE,sBAAsB,EAAE,qBAC1B,EAAE,uBAAuB,EAAE,sBAC3B,EAAE,kBAAkB,EAAE,iBACtB,kBAAkB,EAAE,UAAU,EAAE,SAAS;;AAI7C,SAAS,kBAAkB,GAAwB,GAAwB;AACzE,QACE,EAAE,kBAAkB,EAAE,iBACtB,EAAE,mBAAmB,EAAE,kBACvB,EAAE,oBAAoB,EAAE,mBACxB,EAAE,uBAAuB,EAAE,sBAC3B,EAAE,wBAAwB,EAAE,uBAC5B,EAAE,iBAAiB,EAAE,gBACrB,EAAE,kBAAkB,EAAE,iBACtB,EAAE,wBAAwB,EAAE,uBAC5B,EAAE,yBAAyB,EAAE"}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
//#region src/utils/arePrePropertiesEqual.ts
|
|
2
2
|
function arePrePropertiesEqual(propsA, propsB) {
|
|
3
3
|
if (propsA == null || propsB == null) return propsA === propsB;
|
|
4
|
-
return propsA.type === propsB.type && propsA.diffIndicators === propsB.diffIndicators && propsA.disableBackground === propsB.disableBackground && propsA.disableLineNumbers === propsB.disableLineNumbers && propsA.overflow === propsB.overflow && propsA.split === propsB.split && propsA.themeStyles === propsB.themeStyles && propsA.themeType === propsB.themeType && propsA.totalLines === propsB.totalLines;
|
|
4
|
+
return areCustomPropertiesEqual(propsA.customProperties, propsB.customProperties) && propsA.type === propsB.type && propsA.diffIndicators === propsB.diffIndicators && propsA.disableBackground === propsB.disableBackground && propsA.disableLineNumbers === propsB.disableLineNumbers && propsA.overflow === propsB.overflow && propsA.split === propsB.split && propsA.themeStyles === propsB.themeStyles && propsA.themeType === propsB.themeType && propsA.totalLines === propsB.totalLines;
|
|
5
|
+
}
|
|
6
|
+
const EMPTY_CUSTOM_PROPERTIES = {};
|
|
7
|
+
function areCustomPropertiesEqual(customPropertiesA = EMPTY_CUSTOM_PROPERTIES, customPropertiesB = EMPTY_CUSTOM_PROPERTIES) {
|
|
8
|
+
if (customPropertiesA === customPropertiesB) return true;
|
|
9
|
+
const keysA = Object.keys(customPropertiesA);
|
|
10
|
+
const keysB = Object.keys(customPropertiesB);
|
|
11
|
+
if (keysA.length !== keysB.length) return false;
|
|
12
|
+
for (const key of keysA) if (customPropertiesA[key] !== customPropertiesB[key]) return false;
|
|
13
|
+
return true;
|
|
5
14
|
}
|
|
6
15
|
|
|
7
16
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arePrePropertiesEqual.js","names":[],"sources":["../../src/utils/arePrePropertiesEqual.ts"],"sourcesContent":["import type { PrePropertiesConfig } from '../types';\n\nexport function arePrePropertiesEqual(\n propsA: PrePropertiesConfig | undefined,\n propsB: PrePropertiesConfig | undefined\n): boolean {\n if (propsA == null || propsB == null) {\n return propsA === propsB;\n }\n return (\n propsA.type === propsB.type &&\n propsA.diffIndicators === propsB.diffIndicators &&\n propsA.disableBackground === propsB.disableBackground &&\n propsA.disableLineNumbers === propsB.disableLineNumbers &&\n propsA.overflow === propsB.overflow &&\n propsA.split === propsB.split &&\n propsA.themeStyles === propsB.themeStyles &&\n propsA.themeType === propsB.themeType &&\n propsA.totalLines === propsB.totalLines\n );\n}\n"],"mappings":";AAEA,SAAgB,sBACd,QACA,QACS;AACT,KAAI,UAAU,QAAQ,UAAU,KAC9B,QAAO,WAAW;AAEpB,QACE,OAAO,SAAS,OAAO,QACvB,OAAO,mBAAmB,OAAO,kBACjC,OAAO,sBAAsB,OAAO,qBACpC,OAAO,uBAAuB,OAAO,sBACrC,OAAO,aAAa,OAAO,YAC3B,OAAO,UAAU,OAAO,SACxB,OAAO,gBAAgB,OAAO,eAC9B,OAAO,cAAc,OAAO,aAC5B,OAAO,eAAe,OAAO"}
|
|
1
|
+
{"version":3,"file":"arePrePropertiesEqual.js","names":["EMPTY_CUSTOM_PROPERTIES: CustomPreProperties"],"sources":["../../src/utils/arePrePropertiesEqual.ts"],"sourcesContent":["import type { CustomPreProperties, PrePropertiesConfig } from '../types';\n\nexport function arePrePropertiesEqual(\n propsA: PrePropertiesConfig | undefined,\n propsB: PrePropertiesConfig | undefined\n): boolean {\n if (propsA == null || propsB == null) {\n return propsA === propsB;\n }\n return (\n areCustomPropertiesEqual(\n propsA.customProperties,\n propsB.customProperties\n ) &&\n propsA.type === propsB.type &&\n propsA.diffIndicators === propsB.diffIndicators &&\n propsA.disableBackground === propsB.disableBackground &&\n propsA.disableLineNumbers === propsB.disableLineNumbers &&\n propsA.overflow === propsB.overflow &&\n propsA.split === propsB.split &&\n propsA.themeStyles === propsB.themeStyles &&\n propsA.themeType === propsB.themeType &&\n propsA.totalLines === propsB.totalLines\n );\n}\n\nconst EMPTY_CUSTOM_PROPERTIES: CustomPreProperties = {};\n\nfunction areCustomPropertiesEqual(\n customPropertiesA: CustomPreProperties = EMPTY_CUSTOM_PROPERTIES,\n customPropertiesB: CustomPreProperties = EMPTY_CUSTOM_PROPERTIES\n): boolean {\n if (customPropertiesA === customPropertiesB) {\n return true;\n }\n const keysA = Object.keys(customPropertiesA);\n const keysB = Object.keys(customPropertiesB);\n if (keysA.length !== keysB.length) {\n return false;\n }\n for (const key of keysA) {\n if (customPropertiesA[key] !== customPropertiesB[key]) {\n return false;\n }\n }\n return true;\n}\n"],"mappings":";AAEA,SAAgB,sBACd,QACA,QACS;AACT,KAAI,UAAU,QAAQ,UAAU,KAC9B,QAAO,WAAW;AAEpB,QACE,yBACE,OAAO,kBACP,OAAO,iBACR,IACD,OAAO,SAAS,OAAO,QACvB,OAAO,mBAAmB,OAAO,kBACjC,OAAO,sBAAsB,OAAO,qBACpC,OAAO,uBAAuB,OAAO,sBACrC,OAAO,aAAa,OAAO,YAC3B,OAAO,UAAU,OAAO,SACxB,OAAO,gBAAgB,OAAO,eAC9B,OAAO,cAAc,OAAO,aAC5B,OAAO,eAAe,OAAO;;AAIjC,MAAMA,0BAA+C,EAAE;AAEvD,SAAS,yBACP,oBAAyC,yBACzC,oBAAyC,yBAChC;AACT,KAAI,sBAAsB,kBACxB,QAAO;CAET,MAAM,QAAQ,OAAO,KAAK,kBAAkB;CAC5C,MAAM,QAAQ,OAAO,KAAK,kBAAkB;AAC5C,KAAI,MAAM,WAAW,MAAM,OACzB,QAAO;AAET,MAAK,MAAM,OAAO,MAChB,KAAI,kBAAkB,SAAS,kBAAkB,KAC/C,QAAO;AAGX,QAAO"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SelectionPoint } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/areSelectionPointsEqual.d.ts
|
|
4
|
+
declare function areSelectionPointsEqual(a: SelectionPoint, b: SelectionPoint): boolean;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { areSelectionPointsEqual };
|
|
7
|
+
//# sourceMappingURL=areSelectionPointsEqual.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"areSelectionPointsEqual.d.ts","names":["SelectionPoint","areSelectionPointsEqual"],"sources":["../../src/utils/areSelectionPointsEqual.d.ts"],"sourcesContent":["import type { SelectionPoint } from '../types';\nexport declare function areSelectionPointsEqual(a: SelectionPoint, b: SelectionPoint): boolean;\n//# sourceMappingURL=areSelectionPointsEqual.d.ts.map"],"mappings":";;;iBACwBC,uBAAAA,IAA2BD,mBAAmBA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"areSelectionPointsEqual.js","names":[],"sources":["../../src/utils/areSelectionPointsEqual.ts"],"sourcesContent":["import type { SelectionPoint } from '../types';\n\nexport function areSelectionPointsEqual(\n a: SelectionPoint,\n b: SelectionPoint\n): boolean {\n return a.lineNumber === b.lineNumber && a.side === b.side;\n}\n"],"mappings":";AAEA,SAAgB,wBACd,GACA,GACS;AACT,QAAO,EAAE,eAAe,EAAE,cAAc,EAAE,SAAS,EAAE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SelectedLineRange } from "../managers/
|
|
1
|
+
import { SelectedLineRange } from "../managers/InteractionManager.js";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/areSelectionsEqual.d.ts
|
|
4
4
|
declare function areSelectionsEqual(selectionA: SelectedLineRange | undefined, selectionB: SelectedLineRange | undefined): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"areSelectionsEqual.d.ts","names":["SelectedLineRange","areSelectionsEqual"],"sources":["../../src/utils/areSelectionsEqual.d.ts"],"sourcesContent":["import type { SelectedLineRange } from '../managers/
|
|
1
|
+
{"version":3,"file":"areSelectionsEqual.d.ts","names":["SelectedLineRange","areSelectionsEqual"],"sources":["../../src/utils/areSelectionsEqual.d.ts"],"sourcesContent":["import type { SelectedLineRange } from '../managers/InteractionManager';\nexport declare function areSelectionsEqual(selectionA: SelectedLineRange | undefined, selectionB: SelectedLineRange | undefined): boolean;\n//# sourceMappingURL=areSelectionsEqual.d.ts.map"],"mappings":";;;iBACwBC,kBAAAA,aAA+BD,2CAA2CA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"areSelectionsEqual.js","names":[],"sources":["../../src/utils/areSelectionsEqual.ts"],"sourcesContent":["import type { SelectedLineRange } from '../managers/
|
|
1
|
+
{"version":3,"file":"areSelectionsEqual.js","names":[],"sources":["../../src/utils/areSelectionsEqual.ts"],"sourcesContent":["import type { SelectedLineRange } from '../managers/InteractionManager';\n\nexport function areSelectionsEqual(\n selectionA: SelectedLineRange | undefined,\n selectionB: SelectedLineRange | undefined\n): boolean {\n return (\n selectionA?.start === selectionB?.start &&\n selectionA?.end === selectionB?.end &&\n selectionA?.side === selectionB?.side &&\n selectionA?.endSide === selectionB?.endSide\n );\n}\n"],"mappings":";AAEA,SAAgB,mBACd,YACA,YACS;AACT,QACE,YAAY,UAAU,YAAY,SAClC,YAAY,QAAQ,YAAY,OAChC,YAAY,SAAS,YAAY,QACjC,YAAY,YAAY,YAAY"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HEADER_METADATA_SLOT_ID } from "../constants.js";
|
|
1
|
+
import { HEADER_METADATA_SLOT_ID, HEADER_PREFIX_SLOT_ID } from "../constants.js";
|
|
2
2
|
import { createHastElement, createIconElement, createTextNodeElement } from "./hast_utils.js";
|
|
3
3
|
import { getIconForType } from "./getIconForType.js";
|
|
4
4
|
|
|
@@ -22,7 +22,10 @@ function createFileHeaderElement({ fileOrDiff, themeStyles, themeType }) {
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
function createHeaderElement({ name, prevName, iconType }) {
|
|
25
|
-
const children = [
|
|
25
|
+
const children = [createHastElement({
|
|
26
|
+
tagName: "slot",
|
|
27
|
+
properties: { name: HEADER_PREFIX_SLOT_ID }
|
|
28
|
+
}), createIconElement({
|
|
26
29
|
name: getIconForType(iconType),
|
|
27
30
|
properties: { "data-change-icon": iconType }
|
|
28
31
|
})];
|
|
@@ -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 { HEADER_METADATA_SLOT_ID } from '../constants';\nimport type {\n ChangeTypes,\n FileContents,\n FileDiffMetadata,\n ThemeTypes,\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 themeStyles: string;\n themeType: ThemeTypes;\n}\n\nexport function createFileHeaderElement({\n fileOrDiff,\n themeStyles,\n themeType,\n}: CreateFileHeaderElementProps): HASTElement {\n const fileDiff = 'type' in fileOrDiff ? fileOrDiff : undefined;\n const properties: Properties = {\n 'data-diffs-header': '',\n 'data-change-type': fileDiff?.type,\n 'data-theme-type': themeType !== 'system' ? themeType : undefined,\n style: themeStyles,\n };\n\n return createHastElement({\n tagName: 'div',\n children: [\n createHeaderElement({\n name: fileOrDiff.name,\n prevName: 'prevName' in fileOrDiff ? fileOrDiff.prevName : undefined,\n iconType: fileDiff?.type ?? 'file',\n }),\n 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 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: [createTextNodeElement(prevName)],\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: [createTextNodeElement(name)],\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":";;;;;AAsBA,SAAgB,wBAAwB,EACtC,YACA,aACA,aAC4C;CAC5C,MAAM,WAAW,UAAU,aAAa,aAAa;CACrD,MAAMA,aAAyB;EAC7B,qBAAqB;EACrB,oBAAoB,UAAU;EAC9B,mBAAmB,cAAc,WAAW,YAAY;EACxD,OAAO;EACR;AAED,QAAO,kBAAkB;EACvB,SAAS;EACT,UAAU,CACR,oBAAoB;GAClB,MAAM,WAAW;GACjB,UAAU,cAAc,aAAa,WAAW,WAAW;GAC3D,UAAU,UAAU,QAAQ;GAC7B,CAAC,EACF,sBAAsB,SAAS,CAChC;EACD;EACD,CAAC;;AASJ,SAAS,oBAAoB,EAC3B,MACA,UACA,YAC0C;CAC1C,MAAMC,WAA6B,CACjC,kBAAkB;EAChB,MAAM,eAAe,SAAS;EAC9B,YAAY,EAAE,oBAAoB,UAAU;EAC7C,CAAC,CACH;AACD,KAAI,YAAY,MAAM;AACpB,WAAS,KACP,kBAAkB;GAChB,SAAS;GACT,UAAU,CAAC,sBAAsB,SAAS,CAAC;GAC3C,YAAY,EACV,kBAAkB,IACnB;GACF,CAAC,CACH;AACD,WAAS,KACP,kBAAkB;GAChB,MAAM;GACN,YAAY,EACV,oBAAoB,IACrB;GACF,CAAC,CACH;;AAEH,UAAS,KACP,kBAAkB;EAChB,SAAS;EACT,UAAU,CAAC,sBAAsB,KAAK,CAAC;EACvC,YAAY,EAAE,cAAc,IAAI;EACjC,CAAC,CACH;AACD,QAAO,kBAAkB;EACvB,SAAS;EACT;EACA,YAAY,EAAE,uBAAuB,IAAI;EAC1C,CAAC;;AAGJ,SAAS,sBACP,UACa;CACb,MAAMA,WAA6B,EAAE;AACrC,KAAI,YAAY,MAAM;EACpB,IAAI,YAAY;EAChB,IAAI,YAAY;AAChB,OAAK,MAAM,QAAQ,SAAS,OAAO;AACjC,gBAAa,KAAK;AAClB,gBAAa,KAAK;;AAEpB,MAAI,YAAY,KAAK,cAAc,EACjC,UAAS,KACP,kBAAkB;GAChB,SAAS;GACT,UAAU,CAAC,sBAAsB,IAAI,YAAY,CAAC;GAClD,YAAY,EAAE,wBAAwB,IAAI;GAC3C,CAAC,CACH;AAEH,MAAI,YAAY,KAAK,cAAc,EACjC,UAAS,KACP,kBAAkB;GAChB,SAAS;GACT,UAAU,CAAC,sBAAsB,IAAI,YAAY,CAAC;GAClD,YAAY,EAAE,wBAAwB,IAAI;GAC3C,CAAC,CACH;;AAGL,UAAS,KACP,kBAAkB;EAChB,SAAS;EACT,YAAY,EAAE,MAAM,yBAAyB;EAC9C,CAAC,CACH;AACD,QAAO,kBAAkB;EACvB,SAAS;EACT;EACA,YAAY,EAAE,iBAAiB,IAAI;EACpC,CAAC"}
|
|
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 { HEADER_METADATA_SLOT_ID, HEADER_PREFIX_SLOT_ID } from '../constants';\nimport type {\n ChangeTypes,\n FileContents,\n FileDiffMetadata,\n ThemeTypes,\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 themeStyles: string;\n themeType: ThemeTypes;\n}\n\nexport function createFileHeaderElement({\n fileOrDiff,\n themeStyles,\n themeType,\n}: CreateFileHeaderElementProps): HASTElement {\n const fileDiff = 'type' in fileOrDiff ? fileOrDiff : undefined;\n const properties: Properties = {\n 'data-diffs-header': '',\n 'data-change-type': fileDiff?.type,\n 'data-theme-type': themeType !== 'system' ? themeType : undefined,\n style: themeStyles,\n };\n\n return createHastElement({\n tagName: 'div',\n children: [\n createHeaderElement({\n name: fileOrDiff.name,\n prevName: 'prevName' in fileOrDiff ? fileOrDiff.prevName : undefined,\n iconType: fileDiff?.type ?? 'file',\n }),\n 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: [createTextNodeElement(prevName)],\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: [createTextNodeElement(name)],\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":";;;;;AAsBA,SAAgB,wBAAwB,EACtC,YACA,aACA,aAC4C;CAC5C,MAAM,WAAW,UAAU,aAAa,aAAa;CACrD,MAAMA,aAAyB;EAC7B,qBAAqB;EACrB,oBAAoB,UAAU;EAC9B,mBAAmB,cAAc,WAAW,YAAY;EACxD,OAAO;EACR;AAED,QAAO,kBAAkB;EACvB,SAAS;EACT,UAAU,CACR,oBAAoB;GAClB,MAAM,WAAW;GACjB,UAAU,cAAc,aAAa,WAAW,WAAW;GAC3D,UAAU,UAAU,QAAQ;GAC7B,CAAC,EACF,sBAAsB,SAAS,CAChC;EACD;EACD,CAAC;;AASJ,SAAS,oBAAoB,EAC3B,MACA,UACA,YAC0C;CAC1C,MAAMC,WAA6B,CACjC,kBAAkB;EAChB,SAAS;EACT,YAAY,EAAE,MAAM,uBAAuB;EAC5C,CAAC,EACF,kBAAkB;EAChB,MAAM,eAAe,SAAS;EAC9B,YAAY,EAAE,oBAAoB,UAAU;EAC7C,CAAC,CACH;AACD,KAAI,YAAY,MAAM;AACpB,WAAS,KACP,kBAAkB;GAChB,SAAS;GACT,UAAU,CAAC,sBAAsB,SAAS,CAAC;GAC3C,YAAY,EACV,kBAAkB,IACnB;GACF,CAAC,CACH;AACD,WAAS,KACP,kBAAkB;GAChB,MAAM;GACN,YAAY,EACV,oBAAoB,IACrB;GACF,CAAC,CACH;;AAEH,UAAS,KACP,kBAAkB;EAChB,SAAS;EACT,UAAU,CAAC,sBAAsB,KAAK,CAAC;EACvC,YAAY,EAAE,cAAc,IAAI;EACjC,CAAC,CACH;AACD,QAAO,kBAAkB;EACvB,SAAS;EACT;EACA,YAAY,EAAE,uBAAuB,IAAI;EAC1C,CAAC;;AAGJ,SAAS,sBACP,UACa;CACb,MAAMA,WAA6B,EAAE;AACrC,KAAI,YAAY,MAAM;EACpB,IAAI,YAAY;EAChB,IAAI,YAAY;AAChB,OAAK,MAAM,QAAQ,SAAS,OAAO;AACjC,gBAAa,KAAK;AAClB,gBAAa,KAAK;;AAEpB,MAAI,YAAY,KAAK,cAAc,EACjC,UAAS,KACP,kBAAkB;GAChB,SAAS;GACT,UAAU,CAAC,sBAAsB,IAAI,YAAY,CAAC;GAClD,YAAY,EAAE,wBAAwB,IAAI;GAC3C,CAAC,CACH;AAEH,MAAI,YAAY,KAAK,cAAc,EACjC,UAAS,KACP,kBAAkB;GAChB,SAAS;GACT,UAAU,CAAC,sBAAsB,IAAI,YAAY,CAAC;GAClD,YAAY,EAAE,wBAAwB,IAAI;GAC3C,CAAC,CACH;;AAGL,UAAS,KACP,kBAAkB;EAChB,SAAS;EACT,YAAY,EAAE,MAAM,yBAAyB;EAC9C,CAAC,CACH;AACD,QAAO,kBAAkB;EACvB,SAAS;EACT;EACA,YAAY,EAAE,iBAAiB,IAAI;EACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createGutterUtilityContentNode.d.ts","names":["createGutterUtilityContentNode","HTMLElement"],"sources":["../../src/utils/createGutterUtilityContentNode.d.ts"],"sourcesContent":["export declare function createGutterUtilityContentNode(): HTMLElement;\n//# sourceMappingURL=createGutterUtilityContentNode.d.ts.map"],"mappings":";iBAAwBA,8BAAAA,CAAAA,GAAkCC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/utils/createGutterUtilityContentNode.ts
|
|
2
|
+
function createGutterUtilityContentNode() {
|
|
3
|
+
const gutterUtilityContent = document.createElement("div");
|
|
4
|
+
gutterUtilityContent.slot = "gutter-utility-slot";
|
|
5
|
+
gutterUtilityContent.style.position = "absolute";
|
|
6
|
+
gutterUtilityContent.style.top = "0";
|
|
7
|
+
gutterUtilityContent.style.bottom = "0";
|
|
8
|
+
gutterUtilityContent.style.textAlign = "center";
|
|
9
|
+
gutterUtilityContent.style.whiteSpace = "normal";
|
|
10
|
+
return gutterUtilityContent;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { createGutterUtilityContentNode };
|
|
15
|
+
//# sourceMappingURL=createGutterUtilityContentNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createGutterUtilityContentNode.js","names":[],"sources":["../../src/utils/createGutterUtilityContentNode.ts"],"sourcesContent":["export function createGutterUtilityContentNode(): HTMLElement {\n const gutterUtilityContent = document.createElement('div');\n gutterUtilityContent.slot = 'gutter-utility-slot';\n gutterUtilityContent.style.position = 'absolute';\n gutterUtilityContent.style.top = '0';\n gutterUtilityContent.style.bottom = '0';\n gutterUtilityContent.style.textAlign = 'center';\n gutterUtilityContent.style.whiteSpace = 'normal';\n return gutterUtilityContent;\n}\n"],"mappings":";AAAA,SAAgB,iCAA8C;CAC5D,MAAM,uBAAuB,SAAS,cAAc,MAAM;AAC1D,sBAAqB,OAAO;AAC5B,sBAAqB,MAAM,WAAW;AACtC,sBAAqB,MAAM,MAAM;AACjC,sBAAqB,MAAM,SAAS;AACpC,sBAAqB,MAAM,YAAY;AACvC,sBAAqB,MAAM,aAAa;AACxC,QAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createGutterUtilityElement.d.ts","names":["Element","HASTElement","createGutterUtilityElement"],"sources":["../../src/utils/createGutterUtilityElement.d.ts"],"sourcesContent":["import type { Element as HASTElement } from 'hast';\nexport declare function createGutterUtilityElement(): HASTElement;\n//# sourceMappingURL=createGutterUtilityElement.d.ts.map"],"mappings":";;;iBACwBE,0BAAAA,CAAAA,GAA8BD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createHastElement, createIconElement } from "./hast_utils.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/createGutterUtilityElement.ts
|
|
4
|
+
function createGutterUtilityElement() {
|
|
5
|
+
return createHastElement({
|
|
6
|
+
tagName: "button",
|
|
7
|
+
properties: {
|
|
8
|
+
"data-utility-button": "",
|
|
9
|
+
type: "button"
|
|
10
|
+
},
|
|
11
|
+
children: [createIconElement({
|
|
12
|
+
name: "diffs-icon-plus",
|
|
13
|
+
properties: { "data-icon": "" }
|
|
14
|
+
})]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { createGutterUtilityElement };
|
|
20
|
+
//# sourceMappingURL=createGutterUtilityElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createGutterUtilityElement.js","names":[],"sources":["../../src/utils/createGutterUtilityElement.ts"],"sourcesContent":["import type { Element as HASTElement } from 'hast';\n\nimport { createHastElement, createIconElement } from './hast_utils';\n\nexport function createGutterUtilityElement(): HASTElement {\n return createHastElement({\n tagName: 'button',\n properties: { 'data-utility-button': '', type: 'button' },\n children: [\n createIconElement({\n name: 'diffs-icon-plus',\n properties: { 'data-icon': '' },\n }),\n ],\n });\n}\n"],"mappings":";;;AAIA,SAAgB,6BAA0C;AACxD,QAAO,kBAAkB;EACvB,SAAS;EACT,YAAY;GAAE,uBAAuB;GAAI,MAAM;GAAU;EACzD,UAAU,CACR,kBAAkB;GAChB,MAAM;GACN,YAAY,EAAE,aAAa,IAAI;GAChC,CAAC,CACH;EACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPreElement.d.ts","names":["Element","HASTElement","Properties","PrePropertiesConfig","createPreElement","createPreWrapperProperties","diffIndicators","disableBackground","disableLineNumbers","overflow","split","themeType","themeStyles","totalLines","type"],"sources":["../../src/utils/createPreElement.d.ts"],"sourcesContent":["import type { Element as HASTElement, Properties } from 'hast';\nimport type { PrePropertiesConfig } from '../types';\nexport declare function createPreElement(options: PrePropertiesConfig): HASTElement;\nexport declare function createPreWrapperProperties({ diffIndicators, disableBackground, disableLineNumbers, overflow, split, themeType, themeStyles, totalLines, type }: PrePropertiesConfig): Properties;\n//# sourceMappingURL=createPreElement.d.ts.map"],"mappings":";;;;iBAEwBI,gBAAAA,UAA0BD,sBAAsBF;iBAChDI,0BAAAA
|
|
1
|
+
{"version":3,"file":"createPreElement.d.ts","names":["Element","HASTElement","Properties","PrePropertiesConfig","createPreElement","createPreWrapperProperties","diffIndicators","disableBackground","disableLineNumbers","overflow","split","themeType","themeStyles","totalLines","type","customProperties"],"sources":["../../src/utils/createPreElement.d.ts"],"sourcesContent":["import type { Element as HASTElement, Properties } from 'hast';\nimport type { PrePropertiesConfig } from '../types';\nexport declare function createPreElement(options: PrePropertiesConfig): HASTElement;\nexport declare function createPreWrapperProperties({ diffIndicators, disableBackground, disableLineNumbers, overflow, split, themeType, themeStyles, totalLines, type, customProperties }: PrePropertiesConfig): Properties;\n//# sourceMappingURL=createPreElement.d.ts.map"],"mappings":";;;;iBAEwBI,gBAAAA,UAA0BD,sBAAsBF;iBAChDI,0BAAAA;;;;;;;;;;;GAAmKF,sBAAsBD"}
|
|
@@ -7,8 +7,9 @@ function createPreElement(options) {
|
|
|
7
7
|
properties: createPreWrapperProperties(options)
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
|
-
function createPreWrapperProperties({ diffIndicators, disableBackground, disableLineNumbers, overflow, split, themeType, themeStyles, totalLines, type }) {
|
|
10
|
+
function createPreWrapperProperties({ diffIndicators, disableBackground, disableLineNumbers, overflow, split, themeType, themeStyles, totalLines, type, customProperties }) {
|
|
11
11
|
const properties = {
|
|
12
|
+
...customProperties,
|
|
12
13
|
"data-diff": type === "diff" ? "" : void 0,
|
|
13
14
|
"data-file": type === "file" ? "" : void 0,
|
|
14
15
|
"data-diff-type": type === "diff" ? split ? "split" : "single" : void 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPreElement.js","names":["properties: Properties"],"sources":["../../src/utils/createPreElement.ts"],"sourcesContent":["import type { Element as HASTElement, Properties } from 'hast';\n\nimport type { PrePropertiesConfig } from '../types';\nimport { createHastElement } from './hast_utils';\n\nexport function createPreElement(options: PrePropertiesConfig): HASTElement {\n return createHastElement({\n tagName: 'pre',\n properties: createPreWrapperProperties(options),\n });\n}\n\nexport function createPreWrapperProperties({\n diffIndicators,\n disableBackground,\n disableLineNumbers,\n overflow,\n split,\n themeType,\n themeStyles,\n totalLines,\n type,\n}: PrePropertiesConfig): Properties {\n const properties: Properties = {\n 'data-diff': type === 'diff' ? '' : undefined,\n 'data-file': type === 'file' ? '' : undefined,\n 'data-diff-type':\n type === 'diff' ? (split ? 'split' : 'single') : undefined,\n 'data-overflow': overflow,\n 'data-disable-line-numbers': disableLineNumbers ? '' : undefined,\n 'data-background': !disableBackground ? '' : undefined,\n 'data-indicators':\n diffIndicators === 'bars' || diffIndicators === 'classic'\n ? diffIndicators\n : undefined,\n 'data-theme-type': themeType !== 'system' ? themeType : undefined,\n // NOTE(amadeus): Alex, here we would probably set a class property\n // instead, when that's working and supported\n style: themeStyles,\n tabIndex: 0,\n };\n properties.style += `--diffs-min-number-column-width-default:${`${totalLines}`.length}ch;`;\n\n return properties;\n}\n"],"mappings":";;;AAKA,SAAgB,iBAAiB,SAA2C;AAC1E,QAAO,kBAAkB;EACvB,SAAS;EACT,YAAY,2BAA2B,QAAQ;EAChD,CAAC;;AAGJ,SAAgB,2BAA2B,EACzC,gBACA,mBACA,oBACA,UACA,OACA,WACA,aACA,YACA,
|
|
1
|
+
{"version":3,"file":"createPreElement.js","names":["properties: Properties"],"sources":["../../src/utils/createPreElement.ts"],"sourcesContent":["import type { Element as HASTElement, Properties } from 'hast';\n\nimport type { PrePropertiesConfig } from '../types';\nimport { createHastElement } from './hast_utils';\n\nexport function createPreElement(options: PrePropertiesConfig): HASTElement {\n return createHastElement({\n tagName: 'pre',\n properties: createPreWrapperProperties(options),\n });\n}\n\nexport function createPreWrapperProperties({\n diffIndicators,\n disableBackground,\n disableLineNumbers,\n overflow,\n split,\n themeType,\n themeStyles,\n totalLines,\n type,\n customProperties,\n}: PrePropertiesConfig): Properties {\n const properties: Properties = {\n // NOTE: We always apply custom properties first so the important\n // properties cannot be overridden\n ...customProperties,\n 'data-diff': type === 'diff' ? '' : undefined,\n 'data-file': type === 'file' ? '' : undefined,\n 'data-diff-type':\n type === 'diff' ? (split ? 'split' : 'single') : undefined,\n 'data-overflow': overflow,\n 'data-disable-line-numbers': disableLineNumbers ? '' : undefined,\n 'data-background': !disableBackground ? '' : undefined,\n 'data-indicators':\n diffIndicators === 'bars' || diffIndicators === 'classic'\n ? diffIndicators\n : undefined,\n 'data-theme-type': themeType !== 'system' ? themeType : undefined,\n // NOTE(amadeus): Alex, here we would probably set a class property\n // instead, when that's working and supported\n style: themeStyles,\n tabIndex: 0,\n };\n properties.style += `--diffs-min-number-column-width-default:${`${totalLines}`.length}ch;`;\n\n return properties;\n}\n"],"mappings":";;;AAKA,SAAgB,iBAAiB,SAA2C;AAC1E,QAAO,kBAAkB;EACvB,SAAS;EACT,YAAY,2BAA2B,QAAQ;EAChD,CAAC;;AAGJ,SAAgB,2BAA2B,EACzC,gBACA,mBACA,oBACA,UACA,OACA,WACA,aACA,YACA,MACA,oBACkC;CAClC,MAAMA,aAAyB;EAG7B,GAAG;EACH,aAAa,SAAS,SAAS,KAAK;EACpC,aAAa,SAAS,SAAS,KAAK;EACpC,kBACE,SAAS,SAAU,QAAQ,UAAU,WAAY;EACnD,iBAAiB;EACjB,6BAA6B,qBAAqB,KAAK;EACvD,mBAAmB,CAAC,oBAAoB,KAAK;EAC7C,mBACE,mBAAmB,UAAU,mBAAmB,YAC5C,iBACA;EACN,mBAAmB,cAAc,WAAW,YAAY;EAGxD,OAAO;EACP,UAAU;EACX;AACD,YAAW,SAAS,2CAA2C,GAAG,aAAa,OAAO;AAEtF,QAAO"}
|
|
@@ -23,7 +23,7 @@ function createSeparator({ type, content, expandIndex, chunked = false, slotName
|
|
|
23
23
|
children: [createTextNodeElement(content)],
|
|
24
24
|
properties: { "data-separator-wrapper": "" }
|
|
25
25
|
}));
|
|
26
|
-
if (type === "line-info" && content != null) {
|
|
26
|
+
if ((type === "line-info" || type === "line-info-basic") && content != null) {
|
|
27
27
|
const contentChildren = [];
|
|
28
28
|
if (expandIndex != null) if (!chunked) contentChildren.push(createExpandButton(!isFirstHunk && !isLastHunk ? "both" : isFirstHunk ? "down" : "up"));
|
|
29
29
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSeparator.js","names":["contentChildren: ElementContent[]"],"sources":["../../src/utils/createSeparator.ts"],"sourcesContent":["import type { ElementContent, Element as HASTElement } from 'hast';\n\nimport type { ExpansionDirections, HunkSeparators } from '../types';\nimport {\n createHastElement,\n createIconElement,\n createTextNodeElement,\n} from './hast_utils';\n\ninterface CreateSeparatorProps {\n type: HunkSeparators;\n content?: string;\n expandIndex?: number;\n chunked?: boolean;\n slotName?: string;\n isFirstHunk: boolean;\n isLastHunk: boolean;\n}\n\nfunction createExpandButton(type: ExpansionDirections) {\n return createHastElement({\n tagName: 'div',\n children: [\n createIconElement({\n name: type === 'both' ? 'diffs-icon-expand-all' : 'diffs-icon-expand',\n properties: { 'data-icon': '' },\n }),\n ],\n properties: {\n 'data-expand-button': '',\n 'data-expand-both': type === 'both' ? '' : undefined,\n 'data-expand-up': type === 'up' ? '' : undefined,\n 'data-expand-down': type === 'down' ? '' : undefined,\n },\n });\n}\n\nexport function createSeparator({\n type,\n content,\n expandIndex,\n chunked = false,\n slotName,\n isFirstHunk,\n isLastHunk,\n}: CreateSeparatorProps): HASTElement {\n const children = [];\n if (type === 'metadata' && content != null) {\n children.push(\n createHastElement({\n tagName: 'div',\n children: [createTextNodeElement(content)],\n properties: { 'data-separator-wrapper': '' },\n })\n );\n }\n if (type === 'line-info' && content != null) {\n const contentChildren: ElementContent[] = [];\n if (expandIndex != null) {\n if (!chunked) {\n contentChildren.push(\n createExpandButton(\n !isFirstHunk && !isLastHunk ? 'both' : isFirstHunk ? 'down' : 'up'\n )\n );\n } else {\n if (!isFirstHunk) {\n contentChildren.push(createExpandButton('up'));\n }\n if (!isLastHunk) {\n contentChildren.push(createExpandButton('down'));\n }\n }\n }\n contentChildren.push(\n createHastElement({\n tagName: 'div',\n children: [\n createHastElement({\n tagName: 'span',\n children: [createTextNodeElement(content)],\n properties: { 'data-unmodified-lines': '' },\n }),\n ],\n properties: { 'data-separator-content': '' },\n })\n );\n children.push(\n createHastElement({\n tagName: 'div',\n children: contentChildren,\n properties: {\n 'data-separator-wrapper': '',\n 'data-separator-multi-button':\n contentChildren.length > 2 ? '' : undefined,\n },\n })\n );\n }\n if (type === 'custom' && slotName != null) {\n children.push(\n createHastElement({\n tagName: 'slot',\n properties: { name: slotName },\n })\n );\n }\n return createHastElement({\n tagName: 'div',\n children,\n properties: {\n 'data-separator': children.length === 0 ? 'simple' : type,\n 'data-expand-index': expandIndex,\n 'data-separator-first': isFirstHunk ? '' : undefined,\n 'data-separator-last': isLastHunk ? '' : undefined,\n },\n });\n}\n"],"mappings":";;;AAmBA,SAAS,mBAAmB,MAA2B;AACrD,QAAO,kBAAkB;EACvB,SAAS;EACT,UAAU,CACR,kBAAkB;GAChB,MAAM,SAAS,SAAS,0BAA0B;GAClD,YAAY,EAAE,aAAa,IAAI;GAChC,CAAC,CACH;EACD,YAAY;GACV,sBAAsB;GACtB,oBAAoB,SAAS,SAAS,KAAK;GAC3C,kBAAkB,SAAS,OAAO,KAAK;GACvC,oBAAoB,SAAS,SAAS,KAAK;GAC5C;EACF,CAAC;;AAGJ,SAAgB,gBAAgB,EAC9B,MACA,SACA,aACA,UAAU,OACV,UACA,aACA,cACoC;CACpC,MAAM,WAAW,EAAE;AACnB,KAAI,SAAS,cAAc,WAAW,KACpC,UAAS,KACP,kBAAkB;EAChB,SAAS;EACT,UAAU,CAAC,sBAAsB,QAAQ,CAAC;EAC1C,YAAY,EAAE,0BAA0B,IAAI;EAC7C,CAAC,CACH;AAEH,
|
|
1
|
+
{"version":3,"file":"createSeparator.js","names":["contentChildren: ElementContent[]"],"sources":["../../src/utils/createSeparator.ts"],"sourcesContent":["import type { ElementContent, Element as HASTElement } from 'hast';\n\nimport type { ExpansionDirections, HunkSeparators } from '../types';\nimport {\n createHastElement,\n createIconElement,\n createTextNodeElement,\n} from './hast_utils';\n\ninterface CreateSeparatorProps {\n type: HunkSeparators;\n content?: string;\n expandIndex?: number;\n chunked?: boolean;\n slotName?: string;\n isFirstHunk: boolean;\n isLastHunk: boolean;\n}\n\nfunction createExpandButton(type: ExpansionDirections) {\n return createHastElement({\n tagName: 'div',\n children: [\n createIconElement({\n name: type === 'both' ? 'diffs-icon-expand-all' : 'diffs-icon-expand',\n properties: { 'data-icon': '' },\n }),\n ],\n properties: {\n 'data-expand-button': '',\n 'data-expand-both': type === 'both' ? '' : undefined,\n 'data-expand-up': type === 'up' ? '' : undefined,\n 'data-expand-down': type === 'down' ? '' : undefined,\n },\n });\n}\n\nexport function createSeparator({\n type,\n content,\n expandIndex,\n chunked = false,\n slotName,\n isFirstHunk,\n isLastHunk,\n}: CreateSeparatorProps): HASTElement {\n const children = [];\n if (type === 'metadata' && content != null) {\n children.push(\n createHastElement({\n tagName: 'div',\n children: [createTextNodeElement(content)],\n properties: { 'data-separator-wrapper': '' },\n })\n );\n }\n if ((type === 'line-info' || type === 'line-info-basic') && content != null) {\n const contentChildren: ElementContent[] = [];\n if (expandIndex != null) {\n if (!chunked) {\n contentChildren.push(\n createExpandButton(\n !isFirstHunk && !isLastHunk ? 'both' : isFirstHunk ? 'down' : 'up'\n )\n );\n } else {\n if (!isFirstHunk) {\n contentChildren.push(createExpandButton('up'));\n }\n if (!isLastHunk) {\n contentChildren.push(createExpandButton('down'));\n }\n }\n }\n contentChildren.push(\n createHastElement({\n tagName: 'div',\n children: [\n createHastElement({\n tagName: 'span',\n children: [createTextNodeElement(content)],\n properties: { 'data-unmodified-lines': '' },\n }),\n ],\n properties: { 'data-separator-content': '' },\n })\n );\n children.push(\n createHastElement({\n tagName: 'div',\n children: contentChildren,\n properties: {\n 'data-separator-wrapper': '',\n 'data-separator-multi-button':\n contentChildren.length > 2 ? '' : undefined,\n },\n })\n );\n }\n if (type === 'custom' && slotName != null) {\n children.push(\n createHastElement({\n tagName: 'slot',\n properties: { name: slotName },\n })\n );\n }\n return createHastElement({\n tagName: 'div',\n children,\n properties: {\n 'data-separator': children.length === 0 ? 'simple' : type,\n 'data-expand-index': expandIndex,\n 'data-separator-first': isFirstHunk ? '' : undefined,\n 'data-separator-last': isLastHunk ? '' : undefined,\n },\n });\n}\n"],"mappings":";;;AAmBA,SAAS,mBAAmB,MAA2B;AACrD,QAAO,kBAAkB;EACvB,SAAS;EACT,UAAU,CACR,kBAAkB;GAChB,MAAM,SAAS,SAAS,0BAA0B;GAClD,YAAY,EAAE,aAAa,IAAI;GAChC,CAAC,CACH;EACD,YAAY;GACV,sBAAsB;GACtB,oBAAoB,SAAS,SAAS,KAAK;GAC3C,kBAAkB,SAAS,OAAO,KAAK;GACvC,oBAAoB,SAAS,SAAS,KAAK;GAC5C;EACF,CAAC;;AAGJ,SAAgB,gBAAgB,EAC9B,MACA,SACA,aACA,UAAU,OACV,UACA,aACA,cACoC;CACpC,MAAM,WAAW,EAAE;AACnB,KAAI,SAAS,cAAc,WAAW,KACpC,UAAS,KACP,kBAAkB;EAChB,SAAS;EACT,UAAU,CAAC,sBAAsB,QAAQ,CAAC;EAC1C,YAAY,EAAE,0BAA0B,IAAI;EAC7C,CAAC,CACH;AAEH,MAAK,SAAS,eAAe,SAAS,sBAAsB,WAAW,MAAM;EAC3E,MAAMA,kBAAoC,EAAE;AAC5C,MAAI,eAAe,KACjB,KAAI,CAAC,QACH,iBAAgB,KACd,mBACE,CAAC,eAAe,CAAC,aAAa,SAAS,cAAc,SAAS,KAC/D,CACF;OACI;AACL,OAAI,CAAC,YACH,iBAAgB,KAAK,mBAAmB,KAAK,CAAC;AAEhD,OAAI,CAAC,WACH,iBAAgB,KAAK,mBAAmB,OAAO,CAAC;;AAItD,kBAAgB,KACd,kBAAkB;GAChB,SAAS;GACT,UAAU,CACR,kBAAkB;IAChB,SAAS;IACT,UAAU,CAAC,sBAAsB,QAAQ,CAAC;IAC1C,YAAY,EAAE,yBAAyB,IAAI;IAC5C,CAAC,CACH;GACD,YAAY,EAAE,0BAA0B,IAAI;GAC7C,CAAC,CACH;AACD,WAAS,KACP,kBAAkB;GAChB,SAAS;GACT,UAAU;GACV,YAAY;IACV,0BAA0B;IAC1B,+BACE,gBAAgB,SAAS,IAAI,KAAK;IACrC;GACF,CAAC,CACH;;AAEH,KAAI,SAAS,YAAY,YAAY,KACnC,UAAS,KACP,kBAAkB;EAChB,SAAS;EACT,YAAY,EAAE,MAAM,UAAU;EAC/B,CAAC,CACH;AAEH,QAAO,kBAAkB;EACvB,SAAS;EACT;EACA,YAAY;GACV,kBAAkB,SAAS,WAAW,IAAI,WAAW;GACrD,qBAAqB;GACrB,wBAAwB,cAAc,KAAK;GAC3C,uBAAuB,aAAa,KAAK;GAC1C;EACF,CAAC"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
//#region src/utils/createWindowFromScrollPosition.ts
|
|
2
2
|
function createWindowFromScrollPosition({ scrollTop, scrollHeight, height, containerOffset = 0, fitPerfectly, overscrollSize }) {
|
|
3
3
|
const windowHeight = height + overscrollSize * 2;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const effectiveHeight = fitPerfectly ? height : windowHeight;
|
|
5
|
+
scrollHeight = Math.max(scrollHeight, effectiveHeight);
|
|
6
|
+
if (windowHeight >= scrollHeight || fitPerfectly) {
|
|
7
|
+
const top$1 = Math.max(scrollTop - containerOffset, 0);
|
|
8
|
+
const bottom$1 = Math.min(scrollTop + effectiveHeight, scrollHeight) - containerOffset;
|
|
9
|
+
return {
|
|
10
|
+
top: top$1,
|
|
11
|
+
bottom: Math.max(bottom$1, top$1)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
8
14
|
let top = scrollTop + height / 2 - windowHeight / 2;
|
|
9
15
|
let bottom = top + windowHeight;
|
|
10
|
-
if (top < 0)
|
|
11
|
-
|
|
12
|
-
bottom = Math.min(windowHeight, scrollHeight);
|
|
13
|
-
} else if (bottom > scrollHeight) {
|
|
14
|
-
bottom = scrollHeight;
|
|
15
|
-
top = Math.max(bottom - windowHeight, 0);
|
|
16
|
-
}
|
|
16
|
+
if (top < 0) top = 0;
|
|
17
|
+
if (bottom > scrollHeight) bottom = scrollHeight;
|
|
17
18
|
top = Math.floor(Math.max(top - containerOffset, 0));
|
|
18
19
|
return {
|
|
19
20
|
top,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createWindowFromScrollPosition.js","names":[],"sources":["../../src/utils/createWindowFromScrollPosition.ts"],"sourcesContent":["import type { VirtualWindowSpecs } from '../types';\n\ninterface WindowFromScrollPositionProps {\n scrollTop: number;\n height: number;\n scrollHeight: number;\n containerOffset?: number;\n fitPerfectly: boolean;\n overscrollSize: number;\n}\n\nexport function createWindowFromScrollPosition({\n scrollTop,\n scrollHeight,\n height,\n containerOffset = 0,\n fitPerfectly,\n overscrollSize,\n}: WindowFromScrollPositionProps): VirtualWindowSpecs {\n const windowHeight = height + overscrollSize * 2;\n if (windowHeight
|
|
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 containerOffset?: number;\n fitPerfectly: boolean;\n overscrollSize: number;\n}\n\nexport function createWindowFromScrollPosition({\n scrollTop,\n scrollHeight,\n height,\n containerOffset = 0,\n fitPerfectly,\n overscrollSize,\n}: WindowFromScrollPositionProps): VirtualWindowSpecs {\n const windowHeight = height + overscrollSize * 2;\n const effectiveHeight = fitPerfectly ? height : windowHeight;\n scrollHeight = Math.max(scrollHeight, effectiveHeight);\n\n if (windowHeight >= scrollHeight || fitPerfectly) {\n const top = Math.max(scrollTop - containerOffset, 0);\n const bottom =\n Math.min(scrollTop + effectiveHeight, scrollHeight) - containerOffset;\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 - containerOffset, 0));\n return {\n top,\n bottom: Math.ceil(\n Math.max(Math.min(bottom, scrollHeight) - containerOffset, top)\n ),\n };\n}\n"],"mappings":";AAWA,SAAgB,+BAA+B,EAC7C,WACA,cACA,QACA,kBAAkB,GAClB,cACA,kBACoD;CACpD,MAAM,eAAe,SAAS,iBAAiB;CAC/C,MAAM,kBAAkB,eAAe,SAAS;AAChD,gBAAe,KAAK,IAAI,cAAc,gBAAgB;AAEtD,KAAI,gBAAgB,gBAAgB,cAAc;EAChD,MAAMA,QAAM,KAAK,IAAI,YAAY,iBAAiB,EAAE;EACpD,MAAMC,WACJ,KAAK,IAAI,YAAY,iBAAiB,aAAa,GAAG;AACxD,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,MAAM,iBAAiB,EAAE,CAAC;AACpD,QAAO;EACL;EACA,QAAQ,KAAK,KACX,KAAK,IAAI,KAAK,IAAI,QAAQ,aAAa,GAAG,iBAAiB,IAAI,CAChE;EACF"}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import { DiffsThemeNames, SupportedLanguages, ThemesType } from "../types.js";
|
|
1
|
+
import { DiffsThemeNames, HighlighterTypes, SupportedLanguages, ThemesType } from "../types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/getHighlighterOptions.d.ts
|
|
4
4
|
interface HighlighterOptionsShape {
|
|
5
5
|
theme?: DiffsThemeNames | ThemesType;
|
|
6
|
+
preferredHighlighter?: HighlighterTypes;
|
|
6
7
|
}
|
|
7
8
|
interface GetHighlighterOptionsReturn {
|
|
8
9
|
langs: SupportedLanguages[];
|
|
9
10
|
themes: DiffsThemeNames[];
|
|
11
|
+
preferredHighlighter: HighlighterTypes;
|
|
10
12
|
}
|
|
11
|
-
declare function getHighlighterOptions(lang: SupportedLanguages | undefined,
|
|
13
|
+
declare function getHighlighterOptions(lang: SupportedLanguages | undefined, {
|
|
14
|
+
theme,
|
|
15
|
+
preferredHighlighter
|
|
16
|
+
}: HighlighterOptionsShape): GetHighlighterOptionsReturn;
|
|
12
17
|
//#endregion
|
|
13
18
|
export { getHighlighterOptions };
|
|
14
19
|
//# sourceMappingURL=getHighlighterOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getHighlighterOptions.d.ts","names":["DiffsThemeNames","SupportedLanguages","ThemesType","HighlighterOptionsShape","GetHighlighterOptionsReturn","getHighlighterOptions"],"sources":["../../src/utils/getHighlighterOptions.d.ts"],"sourcesContent":["import type { DiffsThemeNames, SupportedLanguages, ThemesType } from '../types';\ninterface HighlighterOptionsShape {\n theme?: DiffsThemeNames | ThemesType;\n}\ninterface GetHighlighterOptionsReturn {\n langs: SupportedLanguages[];\n themes: DiffsThemeNames[];\n}\nexport declare function getHighlighterOptions(lang: SupportedLanguages | undefined,
|
|
1
|
+
{"version":3,"file":"getHighlighterOptions.d.ts","names":["DiffsThemeNames","HighlighterTypes","SupportedLanguages","ThemesType","HighlighterOptionsShape","GetHighlighterOptionsReturn","getHighlighterOptions","theme","preferredHighlighter"],"sources":["../../src/utils/getHighlighterOptions.d.ts"],"sourcesContent":["import type { DiffsThemeNames, HighlighterTypes, SupportedLanguages, ThemesType } from '../types';\ninterface HighlighterOptionsShape {\n theme?: DiffsThemeNames | ThemesType;\n preferredHighlighter?: HighlighterTypes;\n}\ninterface GetHighlighterOptionsReturn {\n langs: SupportedLanguages[];\n themes: DiffsThemeNames[];\n preferredHighlighter: HighlighterTypes;\n}\nexport declare function getHighlighterOptions(lang: SupportedLanguages | undefined, { theme, preferredHighlighter }: HighlighterOptionsShape): GetHighlighterOptionsReturn;\nexport {};\n//# sourceMappingURL=getHighlighterOptions.d.ts.map"],"mappings":";;;UACUI,uBAAAA;UACEJ,kBAAkBG;EADpBC,oBAAAA,CAAAA,EAEiBH,gBAFM;;UAIvBI,2BAAAA,CAHoBF;EACHF,KAAAA,EAGhBC,kBAHgBD,EAAAA;EAAgB,MAAA,EAI/BD,eAJ+B,EAAA;EAEjCK,oBAAAA,EAGgBJ,gBAHW;;AAEzBD,iBAGYM,qBAAAA,CAHZN,IAAAA,EAGwCE,kBAHxCF,GAAAA,SAAAA,EAAAA;EAAAA,KAAAA;EAAAA;AAAAA,CAAAA,EAGyGI,uBAHzGJ,CAAAA,EAGmIK,2BAHnIL"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { getThemes } from "./getThemes.js";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/getHighlighterOptions.ts
|
|
4
|
-
function getHighlighterOptions(lang,
|
|
4
|
+
function getHighlighterOptions(lang, { theme, preferredHighlighter = "shiki-js" }) {
|
|
5
5
|
return {
|
|
6
6
|
langs: [lang ?? "text"],
|
|
7
|
-
themes: getThemes(
|
|
7
|
+
themes: getThemes(theme),
|
|
8
|
+
preferredHighlighter
|
|
8
9
|
};
|
|
9
10
|
}
|
|
10
11
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getHighlighterOptions.js","names":[],"sources":["../../src/utils/getHighlighterOptions.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"getHighlighterOptions.js","names":[],"sources":["../../src/utils/getHighlighterOptions.ts"],"sourcesContent":["import type {\n DiffsThemeNames,\n HighlighterTypes,\n SupportedLanguages,\n ThemesType,\n} from '../types';\nimport { getThemes } from './getThemes';\n\ninterface HighlighterOptionsShape {\n theme?: DiffsThemeNames | ThemesType;\n preferredHighlighter?: HighlighterTypes;\n}\n\ninterface GetHighlighterOptionsReturn {\n langs: SupportedLanguages[];\n themes: DiffsThemeNames[];\n preferredHighlighter: HighlighterTypes;\n}\n\nexport function getHighlighterOptions(\n lang: SupportedLanguages | undefined,\n { theme, preferredHighlighter = 'shiki-js' }: HighlighterOptionsShape\n): GetHighlighterOptionsReturn {\n return {\n langs: [lang ?? 'text'],\n themes: getThemes(theme),\n preferredHighlighter,\n };\n}\n"],"mappings":";;;AAmBA,SAAgB,sBACd,MACA,EAAE,OAAO,uBAAuB,cACH;AAC7B,QAAO;EACL,OAAO,CAAC,QAAQ,OAAO;EACvB,QAAQ,UAAU,MAAM;EACxB;EACD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AnnotationSide } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/getMergeConflictActionSlotName.d.ts
|
|
4
|
+
interface MergeConflictActionSlotInput {
|
|
5
|
+
side: AnnotationSide;
|
|
6
|
+
lineNumber: number;
|
|
7
|
+
conflictIndex: number;
|
|
8
|
+
}
|
|
9
|
+
declare function getMergeConflictActionSlotName({
|
|
10
|
+
side,
|
|
11
|
+
lineNumber,
|
|
12
|
+
conflictIndex
|
|
13
|
+
}: MergeConflictActionSlotInput): string;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { getMergeConflictActionSlotName };
|
|
16
|
+
//# sourceMappingURL=getMergeConflictActionSlotName.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMergeConflictActionSlotName.d.ts","names":["AnnotationSide","MergeConflictActionSlotInput","getMergeConflictActionSlotName","side","lineNumber","conflictIndex"],"sources":["../../src/utils/getMergeConflictActionSlotName.d.ts"],"sourcesContent":["import type { AnnotationSide } from '../types';\ninterface MergeConflictActionSlotInput {\n side: AnnotationSide;\n lineNumber: number;\n conflictIndex: number;\n}\nexport declare function getMergeConflictActionSlotName({ side, lineNumber, conflictIndex }: MergeConflictActionSlotInput): string;\nexport {};\n//# sourceMappingURL=getMergeConflictActionSlotName.d.ts.map"],"mappings":";;;UACUC,4BAAAA;QACAD;EADAC,UAAAA,EAAAA,MAAAA;EAKcC,aAAAA,EAAAA,MAAAA;;AAAuCE,iBAAvCF,8BAAAA,CAAuCE;EAAAA,IAAAA;EAAAA,UAAAA;EAAAA;AAAAA,CAAAA,EAA6BH,4BAA7BG,CAAAA,EAAAA,MAAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/utils/getMergeConflictActionSlotName.ts
|
|
2
|
+
function getMergeConflictActionSlotName({ side, lineNumber, conflictIndex }) {
|
|
3
|
+
return `merge-conflict-action-${side}-${lineNumber}-${conflictIndex}`;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
export { getMergeConflictActionSlotName };
|
|
8
|
+
//# sourceMappingURL=getMergeConflictActionSlotName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMergeConflictActionSlotName.js","names":[],"sources":["../../src/utils/getMergeConflictActionSlotName.ts"],"sourcesContent":["import type { AnnotationSide } from '../types';\n\ninterface MergeConflictActionSlotInput {\n side: AnnotationSide;\n lineNumber: number;\n conflictIndex: number;\n}\n\nexport function getMergeConflictActionSlotName({\n side,\n lineNumber,\n conflictIndex,\n}: MergeConflictActionSlotInput): string {\n return `merge-conflict-action-${side}-${lineNumber}-${conflictIndex}`;\n}\n"],"mappings":";AAQA,SAAgB,+BAA+B,EAC7C,MACA,YACA,iBACuC;AACvC,QAAO,yBAAyB,KAAK,GAAG,WAAW,GAAG"}
|