vane-waterfall 1.0.4 → 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
@@ -0,0 +1,559 @@
1
+ import { jsxs as le, Fragment as ce, jsx as q } from "react/jsx-runtime";
2
+ import ue, { useRef as M, useState as A, useCallback as C, useMemo as z, useLayoutEffect as X, createContext as fe, forwardRef as ge, useEffect as J } from "react";
3
+ function me() {
4
+ const i = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), c = (e, o) => {
5
+ const s = i.get(e);
6
+ if (s)
7
+ for (const r of [...s])
8
+ try {
9
+ r(o);
10
+ } catch (a) {
11
+ console.warn(`[PluginBus] handler error for event "${e}"`, a);
12
+ }
13
+ }, g = (e, o) => {
14
+ let s = i.get(e);
15
+ return s || (s = /* @__PURE__ */ new Set(), i.set(e, s)), s.add(o), () => {
16
+ s?.delete(o);
17
+ };
18
+ }, m = (e, o) => {
19
+ const s = (r) => {
20
+ o(r), l(e, s);
21
+ };
22
+ return g(e, s);
23
+ }, l = (e, o) => {
24
+ if (!o) {
25
+ i.delete(e);
26
+ return;
27
+ }
28
+ i.get(e)?.delete(o);
29
+ };
30
+ return { emit: c, on: g, once: m, off: l, getData: (e) => t.get(e), setData: (e, o) => {
31
+ const s = t.get(e);
32
+ t.set(e, o), s !== o && c(e, o);
33
+ }, deleteData: (e) => {
34
+ const o = t.has(e);
35
+ t.delete(e), o && c(e, void 0);
36
+ }, hasData: (e) => t.has(e), getAll: () => {
37
+ const e = {};
38
+ return t.forEach((o, s) => {
39
+ e[s] = o;
40
+ }), e;
41
+ }, clear: () => {
42
+ i.clear(), t.clear();
43
+ } };
44
+ }
45
+ function ee(i) {
46
+ const t = new Map(i.map((o) => [o.name, o])), c = [];
47
+ for (const o of i)
48
+ for (const s of o.dependencies ?? [])
49
+ t.has(s) || c.push(`${o.name} -> ${s}`);
50
+ const g = [], m = /* @__PURE__ */ new Set(), l = [...i], e = (o) => (o.dependencies ?? []).every((s) => m.has(s) || !t.has(s));
51
+ for (; l.length > 0; ) {
52
+ const o = l.filter(e);
53
+ if (o.length === 0)
54
+ throw new Error(
55
+ `[vane/plugin-core] 插件循环依赖: ${l.map((r) => r.name).join(" <-> ")}`
56
+ );
57
+ let s = o[0];
58
+ for (const r of o)
59
+ (r.priority ?? 0) > (s.priority ?? 0) && (s = r);
60
+ g.push(s), m.add(s.name), l.splice(l.indexOf(s), 1);
61
+ }
62
+ return c.length > 0 && console.warn(
63
+ `[vane/plugin-core] 以下插件依赖未注册,将被忽略:
64
+ ${c.join(`
65
+ `)}`
66
+ ), g;
67
+ }
68
+ async function de(i, t = {}) {
69
+ const { timeout: c = 3e3, name: g = "anonymous", hook: m = "unknown" } = t;
70
+ if (!c || c <= 0)
71
+ return await i();
72
+ let l;
73
+ const e = new Promise((o, s) => {
74
+ l = setTimeout(() => {
75
+ s(new Error(`[vane/plugin-core] 插件 ${g} 的钩子 ${m} 超时(${c}ms)`));
76
+ }, c);
77
+ });
78
+ try {
79
+ return await Promise.race([Promise.resolve().then(i), e]);
80
+ } finally {
81
+ l && clearTimeout(l);
82
+ }
83
+ }
84
+ const he = /* @__PURE__ */ new Set(["onMount", "onUnmount", "onPropsChange", "onError"]);
85
+ function pe(i = {}) {
86
+ const t = i.logger ?? console, c = i.sandbox ?? !0, g = i.timeout ?? 3e3, m = [], l = [], e = /* @__PURE__ */ new Map(), o = () => ee([...e.values()].filter((r) => r.enabled !== !1)), s = (r) => {
87
+ e.set(r.name, { ...r, enabled: r.enabled ?? !0 }), r.init && Promise.resolve(r.init()).catch((a) => {
88
+ t.warn(`[PluginManager] init failed for ${r.name}`, a);
89
+ });
90
+ };
91
+ return {
92
+ register: s,
93
+ registerAll: (r) => {
94
+ for (const a of r) s(a);
95
+ },
96
+ unregister: (r) => {
97
+ const a = e.get(r);
98
+ a && (a.destroy && Promise.resolve(a.destroy()).catch((b) => {
99
+ t.warn(`[PluginManager] destroy failed for ${a.name}`, b);
100
+ }), e.delete(r));
101
+ },
102
+ getPlugin: (r) => e.get(r),
103
+ getAllPlugins: () => [...e.values()],
104
+ getEnabledPlugins: () => [...e.values()].filter((r) => r.enabled !== !1),
105
+ getExecutionOrder: o,
106
+ enable: (r) => {
107
+ const a = e.get(r);
108
+ a && (a.enabled = !0);
109
+ },
110
+ disable: (r) => {
111
+ const a = e.get(r);
112
+ a && (a.enabled = !1);
113
+ },
114
+ has: (r) => e.has(r),
115
+ executeHook: async (r, a, ...b) => {
116
+ for (const p of o()) {
117
+ const R = p.hooks?.[r];
118
+ if (typeof R != "function") continue;
119
+ const $ = p.sandbox ?? c, N = p.timeout ?? g;
120
+ let k;
121
+ try {
122
+ k = $ ? await de(
123
+ () => R(a, ...b),
124
+ { timeout: N, name: p.name, hook: String(r) }
125
+ ) : await R(a, ...b);
126
+ } catch (W) {
127
+ if (m.push({ plugin: p.name, hook: String(r), error: W }), t.warn(
128
+ `[PluginManager] hook ${String(r)} failed in ${p.name}`,
129
+ W
130
+ ), i.onError?.(p.name, String(r), W), r === "onError") break;
131
+ continue;
132
+ }
133
+ if (he.has(String(r)) && typeof k == "function") {
134
+ l.push(k);
135
+ continue;
136
+ }
137
+ if (k === !1) return !1;
138
+ if (k !== void 0 && k !== !0) return k;
139
+ }
140
+ },
141
+ clear: () => {
142
+ const r = l.splice(0);
143
+ for (const a of r.reverse())
144
+ try {
145
+ a();
146
+ } catch (b) {
147
+ t.warn("[PluginManager] cleanup failed", b);
148
+ }
149
+ for (const a of e.values())
150
+ a.destroy && Promise.resolve(a.destroy()).catch((b) => {
151
+ t.warn(`[PluginManager] destroy failed for ${a.name}`, b);
152
+ });
153
+ e.clear();
154
+ },
155
+ getErrors: () => [...m]
156
+ };
157
+ }
158
+ var we = Object.defineProperty, ye = (i, t, c) => t in i ? we(i, t, { enumerable: !0, configurable: !0, writable: !0, value: c }) : i[t] = c, ve = (i, t, c) => ye(i, t + "", c);
159
+ class te extends ue.Component {
160
+ constructor() {
161
+ super(...arguments), ve(this, "state", { error: null });
162
+ }
163
+ static getDerivedStateFromError(t) {
164
+ return { error: t };
165
+ }
166
+ componentDidCatch(t, c) {
167
+ console.warn("[vane/plugin-core] 插件渲染错误已被隔离", t, c), this.props.onError?.(t, c);
168
+ }
169
+ render() {
170
+ const { error: t } = this.state;
171
+ return t ? this.props.fallback ? this.props.fallback(t) : null : this.props.children;
172
+ }
173
+ }
174
+ let Y = null;
175
+ function Pe(i = !1) {
176
+ if (Y && !i) return Y;
177
+ const t = typeof window < "u" ? window.innerWidth : 1024, c = typeof window < "u" ? window.innerHeight : 768, g = typeof window < "u" && window.devicePixelRatio || 1, m = typeof navigator < "u" && navigator.userAgent || "", l = /iPad|Tablet/i.test(m), e = /Mobile|Android|iPhone/i.test(m), o = typeof window < "u" && ("ontouchstart" in window || (navigator.maxTouchPoints ?? 0) > 0);
178
+ return Y = {
179
+ type: l ? "tablet" : e ? "mobile" : "desktop",
180
+ os: m,
181
+ browser: m,
182
+ devicePixelRatio: g,
183
+ viewportWidth: t,
184
+ viewportHeight: c,
185
+ isTouchDevice: o,
186
+ isRetina: g >= 2
187
+ }, Y;
188
+ }
189
+ function Ie(i) {
190
+ const {
191
+ plugins: t,
192
+ props: c,
193
+ data: g,
194
+ initialState: m,
195
+ containerRef: l,
196
+ enableDebug: e = !1,
197
+ managerOptions: o,
198
+ extendContext: s
199
+ } = i, r = M(null), a = l ?? r, b = M(null);
200
+ b.current || (b.current = pe(o));
201
+ const p = b.current, R = M(null);
202
+ R.current || (R.current = me());
203
+ const $ = R.current, N = M(/* @__PURE__ */ new Map()), [k, W] = A(m ?? {}), [, K] = A(0), U = C(() => K((I) => I + 1), []), O = z(() => Pe(), []), D = t.map((I) => I.name).join("|");
204
+ X(() => {
205
+ p.clear(), p.registerAll(t), e && console.debug("[vane/plugin-core] plugins registered:", D);
206
+ }, [D]), X(
207
+ () => () => {
208
+ p.executeHook("onUnmount", j.current), p.clear();
209
+ },
210
+ [p]
211
+ );
212
+ const B = z(
213
+ () => ee(t),
214
+ // eslint-disable-next-line react-hooks/exhaustive-deps
215
+ [D]
216
+ ), j = M(null), F = z(() => {
217
+ const I = {
218
+ props: c,
219
+ data: g,
220
+ bus: $,
221
+ refs: { container: a, getContainer: () => a.current },
222
+ state: k,
223
+ setState: (v) => W((V) => ({ ...V, ...v })),
224
+ shared: N.current,
225
+ deviceInfo: O,
226
+ forceUpdate: U,
227
+ getSize: () => {
228
+ const v = a.current;
229
+ return v ? { width: v.offsetWidth, height: v.offsetHeight } : { width: 0, height: 0 };
230
+ },
231
+ logger: console
232
+ };
233
+ return s ? s(I) : I;
234
+ }, [c, g, k, O, $, s]);
235
+ j.current = F;
236
+ const L = C(
237
+ (I) => {
238
+ let v = I;
239
+ for (const V of B) {
240
+ const E = V.hooks?.transformProps;
241
+ typeof E == "function" && (v = E(v));
242
+ }
243
+ return v;
244
+ },
245
+ [B]
246
+ ), T = C(
247
+ (I) => {
248
+ let v = I;
249
+ for (const V of B) {
250
+ const E = V.hooks?.transformData;
251
+ typeof E == "function" && (v = E(j.current, v));
252
+ }
253
+ return v;
254
+ },
255
+ [B]
256
+ ), h = C(
257
+ (I, ...v) => p.executeHook(I, j.current, ...v),
258
+ [p]
259
+ );
260
+ return {
261
+ manager: p,
262
+ bus: $,
263
+ context: F,
264
+ state: k,
265
+ setState: F.setState,
266
+ execute: h,
267
+ transformProps: L,
268
+ transformData: T,
269
+ orderedPlugins: B
270
+ };
271
+ }
272
+ fe(null);
273
+ function _(i, t, c) {
274
+ const { hook: g, position: m = "after" } = c;
275
+ return i.filter((l) => l.enabled !== !1).filter((l) => typeof l.hooks?.[g] == "function").filter((l) => (l.config?.slotPosition ?? "after") === m).sort(
276
+ (l, e) => (l.config?.order ?? 0) - (e.config?.order ?? 0) || (e.priority ?? 0) - (l.priority ?? 0)
277
+ ).map((l, e) => {
278
+ try {
279
+ const o = l.hooks[g](t);
280
+ return o == null ? null : /* @__PURE__ */ q(te, { children: o }, `vane-slot-${l.name}-${e}`);
281
+ } catch (o) {
282
+ return console.warn(`[vane/plugin-core] 插件 ${l.name} 的 ${g} 渲染失败`, o), null;
283
+ }
284
+ });
285
+ }
286
+ function be(i, t, c) {
287
+ return /* @__PURE__ */ le(ce, { children: [
288
+ _(i, t, { hook: "renderHeader", position: "before" }),
289
+ c,
290
+ _(i, t, { hook: "renderOverlay" }),
291
+ _(i, t, { hook: "renderHeader", position: "after" }),
292
+ _(i, t, { hook: "renderFooter" })
293
+ ] });
294
+ }
295
+ const ke = {
296
+ columns: 0,
297
+ columnWidth: 0,
298
+ gap: 0,
299
+ columnHeights: [],
300
+ totalHeight: 0,
301
+ containerWidth: 0,
302
+ containerHeight: 0
303
+ }, xe = {
304
+ scrollTop: 0,
305
+ scrollLeft: 0,
306
+ scrollHeight: 0,
307
+ scrollWidth: 0,
308
+ clientHeight: 0,
309
+ clientWidth: 0,
310
+ isScrolling: !1,
311
+ direction: null
312
+ };
313
+ function Ce() {
314
+ const i = typeof navigator < "u" ? navigator : void 0, t = i?.connection || i?.mozConnection || i?.webkitConnection;
315
+ if (t)
316
+ return {
317
+ effectiveType: t.effectiveType || "4g",
318
+ downlink: Number(t.downlink || 10),
319
+ rtt: Number(t.rtt || 50),
320
+ saveData: !!t.saveData,
321
+ online: i?.onLine !== !1
322
+ };
323
+ }
324
+ function Z(i, t, c) {
325
+ let g = Number.POSITIVE_INFINITY, m = -1;
326
+ return i.forEach((l, e) => {
327
+ Math.max(
328
+ 0,
329
+ Math.min(t + c, l.y + l.height) - Math.max(t, l.y)
330
+ ) > 0 && (e < g && (g = e), e > m && (m = e));
331
+ }), m < 0 ? { start: 0, end: 0 } : { start: g, end: m };
332
+ }
333
+ function Le(i, t) {
334
+ const c = Array.isArray(t) ? { plugins: t } : t, { plugins: g, enableDebug: m = !1 } = c, l = ge(
335
+ (e, o) => {
336
+ const s = M(null), r = M(/* @__PURE__ */ new Map()), a = M(null), b = z(() => Ce(), []), p = M(null), [R, $] = A(ke), [N, k] = A(
337
+ () => /* @__PURE__ */ new Map()
338
+ ), [W, K] = A(xe), [U, O] = A(!1), [D, B] = A(e.items ?? []), j = C(
339
+ (n) => {
340
+ const u = () => a.current?.getLayoutInfo() ?? R, y = () => a.current?.getAllItemPositions() ?? N, P = () => a.current?.getViewportInfo() ?? W, f = {
341
+ ...n,
342
+ items: D,
343
+ itemCount: D.length,
344
+ containerRef: s,
345
+ itemRefs: r.current,
346
+ getItemRef: (d) => r.current.get(d) ?? null,
347
+ layout: u(),
348
+ itemPositions: y(),
349
+ getItemPosition: (d) => y().get(d) ?? null,
350
+ viewport: P(),
351
+ visibleItems: /* @__PURE__ */ new Set(),
352
+ visibleRange: Z(
353
+ y(),
354
+ P().scrollTop,
355
+ P().clientHeight
356
+ ),
357
+ isLayouting: U,
358
+ isScrolling: W.isScrolling,
359
+ isDragging: !!n.state?.dragInfo?.isDragging,
360
+ isLoading: !!(n.state?.isLoading ?? !1),
361
+ hasMore: !!(n.state?.hasMore ?? !0),
362
+ error: n.state?.error ?? null,
363
+ sharedData: n.shared,
364
+ networkInfo: b,
365
+ dragInfo: n.state?.dragInfo,
366
+ relayout: () => a.current?.relayout(),
367
+ scrollToItem: (d, S) => a.current?.scrollToItem(d, S),
368
+ scrollToTop: (d) => a.current?.scrollToTop(d),
369
+ scrollToBottom: (d) => a.current?.scrollToBottom(d),
370
+ measureItem: (d) => a.current?.measureItem(d) ?? Promise.resolve({ width: 0, height: 0 })
371
+ };
372
+ return Object.defineProperties(f, {
373
+ layout: { get: u, enumerable: !0, configurable: !0 },
374
+ itemPositions: { get: y, enumerable: !0, configurable: !0 },
375
+ viewport: { get: P, enumerable: !0, configurable: !0 },
376
+ props: {
377
+ get: () => p.current ?? n.props,
378
+ enumerable: !0,
379
+ configurable: !0
380
+ },
381
+ visibleRange: {
382
+ get: () => {
383
+ const d = P();
384
+ return Z(y(), d.scrollTop, d.clientHeight);
385
+ },
386
+ enumerable: !0,
387
+ configurable: !0
388
+ }
389
+ }), f;
390
+ },
391
+ [D, R, N, W, U, b]
392
+ ), L = Ie({
393
+ plugins: g,
394
+ props: e,
395
+ enableDebug: m,
396
+ containerRef: s,
397
+ extendContext: j
398
+ }), T = M(L.context);
399
+ T.current = L.context;
400
+ const h = C(
401
+ (n, ...u) => L.execute(n, ...u),
402
+ // eslint-disable-next-line react-hooks/exhaustive-deps
403
+ [L.manager]
404
+ ), I = L.orderedPlugins, v = g.map((n) => n.name).join("|"), V = z(() => {
405
+ const n = I.filter(
406
+ (f) => typeof f.hooks?.calculateColumns == "function"
407
+ ), u = I.filter(
408
+ (f) => typeof f.hooks?.calculateColumnWidth == "function"
409
+ ), y = I.filter(
410
+ (f) => typeof f.hooks?.calculateItemPosition == "function"
411
+ );
412
+ if (!n.length && !u.length && !y.length)
413
+ return;
414
+ const P = (f, d, S) => console.warn(`[vane-waterfall] ${f} 的 ${d} 执行失败`, S);
415
+ return {
416
+ calculateColumns: n.length ? (f) => {
417
+ const d = T.current?.containerRef?.current?.clientWidth ?? 0;
418
+ for (const S of n)
419
+ try {
420
+ const x = S.hooks.calculateColumns(T.current, d);
421
+ if (typeof x == "number" && Number.isFinite(x)) return x;
422
+ } catch (x) {
423
+ P(S.name, "calculateColumns", x);
424
+ }
425
+ } : void 0,
426
+ calculateColumnWidth: u.length ? (f, d, S) => {
427
+ for (const x of u)
428
+ try {
429
+ const H = x.hooks.calculateColumnWidth(
430
+ T.current,
431
+ S,
432
+ d
433
+ );
434
+ if (typeof H == "number" && Number.isFinite(H)) return H;
435
+ } catch (H) {
436
+ P(x.name, "calculateColumnWidth", H);
437
+ }
438
+ } : void 0,
439
+ calculateItemPosition: y.length ? (f, d, S) => {
440
+ for (const x of y)
441
+ try {
442
+ const H = x.hooks.calculateItemPosition(
443
+ T.current,
444
+ f,
445
+ d,
446
+ S
447
+ );
448
+ if (H) return H;
449
+ } catch (H) {
450
+ P(x.name, "calculateItemPosition", H);
451
+ }
452
+ } : void 0
453
+ };
454
+ }, [v]), E = C(() => {
455
+ const n = a.current;
456
+ if (!n) return;
457
+ const u = n.getLayoutInfo(), y = n.getAllItemPositions(), P = n.getViewportInfo();
458
+ $(
459
+ (f) => f.totalHeight === u.totalHeight && f.columns === u.columns && f.columnWidth === u.columnWidth && f.containerWidth === u.containerWidth ? f : u
460
+ ), k(
461
+ (f) => f.size === y.size ? f : y
462
+ ), K(
463
+ (f) => f.scrollTop === P.scrollTop && f.clientHeight === P.clientHeight && f.scrollHeight === P.scrollHeight && f.isScrolling === P.isScrolling ? f : P
464
+ );
465
+ }, []);
466
+ J(() => {
467
+ B(e.items ?? []);
468
+ }, [e.items]), J(() => {
469
+ h("onMount");
470
+ }, [h]);
471
+ const G = M(e);
472
+ J(() => {
473
+ const n = G.current;
474
+ n !== e && (G.current = e, h("onPropsChange", n, e));
475
+ }, [e, h]);
476
+ const w = L.transformProps(e);
477
+ p.current = w;
478
+ const ne = C(async () => (O(!0), await h("onBeforeLayout") === !1 ? (O(!1), !1) : !0), [h]), oe = C(() => {
479
+ h("onLayout");
480
+ }, [h]), re = C(() => {
481
+ O(!1), h("onLayoutComplete"), Promise.resolve().then(E);
482
+ }, [h, E]), ie = I.filter(
483
+ (n) => typeof n.hooks?.renderItemWrapper == "function"
484
+ ), Q = w.renderItem, se = C(
485
+ (n, u) => {
486
+ let y = Q?.(n, u) ?? null;
487
+ for (const P of ie)
488
+ try {
489
+ const f = P.hooks.renderItemWrapper(T.current, y, u);
490
+ f != null && (y = f);
491
+ } catch (f) {
492
+ console.warn(`[vane-waterfall] ${P.name} 的 renderItemWrapper 失败`, f);
493
+ }
494
+ return y;
495
+ },
496
+ // eslint-disable-next-line react-hooks/exhaustive-deps
497
+ [Q, v]
498
+ ), ae = {
499
+ ...w,
500
+ containerRefExternal: s,
501
+ itemRefsExternal: r,
502
+ debug: w.debug ?? m,
503
+ layoutHooks: V ?? w.layoutHooks,
504
+ renderItem: se,
505
+ children: /* @__PURE__ */ q(te, { children: be(L.orderedPlugins, L.context, w.children) }),
506
+ onMount: () => {
507
+ w.onMount?.();
508
+ },
509
+ onUnmount: () => {
510
+ w.onUnmount?.();
511
+ },
512
+ onBeforeLayout: async () => await ne() === !1 ? !1 : w.onBeforeLayout?.() ?? !0,
513
+ onLayout: () => {
514
+ w.onLayout?.(), oe();
515
+ },
516
+ onLayoutComplete: () => {
517
+ w.onLayoutComplete?.(), re();
518
+ },
519
+ onItemMount: (n, u) => {
520
+ w.onItemMount?.(n, u), h("onItemMount", n, u);
521
+ },
522
+ onItemUnmount: (n) => {
523
+ w.onItemUnmount?.(n), h("onItemUnmount", n);
524
+ },
525
+ onItemEnterViewport: (n, u) => {
526
+ w.onItemEnterViewport?.(n, u), h("onItemEnterViewport", n, u);
527
+ },
528
+ onItemLeaveViewport: (n, u) => {
529
+ w.onItemLeaveViewport?.(n, u), h("onItemLeaveViewport", n, u);
530
+ },
531
+ onScroll: (n, u) => {
532
+ w.onScroll?.(n, u), h("onScroll", n, u), E();
533
+ },
534
+ onResize: (n, u) => {
535
+ w.onResize?.(n, u), h("onResize", n, u);
536
+ },
537
+ onReachBottom: async (n) => {
538
+ await w.onReachBottom?.(n), await h("onReachBottom", n);
539
+ },
540
+ onItemClick: (n, u, y) => {
541
+ w.onItemClick?.(n, u, y), h("onItemClick", n, u, y);
542
+ }
543
+ };
544
+ return /* @__PURE__ */ q(
545
+ i,
546
+ {
547
+ ref: (n) => {
548
+ a.current = n, typeof o == "function" ? o(n) : o && (o.current = n);
549
+ },
550
+ ...ae
551
+ }
552
+ );
553
+ }
554
+ );
555
+ return l.displayName = "WithPlugins(WaterfallCore)", l;
556
+ }
557
+ export {
558
+ Le as w
559
+ };
@@ -0,0 +1,124 @@
1
+ import { default as React } from 'react';
2
+ import { ItemPosition, ItemVisibility, LayoutInfo, ViewportInfo } from './plugins/types';
3
+ import { AlignmentMode, LayoutHooks } from './layout';
4
+ import { VirtualizeOptions } from './virtualize';
5
+ export interface WaterfallCoreProps<T = any> {
6
+ items: T[];
7
+ renderItem: (item: T, index: number) => React.ReactNode;
8
+ keyExtractor?: (item: T, index: number) => React.Key;
9
+ /** 列数,默认 3;插件可通过 `calculateColumns` 覆盖 */
10
+ columns?: number;
11
+ /** 行/列间距的简写,默认 16 */
12
+ gap?: number;
13
+ rowGap?: number;
14
+ columnGap?: number;
15
+ /**
16
+ * 列分配策略,默认 shortest
17
+ * - shortest:放进当前最矮的列
18
+ * - balanced:放进项数最少的列
19
+ * - sequential:按 index 轮转
20
+ */
21
+ alignmentMode?: AlignmentMode;
22
+ /** 容器内边距 */
23
+ padding?: number | {
24
+ top?: number;
25
+ right?: number;
26
+ bottom?: number;
27
+ left?: number;
28
+ };
29
+ containerStyle?: React.CSSProperties;
30
+ containerClassName?: string;
31
+ itemStyle?: React.CSSProperties;
32
+ itemClassName?: string;
33
+ /** 用 transform 定位(默认 true);需要读 offsetLeft / 打印时传 false */
34
+ useTransform?: boolean;
35
+ throttleDelay?: number;
36
+ debounceDelay?: number;
37
+ /**
38
+ * 距底部多少像素内触发 `onReachBottom`,默认 100。
39
+ * 无限滚动类插件靠它提前预加载(旧版写死 100,插件配多大都没用)。
40
+ */
41
+ reachBottomOffset?: number;
42
+ /**
43
+ * 虚拟化:只渲染视口附近的项。
44
+ * 千项以上、项高度可估(图片卡、商品卡)时开;与 `RecyclePlugin` 不要同开。
45
+ */
46
+ virtualize?: boolean | VirtualizeOptions;
47
+ /** FilterPlugin 读取;优先级高于工厂里的 predicate */
48
+ filterFn?: (item: T, index: number) => boolean;
49
+ /** SortPlugin 读取;优先级高于工厂里的 comparator */
50
+ sortComparator?: (a: T, b: T) => number;
51
+ /** SearchPlugin 读取 */
52
+ searchQuery?: string;
53
+ /** PaginationPlugin 读取,1 基 */
54
+ pageIndex?: number;
55
+ /** PaginationPlugin 读取 */
56
+ pageSize?: number;
57
+ /** InfiniteScrollPlugin 读取 */
58
+ onLoadMore?: () => void | Promise<void>;
59
+ /** 数据条件变化后是否回顶(各插件分别读自己那个键) */
60
+ scrollToTopOnFilterChange?: boolean;
61
+ scrollToTopOnSortChange?: boolean;
62
+ scrollToTopOnSearchChange?: boolean;
63
+ scrollToTopOnPageChange?: boolean;
64
+ /** 回顶行为,默认 auto */
65
+ scrollToTopBehavior?: "auto" | "smooth";
66
+ /** D1-A 布局钩子(HOC 从插件装配结果里汇总) */
67
+ layoutHooks?: LayoutHooks;
68
+ onMount?: () => void;
69
+ onUnmount?: () => void;
70
+ onBeforeLayout?: () => boolean | void | Promise<boolean | void>;
71
+ onLayout?: () => void;
72
+ onLayoutComplete?: () => void;
73
+ onItemMount?: (index: number, element: HTMLElement) => void;
74
+ onItemUnmount?: (index: number) => void;
75
+ onItemEnterViewport?: (index: number, visibility: ItemVisibility) => void;
76
+ onItemLeaveViewport?: (index: number, visibility: ItemVisibility) => void;
77
+ onScroll?: (scrollTop: number, scrollLeft: number) => void;
78
+ onResize?: (width: number, height: number) => void;
79
+ onReachBottom?: (distance: number) => void;
80
+ onItemClick?: (index: number, item: T, event: React.MouseEvent) => void;
81
+ /** 插件覆盖层等(由 composeSlots 组装,渲染在滚动容器内部) */
82
+ children?: React.ReactNode;
83
+ /** HOC 注入:插件拿容器 DOM 用 */
84
+ containerRefExternal?: React.RefObject<HTMLDivElement | null>;
85
+ /** HOC 注入:插件拿项 DOM 用 */
86
+ itemRefsExternal?: React.MutableRefObject<Map<number, HTMLElement>>;
87
+ debug?: boolean;
88
+ }
89
+ export interface WaterfallCoreRef {
90
+ relayout: () => void;
91
+ scrollToItem: (index: number, options?: ScrollToItemOptions) => void;
92
+ scrollToTop: (options?: ScrollToOptions) => void;
93
+ scrollToBottom: (options?: ScrollToOptions) => void;
94
+ getItemPosition: (index: number) => ItemPosition | null;
95
+ getAllItemPositions: () => Map<number, ItemPosition>;
96
+ getColumnHeights: () => number[];
97
+ getLayoutInfo: () => LayoutInfo;
98
+ getViewportInfo: () => ViewportInfo;
99
+ /** 当前渲染出来的索引区间(虚拟化关闭时是 0..n-1) */
100
+ getVisibleRange: () => {
101
+ start: number;
102
+ end: number;
103
+ };
104
+ forceUpdate: () => void;
105
+ getContainer: () => HTMLDivElement | null;
106
+ getItemElement: (index: number) => HTMLElement | null;
107
+ measureItem: (index: number) => Promise<{
108
+ width: number;
109
+ height: number;
110
+ }>;
111
+ }
112
+ export interface ScrollToItemOptions {
113
+ behavior?: "auto" | "smooth";
114
+ block?: "start" | "center" | "end" | "nearest";
115
+ inline?: "start" | "center" | "end" | "nearest";
116
+ offset?: number;
117
+ }
118
+ export interface ScrollToOptions {
119
+ behavior?: "auto" | "smooth";
120
+ offset?: number;
121
+ }
122
+ declare const WaterfallCore: React.ForwardRefExoticComponent<WaterfallCoreProps<any> & React.RefAttributes<WaterfallCoreRef>>;
123
+ export default WaterfallCore;
124
+ //# sourceMappingURL=WaterfallCore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WaterfallCore.d.ts","sourceRoot":"","sources":["../../../src/components/WaterfallPlugin/WaterfallCore.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,UAAU,EACV,YAAY,EACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAA8C,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAIlG,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,GAAG;IAEzC,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IACxD,YAAY,C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