@pierre/diffs 1.2.0-beta.3 → 1.2.0-beta.5

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.
Files changed (71) hide show
  1. package/dist/components/CodeView.d.ts +18 -10
  2. package/dist/components/CodeView.d.ts.map +1 -1
  3. package/dist/components/CodeView.js +124 -32
  4. package/dist/components/CodeView.js.map +1 -1
  5. package/dist/components/File.d.ts +3 -2
  6. package/dist/components/File.d.ts.map +1 -1
  7. package/dist/components/File.js +13 -4
  8. package/dist/components/File.js.map +1 -1
  9. package/dist/components/FileDiff.d.ts +3 -2
  10. package/dist/components/FileDiff.d.ts.map +1 -1
  11. package/dist/components/FileDiff.js +13 -4
  12. package/dist/components/FileDiff.js.map +1 -1
  13. package/dist/components/FileStream.js +6 -3
  14. package/dist/components/FileStream.js.map +1 -1
  15. package/dist/components/VirtulizerDevelopment.d.ts.map +1 -1
  16. package/dist/components/web-components.js +4 -0
  17. package/dist/components/web-components.js.map +1 -1
  18. package/dist/constants.d.ts +6 -3
  19. package/dist/constants.d.ts.map +1 -1
  20. package/dist/constants.js +11 -2
  21. package/dist/constants.js.map +1 -1
  22. package/dist/index.d.ts +5 -5
  23. package/dist/index.js +3 -3
  24. package/dist/managers/InteractionManager.d.ts +22 -10
  25. package/dist/managers/InteractionManager.d.ts.map +1 -1
  26. package/dist/managers/InteractionManager.js +223 -28
  27. package/dist/managers/InteractionManager.js.map +1 -1
  28. package/dist/react/constants.d.ts.map +1 -1
  29. package/dist/react/constants.js +3 -1
  30. package/dist/react/constants.js.map +1 -1
  31. package/dist/react/index.d.ts +2 -2
  32. package/dist/react/jsx.d.ts.map +1 -1
  33. package/dist/react/types.d.ts +2 -2
  34. package/dist/react/types.d.ts.map +1 -1
  35. package/dist/react/utils/useFileDiffInstance.d.ts +2 -2
  36. package/dist/react/utils/useFileDiffInstance.d.ts.map +1 -1
  37. package/dist/react/utils/useFileDiffInstance.js.map +1 -1
  38. package/dist/react/utils/useFileInstance.d.ts +2 -2
  39. package/dist/react/utils/useFileInstance.d.ts.map +1 -1
  40. package/dist/react/utils/useFileInstance.js.map +1 -1
  41. package/dist/react/utils/useUnresolvedFileInstance.d.ts +2 -2
  42. package/dist/react/utils/useUnresolvedFileInstance.d.ts.map +1 -1
  43. package/dist/react/utils/useUnresolvedFileInstance.js.map +1 -1
  44. package/dist/ssr/index.d.ts +2 -2
  45. package/dist/style.js +1 -1
  46. package/dist/style.js.map +1 -1
  47. package/dist/types.d.ts +23 -9
  48. package/dist/types.d.ts.map +1 -1
  49. package/dist/utils/areSelectionsEqual.d.ts +1 -1
  50. package/dist/utils/areSelectionsEqual.d.ts.map +1 -1
  51. package/dist/utils/areSelectionsEqual.js.map +1 -1
  52. package/dist/utils/createGutterUtilityContentNode.js +1 -0
  53. package/dist/utils/createGutterUtilityContentNode.js.map +1 -1
  54. package/dist/utils/cssWrappers.d.ts +3 -2
  55. package/dist/utils/cssWrappers.d.ts.map +1 -1
  56. package/dist/utils/cssWrappers.js +13 -2
  57. package/dist/utils/cssWrappers.js.map +1 -1
  58. package/dist/utils/getFiletypeFromFileName.js +16 -0
  59. package/dist/utils/getFiletypeFromFileName.js.map +1 -1
  60. package/dist/utils/parsePatchFiles.js +15 -0
  61. package/dist/utils/parsePatchFiles.js.map +1 -1
  62. package/dist/utils/scrollbarGutter.d.ts +6 -0
  63. package/dist/utils/scrollbarGutter.d.ts.map +1 -0
  64. package/dist/utils/scrollbarGutter.js +28 -0
  65. package/dist/utils/scrollbarGutter.js.map +1 -0
  66. package/dist/worker/WorkerPoolManager.js.map +1 -1
  67. package/dist/worker/worker-portable.js +26 -1
  68. package/dist/worker/worker-portable.js.map +1 -1
  69. package/dist/worker/worker.js +23 -0
  70. package/dist/worker/worker.js.map +1 -1
  71. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemVersion, CodeViewMetrics, CodeViewScrollTarget, HunkSeparators, SmoothScrollSettings, VirtualFileMetrics, VirtualWindowSpecs } from "../types.js";
2
- import { SelectedLineRange, SelectionWriteOptions } from "../managers/InteractionManager.js";
1
+ import { CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewLayout, CodeViewScrollTarget, HunkSeparators, SelectedLineRange, SmoothScrollSettings, VirtualFileMetrics, VirtualWindowSpecs } from "../types.js";
2
+ import { SelectionWriteOptions } from "../managers/InteractionManager.js";
3
3
  import { WorkerPoolManager } from "../worker/WorkerPoolManager.js";
4
4
  import "../worker/index.js";
5
5
  import { FileOptions } from "./File.js";
@@ -20,7 +20,7 @@ interface AdvancedVirtualizedBaseItem {
20
20
  * when rendered. */
21
21
  element: HTMLElement | undefined;
22
22
  /** Last controlled version observed for this record. */
23
- version: CodeViewItemVersion | undefined;
23
+ version: number | undefined;
24
24
  }
