vane-waterfall 2.0.1 → 2.0.3

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 (134) hide show
  1. package/README.md +4 -4
  2. package/dist/chunks/WaterfallCore-EdAZuWAY.js +695 -0
  3. package/dist/chunks/doc-BAhVW3g8.js +150 -0
  4. package/dist/chunks/doc-BU0CKW63.js +156 -0
  5. package/dist/chunks/doc-BrEd0oZB.js +100 -0
  6. package/dist/chunks/{doc-bTHwfIVb.js → doc-Bud0hbaz.js} +39 -25
  7. package/dist/chunks/{doc-DukOmDCo.js → doc-C-B3zK2o.js} +52 -23
  8. package/dist/chunks/{doc-DElLNjIc.js → doc-C206ZwYC.js} +33 -24
  9. package/dist/chunks/doc-C2L8kkeI.js +112 -0
  10. package/dist/chunks/doc-CE1DGMBV.js +166 -0
  11. package/dist/chunks/{doc-BXSy2aPP.js → doc-CHbQXLwY.js} +33 -19
  12. package/dist/chunks/{doc-BfWnfTst.js → doc-CInpKZNU.js} +38 -24
  13. package/dist/chunks/{doc-gTAsLjVx.js → doc-CYxwSuG6.js} +30 -16
  14. package/dist/chunks/{doc-DzvTrZ13.js → doc-CaJ02INP.js} +25 -16
  15. package/dist/chunks/{doc-BXElhF2h.js → doc-CiCso5Ti.js} +44 -30
  16. package/dist/chunks/doc-CkuMr8Ca.js +118 -0
  17. package/dist/chunks/{doc-3Fpag2G8.js → doc-D7m1OFCW.js} +38 -24
  18. package/dist/chunks/doc-DEN2WTDh.js +153 -0
  19. package/dist/chunks/{doc-C5xrHNoC.js → doc-DhICh9S2.js} +37 -23
  20. package/dist/chunks/doc-DlJICsyN.js +100 -0
  21. package/dist/chunks/{doc-BtzhgTYj.js → doc-DtxS1-P0.js} +35 -26
  22. package/dist/chunks/{doc-BIzjYAZW.js → doc-DudYCn_-.js} +25 -16
  23. package/dist/chunks/doc-HoyAFR_m.js +101 -0
  24. package/dist/chunks/doc-RlBMCMNs.js +170 -0
  25. package/dist/chunks/doc-RwKQqySd.js +102 -0
  26. package/dist/chunks/{doc-CTUoMe7o.js → doc-eYhNJy97.js} +31 -22
  27. package/dist/chunks/{doc-CcPFavOs.js → doc-i6FY1We1.js} +27 -13
  28. package/dist/chunks/doc-skPl6ZMP.js +101 -0
  29. package/dist/chunks/index-8gEIzUxi.js +15 -0
  30. package/dist/chunks/index-B96I5CKE.js +21 -0
  31. package/dist/chunks/index-Bjmhy8jW.js +11 -0
  32. package/dist/chunks/index-Cuq0ofv-.js +13 -0
  33. package/dist/chunks/{index-BAWlVYr3.js → index-Cz4YEqRF.js} +1 -1
  34. package/dist/chunks/{index-wLI6UXkY.js → index-FBJVUYmH.js} +1 -1
  35. package/dist/chunks/withPlugins-BOeDFhof.js +743 -0
  36. package/dist/components/WaterfallPlugin/WaterfallCore.d.ts +19 -0
  37. package/dist/components/WaterfallPlugin/WaterfallCore.d.ts.map +1 -1
  38. package/dist/components/WaterfallPlugin/layout.d.ts +7 -0
  39. package/dist/components/WaterfallPlugin/layout.d.ts.map +1 -1
  40. package/dist/components/WaterfallPlugin/plugins/types.d.ts +3 -0
  41. package/dist/components/WaterfallPlugin/plugins/types.d.ts.map +1 -1
  42. package/dist/components/WaterfallPlugin/withPlugins.d.ts.map +1 -1
  43. package/dist/custom-plugins/A11yPlugin/create.d.ts.map +1 -1
  44. package/dist/custom-plugins/A11yPlugin/doc.json.d.ts +64 -40
  45. package/dist/custom-plugins/A11yPlugin/index.js +1 -1
  46. package/dist/custom-plugins/AlignmentPlugin/doc.json.d.ts +42 -28
  47. package/dist/custom-plugins/AlignmentPlugin/index.js +1 -1
  48. package/dist/custom-plugins/AutoColumnPlugin/doc.json.d.ts +53 -44
  49. package/dist/custom-plugins/AutoColumnPlugin/index.js +1 -1
  50. package/dist/custom-plugins/BookmarkPlugin/create.d.ts.map +1 -1
  51. package/dist/custom-plugins/BookmarkPlugin/doc.json.d.ts +44 -35
  52. package/dist/custom-plugins/BookmarkPlugin/index.js +1 -1
  53. package/dist/custom-plugins/ClickAnalyticsPlugin/create.d.ts +2 -0
  54. package/dist/custom-plugins/ClickAnalyticsPlugin/create.d.ts.map +1 -1
  55. package/dist/custom-plugins/ClickAnalyticsPlugin/doc.json.d.ts +29 -0
  56. package/dist/custom-plugins/ClickAnalyticsPlugin/index.js +1 -1
  57. package/dist/custom-plugins/DebounceLayoutPlugin/doc.json.d.ts +37 -28
  58. package/dist/custom-plugins/DebounceLayoutPlugin/index.js +1 -1
  59. package/dist/custom-plugins/DragReorderPlugin/doc.json.d.ts +14 -0
  60. package/dist/custom-plugins/DragReorderPlugin/index.js +1 -1
  61. package/dist/custom-plugins/FilterPlugin/doc.json.d.ts +53 -39
  62. package/dist/custom-plugins/FilterPlugin/index.js +1 -1
  63. package/dist/custom-plugins/FixedHeightPlugin/doc.json.d.ts +42 -28
  64. package/dist/custom-plugins/FixedHeightPlugin/index.js +1 -1
  65. package/dist/custom-plugins/GapPlugin/create.d.ts.map +1 -1
  66. package/dist/custom-plugins/GapPlugin/doc.json.d.ts +61 -37
  67. package/dist/custom-plugins/GapPlugin/index.js +1 -1
  68. package/dist/custom-plugins/GroupingPlugin/create.d.ts.map +1 -1
  69. package/dist/custom-plugins/GroupingPlugin/doc.json.d.ts +61 -32
  70. package/dist/custom-plugins/GroupingPlugin/index.js +1 -1
  71. package/dist/custom-plugins/HeatmapAnalyticsPlugin/create.d.ts +2 -0
  72. package/dist/custom-plugins/HeatmapAnalyticsPlugin/create.d.ts.map +1 -1
  73. package/dist/custom-plugins/HeatmapAnalyticsPlugin/doc.json.d.ts +24 -0
  74. package/dist/custom-plugins/HeatmapAnalyticsPlugin/index.js +1 -1
  75. package/dist/custom-plugins/InfiniteScrollPlugin/create.d.ts.map +1 -1
  76. package/dist/custom-plugins/InfiniteScrollPlugin/doc.json.d.ts +55 -36
  77. package/dist/custom-plugins/InfiniteScrollPlugin/index.js +1 -1
  78. package/dist/custom-plugins/PaginationPlugin/create.d.ts.map +1 -1
  79. package/dist/custom-plugins/PaginationPlugin/doc.json.d.ts +56 -42
  80. package/dist/custom-plugins/PaginationPlugin/index.js +1 -1
  81. package/dist/custom-plugins/PinItemPlugin/doc.json.d.ts +49 -35
  82. package/dist/custom-plugins/PinItemPlugin/index.js +1 -1
  83. package/dist/custom-plugins/RecyclePlugin/create.d.ts.map +1 -1
  84. package/dist/custom-plugins/RecyclePlugin/doc.json.d.ts +57 -28
  85. package/dist/custom-plugins/RecyclePlugin/index.js +1 -1
  86. package/dist/custom-plugins/ReducedMotionPlugin/doc.json.d.ts +29 -0
  87. package/dist/custom-plugins/ReducedMotionPlugin/index.js +1 -1
  88. package/dist/custom-plugins/ResponsiveColumnsPlugin/doc.json.d.ts +40 -31
  89. package/dist/custom-plugins/ResponsiveColumnsPlugin/index.js +1 -1
  90. package/dist/custom-plugins/ScrollAnchorPlugin/doc.json.d.ts +42 -28
  91. package/dist/custom-plugins/ScrollAnchorPlugin/index.js +1 -1
  92. package/dist/custom-plugins/SearchPlugin/doc.json.d.ts +53 -39
  93. package/dist/custom-plugins/SearchPlugin/index.js +1 -1
  94. package/dist/custom-plugins/SortPlugin/doc.json.d.ts +52 -38
  95. package/dist/custom-plugins/SortPlugin/index.js +1 -1
  96. package/dist/custom-plugins/StatePersistencePlugin/create.d.ts.map +1 -1
  97. package/dist/custom-plugins/StatePersistencePlugin/doc.json.d.ts +71 -37
  98. package/dist/custom-plugins/StatePersistencePlugin/index.js +1 -1
  99. package/dist/custom-plugins/StickyHeaderPlugin/create.d.ts.map +1 -1
  100. package/dist/custom-plugins/StickyHeaderPlugin/doc.json.d.ts +43 -34
  101. package/dist/custom-plugins/StickyHeaderPlugin/index.js +1 -1
  102. package/dist/custom-plugins/ThrottlePlugin/doc.json.d.ts +43 -34
  103. package/dist/custom-plugins/ThrottlePlugin/index.js +1 -1
  104. package/dist/custom-plugins/TransitionPlugin/doc.json.d.ts +49 -35
  105. package/dist/custom-plugins/TransitionPlugin/index.js +1 -1
  106. package/dist/custom-plugins/URLSyncPlugin/create.d.ts.map +1 -1
  107. package/dist/custom-plugins/URLSyncPlugin/doc.json.d.ts +57 -33
  108. package/dist/custom-plugins/URLSyncPlugin/index.js +1 -1
  109. package/dist/custom-plugins/index.js +6 -6
  110. package/dist/entries/core.js +1 -1
  111. package/dist/entries/plugins.js +7 -7
  112. package/dist/index.js +2 -2
  113. package/dist/presets/dashboard/index.js +2 -2
  114. package/dist/presets/photo-feed/index.js +3 -3
  115. package/dist/presets/product-feed/index.js +2 -2
  116. package/package.json +16 -8
  117. package/dist/chunks/WaterfallCore-BSXw7bl_.js +0 -581
  118. package/dist/chunks/doc-78xF08vt.js +0 -82
  119. package/dist/chunks/doc-B-7dugGv.js +0 -79
  120. package/dist/chunks/doc-B6kLfMPv.js +0 -121
  121. package/dist/chunks/doc-BCGQ8Cp5.js +0 -114
  122. package/dist/chunks/doc-BP0DmB7-.js +0 -91
  123. package/dist/chunks/doc-CBHjiDG7.js +0 -88
  124. package/dist/chunks/doc-CraXjOaA.js +0 -68
  125. package/dist/chunks/doc-DJjxOYzW.js +0 -111
  126. package/dist/chunks/doc-NhL4Ux8q.js +0 -125
  127. package/dist/chunks/doc-f4Uijujv.js +0 -102
  128. package/dist/chunks/doc-j4W9SUrY.js +0 -76
  129. package/dist/chunks/doc-kTbJE7rY.js +0 -92
  130. package/dist/chunks/index-COaun3nf.js +0 -15
  131. package/dist/chunks/index-DXAtA2f6.js +0 -11
  132. package/dist/chunks/index-DsRLmBW-.js +0 -13
  133. package/dist/chunks/index-gjoCq0yC.js +0 -21
  134. package/dist/chunks/withPlugins-DLoKg4AP.js +0 -559
