@fountain-ui/lab 2.0.0-beta.9 → 3.0.0-alpha.1

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.
Files changed (474) hide show
  1. package/build/commonjs/BottomSheet/BottomSheetNative.js +78 -27
  2. package/build/commonjs/BottomSheet/BottomSheetNative.js.map +1 -1
  3. package/build/commonjs/BottomSheet/BottomSheetProps.js.map +1 -1
  4. package/build/commonjs/BottomSheet/BottomSheetWeb.js +63 -17
  5. package/build/commonjs/BottomSheet/BottomSheetWeb.js.map +1 -1
  6. package/build/commonjs/BottomSheet/useDynamicSnapPoints.js +79 -0
  7. package/build/commonjs/BottomSheet/useDynamicSnapPoints.js.map +1 -0
  8. package/build/commonjs/Carousel/Carousel.js +130 -0
  9. package/build/commonjs/Carousel/Carousel.js.map +1 -0
  10. package/build/commonjs/Carousel/CarouselProps.js.map +1 -1
  11. package/build/commonjs/Carousel/animation/animationUtils.js +9 -0
  12. package/build/commonjs/Carousel/animation/animationUtils.js.map +1 -0
  13. package/build/commonjs/Carousel/animation/createDefaultItemStyle.js +15 -0
  14. package/build/commonjs/Carousel/animation/createDefaultItemStyle.js.map +1 -0
  15. package/build/commonjs/Carousel/animation/createDefaultScrollAnimation.js +26 -0
  16. package/build/commonjs/Carousel/animation/createDefaultScrollAnimation.js.map +1 -0
  17. package/build/commonjs/Carousel/animation/index.js +40 -0
  18. package/build/commonjs/Carousel/animation/index.js.map +1 -0
  19. package/build/commonjs/Carousel/animation/normalItemStyleFactory.js +27 -0
  20. package/build/commonjs/Carousel/animation/normalItemStyleFactory.js.map +1 -0
  21. package/build/commonjs/Carousel/animation/parallaxItemStyleFactory.js +65 -0
  22. package/build/commonjs/Carousel/animation/parallaxItemStyleFactory.js.map +1 -0
  23. package/build/commonjs/Carousel/components/InternalContext.js +29 -0
  24. package/build/commonjs/Carousel/components/InternalContext.js.map +1 -0
  25. package/build/commonjs/Carousel/components/ItemView.js +66 -0
  26. package/build/commonjs/Carousel/components/ItemView.js.map +1 -0
  27. package/build/commonjs/Carousel/components/RootView.js +86 -0
  28. package/build/commonjs/Carousel/components/RootView.js.map +1 -0
  29. package/build/commonjs/Carousel/components/ScrollViewGesture.js +84 -0
  30. package/build/commonjs/Carousel/components/ScrollViewGesture.js.map +1 -0
  31. package/build/commonjs/Carousel/components/index.js +40 -0
  32. package/build/commonjs/Carousel/components/index.js.map +1 -0
  33. package/build/commonjs/Carousel/components/useItemInterpolation.js +65 -0
  34. package/build/commonjs/Carousel/components/useItemInterpolation.js.map +1 -0
  35. package/build/commonjs/Carousel/hooks/index.js +48 -0
  36. package/build/commonjs/Carousel/hooks/index.js.map +1 -0
  37. package/build/commonjs/Carousel/hooks/useAutoplayController.js +58 -0
  38. package/build/commonjs/Carousel/hooks/useAutoplayController.js.map +1 -0
  39. package/build/commonjs/Carousel/hooks/useIndexController.js +55 -0
  40. package/build/commonjs/Carousel/hooks/useIndexController.js.map +1 -0
  41. package/build/commonjs/Carousel/hooks/useItemVisibilityStore.js +95 -0
  42. package/build/commonjs/Carousel/hooks/useItemVisibilityStore.js.map +1 -0
  43. package/build/commonjs/Carousel/hooks/useLoopedData.js +33 -0
  44. package/build/commonjs/Carousel/hooks/useLoopedData.js.map +1 -0
  45. package/build/commonjs/Carousel/hooks/usePagingAnimator.js +202 -0
  46. package/build/commonjs/Carousel/hooks/usePagingAnimator.js.map +1 -0
  47. package/build/commonjs/Carousel/index.js +16 -2
  48. package/build/commonjs/Carousel/index.js.map +1 -1
  49. package/build/commonjs/Carousel/tick.js +16 -0
  50. package/build/commonjs/Carousel/tick.js.map +1 -0
  51. package/build/commonjs/Carousel/types.js +8 -0
  52. package/build/commonjs/Carousel/types.js.map +1 -0
  53. package/build/commonjs/ComicViewer/ComicViewer.js +230 -92
  54. package/build/commonjs/ComicViewer/ComicViewer.js.map +1 -1
  55. package/build/commonjs/ComicViewer/ComicViewerProps.js.map +1 -1
  56. package/build/commonjs/ComicViewer/EncodedTile.js +10 -0
  57. package/build/commonjs/ComicViewer/EncodedTile.js.map +1 -0
  58. package/build/commonjs/ComicViewer/FastScroll.js +175 -0
  59. package/build/commonjs/ComicViewer/FastScroll.js.map +1 -0
  60. package/build/commonjs/ComicViewer/{ComicViewerItemProps.js → FastScrollProps.js} +1 -1
  61. package/build/commonjs/ComicViewer/FastScrollProps.js.map +1 -0
  62. package/build/commonjs/ComicViewer/ReloadButton.js +48 -0
  63. package/build/commonjs/ComicViewer/ReloadButton.js.map +1 -0
  64. package/build/commonjs/ComicViewer/ViewerItem.js +53 -59
  65. package/build/commonjs/ComicViewer/ViewerItem.js.map +1 -1
  66. package/build/commonjs/ComicViewer/index.js.map +1 -1
  67. package/build/commonjs/ComicViewer/util.js +27 -0
  68. package/build/commonjs/ComicViewer/util.js.map +1 -0
  69. package/build/commonjs/DateTimePicker/DateTimePicker.js +12 -3
  70. package/build/commonjs/DateTimePicker/DateTimePicker.js.map +1 -1
  71. package/build/commonjs/DateTimePicker/YearPicker.js +2 -2
  72. package/build/commonjs/DateTimePicker/YearPicker.js.map +1 -1
  73. package/build/commonjs/StatusBarProvider/Provider.js.map +1 -1
  74. package/build/commonjs/StatusBarProvider/StatusBarProvider.js +111 -2
  75. package/build/commonjs/StatusBarProvider/StatusBarProvider.js.map +1 -1
  76. package/build/commonjs/ViewPager/FluxContext.js +13 -0
  77. package/build/commonjs/ViewPager/FluxContext.js.map +1 -0
  78. package/build/commonjs/ViewPager/InternalContext.js +17 -0
  79. package/build/commonjs/ViewPager/InternalContext.js.map +1 -0
  80. package/build/commonjs/ViewPager/PageStateContext.js +14 -0
  81. package/build/commonjs/ViewPager/PageStateContext.js.map +1 -0
  82. package/build/commonjs/ViewPager/ViewPager.js +81 -0
  83. package/build/commonjs/ViewPager/ViewPager.js.map +1 -0
  84. package/build/commonjs/ViewPager/ViewPager.native.js +152 -0
  85. package/build/commonjs/ViewPager/ViewPager.native.js.map +1 -0
  86. package/build/commonjs/ViewPager/ViewPagerProps.js.map +1 -1
  87. package/build/commonjs/ViewPager/components/ChildrenMemoizedPage.js +122 -0
  88. package/build/commonjs/ViewPager/components/ChildrenMemoizedPage.js.map +1 -0
  89. package/build/commonjs/ViewPager/components/FluxStoreProvider.js +37 -0
  90. package/build/commonjs/ViewPager/components/FluxStoreProvider.js.map +1 -0
  91. package/build/commonjs/ViewPager/components/index.js +24 -0
  92. package/build/commonjs/ViewPager/components/index.js.map +1 -0
  93. package/build/commonjs/ViewPager/hooks/index.js +64 -0
  94. package/build/commonjs/ViewPager/hooks/index.js.map +1 -0
  95. package/build/commonjs/ViewPager/hooks/useDispatch.js +22 -0
  96. package/build/commonjs/ViewPager/hooks/useDispatch.js.map +1 -0
  97. package/build/commonjs/ViewPager/hooks/useEagerState.js +24 -0
  98. package/build/commonjs/ViewPager/hooks/useEagerState.js.map +1 -0
  99. package/build/commonjs/ViewPager/hooks/useForceRender.js +16 -0
  100. package/build/commonjs/ViewPager/hooks/useForceRender.js.map +1 -0
  101. package/build/commonjs/ViewPager/hooks/useLazyState.js +43 -0
  102. package/build/commonjs/ViewPager/hooks/useLazyState.js.map +1 -0
  103. package/build/commonjs/ViewPager/hooks/usePageStore.js +35 -0
  104. package/build/commonjs/ViewPager/hooks/usePageStore.js.map +1 -0
  105. package/build/commonjs/ViewPager/hooks/useStore.js +26 -0
  106. package/build/commonjs/ViewPager/hooks/useStore.js.map +1 -0
  107. package/build/commonjs/ViewPager/hooks/useViewPagerPageState.js +19 -0
  108. package/build/commonjs/ViewPager/hooks/useViewPagerPageState.js.map +1 -0
  109. package/build/commonjs/ViewPager/index.js +42 -2
  110. package/build/commonjs/ViewPager/index.js.map +1 -1
  111. package/build/commonjs/ViewPager/types.js +2 -0
  112. package/build/commonjs/ViewPager/types.js.map +1 -0
  113. package/build/commonjs/ViewPager/utils.js +12 -45
  114. package/build/commonjs/ViewPager/utils.js.map +1 -1
  115. package/build/commonjs/ViewabilityTrackerView/Viewability.js +2 -0
  116. package/build/commonjs/ViewabilityTrackerView/Viewability.js.map +1 -0
  117. package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerView.js +45 -0
  118. package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerView.js.map +1 -0
  119. package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerViewProps.js +2 -0
  120. package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerViewProps.js.map +1 -0
  121. package/build/commonjs/{Carousel/index.native.js → ViewabilityTrackerView/index.js} +3 -3
  122. package/build/commonjs/ViewabilityTrackerView/index.js.map +1 -0
  123. package/build/commonjs/ViewabilityTrackerView/measureViewability.js +42 -0
  124. package/build/commonjs/ViewabilityTrackerView/measureViewability.js.map +1 -0
  125. package/build/commonjs/ViewabilityTrackerView/useViewabilityTracker.js +88 -0
  126. package/build/commonjs/ViewabilityTrackerView/useViewabilityTracker.js.map +1 -0
  127. package/build/commonjs/hooks/index.js +16 -0
  128. package/build/commonjs/hooks/index.js.map +1 -1
  129. package/build/commonjs/hooks/useDeferredExecutor.js +45 -0
  130. package/build/commonjs/hooks/useDeferredExecutor.js.map +1 -0
  131. package/build/commonjs/hooks/useHeight.js +4 -4
  132. package/build/commonjs/hooks/useHeight.js.map +1 -1
  133. package/build/commonjs/hooks/useIsMounted.js +22 -0
  134. package/build/commonjs/hooks/useIsMounted.js.map +1 -0
  135. package/build/commonjs/hooks/useUnstableCollapsibleAppBar.js +3 -5
  136. package/build/commonjs/hooks/useUnstableCollapsibleAppBar.js.map +1 -1
  137. package/build/commonjs/index.js +22 -1
  138. package/build/commonjs/index.js.map +1 -1
  139. package/build/module/BottomSheet/BottomSheetNative.js +73 -22
  140. package/build/module/BottomSheet/BottomSheetNative.js.map +1 -1
  141. package/build/module/BottomSheet/BottomSheetProps.js.map +1 -1
  142. package/build/module/BottomSheet/BottomSheetWeb.js +58 -18
  143. package/build/module/BottomSheet/BottomSheetWeb.js.map +1 -1
  144. package/build/module/BottomSheet/useDynamicSnapPoints.js +65 -0
  145. package/build/module/BottomSheet/useDynamicSnapPoints.js.map +1 -0
  146. package/build/module/Carousel/Carousel.js +109 -0
  147. package/build/module/Carousel/Carousel.js.map +1 -0
  148. package/build/module/Carousel/CarouselProps.js.map +1 -1
  149. package/build/module/Carousel/animation/animationUtils.js +2 -0
  150. package/build/module/Carousel/animation/animationUtils.js.map +1 -0
  151. package/build/module/Carousel/animation/createDefaultItemStyle.js +3 -0
  152. package/build/module/Carousel/animation/createDefaultItemStyle.js.map +1 -0
  153. package/build/module/Carousel/animation/createDefaultScrollAnimation.js +12 -0
  154. package/build/module/Carousel/animation/createDefaultScrollAnimation.js.map +1 -0
  155. package/build/module/Carousel/animation/index.js +5 -0
  156. package/build/module/Carousel/animation/index.js.map +1 -0
  157. package/build/module/Carousel/animation/normalItemStyleFactory.js +18 -0
  158. package/build/module/Carousel/animation/normalItemStyleFactory.js.map +1 -0
  159. package/build/module/Carousel/animation/parallaxItemStyleFactory.js +55 -0
  160. package/build/module/Carousel/animation/parallaxItemStyleFactory.js.map +1 -0
  161. package/build/module/Carousel/components/InternalContext.js +19 -0
  162. package/build/module/Carousel/components/InternalContext.js.map +1 -0
  163. package/build/module/Carousel/components/ItemView.js +46 -0
  164. package/build/module/Carousel/components/ItemView.js.map +1 -0
  165. package/build/module/Carousel/components/RootView.js +65 -0
  166. package/build/module/Carousel/components/RootView.js.map +1 -0
  167. package/build/module/Carousel/components/ScrollViewGesture.js +69 -0
  168. package/build/module/Carousel/components/ScrollViewGesture.js.map +1 -0
  169. package/build/module/Carousel/components/index.js +5 -0
  170. package/build/module/Carousel/components/index.js.map +1 -0
  171. package/build/module/Carousel/components/useItemInterpolation.js +51 -0
  172. package/build/module/Carousel/components/useItemInterpolation.js.map +1 -0
  173. package/build/module/Carousel/hooks/index.js +6 -0
  174. package/build/module/Carousel/hooks/index.js.map +1 -0
  175. package/build/module/Carousel/hooks/useAutoplayController.js +48 -0
  176. package/build/module/Carousel/hooks/useAutoplayController.js.map +1 -0
  177. package/build/module/Carousel/hooks/useIndexController.js +44 -0
  178. package/build/module/Carousel/hooks/useIndexController.js.map +1 -0
  179. package/build/module/Carousel/hooks/useItemVisibilityStore.js +86 -0
  180. package/build/module/Carousel/hooks/useItemVisibilityStore.js.map +1 -0
  181. package/build/module/Carousel/hooks/useLoopedData.js +24 -0
  182. package/build/module/Carousel/hooks/useLoopedData.js.map +1 -0
  183. package/build/module/Carousel/hooks/usePagingAnimator.js +192 -0
  184. package/build/module/Carousel/hooks/usePagingAnimator.js.map +1 -0
  185. package/build/module/Carousel/index.js +2 -1
  186. package/build/module/Carousel/index.js.map +1 -1
  187. package/build/module/Carousel/tick.js +6 -0
  188. package/build/module/Carousel/tick.js.map +1 -0
  189. package/build/module/Carousel/types.js +4 -0
  190. package/build/module/Carousel/types.js.map +1 -0
  191. package/build/module/ComicViewer/ComicViewer.js +229 -93
  192. package/build/module/ComicViewer/ComicViewer.js.map +1 -1
  193. package/build/module/ComicViewer/ComicViewerProps.js.map +1 -1
  194. package/build/module/ComicViewer/EncodedTile.js +3 -0
  195. package/build/module/ComicViewer/EncodedTile.js.map +1 -0
  196. package/build/module/ComicViewer/FastScroll.js +152 -0
  197. package/build/module/ComicViewer/FastScroll.js.map +1 -0
  198. package/build/module/ComicViewer/FastScrollProps.js +2 -0
  199. package/build/module/ComicViewer/FastScrollProps.js.map +1 -0
  200. package/build/module/ComicViewer/ReloadButton.js +33 -0
  201. package/build/module/ComicViewer/ReloadButton.js.map +1 -0
  202. package/build/module/ComicViewer/ViewerItem.js +53 -60
  203. package/build/module/ComicViewer/ViewerItem.js.map +1 -1
  204. package/build/module/ComicViewer/index.js.map +1 -1
  205. package/build/module/ComicViewer/util.js +15 -0
  206. package/build/module/ComicViewer/util.js.map +1 -0
  207. package/build/module/DateTimePicker/DateTimePicker.js +13 -4
  208. package/build/module/DateTimePicker/DateTimePicker.js.map +1 -1
  209. package/build/module/DateTimePicker/YearPicker.js +2 -2
  210. package/build/module/DateTimePicker/YearPicker.js.map +1 -1
  211. package/build/module/StatusBarProvider/Provider.js.map +1 -1
  212. package/build/module/StatusBarProvider/StatusBarProvider.js +105 -2
  213. package/build/module/StatusBarProvider/StatusBarProvider.js.map +1 -1
  214. package/build/module/ViewPager/FluxContext.js +4 -0
  215. package/build/module/ViewPager/FluxContext.js.map +1 -0
  216. package/build/module/ViewPager/InternalContext.js +7 -0
  217. package/build/module/ViewPager/InternalContext.js.map +1 -0
  218. package/build/module/ViewPager/PageStateContext.js +5 -0
  219. package/build/module/ViewPager/PageStateContext.js.map +1 -0
  220. package/build/module/ViewPager/ViewPager.js +57 -0
  221. package/build/module/ViewPager/ViewPager.js.map +1 -0
  222. package/build/module/ViewPager/ViewPager.native.js +129 -0
  223. package/build/module/ViewPager/ViewPager.native.js.map +1 -0
  224. package/build/module/ViewPager/ViewPagerProps.js.map +1 -1
  225. package/build/module/ViewPager/components/ChildrenMemoizedPage.js +101 -0
  226. package/build/module/ViewPager/components/ChildrenMemoizedPage.js.map +1 -0
  227. package/build/module/ViewPager/components/FluxStoreProvider.js +20 -0
  228. package/build/module/ViewPager/components/FluxStoreProvider.js.map +1 -0
  229. package/build/module/ViewPager/components/index.js +3 -0
  230. package/build/module/ViewPager/components/index.js.map +1 -0
  231. package/build/module/ViewPager/hooks/index.js +8 -0
  232. package/build/module/ViewPager/hooks/index.js.map +1 -0
  233. package/build/module/ViewPager/hooks/useDispatch.js +10 -0
  234. package/build/module/ViewPager/hooks/useDispatch.js.map +1 -0
  235. package/build/module/ViewPager/hooks/useEagerState.js +12 -0
  236. package/build/module/ViewPager/hooks/useEagerState.js.map +1 -0
  237. package/build/module/ViewPager/hooks/useForceRender.js +7 -0
  238. package/build/module/ViewPager/hooks/useForceRender.js.map +1 -0
  239. package/build/module/ViewPager/hooks/useLazyState.js +28 -0
  240. package/build/module/ViewPager/hooks/useLazyState.js.map +1 -0
  241. package/build/module/ViewPager/hooks/usePageStore.js +25 -0
  242. package/build/module/ViewPager/hooks/usePageStore.js.map +1 -0
  243. package/build/module/ViewPager/hooks/useStore.js +14 -0
  244. package/build/module/ViewPager/hooks/useStore.js.map +1 -0
  245. package/build/module/ViewPager/hooks/useViewPagerPageState.js +7 -0
  246. package/build/module/ViewPager/hooks/useViewPagerPageState.js.map +1 -0
  247. package/build/module/ViewPager/index.js +3 -1
  248. package/build/module/ViewPager/index.js.map +1 -1
  249. package/build/module/ViewPager/types.js +2 -0
  250. package/build/module/ViewPager/types.js.map +1 -0
  251. package/build/module/ViewPager/utils.js +6 -34
  252. package/build/module/ViewPager/utils.js.map +1 -1
  253. package/build/module/ViewabilityTrackerView/Viewability.js +2 -0
  254. package/build/module/ViewabilityTrackerView/Viewability.js.map +1 -0
  255. package/build/module/ViewabilityTrackerView/ViewabilityTrackerView.js +28 -0
  256. package/build/module/ViewabilityTrackerView/ViewabilityTrackerView.js.map +1 -0
  257. package/build/module/ViewabilityTrackerView/ViewabilityTrackerViewProps.js +2 -0
  258. package/build/module/ViewabilityTrackerView/ViewabilityTrackerViewProps.js.map +1 -0
  259. package/build/module/ViewabilityTrackerView/index.js +2 -0
  260. package/build/module/ViewabilityTrackerView/index.js.map +1 -0
  261. package/build/module/ViewabilityTrackerView/measureViewability.js +34 -0
  262. package/build/module/ViewabilityTrackerView/measureViewability.js.map +1 -0
  263. package/build/module/ViewabilityTrackerView/useViewabilityTracker.js +73 -0
  264. package/build/module/ViewabilityTrackerView/useViewabilityTracker.js.map +1 -0
  265. package/build/module/hooks/index.js +2 -0
  266. package/build/module/hooks/index.js.map +1 -1
  267. package/build/module/hooks/useDeferredExecutor.js +33 -0
  268. package/build/module/hooks/useDeferredExecutor.js.map +1 -0
  269. package/build/module/hooks/useHeight.js +2 -3
  270. package/build/module/hooks/useHeight.js.map +1 -1
  271. package/build/module/hooks/useIsMounted.js +13 -0
  272. package/build/module/hooks/useIsMounted.js.map +1 -0
  273. package/build/module/hooks/useUnstableCollapsibleAppBar.js +4 -6
  274. package/build/module/hooks/useUnstableCollapsibleAppBar.js.map +1 -1
  275. package/build/module/index.js +2 -0
  276. package/build/module/index.js.map +1 -1
  277. package/build/typescript/AnimatedY/AnimatedY.d.ts +1 -0
  278. package/build/typescript/BottomSheet/BottomSheetNative.d.ts +1 -0
  279. package/build/typescript/BottomSheet/BottomSheetProps.d.ts +22 -1
  280. package/build/typescript/BottomSheet/BottomSheetWeb.d.ts +1 -0
  281. package/build/typescript/BottomSheet/TransparentBackdrop.d.ts +1 -0
  282. package/build/typescript/BottomSheet/useDynamicSnapPoints.d.ts +13 -0
  283. package/build/typescript/Carousel/Carousel.d.ts +5 -0
  284. package/build/typescript/Carousel/CarouselProps.d.ts +33 -48
  285. package/build/typescript/Carousel/animation/animationUtils.d.ts +1 -0
  286. package/build/typescript/Carousel/animation/createDefaultItemStyle.d.ts +2 -0
  287. package/build/typescript/Carousel/animation/createDefaultScrollAnimation.d.ts +2 -0
  288. package/build/typescript/Carousel/animation/index.d.ts +4 -0
  289. package/build/typescript/Carousel/animation/normalItemStyleFactory.d.ts +2 -0
  290. package/build/typescript/Carousel/animation/parallaxItemStyleFactory.d.ts +9 -0
  291. package/build/typescript/Carousel/components/InternalContext.d.ts +14 -0
  292. package/build/typescript/Carousel/components/ItemView.d.ts +9 -0
  293. package/build/typescript/Carousel/components/RootView.d.ts +16 -0
  294. package/build/typescript/Carousel/components/ScrollViewGesture.d.ts +12 -0
  295. package/build/typescript/Carousel/components/index.d.ts +4 -0
  296. package/build/typescript/Carousel/components/useItemInterpolation.d.ts +2 -0
  297. package/build/typescript/Carousel/hooks/index.d.ts +5 -0
  298. package/build/typescript/Carousel/hooks/useAutoplayController.d.ts +7 -0
  299. package/build/typescript/Carousel/hooks/useIndexController.d.ts +10 -0
  300. package/build/typescript/Carousel/hooks/useItemVisibilityStore.d.ts +7 -0
  301. package/build/typescript/Carousel/hooks/useLoopedData.d.ts +1 -0
  302. package/build/typescript/Carousel/hooks/usePagingAnimator.d.ts +17 -0
  303. package/build/typescript/Carousel/index.d.ts +3 -1
  304. package/build/typescript/Carousel/tick.d.ts +2 -0
  305. package/build/typescript/Carousel/types.d.ts +91 -0
  306. package/build/typescript/ComicViewer/ComicViewer.d.ts +2 -1
  307. package/build/typescript/ComicViewer/ComicViewerProps.d.ts +61 -43
  308. package/build/typescript/ComicViewer/EncodedTile.d.ts +2 -0
  309. package/build/typescript/ComicViewer/FastScroll.d.ts +4 -0
  310. package/build/typescript/ComicViewer/FastScrollProps.d.ts +74 -0
  311. package/build/typescript/ComicViewer/ReloadButton.d.ts +7 -0
  312. package/build/typescript/ComicViewer/ViewerItem.d.ts +46 -7
  313. package/build/typescript/ComicViewer/index.d.ts +3 -2
  314. package/build/typescript/ComicViewer/util.d.ts +2 -0
  315. package/build/typescript/DateTimePicker/DateTimePicker.d.ts +1 -0
  316. package/build/typescript/DateTimePicker/YearPicker.d.ts +1 -0
  317. package/build/typescript/FlipCard/FlipCard.d.ts +1 -0
  318. package/build/typescript/StatusBarProvider/Provider.d.ts +13 -0
  319. package/build/typescript/StatusBarProvider/StatusBarProvider.d.ts +1 -0
  320. package/build/typescript/ViewPager/FluxContext.d.ts +5 -0
  321. package/build/typescript/ViewPager/InternalContext.d.ts +7 -0
  322. package/build/typescript/ViewPager/PageStateContext.d.ts +6 -0
  323. package/build/typescript/ViewPager/ViewPager.d.ts +5 -0
  324. package/build/typescript/ViewPager/ViewPager.native.d.ts +5 -0
  325. package/build/typescript/ViewPager/ViewPagerProps.d.ts +21 -27
  326. package/build/typescript/ViewPager/components/ChildrenMemoizedPage.d.ts +14 -0
  327. package/build/typescript/ViewPager/components/FluxStoreProvider.d.ts +6 -0
  328. package/build/typescript/ViewPager/components/index.d.ts +2 -0
  329. package/build/typescript/ViewPager/hooks/index.d.ts +7 -0
  330. package/build/typescript/ViewPager/hooks/useDispatch.d.ts +2 -0
  331. package/build/typescript/ViewPager/hooks/useEagerState.d.ts +1 -0
  332. package/build/typescript/ViewPager/hooks/useForceRender.d.ts +2 -0
  333. package/build/typescript/ViewPager/hooks/useLazyState.d.ts +2 -0
  334. package/build/typescript/ViewPager/hooks/usePageStore.d.ts +2 -0
  335. package/build/typescript/ViewPager/hooks/useStore.d.ts +2 -0
  336. package/build/typescript/ViewPager/hooks/useViewPagerPageState.d.ts +1 -0
  337. package/build/typescript/ViewPager/index.d.ts +4 -1
  338. package/build/typescript/ViewPager/types.d.ts +12 -0
  339. package/build/typescript/ViewPager/utils.d.ts +5 -20
  340. package/build/typescript/ViewabilityTrackerView/Viewability.d.ts +3 -0
  341. package/build/typescript/ViewabilityTrackerView/ViewabilityTrackerView.d.ts +3 -0
  342. package/build/typescript/ViewabilityTrackerView/ViewabilityTrackerViewProps.d.ts +22 -0
  343. package/build/typescript/ViewabilityTrackerView/index.d.ts +2 -0
  344. package/build/typescript/ViewabilityTrackerView/measureViewability.d.ts +11 -0
  345. package/build/typescript/ViewabilityTrackerView/useViewabilityTracker.d.ts +11 -0
  346. package/build/typescript/hooks/index.d.ts +2 -0
  347. package/build/typescript/hooks/useDeferredExecutor.d.ts +11 -0
  348. package/build/typescript/hooks/useIsMounted.d.ts +4 -0
  349. package/build/typescript/index.d.ts +2 -0
  350. package/package.json +10 -25
  351. package/src/BottomSheet/BottomSheetNative.tsx +76 -21
  352. package/src/BottomSheet/BottomSheetProps.ts +26 -1
  353. package/src/BottomSheet/BottomSheetWeb.tsx +67 -24
  354. package/src/BottomSheet/useDynamicSnapPoints.ts +87 -0
  355. package/src/Carousel/Carousel.tsx +135 -0
  356. package/src/Carousel/CarouselProps.ts +42 -53
  357. package/src/Carousel/animation/animationUtils.ts +1 -0
  358. package/src/Carousel/animation/createDefaultItemStyle.ts +3 -0
  359. package/src/Carousel/animation/createDefaultScrollAnimation.ts +14 -0
  360. package/src/Carousel/animation/index.ts +4 -0
  361. package/src/Carousel/animation/normalItemStyleFactory.ts +19 -0
  362. package/src/Carousel/animation/parallaxItemStyleFactory.ts +79 -0
  363. package/src/Carousel/components/InternalContext.ts +33 -0
  364. package/src/Carousel/components/ItemView.tsx +66 -0
  365. package/src/Carousel/components/RootView.tsx +79 -0
  366. package/src/Carousel/components/ScrollViewGesture.tsx +93 -0
  367. package/src/Carousel/components/index.ts +4 -0
  368. package/src/Carousel/components/useItemInterpolation.ts +107 -0
  369. package/src/Carousel/hooks/index.ts +5 -0
  370. package/src/Carousel/hooks/useAutoplayController.ts +57 -0
  371. package/src/Carousel/hooks/useIndexController.tsx +57 -0
  372. package/src/Carousel/hooks/useItemVisibilityStore.ts +107 -0
  373. package/src/Carousel/hooks/useLoopedData.ts +26 -0
  374. package/src/Carousel/hooks/usePagingAnimator.ts +255 -0
  375. package/src/Carousel/index.ts +4 -2
  376. package/src/Carousel/tick.ts +6 -0
  377. package/src/Carousel/types.ts +114 -0
  378. package/src/ComicViewer/ComicViewer.tsx +268 -106
  379. package/src/ComicViewer/ComicViewerProps.ts +66 -44
  380. package/src/ComicViewer/EncodedTile.ts +3 -0
  381. package/src/ComicViewer/FastScroll.tsx +176 -0
  382. package/src/ComicViewer/FastScrollProps.ts +88 -0
  383. package/src/ComicViewer/ReloadButton.tsx +36 -0
  384. package/src/ComicViewer/ViewerItem.tsx +104 -62
  385. package/src/ComicViewer/index.ts +8 -2
  386. package/src/ComicViewer/util.ts +15 -0
  387. package/src/DateTimePicker/DateTimePicker.tsx +11 -3
  388. package/src/DateTimePicker/YearPicker.tsx +2 -2
  389. package/src/StatusBarProvider/Provider.ts +14 -0
  390. package/src/StatusBarProvider/StatusBarProvider.tsx +103 -1
  391. package/src/ViewPager/FluxContext.ts +8 -0
  392. package/src/ViewPager/InternalContext.ts +13 -0
  393. package/src/ViewPager/PageStateContext.ts +11 -0
  394. package/src/ViewPager/ViewPager.native.tsx +152 -0
  395. package/src/ViewPager/ViewPager.tsx +69 -0
  396. package/src/ViewPager/ViewPagerProps.ts +25 -34
  397. package/src/ViewPager/components/ChildrenMemoizedPage.tsx +124 -0
  398. package/src/ViewPager/components/FluxStoreProvider.tsx +27 -0
  399. package/src/ViewPager/components/index.ts +2 -0
  400. package/src/ViewPager/hooks/index.ts +7 -0
  401. package/src/ViewPager/hooks/useDispatch.ts +11 -0
  402. package/src/ViewPager/hooks/useEagerState.ts +14 -0
  403. package/src/ViewPager/hooks/useForceRender.ts +7 -0
  404. package/src/ViewPager/hooks/useLazyState.ts +32 -0
  405. package/src/ViewPager/hooks/usePageStore.ts +30 -0
  406. package/src/ViewPager/hooks/useStore.ts +15 -0
  407. package/src/ViewPager/hooks/useViewPagerPageState.ts +6 -0
  408. package/src/ViewPager/index.ts +11 -2
  409. package/src/ViewPager/types.ts +15 -0
  410. package/src/ViewPager/utils.tsx +9 -56
  411. package/src/ViewabilityTrackerView/Viewability.ts +3 -0
  412. package/src/ViewabilityTrackerView/ViewabilityTrackerView.tsx +33 -0
  413. package/src/ViewabilityTrackerView/ViewabilityTrackerViewProps.ts +25 -0
  414. package/src/ViewabilityTrackerView/index.ts +2 -0
  415. package/src/ViewabilityTrackerView/measureViewability.ts +54 -0
  416. package/src/ViewabilityTrackerView/useViewabilityTracker.ts +85 -0
  417. package/src/hooks/index.ts +2 -0
  418. package/src/hooks/useDeferredExecutor.ts +46 -0
  419. package/src/hooks/useHeight.ts +3 -4
  420. package/src/hooks/useIsMounted.ts +19 -0
  421. package/src/hooks/useUnstableCollapsibleAppBar.ts +4 -4
  422. package/src/index.ts +3 -0
  423. package/build/commonjs/Carousel/CarouselNative.js +0 -72
  424. package/build/commonjs/Carousel/CarouselNative.js.map +0 -1
  425. package/build/commonjs/Carousel/CarouselWeb.js +0 -237
  426. package/build/commonjs/Carousel/CarouselWeb.js.map +0 -1
  427. package/build/commonjs/Carousel/index.native.js.map +0 -1
  428. package/build/commonjs/Carousel/utils.js +0 -19
  429. package/build/commonjs/Carousel/utils.js.map +0 -1
  430. package/build/commonjs/ComicViewer/ComicViewerItemProps.js.map +0 -1
  431. package/build/commonjs/ViewPager/ChildrenMemoizedPage.js +0 -49
  432. package/build/commonjs/ViewPager/ChildrenMemoizedPage.js.map +0 -1
  433. package/build/commonjs/ViewPager/ViewPagerNative.js +0 -75
  434. package/build/commonjs/ViewPager/ViewPagerNative.js.map +0 -1
  435. package/build/commonjs/ViewPager/ViewPagerWeb.js +0 -55
  436. package/build/commonjs/ViewPager/ViewPagerWeb.js.map +0 -1
  437. package/build/commonjs/ViewPager/index.native.js +0 -16
  438. package/build/commonjs/ViewPager/index.native.js.map +0 -1
  439. package/build/module/Carousel/CarouselNative.js +0 -54
  440. package/build/module/Carousel/CarouselNative.js.map +0 -1
  441. package/build/module/Carousel/CarouselWeb.js +0 -215
  442. package/build/module/Carousel/CarouselWeb.js.map +0 -1
  443. package/build/module/Carousel/index.native.js +0 -2
  444. package/build/module/Carousel/index.native.js.map +0 -1
  445. package/build/module/Carousel/utils.js +0 -7
  446. package/build/module/Carousel/utils.js.map +0 -1
  447. package/build/module/ComicViewer/ComicViewerItemProps.js +0 -2
  448. package/build/module/ComicViewer/ComicViewerItemProps.js.map +0 -1
  449. package/build/module/ViewPager/ChildrenMemoizedPage.js +0 -37
  450. package/build/module/ViewPager/ChildrenMemoizedPage.js.map +0 -1
  451. package/build/module/ViewPager/ViewPagerNative.js +0 -58
  452. package/build/module/ViewPager/ViewPagerNative.js.map +0 -1
  453. package/build/module/ViewPager/ViewPagerWeb.js +0 -41
  454. package/build/module/ViewPager/ViewPagerWeb.js.map +0 -1
  455. package/build/module/ViewPager/index.native.js +0 -2
  456. package/build/module/ViewPager/index.native.js.map +0 -1
  457. package/build/typescript/Carousel/CarouselNative.d.ts +0 -2
  458. package/build/typescript/Carousel/CarouselWeb.d.ts +0 -4
  459. package/build/typescript/Carousel/index.native.d.ts +0 -1
  460. package/build/typescript/Carousel/utils.d.ts +0 -6
  461. package/build/typescript/ComicViewer/ComicViewerItemProps.d.ts +0 -12
  462. package/build/typescript/ViewPager/ChildrenMemoizedPage.d.ts +0 -4
  463. package/build/typescript/ViewPager/ViewPagerNative.d.ts +0 -2
  464. package/build/typescript/ViewPager/ViewPagerWeb.d.ts +0 -2
  465. package/build/typescript/ViewPager/index.native.d.ts +0 -1
  466. package/src/Carousel/CarouselNative.tsx +0 -67
  467. package/src/Carousel/CarouselWeb.tsx +0 -222
  468. package/src/Carousel/index.native.ts +0 -1
  469. package/src/Carousel/utils.ts +0 -11
  470. package/src/ComicViewer/ComicViewerItemProps.ts +0 -15
  471. package/src/ViewPager/ChildrenMemoizedPage.tsx +0 -36
  472. package/src/ViewPager/ViewPagerNative.tsx +0 -73
  473. package/src/ViewPager/ViewPagerWeb.tsx +0 -52
  474. package/src/ViewPager/index.native.ts +0 -1
