@legendapp/list 3.0.0-beta.33 → 3.0.0-beta.35

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/animated.d.ts CHANGED
@@ -226,6 +226,11 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
226
226
  * - true enables both behaviors; false disables both.
227
227
  */
228
228
  maintainVisibleContentPosition?: boolean | MaintainVisibleContentPositionConfig<ItemT>;
229
+ /**
230
+ * Web only: when true, listens to window/body scrolling instead of rendering a scrollable list container.
231
+ * @default false
232
+ */
233
+ useWindowScroll?: boolean;
229
234
  /**
230
235
  * Number of columns to render items in.
231
236
  * @default 1
@@ -414,7 +419,7 @@ type LegendListState = {
414
419
  listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
415
420
  listenToPosition: (key: string, callback: (value: number) => void) => () => void;
416
421
  positionAtIndex: (index: number) => number;
417
- positions: Map<string, number>;
422
+ positionByKey: (key: string) => number | undefined;
418
423
  scroll: number;
419
424
  scrollLength: number;
420
425
  scrollVelocity: number;
@@ -453,7 +458,7 @@ type LegendListRef$1 = {
453
458
  scrollIndexIntoView(params: {
454
459
  animated?: boolean | undefined;
455
460
  index: number;
456
- }): void;
461
+ }): Promise<void>;
457
462
  /**
458
463
  * Scrolls a specific index into view.
459
464
  * @param params - Parameters for scrolling.
@@ -463,7 +468,7 @@ type LegendListRef$1 = {
463
468
  scrollItemIntoView(params: {
464
469
  animated?: boolean | undefined;
465
470
  item: any;
466
- }): void;
471
+ }): Promise<void>;
467
472
  /**
468
473
  * Scrolls to the end of the list.
469
474
  * @param options - Options for scrolling.
@@ -473,7 +478,7 @@ type LegendListRef$1 = {
473
478
  scrollToEnd(options?: {
474
479
  animated?: boolean | undefined;
475
480
  viewOffset?: number | undefined;
476
- }): void;
481
+ }): Promise<void>;
477
482
  /**
478
483
  * Scrolls to a specific index in the list.
479
484
  * @param params - Parameters for scrolling.
@@ -487,7 +492,7 @@ type LegendListRef$1 = {
487
492
  index: number;
488
493
  viewOffset?: number | undefined;
489
494
  viewPosition?: number | undefined;
490
- }): void;
495
+ }): Promise<void>;
491
496
  /**
492
497
  * Scrolls to a specific item in the list.
493
498
  * @param params - Parameters for scrolling.
@@ -501,7 +506,7 @@ type LegendListRef$1 = {
501
506
  item: any;
502
507
  viewOffset?: number | undefined;
503
508
  viewPosition?: number | undefined;
504
- }): void;
509
+ }): Promise<void>;
505
510
  /**
506
511
  * Scrolls to a specific offset in pixels.
507
512
  * @param params - Parameters for scrolling.
@@ -511,7 +516,7 @@ type LegendListRef$1 = {
511
516
  scrollToOffset(params: {
512
517
  offset: number;
513
518
  animated?: boolean | undefined;
514
- }): void;
519
+ }): Promise<void>;
515
520
  /**
516
521
  * Sets or adds to the offset of the visible content anchor.
517
522
  * @param value - The offset to set or add.
package/index.d.ts CHANGED
@@ -121,6 +121,29 @@ interface NativeSyntheticEvent$1<T> {
121
121
  }
122
122
  type ViewStyle$1 = Record<string, unknown>;
123
123
  type StyleProp$1<T> = T | T[] | null | undefined | false;
124
+ interface ScrollEventTargetLike$1 {
125
+ addEventListener(type: string, listener: (...args: any[]) => void): void;
126
+ removeEventListener(type: string, listener: (...args: any[]) => void): void;
127
+ }
128
+ interface ScrollableNodeLike$1 {
129
+ scrollLeft?: number;
130
+ scrollTop?: number;
131
+ }
132
+ interface LegendListScrollerRef$1 {
133
+ flashScrollIndicators(): void;
134
+ getCurrentScrollOffset?(): number;
135
+ getScrollEventTarget(): ScrollEventTargetLike$1 | null;
136
+ getScrollableNode(): ScrollableNodeLike$1 | null;
137
+ getScrollResponder(): unknown;
138
+ scrollTo(options: {
139
+ animated?: boolean;
140
+ x?: number;
141
+ y?: number;
142
+ }): void;
143
+ scrollToEnd(options?: {
144
+ animated?: boolean;
145
+ }): void;
146
+ }
124
147
  type BaseScrollViewProps$1<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
125
148
  interface DataModeProps<ItemT, TItemType extends string | undefined> {
126
149
  /**
@@ -277,6 +300,11 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
277
300
  * - true enables both behaviors; false disables both.
278
301
  */
