@fountain-ui/lab 2.0.0-beta.7 → 2.0.0-beta.71
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/build/commonjs/AnimatedY/AnimatedY.js +8 -10
- package/build/commonjs/AnimatedY/AnimatedY.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetNative.js +65 -7
- package/build/commonjs/BottomSheet/BottomSheetNative.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetProps.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetWeb.js +41 -13
- package/build/commonjs/BottomSheet/BottomSheetWeb.js.map +1 -1
- package/build/commonjs/BottomSheet/useDynamicSnapPoints.js +65 -0
- package/build/commonjs/BottomSheet/useDynamicSnapPoints.js.map +1 -0
- package/build/commonjs/Carousel/Carousel.js +130 -0
- package/build/commonjs/Carousel/Carousel.js.map +1 -0
- package/build/commonjs/Carousel/CarouselProps.js.map +1 -1
- package/build/commonjs/Carousel/animation/animationUtils.js +9 -0
- package/build/commonjs/Carousel/animation/animationUtils.js.map +1 -0
- package/build/commonjs/Carousel/animation/createDefaultItemStyle.js +15 -0
- package/build/commonjs/Carousel/animation/createDefaultItemStyle.js.map +1 -0
- package/build/commonjs/Carousel/animation/createDefaultScrollAnimation.js +26 -0
- package/build/commonjs/Carousel/animation/createDefaultScrollAnimation.js.map +1 -0
- package/build/commonjs/Carousel/animation/index.js +40 -0
- package/build/commonjs/Carousel/animation/index.js.map +1 -0
- package/build/commonjs/Carousel/animation/normalItemStyleFactory.js +27 -0
- package/build/commonjs/Carousel/animation/normalItemStyleFactory.js.map +1 -0
- package/build/commonjs/Carousel/animation/parallaxItemStyleFactory.js +65 -0
- package/build/commonjs/Carousel/animation/parallaxItemStyleFactory.js.map +1 -0
- package/build/commonjs/Carousel/components/InternalContext.js +29 -0
- package/build/commonjs/Carousel/components/InternalContext.js.map +1 -0
- package/build/commonjs/Carousel/components/ItemView.js +66 -0
- package/build/commonjs/Carousel/components/ItemView.js.map +1 -0
- package/build/commonjs/Carousel/components/RootView.js +86 -0
- package/build/commonjs/Carousel/components/RootView.js.map +1 -0
- package/build/commonjs/Carousel/components/ScrollViewGesture.js +84 -0
- package/build/commonjs/Carousel/components/ScrollViewGesture.js.map +1 -0
- package/build/commonjs/Carousel/components/index.js +40 -0
- package/build/commonjs/Carousel/components/index.js.map +1 -0
- package/build/commonjs/Carousel/components/useItemInterpolation.js +65 -0
- package/build/commonjs/Carousel/components/useItemInterpolation.js.map +1 -0
- package/build/commonjs/Carousel/hooks/index.js +48 -0
- package/build/commonjs/Carousel/hooks/index.js.map +1 -0
- package/build/commonjs/Carousel/hooks/useAutoplayController.js +58 -0
- package/build/commonjs/Carousel/hooks/useAutoplayController.js.map +1 -0
- package/build/commonjs/Carousel/hooks/useIndexController.js +55 -0
- package/build/commonjs/Carousel/hooks/useIndexController.js.map +1 -0
- package/build/commonjs/Carousel/hooks/useItemVisibilityStore.js +95 -0
- package/build/commonjs/Carousel/hooks/useItemVisibilityStore.js.map +1 -0
- package/build/commonjs/Carousel/hooks/useLoopedData.js +33 -0
- package/build/commonjs/Carousel/hooks/useLoopedData.js.map +1 -0
- package/build/commonjs/Carousel/hooks/usePagingAnimator.js +202 -0
- package/build/commonjs/Carousel/hooks/usePagingAnimator.js.map +1 -0
- package/build/commonjs/Carousel/index.js +16 -2
- package/build/commonjs/Carousel/index.js.map +1 -1
- package/build/commonjs/Carousel/tick.js +16 -0
- package/build/commonjs/Carousel/tick.js.map +1 -0
- package/build/commonjs/Carousel/types.js +8 -0
- package/build/commonjs/Carousel/types.js.map +1 -0
- package/build/commonjs/ComicViewer/ComicViewer.js +230 -92
- package/build/commonjs/ComicViewer/ComicViewer.js.map +1 -1
- package/build/commonjs/ComicViewer/ComicViewerProps.js.map +1 -1
- package/build/commonjs/ComicViewer/EncodedTile.js +10 -0
- package/build/commonjs/ComicViewer/EncodedTile.js.map +1 -0
- package/build/commonjs/ComicViewer/FastScroll.js +175 -0
- package/build/commonjs/ComicViewer/FastScroll.js.map +1 -0
- package/build/commonjs/ComicViewer/{ComicViewerItemProps.js → FastScrollProps.js} +1 -1
- package/build/commonjs/ComicViewer/FastScrollProps.js.map +1 -0
- package/build/commonjs/ComicViewer/ReloadButton.js +48 -0
- package/build/commonjs/ComicViewer/ReloadButton.js.map +1 -0
- package/build/commonjs/ComicViewer/ViewerItem.js +53 -59
- package/build/commonjs/ComicViewer/ViewerItem.js.map +1 -1
- package/build/commonjs/ComicViewer/index.js.map +1 -1
- package/build/commonjs/ComicViewer/util.js +27 -0
- package/build/commonjs/ComicViewer/util.js.map +1 -0
- package/build/commonjs/DateTimePicker/DateTimePicker.js +10 -1
- package/build/commonjs/DateTimePicker/DateTimePicker.js.map +1 -1
- package/build/commonjs/FlipCard/FlipCard.js +2 -2
- package/build/commonjs/FlipCard/FlipCard.js.map +1 -1
- package/build/commonjs/ViewPager/FluxContext.js +13 -0
- package/build/commonjs/ViewPager/FluxContext.js.map +1 -0
- package/build/commonjs/ViewPager/InternalContext.js +17 -0
- package/build/commonjs/ViewPager/InternalContext.js.map +1 -0
- package/build/commonjs/ViewPager/PageStateContext.js +16 -0
- package/build/commonjs/ViewPager/PageStateContext.js.map +1 -0
- package/build/commonjs/ViewPager/ViewPager.js +81 -0
- package/build/commonjs/ViewPager/ViewPager.js.map +1 -0
- package/build/commonjs/ViewPager/ViewPager.native.js +152 -0
- package/build/commonjs/ViewPager/ViewPager.native.js.map +1 -0
- package/build/commonjs/ViewPager/ViewPagerProps.js.map +1 -1
- package/build/commonjs/ViewPager/components/ChildrenMemoizedPage.js +122 -0
- package/build/commonjs/ViewPager/components/ChildrenMemoizedPage.js.map +1 -0
- package/build/commonjs/ViewPager/components/FluxStoreProvider.js +37 -0
- package/build/commonjs/ViewPager/components/FluxStoreProvider.js.map +1 -0
- package/build/commonjs/ViewPager/components/index.js +24 -0
- package/build/commonjs/ViewPager/components/index.js.map +1 -0
- package/build/commonjs/ViewPager/hooks/index.js +64 -0
- package/build/commonjs/ViewPager/hooks/index.js.map +1 -0
- package/build/commonjs/ViewPager/hooks/useDispatch.js +22 -0
- package/build/commonjs/ViewPager/hooks/useDispatch.js.map +1 -0
- package/build/commonjs/ViewPager/hooks/useEagerState.js +24 -0
- package/build/commonjs/ViewPager/hooks/useEagerState.js.map +1 -0
- package/build/commonjs/ViewPager/hooks/useForceRender.js +16 -0
- package/build/commonjs/ViewPager/hooks/useForceRender.js.map +1 -0
- package/build/commonjs/ViewPager/hooks/useLazyState.js +45 -0
- package/build/commonjs/ViewPager/hooks/useLazyState.js.map +1 -0
- package/build/commonjs/ViewPager/hooks/usePageStore.js +35 -0
- package/build/commonjs/ViewPager/hooks/usePageStore.js.map +1 -0
- package/build/commonjs/ViewPager/hooks/useStore.js +26 -0
- package/build/commonjs/ViewPager/hooks/useStore.js.map +1 -0
- package/build/commonjs/ViewPager/hooks/useViewPagerPageState.js +19 -0
- package/build/commonjs/ViewPager/hooks/useViewPagerPageState.js.map +1 -0
- package/build/commonjs/ViewPager/index.js +42 -2
- package/build/commonjs/ViewPager/index.js.map +1 -1
- package/build/commonjs/ViewPager/types.js +2 -0
- package/build/commonjs/ViewPager/types.js.map +1 -0
- package/build/commonjs/ViewPager/utils.js +12 -45
- package/build/commonjs/ViewPager/utils.js.map +1 -1
- package/build/commonjs/ViewabilityTrackerView/Viewability.js +2 -0
- package/build/commonjs/ViewabilityTrackerView/Viewability.js.map +1 -0
- package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerView.js +45 -0
- package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerView.js.map +1 -0
- package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerViewProps.js +2 -0
- package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerViewProps.js.map +1 -0
- package/build/commonjs/{Carousel/index.native.js → ViewabilityTrackerView/index.js} +3 -3
- package/build/commonjs/ViewabilityTrackerView/index.js.map +1 -0
- package/build/commonjs/ViewabilityTrackerView/measureViewability.js +42 -0
- package/build/commonjs/ViewabilityTrackerView/measureViewability.js.map +1 -0
- package/build/commonjs/ViewabilityTrackerView/useViewabilityTracker.js +88 -0
- package/build/commonjs/ViewabilityTrackerView/useViewabilityTracker.js.map +1 -0
- package/build/commonjs/hooks/index.js +16 -0
- package/build/commonjs/hooks/index.js.map +1 -1
- package/build/commonjs/hooks/useDeferredExecutor.js +45 -0
- package/build/commonjs/hooks/useDeferredExecutor.js.map +1 -0
- package/build/commonjs/hooks/useHeight.js +4 -4
- package/build/commonjs/hooks/useHeight.js.map +1 -1
- package/build/commonjs/hooks/useIsMounted.js +22 -0
- package/build/commonjs/hooks/useIsMounted.js.map +1 -0
- package/build/commonjs/hooks/useUnstableCollapsibleAppBar.js +41 -31
- package/build/commonjs/hooks/useUnstableCollapsibleAppBar.js.map +1 -1
- package/build/commonjs/hooks/useUnstableToggleDisplayStyle.js +2 -2
- package/build/commonjs/hooks/useUnstableToggleDisplayStyle.js.map +1 -1
- package/build/commonjs/index.js +22 -1
- package/build/commonjs/index.js.map +1 -1
- package/build/module/AnimatedY/AnimatedY.js +8 -7
- package/build/module/AnimatedY/AnimatedY.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetNative.js +64 -9
- package/build/module/BottomSheet/BottomSheetNative.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetProps.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetWeb.js +40 -14
- package/build/module/BottomSheet/BottomSheetWeb.js.map +1 -1
- package/build/module/BottomSheet/useDynamicSnapPoints.js +52 -0
- package/build/module/BottomSheet/useDynamicSnapPoints.js.map +1 -0
- package/build/module/Carousel/Carousel.js +109 -0
- package/build/module/Carousel/Carousel.js.map +1 -0
- package/build/module/Carousel/CarouselProps.js.map +1 -1
- package/build/module/Carousel/animation/animationUtils.js +2 -0
- package/build/module/Carousel/animation/animationUtils.js.map +1 -0
- package/build/module/Carousel/animation/createDefaultItemStyle.js +3 -0
- package/build/module/Carousel/animation/createDefaultItemStyle.js.map +1 -0
- package/build/module/Carousel/animation/createDefaultScrollAnimation.js +12 -0
- package/build/module/Carousel/animation/createDefaultScrollAnimation.js.map +1 -0
- package/build/module/Carousel/animation/index.js +5 -0
- package/build/module/Carousel/animation/index.js.map +1 -0
- package/build/module/Carousel/animation/normalItemStyleFactory.js +18 -0
- package/build/module/Carousel/animation/normalItemStyleFactory.js.map +1 -0
- package/build/module/Carousel/animation/parallaxItemStyleFactory.js +55 -0
- package/build/module/Carousel/animation/parallaxItemStyleFactory.js.map +1 -0
- package/build/module/Carousel/components/InternalContext.js +19 -0
- package/build/module/Carousel/components/InternalContext.js.map +1 -0
- package/build/module/Carousel/components/ItemView.js +46 -0
- package/build/module/Carousel/components/ItemView.js.map +1 -0
- package/build/module/Carousel/components/RootView.js +65 -0
- package/build/module/Carousel/components/RootView.js.map +1 -0
- package/build/module/Carousel/components/ScrollViewGesture.js +69 -0
- package/build/module/Carousel/components/ScrollViewGesture.js.map +1 -0
- package/build/module/Carousel/components/index.js +5 -0
- package/build/module/Carousel/components/index.js.map +1 -0
- package/build/module/Carousel/components/useItemInterpolation.js +51 -0
- package/build/module/Carousel/components/useItemInterpolation.js.map +1 -0
- package/build/module/Carousel/hooks/index.js +6 -0
- package/build/module/Carousel/hooks/index.js.map +1 -0
- package/build/module/Carousel/hooks/useAutoplayController.js +48 -0
- package/build/module/Carousel/hooks/useAutoplayController.js.map +1 -0
- package/build/module/Carousel/hooks/useIndexController.js +44 -0
- package/build/module/Carousel/hooks/useIndexController.js.map +1 -0
- package/build/module/Carousel/hooks/useItemVisibilityStore.js +86 -0
- package/build/module/Carousel/hooks/useItemVisibilityStore.js.map +1 -0
- package/build/module/Carousel/hooks/useLoopedData.js +24 -0
- package/build/module/Carousel/hooks/useLoopedData.js.map +1 -0
- package/build/module/Carousel/hooks/usePagingAnimator.js +192 -0
- package/build/module/Carousel/hooks/usePagingAnimator.js.map +1 -0
- package/build/module/Carousel/index.js +2 -1
- package/build/module/Carousel/index.js.map +1 -1
- package/build/module/Carousel/tick.js +6 -0
- package/build/module/Carousel/tick.js.map +1 -0
- package/build/module/Carousel/types.js +4 -0
- package/build/module/Carousel/types.js.map +1 -0
- package/build/module/ComicViewer/ComicViewer.js +229 -93
- package/build/module/ComicViewer/ComicViewer.js.map +1 -1
- package/build/module/ComicViewer/ComicViewerProps.js.map +1 -1
- package/build/module/ComicViewer/EncodedTile.js +3 -0
- package/build/module/ComicViewer/EncodedTile.js.map +1 -0
- package/build/module/ComicViewer/FastScroll.js +152 -0
- package/build/module/ComicViewer/FastScroll.js.map +1 -0
- package/build/module/ComicViewer/FastScrollProps.js +2 -0
- package/build/module/ComicViewer/FastScrollProps.js.map +1 -0
- package/build/module/ComicViewer/ReloadButton.js +33 -0
- package/build/module/ComicViewer/ReloadButton.js.map +1 -0
- package/build/module/ComicViewer/ViewerItem.js +53 -60
- package/build/module/ComicViewer/ViewerItem.js.map +1 -1
- package/build/module/ComicViewer/index.js.map +1 -1
- package/build/module/ComicViewer/util.js +15 -0
- package/build/module/ComicViewer/util.js.map +1 -0
- package/build/module/DateTimePicker/DateTimePicker.js +11 -2
- package/build/module/DateTimePicker/DateTimePicker.js.map +1 -1
- package/build/module/FlipCard/FlipCard.js +2 -2
- package/build/module/FlipCard/FlipCard.js.map +1 -1
- package/build/module/ViewPager/FluxContext.js +4 -0
- package/build/module/ViewPager/FluxContext.js.map +1 -0
- package/build/module/ViewPager/InternalContext.js +7 -0
- package/build/module/ViewPager/InternalContext.js.map +1 -0
- package/build/module/ViewPager/PageStateContext.js +7 -0
- package/build/module/ViewPager/PageStateContext.js.map +1 -0
- package/build/module/ViewPager/ViewPager.js +57 -0
- package/build/module/ViewPager/ViewPager.js.map +1 -0
- package/build/module/ViewPager/ViewPager.native.js +129 -0
- package/build/module/ViewPager/ViewPager.native.js.map +1 -0
- package/build/module/ViewPager/ViewPagerProps.js.map +1 -1
- package/build/module/ViewPager/components/ChildrenMemoizedPage.js +101 -0
- package/build/module/ViewPager/components/ChildrenMemoizedPage.js.map +1 -0
- package/build/module/ViewPager/components/FluxStoreProvider.js +20 -0
- package/build/module/ViewPager/components/FluxStoreProvider.js.map +1 -0
- package/build/module/ViewPager/components/index.js +3 -0
- package/build/module/ViewPager/components/index.js.map +1 -0
- package/build/module/ViewPager/hooks/index.js +8 -0
- package/build/module/ViewPager/hooks/index.js.map +1 -0
- package/build/module/ViewPager/hooks/useDispatch.js +10 -0
- package/build/module/ViewPager/hooks/useDispatch.js.map +1 -0
- package/build/module/ViewPager/hooks/useEagerState.js +12 -0
- package/build/module/ViewPager/hooks/useEagerState.js.map +1 -0
- package/build/module/ViewPager/hooks/useForceRender.js +7 -0
- package/build/module/ViewPager/hooks/useForceRender.js.map +1 -0
- package/build/module/ViewPager/hooks/useLazyState.js +30 -0
- package/build/module/ViewPager/hooks/useLazyState.js.map +1 -0
- package/build/module/ViewPager/hooks/usePageStore.js +25 -0
- package/build/module/ViewPager/hooks/usePageStore.js.map +1 -0
- package/build/module/ViewPager/hooks/useStore.js +14 -0
- package/build/module/ViewPager/hooks/useStore.js.map +1 -0
- package/build/module/ViewPager/hooks/useViewPagerPageState.js +7 -0
- package/build/module/ViewPager/hooks/useViewPagerPageState.js.map +1 -0
- package/build/module/ViewPager/index.js +3 -1
- package/build/module/ViewPager/index.js.map +1 -1
- package/build/module/ViewPager/types.js +2 -0
- package/build/module/ViewPager/types.js.map +1 -0
- package/build/module/ViewPager/utils.js +6 -34
- package/build/module/ViewPager/utils.js.map +1 -1
- package/build/module/ViewabilityTrackerView/Viewability.js +2 -0
- package/build/module/ViewabilityTrackerView/Viewability.js.map +1 -0
- package/build/module/ViewabilityTrackerView/ViewabilityTrackerView.js +28 -0
- package/build/module/ViewabilityTrackerView/ViewabilityTrackerView.js.map +1 -0
- package/build/module/ViewabilityTrackerView/ViewabilityTrackerViewProps.js +2 -0
- package/build/module/ViewabilityTrackerView/ViewabilityTrackerViewProps.js.map +1 -0
- package/build/module/ViewabilityTrackerView/index.js +2 -0
- package/build/module/ViewabilityTrackerView/index.js.map +1 -0
- package/build/module/ViewabilityTrackerView/measureViewability.js +34 -0
- package/build/module/ViewabilityTrackerView/measureViewability.js.map +1 -0
- package/build/module/ViewabilityTrackerView/useViewabilityTracker.js +73 -0
- package/build/module/ViewabilityTrackerView/useViewabilityTracker.js.map +1 -0
- package/build/module/hooks/index.js +2 -0
- package/build/module/hooks/index.js.map +1 -1
- package/build/module/hooks/useDeferredExecutor.js +33 -0
- package/build/module/hooks/useDeferredExecutor.js.map +1 -0
- package/build/module/hooks/useHeight.js +2 -3
- package/build/module/hooks/useHeight.js.map +1 -1
- package/build/module/hooks/useIsMounted.js +13 -0
- package/build/module/hooks/useIsMounted.js.map +1 -0
- package/build/module/hooks/useUnstableCollapsibleAppBar.js +40 -24
- package/build/module/hooks/useUnstableCollapsibleAppBar.js.map +1 -1
- package/build/module/hooks/useUnstableToggleDisplayStyle.js +2 -2
- package/build/module/hooks/useUnstableToggleDisplayStyle.js.map +1 -1
- package/build/module/index.js +2 -0
- package/build/module/index.js.map +1 -1
- package/build/typescript/AnimatedY/AnimatedY.d.ts +1 -0
- package/build/typescript/BottomSheet/BottomSheetNative.d.ts +1 -0
- package/build/typescript/BottomSheet/BottomSheetProps.d.ts +32 -1
- package/build/typescript/BottomSheet/BottomSheetWeb.d.ts +1 -0
- package/build/typescript/BottomSheet/TransparentBackdrop.d.ts +1 -0
- package/build/typescript/BottomSheet/useDynamicSnapPoints.d.ts +12 -0
- package/build/typescript/Carousel/Carousel.d.ts +5 -0
- package/build/typescript/Carousel/CarouselProps.d.ts +33 -48
- package/build/typescript/Carousel/animation/animationUtils.d.ts +1 -0
- package/build/typescript/Carousel/animation/createDefaultItemStyle.d.ts +2 -0
- package/build/typescript/Carousel/animation/createDefaultScrollAnimation.d.ts +2 -0
- package/build/typescript/Carousel/animation/index.d.ts +4 -0
- package/build/typescript/Carousel/animation/normalItemStyleFactory.d.ts +2 -0
- package/build/typescript/Carousel/animation/parallaxItemStyleFactory.d.ts +9 -0
- package/build/typescript/Carousel/components/InternalContext.d.ts +14 -0
- package/build/typescript/Carousel/components/ItemView.d.ts +9 -0
- package/build/typescript/Carousel/components/RootView.d.ts +16 -0
- package/build/typescript/Carousel/components/ScrollViewGesture.d.ts +12 -0
- package/build/typescript/Carousel/components/index.d.ts +4 -0
- package/build/typescript/Carousel/components/useItemInterpolation.d.ts +2 -0
- package/build/typescript/Carousel/hooks/index.d.ts +5 -0
- package/build/typescript/Carousel/hooks/useAutoplayController.d.ts +7 -0
- package/build/typescript/Carousel/hooks/useIndexController.d.ts +10 -0
- package/build/typescript/Carousel/hooks/useItemVisibilityStore.d.ts +7 -0
- package/build/typescript/Carousel/hooks/useLoopedData.d.ts +1 -0
- package/build/typescript/Carousel/hooks/usePagingAnimator.d.ts +17 -0
- package/build/typescript/Carousel/index.d.ts +3 -1
- package/build/typescript/Carousel/tick.d.ts +2 -0
- package/build/typescript/Carousel/types.d.ts +91 -0
- package/build/typescript/ComicViewer/ComicViewer.d.ts +2 -1
- package/build/typescript/ComicViewer/ComicViewerProps.d.ts +61 -43
- package/build/typescript/ComicViewer/EncodedTile.d.ts +2 -0
- package/build/typescript/ComicViewer/FastScroll.d.ts +4 -0
- package/build/typescript/ComicViewer/FastScrollProps.d.ts +74 -0
- package/build/typescript/ComicViewer/ReloadButton.d.ts +7 -0
- package/build/typescript/ComicViewer/ViewerItem.d.ts +46 -7
- package/build/typescript/ComicViewer/index.d.ts +3 -2
- package/build/typescript/ComicViewer/util.d.ts +2 -0
- package/build/typescript/DateTimePicker/DateTimePicker.d.ts +1 -0
- package/build/typescript/DateTimePicker/YearPicker.d.ts +1 -0
- package/build/typescript/FlipCard/FlipCard.d.ts +1 -0
- package/build/typescript/StatusBarProvider/StatusBarProvider.d.ts +1 -0
- package/build/typescript/ViewPager/FluxContext.d.ts +5 -0
- package/build/typescript/ViewPager/InternalContext.d.ts +7 -0
- package/build/typescript/ViewPager/PageStateContext.d.ts +6 -0
- package/build/typescript/ViewPager/ViewPager.d.ts +5 -0
- package/build/typescript/ViewPager/ViewPager.native.d.ts +5 -0
- package/build/typescript/ViewPager/ViewPagerProps.d.ts +21 -27
- package/build/typescript/ViewPager/components/ChildrenMemoizedPage.d.ts +14 -0
- package/build/typescript/ViewPager/components/FluxStoreProvider.d.ts +6 -0
- package/build/typescript/ViewPager/components/index.d.ts +2 -0
- package/build/typescript/ViewPager/hooks/index.d.ts +7 -0
- package/build/typescript/ViewPager/hooks/useDispatch.d.ts +2 -0
- package/build/typescript/ViewPager/hooks/useEagerState.d.ts +1 -0
- package/build/typescript/ViewPager/hooks/useForceRender.d.ts +2 -0
- package/build/typescript/ViewPager/hooks/useLazyState.d.ts +2 -0
- package/build/typescript/ViewPager/hooks/usePageStore.d.ts +2 -0
- package/build/typescript/ViewPager/hooks/useStore.d.ts +2 -0
- package/build/typescript/ViewPager/hooks/useViewPagerPageState.d.ts +1 -0
- package/build/typescript/ViewPager/index.d.ts +4 -1
- package/build/typescript/ViewPager/types.d.ts +12 -0
- package/build/typescript/ViewPager/utils.d.ts +5 -20
- package/build/typescript/ViewabilityTrackerView/Viewability.d.ts +3 -0
- package/build/typescript/ViewabilityTrackerView/ViewabilityTrackerView.d.ts +3 -0
- package/build/typescript/ViewabilityTrackerView/ViewabilityTrackerViewProps.d.ts +22 -0
- package/build/typescript/ViewabilityTrackerView/index.d.ts +2 -0
- package/build/typescript/ViewabilityTrackerView/measureViewability.d.ts +11 -0
- package/build/typescript/ViewabilityTrackerView/useViewabilityTracker.d.ts +11 -0
- package/build/typescript/hooks/index.d.ts +2 -0
- package/build/typescript/hooks/useDeferredExecutor.d.ts +11 -0
- package/build/typescript/hooks/useIsMounted.d.ts +4 -0
- package/build/typescript/index.d.ts +2 -0
- package/package.json +10 -25
- package/src/AnimatedY/AnimatedY.tsx +10 -7
- package/src/BottomSheet/BottomSheetNative.tsx +68 -6
- package/src/BottomSheet/BottomSheetProps.ts +38 -1
- package/src/BottomSheet/BottomSheetWeb.tsx +54 -16
- package/src/BottomSheet/useDynamicSnapPoints.ts +73 -0
- package/src/Carousel/Carousel.tsx +135 -0
- package/src/Carousel/CarouselProps.ts +42 -53
- package/src/Carousel/animation/animationUtils.ts +1 -0
- package/src/Carousel/animation/createDefaultItemStyle.ts +3 -0
- package/src/Carousel/animation/createDefaultScrollAnimation.ts +14 -0
- package/src/Carousel/animation/index.ts +4 -0
- package/src/Carousel/animation/normalItemStyleFactory.ts +19 -0
- package/src/Carousel/animation/parallaxItemStyleFactory.ts +79 -0
- package/src/Carousel/components/InternalContext.ts +33 -0
- package/src/Carousel/components/ItemView.tsx +66 -0
- package/src/Carousel/components/RootView.tsx +79 -0
- package/src/Carousel/components/ScrollViewGesture.tsx +93 -0
- package/src/Carousel/components/index.ts +4 -0
- package/src/Carousel/components/useItemInterpolation.ts +107 -0
- package/src/Carousel/hooks/index.ts +5 -0
- package/src/Carousel/hooks/useAutoplayController.ts +57 -0
- package/src/Carousel/hooks/useIndexController.tsx +57 -0
- package/src/Carousel/hooks/useItemVisibilityStore.ts +107 -0
- package/src/Carousel/hooks/useLoopedData.ts +26 -0
- package/src/Carousel/hooks/usePagingAnimator.ts +255 -0
- package/src/Carousel/index.ts +4 -2
- package/src/Carousel/tick.ts +6 -0
- package/src/Carousel/types.ts +114 -0
- package/src/ComicViewer/ComicViewer.tsx +268 -106
- package/src/ComicViewer/ComicViewerProps.ts +66 -44
- package/src/ComicViewer/EncodedTile.ts +3 -0
- package/src/ComicViewer/FastScroll.tsx +176 -0
- package/src/ComicViewer/FastScrollProps.ts +88 -0
- package/src/ComicViewer/ReloadButton.tsx +36 -0
- package/src/ComicViewer/ViewerItem.tsx +104 -62
- package/src/ComicViewer/index.ts +8 -2
- package/src/ComicViewer/util.ts +15 -0
- package/src/DateTimePicker/DateTimePicker.tsx +9 -1
- package/src/FlipCard/FlipCard.tsx +2 -2
- package/src/ViewPager/FluxContext.ts +8 -0
- package/src/ViewPager/InternalContext.ts +13 -0
- package/src/ViewPager/PageStateContext.ts +11 -0
- package/src/ViewPager/ViewPager.native.tsx +152 -0
- package/src/ViewPager/ViewPager.tsx +69 -0
- package/src/ViewPager/ViewPagerProps.ts +25 -34
- package/src/ViewPager/components/ChildrenMemoizedPage.tsx +124 -0
- package/src/ViewPager/components/FluxStoreProvider.tsx +27 -0
- package/src/ViewPager/components/index.ts +2 -0
- package/src/ViewPager/hooks/index.ts +7 -0
- package/src/ViewPager/hooks/useDispatch.ts +11 -0
- package/src/ViewPager/hooks/useEagerState.ts +14 -0
- package/src/ViewPager/hooks/useForceRender.ts +7 -0
- package/src/ViewPager/hooks/useLazyState.ts +32 -0
- package/src/ViewPager/hooks/usePageStore.ts +30 -0
- package/src/ViewPager/hooks/useStore.ts +15 -0
- package/src/ViewPager/hooks/useViewPagerPageState.ts +6 -0
- package/src/ViewPager/index.ts +11 -2
- package/src/ViewPager/types.ts +15 -0
- package/src/ViewPager/utils.tsx +9 -56
- package/src/ViewabilityTrackerView/Viewability.ts +3 -0
- package/src/ViewabilityTrackerView/ViewabilityTrackerView.tsx +33 -0
- package/src/ViewabilityTrackerView/ViewabilityTrackerViewProps.ts +25 -0
- package/src/ViewabilityTrackerView/index.ts +2 -0
- package/src/ViewabilityTrackerView/measureViewability.ts +54 -0
- package/src/ViewabilityTrackerView/useViewabilityTracker.ts +85 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useDeferredExecutor.ts +46 -0
- package/src/hooks/useHeight.ts +3 -4
- package/src/hooks/useIsMounted.ts +19 -0
- package/src/hooks/useUnstableCollapsibleAppBar.ts +38 -23
- package/src/hooks/useUnstableToggleDisplayStyle.ts +2 -1
- package/src/index.ts +3 -0
- package/build/commonjs/Carousel/CarouselNative.js +0 -72
- package/build/commonjs/Carousel/CarouselNative.js.map +0 -1
- package/build/commonjs/Carousel/CarouselWeb.js +0 -237
- package/build/commonjs/Carousel/CarouselWeb.js.map +0 -1
- package/build/commonjs/Carousel/index.native.js.map +0 -1
- package/build/commonjs/Carousel/utils.js +0 -19
- package/build/commonjs/Carousel/utils.js.map +0 -1
- package/build/commonjs/ComicViewer/ComicViewerItemProps.js.map +0 -1
- package/build/commonjs/ViewPager/ChildrenMemoizedPage.js +0 -49
- package/build/commonjs/ViewPager/ChildrenMemoizedPage.js.map +0 -1
- package/build/commonjs/ViewPager/ViewPagerNative.js +0 -72
- package/build/commonjs/ViewPager/ViewPagerNative.js.map +0 -1
- package/build/commonjs/ViewPager/ViewPagerWeb.js +0 -55
- package/build/commonjs/ViewPager/ViewPagerWeb.js.map +0 -1
- package/build/commonjs/ViewPager/index.native.js +0 -16
- package/build/commonjs/ViewPager/index.native.js.map +0 -1
- package/build/commonjs/hooks/useWidth.js +0 -29
- package/build/commonjs/hooks/useWidth.js.map +0 -1
- package/build/module/Carousel/CarouselNative.js +0 -54
- package/build/module/Carousel/CarouselNative.js.map +0 -1
- package/build/module/Carousel/CarouselWeb.js +0 -215
- package/build/module/Carousel/CarouselWeb.js.map +0 -1
- package/build/module/Carousel/index.native.js +0 -2
- package/build/module/Carousel/index.native.js.map +0 -1
- package/build/module/Carousel/utils.js +0 -7
- package/build/module/Carousel/utils.js.map +0 -1
- package/build/module/ComicViewer/ComicViewerItemProps.js +0 -2
- package/build/module/ComicViewer/ComicViewerItemProps.js.map +0 -1
- package/build/module/ViewPager/ChildrenMemoizedPage.js +0 -37
- package/build/module/ViewPager/ChildrenMemoizedPage.js.map +0 -1
- package/build/module/ViewPager/ViewPagerNative.js +0 -53
- package/build/module/ViewPager/ViewPagerNative.js.map +0 -1
- package/build/module/ViewPager/ViewPagerWeb.js +0 -41
- package/build/module/ViewPager/ViewPagerWeb.js.map +0 -1
- package/build/module/ViewPager/index.native.js +0 -2
- package/build/module/ViewPager/index.native.js.map +0 -1
- package/build/module/hooks/useWidth.js +0 -15
- package/build/module/hooks/useWidth.js.map +0 -1
- package/build/typescript/Carousel/CarouselNative.d.ts +0 -2
- package/build/typescript/Carousel/CarouselWeb.d.ts +0 -4
- package/build/typescript/Carousel/index.native.d.ts +0 -1
- package/build/typescript/Carousel/utils.d.ts +0 -6
- package/build/typescript/ComicViewer/ComicViewerItemProps.d.ts +0 -12
- package/build/typescript/ViewPager/ChildrenMemoizedPage.d.ts +0 -4
- package/build/typescript/ViewPager/ViewPagerNative.d.ts +0 -2
- package/build/typescript/ViewPager/ViewPagerWeb.d.ts +0 -2
- package/build/typescript/ViewPager/index.native.d.ts +0 -1
- package/build/typescript/hooks/useWidth.d.ts +0 -2
- package/src/Carousel/CarouselNative.tsx +0 -67
- package/src/Carousel/CarouselWeb.tsx +0 -222
- package/src/Carousel/index.native.ts +0 -1
- package/src/Carousel/utils.ts +0 -11
- package/src/ComicViewer/ComicViewerItemProps.ts +0 -15
- package/src/ViewPager/ChildrenMemoizedPage.tsx +0 -36
- package/src/ViewPager/ViewPagerNative.tsx +0 -66
- package/src/ViewPager/ViewPagerWeb.tsx +0 -52
- package/src/ViewPager/index.native.ts +0 -1
- package/src/hooks/useWidth.ts +0 -17
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { useCallback, useMemo, useRef } from 'react';
|
|
2
|
+
import { Animated } from 'react-native';
|
|
3
|
+
import { useAnimatedValue } from '@fountain-ui/core';
|
|
4
|
+
import type {
|
|
5
|
+
CreateScrollAnimation,
|
|
6
|
+
DirectionalPagingAnimationConfig,
|
|
7
|
+
IndexController,
|
|
8
|
+
IndexPagingAnimationConfig,
|
|
9
|
+
PagingAnimationConfig,
|
|
10
|
+
PagingAnimationType,
|
|
11
|
+
PagingDirection,
|
|
12
|
+
StartPagingAnimation,
|
|
13
|
+
} from '../types';
|
|
14
|
+
|
|
15
|
+
export interface PagingAnimatorConfig {
|
|
16
|
+
createScrollAnimation: CreateScrollAnimation;
|
|
17
|
+
itemWidth: number;
|
|
18
|
+
indexController: IndexController;
|
|
19
|
+
initialIndex: number;
|
|
20
|
+
loop: boolean;
|
|
21
|
+
numberOfData: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface PagingAnimator {
|
|
25
|
+
gestureTranslationX: Animated.Value;
|
|
26
|
+
globalInterpolation: Animated.AnimatedInterpolation;
|
|
27
|
+
interruptAnimation: () => void;
|
|
28
|
+
startPagingAnimation: StartPagingAnimation;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function directionToValue(itemWidth: number) {
|
|
32
|
+
return function (direction: PagingDirection): number {
|
|
33
|
+
switch (direction) {
|
|
34
|
+
case 'next':
|
|
35
|
+
return -itemWidth;
|
|
36
|
+
case 'prev':
|
|
37
|
+
return itemWidth;
|
|
38
|
+
case 'stay':
|
|
39
|
+
return 0;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function toValueCompensator(itemWidth: number) {
|
|
45
|
+
return function (toValue: number, currentOffset: number): number {
|
|
46
|
+
const remainder = Math.abs(currentOffset % itemWidth);
|
|
47
|
+
|
|
48
|
+
const halfOfItemWidth = Math.abs(itemWidth / 2);
|
|
49
|
+
const compensateVector = remainder > halfOfItemWidth
|
|
50
|
+
? remainder - itemWidth
|
|
51
|
+
: remainder;
|
|
52
|
+
|
|
53
|
+
const direction = currentOffset > 0 ? -1 : 1;
|
|
54
|
+
|
|
55
|
+
return toValue + (direction * compensateVector);
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default function usePagingAnimator(config: PagingAnimatorConfig): PagingAnimator {
|
|
60
|
+
const {
|
|
61
|
+
createScrollAnimation,
|
|
62
|
+
itemWidth,
|
|
63
|
+
indexController,
|
|
64
|
+
initialIndex,
|
|
65
|
+
loop,
|
|
66
|
+
numberOfData,
|
|
67
|
+
} = config;
|
|
68
|
+
|
|
69
|
+
const {
|
|
70
|
+
getCurrentIndex,
|
|
71
|
+
lastIndex,
|
|
72
|
+
notifyScrollStateHasChanged,
|
|
73
|
+
} = indexController;
|
|
74
|
+
|
|
75
|
+
const initialOffsetX = itemWidth * initialIndex;
|
|
76
|
+
const accumulativeOffsetX = useAnimatedValue(initialOffsetX);
|
|
77
|
+
const animationOffsetX = useAnimatedValue(0);
|
|
78
|
+
const gestureTranslationX = useAnimatedValue(0);
|
|
79
|
+
|
|
80
|
+
const globalInterpolation = useMemo(() => {
|
|
81
|
+
return Animated.add(
|
|
82
|
+
Animated.add(accumulativeOffsetX, animationOffsetX),
|
|
83
|
+
gestureTranslationX,
|
|
84
|
+
);
|
|
85
|
+
}, []);
|
|
86
|
+
|
|
87
|
+
const toValueRef = useRef<number>(0);
|
|
88
|
+
const currentOffsetRef = useRef<number>(0);
|
|
89
|
+
|
|
90
|
+
const isAnimatingRef = useRef<boolean>(false);
|
|
91
|
+
|
|
92
|
+
const maxWidth = Math.abs(numberOfData * itemWidth);
|
|
93
|
+
|
|
94
|
+
const ensureOffsetBoundary: (offset: number) => number = useCallback((offset: number) => {
|
|
95
|
+
if (loop) {
|
|
96
|
+
const isCloseToEnd = Math.abs(offset) >= (maxWidth - itemWidth);
|
|
97
|
+
if (isCloseToEnd) {
|
|
98
|
+
const signOfOffset = offset > 0 ? 1 : -1;
|
|
99
|
+
return offset + (-signOfOffset * maxWidth);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return offset % maxWidth;
|
|
104
|
+
}, [itemWidth, loop, maxWidth]);
|
|
105
|
+
|
|
106
|
+
const requireNewOffset = useCallback((newOffset: number) => {
|
|
107
|
+
const nextOffset = ensureOffsetBoundary(newOffset);
|
|
108
|
+
|
|
109
|
+
currentOffsetRef.current = nextOffset;
|
|
110
|
+
accumulativeOffsetX.setValue(nextOffset);
|
|
111
|
+
|
|
112
|
+
toValueRef.current = 0;
|
|
113
|
+
animationOffsetX.setValue(0);
|
|
114
|
+
}, [
|
|
115
|
+
ensureOffsetBoundary,
|
|
116
|
+
]);
|
|
117
|
+
|
|
118
|
+
const interruptAnimation = useCallback(() => {
|
|
119
|
+
if (!isAnimatingRef.current) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
animationOffsetX.stopAnimation(lastValue => {
|
|
124
|
+
isAnimatingRef.current = false;
|
|
125
|
+
|
|
126
|
+
const prevOffset = currentOffsetRef.current;
|
|
127
|
+
const totalOffset = prevOffset + lastValue;
|
|
128
|
+
|
|
129
|
+
requireNewOffset(totalOffset);
|
|
130
|
+
|
|
131
|
+
notifyScrollStateHasChanged({ offset: totalOffset, state: 'interrupted' });
|
|
132
|
+
});
|
|
133
|
+
}, [
|
|
134
|
+
notifyScrollStateHasChanged,
|
|
135
|
+
requireNewOffset,
|
|
136
|
+
]);
|
|
137
|
+
|
|
138
|
+
const finalizeAnimation = useCallback(() => {
|
|
139
|
+
isAnimatingRef.current = false;
|
|
140
|
+
|
|
141
|
+
const prevOffset = currentOffsetRef.current;
|
|
142
|
+
const toValue = toValueRef.current;
|
|
143
|
+
const totalOffset = prevOffset + toValue;
|
|
144
|
+
|
|
145
|
+
requireNewOffset(totalOffset);
|
|
146
|
+
|
|
147
|
+
notifyScrollStateHasChanged({ offset: totalOffset, state: 'idle' });
|
|
148
|
+
}, [
|
|
149
|
+
notifyScrollStateHasChanged,
|
|
150
|
+
requireNewOffset,
|
|
151
|
+
]);
|
|
152
|
+
|
|
153
|
+
const startPagingAnimation = useCallback((type: PagingAnimationType, config: PagingAnimationConfig) => {
|
|
154
|
+
if (isAnimatingRef.current) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const configWithDefaults: PagingAnimationConfig = {
|
|
159
|
+
animated: true,
|
|
160
|
+
...config,
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const currentIndex = getCurrentIndex();
|
|
164
|
+
|
|
165
|
+
const getValueByDirectionOnAllAdjacentItemsVisible = directionToValue(itemWidth);
|
|
166
|
+
const compensateToValue = toValueCompensator(itemWidth);
|
|
167
|
+
|
|
168
|
+
const getValueByDirectionalPagingOnLoopDisabled = (_config: DirectionalPagingAnimationConfig): number => {
|
|
169
|
+
const { direction, isOriginatedFromGesture } = _config;
|
|
170
|
+
|
|
171
|
+
if (currentIndex === 0 && direction === 'prev') {
|
|
172
|
+
return isOriginatedFromGesture
|
|
173
|
+
? getValueByDirectionOnAllAdjacentItemsVisible('stay')
|
|
174
|
+
: -lastIndex * itemWidth; // last position
|
|
175
|
+
} else if (currentIndex === lastIndex && direction === 'next') {
|
|
176
|
+
return isOriginatedFromGesture
|
|
177
|
+
? getValueByDirectionOnAllAdjacentItemsVisible('stay')
|
|
178
|
+
: lastIndex * itemWidth; // first position
|
|
179
|
+
}
|
|
180
|
+
return getValueByDirectionOnAllAdjacentItemsVisible(direction);
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const getValueByDirectionalPaging = (_config: DirectionalPagingAnimationConfig): number => {
|
|
184
|
+
const _configWithDefaults: DirectionalPagingAnimationConfig = {
|
|
185
|
+
isOriginatedFromGesture: false,
|
|
186
|
+
..._config,
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
return loop
|
|
190
|
+
? getValueByDirectionOnAllAdjacentItemsVisible(_configWithDefaults.direction)
|
|
191
|
+
: getValueByDirectionalPagingOnLoopDisabled(_configWithDefaults);
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const getValueByIndexPaging = ({ index }: IndexPagingAnimationConfig): number => {
|
|
195
|
+
if (index < 0 || index > lastIndex || index === currentIndex) {
|
|
196
|
+
// no animation if index is invalid or equals to current index
|
|
197
|
+
return 0;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const distance = Math.abs(currentIndex - index) * itemWidth;
|
|
201
|
+
const direction = index > currentIndex ? -1 : 1;
|
|
202
|
+
|
|
203
|
+
return distance * direction;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const wantedToValue = type === 'directional'
|
|
207
|
+
// @ts-ignore
|
|
208
|
+
? getValueByDirectionalPaging(configWithDefaults)
|
|
209
|
+
// @ts-ignore
|
|
210
|
+
: getValueByIndexPaging(configWithDefaults);
|
|
211
|
+
|
|
212
|
+
const toValue = compensateToValue(wantedToValue, currentOffsetRef.current);
|
|
213
|
+
|
|
214
|
+
toValueRef.current = toValue;
|
|
215
|
+
isAnimatingRef.current = true;
|
|
216
|
+
|
|
217
|
+
notifyScrollStateHasChanged({
|
|
218
|
+
offset: currentOffsetRef.current + toValue,
|
|
219
|
+
state: 'dragging',
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
const lastGestureTranslationX: number = configWithDefaults.lastGestureTranslationX ?? 0;
|
|
223
|
+
if (Number.isFinite(lastGestureTranslationX)) {
|
|
224
|
+
animationOffsetX.setValue(lastGestureTranslationX);
|
|
225
|
+
gestureTranslationX.setValue(0);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (configWithDefaults.animated) {
|
|
229
|
+
const animation = createScrollAnimation(animationOffsetX, toValue);
|
|
230
|
+
|
|
231
|
+
animation.start(({ finished }) => {
|
|
232
|
+
if (finished) {
|
|
233
|
+
finalizeAnimation();
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
} else {
|
|
237
|
+
finalizeAnimation();
|
|
238
|
+
}
|
|
239
|
+
}, [
|
|
240
|
+
createScrollAnimation,
|
|
241
|
+
getCurrentIndex,
|
|
242
|
+
finalizeAnimation,
|
|
243
|
+
itemWidth,
|
|
244
|
+
lastIndex,
|
|
245
|
+
loop,
|
|
246
|
+
notifyScrollStateHasChanged,
|
|
247
|
+
]);
|
|
248
|
+
|
|
249
|
+
return {
|
|
250
|
+
gestureTranslationX,
|
|
251
|
+
globalInterpolation,
|
|
252
|
+
interruptAnimation,
|
|
253
|
+
startPagingAnimation,
|
|
254
|
+
};
|
|
255
|
+
};
|
package/src/Carousel/index.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export { default } from './
|
|
2
|
-
export type { default as CarouselProps } from './CarouselProps';
|
|
1
|
+
export { default } from './Carousel';
|
|
2
|
+
export type { default as CarouselProps } from './CarouselProps';
|
|
3
|
+
export type { CarouselInstance } from './types';
|
|
4
|
+
export { normalItemStyleFactory, parallaxItemStyleFactory } from './animation';
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { Animated, ViewProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
const directions = ['next', 'prev', 'stay'] as const;
|
|
5
|
+
|
|
6
|
+
export type PagingDirection = (typeof directions)[number];
|
|
7
|
+
|
|
8
|
+
const scrollStates = ['idle', 'dragging', 'interrupted'] as const;
|
|
9
|
+
|
|
10
|
+
export type ScrollState = (typeof scrollStates)[number];
|
|
11
|
+
|
|
12
|
+
export type ItemHeight = number | 'auto';
|
|
13
|
+
|
|
14
|
+
export interface RenderItem<T> {
|
|
15
|
+
(info: { item: T, index: number, interpolation: Animated.AnimatedInterpolation }): ReactElement | null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface CreateScrollAnimation {
|
|
19
|
+
(aValue: Animated.AnimatedValue, toValue: number): Animated.CompositeAnimation;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface CreateItemStyle {
|
|
23
|
+
(itemInterpolation: Animated.AnimatedInterpolation, itemWidth: number): Animated.AnimatedProps<ViewProps['style']>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface GetCurrentIndex {
|
|
27
|
+
(): number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface OnIndexChange {
|
|
31
|
+
(itemIndex: number): void;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface OnPositionChange {
|
|
35
|
+
(position: number): void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface ScrollStateChangeEvent {
|
|
39
|
+
offset: number;
|
|
40
|
+
state: ScrollState;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface IndexController {
|
|
44
|
+
getCurrentIndex: GetCurrentIndex;
|
|
45
|
+
lastIndex: number;
|
|
46
|
+
notifyScrollStateHasChanged: (event: ScrollStateChangeEvent) => void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type PagingAnimationType = 'directional' | 'index';
|
|
50
|
+
|
|
51
|
+
export interface BasePagingAnimationConfig {
|
|
52
|
+
animated?: boolean;
|
|
53
|
+
lastGestureTranslationX?: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface DirectionalPagingAnimationConfig extends BasePagingAnimationConfig {
|
|
57
|
+
direction: PagingDirection;
|
|
58
|
+
isOriginatedFromGesture?: boolean;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface IndexPagingAnimationConfig extends BasePagingAnimationConfig {
|
|
62
|
+
index: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export type PagingAnimationConfig = DirectionalPagingAnimationConfig | IndexPagingAnimationConfig;
|
|
66
|
+
|
|
67
|
+
export interface StartPagingAnimation {
|
|
68
|
+
(type: PagingAnimationType, config: PagingAnimationConfig): void;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type VisibleIndexRanges = Array<[number, number]>;
|
|
72
|
+
|
|
73
|
+
export interface StoreSubscription {
|
|
74
|
+
(): void;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface ItemVisibilityStore {
|
|
78
|
+
dispatch: (ranges: VisibleIndexRanges) => void;
|
|
79
|
+
subscribe: (listener: (ranges: VisibleIndexRanges) => void) => StoreSubscription;
|
|
80
|
+
removeAllListeners: () => void;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface AutoplayController {
|
|
84
|
+
pause: () => void;
|
|
85
|
+
resume: () => void;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface ScrollToOption {
|
|
89
|
+
index: number;
|
|
90
|
+
animated?: boolean;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface CarouselInstance {
|
|
94
|
+
/**
|
|
95
|
+
* Get current visible item index.
|
|
96
|
+
*/
|
|
97
|
+
getCurrentIndex: GetCurrentIndex;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Scroll to next visible item.
|
|
101
|
+
*/
|
|
102
|
+
next: () => void;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Scroll to previous visible item.
|
|
106
|
+
*/
|
|
107
|
+
prev: () => void;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Scroll to desired indexed item.
|
|
111
|
+
* Invalid index is ignored.
|
|
112
|
+
*/
|
|
113
|
+
scrollTo: (option: ScrollToOption) => void;
|
|
114
|
+
}
|