@@ -0,0 +1,51 @@
1
+ import { useContext, useMemo } from 'react';
2
+ import { Animated } from 'react-native';
3
+ import InternalContext from './InternalContext';
4
+ const OVERSCROLL_FRICTION_FACTOR = 4;
5
+ export default function useItemInterpolation(index) {
6
+ const {
7
+ itemWidth,
8
+ data,
9
+ globalInterpolation,
10
+ loop
11
+ } = useContext(InternalContext);
12
+ const numberOfData = data.length;
13
+ const interpolationConfigOnLoop = useMemo(() => {
14
+ const lastIndex = numberOfData - 1;
15
+ const maxWidth = Math.abs(itemWidth * numberOfData);
16
+ const halfOfItemWidth = 0.5 * itemWidth;
17
+ const positiveCount = Math.round(lastIndex / 2);
18
+ const startPosition = index > positiveCount ? (index - numberOfData) * itemWidth : itemWidth * index;
19
+ const max = positiveCount * itemWidth;
20
+ const min = -((lastIndex - positiveCount) * itemWidth);
21
+ const inputRange = [-maxWidth, min - halfOfItemWidth - startPosition - Number.MIN_VALUE, min - halfOfItemWidth - startPosition, 0, max + halfOfItemWidth - startPosition, max + halfOfItemWidth - startPosition + Number.MIN_VALUE, maxWidth];
22
+ const outputRange = [startPosition, max + halfOfItemWidth - Number.MIN_VALUE, min - halfOfItemWidth, startPosition, max + halfOfItemWidth, min - halfOfItemWidth + Number.MIN_VALUE, startPosition];
23
+ return {
24
+ inputRange,
25
+ outputRange,
26
+ extrapolate: 'clamp'
27
+ };
28
+ }, [index, itemWidth, numberOfData]);
29
+ const interpolationConfigOnNoLoop = useMemo(() => {
30
+ const lastIndex = numberOfData - 1;
31
+ const maxWidth = itemWidth * lastIndex;
32
+ const startPosition = itemWidth * index;
33
+ const friction = itemWidth / OVERSCROLL_FRICTION_FACTOR;
34
+ const inputRange = [-(maxWidth + itemWidth), // overscroll
35
+ -maxWidth, 0, itemWidth // overscroll
36
+ ];
37
+ const outputRange = [-maxWidth + startPosition - friction, -maxWidth + startPosition, startPosition, startPosition + friction];
38
+ return {
39
+ inputRange,
40
+ outputRange,
41
+ extrapolate: 'clamp'
42
+ };
43
+ }, [index, itemWidth, numberOfData]);
44
+ return useMemo(() => {
45
+ const interpolationConfig = loop ? interpolationConfigOnLoop : interpolationConfigOnNoLoop;
46
+ const localOffsetX = globalInterpolation.interpolate(interpolationConfig);
47
+ return Animated.divide(localOffsetX, itemWidth);
48
+ }, [globalInterpolation, interpolationConfigOnLoop, interpolationConfigOnNoLoop, itemWidth, loop]);
49
+ }
50
+ ;
51
+ //# sourceMappingURL=useItemInterpolation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useContext","useMemo","Animated","InternalContext","OVERSCROLL_FRICTION_FACTOR","useItemInterpolation","index","itemWidth","data","globalInterpolation","loop","numberOfData","length","interpolationConfigOnLoop","lastIndex","maxWidth","Math","abs","halfOfItemWidth","positiveCount","round","startPosition","max","min","inputRange","Number","MIN_VALUE","outputRange","extrapolate","interpolationConfigOnNoLoop","friction","interpolationConfig","localOffsetX","interpolate","divide"],"sources":["useItemInterpolation.ts"],"sourcesContent":["import { useContext, useMemo } from 'react';\nimport { Animated } from 'react-native';\nimport InternalContext from './InternalContext';\n\nconst OVERSCROLL_FRICTION_FACTOR = 4;\n\nexport default function useItemInterpolation(index: number): Animated.AnimatedInterpolation {\n const {\n itemWidth,\n data,\n globalInterpolation,\n loop,\n } = useContext(InternalContext);\n\n const numberOfData = data.length;\n\n const interpolationConfigOnLoop = useMemo<Animated.InterpolationConfigType>(() => {\n const lastIndex = numberOfData - 1;\n const maxWidth = Math.abs(itemWidth * numberOfData);\n const halfOfItemWidth = 0.5 * itemWidth;\n\n const positiveCount = Math.round(lastIndex / 2);\n const startPosition = index > positiveCount\n ? (index - numberOfData) * itemWidth\n : itemWidth * index;\n\n const max = positiveCount * itemWidth;\n const min = -((lastIndex - positiveCount) * itemWidth);\n\n const inputRange = [\n -maxWidth,\n min - halfOfItemWidth - startPosition - Number.MIN_VALUE,\n min - halfOfItemWidth - startPosition,\n 0,\n max + halfOfItemWidth - startPosition,\n max + halfOfItemWidth - startPosition + Number.MIN_VALUE,\n maxWidth,\n ];\n\n const outputRange = [\n startPosition,\n max + halfOfItemWidth - Number.MIN_VALUE,\n min - halfOfItemWidth,\n startPosition,\n max + halfOfItemWidth,\n min - halfOfItemWidth + Number.MIN_VALUE,\n startPosition,\n ];\n\n return {\n inputRange,\n outputRange,\n extrapolate: 'clamp',\n };\n }, [\n index,\n itemWidth,\n numberOfData,\n ]);\n\n const interpolationConfigOnNoLoop = useMemo<Animated.InterpolationConfigType>(() => {\n const lastIndex = numberOfData - 1;\n const maxWidth = itemWidth * lastIndex;\n const startPosition = itemWidth * index;\n const friction = itemWidth / OVERSCROLL_FRICTION_FACTOR;\n\n const inputRange = [\n -(maxWidth + itemWidth), // overscroll\n -maxWidth,\n 0,\n itemWidth, // overscroll\n ];\n\n const outputRange = [\n -maxWidth + startPosition - friction,\n -maxWidth + startPosition,\n startPosition,\n startPosition + friction,\n ];\n\n return {\n inputRange,\n outputRange,\n extrapolate: 'clamp',\n };\n }, [\n index,\n itemWidth,\n numberOfData,\n ]);\n\n return useMemo(() => {\n const interpolationConfig = loop\n ? interpolationConfigOnLoop\n : interpolationConfigOnNoLoop;\n\n const localOffsetX = globalInterpolation.interpolate(interpolationConfig);\n\n return Animated.divide(localOffsetX, itemWidth);\n }, [\n globalInterpolation,\n interpolationConfigOnLoop,\n interpolationConfigOnNoLoop,\n itemWidth,\n loop,\n ]);\n};\n"],"mappings":"AAAA,SAASA,UAAT,EAAqBC,OAArB,QAAoC,OAApC;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,OAAOC,eA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,CARW,CAAd;AAeH;AAAA"}
@@ -0,0 +1,6 @@
1
+ export { default as useAutoplayController } from './useAutoplayController';
2
+ export { default as useIndexController } from './useIndexController';
3
+ export { default as useLoopedData } from './useLoopedData';
4
+ export { default as usePagingAnimator } from './usePagingAnimator';
5
+ export { default as useItemVisibilityStore } from './useItemVisibilityStore';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["default","useAutoplayController","useIndexController","useLoopedData","usePagingAnimator","useItemVisibilityStore"],"sources":["index.ts"],"sourcesContent":["export { default as useAutoplayController } from './useAutoplayController';\nexport { default as useIndexController } from './useIndexController';\nexport { default as useLoopedData } from './useLoopedData';\nexport { default as usePagingAnimator } from './usePagingAnimator';\nexport { default as useItemVisibilityStore } from './useItemVisibilityStore';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,qBAApB,QAAiD,yBAAjD;AACA,SAASD,OAAO,IAAIE,kBAApB,QAA8C,sBAA9C;AACA,SAASF,OAAO,IAAIG,aAApB,QAAyC,iBAAzC;AACA,SAASH,OAAO,IAAII,iBAApB,QAA6C,qBAA7C;AACA,SAASJ,OAAO,IAAIK,sBAApB,QAAkD,0BAAlD"}
@@ -0,0 +1,48 @@
1
+ import { useCallback, useEffect, useRef } from 'react';
2
+ import { useDeferredExecutor } from '../../hooks';
3
+ export default function useAutoplayController(config) {
4
+ const {
5
+ enabled,
6
+ intervalMillis,
7
+ startPagingAnimation
8
+ } = config;
9
+ const paused = useRef(false);
10
+ const executor = useDeferredExecutor();
11
+ const play = useCallback(() => {
12
+ if (paused.current) {
13
+ return;
14
+ }
15
+
16
+ executor.execute(() => {
17
+ startPagingAnimation('directional', {
18
+ direction: 'next',
19
+ isOriginatedFromGesture: false
20
+ });
21
+ play();
22
+ }, intervalMillis);
23
+ }, [intervalMillis, startPagingAnimation]);
24
+ const pause = useCallback(() => {
25
+ executor.cancel();
26
+ paused.current = true;
27
+ }, []);
28
+ const resume = useCallback(() => {
29
+ paused.current = false;
30
+
31
+ if (enabled) {
32
+ play();
33
+ }
34
+ }, [play, enabled]);
35
+ useEffect(() => {
36
+ if (enabled) {
37
+ resume();
38
+ } else {
39
+ pause();
40
+ }
41
+ }, [enabled]);
42
+ return {
43
+ pause,
44
+ resume
45
+ };
46
+ }
47
+ ;
48
+ //# sourceMappingURL=useAutoplayController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useEffect","useRef","useDeferredExecutor","useAutoplayController","config","enabled","intervalMillis","startPagingAnimation","paused","executor","play","current","execute","direction","isOriginatedFromGesture","pause","cancel","resume"],"sources":["useAutoplayController.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\nimport type { AutoplayController, StartPagingAnimation } from '../types';\nimport { useDeferredExecutor } from '../../hooks';\n\nexport interface AutoplayConfig {\n enabled: boolean;\n intervalMillis: number;\n startPagingAnimation: StartPagingAnimation;\n}\n\nexport default function useAutoplayController(config: AutoplayConfig): AutoplayController {\n const {\n enabled,\n intervalMillis,\n startPagingAnimation,\n } = config;\n\n const paused = useRef<boolean>(false);\n\n const executor = useDeferredExecutor();\n\n const play = useCallback(() => {\n if (paused.current) {\n return;\n }\n\n executor.execute(() => {\n startPagingAnimation(\n 'directional',\n { direction: 'next', isOriginatedFromGesture: false },\n );\n play();\n }, intervalMillis);\n }, [intervalMillis, startPagingAnimation]);\n\n const pause = useCallback(() => {\n executor.cancel();\n paused.current = true;\n }, []);\n\n const resume = useCallback(() => {\n paused.current = false;\n if (enabled) {\n play();\n }\n }, [play, enabled]);\n\n useEffect(() => {\n if (enabled) {\n resume();\n } else {\n pause();\n }\n }, [enabled]);\n\n return { pause, resume };\n};\n"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,SAAtB,EAAiCC,MAAjC,QAA+C,OAA/C;AAEA,SAASC,mBAAT,QAAoC,aAApC;AAQA,eAAe,SAASC,qBAAT,CAA+BC,MAA/B,EAA2E;EACtF,MAAM;IACFC,OADE;IAEFC,cAFE;IAGFC;EAHE,IAIFH,MAJJ;EAMA,MAAMI,MAAM,GAAGP,MAAM,CAAU,KAAV,CAArB;EAEA,MAAMQ,QAAQ,GAAGP,mBAAmB,EAApC;EAEA,MAAMQ,IAAI,GAAGX,WAAW,CAAC,MAAM;IAC3B,IAAIS,MAAM,CAACG,OAAX,EAAoB;MAChB;IACH;;IAEDF,QAAQ,CAACG,OAAT,CAAiB,MAAM;MACnBL,oBAAoB,CAChB,aADgB,EAEhB;QAAEM,SAAS,EAAE,MAAb;QAAqBC,uBAAuB,EAAE;MAA9C,CAFgB,CAApB;MAIAJ,IAAI;IACP,CAND,EAMGJ,cANH;EAOH,CAZuB,EAYrB,CAACA,cAAD,EAAiBC,oBAAjB,CAZqB,CAAxB;EAcA,MAAMQ,KAAK,GAAGhB,WAAW,CAAC,MAAM;IAC5BU,QAAQ,CAACO,MAAT;IACAR,MAAM,CAACG,OAAP,GAAiB,IAAjB;EACH,CAHwB,EAGtB,EAHsB,CAAzB;EAKA,MAAMM,MAAM,GAAGlB,WAAW,CAAC,MAAM;IAC7BS,MAAM,CAACG,OAAP,GAAiB,KAAjB;;IACA,IAAIN,OAAJ,EAAa;MACTK,IAAI;IACP;EACJ,CALyB,EAKvB,CAACA,IAAD,EAAOL,OAAP,CALuB,CAA1B;EAOAL,SAAS,CAAC,MAAM;IACZ,IAAIK,OAAJ,EAAa;MACTY,MAAM;IACT,CAFD,MAEO;MACHF,KAAK;IACR;EACJ,CANQ,EAMN,CAACV,OAAD,CANM,CAAT;EAQA,OAAO;IAAEU,KAAF;IAASE;EAAT,CAAP;AACH;AAAA"}
@@ -0,0 +1,44 @@
1
+ import { useCallback } from 'react';
2
+ import { useImperativeState } from '@fountain-ui/core';
3
+ import { mod } from '@fountain-ui/utils';
4
+ export default function useIndexController(params) {
5
+ const {
6
+ initialIndex,
7
+ itemWidth,
8
+ numberOfData,
9
+ numberOfOriginalData,
10
+ onIndexChange,
11
+ onPositionChange
12
+ } = params;
13
+ const currentIndex = useImperativeState(initialIndex);
14
+ const currentPosition = useImperativeState(initialIndex);
15
+ const notifyScrollStateHasChanged = useCallback(_ref => {
16
+ let {
17
+ offset,
18
+ state
19
+ } = _ref;
20
+ const normalized = -Math.round(offset / itemWidth);
21
+ const index = Math.floor(mod(normalized, numberOfOriginalData));
22
+ const position = Math.floor(mod(normalized, numberOfData));
23
+
24
+ if (state === 'idle' || state === 'interrupted') {
25
+ if (currentIndex.hasChanged()) {
26
+ onIndexChange === null || onIndexChange === void 0 ? void 0 : onIndexChange(currentIndex.get());
27
+ }
28
+
29
+ if (currentPosition.hasChanged()) {
30
+ onPositionChange === null || onPositionChange === void 0 ? void 0 : onPositionChange(currentPosition.get());
31
+ }
32
+ }
33
+
34
+ currentIndex.set(index);
35
+ currentPosition.set(position);
36
+ }, [itemWidth, numberOfData, numberOfOriginalData, onIndexChange, onPositionChange]);
37
+ return {
38
+ getCurrentIndex: currentIndex.get,
39
+ lastIndex: numberOfOriginalData - 1,
40
+ notifyScrollStateHasChanged
41
+ };
42
+ }
43
+ ;
44
+ //# sourceMappingURL=useIndexController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useImperativeState","mod","useIndexController","params","initialIndex","itemWidth","numberOfData","numberOfOriginalData","onIndexChange","onPositionChange","currentIndex","currentPosition","notifyScrollStateHasChanged","offset","state","normalized","Math","round","index","floor","position","hasChanged","get","set","getCurrentIndex","lastIndex"],"sources":["useIndexController.tsx"],"sourcesContent":["import { useCallback } from 'react';\nimport { useImperativeState } from '@fountain-ui/core';\nimport { mod } from '@fountain-ui/utils';\nimport type { IndexController, ScrollStateChangeEvent } from '../types';\n\nexport interface UseIndexControllerParameters {\n initialIndex: number;\n itemWidth: number;\n numberOfData: number;\n numberOfOriginalData: number;\n onIndexChange?: (itemIndex: number) => void;\n onPositionChange?: (position: number) => void;\n}\n\nexport default function useIndexController(params: UseIndexControllerParameters): IndexController {\n const {\n initialIndex,\n itemWidth,\n numberOfData,\n numberOfOriginalData,\n onIndexChange,\n onPositionChange,\n } = params;\n\n const currentIndex = useImperativeState(initialIndex);\n const currentPosition = useImperativeState(initialIndex);\n\n const notifyScrollStateHasChanged = useCallback(({ offset, state }: ScrollStateChangeEvent) => {\n const normalized = -Math.round(offset / itemWidth);\n const index = Math.floor(mod(normalized, numberOfOriginalData));\n const position = Math.floor(mod(normalized, numberOfData));\n\n if (state === 'idle' || state === 'interrupted') {\n if (currentIndex.hasChanged()) {\n onIndexChange?.(currentIndex.get());\n }\n if (currentPosition.hasChanged()) {\n onPositionChange?.(currentPosition.get());\n }\n }\n\n currentIndex.set(index);\n currentPosition.set(position);\n }, [\n itemWidth,\n numberOfData,\n numberOfOriginalData,\n onIndexChange,\n onPositionChange,\n ]);\n\n return {\n getCurrentIndex: currentIndex.get,\n lastIndex: numberOfOriginalData - 1,\n notifyScrollStateHasChanged,\n };\n};\n"],"mappings":"AAAA,SAASA,WAAT,QAA4B,OAA5B;AACA,SAASC,kBAAT,QAAmC,mBAAnC;AACA,SAASC,GAAT,QAAoB,oBAApB;AAYA,eAAe,SAASC,kBAAT,CAA4BC,MAA5B,EAAmF;EAC9F,MAAM;IACFC,YADE;IAEFC,SAFE;IAGFC,YAHE;IAIFC,oBAJE;IAKFC,aALE;IAMFC;EANE,IAOFN,MAPJ;EASA,MAAMO,YAAY,GAAGV,kBAAkB,CAACI,YAAD,CAAvC;EACA,MAAMO,eAAe,GAAGX,kBAAkB,CAACI,YAAD,CAA1C;EAEA,MAAMQ,2BAA2B,GAAGb,WAAW,CAAC,QAA+C;IAAA,IAA9C;MAAEc,MAAF;MAAUC;IAAV,CAA8C;IAC3F,MAAMC,UAAU,GAAG,CAACC,IAAI,CAACC,KAAL,CAAWJ,MAAM,GAAGR,SAApB,CAApB;IACA,MAAMa,KAAK,GAAGF,IAAI,CAACG,KAAL,CAAWlB,GAAG,CAACc,UAAD,EAAaR,oBAAb,CAAd,CAAd;IACA,MAAMa,QAAQ,GAAGJ,IAAI,CAACG,KAAL,CAAWlB,GAAG,CAACc,UAAD,EAAaT,YAAb,CAAd,CAAjB;;IAEA,IAAIQ,KAAK,KAAK,MAAV,IAAoBA,KAAK,KAAK,aAAlC,EAAiD;MAC7C,IAAIJ,YAAY,CAACW,UAAb,EAAJ,EAA+B;QAC3Bb,aAAa,SAAb,IAAAA,aAAa,WAAb,YAAAA,aAAa,CAAGE,YAAY,CAACY,GAAb,EAAH,CAAb;MACH;;MACD,IAAIX,eAAe,CAACU,UAAhB,EAAJ,EAAkC;QAC9BZ,gBAAgB,SAAhB,IAAAA,gBAAgB,WAAhB,YAAAA,gBAAgB,CAAGE,eAAe,CAACW,GAAhB,EAAH,CAAhB;MACH;IACJ;;IAEDZ,YAAY,CAACa,GAAb,CAAiBL,KAAjB;IACAP,eAAe,CAACY,GAAhB,CAAoBH,QAApB;EACH,CAhB8C,EAgB5C,CACCf,SADD,EAECC,YAFD,EAGCC,oBAHD,EAICC,aAJD,EAKCC,gBALD,CAhB4C,CAA/C;EAwBA,OAAO;IACHe,eAAe,EAAEd,YAAY,CAACY,GAD3B;IAEHG,SAAS,EAAElB,oBAAoB,GAAG,CAF/B;IAGHK;EAHG,CAAP;AAKH;AAAA"}
@@ -0,0 +1,86 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ import { useCallback, useEffect, useRef, useState } from 'react';
4
+ import { mod } from '@fountain-ui/utils';
5
+
6
+ class SimpleItemVisibilityStore {
7
+ constructor(initialValue) {
8
+ _defineProperty(this, "store", void 0);
9
+
10
+ _defineProperty(this, "listeners", []);
11
+
12
+ this.store = initialValue;
13
+ }
14
+
15
+ subscribe(listener) {
16
+ this.listeners.push(listener);
17
+ listener(this.store);
18
+ return () => {
19
+ const index = this.listeners.indexOf(listener);
20
+ this.listeners.splice(index, 1);
21
+ };
22
+ }
23
+
24
+ dispatch(ranges) {
25
+ this.store = ranges;
26
+
27
+ for (const id in this.listeners) {
28
+ const listener = this.listeners[id];
29
+ listener === null || listener === void 0 ? void 0 : listener(ranges);
30
+ }
31
+ }
32
+
33
+ removeAllListeners() {
34
+ this.listeners.splice(0, this.listeners.length);
35
+ }
36
+
37
+ }
38
+
39
+ function normalize(windowSize, numberOfData) {
40
+ if (windowSize <= 0) {
41
+ return numberOfData;
42
+ }
43
+
44
+ if (windowSize > 0 && windowSize % 2 === 0) {
45
+ return windowSize + 1;
46
+ }
47
+
48
+ return windowSize;
49
+ }
50
+
51
+ function makeVisibleIndexRanges(numberOfData, windowSize, index) {
52
+ const ws = normalize(windowSize, numberOfData);
53
+ const firstIndex = 0;
54
+ const lastIndex = numberOfData - 1;
55
+ const halfNumberOfAdjacent = Math.floor(ws / 2);
56
+ const leftSide = index - halfNumberOfAdjacent;
57
+ const rightSide = index + halfNumberOfAdjacent;
58
+ const leftRanges = leftSide >= 0 ? [[leftSide, index]] : [[firstIndex, index], [mod(leftSide, numberOfData), lastIndex]];
59
+ const rightRanges = rightSide < numberOfData ? [[index, rightSide]] : [[index, lastIndex], [firstIndex, mod(rightSide, numberOfData)]]; // @ts-ignore
60
+
61
+ return [...leftRanges, ...rightRanges];
62
+ }
63
+
64
+ export default function useItemVisibilityStore(params) {
65
+ const {
66
+ initialIndex,
67
+ numberOfData,
68
+ windowSize
69
+ } = params;
70
+ const [initialRange] = useState(() => {
71
+ return makeVisibleIndexRanges(numberOfData, windowSize, initialIndex);
72
+ });
73
+ const store = useRef(new SimpleItemVisibilityStore(initialRange)).current;
74
+ const onPositionChange = useCallback(position => {
75
+ const newRanges = makeVisibleIndexRanges(numberOfData, windowSize, position);
76
+ store.dispatch(newRanges);
77
+ }, [numberOfData, windowSize]);
78
+ useEffect(() => {
79
+ return () => {
80
+ store.removeAllListeners();
81
+ };
82
+ }, []);
83
+ return [store, onPositionChange];
84
+ }
85
+ ;
86
+ //# sourceMappingURL=useItemVisibilityStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useEffect","useRef","useState","mod","SimpleItemVisibilityStore","constructor","initialValue","store","subscribe","listener","listeners","push","index","indexOf","splice","dispatch","ranges","id","removeAllListeners","length","normalize","windowSize","numberOfData","makeVisibleIndexRanges","ws","firstIndex","lastIndex","halfNumberOfAdjacent","Math","floor","leftSide","rightSide","leftRanges","rightRanges","useItemVisibilityStore","params","initialIndex","initialRange","current","onPositionChange","position","newRanges"],"sources":["useItemVisibilityStore.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport { mod } from '@fountain-ui/utils';\nimport type { ItemVisibilityStore, OnPositionChange, VisibleIndexRanges } from '../types';\n\nexport interface Parameters {\n initialIndex: number;\n numberOfData: number;\n windowSize: number;\n}\n\nclass SimpleItemVisibilityStore implements ItemVisibilityStore {\n\n private store: VisibleIndexRanges;\n\n constructor(initialValue: VisibleIndexRanges) {\n this.store = initialValue;\n }\n\n private listeners: Array<(ranges: VisibleIndexRanges) => void> = [];\n\n subscribe(listener: (ranges: VisibleIndexRanges) => void) {\n this.listeners.push(listener);\n\n listener(this.store);\n\n return () => {\n const index = this.listeners.indexOf(listener);\n this.listeners.splice(index, 1);\n };\n }\n\n dispatch(ranges: VisibleIndexRanges): void {\n this.store = ranges;\n for (const id in this.listeners) {\n const listener = this.listeners[id];\n listener?.(ranges);\n }\n }\n\n removeAllListeners(): void {\n this.listeners.splice(0, this.listeners.length);\n }\n\n}\n\nfunction normalize(windowSize: number, numberOfData: number): number {\n if (windowSize <= 0) {\n return numberOfData;\n }\n if (windowSize > 0 && windowSize % 2 === 0) {\n return windowSize + 1;\n }\n return windowSize;\n}\n\nfunction makeVisibleIndexRanges(numberOfData: number, windowSize: number, index: number): VisibleIndexRanges {\n const ws = normalize(windowSize, numberOfData);\n\n const firstIndex = 0;\n const lastIndex = numberOfData - 1;\n const halfNumberOfAdjacent = Math.floor(ws / 2);\n\n const leftSide = index - halfNumberOfAdjacent;\n const rightSide = index + halfNumberOfAdjacent;\n\n const leftRanges = leftSide >= 0\n ? [[leftSide, index]]\n : [[firstIndex, index], [mod(leftSide, numberOfData), lastIndex]];\n\n const rightRanges = rightSide < numberOfData\n ? [[index, rightSide]]\n : [[index, lastIndex], [firstIndex, mod(rightSide, numberOfData)]];\n\n // @ts-ignore\n return [\n ...leftRanges,\n ...rightRanges,\n ];\n}\n\nexport default function useItemVisibilityStore(params: Parameters): [ItemVisibilityStore, OnPositionChange] {\n const {\n initialIndex,\n numberOfData,\n windowSize,\n } = params;\n\n const [initialRange] = useState(() => {\n return makeVisibleIndexRanges(numberOfData, windowSize, initialIndex);\n });\n\n const store = useRef(new SimpleItemVisibilityStore(initialRange)).current;\n\n const onPositionChange: OnPositionChange = useCallback((position) => {\n const newRanges = makeVisibleIndexRanges(numberOfData, windowSize, position);\n\n store.dispatch(newRanges);\n }, [numberOfData, windowSize]);\n\n useEffect(() => {\n return () => {\n store.removeAllListeners();\n };\n }, []);\n\n return [store, onPositionChange];\n};\n"],"mappings":";;AAAA,SAASA,WAAT,EAAsBC,SAAtB,EAAiCC,MAAjC,EAAyCC,QAAzC,QAAyD,OAAzD;AACA,SAASC,GAAT,QAAoB,oBAApB;;AASA,MAAMC,yBAAN,CAA+D;EAI3DC,WAAW,CAACC,YAAD,EAAmC;IAAA;;IAAA,mCAImB,EAJnB;;IAC1C,KAAKC,KAAL,GAAaD,YAAb;EACH;;EAIDE,SAAS,CAACC,QAAD,EAAiD;IACtD,KAAKC,SAAL,CAAeC,IAAf,CAAoBF,QAApB;IAEAA,QAAQ,CAAC,KAAKF,KAAN,CAAR;IAEA,OAAO,MAAM;MACT,MAAMK,KAAK,GAAG,KAAKF,SAAL,CAAeG,OAAf,CAAuBJ,QAAvB,CAAd;MACA,KAAKC,SAAL,CAAeI,MAAf,CAAsBF,KAAtB,EAA6B,CAA7B;IACH,CAHD;EAIH;;EAEDG,QAAQ,CAACC,MAAD,EAAmC;IACvC,KAAKT,KAAL,GAAaS,MAAb;;IACA,KAAK,MAAMC,EAAX,IAAiB,KAAKP,SAAtB,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,CAAD,CADc,GAEd,CAAC,CAACnB,KAAD,EAAQc,SAAR,CAAD,EAAqB,CAACD,UAAD,EAAatB,GAAG,CAAC4B,SAAD,EAAYT,YAAZ,CAAhB,CAArB,CAFN,CAdyG,CAkBzG;;EACA,OAAO,CACH,GAAGU,UADA,EAEH,GAAGC,WAFA,CAAP;AAIH;;AAED,eAAe,SAASC,sBAAT,CAAgCC,MAAhC,EAA6F;EACxG,MAAM;IACFC,YADE;IAEFd,YAFE;IAGFD;EAHE,IAIFc,MAJJ;EAMA,MAAM,CAACE,YAAD,IAAiBnC,QAAQ,CAAC,MAAM;IAClC,OAAOqB,sBAAsB,CAACD,YAAD,EAAeD,UAAf,EAA2Be,YAA3B,CAA7B;EACH,CAF8B,CAA/B;EAIA,MAAM7B,KAAK,GAAGN,MAAM,CAAC,IAAIG,yBAAJ,CAA8BiC,YAA9B,CAAD,CAAN,CAAoDC,OAAlE;EAEA,MAAMC,gBAAkC,GAAGxC,WAAW,CAAEyC,QAAD,IAAc;IACjE,MAAMC,SAAS,GAAGlB,sBAAsB,CAACD,YAAD,EAAeD,UAAf,EAA2BmB,QAA3B,CAAxC;IAEAjC,KAAK,CAACQ,QAAN,CAAe0B,SAAf;EACH,CAJqD,EAInD,CAACnB,YAAD,EAAeD,UAAf,CAJmD,CAAtD;EAMArB,SAAS,CAAC,MAAM;IACZ,OAAO,MAAM;MACTO,KAAK,CAACW,kBAAN;IACH,CAFD;EAGH,CAJQ,EAIN,EAJM,CAAT;EAMA,OAAO,CAACX,KAAD,EAAQgC,gBAAR,CAAP;AACH;AAAA"}
@@ -0,0 +1,24 @@
1
+ import { useMemo } from 'react';
2
+ export default function useLoopedData(originalData, loop) {
3
+ return useMemo(() => {
4
+ if (!loop) {
5
+ return originalData;
6
+ }
7
+
8
+ const numberOfData = originalData.length;
9
+
10
+ if (numberOfData === 1) {
11
+ const [first] = originalData;
12
+ return [first, first, first];
13
+ }
14
+
15
+ if (numberOfData === 2) {
16
+ const [first, second] = originalData;
17
+ return [first, second, first, second];
18
+ }
19
+
20
+ return originalData;
21
+ }, [originalData, loop]);
22
+ }
23
+ ;
24
+ //# sourceMappingURL=useLoopedData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useMemo","useLoopedData","originalData","loop","numberOfData","length","first","second"],"sources":["useLoopedData.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nexport default function useLoopedData<ItemT>(\n originalData: ReadonlyArray<ItemT>,\n loop: boolean,\n): ReadonlyArray<ItemT> {\n return useMemo(() => {\n if (!loop) {\n return originalData;\n }\n\n const numberOfData = originalData.length;\n\n if (numberOfData === 1) {\n const [first] = originalData;\n return [first, first, first];\n }\n\n if (numberOfData === 2) {\n const [first, second] = originalData;\n return [first, second, first, second];\n }\n\n return originalData;\n }, [originalData, loop]);\n};\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,OAAxB;AAEA,eAAe,SAASC,aAAT,CACXC,YADW,EAEXC,IAFW,EAGS;EACpB,OAAOH,OAAO,CAAC,MAAM;IACjB,IAAI,CAACG,IAAL,EAAW;MACP,OAAOD,YAAP;IACH;;IAED,MAAME,YAAY,GAAGF,YAAY,CAACG,MAAlC;;IAEA,IAAID,YAAY,KAAK,CAArB,EAAwB;MACpB,MAAM,CAACE,KAAD,IAAUJ,YAAhB;MACA,OAAO,CAACI,KAAD,EAAQA,KAAR,EAAeA,KAAf,CAAP;IACH;;IAED,IAAIF,YAAY,KAAK,CAArB,EAAwB;MACpB,MAAM,CAACE,KAAD,EAAQC,MAAR,IAAkBL,YAAxB;MACA,OAAO,CAACI,KAAD,EAAQC,MAAR,EAAgBD,KAAhB,EAAuBC,MAAvB,CAAP;IACH;;IAED,OAAOL,YAAP;EACH,CAlBa,EAkBX,CAACA,YAAD,EAAeC,IAAf,CAlBW,CAAd;AAmBH;AAAA"}
@@ -0,0 +1,192 @@
1
+ import { useCallback, useMemo, useRef } from 'react';
2
+ import { Animated } from 'react-native';
3
+ import { useAnimatedValue } from '@fountain-ui/core';
4
+
5
+ function directionToValue(itemWidth) {
6
+ return function (direction) {
7
+ switch (direction) {
8
+ case 'next':
9
+ return -itemWidth;
10
+
11
+ case 'prev':
12
+ return itemWidth;
13
+
14
+ case 'stay':
15
+ return 0;
16
+ }
17
+ };
18
+ }
19
+
20
+ function toValueCompensator(itemWidth) {
21
+ return function (toValue, currentOffset) {
22
+ const remainder = Math.abs(currentOffset % itemWidth);
23
+ const halfOfItemWidth = Math.abs(itemWidth / 2);
24
+ const compensateVector = remainder > halfOfItemWidth ? remainder - itemWidth : remainder;
25
+ const direction = currentOffset > 0 ? -1 : 1;
26
+ return toValue + direction * compensateVector;
27
+ };
28
+ }
29
+
30
+ export default function usePagingAnimator(config) {
31
+ const {
32
+ createScrollAnimation,
33
+ itemWidth,
34
+ indexController,
35
+ initialIndex,
36
+ loop,
37
+ numberOfData
38
+ } = config;
39
+ const {
40
+ getCurrentIndex,
41
+ lastIndex,
42
+ notifyScrollStateHasChanged
43
+ } = indexController;
44
+ const initialOffsetX = itemWidth * initialIndex;
45
+ const accumulativeOffsetX = useAnimatedValue(initialOffsetX);
46
+ const animationOffsetX = useAnimatedValue(0);
47
+ const gestureTranslationX = useAnimatedValue(0);
48
+ const globalInterpolation = useMemo(() => {
49
+ return Animated.add(Animated.add(accumulativeOffsetX, animationOffsetX), gestureTranslationX);
50
+ }, []);
51
+ const toValueRef = useRef(0);
52
+ const currentOffsetRef = useRef(0);
53
+ const isAnimatingRef = useRef(false);
54
+ const maxWidth = Math.abs(numberOfData * itemWidth);
55
+ const ensureOffsetBoundary = useCallback(offset => {
56
+ if (loop) {
57
+ const isCloseToEnd = Math.abs(offset) >= maxWidth - itemWidth;
58
+
59
+ if (isCloseToEnd) {
60
+ const signOfOffset = offset > 0 ? 1 : -1;
61
+ return offset + -signOfOffset * maxWidth;
62
+ }
63
+ }
64
+
65
+ return offset % maxWidth;
66
+ }, [itemWidth, loop, maxWidth]);
67
+ const requireNewOffset = useCallback(newOffset => {
68
+ const nextOffset = ensureOffsetBoundary(newOffset);
69
+ currentOffsetRef.current = nextOffset;
70
+ accumulativeOffsetX.setValue(nextOffset);
71
+ toValueRef.current = 0;
72
+ animationOffsetX.setValue(0);
73
+ }, [ensureOffsetBoundary]);
74
+ const interruptAnimation = useCallback(() => {
75
+ if (!isAnimatingRef.current) {
76
+ return;
77
+ }
78
+
79
+ animationOffsetX.stopAnimation(lastValue => {
80
+ isAnimatingRef.current = false;
81
+ const prevOffset = currentOffsetRef.current;
82
+ const totalOffset = prevOffset + lastValue;
83
+ requireNewOffset(totalOffset);
84
+ notifyScrollStateHasChanged({
85
+ offset: totalOffset,
86
+ state: 'interrupted'
87
+ });
88
+ });
89
+ }, [notifyScrollStateHasChanged, requireNewOffset]);
90
+ const finalizeAnimation = useCallback(() => {
91
+ isAnimatingRef.current = false;
92
+ const prevOffset = currentOffsetRef.current;
93
+ const toValue = toValueRef.current;
94
+ const totalOffset = prevOffset + toValue;
95
+ requireNewOffset(totalOffset);
96
+ notifyScrollStateHasChanged({
97
+ offset: totalOffset,
98
+ state: 'idle'
99
+ });
100
+ }, [notifyScrollStateHasChanged, requireNewOffset]);
101
+ const startPagingAnimation = useCallback((type, config) => {
102
+ if (isAnimatingRef.current) {
103
+ return;
104
+ }
105
+
106
+ const configWithDefaults = {
107
+ animated: true,
108
+ ...config
109
+ };
110
+ const currentIndex = getCurrentIndex();
111
+ const getValueByDirectionOnAllAdjacentItemsVisible = directionToValue(itemWidth);
112
+ const compensateToValue = toValueCompensator(itemWidth);
113
+
114
+ const getValueByDirectionalPagingOnLoopDisabled = _config => {
115
+ const {
116
+ direction,
117
+ isOriginatedFromGesture
118
+ } = _config;
119
+
120
+ if (currentIndex === 0 && direction === 'prev') {
121
+ return isOriginatedFromGesture ? getValueByDirectionOnAllAdjacentItemsVisible('stay') : -lastIndex * itemWidth; // last position
122
+ } else if (currentIndex === lastIndex && direction === 'next') {
123
+ return isOriginatedFromGesture ? getValueByDirectionOnAllAdjacentItemsVisible('stay') : lastIndex * itemWidth; // first position
124
+ }
125
+
126
+ return getValueByDirectionOnAllAdjacentItemsVisible(direction);
127
+ };
128
+
129
+ const getValueByDirectionalPaging = _config => {
130
+ const _configWithDefaults = {
131
+ isOriginatedFromGesture: false,
132
+ ..._config
133
+ };
134
+ return loop ? getValueByDirectionOnAllAdjacentItemsVisible(_configWithDefaults.direction) : getValueByDirectionalPagingOnLoopDisabled(_configWithDefaults);
135
+ };
136
+
137
+ const getValueByIndexPaging = _ref => {
138
+ let {
139
+ index
140
+ } = _ref;
141
+
142
+ if (index < 0 || index > lastIndex || index === currentIndex) {
143
+ // no animation if index is invalid or equals to current index
144
+ return 0;
145
+ }
146
+
147
+ const distance = Math.abs(currentIndex - index) * itemWidth;
148
+ const direction = index > currentIndex ? -1 : 1;
149
+ return distance * direction;
150
+ };
151
+
152
+ const wantedToValue = type === 'directional' // @ts-ignore
153
+ ? getValueByDirectionalPaging(configWithDefaults) // @ts-ignore
154
+ : getValueByIndexPaging(configWithDefaults);
155
+ const toValue = compensateToValue(wantedToValue, currentOffsetRef.current);
156
+ toValueRef.current = toValue;
157
+ isAnimatingRef.current = true;
158
+ notifyScrollStateHasChanged({
159
+ offset: currentOffsetRef.current + toValue,
160
+ state: 'dragging'
161
+ });
162
+ const lastGestureTranslationX = configWithDefaults.lastGestureTranslationX ?? 0;
163
+
164
+ if (Number.isFinite(lastGestureTranslationX)) {
165
+ animationOffsetX.setValue(lastGestureTranslationX);
166
+ gestureTranslationX.setValue(0);
167
+ }
168
+
169
+ if (configWithDefaults.animated) {
170
+ const animation = createScrollAnimation(animationOffsetX, toValue);
171
+ animation.start(_ref2 => {
172
+ let {
173
+ finished
174
+ } = _ref2;
175
+
176
+ if (finished) {
177
+ finalizeAnimation();
178
+ }
179
+ });
180
+ } else {
181
+ finalizeAnimation();
182
+ }
183
+ }, [createScrollAnimation, getCurrentIndex, finalizeAnimation, itemWidth, lastIndex, loop, notifyScrollStateHasChanged]);
184
+ return {
185
+ gestureTranslationX,
186
+ globalInterpolation,
187
+ interruptAnimation,
188
+ startPagingAnimation
189
+ };
190
+ }
191
+ ;
192
+ //# sourceMappingURL=usePagingAnimator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useMemo","useRef","Animated","useAnimatedValue","directionToValue","itemWidth","direction","toValueCompensator","toValue","currentOffset","remainder","Math","abs","halfOfItemWidth","compensateVector","usePagingAnimator","config","createScrollAnimation","indexController","initialIndex","loop","numberOfData","getCurrentIndex","lastIndex","notifyScrollStateHasChanged","initialOffsetX","accumulativeOffsetX","animationOffsetX","gestureTranslationX","globalInterpolation","add","toValueRef","currentOffsetRef","isAnimatingRef","maxWidth","ensureOffsetBoundary","offset","isCloseToEnd","signOfOffset","requireNewOffset","newOffset","nextOffset","current","setValue","interruptAnimation","stopAnimation","lastValue","prevOffset","totalOffset","state","finalizeAnimation","startPagingAnimation","type","configWithDefaults","animated","currentIndex","getValueByDirectionOnAllAdjacentItemsVisible","compensateToValue","getValueByDirectionalPagingOnLoopDisabled","_config","isOriginatedFromGesture","getValueByDirectionalPaging","_configWithDefaults","getValueByIndexPaging","index","distance","wantedToValue","lastGestureTranslationX","Number","isFinite","animation","start","finished"],"sources":["usePagingAnimator.ts"],"sourcesContent":["import { useCallback, useMemo, useRef } from 'react';\nimport { Animated } from 'react-native';\nimport { useAnimatedValue } from '@fountain-ui/core';\nimport type {\n CreateScrollAnimation,\n DirectionalPagingAnimationConfig,\n IndexController,\n IndexPagingAnimationConfig,\n PagingAnimationConfig,\n PagingAnimationType,\n PagingDirection,\n StartPagingAnimation,\n} from '../types';\n\nexport interface PagingAnimatorConfig {\n createScrollAnimation: CreateScrollAnimation;\n itemWidth: number;\n indexController: IndexController;\n initialIndex: number;\n loop: boolean;\n numberOfData: number;\n}\n\nexport interface PagingAnimator {\n gestureTranslationX: Animated.Value;\n globalInterpolation: Animated.AnimatedInterpolation;\n interruptAnimation: () => void;\n startPagingAnimation: StartPagingAnimation;\n}\n\nfunction directionToValue(itemWidth: number) {\n return function (direction: PagingDirection): number {\n switch (direction) {\n case 'next':\n return -itemWidth;\n case 'prev':\n return itemWidth;\n case 'stay':\n return 0;\n }\n };\n}\n\nfunction toValueCompensator(itemWidth: number) {\n return function (toValue: number, currentOffset: number): number {\n const remainder = Math.abs(currentOffset % itemWidth);\n\n const halfOfItemWidth = Math.abs(itemWidth / 2);\n const compensateVector = remainder > halfOfItemWidth\n ? remainder - itemWidth\n : remainder;\n\n const direction = currentOffset > 0 ? -1 : 1;\n\n return toValue + (direction * compensateVector);\n };\n}\n\nexport default function usePagingAnimator(config: PagingAnimatorConfig): PagingAnimator {\n const {\n createScrollAnimation,\n itemWidth,\n indexController,\n initialIndex,\n loop,\n numberOfData,\n } = config;\n\n const {\n getCurrentIndex,\n lastIndex,\n notifyScrollStateHasChanged,\n } = indexController;\n\n const initialOffsetX = itemWidth * initialIndex;\n const accumulativeOffsetX = useAnimatedValue(initialOffsetX);\n const animationOffsetX = useAnimatedValue(0);\n const gestureTranslationX = useAnimatedValue(0);\n\n const globalInterpolation = useMemo(() => {\n return Animated.add(\n Animated.add(accumulativeOffsetX, animationOffsetX),\n gestureTranslationX,\n );\n }, []);\n\n const toValueRef = useRef<number>(0);\n const currentOffsetRef = useRef<number>(0);\n\n const isAnimatingRef = useRef<boolean>(false);\n\n const maxWidth = Math.abs(numberOfData * itemWidth);\n\n const ensureOffsetBoundary: (offset: number) => number = useCallback((offset: number) => {\n if (loop) {\n const isCloseToEnd = Math.abs(offset) >= (maxWidth - itemWidth);\n if (isCloseToEnd) {\n const signOfOffset = offset > 0 ? 1 : -1;\n return offset + (-signOfOffset * maxWidth);\n }\n }\n\n return offset % maxWidth;\n }, [itemWidth, loop, maxWidth]);\n\n const requireNewOffset = useCallback((newOffset: number) => {\n const nextOffset = ensureOffsetBoundary(newOffset);\n\n currentOffsetRef.current = nextOffset;\n accumulativeOffsetX.setValue(nextOffset);\n\n toValueRef.current = 0;\n animationOffsetX.setValue(0);\n }, [\n ensureOffsetBoundary,\n ]);\n\n const interruptAnimation = useCallback(() => {\n if (!isAnimatingRef.current) {\n return;\n }\n\n animationOffsetX.stopAnimation(lastValue => {\n isAnimatingRef.current = false;\n\n const prevOffset = currentOffsetRef.current;\n const totalOffset = prevOffset + lastValue;\n\n requireNewOffset(totalOffset);\n\n notifyScrollStateHasChanged({ offset: totalOffset, state: 'interrupted' });\n });\n }, [\n notifyScrollStateHasChanged,\n requireNewOffset,\n ]);\n\n const finalizeAnimation = useCallback(() => {\n isAnimatingRef.current = false;\n\n const prevOffset = currentOffsetRef.current;\n const toValue = toValueRef.current;\n const totalOffset = prevOffset + toValue;\n\n requireNewOffset(totalOffset);\n\n notifyScrollStateHasChanged({ offset: totalOffset, state: 'idle' });\n }, [\n notifyScrollStateHasChanged,\n requireNewOffset,\n ]);\n\n const startPagingAnimation = useCallback((type: PagingAnimationType, config: PagingAnimationConfig) => {\n if (isAnimatingRef.current) {\n return;\n }\n\n const configWithDefaults: PagingAnimationConfig = {\n animated: true,\n ...config,\n };\n\n const currentIndex = getCurrentIndex();\n\n const getValueByDirectionOnAllAdjacentItemsVisible = directionToValue(itemWidth);\n const compensateToValue = toValueCompensator(itemWidth);\n\n const getValueByDirectionalPagingOnLoopDisabled = (_config: DirectionalPagingAnimationConfig): number => {\n const { direction, isOriginatedFromGesture } = _config;\n\n if (currentIndex === 0 && direction === 'prev') {\n return isOriginatedFromGesture\n ? getValueByDirectionOnAllAdjacentItemsVisible('stay')\n : -lastIndex * itemWidth; // last position\n } else if (currentIndex === lastIndex && direction === 'next') {\n return isOriginatedFromGesture\n ? getValueByDirectionOnAllAdjacentItemsVisible('stay')\n : lastIndex * itemWidth; // first position\n }\n return getValueByDirectionOnAllAdjacentItemsVisible(direction);\n };\n\n const getValueByDirectionalPaging = (_config: DirectionalPagingAnimationConfig): number => {\n const _configWithDefaults: DirectionalPagingAnimationConfig = {\n isOriginatedFromGesture: false,\n ..._config,\n };\n\n return loop\n ? getValueByDirectionOnAllAdjacentItemsVisible(_configWithDefaults.direction)\n : getValueByDirectionalPagingOnLoopDisabled(_configWithDefaults);\n };\n\n const getValueByIndexPaging = ({ index }: IndexPagingAnimationConfig): number => {\n if (index < 0 || index > lastIndex || index === currentIndex) {\n // no animation if index is invalid or equals to current index\n return 0;\n }\n\n const distance = Math.abs(currentIndex - index) * itemWidth;\n const direction = index > currentIndex ? -1 : 1;\n\n return distance * direction;\n };\n\n const wantedToValue = type === 'directional'\n // @ts-ignore\n ? getValueByDirectionalPaging(configWithDefaults)\n // @ts-ignore\n : getValueByIndexPaging(configWithDefaults);\n\n const toValue = compensateToValue(wantedToValue, currentOffsetRef.current);\n\n toValueRef.current = toValue;\n isAnimatingRef.current = true;\n\n notifyScrollStateHasChanged({\n offset: currentOffsetRef.current + toValue,\n state: 'dragging',\n });\n\n const lastGestureTranslationX: number = configWithDefaults.lastGestureTranslationX ?? 0;\n if (Number.isFinite(lastGestureTranslationX)) {\n animationOffsetX.setValue(lastGestureTranslationX);\n gestureTranslationX.setValue(0);\n }\n\n if (configWithDefaults.animated) {\n const animation = createScrollAnimation(animationOffsetX, toValue);\n\n animation.start(({ finished }) => {\n if (finished) {\n finalizeAnimation();\n }\n });\n } else {\n finalizeAnimation();\n }\n }, [\n createScrollAnimation,\n getCurrentIndex,\n finalizeAnimation,\n itemWidth,\n lastIndex,\n loop,\n notifyScrollStateHasChanged,\n ]);\n\n return {\n gestureTranslationX,\n globalInterpolation,\n interruptAnimation,\n startPagingAnimation,\n };\n};\n"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,OAAtB,EAA+BC,MAA/B,QAA6C,OAA7C;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,SAASC,gBAAT,QAAiC,mBAAjC;;AA4BA,SAASC,gBAAT,CAA0BC,SAA1B,EAA6C;EACzC,OAAO,UAAUC,SAAV,EAA8C;IACjD,QAAQA,SAAR;MACI,KAAK,MAAL;QACI,OAAO,CAACD,SAAR;;MACJ,KAAK,MAAL;QACI,OAAOA,SAAP;;MACJ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AArB;IACAyB,cAAc,CAACS,OAAf,GAAyB,IAAzB;IAEAlB,2BAA2B,CAAC;MACxBY,MAAM,EAAEJ,gBAAgB,CAACU,OAAjB,GAA2BlC,OADX;MAExByC,KAAK,EAAE;IAFiB,CAAD,CAA3B;IAKA,MAAMkB,uBAA+B,GAAGd,kBAAkB,CAACc,uBAAnB,IAA8C,CAAtF;;IACA,IAAIC,MAAM,CAACC,QAAP,CAAgBF,uBAAhB,CAAJ,EAA8C;MAC1CxC,gBAAgB,CAACgB,QAAjB,CAA0BwB,uBAA1B;MACAvC,mBAAmB,CAACe,QAApB,CAA6B,CAA7B;IACH;;IAED,IAAIU,kBAAkB,CAACC,QAAvB,EAAiC;MAC7B,MAAMgB,SAAS,GAAGrD,qBAAqB,CAACU,gBAAD,EAAmBnB,OAAnB,CAAvC;MAEA8D,SAAS,CAACC,KAAV,CAAgB,SAAkB;QAAA,IAAjB;UAAEC;QAAF,CAAiB;;QAC9B,IAAIA,QAAJ,EAAc;UACVtB,iBAAiB;QACpB;MACJ,CAJD;IAKH,CARD,MAQO;MACHA,iBAAiB;IACpB;EACJ,CAtFuC,EAsFrC,CACCjC,qBADD,EAECK,eAFD,EAGC4B,iBAHD,EAIC7C,SAJD,EAKCkB,SALD,EAMCH,IAND,EAOCI,2BAPD,CAtFqC,CAAxC;EAgGA,OAAO;IACHI,mBADG;IAEHC,mBAFG;IAGHe,kBAHG;IAIHO;EAJG,CAAP;AAMH;AAAA"}
@@ -1,2 +1,3 @@
1
- export { default } from './CarouselWeb';
1
+ export { default } from './Carousel';
2
+ export { normalItemStyleFactory, parallaxItemStyleFactory } from './animation';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["default"],"sources":["index.ts"],"sourcesContent":["export { default } from './CarouselWeb';\nexport type { default as CarouselProps } from './CarouselProps';"],"mappings":"AAAA,SAASA,OAAT,QAAwB,eAAxB"}
1
+ {"version":3,"names":["default","normalItemStyleFactory","parallaxItemStyleFactory"],"sources":["index.ts"],"sourcesContent":["export { default } from './Carousel';\nexport type { default as CarouselProps } from './CarouselProps';\nexport type { CarouselInstance } from './types';\nexport { normalItemStyleFactory, parallaxItemStyleFactory } from './animation';\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,YAAxB;AAGA,SAASC,sBAAT,EAAiCC,wBAAjC,QAAiE,aAAjE"}
@@ -0,0 +1,6 @@
1
+ import { logger } from '@fountain-ui/utils';
2
+ export default logger('Carousel', {
3
+ enabled: __DEV__,
4
+ format: 'diff'
5
+ });
6
+ //# sourceMappingURL=tick.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["logger","enabled","__DEV__","format"],"sources":["tick.ts"],"sourcesContent":["import { logger } from '@fountain-ui/utils';\n\nexport default logger('Carousel', {\n enabled: __DEV__,\n format: 'diff',\n});\n"],"mappings":"AAAA,SAASA,MAAT,QAAuB,oBAAvB;AAEA,eAAeA,MAAM,CAAC,UAAD,EAAa;EAC9BC,OAAO,EAAEC,OADqB;EAE9BC,MAAM,EAAE;AAFsB,CAAb,CAArB"}
@@ -0,0 +1,4 @@
1
+ const directions = ['next', 'prev', 'stay'];
2
+ const scrollStates = ['idle', 'dragging', 'interrupted'];
3
+ export {};
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["directions","scrollStates"],"sources":["types.ts"],"sourcesContent":["import type { ReactElement } from 'react';\nimport type { Animated, ViewProps } from 'react-native';\n\nconst directions = ['next', 'prev', 'stay'] as const;\n\nexport type PagingDirection = (typeof directions)[number];\n\nconst scrollStates = ['idle', 'dragging', 'interrupted'] as const;\n\nexport type ScrollState = (typeof scrollStates)[number];\n\nexport type ItemHeight = number | 'auto';\n\nexport interface RenderItem<T> {\n (info: { item: T, index: number, interpolation: Animated.AnimatedInterpolation }): ReactElement | null;\n}\n\nexport interface CreateScrollAnimation {\n (aValue: Animated.AnimatedValue, toValue: number): Animated.CompositeAnimation;\n}\n\nexport interface CreateItemStyle {\n (itemInterpolation: Animated.AnimatedInterpolation, itemWidth: number): Animated.AnimatedProps<ViewProps['style']>;\n}\n\nexport interface GetCurrentIndex {\n (): number;\n}\n\nexport interface OnIndexChange {\n (itemIndex: number): void;\n}\n\nexport interface OnPositionChange {\n (position: number): void;\n}\n\nexport interface ScrollStateChangeEvent {\n offset: number;\n state: ScrollState;\n}\n\nexport interface IndexController {\n getCurrentIndex: GetCurrentIndex;\n lastIndex: number;\n notifyScrollStateHasChanged: (event: ScrollStateChangeEvent) => void;\n}\n\nexport type PagingAnimationType = 'directional' | 'index';\n\nexport interface BasePagingAnimationConfig {\n animated?: boolean;\n lastGestureTranslationX?: number;\n}\n\nexport interface DirectionalPagingAnimationConfig extends BasePagingAnimationConfig {\n direction: PagingDirection;\n isOriginatedFromGesture?: boolean;\n}\n\nexport interface IndexPagingAnimationConfig extends BasePagingAnimationConfig {\n index: number;\n}\n\nexport type PagingAnimationConfig = DirectionalPagingAnimationConfig | IndexPagingAnimationConfig;\n\nexport interface StartPagingAnimation {\n (type: PagingAnimationType, config: PagingAnimationConfig): void;\n}\n\nexport type VisibleIndexRanges = Array<[number, number]>;\n\nexport interface StoreSubscription {\n (): void;\n}\n\nexport interface ItemVisibilityStore {\n dispatch: (ranges: VisibleIndexRanges) => void;\n subscribe: (listener: (ranges: VisibleIndexRanges) => void) => StoreSubscription;\n removeAllListeners: () => void;\n}\n\nexport interface AutoplayController {\n pause: () => void;\n resume: () => void;\n}\n\nexport interface ScrollToOption {\n index: number;\n animated?: boolean;\n}\n\nexport interface CarouselInstance {\n /**\n * Get current visible item index.\n */\n getCurrentIndex: GetCurrentIndex;\n\n /**\n * Scroll to next visible item.\n */\n next: () => void;\n\n /**\n * Scroll to previous visible item.\n */\n prev: () => void;\n\n /**\n * Scroll to desired indexed item.\n * Invalid index is ignored.\n */\n scrollTo: (option: ScrollToOption) => void;\n}\n"],"mappings":"AAGA,MAAMA,UAAU,GAAG,CAAC,MAAD,EAAS,MAAT,EAAiB,MAAjB,CAAnB;AAIA,MAAMC,YAAY,GAAG,CAAC,MAAD,EAAS,UAAT,EAAqB,aAArB,CAArB"}