@fountain-ui/lab 2.0.0-beta.10 → 2.0.0-beta.13

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 (266) hide show
  1. package/build/commonjs/Carousel/Carousel.js +142 -0
  2. package/build/commonjs/Carousel/Carousel.js.map +1 -0
  3. package/build/commonjs/Carousel/CarouselProps.js.map +1 -1
  4. package/build/commonjs/Carousel/animation/animationUtils.js +9 -0
  5. package/build/commonjs/Carousel/animation/animationUtils.js.map +1 -0
  6. package/build/commonjs/Carousel/animation/createDefaultItemStyle.js +15 -0
  7. package/build/commonjs/Carousel/animation/createDefaultItemStyle.js.map +1 -0
  8. package/build/commonjs/Carousel/animation/createDefaultScrollAnimation.js +20 -0
  9. package/build/commonjs/Carousel/animation/createDefaultScrollAnimation.js.map +1 -0
  10. package/build/commonjs/Carousel/animation/index.js +40 -0
  11. package/build/commonjs/Carousel/animation/index.js.map +1 -0
  12. package/build/commonjs/Carousel/animation/normalItemStyleFactory.js +27 -0
  13. package/build/commonjs/Carousel/animation/normalItemStyleFactory.js.map +1 -0
  14. package/build/commonjs/Carousel/animation/parallaxItemStyleFactory.js +65 -0
  15. package/build/commonjs/Carousel/animation/parallaxItemStyleFactory.js.map +1 -0
  16. package/build/commonjs/Carousel/components/InternalContext.js +29 -0
  17. package/build/commonjs/Carousel/components/InternalContext.js.map +1 -0
  18. package/build/commonjs/Carousel/components/ItemView.js +66 -0
  19. package/build/commonjs/Carousel/components/ItemView.js.map +1 -0
  20. package/build/commonjs/Carousel/components/RootView.js +86 -0
  21. package/build/commonjs/Carousel/components/RootView.js.map +1 -0
  22. package/build/commonjs/Carousel/components/ScrollViewGesture.js +81 -0
  23. package/build/commonjs/Carousel/components/ScrollViewGesture.js.map +1 -0
  24. package/build/commonjs/Carousel/components/index.js +40 -0
  25. package/build/commonjs/Carousel/components/index.js.map +1 -0
  26. package/build/commonjs/Carousel/hooks/index.js +64 -0
  27. package/build/commonjs/Carousel/hooks/index.js.map +1 -0
  28. package/build/commonjs/Carousel/hooks/useAutoplayController.js +58 -0
  29. package/build/commonjs/Carousel/hooks/useAutoplayController.js.map +1 -0
  30. package/build/commonjs/Carousel/hooks/useDimensionChangeReaction.js +23 -0
  31. package/build/commonjs/Carousel/hooks/useDimensionChangeReaction.js.map +1 -0
  32. package/build/commonjs/Carousel/hooks/useIndexController.js +70 -0
  33. package/build/commonjs/Carousel/hooks/useIndexController.js.map +1 -0
  34. package/build/commonjs/Carousel/hooks/useItemInterpolation.js +63 -0
  35. package/build/commonjs/Carousel/hooks/useItemInterpolation.js.map +1 -0
  36. package/build/commonjs/Carousel/hooks/useItemVisibilityStore.js +95 -0
  37. package/build/commonjs/Carousel/hooks/useItemVisibilityStore.js.map +1 -0
  38. package/build/commonjs/Carousel/hooks/useLoopedData.js +33 -0
  39. package/build/commonjs/Carousel/hooks/useLoopedData.js.map +1 -0
  40. package/build/commonjs/Carousel/hooks/usePagingAnimation.js +162 -0
  41. package/build/commonjs/Carousel/hooks/usePagingAnimation.js.map +1 -0
  42. package/build/commonjs/Carousel/index.js +16 -2
  43. package/build/commonjs/Carousel/index.js.map +1 -1
  44. package/build/commonjs/Carousel/types.js +7 -0
  45. package/build/commonjs/Carousel/types.js.map +1 -0
  46. package/build/commonjs/ViewPager/ChildrenMemoizedPage.js +86 -21
  47. package/build/commonjs/ViewPager/ChildrenMemoizedPage.js.map +1 -1
  48. package/build/commonjs/ViewPager/PageStateContext.js +22 -0
  49. package/build/commonjs/ViewPager/PageStateContext.js.map +1 -0
  50. package/build/commonjs/ViewPager/ViewPagerNative.js +82 -34
  51. package/build/commonjs/ViewPager/ViewPagerNative.js.map +1 -1
  52. package/build/commonjs/ViewPager/ViewPagerProps.js.map +1 -1
  53. package/build/commonjs/ViewPager/ViewPagerWeb.js +35 -26
  54. package/build/commonjs/ViewPager/ViewPagerWeb.js.map +1 -1
  55. package/build/commonjs/ViewPager/index.js +8 -0
  56. package/build/commonjs/ViewPager/index.js.map +1 -1
  57. package/build/commonjs/ViewPager/index.native.js +8 -0
  58. package/build/commonjs/ViewPager/index.native.js.map +1 -1
  59. package/build/commonjs/ViewPager/utils.js +5 -41
  60. package/build/commonjs/ViewPager/utils.js.map +1 -1
  61. package/build/commonjs/ViewabilityTrackerView/Viewability.js +2 -0
  62. package/build/commonjs/ViewabilityTrackerView/Viewability.js.map +1 -0
  63. package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerView.js +45 -0
  64. package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerView.js.map +1 -0
  65. package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerViewProps.js +2 -0
  66. package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerViewProps.js.map +1 -0
  67. package/build/commonjs/{Carousel/index.native.js → ViewabilityTrackerView/index.js} +3 -3
  68. package/build/commonjs/ViewabilityTrackerView/index.js.map +1 -0
  69. package/build/commonjs/ViewabilityTrackerView/measureViewability.js +42 -0
  70. package/build/commonjs/ViewabilityTrackerView/measureViewability.js.map +1 -0
  71. package/build/commonjs/ViewabilityTrackerView/useViewabilityTracker.js +88 -0
  72. package/build/commonjs/ViewabilityTrackerView/useViewabilityTracker.js.map +1 -0
  73. package/build/commonjs/hooks/index.js +16 -0
  74. package/build/commonjs/hooks/index.js.map +1 -1
  75. package/build/commonjs/hooks/useDeferredExecutor.js +45 -0
  76. package/build/commonjs/hooks/useDeferredExecutor.js.map +1 -0
  77. package/build/commonjs/hooks/useIsMounted.js +22 -0
  78. package/build/commonjs/hooks/useIsMounted.js.map +1 -0
  79. package/build/commonjs/index.js +22 -1
  80. package/build/commonjs/index.js.map +1 -1
  81. package/build/module/Carousel/Carousel.js +120 -0
  82. package/build/module/Carousel/Carousel.js.map +1 -0
  83. package/build/module/Carousel/CarouselProps.js.map +1 -1
  84. package/build/module/Carousel/animation/animationUtils.js +2 -0
  85. package/build/module/Carousel/animation/animationUtils.js.map +1 -0
  86. package/build/module/Carousel/animation/createDefaultItemStyle.js +3 -0
  87. package/build/module/Carousel/animation/createDefaultItemStyle.js.map +1 -0
  88. package/build/module/Carousel/animation/createDefaultScrollAnimation.js +11 -0
  89. package/build/module/Carousel/animation/createDefaultScrollAnimation.js.map +1 -0
  90. package/build/module/Carousel/animation/index.js +5 -0
  91. package/build/module/Carousel/animation/index.js.map +1 -0
  92. package/build/module/Carousel/animation/normalItemStyleFactory.js +18 -0
  93. package/build/module/Carousel/animation/normalItemStyleFactory.js.map +1 -0
  94. package/build/module/Carousel/animation/parallaxItemStyleFactory.js +55 -0
  95. package/build/module/Carousel/animation/parallaxItemStyleFactory.js.map +1 -0
  96. package/build/module/Carousel/components/InternalContext.js +19 -0
  97. package/build/module/Carousel/components/InternalContext.js.map +1 -0
  98. package/build/module/Carousel/components/ItemView.js +46 -0
  99. package/build/module/Carousel/components/ItemView.js.map +1 -0
  100. package/build/module/Carousel/components/RootView.js +65 -0
  101. package/build/module/Carousel/components/RootView.js.map +1 -0
  102. package/build/module/Carousel/components/ScrollViewGesture.js +67 -0
  103. package/build/module/Carousel/components/ScrollViewGesture.js.map +1 -0
  104. package/build/module/Carousel/components/index.js +5 -0
  105. package/build/module/Carousel/components/index.js.map +1 -0
  106. package/build/module/Carousel/hooks/index.js +8 -0
  107. package/build/module/Carousel/hooks/index.js.map +1 -0
  108. package/build/module/Carousel/hooks/useAutoplayController.js +48 -0
  109. package/build/module/Carousel/hooks/useAutoplayController.js.map +1 -0
  110. package/build/module/Carousel/hooks/useDimensionChangeReaction.js +14 -0
  111. package/build/module/Carousel/hooks/useDimensionChangeReaction.js.map +1 -0
  112. package/build/module/Carousel/hooks/useIndexController.js +54 -0
  113. package/build/module/Carousel/hooks/useIndexController.js.map +1 -0
  114. package/build/module/Carousel/hooks/useItemInterpolation.js +51 -0
  115. package/build/module/Carousel/hooks/useItemInterpolation.js.map +1 -0
  116. package/build/module/Carousel/hooks/useItemVisibilityStore.js +87 -0
  117. package/build/module/Carousel/hooks/useItemVisibilityStore.js.map +1 -0
  118. package/build/module/Carousel/hooks/useLoopedData.js +24 -0
  119. package/build/module/Carousel/hooks/useLoopedData.js.map +1 -0
  120. package/build/module/Carousel/hooks/usePagingAnimation.js +153 -0
  121. package/build/module/Carousel/hooks/usePagingAnimation.js.map +1 -0
  122. package/build/module/Carousel/index.js +2 -1
  123. package/build/module/Carousel/index.js.map +1 -1
  124. package/build/module/Carousel/types.js +3 -0
  125. package/build/module/Carousel/types.js.map +1 -0
  126. package/build/module/ViewPager/ChildrenMemoizedPage.js +80 -23
  127. package/build/module/ViewPager/ChildrenMemoizedPage.js.map +1 -1
  128. package/build/module/ViewPager/PageStateContext.js +10 -0
  129. package/build/module/ViewPager/PageStateContext.js.map +1 -0
  130. package/build/module/ViewPager/ViewPagerNative.js +81 -34
  131. package/build/module/ViewPager/ViewPagerNative.js.map +1 -1
  132. package/build/module/ViewPager/ViewPagerProps.js.map +1 -1
  133. package/build/module/ViewPager/ViewPagerWeb.js +29 -24
  134. package/build/module/ViewPager/ViewPagerWeb.js.map +1 -1
  135. package/build/module/ViewPager/index.js +1 -0
  136. package/build/module/ViewPager/index.js.map +1 -1
  137. package/build/module/ViewPager/index.native.js +1 -0
  138. package/build/module/ViewPager/index.native.js.map +1 -1
  139. package/build/module/ViewPager/utils.js +2 -32
  140. package/build/module/ViewPager/utils.js.map +1 -1
  141. package/build/module/ViewabilityTrackerView/Viewability.js +2 -0
  142. package/build/module/ViewabilityTrackerView/Viewability.js.map +1 -0
  143. package/build/module/ViewabilityTrackerView/ViewabilityTrackerView.js +28 -0
  144. package/build/module/ViewabilityTrackerView/ViewabilityTrackerView.js.map +1 -0
  145. package/build/module/ViewabilityTrackerView/ViewabilityTrackerViewProps.js +2 -0
  146. package/build/module/ViewabilityTrackerView/ViewabilityTrackerViewProps.js.map +1 -0
  147. package/build/module/ViewabilityTrackerView/index.js +2 -0
  148. package/build/module/ViewabilityTrackerView/index.js.map +1 -0
  149. package/build/module/ViewabilityTrackerView/measureViewability.js +34 -0
  150. package/build/module/ViewabilityTrackerView/measureViewability.js.map +1 -0
  151. package/build/module/ViewabilityTrackerView/useViewabilityTracker.js +73 -0
  152. package/build/module/ViewabilityTrackerView/useViewabilityTracker.js.map +1 -0
  153. package/build/module/hooks/index.js +2 -0
  154. package/build/module/hooks/index.js.map +1 -1
  155. package/build/module/hooks/useDeferredExecutor.js +33 -0
  156. package/build/module/hooks/useDeferredExecutor.js.map +1 -0
  157. package/build/module/hooks/useIsMounted.js +13 -0
  158. package/build/module/hooks/useIsMounted.js.map +1 -0
  159. package/build/module/index.js +2 -0
  160. package/build/module/index.js.map +1 -1
  161. package/build/typescript/Carousel/Carousel.d.ts +5 -0
  162. package/build/typescript/Carousel/CarouselProps.d.ts +33 -48
  163. package/build/typescript/Carousel/animation/animationUtils.d.ts +1 -0
  164. package/build/typescript/Carousel/animation/createDefaultItemStyle.d.ts +2 -0
  165. package/build/typescript/Carousel/animation/createDefaultScrollAnimation.d.ts +2 -0
  166. package/build/typescript/Carousel/animation/index.d.ts +4 -0
  167. package/build/typescript/Carousel/animation/normalItemStyleFactory.d.ts +2 -0
  168. package/build/typescript/Carousel/animation/parallaxItemStyleFactory.d.ts +9 -0
  169. package/build/typescript/Carousel/components/InternalContext.d.ts +14 -0
  170. package/build/typescript/Carousel/components/ItemView.d.ts +9 -0
  171. package/build/typescript/Carousel/components/RootView.d.ts +16 -0
  172. package/build/typescript/Carousel/components/ScrollViewGesture.d.ts +12 -0
  173. package/build/typescript/Carousel/components/index.d.ts +4 -0
  174. package/build/typescript/Carousel/hooks/index.d.ts +7 -0
  175. package/build/typescript/Carousel/hooks/useAutoplayController.d.ts +7 -0
  176. package/build/typescript/Carousel/hooks/useDimensionChangeReaction.d.ts +7 -0
  177. package/build/typescript/Carousel/hooks/useIndexController.d.ts +10 -0
  178. package/build/typescript/Carousel/hooks/useItemInterpolation.d.ts +2 -0
  179. package/build/typescript/Carousel/hooks/useItemVisibilityStore.d.ts +7 -0
  180. package/build/typescript/Carousel/hooks/useLoopedData.d.ts +1 -0
  181. package/build/typescript/Carousel/hooks/usePagingAnimation.d.ts +18 -0
  182. package/build/typescript/Carousel/index.d.ts +3 -1
  183. package/build/typescript/Carousel/types.d.ts +79 -0
  184. package/build/typescript/ViewPager/ChildrenMemoizedPage.d.ts +2 -1
  185. package/build/typescript/ViewPager/PageStateContext.d.ts +7 -0
  186. package/build/typescript/ViewPager/ViewPagerNative.d.ts +4 -1
  187. package/build/typescript/ViewPager/ViewPagerProps.d.ts +31 -19
  188. package/build/typescript/ViewPager/ViewPagerWeb.d.ts +4 -1
  189. package/build/typescript/ViewPager/index.d.ts +2 -1
  190. package/build/typescript/ViewPager/index.native.d.ts +1 -0
  191. package/build/typescript/ViewPager/utils.d.ts +3 -19
  192. package/build/typescript/ViewabilityTrackerView/Viewability.d.ts +3 -0
  193. package/build/typescript/ViewabilityTrackerView/ViewabilityTrackerView.d.ts +2 -0
  194. package/build/typescript/ViewabilityTrackerView/ViewabilityTrackerViewProps.d.ts +22 -0
  195. package/build/typescript/ViewabilityTrackerView/index.d.ts +2 -0
  196. package/build/typescript/ViewabilityTrackerView/measureViewability.d.ts +11 -0
  197. package/build/typescript/ViewabilityTrackerView/useViewabilityTracker.d.ts +11 -0
  198. package/build/typescript/hooks/index.d.ts +2 -0
  199. package/build/typescript/hooks/useDeferredExecutor.d.ts +11 -0
  200. package/build/typescript/hooks/useIsMounted.d.ts +4 -0
  201. package/build/typescript/index.d.ts +2 -0
  202. package/package.json +4 -19
  203. package/src/Carousel/Carousel.tsx +152 -0
  204. package/src/Carousel/CarouselProps.ts +35 -53
  205. package/src/Carousel/animation/animationUtils.ts +1 -0
  206. package/src/Carousel/animation/createDefaultItemStyle.ts +3 -0
  207. package/src/Carousel/animation/createDefaultScrollAnimation.ts +13 -0
  208. package/src/Carousel/animation/index.ts +4 -0
  209. package/src/Carousel/animation/normalItemStyleFactory.ts +19 -0
  210. package/src/Carousel/animation/parallaxItemStyleFactory.ts +79 -0
  211. package/src/Carousel/components/InternalContext.ts +33 -0
  212. package/src/Carousel/components/ItemView.tsx +66 -0
  213. package/src/Carousel/components/RootView.tsx +79 -0
  214. package/src/Carousel/components/ScrollViewGesture.tsx +87 -0
  215. package/src/Carousel/components/index.ts +4 -0
  216. package/src/Carousel/hooks/index.ts +7 -0
  217. package/src/Carousel/hooks/useAutoplayController.ts +57 -0
  218. package/src/Carousel/hooks/useDimensionChangeReaction.ts +25 -0
  219. package/src/Carousel/hooks/useIndexController.tsx +76 -0
  220. package/src/Carousel/hooks/useItemInterpolation.ts +107 -0
  221. package/src/Carousel/hooks/useItemVisibilityStore.ts +107 -0
  222. package/src/Carousel/hooks/useLoopedData.ts +26 -0
  223. package/src/Carousel/hooks/usePagingAnimation.ts +195 -0
  224. package/src/Carousel/index.ts +4 -2
  225. package/src/Carousel/types.ts +97 -0
  226. package/src/ViewPager/ChildrenMemoizedPage.tsx +97 -23
  227. package/src/ViewPager/PageStateContext.ts +15 -0
  228. package/src/ViewPager/ViewPagerNative.tsx +101 -39
  229. package/src/ViewPager/ViewPagerProps.ts +33 -19
  230. package/src/ViewPager/ViewPagerWeb.tsx +38 -29
  231. package/src/ViewPager/index.native.ts +1 -0
  232. package/src/ViewPager/index.ts +2 -1
  233. package/src/ViewPager/utils.tsx +4 -56
  234. package/src/ViewabilityTrackerView/Viewability.ts +3 -0
  235. package/src/ViewabilityTrackerView/ViewabilityTrackerView.tsx +33 -0
  236. package/src/ViewabilityTrackerView/ViewabilityTrackerViewProps.ts +25 -0
  237. package/src/ViewabilityTrackerView/index.ts +2 -0
  238. package/src/ViewabilityTrackerView/measureViewability.ts +56 -0
  239. package/src/ViewabilityTrackerView/useViewabilityTracker.ts +85 -0
  240. package/src/hooks/index.ts +2 -0
  241. package/src/hooks/useDeferredExecutor.ts +46 -0
  242. package/src/hooks/useIsMounted.ts +19 -0
  243. package/src/index.ts +3 -0
  244. package/build/commonjs/Carousel/CarouselNative.js +0 -72
  245. package/build/commonjs/Carousel/CarouselNative.js.map +0 -1
  246. package/build/commonjs/Carousel/CarouselWeb.js +0 -237
  247. package/build/commonjs/Carousel/CarouselWeb.js.map +0 -1
  248. package/build/commonjs/Carousel/index.native.js.map +0 -1
  249. package/build/commonjs/Carousel/utils.js +0 -19
  250. package/build/commonjs/Carousel/utils.js.map +0 -1
  251. package/build/module/Carousel/CarouselNative.js +0 -54
  252. package/build/module/Carousel/CarouselNative.js.map +0 -1
  253. package/build/module/Carousel/CarouselWeb.js +0 -215
  254. package/build/module/Carousel/CarouselWeb.js.map +0 -1
  255. package/build/module/Carousel/index.native.js +0 -2
  256. package/build/module/Carousel/index.native.js.map +0 -1
  257. package/build/module/Carousel/utils.js +0 -7
  258. package/build/module/Carousel/utils.js.map +0 -1
  259. package/build/typescript/Carousel/CarouselNative.d.ts +0 -2
  260. package/build/typescript/Carousel/CarouselWeb.d.ts +0 -4
  261. package/build/typescript/Carousel/index.native.d.ts +0 -1
  262. package/build/typescript/Carousel/utils.d.ts +0 -6
  263. package/src/Carousel/CarouselNative.tsx +0 -67
  264. package/src/Carousel/CarouselWeb.tsx +0 -222
  265. package/src/Carousel/index.native.ts +0 -1
  266. package/src/Carousel/utils.ts +0 -11
