@fountain-ui/lab 2.0.0-beta.5 → 2.0.0-beta.50

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 (517) hide show
  1. package/build/commonjs/AnimatedY/AnimatedY.js +10 -14
  2. package/build/commonjs/AnimatedY/AnimatedY.js.map +1 -1
  3. package/build/commonjs/AnimatedY/AnimatedYProps.js.map +1 -1
  4. package/build/commonjs/AnimatedY/index.js.map +1 -1
  5. package/build/commonjs/BottomSheet/BottomSheetNative.js +28 -5
  6. package/build/commonjs/BottomSheet/BottomSheetNative.js.map +1 -1
  7. package/build/commonjs/BottomSheet/BottomSheetProps.js.map +1 -1
  8. package/build/commonjs/BottomSheet/BottomSheetWeb.js +26 -15
  9. package/build/commonjs/BottomSheet/BottomSheetWeb.js.map +1 -1
  10. package/build/commonjs/BottomSheet/TransparentBackdrop.js +1 -1
  11. package/build/commonjs/BottomSheet/TransparentBackdrop.js.map +1 -1
  12. package/build/commonjs/BottomSheet/index.js.map +1 -1
  13. package/build/commonjs/BottomSheet/index.native.js.map +1 -1
  14. package/build/commonjs/BottomSheet/useDynamicSnapPoints.js +65 -0
  15. package/build/commonjs/BottomSheet/useDynamicSnapPoints.js.map +1 -0
  16. package/build/commonjs/Carousel/Carousel.js +130 -0
  17. package/build/commonjs/Carousel/Carousel.js.map +1 -0
  18. package/build/commonjs/Carousel/CarouselProps.js.map +1 -1
  19. package/build/commonjs/Carousel/animation/animationUtils.js +9 -0
  20. package/build/commonjs/Carousel/animation/animationUtils.js.map +1 -0
  21. package/build/commonjs/Carousel/animation/createDefaultItemStyle.js +15 -0
  22. package/build/commonjs/Carousel/animation/createDefaultItemStyle.js.map +1 -0
  23. package/build/commonjs/Carousel/animation/createDefaultScrollAnimation.js +20 -0
  24. package/build/commonjs/Carousel/animation/createDefaultScrollAnimation.js.map +1 -0
  25. package/build/commonjs/Carousel/animation/index.js +40 -0
  26. package/build/commonjs/Carousel/animation/index.js.map +1 -0
  27. package/build/commonjs/Carousel/animation/normalItemStyleFactory.js +27 -0
  28. package/build/commonjs/Carousel/animation/normalItemStyleFactory.js.map +1 -0
  29. package/build/commonjs/Carousel/animation/parallaxItemStyleFactory.js +65 -0
  30. package/build/commonjs/Carousel/animation/parallaxItemStyleFactory.js.map +1 -0
  31. package/build/commonjs/Carousel/components/InternalContext.js +29 -0
  32. package/build/commonjs/Carousel/components/InternalContext.js.map +1 -0
  33. package/build/commonjs/Carousel/components/ItemView.js +66 -0
  34. package/build/commonjs/Carousel/components/ItemView.js.map +1 -0
  35. package/build/commonjs/Carousel/components/RootView.js +86 -0
  36. package/build/commonjs/Carousel/components/RootView.js.map +1 -0
  37. package/build/commonjs/Carousel/components/ScrollViewGesture.js +82 -0
  38. package/build/commonjs/Carousel/components/ScrollViewGesture.js.map +1 -0
  39. package/build/commonjs/Carousel/components/index.js +40 -0
  40. package/build/commonjs/Carousel/components/index.js.map +1 -0
  41. package/build/commonjs/Carousel/components/useItemInterpolation.js +65 -0
  42. package/build/commonjs/Carousel/components/useItemInterpolation.js.map +1 -0
  43. package/build/commonjs/Carousel/hooks/index.js +48 -0
  44. package/build/commonjs/Carousel/hooks/index.js.map +1 -0
  45. package/build/commonjs/Carousel/hooks/useAutoplayController.js +58 -0
  46. package/build/commonjs/Carousel/hooks/useAutoplayController.js.map +1 -0
  47. package/build/commonjs/Carousel/hooks/useIndexController.js +55 -0
  48. package/build/commonjs/Carousel/hooks/useIndexController.js.map +1 -0
  49. package/build/commonjs/Carousel/hooks/useItemVisibilityStore.js +95 -0
  50. package/build/commonjs/Carousel/hooks/useItemVisibilityStore.js.map +1 -0
  51. package/build/commonjs/Carousel/hooks/useLoopedData.js +33 -0
  52. package/build/commonjs/Carousel/hooks/useLoopedData.js.map +1 -0
  53. package/build/commonjs/Carousel/hooks/usePagingAnimator.js +202 -0
  54. package/build/commonjs/Carousel/hooks/usePagingAnimator.js.map +1 -0
  55. package/build/commonjs/Carousel/index.js +16 -2
  56. package/build/commonjs/Carousel/index.js.map +1 -1
  57. package/build/commonjs/Carousel/tick.js +16 -0
  58. package/build/commonjs/Carousel/tick.js.map +1 -0
  59. package/build/commonjs/Carousel/types.js +8 -0
  60. package/build/commonjs/Carousel/types.js.map +1 -0
  61. package/build/commonjs/ComicViewer/ComicViewer.js +248 -88
  62. package/build/commonjs/ComicViewer/ComicViewer.js.map +1 -1
  63. package/build/commonjs/ComicViewer/ComicViewerProps.js.map +1 -1
  64. package/build/commonjs/ComicViewer/EncodedTile.js +10 -0
  65. package/build/commonjs/ComicViewer/EncodedTile.js.map +1 -0
  66. package/build/commonjs/ComicViewer/FastScroll.js +162 -0
  67. package/build/commonjs/ComicViewer/FastScroll.js.map +1 -0
  68. package/build/commonjs/ComicViewer/{ComicViewerItemProps.js → FastScrollProps.js} +1 -1
  69. package/build/commonjs/ComicViewer/FastScrollProps.js.map +1 -0
  70. package/build/commonjs/ComicViewer/ReloadButton.js +48 -0
  71. package/build/commonjs/ComicViewer/ReloadButton.js.map +1 -0
  72. package/build/commonjs/ComicViewer/ViewerItem.js +51 -58
  73. package/build/commonjs/ComicViewer/ViewerItem.js.map +1 -1
  74. package/build/commonjs/ComicViewer/index.js.map +1 -1
  75. package/build/commonjs/ComicViewer/util.js +27 -0
  76. package/build/commonjs/ComicViewer/util.js.map +1 -0
  77. package/build/commonjs/DateTimePicker/DateTimePicker.js.map +1 -1
  78. package/build/commonjs/DateTimePicker/DateTimePickerProps.js.map +1 -1
  79. package/build/commonjs/DateTimePicker/DateTimePickerProvider.js.map +1 -1
  80. package/build/commonjs/DateTimePicker/YearPicker.js +21 -17
  81. package/build/commonjs/DateTimePicker/YearPicker.js.map +1 -1
  82. package/build/commonjs/DateTimePicker/index.js +4 -4
  83. package/build/commonjs/DateTimePicker/index.js.map +1 -1
  84. package/build/commonjs/DateTimePicker/utils.js +2 -1
  85. package/build/commonjs/DateTimePicker/utils.js.map +1 -1
  86. package/build/commonjs/FlipCard/FlipCard.js +7 -13
  87. package/build/commonjs/FlipCard/FlipCard.js.map +1 -1
  88. package/build/commonjs/FlipCard/FlipCardProps.js.map +1 -1
  89. package/build/commonjs/FlipCard/index.js.map +1 -1
  90. package/build/commonjs/StatusBarProvider/Provider.js +1 -1
  91. package/build/commonjs/StatusBarProvider/Provider.js.map +1 -1
  92. package/build/commonjs/StatusBarProvider/StatusBarProvider.js.map +1 -1
  93. package/build/commonjs/StatusBarProvider/StatusBarProviderProps.js.map +1 -1
  94. package/build/commonjs/StatusBarProvider/index.js.map +1 -1
  95. package/build/commonjs/ViewPager/FluxContext.js +13 -0
  96. package/build/commonjs/ViewPager/FluxContext.js.map +1 -0
  97. package/build/commonjs/ViewPager/InternalContext.js +17 -0
  98. package/build/commonjs/ViewPager/InternalContext.js.map +1 -0
  99. package/build/commonjs/ViewPager/PageStateContext.js +16 -0
  100. package/build/commonjs/ViewPager/PageStateContext.js.map +1 -0
  101. package/build/commonjs/ViewPager/ViewPager.js +81 -0
  102. package/build/commonjs/ViewPager/ViewPager.js.map +1 -0
  103. package/build/commonjs/ViewPager/ViewPager.native.js +150 -0
  104. package/build/commonjs/ViewPager/ViewPager.native.js.map +1 -0
  105. package/build/commonjs/ViewPager/ViewPagerProps.js.map +1 -1
  106. package/build/commonjs/ViewPager/components/ChildrenMemoizedPage.js +122 -0
  107. package/build/commonjs/ViewPager/components/ChildrenMemoizedPage.js.map +1 -0
  108. package/build/commonjs/ViewPager/components/FluxStoreProvider.js +37 -0
  109. package/build/commonjs/ViewPager/components/FluxStoreProvider.js.map +1 -0
  110. package/build/commonjs/ViewPager/components/index.js +24 -0
  111. package/build/commonjs/ViewPager/components/index.js.map +1 -0
  112. package/build/commonjs/ViewPager/hooks/index.js +64 -0
  113. package/build/commonjs/ViewPager/hooks/index.js.map +1 -0
  114. package/build/commonjs/ViewPager/hooks/useDispatch.js +22 -0
  115. package/build/commonjs/ViewPager/hooks/useDispatch.js.map +1 -0
  116. package/build/commonjs/ViewPager/hooks/useEagerState.js +24 -0
  117. package/build/commonjs/ViewPager/hooks/useEagerState.js.map +1 -0
  118. package/build/commonjs/ViewPager/hooks/useForceRender.js +16 -0
  119. package/build/commonjs/ViewPager/hooks/useForceRender.js.map +1 -0
  120. package/build/commonjs/ViewPager/hooks/useLazyState.js +45 -0
  121. package/build/commonjs/ViewPager/hooks/useLazyState.js.map +1 -0
  122. package/build/commonjs/ViewPager/hooks/usePageStore.js +35 -0
  123. package/build/commonjs/ViewPager/hooks/usePageStore.js.map +1 -0
  124. package/build/commonjs/ViewPager/hooks/useStore.js +26 -0
  125. package/build/commonjs/ViewPager/hooks/useStore.js.map +1 -0
  126. package/build/commonjs/ViewPager/hooks/useViewPagerPageState.js +19 -0
  127. package/build/commonjs/ViewPager/hooks/useViewPagerPageState.js.map +1 -0
  128. package/build/commonjs/ViewPager/index.js +42 -2
  129. package/build/commonjs/ViewPager/index.js.map +1 -1
  130. package/build/commonjs/ViewPager/types.js +2 -0
  131. package/build/commonjs/ViewPager/types.js.map +1 -0
  132. package/build/commonjs/ViewPager/utils.js +12 -43
  133. package/build/commonjs/ViewPager/utils.js.map +1 -1
  134. package/build/commonjs/ViewabilityTrackerView/Viewability.js +2 -0
  135. package/build/commonjs/ViewabilityTrackerView/Viewability.js.map +1 -0
  136. package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerView.js +45 -0
  137. package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerView.js.map +1 -0
  138. package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerViewProps.js +2 -0
  139. package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerViewProps.js.map +1 -0
  140. package/build/commonjs/{Carousel/index.native.js → ViewabilityTrackerView/index.js} +3 -3
  141. package/build/commonjs/ViewabilityTrackerView/index.js.map +1 -0
  142. package/build/commonjs/ViewabilityTrackerView/measureViewability.js +42 -0
  143. package/build/commonjs/ViewabilityTrackerView/measureViewability.js.map +1 -0
  144. package/build/commonjs/ViewabilityTrackerView/useViewabilityTracker.js +88 -0
  145. package/build/commonjs/ViewabilityTrackerView/useViewabilityTracker.js.map +1 -0
  146. package/build/commonjs/hooks/index.js +16 -0
  147. package/build/commonjs/hooks/index.js.map +1 -1
  148. package/build/commonjs/hooks/useAppbarStyles.js.map +1 -1
  149. package/build/commonjs/hooks/useDeferredExecutor.js +45 -0
  150. package/build/commonjs/hooks/useDeferredExecutor.js.map +1 -0
  151. package/build/commonjs/hooks/useElevationStyle.js.map +1 -1
  152. package/build/commonjs/hooks/useHeight.js +7 -6
  153. package/build/commonjs/hooks/useHeight.js.map +1 -1
  154. package/build/commonjs/hooks/useIsMounted.js +22 -0
  155. package/build/commonjs/hooks/useIsMounted.js.map +1 -0
  156. package/build/commonjs/hooks/useUnstableCollapsibleAppBar.js +58 -61
  157. package/build/commonjs/hooks/useUnstableCollapsibleAppBar.js.map +1 -1
  158. package/build/commonjs/hooks/useUnstableToggleDisplayStyle.js +9 -11
  159. package/build/commonjs/hooks/useUnstableToggleDisplayStyle.js.map +1 -1
  160. package/build/commonjs/index.js +28 -7
  161. package/build/commonjs/index.js.map +1 -1
  162. package/build/module/AnimatedY/AnimatedY.js +11 -10
  163. package/build/module/AnimatedY/AnimatedY.js.map +1 -1
  164. package/build/module/AnimatedY/AnimatedYProps.js.map +1 -1
  165. package/build/module/AnimatedY/index.js.map +1 -1
  166. package/build/module/BottomSheet/BottomSheetNative.js +29 -7
  167. package/build/module/BottomSheet/BottomSheetNative.js.map +1 -1
  168. package/build/module/BottomSheet/BottomSheetProps.js.map +1 -1
  169. package/build/module/BottomSheet/BottomSheetWeb.js +24 -15
  170. package/build/module/BottomSheet/BottomSheetWeb.js.map +1 -1
  171. package/build/module/BottomSheet/TransparentBackdrop.js +1 -1
  172. package/build/module/BottomSheet/TransparentBackdrop.js.map +1 -1
  173. package/build/module/BottomSheet/index.js.map +1 -1
  174. package/build/module/BottomSheet/index.native.js.map +1 -1
  175. package/build/module/BottomSheet/useDynamicSnapPoints.js +52 -0
  176. package/build/module/BottomSheet/useDynamicSnapPoints.js.map +1 -0
  177. package/build/module/Carousel/Carousel.js +109 -0
  178. package/build/module/Carousel/Carousel.js.map +1 -0
  179. package/build/module/Carousel/CarouselProps.js.map +1 -1
  180. package/build/module/Carousel/animation/animationUtils.js +2 -0
  181. package/build/module/Carousel/animation/animationUtils.js.map +1 -0
  182. package/build/module/Carousel/animation/createDefaultItemStyle.js +3 -0
  183. package/build/module/Carousel/animation/createDefaultItemStyle.js.map +1 -0
  184. package/build/module/Carousel/animation/createDefaultScrollAnimation.js +11 -0
  185. package/build/module/Carousel/animation/createDefaultScrollAnimation.js.map +1 -0
  186. package/build/module/Carousel/animation/index.js +5 -0
  187. package/build/module/Carousel/animation/index.js.map +1 -0
  188. package/build/module/Carousel/animation/normalItemStyleFactory.js +18 -0
  189. package/build/module/Carousel/animation/normalItemStyleFactory.js.map +1 -0
  190. package/build/module/Carousel/animation/parallaxItemStyleFactory.js +55 -0
  191. package/build/module/Carousel/animation/parallaxItemStyleFactory.js.map +1 -0
  192. package/build/module/Carousel/components/InternalContext.js +19 -0
  193. package/build/module/Carousel/components/InternalContext.js.map +1 -0
  194. package/build/module/Carousel/components/ItemView.js +46 -0
  195. package/build/module/Carousel/components/ItemView.js.map +1 -0
  196. package/build/module/Carousel/components/RootView.js +65 -0
  197. package/build/module/Carousel/components/RootView.js.map +1 -0
  198. package/build/module/Carousel/components/ScrollViewGesture.js +68 -0
  199. package/build/module/Carousel/components/ScrollViewGesture.js.map +1 -0
  200. package/build/module/Carousel/components/index.js +5 -0
  201. package/build/module/Carousel/components/index.js.map +1 -0
  202. package/build/module/Carousel/components/useItemInterpolation.js +51 -0
  203. package/build/module/Carousel/components/useItemInterpolation.js.map +1 -0
  204. package/build/module/Carousel/hooks/index.js +6 -0
  205. package/build/module/Carousel/hooks/index.js.map +1 -0
  206. package/build/module/Carousel/hooks/useAutoplayController.js +48 -0
  207. package/build/module/Carousel/hooks/useAutoplayController.js.map +1 -0
  208. package/build/module/Carousel/hooks/useIndexController.js +44 -0
  209. package/build/module/Carousel/hooks/useIndexController.js.map +1 -0
  210. package/build/module/Carousel/hooks/useItemVisibilityStore.js +86 -0
  211. package/build/module/Carousel/hooks/useItemVisibilityStore.js.map +1 -0
  212. package/build/module/Carousel/hooks/useLoopedData.js +24 -0
  213. package/build/module/Carousel/hooks/useLoopedData.js.map +1 -0
  214. package/build/module/Carousel/hooks/usePagingAnimator.js +192 -0
  215. package/build/module/Carousel/hooks/usePagingAnimator.js.map +1 -0
  216. package/build/module/Carousel/index.js +2 -1
  217. package/build/module/Carousel/index.js.map +1 -1
  218. package/build/module/Carousel/tick.js +6 -0
  219. package/build/module/Carousel/tick.js.map +1 -0
  220. package/build/module/Carousel/types.js +4 -0
  221. package/build/module/Carousel/types.js.map +1 -0
  222. package/build/module/ComicViewer/ComicViewer.js +245 -88
  223. package/build/module/ComicViewer/ComicViewer.js.map +1 -1
  224. package/build/module/ComicViewer/ComicViewerProps.js.map +1 -1
  225. package/build/module/ComicViewer/EncodedTile.js +3 -0
  226. package/build/module/ComicViewer/EncodedTile.js.map +1 -0
  227. package/build/module/ComicViewer/FastScroll.js +141 -0
  228. package/build/module/ComicViewer/FastScroll.js.map +1 -0
  229. package/build/module/ComicViewer/FastScrollProps.js +2 -0
  230. package/build/module/ComicViewer/FastScrollProps.js.map +1 -0
  231. package/build/module/ComicViewer/ReloadButton.js +33 -0
  232. package/build/module/ComicViewer/ReloadButton.js.map +1 -0
  233. package/build/module/ComicViewer/ViewerItem.js +51 -59
  234. package/build/module/ComicViewer/ViewerItem.js.map +1 -1
  235. package/build/module/ComicViewer/index.js.map +1 -1
  236. package/build/module/ComicViewer/util.js +15 -0
  237. package/build/module/ComicViewer/util.js.map +1 -0
  238. package/build/module/DateTimePicker/DateTimePicker.js.map +1 -1
  239. package/build/module/DateTimePicker/DateTimePickerProps.js.map +1 -1
  240. package/build/module/DateTimePicker/DateTimePickerProvider.js.map +1 -1
  241. package/build/module/DateTimePicker/YearPicker.js +21 -17
  242. package/build/module/DateTimePicker/YearPicker.js.map +1 -1
  243. package/build/module/DateTimePicker/index.js.map +1 -1
  244. package/build/module/DateTimePicker/utils.js +2 -1
  245. package/build/module/DateTimePicker/utils.js.map +1 -1
  246. package/build/module/FlipCard/FlipCard.js +7 -7
  247. package/build/module/FlipCard/FlipCard.js.map +1 -1
  248. package/build/module/FlipCard/FlipCardProps.js.map +1 -1
  249. package/build/module/FlipCard/index.js.map +1 -1
  250. package/build/module/StatusBarProvider/Provider.js.map +1 -1
  251. package/build/module/StatusBarProvider/StatusBarProvider.js.map +1 -1
  252. package/build/module/StatusBarProvider/StatusBarProviderProps.js.map +1 -1
  253. package/build/module/StatusBarProvider/index.js.map +1 -1
  254. package/build/module/ViewPager/FluxContext.js +4 -0
  255. package/build/module/ViewPager/FluxContext.js.map +1 -0
  256. package/build/module/ViewPager/InternalContext.js +7 -0
  257. package/build/module/ViewPager/InternalContext.js.map +1 -0
  258. package/build/module/ViewPager/PageStateContext.js +7 -0
  259. package/build/module/ViewPager/PageStateContext.js.map +1 -0
  260. package/build/module/ViewPager/ViewPager.js +57 -0
  261. package/build/module/ViewPager/ViewPager.js.map +1 -0
  262. package/build/module/ViewPager/ViewPager.native.js +127 -0
  263. package/build/module/ViewPager/ViewPager.native.js.map +1 -0
  264. package/build/module/ViewPager/ViewPagerProps.js.map +1 -1
  265. package/build/module/ViewPager/components/ChildrenMemoizedPage.js +101 -0
  266. package/build/module/ViewPager/components/ChildrenMemoizedPage.js.map +1 -0
  267. package/build/module/ViewPager/components/FluxStoreProvider.js +20 -0
  268. package/build/module/ViewPager/components/FluxStoreProvider.js.map +1 -0
  269. package/build/module/ViewPager/components/index.js +3 -0
  270. package/build/module/ViewPager/components/index.js.map +1 -0
  271. package/build/module/ViewPager/hooks/index.js +8 -0
  272. package/build/module/ViewPager/hooks/index.js.map +1 -0
  273. package/build/module/ViewPager/hooks/useDispatch.js +10 -0
  274. package/build/module/ViewPager/hooks/useDispatch.js.map +1 -0
  275. package/build/module/ViewPager/hooks/useEagerState.js +12 -0
  276. package/build/module/ViewPager/hooks/useEagerState.js.map +1 -0
  277. package/build/module/ViewPager/hooks/useForceRender.js +7 -0
  278. package/build/module/ViewPager/hooks/useForceRender.js.map +1 -0
  279. package/build/module/ViewPager/hooks/useLazyState.js +30 -0
  280. package/build/module/ViewPager/hooks/useLazyState.js.map +1 -0
  281. package/build/module/ViewPager/hooks/usePageStore.js +25 -0
  282. package/build/module/ViewPager/hooks/usePageStore.js.map +1 -0
  283. package/build/module/ViewPager/hooks/useStore.js +14 -0
  284. package/build/module/ViewPager/hooks/useStore.js.map +1 -0
  285. package/build/module/ViewPager/hooks/useViewPagerPageState.js +7 -0
  286. package/build/module/ViewPager/hooks/useViewPagerPageState.js.map +1 -0
  287. package/build/module/ViewPager/index.js +3 -1
  288. package/build/module/ViewPager/index.js.map +1 -1
  289. package/build/module/ViewPager/types.js +2 -0
  290. package/build/module/ViewPager/types.js.map +1 -0
  291. package/build/module/ViewPager/utils.js +6 -33
  292. package/build/module/ViewPager/utils.js.map +1 -1
  293. package/build/module/ViewabilityTrackerView/Viewability.js +2 -0
  294. package/build/module/ViewabilityTrackerView/Viewability.js.map +1 -0
  295. package/build/module/ViewabilityTrackerView/ViewabilityTrackerView.js +28 -0
  296. package/build/module/ViewabilityTrackerView/ViewabilityTrackerView.js.map +1 -0
  297. package/build/module/ViewabilityTrackerView/ViewabilityTrackerViewProps.js +2 -0
  298. package/build/module/ViewabilityTrackerView/ViewabilityTrackerViewProps.js.map +1 -0
  299. package/build/module/ViewabilityTrackerView/index.js +2 -0
  300. package/build/module/ViewabilityTrackerView/index.js.map +1 -0
  301. package/build/module/ViewabilityTrackerView/measureViewability.js +34 -0
  302. package/build/module/ViewabilityTrackerView/measureViewability.js.map +1 -0
  303. package/build/module/ViewabilityTrackerView/useViewabilityTracker.js +73 -0
  304. package/build/module/ViewabilityTrackerView/useViewabilityTracker.js.map +1 -0
  305. package/build/module/hooks/index.js +2 -0
  306. package/build/module/hooks/index.js.map +1 -1
  307. package/build/module/hooks/useAppbarStyles.js.map +1 -1
  308. package/build/module/hooks/useDeferredExecutor.js +33 -0
  309. package/build/module/hooks/useDeferredExecutor.js.map +1 -0
  310. package/build/module/hooks/useElevationStyle.js.map +1 -1
  311. package/build/module/hooks/useHeight.js +4 -4
  312. package/build/module/hooks/useHeight.js.map +1 -1
  313. package/build/module/hooks/useIsMounted.js +13 -0
  314. package/build/module/hooks/useIsMounted.js.map +1 -0
  315. package/build/module/hooks/useUnstableCollapsibleAppBar.js +58 -45
  316. package/build/module/hooks/useUnstableCollapsibleAppBar.js.map +1 -1
  317. package/build/module/hooks/useUnstableToggleDisplayStyle.js +9 -7
  318. package/build/module/hooks/useUnstableToggleDisplayStyle.js.map +1 -1
  319. package/build/module/index.js +2 -0
  320. package/build/module/index.js.map +1 -1
  321. package/build/typescript/BottomSheet/BottomSheetProps.d.ts +18 -1
  322. package/build/typescript/BottomSheet/useDynamicSnapPoints.d.ts +12 -0
  323. package/build/typescript/Carousel/Carousel.d.ts +5 -0
  324. package/build/typescript/Carousel/CarouselProps.d.ts +33 -48
  325. package/build/typescript/Carousel/animation/animationUtils.d.ts +1 -0
  326. package/build/typescript/Carousel/animation/createDefaultItemStyle.d.ts +2 -0
  327. package/build/typescript/Carousel/animation/createDefaultScrollAnimation.d.ts +2 -0
  328. package/build/typescript/Carousel/animation/index.d.ts +4 -0
  329. package/build/typescript/Carousel/animation/normalItemStyleFactory.d.ts +2 -0
  330. package/build/typescript/Carousel/animation/parallaxItemStyleFactory.d.ts +9 -0
  331. package/build/typescript/Carousel/components/InternalContext.d.ts +14 -0
  332. package/build/typescript/Carousel/components/ItemView.d.ts +9 -0
  333. package/build/typescript/Carousel/components/RootView.d.ts +16 -0
  334. package/build/typescript/Carousel/components/ScrollViewGesture.d.ts +12 -0
  335. package/build/typescript/Carousel/components/index.d.ts +4 -0
  336. package/build/typescript/Carousel/components/useItemInterpolation.d.ts +2 -0
  337. package/build/typescript/Carousel/hooks/index.d.ts +5 -0
  338. package/build/typescript/Carousel/hooks/useAutoplayController.d.ts +7 -0
  339. package/build/typescript/Carousel/hooks/useIndexController.d.ts +10 -0
  340. package/build/typescript/Carousel/hooks/useItemVisibilityStore.d.ts +7 -0
  341. package/build/typescript/Carousel/hooks/useLoopedData.d.ts +1 -0
  342. package/build/typescript/Carousel/hooks/usePagingAnimator.d.ts +17 -0
  343. package/build/typescript/Carousel/index.d.ts +3 -1
  344. package/build/typescript/Carousel/tick.d.ts +2 -0
  345. package/build/typescript/Carousel/types.d.ts +91 -0
  346. package/build/typescript/ComicViewer/ComicViewer.d.ts +1 -1
  347. package/build/typescript/ComicViewer/ComicViewerProps.d.ts +56 -43
  348. package/build/typescript/ComicViewer/EncodedTile.d.ts +2 -0
  349. package/build/typescript/ComicViewer/FastScroll.d.ts +4 -0
  350. package/build/typescript/ComicViewer/FastScrollProps.d.ts +70 -0
  351. package/build/typescript/ComicViewer/ReloadButton.d.ts +7 -0
  352. package/build/typescript/ComicViewer/ViewerItem.d.ts +42 -7
  353. package/build/typescript/ComicViewer/index.d.ts +3 -2
  354. package/build/typescript/ComicViewer/util.d.ts +2 -0
  355. package/build/typescript/ViewPager/FluxContext.d.ts +5 -0
  356. package/build/typescript/ViewPager/InternalContext.d.ts +7 -0
  357. package/build/typescript/ViewPager/PageStateContext.d.ts +6 -0
  358. package/build/typescript/ViewPager/ViewPager.d.ts +5 -0
  359. package/build/typescript/ViewPager/ViewPager.native.d.ts +5 -0
  360. package/build/typescript/ViewPager/ViewPagerProps.d.ts +18 -29
  361. package/build/typescript/ViewPager/components/ChildrenMemoizedPage.d.ts +14 -0
  362. package/build/typescript/ViewPager/components/FluxStoreProvider.d.ts +6 -0
  363. package/build/typescript/ViewPager/components/index.d.ts +2 -0
  364. package/build/typescript/ViewPager/hooks/index.d.ts +7 -0
  365. package/build/typescript/ViewPager/hooks/useDispatch.d.ts +2 -0
  366. package/build/typescript/ViewPager/hooks/useEagerState.d.ts +1 -0
  367. package/build/typescript/ViewPager/hooks/useForceRender.d.ts +2 -0
  368. package/build/typescript/ViewPager/hooks/useLazyState.d.ts +2 -0
  369. package/build/typescript/ViewPager/hooks/usePageStore.d.ts +2 -0
  370. package/build/typescript/ViewPager/hooks/useStore.d.ts +2 -0
  371. package/build/typescript/ViewPager/hooks/useViewPagerPageState.d.ts +1 -0
  372. package/build/typescript/ViewPager/index.d.ts +4 -1
  373. package/build/typescript/ViewPager/types.d.ts +12 -0
  374. package/build/typescript/ViewPager/utils.d.ts +5 -20
  375. package/build/typescript/ViewabilityTrackerView/Viewability.d.ts +3 -0
  376. package/build/typescript/ViewabilityTrackerView/ViewabilityTrackerView.d.ts +3 -0
  377. package/build/typescript/ViewabilityTrackerView/ViewabilityTrackerViewProps.d.ts +22 -0
  378. package/build/typescript/ViewabilityTrackerView/index.d.ts +2 -0
  379. package/build/typescript/ViewabilityTrackerView/measureViewability.d.ts +11 -0
  380. package/build/typescript/ViewabilityTrackerView/useViewabilityTracker.d.ts +11 -0
  381. package/build/typescript/hooks/index.d.ts +2 -0
  382. package/build/typescript/hooks/useDeferredExecutor.d.ts +11 -0
  383. package/build/typescript/hooks/useIsMounted.d.ts +4 -0
  384. package/build/typescript/hooks/useUnstableCollapsibleAppBar.d.ts +2 -3
  385. package/build/typescript/hooks/useUnstableToggleDisplayStyle.d.ts +2 -2
  386. package/build/typescript/index.d.ts +2 -0
  387. package/package.json +13 -27
  388. package/src/AnimatedY/AnimatedY.tsx +13 -10
  389. package/src/BottomSheet/BottomSheetNative.tsx +30 -3
  390. package/src/BottomSheet/BottomSheetProps.ts +21 -1
  391. package/src/BottomSheet/BottomSheetWeb.tsx +32 -13
  392. package/src/BottomSheet/useDynamicSnapPoints.ts +73 -0
  393. package/src/Carousel/Carousel.tsx +135 -0
  394. package/src/Carousel/CarouselProps.ts +42 -53
  395. package/src/Carousel/animation/animationUtils.ts +1 -0
  396. package/src/Carousel/animation/createDefaultItemStyle.ts +3 -0
  397. package/src/Carousel/animation/createDefaultScrollAnimation.ts +13 -0
  398. package/src/Carousel/animation/index.ts +4 -0
  399. package/src/Carousel/animation/normalItemStyleFactory.ts +19 -0
  400. package/src/Carousel/animation/parallaxItemStyleFactory.ts +79 -0
  401. package/src/Carousel/components/InternalContext.ts +33 -0
  402. package/src/Carousel/components/ItemView.tsx +66 -0
  403. package/src/Carousel/components/RootView.tsx +79 -0
  404. package/src/Carousel/components/ScrollViewGesture.tsx +92 -0
  405. package/src/Carousel/components/index.ts +4 -0
  406. package/src/Carousel/components/useItemInterpolation.ts +107 -0
  407. package/src/Carousel/hooks/index.ts +5 -0
  408. package/src/Carousel/hooks/useAutoplayController.ts +57 -0
  409. package/src/Carousel/hooks/useIndexController.tsx +57 -0
  410. package/src/Carousel/hooks/useItemVisibilityStore.ts +107 -0
  411. package/src/Carousel/hooks/useLoopedData.ts +26 -0
  412. package/src/Carousel/hooks/usePagingAnimator.ts +255 -0
  413. package/src/Carousel/index.ts +4 -2
  414. package/src/Carousel/tick.ts +6 -0
  415. package/src/Carousel/types.ts +114 -0
  416. package/src/ComicViewer/ComicViewer.tsx +283 -104
  417. package/src/ComicViewer/ComicViewerProps.ts +60 -44
  418. package/src/ComicViewer/EncodedTile.ts +3 -0
  419. package/src/ComicViewer/FastScroll.tsx +158 -0
  420. package/src/ComicViewer/FastScrollProps.ts +83 -0
  421. package/src/ComicViewer/ReloadButton.tsx +36 -0
  422. package/src/ComicViewer/ViewerItem.tsx +97 -62
  423. package/src/ComicViewer/index.ts +8 -2
  424. package/src/ComicViewer/util.ts +15 -0
  425. package/src/FlipCard/FlipCard.tsx +8 -8
  426. package/src/ViewPager/FluxContext.ts +8 -0
  427. package/src/ViewPager/InternalContext.ts +13 -0
  428. package/src/ViewPager/PageStateContext.ts +11 -0
  429. package/src/ViewPager/ViewPager.native.tsx +150 -0
  430. package/src/ViewPager/ViewPager.tsx +69 -0
  431. package/src/ViewPager/ViewPagerProps.ts +20 -35
  432. package/src/ViewPager/components/ChildrenMemoizedPage.tsx +124 -0
  433. package/src/ViewPager/components/FluxStoreProvider.tsx +27 -0
  434. package/src/ViewPager/components/index.ts +2 -0
  435. package/src/ViewPager/hooks/index.ts +7 -0
  436. package/src/ViewPager/hooks/useDispatch.ts +11 -0
  437. package/src/ViewPager/hooks/useEagerState.ts +14 -0
  438. package/src/ViewPager/hooks/useForceRender.ts +7 -0
  439. package/src/ViewPager/hooks/useLazyState.ts +32 -0
  440. package/src/ViewPager/hooks/usePageStore.ts +30 -0
  441. package/src/ViewPager/hooks/useStore.ts +15 -0
  442. package/src/ViewPager/hooks/useViewPagerPageState.ts +6 -0
  443. package/src/ViewPager/index.ts +11 -2
  444. package/src/ViewPager/types.ts +15 -0
  445. package/src/ViewPager/utils.tsx +9 -56
  446. package/src/ViewabilityTrackerView/Viewability.ts +3 -0
  447. package/src/ViewabilityTrackerView/ViewabilityTrackerView.tsx +33 -0
  448. package/src/ViewabilityTrackerView/ViewabilityTrackerViewProps.ts +25 -0
  449. package/src/ViewabilityTrackerView/index.ts +2 -0
  450. package/src/ViewabilityTrackerView/measureViewability.ts +54 -0
  451. package/src/ViewabilityTrackerView/useViewabilityTracker.ts +85 -0
  452. package/src/hooks/index.ts +2 -0
  453. package/src/hooks/useDeferredExecutor.ts +46 -0
  454. package/src/hooks/useHeight.ts +3 -4
  455. package/src/hooks/useIsMounted.ts +19 -0
  456. package/src/hooks/useUnstableCollapsibleAppBar.ts +62 -45
  457. package/src/hooks/useUnstableToggleDisplayStyle.ts +8 -6
  458. package/src/index.ts +3 -0
  459. package/yarn-error.log +103 -0
  460. package/build/commonjs/Carousel/CarouselNative.js +0 -72
  461. package/build/commonjs/Carousel/CarouselNative.js.map +0 -1
  462. package/build/commonjs/Carousel/CarouselWeb.js +0 -237
  463. package/build/commonjs/Carousel/CarouselWeb.js.map +0 -1
  464. package/build/commonjs/Carousel/index.native.js.map +0 -1
  465. package/build/commonjs/Carousel/utils.js +0 -19
  466. package/build/commonjs/Carousel/utils.js.map +0 -1
  467. package/build/commonjs/ComicViewer/ComicViewerItemProps.js.map +0 -1
  468. package/build/commonjs/ViewPager/ChildrenMemoizedPage.js +0 -49
  469. package/build/commonjs/ViewPager/ChildrenMemoizedPage.js.map +0 -1
  470. package/build/commonjs/ViewPager/ViewPagerNative.js +0 -72
  471. package/build/commonjs/ViewPager/ViewPagerNative.js.map +0 -1
  472. package/build/commonjs/ViewPager/ViewPagerWeb.js +0 -55
  473. package/build/commonjs/ViewPager/ViewPagerWeb.js.map +0 -1
  474. package/build/commonjs/ViewPager/index.native.js +0 -16
  475. package/build/commonjs/ViewPager/index.native.js.map +0 -1
  476. package/build/commonjs/hooks/useWidth.js +0 -29
  477. package/build/commonjs/hooks/useWidth.js.map +0 -1
  478. package/build/module/Carousel/CarouselNative.js +0 -54
  479. package/build/module/Carousel/CarouselNative.js.map +0 -1
  480. package/build/module/Carousel/CarouselWeb.js +0 -215
  481. package/build/module/Carousel/CarouselWeb.js.map +0 -1
  482. package/build/module/Carousel/index.native.js +0 -2
  483. package/build/module/Carousel/index.native.js.map +0 -1
  484. package/build/module/Carousel/utils.js +0 -7
  485. package/build/module/Carousel/utils.js.map +0 -1
  486. package/build/module/ComicViewer/ComicViewerItemProps.js +0 -2
  487. package/build/module/ComicViewer/ComicViewerItemProps.js.map +0 -1
  488. package/build/module/ViewPager/ChildrenMemoizedPage.js +0 -37
  489. package/build/module/ViewPager/ChildrenMemoizedPage.js.map +0 -1
  490. package/build/module/ViewPager/ViewPagerNative.js +0 -53
  491. package/build/module/ViewPager/ViewPagerNative.js.map +0 -1
  492. package/build/module/ViewPager/ViewPagerWeb.js +0 -41
  493. package/build/module/ViewPager/ViewPagerWeb.js.map +0 -1
  494. package/build/module/ViewPager/index.native.js +0 -2
  495. package/build/module/ViewPager/index.native.js.map +0 -1
  496. package/build/module/hooks/useWidth.js +0 -15
  497. package/build/module/hooks/useWidth.js.map +0 -1
  498. package/build/typescript/Carousel/CarouselNative.d.ts +0 -3
  499. package/build/typescript/Carousel/CarouselWeb.d.ts +0 -4
  500. package/build/typescript/Carousel/index.native.d.ts +0 -1
  501. package/build/typescript/Carousel/utils.d.ts +0 -6
  502. package/build/typescript/ComicViewer/ComicViewerItemProps.d.ts +0 -12
  503. package/build/typescript/ViewPager/ChildrenMemoizedPage.d.ts +0 -4
  504. package/build/typescript/ViewPager/ViewPagerNative.d.ts +0 -3
  505. package/build/typescript/ViewPager/ViewPagerWeb.d.ts +0 -3
  506. package/build/typescript/ViewPager/index.native.d.ts +0 -1
  507. package/build/typescript/hooks/useWidth.d.ts +0 -2
  508. package/src/Carousel/CarouselNative.tsx +0 -67
  509. package/src/Carousel/CarouselWeb.tsx +0 -222
  510. package/src/Carousel/index.native.ts +0 -1
  511. package/src/Carousel/utils.ts +0 -11
  512. package/src/ComicViewer/ComicViewerItemProps.ts +0 -15
  513. package/src/ViewPager/ChildrenMemoizedPage.tsx +0 -36
  514. package/src/ViewPager/ViewPagerNative.tsx +0 -66
  515. package/src/ViewPager/ViewPagerWeb.tsx +0 -52
  516. package/src/ViewPager/index.native.ts +0 -1
  517. package/src/hooks/useWidth.ts +0 -17
