react-native-reanimated-carousel 5.0.0-beta.8 → 5.1.0

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 (402) hide show
  1. package/README.md +31 -29
  2. package/lib/commonjs/components/Carousel.js +1 -1
  3. package/lib/commonjs/components/Carousel.js.map +1 -1
  4. package/lib/commonjs/components/CarouselLayout.js +1 -1
  5. package/lib/commonjs/components/CarouselLayout.js.map +1 -1
  6. package/lib/commonjs/components/ItemLayout.js +1 -1
  7. package/lib/commonjs/components/ItemLayout.js.map +1 -1
  8. package/lib/commonjs/components/ItemRenderer.js +1 -1
  9. package/lib/commonjs/components/ItemRenderer.js.map +1 -1
  10. package/lib/commonjs/components/Pagination/PaginationItem.js +2 -0
  11. package/lib/commonjs/components/Pagination/PaginationItem.js.map +1 -0
  12. package/lib/commonjs/components/Pagination/index.js +1 -1
  13. package/lib/commonjs/components/Pagination/index.js.map +1 -1
  14. package/lib/commonjs/components/ScrollViewGesture.js +1 -1
  15. package/lib/commonjs/components/ScrollViewGesture.js.map +1 -1
  16. package/lib/commonjs/hooks/useAutoPlay.js +1 -1
  17. package/lib/commonjs/hooks/useAutoPlay.js.map +1 -1
  18. package/lib/commonjs/hooks/useCarouselController.js +1 -1
  19. package/lib/commonjs/hooks/useCarouselController.js.map +1 -1
  20. package/lib/commonjs/hooks/useCommonVariables.js +1 -1
  21. package/lib/commonjs/hooks/useCommonVariables.js.map +1 -1
  22. package/lib/commonjs/hooks/useInitProps.js +1 -1
  23. package/lib/commonjs/hooks/useInitProps.js.map +1 -1
  24. package/lib/commonjs/hooks/useLayoutConfig.js +1 -1
  25. package/lib/commonjs/hooks/useLayoutConfig.js.map +1 -1
  26. package/lib/commonjs/hooks/useOffsetX.js.map +1 -1
  27. package/lib/commonjs/hooks/useOnProgressChange.js +1 -1
  28. package/lib/commonjs/hooks/useOnProgressChange.js.map +1 -1
  29. package/lib/commonjs/hooks/usePanGestureProxy.js.map +1 -1
  30. package/lib/commonjs/hooks/usePropsErrorBoundary.js +1 -1
  31. package/lib/commonjs/hooks/usePropsErrorBoundary.js.map +1 -1
  32. package/lib/commonjs/hooks/useUpdateGestureConfig.js.map +1 -1
  33. package/lib/commonjs/hooks/useVisibleRanges.js.map +1 -1
  34. package/lib/commonjs/index.js +1 -1
  35. package/lib/commonjs/index.js.map +1 -1
  36. package/lib/commonjs/layouts/index.js.map +1 -1
  37. package/lib/commonjs/layouts/normal.js +1 -1
  38. package/lib/commonjs/layouts/normal.js.map +1 -1
  39. package/lib/commonjs/layouts/parallax.js +1 -1
  40. package/lib/commonjs/layouts/parallax.js.map +1 -1
  41. package/lib/commonjs/layouts/stack.js +1 -1
  42. package/lib/commonjs/layouts/stack.js.map +1 -1
  43. package/lib/commonjs/public-types.js +2 -0
  44. package/lib/commonjs/public-types.js.map +1 -0
  45. package/lib/commonjs/store/index.js.map +1 -1
  46. package/lib/commonjs/utils/carousel-direction.js +2 -0
  47. package/lib/commonjs/utils/carousel-direction.js.map +1 -0
  48. package/lib/commonjs/utils/carousel-math.js +2 -0
  49. package/lib/commonjs/utils/carousel-math.js.map +1 -0
  50. package/lib/commonjs/utils/computed-with-auto-fill-data.js.map +1 -1
  51. package/lib/commonjs/utils/deal-with-animation.js +1 -1
  52. package/lib/commonjs/utils/deal-with-animation.js.map +1 -1
  53. package/lib/module/components/Carousel.js +1 -1
  54. package/lib/module/components/Carousel.js.map +1 -1
  55. package/lib/module/components/CarouselLayout.js +1 -1
  56. package/lib/module/components/CarouselLayout.js.map +1 -1
  57. package/lib/module/components/ItemLayout.js +1 -1
  58. package/lib/module/components/ItemLayout.js.map +1 -1
  59. package/lib/module/components/ItemRenderer.js +1 -1
  60. package/lib/module/components/ItemRenderer.js.map +1 -1
  61. package/lib/module/components/LazyView.js +1 -1
  62. package/lib/module/components/LazyView.js.map +1 -1
  63. package/lib/module/components/Pagination/PaginationItem.js +2 -0
  64. package/lib/module/components/Pagination/PaginationItem.js.map +1 -0
  65. package/lib/module/components/Pagination/index.js +1 -1
  66. package/lib/module/components/Pagination/index.js.map +1 -1
  67. package/lib/module/components/ScrollViewGesture.js +1 -1
  68. package/lib/module/components/ScrollViewGesture.js.map +1 -1
  69. package/lib/module/constants/index.js +1 -1
  70. package/lib/module/constants/index.js.map +1 -1
  71. package/lib/module/hooks/useAutoPlay.js +1 -1
  72. package/lib/module/hooks/useAutoPlay.js.map +1 -1
  73. package/lib/module/hooks/useCarouselController.js +1 -1
  74. package/lib/module/hooks/useCarouselController.js.map +1 -1
  75. package/lib/module/hooks/useCheckMounted.js +1 -1
  76. package/lib/module/hooks/useCheckMounted.js.map +1 -1
  77. package/lib/module/hooks/useCommonVariables.js +1 -1
  78. package/lib/module/hooks/useCommonVariables.js.map +1 -1
  79. package/lib/module/hooks/useInitProps.js +1 -1
  80. package/lib/module/hooks/useInitProps.js.map +1 -1
  81. package/lib/module/hooks/useLayoutConfig.js +1 -1
  82. package/lib/module/hooks/useLayoutConfig.js.map +1 -1
  83. package/lib/module/hooks/useOffsetX.js +1 -1
  84. package/lib/module/hooks/useOffsetX.js.map +1 -1
  85. package/lib/module/hooks/useOnProgressChange.js +1 -1
  86. package/lib/module/hooks/useOnProgressChange.js.map +1 -1
  87. package/lib/module/hooks/usePanGestureProxy.js +1 -1
  88. package/lib/module/hooks/usePanGestureProxy.js.map +1 -1
  89. package/lib/module/hooks/usePropsErrorBoundary.js +1 -1
  90. package/lib/module/hooks/usePropsErrorBoundary.js.map +1 -1
  91. package/lib/module/hooks/useUpdateGestureConfig.js +1 -1
  92. package/lib/module/hooks/useUpdateGestureConfig.js.map +1 -1
  93. package/lib/module/hooks/useVisibleRanges.js +1 -1
  94. package/lib/module/hooks/useVisibleRanges.js.map +1 -1
  95. package/lib/module/index.js +1 -1
  96. package/lib/module/index.js.map +1 -1
  97. package/lib/module/layouts/index.js +1 -1
  98. package/lib/module/layouts/index.js.map +1 -1
  99. package/lib/module/layouts/normal.js +1 -1
  100. package/lib/module/layouts/normal.js.map +1 -1
  101. package/lib/module/layouts/parallax.js +1 -1
  102. package/lib/module/layouts/parallax.js.map +1 -1
  103. package/lib/module/layouts/stack.js +1 -1
  104. package/lib/module/layouts/stack.js.map +1 -1
  105. package/lib/module/package.json +1 -0
  106. package/lib/module/public-types.js +2 -0
  107. package/lib/module/public-types.js.map +1 -0
  108. package/lib/module/store/index.js +1 -1
  109. package/lib/module/store/index.js.map +1 -1
  110. package/lib/module/types.js +1 -1
  111. package/lib/module/utils/carousel-direction.js +2 -0
  112. package/lib/module/utils/carousel-direction.js.map +1 -0
  113. package/lib/module/utils/carousel-math.js +2 -0
  114. package/lib/module/utils/carousel-math.js.map +1 -0
  115. package/lib/module/utils/compute-gesture-translation.js +1 -1
  116. package/lib/module/utils/compute-gesture-translation.js.map +1 -1
  117. package/lib/module/utils/compute-offset-if-size-changed.js +1 -1
  118. package/lib/module/utils/compute-offset-if-size-changed.js.map +1 -1
  119. package/lib/module/utils/computed-with-auto-fill-data.js +1 -1
  120. package/lib/module/utils/computed-with-auto-fill-data.js.map +1 -1
  121. package/lib/module/utils/deal-with-animation.js +1 -1
  122. package/lib/module/utils/deal-with-animation.js.map +1 -1
  123. package/lib/module/utils/log.js +1 -1
  124. package/lib/module/utils/log.js.map +1 -1
  125. package/lib/module/utils/sanitize-animation-style.js +1 -1
  126. package/lib/module/utils/sanitize-animation-style.js.map +1 -1
  127. package/lib/typescript/commonjs/components/Carousel.d.ts +8 -0
  128. package/lib/typescript/commonjs/components/Carousel.d.ts.map +1 -0
  129. package/lib/typescript/{components → commonjs/components}/CarouselLayout.d.ts +5 -8
  130. package/lib/typescript/commonjs/components/CarouselLayout.d.ts.map +1 -0
  131. package/lib/typescript/commonjs/components/ItemLayout.d.ts +21 -0
  132. package/lib/typescript/commonjs/components/ItemLayout.d.ts.map +1 -0
  133. package/lib/typescript/commonjs/components/ItemRenderer.d.ts +24 -0
  134. package/lib/typescript/commonjs/components/ItemRenderer.d.ts.map +1 -0
  135. package/lib/typescript/commonjs/components/LazyView.d.ts.map +1 -0
  136. package/lib/typescript/commonjs/components/Pagination/PaginationItem.d.ts +14 -0
  137. package/lib/typescript/commonjs/components/Pagination/PaginationItem.d.ts.map +1 -0
  138. package/lib/typescript/commonjs/components/Pagination/index.d.ts +4 -0
  139. package/lib/typescript/commonjs/components/Pagination/index.d.ts.map +1 -0
  140. package/lib/typescript/{components → commonjs/components}/ScrollViewGesture.d.ts +3 -4
  141. package/lib/typescript/commonjs/components/ScrollViewGesture.d.ts.map +1 -0
  142. package/lib/typescript/commonjs/constants/index.d.ts.map +1 -0
  143. package/lib/typescript/commonjs/hooks/useAutoPlay.d.ts +12 -0
  144. package/lib/typescript/commonjs/hooks/useAutoPlay.d.ts.map +1 -0
  145. package/lib/typescript/commonjs/hooks/useCarouselController.d.ts +29 -0
  146. package/lib/typescript/commonjs/hooks/useCarouselController.d.ts.map +1 -0
  147. package/lib/typescript/commonjs/hooks/useCheckMounted.d.ts.map +1 -0
  148. package/lib/typescript/commonjs/hooks/useCommonVariables.d.ts +18 -0
  149. package/lib/typescript/commonjs/hooks/useCommonVariables.d.ts.map +1 -0
  150. package/lib/typescript/commonjs/hooks/useInitProps.d.ts +25 -0
  151. package/lib/typescript/commonjs/hooks/useInitProps.d.ts.map +1 -0
  152. package/lib/typescript/commonjs/hooks/useLayoutConfig.d.ts +8 -0
  153. package/lib/typescript/commonjs/hooks/useLayoutConfig.d.ts.map +1 -0
  154. package/lib/typescript/commonjs/hooks/useOffsetX.d.ts +13 -0
  155. package/lib/typescript/commonjs/hooks/useOffsetX.d.ts.map +1 -0
  156. package/lib/typescript/commonjs/hooks/useOnProgressChange.d.ts +12 -0
  157. package/lib/typescript/commonjs/hooks/useOnProgressChange.d.ts.map +1 -0
  158. package/lib/typescript/{hooks → commonjs/hooks}/usePanGestureProxy.d.ts +4 -3
  159. package/lib/typescript/commonjs/hooks/usePanGestureProxy.d.ts.map +1 -0
  160. package/lib/typescript/commonjs/hooks/usePropsErrorBoundary.d.ts +3 -0
  161. package/lib/typescript/commonjs/hooks/usePropsErrorBoundary.d.ts.map +1 -0
  162. package/lib/typescript/commonjs/hooks/useUpdateGestureConfig.d.ts +9 -0
  163. package/lib/typescript/commonjs/hooks/useUpdateGestureConfig.d.ts.map +1 -0
  164. package/lib/typescript/{hooks → commonjs/hooks}/useVisibleRanges.d.ts +6 -6
  165. package/lib/typescript/commonjs/hooks/useVisibleRanges.d.ts.map +1 -0
  166. package/lib/typescript/commonjs/index.d.ts +4 -0
  167. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  168. package/lib/typescript/{layouts → commonjs/layouts}/index.d.ts +0 -1
  169. package/lib/typescript/commonjs/layouts/index.d.ts.map +1 -0
  170. package/lib/typescript/commonjs/layouts/normal.d.ts +15 -0
  171. package/lib/typescript/commonjs/layouts/normal.d.ts.map +1 -0
  172. package/lib/typescript/commonjs/layouts/parallax.d.ts +27 -0
  173. package/lib/typescript/commonjs/layouts/parallax.d.ts.map +1 -0
  174. package/lib/typescript/commonjs/layouts/stack.d.ts +10 -0
  175. package/lib/typescript/commonjs/layouts/stack.d.ts.map +1 -0
  176. package/lib/typescript/commonjs/package.json +1 -0
  177. package/lib/typescript/commonjs/public-types.d.ts +171 -0
  178. package/lib/typescript/commonjs/public-types.d.ts.map +1 -0
  179. package/lib/typescript/{store → commonjs/store}/index.d.ts +8 -8
  180. package/lib/typescript/commonjs/store/index.d.ts.map +1 -0
  181. package/lib/typescript/commonjs/types.d.ts +15 -0
  182. package/lib/typescript/commonjs/types.d.ts.map +1 -0
  183. package/lib/typescript/commonjs/utils/carousel-direction.d.ts +9 -0
  184. package/lib/typescript/commonjs/utils/carousel-direction.d.ts.map +1 -0
  185. package/lib/typescript/commonjs/utils/carousel-math.d.ts +28 -0
  186. package/lib/typescript/commonjs/utils/carousel-math.d.ts.map +1 -0
  187. package/lib/typescript/commonjs/utils/compute-gesture-translation.d.ts.map +1 -0
  188. package/lib/typescript/commonjs/utils/compute-offset-if-size-changed.d.ts.map +1 -0
  189. package/lib/typescript/commonjs/utils/computed-with-auto-fill-data.d.ts.map +1 -0
  190. package/lib/typescript/commonjs/utils/deal-with-animation.d.ts +3 -0
  191. package/lib/typescript/commonjs/utils/deal-with-animation.d.ts.map +1 -0
  192. package/lib/typescript/commonjs/utils/log.d.ts.map +1 -0
  193. package/lib/typescript/commonjs/utils/sanitize-animation-style.d.ts.map +1 -0
  194. package/lib/typescript/module/components/Carousel.d.ts +8 -0
  195. package/lib/typescript/module/components/Carousel.d.ts.map +1 -0
  196. package/lib/typescript/module/components/CarouselLayout.d.ts +14 -0
  197. package/lib/typescript/module/components/CarouselLayout.d.ts.map +1 -0
  198. package/lib/typescript/module/components/ItemLayout.d.ts +21 -0
  199. package/lib/typescript/module/components/ItemLayout.d.ts.map +1 -0
  200. package/lib/typescript/module/components/ItemRenderer.d.ts +24 -0
  201. package/lib/typescript/module/components/ItemRenderer.d.ts.map +1 -0
  202. package/lib/typescript/module/components/LazyView.d.ts +8 -0
  203. package/lib/typescript/module/components/LazyView.d.ts.map +1 -0
  204. package/lib/typescript/module/components/Pagination/PaginationItem.d.ts +14 -0
  205. package/lib/typescript/module/components/Pagination/PaginationItem.d.ts.map +1 -0
  206. package/lib/typescript/module/components/Pagination/index.d.ts +4 -0
  207. package/lib/typescript/module/components/Pagination/index.d.ts.map +1 -0
  208. package/lib/typescript/module/components/ScrollViewGesture.d.ts +18 -0
  209. package/lib/typescript/module/components/ScrollViewGesture.d.ts.map +1 -0
  210. package/lib/typescript/module/constants/index.d.ts +9 -0
  211. package/lib/typescript/module/constants/index.d.ts.map +1 -0
  212. package/lib/typescript/module/hooks/useAutoPlay.d.ts +12 -0
  213. package/lib/typescript/module/hooks/useAutoPlay.d.ts.map +1 -0
  214. package/lib/typescript/module/hooks/useCarouselController.d.ts +29 -0
  215. package/lib/typescript/module/hooks/useCarouselController.d.ts.map +1 -0
  216. package/lib/typescript/module/hooks/useCheckMounted.d.ts +3 -0
  217. package/lib/typescript/module/hooks/useCheckMounted.d.ts.map +1 -0
  218. package/lib/typescript/module/hooks/useCommonVariables.d.ts +18 -0
  219. package/lib/typescript/module/hooks/useCommonVariables.d.ts.map +1 -0
  220. package/lib/typescript/module/hooks/useInitProps.d.ts +25 -0
  221. package/lib/typescript/module/hooks/useInitProps.d.ts.map +1 -0
  222. package/lib/typescript/module/hooks/useLayoutConfig.d.ts +8 -0
  223. package/lib/typescript/module/hooks/useLayoutConfig.d.ts.map +1 -0
  224. package/lib/typescript/module/hooks/useOffsetX.d.ts +13 -0
  225. package/lib/typescript/module/hooks/useOffsetX.d.ts.map +1 -0
  226. package/lib/typescript/module/hooks/useOnProgressChange.d.ts +12 -0
  227. package/lib/typescript/module/hooks/useOnProgressChange.d.ts.map +1 -0
  228. package/lib/typescript/module/hooks/usePanGestureProxy.d.ts +11 -0
  229. package/lib/typescript/module/hooks/usePanGestureProxy.d.ts.map +1 -0
  230. package/lib/typescript/module/hooks/usePropsErrorBoundary.d.ts +3 -0
  231. package/lib/typescript/module/hooks/usePropsErrorBoundary.d.ts.map +1 -0
  232. package/lib/typescript/module/hooks/useUpdateGestureConfig.d.ts +9 -0
  233. package/lib/typescript/module/hooks/useUpdateGestureConfig.d.ts.map +1 -0
  234. package/lib/typescript/module/hooks/useVisibleRanges.d.ts +22 -0
  235. package/lib/typescript/module/hooks/useVisibleRanges.d.ts.map +1 -0
  236. package/lib/typescript/module/index.d.ts +4 -0
  237. package/lib/typescript/module/index.d.ts.map +1 -0
  238. package/lib/typescript/module/layouts/index.d.ts +10 -0
  239. package/lib/typescript/module/layouts/index.d.ts.map +1 -0
  240. package/lib/typescript/module/layouts/normal.d.ts +15 -0
  241. package/lib/typescript/module/layouts/normal.d.ts.map +1 -0
  242. package/lib/typescript/module/layouts/parallax.d.ts +27 -0
  243. package/lib/typescript/module/layouts/parallax.d.ts.map +1 -0
  244. package/lib/typescript/module/layouts/stack.d.ts +10 -0
  245. package/lib/typescript/module/layouts/stack.d.ts.map +1 -0
  246. package/lib/typescript/module/package.json +1 -0
  247. package/lib/typescript/module/public-types.d.ts +171 -0
  248. package/lib/typescript/module/public-types.d.ts.map +1 -0
  249. package/lib/typescript/module/store/index.d.ts +35 -0
  250. package/lib/typescript/module/store/index.d.ts.map +1 -0
  251. package/lib/typescript/module/types.d.ts +15 -0
  252. package/lib/typescript/module/types.d.ts.map +1 -0
  253. package/lib/typescript/module/utils/carousel-direction.d.ts +9 -0
  254. package/lib/typescript/module/utils/carousel-direction.d.ts.map +1 -0
  255. package/lib/typescript/module/utils/carousel-math.d.ts +28 -0
  256. package/lib/typescript/module/utils/carousel-math.d.ts.map +1 -0
  257. package/lib/typescript/module/utils/compute-gesture-translation.d.ts +9 -0
  258. package/lib/typescript/module/utils/compute-gesture-translation.d.ts.map +1 -0
  259. package/lib/typescript/module/utils/compute-offset-if-size-changed.d.ts +6 -0
  260. package/lib/typescript/module/utils/compute-offset-if-size-changed.d.ts.map +1 -0
  261. package/lib/typescript/module/utils/computed-with-auto-fill-data.d.ts +23 -0
  262. package/lib/typescript/module/utils/computed-with-auto-fill-data.d.ts.map +1 -0
  263. package/lib/typescript/module/utils/deal-with-animation.d.ts +3 -0
  264. package/lib/typescript/module/utils/deal-with-animation.d.ts.map +1 -0
  265. package/lib/typescript/module/utils/log.d.ts +7 -0
  266. package/lib/typescript/module/utils/log.d.ts.map +1 -0
  267. package/lib/typescript/module/utils/sanitize-animation-style.d.ts +3 -0
  268. package/lib/typescript/module/utils/sanitize-animation-style.d.ts.map +1 -0
  269. package/package.json +31 -6
  270. package/scripts/codemods/v5.mjs +502 -0
  271. package/src/components/Carousel.tsx +5 -5
  272. package/src/components/CarouselLayout.tsx +52 -89
  273. package/src/components/ItemLayout.tsx +57 -48
  274. package/src/components/ItemRenderer.tsx +29 -18
  275. package/src/components/Pagination/PaginationItem.tsx +166 -0
  276. package/src/components/Pagination/index.tsx +105 -6
  277. package/src/components/ScrollViewGesture.tsx +92 -177
  278. package/src/hooks/useAutoPlay.ts +23 -18
  279. package/src/hooks/useCarouselController.tsx +196 -342
  280. package/src/hooks/useCommonVariables.ts +159 -71
  281. package/src/hooks/useInitProps.ts +161 -71
  282. package/src/hooks/useLayoutConfig.ts +21 -12
  283. package/src/hooks/useOffsetX.ts +6 -6
  284. package/src/hooks/useOnProgressChange.ts +23 -48
  285. package/src/hooks/usePanGestureProxy.ts +8 -8
  286. package/src/hooks/usePropsErrorBoundary.ts +32 -90
  287. package/src/hooks/useUpdateGestureConfig.ts +6 -3
  288. package/src/hooks/useVisibleRanges.tsx +6 -6
  289. package/src/index.tsx +14 -9
  290. package/src/layouts/index.tsx +0 -2
  291. package/src/layouts/normal.ts +14 -4
  292. package/src/layouts/parallax.ts +32 -59
  293. package/src/layouts/stack.ts +30 -70
  294. package/src/public-types.ts +209 -0
  295. package/src/store/index.tsx +7 -7
  296. package/src/types.ts +30 -322
  297. package/src/utils/carousel-direction.ts +39 -0
  298. package/src/utils/carousel-math.ts +156 -0
  299. package/src/utils/computed-with-auto-fill-data.ts +2 -2
  300. package/src/utils/deal-with-animation.ts +11 -9
  301. package/lib/commonjs/components/Pagination/Basic/PaginationItem.js +0 -2
  302. package/lib/commonjs/components/Pagination/Basic/PaginationItem.js.map +0 -1
  303. package/lib/commonjs/components/Pagination/Basic/index.js +0 -2
  304. package/lib/commonjs/components/Pagination/Basic/index.js.map +0 -1
  305. package/lib/commonjs/components/Pagination/Custom/PaginationItem.js +0 -2
  306. package/lib/commonjs/components/Pagination/Custom/PaginationItem.js.map +0 -1
  307. package/lib/commonjs/components/Pagination/Custom/index.js +0 -2
  308. package/lib/commonjs/components/Pagination/Custom/index.js.map +0 -1
  309. package/lib/commonjs/utils/compute-offset-if-data-changed.js +0 -2
  310. package/lib/commonjs/utils/compute-offset-if-data-changed.js.map +0 -1
  311. package/lib/commonjs/utils/handleroffset-direction.js +0 -2
  312. package/lib/commonjs/utils/handleroffset-direction.js.map +0 -1
  313. package/lib/module/components/Pagination/Basic/PaginationItem.js +0 -2
  314. package/lib/module/components/Pagination/Basic/PaginationItem.js.map +0 -1
  315. package/lib/module/components/Pagination/Basic/index.js +0 -2
  316. package/lib/module/components/Pagination/Basic/index.js.map +0 -1
  317. package/lib/module/components/Pagination/Custom/PaginationItem.js +0 -2
  318. package/lib/module/components/Pagination/Custom/PaginationItem.js.map +0 -1
  319. package/lib/module/components/Pagination/Custom/index.js +0 -2
  320. package/lib/module/components/Pagination/Custom/index.js.map +0 -1
  321. package/lib/module/utils/compute-offset-if-data-changed.js +0 -2
  322. package/lib/module/utils/compute-offset-if-data-changed.js.map +0 -1
  323. package/lib/module/utils/handleroffset-direction.js +0 -2
  324. package/lib/module/utils/handleroffset-direction.js.map +0 -1
  325. package/lib/typescript/components/Carousel.d.ts +0 -8
  326. package/lib/typescript/components/Carousel.d.ts.map +0 -1
  327. package/lib/typescript/components/CarouselLayout.d.ts.map +0 -1
  328. package/lib/typescript/components/ItemLayout.d.ts +0 -20
  329. package/lib/typescript/components/ItemLayout.d.ts.map +0 -1
  330. package/lib/typescript/components/ItemRenderer.d.ts +0 -23
  331. package/lib/typescript/components/ItemRenderer.d.ts.map +0 -1
  332. package/lib/typescript/components/LazyView.d.ts.map +0 -1
  333. package/lib/typescript/components/Pagination/Basic/PaginationItem.d.ts +0 -29
  334. package/lib/typescript/components/Pagination/Basic/PaginationItem.d.ts.map +0 -1
  335. package/lib/typescript/components/Pagination/Basic/index.d.ts +0 -23
  336. package/lib/typescript/components/Pagination/Basic/index.d.ts.map +0 -1
  337. package/lib/typescript/components/Pagination/Custom/PaginationItem.d.ts +0 -35
  338. package/lib/typescript/components/Pagination/Custom/PaginationItem.d.ts.map +0 -1
  339. package/lib/typescript/components/Pagination/Custom/index.d.ts +0 -26
  340. package/lib/typescript/components/Pagination/Custom/index.d.ts.map +0 -1
  341. package/lib/typescript/components/Pagination/index.d.ts +0 -5
  342. package/lib/typescript/components/Pagination/index.d.ts.map +0 -1
  343. package/lib/typescript/components/ScrollViewGesture.d.ts.map +0 -1
  344. package/lib/typescript/constants/index.d.ts.map +0 -1
  345. package/lib/typescript/hooks/useAutoPlay.d.ts +0 -12
  346. package/lib/typescript/hooks/useAutoPlay.d.ts.map +0 -1
  347. package/lib/typescript/hooks/useCarouselController.d.ts +0 -28
  348. package/lib/typescript/hooks/useCarouselController.d.ts.map +0 -1
  349. package/lib/typescript/hooks/useCheckMounted.d.ts.map +0 -1
  350. package/lib/typescript/hooks/useCommonVariables.d.ts +0 -13
  351. package/lib/typescript/hooks/useCommonVariables.d.ts.map +0 -1
  352. package/lib/typescript/hooks/useInitProps.d.ts +0 -10
  353. package/lib/typescript/hooks/useInitProps.d.ts.map +0 -1
  354. package/lib/typescript/hooks/useLayoutConfig.d.ts +0 -8
  355. package/lib/typescript/hooks/useLayoutConfig.d.ts.map +0 -1
  356. package/lib/typescript/hooks/useOffsetX.d.ts +0 -13
  357. package/lib/typescript/hooks/useOffsetX.d.ts.map +0 -1
  358. package/lib/typescript/hooks/useOnProgressChange.d.ts +0 -11
  359. package/lib/typescript/hooks/useOnProgressChange.d.ts.map +0 -1
  360. package/lib/typescript/hooks/usePanGestureProxy.d.ts.map +0 -1
  361. package/lib/typescript/hooks/usePropsErrorBoundary.d.ts +0 -5
  362. package/lib/typescript/hooks/usePropsErrorBoundary.d.ts.map +0 -1
  363. package/lib/typescript/hooks/useUpdateGestureConfig.d.ts +0 -6
  364. package/lib/typescript/hooks/useUpdateGestureConfig.d.ts.map +0 -1
  365. package/lib/typescript/hooks/useVisibleRanges.d.ts.map +0 -1
  366. package/lib/typescript/index.d.ts +0 -7
  367. package/lib/typescript/index.d.ts.map +0 -1
  368. package/lib/typescript/layouts/index.d.ts.map +0 -1
  369. package/lib/typescript/layouts/normal.d.ts +0 -13
  370. package/lib/typescript/layouts/normal.d.ts.map +0 -1
  371. package/lib/typescript/layouts/parallax.d.ts +0 -47
  372. package/lib/typescript/layouts/parallax.d.ts.map +0 -1
  373. package/lib/typescript/layouts/stack.d.ts +0 -38
  374. package/lib/typescript/layouts/stack.d.ts.map +0 -1
  375. package/lib/typescript/store/index.d.ts.map +0 -1
  376. package/lib/typescript/types.d.ts +0 -302
  377. package/lib/typescript/types.d.ts.map +0 -1
  378. package/lib/typescript/utils/compute-gesture-translation.d.ts.map +0 -1
  379. package/lib/typescript/utils/compute-offset-if-data-changed.d.ts +0 -9
  380. package/lib/typescript/utils/compute-offset-if-data-changed.d.ts.map +0 -1
  381. package/lib/typescript/utils/compute-offset-if-size-changed.d.ts.map +0 -1
  382. package/lib/typescript/utils/computed-with-auto-fill-data.d.ts.map +0 -1
  383. package/lib/typescript/utils/deal-with-animation.d.ts +0 -3
  384. package/lib/typescript/utils/deal-with-animation.d.ts.map +0 -1
  385. package/lib/typescript/utils/handleroffset-direction.d.ts +0 -4
  386. package/lib/typescript/utils/handleroffset-direction.d.ts.map +0 -1
  387. package/lib/typescript/utils/log.d.ts.map +0 -1
  388. package/lib/typescript/utils/sanitize-animation-style.d.ts.map +0 -1
  389. package/src/components/Pagination/Basic/PaginationItem.tsx +0 -149
  390. package/src/components/Pagination/Basic/index.tsx +0 -98
  391. package/src/components/Pagination/Custom/PaginationItem.tsx +0 -166
  392. package/src/components/Pagination/Custom/index.tsx +0 -111
  393. package/src/utils/compute-offset-if-data-changed.ts +0 -44
  394. package/src/utils/handleroffset-direction.ts +0 -18
  395. /package/lib/typescript/{components → commonjs/components}/LazyView.d.ts +0 -0
  396. /package/lib/typescript/{constants → commonjs/constants}/index.d.ts +0 -0
  397. /package/lib/typescript/{hooks → commonjs/hooks}/useCheckMounted.d.ts +0 -0
  398. /package/lib/typescript/{utils → commonjs/utils}/compute-gesture-translation.d.ts +0 -0
  399. /package/lib/typescript/{utils → commonjs/utils}/compute-offset-if-size-changed.d.ts +0 -0
  400. /package/lib/typescript/{utils → commonjs/utils}/computed-with-auto-fill-data.d.ts +0 -0
  401. /package/lib/typescript/{utils → commonjs/utils}/log.d.ts +0 -0
  402. /package/lib/typescript/{utils → commonjs/utils}/sanitize-animation-style.d.ts +0 -0
