UNPKG

28.5 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 _lastMeasuredIndex;
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 /**
234 * Whether the parent is hidden or not.
235 *
236 * This should be set externally if a container is hidden to
237 * stop updating the widget size when hidden.
238 */
239 get isParentHidden(): boolean;
240 set isParentHidden(v: boolean);
241 /**
242 * Widget layout
243 */
244 get layout(): WindowedLayout;
245 /**
246 * The outer container of the windowed list.
247 */
248 get outerNode(): HTMLElement;
249 /**
250 * Viewport
251 */
252 get viewportNode(): HTMLElement;
253 /**
254 * Flag to enable virtual scrollbar.
255 */
256 get scrollbar(): boolean;
257 set scrollbar(enabled: boolean);
258 /**
259 * The renderer for this windowed list. Set at instantiation.
260 */
261 protected renderer: WindowedList.IRenderer<U>;
262 /**
263 * Windowed list view model
264 */
265 protected get viewModel(): T;
266 /**
267 * Dispose the windowed list.
268 */
269 dispose(): void;
270 /**
271 * Callback on event.
272 *
273 * @param event Event
274 */
275 handleEvent(event: Event): void;
276 /**
277 * Scroll to the specified offset `scrollTop`.
278 *
279 * @param scrollOffset Offset to scroll
280 *
281 * @deprecated since v4 This is an internal helper. Prefer calling `scrollToItem`.
282 */
283 scrollTo(scrollOffset: number): void;
284 /**
285 * Scroll to the specified item.
286 *
287 * By default, the list will scroll as little as possible to ensure the item is fully visible (`auto`).
288 * You can control the alignment of the item though by specifying a second alignment parameter.
289 * Acceptable values are:
290 *
291 * auto - Automatically align with the top or bottom minimising the amount scrolled,
292 * If `alignPreference` is given, follow such preferred alignment.
293 * If item is smaller than the viewport and fully visible, do not scroll at all.
294 * smart - If the item is significantly visible, don't scroll at all (regardless of whether it fits in the viewport).
295 * If the item is less than one viewport away, scroll so that it becomes fully visible (following the `auto` heuristics).
296 * 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).
297 * center - Align the middle of the item with the middle of the viewport (it only works well for items smaller than the viewport).
298 * top-center - Align the top of the item with the middle of the viewport (works well for items larger than the viewport).
299 * end - Align the bottom of the item to the bottom of the list.
300 * start - Align the top of item to the top of the list.
301 *
302 * @param index Item index to scroll to
303 * @param align Type of alignment
304 * @param margin In 'smart' mode the viewport proportion to add
305 * @param alignPreference Allows to override the alignment of item when the `auto` heuristic decides that the item needs to be scrolled into view.
306 */
307 scrollToItem(index: number, align?: WindowedList.ScrollToAlign, margin?: number, alignPreference?: WindowedList.BaseScrollToAlignment): Promise<void>;
308 /**
309 * A message handler invoked on an `'after-attach'` message.
310 */
311 protected onAfterAttach(msg: Message): void;
312 /**
313 * A message handler invoked on an `'before-detach'` message.
314 */
315 protected onBeforeDetach(msg: Message): void;
316 /**
317 * Callback on scroll event
318 *
319 * @param event Scroll event
320 */
321 protected onScroll(event: Event): void;
322 /**
323 * A message handler invoked on an `'resize-request'` message.
324 */
325 protected onResize(msg: Widget.ResizeMessage): void;
326 /**
327 * Callback on view model change
328 *
329 * @param model Windowed list model
330 * @param changes Change
331 */
332 protected onStateChanged(model: WindowedList.IModel, changes: IChangedArgs<number | boolean, number | boolean, string>): void;
333 /**
334 * A message handler invoked on an `'update-request'` message.
335 *
336 * #### Notes
337 * The default implementation of this handler is a no-op.
338 */
339 protected onUpdateRequest(msg: Message): void;
340 /**
341 * A signal that emits the index when the virtual scrollbar jumps to an item.
342 */
343 protected jumped: Signal<this, number>;
344 private _adjustDimensionsForScrollbar;
345 /**
346 * Add listeners for viewport, contents and the virtual scrollbar.
347 */
348 private _addListeners;
349 /**
350 * Turn off windowing related styles in the viewport.
351 */
352 private _applyNoWindowingStyles;
353 /**
354 * Turn on windowing related styles in the viewport.
355 */
356 private _applyWindowingStyles;
357 /**
358 * Remove listeners for viewport and contents (but not the virtual scrollbar).
359 */
360 private _removeListeners;
361 /**
362 * Update viewport and DOM state.
363 */
364 private _update;
365 /**
366 * Handle viewport area resize.
367 */
368 private _onAreaResize;
369 /**
370 * Handle viewport content (i.e. items) resize.
371 */
372 private _onItemResize;
373 /**
374 * Scroll to the item which was most recently requested.
375 *
376 * This method ensures that the app scrolls to the item even if a resize event
377 * occurs shortly after the scroll. Consider the following sequence of events:
378 *
379 * 1. User is at the nth cell, presses Shift+Enter (run current cell and
380 * advance to next)
381 * 2. App scrolls to the next (n+1) cell
382 * 3. The nth cell finishes running and renders the output, pushing the
383 * (n+1) cell down out of view
384 * 4. This triggers the resize observer, which calls this method and scrolls
385 * the (n+1) cell back into view
386 *
387 * On implementation level, this is ensured by scrolling to `this._scrollToItem`
388 * which is cleared after a short timeout once the scrolling settles
389 * (see `this._resetScrollToItem()`).
390 */
391 private _scrollBackToItemOnResize;
392 /**
393 * Clear any outstanding timeout and enqueue scrolling to a new item.
394 */
395 private _resetScrollToItem;
396 /**
397 * Render virtual scrollbar.
398 */
399 private _renderScrollbar;
400 /**
401 * Handle `pointerdown` events on the virtual scrollbar.
402 */
403 private _evtPointerDown;
404 /**
405 * Update the total size
406 */
407 private _updateTotalSize;
408 protected _viewModel: T;
409 private _viewportPaddingTop;
410 private _viewportPaddingBottom;
411 private _innerElement;
412 private _isParentHidden;
413 private _isScrolling;
414 private _needsUpdate;
415 private _outerElement;
416 private _resetScrollToItemTimeout;
417 private _areaResizeObserver;
418 private _itemsResizeObserver;
419 private _scrollbarElement;
420 private _scrollbarResizeObserver;
421 private _scrollRepaint;
422 private _scrollToItem;
423 private _scrollUpdateWasRequested;
424 private _updater;
425 private _viewport;
426}
427/**
428 * Customized layout for windowed list container.
429 */
430export declare class WindowedLayout extends PanelLayout {
431 /**
432 * Constructor
433 */
434 constructor();
435 /**
436 * Specialized parent type definition
437 */
438 get parent(): WindowedList | null;
439 set parent(value: WindowedList | null);
440 /**
441 * Attach a widget to the parent's DOM node.
442 *
443 * @param index - The current index of the widget in the layout.
444 *
445 * @param widget - The widget to attach to the parent.
446 *
447 * #### Notes
448 * This method is called automatically by the panel layout at the
449 * appropriate time. It should not be called directly by user code.
450 *
451 * The default implementation adds the widgets's node to the parent's
452 * node at the proper location, and sends the appropriate attach
453 * messages to the widget if the parent is attached to the DOM.
454 *
455 * Subclasses may reimplement this method to control how the widget's
456 * node is added to the parent's node.
457 */
458 protected attachWidget(index: number, widget: Widget): void;
459 /**
460 * Detach a widget from the parent's DOM node.
461 *
462 * @param index - The previous index of the widget in the layout.
463 *
464 * @param widget - The widget to detach from the parent.
465 *
466 * #### Notes
467 * This method is called automatically by the panel layout at the
468 * appropriate time. It should not be called directly by user code.
469 *
470 * The default implementation removes the widget's node from the
471 * parent's node, and sends the appropriate detach messages to the
472 * widget if the parent is attached to the DOM.
473 *
474 * Subclasses may reimplement this method to control how the widget's
475 * node is removed from the parent's node.
476 */
477 protected detachWidget(index: number, widget: Widget): void;
478 /**
479 * Move a widget in the parent's DOM node.
480 *
481 * @param fromIndex - The previous index of the widget in the layout.
482 *
483 * @param toIndex - The current index of the widget in the layout.
484 *
485 * @param widget - The widget to move in the parent.
486 *
487 * #### Notes
488 * This method is called automatically by the panel layout at the
489 * appropriate time. It should not be called directly by user code.
490 *
491 * The default implementation moves the widget's node to the proper
492 * location in the parent's node and sends the appropriate attach and
493 * detach messages to the widget if the parent is attached to the DOM.
494 *
495 * Subclasses may reimplement this method to control how the widget's
496 * node is moved in the parent's node.
497 */
498 protected moveWidget(fromIndex: number, toIndex: number, widget: Widget): void;
499 /**
500 * A message handler invoked on an `'update-request'` message.
501 *
502 * #### Notes
503 * This is a reimplementation of the base class method,
504 * and is a no-op.
505 */
506 protected onUpdateRequest(msg: Message): void;
507}
508/**
509 * Windowed list model interface
510 */
511export interface ISimpleObservableList<T = any> {
512 get?: (index: number) => T;
513 length: number;
514 changed: ISignal<any, IObservableList.IChangedArgs<any>>;
515}
516/**
517 * A namespace for windowed list
518 */
519export declare namespace WindowedList {
520 /**
521 * The default renderer class for windowed lists.
522 */
523 class Renderer<T = any> implements IRenderer<T> {
524 /**
525 * Create the outer, root element of the windowed list.
526 */
527 createOuter(): HTMLElement;
528 /**
529 * Create the virtual scrollbar element.
530 */
531 createScrollbar(): HTMLOListElement;
532 /**
533 * Create an individual item rendered in the scrollbar.
534 */
535 createScrollbarItem(_: WindowedList, index: number): HTMLLIElement;
536 /**
537 * Create the viewport element into which virtualized children are added.
538 */
539 createViewport(): HTMLElement;
540 }
541 /**
542 * The default renderer for windowed lists.
543 */
544 const defaultRenderer: Renderer<any>;
545 /**
546 * Windowed list model interface
547 */
548 interface IModel<T = any> extends IDisposable {
549 /**
550 * Provide a best guess for the widget size at position index
551 *
552 * #### Notes
553 *
554 * This function should be very light to compute especially when
555 * returning the default size.
556 * The default value should be constant (i.e. two calls with `null` should
557 * return the same value). But it can change for a given `index`.
558 *
559 * @param index Widget position
560 * @returns Estimated widget size
561 */
562 estimateWidgetSize: (index: number) => number;
563 /**
564 * Get the total list size.
565 *
566 * @returns Total estimated size
567 */
568 getEstimatedTotalSize(): number;
569 /**
570 * Get the scroll offset to display an item in the viewport.
571 *
572 * By default, the list will scroll as little as possible to ensure the item is fully visible (`auto`).
573 * You can control the alignment of the item though by specifying a second alignment parameter.
574 * Acceptable values are:
575 *
576 * auto - Automatically align with the top or bottom minimising the amount scrolled,
577 * If `alignPreference` is given, follow such preferred alignment.
578 * If item is smaller than the viewport and fully visible, do not scroll at all.
579 * smart - If the item is significantly visible, don't scroll at all (regardless of whether it fits in the viewport).
580 * If the item is less than one viewport away, scroll so that it becomes fully visible (following the `auto` heuristics).
581 * 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).
582 * center - Align the middle of the item with the middle of the viewport (it only works well for items smaller than the viewport).
583 * top-center - Align the top of the item with the middle of the viewport (works well for items larger than the viewport).
584 * end - Align the bottom of the item to the bottom of the list.
585 * start - Align the top of item to the top of the list.
586 *
587 * @param index Item index
588 * @param align Where to align the item in the viewport
589 * @param margin In 'smart' mode the viewport proportion to add
590 * @param precomputed Precomputed values to use when windowing is disabled.
591 * @param alignPreference Allows to override the alignment of item when the `auto` heuristic decides that the item needs to be scrolled into view.
592 * @returns The needed scroll offset
593 */
594 getOffsetForIndexAndAlignment(index: number, align?: ScrollToAlign, margin?: number, precomputed?: {
595 totalSize: number;
596 itemMetadata: WindowedList.ItemMetadata;
597 currentOffset: number;
598 }, alignPreference?: WindowedList.BaseScrollToAlignment): number;
599 /**
600 * Compute the items range to display.
601 *
602 * It returns ``null`` if the range does not need to be updated.
603 *
604 * @returns The current items range to display
605 */
606 getRangeToRender(): WindowIndex | null;
607 /**
608 * Return the viewport top position and height for range spanning from
609 * ``startIndex`` to ``stopIndex``.
610 *
611 * @param start First item in viewport index
612 * @param stop Last item in viewport index
613 * @returns The viewport top position and its height
614 */
615 getSpan(start: number, stop: number): [number, number];
616 /**
617 * List widget height
618 */
619 height: number;
620 /**
621 * Top padding of the the outer window node.
622 */
623 paddingTop?: number;
624 /**
625 * Items list to be rendered
626 */
627 itemsList: ISimpleObservableList<T> | null;
628 /**
629 * Number of widgets to render in addition to those
630 * visible in the viewport.
631 */
632 overscanCount: number;
633 /**
634 * WindowedListModel caches offsets and measurements for each index for performance purposes.
635 * This method clears that cached data for all items after (and including) the specified index.
636 *
637 * The list will automatically re-render after the index is reset.
638 *
639 * @param index
640 */
641 resetAfterIndex(index: number): void;
642 /**
643 * Viewport scroll offset.
644 */
645 scrollOffset: number;
646 /**
647 * Update item sizes.
648 *
649 * This should be called when the real item sizes has been
650 * measured.
651 *
652 * @param sizes New sizes per item index
653 * @returns Whether some sizes changed or not
654 */
655 setWidgetSize(sizes: {
656 index: number;
657 size: number;
658 }[]): boolean;
659 /**
660 * A signal emitted when any model state changes.
661 */
662 readonly stateChanged: ISignal<IModel, IChangedArgs<any, any, 'count' | 'index' | 'list' | 'overscanCount' | 'windowingActive' | string>>;
663 /**
664 * Total number of widgets in the list
665 */
666 widgetCount: number;
667 /**
668 * Whether windowing is active or not.
669 */
670 windowingActive: boolean;
671 /**
672 * Widget factory for the list items.
673 *
674 * Caching the resulting widgets should be done by the callee.
675 *
676 * @param index List index
677 * @returns The widget at the given position
678 */
679 widgetRenderer: (index: number) => Widget;
680 }
681 /**
682 * Windowed list model constructor options
683 */
684 interface IModelOptions {
685 /**
686 * Total number of widgets in the list.
687 *
688 * #### Notes
689 * If an observable list is provided this will be ignored.
690 */
691 count?: number;
692 /**
693 * Dynamic list of items
694 */
695 itemsList?: IObservableList<any>;
696 /**
697 * Number of widgets to render in addition to those
698 * visible in the viewport.
699 */
700 overscanCount?: number;
701 /**
702 * Whether windowing is active or not.
703 *
704 * This is true by default.
705 */
706 windowingActive?: boolean;
707 }
708 /**
709 * Windowed list view constructor options
710 */
711 interface IOptions<T extends WindowedList.IModel = WindowedList.IModel, U = any> {
712 /**
713 * Windowed list model to display
714 */
715 model: T;
716 /**
717 * Windowed list layout
718 */
719 layout?: WindowedLayout;
720 /**
721 * A renderer for the elements of the windowed list.
722 */
723 renderer?: IRenderer<U>;
724 /**
725 * Whether the windowed list should display a scrollbar UI.
726 */
727 scrollbar?: boolean;
728 }
729 /**
730 * A windowed list element renderer.
731 */
732 interface IRenderer<T = any> {
733 /**
734 * Create the outer, root element of the windowed list.
735 */
736 createOuter(): HTMLElement;
737 /**
738 * Create the virtual scrollbar element.
739 */
740 createScrollbar(): HTMLElement;
741 /**
742 * Create an individual item rendered in the scrollbar.
743 */
744 createScrollbarItem(list: WindowedList, index: number, item: T | undefined): HTMLElement;
745 /**
746 * Create the viewport element into which virtualized children are added.
747 */
748 createViewport(): HTMLElement;
749 }
750 /**
751 * Item list metadata
752 */
753 type ItemMetadata = {
754 /**
755 * Item vertical offset in the container
756 */
757 offset: number;
758 /**
759 * Item height
760 */
761 size: number;
762 /**
763 * Whether the size is an estimation or a measurement.
764 */
765 measured?: boolean;
766 };
767 /**
768 * Basic type of scroll alignment
769 */
770 type BaseScrollToAlignment = 'center' | 'top-center' | 'start' | 'end';
771 /**
772 * Type of scroll alignment including `auto` and `smart`
773 */
774 type ScrollToAlign = 'auto' | 'smart' | BaseScrollToAlignment;
775 /**
776 * Widget range in view port
777 */
778 type WindowIndex = [number, number, number, number];
779}