@pierre/diffs 1.2.0-beta.0 → 1.2.0-beta.2
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 +26 -5
- package/dist/components/CodeView.d.ts.map +1 -1
- package/dist/components/CodeView.js +194 -82
- package/dist/components/CodeView.js.map +1 -1
- package/dist/components/VirtualizedFile.d.ts +2 -2
- package/dist/components/VirtualizedFile.d.ts.map +1 -1
- package/dist/components/VirtualizedFile.js +5 -4
- package/dist/components/VirtualizedFile.js.map +1 -1
- package/dist/components/VirtualizedFileDiff.d.ts +2 -2
- package/dist/components/VirtualizedFileDiff.d.ts.map +1 -1
- package/dist/components/VirtualizedFileDiff.js +5 -4
- package/dist/components/VirtualizedFileDiff.js.map +1 -1
- package/dist/style.js +1 -1
- package/dist/style.js.map +1 -1
- package/package.json +1 -1
|
@@ -105,8 +105,9 @@ declare class CodeView<LAnnotation = undefined> {
|
|
|
105
105
|
private slotSnapshot;
|
|
106
106
|
private scrollListeners;
|
|
107
107
|
private scrollHeight;
|
|
108
|
-
private
|
|
108
|
+
private containerHeight;
|
|
109
109
|
private scrollTop;
|
|
110
|
+
private scrollPageOffset;
|
|
110
111
|
private scrollDirty;
|
|
111
112
|
private pointerEventsRestoreTimer;
|
|
112
113
|
private pointerEventsDisabled;
|
|
@@ -207,11 +208,27 @@ declare class CodeView<LAnnotation = undefined> {
|
|
|
207
208
|
* intentionally publishes a newer version.
|
|
208
209
|
*/
|
|
209
210
|
private syncItemRecord;
|
|
211
|
+
private getMaxScrollTopForHeight;
|
|
212
|
+
private getMaxScrollTop;
|
|
213
|
+
private shouldRebaseScroll;
|
|
214
|
+
private getPagedScrollHeight;
|
|
215
|
+
private getMaxPagedScrollTop;
|
|
216
|
+
private clampPagedScrollTop;
|
|
210
217
|
/**
|
|
211
|
-
* Clamps a scroll position to the min/max allowable scroll range
|
|
212
|
-
* the computed
|
|
218
|
+
* Clamps a logical scroll position to the min/max allowable scroll range
|
|
219
|
+
* based on the full computed content height.
|
|
213
220
|
*/
|
|
214
221
|
private clampScrollTop;
|
|
222
|
+
private getMaxScrollPageOffset;
|
|
223
|
+
private clampScrollPageOffset;
|
|
224
|
+
private resolveScrollPageWindow;
|
|
225
|
+
/**
|
|
226
|
+
* Resolve how a logical scrollTop maps onto the reusable paged scroll window
|
|
227
|
+
* without mutating the current page offset.
|
|
228
|
+
*/
|
|
229
|
+
private resolvePagedScrollPosition;
|
|
230
|
+
private needsScrollPageUpdate;
|
|
231
|
+
private getPagedLayoutTop;
|
|
215
232
|
private getStickyHeaderOffset;
|
|
216
233
|
private getScrollTargetRect;
|
|
217
234
|
private normalizeScrollTarget;
|
|
@@ -237,7 +254,7 @@ declare class CodeView<LAnnotation = undefined> {
|
|
|
237
254
|
* smooth scroll animation or not. If not just return the destination, or
|
|
238
255
|
* compute next position given the smooth scroll spring physics
|
|
239
256
|
*/
|
|
240
|
-
private
|
|
257
|
+
private computeTargetScrollTopForFrame;
|
|
241
258
|
/**
|
|
242
259
|
* Closed-form critical-damped ODE step.
|
|
243
260
|
*
|
|
@@ -256,6 +273,10 @@ declare class CodeView<LAnnotation = undefined> {
|
|
|
256
273
|
private advanceScrollAnimation;
|
|
257
274
|
private computeRenderRangeAndEmit;
|
|
258
275
|
private flushManagers;
|
|
276
|
+
private syncContainerHeight;
|
|
277
|
+
private getStickyBounds;
|
|
278
|
+
private applyStickyPositioning;
|
|
279
|
+
private syncPagedScrollScaffolding;
|
|
259
280
|
private reconcileRenderedItems;
|
|
260
281
|
private updateStickyPositioning;
|
|
261
282
|
private handleScroll;
|
|
@@ -284,7 +305,7 @@ declare class CodeView<LAnnotation = undefined> {
|
|
|
284
305
|
private resolveAnchoredScrollTop;
|
|
285
306
|
/**
|
|
286
307
|
* Apply a device-pixel-rounded scroll position if it differs from the last
|
|
287
|
-
*
|
|
308
|
+
* logical scrollTop synchronized into the paged scroll scaffold.
|
|
288
309
|
*/
|
|
289
310
|
private applyScrollFix;
|
|
290
311
|
/**
|
|
@@ -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 lastContainerHeight;\n private scrollTop;\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 /**\n * Clamps a scroll position to the min/max allowable scroll range based on\n * the computed total height\n */\n private clampScrollTop;\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 computeFrameScrollTop;\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 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 * rendered/applied scrollTop we've already recorded in renderState.\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,EAVxBlB,gBAUwBkB,CAVPA,WAUOA,CAAAA;EAApBL;EAAmB,QAAA,EARnBD,eAQmB,CARHM,WAQG,CAAA;AAEjC;AAG2BA,UAXVE,wBAWUF,CAAAA,WAAAA,CAAAA,CAAAA;EAAjBlB,EAAAA,EAAAA,MAAAA;EACGE,IAAAA,EAAAA,MAAAA;EACAc,IAAAA,EAVHjB,gBAUGiB,CAVcE,WAUdF,CAAAA;EACiBE,OAAAA,EAVjBhB,mBAUiBgB,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;EAAiEF,IAAAA,EAAAA,MAAAA;EAAzBG,I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AAA,MAAAA;EAApBL,aAAAA,CAAAA,EAAAA,EAAAA,MAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAAmB,QAAA,UAAA"}
|
|
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/BC,uBAUApB,CAAAA,WAAAA,CAAAA,SAV6CgB,2BAU7ChB,CAAAA;EACGG,IAAAA,EAAAA,MAAAA;EACAc;EACqBE,IAAAA,EAVxBlB,gBAUwBkB,CAVPA,WAUOA,CAAAA;EAApBL;EAAmB,QAAA,EARnBD,eAQmB,CARHM,WAQG,CAA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A,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"}
|
|
@@ -81,6 +81,11 @@ const CODE_VIEW_SELECTION_CALLBACK_KEYS = [
|
|
|
81
81
|
"onLineSelectionEnd"
|
|
82
82
|
];
|
|
83
83
|
const DEFAULT_POINTER_EVENTS_RESTORE_DELAY_MS = 120;
|
|
84
|
+
const SCROLL_REBASE_CONTAINER_HEIGHT = 12e6;
|
|
85
|
+
const SCROLL_REBASE_TRIGGER_TOP = 1e6;
|
|
86
|
+
const SCROLL_REBASE_TARGET_TOP = 2e6;
|
|
87
|
+
const SCROLL_REBASE_TARGET_BOTTOM = SCROLL_REBASE_CONTAINER_HEIGHT - SCROLL_REBASE_TARGET_TOP;
|
|
88
|
+
const SCROLL_REBASE_THRESHOLD = SCROLL_REBASE_CONTAINER_HEIGHT - SCROLL_REBASE_TRIGGER_TOP;
|
|
84
89
|
var CodeView = class CodeView {
|
|
85
90
|
static __STOP = false;
|
|
86
91
|
static __lastScrollPosition = 0;
|
|
@@ -99,8 +104,9 @@ var CodeView = class CodeView {
|
|
|
99
104
|
slotSnapshot;
|
|
100
105
|
scrollListeners = /* @__PURE__ */ new Set();
|
|
101
106
|
scrollHeight = 0;
|
|
102
|
-
|
|
107
|
+
containerHeight = -1;
|
|
103
108
|
scrollTop = 0;
|
|
109
|
+
scrollPageOffset = 0;
|
|
104
110
|
scrollDirty = true;
|
|
105
111
|
pointerEventsRestoreTimer;
|
|
106
112
|
pointerEventsDisabled = false;
|
|
@@ -183,8 +189,9 @@ var CodeView = class CodeView {
|
|
|
183
189
|
setup(root) {
|
|
184
190
|
if (this.root != null) throw new Error("CodeView.setup: already setup");
|
|
185
191
|
this.root = root;
|
|
192
|
+
this.root.style.overflowAnchor = "none";
|
|
186
193
|
this.container ??= document.createElement("div");
|
|
187
|
-
this.container.style.contain = "layout
|
|
194
|
+
this.container.style.contain = "layout style";
|
|
188
195
|
this.syncViewerMetrics();
|
|
189
196
|
this.container.appendChild(this.stickyOffset);
|
|
190
197
|
this.container.appendChild(this.stickyContainer);
|
|
@@ -226,6 +233,7 @@ var CodeView = class CodeView {
|
|
|
226
233
|
this.stickyContainer.textContent = "";
|
|
227
234
|
this.stickyOffset.style.height = "";
|
|
228
235
|
this.container?.style.removeProperty("height");
|
|
236
|
+
this.containerHeight = -1;
|
|
229
237
|
this.windowSpecs = {
|
|
230
238
|
top: 0,
|
|
231
239
|
bottom: 0
|
|
@@ -233,6 +241,7 @@ var CodeView = class CodeView {
|
|
|
233
241
|
this.pendingLayoutAnchor = void 0;
|
|
234
242
|
this.height = 0;
|
|
235
243
|
this.scrollTop = 0;
|
|
244
|
+
this.scrollPageOffset = 0;
|
|
236
245
|
this.scrollHeight = 0;
|
|
237
246
|
this.scrollDirty = true;
|
|
238
247
|
this.heightDirty = true;
|
|
@@ -249,6 +258,7 @@ var CodeView = class CodeView {
|
|
|
249
258
|
this.root?.removeEventListener("touchstart", this.clearPendingScroll);
|
|
250
259
|
this.root?.removeEventListener("pointerdown", this.clearPendingScroll);
|
|
251
260
|
this.root?.removeEventListener("keydown", this.clearPendingScroll);
|
|
261
|
+
this.root?.style.removeProperty("overflow-anchor");
|
|
252
262
|
this.container?.remove();
|
|
253
263
|
this.stickyOffset.remove();
|
|
254
264
|
this.stickyContainer.remove();
|
|
@@ -636,15 +646,81 @@ var CodeView = class CodeView {
|
|
|
636
646
|
else item.instance.setOptions(this.createOptions(item.item));
|
|
637
647
|
return true;
|
|
638
648
|
}
|
|
649
|
+
getMaxScrollTopForHeight(scrollHeight) {
|
|
650
|
+
const { paddingBottom, paddingTop } = this.getViewerMetrics();
|
|
651
|
+
return Math.max(paddingTop + scrollHeight + paddingBottom - this.getHeight(), 0);
|
|
652
|
+
}
|
|
653
|
+
getMaxScrollTop() {
|
|
654
|
+
return this.getMaxScrollTopForHeight(this.getScrollHeight());
|
|
655
|
+
}
|
|
656
|
+
shouldRebaseScroll() {
|
|
657
|
+
return this.getMaxScrollTop() > SCROLL_REBASE_THRESHOLD;
|
|
658
|
+
}
|
|
659
|
+
getPagedScrollHeight() {
|
|
660
|
+
return this.shouldRebaseScroll() ? Math.min(this.getScrollHeight(), SCROLL_REBASE_CONTAINER_HEIGHT) : this.getScrollHeight();
|
|
661
|
+
}
|
|
662
|
+
getMaxPagedScrollTop() {
|
|
663
|
+
return this.getMaxScrollTopForHeight(this.getPagedScrollHeight());
|
|
664
|
+
}
|
|
665
|
+
clampPagedScrollTop(value) {
|
|
666
|
+
const maxScroll = this.getMaxPagedScrollTop();
|
|
667
|
+
return Math.max(0, Math.min(value, maxScroll));
|
|
668
|
+
}
|
|
639
669
|
/**
|
|
640
|
-
* Clamps a scroll position to the min/max allowable scroll range
|
|
641
|
-
* the computed
|
|
670
|
+
* Clamps a logical scroll position to the min/max allowable scroll range
|
|
671
|
+
* based on the full computed content height.
|
|
642
672
|
*/
|
|
643
673
|
clampScrollTop(value) {
|
|
644
|
-
const
|
|
645
|
-
const maxScroll = Math.max(paddingTop + this.getScrollHeight() + paddingBottom - this.getHeight(), 0);
|
|
674
|
+
const maxScroll = this.getMaxScrollTop();
|
|
646
675
|
return Math.max(0, Math.min(value, maxScroll));
|
|
647
676
|
}
|
|
677
|
+
getMaxScrollPageOffset() {
|
|
678
|
+
return Math.max(this.getMaxScrollTop() - this.getMaxPagedScrollTop(), 0);
|
|
679
|
+
}
|
|
680
|
+
clampScrollPageOffset(value) {
|
|
681
|
+
const maxOffset = this.getMaxScrollPageOffset();
|
|
682
|
+
return Math.max(0, Math.min(value, maxOffset));
|
|
683
|
+
}
|
|
684
|
+
resolveScrollPageWindow(scrollTop, preferredPagedScrollTop) {
|
|
685
|
+
let pagedScrollTop = roundToDevicePixel(this.clampPagedScrollTop(preferredPagedScrollTop));
|
|
686
|
+
let scrollPageOffset = this.clampScrollPageOffset(scrollTop - pagedScrollTop);
|
|
687
|
+
pagedScrollTop = roundToDevicePixel(this.clampPagedScrollTop(scrollTop - scrollPageOffset));
|
|
688
|
+
scrollPageOffset = this.clampScrollPageOffset(scrollTop - pagedScrollTop);
|
|
689
|
+
return {
|
|
690
|
+
pagedScrollTop,
|
|
691
|
+
scrollPageOffset
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Resolve how a logical scrollTop maps onto the reusable paged scroll window
|
|
696
|
+
* without mutating the current page offset.
|
|
697
|
+
*/
|
|
698
|
+
resolvePagedScrollPosition(logicalScrollTop) {
|
|
699
|
+
if (!this.shouldRebaseScroll()) return {
|
|
700
|
+
pagedScrollTop: this.clampPagedScrollTop(logicalScrollTop),
|
|
701
|
+
scrollPageOffset: 0
|
|
702
|
+
};
|
|
703
|
+
const currentPageOffset = this.clampScrollPageOffset(this.scrollPageOffset);
|
|
704
|
+
const pagedScrollTop = logicalScrollTop - currentPageOffset;
|
|
705
|
+
const pagedMaxScrollTop = this.getMaxPagedScrollTop();
|
|
706
|
+
const maxRebaseOffset = this.getMaxScrollPageOffset();
|
|
707
|
+
const shouldMoveDown = pagedScrollTop > SCROLL_REBASE_THRESHOLD && currentPageOffset < maxRebaseOffset;
|
|
708
|
+
const shouldMoveUp = pagedScrollTop < SCROLL_REBASE_TRIGGER_TOP && currentPageOffset > 0;
|
|
709
|
+
if (pagedScrollTop < 0 || pagedScrollTop > pagedMaxScrollTop || shouldMoveDown || shouldMoveUp) return this.resolveScrollPageWindow(logicalScrollTop, shouldMoveUp ? Math.min(SCROLL_REBASE_TARGET_BOTTOM, pagedMaxScrollTop) : SCROLL_REBASE_TARGET_TOP);
|
|
710
|
+
return {
|
|
711
|
+
pagedScrollTop: roundToDevicePixel(this.clampPagedScrollTop(pagedScrollTop)),
|
|
712
|
+
scrollPageOffset: currentPageOffset
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
needsScrollPageUpdate(logicalScrollTop) {
|
|
716
|
+
const roundedScrollTop = roundToDevicePixel(this.clampScrollTop(logicalScrollTop));
|
|
717
|
+
const { scrollPageOffset } = this.resolvePagedScrollPosition(roundedScrollTop);
|
|
718
|
+
return scrollPageOffset !== this.scrollPageOffset;
|
|
719
|
+
}
|
|
720
|
+
getPagedLayoutTop(logicalTop) {
|
|
721
|
+
if (!this.shouldRebaseScroll()) return logicalTop;
|
|
722
|
+
return Math.max(logicalTop - this.scrollPageOffset, 0);
|
|
723
|
+
}
|
|
648
724
|
getStickyHeaderOffset() {
|
|
649
725
|
return this.options.stickyHeaders === true && this.options.disableFileHeader !== true ? this.getItemMetrics().diffHeaderHeight : 0;
|
|
650
726
|
}
|
|
@@ -737,7 +813,7 @@ var CodeView = class CodeView {
|
|
|
737
813
|
* smooth scroll animation or not. If not just return the destination, or
|
|
738
814
|
* compute next position given the smooth scroll spring physics
|
|
739
815
|
*/
|
|
740
|
-
|
|
816
|
+
computeTargetScrollTopForFrame(scrollTop, frameTimestamp) {
|
|
741
817
|
if (this.pendingScrollTarget == null) return scrollTop;
|
|
742
818
|
const destination = this.resolveScrollTargetTop(this.pendingScrollTarget);
|
|
743
819
|
if (destination == null) return scrollTop;
|
|
@@ -796,48 +872,50 @@ var CodeView = class CodeView {
|
|
|
796
872
|
}
|
|
797
873
|
computeRenderRangeAndEmit = (timestamp = performance.now()) => {
|
|
798
874
|
if (CodeView.__STOP || this.container == null) return;
|
|
799
|
-
const
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
let
|
|
803
|
-
let
|
|
875
|
+
const viewportHeight = this.getHeight();
|
|
876
|
+
const initialScrollTop = this.getScrollTop();
|
|
877
|
+
let scrollTopAfterLayout = initialScrollTop;
|
|
878
|
+
let computeScrollCorrection = this.pendingLayoutAnchor != null;
|
|
879
|
+
let scrollAnchor = this.getScrollAnchor(scrollTopAfterLayout);
|
|
804
880
|
if (this.layoutDirtyIndex != null) {
|
|
805
881
|
this.recomputeLayout(this.layoutDirtyIndex);
|
|
806
882
|
this.layoutDirtyIndex = void 0;
|
|
807
|
-
|
|
883
|
+
computeScrollCorrection = true;
|
|
808
884
|
}
|
|
809
|
-
if (
|
|
810
|
-
const
|
|
811
|
-
if (
|
|
812
|
-
const
|
|
813
|
-
|
|
814
|
-
if (this.scrollAnimation != null) this.scrollAnimation.position +=
|
|
885
|
+
if (computeScrollCorrection && scrollAnchor != null) {
|
|
886
|
+
const anchoredScrollTopAfterLayout = this.resolveAnchoredScrollTop(scrollAnchor);
|
|
887
|
+
if (anchoredScrollTopAfterLayout != null) {
|
|
888
|
+
const layoutAnchorDelta = anchoredScrollTopAfterLayout - scrollTopAfterLayout;
|
|
889
|
+
scrollTopAfterLayout = anchoredScrollTopAfterLayout;
|
|
890
|
+
if (this.scrollAnimation != null) this.scrollAnimation.position += layoutAnchorDelta;
|
|
815
891
|
}
|
|
816
892
|
}
|
|
817
|
-
if (
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
let appliedScrollTop = currentRootScrollTop;
|
|
821
|
-
if (this.pendingScrollTarget != null && frameScrollTop !== appliedScrollTop) {
|
|
822
|
-
this.applyScrollFix(frameScrollTop, appliedScrollTop);
|
|
823
|
-
appliedScrollTop = frameScrollTop;
|
|
893
|
+
if (computeScrollCorrection) {
|
|
894
|
+
scrollTopAfterLayout = this.clampScrollTop(scrollTopAfterLayout);
|
|
895
|
+
this.syncContainerHeight();
|
|
824
896
|
}
|
|
825
|
-
|
|
897
|
+
const targetScrollTop = this.computeTargetScrollTopForFrame(scrollTopAfterLayout, timestamp);
|
|
898
|
+
const fitPerfectly = !computeScrollCorrection && (this.renderState.scrollTop === -1 || Math.abs(targetScrollTop - this.renderState.scrollTop) > viewportHeight + this.config.overscrollSize * 2);
|
|
899
|
+
if (fitPerfectly) scrollAnchor = void 0;
|
|
826
900
|
this.windowSpecs = createWindowFromScrollPosition({
|
|
827
|
-
scrollTop:
|
|
828
|
-
height,
|
|
901
|
+
scrollTop: targetScrollTop,
|
|
902
|
+
height: viewportHeight,
|
|
829
903
|
scrollHeight: this.getScrollHeight(),
|
|
830
904
|
fitPerfectly,
|
|
831
905
|
fitPerfectlyOverscroll: this.getFitPerfectlyOverscroll(),
|
|
832
906
|
overscrollSize: this.config.overscrollSize
|
|
833
907
|
});
|
|
908
|
+
let syncedScrollTop = initialScrollTop;
|
|
909
|
+
if (this.pendingScrollTarget != null && targetScrollTop !== syncedScrollTop || this.needsScrollPageUpdate(targetScrollTop)) {
|
|
910
|
+
this.applyScrollFix(targetScrollTop, syncedScrollTop, this.windowSpecs);
|
|
911
|
+
syncedScrollTop = targetScrollTop;
|
|
912
|
+
}
|
|
834
913
|
const { top, bottom } = this.windowSpecs;
|
|
835
914
|
const { firstIndex, lastIndex } = this.renderState;
|
|
836
915
|
if (firstIndex >= 0) for (let index = firstIndex; index <= lastIndex; index++) {
|
|
837
916
|
const item = this.items[index];
|
|
838
917
|
if (item == null) throw new Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${index}`);
|
|
839
|
-
|
|
840
|
-
if (!(renderedTop > top - item.height && renderedTop <= bottom)) cleanRenderedItem(item);
|
|
918
|
+
if (!(item.top > top - item.height && item.top <= bottom)) cleanRenderedItem(item);
|
|
841
919
|
}
|
|
842
920
|
let prevElement;
|
|
843
921
|
const updatedItems = /* @__PURE__ */ new Set();
|
|
@@ -863,37 +941,74 @@ var CodeView = class CodeView {
|
|
|
863
941
|
this.renderState.lastIndex = lastRenderedIndex;
|
|
864
942
|
this.flushSlotCoordinator();
|
|
865
943
|
this.reconcileRenderedItems(updatedItems);
|
|
944
|
+
this.syncContainerHeight();
|
|
866
945
|
this.updateStickyPositioning();
|
|
867
|
-
const
|
|
868
|
-
if (
|
|
869
|
-
const
|
|
870
|
-
let
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
}
|
|
883
|
-
} else renderedScrollTop = currentScrollTop;
|
|
946
|
+
const anchoredScrollTopAfterRender = scrollAnchor != null ? this.resolveAnchoredScrollTop(scrollAnchor) : void 0;
|
|
947
|
+
if (scrollAnchor === this.pendingLayoutAnchor) this.pendingLayoutAnchor = void 0;
|
|
948
|
+
const postRenderAnchorDelta = anchoredScrollTopAfterRender != null ? anchoredScrollTopAfterRender - scrollTopAfterLayout : 0;
|
|
949
|
+
let postRenderScrollTop = targetScrollTop;
|
|
950
|
+
let shouldCheckPendingTargetSettled = false;
|
|
951
|
+
if (this.pendingScrollTarget != null) {
|
|
952
|
+
const pendingTargetScrollTop = this.advanceScrollAnimation(timestamp, postRenderAnchorDelta);
|
|
953
|
+
if (pendingTargetScrollTop != null) {
|
|
954
|
+
postRenderScrollTop = pendingTargetScrollTop;
|
|
955
|
+
shouldCheckPendingTargetSettled = true;
|
|
956
|
+
} else postRenderScrollTop = scrollTopAfterLayout;
|
|
957
|
+
} else postRenderScrollTop = anchoredScrollTopAfterRender ?? targetScrollTop;
|
|
958
|
+
if (postRenderScrollTop !== syncedScrollTop) {
|
|
959
|
+
this.applyScrollFix(postRenderScrollTop, syncedScrollTop, this.windowSpecs);
|
|
960
|
+
syncedScrollTop = postRenderScrollTop;
|
|
884
961
|
}
|
|
885
|
-
this.
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
this.container.style.height = `${totalScrollHeight}px`;
|
|
889
|
-
this.lastContainerHeight = totalScrollHeight;
|
|
962
|
+
if (shouldCheckPendingTargetSettled && this.pendingScrollTarget != null && this.isPendingTargetSettled(this.pendingScrollTarget)) {
|
|
963
|
+
this.pendingScrollTarget = void 0;
|
|
964
|
+
this.scrollAnimation = void 0;
|
|
890
965
|
}
|
|
966
|
+
this.renderState.scrollTop = roundToDevicePixel(syncedScrollTop);
|
|
891
967
|
this.flushManagers(updatedItems);
|
|
892
968
|
if (fitPerfectly || this.scrollAnimation != null) this.render();
|
|
893
969
|
};
|
|
894
970
|
flushManagers(updatedItems) {
|
|
895
971
|
for (const item of updatedItems) item.instance.flushManagers();
|
|
896
972
|
}
|
|
973
|
+
syncContainerHeight() {
|
|
974
|
+
const pagedScrollHeight = this.getPagedScrollHeight();
|
|
975
|
+
if (this.container == null || this.containerHeight === pagedScrollHeight) return;
|
|
976
|
+
this.container.style.height = `${pagedScrollHeight}px`;
|
|
977
|
+
this.containerHeight = pagedScrollHeight;
|
|
978
|
+
}
|
|
979
|
+
getStickyBounds(windowSpecs) {
|
|
980
|
+
const { firstIndex, lastIndex } = windowSpecs != null ? {
|
|
981
|
+
firstIndex: this.findFirstVisibleIndex(windowSpecs.top),
|
|
982
|
+
lastIndex: this.findLastVisibleIndex(windowSpecs.bottom)
|
|
983
|
+
} : this.renderState;
|
|
984
|
+
if (firstIndex === -1 || lastIndex === -1 || firstIndex > lastIndex) return;
|
|
985
|
+
const firstStickySpecs = this.items[firstIndex]?.instance.getAdvancedStickySpecs(windowSpecs);
|
|
986
|
+
const lastStickySpecs = this.items[lastIndex]?.instance.getAdvancedStickySpecs(windowSpecs);
|
|
987
|
+
if (firstStickySpecs == null || lastStickySpecs == null) return;
|
|
988
|
+
return {
|
|
989
|
+
stickyTop: this.getPagedLayoutTop(Math.max(firstStickySpecs.topOffset, 0)),
|
|
990
|
+
stickyBottom: this.getPagedLayoutTop(lastStickySpecs.topOffset + lastStickySpecs.height)
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
applyStickyPositioning({ stickyTop, stickyBottom }) {
|
|
994
|
+
const height = this.getHeight();
|
|
995
|
+
const itemMetrics = this.getItemMetrics();
|
|
996
|
+
const stickyContainerHeight = stickyBottom - stickyTop;
|
|
997
|
+
this.renderState.stickyHeight = stickyContainerHeight;
|
|
998
|
+
this.renderState.stickyTop = stickyTop;
|
|
999
|
+
this.renderState.stickyBottom = stickyBottom;
|
|
1000
|
+
this.stickyOffset.style.height = `${stickyTop}px`;
|
|
1001
|
+
const randomOffset = (Math.random() * itemMetrics.lineHeight >> 0) * -1;
|
|
1002
|
+
const stickyJitter = -Math.max(stickyContainerHeight + randomOffset, 0) + height;
|
|
1003
|
+
this.stickyContainer.style.top = `${stickyJitter}px`;
|
|
1004
|
+
this.stickyContainer.style.bottom = `${stickyJitter + itemMetrics.diffHeaderHeight}px`;
|
|
1005
|
+
}
|
|
1006
|
+
syncPagedScrollScaffolding(windowSpecs) {
|
|
1007
|
+
this.syncContainerHeight();
|
|
1008
|
+
const stickyBounds = this.getStickyBounds(windowSpecs);
|
|
1009
|
+
if (stickyBounds == null) return;
|
|
1010
|
+
this.applyStickyPositioning(stickyBounds);
|
|
1011
|
+
}
|
|
897
1012
|
reconcileRenderedItems(updatedItems) {
|
|
898
1013
|
const { firstIndex, lastIndex } = this.renderState;
|
|
899
1014
|
if (firstIndex === -1) return;
|
|
@@ -924,24 +1039,11 @@ var CodeView = class CodeView {
|
|
|
924
1039
|
}
|
|
925
1040
|
}
|
|
926
1041
|
updateStickyPositioning() {
|
|
927
|
-
const
|
|
928
|
-
|
|
929
|
-
const
|
|
930
|
-
if (
|
|
931
|
-
|
|
932
|
-
const itemMetrics = this.getItemMetrics();
|
|
933
|
-
const stickyTop = Math.max(firstStickySpecs.topOffset, 0);
|
|
934
|
-
const stickyBottom = lastStickySpecs.topOffset + lastStickySpecs.height;
|
|
935
|
-
const stickyContainerHeight = stickyBottom - stickyTop;
|
|
936
|
-
if (stickyContainerHeight === this.renderState.stickyHeight && stickyTop === this.renderState.stickyTop && stickyBottom === this.renderState.stickyBottom) return;
|
|
937
|
-
this.renderState.stickyHeight = stickyContainerHeight;
|
|
938
|
-
this.renderState.stickyTop = stickyTop;
|
|
939
|
-
this.renderState.stickyBottom = stickyBottom;
|
|
940
|
-
this.stickyOffset.style.height = `${stickyTop}px`;
|
|
941
|
-
const randomOffset = (Math.random() * itemMetrics.lineHeight >> 0) * -1;
|
|
942
|
-
const stickyJitter = -Math.max(stickyContainerHeight + randomOffset, 0) + height;
|
|
943
|
-
this.stickyContainer.style.top = `${stickyJitter}px`;
|
|
944
|
-
this.stickyContainer.style.bottom = `${stickyJitter + itemMetrics.diffHeaderHeight}px`;
|
|
1042
|
+
const stickyBounds = this.getStickyBounds();
|
|
1043
|
+
if (stickyBounds == null) return;
|
|
1044
|
+
const { stickyTop, stickyBottom } = stickyBounds;
|
|
1045
|
+
if (stickyBottom - stickyTop === this.renderState.stickyHeight && stickyTop === this.renderState.stickyTop && stickyBottom === this.renderState.stickyBottom) return;
|
|
1046
|
+
this.applyStickyPositioning(stickyBounds);
|
|
945
1047
|
}
|
|
946
1048
|
handleScroll = () => {
|
|
947
1049
|
if (CodeView.__STOP) return;
|
|
@@ -965,7 +1067,7 @@ var CodeView = class CodeView {
|
|
|
965
1067
|
const anchoredScrollTop = anchor != null ? this.resolveAnchoredScrollTop(anchor) : void 0;
|
|
966
1068
|
if (anchoredScrollTop != null) {
|
|
967
1069
|
const resizeAnchorDelta = anchoredScrollTop - currentScrollTop;
|
|
968
|
-
this.applyScrollFix(anchoredScrollTop, currentScrollTop);
|
|
1070
|
+
this.applyScrollFix(anchoredScrollTop, currentScrollTop, this.windowSpecs);
|
|
969
1071
|
if (this.scrollAnimation != null) this.scrollAnimation.position += resizeAnchorDelta;
|
|
970
1072
|
}
|
|
971
1073
|
if (this.pendingScrollTarget != null && this.isPendingTargetSettled(this.pendingScrollTarget)) {
|
|
@@ -1046,20 +1148,29 @@ var CodeView = class CodeView {
|
|
|
1046
1148
|
}
|
|
1047
1149
|
/**
|
|
1048
1150
|
* Apply a device-pixel-rounded scroll position if it differs from the last
|
|
1049
|
-
*
|
|
1151
|
+
* logical scrollTop synchronized into the paged scroll scaffold.
|
|
1050
1152
|
*/
|
|
1051
|
-
applyScrollFix(
|
|
1153
|
+
applyScrollFix(targetScrollTop, syncedScrollTop, windowSpecs) {
|
|
1052
1154
|
if (this.root == null) return;
|
|
1053
|
-
const
|
|
1054
|
-
const
|
|
1055
|
-
|
|
1155
|
+
const roundedTargetScrollTop = roundToDevicePixel(this.clampScrollTop(targetScrollTop));
|
|
1156
|
+
const roundedSyncedScrollTop = roundToDevicePixel(syncedScrollTop);
|
|
1157
|
+
const { scrollPageOffset: previousPageOffset } = this;
|
|
1158
|
+
const syncedPagedScrollTop = roundToDevicePixel(this.clampPagedScrollTop(roundedSyncedScrollTop - previousPageOffset));
|
|
1159
|
+
const { pagedScrollTop, scrollPageOffset } = this.resolvePagedScrollPosition(roundedTargetScrollTop);
|
|
1160
|
+
const targetPagedScrollTop = pagedScrollTop;
|
|
1161
|
+
const rebaseChanged = previousPageOffset !== scrollPageOffset;
|
|
1162
|
+
if (roundedTargetScrollTop === this.renderState.scrollTop && roundedTargetScrollTop === roundedSyncedScrollTop && targetPagedScrollTop === syncedPagedScrollTop && !rebaseChanged) return;
|
|
1056
1163
|
this.suspendPointerEvents();
|
|
1057
|
-
if (
|
|
1058
|
-
|
|
1164
|
+
if (targetPagedScrollTop !== syncedPagedScrollTop || rebaseChanged) {
|
|
1165
|
+
this.scrollPageOffset = scrollPageOffset;
|
|
1166
|
+
this.syncPagedScrollScaffolding(windowSpecs);
|
|
1167
|
+
}
|
|
1168
|
+
if (targetPagedScrollTop !== syncedPagedScrollTop) this.root.scrollTo({
|
|
1169
|
+
top: targetPagedScrollTop,
|
|
1059
1170
|
behavior: "instant"
|
|
1060
1171
|
});
|
|
1061
|
-
this.renderState.scrollTop =
|
|
1062
|
-
this.scrollTop =
|
|
1172
|
+
this.renderState.scrollTop = roundedTargetScrollTop;
|
|
1173
|
+
this.scrollTop = roundedTargetScrollTop;
|
|
1063
1174
|
this.scrollDirty = false;
|
|
1064
1175
|
}
|
|
1065
1176
|
/**
|
|
@@ -1074,7 +1185,8 @@ var CodeView = class CodeView {
|
|
|
1074
1185
|
getScrollTop() {
|
|
1075
1186
|
if (!this.scrollDirty) return this.scrollTop;
|
|
1076
1187
|
this.scrollDirty = false;
|
|
1077
|
-
|
|
1188
|
+
const rootScrollTop = this.root?.scrollTop ?? 0;
|
|
1189
|
+
this.scrollTop = this.clampScrollTop(rootScrollTop + this.scrollPageOffset);
|
|
1078
1190
|
return this.scrollTop;
|
|
1079
1191
|
}
|
|
1080
1192
|
getHeight() {
|