vane-waterfall 1.0.5 → 2.0.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 (246) hide show
  1. package/README.md +174 -365
  2. package/dist/chunks/WaterfallCore-BSXw7bl_.js +581 -0
  3. package/dist/chunks/doc-3Fpag2G8.js +84 -0
  4. package/dist/chunks/doc-78xF08vt.js +82 -0
  5. package/dist/chunks/doc-B-7dugGv.js +79 -0
  6. package/dist/chunks/doc-B6kLfMPv.js +121 -0
  7. package/dist/chunks/doc-BCGQ8Cp5.js +114 -0
  8. package/dist/chunks/doc-BIzjYAZW.js +50 -0
  9. package/dist/chunks/doc-BP0DmB7-.js +91 -0
  10. package/dist/chunks/doc-BXElhF2h.js +138 -0
  11. package/dist/chunks/doc-BXSy2aPP.js +59 -0
  12. package/dist/chunks/doc-BfWnfTst.js +83 -0
  13. package/dist/chunks/doc-BtzhgTYj.js +85 -0
  14. package/dist/chunks/doc-C5xrHNoC.js +70 -0
  15. package/dist/chunks/doc-CBHjiDG7.js +88 -0
  16. package/dist/chunks/doc-CTUoMe7o.js +79 -0
  17. package/dist/chunks/doc-CcPFavOs.js +56 -0
  18. package/dist/chunks/doc-CraXjOaA.js +68 -0
  19. package/dist/chunks/doc-DElLNjIc.js +61 -0
  20. package/dist/chunks/doc-DJjxOYzW.js +111 -0
  21. package/dist/chunks/doc-DukOmDCo.js +95 -0
  22. package/dist/chunks/doc-DzvTrZ13.js +60 -0
  23. package/dist/chunks/doc-NhL4Ux8q.js +125 -0
  24. package/dist/chunks/doc-bTHwfIVb.js +78 -0
  25. package/dist/chunks/doc-f4Uijujv.js +102 -0
  26. package/dist/chunks/doc-gTAsLjVx.js +55 -0
  27. package/dist/chunks/doc-j4W9SUrY.js +76 -0
  28. package/dist/chunks/doc-kTbJE7rY.js +92 -0
  29. package/dist/chunks/index-BAWlVYr3.js +5 -0
  30. package/dist/chunks/index-COaun3nf.js +15 -0
  31. package/dist/chunks/index-DXAtA2f6.js +11 -0
  32. package/dist/chunks/index-DsRLmBW-.js +13 -0
  33. package/dist/chunks/index-gjoCq0yC.js +21 -0
  34. package/dist/chunks/index-wLI6UXkY.js +5 -0
  35. package/dist/chunks/withPlugins-DLoKg4AP.js +559 -0
  36. package/dist/components/WaterfallPlugin/WaterfallCore.d.ts +124 -0
  37. package/dist/components/WaterfallPlugin/WaterfallCore.d.ts.map +1 -0
  38. package/dist/components/WaterfallPlugin/index.d.ts +9 -10
  39. package/dist/components/WaterfallPlugin/index.d.ts.map +1 -0
  40. package/dist/components/WaterfallPlugin/layout.d.ts +41 -0
  41. package/dist/components/WaterfallPlugin/layout.d.ts.map +1 -0
  42. package/dist/components/WaterfallPlugin/plugins/types.d.ts +76 -380
  43. package/dist/components/WaterfallPlugin/plugins/types.d.ts.map +1 -0
  44. package/dist/components/WaterfallPlugin/virtualize.d.ts +62 -0
  45. package/dist/components/WaterfallPlugin/virtualize.d.ts.map +1 -0
  46. package/dist/components/WaterfallPlugin/{plugins/withPlugins.d.ts → withPlugins.d.ts} +4 -2
  47. package/dist/components/WaterfallPlugin/withPlugins.d.ts.map +1 -0
  48. package/dist/custom-plugins/A11yPlugin/create.d.ts +23 -0
  49. package/dist/custom-plugins/A11yPlugin/create.d.ts.map +1 -0
  50. package/dist/custom-plugins/A11yPlugin/doc.json.d.ts +52 -0
  51. package/dist/custom-plugins/A11yPlugin/index.d.ts +11 -0
  52. package/dist/custom-plugins/A11yPlugin/index.d.ts.map +1 -0
  53. package/dist/custom-plugins/A11yPlugin/index.js +5 -0
  54. package/dist/{components/WaterfallPlugin/custom-plugins/Alignment/index.d.ts → custom-plugins/AlignmentPlugin/create.d.ts} +3 -3
  55. package/dist/custom-plugins/AlignmentPlugin/create.d.ts.map +1 -0
  56. package/dist/custom-plugins/AlignmentPlugin/doc.json.d.ts +34 -0
  57. package/dist/custom-plugins/AlignmentPlugin/index.d.ts +11 -0
  58. package/dist/custom-plugins/AlignmentPlugin/index.d.ts.map +1 -0
  59. package/dist/custom-plugins/AlignmentPlugin/index.js +5 -0
  60. package/dist/custom-plugins/AutoColumnPlugin/create.d.ts +18 -0
  61. package/dist/custom-plugins/AutoColumnPlugin/create.d.ts.map +1 -0
  62. package/dist/custom-plugins/AutoColumnPlugin/doc.json.d.ts +50 -0
  63. package/dist/custom-plugins/AutoColumnPlugin/index.d.ts +11 -0
  64. package/dist/custom-plugins/AutoColumnPlugin/index.d.ts.map +1 -0
  65. package/dist/custom-plugins/AutoColumnPlugin/index.js +5 -0
  66. package/dist/{components/WaterfallPlugin/custom-plugins/Bookmark/index.d.ts → custom-plugins/BookmarkPlugin/create.d.ts} +3 -3
  67. package/dist/custom-plugins/BookmarkPlugin/create.d.ts.map +1 -0
  68. package/dist/custom-plugins/BookmarkPlugin/doc.json.d.ts +41 -0
  69. package/dist/custom-plugins/BookmarkPlugin/index.d.ts +11 -0
  70. package/dist/custom-plugins/BookmarkPlugin/index.d.ts.map +1 -0
  71. package/dist/custom-plugins/BookmarkPlugin/index.js +5 -0
  72. package/dist/custom-plugins/ClickAnalyticsPlugin/create.d.ts +25 -0
  73. package/dist/custom-plugins/ClickAnalyticsPlugin/create.d.ts.map +1 -0
  74. package/dist/custom-plugins/ClickAnalyticsPlugin/doc.json.d.ts +41 -0
  75. package/dist/custom-plugins/ClickAnalyticsPlugin/index.d.ts +11 -0
  76. package/dist/custom-plugins/ClickAnalyticsPlugin/index.d.ts.map +1 -0
  77. package/dist/custom-plugins/ClickAnalyticsPlugin/index.js +5 -0
  78. package/dist/{components/WaterfallPlugin/custom-plugins/DebounceLayout/index.d.ts → custom-plugins/DebounceLayoutPlugin/create.d.ts} +3 -3
  79. package/dist/custom-plugins/DebounceLayoutPlugin/create.d.ts.map +1 -0
  80. package/dist/custom-plugins/DebounceLayoutPlugin/doc.json.d.ts +34 -0
  81. package/dist/custom-plugins/DebounceLayoutPlugin/index.d.ts +11 -0
  82. package/dist/custom-plugins/DebounceLayoutPlugin/index.d.ts.map +1 -0
  83. package/dist/custom-plugins/DebounceLayoutPlugin/index.js +5 -0
  84. package/dist/custom-plugins/DragReorderPlugin/create.d.ts +33 -0
  85. package/dist/custom-plugins/DragReorderPlugin/create.d.ts.map +1 -0
  86. package/dist/custom-plugins/DragReorderPlugin/doc.json.d.ts +53 -0
  87. package/dist/custom-plugins/DragReorderPlugin/index.d.ts +11 -0
  88. package/dist/custom-plugins/DragReorderPlugin/index.d.ts.map +1 -0
  89. package/dist/custom-plugins/DragReorderPlugin/index.js +5 -0
  90. package/dist/{components/WaterfallPlugin/custom-plugins/Filter/index.d.ts → custom-plugins/FilterPlugin/create.d.ts} +3 -3
  91. package/dist/custom-plugins/FilterPlugin/create.d.ts.map +1 -0
  92. package/dist/custom-plugins/FilterPlugin/doc.json.d.ts +47 -0
  93. package/dist/custom-plugins/FilterPlugin/index.d.ts +11 -0
  94. package/dist/custom-plugins/FilterPlugin/index.d.ts.map +1 -0
  95. package/dist/custom-plugins/FilterPlugin/index.js +5 -0
  96. package/dist/{components/WaterfallPlugin/custom-plugins/FixedHeight/index.d.ts → custom-plugins/FixedHeightPlugin/create.d.ts} +3 -3
  97. package/dist/custom-plugins/FixedHeightPlugin/create.d.ts.map +1 -0
  98. package/dist/custom-plugins/FixedHeightPlugin/doc.json.d.ts +34 -0
  99. package/dist/custom-plugins/FixedHeightPlugin/index.d.ts +11 -0
  100. package/dist/custom-plugins/FixedHeightPlugin/index.d.ts.map +1 -0
  101. package/dist/custom-plugins/FixedHeightPlugin/index.js +5 -0
  102. package/dist/{components/WaterfallPlugin/custom-plugins/Gap/index.d.ts → custom-plugins/GapPlugin/create.d.ts} +3 -3
  103. package/dist/custom-plugins/GapPlugin/create.d.ts.map +1 -0
  104. package/dist/custom-plugins/GapPlugin/doc.json.d.ts +47 -0
  105. package/dist/custom-plugins/GapPlugin/index.d.ts +11 -0
  106. package/dist/custom-plugins/GapPlugin/index.d.ts.map +1 -0
  107. package/dist/custom-plugins/GapPlugin/index.js +5 -0
  108. package/dist/custom-plugins/GroupingPlugin/create.d.ts +16 -0
  109. package/dist/custom-plugins/GroupingPlugin/create.d.ts.map +1 -0
  110. package/dist/custom-plugins/GroupingPlugin/doc.json.d.ts +40 -0
  111. package/dist/custom-plugins/GroupingPlugin/index.d.ts +11 -0
  112. package/dist/custom-plugins/GroupingPlugin/index.d.ts.map +1 -0
  113. package/dist/custom-plugins/GroupingPlugin/index.js +5 -0
  114. package/dist/custom-plugins/HeatmapAnalyticsPlugin/create.d.ts +31 -0
  115. package/dist/custom-plugins/HeatmapAnalyticsPlugin/create.d.ts.map +1 -0
  116. package/dist/custom-plugins/HeatmapAnalyticsPlugin/doc.json.d.ts +43 -0
  117. package/dist/custom-plugins/HeatmapAnalyticsPlugin/index.d.ts +11 -0
  118. package/dist/custom-plugins/HeatmapAnalyticsPlugin/index.d.ts.map +1 -0
  119. package/dist/custom-plugins/HeatmapAnalyticsPlugin/index.js +5 -0
  120. package/dist/custom-plugins/InfiniteScrollPlugin/create.d.ts +17 -0
  121. package/dist/custom-plugins/InfiniteScrollPlugin/create.d.ts.map +1 -0
  122. package/dist/custom-plugins/InfiniteScrollPlugin/doc.json.d.ts +44 -0
  123. package/dist/custom-plugins/InfiniteScrollPlugin/index.d.ts +11 -0
  124. package/dist/custom-plugins/InfiniteScrollPlugin/index.d.ts.map +1 -0
  125. package/dist/custom-plugins/InfiniteScrollPlugin/index.js +5 -0
  126. package/dist/{components/WaterfallPlugin/custom-plugins/Pagination/index.d.ts → custom-plugins/PaginationPlugin/create.d.ts} +3 -3
  127. package/dist/custom-plugins/PaginationPlugin/create.d.ts.map +1 -0
  128. package/dist/custom-plugins/PaginationPlugin/doc.json.d.ts +50 -0
  129. package/dist/custom-plugins/PaginationPlugin/index.d.ts +11 -0
  130. package/dist/custom-plugins/PaginationPlugin/index.d.ts.map +1 -0
  131. package/dist/custom-plugins/PaginationPlugin/index.js +5 -0
  132. package/dist/custom-plugins/PinItemPlugin/create.d.ts +23 -0
  133. package/dist/custom-plugins/PinItemPlugin/create.d.ts.map +1 -0
  134. package/dist/custom-plugins/PinItemPlugin/doc.json.d.ts +43 -0
  135. package/dist/custom-plugins/PinItemPlugin/index.d.ts +11 -0
  136. package/dist/custom-plugins/PinItemPlugin/index.d.ts.map +1 -0
  137. package/dist/custom-plugins/PinItemPlugin/index.js +5 -0
  138. package/dist/{components/WaterfallPlugin/custom-plugins/Recycle/index.d.ts → custom-plugins/RecyclePlugin/create.d.ts} +3 -3
  139. package/dist/custom-plugins/RecyclePlugin/create.d.ts.map +1 -0
  140. package/dist/custom-plugins/RecyclePlugin/doc.json.d.ts +35 -0
  141. package/dist/custom-plugins/RecyclePlugin/index.d.ts +11 -0
  142. package/dist/custom-plugins/RecyclePlugin/index.d.ts.map +1 -0
  143. package/dist/custom-plugins/RecyclePlugin/index.js +5 -0
  144. package/dist/custom-plugins/ReducedMotionPlugin/create.d.ts +25 -0
  145. package/dist/custom-plugins/ReducedMotionPlugin/create.d.ts.map +1 -0
  146. package/dist/custom-plugins/ReducedMotionPlugin/doc.json.d.ts +42 -0
  147. package/dist/custom-plugins/ReducedMotionPlugin/index.d.ts +11 -0
  148. package/dist/custom-plugins/ReducedMotionPlugin/index.d.ts.map +1 -0
  149. package/dist/custom-plugins/ReducedMotionPlugin/index.js +5 -0
  150. package/dist/custom-plugins/ResponsiveColumnsPlugin/create.d.ts +22 -0
  151. package/dist/custom-plugins/ResponsiveColumnsPlugin/create.d.ts.map +1 -0
  152. package/dist/custom-plugins/ResponsiveColumnsPlugin/doc.json.d.ts +37 -0
  153. package/dist/custom-plugins/ResponsiveColumnsPlugin/index.d.ts +10 -0
  154. package/dist/custom-plugins/ResponsiveColumnsPlugin/index.d.ts.map +1 -0
  155. package/dist/custom-plugins/ResponsiveColumnsPlugin/index.js +5 -0
  156. package/dist/{components/WaterfallPlugin/custom-plugins/ScrollAnchor/index.d.ts → custom-plugins/ScrollAnchorPlugin/create.d.ts} +3 -3
  157. package/dist/custom-plugins/ScrollAnchorPlugin/create.d.ts.map +1 -0
  158. package/dist/custom-plugins/ScrollAnchorPlugin/doc.json.d.ts +34 -0
  159. package/dist/custom-plugins/ScrollAnchorPlugin/index.d.ts +11 -0
  160. package/dist/custom-plugins/ScrollAnchorPlugin/index.d.ts.map +1 -0
  161. package/dist/custom-plugins/ScrollAnchorPlugin/index.js +5 -0
  162. package/dist/{components/WaterfallPlugin/custom-plugins/Search/index.d.ts → custom-plugins/SearchPlugin/create.d.ts} +3 -3
  163. package/dist/custom-plugins/SearchPlugin/create.d.ts.map +1 -0
  164. package/dist/custom-plugins/SearchPlugin/doc.json.d.ts +47 -0
  165. package/dist/custom-plugins/SearchPlugin/index.d.ts +11 -0
  166. package/dist/custom-plugins/SearchPlugin/index.d.ts.map +1 -0
  167. package/dist/custom-plugins/SearchPlugin/index.js +5 -0
  168. package/dist/{components/WaterfallPlugin/custom-plugins/Sort/index.d.ts → custom-plugins/SortPlugin/create.d.ts} +3 -3
  169. package/dist/custom-plugins/SortPlugin/create.d.ts.map +1 -0
  170. package/dist/custom-plugins/SortPlugin/doc.json.d.ts +46 -0
  171. package/dist/custom-plugins/SortPlugin/index.d.ts +11 -0
  172. package/dist/custom-plugins/SortPlugin/index.d.ts.map +1 -0
  173. package/dist/custom-plugins/SortPlugin/index.js +5 -0
  174. package/dist/{components/WaterfallPlugin/custom-plugins/StatePersistence/index.d.ts → custom-plugins/StatePersistencePlugin/create.d.ts} +3 -3
  175. package/dist/custom-plugins/StatePersistencePlugin/create.d.ts.map +1 -0
  176. package/dist/custom-plugins/StatePersistencePlugin/doc.json.d.ts +47 -0
  177. package/dist/custom-plugins/StatePersistencePlugin/index.d.ts +11 -0
  178. package/dist/custom-plugins/StatePersistencePlugin/index.d.ts.map +1 -0
  179. package/dist/custom-plugins/StatePersistencePlugin/index.js +5 -0
  180. package/dist/custom-plugins/StickyHeaderPlugin/create.d.ts +13 -0
  181. package/dist/custom-plugins/StickyHeaderPlugin/create.d.ts.map +1 -0
  182. package/dist/custom-plugins/StickyHeaderPlugin/doc.json.d.ts +40 -0
  183. package/dist/custom-plugins/StickyHeaderPlugin/index.d.ts +11 -0
  184. package/dist/custom-plugins/StickyHeaderPlugin/index.d.ts.map +1 -0
  185. package/dist/custom-plugins/StickyHeaderPlugin/index.js +5 -0
  186. package/dist/{components/WaterfallPlugin/custom-plugins/Throttle/index.d.ts → custom-plugins/ThrottlePlugin/create.d.ts} +3 -3
  187. package/dist/custom-plugins/ThrottlePlugin/create.d.ts.map +1 -0
  188. package/dist/custom-plugins/ThrottlePlugin/doc.json.d.ts +40 -0
  189. package/dist/custom-plugins/ThrottlePlugin/index.d.ts +11 -0
  190. package/dist/custom-plugins/ThrottlePlugin/index.d.ts.map +1 -0
  191. package/dist/custom-plugins/ThrottlePlugin/index.js +5 -0
  192. package/dist/{components/WaterfallPlugin/custom-plugins/Transition/index.d.ts → custom-plugins/TransitionPlugin/create.d.ts} +3 -3
  193. package/dist/custom-plugins/TransitionPlugin/create.d.ts.map +1 -0
  194. package/dist/custom-plugins/TransitionPlugin/doc.json.d.ts +43 -0
  195. package/dist/custom-plugins/TransitionPlugin/index.d.ts +11 -0
  196. package/dist/custom-plugins/TransitionPlugin/index.d.ts.map +1 -0
  197. package/dist/custom-plugins/TransitionPlugin/index.js +5 -0
  198. package/dist/{components/WaterfallPlugin/custom-plugins/URLSync/index.d.ts → custom-plugins/URLSyncPlugin/create.d.ts} +3 -3
  199. package/dist/custom-plugins/URLSyncPlugin/create.d.ts.map +1 -0
  200. package/dist/custom-plugins/URLSyncPlugin/doc.json.d.ts +41 -0
  201. package/dist/custom-plugins/URLSyncPlugin/index.d.ts +11 -0
  202. package/dist/custom-plugins/URLSyncPlugin/index.d.ts.map +1 -0
  203. package/dist/custom-plugins/URLSyncPlugin/index.js +5 -0
  204. package/dist/custom-plugins/index.d.ts +61 -0
  205. package/dist/custom-plugins/index.d.ts.map +1 -0
  206. package/dist/custom-plugins/index.js +34 -0
  207. package/dist/entries/core.d.ts +8 -0
  208. package/dist/entries/core.d.ts.map +1 -0
  209. package/dist/entries/core.js +7 -0
  210. package/dist/entries/plugins.d.ts +7 -0
  211. package/dist/entries/plugins.d.ts.map +1 -0
  212. package/dist/entries/plugins.js +36 -0
  213. package/dist/index.d.ts +14 -9
  214. package/dist/index.d.ts.map +1 -0
  215. package/dist/index.js +8 -0
  216. package/dist/presets/dashboard/index.d.ts +13 -0
  217. package/dist/presets/dashboard/index.d.ts.map +1 -0
  218. package/dist/presets/dashboard/index.js +21 -0
  219. package/dist/presets/photo-feed/index.d.ts +13 -0
  220. package/dist/presets/photo-feed/index.d.ts.map +1 -0
  221. package/dist/presets/photo-feed/index.js +17 -0
  222. package/dist/presets/product-feed/index.d.ts +9 -0
  223. package/dist/presets/product-feed/index.d.ts.map +1 -0
  224. package/dist/presets/product-feed/index.js +23 -0
  225. package/package.json +222 -82
  226. package/dist/404.jpg +0 -0
  227. package/dist/components/WaterfallPlugin/core/WaterfallCore.d.ts +0 -174
  228. package/dist/components/WaterfallPlugin/custom-plugins/A11y/index.d.ts +0 -16
  229. package/dist/components/WaterfallPlugin/custom-plugins/AutoColumn/index.d.ts +0 -17
  230. package/dist/components/WaterfallPlugin/custom-plugins/ClickAnalytics/index.d.ts +0 -12
  231. package/dist/components/WaterfallPlugin/custom-plugins/DragReorder/index.d.ts +0 -13
  232. package/dist/components/WaterfallPlugin/custom-plugins/Grouping/index.d.ts +0 -12
  233. package/dist/components/WaterfallPlugin/custom-plugins/HeatmapAnalytics/index.d.ts +0 -14
  234. package/dist/components/WaterfallPlugin/custom-plugins/InfiniteScroll/index.d.ts +0 -13
  235. package/dist/components/WaterfallPlugin/custom-plugins/PinItem/index.d.ts +0 -13
  236. package/dist/components/WaterfallPlugin/custom-plugins/ReducedMotion/index.d.ts +0 -13
  237. package/dist/components/WaterfallPlugin/custom-plugins/ResponsiveColumns/index.d.ts +0 -10
  238. package/dist/components/WaterfallPlugin/custom-plugins/StickyHeader/index.d.ts +0 -11
  239. package/dist/components/WaterfallPlugin/custom-plugins/VirtualWaterfall/index.d.ts +0 -12
  240. package/dist/components/WaterfallPlugin/custom-plugins/index.d.ts +0 -30
  241. package/dist/components/WaterfallPlugin/plugins/PluginBus.d.ts +0 -2
  242. package/dist/components/WaterfallPlugin/plugins/PluginManager.d.ts +0 -2
  243. package/dist/components/WaterfallPlugin/plugins/index.d.ts +0 -8
  244. package/dist/index.es.js +0 -2382
  245. package/dist/index.umd.js +0 -30
  246. package/dist/vite.svg +0 -1