@@ -0,0 +1,502 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { readdir, readFile, stat, writeFile } from "node:fs/promises";
4
+ import { realpathSync } from "node:fs";
5
+ import path from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+ import ts from "typescript";
8
+
9
+ const packageName = "react-native-reanimated-carousel";
10
+ const migrationPrompt = [
11
+ "Read https://rn-carousel.dev/migration-v5.md and upgrade",
12
+ "react-native-reanimated-carousel to v5 in this project, then summarize",
13
+ "what changed for my review.",
14
+ ].join(" ");
15
+ const supportedExtensions = new Set([".js", ".jsx", ".ts", ".tsx"]);
16
+ const directPropRenames = new Map([
17
+ ["autoPlay", "autoplay"],
18
+ ["autoPlayInterval", "autoplayInterval"],
19
+ ["customAnimation", "itemAnimation"],
20
+ ["defaultScrollOffsetValue", "scrollOffsetValue"],
21
+ ["enabled", "scrollEnabled"],
22
+ ["windowSize", "renderWindowSize"],
23
+ ]);
24
+ const exportedTypeRenames = new Map([
25
+ ["ICarouselInstance", "CarouselRef"],
26
+ ["ILayoutConfig", "CarouselLayout"],
27
+ ["TAnimationStyle", "CarouselItemAnimation"],
28
+ ["TCarouselProps", "CarouselProps"],
29
+ ]);
30
+ const manualMigrationProps = new Set([
31
+ "autoFillData",
32
+ "customConfig",
33
+ "fixedDirection",
34
+ "height",
35
+ "maxScrollDistancePerSwipe",
36
+ "minScrollDistancePerSwipe",
37
+ "mode",
38
+ "modeConfig",
39
+ "onScrollEnd",
40
+ "scrollAnimationDuration",
41
+ "width",
42
+ "withAnimation",
43
+ ]);
44
+
45
+ function scriptKind(fileName) {
46
+ if (fileName.endsWith(".tsx")) return ts.ScriptKind.TSX;
47
+ if (fileName.endsWith(".jsx")) return ts.ScriptKind.JSX;
48
+ if (fileName.endsWith(".ts")) return ts.ScriptKind.TS;
49
+ return ts.ScriptKind.JS;
50
+ }
51
+
52
+ function importName(specifier) {
53
+ return (specifier.propertyName ?? specifier.name).text;
54
+ }
55
+
56
+ function jsxAttributeName(attribute) {
57
+ return ts.isJsxAttribute(attribute) && ts.isIdentifier(attribute.name)
58
+ ? attribute.name.text
59
+ : undefined;
60
+ }
61
+
62
+ function expressionFromBooleanAttribute(attribute) {
63
+ if (!attribute.initializer) return ts.factory.createTrue();
64
+ if (ts.isJsxExpression(attribute.initializer)) {
65
+ return attribute.initializer.expression ?? ts.factory.createTrue();
66
+ }
67
+ if (ts.isStringLiteral(attribute.initializer)) {
68
+ if (attribute.initializer.text === "false") return ts.factory.createFalse();
69
+ if (attribute.initializer.text === "true") return ts.factory.createTrue();
70
+ }
71
+ return ts.factory.createTrue();
72
+ }
73
+
74
+ function enumAttribute(name, condition, whenTrue, whenFalse) {
75
+ if (condition.kind === ts.SyntaxKind.TrueKeyword) {
76
+ return ts.factory.createJsxAttribute(
77
+ ts.factory.createIdentifier(name),
78
+ ts.factory.createStringLiteral(whenTrue)
79
+ );
80
+ }
81
+ if (condition.kind === ts.SyntaxKind.FalseKeyword) {
82
+ return ts.factory.createJsxAttribute(
83
+ ts.factory.createIdentifier(name),
84
+ ts.factory.createStringLiteral(whenFalse)
85
+ );
86
+ }
87
+
88
+ return ts.factory.createJsxAttribute(
89
+ ts.factory.createIdentifier(name),
90
+ ts.factory.createJsxExpression(
91
+ undefined,
92
+ ts.factory.createConditionalExpression(
93
+ condition,
94
+ ts.factory.createToken(ts.SyntaxKind.QuestionToken),
95
+ ts.factory.createStringLiteral(whenTrue),
96
+ ts.factory.createToken(ts.SyntaxKind.ColonToken),
97
+ ts.factory.createStringLiteral(whenFalse)
98
+ )
99
+ )
100
+ );
101
+ }
102
+
103
+ function renamedAttribute(attribute, name) {
104
+ return ts.factory.updateJsxAttribute(
105
+ attribute,
106
+ ts.factory.createIdentifier(name),
107
+ attribute.initializer
108
+ );
109
+ }
110
+
111
+ function itemSizeAttribute(attributes) {
112
+ const itemWidth = attributes.find((attribute) => jsxAttributeName(attribute) === "itemWidth");
113
+ const itemHeight = attributes.find((attribute) => jsxAttributeName(attribute) === "itemHeight");
114
+ if (!itemWidth && !itemHeight) return undefined;
115
+
116
+ const vertical = attributes.find((attribute) => jsxAttributeName(attribute) === "vertical");
117
+ const verticalCondition = vertical
118
+ ? expressionFromBooleanAttribute(vertical)
119
+ : ts.factory.createFalse();
120
+
121
+ let initializer;
122
+ if (itemWidth && itemHeight) {
123
+ if (verticalCondition.kind === ts.SyntaxKind.TrueKeyword) initializer = itemHeight.initializer;
124
+ else if (verticalCondition.kind === ts.SyntaxKind.FalseKeyword) initializer = itemWidth.initializer;
125
+ else {
126
+ const widthExpression = expressionFromBooleanAttribute(itemWidth);
127
+ const heightExpression = expressionFromBooleanAttribute(itemHeight);
128
+ initializer = ts.factory.createJsxExpression(
129
+ undefined,
130
+ ts.factory.createConditionalExpression(
131
+ verticalCondition,
132
+ ts.factory.createToken(ts.SyntaxKind.QuestionToken),
133
+ heightExpression,
134
+ ts.factory.createToken(ts.SyntaxKind.ColonToken),
135
+ widthExpression
136
+ )
137
+ );
138
+ }
139
+ } else {
140
+ initializer = (itemWidth ?? itemHeight).initializer;
141
+ }
142
+
143
+ return ts.factory.createJsxAttribute(
144
+ ts.factory.createIdentifier("itemSize"),
145
+ initializer ?? ts.factory.createJsxExpression(undefined, ts.factory.createTrue())
146
+ );
147
+ }
148
+
149
+ function snapModeAttribute(attributes) {
150
+ const snap = attributes.find((attribute) =>
151
+ ["enableSnap", "snapEnabled"].includes(jsxAttributeName(attribute) ?? "")
152
+ );
153
+ const paging = attributes.find((attribute) => jsxAttributeName(attribute) === "pagingEnabled");
154
+ if (!snap && !paging) return undefined;
155
+
156
+ const snapCondition = snap
157
+ ? expressionFromBooleanAttribute(snap)
158
+ : ts.factory.createTrue();
159
+ const pagingCondition = paging
160
+ ? expressionFromBooleanAttribute(paging)
161
+ : ts.factory.createTrue();
162
+
163
+ if (snapCondition.kind === ts.SyntaxKind.FalseKeyword) {
164
+ return ts.factory.createJsxAttribute(
165
+ ts.factory.createIdentifier("snapMode"),
166
+ ts.factory.createStringLiteral("none")
167
+ );
168
+ }
169
+ if (
170
+ snapCondition.kind === ts.SyntaxKind.TrueKeyword &&
171
+ pagingCondition.kind === ts.SyntaxKind.TrueKeyword
172
+ ) {
173
+ return ts.factory.createJsxAttribute(
174
+ ts.factory.createIdentifier("snapMode"),
175
+ ts.factory.createStringLiteral("page")
176
+ );
177
+ }
178
+ if (
179
+ snapCondition.kind === ts.SyntaxKind.TrueKeyword &&
180
+ pagingCondition.kind === ts.SyntaxKind.FalseKeyword
181
+ ) {
182
+ return ts.factory.createJsxAttribute(
183
+ ts.factory.createIdentifier("snapMode"),
184
+ ts.factory.createStringLiteral("nearest")
185
+ );
186
+ }
187
+
188
+ const modeExpression = ts.factory.createConditionalExpression(
189
+ pagingCondition,
190
+ ts.factory.createToken(ts.SyntaxKind.QuestionToken),
191
+ ts.factory.createStringLiteral("page"),
192
+ ts.factory.createToken(ts.SyntaxKind.ColonToken),
193
+ ts.factory.createStringLiteral("nearest")
194
+ );
195
+ const expression =
196
+ snapCondition.kind === ts.SyntaxKind.TrueKeyword
197
+ ? modeExpression
198
+ : ts.factory.createConditionalExpression(
199
+ snapCondition,
200
+ ts.factory.createToken(ts.SyntaxKind.QuestionToken),
201
+ modeExpression,
202
+ ts.factory.createToken(ts.SyntaxKind.ColonToken),
203
+ ts.factory.createStringLiteral("none")
204
+ );
205
+
206
+ return ts.factory.createJsxAttribute(
207
+ ts.factory.createIdentifier("snapMode"),
208
+ ts.factory.createJsxExpression(undefined, expression)
209
+ );
210
+ }
211
+
212
+ function migrateCarouselAttributes(properties, warnings, markChanged) {
213
+ const attributes = [...properties.properties];
214
+ const output = [];
215
+ const hasLoop = attributes.some((attribute) => jsxAttributeName(attribute) === "loop");
216
+ const generatedItemSize = itemSizeAttribute(attributes);
217
+ const generatedSnapMode = snapModeAttribute(attributes);
218
+
219
+ for (const attribute of attributes) {
220
+ const name = jsxAttributeName(attribute);
221
+ if (!name) {
222
+ output.push(attribute);
223
+ continue;
224
+ }
225
+ if (name === "itemWidth" || name === "itemHeight") {
226
+ markChanged();
227
+ continue;
228
+ }
229
+ if (name === "enableSnap" || name === "snapEnabled" || name === "pagingEnabled") {
230
+ markChanged();
231
+ continue;
232
+ }
233
+
234
+ if (name === "vertical") {
235
+ markChanged();
236
+ output.push(
237
+ enumAttribute(
238
+ "orientation",
239
+ expressionFromBooleanAttribute(attribute),
240
+ "vertical",
241
+ "horizontal"
242
+ )
243
+ );
244
+ continue;
245
+ }
246
+ if (name === "autoPlayReverse") {
247
+ markChanged();
248
+ output.push(
249
+ enumAttribute(
250
+ "autoplayDirection",
251
+ expressionFromBooleanAttribute(attribute),
252
+ "backward",
253
+ "forward"
254
+ )
255
+ );
256
+ continue;
257
+ }
258
+ if (directPropRenames.has(name)) {
259
+ markChanged();
260
+ output.push(renamedAttribute(attribute, directPropRenames.get(name)));
261
+ continue;
262
+ }
263
+ if (manualMigrationProps.has(name)) warnings.add(name);
264
+ output.push(attribute);
265
+ }
266
+
267
+ if (generatedItemSize) output.push(generatedItemSize);
268
+ if (generatedSnapMode) output.push(generatedSnapMode);
269
+ if (!hasLoop) {
270
+ markChanged();
271
+ output.push(
272
+ ts.factory.createJsxAttribute(
273
+ ts.factory.createIdentifier("loop"),
274
+ ts.factory.createJsxExpression(undefined, ts.factory.createTrue())
275
+ )
276
+ );
277
+ }
278
+
279
+ return ts.factory.updateJsxAttributes(properties, output);
280
+ }
281
+
282
+ export function transformSource(source, fileName = "source.tsx") {
283
+ const sourceFile = ts.createSourceFile(
284
+ fileName,
285
+ source,
286
+ ts.ScriptTarget.Latest,
287
+ true,
288
+ scriptKind(fileName)
289
+ );
290
+ const carouselNames = new Set();
291
+ const warnings = new Set();
292
+ let didTransform = false;
293
+
294
+ for (const statement of sourceFile.statements) {
295
+ if (
296
+ !ts.isImportDeclaration(statement) ||
297
+ !ts.isStringLiteral(statement.moduleSpecifier) ||
298
+ statement.moduleSpecifier.text !== packageName
299
+ ) {
300
+ continue;
301
+ }
302
+
303
+ const clause = statement.importClause;
304
+ if (clause?.name) carouselNames.add(clause.name.text);
305
+ if (clause?.namedBindings && ts.isNamedImports(clause.namedBindings)) {
306
+ for (const specifier of clause.namedBindings.elements) {
307
+ if (importName(specifier) === "Carousel") carouselNames.add(specifier.name.text);
308
+ }
309
+ }
310
+ }
311
+
312
+ const transformer = (context) => {
313
+ const visit = (node) => {
314
+ if (
315
+ ts.isImportDeclaration(node) &&
316
+ ts.isStringLiteral(node.moduleSpecifier) &&
317
+ node.moduleSpecifier.text === packageName &&
318
+ node.importClause
319
+ ) {
320
+ const clause = node.importClause;
321
+ const elements =
322
+ clause.namedBindings && ts.isNamedImports(clause.namedBindings)
323
+ ? [...clause.namedBindings.elements]
324
+ : [];
325
+
326
+ const migratedElements = elements.map((specifier) => {
327
+ const currentImport = importName(specifier);
328
+ const replacement = exportedTypeRenames.get(currentImport);
329
+ if (!replacement) return specifier;
330
+ didTransform = true;
331
+ return ts.factory.updateImportSpecifier(
332
+ specifier,
333
+ specifier.isTypeOnly,
334
+ ts.factory.createIdentifier(replacement),
335
+ specifier.name
336
+ );
337
+ });
338
+
339
+ if (clause.name) {
340
+ didTransform = true;
341
+ const duplicate = migratedElements.some(
342
+ (specifier) =>
343
+ importName(specifier) === "Carousel" && specifier.name.text === clause.name.text
344
+ );
345
+ if (!duplicate) {
346
+ migratedElements.unshift(
347
+ ts.factory.createImportSpecifier(
348
+ false,
349
+ clause.name.text === "Carousel"
350
+ ? undefined
351
+ : ts.factory.createIdentifier("Carousel"),
352
+ clause.name
353
+ )
354
+ );
355
+ }
356
+ }
357
+
358
+ if (!didTransform) return node;
359
+
360
+ return ts.factory.updateImportDeclaration(
361
+ node,
362
+ node.modifiers,
363
+ ts.factory.updateImportClause(
364
+ clause,
365
+ clause.isTypeOnly,
366
+ undefined,
367
+ ts.factory.createNamedImports(migratedElements)
368
+ ),
369
+ node.moduleSpecifier,
370
+ node.attributes
371
+ );
372
+ }
373
+
374
+ if (
375
+ ts.isJsxSelfClosingElement(node) &&
376
+ ts.isIdentifier(node.tagName) &&
377
+ carouselNames.has(node.tagName.text)
378
+ ) {
379
+ return ts.factory.updateJsxSelfClosingElement(
380
+ node,
381
+ node.tagName,
382
+ node.typeArguments,
383
+ migrateCarouselAttributes(node.attributes, warnings, () => {
384
+ didTransform = true;
385
+ })
386
+ );
387
+ }
388
+
389
+ if (
390
+ ts.isJsxOpeningElement(node) &&
391
+ ts.isIdentifier(node.tagName) &&
392
+ carouselNames.has(node.tagName.text)
393
+ ) {
394
+ return ts.factory.updateJsxOpeningElement(
395
+ node,
396
+ node.tagName,
397
+ node.typeArguments,
398
+ migrateCarouselAttributes(node.attributes, warnings, () => {
399
+ didTransform = true;
400
+ })
401
+ );
402
+ }
403
+
404
+ return ts.visitEachChild(node, visit, context);
405
+ };
406
+
407
+ return (root) => ts.visitNode(root, visit);
408
+ };
409
+
410
+ const result = ts.transform(sourceFile, [transformer]);
411
+ const transformed = result.transformed[0];
412
+ const output = didTransform
413
+ ? ts
414
+ .createPrinter({ newLine: ts.NewLineKind.LineFeed })
415
+ .printFile(transformed)
416
+ .replace(/[ \t]+$/gm, "")
417
+ : source;
418
+ result.dispose();
419
+
420
+ return {
421
+ changed: didTransform && output.trimEnd() !== source.trimEnd(),
422
+ code: output,
423
+ warnings: [...warnings].sort(),
424
+ };
425
+ }
426
+
427
+ async function collectFiles(inputPath) {
428
+ const metadata = await stat(inputPath);
429
+ if (metadata.isFile()) {
430
+ return supportedExtensions.has(path.extname(inputPath)) ? [inputPath] : [];
431
+ }
432
+
433
+ const files = [];
434
+ for (const entry of await readdir(inputPath, { withFileTypes: true })) {
435
+ if (entry.name === "node_modules" || entry.name.startsWith(".")) continue;
436
+ files.push(...(await collectFiles(path.join(inputPath, entry.name))));
437
+ }
438
+ return files;
439
+ }
440
+
441
+ export function completionOutput(dryRun) {
442
+ return [
443
+ dryRun
444
+ ? "Mechanical migration preview complete; no files were written."
445
+ : "Mechanical migration complete.",
446
+ "Behavioral migration review is still required. Give this prompt to your AI agent:",
447
+ migrationPrompt,
448
+ ].join("\n");
449
+ }
450
+
451
+ async function main() {
452
+ const args = process.argv.slice(2);
453
+ const dryRun = args.includes("--dry");
454
+ const inputs = args.filter((arg) => arg !== "--dry");
455
+ if (inputs.length === 0) {
456
+ console.error("Usage: node scripts/codemods/v5.mjs [--dry] <file-or-directory> [...]");
457
+ process.exitCode = 2;
458
+ return;
459
+ }
460
+
461
+ const files = (
462
+ await Promise.all(inputs.map((input) => collectFiles(path.resolve(process.cwd(), input))))
463
+ ).flat();
464
+ let changed = 0;
465
+
466
+ for (const file of files) {
467
+ const source = await readFile(file, "utf8");
468
+ const result = transformSource(source, file);
469
+ if (!result.changed) {
470
+ if (result.warnings.length > 0) {
471
+ const relative = path.relative(process.cwd(), file);
472
+ console.warn(`review ${relative}`);
473
+ console.warn(
474
+ ` manual migration still required for: ${result.warnings.map((name) => `\`${name}\``).join(", ")}`
475
+ );
476
+ }
477
+ continue;
478
+ }
479
+ changed += 1;
480
+ if (!dryRun) await writeFile(file, result.code);
481
+ const relative = path.relative(process.cwd(), file);
482
+ console.log(`${dryRun ? "would update" : "updated"} ${relative}`);
483
+ if (result.warnings.length > 0) {
484
+ console.warn(
485
+ ` manual migration still required for: ${result.warnings.map((name) => `\`${name}\``).join(", ")}`
486
+ );
487
+ }
488
+ }
489
+
490
+ console.log(`${dryRun ? "would update" : "updated"} ${changed} file(s)`);
491
+ console.log(completionOutput(dryRun));
492
+ }
493
+
494
+ if (
495
+ process.argv[1] &&
496
+ realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url))
497
+ ) {
498
+ main().catch((error) => {
499
+ console.error(error.stack ?? error.message);
500
+ process.exitCode = 1;
501
+ });
502
+ }
@@ -3,10 +3,10 @@ import { useCommonVariables } from "../hooks/useCommonVariables";
3
3
  import { useInitProps } from "../hooks/useInitProps";
4
4
  import { usePropsErrorBoundary } from "../hooks/usePropsErrorBoundary";
5
5
  import { GlobalStateProvider } from "../store";
6
- import type { ICarouselInstance, TCarouselProps } from "../types";
6
+ import type { CarouselProps, CarouselRef } from "../types";
7
7
  import { CarouselLayout } from "./CarouselLayout";
8
8
 
9
- const Carousel = React.forwardRef<ICarouselInstance, TCarouselProps<any>>((_props, ref) => {
9
+ const CarouselImpl = React.forwardRef<CarouselRef, CarouselProps<unknown>>((_props, ref) => {
10
10
  const props = useInitProps(_props);
11
11
  const { dataLength } = props;
12
12
  const commonVariables = useCommonVariables(props);
@@ -20,9 +20,9 @@ const Carousel = React.forwardRef<ICarouselInstance, TCarouselProps<any>>((_prop
20
20
  });
21
21
 
22
22
  type CarouselComponent = <T>(
23
- props: React.PropsWithChildren<TCarouselProps<T>> & {
24
- ref?: React.Ref<ICarouselInstance>;
23
+ props: CarouselProps<T> & {
24
+ ref?: React.Ref<CarouselRef>;
25
25
  }
26
26
  ) => React.ReactElement;
27
27
 
28
- export default Carousel as CarouselComponent;
28
+ export const Carousel = CarouselImpl as CarouselComponent;