@@ -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,"names":["default","useUnstableCollapsibleAppBar","useUnstableToggleDisplayStyle"],"sources":["index.ts"],"sourcesContent":["export { default as useUnstableCollapsibleAppBar } from './useUnstableCollapsibleAppBar';\nexport { default as useUnstableToggleDisplayStyle } from './useUnstableToggleDisplayStyle';\n\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,4BAApB,QAAwD,gCAAxD;AACA,SAASD,OAAO,IAAIE,6BAApB,QAAyD,iCAAzD"}
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"}
@@ -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"}
@@ -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"}
@@ -12,5 +12,7 @@ export { default as ComicViewer } from './ComicViewer';
12
12
  export * from './ComicViewer';
13
13
  export { default as StatusBarProvider, useStatusBarContext } from './StatusBarProvider';
14
14
  export * from './StatusBarProvider';
15
+ export { default as ViewabilityTrackerView } from './ViewabilityTrackerView';
16
+ export * from './ViewabilityTrackerView';
15
17
  export * from './hooks';
16
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["default","BottomSheet","Carousel","DateTimePicker","FlipCard","ViewPager","ComicViewer","StatusBarProvider","useStatusBarContext"],"sources":["index.ts"],"sourcesContent":["export { default as BottomSheet } from './BottomSheet';\nexport * from './BottomSheet';\n\nexport { default as Carousel } from './Carousel';\nexport * from './Carousel';\n\nexport { default as DateTimePicker } from './DateTimePicker';\nexport * from './DateTimePicker';\n\nexport { default as FlipCard } from './FlipCard';\nexport * from './FlipCard';\n\nexport { default as ViewPager } from './ViewPager';\nexport * from './ViewPager';\n\nexport { default as ComicViewer } from './ComicViewer';\nexport * from './ComicViewer';\n\nexport { default as StatusBarProvider, useStatusBarContext } from './StatusBarProvider';\nexport * from './StatusBarProvider';\n\nexport * from './hooks';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,WAApB,QAAuC,eAAvC;AACA,cAAc,eAAd;AAEA,SAASD,OAAO,IAAIE,QAApB,QAAoC,YAApC;AACA,cAAc,YAAd;AAEA,SAASF,OAAO,IAAIG,cAApB,QAA0C,kBAA1C;AACA,cAAc,kBAAd;AAEA,SAASH,OAAO,IAAII,QAApB,QAAoC,YAApC;AACA,cAAc,YAAd;AAEA,SAASJ,OAAO,IAAIK,SAApB,QAAqC,aAArC;AACA,cAAc,aAAd;AAEA,SAASL,OAAO,IAAIM,WAApB,QAAuC,eAAvC;AACA,cAAc,eAAd;AAEA,SAASN,OAAO,IAAIO,iBAApB,EAAuCC,mBAAvC,QAAkE,qBAAlE;AACA,cAAc,qBAAd;AAEA,cAAc,SAAd"}
1
+ {"version":3,"names":["default","BottomSheet","Carousel","DateTimePicker","FlipCard","ViewPager","ComicViewer","StatusBarProvider","useStatusBarContext","ViewabilityTrackerView"],"sources":["index.ts"],"sourcesContent":["export { default as BottomSheet } from './BottomSheet';\nexport * from './BottomSheet';\n\nexport { default as Carousel } from './Carousel';\nexport * from './Carousel';\n\nexport { default as DateTimePicker } from './DateTimePicker';\nexport * from './DateTimePicker';\n\nexport { default as FlipCard } from './FlipCard';\nexport * from './FlipCard';\n\nexport { default as ViewPager } from './ViewPager';\nexport * from './ViewPager';\n\nexport { default as ComicViewer } from './ComicViewer';\nexport * from './ComicViewer';\n\nexport { default as StatusBarProvider, useStatusBarContext } from './StatusBarProvider';\nexport * from './StatusBarProvider';\n\nexport { default as ViewabilityTrackerView } from './ViewabilityTrackerView';\nexport * from './ViewabilityTrackerView';\n\nexport * from './hooks';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,WAApB,QAAuC,eAAvC;AACA,cAAc,eAAd;AAEA,SAASD,OAAO,IAAIE,QAApB,QAAoC,YAApC;AACA,cAAc,YAAd;AAEA,SAASF,OAAO,IAAIG,cAApB,QAA0C,kBAA1C;AACA,cAAc,kBAAd;AAEA,SAASH,OAAO,IAAII,QAApB,QAAoC,YAApC;AACA,cAAc,YAAd;AAEA,SAASJ,OAAO,IAAIK,SAApB,QAAqC,aAArC;AACA,cAAc,aAAd;AAEA,SAASL,OAAO,IAAIM,WAApB,QAAuC,eAAvC;AACA,cAAc,eAAd;AAEA,SAASN,OAAO,IAAIO,iBAApB,EAAuCC,mBAAvC,QAAkE,qBAAlE;AACA,cAAc,qBAAd;AAEA,SAASR,OAAO,IAAIS,sBAApB,QAAkD,0BAAlD;AACA,cAAc,0BAAd;AAEA,cAAc,SAAd"}
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type CarouselProps from './CarouselProps';
3
+ import type { CarouselInstance } from './types';
4
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<CarouselProps<any>, "style" | "data" | "autoplay" | "autoplayInterval" | "createItemStyle" | "createScrollAnimation" | "disableSmartAutoplay" | "initialIndex" | "itemHeight" | "itemWidth" | "loop" | "onIndexChange" | "renderItem" | "scrollEnabled" | "windowSize"> & React.RefAttributes<CarouselInstance>>>;
5
+ export default _default;
@@ -1,7 +1,8 @@
1
- import React, { RefObject } from 'react';
2
- import type { ListRenderItemInfo } from 'react-native';
1
+ import type { RefObject } from 'react';
3
2
  import type { ComponentProps } from '@fountain-ui/core';
3
+ import type { CarouselInstance, CreateItemStyle, CreateScrollAnimation, ItemHeight, RenderItem } from './types';
4
4
  export default interface CarouselProps<ItemT = any> extends ComponentProps<{
5
+ ref?: RefObject<CarouselInstance>;
5
6
  /**
6
7
  * If `true`, enable autoplay.
7
8
  * @default false
@@ -13,78 +14,62 @@ export default interface CarouselProps<ItemT = any> extends ComponentProps<{
13
14
  */
14
15
  autoplayInterval?: number;
15
16
  /**
16
- * Padding for center slide. If specified, `slidesToScroll` and `slidesToShow` set to 1.
17
+ * The item style creator function.
18
+ * @default createDefaultItemStyle
17
19
  */
18
- centerSlidePadding?: number;
20
+ createItemStyle?: CreateItemStyle;
19
21
  /**
20
- * Delay in ms until navigating to the next item.
22
+ * The scroll animation creator function.
23
+ * @default createDefaultScrollAnimation
24
+ */
25
+ createScrollAnimation?: CreateScrollAnimation;
26
+ /**
27
+ * Data for render items.
21
28
  */
22
29
  data: ReadonlyArray<ItemT>;
23
30
  /**
24
- * Value of the opacity effect applied to inactive slides.
25
- * @default 0.7
31
+ * If `true`, carousel will detect its own viewability and control autoplay automatically.
32
+ * @default false
26
33
  */
27
- inactiveSlideOpacity?: number;
34
+ disableSmartAutoplay?: boolean;
28
35
  /**
29
- * Value of the 'scale' transform applied to inactive slides.
30
- * @default 0.9
36
+ * Index of initial item that should be selected.
37
+ * @default 0
31
38
  */
32
- inactiveSlideScale?: number;
39
+ initialIndex?: number;
33
40
  /**
34
- * Web only. Value of the 'scale' transform applied to a active slide.
35
- * @default 0.990
41
+ * The item height.
42
+ * For a performance reason, always consider to provide a number value.
36
43
  */
37
- activeSlideScale?: number;
44
+ itemHeight: ItemHeight;
38
45
  /**
39
- * A number representing the index of the active slide.
46
+ * The item width.
40
47
  */
41
- index: number;
48
+ itemWidth: number;
42
49
  /**
43
50
  * Enable infinite loop mode.
44
51
  * @default false
45
52
  */
46
- infinite?: boolean;
53
+ loop?: boolean;
47
54
  /**
48
55
  * Callback fired when an index is changed.
49
56
  */
50
- onChange?: (newIndex: number) => void;
57
+ onIndexChange?: (newIndex: number) => void;
51
58
  /**
52
59
  * Takes an item from data and renders it into the list.
53
60
  */
54
- renderItem: (info: Omit<ListRenderItemInfo<ItemT>, 'separators'>) => React.ReactElement | null;
55
- /**
56
- * Web only. Number of slides to scroll at once.
57
- * @default 1
58
- */
59
- slidesToScroll?: number;
60
- /**
61
- * Web only. Number of slides to display.
62
- * @default 1
63
- */
64
- slidesToShow?: number;
61
+ renderItem: RenderItem<ItemT>;
65
62
  /**
66
- * Web only. Enable items to display at the center.
63
+ * Whether to enable scroll gesture.
67
64
  * @default true
68
65
  */
69
- centerMode?: boolean;
70
- /**
71
- * Web only. Enable arrows to display.
72
- * @default true
73
- */
74
- arrows?: boolean;
75
- /**
76
- * Web only. Style of arrows
77
- * @default true
78
- */
79
- arrowsStyle?: object;
80
- /**
81
- * Web only. Style of track
82
- * @default object
83
- */
84
- trackStyle?: object;
66
+ scrollEnabled?: boolean;
85
67
  /**
86
- * Only web. Refer slick object
68
+ * The maximum number of items that can respond to pan gesture events.
69
+ * Due to the nature of the `active` item, it accepts only odd number. (e.g. 1, 3, 5...)
70
+ * 0 means all items will respond to pan gesture events.
71
+ * @default 5
87
72
  */
88
- ref?: RefObject<any>;
73
+ windowSize?: number;
89
74
  }> {
90
75
  }
@@ -0,0 +1 @@
1
+ export declare const itemInterpolationInputRange: number[];
@@ -0,0 +1,2 @@
1
+ declare const _default: import("../types").CreateItemStyle;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { Animated } from 'react-native';
2
+ export default function createDefaultScrollAnimation(animatedValue: Animated.Value, toValue: number): Animated.CompositeAnimation;
@@ -0,0 +1,4 @@
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';
@@ -0,0 +1,2 @@
1
+ import type { CreateItemStyle } from '../types';
2
+ export default function normalItemStyleFactory(): CreateItemStyle;
@@ -0,0 +1,9 @@
1
+ import type { CreateItemStyle } from '../types';
2
+ export interface ParallaxAnimationConfig {
3
+ activeItemScale?: number;
4
+ activeItemOpacity?: number;
5
+ adjacentItemScale?: number;
6
+ adjacentItemOpacity?: number;
7
+ scrollingOffset?: number;
8
+ }
9
+ export default function parallaxItemStyleFactory(config?: ParallaxAnimationConfig): CreateItemStyle;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { Animated } from 'react-native';
3
+ import type { CreateItemStyle, ItemHeight, ItemVisibilityStore } from '../types';
4
+ export interface InternalContextValue<ItemT> {
5
+ createItemStyle: CreateItemStyle;
6
+ data: ReadonlyArray<ItemT>;
7
+ globalInterpolation: Animated.AnimatedInterpolation;
8
+ itemHeight: ItemHeight;
9
+ itemWidth: number;
10
+ itemVisibilityStore: ItemVisibilityStore;
11
+ loop: boolean;
12
+ }
13
+ declare const InternalContext: import("react").Context<InternalContextValue<any>>;
14
+ export default InternalContext;
@@ -0,0 +1,9 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { ViewProps } from 'react-native';
3
+ import { Animated } from 'react-native';
4
+ export interface ItemViewProps {
5
+ children: (interpolation: Animated.AnimatedInterpolation) => ReactElement | null;
6
+ index: number;
7
+ onLayout?: ViewProps['onLayout'];
8
+ }
9
+ export default function ItemView(props: ItemViewProps): JSX.Element;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import type { View, ViewProps } from 'react-native';
3
+ import type { ItemHeight, RenderItem } from '../types';
4
+ export declare type RootViewProps<ItemT> = ViewProps & {
5
+ data: ReadonlyArray<ItemT>;
6
+ itemHeight: ItemHeight;
7
+ originalData: ReadonlyArray<ItemT>;
8
+ renderItem: RenderItem<ItemT>;
9
+ };
10
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<ViewProps & {
11
+ data: readonly any[];
12
+ itemHeight: ItemHeight;
13
+ originalData: readonly any[];
14
+ renderItem: RenderItem<any>;
15
+ } & React.RefAttributes<View>>>;
16
+ export default _default;
@@ -0,0 +1,12 @@
1
+ import type { ReactNode } from 'react';
2
+ import { Animated } from 'react-native';
3
+ import type { AutoplayController, StartPagingAnimation } from '../types';
4
+ export interface ScrollViewGestureProps {
5
+ autoplayController: AutoplayController;
6
+ children: ReactNode;
7
+ finalizeAnimation: () => void;
8
+ offsetTx: Animated.Value;
9
+ scrollEnabled: boolean;
10
+ startPagingAnimation: StartPagingAnimation;
11
+ }
12
+ export default function ScrollViewGesture(props: ScrollViewGestureProps): JSX.Element;
@@ -0,0 +1,4 @@
1
+ export { default as InternalContext } from './InternalContext';
2
+ export { default as ItemView } from './ItemView';
3
+ export { default as RootView } from './RootView';
4
+ export { default as ScrollViewGesture } from './ScrollViewGesture';
@@ -0,0 +1,7 @@
1
+ export { default as useAutoplayController } from './useAutoplayController';
2
+ export { default as useDimensionChangeReaction } from './useDimensionChangeReaction';
3
+ export { default as useIndexController } from './useIndexController';
4
+ export { default as useItemInterpolation } from './useItemInterpolation';
5
+ export { default as useLoopedData } from './useLoopedData';
6
+ export { default as usePagingAnimation } from './usePagingAnimation';
7
+ export { default as useItemVisibilityStore } from './useItemVisibilityStore';
@@ -0,0 +1,7 @@
1
+ import type { AutoplayController, StartPagingAnimation } from '../types';
2
+ export interface AutoplayConfig {
3
+ enabled: boolean;
4
+ intervalMillis: number;
5
+ startPagingAnimation: StartPagingAnimation;
6
+ }
7
+ export default function useAutoplayController(config: AutoplayConfig): AutoplayController;
@@ -0,0 +1,7 @@
1
+ import { Animated } from 'react-native';
2
+ export interface Parameters {
3
+ controlledTx: Animated.AnimatedValue;
4
+ currentIndex: number;
5
+ itemWidth: number;
6
+ }
7
+ export default function useDimensionChangeReaction(params: Parameters): void;
@@ -0,0 +1,10 @@
1
+ import { Animated } from 'react-native';
2
+ import type { IndexController } from '../types';
3
+ export interface UseIndexControllerParameters {
4
+ controlledTx: Animated.AnimatedValue;
5
+ initialIndex: number;
6
+ itemWidth: number;
7
+ numberOfOriginalData: number;
8
+ onIndexChange?: (newIndex: number) => void;
9
+ }
10
+ export default function useIndexController(params: UseIndexControllerParameters): IndexController;
@@ -0,0 +1,2 @@
1
+ import { Animated } from 'react-native';
2
+ export default function useItemInterpolation(index: number): Animated.AnimatedInterpolation;
@@ -0,0 +1,7 @@
1
+ import type { ItemVisibilityStore } from '../types';
2
+ export interface Parameters {
3
+ currentIndex: number;
4
+ numberOfData: number;
5
+ windowSize: number;
6
+ }
7
+ export default function useItemVisibilityStore(params: Parameters): ItemVisibilityStore;
@@ -0,0 +1 @@
1
+ export default function useLoopedData<ItemT>(originalData: ReadonlyArray<ItemT>, loop: boolean): ReadonlyArray<ItemT>;
@@ -0,0 +1,18 @@
1
+ import { Animated } from 'react-native';
2
+ import type { CreateScrollAnimation, GetCurrentIndex, StartPagingAnimation } from '../types';
3
+ export interface PagingAnimationParameters {
4
+ controlledTx: Animated.Value;
5
+ createScrollAnimation: CreateScrollAnimation;
6
+ getCurrentIndex: GetCurrentIndex;
7
+ itemWidth: number;
8
+ lastIndex: number;
9
+ loop: boolean;
10
+ numberOfData: number;
11
+ offsetTx: Animated.Value;
12
+ }
13
+ export interface UsePagingAnimation {
14
+ finalizeAnimation: () => void;
15
+ globalInterpolation: Animated.AnimatedInterpolation;
16
+ startPagingAnimation: StartPagingAnimation;
17
+ }
18
+ export default function usePagingAnimation(params: PagingAnimationParameters): UsePagingAnimation;
@@ -1,2 +1,4 @@
1
- export { default } from './CarouselWeb';
1
+ export { default } from './Carousel';
2
2
  export type { default as CarouselProps } from './CarouselProps';
3
+ export type { CarouselInstance } from './types';
4
+ export { normalItemStyleFactory, parallaxItemStyleFactory } from './animation';
@@ -0,0 +1,79 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { Animated, ViewProps } from 'react-native';
3
+ declare const directions: readonly ["next", "prev", "stay"];
4
+ export declare type PagingDirection = (typeof directions)[number];
5
+ export declare type ItemHeight = number | 'auto';
6
+ export interface RenderItem<T> {
7
+ (info: {
8
+ item: T;
9
+ index: number;
10
+ interpolation: Animated.AnimatedInterpolation;
11
+ }): ReactElement | null;
12
+ }
13
+ export interface CreateScrollAnimation {
14
+ (aValue: Animated.AnimatedValue, toValue: number): Animated.CompositeAnimation;
15
+ }
16
+ export interface CreateItemStyle {
17
+ (itemInterpolation: Animated.AnimatedInterpolation, itemWidth: number): Animated.AnimatedProps<ViewProps['style']>;
18
+ }
19
+ export interface GetCurrentIndex {
20
+ (): number;
21
+ }
22
+ export interface IndexController {
23
+ currentIndex: number;
24
+ getCurrentIndex: GetCurrentIndex;
25
+ lastIndex: number;
26
+ monitorElement: ReactElement;
27
+ }
28
+ export declare type PagingAnimationType = 'directional' | 'index';
29
+ export interface BasePagingAnimationConfig {
30
+ animated?: boolean;
31
+ }
32
+ export interface DirectionalPagingAnimationConfig extends BasePagingAnimationConfig {
33
+ direction: PagingDirection;
34
+ isOriginatedFromGesture?: boolean;
35
+ }
36
+ export interface IndexPagingAnimationConfig extends BasePagingAnimationConfig {
37
+ index: number;
38
+ }
39
+ export declare type PagingAnimationConfig = DirectionalPagingAnimationConfig | IndexPagingAnimationConfig;
40
+ export interface StartPagingAnimation {
41
+ (type: PagingAnimationType, config: PagingAnimationConfig): void;
42
+ }
43
+ export declare type VisibleIndexRanges = Array<[number, number]>;
44
+ export interface StoreSubscription {
45
+ (): void;
46
+ }
47
+ export interface ItemVisibilityStore {
48
+ dispatch: (ranges: VisibleIndexRanges) => void;
49
+ subscribe: (listener: (ranges: VisibleIndexRanges) => void) => StoreSubscription;
50
+ removeAllListeners: () => void;
51
+ }
52
+ export interface AutoplayController {
53
+ pause: () => void;
54
+ resume: () => void;
55
+ }
56
+ export interface ScrollToOption {
57
+ index: number;
58
+ animated?: boolean;
59
+ }
60
+ export interface CarouselInstance {
61
+ /**
62
+ * Get current visible item index.
63
+ */
64
+ getCurrentIndex: GetCurrentIndex;
65
+ /**
66
+ * Scroll to next visible item.
67
+ */
68
+ next: () => void;
69
+ /**
70
+ * Scroll to previous visible item.
71
+ */
72
+ prev: () => void;
73
+ /**
74
+ * Scroll to desired indexed item.
75
+ * Invalid index is ignored.
76
+ */
77
+ scrollTo: (option: ScrollToOption) => void;
78
+ }
79
+ export {};
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
2
  import type { PageProps } from './ViewPagerProps';
3
- declare const _default: React.MemoExoticComponent<(props: PageProps) => JSX.Element>;
3
+ declare function Page(props: PageProps): JSX.Element;
4
+ declare const _default: React.MemoExoticComponent<typeof Page>;
4
5
  export default _default;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ interface PageState {
3
+ isActive: boolean;
4
+ }
5
+ declare const PageStateContext: import("react").Context<PageState>;
6
+ export declare const useViewPagerPageState: () => PageState;
7
+ export default PageStateContext;
@@ -1,2 +1,5 @@
1
+ import React from 'react';
1
2
  import type ViewPagerProps from './ViewPagerProps';
2
- export default function ViewPager(props: ViewPagerProps): JSX.Element;
3
+ import type { ViewPagerInstance } from './ViewPagerProps';
4
+ declare const ViewPager: React.ForwardRefExoticComponent<Pick<ViewPagerProps, "style" | "children" | "onChange" | "scrollEnabled" | "keyboardDismissMode" | "loading" | "initialPage" | "offscreenPageRerenderLimit" | "pageComponent" | "pageForceRerenderKey" | "UNSTABLE_sharedPage"> & React.RefAttributes<ViewPagerInstance>>;
5
+ export default ViewPager;
@@ -1,38 +1,46 @@
1
- import React from 'react';
1
+ import type { ComponentType, PropsWithChildren, ReactNode, Ref } from 'react';
2
2
  import type { ViewProps } from 'react-native';
3
+ import type { SharedValue } from 'react-native-reanimated';
3
4
  import type { ComponentProps } from '@fountain-ui/core';
4
5
  export declare type KeyboardDismissMode = 'none' | 'on-drag';
5
- export declare type PageProps = React.PropsWithChildren<ViewProps> & {
6
- isNeighbor: boolean;
7
- isVisible: boolean;
8
- rerenderKey?: any;
6
+ export declare type PageProps = PropsWithChildren<ViewProps> & {
7
+ index: number;
8
+ loading: ViewPagerProps['loading'];
9
+ offscreenPageRerenderLimit: number;
10
+ sharedIndex: SharedValue<number>;
11
+ rerenderKey?: ViewPagerProps['pageForceRerenderKey'];
9
12
  };
10
- export declare type PageComponent = React.ComponentType<PageProps>;
13
+ export declare type PageComponent = ComponentType<PageProps>;
11
14
  export declare type Loading = 'lazy' | 'eager';
12
- export default interface ViewPagerProps extends ComponentProps<{
15
+ export interface ViewPagerInstance {
13
16
  /**
14
- * Collection of ViewPager components.
17
+ * Function to scroll to a specific page in the ViewPager. Invalid index is ignored.
18
+ * @param index
15
19
  */
16
- children?: React.ReactNode;
17
- /**
18
- * If `true`, enable page visible hint.
19
- * @default false
20
- */
21
- enableVisibleHint?: boolean;
20
+ setPage: (index: number) => void;
21
+ }
22
+ export default interface ViewPagerProps extends ComponentProps<{
23
+ ref?: Ref<ViewPagerInstance>;
22
24
  /**
23
- * If `true`, Based on the current index, the pages on the left and right are also rerender.
24
- * @default false
25
+ * Collection of ViewPager components.
25
26
  */
26
- enableNeighborPageRerender?: boolean;
27
+ children?: ReactNode;
27
28
  /**
28
- * A number representing the index of the active page.
29
+ * Index of initial page that should be selected.
30
+ * @default 0
29
31
  */
30
- index: number;
32
+ initialPage?: number;
31
33
  /**
32
34
  * Whether to load the page immediately (`eager`) or on an as-needed basis (`lazy`).
33
35
  * @default 'lazy'
34
36
  */
35
37
  loading?: Loading;
38
+ /**
39
+ * Mobile only. The number of pages that should be re-rendered to either side of the current page.
40
+ * Changing this value after the component mount has no effect.
41
+ * @default 0
42
+ */
43
+ offscreenPageRerenderLimit?: number;
36
44
  /**
37
45
  * Callback fired when an index is changed.
38
46
  */
@@ -56,5 +64,9 @@ export default interface ViewPagerProps extends ComponentProps<{
56
64
  * @default 'on-drag'
57
65
  */
58
66
  keyboardDismissMode?: KeyboardDismissMode;
67
+ /**
68
+ * Unstable API.
69
+ */
70
+ UNSTABLE_sharedPage?: SharedValue<number>;
59
71
  }> {
60
72
  }
@@ -1,2 +1,5 @@
1
+ import React from 'react';
1
2
  import type ViewPagerProps from './ViewPagerProps';
2
- export default function ViewPager(props: ViewPagerProps): JSX.Element;
3
+ import type { ViewPagerInstance } from './ViewPagerProps';
4
+ declare const ViewPager: React.ForwardRefExoticComponent<Pick<ViewPagerProps, "style" | "children" | "onChange" | "scrollEnabled" | "keyboardDismissMode" | "loading" | "initialPage" | "offscreenPageRerenderLimit" | "pageComponent" | "pageForceRerenderKey" | "UNSTABLE_sharedPage"> & React.RefAttributes<ViewPagerInstance>>;
5
+ export default ViewPager;
@@ -1,2 +1,3 @@
1
1
  export { default } from './ViewPagerWeb';
2
- export type { default as ViewPagerProps } from './ViewPagerProps';
2
+ export type { default as ViewPagerProps, ViewPagerInstance } from './ViewPagerProps';
3
+ export { useViewPagerPageState } from './PageStateContext';
@@ -1 +1,2 @@
1
1
  export { default } from './ViewPagerNative';
2
+ export { useViewPagerPageState } from './PageStateContext';
@@ -1,21 +1,5 @@
1
- import React from 'react';
2
- import ViewPagerProps, { Loading, PageComponent } from './ViewPagerProps';
3
- export interface PageState {
4
- visited?: boolean;
5
- }
6
- export interface PageRenderOption {
7
- enableVisibleHint: boolean;
8
- enableNeighborPageRerender: boolean;
9
- index: number;
10
- loading: Loading;
11
- pageComponent: PageComponent;
12
- pageForceRerenderKey?: any;
13
- }
14
- export interface PageRenderer {
15
- (children: ViewPagerProps['children']): React.ReactNode;
16
- }
17
- export declare const defaultEnableVisibleHint: boolean;
18
- export declare const defaultEnableNeighborPageRerender: boolean;
1
+ import { Loading, PageComponent } from './ViewPagerProps';
2
+ export declare const defaultInitialPage: number;
19
3
  export declare const defaultLoading: Loading;
4
+ export declare const defaultOffscreenPageRerenderLimit: number;
20
5
  export declare const defaultPageComponent: PageComponent;
21
- export declare const usePageRenderer: ({ enableVisibleHint, index: currentIndex, loading, pageComponent: PageComponent, pageForceRerenderKey, enableNeighborPageRerender, }: PageRenderOption) => PageRenderer;
@@ -0,0 +1,3 @@
1
+ export default interface Viewability {
2
+ visible: boolean;
3
+ }
@@ -0,0 +1,2 @@
1
+ import type ViewabilityTrackerViewProps from './ViewabilityTrackerViewProps';
2
+ export default function ViewabilityTrackerView(props: ViewabilityTrackerViewProps): JSX.Element;