@fountain-ui/lab 2.0.0-beta.1 → 2.0.0-beta.12

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 (381) 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 +1 -1
  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 +2 -6
  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/Carousel/Carousel.js +137 -0
  15. package/build/commonjs/Carousel/Carousel.js.map +1 -0
  16. package/build/commonjs/Carousel/CarouselProps.js.map +1 -1
  17. package/build/commonjs/Carousel/animation/animationUtils.js +9 -0
  18. package/build/commonjs/Carousel/animation/animationUtils.js.map +1 -0
  19. package/build/commonjs/Carousel/animation/createDefaultItemStyle.js +15 -0
  20. package/build/commonjs/Carousel/animation/createDefaultItemStyle.js.map +1 -0
  21. package/build/commonjs/Carousel/animation/createDefaultScrollAnimation.js +20 -0
  22. package/build/commonjs/Carousel/animation/createDefaultScrollAnimation.js.map +1 -0
  23. package/build/commonjs/Carousel/animation/index.js +40 -0
  24. package/build/commonjs/Carousel/animation/index.js.map +1 -0
  25. package/build/commonjs/Carousel/animation/normalItemStyleFactory.js +27 -0
  26. package/build/commonjs/Carousel/animation/normalItemStyleFactory.js.map +1 -0
  27. package/build/commonjs/Carousel/animation/parallaxItemStyleFactory.js +65 -0
  28. package/build/commonjs/Carousel/animation/parallaxItemStyleFactory.js.map +1 -0
  29. package/build/commonjs/Carousel/components/InternalContext.js +29 -0
  30. package/build/commonjs/Carousel/components/InternalContext.js.map +1 -0
  31. package/build/commonjs/Carousel/components/ItemView.js +64 -0
  32. package/build/commonjs/Carousel/components/ItemView.js.map +1 -0
  33. package/build/commonjs/Carousel/components/RootView.js +68 -0
  34. package/build/commonjs/Carousel/components/RootView.js.map +1 -0
  35. package/build/commonjs/Carousel/components/ScrollViewGesture.js +76 -0
  36. package/build/commonjs/Carousel/components/ScrollViewGesture.js.map +1 -0
  37. package/build/commonjs/Carousel/components/index.js +40 -0
  38. package/build/commonjs/Carousel/components/index.js.map +1 -0
  39. package/build/commonjs/Carousel/hooks/index.js +64 -0
  40. package/build/commonjs/Carousel/hooks/index.js.map +1 -0
  41. package/build/commonjs/Carousel/hooks/useAutoplayController.js +55 -0
  42. package/build/commonjs/Carousel/hooks/useAutoplayController.js.map +1 -0
  43. package/build/commonjs/Carousel/hooks/useDimensionChangeReaction.js +23 -0
  44. package/build/commonjs/Carousel/hooks/useDimensionChangeReaction.js.map +1 -0
  45. package/build/commonjs/Carousel/hooks/useIndexController.js +70 -0
  46. package/build/commonjs/Carousel/hooks/useIndexController.js.map +1 -0
  47. package/build/commonjs/Carousel/hooks/useItemInterpolation.js +63 -0
  48. package/build/commonjs/Carousel/hooks/useItemInterpolation.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/usePagingAnimation.js +124 -0
  54. package/build/commonjs/Carousel/hooks/usePagingAnimation.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/types.js +7 -0
  58. package/build/commonjs/Carousel/types.js.map +1 -0
  59. package/build/commonjs/ComicViewer/ComicViewer.js +16 -11
  60. package/build/commonjs/ComicViewer/ComicViewer.js.map +1 -1
  61. package/build/commonjs/ComicViewer/ComicViewerItemProps.js.map +1 -1
  62. package/build/commonjs/ComicViewer/ComicViewerProps.js.map +1 -1
  63. package/build/commonjs/ComicViewer/ViewerItem.js +4 -3
  64. package/build/commonjs/ComicViewer/ViewerItem.js.map +1 -1
  65. package/build/commonjs/ComicViewer/index.js.map +1 -1
  66. package/build/commonjs/DateTimePicker/DateTimePicker.js +2 -2
  67. package/build/commonjs/DateTimePicker/DateTimePicker.js.map +1 -1
  68. package/build/commonjs/DateTimePicker/DateTimePickerProps.js.map +1 -1
  69. package/build/commonjs/DateTimePicker/DateTimePickerProvider.js.map +1 -1
  70. package/build/commonjs/DateTimePicker/YearPicker.js +21 -17
  71. package/build/commonjs/DateTimePicker/YearPicker.js.map +1 -1
  72. package/build/commonjs/DateTimePicker/index.js +4 -4
  73. package/build/commonjs/DateTimePicker/index.js.map +1 -1
  74. package/build/commonjs/DateTimePicker/utils.js +2 -1
  75. package/build/commonjs/DateTimePicker/utils.js.map +1 -1
  76. package/build/commonjs/FlipCard/FlipCard.js +7 -13
  77. package/build/commonjs/FlipCard/FlipCard.js.map +1 -1
  78. package/build/commonjs/FlipCard/FlipCardProps.js.map +1 -1
  79. package/build/commonjs/FlipCard/index.js.map +1 -1
  80. package/build/commonjs/StatusBarProvider/Provider.js +1 -1
  81. package/build/commonjs/StatusBarProvider/Provider.js.map +1 -1
  82. package/build/commonjs/StatusBarProvider/StatusBarProvider.js.map +1 -1
  83. package/build/commonjs/StatusBarProvider/StatusBarProviderProps.js.map +1 -1
  84. package/build/commonjs/StatusBarProvider/index.js.map +1 -1
  85. package/build/commonjs/ViewPager/ChildrenMemoizedPage.js +86 -21
  86. package/build/commonjs/ViewPager/ChildrenMemoizedPage.js.map +1 -1
  87. package/build/commonjs/ViewPager/PageStateContext.js +22 -0
  88. package/build/commonjs/ViewPager/PageStateContext.js.map +1 -0
  89. package/build/commonjs/ViewPager/ViewPagerNative.js +61 -38
  90. package/build/commonjs/ViewPager/ViewPagerNative.js.map +1 -1
  91. package/build/commonjs/ViewPager/ViewPagerProps.js.map +1 -1
  92. package/build/commonjs/ViewPager/ViewPagerWeb.js +35 -26
  93. package/build/commonjs/ViewPager/ViewPagerWeb.js.map +1 -1
  94. package/build/commonjs/ViewPager/index.js +8 -0
  95. package/build/commonjs/ViewPager/index.js.map +1 -1
  96. package/build/commonjs/ViewPager/index.native.js +8 -0
  97. package/build/commonjs/ViewPager/index.native.js.map +1 -1
  98. package/build/commonjs/ViewPager/utils.js +5 -39
  99. package/build/commonjs/ViewPager/utils.js.map +1 -1
  100. package/build/commonjs/ViewabilityTrackerView/Viewability.js +2 -0
  101. package/build/commonjs/ViewabilityTrackerView/Viewability.js.map +1 -0
  102. package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerView.js +45 -0
  103. package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerView.js.map +1 -0
  104. package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerViewProps.js +2 -0
  105. package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerViewProps.js.map +1 -0
  106. package/build/commonjs/{Carousel/index.native.js → ViewabilityTrackerView/index.js} +3 -3
  107. package/build/commonjs/ViewabilityTrackerView/index.js.map +1 -0
  108. package/build/commonjs/ViewabilityTrackerView/measureViewability.js +42 -0
  109. package/build/commonjs/ViewabilityTrackerView/measureViewability.js.map +1 -0
  110. package/build/commonjs/ViewabilityTrackerView/useViewabilityTracker.js +88 -0
  111. package/build/commonjs/ViewabilityTrackerView/useViewabilityTracker.js.map +1 -0
  112. package/build/commonjs/hooks/index.js +16 -0
  113. package/build/commonjs/hooks/index.js.map +1 -1
  114. package/build/commonjs/hooks/useAppbarStyles.js.map +1 -1
  115. package/build/commonjs/hooks/useDeferredExecutor.js +45 -0
  116. package/build/commonjs/hooks/useDeferredExecutor.js.map +1 -0
  117. package/build/commonjs/hooks/useElevationStyle.js.map +1 -1
  118. package/build/commonjs/hooks/useHeight.js +5 -4
  119. package/build/commonjs/hooks/useHeight.js.map +1 -1
  120. package/build/commonjs/hooks/useIsMounted.js +22 -0
  121. package/build/commonjs/hooks/useIsMounted.js.map +1 -0
  122. package/build/commonjs/hooks/useUnstableCollapsibleAppBar.js +56 -57
  123. package/build/commonjs/hooks/useUnstableCollapsibleAppBar.js.map +1 -1
  124. package/build/commonjs/hooks/useUnstableToggleDisplayStyle.js +9 -11
  125. package/build/commonjs/hooks/useUnstableToggleDisplayStyle.js.map +1 -1
  126. package/build/commonjs/index.js +28 -7
  127. package/build/commonjs/index.js.map +1 -1
  128. package/build/module/AnimatedY/AnimatedY.js +11 -10
  129. package/build/module/AnimatedY/AnimatedY.js.map +1 -1
  130. package/build/module/AnimatedY/AnimatedYProps.js.map +1 -1
  131. package/build/module/AnimatedY/index.js.map +1 -1
  132. package/build/module/BottomSheet/BottomSheetNative.js +1 -1
  133. package/build/module/BottomSheet/BottomSheetNative.js.map +1 -1
  134. package/build/module/BottomSheet/BottomSheetProps.js.map +1 -1
  135. package/build/module/BottomSheet/BottomSheetWeb.js +2 -6
  136. package/build/module/BottomSheet/BottomSheetWeb.js.map +1 -1
  137. package/build/module/BottomSheet/TransparentBackdrop.js +1 -1
  138. package/build/module/BottomSheet/TransparentBackdrop.js.map +1 -1
  139. package/build/module/BottomSheet/index.js.map +1 -1
  140. package/build/module/BottomSheet/index.native.js.map +1 -1
  141. package/build/module/Carousel/Carousel.js +115 -0
  142. package/build/module/Carousel/Carousel.js.map +1 -0
  143. package/build/module/Carousel/CarouselProps.js.map +1 -1
  144. package/build/module/Carousel/animation/animationUtils.js +2 -0
  145. package/build/module/Carousel/animation/animationUtils.js.map +1 -0
  146. package/build/module/Carousel/animation/createDefaultItemStyle.js +3 -0
  147. package/build/module/Carousel/animation/createDefaultItemStyle.js.map +1 -0
  148. package/build/module/Carousel/animation/createDefaultScrollAnimation.js +11 -0
  149. package/build/module/Carousel/animation/createDefaultScrollAnimation.js.map +1 -0
  150. package/build/module/Carousel/animation/index.js +5 -0
  151. package/build/module/Carousel/animation/index.js.map +1 -0
  152. package/build/module/Carousel/animation/normalItemStyleFactory.js +18 -0
  153. package/build/module/Carousel/animation/normalItemStyleFactory.js.map +1 -0
  154. package/build/module/Carousel/animation/parallaxItemStyleFactory.js +55 -0
  155. package/build/module/Carousel/animation/parallaxItemStyleFactory.js.map +1 -0
  156. package/build/module/Carousel/components/InternalContext.js +19 -0
  157. package/build/module/Carousel/components/InternalContext.js.map +1 -0
  158. package/build/module/Carousel/components/ItemView.js +44 -0
  159. package/build/module/Carousel/components/ItemView.js.map +1 -0
  160. package/build/module/Carousel/components/RootView.js +47 -0
  161. package/build/module/Carousel/components/RootView.js.map +1 -0
  162. package/build/module/Carousel/components/ScrollViewGesture.js +62 -0
  163. package/build/module/Carousel/components/ScrollViewGesture.js.map +1 -0
  164. package/build/module/Carousel/components/index.js +5 -0
  165. package/build/module/Carousel/components/index.js.map +1 -0
  166. package/build/module/Carousel/hooks/index.js +8 -0
  167. package/build/module/Carousel/hooks/index.js.map +1 -0
  168. package/build/module/Carousel/hooks/useAutoplayController.js +45 -0
  169. package/build/module/Carousel/hooks/useAutoplayController.js.map +1 -0
  170. package/build/module/Carousel/hooks/useDimensionChangeReaction.js +14 -0
  171. package/build/module/Carousel/hooks/useDimensionChangeReaction.js.map +1 -0
  172. package/build/module/Carousel/hooks/useIndexController.js +54 -0
  173. package/build/module/Carousel/hooks/useIndexController.js.map +1 -0
  174. package/build/module/Carousel/hooks/useItemInterpolation.js +51 -0
  175. package/build/module/Carousel/hooks/useItemInterpolation.js.map +1 -0
  176. package/build/module/Carousel/hooks/useItemVisibilityStore.js +87 -0
  177. package/build/module/Carousel/hooks/useItemVisibilityStore.js.map +1 -0
  178. package/build/module/Carousel/hooks/useLoopedData.js +24 -0
  179. package/build/module/Carousel/hooks/useLoopedData.js.map +1 -0
  180. package/build/module/Carousel/hooks/usePagingAnimation.js +115 -0
  181. package/build/module/Carousel/hooks/usePagingAnimation.js.map +1 -0
  182. package/build/module/Carousel/index.js +2 -1
  183. package/build/module/Carousel/index.js.map +1 -1
  184. package/build/module/Carousel/types.js +3 -0
  185. package/build/module/Carousel/types.js.map +1 -0
  186. package/build/module/ComicViewer/ComicViewer.js +16 -11
  187. package/build/module/ComicViewer/ComicViewer.js.map +1 -1
  188. package/build/module/ComicViewer/ComicViewerItemProps.js.map +1 -1
  189. package/build/module/ComicViewer/ComicViewerProps.js.map +1 -1
  190. package/build/module/ComicViewer/ViewerItem.js +4 -3
  191. package/build/module/ComicViewer/ViewerItem.js.map +1 -1
  192. package/build/module/ComicViewer/index.js.map +1 -1
  193. package/build/module/DateTimePicker/DateTimePicker.js +2 -2
  194. package/build/module/DateTimePicker/DateTimePicker.js.map +1 -1
  195. package/build/module/DateTimePicker/DateTimePickerProps.js.map +1 -1
  196. package/build/module/DateTimePicker/DateTimePickerProvider.js.map +1 -1
  197. package/build/module/DateTimePicker/YearPicker.js +21 -17
  198. package/build/module/DateTimePicker/YearPicker.js.map +1 -1
  199. package/build/module/DateTimePicker/index.js.map +1 -1
  200. package/build/module/DateTimePicker/utils.js +2 -1
  201. package/build/module/DateTimePicker/utils.js.map +1 -1
  202. package/build/module/FlipCard/FlipCard.js +7 -7
  203. package/build/module/FlipCard/FlipCard.js.map +1 -1
  204. package/build/module/FlipCard/FlipCardProps.js.map +1 -1
  205. package/build/module/FlipCard/index.js.map +1 -1
  206. package/build/module/StatusBarProvider/Provider.js.map +1 -1
  207. package/build/module/StatusBarProvider/StatusBarProvider.js.map +1 -1
  208. package/build/module/StatusBarProvider/StatusBarProviderProps.js.map +1 -1
  209. package/build/module/StatusBarProvider/index.js.map +1 -1
  210. package/build/module/ViewPager/ChildrenMemoizedPage.js +80 -23
  211. package/build/module/ViewPager/ChildrenMemoizedPage.js.map +1 -1
  212. package/build/module/ViewPager/PageStateContext.js +10 -0
  213. package/build/module/ViewPager/PageStateContext.js.map +1 -0
  214. package/build/module/ViewPager/ViewPagerNative.js +57 -33
  215. package/build/module/ViewPager/ViewPagerNative.js.map +1 -1
  216. package/build/module/ViewPager/ViewPagerProps.js.map +1 -1
  217. package/build/module/ViewPager/ViewPagerWeb.js +29 -24
  218. package/build/module/ViewPager/ViewPagerWeb.js.map +1 -1
  219. package/build/module/ViewPager/index.js +1 -0
  220. package/build/module/ViewPager/index.js.map +1 -1
  221. package/build/module/ViewPager/index.native.js +1 -0
  222. package/build/module/ViewPager/index.native.js.map +1 -1
  223. package/build/module/ViewPager/utils.js +2 -31
  224. package/build/module/ViewPager/utils.js.map +1 -1
  225. package/build/module/ViewabilityTrackerView/Viewability.js +2 -0
  226. package/build/module/ViewabilityTrackerView/Viewability.js.map +1 -0
  227. package/build/module/ViewabilityTrackerView/ViewabilityTrackerView.js +28 -0
  228. package/build/module/ViewabilityTrackerView/ViewabilityTrackerView.js.map +1 -0
  229. package/build/module/ViewabilityTrackerView/ViewabilityTrackerViewProps.js +2 -0
  230. package/build/module/ViewabilityTrackerView/ViewabilityTrackerViewProps.js.map +1 -0
  231. package/build/module/ViewabilityTrackerView/index.js +2 -0
  232. package/build/module/ViewabilityTrackerView/index.js.map +1 -0
  233. package/build/module/ViewabilityTrackerView/measureViewability.js +34 -0
  234. package/build/module/ViewabilityTrackerView/measureViewability.js.map +1 -0
  235. package/build/module/ViewabilityTrackerView/useViewabilityTracker.js +73 -0
  236. package/build/module/ViewabilityTrackerView/useViewabilityTracker.js.map +1 -0
  237. package/build/module/hooks/index.js +2 -0
  238. package/build/module/hooks/index.js.map +1 -1
  239. package/build/module/hooks/useAppbarStyles.js.map +1 -1
  240. package/build/module/hooks/useDeferredExecutor.js +33 -0
  241. package/build/module/hooks/useDeferredExecutor.js.map +1 -0
  242. package/build/module/hooks/useElevationStyle.js.map +1 -1
  243. package/build/module/hooks/useHeight.js +4 -3
  244. package/build/module/hooks/useHeight.js.map +1 -1
  245. package/build/module/hooks/useIsMounted.js +13 -0
  246. package/build/module/hooks/useIsMounted.js.map +1 -0
  247. package/build/module/hooks/useUnstableCollapsibleAppBar.js +58 -43
  248. package/build/module/hooks/useUnstableCollapsibleAppBar.js.map +1 -1
  249. package/build/module/hooks/useUnstableToggleDisplayStyle.js +9 -7
  250. package/build/module/hooks/useUnstableToggleDisplayStyle.js.map +1 -1
  251. package/build/module/index.js +2 -0
  252. package/build/module/index.js.map +1 -1
  253. package/build/typescript/AnimatedY/AnimatedY.d.ts +0 -1
  254. package/build/typescript/BottomSheet/BottomSheetNative.d.ts +0 -1
  255. package/build/typescript/BottomSheet/BottomSheetWeb.d.ts +0 -1
  256. package/build/typescript/BottomSheet/TransparentBackdrop.d.ts +0 -1
  257. package/build/typescript/Carousel/Carousel.d.ts +5 -0
  258. package/build/typescript/Carousel/CarouselProps.d.ts +32 -48
  259. package/build/typescript/Carousel/animation/animationUtils.d.ts +1 -0
  260. package/build/typescript/Carousel/animation/createDefaultItemStyle.d.ts +2 -0
  261. package/build/typescript/Carousel/animation/createDefaultScrollAnimation.d.ts +2 -0
  262. package/build/typescript/Carousel/animation/index.d.ts +4 -0
  263. package/build/typescript/Carousel/animation/normalItemStyleFactory.d.ts +2 -0
  264. package/build/typescript/Carousel/animation/parallaxItemStyleFactory.d.ts +9 -0
  265. package/build/typescript/Carousel/components/InternalContext.d.ts +14 -0
  266. package/build/typescript/Carousel/components/ItemView.d.ts +7 -0
  267. package/build/typescript/Carousel/components/RootView.d.ts +16 -0
  268. package/build/typescript/Carousel/components/ScrollViewGesture.d.ts +12 -0
  269. package/build/typescript/Carousel/components/index.d.ts +4 -0
  270. package/build/typescript/Carousel/hooks/index.d.ts +7 -0
  271. package/build/typescript/Carousel/hooks/useAutoplayController.d.ts +7 -0
  272. package/build/typescript/Carousel/hooks/useDimensionChangeReaction.d.ts +7 -0
  273. package/build/typescript/Carousel/hooks/useIndexController.d.ts +10 -0
  274. package/build/typescript/Carousel/hooks/useItemInterpolation.d.ts +2 -0
  275. package/build/typescript/Carousel/hooks/useItemVisibilityStore.d.ts +7 -0
  276. package/build/typescript/Carousel/hooks/useLoopedData.d.ts +1 -0
  277. package/build/typescript/Carousel/hooks/usePagingAnimation.d.ts +18 -0
  278. package/build/typescript/Carousel/index.d.ts +3 -1
  279. package/build/typescript/Carousel/types.d.ts +57 -0
  280. package/build/typescript/ComicViewer/ComicViewer.d.ts +0 -1
  281. package/build/typescript/DateTimePicker/DateTimePicker.d.ts +0 -1
  282. package/build/typescript/DateTimePicker/YearPicker.d.ts +0 -1
  283. package/build/typescript/FlipCard/FlipCard.d.ts +0 -1
  284. package/build/typescript/StatusBarProvider/StatusBarProvider.d.ts +0 -1
  285. package/build/typescript/ViewPager/ChildrenMemoizedPage.d.ts +2 -1
  286. package/build/typescript/ViewPager/PageStateContext.d.ts +7 -0
  287. package/build/typescript/ViewPager/ViewPagerNative.d.ts +4 -2
  288. package/build/typescript/ViewPager/ViewPagerProps.d.ts +31 -19
  289. package/build/typescript/ViewPager/ViewPagerWeb.d.ts +4 -2
  290. package/build/typescript/ViewPager/index.d.ts +2 -1
  291. package/build/typescript/ViewPager/index.native.d.ts +1 -0
  292. package/build/typescript/ViewPager/utils.d.ts +3 -19
  293. package/build/typescript/ViewabilityTrackerView/Viewability.d.ts +3 -0
  294. package/build/typescript/ViewabilityTrackerView/ViewabilityTrackerView.d.ts +2 -0
  295. package/build/typescript/ViewabilityTrackerView/ViewabilityTrackerViewProps.d.ts +22 -0
  296. package/build/typescript/ViewabilityTrackerView/index.d.ts +2 -0
  297. package/build/typescript/ViewabilityTrackerView/measureViewability.d.ts +11 -0
  298. package/build/typescript/ViewabilityTrackerView/useViewabilityTracker.d.ts +11 -0
  299. package/build/typescript/hooks/index.d.ts +2 -0
  300. package/build/typescript/hooks/useDeferredExecutor.d.ts +11 -0
  301. package/build/typescript/hooks/useIsMounted.d.ts +4 -0
  302. package/build/typescript/hooks/useUnstableCollapsibleAppBar.d.ts +2 -3
  303. package/build/typescript/hooks/useUnstableToggleDisplayStyle.d.ts +2 -2
  304. package/build/typescript/index.d.ts +2 -0
  305. package/package.json +12 -27
  306. package/src/AnimatedY/AnimatedY.tsx +13 -10
  307. package/src/Carousel/Carousel.tsx +151 -0
  308. package/src/Carousel/CarouselProps.ts +34 -53
  309. package/src/Carousel/animation/animationUtils.ts +1 -0
  310. package/src/Carousel/animation/createDefaultItemStyle.ts +3 -0
  311. package/src/Carousel/animation/createDefaultScrollAnimation.ts +13 -0
  312. package/src/Carousel/animation/index.ts +4 -0
  313. package/src/Carousel/animation/normalItemStyleFactory.ts +19 -0
  314. package/src/Carousel/animation/parallaxItemStyleFactory.ts +79 -0
  315. package/src/Carousel/components/InternalContext.ts +33 -0
  316. package/src/Carousel/components/ItemView.tsx +56 -0
  317. package/src/Carousel/components/RootView.tsx +66 -0
  318. package/src/Carousel/components/ScrollViewGesture.tsx +80 -0
  319. package/src/Carousel/components/index.ts +4 -0
  320. package/src/Carousel/hooks/index.ts +7 -0
  321. package/src/Carousel/hooks/useAutoplayController.ts +54 -0
  322. package/src/Carousel/hooks/useDimensionChangeReaction.ts +25 -0
  323. package/src/Carousel/hooks/useIndexController.tsx +76 -0
  324. package/src/Carousel/hooks/useItemInterpolation.ts +107 -0
  325. package/src/Carousel/hooks/useItemVisibilityStore.ts +107 -0
  326. package/src/Carousel/hooks/useLoopedData.ts +26 -0
  327. package/src/Carousel/hooks/usePagingAnimation.ts +148 -0
  328. package/src/Carousel/index.ts +4 -2
  329. package/src/Carousel/types.ts +67 -0
  330. package/src/DateTimePicker/DateTimePicker.tsx +2 -2
  331. package/src/FlipCard/FlipCard.tsx +8 -8
  332. package/src/ViewPager/ChildrenMemoizedPage.tsx +97 -23
  333. package/src/ViewPager/PageStateContext.ts +15 -0
  334. package/src/ViewPager/ViewPagerNative.tsx +72 -36
  335. package/src/ViewPager/ViewPagerProps.ts +33 -19
  336. package/src/ViewPager/ViewPagerWeb.tsx +38 -29
  337. package/src/ViewPager/index.native.ts +1 -0
  338. package/src/ViewPager/index.ts +2 -1
  339. package/src/ViewPager/utils.tsx +4 -56
  340. package/src/ViewabilityTrackerView/Viewability.ts +3 -0
  341. package/src/ViewabilityTrackerView/ViewabilityTrackerView.tsx +33 -0
  342. package/src/ViewabilityTrackerView/ViewabilityTrackerViewProps.ts +25 -0
  343. package/src/ViewabilityTrackerView/index.ts +2 -0
  344. package/src/ViewabilityTrackerView/measureViewability.ts +56 -0
  345. package/src/ViewabilityTrackerView/useViewabilityTracker.ts +85 -0
  346. package/src/hooks/index.ts +2 -0
  347. package/src/hooks/useDeferredExecutor.ts +46 -0
  348. package/src/hooks/useHeight.ts +2 -2
  349. package/src/hooks/useIsMounted.ts +19 -0
  350. package/src/hooks/useUnstableCollapsibleAppBar.ts +59 -42
  351. package/src/hooks/useUnstableToggleDisplayStyle.ts +8 -6
  352. package/src/index.ts +3 -0
  353. package/build/commonjs/Carousel/CarouselNative.js +0 -72
  354. package/build/commonjs/Carousel/CarouselNative.js.map +0 -1
  355. package/build/commonjs/Carousel/CarouselWeb.js +0 -237
  356. package/build/commonjs/Carousel/CarouselWeb.js.map +0 -1
  357. package/build/commonjs/Carousel/index.native.js.map +0 -1
  358. package/build/commonjs/Carousel/utils.js +0 -19
  359. package/build/commonjs/Carousel/utils.js.map +0 -1
  360. package/build/commonjs/hooks/useWidth.js +0 -29
  361. package/build/commonjs/hooks/useWidth.js.map +0 -1
  362. package/build/module/Carousel/CarouselNative.js +0 -54
  363. package/build/module/Carousel/CarouselNative.js.map +0 -1
  364. package/build/module/Carousel/CarouselWeb.js +0 -215
  365. package/build/module/Carousel/CarouselWeb.js.map +0 -1
  366. package/build/module/Carousel/index.native.js +0 -2
  367. package/build/module/Carousel/index.native.js.map +0 -1
  368. package/build/module/Carousel/utils.js +0 -7
  369. package/build/module/Carousel/utils.js.map +0 -1
  370. package/build/module/hooks/useWidth.js +0 -15
  371. package/build/module/hooks/useWidth.js.map +0 -1
  372. package/build/typescript/Carousel/CarouselNative.d.ts +0 -3
  373. package/build/typescript/Carousel/CarouselWeb.d.ts +0 -4
  374. package/build/typescript/Carousel/index.native.d.ts +0 -1
  375. package/build/typescript/Carousel/utils.d.ts +0 -6
  376. package/build/typescript/hooks/useWidth.d.ts +0 -2
  377. package/src/Carousel/CarouselNative.tsx +0 -67
  378. package/src/Carousel/CarouselWeb.tsx +0 -222
  379. package/src/Carousel/index.native.ts +0 -1
  380. package/src/Carousel/utils.ts +0 -11
  381. package/src/hooks/useWidth.ts +0 -17