25
25
  interface CodeViewDiffItemContext<LAnnotation> extends AdvancedVirtualizedBaseItem {
26
26
  type: 'diff';
@@ -40,7 +40,7 @@ interface CodeViewRenderedDiffItem<LAnnotation> {
40
40
  id: string;
41
41
  type: 'diff';
42
42
  item: CodeViewDiffItem<LAnnotation>;
43
- version: CodeViewItemVersion | undefined;
43
+ version: number | undefined;
44
44
  element: HTMLElement;
45
45
  instance: VirtualizedFileDiff<LAnnotation>;
46
46
  }
@@ -48,7 +48,7 @@ interface CodeViewRenderedFileItem<LAnnotation> {
48
48
  id: string;
49
49
  type: 'file';
50
50
  item: CodeViewFileItem<LAnnotation>;
51
- version: CodeViewItemVersion | undefined;
51
+ version: number | undefined;
52
52
  element: HTMLElement;
53
53
  instance: VirtualizedFile<LAnnotation>;
54
54
  }
@@ -83,13 +83,17 @@ type CodeViewSharedCallbackOptions<LAnnotation> = { [TKey in CodeViewSharedCallb
83
83
  type CodeViewSelectionCallbackOptions<LAnnotation> = { [TKey in CodeViewSelectionCallbackKeys]?: CodeViewOptionCallback<LAnnotation, TKey> };
84
84
  interface CodeViewOptions<LAnnotation> extends CodeViewPassThroughOptions<LAnnotation>, CodeViewSharedCallbackOptions<LAnnotation>, CodeViewSelectionCallbackOptions<LAnnotation> {
85
85
  hunkSeparators?: Exclude<HunkSeparators, 'custom'>;
86
- itemMetrics?: VirtualFileMetrics;
86
+ itemMetrics?: Partial<VirtualFileMetrics>;
87
87
  pointerEventsOnScroll?: boolean;
88
88
  smoothScrollSettings?: SmoothScrollSettings;
89
89
  stickyHeaders?: boolean;
90
90
  controlledSelection?: boolean;
91
91
  onSelectedLinesChange?(selection: CodeViewLineSelection | null): void;
92
- viewerMetrics?: CodeViewMetrics;
92
+ layout?: CodeViewLayout;
93
+ /** Internal dev-only check to ensure your `itemMetrics` are correct. Its
94
+ * automatically disabled in a production build because it will hurt
95
+ * performance fairly significantly */
96
+ __devOnlyValidateItemHeights?: boolean;
93
97
  }
94
98
  declare class CodeView<LAnnotation = undefined> {
95
99
  static __STOP: boolean;
@@ -115,6 +119,7 @@ declare class CodeView<LAnnotation = undefined> {
115
119
  private heightDirty;
116
120
  private windowSpecs;
117
121
  private renderState;
122
+ private itemMetricsCache;
118
123
  private pendingScrollTarget;
119
124
  private pendingLayoutAnchor;
120
125
  private scrollAnimation;
@@ -127,14 +132,16 @@ declare class CodeView<LAnnotation = undefined> {
127
132
  private workerManager;
128
133
  private isContainerManaged;
129
134
  constructor(options?: CodeViewOptions<LAnnotation>, workerManager?: WorkerPoolManager | undefined, isContainerManaged?: boolean);
130
- private getViewerMetrics;
131
- private getItemMetrics;
135
+ private getLayout;
136
+ private computeMetricsCache;
132
137
  private getSmoothScrollSettings;
133
138
  private shouldDisablePointerEvents;
139
+ private shouldValidateItemHeights;
140
+ private validateRenderedItemHeight;
134
141
  private clearPointerEventsTimer;
135
142
  private suspendPointerEvents;
136
143
  private restorePointerEvents;
137
- private syncViewerMetrics;
144
+ private syncLayout;
138
145
  setup(root: HTMLElement): void;
139
146
  reset(): void;
140
147
  cleanUp(): void;
@@ -247,6 +254,7 @@ declare class CodeView<LAnnotation = undefined> {
247
254
  */
248
255
  private resolveAlignedScrollPosition;
249
256
  private getLineScrollPosition;
257
+ private getRangeScrollPosition;
250
258
  /**
251
259
  * Determine target scroll position for current frame.
252
260
  *
@@ -1 +1 @@
1
- {"version":3,"file":"CodeView.d.ts","names":["SelectedLineRange","SelectionWriteOptions","CodeViewDiffItem","CodeViewFileItem","CodeViewItem","CodeViewItemVersion","CodeViewMetrics","CodeViewScrollTarget","HunkSeparators","SmoothScrollSettings","VirtualFileMetrics","VirtualWindowSpecs","WorkerPoolManager","FileOptions","FileDiffOptions","VirtualizedFile","VirtualizedFileDiff","VirtualizerConfig","AdvancedVirtualizedBaseItem","HTMLElement","CodeViewDiffItemContext","LAnnotation","CodeViewFileItemContext","CodeViewRenderedDiffItem","CodeViewRenderedFileItem","CodeViewRenderedItem","CodeViewLineSelection","CodeViewCoordinator","CodeViewScrollListener","CodeView","OverloadCallbackArgs","TCallback","TArgs","CallbackReturn","TReturn","OverloadFileCallbackArgs","TKey","NonNullable","OverloadDiffCallbackArgs","CodeViewOptionCallback","CODE_VIEW_DIFF_OPTION_KEYS","CodeViewDiffOptionKeys","CodeViewPassThroughOptions","Pick","CODE_VIEW_SHARED_CALLBACK_KEYS","CODE_VIEW_SELECTION_CALLBACK_KEYS","CodeViewSharedCallbackKeys","CodeViewSelectionCallbackKeys","CodeViewSharedCallbackOptions","CodeViewSelectionCallbackOptions","CodeViewOptions","Exclude"],"sources":["../../src/components/CodeView.d.ts"],"sourcesContent":["import type { SelectedLineRange, SelectionWriteOptions } from '../managers/InteractionManager';\nimport type { CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemVersion, CodeViewMetrics, CodeViewScrollTarget, HunkSeparators, SmoothScrollSettings, VirtualFileMetrics, VirtualWindowSpecs } from '../types';\nimport type { WorkerPoolManager } from '../worker';\nimport type { FileOptions } from './File';\nimport type { FileDiffOptions } from './FileDiff';\nimport { VirtualizedFile } from './VirtualizedFile';\nimport { VirtualizedFileDiff } from './VirtualizedFileDiff';\nimport type { VirtualizerConfig } from './Virtualizer';\ninterface AdvancedVirtualizedBaseItem {\n /** Current index of this record in the ordered items array. */\n index: number;\n /** Absolute top offset of this item inside the scroll content. */\n top: number;\n /** Total measured height reserved for this item. */\n height: number;\n /** Root <diffs-container> node currently mounted for this item, only exists\n * when rendered. */\n element: HTMLElement | undefined;\n /** Last controlled version observed for this record. */\n version: CodeViewItemVersion | undefined;\n}\ninterface CodeViewDiffItemContext<LAnnotation> extends AdvancedVirtualizedBaseItem {\n type: 'diff';\n /** Latest item snapshot for this record. Controlled updates can replace it. */\n item: CodeViewDiffItem<LAnnotation>;\n /** Virtualized diff instance responsible for rendering this item. */\n instance: VirtualizedFileDiff<LAnnotation>;\n}\ninterface CodeViewFileItemContext<LAnnotation> extends AdvancedVirtualizedBaseItem {\n type: 'file';\n /** Latest item snapshot for this record. Controlled updates can replace it. */\n item: CodeViewFileItem<LAnnotation>;\n /** Virtualized file instance responsible for rendering this item. */\n instance: VirtualizedFile<LAnnotation>;\n}\nexport interface CodeViewRenderedDiffItem<LAnnotation> {\n id: string;\n type: 'diff';\n item: CodeViewDiffItem<LAnnotation>;\n version: CodeViewItemVersion | undefined;\n element: HTMLElement;\n instance: VirtualizedFileDiff<LAnnotation>;\n}\nexport interface CodeViewRenderedFileItem<LAnnotation> {\n id: string;\n type: 'file';\n item: CodeViewFileItem<LAnnotation>;\n version: CodeViewItemVersion | undefined;\n element: HTMLElement;\n instance: VirtualizedFile<LAnnotation>;\n}\nexport type CodeViewRenderedItem<LAnnotation> = CodeViewRenderedDiffItem<LAnnotation> | CodeViewRenderedFileItem<LAnnotation>;\nexport interface CodeViewLineSelection {\n id: string;\n range: SelectedLineRange;\n}\nexport interface CodeViewCoordinator<LAnnotation> {\n hasHeaderRenderers: boolean;\n hasAnnotationRenderer: boolean;\n hasGutterRenderer: boolean;\n onSnapshotChange(snapshot: CodeViewRenderedItem<LAnnotation>[] | undefined): void;\n}\nexport type CodeViewScrollListener<LAnnotation> = (scrollTop: number, viewer: CodeView<LAnnotation>) => void;\ntype OverloadCallbackArgs<TCallback> = TCallback extends (...args: infer TArgs) => unknown ? TArgs : never;\ntype CallbackReturn<TCallback> = TCallback extends (...args: never[]) => infer TReturn ? TReturn : never;\ntype OverloadFileCallbackArgs<LAnnotation, TKey extends keyof FileOptions<LAnnotation>> = OverloadCallbackArgs<NonNullable<FileOptions<LAnnotation>[TKey]>>;\ntype OverloadDiffCallbackArgs<LAnnotation, TKey extends keyof FileDiffOptions<LAnnotation>> = OverloadCallbackArgs<NonNullable<FileDiffOptions<LAnnotation>[TKey]>>;\ntype CodeViewOptionCallback<LAnnotation, TKey extends keyof FileOptions<LAnnotation> & keyof FileDiffOptions<LAnnotation>> = {\n (...args: [\n ...OverloadFileCallbackArgs<LAnnotation, TKey>,\n context: CodeViewFileItemContext<LAnnotation>\n ]): CallbackReturn<NonNullable<FileOptions<LAnnotation>[TKey]>>;\n (...args: [\n ...OverloadDiffCallbackArgs<LAnnotation, TKey>,\n context: CodeViewDiffItemContext<LAnnotation>\n ]): CallbackReturn<NonNullable<FileDiffOptions<LAnnotation>[TKey]>>;\n};\ndeclare const CODE_VIEW_DIFF_OPTION_KEYS: readonly [\"theme\", \"disableLineNumbers\", \"overflow\", \"themeType\", \"disableFileHeader\", \"disableVirtualizationBuffers\", \"preferredHighlighter\", \"useCSSClasses\", \"useTokenTransformer\", \"tokenizeMaxLineLength\", \"tokenizeMaxLength\", \"unsafeCSS\", \"diffStyle\", \"diffIndicators\", \"disableBackground\", \"expandUnchanged\", \"collapsedContextThreshold\", \"lineDiffType\", \"maxLineDiffLength\", \"expansionLineCount\", \"lineHoverHighlight\", \"enableTokenInteractionsOnWhitespace\", \"enableGutterUtility\", \"__debugPointerEvents\", \"enableLineSelection\", \"controlledSelection\", \"disableErrorHandling\"];\ntype CodeViewDiffOptionKeys = (typeof CODE_VIEW_DIFF_OPTION_KEYS)[number];\ntype CodeViewPassThroughOptions<LAnnotation> = Pick<FileDiffOptions<LAnnotation>, CodeViewDiffOptionKeys>;\ndeclare const CODE_VIEW_SHARED_CALLBACK_KEYS: readonly [\"renderCustomHeader\", \"renderHeaderPrefix\", \"renderHeaderMetadata\", \"renderAnnotation\", \"renderGutterUtility\", \"onPostRender\", \"onGutterUtilityClick\", \"onLineClick\", \"onLineNumberClick\", \"onLineEnter\", \"onLineLeave\", \"onTokenClick\", \"onTokenEnter\", \"onTokenLeave\"];\ndeclare const CODE_VIEW_SELECTION_CALLBACK_KEYS: readonly [\"onLineSelected\", \"onLineSelectionStart\", \"onLineSelectionChange\", \"onLineSelectionEnd\"];\ntype CodeViewSharedCallbackKeys = (typeof CODE_VIEW_SHARED_CALLBACK_KEYS)[number];\ntype CodeViewSelectionCallbackKeys = (typeof CODE_VIEW_SELECTION_CALLBACK_KEYS)[number];\ntype CodeViewSharedCallbackOptions<LAnnotation> = {\n [TKey in CodeViewSharedCallbackKeys]?: CodeViewOptionCallback<LAnnotation, TKey>;\n};\ntype CodeViewSelectionCallbackOptions<LAnnotation> = {\n [TKey in CodeViewSelectionCallbackKeys]?: CodeViewOptionCallback<LAnnotation, TKey>;\n};\nexport interface CodeViewOptions<LAnnotation> extends CodeViewPassThroughOptions<LAnnotation>, CodeViewSharedCallbackOptions<LAnnotation>, CodeViewSelectionCallbackOptions<LAnnotation> {\n hunkSeparators?: Exclude<HunkSeparators, 'custom'>;\n itemMetrics?: VirtualFileMetrics;\n pointerEventsOnScroll?: boolean;\n smoothScrollSettings?: SmoothScrollSettings;\n stickyHeaders?: boolean;\n controlledSelection?: boolean;\n onSelectedLinesChange?(selection: CodeViewLineSelection | null): void;\n viewerMetrics?: CodeViewMetrics;\n}\nexport declare class CodeView<LAnnotation = undefined> {\n static __STOP: boolean;\n static __lastScrollPosition: number;\n type: \"advanced\";\n readonly config: VirtualizerConfig;\n private items;\n private idToItem;\n private selectedLines;\n private instanceToItem;\n private layoutDirtyIndex;\n private slotCoordinator;\n private slotSnapshot;\n private scrollListeners;\n private scrollHeight;\n private containerHeight;\n private scrollTop;\n private scrollPageOffset;\n private scrollDirty;\n private pointerEventsRestoreTimer;\n private pointerEventsDisabled;\n private height;\n private heightDirty;\n private windowSpecs;\n private renderState;\n private pendingScrollTarget;\n private pendingLayoutAnchor;\n private scrollAnimation;\n private root;\n private resizeObserver;\n private container;\n private stickyContainer;\n private stickyOffset;\n private options;\n private workerManager;\n private isContainerManaged;\n constructor(options?: CodeViewOptions<LAnnotation>, workerManager?: WorkerPoolManager | undefined, isContainerManaged?: boolean);\n private getViewerMetrics;\n private getItemMetrics;\n private getSmoothScrollSettings;\n private shouldDisablePointerEvents;\n private clearPointerEventsTimer;\n private suspendPointerEvents;\n private restorePointerEvents;\n private syncViewerMetrics;\n setup(root: HTMLElement): void;\n reset(): void;\n cleanUp(): void;\n private cleanAllRenderedItems;\n private resolveEffectiveScrollBehavior;\n scrollTo(target: CodeViewScrollTarget): void;\n setSelectedLines(selection: CodeViewLineSelection | null, options?: SelectionWriteOptions): void;\n getSelectedLines(): CodeViewLineSelection | null;\n clearSelectedLines(options?: SelectionWriteOptions): void;\n getItem(itemId: string): CodeViewItem<LAnnotation> | undefined;\n updateItem(input: CodeViewItem<LAnnotation>): boolean;\n addItem(input: CodeViewItem<LAnnotation>): void;\n addItems(inputs: readonly CodeViewItem<LAnnotation>[]): void;\n setItems(items: readonly CodeViewItem<LAnnotation>[]): void;\n /**\n * Append new records to the viewer while preserving existing layout state.\n * This is the shared path for imperative adds and the append-only reconcile\n * fast path, so it measures new items immediately and only triggers render\n * once at the end.\n */\n private appendItemsInternal;\n private canSkipRenderForAppend;\n setOptions(options: CodeViewOptions<LAnnotation> | undefined): void;\n private capturePendingLayoutAnchor;\n render(immediate?: boolean): void;\n instanceChanged(instance: VirtualizedFile<LAnnotation> | VirtualizedFileDiff<LAnnotation>, layoutDirty: boolean): void;\n getWindowSpecs(): VirtualWindowSpecs;\n getContainerElement(): HTMLElement | undefined;\n getRenderedItems(): CodeViewRenderedItem<LAnnotation>[];\n setSlotCoordinator(coordinator?: CodeViewCoordinator<LAnnotation>): boolean;\n getSlotSnapshot(coordinator: CodeViewCoordinator<LAnnotation>): CodeViewRenderedItem<LAnnotation>[] | undefined;\n subscribeToScroll(listener: CodeViewScrollListener<LAnnotation>): () => void;\n getLocalTopForInstance(instance: VirtualizedFile<LAnnotation> | VirtualizedFileDiff<LAnnotation>): number;\n getTopForItem(id: string): number | undefined;\n private createItem;\n private getItemById;\n private getItemByMode;\n private applySelectedLines;\n private syncSelection;\n private wrapCallbackWithContext;\n private getWrappedOptionCallback;\n private getWrappedSelectionOptionCallback;\n private createOptions;\n /**\n * Track the earliest index whose measured layout may now be stale. Later\n * render passes relayout from this point forward so we do not have to rebuild\n * positions for the whole list after every change.\n */\n private markLayoutDirtyFromIndex;\n /**\n * Mark the earliest affected item as layout-dirty after an imperative change.\n * Each record carries its current array index so this stays O(1) even when\n * the viewer holds a very large number of items.\n */\n private markItemLayoutDirty;\n /**\n * Detect the common controlled-update case where the new list simply extends\n * the existing ordered prefix. When that happens we can reuse every current\n * record in place, sync any versioned payload changes, and append only the new\n * tail instead of rebuilding the whole list.\n */\n private tryAppendItems;\n /**\n * Reconcile a new controlled item list against the existing records by id.\n * This reuses records and instances when type matches, cleans up removed\n * records, rebuilds the lookup maps, and marks layout dirty whenever order,\n * membership, or versioned item data changes.\n */\n private reconcileItems;\n /**\n * Update a reused record from the latest controlled item only when its item\n * version changes. Matching versions mean CodeView keeps the current record\n * snapshot, which lets imperative updates remain in place until the caller\n * intentionally publishes a newer version.\n */\n private syncItemRecord;\n private getMaxScrollTopForHeight;\n private getMaxScrollTop;\n private shouldRebaseScroll;\n private getPagedScrollHeight;\n private getMaxPagedScrollTop;\n private clampPagedScrollTop;\n /**\n * Clamps a logical scroll position to the min/max allowable scroll range\n * based on the full computed content height.\n */\n private clampScrollTop;\n private getMaxScrollPageOffset;\n private clampScrollPageOffset;\n private resolveScrollPageWindow;\n /**\n * Resolve how a logical scrollTop maps onto the reusable paged scroll window\n * without mutating the current page offset.\n */\n private resolvePagedScrollPosition;\n private needsScrollPageUpdate;\n private getPagedLayoutTop;\n private getStickyHeaderOffset;\n private getScrollTargetRect;\n private normalizeScrollTarget;\n /**\n * Resolve a target's scroll position\n \n * Returns `undefined` when we can't resolve a target for whatever reason\n */\n private resolveScrollTargetTop;\n /**\n * Given an existing scroll target (scroll top and height), figure out the\n * correct scroll position to target based on the desired alignment, offset\n * and stickyOffset if necessary\n */\n private resolveAlignedScrollPosition;\n private getLineScrollPosition;\n /**\n * Determine target scroll position for current frame.\n *\n * If there's no pendingScrollTarget then we just return the current scroll\n * position\n *\n * If there's a pendingScrollTarget then we depend on whether there's a\n * smooth scroll animation or not. If not just return the destination, or\n * compute next position given the smooth scroll spring physics\n */\n private computeTargetScrollTopForFrame;\n /**\n * Closed-form critical-damped ODE step.\n *\n * Stable at any dt (Euler would blow up once ω·dt ≳ 1), so this survives\n * big RAF gaps (tab-wake, offscreen frames) and resize-driven ticks that\n * fire outside the normal RAF cadence.\n */\n private computeSpringStep;\n /**\n * For any given pendingScrollTarget, updates any in flight smooth scroll\n * animations and returns the target scrollTop to move towards\n *\n * Resolves the animation based on frame time and adopts any necessary scroll\n * anchoring corrections if necessary\n */\n private advanceScrollAnimation;\n private computeRenderRangeAndEmit;\n private flushManagers;\n private syncContainerHeight;\n private getStickyBounds;\n private applyStickyPositioning;\n private syncPagedScrollScaffolding;\n private reconcileRenderedItems;\n private updateStickyPositioning;\n private handleScroll;\n private clearPendingScroll;\n private handleResize;\n /**\n * Figure out scrollTop accounting for sticky header if enabled and\n * necessary\n */\n private getScrollAnchorViewportTop;\n /**\n * Attempt to find a scroll anchor based on build in metrics of the existing\n * rendered files/diff.\n *\n * A scroll anchor represents the first fully visible element (in other\n * words, the first file or first line who's top is fully in the viewport).\n */\n private getScrollAnchor;\n /**\n * Given a scroll anchor, attempt to resolve a newly updated (and clamped)\n * scroll position to keep the anchored element in place.\n *\n * If we can't resolve a position for whatever reason, we'll return\n * undefined.\n */\n private resolveAnchoredScrollTop;\n /**\n * Apply a device-pixel-rounded scroll position if it differs from the last\n * logical scrollTop synchronized into the paged scroll scaffold.\n */\n private applyScrollFix;\n /**\n * Decide whether a pending programmatic scroll has reached its\n * destination and should be cleared.\n */\n private isPendingTargetSettled;\n getScrollTop(): number;\n getHeight(): number;\n getScrollHeight(): number;\n private flushSlotCoordinator;\n private notifyScroll;\n /**\n * Find the first item whose bottom edge crosses into the viewport window.\n * This lets scroll-time rendering jump directly near the visible range instead\n * of linearly scanning from the start of very large item lists.\n */\n private findFirstVisibleIndex;\n /**\n * Find the last item whose top edge is still within the viewport window.\n * Paired with findFirstVisibleIndex, this bounds the render loop to only the\n * slice of items that can actually intersect the current scroll range.\n */\n private findLastVisibleIndex;\n /**\n * Recompute measured tops and heights starting from the earliest dirty item.\n * Earlier items keep their existing layout, while everything from startIndex\n * onward is remeasured so downstream positions and total scroll height stay\n * consistent after inserts, removals, or versioned item updates.\n */\n private recomputeLayout;\n private resetRenderState;\n private getFitPerfectlyOverscroll;\n}\nexport {};\n//# sourceMappingURL=CodeView.d.ts.map"],"mappings":";;;;;;;;;;;UAQUkB,2BAAAA;;;EAAAA;EAaAE,GAAAA,EAAAA,MAAAA;EAGiBC;EAAjBnB,MAAAA,EAAAA,MAAAA;EAEwBmB;;EALqBH,OAAAA,EAJ1CC,WAI0CD,GAAAA,SAAAA;EAA2B;EAOxEI,OAAAA,EATGjB,mBASoB,GAAA,SAAAgB;;UAPvBD,uBAUAjB,CAAAA,WAAAA,CAAAA,SAV6Ce,2BAU7Cf,CAAAA;EAEoBkB,IAAAA,EAAAA,MAAAA;EAAhBN;EALyCG,IAAAA,EAJ7ChB,gBAI6CgB,CAJ5BG,WAI4BH,CAAAA;EAA2B;EAOjEK,QAAAA,EATHP,mBAS2B,CATPK,WASOA,CAAAA;;UAP/BC,uBAUApB,CAAAA,WAAAA,CAAAA,SAV6CgB,2BAU7ChB,CAAAA;EACGG,IAAAA,EAAAA,MAAAA;EACAc;EACqBE,IAAAA,EAV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GAL4BX,mBAK5BW,CALgDN,WAKhDM,CAAAA,EAAAA,WAAAA,EAAAA,OAAAA,CAAAA,EAAAA,IAAAA;EAAwDN,cAAAA,CAAAA,CAAAA,EAJnEV,kBAImEU;EAArBI,mBAAAA,CAAAA,CAAAA,EAHzCN,WAGyCM,GAAAA,SAAAA;EACbJ,gBAAAA,CAAAA,CAAAA,EAH/BI,oBAG+BJ,CAHVA,WAGUA,CAAAA,EAAAA;EAAvBO,kBAAAA,CAAAA,WAAAA,CAAAA,EAFKD,mBAELC,CAFyBP,WAEzBO,CAAAA,CAAAA,EAAAA,OAAAA;EACqBP,eAAAA,CAAAA,WAAAA,EAFpBM,mBAEoBN,CAFAA,WAEAA,CAAAA,CAAAA,EAFeI,oBAEfJ,CAFoCA,WAEpCA,CAAAA,EAAAA,GAAAA,SAAAA;EAAhBN,iBAAAA,CAAAA,QAAAA,EADLa,sBACKb,CADkBM,WAClBN,CAAAA,CAAAA,EAAAA,GAAAA,GAAAA,IAAAA;EAAmDM,sBAAAA,CAAAA,QAAAA,EAAnDN,eAAmDM,CAAnCA,WAAmCA,CAAAA,GAApBL,mBAAoBK,CAAAA,WAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAApBL,aAAAA,CAAAA,EAAAA,EAAAA,MAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAAmB,QAAA,UAAA"}
1
+ {"version":3,"file":"CodeView.d.ts","names":["SelectionWriteOptions","CodeViewDiffItem","CodeViewFileItem","CodeViewItem","CodeViewLayout","CodeViewScrollTarget","HunkSeparators","SelectedLineRange","SmoothScrollSettings","VirtualFileMetrics","VirtualWindowSpecs","WorkerPoolManager","FileOptions","FileDiffOptions","VirtualizedFile","VirtualizedFileDiff","VirtualizerConfig","AdvancedVirtualizedBaseItem","HTMLElement","CodeViewDiffItemContext","LAnnotation","CodeViewFileItemContext","CodeViewRenderedDiffItem","CodeViewRenderedFileItem","CodeViewRenderedItem","CodeViewLineSelection","CodeViewCoordinator","CodeViewScrollListener","CodeView","OverloadCallbackArgs","TCallback","TArgs","CallbackReturn","TReturn","OverloadFileCallbackArgs","TKey","NonNullable","OverloadDiffCallbackArgs","CodeViewOptionCallback","CODE_VIEW_DIFF_OPTION_KEYS","CodeViewDiffOptionKeys","CodeViewPassThroughOptions","Pick","CODE_VIEW_SHARED_CALLBACK_KEYS","CODE_VIEW_SELECTION_CALLBACK_KEYS","CodeViewSharedCallbackKeys","CodeViewSelectionCallbackKeys","CodeViewSharedCallbackOptions","CodeViewSelectionCallbackOptions","CodeViewOptions","Exclude","Partial"],"sources":["../../src/components/CodeView.d.ts"],"sourcesContent":["import type { SelectionWriteOptions } from '../managers/InteractionManager';\nimport type { CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewLayout, CodeViewScrollTarget, HunkSeparators, SelectedLineRange, SmoothScrollSettings, VirtualFileMetrics, VirtualWindowSpecs } from '../types';\nimport type { WorkerPoolManager } from '../worker';\nimport type { FileOptions } from './File';\nimport type { FileDiffOptions } from './FileDiff';\nimport { VirtualizedFile } from './VirtualizedFile';\nimport { VirtualizedFileDiff } from './VirtualizedFileDiff';\nimport type { VirtualizerConfig } from './Virtualizer';\ninterface AdvancedVirtualizedBaseItem {\n /** Current index of this record in the ordered items array. */\n index: number;\n /** Absolute top offset of this item inside the scroll content. */\n top: number;\n /** Total measured height reserved for this item. */\n height: number;\n /** Root <diffs-container> node currently mounted for this item, only exists\n * when rendered. */\n element: HTMLElement | undefined;\n /** Last controlled version observed for this record. */\n version: number | undefined;\n}\ninterface CodeViewDiffItemContext<LAnnotation> extends AdvancedVirtualizedBaseItem {\n type: 'diff';\n /** Latest item snapshot for this record. Controlled updates can replace it. */\n item: CodeViewDiffItem<LAnnotation>;\n /** Virtualized diff instance responsible for rendering this item. */\n instance: VirtualizedFileDiff<LAnnotation>;\n}\ninterface CodeViewFileItemContext<LAnnotation> extends AdvancedVirtualizedBaseItem {\n type: 'file';\n /** Latest item snapshot for this record. Controlled updates can replace it. */\n item: CodeViewFileItem<LAnnotation>;\n /** Virtualized file instance responsible for rendering this item. */\n instance: VirtualizedFile<LAnnotation>;\n}\nexport interface CodeViewRenderedDiffItem<LAnnotation> {\n id: string;\n type: 'diff';\n item: CodeViewDiffItem<LAnnotation>;\n version: number | undefined;\n element: HTMLElement;\n instance: VirtualizedFileDiff<LAnnotation>;\n}\nexport interface CodeViewRenderedFileItem<LAnnotation> {\n id: string;\n type: 'file';\n item: CodeViewFileItem<LAnnotation>;\n version: number | undefined;\n element: HTMLElement;\n instance: VirtualizedFile<LAnnotation>;\n}\nexport type CodeViewRenderedItem<LAnnotation> = CodeViewRenderedDiffItem<LAnnotation> | CodeViewRenderedFileItem<LAnnotation>;\nexport interface CodeViewLineSelection {\n id: string;\n range: SelectedLineRange;\n}\nexport interface CodeViewCoordinator<LAnnotation> {\n hasHeaderRenderers: boolean;\n hasAnnotationRenderer: boolean;\n hasGutterRenderer: boolean;\n onSnapshotChange(snapshot: CodeViewRenderedItem<LAnnotation>[] | undefined): void;\n}\nexport type CodeViewScrollListener<LAnnotation> = (scrollTop: number, viewer: CodeView<LAnnotation>) => void;\ntype OverloadCallbackArgs<TCallback> = TCallback extends (...args: infer TArgs) => unknown ? TArgs : never;\ntype CallbackReturn<TCallback> = TCallback extends (...args: never[]) => infer TReturn ? TReturn : never;\ntype OverloadFileCallbackArgs<LAnnotation, TKey extends keyof FileOptions<LAnnotation>> = OverloadCallbackArgs<NonNullable<FileOptions<LAnnotation>[TKey]>>;\ntype OverloadDiffCallbackArgs<LAnnotation, TKey extends keyof FileDiffOptions<LAnnotation>> = OverloadCallbackArgs<NonNullable<FileDiffOptions<LAnnotation>[TKey]>>;\ntype CodeViewOptionCallback<LAnnotation, TKey extends keyof FileOptions<LAnnotation> & keyof FileDiffOptions<LAnnotation>> = {\n (...args: [\n ...OverloadFileCallbackArgs<LAnnotation, TKey>,\n context: CodeViewFileItemContext<LAnnotation>\n ]): CallbackReturn<NonNullable<FileOptions<LAnnotation>[TKey]>>;\n (...args: [\n ...OverloadDiffCallbackArgs<LAnnotation, TKey>,\n context: CodeViewDiffItemContext<LAnnotation>\n ]): CallbackReturn<NonNullable<FileDiffOptions<LAnnotation>[TKey]>>;\n};\ndeclare const CODE_VIEW_DIFF_OPTION_KEYS: readonly [\"theme\", \"disableLineNumbers\", \"overflow\", \"themeType\", \"disableFileHeader\", \"disableVirtualizationBuffers\", \"preferredHighlighter\", \"useCSSClasses\", \"useTokenTransformer\", \"tokenizeMaxLineLength\", \"tokenizeMaxLength\", \"unsafeCSS\", \"diffStyle\", \"diffIndicators\", \"disableBackground\", \"expandUnchanged\", \"collapsedContextThreshold\", \"lineDiffType\", \"maxLineDiffLength\", \"expansionLineCount\", \"lineHoverHighlight\", \"enableTokenInteractionsOnWhitespace\", \"enableGutterUtility\", \"__debugPointerEvents\", \"enableLineSelection\", \"controlledSelection\", \"disableErrorHandling\"];\ntype CodeViewDiffOptionKeys = (typeof CODE_VIEW_DIFF_OPTION_KEYS)[number];\ntype CodeViewPassThroughOptions<LAnnotation> = Pick<FileDiffOptions<LAnnotation>, CodeViewDiffOptionKeys>;\ndeclare const CODE_VIEW_SHARED_CALLBACK_KEYS: readonly [\"renderCustomHeader\", \"renderHeaderPrefix\", \"renderHeaderMetadata\", \"renderAnnotation\", \"renderGutterUtility\", \"onPostRender\", \"onGutterUtilityClick\", \"onLineClick\", \"onLineNumberClick\", \"onLineEnter\", \"onLineLeave\", \"onTokenClick\", \"onTokenEnter\", \"onTokenLeave\"];\ndeclare const CODE_VIEW_SELECTION_CALLBACK_KEYS: readonly [\"onLineSelected\", \"onLineSelectionStart\", \"onLineSelectionChange\", \"onLineSelectionEnd\"];\ntype CodeViewSharedCallbackKeys = (typeof CODE_VIEW_SHARED_CALLBACK_KEYS)[number];\ntype CodeViewSelectionCallbackKeys = (typeof CODE_VIEW_SELECTION_CALLBACK_KEYS)[number];\ntype CodeViewSharedCallbackOptions<LAnnotation> = {\n [TKey in CodeViewSharedCallbackKeys]?: CodeViewOptionCallback<LAnnotation, TKey>;\n};\ntype CodeViewSelectionCallbackOptions<LAnnotation> = {\n [TKey in CodeViewSelectionCallbackKeys]?: CodeViewOptionCallback<LAnnotation, TKey>;\n};\nexport interface CodeViewOptions<LAnnotation> extends CodeViewPassThroughOptions<LAnnotation>, CodeViewSharedCallbackOptions<LAnnotation>, CodeViewSelectionCallbackOptions<LAnnotation> {\n hunkSeparators?: Exclude<HunkSeparators, 'custom'>;\n itemMetrics?: Partial<VirtualFileMetrics>;\n pointerEventsOnScroll?: boolean;\n smoothScrollSettings?: SmoothScrollSettings;\n stickyHeaders?: boolean;\n controlledSelection?: boolean;\n onSelectedLinesChange?(selection: CodeViewLineSelection | null): void;\n layout?: CodeViewLayout;\n /** Internal dev-only check to ensure your `itemMetrics` are correct. Its\n * automatically disabled in a production build because it will hurt\n * performance fairly significantly */\n __devOnlyValidateItemHeights?: boolean;\n}\nexport declare class CodeView<LAnnotation = undefined> {\n static __STOP: boolean;\n static __lastScrollPosition: number;\n type: \"advanced\";\n readonly config: VirtualizerConfig;\n private items;\n private idToItem;\n private selectedLines;\n private instanceToItem;\n private layoutDirtyIndex;\n private slotCoordinator;\n private slotSnapshot;\n private scrollListeners;\n private scrollHeight;\n private containerHeight;\n private scrollTop;\n private scrollPageOffset;\n private scrollDirty;\n private pointerEventsRestoreTimer;\n private pointerEventsDisabled;\n private height;\n private heightDirty;\n private windowSpecs;\n private renderState;\n private itemMetricsCache;\n private pendingScrollTarget;\n private pendingLayoutAnchor;\n private scrollAnimation;\n private root;\n private resizeObserver;\n private container;\n private stickyContainer;\n private stickyOffset;\n private options;\n private workerManager;\n private isContainerManaged;\n constructor(options?: CodeViewOptions<LAnnotation>, workerManager?: WorkerPoolManager | undefined, isContainerManaged?: boolean);\n private getLayout;\n private computeMetricsCache;\n private getSmoothScrollSettings;\n private shouldDisablePointerEvents;\n private shouldValidateItemHeights;\n private validateRenderedItemHeight;\n private clearPointerEventsTimer;\n private suspendPointerEvents;\n private restorePointerEvents;\n private syncLayout;\n setup(root: HTMLElement): void;\n reset(): void;\n cleanUp(): void;\n private cleanAllRenderedItems;\n private resolveEffectiveScrollBehavior;\n scrollTo(target: CodeViewScrollTarget): void;\n setSelectedLines(selection: CodeViewLineSelection | null, options?: SelectionWriteOptions): void;\n getSelectedLines(): CodeViewLineSelection | null;\n clearSelectedLines(options?: SelectionWriteOptions): void;\n getItem(itemId: string): CodeViewItem<LAnnotation> | undefined;\n updateItem(input: CodeViewItem<LAnnotation>): boolean;\n addItem(input: CodeViewItem<LAnnotation>): void;\n addItems(inputs: readonly CodeViewItem<LAnnotation>[]): void;\n setItems(items: readonly CodeViewItem<LAnnotation>[]): void;\n /**\n * Append new records to the viewer while preserving existing layout state.\n * This is the shared path for imperative adds and the append-only reconcile\n * fast path, so it measures new items immediately and only triggers render\n * once at the end.\n */\n private appendItemsInternal;\n private canSkipRenderForAppend;\n setOptions(options: CodeViewOptions<LAnnotation> | undefined): void;\n private capturePendingLayoutAnchor;\n render(immediate?: boolean): void;\n instanceChanged(instance: VirtualizedFile<LAnnotation> | VirtualizedFileDiff<LAnnotation>, layoutDirty: boolean): void;\n getWindowSpecs(): VirtualWindowSpecs;\n getContainerElement(): HTMLElement | undefined;\n getRenderedItems(): CodeViewRenderedItem<LAnnotation>[];\n setSlotCoordinator(coordinator?: CodeViewCoordinator<LAnnotation>): boolean;\n getSlotSnapshot(coordinator: CodeViewCoordinator<LAnnotation>): CodeViewRenderedItem<LAnnotation>[] | undefined;\n subscribeToScroll(listener: CodeViewScrollListener<LAnnotation>): () => void;\n getLocalTopForInstance(instance: VirtualizedFile<LAnnotation> | VirtualizedFileDiff<LAnnotation>): number;\n getTopForItem(id: string): number | undefined;\n private createItem;\n private getItemById;\n private getItemByMode;\n private applySelectedLines;\n private syncSelection;\n private wrapCallbackWithContext;\n private getWrappedOptionCallback;\n private getWrappedSelectionOptionCallback;\n private createOptions;\n /**\n * Track the earliest index whose measured layout may now be stale. Later\n * render passes relayout from this point forward so we do not have to rebuild\n * positions for the whole list after every change.\n */\n private markLayoutDirtyFromIndex;\n /**\n * Mark the earliest affected item as layout-dirty after an imperative change.\n * Each record carries its current array index so this stays O(1) even when\n * the viewer holds a very large number of items.\n */\n private markItemLayoutDirty;\n /**\n * Detect the common controlled-update case where the new list simply extends\n * the existing ordered prefix. When that happens we can reuse every current\n * record in place, sync any versioned payload changes, and append only the new\n * tail instead of rebuilding the whole list.\n */\n private tryAppendItems;\n /**\n * Reconcile a new controlled item list against the existing records by id.\n * This reuses records and instances when type matches, cleans up removed\n * records, rebuilds the lookup maps, and marks layout dirty whenever order,\n * membership, or versioned item data changes.\n */\n private reconcileItems;\n /**\n * Update a reused record from the latest controlled item only when its item\n * version changes. Matching versions mean CodeView keeps the current record\n * snapshot, which lets imperative updates remain in place until the caller\n * intentionally publishes a newer version.\n */\n private syncItemRecord;\n private getMaxScrollTopForHeight;\n private getMaxScrollTop;\n private shouldRebaseScroll;\n private getPagedScrollHeight;\n private getMaxPagedScrollTop;\n private clampPagedScrollTop;\n /**\n * Clamps a logical scroll position to the min/max allowable scroll range\n * based on the full computed content height.\n */\n private clampScrollTop;\n private getMaxScrollPageOffset;\n private clampScrollPageOffset;\n private resolveScrollPageWindow;\n /**\n * Resolve how a logical scrollTop maps onto the reusable paged scroll window\n * without mutating the current page offset.\n */\n private resolvePagedScrollPosition;\n private needsScrollPageUpdate;\n private getPagedLayoutTop;\n private getStickyHeaderOffset;\n private getScrollTargetRect;\n private normalizeScrollTarget;\n /**\n * Resolve a target's scroll position\n \n * Returns `undefined` when we can't resolve a target for whatever reason\n */\n private resolveScrollTargetTop;\n /**\n * Given an existing scroll target (scroll top and height), figure out the\n * correct scroll position to target based on the desired alignment, offset\n * and stickyOffset if necessary\n */\n private resolveAlignedScrollPosition;\n private getLineScrollPosition;\n private getRangeScrollPosition;\n /**\n * Determine target scroll position for current frame.\n *\n * If there's no pendingScrollTarget then we just return the current scroll\n * position\n *\n * If there's a pendingScrollTarget then we depend on whether there's a\n * smooth scroll animation or not. If not just return the destination, or\n * compute next position given the smooth scroll spring physics\n */\n private computeTargetScrollTopForFrame;\n /**\n * Closed-form critical-damped ODE step.\n *\n * Stable at any dt (Euler would blow up once ω·dt ≳ 1), so this survives\n * big RAF gaps (tab-wake, offscreen frames) and resize-driven ticks that\n * fire outside the normal RAF cadence.\n */\n private computeSpringStep;\n /**\n * For any given pendingScrollTarget, updates any in flight smooth scroll\n * animations and returns the target scrollTop to move towards\n *\n * Resolves the animation based on frame time and adopts any necessary scroll\n * anchoring corrections if necessary\n */\n private advanceScrollAnimation;\n private computeRenderRangeAndEmit;\n private flushManagers;\n private syncContainerHeight;\n private getStickyBounds;\n private applyStickyPositioning;\n private syncPagedScrollScaffolding;\n private reconcileRenderedItems;\n private updateStickyPositioning;\n private handleScroll;\n private clearPendingScroll;\n private handleResize;\n /**\n * Figure out scrollTop accounting for sticky header if enabled and\n * necessary\n */\n private getScrollAnchorViewportTop;\n /**\n * Attempt to find a scroll anchor based on build in metrics of the existing\n * rendered files/diff.\n *\n * A scroll anchor represents the first fully visible element (in other\n * words, the first file or first line who's top is fully in the viewport).\n */\n private getScrollAnchor;\n /**\n * Given a scroll anchor, attempt to resolve a newly updated (and clamped)\n * scroll position to keep the anchored element in place.\n *\n * If we can't resolve a position for whatever reason, we'll return\n * undefined.\n */\n private resolveAnchoredScrollTop;\n /**\n * Apply a device-pixel-rounded scroll position if it differs from the last\n * logical scrollTop synchronized into the paged scroll scaffold.\n */\n private applyScrollFix;\n /**\n * Decide whether a pending programmatic scroll has reached its\n * destination and should be cleared.\n */\n private isPendingTargetSettled;\n getScrollTop(): number;\n getHeight(): number;\n getScrollHeight(): number;\n private flushSlotCoordinator;\n private notifyScroll;\n /**\n * Find the first item whose bottom edge crosses into the viewport window.\n * This lets scroll-time rendering jump directly near the visible range instead\n * of linearly scanning from the start of very large item lists.\n */\n private findFirstVisibleIndex;\n /**\n * Find the last item whose top edge is still within the viewport window.\n * Paired with findFirstVisibleIndex, this bounds the render loop to only the\n * slice of items that can actually intersect the current scroll range.\n */\n private findLastVisibleIndex;\n /**\n * Recompute measured tops and heights starting from the earliest dirty item.\n * Earlier items keep their existing layout, while everything from startIndex\n * onward is remeasured so downstream positions and total scroll height stay\n * consistent after inserts, removals, or versioned item updates.\n */\n private recomputeLayout;\n private resetRenderState;\n private getFitPerfectlyOverscroll;\n}\nexport {};\n//# sourceMappingURL=CodeView.d.ts.map"],"mappings":";;;;;;;;;;;UAQUiB,2BAAAA;;;EAAAA;EAaAE,GAAAA,EAAAA,MAAAA;EAGiBC;EAAjBnB,MAAAA,EAAAA,MAAAA;EAEwBmB;;EALqBH,OAAAA,EAJ1CC,WAI0CD,GAAAA,SAAAA;EAA2B;EAOxEI,OAAAA,EAAAA,MAAAA,GAAAA,SAAuB;;UAPvBF,uBAUAjB,CAAAA,WAAAA,CAAAA,SAV6Ce,2BAU7Cf,CAAAA;EAEoBkB,IAAAA,EAAAA,MAAAA;EAAhBN;EALyCG,IAAAA,EAJ7ChB,gBAI6CgB,CAJ5BG,WAI4BH,CAAAA;EAA2B;EAOjEK,QAAAA,EATHP,mBAS2B,CATPK,WASOA,CAAAA;;UAP/BC,uBAUApB,CAAAA,WAAAA,CAAAA,SAV6CgB,2BAU7ChB,CAAAA;EAEGiB,IAAAA,EAAAA,MAAAA;EACqBE;EAApBL,IAAAA,EAVJb,gBAUIa,CAVaK,WAUbL,CAAAA;EAAmB;EAEhBQ,QAAAA,EAVHT,eAUGS,CAVaH,WAUWA,CAAAA;;AAG/BlB,UAXOoB,wBAWPpB,CAAAA,WAAAA,CAAAA,CAAAA;EAEGgB,EAAAA,EAAAA,MAAAA;EACiBE,IAAAA,EAAAA,MAAAA;EAAhBN,IAAAA,EAXJb,gBAWIa,CAXaM,WAWbN,CAAAA;EAAe,OAAA,EAAA,MAAA,GAAA,SAAA;EAEjBU,OAAAA,EAXCN,WAWDM;EAA6DJ,QAAAA,EAV3DL,mBAU2DK,CAVvCA,WAUuCA,CAAAA;;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DO,uBAAuBP;mCAClBN,gBAAgBM,eAAeL,oBAAoBK"}
@@ -1,4 +1,4 @@
1
- import { DEFAULT_CODE_VIEW_FILE_METRICS, DEFAULT_CODE_VIEW_METRICS, DEFAULT_SMOOTH_SCROLL_SETTINGS, DEFAULT_THEMES, DIFFS_TAG_NAME } from "../constants.js";
1
+ import { DEFAULT_CODE_VIEW_FILE_METRICS, DEFAULT_CODE_VIEW_LAYOUT, DEFAULT_SMOOTH_SCROLL_SETTINGS, DEFAULT_THEMES, DIFFS_DEVELOPMENT_BUILD, DIFFS_TAG_NAME } from "../constants.js";
2
2
  import { dequeueRender, queueRender } from "../managers/UniversalRenderingManager.js";
3
3
  import { areObjectsEqual } from "../utils/areObjectsEqual.js";
4
4
  import { areSelectionsEqual } from "../utils/areSelectionsEqual.js";
@@ -124,6 +124,7 @@ var CodeView = class CodeView {
124
124
  stickyTop: -1,
125
125
  stickyBottom: -1
126
126
  };
127
+ itemMetricsCache = DEFAULT_CODE_VIEW_FILE_METRICS;
127
128
  pendingScrollTarget;
128
129
  pendingLayoutAnchor;
129
130
  scrollAnimation;
@@ -137,6 +138,7 @@ var CodeView = class CodeView {
137
138
  isContainerManaged;
138
139
  constructor(options = { theme: DEFAULT_THEMES }, workerManager, isContainerManaged = false) {
139
140
  this.options = options;
141
+ this.computeMetricsCache(options.itemMetrics);
140
142
  this.workerManager = workerManager;
141
143
  this.isContainerManaged = isContainerManaged;
142
144
  this.stickyOffset.style.contain = "layout size";
@@ -147,11 +149,20 @@ var CodeView = class CodeView {
147
149
  this.stickyContainer.style.display = "flex";
148
150
  this.stickyContainer.style.flexDirection = "column";
149
151
  }
150
- getViewerMetrics() {
151
- return this.options.viewerMetrics ?? DEFAULT_CODE_VIEW_METRICS;
152
- }
153
- getItemMetrics() {
154
- return this.options.itemMetrics ?? DEFAULT_CODE_VIEW_FILE_METRICS;
152
+ getLayout() {
153
+ return this.options.layout ?? DEFAULT_CODE_VIEW_LAYOUT;
154
+ }
155
+ computeMetricsCache(itemMetrics) {
156
+ this.itemMetricsCache = {
157
+ hunkLineCount: itemMetrics?.hunkLineCount ?? DEFAULT_CODE_VIEW_FILE_METRICS.hunkLineCount,
158
+ lineHeight: itemMetrics?.lineHeight ?? DEFAULT_CODE_VIEW_FILE_METRICS.lineHeight,
159
+ diffHeaderHeight: itemMetrics?.diffHeaderHeight ?? DEFAULT_CODE_VIEW_FILE_METRICS.diffHeaderHeight,
160
+ hunkSeparatorHeight: itemMetrics?.hunkSeparatorHeight ?? DEFAULT_CODE_VIEW_FILE_METRICS.hunkSeparatorHeight,
161
+ spacing: itemMetrics?.spacing ?? DEFAULT_CODE_VIEW_FILE_METRICS.spacing,
162
+ paddingTop: itemMetrics?.paddingTop,
163
+ paddingBottom: itemMetrics?.paddingBottom
164
+ };
165
+ return this.itemMetricsCache;
155
166
  }
156
167
  getSmoothScrollSettings() {
157
168
  return this.options.smoothScrollSettings ?? DEFAULT_SMOOTH_SCROLL_SETTINGS;
@@ -159,6 +170,33 @@ var CodeView = class CodeView {
159
170
  shouldDisablePointerEvents() {
160
171
  return this.options.pointerEventsOnScroll !== true;
161
172
  }
173
+ shouldValidateItemHeights() {
174
+ return DIFFS_DEVELOPMENT_BUILD && this.options.__devOnlyValidateItemHeights === true;
175
+ }
176
+ validateRenderedItemHeight(item) {
177
+ if (!this.shouldValidateItemHeights() || item.element == null) return;
178
+ const stickySpecs = item.instance.getAdvancedStickySpecs();
179
+ if (stickySpecs == null) return;
180
+ const expectedHeight = stickySpecs.height;
181
+ const actualHeight = item.element.getBoundingClientRect().height;
182
+ if (expectedHeight === actualHeight) return;
183
+ console.error("CodeView: reconciled item height does not match DOM height", {
184
+ id: item.item.id,
185
+ type: item.type,
186
+ index: item.index,
187
+ version: item.version,
188
+ expectedHeight,
189
+ actualHeight,
190
+ delta: actualHeight - expectedHeight,
191
+ stickyTopOffset: stickySpecs.topOffset,
192
+ virtualizedHeight: item.instance.getVirtualizedHeight(),
193
+ top: item.top,
194
+ scrollTop: this.getScrollTop(),
195
+ windowSpecs: { ...this.windowSpecs },
196
+ element: item.element,
197
+ instance: item.instance
198
+ });
199
+ }
162
200
  clearPointerEventsTimer() {
163
201
  if (this.pointerEventsRestoreTimer != null) {
164
202
  clearTimeout(this.pointerEventsRestoreTimer);
@@ -180,8 +218,8 @@ var CodeView = class CodeView {
180
218
  this.stickyContainer.style.removeProperty("pointer-events");
181
219
  this.pointerEventsDisabled = false;
182
220
  };
183
- syncViewerMetrics() {
184
- const { gap, paddingBottom, paddingTop } = this.getViewerMetrics();
221
+ syncLayout() {
222
+ const { gap, paddingBottom, paddingTop } = this.getLayout();
185
223
  this.stickyContainer.style.gap = `${gap}px`;
186
224
  this.container?.style.setProperty("margin-top", `${paddingTop}px`);
187
225
  this.container?.style.setProperty("margin-bottom", `${paddingBottom}px`);
@@ -192,7 +230,7 @@ var CodeView = class CodeView {
192
230
  this.root.style.overflowAnchor = "none";
193
231
  this.container ??= document.createElement("div");
194
232
  this.container.style.contain = "layout style";
195
- this.syncViewerMetrics();
233
+ this.syncLayout();
196
234
  this.container.appendChild(this.stickyOffset);
197
235
  this.container.appendChild(this.stickyContainer);
198
236
  this.root.appendChild(this.container);
@@ -342,8 +380,8 @@ var CodeView = class CodeView {
342
380
  */
343
381
  appendItemsInternal(inputs, render = true) {
344
382
  if (inputs.length === 0) return;
345
- const viewerMetrics = this.getViewerMetrics();
346
- let nextTop = this.items.length === 0 ? 0 : this.scrollHeight + viewerMetrics.gap;
383
+ const layout = this.getLayout();
384
+ let nextTop = this.items.length === 0 ? 0 : this.scrollHeight + layout.gap;
347
385
  const appendedTop = nextTop;
348
386
  for (let index = 0; index < inputs.length; index++) {
349
387
  const input = inputs[index];
@@ -354,9 +392,9 @@ var CodeView = class CodeView {
354
392
  this.idToItem.set(item.item.id, item);
355
393
  this.instanceToItem.set(item.instance, item);
356
394
  item.height = prepareItemInstance(item);
357
- nextTop += item.height + viewerMetrics.gap;
395
+ nextTop += item.height + layout.gap;
358
396
  }
359
- this.scrollHeight = nextTop - viewerMetrics.gap;
397
+ this.scrollHeight = nextTop - layout.gap;
360
398
  this.scrollDirty = true;
361
399
  if (render) if (this.canSkipRenderForAppend(appendedTop)) this.syncContainerHeight();
362
400
  else this.render();
@@ -367,12 +405,12 @@ var CodeView = class CodeView {
367
405
  setOptions(options) {
368
406
  if (options == null) return;
369
407
  this.capturePendingLayoutAnchor();
370
- const previousViewerMetrics = this.getViewerMetrics();
371
- const previousItemMetrics = this.getItemMetrics();
408
+ const previousLayout = this.getLayout();
409
+ const { itemMetricsCache: previousItemMetrics } = this;
372
410
  this.options = options;
373
- const nextItemMetrics = this.getItemMetrics();
411
+ const nextItemMetrics = this.computeMetricsCache(options.itemMetrics);
374
412
  const itemMetricsChanged = !areObjectsEqual(previousItemMetrics, nextItemMetrics);
375
- if (!areObjectsEqual(previousViewerMetrics, this.getViewerMetrics())) this.syncViewerMetrics();
413
+ if (!areObjectsEqual(previousLayout, this.getLayout())) this.syncLayout();
376
414
  for (let index = 0; index < this.items.length; index++) {
377
415
  const item = this.items[index];
378
416
  if (item == null) throw new Error("CodeView.setOptions: invalid item index");
@@ -456,10 +494,10 @@ var CodeView = class CodeView {
456
494
  getTopForItem(id) {
457
495
  const item = this.idToItem.get(id);
458
496
  if (item == null) return;
459
- return item.top + this.getViewerMetrics().paddingTop;
497
+ return item.top + this.getLayout().paddingTop;
460
498
  }
461
499
  createItem(input, index, top) {
462
- const itemMetrics = this.getItemMetrics();
500
+ const { itemMetricsCache: itemMetrics } = this;
463
501
  if (input.type === "diff") return {
464
502
  type: "diff",
465
503
  item: input,
@@ -668,7 +706,7 @@ var CodeView = class CodeView {
668
706
  return true;
669
707
  }
670
708
  getMaxScrollTopForHeight(scrollHeight) {
671
- const { paddingBottom, paddingTop } = this.getViewerMetrics();
709
+ const { paddingBottom, paddingTop } = this.getLayout();
672
710
  return Math.max(paddingTop + scrollHeight + paddingBottom - this.getHeight(), 0);
673
711
  }
674
712
  getMaxScrollTop() {
@@ -743,7 +781,7 @@ var CodeView = class CodeView {
743
781
  return Math.max(logicalTop - this.scrollPageOffset, 0);
744
782
  }
745
783
  getStickyHeaderOffset() {
746
- return this.options.stickyHeaders === true && this.options.disableFileHeader !== true ? this.getItemMetrics().diffHeaderHeight : 0;
784
+ return this.options.stickyHeaders === true && this.options.disableFileHeader !== true ? this.itemMetricsCache.diffHeaderHeight : 0;
747
785
  }
748
786
  getScrollTargetRect(target) {
749
787
  const item = this.idToItem.get(target.id);
@@ -755,6 +793,17 @@ var CodeView = class CodeView {
755
793
  top: item.top,
756
794
  height: item.height
757
795
  };
796
+ if (target.type === "range") {
797
+ const rangePosition = this.getRangeScrollPosition(item, target);
798
+ if (rangePosition == null) {
799
+ console.warn(`CodeView.scrollTo: unable to resolve range ${formatSelectedLineRange(target.range)} for item "${target.id}"`);
800
+ return;
801
+ }
802
+ return {
803
+ top: item.top + rangePosition.top,
804
+ height: rangePosition.height
805
+ };
806
+ }
758
807
  const linePosition = this.getLineScrollPosition(item, target);
759
808
  if (linePosition == null) {
760
809
  console.warn(`CodeView.scrollTo: unable to resolve line ${target.lineNumber} for item "${target.id}"`);
@@ -770,10 +819,10 @@ var CodeView = class CodeView {
770
819
  const rect = this.getScrollTargetRect(target);
771
820
  if (rect == null) return;
772
821
  const offset = target.offset ?? 0;
773
- const targetTop = this.getViewerMetrics().paddingTop + rect.top;
822
+ const targetTop = this.getLayout().paddingTop + rect.top;
774
823
  const targetBottom = targetTop + rect.height;
775
824
  const currentTop = this.getScrollTop();
776
- const visibleTop = currentTop + (target.type === "line" ? this.getStickyHeaderOffset() : 0);
825
+ const visibleTop = currentTop + (target.type === "line" || target.type === "range" ? this.getStickyHeaderOffset() : 0);
777
826
  const visibleBottom = currentTop + this.getHeight();
778
827
  if (targetTop - offset <= visibleTop && targetBottom + offset >= visibleBottom) return;
779
828
  if (targetTop - offset < visibleTop) return {
@@ -801,6 +850,14 @@ var CodeView = class CodeView {
801
850
  return;
802
851
  }
803
852
  if (target.type === "item") return this.clampScrollTop(this.resolveAlignedScrollPosition(item.top, item.height, target.align, target.offset));
853
+ if (target.type === "range") {
854
+ const rangePosition = this.getRangeScrollPosition(item, target);
855
+ if (rangePosition == null) {
856
+ console.warn(`CodeView.scrollTo: unable to resolve range ${formatSelectedLineRange(target.range)} for item "${target.id}"`);
857
+ return;
858
+ }
859
+ return this.clampScrollTop(this.resolveAlignedScrollPosition(item.top + rangePosition.top, rangePosition.height, target.align, target.offset, this.getStickyHeaderOffset()));
860
+ }
804
861
  const linePosition = this.getLineScrollPosition(item, target);
805
862
  if (linePosition == null) {
806
863
  console.warn(`CodeView.scrollTo: unable to resolve line ${target.lineNumber} for item "${target.id}"`);
@@ -814,7 +871,7 @@ var CodeView = class CodeView {
814
871
  * and stickyOffset if necessary
815
872
  */
816
873
  resolveAlignedScrollPosition(targetTop, targetHeight, align, offset = 0, stickyOffset = 0) {
817
- targetTop += this.getViewerMetrics().paddingTop;
874
+ targetTop += this.getLayout().paddingTop;
818
875
  const viewportHeight = this.getHeight();
819
876
  if (align === "center" && targetHeight + offset < viewportHeight) return targetTop - (viewportHeight - targetHeight) / 2 + offset;
820
877
  if (align === "end") return targetTop - (viewportHeight - targetHeight) + offset;
@@ -824,6 +881,31 @@ var CodeView = class CodeView {
824
881
  if (item.type === "diff") return item.instance.getLinePosition(target.lineNumber, target.side);
825
882
  return item.instance.getLinePosition(target.lineNumber);
826
883
  }
884
+ getRangeScrollPosition(item, target) {
885
+ const { range } = target;
886
+ const startPosition = this.getLineScrollPosition(item, {
887
+ type: "line",
888
+ id: target.id,
889
+ lineNumber: range.start,
890
+ side: range.side
891
+ });
892
+ const endPosition = this.getLineScrollPosition(item, {
893
+ type: "line",
894
+ id: target.id,
895
+ lineNumber: range.end,
896
+ side: range.endSide ?? range.side
897
+ });
898
+ if (startPosition == null || endPosition == null) return;
899
+ const startTop = startPosition.top;
900
+ const startBottom = startTop + startPosition.height;
901
+ const endTop = endPosition.top;
902
+ const endBottom = endTop + endPosition.height;
903
+ const top = Math.min(startTop, endTop);
904
+ return {
905
+ top,
906
+ height: Math.max(startBottom, endBottom) - top
907
+ };
908
+ }
827
909
  /**
828
910
  * Determine target scroll position for current frame.
829
911
  *
@@ -1013,7 +1095,7 @@ var CodeView = class CodeView {
1013
1095
  }
1014
1096
  applyStickyPositioning({ stickyTop, stickyBottom }) {
1015
1097
  const height = this.getHeight();
1016
- const itemMetrics = this.getItemMetrics();
1098
+ const { itemMetricsCache: itemMetrics } = this;
1017
1099
  const stickyContainerHeight = stickyBottom - stickyTop;
1018
1100
  this.renderState.stickyHeight = stickyContainerHeight;
1019
1101
  this.renderState.stickyTop = stickyTop;
@@ -1050,9 +1132,10 @@ var CodeView = class CodeView {
1050
1132
  heightChanged = true;
1051
1133
  item.height = item.instance.getVirtualizedHeight();
1052
1134
  }
1135
+ this.validateRenderedItemHeight(item);
1053
1136
  }
1054
1137
  currentTop += item.instance.getVirtualizedHeight();
1055
- if (index < this.items.length - 1) currentTop += this.getViewerMetrics().gap;
1138
+ if (index < this.items.length - 1) currentTop += this.getLayout().gap;
1056
1139
  }
1057
1140
  if (heightChanged && currentTop != null) {
1058
1141
  this.scrollDirty = true;
@@ -1125,7 +1208,7 @@ var CodeView = class CodeView {
1125
1208
  for (let index = firstIndex; index <= lastIndex; index++) {
1126
1209
  const item = this.items[index];
1127
1210
  if (item == null) continue;
1128
- const absoluteItemTop = this.getViewerMetrics().paddingTop + item.top;
1211
+ const absoluteItemTop = this.getLayout().paddingTop + item.top;
1129
1212
  if (absoluteItemTop + item.height <= scrollTop) continue;
1130
1213
  if (absoluteItemTop >= scrollTop + viewportHeight) break;
1131
1214
  if (absoluteItemTop >= scrollTop) return {
@@ -1157,7 +1240,7 @@ var CodeView = class CodeView {
1157
1240
  resolveAnchoredScrollTop(anchor) {
1158
1241
  const item = this.idToItem.get(anchor.id);
1159
1242
  if (item == null) return;
1160
- const { paddingTop } = this.getViewerMetrics();
1243
+ const { paddingTop } = this.getLayout();
1161
1244
  if (anchor.type === "item") {
1162
1245
  const absoluteItemTop = paddingTop + item.top;
1163
1246
  return this.clampScrollTop(absoluteItemTop - anchor.viewportOffset);
@@ -1283,12 +1366,12 @@ var CodeView = class CodeView {
1283
1366
  this.scrollHeight = 0;
1284
1367
  return;
1285
1368
  }
1286
- const viewerMetrics = this.getViewerMetrics();
1369
+ const layout = this.getLayout();
1287
1370
  let runningTop = 0;
1288
1371
  if (startIndex > 0) {
1289
1372
  const previousItem = this.items[startIndex - 1];
1290
1373
  if (previousItem == null) throw new Error("CodeView.recomputeLayout: invalid dirty index");
1291
- runningTop = previousItem.top + previousItem.height + viewerMetrics.gap;
1374
+ runningTop = previousItem.top + previousItem.height + layout.gap;
1292
1375
  }
1293
1376
  for (let index = startIndex; index < this.items.length; index++) {
1294
1377
  const item = this.items[index];
@@ -1297,7 +1380,7 @@ var CodeView = class CodeView {
1297
1380
  if (item.type === "diff") item.height = item.instance.prepareVirtualizedItem(item.item.fileDiff);
1298
1381
  else item.height = item.instance.prepareVirtualizedItem(item.item.file);
1299
1382
  runningTop += item.height;
1300
- if (index < this.items.length - 1) runningTop += viewerMetrics.gap;
1383
+ if (index < this.items.length - 1) runningTop += layout.gap;
1301
1384
  }
1302
1385
  if (runningTop !== this.scrollHeight) this.scrollDirty = true;
1303
1386
  this.scrollHeight = runningTop;
@@ -1311,7 +1394,7 @@ var CodeView = class CodeView {
1311
1394
  this.renderState.stickyBottom = -1;
1312
1395
  }
1313
1396
  getFitPerfectlyOverscroll() {
1314
- return this.getViewerMetrics().gap + this.getItemMetrics().diffHeaderHeight;
1397
+ return this.getLayout().gap + this.itemMetricsCache.diffHeaderHeight;
1315
1398
  }
1316
1399
  };
1317
1400
  function cleanRenderedItem(item) {
@@ -1324,6 +1407,15 @@ function prepareItemInstance(item) {
1324
1407
  if (item.type === "diff") return item.instance.prepareVirtualizedItem(item.item.fileDiff);
1325
1408
  else return item.instance.prepareVirtualizedItem(item.item.file);
1326
1409
  }
1410
+ function formatSelectedLineRange(range) {
1411
+ const start = formatSelectedLinePoint(range.start, range.side);
1412
+ const end = formatSelectedLinePoint(range.end, range.endSide ?? range.side);
1413
+ return start === end ? start : `${start}-${end}`;
1414
+ }
1415
+ function formatSelectedLinePoint(lineNumber, side) {
1416
+ if (side == null) return `${lineNumber}`;
1417
+ return `${side === "deletions" ? "D" : "A"}${lineNumber}`;
1418
+ }
1327
1419
  function renderItem(item, fileContainer) {
1328
1420
  if (item.type === "diff") return item.instance.render({
1329
1421
  deferManagers: true,