279
302
  maintainVisibleContentPosition?: boolean | MaintainVisibleContentPositionConfig$1<ItemT>;
303
+ /**
304
+ * Web only: when true, listens to window/body scrolling instead of rendering a scrollable list container.
305
+ * @default false
306
+ */
307
+ useWindowScroll?: boolean;
280
308
  /**
281
309
  * Number of columns to render items in.
282
310
  * @default 1
@@ -471,10 +499,11 @@ interface InternalState$1 {
471
499
  num: number;
472
500
  avg: number;
473
501
  }>;
474
- columns: Map<string, number>;
475
- columnSpans: Map<string, number>;
502
+ columns: Array<number | undefined>;
503
+ columnSpans: Array<number | undefined>;
476
504
  containerItemKeys: Map<string, number>;
477
505
  containerItemTypes: Map<number, string>;
506
+ dataChangeEpoch: number;
478
507
  dataChangeNeedsScrollUpdate: boolean;
479
508
  didColumnsChange?: boolean;
480
509
  didDataChange?: boolean;
@@ -521,12 +550,13 @@ interface InternalState$1 {
521
550
  needsOtherAxisSize?: boolean;
522
551
  otherAxisSize?: number;
523
552
  pendingTotalSize?: number;
524
- positions: Map<string, number>;
553
+ pendingScrollResolve?: (() => void) | undefined;
554
+ positions: Array<number | undefined>;
525
555
  previousData?: readonly unknown[];
526
556
  queuedCalculateItemsInView: number | undefined;
527
557
  queuedMVCPRecalculate?: number;
528
558
  queuedInitialLayout?: boolean | undefined;
529
- refScroller: React.RefObject<any>;
559
+ refScroller: React.RefObject<LegendListScrollerRef$1 | null>;
530
560
  scroll: number;
531
561
  scrollAdjustHandler: ScrollAdjustHandler;
532
562
  scrollForNextCalculateItemsInView: {
@@ -550,6 +580,7 @@ interface InternalState$1 {
550
580
  startBuffered: number;
551
581
  startBufferedId?: string;
552
582
  startNoBuffer: number;
583
+ startReachedSnapshotDataChangeEpoch: number | undefined;
553
584
  startReachedSnapshot: ThresholdSnapshot$1 | undefined;
554
585
  stickyContainerPool: Set<number>;
555
586
  stickyContainers: Map<number, number>;
@@ -599,12 +630,14 @@ interface InternalState$1 {
599
630
  renderItem: LegendListPropsInternal["renderItem"];
600
631
  scrollBuffer?: number;
601
632
  snapToIndices: number[] | undefined;
633
+ positionComponentInternal: React.ComponentType<any> | undefined;
602
634
  stickyPositionComponentInternal: React.ComponentType<any> | undefined;
603
635
  stickyIndicesArr: number[];
604
636
  stickyIndicesSet: Set<number>;
605
637
  stylePaddingBottom: number | undefined;
606
638
  stylePaddingTop: number | undefined;
607
639
  suggestEstimatedItemSize: boolean;
640
+ useWindowScroll: boolean;
608
641
  };
609
642
  }
610
643
  interface ViewableRange$1<T> {
@@ -633,7 +666,7 @@ type LegendListState$1 = {
633
666
  listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
634
667
  listenToPosition: (key: string, callback: (value: number) => void) => () => void;
635
668
  positionAtIndex: (index: number) => number;
636
- positions: Map<string, number>;
669
+ positionByKey: (key: string) => number | undefined;
637
670
  scroll: number;
638
671
  scrollLength: number;
639
672
  scrollVelocity: number;
@@ -672,7 +705,7 @@ type LegendListRef$1 = {
672
705
  scrollIndexIntoView(params: {
673
706
  animated?: boolean | undefined;
674
707
  index: number;
675
- }): void;
708
+ }): Promise<void>;
676
709
  /**
677
710
  * Scrolls a specific index into view.
678
711
  * @param params - Parameters for scrolling.
@@ -682,7 +715,7 @@ type LegendListRef$1 = {
682
715
  scrollItemIntoView(params: {
683
716
  animated?: boolean | undefined;
684
717
  item: any;
685
- }): void;
718
+ }): Promise<void>;
686
719
  /**
687
720
  * Scrolls to the end of the list.
688
721
  * @param options - Options for scrolling.
@@ -692,7 +725,7 @@ type LegendListRef$1 = {
692
725
  scrollToEnd(options?: {
693
726
  animated?: boolean | undefined;
694
727
  viewOffset?: number | undefined;
695
- }): void;
728
+ }): Promise<void>;
696
729
  /**
697
730
  * Scrolls to a specific index in the list.
698
731
  * @param params - Parameters for scrolling.
@@ -706,7 +739,7 @@ type LegendListRef$1 = {
706
739
  index: number;
707
740
  viewOffset?: number | undefined;
708
741
  viewPosition?: number | undefined;
709
- }): void;
742
+ }): Promise<void>;
710
743
  /**
711
744
  * Scrolls to a specific item in the list.
712
745
  * @param params - Parameters for scrolling.
@@ -720,7 +753,7 @@ type LegendListRef$1 = {
720
753
  item: any;
721
754
  viewOffset?: number | undefined;
722
755
  viewPosition?: number | undefined;
723
- }): void;
756
+ }): Promise<void>;
724
757
  /**
725
758
  * Scrolls to a specific offset in pixels.
726
759
  * @param params - Parameters for scrolling.
@@ -730,7 +763,7 @@ type LegendListRef$1 = {
730
763
  scrollToOffset(params: {
731
764
  offset: number;
732
765
  animated?: boolean | undefined;
733
- }): void;
766
+ }): Promise<void>;
734
767
  /**
735
768
  * Sets or adds to the offset of the visible content anchor.
736
769
  * @param value - The offset to set or add.
@@ -858,6 +891,12 @@ type ViewStyle = ViewStyle$1;
858
891
  /** @deprecated Use `@legendapp/list/react-native` or `@legendapp/list/react` for strict typing */