@@ -1,44 +1,63 @@
1
- declare const _default: {
2
- "name": "InfiniteScrollPlugin",
3
- "description": "监听 Core 的 onReachBottom,在距底部 `threshold` 像素内触发 onLoadMore。自带并发锁:上一次还没结束不会重复触发。",
4
- "since": "2.0.0",
5
- "tags": [
6
- "data",
7
- "加载更多"
8
- ],
9
- "config": [
1
+ declare const _default: {
2
+ "name": "InfiniteScrollPlugin",
3
+ "description": "监听 Core 的 onReachBottom,在距底部 `threshold` 像素内触发 onLoadMore。自带并发锁:上一次还没结束不会重复触发。",
4
+ "since": "2.0.0",
5
+ "tags": [
6
+ "data",
7
+ "加载更多"
8
+ ],
9
+ "events": [
10
+ {
11
+ "name": "onUnmount",
12
+ "when": "瀑布流卸载前",
13
+ "description": "断开观察器、移除滚动监听"
14
+ },
10
15
  {
11
- "name": "threshold",
12
- "type": "number",
13
- "default": "300",
14
- "description": "触发距离 px"
16
+ "name": "onReachBottom",
17
+ "when": "滚动触底(distance 为距底像素)",
18
+ "description": "加载更多、预取下一页"
15
19
  },
16
20
  {
17
- "name": "onLoadMore",
18
- "type": "() => void | Promise<void>",
19
- "default": "props.onLoadMore",
20
- "description": "加载回调"
21
+ "name": "transformProps",
22
+ "when": "渲染前链式改写瀑布流 props",
23
+ "description": "补 gap / columns 默认值、按断点覆盖配置"
21
24
  }
22
25
  ],
23
- "example": "// 滚动到距底部阈值内触发加载更多,带并发锁防重复请求。\nconst Waterfall = withPlugins(WaterfallCore, [\n createInfiniteScrollPlugin({\n threshold: 300,\n }),\n]);\n\n<Waterfall items={items} renderItem={(item) => <Card data={item} />} />;",
24
- "conflicts": [
25
- "PaginationPlugin"
26
- ],
27
- "features": [
28
- "距底 300px 预加载,滚到底时数据已就位",
29
- "并发锁:加载中不重复触发",
30
- "context.hasMore 为 false 时自动停"
31
- ],
32
- "useCases": [
33
- "信息流无限滚动",
34
- "画廊继续加载",
35
- "搜索结果瀑布流"
36
- ],
37
- "notes": [
38
- "阈值不要小于一屏(约 600px),否则用户滚到底会看到空白等待。",
39
- "翻页类场景请用 PaginationPlugin,两者不要同装。"
40
- ]
41
- }
26
+ "methods": [],
27
+ "methodsNote": "只读取 context 字段(props / state / data),不调用上下文方法",
28
+ "config": [
29
+ {
30
+ "name": "threshold",
31
+ "type": "number",
32
+ "default": "300",
33
+ "description": "触发距离 px"
34
+ },
35
+ {
36
+ "name": "onLoadMore",
37
+ "type": "() => void | Promise<void>",
38
+ "default": "props.onLoadMore",
39
+ "description": "加载回调"
40
+ }
41
+ ],
42
+ "example": "// 滚动到距底部阈值内触发加载更多,带并发锁防重复请求。\nconst Waterfall = withPlugins(WaterfallCore, [\n createInfiniteScrollPlugin({\n threshold: 300,\n }),\n]);\n\n<Waterfall items={items} renderItem={(item) => <Card data={item} />} />;",
43
+ "conflicts": [
44
+ "PaginationPlugin"
45
+ ],
46
+ "features": [
47
+ "距底 300px 预加载,滚到底时数据已就位",
48
+ "并发锁:加载中不重复触发",
49
+ "context.hasMore 为 false 时自动停"
50
+ ],
51
+ "useCases": [
52
+ "信息流无限滚动",
53
+ "画廊继续加载",
54
+ "搜索结果瀑布流"
55
+ ],
56
+ "notes": [
57
+ "阈值不要小于一屏(约 600px),否则用户滚到底会看到空白等待。",
58
+ "翻页类场景请用 PaginationPlugin,两者不要同装。"
59
+ ]
60
+ }
42
61
  ;
43
62
 
44
63
  export default _default;
@@ -1,4 +1,4 @@
1
- import { c as e, d as t } from "../../chunks/doc-78xF08vt.js";
1
+ import { c as e, d as t } from "../../chunks/doc-HoyAFR_m.js";
2
2
  const i = Object.assign(e, { meta: t });
3
3
  export {
4
4
  i as createInfiniteScrollPlugin
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/custom-plugins/PaginationPlugin/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAEtF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6CAA6C;IAC7C,cAAc,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CACpC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,GAAE,gBAAqB,GAAG,eAAe,CAAC,CAAC,CAAC,CA+BjG"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/custom-plugins/PaginationPlugin/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAEtF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6CAA6C;IAC7C,cAAc,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CACpC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,GAAE,gBAAqB,GAAG,eAAe,CAAC,CAAC,CAAC,CA6CjG"}
@@ -1,50 +1,64 @@
1
- declare const _default: {
2
- "name": "PaginationPlugin",
3
- "description": "读 `props.pageIndex`(1 基)与 `props.pageSize` 切片。放在数据管线最末端,保证切的是「过滤 + 排序 + 搜索」之后的结果。",
4
- "since": "2.0.0",
5
- "tags": [
6
- "data",
7
- "数据管线",
8
- "分页"
9
- ],
10
- "config": [
11
- {
12
- "name": "pageSize",
13
- "type": "number",
14
- "default": "props.pageSize ?? 20",
15
- "description": "每页条数"
16
- },
1
+ declare const _default: {
2
+ "name": "PaginationPlugin",
3
+ "description": "读 `props.pageIndex`(1 基)与 `props.pageSize` 切片。放在数据管线最末端,保证切的是「过滤 + 排序 + 搜索」之后的结果。",
4
+ "since": "2.0.0",
5
+ "tags": [
6
+ "data",
7
+ "数据管线",
8
+ "分页"
9
+ ],
10
+ "events": [
17
11
  {
18
- "name": "scrollToTop",
19
- "type": "boolean",
20
- "default": "false",
21
- "description": "翻页后回顶"
12
+ "name": "onPropsChange",
13
+ "when": "props 变化后",
14
+ "description": "数据或配置变化时请求重排"
22
15
  },
23
16
  {
24
- "name": "scrollBehavior",
25
- "type": "\"auto\" | \"smooth\"",
26
- "default": "\"auto\"",
27
- "description": "回顶行为"
17
+ "name": "transformProps",
18
+ "when": "渲染前链式改写瀑布流 props",
19
+ "description": "补 gap / columns 默认值、按断点覆盖配置"
28
20
  }
29
21
  ],
30
- "example": "// 按 props.pageIndex / pageSize 切片,页码从 1 开始。\nconst Waterfall = withPlugins(WaterfallCore, [\n createPaginationPlugin({\n scrollToTop: false,\n scrollBehavior: \"auto\",\n }),\n]);\n\n<Waterfall items={items} renderItem={(item) => <Card data={item} />} />;",
31
- "conflicts": [
32
- "InfiniteScrollPlugin"
33
- ],
34
- "features": [
35
- "1 基页码(与 UI 分页器一致)",
36
- "pageIndex 非法值自动夹到 1",
37
- "翻页自动回顶可选"
38
- ],
39
- "useCases": [
40
- "后台列表分页",
41
- "搜索结果分页",
42
- "与 URLSyncPlugin 配合做可分享链接"
43
- ],
44
- "notes": [
45
- "pageSize 优先级:props.pageSize > 工厂 config.pageSize > 20。"
46
- ]
47
- }
22
+ "methods": [],
23
+ "methodsNote": "只读取 context 字段(props / state / data),不调用上下文方法",
24
+ "config": [
25
+ {
26
+ "name": "pageSize",
27
+ "type": "number",
28
+ "default": "props.pageSize ?? 20",
29
+ "description": "每页条数"
30
+ },
31
+ {
32
+ "name": "scrollToTop",
33
+ "type": "boolean",
34
+ "default": "false",
35
+ "description": "翻页后回顶"
36
+ },
37
+ {
38
+ "name": "scrollBehavior",
39
+ "type": "\"auto\" | \"smooth\"",
40
+ "default": "\"auto\"",
41
+ "description": "回顶行为"
42
+ }
43
+ ],
44
+ "example": "// 按 props.pageIndex / pageSize 切片,页码从 1 开始。\nconst Waterfall = withPlugins(WaterfallCore, [\n createPaginationPlugin({\n scrollToTop: false,\n scrollBehavior: \"auto\",\n }),\n]);\n\n<Waterfall items={items} renderItem={(item) => <Card data={item} />} />;",
45
+ "conflicts": [
46
+ "InfiniteScrollPlugin"
47
+ ],
48
+ "features": [
49
+ "1 基页码(与 UI 分页器一致)",
50
+ "pageIndex 非法值自动夹到 1",
51
+ "翻页自动回顶可选"
52
+ ],
53
+ "useCases": [
54
+ "后台列表分页",
55
+ "搜索结果分页",
56
+ "与 URLSyncPlugin 配合做可分享链接"
57
+ ],
58
+ "notes": [
59
+ "pageSize 优先级:props.pageSize > 工厂 config.pageSize > 20。"
60
+ ]
61
+ }
48
62
  ;
49
63
 
50
64
  export default _default;
@@ -1,4 +1,4 @@
1
- import { c as a, d as t } from "../../chunks/doc-B-7dugGv.js";
1
+ import { c as a, d as t } from "../../chunks/doc-DlJICsyN.js";
2
2
  const n = Object.assign(a, { meta: t });
3
3
  export {
4
4
  n as createPaginationPlugin
@@ -1,43 +1,57 @@
1
- declare const _default: {
2
- "name": "PinItemPlugin",
3
- "description": "把若干索引的项钉在顶部指定列,其余项从它们下方继续排。走 D1-A 布局钩子(calculateItemPosition),是旧版宣称但从未生效的能力。",
4
- "since": "2.0.0",
5
- "tags": [
6
- "layout",
7
- "layout-hook",
8
- "置顶"
9
- ],
10
- "config": [
1
+ declare const _default: {
2
+ "name": "PinItemPlugin",
3
+ "description": "把若干索引的项钉在顶部指定列,其余项从它们下方继续排。走 D1-A 布局钩子(calculateItemPosition),是旧版宣称但从未生效的能力。",
4
+ "since": "2.0.0",
5
+ "tags": [
6
+ "layout",
7
+ "layout-hook",
8
+ "置顶"
9
+ ],
10
+ "events": [
11
11
  {
12
- "name": "pinnedIndices",
13
- "type": "number[]",
14
- "default": "[]",
15
- "description": "要钉住的项索引"
12
+ "name": "onBeforeLayout",
13
+ "when": "开始一次布局之前",
14
+ "description": "返回 false 可阻止本次布局(如数据仍在加载)"
16
15
  },
17
16
  {
18
- "name": "column",
19
- "type": "number",
20
- "default": "0",
21
- "description": "钉到第几列"
17
+ "name": "calculateItemPosition",
18
+ "when": "每个卡片参与布局时(拿到 index / item / columns)",
19
+ "description": "返回坐标片段可覆盖列分配结果(置顶、跨列、错位)"
22
20
  }
23
21
  ],
24
- "example": "// 把指定索引的项钉在顶部同一列,不参与常规列高推进(广告位 / 公告卡)。\nconst Waterfall = withPlugins(WaterfallCore, [\n createPinItemPlugin({\n pinnedIndices: [],\n column: 0,\n }),\n]);\n\n<Waterfall items={items} renderItem={(item) => <Card data={item} />} />;",
25
- "features": [
26
- "置顶项不占常规列高:后续项从置顶块下方开始",
27
- "支持多列分别置顶(column 可不同)",
28
- "每次布局前重置偏移,items 变化后不会累加错位"
29
- ],
30
- "useCases": [
31
- "信息流首位的推广卡",
32
- "公告 / 置顶帖",
33
- "需要固定在左上角的活动位"
34
- ],
35
- "notes": [
36
- "置顶项之间按 pinnedIndices 顺序纵向堆叠,同一列多条会依次往下排。",
37
- "置顶会挤掉该列的正常网格位置,pinnedIndices 建议控制在 1~2 条。",
38
- "换列后的 x 由布局引擎按本轮列宽补齐,插件只返回 column 即可 —— 自己用「列宽 + 间距」反推 x 会在间距由其它插件(GapPlugin)注入时算错。"
39
- ]
40
- }
22
+ "methods": [],
23
+ "methodsNote": "只读取 context 字段(props / state / data),不调用上下文方法",
24
+ "config": [
25
+ {
26
+ "name": "pinnedIndices",
27
+ "type": "number[]",
28
+ "default": "[]",
29
+ "description": "要钉住的项索引"
30
+ },
31
+ {
32
+ "name": "column",
33
+ "type": "number",
34
+ "default": "0",
35
+ "description": "钉到第几列"
36
+ }
37
+ ],
38
+ "example": "// 把指定索引的项钉在顶部同一列,不参与常规列高推进(广告位 / 公告卡)。\nconst Waterfall = withPlugins(WaterfallCore, [\n createPinItemPlugin({\n pinnedIndices: [],\n column: 0,\n }),\n]);\n\n<Waterfall items={items} renderItem={(item) => <Card data={item} />} />;",
39
+ "features": [
40
+ "置顶项不占常规列高:后续项从置顶块下方开始",
41
+ "支持多列分别置顶(column 可不同)",
42
+ "每次布局前重置偏移,items 变化后不会累加错位"
43
+ ],
44
+ "useCases": [
45
+ "信息流首位的推广卡",
46
+ "公告 / 置顶帖",
47
+ "需要固定在左上角的活动位"
48
+ ],
49
+ "notes": [
50
+ "置顶项之间按 pinnedIndices 顺序纵向堆叠,同一列多条会依次往下排。",
51
+ "置顶会挤掉该列的正常网格位置,pinnedIndices 建议控制在 1~2 条。",
52
+ "换列后的 x 由布局引擎按本轮列宽补齐,插件只返回 column 即可 —— 自己用「列宽 + 间距」反推 x 会在间距由其它插件(GapPlugin)注入时算错。"
53
+ ]
54
+ }
41
55
  ;
42
56
 
43
57
  export default _default;
@@ -1,4 +1,4 @@
1
- import { c as e, d as t } from "../../chunks/doc-bTHwfIVb.js";
1
+ import { c as e, d as t } from "../../chunks/doc-Bud0hbaz.js";
2
2
  const c = Object.assign(e, { meta: t });
3
3
  export {
4
4
  c as createPinItemPlugin
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/custom-plugins/RecyclePlugin/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAEtF,MAAM,MAAM,aAAa,GAAG;IAC1B,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,EAAE,aAAa,GAAG,eAAe,CAAC,CAAC,CAAC,CAmCtF"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/custom-plugins/RecyclePlugin/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAEhB,MAAM,gDAAgD,CAAC;AAExD,MAAM,MAAM,aAAa,GAAG;IAC1B,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,EAAE,aAAa,GAAG,eAAe,CAAC,CAAC,CAAC,CAuCtF"}
@@ -1,35 +1,64 @@
1
- declare const _default: {
2
- "name": "RecyclePlugin",
3
- "description": "纯绘制层优化:项离开视口就 `visibility: hidden`,回来再显示。DOM 节点不销毁,滚动位置与已加载的图片都保留,适合「项里有视频/Canvas,重建代价高」的场景。",
4
- "since": "2.0.0",
5
- "tags": [
6
- "interaction",
7
- "性能"
8
- ],
9
- "config": [
1
+ declare const _default: {
2
+ "name": "RecyclePlugin",
3
+ "description": "纯绘制层优化:项离开视口就 `visibility: hidden`,回来再显示。DOM 节点不销毁,滚动位置与已加载的图片都保留,适合「项里有视频/Canvas,重建代价高」的场景。",
4
+ "since": "2.0.0",
5
+ "tags": [
6
+ "interaction",
7
+ "性能"
8
+ ],
9
+ "events": [
10
+ {
11
+ "name": "onUnmount",
12
+ "when": "瀑布流卸载前",
13
+ "description": "断开观察器、移除滚动监听"
14
+ },
15
+ {
16
+ "name": "onItemUnmount",
17
+ "when": "单个卡片卸载时",
18
+ "description": "解绑该卡片的监听与观察器"
19
+ },
20
+ {
21
+ "name": "onItemEnterViewport",
22
+ "when": "单个卡片进入视口",
23
+ "description": "卡片级曝光、视频自动播放等"
24
+ },
10
25
  {
11
- "name": "poolSize",
12
- "type": "number",
13
- "default": "—",
14
- "description": "同时保持可见的项数上限(超出则回收最早的)"
26
+ "name": "onItemLeaveViewport",
27
+ "when": "单个卡片离开视口",
28
+ "description": "暂停播放、回收资源"
15
29
  }
16
30
  ],
17
- "example": "// 视口外的项设 `visibility: hidden`,降低长列表的绘制压力。\nconst Waterfall = withPlugins(WaterfallCore, [\n createRecyclePlugin(),\n]);\n\n<Waterfall items={items} renderItem={(item) => <Card data={item} />} />;",
18
- "features": [
19
- "不销毁 DOM,只隐藏",
20
- "项内媒体不重新加载",
21
- "与虚拟化正交(一个省绘制、一个省节点)"
22
- ],
23
- "useCases": [
24
- "项内含视频 / canvas",
25
- "长列表滚动发虚",
26
- "低端设备省电"
31
+ "methods": [
32
+ {
33
+ "name": "getItemRef",
34
+ "signature": "ctx.getItemRef(index: number): HTMLElement | null",
35
+ "description": "取第 index 张卡片的 DOM 引用,可能为 null(尚未挂载 / 已回收)"
36
+ }
27
37
  ],
28
- "notes": [
29
- "与 Core 的 `virtualize` 同开会让项被卸载又隐藏,收益互相抵消,建议只选一个。",
30
- "只改 visibility 不改布局,所以不会引起重排。"
31
- ]
32
- }
38
+ "config": [
39
+ {
40
+ "name": "poolSize",
41
+ "type": "number",
42
+ "default": "—",
43
+ "description": "同时保持可见的项数上限(超出则回收最早的)"
44
+ }
45
+ ],
46
+ "example": "// 视口外的项设 `visibility: hidden`,降低长列表的绘制压力。\nconst Waterfall = withPlugins(WaterfallCore, [\n createRecyclePlugin(),\n]);\n\n<Waterfall items={items} renderItem={(item) => <Card data={item} />} />;",
47
+ "features": [
48
+ "不销毁 DOM,只隐藏",
49
+ "项内媒体不重新加载",
50
+ "与虚拟化正交(一个省绘制、一个省节点)"
51
+ ],
52
+ "useCases": [
53
+ "项内含视频 / canvas",
54
+ "长列表滚动发虚",
55
+ "低端设备省电"
56
+ ],
57
+ "notes": [
58
+ "与 Core 的 `virtualize` 同开会让项被卸载又隐藏,收益互相抵消,建议只选一个。",
59
+ "只改 visibility 不改布局,所以不会引起重排。"
60
+ ]
61
+ }
33
62
  ;
34
63
 
35
64
  export default _default;
@@ -1,4 +1,4 @@
1
- import { c as e, d as c } from "../../chunks/doc-CraXjOaA.js";
1
+ import { c as e, d as c } from "../../chunks/doc-skPl6ZMP.js";
2
2
  const a = Object.assign(e, { meta: c });
3
3
  export {
4
4
  a as createRecyclePlugin
@@ -6,6 +6,35 @@ declare const _default: {
6
6
  "perf",
7
7
  "a11y"
8
8
  ],
9
+ "events": [
10
+ {
11
+ "name": "onUnmount",
12
+ "when": "瀑布流卸载前",
13
+ "description": "断开观察器、移除滚动监听"
14
+ },
15
+ {
16
+ "name": "onItemMount",
17
+ "when": "单个卡片挂载并拿到 DOM 元素时",
18
+ "description": "按卡片绑定监听、观察器、埋点"
19
+ },
20
+ {
21
+ "name": "onItemUnmount",
22
+ "when": "单个卡片卸载时",
23
+ "description": "解绑该卡片的监听与观察器"
24
+ },
25
+ {
26
+ "name": "onLayoutComplete",
27
+ "when": "DOM 落位完成(可安全测量)",
28
+ "description": "测量真实高度、懒加载判定、曝光上报"
29
+ },
30
+ {
31
+ "name": "transformProps",
32
+ "when": "渲染前链式改写瀑布流 props",
33
+ "description": "补 gap / columns 默认值、按断点覆盖配置"
34
+ }
35
+ ],
36
+ "methods": [],
37
+ "methodsNote": "只读取 context 字段(props / state / data),不调用上下文方法",
9
38
  "config": [
10
39
  {
11
40
  "name": "disableTransform",
@@ -1,4 +1,4 @@
1
- import { c as e, d as o } from "../../chunks/doc-DukOmDCo.js";
1
+ import { c as e, d as o } from "../../chunks/doc-C-B3zK2o.js";
2
2
  const c = Object.assign(e, { meta: o });
3
3
  export {
4
4
  c as createReducedMotionPlugin
@@ -1,37 +1,46 @@
1
- declare const _default: {
2
- "name": "ResponsiveColumnsPlugin",
3
- "description": "用一张断点表控制列数,命中哪档用哪档。走 D1-A 布局钩子(calculateColumns),按容器宽度匹配断点。",
4
- "since": "2.0.0",
5
- "tags": [
6
- "layout",
7
- "layout-hook",
8
- "响应式"
9
- ],
10
- "config": [
1
+ declare const _default: {
2
+ "name": "ResponsiveColumnsPlugin",
3
+ "description": "用一张断点表控制列数,命中哪档用哪档。走 D1-A 布局钩子(calculateColumns),按容器宽度匹配断点。",
4
+ "since": "2.0.0",
5
+ "tags": [
6
+ "layout",
7
+ "layout-hook",
8
+ "响应式"
9
+ ],
10
+ "events": [
11
11
  {
12
- "name": "breakpoints",
13
- "type": "Record<string, { width: number; columns: number }>",
14
- "default": "—",
15
- "description": "断点表,按 width 升序匹配"
12
+ "name": "calculateColumns",
13
+ "when": "每次布局前,询问列数",
14
+ "description": "返回列数则覆盖 props.columns;返回 undefined 沿用配置"
16
15
  }
17
16
  ],
18
- "example": "// 按断点表决定列数(如 640 → 2 列、1024 → 3 列、1440 → 4 列)。\nconst Waterfall = withPlugins(WaterfallCore, [\n createResponsiveColumnsPlugin(),\n]);\n\n<Waterfall items={items} renderItem={(item) => <Card data={item} />} />;",
19
- "conflicts": [
20
- "AutoColumnPlugin"
21
- ],
22
- "features": [
23
- "断点表驱动,设计稿几档就写几档",
24
- "按容器宽度而非视口宽度匹配",
25
- "未命中任何断点时回退到 props.columns"
26
- ],
27
- "useCases": [
28
- "严格对齐设计断点的站点",
29
- "同一个组件嵌在不同宽度的容器里"
30
- ],
31
- "notes": [
32
- "与 AutoColumnPlugin 互斥。"
33
- ]
34
- }
17
+ "methods": [],
18
+ "methodsNote": "只读取 context 字段(props / state / data),不调用上下文方法",
19
+ "config": [
20
+ {
21
+ "name": "breakpoints",
22
+ "type": "Record<string, { width: number; columns: number }>",
23
+ "default": "—",
24
+ "description": "断点表,按 width 升序匹配"
25
+ }
26
+ ],
27
+ "example": "// 按断点表决定列数(如 640 → 2 列、1024 → 3 列、1440 → 4 列)。\nconst Waterfall = withPlugins(WaterfallCore, [\n createResponsiveColumnsPlugin(),\n]);\n\n<Waterfall items={items} renderItem={(item) => <Card data={item} />} />;",
28
+ "conflicts": [
29
+ "AutoColumnPlugin"
30
+ ],
31
+ "features": [
32
+ "断点表驱动,设计稿几档就写几档",
33
+ "按容器宽度而非视口宽度匹配",
34
+ "未命中任何断点时回退到 props.columns"
35
+ ],
36
+ "useCases": [
37
+ "严格对齐设计断点的站点",
38
+ "同一个组件嵌在不同宽度的容器里"
39
+ ],
40
+ "notes": [
41
+ "与 AutoColumnPlugin 互斥。"
42
+ ]
43
+ }
35
44
  ;
36
45
 
37
46
  export default _default;
@@ -1,4 +1,4 @@
1
- import { c as e, d as s } from "../../chunks/doc-DElLNjIc.js";
1
+ import { c as e, d as s } from "../../chunks/doc-C206ZwYC.js";
2
2
  const n = Object.assign(e, { meta: s });
3
3
  export {
4
4
  n as createResponsiveColumnsPlugin