/** * Generated bundle index. Do not edit. */ import * as i0 from "@angular/core"; import { ElementRef, InjectionToken, InputSignal, OnDestroy, Signal, TemplateRef } from "@angular/core"; /** Represents a range of indices in a list */ export interface ListRange { start: number; end: number; } /** Interface for the VirtualFor directive that the viewport communicates with */ export interface VirtualForOf { /** Get the offset position for an item by index */ getOffsetForIndex(index: number): number; /** Get the height for an item by index */ getHeightForIndex(index: number): number; /** Total height of all content (viewport reads this reactively) */ readonly totalContentHeight: Signal; /** Current visible range (viewport reads this reactively to emit visibleRangeChange) */ readonly visibleRange: Signal; /** Called by viewport when scroll position changes */ updateForScroll(scrollTop: number, viewportHeight: number): void; } /** Interface for the virtual scroll viewport that the directive communicates with */ export interface VirtualScrollViewport { /** Estimated item height for initial calculations */ readonly itemHeight: InputSignal; /** Number of items to render above/below the visible area */ readonly overscan: InputSignal; /** Viewport height - directive reads this for resize updates */ readonly viewportHeight: Signal; /** Register the VirtualFor directive so viewport can call its methods */ setForOf(forOf: VirtualForOf): void; /** Scroll to a specific index */ scrollToIndex(index: number, behavior?: ScrollBehavior): void; /** Scroll an item into view using 'nearest' behavior (minimal scrolling) */ scrollIntoView(index: number): void; /** Get the current DOM scroll position directly (bypassing signal) */ getDomScrollTop(): number; /** Get the current DOM viewport height directly (bypassing signal) */ getDomViewportHeight(): number; /** Check if viewport is currently scrolled to the bottom (using DOM values) */ isAtBottom(): boolean; /** Imperatively update the spacer height on the DOM (bypasses signal/template async) */ updateSpacerHeight(height: number): void; /** Set the scroll position directly */ setScrollTop(scrollTop: number): void; /** Check if scroll is currently active (to avoid interrupting animations) */ isScrollActive(): boolean; } /** Injection token for the virtual scroll viewport */ export declare const NX_VIRTUAL_SCROLL_VIEWPORT: InjectionToken; /** Context provided to templates rendered by NxVirtualFor */ export interface NxVirtualForContext { /** The item data (available as implicit) */ $implicit: T; /** The index in the source array */ index: number; /** Total number of items */ count: number; /** Whether this is the first item */ first: boolean; /** Whether this is the last item */ last: boolean; /** Whether the index is even */ even: boolean; /** Whether the index is odd */ odd: boolean; } /** Context provided to the group template of NxVirtualFor */ export interface NxVirtualForGroupContext { /** The group as returned by `groupBy` */ $implicit: G; } /** Function type for trackBy */ export type TrackByFunction = (index: number, item: T) => unknown; /** Accessor type - can be a property name string or a function */ export type TrackByAccessor = string | TrackByFunction; /** Marks where the items of a group are rendered inside the group template of `nxVirtualFor`. */ export declare class NxVirtualGroupOutlet implements OnDestroy { private readonly _outletRef; private readonly _viewContainerRef; constructor(); ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * Structural directive for rendering items in a virtual scroll viewport. * @example * ```html * *
* {{ item.name }} *
*
* ``` */ export declare class NxVirtualFor implements VirtualForOf { /** The data source (array of items) */ readonly nxVirtualForOf: import("@angular/core").InputSignal; /** Property name or function to use for tracking items */ readonly nxVirtualForTrackBy: import("@angular/core").InputSignal>; /** * Returns the group of an item, or `null` for items without a group. * The rendered items of each group (compared by `groupTrackBy`) are placed in one instance of * `groupTemplate`. The items of a group must be next to each other, the data isn't reordered. */ readonly nxVirtualForGroupBy: import("@angular/core").InputSignal<((item: T) => G | null | undefined) | null>; /** * Property name or function that identifies a group. Defaults to the group itself. * A group that is replaced by an object with the same key keeps its container and items. */ readonly nxVirtualForGroupTrackBy: import("@angular/core").InputSignal unknown)>; /** * Template that wraps the rendered items of each group, e.g. to give them a `role="group"`. * Mark the place of the items with `nxVirtualGroupOutlet`. The wrapper must only contain the * outlet and must not create a containing block, so the items are still positioned in the viewport. */ readonly nxVirtualForGroupTemplate: import("@angular/core").InputSignal> | null>; private readonly _template; private readonly _viewContainerRef; private readonly _viewport; private readonly _ngZone; private readonly _destroyRef; private readonly _injector; private readonly _errorHandler; /** Cache of embedded views by index */ private readonly _viewCache; /** Cache of item keys for efficient view recycling */ private readonly _keyCache; /** Group of each item, `null` for items without a group */ private _itemGroups; /** Group view that contains each rendered item view, `null` for items in the root container */ private readonly _groupCache; /** Rendered group views by group key */ private readonly _groupViews; /** Group template that the rendered group views were created from */ private _groupTemplateInUse; /** Set when the group template has no outlet, items are then rendered without groups */ private _groupTemplateInvalid; private _groupLayoutChecked; private _repeatedGroupWarned; private _renderRafId; private _destroyed; /** Cache of measured heights, keyed by trackBy identity */ private readonly _heightCache; /** Maximum cache size before triggering cleanup */ private readonly _heightCacheMaxSize; /** Cached position data for all items */ private readonly _positionCache; /** Total height of all content (viewport reads this reactively) */ readonly totalContentHeight: import("@angular/core").Signal; /** Current visible range (start and end indices) */ private readonly _visibleRange; /** Public accessor for visible range (viewport reads this reactively to emit visibleRangeChange) */ readonly visibleRange: import("@angular/core").Signal; /** ResizeObserver for monitoring item size changes */ private _itemResizeObserver; /** Set of currently observed elements */ private readonly _observedElements; /** RAF request ID for measurement, set while a measurement is pending */ private _measureRafId; /** Whether initialization is complete */ private _initialized; constructor(); /** * Get the offset position for an item (called by viewport for scrollToIndex) */ getOffsetForIndex(index: number): number; /** * Get the height for an item (called by viewport for scrollIntoView) */ getHeightForIndex(index: number): number; /** trackBy accessor resolved to a function */ private readonly _trackByFn; /** groupTrackBy accessor resolved to a function */ private readonly _groupKeyFn; /** * Get the tracking key for an item */ private _getItemKey; /** * Get the height for an item (cached or estimated) */ private _getItemHeight; /** * Cache the measured height for an item */ private _cacheHeight; /** * Rebuild position cache from data using height cache. * Returns the new total content height. */ private _rebuildPositionCache; private _rebuildItemGroups; private _warnRepeatedGroup; /** * Find the start index for a given scroll position using binary search */ private _findStartIndex; /** * Calculate the visible range based on scroll position and viewport height */ private _calculateVisibleRange; /** * Called by viewport when scroll position changes. * Directly updates visible range and renders items. */ updateForScroll(scrollTop: number, viewportHeight: number): void; /** * Internal helper to update and render using current DOM values * @param forceRender If true, always re-render even if range hasn't changed */ private _updateAndRender; /** * Update the visible range and render items if changed * @param scrollTop Current scroll position * @param viewportHeight Current viewport height * @param forceRender If true, always re-render even if range hasn't changed */ private _updateVisibleRange; /** * Create the template context for an item */ private _createContext; /** * Update an existing context with new values */ private _updateContext; /** * Render items in the given range */ private _renderItems; private _placeView; private _destroyItemView; /** Returns the group view of an item, creating it at `rootIndex` if it doesn't exist yet. */ private _getGroupView; private _createGroupView; /** Destroys a group view together with the item views in it. */ private _destroyGroupView; private _scheduleRender; /** Destroys the group views that no item in the range belongs to. */ private _destroyUnusedGroupViews; private _resetGroupViews; /** Warns once about a group template whose layout would misplace the items. */ private _checkGroupLayout; /** * Set up ResizeObserver to monitor item size changes */ private _setupItemResizeObserver; /** * Schedule a measurement of visible items */ private _scheduleMeasurement; /** * Measure all currently rendered items and update caches */ private _measureRenderedItems; /** Runs outside of change detection, so errors, e.g. a missing group outlet, are reported like there. */ private _forceRender; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵdir: i0.ɵɵDirectiveDeclaration, "[nxVirtualFor][nxVirtualForOf]", never, { "nxVirtualForOf": { "alias": "nxVirtualForOf"; "required": true; "isSignal": true; }; "nxVirtualForTrackBy": { "alias": "nxVirtualForTrackBy"; "required": false; "isSignal": true; }; "nxVirtualForGroupBy": { "alias": "nxVirtualForGroupBy"; "required": false; "isSignal": true; }; "nxVirtualForGroupTrackBy": { "alias": "nxVirtualForGroupTrackBy"; "required": false; "isSignal": true; }; "nxVirtualForGroupTemplate": { "alias": "nxVirtualForGroupTemplate"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>; } /** Event emitted when visible range changes */ export interface VirtualRangeChangeEvent { start: number; end: number; } export declare class NxVirtualViewportComponent implements VirtualScrollViewport { /** Estimated height in pixels for items before measurement (default: 36) */ readonly itemHeight: import("@angular/core").InputSignal; /** Number of items to render above/below the visible area (default: 20) */ readonly overscan: import("@angular/core").InputSignal; /** Emitted when the visible range changes */ readonly visibleRangeChange: import("@angular/core").OutputEmitterRef; readonly _viewport: import("@angular/core").Signal>; readonly _sizer: import("@angular/core").Signal>; private readonly _ngZone; private readonly _destroyRef; private readonly _injector; /** Reference to the VirtualFor directive */ private readonly _virtualFor; /** Viewport height (measured) */ private readonly _viewportHeight; /** RAF request ID for scroll handling */ private _scrollRafId; /** ResizeObserver for monitoring viewport size changes */ private _viewportResizeObserver; /** Whether a smooth scroll animation is in progress */ private _smoothScrollInProgress; /** Target index for smooth scroll (to correct position after animation) */ private _smoothScrollTargetIndex; /** Timeout for detecting smooth scroll completion */ private _smoothScrollTimeout; /** Viewport height - directive reads this for resize updates */ readonly viewportHeight: import("@angular/core").Signal; /** Total content height in pixels (read-only, for template) */ readonly totalHeight: import("@angular/core").Signal; constructor(); /** * Register the VirtualFor directive so viewport can call its methods. * We register it instead of a contentChild query that it is available as early as possible and * for edge cases when the directive would be wrapped in another component. */ setForOf(forOf: VirtualForOf): void; /** * Scroll to a specific index * @param index The index to scroll to * @param behavior Scroll behavior ('auto' | 'smooth') */ scrollToIndex(index: number, behavior?: ScrollBehavior): void; /** * Scroll an item into view using 'nearest' behavior (minimal scrolling) */ scrollIntoView(index: number): void; /** * Set up the scroll event listener with RAF throttling */ private _setupScrollListener; /** * Handle scroll event (called via RAF) */ private _onScroll; /** * Get the current DOM scroll position directly (bypassing signal) */ getDomScrollTop(): number; /** * Get the current DOM viewport height directly (bypassing signal) */ getDomViewportHeight(): number; /** * Check if viewport is currently scrolled to the bottom (using DOM values) */ isAtBottom(): boolean; /** * Imperatively update the spacer height on the DOM. * This bypasses the async signal → computed → template binding cycle, * ensuring the browser has the correct scrollHeight before scrolling. */ updateSpacerHeight(height: number): void; /** * Set the scroll position directly */ setScrollTop(scrollTop: number): void; /** * Check if a smooth scroll animation is in progress */ isScrollActive(): boolean; /** * Measure the viewport height */ private _measureViewportHeight; /** * Set up ResizeObserver to monitor viewport size changes */ private _setupViewportResizeObserver; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class NxVirtualScrollModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; }