@@ -1,10 +1,9 @@
1
- /**
2
- * WaterfallPlugin 系统入口
3
- */
4
- export { default as WaterfallCore } from './core/WaterfallCore';
5
- export type { WaterfallCoreProps, WaterfallCoreRef, ScrollToOptions, ScrollToItemOptions, } from './core/WaterfallCore';
6
- export type { WaterfallPlugin, PluginManager, PluginBus, WaterfallPluginContext, WaterfallPluginHooks, PluginCreator, WithPluginsConfig, ItemPosition, LayoutInfo, ViewportInfo, ItemVisibility, PerformanceMetrics, DeviceInfo, NetworkInfo, AnimationConfig, DragInfo, ItemRenderer, ItemKeyExtractor, } from './plugins';
7
- export { createPluginBus } from './plugins';
8
- export { createPluginManager } from './plugins';
9
- export { withPlugins } from './plugins';
10
- export * from './custom-plugins';
1
+ /** 瀑布流领域装配层与类型(内部入口,对外只经 index / entries 暴露) */
2
+ export { default as WaterfallCore } from './WaterfallCore';
3
+ export type { WaterfallCoreProps, WaterfallCoreRef, ScrollToItemOptions, ScrollToOptions, } from './WaterfallCore';
4
+ export { withPlugins } from './withPlugins';
5
+ export type { WithPluginsConfig } from './withPlugins';
6
+ export * from './plugins/types';
7
+ export { computeLayout, computeScrollTopForItem, normalizePadding, type AlignmentMode, type LayoutHooks, type LayoutParams, type LayoutResult, type Padding, } from './layout';
8
+ export { computeVisibleRange, type VirtualizeOptions, type VisibleRange } from './virtualize';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/WaterfallPlugin/index.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,cAAc,iBAAiB,CAAC;AAChC,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,gBAAgB,EAChB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,OAAO,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { ItemPosition } from './plugins/types';
2
+ export type AlignmentMode = "shortest" | "balanced" | "sequential";
3
+ export interface Padding {
4
+ top: number;
5
+ right: number;
6
+ bottom: number;
7
+ left: number;
8
+ }
9
+ export declare function normalizePadding(padding?: number | Partial<Padding>): Padding;
10
+ export interface LayoutHooks {
11
+ calculateColumns?: (base: number) => number | void;
12
+ calculateColumnWidth?: (base: number, columns: number, containerWidth: number) => number | void;
13
+ calculateItemPosition?: (index: number, itemHeight: number, base: ItemPosition) => Partial<ItemPosition> | null | void;
14
+ }
15
+ export interface LayoutParams {
16
+ /** 每项高度;0 / undefined / NaN 视为「未测量」 */
17
+ heights: Array<number | undefined>;
18
+ columns: number;
19
+ containerWidth: number;
20
+ columnGap: number;
21
+ rowGap: number;
22
+ padding?: number | Partial<Padding>;
23
+ alignmentMode?: AlignmentMode;
24
+ /** 未测量项的兜底高度。不给 → 沿用旧行为:跳过不占位 */
25
+ estimateHeight?: number;
26
+ hooks?: LayoutHooks;
27
+ }
28
+ export interface LayoutResult {
29
+ columns: number;
30
+ columnWidth: number;
31
+ padding: Padding;
32
+ columnHeights: number[];
33
+ totalHeight: number;
34
+ positions: Map<number, ItemPosition>;
35
+ /** 本次布局里有多少项是拿估值占位的(虚拟化给调试面板用) */
36
+ estimatedCount: number;
37
+ }
38
+ export declare function computeLayout(params: LayoutParams): LayoutResult;
39
+ /** `scrollToItem` 的滚动量(纯计算,供 Core 与单测共用) */
40
+ export declare function computeScrollTopForItem(position: ItemPosition, clientHeight: number, block?: "start" | "center" | "end" | "nearest", offset?: number): number;
41
+ //# sourceMappingURL=layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/components/WaterfallPlugin/layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,CAAC;AAEnE,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAK,GACrC,OAAO,CAUT;AAED,MAAM,WAAW,WAAW;IAC1B,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IACnD,oBAAoB,CAAC,EAAE,CACrB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,KACnB,MAAM,GAAG,IAAI,CAAC;IACnB,qBAAqB,CAAC,EAAE,CACtB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,YAAY,KACf,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;CAC1C;AAED,MAAM,WAAW,YAAY;IAC3B,uCAAuC;IACvC,OAAO,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,iCAAiC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACrC,kCAAkC;IAClC,cAAc,EAAE,MAAM,CAAC;CACxB;AAUD,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAiIhE;AAED,4CAA4C;AAC5C,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,YAAY,EACtB,YAAY,EAAE,MAAM,EACpB,KAAK,GAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAmB,EACvD,MAAM,SAAI,GACT,MAAM,CAQR"}
@@ -1,31 +1,27 @@
1
1
  import { default as React } from 'react';