@@ -1,41 +1,46 @@
1
- import React from 'react';
2
- import { StyleSheet, View } from 'react-native';
3
- import { defaultEnableNeighborPageRerender, defaultEnableVisibleHint, defaultLoading, defaultPageComponent, usePageRenderer } from './utils';
1
+ import React, { Children, forwardRef, useImperativeHandle, useCallback } from 'react';
2
+ import { View } from 'react-native';
3
+ import { useSharedValue } from 'react-native-reanimated';
4
+ import { StyleSheet } from '@fountain-ui/core';
5
+ import { defaultInitialPage, defaultLoading, defaultPageComponent } from './utils';
4
6
  const styles = StyleSheet.create({
5
7
  root: {
6
8
  // @ts-ignore
7
9
  overflow: 'auto',
8
10
  position: 'relative'
9
- },
10
- none: {
11
- display: 'none'
12
11
  }
13
12
  });
14
- export default function ViewPager(props) {
13
+ const ViewPager = /*#__PURE__*/forwardRef(function ViewPager(props, ref) {
15
14
  const {
16
15
  children,
17
- enableVisibleHint = defaultEnableVisibleHint,
18
- enableNeighborPageRerender = defaultEnableNeighborPageRerender,
19
- index,
16
+ initialPage = defaultInitialPage,
20
17
  loading = defaultLoading,
21
18
  pageComponent = defaultPageComponent,
22
19
  pageForceRerenderKey,
23
- style
20
+ style,
21
+ UNSTABLE_sharedIndex
24
22
  } = props;
25
- const renderer = usePageRenderer({
26
- enableVisibleHint,
27
- enableNeighborPageRerender,
28
- index,
29
- loading,
30
- pageComponent,
31
- pageForceRerenderKey
32
- });
23
+ const fallbackSharedIndex = useSharedValue(initialPage);
24
+ const sharedIndex = UNSTABLE_sharedIndex ?? fallbackSharedIndex;
25
+ const setPage = useCallback(newIndex => {
26
+ sharedIndex.value = newIndex;
27
+ }, [sharedIndex]);
28
+ useImperativeHandle(ref, () => ({
29
+ setPage
30
+ }), [setPage]);
31
+ const PageComponent = pageComponent;
33
32
  return /*#__PURE__*/React.createElement(View, {
34
33
  style: [styles.root, style]
35
- }, React.Children.map(renderer(children), (child, i) => /*#__PURE__*/React.cloneElement(child, {
36
- isVisible: i === index,
37
- style: i !== index ? styles.none : StyleSheet.absoluteFill
34
+ }, Children.map(children, (child, index) => /*#__PURE__*/React.createElement(PageComponent, {
35
+ key: index,
36
+ children: child,
37
+ index: index,
38
+ loading: loading,
39
+ offscreenPageRerenderLimit: 0 // All offscreen pages will not be re-rendered
40
+ ,
41
+ rerenderKey: pageForceRerenderKey,
42
+ sharedIndex: sharedIndex
38
43
  })));
39
- }
40
- ;
44
+ });
45
+ export default ViewPager;
41
46
  //# sourceMappingURL=ViewPagerWeb.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["ViewPagerWeb.tsx"],"names":["React","StyleSheet","View","defaultEnableNeighborPageRerender","defaultEnableVisibleHint","defaultLoading","defaultPageComponent","usePageRenderer","styles","create","root","overflow","position","none","display","ViewPager","props","children","enableVisibleHint","enableNeighborPageRerender","index","loading","pageComponent","pageForceRerenderKey","style","renderer","Children","map","child","i","cloneElement","isVisible","absoluteFill"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,UAAT,EAAqBC,IAArB,QAAiC,cAAjC;AAEA,SACIC,iCADJ,EAEIC,wBAFJ,EAGIC,cAHJ,EAIIC,oBAJJ,EAKIC,eALJ,QAMO,SANP;AAQA,MAAMC,MAAM,GAAGP,UAAU,CAACQ,MAAX,CAAkB;AAC7BC,EAAAA,IAAI,EAAE;AACF;AACAC,IAAAA,QAAQ,EAAE,MAFR;AAGFC,IAAAA,QAAQ,EAAE;AAHR,GADuB;AAM7BC,EAAAA,IAAI,EAAE;AAAEC,IAAAA,OAAO,EAAE;AAAX;AANuB,CAAlB,CAAf;AASA,eAAe,SAASC,SAAT,CAAmBC,KAAnB,EAA0C;AACrD,QAAM;AACFC,IAAAA,QADE;AAEFC,IAAAA,iBAAiB,GAAGd,wBAFlB;AAGFe,IAAAA,0BAA0B,GAAGhB,iCAH3B;AAIFiB,IAAAA,KAJE;AAKFC,IAAAA,OAAO,GAAGhB,cALR;AAMFiB,IAAAA,aAAa,GAAGhB,oBANd;AAOFiB,IAAAA,oBAPE;AAQFC,IAAAA;AARE,MASFR,KATJ;AAWA,QAAMS,QAAQ,GAAGlB,eAAe,CAAC;AAC7BW,IAAAA,iBAD6B;AAE7BC,IAAAA,0BAF6B;AAG7BC,IAAAA,KAH6B;AAI7BC,IAAAA,OAJ6B;AAK7BC,IAAAA,aAL6B;AAM7BC,IAAAA;AAN6B,GAAD,CAAhC;AASA,sBACI,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAE,CAACf,MAAM,CAACE,IAAR,EAAcc,KAAd;AAAb,KACKxB,KAAK,CAAC0B,QAAN,CAAeC,GAAf,CAAmBF,QAAQ,CAACR,QAAD,CAA3B,EAAuC,CAACW,KAAD,EAAQC,CAAR,kBACpC7B,KAAK,CAAC8B,YAAN,CAAmBF,KAAnB,EAAgD;AAC5CG,IAAAA,SAAS,EAAEF,CAAC,KAAKT,KAD2B;AAE5CI,IAAAA,KAAK,EAAEK,CAAC,KAAKT,KAAN,GAAcZ,MAAM,CAACK,IAArB,GAA4BZ,UAAU,CAAC+B;AAFF,GAAhD,CADH,CADL,CADJ;AAUH;AAAA","sourcesContent":["import React from 'react';\nimport { StyleSheet, View } from 'react-native';\nimport type ViewPagerProps from './ViewPagerProps';\nimport {\n defaultEnableNeighborPageRerender,\n defaultEnableVisibleHint,\n defaultLoading,\n defaultPageComponent,\n usePageRenderer,\n} from './utils';\n\nconst styles = StyleSheet.create({\n root: {\n // @ts-ignore\n overflow: 'auto',\n position: 'relative',\n },\n none: { display: 'none' },\n});\n\nexport default function ViewPager(props: ViewPagerProps) {\n const {\n children,\n enableVisibleHint = defaultEnableVisibleHint,\n enableNeighborPageRerender = defaultEnableNeighborPageRerender,\n index,\n loading = defaultLoading,\n pageComponent = defaultPageComponent,\n pageForceRerenderKey,\n style,\n } = props;\n\n const renderer = usePageRenderer({\n enableVisibleHint,\n enableNeighborPageRerender,\n index,\n loading,\n pageComponent,\n pageForceRerenderKey,\n });\n\n return (\n <View style={[styles.root, style]}>\n {React.Children.map(renderer(children), (child, i) =>\n React.cloneElement(child as React.ReactElement, {\n isVisible: i === index,\n style: i !== index ? styles.none : StyleSheet.absoluteFill,\n }),\n )}\n </View>\n );\n};\n"]}
1
+ {"version":3,"names":["React","Children","forwardRef","useImperativeHandle","useCallback","View","useSharedValue","StyleSheet","defaultInitialPage","defaultLoading","defaultPageComponent","styles","create","root","overflow","position","ViewPager","props","ref","children","initialPage","loading","pageComponent","pageForceRerenderKey","style","UNSTABLE_sharedIndex","fallbackSharedIndex","sharedIndex","setPage","newIndex","value","PageComponent","map","child","index"],"sources":["ViewPagerWeb.tsx"],"sourcesContent":["import React, { Children, forwardRef, useImperativeHandle, useCallback } from 'react';\nimport { View } from 'react-native';\nimport { useSharedValue } from 'react-native-reanimated';\nimport { StyleSheet } from '@fountain-ui/core';\nimport type ViewPagerProps from './ViewPagerProps';\nimport type { ViewPagerInstance } from './ViewPagerProps';\nimport { defaultInitialPage, defaultLoading, defaultPageComponent } from './utils';\n\nconst styles = StyleSheet.create({\n root: {\n // @ts-ignore\n overflow: 'auto',\n position: 'relative',\n },\n});\n\nconst ViewPager = forwardRef<ViewPagerInstance, ViewPagerProps>(function ViewPager(props, ref) {\n const {\n children,\n initialPage = defaultInitialPage,\n loading = defaultLoading,\n pageComponent = defaultPageComponent,\n pageForceRerenderKey,\n style,\n UNSTABLE_sharedIndex,\n } = props;\n\n const fallbackSharedIndex = useSharedValue<number>(initialPage);\n\n const sharedIndex = UNSTABLE_sharedIndex ?? fallbackSharedIndex;\n\n const setPage = useCallback((newIndex: number) => {\n sharedIndex.value = newIndex;\n }, [sharedIndex]);\n\n useImperativeHandle(\n ref,\n () => ({ setPage }),\n [setPage],\n );\n\n const PageComponent = pageComponent;\n\n return (\n <View style={[styles.root, style]}>\n {Children.map(children, (child, index) => (\n <PageComponent\n key={index}\n children={child}\n index={index}\n loading={loading}\n offscreenPageRerenderLimit={0} // All offscreen pages will not be re-rendered\n rerenderKey={pageForceRerenderKey}\n sharedIndex={sharedIndex}\n />\n ))}\n </View>\n );\n});\n\nexport default ViewPager;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,UAA1B,EAAsCC,mBAAtC,EAA2DC,WAA3D,QAA8E,OAA9E;AACA,SAASC,IAAT,QAAqB,cAArB;AACA,SAASC,cAAT,QAA+B,yBAA/B;AACA,SAASC,UAAT,QAA2B,mBAA3B;AAGA,SAASC,kBAAT,EAA6BC,cAA7B,EAA6CC,oBAA7C,QAAyE,SAAzE;AAEA,MAAMC,MAAM,GAAGJ,UAAU,CAACK,MAAX,CAAkB;EAC7BC,IAAI,EAAE;IACF;IACAC,QAAQ,EAAE,MAFR;IAGFC,QAAQ,EAAE;EAHR;AADuB,CAAlB,CAAf;AAQA,MAAMC,SAAS,gBAAGd,UAAU,CAAoC,SAASc,SAAT,CAAmBC,KAAnB,EAA0BC,GAA1B,EAA+B;EAC3F,MAAM;IACFC,QADE;IAEFC,WAAW,GAAGZ,kBAFZ;IAGFa,OAAO,GAAGZ,cAHR;IAIFa,aAAa,GAAGZ,oBAJd;IAKFa,oBALE;IAMFC,KANE;IAOFC;EAPE,IAQFR,KARJ;EAUA,MAAMS,mBAAmB,GAAGpB,cAAc,CAASc,WAAT,CAA1C;EAEA,MAAMO,WAAW,GAAGF,oBAAoB,IAAIC,mBAA5C;EAEA,MAAME,OAAO,GAAGxB,WAAW,CAAEyB,QAAD,IAAsB;IAC9CF,WAAW,CAACG,KAAZ,GAAoBD,QAApB;EACH,CAF0B,EAExB,CAACF,WAAD,CAFwB,CAA3B;EAIAxB,mBAAmB,CACfe,GADe,EAEf,OAAO;IAAEU;EAAF,CAAP,CAFe,EAGf,CAACA,OAAD,CAHe,CAAnB;EAMA,MAAMG,aAAa,GAAGT,aAAtB;EAEA,oBACI,oBAAC,IAAD;IAAM,KAAK,EAAE,CAACX,MAAM,CAACE,IAAR,EAAcW,KAAd;EAAb,GACKvB,QAAQ,CAAC+B,GAAT,CAAab,QAAb,EAAuB,CAACc,KAAD,EAAQC,KAAR,kBACpB,oBAAC,aAAD;IACI,GAAG,EAAEA,KADT;IAEI,QAAQ,EAAED,KAFd;IAGI,KAAK,EAAEC,KAHX;IAII,OAAO,EAAEb,OAJb;IAKI,0BAA0B,EAAE,CALhC,CAKmC;IALnC;IAMI,WAAW,EAAEE,oBANjB;IAOI,WAAW,EAAEI;EAPjB,EADH,CADL,CADJ;AAeH,CA1C2B,CAA5B;AA4CA,eAAeX,SAAf"}
@@ -1,2 +1,3 @@
1
1
  export { default } from './ViewPagerWeb';
2
+ export { useViewPagerPageState } from './PageStateContext';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,gBAAxB","sourcesContent":["export { default } from './ViewPagerWeb';\nexport type { default as ViewPagerProps } from './ViewPagerProps';"]}
1
+ {"version":3,"names":["default","useViewPagerPageState"],"sources":["index.ts"],"sourcesContent":["export { default } from './ViewPagerWeb';\nexport type { default as ViewPagerProps, ViewPagerInstance } from './ViewPagerProps';\nexport { useViewPagerPageState } from './PageStateContext';\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,gBAAxB;AAEA,SAASC,qBAAT,QAAsC,oBAAtC"}
@@ -1,2 +1,3 @@
1
1
  export { default } from './ViewPagerNative';
2
+ export { useViewPagerPageState } from './PageStateContext';
2
3
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.native.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,mBAAxB","sourcesContent":["export { default } from './ViewPagerNative';\n"]}
1
+ {"version":3,"names":["default","useViewPagerPageState"],"sources":["index.native.ts"],"sourcesContent":["export { default } from './ViewPagerNative';\nexport { useViewPagerPageState } from './PageStateContext';\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,mBAAxB;AACA,SAASC,qBAAT,QAAsC,oBAAtC"}
@@ -1,35 +1,6 @@
1
- import React from 'react';
2
1
  import ChildrenMemoizedPage from './ChildrenMemoizedPage';
3
- export const defaultEnableVisibleHint = false;
4
- export const defaultEnableNeighborPageRerender = false;
2
+ export const defaultInitialPage = 0;
5
3
  export const defaultLoading = 'lazy';
4
+ export const defaultOffscreenPageRerenderLimit = 0;
6
5
  export const defaultPageComponent = ChildrenMemoizedPage;
7
- export const usePageRenderer = ({
8
- enableVisibleHint,
9
- index: currentIndex,
10
- loading,
11
- pageComponent: PageComponent,
12
- pageForceRerenderKey,
13
- enableNeighborPageRerender
14
- }) => {
15
- const pagesStateRef = React.useRef([]);
16
- pagesStateRef.current[currentIndex] = { ...pagesStateRef.current[currentIndex],
17
- visited: true
18
- };
19
- return children => React.Children.map(children, (child, index) => {
20
- var _pagesStateRef$curren, _pagesStateRef$curren2;
21
-
22
- const visited = (_pagesStateRef$curren = (_pagesStateRef$curren2 = pagesStateRef.current[index]) === null || _pagesStateRef$curren2 === void 0 ? void 0 : _pagesStateRef$curren2.visited) !== null && _pagesStateRef$curren !== void 0 ? _pagesStateRef$curren : false;
23
- const content = loading === 'eager' || visited ? child : null;
24
- const isVisible = enableVisibleHint ? index === currentIndex : false;
25
- const isNeighborIndex = index === currentIndex - 1 || index === currentIndex + 1;
26
- return /*#__PURE__*/React.createElement(PageComponent, {
27
- key: index,
28
- children: content,
29
- isNeighbor: enableNeighborPageRerender && isNeighborIndex,
30
- isVisible: isVisible,
31
- rerenderKey: pageForceRerenderKey
32
- });
33
- });
34
- };
35
6
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["utils.tsx"],"names":["React","ChildrenMemoizedPage","defaultEnableVisibleHint","defaultEnableNeighborPageRerender","defaultLoading","defaultPageComponent","usePageRenderer","enableVisibleHint","index","currentIndex","loading","pageComponent","PageComponent","pageForceRerenderKey","enableNeighborPageRerender","pagesStateRef","useRef","current","visited","children","Children","map","child","content","isVisible","isNeighborIndex"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,OAAOC,oBAAP,MAAiC,wBAAjC;AAmBA,OAAO,MAAMC,wBAAiC,GAAG,KAA1C;AAEP,OAAO,MAAMC,iCAA0C,GAAG,KAAnD;AAEP,OAAO,MAAMC,cAAuB,GAAG,MAAhC;AAEP,OAAO,MAAMC,oBAAmC,GAAGJ,oBAA5C;AAEP,OAAO,MAAMK,eAAe,GAAG,CAAC;AAC5BC,EAAAA,iBAD4B;AAE5BC,EAAAA,KAAK,EAAEC,YAFqB;AAG5BC,EAAAA,OAH4B;AAI5BC,EAAAA,aAAa,EAAEC,aAJa;AAK5BC,EAAAA,oBAL4B;AAM5BC,EAAAA;AAN4B,CAAD,KAOO;AAClC,QAAMC,aAAa,GAAGf,KAAK,CAACgB,MAAN,CAA+B,EAA/B,CAAtB;AAEAD,EAAAA,aAAa,CAACE,OAAd,CAAsBR,YAAtB,IAAsC,EAClC,GAAGM,aAAa,CAACE,OAAd,CAAsBR,YAAtB,CAD+B;AAElCS,IAAAA,OAAO,EAAE;AAFyB,GAAtC;AAKA,SAAQC,QAAQ,IAAInB,KAAK,CAACoB,QAAN,CAAeC,GAAf,CAAmBF,QAAnB,EAA6B,CAACG,KAAD,EAAQd,KAAR,KAAkB;AAAA;;AAC/D,UAAMU,OAAO,sDAAGH,aAAa,CAACE,OAAd,CAAsBT,KAAtB,CAAH,2DAAG,uBAA8BU,OAAjC,yEAA4C,KAAzD;AACA,UAAMK,OAAO,GAAIb,OAAO,KAAK,OAAZ,IAAuBQ,OAAxB,GAAmCI,KAAnC,GAA2C,IAA3D;AAEA,UAAME,SAAS,GAAGjB,iBAAiB,GAAIC,KAAK,KAAKC,YAAd,GAA8B,KAAjE;AACA,UAAMgB,eAAe,GAAGjB,KAAK,KAAKC,YAAY,GAAG,CAAzB,IAA8BD,KAAK,KAAKC,YAAY,GAAG,CAA/E;AAEA,wBACI,oBAAC,aAAD;AACI,MAAA,GAAG,EAAED,KADT;AAEI,MAAA,QAAQ,EAAEe,OAFd;AAGI,MAAA,UAAU,EAAET,0BAA0B,IAAIW,eAH9C;AAII,MAAA,SAAS,EAAED,SAJf;AAKI,MAAA,WAAW,EAAEX;AALjB,MADJ;AASH,GAhBmB,CAApB;AAiBH,CAhCM","sourcesContent":["import React from 'react';\nimport ViewPagerProps, { Loading, PageComponent } from './ViewPagerProps';\nimport ChildrenMemoizedPage from './ChildrenMemoizedPage';\n\nexport interface PageState {\n visited?: boolean;\n}\n\nexport interface PageRenderOption {\n enableVisibleHint: boolean;\n enableNeighborPageRerender: boolean;\n index: number;\n loading: Loading;\n pageComponent: PageComponent;\n pageForceRerenderKey?: any;\n}\n\nexport interface PageRenderer {\n (children: ViewPagerProps['children']): React.ReactNode;\n}\n\nexport const defaultEnableVisibleHint: boolean = false;\n\nexport const defaultEnableNeighborPageRerender: boolean = false;\n\nexport const defaultLoading: Loading = 'lazy';\n\nexport const defaultPageComponent: PageComponent = ChildrenMemoizedPage;\n\nexport const usePageRenderer = ({\n enableVisibleHint,\n index: currentIndex,\n loading,\n pageComponent: PageComponent,\n pageForceRerenderKey,\n enableNeighborPageRerender,\n}: PageRenderOption): PageRenderer => {\n const pagesStateRef = React.useRef<Array<PageState>>([]);\n\n pagesStateRef.current[currentIndex] = {\n ...pagesStateRef.current[currentIndex],\n visited: true,\n };\n\n return (children => React.Children.map(children, (child, index) => {\n const visited = pagesStateRef.current[index]?.visited ?? false;\n const content = (loading === 'eager' || visited) ? child : null;\n\n const isVisible = enableVisibleHint ? (index === currentIndex) : false;\n const isNeighborIndex = index === currentIndex - 1 || index === currentIndex + 1;\n\n return (\n <PageComponent\n key={index}\n children={content}\n isNeighbor={enableNeighborPageRerender && isNeighborIndex}\n isVisible={isVisible}\n rerenderKey={pageForceRerenderKey}\n />\n );\n }));\n};\n"]}
1
+ {"version":3,"names":["ChildrenMemoizedPage","defaultInitialPage","defaultLoading","defaultOffscreenPageRerenderLimit","defaultPageComponent"],"sources":["utils.tsx"],"sourcesContent":["import { Loading, PageComponent } from './ViewPagerProps';\nimport ChildrenMemoizedPage from './ChildrenMemoizedPage';\n\nexport const defaultInitialPage: number = 0;\n\nexport const defaultLoading: Loading = 'lazy';\n\nexport const defaultOffscreenPageRerenderLimit: number = 0;\n\nexport const defaultPageComponent: PageComponent = ChildrenMemoizedPage;\n"],"mappings":"AACA,OAAOA,oBAAP,MAAiC,wBAAjC;AAEA,OAAO,MAAMC,kBAA0B,GAAG,CAAnC;AAEP,OAAO,MAAMC,cAAuB,GAAG,MAAhC;AAEP,OAAO,MAAMC,iCAAyC,GAAG,CAAlD;AAEP,OAAO,MAAMC,oBAAmC,GAAGJ,oBAA5C"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=Viewability.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["Viewability.ts"],"sourcesContent":["export default interface Viewability {\n visible: boolean;\n}\n"],"mappings":""}
@@ -0,0 +1,28 @@
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
+
3
+ import React, { useRef } from 'react';
4
+ import { View } from 'react-native';
5
+ import useViewabilityTracker from './useViewabilityTracker';
6
+ export default function ViewabilityTrackerView(props) {
7
+ const {
8
+ enabled = true,
9
+ measurementIntervalMillis = 1000,
10
+ onViewabilityChange,
11
+ visiblePercentThreshold = 50,
12
+ ...otherProps
13
+ } = props;
14
+ const viewRef = useRef(null);
15
+ useViewabilityTracker({
16
+ enabled,
17
+ measurementIntervalMillis,
18
+ onViewabilityChange,
19
+ viewRef,
20
+ visiblePercentThreshold
21
+ });
22
+ return /*#__PURE__*/React.createElement(View, _extends({}, otherProps, {
23
+ ref: viewRef,
24
+ collapsable: false
25
+ }));
26
+ }
27
+ ;
28
+ //# sourceMappingURL=ViewabilityTrackerView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useRef","View","useViewabilityTracker","ViewabilityTrackerView","props","enabled","measurementIntervalMillis","onViewabilityChange","visiblePercentThreshold","otherProps","viewRef"],"sources":["ViewabilityTrackerView.tsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport { View } from 'react-native';\nimport useViewabilityTracker from './useViewabilityTracker';\nimport type ViewabilityTrackerViewProps from './ViewabilityTrackerViewProps';\n\n\nexport default function ViewabilityTrackerView(props: ViewabilityTrackerViewProps) {\n const {\n enabled = true,\n measurementIntervalMillis = 1000,\n onViewabilityChange,\n visiblePercentThreshold = 50,\n ...otherProps\n } = props;\n\n const viewRef = useRef<View>(null);\n\n useViewabilityTracker({\n enabled,\n measurementIntervalMillis,\n onViewabilityChange,\n viewRef,\n visiblePercentThreshold,\n });\n\n return (\n <View\n {...otherProps}\n ref={viewRef}\n collapsable={false}\n />\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,MAAhB,QAA8B,OAA9B;AACA,SAASC,IAAT,QAAqB,cAArB;AACA,OAAOC,qBAAP,MAAkC,yBAAlC;AAIA,eAAe,SAASC,sBAAT,CAAgCC,KAAhC,EAAoE;EAC/E,MAAM;IACFC,OAAO,GAAG,IADR;IAEFC,yBAAyB,GAAG,IAF1B;IAGFC,mBAHE;IAIFC,uBAAuB,GAAG,EAJxB;IAKF,GAAGC;EALD,IAMFL,KANJ;EAQA,MAAMM,OAAO,GAAGV,MAAM,CAAO,IAAP,CAAtB;EAEAE,qBAAqB,CAAC;IAClBG,OADkB;IAElBC,yBAFkB;IAGlBC,mBAHkB;IAIlBG,OAJkB;IAKlBF;EALkB,CAAD,CAArB;EAQA,oBACI,oBAAC,IAAD,eACQC,UADR;IAEI,GAAG,EAAEC,OAFT;IAGI,WAAW,EAAE;EAHjB,GADJ;AAOH;AAAA"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=ViewabilityTrackerViewProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["ViewabilityTrackerViewProps.ts"],"sourcesContent":["import type { ViewProps } from 'react-native';\nimport type { OverridableComponentProps } from '@fountain-ui/core';\nimport type Viewability from './Viewability';\n\nexport default interface ViewabilityTrackerViewProps extends OverridableComponentProps<ViewProps, {\n /**\n * @default true\n */\n enabled?: boolean;\n\n /**\n * @default 1000\n */\n measurementIntervalMillis?: number;\n\n /**\n *\n */\n onViewabilityChange?: (viewability: Viewability) => void;\n\n /**\n * @default 50\n */\n visiblePercentThreshold?: number;\n}> {}\n"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export { default } from './ViewabilityTrackerView';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["default"],"sources":["index.ts"],"sourcesContent":["export { default } from './ViewabilityTrackerView';\nexport type { default as ViewabilityTrackerViewProps } from './ViewabilityTrackerViewProps';\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,0BAAxB"}
@@ -0,0 +1,34 @@
1
+ const computeRectSize = rect => (rect.bottom - rect.top) * (rect.right - rect.left);
2
+
3
+ const normalizePagePosition = value => value != null && Number.isFinite(value) ? value : Number.MAX_SAFE_INTEGER;
4
+
5
+ const normalizeViewSize = size => Number.isFinite(size) && size > 0 ? size : Number.MAX_SAFE_INTEGER;
6
+
7
+ const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
8
+
9
+ export default function measureViewability(_ref) {
10
+ let {
11
+ view,
12
+ windowWidth,
13
+ windowHeight,
14
+ onViewabilityDetailMeasured
15
+ } = _ref;
16
+ view.measure((x, y, width, height, pageX, pageY) => {
17
+ const safePageX = normalizePagePosition(pageX);
18
+ const safePageY = normalizePagePosition(pageY);
19
+ const visibleRect = {
20
+ top: clamp(safePageY, 0, windowHeight),
21
+ bottom: clamp(safePageY + height, 0, windowHeight),
22
+ left: clamp(safePageX, 0, windowWidth),
23
+ right: clamp(safePageX + width, 0, windowWidth)
24
+ };
25
+ const visibleRectSize = computeRectSize(visibleRect);
26
+ const viewSize = normalizeViewSize(width * height);
27
+ const visiblePercent = Math.round(visibleRectSize / viewSize * 100);
28
+ onViewabilityDetailMeasured === null || onViewabilityDetailMeasured === void 0 ? void 0 : onViewabilityDetailMeasured({
29
+ visiblePercent
30
+ });
31
+ });
32
+ }
33
+ ;
34
+ //# sourceMappingURL=measureViewability.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["computeRectSize","rect","bottom","top","right","left","normalizePagePosition","value","Number","isFinite","MAX_SAFE_INTEGER","normalizeViewSize","size","clamp","min","max","Math","measureViewability","view","windowWidth","windowHeight","onViewabilityDetailMeasured","measure","x","y","width","height","pageX","pageY","safePageX","safePageY","visibleRect","visibleRectSize","viewSize","visiblePercent","round"],"sources":["measureViewability.ts"],"sourcesContent":["import type { View } from 'react-native';\n\ninterface Rect {\n top: number,\n bottom: number;\n left: number;\n right: number;\n}\n\nexport interface ViewabilityDetail {\n visiblePercent: number;\n}\n\nexport interface MeasureViewabilityParameters {\n view: View;\n windowWidth: number;\n windowHeight: number;\n onViewabilityDetailMeasured: (detail: ViewabilityDetail) => void;\n}\n\nconst computeRectSize = (rect: Rect): number =>\n (rect.bottom - rect.top) * (rect.right - rect.left);\n\nconst normalizePagePosition = (value?: number): number =>\n (value != null && Number.isFinite(value)) ? value : Number.MAX_SAFE_INTEGER;\n\nconst normalizeViewSize = (size: number): number =>\n Number.isFinite(size) && size > 0 ? size : Number.MAX_SAFE_INTEGER;\n\nconst clamp = (value: number, min: number, max: number): number =>\n Math.min(Math.max(value, min), max);\n\nexport default function measureViewability({\n view,\n windowWidth,\n windowHeight,\n onViewabilityDetailMeasured,\n}: MeasureViewabilityParameters) {\n view.measure((x, y, width, height, pageX?: number, pageY?: number) => {\n const safePageX = normalizePagePosition(pageX);\n const safePageY = normalizePagePosition(pageY);\n\n const visibleRect: Rect = {\n top: clamp(safePageY, 0, windowHeight),\n bottom: clamp(safePageY + height, 0, windowHeight),\n left: clamp(safePageX, 0, windowWidth),\n right: clamp(safePageX + width, 0, windowWidth),\n };\n\n const visibleRectSize = computeRectSize(visibleRect);\n const viewSize = normalizeViewSize(width * height);\n const visiblePercent = Math.round(visibleRectSize / viewSize * 100);\n\n onViewabilityDetailMeasured?.({ visiblePercent });\n });\n};\n"],"mappings":"AAoBA,MAAMA,eAAe,GAAIC,IAAD,IACpB,CAACA,IAAI,CAACC,MAAL,GAAcD,IAAI,CAACE,GAApB,KAA4BF,IAAI,CAACG,KAAL,GAAaH,IAAI,CAACI,IAA9C,CADJ;;AAGA,MAAMC,qBAAqB,GAAIC,KAAD,IACzBA,KAAK,IAAI,IAAT,IAAiBC,MAAM,CAACC,QAAP,CAAgBF,KAAhB,CAAlB,GAA4CA,KAA5C,GAAoDC,MAAM,CAACE,gBAD/D;;AAGA,MAAMC,iBAAiB,GAAIC,IAAD,IACtBJ,MAAM,CAACC,QAAP,CAAgBG,IAAhB,KAAyBA,IAAI,GAAG,CAAhC,GAAoCA,IAApC,GAA2CJ,MAAM,CAACE,gBADtD;;AAGA,MAAMG,KAAK,GAAG,CAACN,KAAD,EAAgBO,GAAhB,EAA6BC,GAA7B,KACVC,IAAI,CAACF,GAAL,CAASE,IAAI,CAACD,GAAL,CAASR,KAAT,EAAgBO,GAAhB,CAAT,EAA+BC,GAA/B,CADJ;;AAGA,eAAe,SAASE,kBAAT,OAKkB;EAAA,IALU;IACvCC,IADuC;IAEvCC,WAFuC;IAGvCC,YAHuC;IAIvCC;EAJuC,CAKV;EAC7BH,IAAI,CAACI,OAAL,CAAa,CAACC,CAAD,EAAIC,CAAJ,EAAOC,KAAP,EAAcC,MAAd,EAAsBC,KAAtB,EAAsCC,KAAtC,KAAyD;IAClE,MAAMC,SAAS,GAAGvB,qBAAqB,CAACqB,KAAD,CAAvC;IACA,MAAMG,SAAS,GAAGxB,qBAAqB,CAACsB,KAAD,CAAvC;IAEA,MAAMG,WAAiB,GAAG;MACtB5B,GAAG,EAAEU,KAAK,CAACiB,SAAD,EAAY,CAAZ,EAAeV,YAAf,CADY;MAEtBlB,MAAM,EAAEW,KAAK,CAACiB,SAAS,GAAGJ,MAAb,EAAqB,CAArB,EAAwBN,YAAxB,CAFS;MAGtBf,IAAI,EAAEQ,KAAK,CAACgB,SAAD,EAAY,CAAZ,EAAeV,WAAf,CAHW;MAItBf,KAAK,EAAES,KAAK,CAACgB,SAAS,GAAGJ,KAAb,EAAoB,CAApB,EAAuBN,WAAvB;IAJU,CAA1B;IAOA,MAAMa,eAAe,GAAGhC,eAAe,CAAC+B,WAAD,CAAvC;IACA,MAAME,QAAQ,GAAGtB,iBAAiB,CAACc,KAAK,GAAGC,MAAT,CAAlC;IACA,MAAMQ,cAAc,GAAGlB,IAAI,CAACmB,KAAL,CAAWH,eAAe,GAAGC,QAAlB,GAA6B,GAAxC,CAAvB;IAEAZ,2BAA2B,SAA3B,IAAAA,2BAA2B,WAA3B,YAAAA,2BAA2B,CAAG;MAAEa;IAAF,CAAH,CAA3B;EACH,CAhBD;AAiBH;AAAA"}
@@ -0,0 +1,73 @@
1
+ import { useEffect, useRef } from 'react';
2
+ import { useValidWindowDimensions } from '@fountain-ui/core';
3
+ import { useDeferredExecutor } from '../hooks';
4
+ import measureViewability from './measureViewability';
5
+ const initialViewability = {
6
+ visible: false
7
+ };
8
+ export default function useViewabilityTracker(config) {
9
+ const {
10
+ enabled,
11
+ measurementIntervalMillis,
12
+ onViewabilityChange,
13
+ viewRef,
14
+ visiblePercentThreshold
15
+ } = config;
16
+ const viewabilityRef = useRef(initialViewability);
17
+ const executor = useDeferredExecutor();
18
+ const window = useValidWindowDimensions();
19
+
20
+ const maybeMeasureRecursive = () => {
21
+ if (!enabled) {
22
+ return;
23
+ }
24
+
25
+ const mapViewabilityDetailToViewability = detail => {
26
+ return {
27
+ visible: detail.visiblePercent >= visiblePercentThreshold
28
+ };
29
+ };
30
+
31
+ const isViewabilityEquals = (a, b) => {
32
+ return a.visible === b.visible;
33
+ };
34
+
35
+ const dispatchViewabilityChanged = viewability => {
36
+ executor.execute(() => onViewabilityChange === null || onViewabilityChange === void 0 ? void 0 : onViewabilityChange(viewability));
37
+ };
38
+
39
+ const onViewabilityDetailMeasured = detail => {
40
+ const nextViewability = mapViewabilityDetailToViewability(detail);
41
+
42
+ if (!isViewabilityEquals(viewabilityRef.current, nextViewability)) {
43
+ viewabilityRef.current = nextViewability;
44
+ dispatchViewabilityChanged(nextViewability);
45
+ }
46
+
47
+ maybeMeasureRecursive();
48
+ };
49
+
50
+ const maybeMeasure = () => {
51
+ if (viewRef.current) {
52
+ measureViewability({
53
+ view: viewRef.current,
54
+ windowWidth: window.width,
55
+ windowHeight: window.height,
56
+ onViewabilityDetailMeasured
57
+ });
58
+ }
59
+ };
60
+
61
+ executor.execute(maybeMeasure, measurementIntervalMillis);
62
+ };
63
+
64
+ useEffect(() => {
65
+ if (enabled) {
66
+ maybeMeasureRecursive();
67
+ } else {
68
+ executor.cancel();
69
+ }
70
+ }, [enabled]);
71
+ }
72
+ ;
73
+ //# sourceMappingURL=useViewabilityTracker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useRef","useValidWindowDimensions","useDeferredExecutor","measureViewability","initialViewability","visible","useViewabilityTracker","config","enabled","measurementIntervalMillis","onViewabilityChange","viewRef","visiblePercentThreshold","viewabilityRef","executor","window","maybeMeasureRecursive","mapViewabilityDetailToViewability","detail","visiblePercent","isViewabilityEquals","a","b","dispatchViewabilityChanged","viewability","execute","onViewabilityDetailMeasured","nextViewability","current","maybeMeasure","view","windowWidth","width","windowHeight","height","cancel"],"sources":["useViewabilityTracker.ts"],"sourcesContent":["import type { RefObject } from 'react';\nimport { useEffect, useRef } from 'react';\nimport type { View } from 'react-native';\nimport { useValidWindowDimensions } from '@fountain-ui/core';\nimport { useDeferredExecutor } from '../hooks';\nimport type { ViewabilityDetail } from './measureViewability';\nimport measureViewability from './measureViewability';\nimport type Viewability from './Viewability';\n\nexport interface ViewabilityTrackerConfig {\n enabled: boolean;\n measurementIntervalMillis: number;\n onViewabilityChange?: (viewability: Viewability) => void;\n viewRef: RefObject<View>;\n visiblePercentThreshold: number;\n}\n\nconst initialViewability: Readonly<Viewability> = { visible: false };\n\nexport default function useViewabilityTracker(config: ViewabilityTrackerConfig) {\n const {\n enabled,\n measurementIntervalMillis,\n onViewabilityChange,\n viewRef,\n visiblePercentThreshold,\n } = config;\n\n const viewabilityRef = useRef<Viewability>(initialViewability);\n\n const executor = useDeferredExecutor();\n\n const window = useValidWindowDimensions();\n\n const maybeMeasureRecursive = () => {\n if (!enabled) {\n return;\n }\n\n const mapViewabilityDetailToViewability = (detail: ViewabilityDetail): Viewability => {\n return { visible: detail.visiblePercent >= visiblePercentThreshold };\n };\n\n const isViewabilityEquals = (a: Viewability, b: Viewability): boolean => {\n return a.visible === b.visible;\n };\n\n const dispatchViewabilityChanged = (viewability: Viewability) => {\n executor.execute(() => onViewabilityChange?.(viewability));\n };\n\n const onViewabilityDetailMeasured = (detail: ViewabilityDetail) => {\n const nextViewability = mapViewabilityDetailToViewability(detail);\n\n if (!isViewabilityEquals(viewabilityRef.current, nextViewability)) {\n viewabilityRef.current = nextViewability;\n\n dispatchViewabilityChanged(nextViewability);\n }\n\n maybeMeasureRecursive();\n };\n\n const maybeMeasure = () => {\n if (viewRef.current) {\n measureViewability({\n view: viewRef.current,\n windowWidth: window.width,\n windowHeight: window.height,\n onViewabilityDetailMeasured,\n });\n }\n };\n\n executor.execute(maybeMeasure, measurementIntervalMillis);\n };\n\n useEffect(() => {\n if (enabled) {\n maybeMeasureRecursive();\n } else {\n executor.cancel();\n }\n }, [enabled]);\n};\n"],"mappings":"AACA,SAASA,SAAT,EAAoBC,MAApB,QAAkC,OAAlC;AAEA,SAASC,wBAAT,QAAyC,mBAAzC;AACA,SAASC,mBAAT,QAAoC,UAApC;AAEA,OAAOC,kBAAP,MAA+B,sBAA/B;AAWA,MAAMC,kBAAyC,GAAG;EAAEC,OAAO,EAAE;AAAX,CAAlD;AAEA,eAAe,SAASC,qBAAT,CAA+BC,MAA/B,EAAiE;EAC5E,MAAM;IACFC,OADE;IAEFC,yBAFE;IAGFC,mBAHE;IAIFC,OAJE;IAKFC;EALE,IAMFL,MANJ;EAQA,MAAMM,cAAc,GAAGb,MAAM,CAAcI,kBAAd,CAA7B;EAEA,MAAMU,QAAQ,GAAGZ,mBAAmB,EAApC;EAEA,MAAMa,MAAM,GAAGd,wBAAwB,EAAvC;;EAEA,MAAMe,qBAAqB,GAAG,MAAM;IAChC,IAAI,CAACR,OAAL,EAAc;MACV;IACH;;IAED,MAAMS,iCAAiC,GAAIC,MAAD,IAA4C;MAClF,OAAO;QAAEb,OAAO,EAAEa,MAAM,CAACC,cAAP,IAAyBP;MAApC,CAAP;IACH,CAFD;;IAIA,MAAMQ,mBAAmB,GAAG,CAACC,CAAD,EAAiBC,CAAjB,KAA6C;MACrE,OAAOD,CAAC,CAAChB,OAAF,KAAciB,CAAC,CAACjB,OAAvB;IACH,CAFD;;IAIA,MAAMkB,0BAA0B,GAAIC,WAAD,IAA8B;MAC7DV,QAAQ,CAACW,OAAT,CAAiB,MAAMf,mBAAN,aAAMA,mBAAN,uBAAMA,mBAAmB,CAAGc,WAAH,CAA1C;IACH,CAFD;;IAIA,MAAME,2BAA2B,GAAIR,MAAD,IAA+B;MAC/D,MAAMS,eAAe,GAAGV,iCAAiC,CAACC,MAAD,CAAzD;;MAEA,IAAI,CAACE,mBAAmB,CAACP,cAAc,CAACe,OAAhB,EAAyBD,eAAzB,CAAxB,EAAmE;QAC/Dd,cAAc,CAACe,OAAf,GAAyBD,eAAzB;QAEAJ,0BAA0B,CAACI,eAAD,CAA1B;MACH;;MAEDX,qBAAqB;IACxB,CAVD;;IAYA,MAAMa,YAAY,GAAG,MAAM;MACvB,IAAIlB,OAAO,CAACiB,OAAZ,EAAqB;QACjBzB,kBAAkB,CAAC;UACf2B,IAAI,EAAEnB,OAAO,CAACiB,OADC;UAEfG,WAAW,EAAEhB,MAAM,CAACiB,KAFL;UAGfC,YAAY,EAAElB,MAAM,CAACmB,MAHN;UAIfR;QAJe,CAAD,CAAlB;MAMH;IACJ,CATD;;IAWAZ,QAAQ,CAACW,OAAT,CAAiBI,YAAjB,EAA+BpB,yBAA/B;EACH,CAzCD;;EA2CAV,SAAS,CAAC,MAAM;IACZ,IAAIS,OAAJ,EAAa;MACTQ,qBAAqB;IACxB,CAFD,MAEO;MACHF,QAAQ,CAACqB,MAAT;IACH;EACJ,CANQ,EAMN,CAAC3B,OAAD,CANM,CAAT;AAOH;AAAA"}
@@ -1,3 +1,5 @@
1
+ export { default as useDeferredExecutor } from './useDeferredExecutor';
2
+ export { default as useIsMounted } from './useIsMounted';
1
3
  export { default as useUnstableCollapsibleAppBar } from './useUnstableCollapsibleAppBar';
2
4
  export { default as useUnstableToggleDisplayStyle } from './useUnstableToggleDisplayStyle';
3
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":["default","useUnstableCollapsibleAppBar","useUnstableToggleDisplayStyle"],"mappings":"AAAA,SAASA,OAAO,IAAIC,4BAApB,QAAwD,gCAAxD;AACA,SAASD,OAAO,IAAIE,6BAApB,QAAyD,iCAAzD","sourcesContent":["export { default as useUnstableCollapsibleAppBar } from './useUnstableCollapsibleAppBar';\nexport { default as useUnstableToggleDisplayStyle } from './useUnstableToggleDisplayStyle';\n\n"]}
1
+ {"version":3,"names":["default","useDeferredExecutor","useIsMounted","useUnstableCollapsibleAppBar","useUnstableToggleDisplayStyle"],"sources":["index.ts"],"sourcesContent":["export { default as useDeferredExecutor } from './useDeferredExecutor';\nexport { default as useIsMounted } from './useIsMounted';\nexport { default as useUnstableCollapsibleAppBar } from './useUnstableCollapsibleAppBar';\nexport { default as useUnstableToggleDisplayStyle } from './useUnstableToggleDisplayStyle';\n\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,mBAApB,QAA+C,uBAA/C;AACA,SAASD,OAAO,IAAIE,YAApB,QAAwC,gBAAxC;AACA,SAASF,OAAO,IAAIG,4BAApB,QAAwD,gCAAxD;AACA,SAASH,OAAO,IAAII,6BAApB,QAAyD,iCAAzD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["useAppbarStyles.ts"],"names":["useAppBarStyles","floating","position","top","left","right"],"mappings":"AAIA,MAAMA,eAAwC,GAAG,YAA0B;AACvE,SAAO;AACHC,IAAAA,QAAQ,EAAE;AACNC,MAAAA,QAAQ,EAAE,UADJ;AAENC,MAAAA,GAAG,EAAE,CAFC;AAGNC,MAAAA,IAAI,EAAE,CAHA;AAINC,MAAAA,KAAK,EAAE;AAJD;AADP,GAAP;AAQH,CATD;;AAWA,eAAeL,eAAf","sourcesContent":["import { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\n\ntype AppBarStyles = NamedStylesStringUnion<'floating'>;\n\nconst useAppBarStyles: UseStyles<AppBarStyles> = function (): AppBarStyles {\n return {\n floating: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n },\n };\n};\n\nexport default useAppBarStyles;"]}
1
+ {"version":3,"names":["useAppBarStyles","floating","position","top","left","right"],"sources":["useAppbarStyles.ts"],"sourcesContent":["import { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\n\ntype AppBarStyles = NamedStylesStringUnion<'floating'>;\n\nconst useAppBarStyles: UseStyles<AppBarStyles> = function (): AppBarStyles {\n return {\n floating: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n },\n };\n};\n\nexport default useAppBarStyles;"],"mappings":"AAIA,MAAMA,eAAwC,GAAG,YAA0B;EACvE,OAAO;IACHC,QAAQ,EAAE;MACNC,QAAQ,EAAE,UADJ;MAENC,GAAG,EAAE,CAFC;MAGNC,IAAI,EAAE,CAHA;MAINC,KAAK,EAAE;IAJD;EADP,CAAP;AAQH,CATD;;AAWA,eAAeL,eAAf"}
@@ -0,0 +1,33 @@
1
+ import { useCallback, useEffect, useRef } from 'react';
2
+ import useIsMounted from './useIsMounted';
3
+ export default function useDeferredExecutor() {
4
+ const isMounted = useIsMounted();
5
+ const timeoutIdRef = useRef(null);
6
+ const cancel = useCallback(() => {
7
+ if (timeoutIdRef.current) {
8
+ clearTimeout(timeoutIdRef.current);
9
+ }
10
+ }, []);
11
+ useEffect(() => {
12
+ return cancel;
13
+ }, []);
14
+ const execute = useCallback((runnable, delay) => {
15
+ if (!isMounted()) {
16
+ return;
17
+ }
18
+
19
+ cancel();
20
+
21
+ if (Number.isFinite(delay)) {
22
+ timeoutIdRef.current = setTimeout(() => runnable(), delay);
23
+ } else {
24
+ runnable();
25
+ }
26
+ }, []);
27
+ return {
28
+ cancel,
29
+ execute
30
+ };
31
+ }
32
+ ;
33
+ //# sourceMappingURL=useDeferredExecutor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useEffect","useRef","useIsMounted","useDeferredExecutor","isMounted","timeoutIdRef","cancel","current","clearTimeout","execute","runnable","delay","Number","isFinite","setTimeout"],"sources":["useDeferredExecutor.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\nimport useIsMounted from './useIsMounted';\n\nexport interface Runnable {\n (): void;\n}\n\nexport interface DeferredExecute {\n (runnable: Runnable, delay?: number): void;\n}\n\nexport interface DeferredExecutor {\n cancel: () => void;\n execute: DeferredExecute;\n}\n\nexport default function useDeferredExecutor(): DeferredExecutor {\n const isMounted = useIsMounted();\n const timeoutIdRef = useRef<NodeJS.Timer | null>(null);\n\n const cancel = useCallback(() => {\n if (timeoutIdRef.current) {\n clearTimeout(timeoutIdRef.current);\n }\n }, []);\n\n useEffect(() => {\n return cancel;\n }, []);\n\n const execute = useCallback<DeferredExecute>((runnable, delay) => {\n if (!isMounted()) {\n return;\n }\n\n cancel();\n\n if (Number.isFinite(delay)) {\n timeoutIdRef.current = setTimeout(() => runnable(), delay);\n } else {\n runnable();\n }\n }, []);\n\n return { cancel, execute };\n};\n"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,SAAtB,EAAiCC,MAAjC,QAA+C,OAA/C;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AAeA,eAAe,SAASC,mBAAT,GAAiD;EAC5D,MAAMC,SAAS,GAAGF,YAAY,EAA9B;EACA,MAAMG,YAAY,GAAGJ,MAAM,CAAsB,IAAtB,CAA3B;EAEA,MAAMK,MAAM,GAAGP,WAAW,CAAC,MAAM;IAC7B,IAAIM,YAAY,CAACE,OAAjB,EAA0B;MACtBC,YAAY,CAACH,YAAY,CAACE,OAAd,CAAZ;IACH;EACJ,CAJyB,EAIvB,EAJuB,CAA1B;EAMAP,SAAS,CAAC,MAAM;IACZ,OAAOM,MAAP;EACH,CAFQ,EAEN,EAFM,CAAT;EAIA,MAAMG,OAAO,GAAGV,WAAW,CAAkB,CAACW,QAAD,EAAWC,KAAX,KAAqB;IAC9D,IAAI,CAACP,SAAS,EAAd,EAAkB;MACd;IACH;;IAEDE,MAAM;;IAEN,IAAIM,MAAM,CAACC,QAAP,CAAgBF,KAAhB,CAAJ,EAA4B;MACxBN,YAAY,CAACE,OAAb,GAAuBO,UAAU,CAAC,MAAMJ,QAAQ,EAAf,EAAmBC,KAAnB,CAAjC;IACH,CAFD,MAEO;MACHD,QAAQ;IACX;EACJ,CAZ0B,EAYxB,EAZwB,CAA3B;EAcA,OAAO;IAAEJ,MAAF;IAAUG;EAAV,CAAP;AACH;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["useElevationStyle.ts"],"names":["Platform","useTheme","useElevationStyle","elevation","theme","shadow","select","android","ios","web","boxShadow"],"mappings":"AAAA,SAASA,QAAT,QAAyB,cAAzB;AAEA,SAASC,QAAT,QAAyB,qBAAzB;AAEA,eAAe,SAASC,iBAAT,CAA2BC,SAA3B,EAAiD;AAC5D,QAAMC,KAAK,GAAGH,QAAQ,EAAtB;AACA,QAAMI,MAAM,GAAGD,KAAK,CAACC,MAAN,CAAaF,SAAb,CAAf;AAEA,SAAOH,QAAQ,CAACM,MAAT,CAAqB;AACxBC,IAAAA,OAAO,EAAEF,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAEF,SADO;AAExBK,IAAAA,GAAG,EAAEH,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAEA,MAFW;AAGxBI,IAAAA,GAAG,EAAEJ,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAEK;AAHW,GAArB,CAAP;AAKH;AAAA","sourcesContent":["import { Platform } from 'react-native';\nimport type { Elevation } from '@fountain-ui/styles';\nimport { useTheme } from '@fountain-ui/styles';\n\nexport default function useElevationStyle(elevation: Elevation) {\n const theme = useTheme();\n const shadow = theme.shadow[elevation];\n\n return Platform.select<any>({\n android: shadow?.elevation,\n ios: shadow?.shadow,\n web: shadow?.boxShadow,\n });\n};\n"]}
1
+ {"version":3,"names":["Platform","useTheme","useElevationStyle","elevation","theme","shadow","select","android","ios","web","boxShadow"],"sources":["useElevationStyle.ts"],"sourcesContent":["import { Platform } from 'react-native';\nimport type { Elevation } from '@fountain-ui/styles';\nimport { useTheme } from '@fountain-ui/styles';\n\nexport default function useElevationStyle(elevation: Elevation) {\n const theme = useTheme();\n const shadow = theme.shadow[elevation];\n\n return Platform.select<any>({\n android: shadow?.elevation,\n ios: shadow?.shadow,\n web: shadow?.boxShadow,\n });\n};\n"],"mappings":"AAAA,SAASA,QAAT,QAAyB,cAAzB;AAEA,SAASC,QAAT,QAAyB,qBAAzB;AAEA,eAAe,SAASC,iBAAT,CAA2BC,SAA3B,EAAiD;EAC5D,MAAMC,KAAK,GAAGH,QAAQ,EAAtB;EACA,MAAMI,MAAM,GAAGD,KAAK,CAACC,MAAN,CAAaF,SAAb,CAAf;EAEA,OAAOH,QAAQ,CAACM,MAAT,CAAqB;IACxBC,OAAO,EAAEF,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAEF,SADO;IAExBK,GAAG,EAAEH,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAEA,MAFW;IAGxBI,GAAG,EAAEJ,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAEK;EAHW,CAArB,CAAP;AAKH;AAAA"}
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
- import Animated from 'react-native-reanimated';
3
- export default function useHeight(initialHeight = 0) {
2
+ import { useWorkletCallback } from 'react-native-reanimated';
3
+ export default function useHeight() {
4
+ let initialHeight = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
4
5
  const [height, setHeight] = React.useState(initialHeight);
5
- const onLayout = Animated.useWorkletCallback(e => {
6
+ const onLayout = useWorkletCallback(e => {
6
7
  setHeight(e.nativeEvent.layout.height);
7
8
  }, []);
8
9
  return [height, onLayout];
@@ -1 +1 @@
1
- {"version":3,"sources":["useHeight.ts"],"names":["React","Animated","useHeight","initialHeight","height","setHeight","useState","onLayout","useWorkletCallback","e","nativeEvent","layout"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,OAAOC,QAAP,MAAqB,yBAArB;AAIA,eAAe,SAASC,SAAT,CAAmBC,aAAa,GAAG,CAAnC,EAAkE;AAC7E,QAAM,CAACC,MAAD,EAASC,SAAT,IAAsBL,KAAK,CAACM,QAAN,CAAuBH,aAAvB,CAA5B;AAEA,QAAMI,QAAQ,GAAGN,QAAQ,CAACO,kBAAT,CAA6BC,CAAD,IAAO;AAChDJ,IAAAA,SAAS,CAACI,CAAC,CAACC,WAAF,CAAcC,MAAd,CAAqBP,MAAtB,CAAT;AACH,GAFgB,EAEd,EAFc,CAAjB;AAIA,SAAO,CAACA,MAAD,EAASG,QAAT,CAAP;AACH;AAAA","sourcesContent":["import React from 'react';\nimport { ViewProps } from 'react-native';\nimport Animated from 'react-native-reanimated';\n\ntype OnLayoutCallback = ViewProps['onLayout'];\n\nexport default function useHeight(initialHeight = 0): [number, OnLayoutCallback] {\n const [height, setHeight] = React.useState<number>(initialHeight);\n\n const onLayout = Animated.useWorkletCallback((e) => {\n setHeight(e.nativeEvent.layout.height);\n }, []);\n\n return [height, onLayout];\n};\n"]}
1
+ {"version":3,"names":["React","useWorkletCallback","useHeight","initialHeight","height","setHeight","useState","onLayout","e","nativeEvent","layout"],"sources":["useHeight.ts"],"sourcesContent":["import React from 'react';\nimport { ViewProps } from 'react-native';\nimport { useWorkletCallback } from 'react-native-reanimated';\n\ntype OnLayoutCallback = ViewProps['onLayout'];\n\nexport default function useHeight(initialHeight = 0): [number, OnLayoutCallback] {\n const [height, setHeight] = React.useState<number>(initialHeight);\n\n const onLayout = useWorkletCallback((e) => {\n setHeight(e.nativeEvent.layout.height);\n }, []);\n\n return [height, onLayout];\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,kBAAT,QAAmC,yBAAnC;AAIA,eAAe,SAASC,SAAT,GAAkE;EAAA,IAA/CC,aAA+C,uEAA/B,CAA+B;EAC7E,MAAM,CAACC,MAAD,EAASC,SAAT,IAAsBL,KAAK,CAACM,QAAN,CAAuBH,aAAvB,CAA5B;EAEA,MAAMI,QAAQ,GAAGN,kBAAkB,CAAEO,CAAD,IAAO;IACvCH,SAAS,CAACG,CAAC,CAACC,WAAF,CAAcC,MAAd,CAAqBN,MAAtB,CAAT;EACH,CAFkC,EAEhC,EAFgC,CAAnC;EAIA,OAAO,CAACA,MAAD,EAASG,QAAT,CAAP;AACH;AAAA"}
@@ -0,0 +1,13 @@
1
+ import { useCallback, useEffect, useRef } from 'react';
2
+ export default function useIsMounted() {
3
+ const mountedRef = useRef(false);
4
+ useEffect(() => {
5
+ mountedRef.current = true;
6
+ return () => {
7
+ mountedRef.current = false;
8
+ };
9
+ }, []);
10
+ return useCallback(() => mountedRef.current, []);
11
+ }
12
+ ;
13
+ //# sourceMappingURL=useIsMounted.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useEffect","useRef","useIsMounted","mountedRef","current"],"sources":["useIsMounted.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\n\nexport interface UseIsMounted {\n (): boolean;\n}\n\nexport default function useIsMounted(): UseIsMounted {\n const mountedRef = useRef<boolean>(false);\n\n useEffect(() => {\n mountedRef.current = true;\n\n return () => {\n mountedRef.current = false;\n };\n }, []);\n\n return useCallback(() => mountedRef.current, []);\n};\n"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,SAAtB,EAAiCC,MAAjC,QAA+C,OAA/C;AAMA,eAAe,SAASC,YAAT,GAAsC;EACjD,MAAMC,UAAU,GAAGF,MAAM,CAAU,KAAV,CAAzB;EAEAD,SAAS,CAAC,MAAM;IACZG,UAAU,CAACC,OAAX,GAAqB,IAArB;IAEA,OAAO,MAAM;MACTD,UAAU,CAACC,OAAX,GAAqB,KAArB;IACH,CAFD;EAGH,CANQ,EAMN,EANM,CAAT;EAQA,OAAOL,WAAW,CAAC,MAAMI,UAAU,CAACC,OAAlB,EAA2B,EAA3B,CAAlB;AACH;AAAA"}