@pierre/diffs 1.2.0-beta.2 → 1.2.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/CodeView.d.ts +16 -6
- package/dist/components/CodeView.d.ts.map +1 -1
- package/dist/components/CodeView.js +129 -27
- package/dist/components/CodeView.js.map +1 -1
- package/dist/components/File.d.ts +3 -2
- package/dist/components/File.d.ts.map +1 -1
- package/dist/components/File.js +14 -5
- package/dist/components/File.js.map +1 -1
- package/dist/components/FileDiff.d.ts +3 -2
- package/dist/components/FileDiff.d.ts.map +1 -1
- package/dist/components/FileDiff.js +14 -5
- package/dist/components/FileDiff.js.map +1 -1
- package/dist/components/FileStream.js +6 -3
- package/dist/components/FileStream.js.map +1 -1
- package/dist/components/VirtualizedFile.d.ts +1 -0
- package/dist/components/VirtualizedFile.d.ts.map +1 -1
- package/dist/components/VirtualizedFile.js +18 -13
- package/dist/components/VirtualizedFile.js.map +1 -1
- package/dist/components/VirtualizedFileDiff.d.ts +1 -0
- package/dist/components/VirtualizedFileDiff.d.ts.map +1 -1
- package/dist/components/VirtualizedFileDiff.js +19 -16
- package/dist/components/VirtualizedFileDiff.js.map +1 -1
- package/dist/components/VirtulizerDevelopment.d.ts.map +1 -1
- package/dist/components/web-components.js +4 -0
- package/dist/components/web-components.js.map +1 -1
- package/dist/constants.d.ts +6 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +11 -2
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/managers/InteractionManager.d.ts +2 -8
- package/dist/managers/InteractionManager.d.ts.map +1 -1
- package/dist/managers/InteractionManager.js.map +1 -1
- package/dist/react/CodeView.d.ts +5 -1
- package/dist/react/CodeView.d.ts.map +1 -1
- package/dist/react/CodeView.js +75 -16
- package/dist/react/CodeView.js.map +1 -1
- package/dist/react/index.d.ts +2 -2
- package/dist/react/types.d.ts +2 -2
- package/dist/react/types.d.ts.map +1 -1
- package/dist/react/utils/useFileDiffInstance.d.ts +2 -2
- package/dist/react/utils/useFileDiffInstance.d.ts.map +1 -1
- package/dist/react/utils/useFileDiffInstance.js +1 -1
- package/dist/react/utils/useFileDiffInstance.js.map +1 -1
- package/dist/react/utils/useFileInstance.d.ts +2 -2
- package/dist/react/utils/useFileInstance.d.ts.map +1 -1
- package/dist/react/utils/useFileInstance.js +1 -1
- package/dist/react/utils/useFileInstance.js.map +1 -1
- package/dist/react/utils/useUnresolvedFileInstance.d.ts +2 -2
- package/dist/react/utils/useUnresolvedFileInstance.d.ts.map +1 -1
- package/dist/react/utils/useUnresolvedFileInstance.js +1 -1
- package/dist/react/utils/useUnresolvedFileInstance.js.map +1 -1
- package/dist/renderers/FileRenderer.js +1 -1
- package/dist/ssr/index.d.ts +2 -2
- package/dist/style.js +1 -1
- package/dist/style.js.map +1 -1
- package/dist/types.d.ts +23 -7
- package/dist/types.d.ts.map +1 -1
- 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/cssWrappers.d.ts +3 -2
- package/dist/utils/cssWrappers.d.ts.map +1 -1
- package/dist/utils/cssWrappers.js +13 -2
- package/dist/utils/cssWrappers.js.map +1 -1
- package/dist/utils/getFiletypeFromFileName.js +16 -0
- package/dist/utils/getFiletypeFromFileName.js.map +1 -1
- package/dist/utils/parsePatchFiles.js +15 -0
- package/dist/utils/parsePatchFiles.js.map +1 -1
- package/dist/utils/scrollbarGutter.d.ts +6 -0
- package/dist/utils/scrollbarGutter.d.ts.map +1 -0
- package/dist/utils/scrollbarGutter.js +28 -0
- package/dist/utils/scrollbarGutter.js.map +1 -0
- package/dist/worker/WorkerPoolManager.js +1 -1
- package/dist/worker/WorkerPoolManager.js.map +1 -1
- package/dist/worker/worker-portable.js +26 -1
- package/dist/worker/worker-portable.js.map +1 -1
- package/dist/worker/worker.js +23 -0
- package/dist/worker/worker.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemVersion,
|
|
2
|
-
import {
|
|
1
|
+
import { CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemVersion, 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";
|
|
@@ -89,7 +89,11 @@ interface CodeViewOptions<LAnnotation> extends CodeViewPassThroughOptions<LAnnot
|
|
|
89
89
|
stickyHeaders?: boolean;
|
|
90
90
|
controlledSelection?: boolean;
|
|
91
91
|
onSelectedLinesChange?(selection: CodeViewLineSelection | null): void;
|
|
92
|
-
|
|
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;
|
|
@@ -127,14 +131,16 @@ declare class CodeView<LAnnotation = undefined> {
|
|
|
127
131
|
private workerManager;
|
|
128
132
|
private isContainerManaged;
|
|
129
133
|
constructor(options?: CodeViewOptions<LAnnotation>, workerManager?: WorkerPoolManager | undefined, isContainerManaged?: boolean);
|
|
130
|
-
private
|
|
134
|
+
private getLayout;
|
|
131
135
|
private getItemMetrics;
|
|
132
136
|
private getSmoothScrollSettings;
|
|
133
137
|
private shouldDisablePointerEvents;
|
|
138
|
+
private shouldValidateItemHeights;
|
|
139
|
+
private validateRenderedItemHeight;
|
|
134
140
|
private clearPointerEventsTimer;
|
|
135
141
|
private suspendPointerEvents;
|
|
136
142
|
private restorePointerEvents;
|
|
137
|
-
private
|
|
143
|
+
private syncLayout;
|
|
138
144
|
setup(root: HTMLElement): void;
|
|
139
145
|
reset(): void;
|
|
140
146
|
cleanUp(): void;
|
|
@@ -144,6 +150,8 @@ declare class CodeView<LAnnotation = undefined> {
|
|
|
144
150
|
setSelectedLines(selection: CodeViewLineSelection | null, options?: SelectionWriteOptions): void;
|
|
145
151
|
getSelectedLines(): CodeViewLineSelection | null;
|
|
146
152
|
clearSelectedLines(options?: SelectionWriteOptions): void;
|
|
153
|
+
getItem(itemId: string): CodeViewItem<LAnnotation> | undefined;
|
|
154
|
+
updateItem(input: CodeViewItem<LAnnotation>): boolean;
|
|
147
155
|
addItem(input: CodeViewItem<LAnnotation>): void;
|
|
148
156
|
addItems(inputs: readonly CodeViewItem<LAnnotation>[]): void;
|
|
149
157
|
setItems(items: readonly CodeViewItem<LAnnotation>[]): void;
|
|
@@ -154,6 +162,7 @@ declare class CodeView<LAnnotation = undefined> {
|
|
|
154
162
|
* once at the end.
|
|
155
163
|
*/
|
|
156
164
|
private appendItemsInternal;
|
|
165
|
+
private canSkipRenderForAppend;
|
|
157
166
|
setOptions(options: CodeViewOptions<LAnnotation> | undefined): void;
|
|
158
167
|
private capturePendingLayoutAnchor;
|
|
159
168
|
render(immediate?: boolean): void;
|
|
@@ -164,7 +173,7 @@ declare class CodeView<LAnnotation = undefined> {
|
|
|
164
173
|
setSlotCoordinator(coordinator?: CodeViewCoordinator<LAnnotation>): boolean;
|
|
165
174
|
getSlotSnapshot(coordinator: CodeViewCoordinator<LAnnotation>): CodeViewRenderedItem<LAnnotation>[] | undefined;
|
|
166
175
|
subscribeToScroll(listener: CodeViewScrollListener<LAnnotation>): () => void;
|
|
167
|
-
|
|
176
|
+
getLocalTopForInstance(instance: VirtualizedFile<LAnnotation> | VirtualizedFileDiff<LAnnotation>): number;
|
|
168
177
|
getTopForItem(id: string): number | undefined;
|
|
169
178
|
private createItem;
|
|
170
179
|
private getItemById;
|
|
@@ -244,6 +253,7 @@ declare class CodeView<LAnnotation = undefined> {
|
|
|
244
253
|
*/
|
|
245
254
|
private resolveAlignedScrollPosition;
|
|
246
255
|
private getLineScrollPosition;
|
|
256
|
+
private getRangeScrollPosition;
|
|
247
257
|
/**
|
|
248
258
|
* Determine target scroll position for current frame.
|
|
249
259
|
*
|
|
@@ -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 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 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 getTopForInstance(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/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cAAAA,CAAAA,CAAAA,EAJ9Cd,kBAI8Cc;EACbJ,mBAAAA,CAAAA,CAAAA,EAJ5BF,WAI4BE,GAAAA,SAAAA;EAAvBO,gBAAAA,CAAAA,CAAAA,EAHRH,oBAGQG,CAHaP,WAGbO,CAAAA,EAAAA;EACgBP,kBAAAA,CAAAA,WAAAA,CAAAA,EAHXM,mBAGWN,CAHSA,WAGTA,CAAAA,CAAAA,EAAAA,OAAAA;EAAhBN,eAAAA,CAAAA,WAAAA,EAFCY,mBAEDZ,CAFqBM,WAErBN,CAAAA,CAAAA,EAFoCU,oBAEpCV,CAFyDM,WAEzDN,CAAAA,EAAAA,GAAAA,SAAAA;EAAmDM,iBAAAA,CAAAA,QAAAA,EADnDO,sBACmDP,CAD5BA,WAC4BA,CAAAA,CAAAA,EAAAA,GAAAA,GAAAA,IAAAA;EAApBL,iBAAAA,CAAAA,QAAAA,EAA/BD,eAA+BC,CAAfK,WAAeL,CAAAA,GAAAA,mBAAAA,CAAoBK,WAApBL,CAAAA,CAAAA,EAAAA,MAAAA;EAAmB,aAAA,CAAA,EAAA,EAAA,MAAA,CAAA,EAAA,MAAA,GAAA,SAAA"}
|
|
1
|
+
{"version":3,"file":"CodeView.d.ts","names":["SelectionWriteOptions","CodeViewDiffItem","CodeViewFileItem","CodeViewItem","CodeViewItemVersion","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"],"sources":["../../src/components/CodeView.d.ts"],"sourcesContent":["import type { SelectionWriteOptions } from '../managers/InteractionManager';\nimport type { CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemVersion, 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: 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 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 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 getItemMetrics;\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":";;;;;;;;;;;UAQUkB,2BAAAA;;;EAAAA;EAaAE,GAAAA,EAAAA,MAAAA;EAGiBC;EAAjBpB,MAAAA,EAAAA,MAAAA;EAEwBoB;;EALqBH,OAAAA,EAJ1CC,WAI0CD,GAAAA,SAAAA;EAA2B;EAOxEI,OAAAA,EATGlB,mBASoB,GAAA,SAAAiB;;UAPvBD,uBAUAlB,CAAAA,WAAAA,CAAAA,SAV6CgB,2BAU7ChB,CAAAA;EAEoBmB,IAAAA,EAAAA,MAAAA;EAAhBN;EALyCG,IAAAA,EAJ7CjB,gBAI6CiB,CAJ5BG,WAI4BH,CAAAA;EAA2B;EAOjEK,QAAAA,EATHP,mBAS2B,CATPK,WASOA,CAAAA;;UAP/BC,uBAUArB,CAAAA,WAAAA,CAAAA,SAV6CiB,2BAU7CjB,CAAAA;EACGG,IAAAA,EAAAA,MAAAA;EACAe;EACqBE,IAAAA,EAVxBnB,gBAUwBmB,CAVPA,WAUOA,CAAAA;EAApBL;EAAmB,QAAA,EARnBD,eAQmB,CARHM,WAQG,CAAA;AAEjC;AAG2BA,UAXVE,wBAWUF,CAAAA,WAAAA,CAAAA,CAAAA;EAAjBnB,EAAAA,EAAAA,MAAAA;EACGE,IAAAA,EAAAA,MAAAA;EACAe,IAAAA,EAVHlB,gBAUGkB,CAVcE,WAUdF,CAAAA;EACiBE,OAAAA,EAVjBjB,mBAUiBiB,GAAAA,SAAAA;EAAhBN,OAAAA,EATDI,WASCJ;EAAe,QAAA,EARfC,mBAQe,CARKK,WAQL,CAAA;AAE7B;AAAyEA,UARxDG,wBAQwDH,CAAAA,WAAAA,CAAAA,CAAAA;EAAzBE,EAAAA,EAAAA,MAAAA;EAA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AAeL,oBAAoBK"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_CODE_VIEW_FILE_METRICS,
|
|
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";
|
|
@@ -147,8 +147,8 @@ var CodeView = class CodeView {
|
|
|
147
147
|
this.stickyContainer.style.display = "flex";
|
|
148
148
|
this.stickyContainer.style.flexDirection = "column";
|
|
149
149
|
}
|
|
150
|
-
|
|
151
|
-
return this.options.
|
|
150
|
+
getLayout() {
|
|
151
|
+
return this.options.layout ?? DEFAULT_CODE_VIEW_LAYOUT;
|
|
152
152
|
}
|
|
153
153
|
getItemMetrics() {
|
|
154
154
|
return this.options.itemMetrics ?? DEFAULT_CODE_VIEW_FILE_METRICS;
|
|
@@ -159,6 +159,33 @@ var CodeView = class CodeView {
|
|
|
159
159
|
shouldDisablePointerEvents() {
|
|
160
160
|
return this.options.pointerEventsOnScroll !== true;
|
|
161
161
|
}
|
|
162
|
+
shouldValidateItemHeights() {
|
|
163
|
+
return DIFFS_DEVELOPMENT_BUILD && this.options.__devOnlyValidateItemHeights === true;
|
|
164
|
+
}
|
|
165
|
+
validateRenderedItemHeight(item) {
|
|
166
|
+
if (!this.shouldValidateItemHeights() || item.element == null) return;
|
|
167
|
+
const stickySpecs = item.instance.getAdvancedStickySpecs();
|
|
168
|
+
if (stickySpecs == null) return;
|
|
169
|
+
const expectedHeight = stickySpecs.height;
|
|
170
|
+
const actualHeight = item.element.getBoundingClientRect().height;
|
|
171
|
+
if (expectedHeight === actualHeight) return;
|
|
172
|
+
console.error("CodeView: reconciled item height does not match DOM height", {
|
|
173
|
+
id: item.item.id,
|
|
174
|
+
type: item.type,
|
|
175
|
+
index: item.index,
|
|
176
|
+
version: item.version,
|
|
177
|
+
expectedHeight,
|
|
178
|
+
actualHeight,
|
|
179
|
+
delta: actualHeight - expectedHeight,
|
|
180
|
+
stickyTopOffset: stickySpecs.topOffset,
|
|
181
|
+
virtualizedHeight: item.instance.getVirtualizedHeight(),
|
|
182
|
+
top: item.top,
|
|
183
|
+
scrollTop: this.getScrollTop(),
|
|
184
|
+
windowSpecs: { ...this.windowSpecs },
|
|
185
|
+
element: item.element,
|
|
186
|
+
instance: item.instance
|
|
187
|
+
});
|
|
188
|
+
}
|
|
162
189
|
clearPointerEventsTimer() {
|
|
163
190
|
if (this.pointerEventsRestoreTimer != null) {
|
|
164
191
|
clearTimeout(this.pointerEventsRestoreTimer);
|
|
@@ -180,8 +207,8 @@ var CodeView = class CodeView {
|
|
|
180
207
|
this.stickyContainer.style.removeProperty("pointer-events");
|
|
181
208
|
this.pointerEventsDisabled = false;
|
|
182
209
|
};
|
|
183
|
-
|
|
184
|
-
const { gap, paddingBottom, paddingTop } = this.
|
|
210
|
+
syncLayout() {
|
|
211
|
+
const { gap, paddingBottom, paddingTop } = this.getLayout();
|
|
185
212
|
this.stickyContainer.style.gap = `${gap}px`;
|
|
186
213
|
this.container?.style.setProperty("margin-top", `${paddingTop}px`);
|
|
187
214
|
this.container?.style.setProperty("margin-bottom", `${paddingBottom}px`);
|
|
@@ -192,7 +219,7 @@ var CodeView = class CodeView {
|
|
|
192
219
|
this.root.style.overflowAnchor = "none";
|
|
193
220
|
this.container ??= document.createElement("div");
|
|
194
221
|
this.container.style.contain = "layout style";
|
|
195
|
-
this.
|
|
222
|
+
this.syncLayout();
|
|
196
223
|
this.container.appendChild(this.stickyOffset);
|
|
197
224
|
this.container.appendChild(this.stickyContainer);
|
|
198
225
|
this.root.appendChild(this.container);
|
|
@@ -304,6 +331,22 @@ var CodeView = class CodeView {
|
|
|
304
331
|
clearSelectedLines(options) {
|
|
305
332
|
this.applySelectedLines(null, options);
|
|
306
333
|
}
|
|
334
|
+
getItem(itemId) {
|
|
335
|
+
return this.idToItem.get(itemId)?.item;
|
|
336
|
+
}
|
|
337
|
+
updateItem(input) {
|
|
338
|
+
const item = this.idToItem.get(input.id);
|
|
339
|
+
if (item == null) {
|
|
340
|
+
console.error(`CodeView.updateItem: unknown item id "${input.id}"`);
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
if (!this.syncItemRecord(item, input)) return false;
|
|
344
|
+
this.markItemLayoutDirty(item);
|
|
345
|
+
this.scrollDirty = true;
|
|
346
|
+
this.render();
|
|
347
|
+
this.syncSelection();
|
|
348
|
+
return true;
|
|
349
|
+
}
|
|
307
350
|
addItem(input) {
|
|
308
351
|
this.addItems([input]);
|
|
309
352
|
this.syncSelection();
|
|
@@ -326,8 +369,9 @@ var CodeView = class CodeView {
|
|
|
326
369
|
*/
|
|
327
370
|
appendItemsInternal(inputs, render = true) {
|
|
328
371
|
if (inputs.length === 0) return;
|
|
329
|
-
const
|
|
330
|
-
let nextTop = this.items.length === 0 ? 0 : this.scrollHeight +
|
|
372
|
+
const layout = this.getLayout();
|
|
373
|
+
let nextTop = this.items.length === 0 ? 0 : this.scrollHeight + layout.gap;
|
|
374
|
+
const appendedTop = nextTop;
|
|
331
375
|
for (let index = 0; index < inputs.length; index++) {
|
|
332
376
|
const input = inputs[index];
|
|
333
377
|
if (input == null) throw new Error("CodeView.appendItemsInternal: missing input item");
|
|
@@ -337,21 +381,25 @@ var CodeView = class CodeView {
|
|
|
337
381
|
this.idToItem.set(item.item.id, item);
|
|
338
382
|
this.instanceToItem.set(item.instance, item);
|
|
339
383
|
item.height = prepareItemInstance(item);
|
|
340
|
-
nextTop += item.height +
|
|
384
|
+
nextTop += item.height + layout.gap;
|
|
341
385
|
}
|
|
342
|
-
this.scrollHeight = nextTop -
|
|
386
|
+
this.scrollHeight = nextTop - layout.gap;
|
|
343
387
|
this.scrollDirty = true;
|
|
344
|
-
if (render) this.
|
|
388
|
+
if (render) if (this.canSkipRenderForAppend(appendedTop)) this.syncContainerHeight();
|
|
389
|
+
else this.render();
|
|
390
|
+
}
|
|
391
|
+
canSkipRenderForAppend(appendedTop) {
|
|
392
|
+
return this.container != null && this.renderState.firstIndex !== -1 && this.pendingScrollTarget == null && this.scrollAnimation == null && this.layoutDirtyIndex == null && appendedTop > this.windowSpecs.bottom;
|
|
345
393
|
}
|
|
346
394
|
setOptions(options) {
|
|
347
395
|
if (options == null) return;
|
|
348
396
|
this.capturePendingLayoutAnchor();
|
|
349
|
-
const
|
|
397
|
+
const previousLayout = this.getLayout();
|
|
350
398
|
const previousItemMetrics = this.getItemMetrics();
|
|
351
399
|
this.options = options;
|
|
352
400
|
const nextItemMetrics = this.getItemMetrics();
|
|
353
401
|
const itemMetricsChanged = !areObjectsEqual(previousItemMetrics, nextItemMetrics);
|
|
354
|
-
if (!areObjectsEqual(
|
|
402
|
+
if (!areObjectsEqual(previousLayout, this.getLayout())) this.syncLayout();
|
|
355
403
|
for (let index = 0; index < this.items.length; index++) {
|
|
356
404
|
const item = this.items[index];
|
|
357
405
|
if (item == null) throw new Error("CodeView.setOptions: invalid item index");
|
|
@@ -427,15 +475,15 @@ var CodeView = class CodeView {
|
|
|
427
475
|
this.scrollListeners.delete(listener);
|
|
428
476
|
};
|
|
429
477
|
}
|
|
430
|
-
|
|
478
|
+
getLocalTopForInstance(instance) {
|
|
431
479
|
const item = this.instanceToItem.get(instance);
|
|
432
|
-
if (item == null) throw new Error("CodeView.
|
|
480
|
+
if (item == null) throw new Error("CodeView.getLocalTopForInstance: unknown virtualized instance");
|
|
433
481
|
return item.top;
|
|
434
482
|
}
|
|
435
483
|
getTopForItem(id) {
|
|
436
484
|
const item = this.idToItem.get(id);
|
|
437
485
|
if (item == null) return;
|
|
438
|
-
return item.top;
|
|
486
|
+
return item.top + this.getLayout().paddingTop;
|
|
439
487
|
}
|
|
440
488
|
createItem(input, index, top) {
|
|
441
489
|
const itemMetrics = this.getItemMetrics();
|
|
@@ -647,7 +695,7 @@ var CodeView = class CodeView {
|
|
|
647
695
|
return true;
|
|
648
696
|
}
|
|
649
697
|
getMaxScrollTopForHeight(scrollHeight) {
|
|
650
|
-
const { paddingBottom, paddingTop } = this.
|
|
698
|
+
const { paddingBottom, paddingTop } = this.getLayout();
|
|
651
699
|
return Math.max(paddingTop + scrollHeight + paddingBottom - this.getHeight(), 0);
|
|
652
700
|
}
|
|
653
701
|
getMaxScrollTop() {
|
|
@@ -734,6 +782,17 @@ var CodeView = class CodeView {
|
|
|
734
782
|
top: item.top,
|
|
735
783
|
height: item.height
|
|
736
784
|
};
|
|
785
|
+
if (target.type === "range") {
|
|
786
|
+
const rangePosition = this.getRangeScrollPosition(item, target);
|
|
787
|
+
if (rangePosition == null) {
|
|
788
|
+
console.warn(`CodeView.scrollTo: unable to resolve range ${formatSelectedLineRange(target.range)} for item "${target.id}"`);
|
|
789
|
+
return;
|
|
790
|
+
}
|
|
791
|
+
return {
|
|
792
|
+
top: item.top + rangePosition.top,
|
|
793
|
+
height: rangePosition.height
|
|
794
|
+
};
|
|
795
|
+
}
|
|
737
796
|
const linePosition = this.getLineScrollPosition(item, target);
|
|
738
797
|
if (linePosition == null) {
|
|
739
798
|
console.warn(`CodeView.scrollTo: unable to resolve line ${target.lineNumber} for item "${target.id}"`);
|
|
@@ -749,10 +808,10 @@ var CodeView = class CodeView {
|
|
|
749
808
|
const rect = this.getScrollTargetRect(target);
|
|
750
809
|
if (rect == null) return;
|
|
751
810
|
const offset = target.offset ?? 0;
|
|
752
|
-
const targetTop = this.
|
|
811
|
+
const targetTop = this.getLayout().paddingTop + rect.top;
|
|
753
812
|
const targetBottom = targetTop + rect.height;
|
|
754
813
|
const currentTop = this.getScrollTop();
|
|
755
|
-
const visibleTop = currentTop + (target.type === "line" ? this.getStickyHeaderOffset() : 0);
|
|
814
|
+
const visibleTop = currentTop + (target.type === "line" || target.type === "range" ? this.getStickyHeaderOffset() : 0);
|
|
756
815
|
const visibleBottom = currentTop + this.getHeight();
|
|
757
816
|
if (targetTop - offset <= visibleTop && targetBottom + offset >= visibleBottom) return;
|
|
758
817
|
if (targetTop - offset < visibleTop) return {
|
|
@@ -780,6 +839,14 @@ var CodeView = class CodeView {
|
|
|
780
839
|
return;
|
|
781
840
|
}
|
|
782
841
|
if (target.type === "item") return this.clampScrollTop(this.resolveAlignedScrollPosition(item.top, item.height, target.align, target.offset));
|
|
842
|
+
if (target.type === "range") {
|
|
843
|
+
const rangePosition = this.getRangeScrollPosition(item, target);
|
|
844
|
+
if (rangePosition == null) {
|
|
845
|
+
console.warn(`CodeView.scrollTo: unable to resolve range ${formatSelectedLineRange(target.range)} for item "${target.id}"`);
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
return this.clampScrollTop(this.resolveAlignedScrollPosition(item.top + rangePosition.top, rangePosition.height, target.align, target.offset, this.getStickyHeaderOffset()));
|
|
849
|
+
}
|
|
783
850
|
const linePosition = this.getLineScrollPosition(item, target);
|
|
784
851
|
if (linePosition == null) {
|
|
785
852
|
console.warn(`CodeView.scrollTo: unable to resolve line ${target.lineNumber} for item "${target.id}"`);
|
|
@@ -793,7 +860,7 @@ var CodeView = class CodeView {
|
|
|
793
860
|
* and stickyOffset if necessary
|
|
794
861
|
*/
|
|
795
862
|
resolveAlignedScrollPosition(targetTop, targetHeight, align, offset = 0, stickyOffset = 0) {
|
|
796
|
-
targetTop += this.
|
|
863
|
+
targetTop += this.getLayout().paddingTop;
|
|
797
864
|
const viewportHeight = this.getHeight();
|
|
798
865
|
if (align === "center" && targetHeight + offset < viewportHeight) return targetTop - (viewportHeight - targetHeight) / 2 + offset;
|
|
799
866
|
if (align === "end") return targetTop - (viewportHeight - targetHeight) + offset;
|
|
@@ -803,6 +870,31 @@ var CodeView = class CodeView {
|
|
|
803
870
|
if (item.type === "diff") return item.instance.getLinePosition(target.lineNumber, target.side);
|
|
804
871
|
return item.instance.getLinePosition(target.lineNumber);
|
|
805
872
|
}
|
|
873
|
+
getRangeScrollPosition(item, target) {
|
|
874
|
+
const { range } = target;
|
|
875
|
+
const startPosition = this.getLineScrollPosition(item, {
|
|
876
|
+
type: "line",
|
|
877
|
+
id: target.id,
|
|
878
|
+
lineNumber: range.start,
|
|
879
|
+
side: range.side
|
|
880
|
+
});
|
|
881
|
+
const endPosition = this.getLineScrollPosition(item, {
|
|
882
|
+
type: "line",
|
|
883
|
+
id: target.id,
|
|
884
|
+
lineNumber: range.end,
|
|
885
|
+
side: range.endSide ?? range.side
|
|
886
|
+
});
|
|
887
|
+
if (startPosition == null || endPosition == null) return;
|
|
888
|
+
const startTop = startPosition.top;
|
|
889
|
+
const startBottom = startTop + startPosition.height;
|
|
890
|
+
const endTop = endPosition.top;
|
|
891
|
+
const endBottom = endTop + endPosition.height;
|
|
892
|
+
const top = Math.min(startTop, endTop);
|
|
893
|
+
return {
|
|
894
|
+
top,
|
|
895
|
+
height: Math.max(startBottom, endBottom) - top
|
|
896
|
+
};
|
|
897
|
+
}
|
|
806
898
|
/**
|
|
807
899
|
* Determine target scroll position for current frame.
|
|
808
900
|
*
|
|
@@ -1029,9 +1121,10 @@ var CodeView = class CodeView {
|
|
|
1029
1121
|
heightChanged = true;
|
|
1030
1122
|
item.height = item.instance.getVirtualizedHeight();
|
|
1031
1123
|
}
|
|
1124
|
+
this.validateRenderedItemHeight(item);
|
|
1032
1125
|
}
|
|
1033
1126
|
currentTop += item.instance.getVirtualizedHeight();
|
|
1034
|
-
if (index < this.items.length - 1) currentTop += this.
|
|
1127
|
+
if (index < this.items.length - 1) currentTop += this.getLayout().gap;
|
|
1035
1128
|
}
|
|
1036
1129
|
if (heightChanged && currentTop != null) {
|
|
1037
1130
|
this.scrollDirty = true;
|
|
@@ -1104,7 +1197,7 @@ var CodeView = class CodeView {
|
|
|
1104
1197
|
for (let index = firstIndex; index <= lastIndex; index++) {
|
|
1105
1198
|
const item = this.items[index];
|
|
1106
1199
|
if (item == null) continue;
|
|
1107
|
-
const absoluteItemTop = this.
|
|
1200
|
+
const absoluteItemTop = this.getLayout().paddingTop + item.top;
|
|
1108
1201
|
if (absoluteItemTop + item.height <= scrollTop) continue;
|
|
1109
1202
|
if (absoluteItemTop >= scrollTop + viewportHeight) break;
|
|
1110
1203
|
if (absoluteItemTop >= scrollTop) return {
|
|
@@ -1136,7 +1229,7 @@ var CodeView = class CodeView {
|
|
|
1136
1229
|
resolveAnchoredScrollTop(anchor) {
|
|
1137
1230
|
const item = this.idToItem.get(anchor.id);
|
|
1138
1231
|
if (item == null) return;
|
|
1139
|
-
const { paddingTop } = this.
|
|
1232
|
+
const { paddingTop } = this.getLayout();
|
|
1140
1233
|
if (anchor.type === "item") {
|
|
1141
1234
|
const absoluteItemTop = paddingTop + item.top;
|
|
1142
1235
|
return this.clampScrollTop(absoluteItemTop - anchor.viewportOffset);
|
|
@@ -1262,12 +1355,12 @@ var CodeView = class CodeView {
|
|
|
1262
1355
|
this.scrollHeight = 0;
|
|
1263
1356
|
return;
|
|
1264
1357
|
}
|
|
1265
|
-
const
|
|
1358
|
+
const layout = this.getLayout();
|
|
1266
1359
|
let runningTop = 0;
|
|
1267
1360
|
if (startIndex > 0) {
|
|
1268
1361
|
const previousItem = this.items[startIndex - 1];
|
|
1269
1362
|
if (previousItem == null) throw new Error("CodeView.recomputeLayout: invalid dirty index");
|
|
1270
|
-
runningTop = previousItem.top + previousItem.height +
|
|
1363
|
+
runningTop = previousItem.top + previousItem.height + layout.gap;
|
|
1271
1364
|
}
|
|
1272
1365
|
for (let index = startIndex; index < this.items.length; index++) {
|
|
1273
1366
|
const item = this.items[index];
|
|
@@ -1276,7 +1369,7 @@ var CodeView = class CodeView {
|
|
|
1276
1369
|
if (item.type === "diff") item.height = item.instance.prepareVirtualizedItem(item.item.fileDiff);
|
|
1277
1370
|
else item.height = item.instance.prepareVirtualizedItem(item.item.file);
|
|
1278
1371
|
runningTop += item.height;
|
|
1279
|
-
if (index < this.items.length - 1) runningTop +=
|
|
1372
|
+
if (index < this.items.length - 1) runningTop += layout.gap;
|
|
1280
1373
|
}
|
|
1281
1374
|
if (runningTop !== this.scrollHeight) this.scrollDirty = true;
|
|
1282
1375
|
this.scrollHeight = runningTop;
|
|
@@ -1290,7 +1383,7 @@ var CodeView = class CodeView {
|
|
|
1290
1383
|
this.renderState.stickyBottom = -1;
|
|
1291
1384
|
}
|
|
1292
1385
|
getFitPerfectlyOverscroll() {
|
|
1293
|
-
return this.
|
|
1386
|
+
return this.getLayout().gap + this.getItemMetrics().diffHeaderHeight;
|
|
1294
1387
|
}
|
|
1295
1388
|
};
|
|
1296
1389
|
function cleanRenderedItem(item) {
|
|
@@ -1303,6 +1396,15 @@ function prepareItemInstance(item) {
|
|
|
1303
1396
|
if (item.type === "diff") return item.instance.prepareVirtualizedItem(item.item.fileDiff);
|
|
1304
1397
|
else return item.instance.prepareVirtualizedItem(item.item.file);
|
|
1305
1398
|
}
|
|
1399
|
+
function formatSelectedLineRange(range) {
|
|
1400
|
+
const start = formatSelectedLinePoint(range.start, range.side);
|
|
1401
|
+
const end = formatSelectedLinePoint(range.end, range.endSide ?? range.side);
|
|
1402
|
+
return start === end ? start : `${start}-${end}`;
|
|
1403
|
+
}
|
|
1404
|
+
function formatSelectedLinePoint(lineNumber, side) {
|
|
1405
|
+
if (side == null) return `${lineNumber}`;
|
|
1406
|
+
return `${side === "deletions" ? "D" : "A"}${lineNumber}`;
|
|
1407
|
+
}
|
|
1306
1408
|
function renderItem(item, fileContainer) {
|
|
1307
1409
|
if (item.type === "diff") return item.instance.render({
|
|
1308
1410
|
deferManagers: true,
|