UNPKG

29.3 kBTypeScriptView Raw
1import { IChangedArgs } from '@jupyterlab/coreutils';
2import { IObservableList } from '@jupyterlab/observables';
3import { IDisposable } from '@lumino/disposable';
4import { Message } from '@lumino/messaging';
5import { ISignal, Signal } from '@lumino/signaling';
6import { PanelLayout, Widget } from '@lumino/widgets';
7/**
8 * Windowed list abstract model.
9 */
10export declare abstract class WindowedListModel implements WindowedList.IModel {
11 /**
12 * Constructor
13 *
14 * @param options Constructor options
15 */
16 constructor(options?: WindowedList.IModelOptions);
17 /**
18 * Provide a best guess for the widget size at position index
19 *
20 * #### Notes
21 *
22 * This function should be very light to compute especially when
23 * returning the default size.
24 * The default value should be constant (i.e. two calls with `null` should
25 * return the same value). But it can change for a given `index`.
26 *
27 * @param index Widget position
28 * @returns Estimated widget size
29 */
30 abstract estimateWidgetSize: (index: number) => number;
31 /**
32 * Widget factory for the list items.
33 *
34 * Caching the resulting widgets should be done by the callee.
35 *
36 * @param index List index
37 * @returns The widget at the given position
38 */
39 abstract widgetRenderer: (index: number) => Widget;
40 /**
41 * The overlap threshold used to decide whether to scroll down to an item
42 * below the viewport (smart mode). If the item overlap with the viewport
43 * is greater or equal this threshold the item is considered sufficiently
44 * visible and will not be scrolled to. The value is the number of pixels
45 * in overlap if greater than one, or otherwise a fraction of item height.
46 * By default the item is scrolled to if not full visible in the viewport.
47 */
48 readonly scrollDownThreshold: number;
49 /**
50 * The underlap threshold used to decide whether to scroll up to an item
51 * above the viewport (smart mode). If the item part outside the viewport
52 * (underlap) is greater than this threshold then the item is considered
53 * not sufficiently visible and will be scrolled to.
54 * The value is the number of pixels in underlap if greater than one, or
55 * otherwise a fraction of the item height.
56 * By default the item is scrolled to if not full visible in the viewport.
57 */
58 readonly scrollUpThreshold: number;
59 /**
60 * Top padding of the the outer window node.
61 */
62 paddingTop: number;
63 /**
64 * List widget height
65 */
66 get height(): number;
67 set height(h: number);
68 /**
69 * Test whether the model is disposed.
70 */
71 get isDisposed(): boolean;
72 /**
73 * Items list to be rendered
74 */
75 get itemsList(): ISimpleObservableList | null;
76 set itemsList(v: ISimpleObservableList | null);
77 /**
78 * Number of widgets to render in addition to those
79 * visible in the viewport.
80 */
81 get overscanCount(): number;
82 set overscanCount(newValue: number);
83 /**
84 * Viewport scroll offset.
85 */
86 get scrollOffset(): number;
87 set scrollOffset(offset: number);
88 /**
89 * Total number of widgets in the list
90 */
91 get widgetCount(): number;
92 set widgetCount(newValue: number);
93 /**
94 * Whether windowing is active or not.
95 *
96 * This is true by default.
97 */
98 get windowingActive(): boolean;
99 set windowingActive(newValue: boolean);
100 /**
101 * A signal emitted when any model state changes.
102 */
103 get stateChanged(): ISignal<WindowedListModel, IChangedArgs<any, any, 'count' | 'estimatedWidgetSize' | 'index' | 'list' | 'overscanCount' | 'windowingActive' | string>>;
104 /**
105 * Dispose the model.
106 */
107 dispose(): void;
108 /**
109 * Get the total list size.
110 *
111 * @returns Total estimated size
112 */
113 getEstimatedTotalSize(): number;
114 /**
115 * Get the scroll offset to display an item in the viewport.
116 *
117 * By default, the list will scroll as little as possible to ensure the item is fully visible (`auto`).
118 * You can control the alignment of the item though by specifying a second alignment parameter.
119 * Acceptable values are:
120 *
121 * auto - Automatically align with the top or bottom minimising the amount scrolled,
122 * If `alignPreference` is given, follow such preferred alignment.
123 * If item is smaller than the viewport and fully visible, do not scroll at all.
124 * smart - If the item is significantly visible, don't scroll at all (regardless of whether it fits in the viewport).
125 * If the item is less than one viewport away, scroll so that it becomes fully visible (following the `auto` heuristics).
126 * If the item is more than one viewport away, scroll so that it is centered within the viewport (`center` if smaller than viewport, `top-center` otherwise).
127 * center - Align the middle of the item with the middle of the viewport (it only works well for items smaller than the viewport).
128 * top-center - Align the top of the item with the middle of the viewport (works well for items larger than the viewport).
129 * end - Align the bottom of the item to the bottom of the list.
130 * start - Align the top of item to the top of the list.
131 *
132 * An item is considered significantly visible if:
133 * - it overlaps with the viewport by the amount specified by `scrollDownThreshold` when below the viewport
134 * - it exceeds the viewport by the amount less than specified by `scrollUpThreshold` when above the viewport.
135 *
136 * @param index Item index
137 * @param align Where to align the item in the viewport
138 * @param margin The proportion of viewport to add when aligning with the top/bottom of the list.
139 * @param precomputed Precomputed values to use when windowing is disabled.
140 * @param alignPreference Allows to override the alignment of item when the `auto` heuristic decides that the item needs to be scrolled into view.
141 * @returns The needed scroll offset
142 */
143 getOffsetForIndexAndAlignment(index: number, align?: WindowedList.ScrollToAlign, margin?: number, precomputed?: {
144 totalSize: number;
145 itemMetadata: WindowedList.ItemMetadata;
146 currentOffset: number;
147 }, alignPreference?: WindowedList.BaseScrollToAlignment): number;
148 /**
149 * Compute the items range to display.
150 *
151 * It returns ``null`` if the range does not need to be updated.
152 *
153 * @returns The current items range to display
154 */
155 getRangeToRender(): WindowedList.WindowIndex | null;
156 /**
157 * Return the viewport top position and height for range spanning from
158 * ``startIndex`` to ``stopIndex``.
159 *
160 * @param startIndex First item in viewport index
161 * @param stopIndex Last item in viewport index
162 * @returns The viewport top position and its height
163 */
164 getSpan(startIndex: number, stopIndex: number): [number, number];
165 /**
166 * WindowedListModel caches offsets and measurements for each index for performance purposes.
167 * This method clears that cached data for all items after (and including) the specified index.
168 *
169 * The list will automatically re-render after the index is reset.
170 *
171 * @param index
172 */
173 resetAfterIndex(index: number): void;
174 /**
175 * Update item sizes.
176 *
177 * This should be called when the real item sizes has been
178 * measured.
179 *
180 * @param sizes New sizes per item index
181 * @returns Whether some sizes changed or not
182 */
183 setWidgetSize(sizes: {
184 index: number;
185 size: number;
186 }[]): boolean;
187 /**
188 * Callback on list changes
189 *
190 * @param list List items
191 * @param changes List change
192 */
193 protected onListChanged(list: IObservableList<Widget>, changes: IObservableList.IChangedArgs<Widget>): void;
194 private _getItemMetadata;
195 private _findNearestItem;
196 private _findNearestItemBinarySearch;
197 private _findNearestItemExponentialSearch;
198 private _getRangeToRender;
199 private _getStartIndexForOffset;
200 private _getStopIndexForStartIndex;
201 /**
202 * Default widget size estimation
203 *
204 * @deprecated we always use {@link estimateWidgetSize}
205 */
206 protected _estimatedWidgetSize: number;
207 protected _stateChanged: Signal<WindowedListModel, IChangedArgs<any, any, string>>;
208 private _currentWindow;
209 private _height;
210 private _isDisposed;
211 private _itemsList;
212 private _measuredAllUntilIndex;
213 private _overscanCount;
214 private _scrollOffset;
215 private _widgetCount;
216 private _widgetSizers;
217 private _windowingActive;
218}
219/**
220 * Windowed list widget
221 */
222export declare class WindowedList<T extends WindowedList.IModel = WindowedList.IModel, U = any> extends Widget {
223 /**
224 * Default widget size
225 */
226 static readonly DEFAULT_WIDGET_SIZE = 50;
227 /**
228 * Constructor
229 *
230 * @param options Constructor options
231 */
232 constructor(options: WindowedList.IOptions<T, U>);
233 private _viewportIndicator;
234 /**
235 * Whether the parent is hidden or not.
236 *
237 * This should be set externally if a container is hidden to
238 * stop updating the widget size when hidden.
239 */
240 get isParentHidden(): boolean;
241 set isParentHidden(v: boolean);
242 /**
243 * Widget layout
244 */
245 get layout(): WindowedLayout;
246 /**
247 * The outer container of the windowed list.
248 */
249 get outerNode(): HTMLElement;
250 /**
251 * Viewport
252 */
253 get viewportNode(): HTMLElement;
254 /**
255 * Flag to enable virtual scrollbar.
256 */
257 get scrollbar(): boolean;
258 set scrollbar(enabled: boolean);
259 /**
260 * The renderer for this windowed list. Set at instantiation.
261 */
262 protected renderer: WindowedList.IRenderer<U>;
263 /**
264 * Windowed list view model
265 */
266 protected get viewModel(): T;
267 /**
268 * Dispose the windowed list.
269 */
270 dispose(): void;
271 /**
272 * Callback on event.
273 *
274 * @param event Event
275 */
276 handleEvent(event: Event): void;
277 /**
278 * Scroll to the specified offset `scrollTop`.
279 *
280 * @param scrollOffset Offset to scroll
281 *
282 * @deprecated since v4 This is an internal helper. Prefer calling `scrollToItem`.
283 */
284 scrollTo(scrollOffset: number): void;
285 /**
286 * Scroll to the specified item.
287 *
288 * By default, the list will scroll as little as possible to ensure the item is fully visible (`auto`).
289 * You can control the alignment of the item though by specifying a second alignment parameter.
290 * Acceptable values are:
291 *
292 * auto - Automatically align with the top or bottom minimising the amount scrolled,
293 * If `alignPreference` is given, follow such preferred alignment.
294 * If item is smaller than the viewport and fully visible, do not scroll at all.
295 * smart - If the item is significantly visible, don't scroll at all (regardless of whether it fits in the viewport).
296 * If the item is less than one viewport away, scroll so that it becomes fully visible (following the `auto` heuristics).
297 * If the item is more than one viewport away, scroll so that it is centered within the viewport (`center` if smaller than viewport, `top-center` otherwise).
298 * center - Align the middle of the item with the middle of the viewport (it only works well for items smaller than the viewport).
299 * top-center - Align the top of the item with the middle of the viewport (works well for items larger than the viewport).
300 * end - Align the bottom of the item to the bottom of the list.
301 * start - Align the top of item to the top of the list.
302 *
303 * @param index Item index to scroll to
304 * @param align Type of alignment
305 * @param margin In 'smart' mode the viewport proportion to add
306 * @param alignPreference Allows to override the alignment of item when the `auto` heuristic decides that the item needs to be scrolled into view.
307 */
308 scrollToItem(index: number, align?: WindowedList.ScrollToAlign, margin?: number, alignPreference?: WindowedList.BaseScrollToAlignment): Promise<void>;
309 /**
310 * A message handler invoked on an `'after-attach'` message.
311 */
312 protected onAfterAttach(msg: Message): void;
313 /**
314 * A message handler invoked on an `'before-detach'` message.
315 */
316 protected onBeforeDetach(msg: Message): void;
317 /**
318 * Callback on scroll event
319 *
320 * @param event Scroll event
321 */
322 protected onScroll(event: Event): void;
323 /**
324 * A message handler invoked on an `'resize-request'` message.
325 */
326 protected onResize(msg: Widget.ResizeMessage): void;
327 /**
328 * Callback on view model change
329 *
330 * @param model Windowed list model
331 * @param changes Change
332 */
333 protected onStateChanged(model: WindowedList.IModel, changes: IChangedArgs<number | boolean, number | boolean, string>): void;
334 /**
335 * A message handler invoked on an `'update-request'` message.
336 *
337 * #### Notes
338 * The default implementation of this handler is a no-op.
339 */
340 protected onUpdateRequest(msg: Message): void;
341 /**
342 * A signal that emits the index when the virtual scrollbar jumps to an item.
343 */
344 protected jumped: Signal<this, number>;
345 private _adjustDimensionsForScrollbar;
346 /**
347 * Add listeners for viewport, contents and the virtual scrollbar.
348 */
349 private _addListeners;
350 /**
351 * Turn off windowing related styles in the viewport.
352 */
353 private _applyNoWindowingStyles;
354 /**
355 * Turn on windowing related styles in the viewport.
356 */
357 private _applyWindowingStyles;
358 /**
359 * Remove listeners for viewport and contents (but not the virtual scrollbar).
360 */
361 private _removeListeners;
362 /**
363 * Update viewport and DOM state.
364 */
365 private _update;
366 /**
367 * Handle viewport area resize.
368 */
369 private _onAreaResize;
370 /**
371 * Handle viewport content (i.e. items) resize.
372 */
373 private _onItemResize;
374 /**
375 * Scroll to the item which was most recently requested.
376 *
377 * This method ensures that the app scrolls to the item even if a resize event
378 * occurs shortly after the scroll. Consider the following sequence of events:
379 *
380 * 1. User is at the nth cell, presses Shift+Enter (run current cell and
381 * advance to next)
382 * 2. App scrolls to the next (n+1) cell
383 * 3. The nth cell finishes running and renders the output, pushing the
384 * (n+1) cell down out of view
385 * 4. This triggers the resize observer, which calls this method and scrolls
386 * the (n+1) cell back into view
387 *
388 * On implementation level, this is ensured by scrolling to `this._scrollToItem`
389 * which is cleared after a short timeout once the scrolling settles
390 * (see `this._resetScrollToItem()`).
391 */
392 private _scrollBackToItemOnResize;
393 /**
394 * Clear any outstanding timeout and enqueue scrolling to a new item.
395 */
396 private _resetScrollToItem;
397 /**
398 * Render virtual scrollbar.
399 */
400 private _renderScrollbar;
401 private _scrollbarItems;
402 /**
403 * Handle `pointerdown` events on the virtual scrollbar.
404 */
405 private _evtPointerDown;
406 /**
407 * Update the total size
408 */
409 private _updateTotalSize;
410 protected _viewModel: T;
411 private _viewportPaddingTop;
412 private _viewportPaddingBottom;
413 private _innerElement;
414 private _isParentHidden;
415 private _isScrolling;
416 private _needsUpdate;
417 private _outerElement;
418 private _resetScrollToItemTimeout;
419 private _areaResizeObserver;
420 private _itemsResizeObserver;
421 private _scrollbarElement;
422 private _scrollbarResizeObserver;
423 private _scrollRepaint;
424 private _scrollToItem;
425 private _scrollUpdateWasRequested;
426 private _updater;
427 private _viewport;
428}
429/**
430 * Customized layout for windowed list container.
431 */
432export declare class WindowedLayout extends PanelLayout {
433 /**
434 * Constructor
435 */
436 constructor();
437 /**
438 * Specialized parent type definition
439 */
440 get parent(): WindowedList | null;
441 set parent(value: WindowedList | null);
442 /**
443 * Attach a widget to the parent's DOM node.
444 *
445 * @param index - The current index of the widget in the layout.
446 *
447 * @param widget - The widget to attach to the parent.
448 *
449 * #### Notes
450 * This method is called automatically by the panel layout at the
451 * appropriate time. It should not be called directly by user code.
452 *
453 * The default implementation adds the widgets's node to the parent's
454 * node at the proper location, and sends the appropriate attach
455 * messages to the widget if the parent is attached to the DOM.
456 *
457 * Subclasses may reimplement this method to control how the widget's
458 * node is added to the parent's node.
459 */
460 protected attachWidget(index: number, widget: Widget): void;
461 /**
462 * Detach a widget from the parent's DOM node.
463 *
464 * @param index - The previous index of the widget in the layout.
465 *
466 * @param widget - The widget to detach from the parent.
467 *
468 * #### Notes
469 * This method is called automatically by the panel layout at the
470 * appropriate time. It should not be called directly by user code.
471 *
472 * The default implementation removes the widget's node from the
473 * parent's node, and sends the appropriate detach messages to the
474 * widget if the parent is attached to the DOM.
475 *
476 * Subclasses may reimplement this method to control how the widget's
477 * node is removed from the parent's node.
478 */
479 protected detachWidget(index: number, widget: Widget): void;
480 /**
481 * Move a widget in the parent's DOM node.
482 *
483 * @param fromIndex - The previous index of the widget in the layout.
484 *
485 * @param toIndex - The current index of the widget in the layout.
486 *
487 * @param widget - The widget to move in the parent.
488 *
489 * #### Notes
490 * This method is called automatically by the panel layout at the
491 * appropriate time. It should not be called directly by user code.
492 *
493 * The default implementation moves the widget's node to the proper
494 * location in the parent's node and sends the appropriate attach and
495 * detach messages to the widget if the parent is attached to the DOM.
496 *
497 * Subclasses may reimplement this method to control how the widget's
498 * node is moved in the parent's node.
499 */
500 protected moveWidget(fromIndex: number, toIndex: number, widget: Widget): void;
501 /**
502 * A message handler invoked on an `'update-request'` message.
503 *
504 * #### Notes
505 * This is a reimplementation of the base class method,
506 * and is a no-op.
507 */
508 protected onUpdateRequest(msg: Message): void;
509}
510/**
511 * Windowed list model interface
512 */
513export interface ISimpleObservableList<T = any> {
514 get?: (index: number) => T;
515 length: number;
516 changed: ISignal<any, IObservableList.IChangedArgs<any>>;
517}
518/**
519 * A namespace for windowed list
520 */
521export declare namespace WindowedList {
522 /**
523 * The default renderer class for windowed lists.
524 */
525 class Renderer<T = any> implements IRenderer<T> {
526 /**
527 * Create the outer, root element of the windowed list.
528 */
529 createOuter(): HTMLElement;
530 /**
531 * Create the virtual scrollbar element.
532 */
533 createScrollbar(): HTMLOListElement;
534 /**
535 * Create the virtual scrollbar viewport indicator.
536 */
537 createScrollbarViewportIndicator(): HTMLElement;
538 /**
539 * Create an individual item rendered in the scrollbar.
540 */
541 createScrollbarItem(_: WindowedList, index: number): HTMLLIElement;
542 /**
543 * Create the viewport element into which virtualized children are added.
544 */
545 createViewport(): HTMLElement;
546 }
547 /**
548 * The default renderer for windowed lists.
549 */
550 const defaultRenderer: Renderer<any>;
551 /**
552 * Windowed list model interface
553 */
554 interface IModel<T = any> extends IDisposable {
555 /**
556 * Provide a best guess for the widget size at position index
557 *
558 * #### Notes
559 *
560 * This function should be very light to compute especially when
561 * returning the default size.
562 * The default value should be constant (i.e. two calls with `null` should
563 * return the same value). But it can change for a given `index`.
564 *
565 * @param index Widget position
566 * @returns Estimated widget size
567 */
568 estimateWidgetSize: (index: number) => number;
569 /**
570 * Get the total list size.
571 *
572 * @returns Total estimated size
573 */
574 getEstimatedTotalSize(): number;
575 /**
576 * Get the scroll offset to display an item in the viewport.
577 *
578 * By default, the list will scroll as little as possible to ensure the item is fully visible (`auto`).
579 * You can control the alignment of the item though by specifying a second alignment parameter.
580 * Acceptable values are:
581 *
582 * auto - Automatically align with the top or bottom minimising the amount scrolled,
583 * If `alignPreference` is given, follow such preferred alignment.
584 * If item is smaller than the viewport and fully visible, do not scroll at all.
585 * smart - If the item is significantly visible, don't scroll at all (regardless of whether it fits in the viewport).
586 * If the item is less than one viewport away, scroll so that it becomes fully visible (following the `auto` heuristics).
587 * If the item is more than one viewport away, scroll so that it is centered within the viewport (`center` if smaller than viewport, `top-center` otherwise).
588 * center - Align the middle of the item with the middle of the viewport (it only works well for items smaller than the viewport).
589 * top-center - Align the top of the item with the middle of the viewport (works well for items larger than the viewport).
590 * end - Align the bottom of the item to the bottom of the list.
591 * start - Align the top of item to the top of the list.
592 *
593 * @param index Item index
594 * @param align Where to align the item in the viewport
595 * @param margin In 'smart' mode the viewport proportion to add
596 * @param precomputed Precomputed values to use when windowing is disabled.
597 * @param alignPreference Allows to override the alignment of item when the `auto` heuristic decides that the item needs to be scrolled into view.
598 * @returns The needed scroll offset
599 */
600 getOffsetForIndexAndAlignment(index: number, align?: ScrollToAlign, margin?: number, precomputed?: {
601 totalSize: number;
602 itemMetadata: WindowedList.ItemMetadata;
603 currentOffset: number;
604 }, alignPreference?: WindowedList.BaseScrollToAlignment): number;
605 /**
606 * Compute the items range to display.
607 *
608 * It returns ``null`` if the range does not need to be updated.
609 *
610 * @returns The current items range to display
611 */
612 getRangeToRender(): WindowIndex | null;
613 /**
614 * Return the viewport top position and height for range spanning from
615 * ``startIndex`` to ``stopIndex``.
616 *
617 * @param start First item in viewport index
618 * @param stop Last item in viewport index
619 * @returns The viewport top position and its height
620 */
621 getSpan(start: number, stop: number): [number, number];
622 /**
623 * List widget height
624 */
625 height: number;
626 /**
627 * Top padding of the the outer window node.
628 */
629 paddingTop?: number;
630 /**
631 * Items list to be rendered
632 */
633 itemsList: ISimpleObservableList<T> | null;
634 /**
635 * Number of widgets to render in addition to those
636 * visible in the viewport.
637 */
638 overscanCount: number;
639 /**
640 * WindowedListModel caches offsets and measurements for each index for performance purposes.
641 * This method clears that cached data for all items after (and including) the specified index.
642 *
643 * The list will automatically re-render after the index is reset.
644 *
645 * @param index
646 */
647 resetAfterIndex(index: number): void;
648 /**
649 * Viewport scroll offset.
650 */
651 scrollOffset: number;
652 /**
653 * Update item sizes.
654 *
655 * This should be called when the real item sizes has been
656 * measured.
657 *
658 * @param sizes New sizes per item index
659 * @returns Whether some sizes changed or not
660 */
661 setWidgetSize(sizes: {
662 index: number;
663 size: number;
664 }[]): boolean;
665 /**
666 * A signal emitted when any model state changes.
667 */
668 readonly stateChanged: ISignal<IModel, IChangedArgs<any, any, 'count' | 'index' | 'list' | 'overscanCount' | 'windowingActive' | string>>;
669 /**
670 * Total number of widgets in the list
671 */
672 widgetCount: number;
673 /**
674 * Whether windowing is active or not.
675 */
676 windowingActive: boolean;
677 /**
678 * Widget factory for the list items.
679 *
680 * Caching the resulting widgets should be done by the callee.
681 *
682 * @param index List index
683 * @returns The widget at the given position
684 */
685 widgetRenderer: (index: number) => Widget;
686 }
687 /**
688 * Windowed list model constructor options
689 */
690 interface IModelOptions {
691 /**
692 * Total number of widgets in the list.
693 *
694 * #### Notes
695 * If an observable list is provided this will be ignored.
696 */
697 count?: number;
698 /**
699 * Dynamic list of items
700 */
701 itemsList?: IObservableList<any>;
702 /**
703 * Number of widgets to render in addition to those
704 * visible in the viewport.
705 */
706 overscanCount?: number;
707 /**
708 * Whether windowing is active or not.
709 *
710 * This is true by default.
711 */
712 windowingActive?: boolean;
713 }
714 /**
715 * Windowed list view constructor options
716 */
717 interface IOptions<T extends WindowedList.IModel = WindowedList.IModel, U = any> {
718 /**
719 * Windowed list model to display
720 */
721 model: T;
722 /**
723 * Windowed list layout
724 */
725 layout?: WindowedLayout;
726 /**
727 * A renderer for the elements of the windowed list.
728 */
729 renderer?: IRenderer<U>;
730 /**
731 * Whether the windowed list should display a scrollbar UI.
732 */
733 scrollbar?: boolean;
734 }
735 /**
736 * A windowed list element renderer.
737 */
738 interface IRenderer<T = any> {
739 /**
740 * Create the outer, root element of the windowed list.
741 */
742 createOuter(): HTMLElement;
743 /**
744 * Create the virtual scrollbar element.
745 */
746 createScrollbar(): HTMLElement;
747 /**
748 * Create the virtual scrollbar viewport indicator.
749 */
750 createScrollbarViewportIndicator?(): HTMLElement;
751 /**
752 * Create an individual item rendered in the scrollbar.
753 */
754 createScrollbarItem(list: WindowedList, index: number, item: T | undefined): HTMLElement | IRenderer.IScrollbarItem;
755 /**
756 * Create the viewport element into which virtualized children are added.
757 */
758 createViewport(): HTMLElement;
759 }
760 /**
761 * Renderer statics.
762 */
763 namespace IRenderer {
764 /**
765 * Scrollbar item.
766 */
767 interface IScrollbarItem extends IDisposable {
768 /**
769 * Render the scrollbar item as an HTML element.
770 */
771 render: (props: {
772 index: number;
773 }) => HTMLElement;
774 /**
775 * Unique item key used for caching.
776 */
777 key: string;
778 }
779 }
780 /**
781 * Item list metadata
782 */
783 type ItemMetadata = {
784 /**
785 * Item vertical offset in the container
786 */
787 offset: number;
788 /**
789 * Item height
790 */
791 size: number;
792 /**
793 * Whether the size is an estimation or a measurement.
794 */
795 measured?: boolean;
796 };
797 /**
798 * Basic type of scroll alignment
799 */
800 type BaseScrollToAlignment = 'center' | 'top-center' | 'start' | 'end';
801 /**
802 * Type of scroll alignment including `auto` and `smart`
803 */
804 type ScrollToAlign = 'auto' | 'smart' | BaseScrollToAlignment;
805 /**
806 * Widget range in view port
807 */
808 type WindowIndex = [number, number, number, number];
809}