859
892
  type StyleProp<T> = StyleProp$1<T>;
860
893
  /** @deprecated Use `@legendapp/list/react-native` or `@legendapp/list/react` for strict typing */
894
+ type ScrollEventTargetLike = ScrollEventTargetLike$1;
895
+ /** @deprecated Use `@legendapp/list/react-native` or `@legendapp/list/react` for strict typing */
896
+ type ScrollableNodeLike = ScrollableNodeLike$1;
897
+ /** @deprecated Use `@legendapp/list/react-native` or `@legendapp/list/react` for strict typing */
898
+ type LegendListScrollerRef = LegendListScrollerRef$1;
899
+ /** @deprecated Use `@legendapp/list/react-native` or `@legendapp/list/react` for strict typing */
861
900
  type BaseScrollViewProps<TScrollView> = BaseScrollViewProps$1<TScrollView>;
862
901
  /** @deprecated Use `@legendapp/list/react-native` or `@legendapp/list/react` for strict typing */
863
902
  type LegendListPropsBase<ItemT, TScrollViewProps = Record<string, any>, TItemType extends string | undefined = string | undefined> = LegendListPropsBase$1<ItemT, TScrollViewProps, TItemType>;
@@ -1160,4 +1199,4 @@ declare function useSyncLayout(): () => void;
1160
1199
  /** @deprecated Use `@legendapp/list/react-native` or `@legendapp/list/react` for strict typing */