2
- import { WaterfallCoreProps } from '../core/WaterfallCore';
3
- /**
4
- * 瀑布流项的位置信息
5
- */
2
+ import { Plugin, PluginContext, PluginDoc } from '@vane/plugin-core';
3
+ import { WaterfallCoreProps } from '../WaterfallCore';
4
+ /** 项位置(px,相对内容区左上角) */
6
5
  export interface ItemPosition {
7
6
  x: number;
8
7
  y: number;
9
8
  width: number;
10
9
  height: number;
10
+ /** 所属列(0 起) */
11
11
  column: number;
12
+ /** 逻辑行号,= floor(index / columns),仅用于调试与分组展示 */
12
13
  row: number;
13
14
  }
14
- /**
15
- * 布局信息
16
- */
17
15
  export interface LayoutInfo {
18
16
  columns: number;
19
17
  columnWidth: number;
18
+ /** 列间距(旧字段名保留,等价于 columnGap) */
20
19
  gap: number;
21
20
  columnHeights: number[];
22
21
  totalHeight: number;
23
22
  containerWidth: number;
24
23
  containerHeight: number;
25
24
  }
26
- /**
27
- * 视口信息
28
- */
29
25
  export interface ViewportInfo {
30
26
  scrollTop: number;
31
27
  scrollLeft: number;
@@ -36,52 +32,14 @@ export interface ViewportInfo {
36
32
  isScrolling: boolean;
37
33
  direction: "up" | "down" | "left" | "right" | null;
38
34
  }
39
- /**
40
- * 项可见性信息
41
- */
42
35
  export interface ItemVisibility {
43
36
  index: number;
44
37
  isVisible: boolean;
38
+ /** 0–1,项与视口的重叠比例 */
45
39
  visibleRatio: number;
46
40
  isAboveViewport: boolean;
47
41
  isBelowViewport: boolean;
48
42
  }
49
- /**
50
- * 性能指标
51
- */
52
- export interface PerformanceMetrics {
53
- layoutStartTime: number;
54
- layoutEndTime?: number;
55
- layoutDuration?: number;
56
- layoutCount: number;
57
- renderStartTime?: number;
58
- renderEndTime?: number;
59
- renderDuration?: number;
60
- renderedItemCount: number;
61
- scrollStartTime?: number;
62
- scrollEndTime?: number;
63
- scrollDuration?: number;
64
- scrollDistance?: number;
65
- itemCount: number;
66
- visibleItemCount: number;
67
- memoryUsage?: number;
68
- }
69
- /**
70
- * 设备信息
71
- */
72
- export interface DeviceInfo {
73
- type: "mobile" | "tablet" | "desktop";
74
- os: string;
75
- browser: string;
76
- devicePixelRatio: number;
77
- viewportWidth: number;
78
- viewportHeight: number;
79
- isTouchDevice: boolean;
80
- isRetina: boolean;
81
- }
82
- /**
83
- * 网络信息
84
- */
85
43
  export interface NetworkInfo {
86
44
  effectiveType: "4g" | "3g" | "2g" | "slow-2g";
87
45
  downlink: number;
@@ -89,18 +47,6 @@ export interface NetworkInfo {
89
47
  saveData: boolean;
90
48
  online: boolean;
91
49
  }
92
- /**
93
- * 动画配置
94
- */
95
- export interface AnimationConfig {
96
- duration: number;
97
- delay?: number;
98
- easing?: string;
99
- stagger?: number;
100
- }
101
- /**
102
- * 拖拽信息
103
- */
104
50
  export interface DragInfo {
105
51
  isDragging: boolean;
106
52
  draggedIndex: number | null;
@@ -110,19 +56,22 @@ export interface DragInfo {
110
56
  dragCurrentY: number;
111
57
  dropTargetIndex: number | null;
112
58
  }
113
- export interface PluginBus {
114
- emit: <T = any>(event: string, data?: T) => void;
115
- on: <T = any>(event: string, handler: (data: T) => void) => () => void;
116
- once: <T = any>(event: string, handler: (data: T) => void) => () => void;
117
- off: (event: string, handler?: (data: any) => void) => void;
118
- getData: <T = any>(key: string) => T | undefined;
119
- setData: <T = any>(key: string, value: T) => void;
120
- deleteData: (key: string) => void;
121
- hasData: (key: string) => boolean;
122
- getAll: () => Record<string, any>;
123
- clear: () => void;
59
+ /** 内核 data 位:本领域没有独立数据层,统一挂在 Core 状态快照上 */
60
+ export interface WaterfallData {
61
+ items: unknown[];
62
+ layout: LayoutInfo;
63
+ itemPositions: Map<number, ItemPosition>;
64
+ viewport: ViewportInfo;
65
+ }
66
+ export interface ScrollToOptions {
67
+ behavior?: "auto" | "smooth";
68
+ offset?: number;
69
+ }
70
+ export interface ScrollToItemOptions extends ScrollToOptions {
71
+ block?: "start" | "center" | "end" | "nearest";
72
+ inline?: "start" | "center" | "end" | "nearest";
124
73
  }
125
- export interface WaterfallPluginContext<T = any> {
74
+ export interface WaterfallPluginContext<T = any> extends PluginContext<WaterfallCoreProps<T>, WaterfallData> {
126
75
  items: T[];
127
76
  itemCount: number;
128
77
  containerRef: React.RefObject<HTMLDivElement | null>;
@@ -143,326 +92,73 @@ export interface WaterfallPluginContext<T = any> {
143
92
  isLoading: boolean;
144
93
  hasMore: boolean;
145
94
  error: Error | null;
146
- props: WaterfallCoreProps<T>;
147
- bus?: PluginBus;
148
- sharedData?: Map<string, any>;
149
- deviceInfo?: DeviceInfo;
95
+ /** 内核 shared(Map)的领域别名,旧插件用它做跨插件通信 */
96
+ sharedData: Map<string, any>;
150
97
  networkInfo?: NetworkInfo;
151
- performanceMetrics?: PerformanceMetrics;
152
98
  dragInfo?: DragInfo;
99
+ /**
100
+ * 请求宿主重渲染一次(不重排)。
101
+ *
102
+ * `renderOverlay` / `renderItemWrapper` 只在宿主渲染时求值,而点击、键盘、定时器
103
+ * 这类事件改的是插件闭包里的状态,宿主无从感知 —— 不调这个,覆盖层要等到下一次
104
+ * 布局或滚动才更新("点了数字不动,滚动一下才跳"就是漏了这一步)。
105
+ */
106
+ forceUpdate: () => void;
153
107
  relayout: () => void;
154
- scrollToItem: (index: number, options?: ScrollToOptions) => void;
108
+ scrollToItem: (index: number, options?: ScrollToItemOptions) => void;
155
109
  scrollToTop: (options?: ScrollToOptions) => void;
156
110
  scrollToBottom: (options?: ScrollToOptions) => void;
157
111
  measureItem: (index: number) => Promise<{
158
112
  width: number;
159
113
  height: number;
160
114
  }>;
161
- forceUpdate: () => void;
162
- }
163
- export interface ScrollToOptions {
164
- behavior?: "auto" | "smooth";
165
- block?: "start" | "center" | "end" | "nearest";
166
- inline?: "start" | "center" | "end" | "nearest";
167
115
  }
168
116
  export interface WaterfallPluginHooks<T = any> {
169
- /**
170
- * 组件挂载时触发
171
- * @returns 清理函数(可选)
172
- */
173
- onMount?: (context: WaterfallPluginContext<T>) => void | (() => void);
174
- /**
175
- * 组件卸载时触发
176
- */
177
- onUnmount?: (context: WaterfallPluginContext<T>) => void;
178
- /**
179
- * Props 变化时触发
180
- */
181
- onPropsChange?: (context: WaterfallPluginContext<T>, prevProps: WaterfallCoreProps<T>, nextProps: WaterfallCoreProps<T>) => void;
182
- /**
183
- * 布局开始前触发
184
- * @returns false 可以阻止布局
185
- */
186
- onBeforeLayout?: (context: WaterfallPluginContext<T>) => boolean | Promise<boolean>;
187
- /**
188
- * 布局计算中触发(可以修改布局逻辑)
189
- */
190
- onLayout?: (context: WaterfallPluginContext<T>) => void;
191
- /**
192
- * 布局完成后触发
193
- */
194
- onLayoutComplete?: (context: WaterfallPluginContext<T>) => void;
195
- /**
196
- * 计算列数(响应式插件会实现此钩子)
197
- * @returns 列数,undefined 表示使用默认值
198
- */
199
- calculateColumns?: (context: WaterfallPluginContext<T>) => number | undefined;
200
- /**
201
- * 计算列宽(自定义列宽插件会实现)
202
- */
203
- calculateColumnWidth?: (context: WaterfallPluginContext<T>, containerWidth: number, columns: number) => number | undefined;
204
- /**
205
- * 计算项位置(自定义布局算法插件会实现)
206
- */
207
- calculateItemPosition?: (context: WaterfallPluginContext<T>, index: number, itemHeight: number) => ItemPosition | undefined;
208
- /**
209
- * 项挂载时触发
210
- */
211
- onItemMount?: (context: WaterfallPluginContext<T>, index: number, element: HTMLElement) => void;
212
- /**
213
- * 项卸载时触发
214
- */
215
- onItemUnmount?: (context: WaterfallPluginContext<T>, index: number) => void;
216
- /**
217
- * 项进入视口时触发
218
- */
219
- onItemEnterViewport?: (context: WaterfallPluginContext<T>, index: number, visibility: ItemVisibility) => void;
220
- /**
221
- * 项离开视口时触发
222
- */
223
- onItemLeaveViewport?: (context: WaterfallPluginContext<T>, index: number, visibility: ItemVisibility) => void;
224
- /**
225
- * 项可见性变化时触发
226
- */
227
- onItemVisibilityChange?: (context: WaterfallPluginContext<T>, index: number, visibility: ItemVisibility) => void;
228
- /**
229
- * 项点击时触发
230
- */
231
- onItemClick?: (context: WaterfallPluginContext<T>, index: number, item: T, event: React.MouseEvent) => void;
232
- /**
233
- * 滚动开始时触发
234
- */
235
- onScrollStart?: (context: WaterfallPluginContext<T>) => void;
236
- /**
237
- * 滚动中触发
238
- */
239
- onScroll?: (context: WaterfallPluginContext<T>, scrollTop: number, scrollLeft: number) => void;
240
- /**
241
- * 滚动结束时触发
242
- */
243
- onScrollEnd?: (context: WaterfallPluginContext<T>) => void;
244
- /**
245
- * 滚动到底部时触发(用于无限滚动)
246
- */
247
- onReachBottom?: (context: WaterfallPluginContext<T>, distance: number) => void | Promise<void>;
248
- /**
249
- * 滚动到顶部时触发
250
- */
251
- onReachTop?: (context: WaterfallPluginContext<T>) => void;
252
- /**
253
- * 容器尺寸变化时触发
254
- */
255
- onResize?: (context: WaterfallPluginContext<T>, width: number, height: number) => void;
256
- /**
257
- * 项尺寸变化时触发
258
- */
259
- onItemResize?: (context: WaterfallPluginContext<T>, index: number, width: number, height: number) => void;
260
- /**
261
- * 数据变化前触发
262
- * @returns false 可以阻止数据更新
263
- */
264
- onBeforeItemsChange?: (context: WaterfallPluginContext<T>, oldItems: T[], newItems: T[]) => boolean | Promise<boolean>;
265
- /**
266
- * 数据变化后触发
267
- */
268
- onItemsChange?: (context: WaterfallPluginContext<T>, oldItems: T[], newItems: T[]) => void;
269
- /**
270
- * 单个项数据变化时触发
271
- */
272
- onItemChange?: (context: WaterfallPluginContext<T>, index: number, oldItem: T, newItem: T) => void;
273
- /**
274
- * 加载更多数据时触发(无限滚动插件会实现)
275
- */
276
- onLoadMore?: (context: WaterfallPluginContext<T>, page: number) => Promise<T[]> | T[] | void;
277
- /**
278
- * 刷新数据时触发(下拉刷新插件会实现)
279
- */
280
- onRefresh?: (context: WaterfallPluginContext<T>) => Promise<T[]> | T[] | void;
281
- /**
282
- * 拖拽开始时触发
283
- */
284
- onDragStart?: (context: WaterfallPluginContext<T>, index: number, event: React.DragEvent) => void;
285
- /**
286
- * 拖拽中触发
287
- */
288
- onDrag?: (context: WaterfallPluginContext<T>, index: number, event: React.DragEvent) => void;
289
- /**
290
- * 拖拽结束时触发
291
- */
292
- onDragEnd?: (context: WaterfallPluginContext<T>, index: number, event: React.DragEvent) => void;
293
- /**
294
- * 项被拖放时触发
295
- */
296
- onDrop?: (context: WaterfallPluginContext<T>, fromIndex: number, toIndex: number) => void;
297
- /**
298
- * 项被选中时触发
299
- */
300
- onItemSelect?: (context: WaterfallPluginContext<T>, index: number, item: T, selected: boolean) => void;
301
- /**
302
- * 多选变化时触发
303
- */
304
- onSelectionChange?: (context: WaterfallPluginContext<T>, selectedIndices: Set<number>) => void;
305
- /**
306
- * 筛选逻辑(筛选插件会实现)
307
- */
308
- filterItem?: (context: WaterfallPluginContext<T>, item: T, index: number) => boolean;
309
- /**
310
- * 排序逻辑(排序插件会实现)
311
- */
312
- sortItems?: (context: WaterfallPluginContext<T>, items: T[]) => T[];
313
- /**
314
- * 搜索逻辑(搜索插件会实现)
315
- */
316
- searchItem?: (context: WaterfallPluginContext<T>, item: T, query: string) => boolean;
317
- /**
318
- * 性能指标收集
319
- */
320
- onPerformanceMetric?: (context: WaterfallPluginContext<T>, metrics: PerformanceMetrics) => void;
321
- /**
322
- * 虚拟滚动范围计算(虚拟滚动插件会实现)
323
- */
324
- calculateVisibleRange?: (context: WaterfallPluginContext<T>) => {
325
- start: number;
326
- end: number;
327
- } | undefined;
328
- /**
329
- * 错误发生时触发
330
- */
331
- onError?: (context: WaterfallPluginContext<T>, error: Error, errorInfo?: React.ErrorInfo) => void;
332
- /**
333
- * 项加载失败时触发
334
- */
335
- onItemLoadError?: (context: WaterfallPluginContext<T>, index: number, error: Error) => void;
336
- /**
337
- * 自定义容器渲染
338
- */
339
- renderContainer?: (context: WaterfallPluginContext<T>, children: React.ReactNode) => React.ReactNode;
340
- /**
341
- * 自定义项包装器渲染
342
- */
343
- renderItemWrapper?: (context: WaterfallPluginContext<T>, index: number, item: T, children: React.ReactNode) => React.ReactNode;
344
- /**
345
- * 自定义覆盖层渲染(加载状态、空状态等)
346
- */
347
- renderOverlay?: (context: WaterfallPluginContext<T>) => React.ReactNode;
348
- /**
349
- * 自定义加载更多指示器
350
- */
351
- renderLoadingMore?: (context: WaterfallPluginContext<T>) => React.ReactNode;
352
- /**
353
- * 自定义空状态
354
- */
355
- renderEmpty?: (context: WaterfallPluginContext<T>) => React.ReactNode;
356
- /**
357
- * 自定义错误状态
358
- */
359
- renderError?: (context: WaterfallPluginContext<T>, error: Error) => React.ReactNode;
360
- /**
361
- * 转换 Props(可以在组件接收 props 前修改)
362
- */
363
- transformProps?: (props: WaterfallCoreProps<T>) => WaterfallCoreProps<T>;
364
- /**
365
- * 转换项数据(可以在渲染前修改项数据)
366
- */
367
- transformItem?: (context: WaterfallPluginContext<T>, item: T, index: number) => T;
368
- }
369
- export interface WaterfallPlugin<T = any> {
370
- /**
371
- * 插件名称(唯一标识)
372
- */
373
- name: string;
374
- /**
375
- * 插件版本
376
- */
377
- version?: string;
378
- /**
379
- * 插件描述
380
- */
381
- description?: string;
382
- /**
383
- * 插件钩子
384
- */
385
- hooks: WaterfallPluginHooks<T>;
386
- /**
387
- * 插件配置
388
- */
389
- config?: Record<string, any>;
390
- /**
391
- * 插件依赖(需要先加载的插件名称)
392
- */
393
- dependencies?: string[];
394
- /**
395
- * 插件优先级(数字越大优先级越高)
396
- */
397
- priority?: number;
398
- /**
399
- * 插件初始化
400
- */
401
- init?: () => void | Promise<void>;
402
- /**
403
- * 插件销毁
404
- */
405
- destroy?: () => void | Promise<void>;
406
- /**
407
- * 插件是否启用
408
- */
409
- enabled?: boolean;
410
- }
411
- export interface PluginManager<T = any> {
412
- /**
413
- * 注册插件
414
- */
415
- register: (plugin: WaterfallPlugin<T>) => void;
416
- /**
417
- * 批量注册插件
418
- */
419
- registerAll: (plugins: WaterfallPlugin<T>[]) => void;
420
- /**
421
- * 注销插件
422
- */
423
- unregister: (pluginName: string) => void;
424
- /**
425
- * 获取插件
426
- */
427
- getPlugin: (pluginName: string) => WaterfallPlugin<T> | undefined;
428
- /**
429
- * 获取所有插件
430
- */
431
- getAllPlugins: () => WaterfallPlugin<T>[];
432
- /**
433
- * 获取启用的插件
434
- */
435
- getEnabledPlugins: () => WaterfallPlugin<T>[];
436
- /**
437
- * 启用插件
438
- */
439
- enablePlugin: (pluginName: string) => void;
440
- /**
441
- * 禁用插件
442
- */
443
- disablePlugin: (pluginName: string) => void;
444
- /**
445
- * 检查插件是否已注册
446
- */
447
- hasPlugin: (pluginName: string) => boolean;
448
- /**
449
- * 执行钩子
450
- */
451
- executeHook: <K extends keyof WaterfallPluginHooks<T>>(hookName: K, context: WaterfallPluginContext<T>, ...args: any[]) => Promise<any>;
452
- /**
453
- * 清空所有插件
454
- */
455
- clear: () => void;
117
+ /** 可返回清理函数;`manager.clear()` 时逆序执行一次 */
118
+ onMount?(context: WaterfallPluginContext<T>): unknown;
119
+ onUnmount?(context: WaterfallPluginContext<T>): unknown;
120
+ onPropsChange?(context: WaterfallPluginContext<T>, prev: WaterfallCoreProps<T>, next: WaterfallCoreProps<T>): unknown;
121
+ /** 转发前改写 props(链式,按 priority 降序) */
122
+ transformProps?(props: WaterfallCoreProps<T>): WaterfallCoreProps<T>;
123
+ /** 返回 false 阻止本次布局 */
124
+ onBeforeLayout?(context: WaterfallPluginContext<T>): boolean | void | Promise<boolean | void>;
125
+ onLayout?(context: WaterfallPluginContext<T>): unknown;
126
+ onLayoutComplete?(context: WaterfallPluginContext<T>): unknown;
127
+ /** D1-A:返回列数则覆盖 props.columns */
128
+ calculateColumns?(context: WaterfallPluginContext<T>, containerWidth: number): number | void;
129
+ /** D1-A:返回列宽则覆盖自动计算值 */
130
+ calculateColumnWidth?(context: WaterfallPluginContext<T>, containerWidth: number, columns: number): number | void;
131
+ /** D1-A:返回位置则覆盖列分配结果(置顶、跨列等) */
132
+ calculateItemPosition?(context: WaterfallPluginContext<T>, index: number, itemHeight: number, base: ItemPosition): Partial<ItemPosition> | null | void;
133
+ onItemMount?(context: WaterfallPluginContext<T>, index: number, element: HTMLElement): unknown;
134
+ onItemUnmount?(context: WaterfallPluginContext<T>, index: number): unknown;
135
+ onItemEnterViewport?(context: WaterfallPluginContext<T>, index: number, visibility: ItemVisibility): unknown;
136
+ onItemLeaveViewport?(context: WaterfallPluginContext<T>, index: number, visibility: ItemVisibility): unknown;
137
+ onItemClick?(context: WaterfallPluginContext<T>, index: number, item: T, event: React.MouseEvent): unknown;
138
+ onScroll?(context: WaterfallPluginContext<T>, scrollTop: number, scrollLeft: number): unknown;
139
+ onResize?(context: WaterfallPluginContext<T>, width: number, height: number): unknown;
140
+ onReachBottom?(context: WaterfallPluginContext<T>, distance: number): unknown;
141
+ /** 覆盖层:HOC 保证渲染在滚动容器内部、内容层之上 */
142
+ renderOverlay?(context: WaterfallPluginContext<T>): React.ReactNode;
143
+ /** 项包装管道:把每个项的渲染结果再包一层(拖拽、无障碍语义等) */
144
+ renderItemWrapper?(context: WaterfallPluginContext<T>, node: React.ReactNode, index: number): React.ReactNode;
456
145
  }
457
146
  /**
458
- * 插件创建器类型
147
+ * 领域插件 = 内核插件把 hooks 收窄成领域钩子。
148
+ * 用 Omit 而不是交叉:交叉会同时保留内核 PluginHooks 的索引签名,
149
+ * TS 在推断钩子参数时会取两边的并集,插件里 context 就变成
150
+ * `PluginContext | WaterfallPluginContext` 而拿不到领域字段。
459
151
  */
460
- export type PluginCreator<T = any, Config = any> = (config?: Config) => WaterfallPlugin<T>;
461
152
  /**
462
- * 项渲染函数类型
153
+ * 领域插件 = 内核插件把 hooks 收窄成领域钩子。
154
+ * 用 Omit 而不是交叉类型:交叉会同时保留内核 PluginHooks 的索引签名,
155
+ * TS 推断钩子参数时会取两边的并集,插件里的 context 就变成
156
+ * `PluginContext | WaterfallPluginContext`,拿不到领域字段。
463
157
  */
464
- export type ItemRenderer<T = any> = (item: T, index: number, context: WaterfallPluginContext<T>) => React.ReactNode;
465
- /**
466
- * 项键提取函数类型
467
- */
468
- export type ItemKeyExtractor<T = any> = (item: T, index: number) => string | number;
158
+ export type WaterfallPlugin<T = any> = Omit<Plugin<WaterfallCoreProps<T>>, "hooks"> & {
159
+ hooks: WaterfallPluginHooks<T>;
160
+ };
161
+ export type WaterfallPluginCreator<Config = any, T = any> = ((config?: Config) => WaterfallPlugin<T>) & {
162
+ meta: PluginDoc;
163
+ };
164
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","s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