@@ -1 +1 @@
1
- {"version":3,"sources":["BottomSheetNative.tsx"],"names":["React","Platform","useTheme","BottomSheetBackdrop","BottomSheetModal","BottomSheetModalProvider","TransparentBackdrop","NoHandle","BottomSheet","props","backdropOpacity","children","index","onChange","snapPoints","indexRef","useRef","bottomSheetRef","handleChange","useCallback","newIndex","current","handleDismiss","useEffect","present","dismiss","snapToIndex","theme","shadow","modalStyle","backgroundColor","select","android","elevation","ios","web","boxShadow","backgroundStyle","palette","paper","default","isBackdropTransparent","OpacityAwareBackdrop"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,SAASC,QAAT,QAAyB,qBAAzB;AACA,SACIC,mBADJ,EAGIC,gBAHJ,EAIIC,wBAJJ,QAKO,sBALP;AAOA,OAAOC,mBAAP,MAAgC,uBAAhC;;AAEA,MAAMC,QAAQ,G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Content":["import React from 'react';\nimport { Platform } from 'react-native';\nimport { useTheme } from '@fountain-ui/styles';\nimport {\n BottomSheetBackdrop,\n BottomSheetBackdropProps,\n BottomSheetModal,\n BottomSheetModalProvider,\n} from '@gorhom/bottom-sheet';\nimport type BottomSheetProps from './BottomSheetProps';\nimport TransparentBackdrop from './TransparentBackdrop';\n\nconst NoHandle = () => null;\n\nexport default function BottomSheet(props: BottomSheetProps) {\n const {\n backdropOpacity = 0.5,\n children,\n index,\n onChange,\n snapPoints,\n } = props;\n\n const indexRef = React.useRef<number>(-1);\n const bottomSheetRef = React.useRef<BottomSheetModal | null>(null);\n\n const handleChange = React.useCallback((newIndex: number) => {\n indexRef.current = newIndex;\n\n if (onChange) {\n onChange(newIndex);\n }\n }, [onChange]);\n\n const handleDismiss = React.useCallback(() => {\n handleChange(-1);\n }, [handleChange]);\n\n React.useEffect(() => {\n if (index === indexRef.current) {\n return;\n }\n\n if (indexRef.current < 0 && index >= 0) {\n bottomSheetRef.current?.present();\n } else if (indexRef.current >= 0 && index < 0) {\n bottomSheetRef.current?.dismiss();\n } else {\n // @ts-ignore\n bottomSheetRef.current?.snapToIndex(index);\n }\n }, [index]);\n\n const theme = useTheme();\n const shadow = theme.shadow[12];\n const modalStyle = {\n backgroundColor: '#ffffff00',\n ...Platform.select<object>({\n android: shadow?.elevation,\n ios: shadow?.shadow,\n web: shadow?.boxShadow,\n }),\n };\n const backgroundStyle = {\n backgroundColor: theme.palette.paper.default,\n };\n\n const isBackdropTransparent = backdropOpacity <= 0;\n\n const OpacityAwareBackdrop = (props: BottomSheetBackdropProps) => (\n <BottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n opacity={backdropOpacity}\n />\n );\n\n return (\n <BottomSheetModalProvider>\n <BottomSheetModal\n backdropComponent={isBackdropTransparent ? TransparentBackdrop : OpacityAwareBackdrop}\n // @ts-ignore\n backgroundStyle={backgroundStyle}\n index={index}\n handleComponent={NoHandle}\n onChange={handleChange}\n onDismiss={handleDismiss}\n ref={bottomSheetRef}\n snapPoints={snapPoints}\n style={modalStyle}\n >\n {children}\n </BottomSheetModal>\n </BottomSheetModalProvider>\n );\n};\n"]}
1
+ {"version":3,"names":["React","Platform","useWindowDimensions","View","useTheme","BottomSheetBackdrop","BottomSheetModal","BottomSheetModalProvider","BottomSheetScrollView","TransparentBackdrop","NoHandle","BottomSheet","props","backdropOpacity","children","enableDynamicSizing","header","index","maxHeightNormalizedRatio","onChange","snapPoints","indexRef","useRef","bottomSheetRef","height","windowHeight","maxDynamicContentSize","Math","round","handleChange","useCallback","newIndex","current","handleDismiss","useEffect","present","dismiss","snapToIndex","theme","shadow","modalStyle","backgroundColor","select","android","elevation","ios","web","boxShadow","backgroundStyle","palette","paper","default","contentWrapperStyle","flex","borderTopLeftRadius","borderTopRightRadius","overflow","isBackdropTransparent","OpacityAwareBackdrop","Boolean","undefined"],"sources":["BottomSheetNative.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform, useWindowDimensions, View } from 'react-native';\nimport { useTheme } from '@fountain-ui/styles';\nimport {\n BottomSheetBackdrop,\n BottomSheetBackdropProps,\n BottomSheetModal,\n BottomSheetModalProvider,\n BottomSheetScrollView,\n} from '@gorhom/bottom-sheet';\nimport type BottomSheetProps from './BottomSheetProps';\nimport TransparentBackdrop from './TransparentBackdrop';\n\nconst NoHandle = () => null;\n\nexport default function BottomSheet(props: BottomSheetProps) {\n const {\n backdropOpacity = 0.5,\n children,\n enableDynamicSizing = true,\n header,\n index,\n maxHeightNormalizedRatio = 0.9,\n onChange,\n snapPoints = [],\n } = props;\n\n const indexRef = React.useRef<number>(-1);\n const bottomSheetRef = React.useRef<BottomSheetModal | null>(null);\n\n const { height: windowHeight } = useWindowDimensions();\n const maxDynamicContentSize = Math.round(windowHeight * maxHeightNormalizedRatio);\n\n const handleChange = React.useCallback((newIndex: number) => {\n indexRef.current = newIndex;\n\n if (onChange) {\n onChange(newIndex);\n }\n }, [onChange]);\n\n const handleDismiss = React.useCallback(() => {\n handleChange(-1);\n }, [handleChange]);\n\n React.useEffect(() => {\n if (index === indexRef.current) {\n return;\n }\n\n if (indexRef.current < 0 && index >= 0) {\n bottomSheetRef.current?.present();\n } else if (indexRef.current >= 0 && index < 0) {\n bottomSheetRef.current?.dismiss();\n } else {\n // @ts-ignore\n bottomSheetRef.current?.snapToIndex(index);\n }\n }, [index]);\n\n const theme = useTheme();\n const shadow = theme.shadow[12];\n const modalStyle = {\n backgroundColor: '#ffffff00',\n ...Platform.select<object>({\n android: shadow?.elevation,\n ios: shadow?.shadow,\n web: shadow?.boxShadow,\n }),\n };\n const backgroundStyle = {\n backgroundColor: theme.palette.paper.default,\n };\n const contentWrapperStyle = {\n flex: 1,\n borderTopLeftRadius: 15,\n borderTopRightRadius: 15,\n overflow: 'hidden',\n };\n\n const isBackdropTransparent = backdropOpacity <= 0;\n\n const OpacityAwareBackdrop = (props: BottomSheetBackdropProps) => (\n <BottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n opacity={backdropOpacity}\n pressBehavior={onChange ? 'close' : 'none'}\n />\n );\n\n return (\n <BottomSheetModalProvider>\n <BottomSheetModal\n backdropComponent={isBackdropTransparent ? TransparentBackdrop : OpacityAwareBackdrop}\n // @ts-ignore\n backgroundStyle={backgroundStyle}\n index={index}\n handleComponent={NoHandle}\n onChange={handleChange}\n onDismiss={handleDismiss}\n ref={bottomSheetRef}\n snapPoints={snapPoints}\n style={modalStyle}\n enablePanDownToClose={Boolean(onChange)}\n enableDynamicSizing={enableDynamicSizing}\n maxDynamicContentSize={maxDynamicContentSize}\n >\n {/* @ts-ignore */}\n <View style={contentWrapperStyle}>\n <BottomSheetScrollView\n bounces={false}\n stickyHeaderIndices={header ? [0] : undefined}\n >\n {header}\n\n {children}\n </BottomSheetScrollView>\n </View>\n </BottomSheetModal>\n </BottomSheetModalProvider>\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,Q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AAiB,EAAE,CAAC,CAHxB;IAII,OAAO,EAAEC,eAJb;IAKI,aAAa,EAAEM,QAAQ,GAAG,OAAH,GAAa;EALxC,GADJ;;EAUA,oBACI,oBAAC,wBAAD,qBACI,oBAAC,gBAAD;IACI,iBAAiB,EAAEsC,qBAAqB,GAAGhD,mBAAH,GAAyBiD,oBADrE,CAEI;IAFJ;IAGI,eAAe,EAAEV,eAHrB;IAII,KAAK,EAAE/B,KAJX;IAKI,eAAe,EAAEP,QALrB;IAMI,QAAQ,EAAEmB,YANd;IAOI,SAAS,EAAEI,aAPf;IAQI,GAAG,EAAEV,cART;IASI,UAAU,EAAEH,UAThB;IAUI,KAAK,EAAEoB,UAVX;IAWI,oBAAoB,EAAEmB,OAAO,CAACxC,QAAD,CAXjC;IAYI,mBAAmB,EAAEJ,mBAZzB;IAaI,qBAAqB,EAAEW;EAb3B,gBAgBI,oBAAC,IAAD;IAAM,KAAK,EAAE0B;EAAb,gBACI,oBAAC,qBAAD;IACI,OAAO,EAAE,KADb;IAEI,mBAAmB,EAAEpC,MAAM,GAAG,CAAC,CAAD,CAAH,GAAS4C;EAFxC,GAIK5C,MAJL,EAMKF,QANL,CADJ,CAhBJ,CADJ,CADJ;AA+BH;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
1
+ {"version":3,"names":[],"sources":["BottomSheetProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ComponentProps } from '@fountain-ui/core';\n\nexport default interface BottomSheetProps extends ComponentProps<{\n /**\n * Opacity for BackdropComponent\n * @default 0.5\n */\n backdropOpacity?: number;\n\n /**\n * BottomSheet children, usually the included sub-components.\n */\n children?: React.ReactNode;\n\n /**\n * Enable dynamic sizing for content size.\n * @default true\n */\n enableDynamicSizing?: boolean;\n\n /**\n * Area to be fixed on the top of the bottom sheet.\n */\n header?: React.ReactNode;\n\n /**\n * Snap index. You could also provide -1 to bottom sheet in closed state.\n */\n index: number;\n\n /**\n * Maximum height(normalized value) of dialog\n * ex. 30% => 0.3 / 90% => 0.9\n * @default 0.9\n */\n maxHeightNormalizedRatio?: number;\n\n /**\n * Callback fired when the index is changed.\n * Important! Use memoized value.\n */\n onChange?: (newIndex: number) => void;\n\n /**\n * Points for the bottom sheet to snap to, points should be sorted from bottom to top.\n * Important! Use memoized value.\n * Only number type or string type(~% format) can be used.\n * @default []\n */\n snapPoints?: Array<number | string>;\n}> {}\n"],"mappings":""}
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
+ import { ScrollView } from 'react-native';
2
3
  import { Modal, Paper, StyleSheet, css, useTheme } from '@fountain-ui/core';
3
4
  import AnimatedY from '../AnimatedY';
5
+ import useDynamicSnapPoints from './useDynamicSnapPoints';
4
6
 
5
7
  const useStyles = function () {
6
8
  const theme = useTheme();
@@ -23,21 +25,16 @@ const useStyles = function () {
23
25
  };
24
26
  };
25
27
 
26
- const calculateHeight = points => {
27
- var _points;
28
-
29
- return (_points = points[points.length - 1]) !== null && _points !== void 0 ? _points : 0;
30
- };
31
-
32
28
  export default function BottomSheet(props) {
33
- var _snapPoints$index;
34
-
35
29
  const {
36
30
  backdropOpacity,
37
31
  children,
32
+ enableDynamicSizing = true,
33
+ header,
38
34
  index,
35
+ maxHeightNormalizedRatio = 0.9,
39
36
  onChange,
40
- snapPoints
37
+ snapPoints = []
41
38
  } = props;
42
39
  const styles = useStyles();
43
40
 
@@ -47,8 +44,19 @@ export default function BottomSheet(props) {
47
44
  }
48
45
  };
49
46
 
50
- const height = calculateHeight(snapPoints);
51
- const translateY = height - ((_snapPoints$index = snapPoints[index]) !== null && _snapPoints$index !== void 0 ? _snapPoints$index : 0);
47
+ const {
48
+ convertedSnapPoints,
49
+ handleContentSizeChange,
50
+ highestSnapPoint
51
+ } = useDynamicSnapPoints({
52
+ enableDynamicSizing,
53
+ maxHeightNormalizedRatio,
54
+ snapPoints
55
+ });
56
+ const translateY = highestSnapPoint - (convertedSnapPoints[index] ?? 0);
57
+ const paperStyles = [styles.paper, {
58
+ height: highestSnapPoint
59
+ }];
52
60
  return /*#__PURE__*/React.createElement(Modal, {
53
61
  backdropOpacity: backdropOpacity,
54
62
  onClose: handleClose,
@@ -59,10 +67,11 @@ export default function BottomSheet(props) {
59
67
  translateY: translateY
60
68
  }, /*#__PURE__*/React.createElement(Paper, {
61
69
  elevation: 12,
62
- style: [styles.paper, {
63
- height
64
- }]
65
- }, children)));
70
+ style: paperStyles
71
+ }, /*#__PURE__*/React.createElement(ScrollView, {
72
+ onContentSizeChange: handleContentSizeChange,
73
+ stickyHeaderIndices: header ? [0] : undefined
74
+ }, header, children))));
66
75
  }
67
76
  ;
68
77
  //# sourceMappingURL=BottomSheetWeb.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["BottomSheetWeb.tsx"],"names":["React","Modal","Paper","StyleSheet","css","useTheme","AnimatedY","useStyles","theme","root","justifyContent","zIndex","dialog","animated","alignSelf","maxWidth","width","paper","borderBottomLeftRadius","borderBottomRightRadius","flexGrow","overflow","calculateHeight","points","length","BottomSheet","props","backdropOpacity","children","index","onChange","snapPoints","styles","handleClose","height","translateY","absoluteFill"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,KAAT,EAAgBC,KAAhB,EAAuBC,UAAvB,EAAmCC,GAAnC,EAAwCC,QAAxC,QAAwD,mBAAxD;AAEA,OAAOC,SAAP,MAAsB,cAAtB;;AAKA,MAAMC,SAAuC,GAAG,YAA+B;AAC3E,QAAMC,KAAK,GAAGH,QAAQ,EAAtB;AAEA,SAAO;AACHI,IAAAA,IAAI,EAAE;AACFC,MAAAA,cAAc,EAAE,UADd;AAEFC,MAAAA,MAAM,EAAEH,KAAK,CAACG,MAAN,CAAaC;AAFnB,KADH;AAKHC,IAAAA,QAAQ,EAAE;AACNC,MAAAA,SAAS,EAAE,QADL;AAENC,MAAAA,QAAQ,EAAE,GAFJ;AAGNC,MAAAA,KAAK,EAAE;AAHD,KALP;AAUHC,IAAAA,KAAK,EAAE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MAAAA;AAAF,KAFG;AAFX,KAOKN,QAPL,CAJJ,CANJ,CADJ;AAuBH;AAAA","sourcesContent":["import React from 'react';\nimport { Modal, Paper, StyleSheet, css, useTheme } from '@fountain-ui/core';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport AnimatedY from '../AnimatedY';\nimport type BottomSheetProps from './BottomSheetProps';\n\ntype BottomSheetStyles = NamedStylesStringUnion<'root' | 'animated' | 'paper'>;\n\nconst useStyles: UseStyles<BottomSheetStyles> = function (): BottomSheetStyles {\n const theme = useTheme();\n\n return {\n root: {\n justifyContent: 'flex-end',\n zIndex: theme.zIndex.dialog\n },\n animated: {\n alignSelf: 'center',\n maxWidth: 720,\n width: '100%',\n },\n paper: {\n borderBottomLeftRadius: 0,\n borderBottomRightRadius: 0,\n flexGrow: 1,\n overflow: 'hidden',\n },\n };\n};\n\nconst calculateHeight = (points: BottomSheetProps['snapPoints']): number => {\n return points[points.length - 1] ?? 0;\n};\n\nexport default function BottomSheet(props: BottomSheetProps) {\n const {\n backdropOpacity,\n children,\n index,\n onChange,\n snapPoints,\n } = props;\n\n const styles = useStyles();\n\n const handleClose = () => {\n if (onChange) {\n onChange(-1);\n }\n };\n\n const height = calculateHeight(snapPoints);\n const translateY = height - (snapPoints[index] ?? 0);\n\n return (\n <Modal\n backdropOpacity={backdropOpacity}\n onClose={handleClose}\n visible={index >= 0}\n style={css([StyleSheet.absoluteFill, styles.root])}\n >\n <AnimatedY\n style={styles.animated}\n translateY={translateY}\n >\n <Paper\n elevation={12}\n style={[\n styles.paper,\n { height },\n ]}\n >\n {children}\n </Paper>\n </AnimatedY>\n </Modal>\n );\n};\n"]}
1
+ {"version":3,"names":["React","ScrollView","Modal","Paper","StyleSheet","css","useTheme","AnimatedY","useDynamicSnapPoints","useStyles","theme","root","justifyContent","zIndex","dialog","animated","alignSelf","maxWidth","width","paper","borderBottomLeftRadius","borderBottomRightRadius","flexGrow","overflow","BottomSheet","props","backdropOpacity","children","enableDynamicSizing","header","index","maxHeightNormalizedRatio","onChange","snapPoints","styles","handleClose","convertedSnapPoints","handleContentSizeChange","highestSnapPoint","translateY","paperStyles","height","absoluteFill","undefined"],"sources":["BottomSheetWeb.tsx"],"sourcesContent":["import React from 'react';\nimport { ScrollView } from 'react-native';\nimport { Modal, Paper, StyleSheet, css, useTheme } from '@fountain-ui/core';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport AnimatedY from '../AnimatedY';\nimport type BottomSheetProps from './BottomSheetProps';\nimport useDynamicSnapPoints from './useDynamicSnapPoints';\n\ntype BottomSheetStyles = NamedStylesStringUnion<'root' | 'animated' | 'paper'>;\n\nconst useStyles: UseStyles<BottomSheetStyles> = function (): BottomSheetStyles {\n const theme = useTheme();\n\n return {\n root: {\n justifyContent: 'flex-end',\n zIndex: theme.zIndex.dialog,\n },\n animated: {\n alignSelf: 'center',\n maxWidth: 720,\n width: '100%',\n },\n paper: {\n borderBottomLeftRadius: 0,\n borderBottomRightRadius: 0,\n flexGrow: 1,\n overflow: 'hidden',\n },\n };\n};\n\nexport default function BottomSheet(props: BottomSheetProps) {\n const {\n backdropOpacity,\n children,\n enableDynamicSizing = true,\n header,\n index,\n maxHeightNormalizedRatio = 0.9,\n onChange,\n snapPoints = [],\n } = props;\n\n const styles = useStyles();\n\n const handleClose = () => {\n if (onChange) {\n onChange(-1);\n }\n };\n\n const {\n convertedSnapPoints,\n handleContentSizeChange,\n highestSnapPoint,\n } = useDynamicSnapPoints({\n enableDynamicSizing,\n maxHeightNormalizedRatio,\n snapPoints,\n });\n\n const translateY = highestSnapPoint - (convertedSnapPoints[index] ?? 0);\n\n const paperStyles = [\n styles.paper,\n { height: highestSnapPoint },\n ];\n\n return (\n <Modal\n backdropOpacity={backdropOpacity}\n onClose={handleClose}\n visible={index >= 0}\n style={css([StyleSheet.absoluteFill, styles.root])}\n >\n <AnimatedY\n style={styles.animated}\n translateY={translateY}\n >\n <Paper\n elevation={12}\n style={paperStyles}\n >\n <ScrollView\n onContentSizeChange={handleContentSizeChange}\n stickyHeaderIndices={header ? [0] : undefined}\n >\n {header}\n\n {children}\n </ScrollView>\n </Paper>\n </AnimatedY>\n </Modal>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,KAAT,EAAgBC,KAAhB,EAAuBC,UAAvB,EAAmCC,GAAnC,EAAwCC,QAAxC,QAAwD,mBAAxD;AAEA,OAAOC,SAAP,MAAsB,cAAtB;AAEA,OAAOC,oBAAP,MAAiC,wBAAjC;;AAIA,MAAMC,SAAuC,GAAG,YAA+B;EAC3E,MAAMC,KAAK,GAAGJ,QAAQ,EAAtB;EAEA,OAAO;IACHK,IAAI,EAAE;MACFC,cAAc,EAAE,UADd;MAEFC,MAAM,EAAEH,KAAK,CAACG,MAAN,CAAaC;IAFnB,CADH;IAKHC,QAAQ,EAAE;MACNC,SAAS,EAAE,QADL;MAENC,QAAQ,EAAE,GAFJ;MAGNC,KAAK,EAAE;IAHD,CALP;IAUHC,KAAK,EAAE;MACHC,sBAAsB,EAAE,CADrB;MAEHC,uBAAuB,EAAE,CAFtB;MAGHC,QAAQ,EAAE,CAHP;MAIHC,QAAQ,EAAE;IAJP;EAVJ,CAAP;AAiBH,CApBD;;AAsBA,eAAe,SAASC,WAAT,CAAqBC,KAArB,EAA8C;EACzD,MAAM;IACFC,eADE;IAEFC,QAFE;IAGFC,mBAAmB,GAAG,IAHpB;IAIFC,MAJE;IAKFC,KALE;IAMFC,wBAAwB,GAAG,GANzB;IAOFC,QAPE;IAQFC,UAAU,GAAG;EARX,IASFR,KATJ;EAWA,MAAMS,MAAM,GAAGzB,SAAS,EAAxB;;EAEA,MAAM0B,WAAW,GAAG,MAAM;IACtB,IAAIH,QAAJ,EAAc;MACVA,QAAQ,CAAC,CAAC,CAAF,CAAR;IACH;EACJ,CAJD;;EAMA,MAAM;IACFI,mBADE;IAEFC,uBAFE;IAGFC;EAHE,IAIF9B,oBAAoB,CAAC;IACrBoB,mBADqB;IAErBG,wBAFqB;IAGrBE;EAHqB,CAAD,CAJxB;EAUA,MAAMM,UAAU,GAAGD,gBAAgB,IAAIF,mBAAmB,CAACN,KAAD,CAAnB,IAA8B,CAAlC,CAAnC;EAEA,MAAMU,WAAW,GAAG,CAChBN,MAAM,CAACf,KADS,EAEhB;IAAEsB,MAAM,EAAEH;EAAV,CAFgB,CAApB;EAKA,oBACI,oBAAC,KAAD;IACI,eAAe,EAAEZ,eADrB;IAEI,OAAO,EAAES,WAFb;IAGI,OAAO,EAAEL,KAAK,IAAI,CAHtB;IAII,KAAK,EAAEzB,GAAG,CAAC,CAACD,UAAU,CAACsC,YAAZ,EAA0BR,MAAM,CAACvB,IAAjC,CAAD;EAJd,gBAMI,oBAAC,SAAD;IACI,KAAK,EAAEuB,MAAM,CAACnB,QADlB;IAEI,UAAU,EAAEwB;EAFhB,gBAII,oBAAC,KAAD;IACI,SAAS,EAAE,EADf;IAEI,KAAK,EAAEC;EAFX,gBAII,oBAAC,UAAD;IACI,mBAAmB,EAAEH,uBADzB;IAEI,mBAAmB,EAAER,MAAM,GAAG,CAAC,CAAD,CAAH,GAASc;EAFxC,GAIKd,MAJL,EAMKF,QANL,CAJJ,CAJJ,CANJ,CADJ;AA2BH;AAAA"}
@@ -1,4 +1,4 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React from 'react';
4
4
  import { BottomSheetBackdrop } from '@gorhom/bottom-sheet';
@@ -1 +1 @@
1
- {"version":3,"sources":["TransparentBackdrop.tsx"],"names":["React","BottomSheetBackdrop","css","TransparentBackdrop","props","backdropStyle","backgroundColor","bottom","left","position","right","top"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,mBAAT,QAA8D,sBAA9D;AACA,SAASC,GAAT,QAAoB,qBAApB;AAEA,eAAe,SAASC,mBAAT,CAA6BC,KAA7B,EAA8D;AACzE;AACA,QAAMC,aAAa,GAAGH,GAAG,CAAC,CACtB;AACII,IAAAA,eAAe,EAAE,WADrB;AAEIC,IAAAA,MAAM,EAAE,CAFZ;AAGIC,IAAAA,IAAI,EAAE,CAHV;AAIIC,IAAAA,QAAQ,EAAE,UAJd;AAKIC,IAAAA,KAAK,EAAE,CALX;AAMIC,IAAAA,GAAG,EAAE;AANT,GADsB,CAAD,CAAzB;AAWA,sBACI,oBAAC,mBAAD,eACQP,KADR;AAEI,IAAA,cAAc,EAAE,CAFpB;AAGI,IAAA,iBAAiB,EAAE,CAAC,CAHxB;AAII,IAAA,KAAK,EAAEC;AAJX,KADJ;AAQH;AAAA","sourcesContent":["import React from 'react';\nimport { BottomSheetBackdrop, BottomSheetBackdropProps } from '@gorhom/bottom-sheet';\nimport { css } from '@fountain-ui/styles';\n\nexport default function TransparentBackdrop(props: BottomSheetBackdropProps) {\n // The reason that it did not use the opacity prop is that the close event is ignored in Android. (opacity < 0.1)\n const backdropStyle = css([\n {\n backgroundColor: '#ffffff00',\n bottom: 0,\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n },\n ]);\n\n return (\n <BottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n style={backdropStyle}\n />\n );\n};"]}
1
+ {"version":3,"names":["React","BottomSheetBackdrop","css","TransparentBackdrop","props","backdropStyle","backgroundColor","bottom","left","position","right","top"],"sources":["TransparentBackdrop.tsx"],"sourcesContent":["import React from 'react';\nimport { BottomSheetBackdrop, BottomSheetBackdropProps } from '@gorhom/bottom-sheet';\nimport { css } from '@fountain-ui/styles';\n\nexport default function TransparentBackdrop(props: BottomSheetBackdropProps) {\n // The reason that it did not use the opacity prop is that the close event is ignored in Android. (opacity < 0.1)\n const backdropStyle = css([\n {\n backgroundColor: '#ffffff00',\n bottom: 0,\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n },\n ]);\n\n return (\n <BottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n style={backdropStyle}\n />\n );\n};"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,mBAAT,QAA8D,sBAA9D;AACA,SAASC,GAAT,QAAoB,qBAApB;AAEA,eAAe,SAASC,mBAAT,CAA6BC,KAA7B,EAA8D;EACzE;EACA,MAAMC,aAAa,GAAGH,GAAG,CAAC,CACtB;IACII,eAAe,EAAE,WADrB;IAEIC,MAAM,EAAE,CAFZ;IAGIC,IAAI,EAAE,CAHV;IAIIC,QAAQ,EAAE,UAJd;IAKIC,KAAK,EAAE,CALX;IAMIC,GAAG,EAAE;EANT,CADsB,CAAD,CAAzB;EAWA,oBACI,oBAAC,mBAAD,eACQP,KADR;IAEI,cAAc,EAAE,CAFpB;IAGI,iBAAiB,EAAE,CAAC,CAHxB;IAII,KAAK,EAAEC;EAJX,GADJ;AAQH;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,kBAAxB","sourcesContent":["export { default } from './BottomSheetWeb';\nexport type { default as BottomSheetProps } from './BottomSheetProps';\n"]}
1
+ {"version":3,"names":["default"],"sources":["index.ts"],"sourcesContent":["export { default } from './BottomSheetWeb';\nexport type { default as BottomSheetProps } from './BottomSheetProps';\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,kBAAxB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.native.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,qBAAxB","sourcesContent":["export { default } from './BottomSheetNative';\n"]}
1
+ {"version":3,"names":["default"],"sources":["index.native.ts"],"sourcesContent":["export { default } from './BottomSheetNative';\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,qBAAxB"}
@@ -0,0 +1,52 @@
1
+ import * as R from 'ramda';
2
+ import { useCallback, useMemo, useState } from 'react';
3
+ import { useWindowDimensions } from 'react-native';
4
+
5
+ const convertSnapPoint = (snapPoint, windowHeight, maxDynamicContentSize) => {
6
+ if (typeof snapPoint === 'number') {
7
+ return Math.min(maxDynamicContentSize, snapPoint);
8
+ }
9
+
10
+ const percentageRegex = new RegExp(/^[0-9]+%$/);
11
+
12
+ if (percentageRegex.test(snapPoint)) {
13
+ const percentage = parseFloat(snapPoint) / 100;
14
+ return isNaN(percentage) ? 0 : Math.min(maxDynamicContentSize, Math.round(windowHeight * percentage));
15
+ }
16
+
17
+ return 0;
18
+ };
19
+
20
+ export default function useDynamicSnapPoints(params) {
21
+ const {
22
+ enableDynamicSizing,
23
+ maxHeightNormalizedRatio,
24
+ snapPoints
25
+ } = params;
26
+ const {
27
+ height: windowHeight
28
+ } = useWindowDimensions();
29
+ const [contentHeight, setContentHeight] = useState(0);
30
+ const convertedSnapPoints = useMemo(() => {
31
+ const maxDynamicContentSize = Math.round(windowHeight * maxHeightNormalizedRatio);
32
+ const convertedSnapPoints = snapPoints.map(snapPoint => {
33
+ return convertSnapPoint(snapPoint, windowHeight, maxDynamicContentSize);
34
+ });
35
+
36
+ if (enableDynamicSizing && contentHeight !== 0) {
37
+ convertedSnapPoints.push(convertSnapPoint(contentHeight, windowHeight, maxDynamicContentSize));
38
+ }
39
+
40
+ return Array.from(new Set(convertedSnapPoints)).sort((a, b) => a - b);
41
+ }, [contentHeight, snapPoints, windowHeight]);
42
+ const highestSnapPoint = R.last(convertedSnapPoints) ?? 0;
43
+ const handleContentSizeChange = useCallback((_, height) => {
44
+ setContentHeight(height);
45
+ }, []);
46
+ return {
47
+ convertedSnapPoints,
48
+ handleContentSizeChange,
49
+ highestSnapPoint
50
+ };
51
+ }
52
+ //# sourceMappingURL=useDynamicSnapPoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["R","useCallback","useMemo","useState","useWindowDimensions","convertSnapPoint","snapPoint","windowHeight","maxDynamicContentSize","Math","min","percentageRegex","RegExp","test","percentage","parseFloat","isNaN","round","useDynamicSnapPoints","params","enableDynamicSizing","maxHeightNormalizedRatio","snapPoints","height","contentHeight","setContentHeight","convertedSnapPoints","map","push","Array","from","Set","sort","a","b","highestSnapPoint","last","handleContentSizeChange","_"],"sources":["useDynamicSnapPoints.ts"],"sourcesContent":["import * as R from 'ramda';\nimport { useCallback, useMemo, useState } from 'react';\nimport { useWindowDimensions } from 'react-native';\n\ninterface UseDynamicSnapPointsParams {\n enableDynamicSizing: boolean;\n maxHeightNormalizedRatio: number;\n snapPoints: (number | string)[];\n}\n\ninterface UseDynamicSnapPointsReturns {\n convertedSnapPoints: number[];\n handleContentSizeChange: (w: number, h: number) => void;\n highestSnapPoint: number;\n}\n\nconst convertSnapPoint = (snapPoint: number | string, windowHeight: number, maxDynamicContentSize: number): number => {\n if (typeof snapPoint === 'number') {\n return Math.min(maxDynamicContentSize, snapPoint);\n }\n\n const percentageRegex = new RegExp(/^[0-9]+%$/);\n if (percentageRegex.test(snapPoint)) {\n const percentage = parseFloat(snapPoint) / 100;\n return isNaN(percentage) ? 0 : Math.min(maxDynamicContentSize, Math.round(windowHeight * percentage));\n }\n\n return 0;\n};\n\nexport default function useDynamicSnapPoints(params: UseDynamicSnapPointsParams): UseDynamicSnapPointsReturns {\n const {\n enableDynamicSizing,\n maxHeightNormalizedRatio,\n snapPoints,\n } = params;\n\n const { height: windowHeight } = useWindowDimensions();\n\n const [contentHeight, setContentHeight] = useState<number>(0);\n\n const convertedSnapPoints = useMemo(() => {\n const maxDynamicContentSize = Math.round(windowHeight * maxHeightNormalizedRatio);\n\n const convertedSnapPoints = snapPoints.map((snapPoint) => {\n return convertSnapPoint(snapPoint, windowHeight, maxDynamicContentSize);\n });\n\n if (enableDynamicSizing && contentHeight !== 0) {\n convertedSnapPoints.push(\n convertSnapPoint(contentHeight, windowHeight, maxDynamicContentSize),\n );\n }\n\n return Array.from(new Set(convertedSnapPoints)).sort((a, b) => a - b);\n }, [\n contentHeight,\n snapPoints,\n windowHeight,\n ]);\n\n const highestSnapPoint = R.last(convertedSnapPoints) ?? 0;\n\n const handleContentSizeChange = useCallback((_: number, height: number) => {\n setContentHeight(height);\n }, []);\n\n return {\n convertedSnapPoints,\n handleContentSizeChange,\n highestSnapPoint,\n };\n}\n"],"mappings":"AAAA,OAAO,KAAKA,CAAZ,MAAmB,OAAnB;AACA,SAASC,WAAT,EAAsBC,OAAtB,EAA+BC,QAA/B,QAA+C,OAA/C;AACA,SAASC,mBAAT,QAAoC,cAApC;;AAcA,MAAMC,gBAAgB,GAAG,CAACC,SAAD,EAA6BC,YAA7B,EAAmDC,qBAAnD,KAA6F;EAClH,IAAI,OAAOF,SAAP,KAAqB,QAAzB,EAAmC;IAC/B,OAAOG,IAAI,CAACC,GAAL,CAASF,qBAAT,EAAgCF,SAAhC,CAAP;EACH;;EAED,MAAMK,eAAe,GAAG,IAAIC,MAAJ,CAAW,WAAX,CAAxB;;EACA,IAAID,eAAe,CAACE,IAAhB,CAAqBP,SAArB,CAAJ,EAAqC;IACjC,MAAMQ,UAAU,GAAGC,UAAU,CAACT,SAAD,CAAV,GAAwB,GAA3C;IACA,OAAOU,KAAK,CAACF,UAAD,CAAL,GAAoB,CAApB,GAAwBL,IAAI,CAACC,GAAL,CAASF,qBAAT,EAAgCC,IAAI,CAACQ,KAAL,CAAWV,YAAY,GAAGO,UAA1B,CAAhC,CAA/B;EACH;;EAED,OAAO,CAAP;AACH,CAZD;;AAcA,eAAe,SAASI,oBAAT,CAA8BC,MAA9B,EAA+F;EAC1G,MAAM;IACFC,mBADE;IAEFC,wBAFE;IAGFC;EAHE,IAIFH,MAJJ;EAMA,MAAM;IAAEI,MAAM,EAAEhB;EAAV,IAA2BH,mBAAmB,EAApD;EAEA,MAAM,CAACoB,aAAD,EAAgBC,gBAAhB,IAAoCtB,QAAQ,CAAS,CAAT,CAAlD;EAEA,MAAMuB,mBAAmB,GAAGxB,OAAO,CAAC,MAAM;IACtC,MAAMM,qBAAqB,GAAGC,IAAI,CAACQ,KAAL,CAAWV,YAAY,GAAGc,wBAA1B,CAA9B;IAEA,MAAMK,mBAAmB,GAAGJ,UAAU,CAACK,GAAX,CAAgBrB,SAAD,IAAe;MACtD,OAAOD,gBAAgB,CAACC,SAAD,EAAYC,YAAZ,EAA0BC,qBAA1B,CAAvB;IACH,CAF2B,CAA5B;;IAIA,IAAIY,mBAAmB,IAAII,aAAa,KAAK,CAA7C,EAAgD;MAC5CE,mBAAmB,CAACE,IAApB,CACIvB,gBAAgB,CAACmB,aAAD,EAAgBjB,YAAhB,EAA8BC,qBAA9B,CADpB;IAGH;;IAED,OAAOqB,KAAK,CAACC,IAAN,CAAW,IAAIC,GAAJ,CAAQL,mBAAR,CAAX,EAAyCM,IAAzC,CAA8C,CAACC,CAAD,EAAIC,CAAJ,KAAUD,CAAC,GAAGC,CAA5D,CAAP;EACH,CAdkC,EAchC,CACCV,aADD,EAECF,UAFD,EAGCf,YAHD,CAdgC,CAAnC;EAoBA,MAAM4B,gBAAgB,GAAGnC,CAAC,CAACoC,IAAF,CAAOV,mBAAP,KAA+B,CAAxD;EAEA,MAAMW,uBAAuB,GAAGpC,WAAW,CAAC,CAACqC,CAAD,EAAYf,MAAZ,KAA+B;IACvEE,gBAAgB,CAACF,MAAD,CAAhB;EACH,CAF0C,EAExC,EAFwC,CAA3C;EAIA,OAAO;IACHG,mBADG;IAEHW,uBAFG;IAGHF;EAHG,CAAP;AAKH"}
@@ -0,0 +1,109 @@
1
+ import React, { forwardRef, memo, useImperativeHandle, useMemo } from 'react';
2
+ import ViewabilityTrackerView from '../ViewabilityTrackerView';
3
+ import { useAutoplayController, useIndexController, useItemVisibilityStore, useLoopedData, usePagingAnimator } from './hooks';
4
+ import { createDefaultItemStyle, createDefaultScrollAnimation } from './animation';
5
+ import { InternalContext, RootView, ScrollViewGesture } from './components';
6
+ const Carousel = /*#__PURE__*/forwardRef(function Carousel(props, ref) {
7
+ const {
8
+ autoplay = false,
9
+ autoplayInterval = 3000,
10
+ createItemStyle = createDefaultItemStyle,
11
+ createScrollAnimation = createDefaultScrollAnimation,
12
+ data: originalData,
13
+ disableSmartAutoplay = false,
14
+ initialIndex = 0,
15
+ itemHeight,
16
+ itemWidth,
17
+ loop = false,
18
+ onIndexChange,
19
+ renderItem,
20
+ scrollEnabled = true,
21
+ style,
22
+ windowSize = 5
23
+ } = props;
24
+ const data = useLoopedData(originalData, loop);
25
+ const [itemVisibilityStore, onPositionChange] = useItemVisibilityStore({
26
+ initialIndex,
27
+ numberOfData: data.length,
28
+ windowSize
29
+ });
30
+ const indexController = useIndexController({
31
+ initialIndex,
32
+ itemWidth,
33
+ numberOfData: data.length,
34
+ numberOfOriginalData: originalData.length,
35
+ onIndexChange,
36
+ onPositionChange
37
+ });
38
+ const {
39
+ getCurrentIndex
40
+ } = indexController;
41
+ const {
42
+ gestureTranslationX,
43
+ globalInterpolation,
44
+ interruptAnimation,
45
+ startPagingAnimation
46
+ } = usePagingAnimator({
47
+ createScrollAnimation,
48
+ itemWidth,
49
+ indexController,
50
+ initialIndex,
51
+ loop,
52
+ numberOfData: data.length
53
+ });
54
+ const autoplayController = useAutoplayController({
55
+ enabled: autoplay,
56
+ intervalMillis: autoplayInterval,
57
+ startPagingAnimation
58
+ });
59
+ useImperativeHandle(ref, () => ({
60
+ getCurrentIndex,
61
+ next: () => startPagingAnimation('directional', {
62
+ direction: 'next'
63
+ }),
64
+ prev: () => startPagingAnimation('directional', {
65
+ direction: 'prev'
66
+ }),
67
+ scrollTo: option => startPagingAnimation('index', option)
68
+ }), [startPagingAnimation, getCurrentIndex]);
69
+ const contextValue = useMemo(() => ({
70
+ createItemStyle,
71
+ data,
72
+ globalInterpolation,
73
+ itemHeight,
74
+ itemWidth,
75
+ itemVisibilityStore,
76
+ loop
77
+ }), [createItemStyle, data, globalInterpolation, itemHeight, itemWidth, itemVisibilityStore, loop]);
78
+ return /*#__PURE__*/React.createElement(InternalContext.Provider, {
79
+ value: contextValue
80
+ }, /*#__PURE__*/React.createElement(ViewabilityTrackerView, {
81
+ enabled: autoplay && !disableSmartAutoplay,
82
+ measurementIntervalMillis: Math.max(3000, autoplayInterval),
83
+ onViewabilityChange: _ref => {
84
+ let {
85
+ visible
86
+ } = _ref;
87
+
88
+ if (visible) {
89
+ autoplayController.resume();
90
+ } else {
91
+ autoplayController.pause();
92
+ }
93
+ }
94
+ }, /*#__PURE__*/React.createElement(ScrollViewGesture, {
95
+ autoplayController: autoplayController,
96
+ gestureTranslationX: gestureTranslationX,
97
+ interruptAnimation: interruptAnimation,
98
+ scrollEnabled: scrollEnabled,
99
+ startPagingAnimation: startPagingAnimation
100
+ }, /*#__PURE__*/React.createElement(RootView, {
101
+ data: data,
102
+ itemHeight: itemHeight,
103
+ originalData: originalData,
104
+ renderItem: renderItem,
105
+ style: style
106
+ }))));
107
+ });
108
+ export default /*#__PURE__*/memo(Carousel);
109
+ //# sourceMappingURL=Carousel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","forwardRef","memo","useImperativeHandle","useMemo","ViewabilityTrackerView","useAutoplayController","useIndexController","useItemVisibilityStore","useLoopedData","usePagingAnimator","createDefaultItemStyle","createDefaultScrollAnimation","InternalContext","RootView","ScrollViewGesture","Carousel","props","ref","autoplay","autoplayInterval","createItemStyle","createScrollAnimation","data","originalData","disableSmartAutoplay","initialIndex","itemHeight","itemWidth","loop","onIndexChange","renderItem","scrollEnabled","style","windowSize","itemVisibilityStore","onPositionChange","numberOfData","length","indexController","numberOfOriginalData","getCurrentIndex","gestureTranslationX","globalInterpolation","interruptAnimation","startPagingAnimation","autoplayController","enabled","intervalMillis","next","direction","prev","scrollTo","option","contextValue","Math","max","visible","resume","pause"],"sources":["Carousel.tsx"],"sourcesContent":["import React, { forwardRef, memo, useImperativeHandle, useMemo } from 'react';\nimport ViewabilityTrackerView from '../ViewabilityTrackerView';\nimport type CarouselProps from './CarouselProps';\nimport type { CarouselInstance } from './types';\nimport {\n useAutoplayController,\n useIndexController,\n useItemVisibilityStore,\n useLoopedData,\n usePagingAnimator,\n} from './hooks';\nimport { createDefaultItemStyle, createDefaultScrollAnimation } from './animation';\nimport { InternalContext, RootView, ScrollViewGesture } from './components';\n\nconst Carousel = forwardRef<CarouselInstance, CarouselProps>(function Carousel(props, ref) {\n const {\n autoplay = false,\n autoplayInterval = 3000,\n createItemStyle = createDefaultItemStyle,\n createScrollAnimation = createDefaultScrollAnimation,\n data: originalData,\n disableSmartAutoplay = false,\n initialIndex = 0,\n itemHeight,\n itemWidth,\n loop = false,\n onIndexChange,\n renderItem,\n scrollEnabled = true,\n style,\n windowSize = 5,\n } = props;\n\n const data = useLoopedData(originalData, loop);\n\n const [itemVisibilityStore, onPositionChange] = useItemVisibilityStore({\n initialIndex,\n numberOfData: data.length,\n windowSize,\n });\n\n const indexController = useIndexController({\n initialIndex,\n itemWidth,\n numberOfData: data.length,\n numberOfOriginalData: originalData.length,\n onIndexChange,\n onPositionChange,\n });\n\n const { getCurrentIndex } = indexController;\n\n const {\n gestureTranslationX,\n globalInterpolation,\n interruptAnimation,\n startPagingAnimation,\n } = usePagingAnimator({\n createScrollAnimation,\n itemWidth,\n indexController,\n initialIndex,\n loop,\n numberOfData: data.length,\n });\n\n const autoplayController = useAutoplayController({\n enabled: autoplay,\n intervalMillis: autoplayInterval,\n startPagingAnimation,\n });\n\n useImperativeHandle(\n ref,\n () => ({\n getCurrentIndex,\n next: () => startPagingAnimation('directional', { direction: 'next' }),\n prev: () => startPagingAnimation('directional', { direction: 'prev' }),\n scrollTo: (option) => startPagingAnimation('index', option),\n }),\n [startPagingAnimation, getCurrentIndex],\n );\n\n const contextValue = useMemo(() => ({\n createItemStyle,\n data,\n globalInterpolation,\n itemHeight,\n itemWidth,\n itemVisibilityStore,\n loop,\n }), [\n createItemStyle,\n data,\n globalInterpolation,\n itemHeight,\n itemWidth,\n itemVisibilityStore,\n loop,\n ]);\n\n return (\n <InternalContext.Provider value={contextValue}>\n <ViewabilityTrackerView\n enabled={autoplay && !disableSmartAutoplay}\n measurementIntervalMillis={Math.max(3000, autoplayInterval)}\n onViewabilityChange={({ visible }) => {\n if (visible) {\n autoplayController.resume();\n } else {\n autoplayController.pause();\n }\n }}\n >\n <ScrollViewGesture\n autoplayController={autoplayController}\n gestureTranslationX={gestureTranslationX}\n interruptAnimation={interruptAnimation}\n scrollEnabled={scrollEnabled}\n startPagingAnimation={startPagingAnimation}\n >\n <RootView\n data={data}\n itemHeight={itemHeight}\n originalData={originalData}\n renderItem={renderItem}\n style={style}\n />\n </ScrollViewGesture>\n </ViewabilityTrackerView>\n </InternalContext.Provider>\n );\n});\n\nexport default memo(Carousel);\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,IAA5B,EAAkCC,mBAAlC,EAAuDC,OAAvD,QAAsE,OAAtE;AACA,OAAOC,sBAAP,MAAmC,2BAAnC;AAGA,SACIC,qBADJ,EAEIC,kBAFJ,EAGIC,sBAHJ,EAIIC,aAJJ,EAKIC,iBALJ,QAMO,SANP;AAOA,SAASC,sBAAT,EAAiCC,4BAAjC,QAAqE,aAArE;AACA,SAASC,eAAT,EAA0BC,QAA1B,EAAoCC,iBAApC,QAA6D,cAA7D;AAEA,MAAMC,QAAQ,gBAAGf,UAAU,CAAkC,SAASe,QAAT,CAAkBC,KAAlB,EAAyBC,GAAzB,EAA8B;EACvF,MAAM;IACFC,QAAQ,GAAG,KADT;IAEFC,gBAAgB,GAAG,IAFjB;IAGFC,eAAe,GAAGV,sBAHhB;IAIFW,qBAAqB,GAAGV,4BAJtB;IAKFW,IAAI,EAAEC,YALJ;IAMFC,oBAAoB,GAAG,KANrB;IAOFC,YAAY,GAAG,CAPb;IAQFC,UARE;IASFC,SATE;IAUFC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3,"names":[],"sources":["CarouselProps.ts"],"sourcesContent":["import type { RefObject } from 'react';\nimport type { ComponentProps } from '@fountain-ui/core';\nimport type {\n CarouselInstance,\n CreateItemStyle,\n CreateScrollAnimation,\n ItemHeight,\n OnIndexChange,\n RenderItem,\n} from './types';\n\nexport default interface CarouselProps<ItemT = any> extends ComponentProps<{\n ref?: RefObject<CarouselInstance>;\n\n /**\n * If `true`, enable autoplay.\n * @default false\n */\n autoplay?: boolean;\n\n /**\n * Delay in ms until navigating to the next item.\n * @default 3000\n */\n autoplayInterval?: number;\n\n /**\n * The item style creator function.\n * @default createDefaultItemStyle\n */\n createItemStyle?: CreateItemStyle;\n\n /**\n * The scroll animation creator function.\n * @default createDefaultScrollAnimation\n */\n createScrollAnimation?: CreateScrollAnimation;\n\n /**\n * Data for render items.\n */\n data: ReadonlyArray<ItemT>;\n\n /**\n * If `true`, carousel will detect its own viewability and control autoplay automatically.\n * @default false\n */\n disableSmartAutoplay?: boolean;\n\n /**\n * Index of initial item that should be selected.\n * @default 0\n */\n initialIndex?: number;\n\n /**\n * The item height.\n * For a performance reason, always consider to provide a number value.\n */\n itemHeight: ItemHeight;\n\n /**\n * The item width.\n */\n itemWidth: number;\n\n /**\n * Enable infinite loop mode.\n * @default false\n */\n loop?: boolean;\n\n /**\n * Callback fired when an index is changed.\n */\n onIndexChange?: OnIndexChange;\n\n /**\n * Takes an item from data and renders it into the list.\n */\n renderItem: RenderItem<ItemT>;\n\n /**\n * Whether to enable scroll gesture.\n * @default true\n */\n scrollEnabled?: boolean;\n\n /**\n * The maximum number of items that can respond to pan gesture events.\n * Due to the nature of the `active` item, it accepts only odd number. (e.g. 1, 3, 5...)\n * 0 means all items will respond to pan gesture events.\n * @default 5\n */\n windowSize?: number;\n}> {}\n"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export const itemInterpolationInputRange = [-1, 0, 1];
2
+ //# sourceMappingURL=animationUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["itemInterpolationInputRange"],"sources":["animationUtils.ts"],"sourcesContent":["export const itemInterpolationInputRange = [-1, 0, 1];\n"],"mappings":"AAAA,OAAO,MAAMA,2BAA2B,GAAG,CAAC,CAAC,CAAF,EAAK,CAAL,EAAQ,CAAR,CAApC"}
@@ -0,0 +1,3 @@
1
+ import normalItemStyleFactory from './normalItemStyleFactory';
2
+ export default normalItemStyleFactory();
3
+ //# sourceMappingURL=createDefaultItemStyle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["normalItemStyleFactory"],"sources":["createDefaultItemStyle.ts"],"sourcesContent":["import normalItemStyleFactory from './normalItemStyleFactory';\n\nexport default normalItemStyleFactory();\n"],"mappings":"AAAA,OAAOA,sBAAP,MAAmC,0BAAnC;AAEA,eAAeA,sBAAsB,EAArC"}
@@ -0,0 +1,11 @@
1
+ import { Animated, Easing } from 'react-native';
2
+ export default function createDefaultScrollAnimation(animatedValue, toValue) {
3
+ return Animated.timing(animatedValue, {
4
+ toValue: toValue,
5
+ duration: 180,
6
+ easing: Easing.bezier(0.2, 0.2, 0.2, 1),
7
+ useNativeDriver: true
8
+ });
9
+ }
10
+ ;
11
+ //# sourceMappingURL=createDefaultScrollAnimation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Animated","Easing","createDefaultScrollAnimation","animatedValue","toValue","timing","duration","easing","bezier","useNativeDriver"],"sources":["createDefaultScrollAnimation.ts"],"sourcesContent":["import { Animated, Easing } from 'react-native';\n\nexport default function createDefaultScrollAnimation(\n animatedValue: Animated.Value,\n toValue: number,\n): Animated.CompositeAnimation {\n return Animated.timing(animatedValue, {\n toValue: toValue,\n duration: 180,\n easing: Easing.bezier(0.2, 0.2, 0.2, 1),\n useNativeDriver: true,\n });\n};\n"],"mappings":"AAAA,SAASA,QAAT,EAAmBC,MAAnB,QAAiC,cAAjC;AAEA,eAAe,SAASC,4BAAT,CACXC,aADW,EAEXC,OAFW,EAGgB;EAC3B,OAAOJ,QAAQ,CAACK,MAAT,CAAgBF,aAAhB,EAA+B;IAClCC,OAAO,EAAEA,OADyB;IAElCE,QAAQ,EAAE,GAFwB;IAGlCC,MAAM,EAAEN,MAAM,CAACO,MAAP,CAAc,GAAd,EAAmB,GAAnB,EAAwB,GAAxB,EAA6B,CAA7B,CAH0B;IAIlCC,eAAe,EAAE;EAJiB,CAA/B,CAAP;AAMH;AAAA"}
@@ -0,0 +1,5 @@
1
+ export { default as createDefaultItemStyle } from './createDefaultItemStyle';
2
+ export { default as createDefaultScrollAnimation } from './createDefaultScrollAnimation';
3
+ export { default as normalItemStyleFactory } from './normalItemStyleFactory';
4
+ export { default as parallaxItemStyleFactory } from './parallaxItemStyleFactory';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["default","createDefaultItemStyle","createDefaultScrollAnimation","normalItemStyleFactory","parallaxItemStyleFactory"],"sources":["index.ts"],"sourcesContent":["export { default as createDefaultItemStyle } from './createDefaultItemStyle';\nexport { default as createDefaultScrollAnimation } from './createDefaultScrollAnimation';\nexport { default as normalItemStyleFactory } from './normalItemStyleFactory';\nexport { default as parallaxItemStyleFactory } from './parallaxItemStyleFactory';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,sBAApB,QAAkD,0BAAlD;AACA,SAASD,OAAO,IAAIE,4BAApB,QAAwD,gCAAxD;AACA,SAASF,OAAO,IAAIG,sBAApB,QAAkD,0BAAlD;AACA,SAASH,OAAO,IAAII,wBAApB,QAAoD,4BAApD"}
@@ -0,0 +1,18 @@
1
+ import { itemInterpolationInputRange } from './animationUtils';
2
+ export default function normalItemStyleFactory() {
3
+ const createItemStyle = (itemInterpolation, itemWidth) => {
4
+ const translate = itemInterpolation.interpolate({
5
+ inputRange: itemInterpolationInputRange,
6
+ outputRange: [-itemWidth, 0, itemWidth]
7
+ });
8
+ return {
9
+ transform: [{
10
+ translateX: translate
11
+ }]
12
+ };
13
+ };
14
+
15
+ return createItemStyle;
16
+ }
17
+ ;
18
+ //# sourceMappingURL=normalItemStyleFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["itemInterpolationInputRange","normalItemStyleFactory","createItemStyle","itemInterpolation","itemWidth","translate","interpolate","inputRange","outputRange","transform","translateX"],"sources":["normalItemStyleFactory.ts"],"sourcesContent":["import type { CreateItemStyle } from '../types';\nimport { itemInterpolationInputRange } from './animationUtils';\n\nexport default function normalItemStyleFactory() {\n const createItemStyle: CreateItemStyle = (itemInterpolation, itemWidth) => {\n const translate = itemInterpolation.interpolate({\n inputRange: itemInterpolationInputRange,\n outputRange: [\n -itemWidth,\n 0,\n itemWidth,\n ],\n });\n\n return { transform: [{ translateX: translate }] };\n };\n\n return createItemStyle;\n};\n"],"mappings":"AACA,SAASA,2BAAT,QAA4C,kBAA5C;AAEA,eAAe,SAASC,sBAAT,GAAkC;EAC7C,MAAMC,eAAgC,GAAG,CAACC,iBAAD,EAAoBC,SAApB,KAAkC;IACvE,MAAMC,SAAS,GAAGF,iBAAiB,CAACG,WAAlB,CAA8B;MAC5CC,UAAU,EAAEP,2BADgC;MAE5CQ,WAAW,EAAE,CACT,CAACJ,SADQ,EAET,CAFS,EAGTA,SAHS;IAF+B,CAA9B,CAAlB;IASA,OAAO;MAAEK,SAAS,EAAE,CAAC;QAAEC,UAAU,EAAEL;MAAd,CAAD;IAAb,CAAP;EACH,CAXD;;EAaA,OAAOH,eAAP;AACH;AAAA"}
@@ -0,0 +1,55 @@
1
+ import { itemInterpolationInputRange } from './animationUtils';
2
+ const defaultParallaxAnimationConfig = {
3
+ activeItemScale: 0.9,
4
+ activeItemOpacity: 1,
5
+ adjacentItemScale: Math.pow(0.9, 2),
6
+ adjacentItemOpacity: 0.5,
7
+ scrollingOffset: 50
8
+ };
9
+ export default function parallaxItemStyleFactory() {
10
+ let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultParallaxAnimationConfig;
11
+ const {
12
+ activeItemOpacity,
13
+ activeItemScale,
14
+ adjacentItemOpacity,
15
+ adjacentItemScale,
16
+ scrollingOffset
17
+ } = { ...defaultParallaxAnimationConfig,
18
+ ...config
19
+ };
20
+
21
+ const createItemStyle = (itemInterpolation, itemWidth) => {
22
+ const translate = itemInterpolation.interpolate({
23
+ inputRange: itemInterpolationInputRange,
24
+ outputRange: [-itemWidth + scrollingOffset, 0, itemWidth - scrollingOffset]
25
+ });
26
+ const zIndex = itemInterpolation.interpolate({
27
+ inputRange: itemInterpolationInputRange,
28
+ outputRange: [0, itemWidth, 0],
29
+ extrapolate: 'clamp'
30
+ });
31
+ const scale = itemInterpolation.interpolate({
32
+ inputRange: itemInterpolationInputRange,
33
+ outputRange: [adjacentItemScale, activeItemScale, adjacentItemScale],
34
+ extrapolate: 'clamp'
35
+ });
36
+ const opacity = itemInterpolation.interpolate({
37
+ inputRange: itemInterpolationInputRange,
38
+ outputRange: [adjacentItemOpacity, activeItemOpacity, adjacentItemOpacity],
39
+ extrapolate: 'clamp'
40
+ });
41
+ return {
42
+ transform: [{
43
+ translateX: translate
44
+ }, {
45
+ scale
46
+ }],
47
+ zIndex,
48
+ opacity
49
+ };
50
+ };
51
+
52
+ return createItemStyle;
53
+ }
54
+ ;
55
+ //# sourceMappingURL=parallaxItemStyleFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["itemInterpolationInputRange","defaultParallaxAnimationConfig","activeItemScale","activeItemOpacity","adjacentItemScale","Math","pow","adjacentItemOpacity","scrollingOffset","parallaxItemStyleFactory","config","createItemStyle","itemInterpolation","itemWidth","translate","interpolate","inputRange","outputRange","zIndex","extrapolate","scale","opacity","transform","translateX"],"sources":["parallaxItemStyleFactory.ts"],"sourcesContent":["import type { CreateItemStyle } from '../types';\nimport { itemInterpolationInputRange } from './animationUtils';\n\nexport interface ParallaxAnimationConfig {\n activeItemScale?: number;\n activeItemOpacity?: number;\n adjacentItemScale?: number;\n adjacentItemOpacity?: number;\n scrollingOffset?: number;\n}\n\nconst defaultParallaxAnimationConfig: Required<Readonly<ParallaxAnimationConfig>> = {\n activeItemScale: 0.9,\n activeItemOpacity: 1,\n adjacentItemScale: Math.pow(0.9, 2),\n adjacentItemOpacity: 0.5,\n scrollingOffset: 50,\n};\n\nexport default function parallaxItemStyleFactory(config: ParallaxAnimationConfig = defaultParallaxAnimationConfig) {\n const {\n activeItemOpacity,\n activeItemScale,\n adjacentItemOpacity,\n adjacentItemScale,\n scrollingOffset,\n }: Required<ParallaxAnimationConfig> = {\n ...defaultParallaxAnimationConfig,\n ...config,\n };\n\n const createItemStyle: CreateItemStyle = (itemInterpolation, itemWidth) => {\n const translate = itemInterpolation.interpolate({\n inputRange: itemInterpolationInputRange,\n outputRange: [\n -itemWidth + scrollingOffset,\n 0,\n itemWidth - scrollingOffset,\n ],\n });\n\n const zIndex = itemInterpolation.interpolate({\n inputRange: itemInterpolationInputRange,\n outputRange: [0, itemWidth, 0],\n extrapolate: 'clamp',\n });\n\n const scale = itemInterpolation.interpolate({\n inputRange: itemInterpolationInputRange,\n outputRange: [\n adjacentItemScale,\n activeItemScale,\n adjacentItemScale,\n ],\n extrapolate: 'clamp',\n });\n\n const opacity = itemInterpolation.interpolate({\n inputRange: itemInterpolationInputRange,\n outputRange: [\n adjacentItemOpacity,\n activeItemOpacity,\n adjacentItemOpacity,\n ],\n extrapolate: 'clamp',\n });\n\n return {\n transform: [\n { translateX: translate },\n { scale },\n ],\n zIndex,\n opacity,\n };\n };\n\n return createItemStyle;\n};\n"],"mappings":"AACA,SAASA,2BAAT,QAA4C,kBAA5C;AAUA,MAAMC,8BAA2E,GAAG;EAChFC,eAAe,EAAE,GAD+D;EAEhFC,iBAAiB,EAAE,CAF6D;EAGhFC,iBAAiB,EAAEC,IAAI,CAACC,GAAL,CAAS,GAAT,EAAc,CAAd,CAH6D;EAIhFC,mBAAmB,EAAE,GAJ2D;EAKhFC,eAAe,EAAE;AAL+D,CAApF;AAQA,eAAe,SAASC,wBAAT,GAAoG;EAAA,IAAlEC,MAAkE,uEAAhCT,8BAAgC;EAC/G,MAAM;IACFE,iBADE;IAEFD,eAFE;IAGFK,mBAHE;IAIFH,iBAJE;IAKFI;EALE,IAMiC,EACnC,GAAGP,8BADgC;IAEnC,GAAGS;EAFgC,CANvC;;EAWA,MAAMC,eAAgC,GAAG,CAACC,iBAAD,EAAoBC,SAApB,KAAkC;IACvE,MAAMC,SAAS,GAAGF,iBAAiB,CAACG,WAAlB,CAA8B;MAC5CC,UAAU,EAAEhB,2BADgC;MAE5CiB,WAAW,EAAE,CACT,CAACJ,SAAD,GAAaL,eADJ,EAET,CAFS,EAGTK,SAAS,GAAGL,eAHH;IAF+B,CAA9B,CAAlB;IASA,MAAMU,MAAM,GAAGN,iBAAiB,CAACG,WAAlB,CAA8B;MACzCC,UAAU,EAAEhB,2BAD6B;MAEzCiB,WAAW,EAAE,CAAC,CAAD,EAAIJ,SAAJ,EAAe,CAAf,CAF4B;MAGzCM,WAAW,EAAE;IAH4B,CAA9B,CAAf;IAMA,MAAMC,KAAK,GAAGR,iBAAiB,CAACG,WAAlB,CAA8B;MACxCC,UAAU,EAAEhB,2BAD4B;MAExCiB,WAAW,EAAE,CACTb,iBADS,EAETF,eAFS,EAGTE,iBAHS,CAF2B;MAOxCe,WAAW,EAAE;IAP2B,CAA9B,CAAd;IAUA,MAAME,OAAO,GAAGT,iBAAiB,CAACG,WAAlB,CAA8B;MAC1CC,UAAU,EAAEhB,2BAD8B;MAE1CiB,WAAW,EAAE,CACTV,mBADS,EAETJ,iBAFS,EAGTI,mBAHS,CAF6B;MAO1CY,WAAW,EAAE;IAP6B,CAA9B,CAAhB;IAUA,OAAO;MACHG,SAAS,EAAE,CACP;QAAEC,UAAU,EAAET;MAAd,CADO,EAEP;QAAEM;MAAF,CAFO,CADR;MAKHF,MALG;MAMHG;IANG,CAAP;EAQH,CA5CD;;EA8CA,OAAOV,eAAP;AACH;AAAA"}
@@ -0,0 +1,19 @@
1
+ import { createContext } from 'react';
2
+ import { Animated } from 'react-native';
3
+ const mockItemVisibilityStore = {
4
+ dispatch: () => void 0,
5
+ subscribe: () => () => void 0,
6
+ removeAllListeners: () => void 0
7
+ };
8
+ const initialValue = {
9
+ createItemStyle: () => ({}),
10
+ data: [],
11
+ globalInterpolation: Animated.add(new Animated.Value(0), 0),
12
+ itemHeight: 0,
13
+ itemWidth: 0,
14
+ itemVisibilityStore: mockItemVisibilityStore,
15
+ loop: false
16
+ };
17
+ const InternalContext = /*#__PURE__*/createContext(initialValue);
18
+ export default InternalContext;
19
+ //# sourceMappingURL=InternalContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createContext","Animated","mockItemVisibilityStore","dispatch","subscribe","removeAllListeners","initialValue","createItemStyle","data","globalInterpolation","add","Value","itemHeight","itemWidth","itemVisibilityStore","loop","InternalContext"],"sources":["InternalContext.ts"],"sourcesContent":["import { createContext } from 'react';\nimport { Animated } from 'react-native';\nimport type { CreateItemStyle, ItemHeight, ItemVisibilityStore } from '../types';\n\nexport interface InternalContextValue<ItemT> {\n createItemStyle: CreateItemStyle;\n data: ReadonlyArray<ItemT>;\n globalInterpolation: Animated.AnimatedInterpolation;\n itemHeight: ItemHeight;\n itemWidth: number;\n itemVisibilityStore: ItemVisibilityStore;\n loop: boolean;\n}\n\nconst mockItemVisibilityStore: ItemVisibilityStore = {\n dispatch: () => void 0,\n subscribe: () => () => void 0,\n removeAllListeners: () => void 0,\n};\n\nconst initialValue: Readonly<InternalContextValue<any>> = {\n createItemStyle: () => ({}),\n data: [],\n globalInterpolation: Animated.add(new Animated.Value(0), 0),\n itemHeight: 0,\n itemWidth: 0,\n itemVisibilityStore: mockItemVisibilityStore,\n loop: false,\n};\n\nconst InternalContext = createContext<InternalContextValue<any>>(initialValue);\n\nexport default InternalContext;\n"],"mappings":"AAAA,SAASA,aAAT,QAA8B,OAA9B;AACA,SAASC,QAAT,QAAyB,cAAzB;AAaA,MAAMC,uBAA4C,GAAG;EACjDC,QAAQ,EAAE,MAAM,KAAK,CAD4B;EAEjDC,SAAS,EAAE,MAAM,MAAM,KAAK,CAFqB;EAGjDC,kBAAkB,EAAE,MAAM,KAAK;AAHkB,CAArD;AAMA,MAAMC,YAAiD,GAAG;EACtDC,eAAe,EAAE,OAAO,EAAP,CADqC;EAEtDC,IAAI,EAAE,EAFgD;EAGtDC,mBAAmB,EAAER,QAAQ,CAACS,GAAT,CAAa,IAAIT,QAAQ,CAACU,KAAb,CAAmB,CAAnB,CAAb,EAAoC,CAApC,CAHiC;EAItDC,UAAU,EAAE,CAJ0C;EAKtDC,SAAS,EAAE,CAL2C;EAMtDC,mBAAmB,EAAEZ,uBANiC;EAOtDa,IAAI,EAAE;AAPgD,CAA1D;AAUA,MAAMC,eAAe,gBAAGhB,aAAa,CAA4BM,YAA5B,CAArC;AAEA,eAAeU,eAAf"}
@@ -0,0 +1,46 @@
1
+ import React, { useContext, useEffect, useMemo, useState } from 'react';
2
+ import { Animated } from 'react-native';
3
+ import { StyleSheet } from '@fountain-ui/core';
4
+ import useItemInterpolation from './useItemInterpolation';
5
+ import InternalContext from './InternalContext';
6
+ export default function ItemView(props) {
7
+ const {
8
+ children,
9
+ index,
10
+ onLayout
11
+ } = props;
12
+ const {
13
+ createItemStyle,
14
+ itemHeight,
15
+ itemWidth,
16
+ itemVisibilityStore
17
+ } = useContext(InternalContext);
18
+ const [visible, setVisible] = useState(false);
19
+ const interpolation = useItemInterpolation(index);
20
+ const itemStyle = useMemo(() => createItemStyle(interpolation, itemWidth), [createItemStyle, interpolation, itemWidth]);
21
+ useEffect(() => {
22
+ return itemVisibilityStore.subscribe(ranges => {
23
+ const nextVisible = ranges.some(_ref => {
24
+ let [from, to] = _ref;
25
+ return index >= from && index <= to;
26
+ });
27
+ setVisible(nextVisible);
28
+ });
29
+ }, [index, itemVisibilityStore]);
30
+ return /*#__PURE__*/React.createElement(Animated.View, {
31
+ children: visible ? children(interpolation) : null,
32
+ onLayout: onLayout,
33
+ style: [{
34
+ width: itemWidth,
35
+ height: itemHeight !== 'auto' ? itemHeight : undefined
36
+ }, styles.absolute, // @ts-ignore
37
+ itemStyle]
38
+ });
39
+ }
40
+ ;
41
+ const styles = StyleSheet.create({
42
+ absolute: {
43
+ position: 'absolute'
44
+ }
45
+ });
46
+ //# sourceMappingURL=ItemView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useContext","useEffect","useMemo","useState","Animated","StyleSheet","useItemInterpolation","InternalContext","ItemView","props","children","index","onLayout","createItemStyle","itemHeight","itemWidth","itemVisibilityStore","visible","setVisible","interpolation","itemStyle","subscribe","ranges","nextVisible","some","from","to","width","height","undefined","styles","absolute","create","position"],"sources":["ItemView.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React, { useContext, useEffect, useMemo, useState } from 'react';\nimport type { ViewProps } from 'react-native';\nimport { Animated } from 'react-native';\nimport { StyleSheet } from '@fountain-ui/core';\nimport useItemInterpolation from './useItemInterpolation';\nimport InternalContext from './InternalContext';\n\nexport interface ItemViewProps {\n children: (interpolation: Animated.AnimatedInterpolation) => ReactElement | null;\n index: number;\n onLayout?: ViewProps['onLayout'];\n}\n\nexport default function ItemView(props: ItemViewProps) {\n const {\n children,\n index,\n onLayout,\n } = props;\n\n const {\n createItemStyle,\n itemHeight,\n itemWidth,\n itemVisibilityStore,\n } = useContext(InternalContext);\n\n const [visible, setVisible] = useState(false);\n\n const interpolation = useItemInterpolation(index);\n\n const itemStyle = useMemo(\n () => createItemStyle(interpolation, itemWidth),\n [createItemStyle, interpolation, itemWidth],\n );\n\n useEffect(() => {\n return itemVisibilityStore.subscribe(ranges => {\n const nextVisible = ranges.some(([from, to]) => index >= from && index <= to);\n setVisible(nextVisible);\n });\n }, [index, itemVisibilityStore]);\n\n return (\n <Animated.View\n children={visible ? children(interpolation) : null}\n onLayout={onLayout}\n style={[\n {\n width: itemWidth,\n height: itemHeight !== 'auto' ? itemHeight : undefined,\n },\n styles.absolute,\n // @ts-ignore\n itemStyle,\n ]}\n />\n );\n};\n\nconst styles = StyleSheet.create({\n absolute: {\n position: 'absolute',\n },\n});\n"],"mappings":"AACA,OAA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