1161
1200
  declare const LegendList: LegendListComponent;
1162
1201
 
1163
- export { type AccessibilityActionEvent, type AccessibilityRole, type AccessibilityState, type AccessibilityValue, type AlwaysRenderConfig, type BaseScrollViewProps, type ColorValue, type ColumnWrapperStyle, type GestureResponderEvent, type GetRenderedItem, type GetRenderedItemResult, type InitialScrollAnchor, type Insets, type InternalState, type LayoutChangeEvent, type LayoutRectangle, LegendList, type LegendListComponent, type LegendListMetrics, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type LegendListState, type LooseAccessibilityActionEvent, type LooseAccessibilityRole, type LooseAccessibilityState, type LooseAccessibilityValue, type LooseColorValue, type LooseGestureResponderEvent, type LoosePointerEvent, type LooseRefreshControlProps, type LooseRole, type LooseScrollViewProps, type MaintainScrollAtEndOptions, type MaintainVisibleContentPositionConfig, type MaintainVisibleContentPositionNormalized, type NativeScrollEvent, type NativeSyntheticEvent, type OnViewableItemsChanged, type PointProp, type PointerEvent, type RefreshControlProps, type Role, type ScrollIndexWithOffset, type ScrollIndexWithOffsetAndContentOffset, type ScrollIndexWithOffsetPosition, type ScrollTarget, type ScrollViewPropsLoose, type StickyHeaderConfig, type StyleProp, type ThresholdSnapshot, type TypedForwardRef, type TypedMemo, type ViewAmountToken, type ViewStyle, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, typedForwardRef, typedMemo, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useSyncLayout, useViewability, useViewabilityAmount };
1202
+ export { type AccessibilityActionEvent, type AccessibilityRole, type AccessibilityState, type AccessibilityValue, type AlwaysRenderConfig, type BaseScrollViewProps, type ColorValue, type ColumnWrapperStyle, type GestureResponderEvent, type GetRenderedItem, type GetRenderedItemResult, type InitialScrollAnchor, type Insets, type InternalState, type LayoutChangeEvent, type LayoutRectangle, LegendList, type LegendListComponent, type LegendListMetrics, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type LegendListScrollerRef, type LegendListState, type LooseAccessibilityActionEvent, type LooseAccessibilityRole, type LooseAccessibilityState, type LooseAccessibilityValue, type LooseColorValue, type LooseGestureResponderEvent, type LoosePointerEvent, type LooseRefreshControlProps, type LooseRole, type LooseScrollViewProps, type MaintainScrollAtEndOptions, type MaintainVisibleContentPositionConfig, type MaintainVisibleContentPositionNormalized, type NativeScrollEvent, type NativeSyntheticEvent, type OnViewableItemsChanged, type PointProp, type PointerEvent, type RefreshControlProps, type Role, type ScrollEventTargetLike, type ScrollIndexWithOffset, type ScrollIndexWithOffsetAndContentOffset, type ScrollIndexWithOffsetPosition, type ScrollTarget, type ScrollViewPropsLoose, type ScrollableNodeLike, type StickyHeaderConfig, type StyleProp, type ThresholdSnapshot, type TypedForwardRef, type TypedMemo, type ViewAmountToken, type ViewStyle, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, typedForwardRef, typedMemo, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useSyncLayout, useViewability, useViewabilityAmount };