vane-waterfall 2.0.2 → 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 (102) hide show
  1. package/dist/chunks/doc-BAhVW3g8.js +150 -0
  2. package/dist/chunks/{doc-BXaJl1By.js → doc-BU0CKW63.js} +64 -35
  3. package/dist/chunks/{doc-D_ozEn0Q.js → doc-BrEd0oZB.js} +41 -32
  4. package/dist/chunks/{doc-bTHwfIVb.js → doc-Bud0hbaz.js} +39 -25
  5. package/dist/chunks/{doc-DukOmDCo.js → doc-C-B3zK2o.js} +52 -23
  6. package/dist/chunks/{doc-DElLNjIc.js → doc-C206ZwYC.js} +33 -24
  7. package/dist/chunks/{doc-BSnWbrkH.js → doc-C2L8kkeI.js} +49 -25
  8. package/dist/chunks/{doc-a0MK2S3n.js → doc-CE1DGMBV.js} +62 -38
  9. package/dist/chunks/{doc-BXSy2aPP.js → doc-CHbQXLwY.js} +33 -19
  10. package/dist/chunks/{doc-BfWnfTst.js → doc-CInpKZNU.js} +38 -24
  11. package/dist/chunks/{doc-gTAsLjVx.js → doc-CYxwSuG6.js} +30 -16
  12. package/dist/chunks/{doc-DzvTrZ13.js → doc-CaJ02INP.js} +25 -16
  13. package/dist/chunks/{doc-BXElhF2h.js → doc-CiCso5Ti.js} +44 -30
  14. package/dist/chunks/{doc-BCmEnh39.js → doc-CkuMr8Ca.js} +49 -25
  15. package/dist/chunks/{doc-3Fpag2G8.js → doc-D7m1OFCW.js} +38 -24
  16. package/dist/chunks/doc-DEN2WTDh.js +153 -0
  17. package/dist/chunks/{doc-C5xrHNoC.js → doc-DhICh9S2.js} +37 -23
  18. package/dist/chunks/{doc-DAieSXLy.js → doc-DlJICsyN.js} +41 -27
  19. package/dist/chunks/{doc-CN4edvn_.js → doc-DtxS1-P0.js} +32 -23
  20. package/dist/chunks/{doc-BIzjYAZW.js → doc-DudYCn_-.js} +25 -16
  21. package/dist/chunks/{doc-BmoijI6q.js → doc-HoyAFR_m.js} +43 -24
  22. package/dist/chunks/doc-RlBMCMNs.js +170 -0
  23. package/dist/chunks/doc-RwKQqySd.js +102 -0
  24. package/dist/chunks/{doc-CTUoMe7o.js → doc-eYhNJy97.js} +31 -22
  25. package/dist/chunks/{doc-CcPFavOs.js → doc-i6FY1We1.js} +27 -13
  26. package/dist/chunks/doc-skPl6ZMP.js +101 -0
  27. package/dist/chunks/index-8gEIzUxi.js +15 -0
  28. package/dist/chunks/index-B96I5CKE.js +21 -0
  29. package/dist/chunks/index-Bjmhy8jW.js +11 -0
  30. package/dist/chunks/index-Cuq0ofv-.js +13 -0
  31. package/dist/chunks/{index-BAWlVYr3.js → index-Cz4YEqRF.js} +1 -1
  32. package/dist/chunks/{index-CF0tYRop.js → index-FBJVUYmH.js} +1 -1
  33. package/dist/chunks/withPlugins-BOeDFhof.js +743 -0
  34. package/dist/custom-plugins/A11yPlugin/doc.json.d.ts +64 -40
  35. package/dist/custom-plugins/A11yPlugin/index.js +1 -1
  36. package/dist/custom-plugins/AlignmentPlugin/doc.json.d.ts +42 -28
  37. package/dist/custom-plugins/AlignmentPlugin/index.js +1 -1
  38. package/dist/custom-plugins/AutoColumnPlugin/doc.json.d.ts +53 -44
  39. package/dist/custom-plugins/AutoColumnPlugin/index.js +1 -1
  40. package/dist/custom-plugins/BookmarkPlugin/doc.json.d.ts +44 -35
  41. package/dist/custom-plugins/BookmarkPlugin/index.js +1 -1
  42. package/dist/custom-plugins/ClickAnalyticsPlugin/doc.json.d.ts +29 -0
  43. package/dist/custom-plugins/ClickAnalyticsPlugin/index.js +1 -1
  44. package/dist/custom-plugins/DebounceLayoutPlugin/doc.json.d.ts +37 -28
  45. package/dist/custom-plugins/DebounceLayoutPlugin/index.js +1 -1
  46. package/dist/custom-plugins/DragReorderPlugin/doc.json.d.ts +14 -0
  47. package/dist/custom-plugins/DragReorderPlugin/index.js +1 -1
  48. package/dist/custom-plugins/FilterPlugin/doc.json.d.ts +53 -39
  49. package/dist/custom-plugins/FilterPlugin/index.js +1 -1
  50. package/dist/custom-plugins/FixedHeightPlugin/doc.json.d.ts +42 -28
  51. package/dist/custom-plugins/FixedHeightPlugin/index.js +1 -1
  52. package/dist/custom-plugins/GapPlugin/doc.json.d.ts +61 -37
  53. package/dist/custom-plugins/GapPlugin/index.js +1 -1
  54. package/dist/custom-plugins/GroupingPlugin/doc.json.d.ts +61 -32
  55. package/dist/custom-plugins/GroupingPlugin/index.js +1 -1
  56. package/dist/custom-plugins/HeatmapAnalyticsPlugin/doc.json.d.ts +24 -0
  57. package/dist/custom-plugins/HeatmapAnalyticsPlugin/index.js +1 -1
  58. package/dist/custom-plugins/InfiniteScrollPlugin/doc.json.d.ts +55 -36
  59. package/dist/custom-plugins/InfiniteScrollPlugin/index.js +1 -1
  60. package/dist/custom-plugins/PaginationPlugin/doc.json.d.ts +56 -42
  61. package/dist/custom-plugins/PaginationPlugin/index.js +1 -1
  62. package/dist/custom-plugins/PinItemPlugin/doc.json.d.ts +49 -35
  63. package/dist/custom-plugins/PinItemPlugin/index.js +1 -1
  64. package/dist/custom-plugins/RecyclePlugin/doc.json.d.ts +57 -28
  65. package/dist/custom-plugins/RecyclePlugin/index.js +1 -1
  66. package/dist/custom-plugins/ReducedMotionPlugin/doc.json.d.ts +29 -0
  67. package/dist/custom-plugins/ReducedMotionPlugin/index.js +1 -1
  68. package/dist/custom-plugins/ResponsiveColumnsPlugin/doc.json.d.ts +40 -31
  69. package/dist/custom-plugins/ResponsiveColumnsPlugin/index.js +1 -1
  70. package/dist/custom-plugins/ScrollAnchorPlugin/doc.json.d.ts +42 -28
  71. package/dist/custom-plugins/ScrollAnchorPlugin/index.js +1 -1
  72. package/dist/custom-plugins/SearchPlugin/doc.json.d.ts +53 -39
  73. package/dist/custom-plugins/SearchPlugin/index.js +1 -1
  74. package/dist/custom-plugins/SortPlugin/doc.json.d.ts +52 -38
  75. package/dist/custom-plugins/SortPlugin/index.js +1 -1
  76. package/dist/custom-plugins/StatePersistencePlugin/doc.json.d.ts +71 -37
  77. package/dist/custom-plugins/StatePersistencePlugin/index.js +1 -1
  78. package/dist/custom-plugins/StickyHeaderPlugin/doc.json.d.ts +43 -34
  79. package/dist/custom-plugins/StickyHeaderPlugin/index.js +1 -1
  80. package/dist/custom-plugins/ThrottlePlugin/doc.json.d.ts +43 -34
  81. package/dist/custom-plugins/ThrottlePlugin/index.js +1 -1
  82. package/dist/custom-plugins/TransitionPlugin/doc.json.d.ts +49 -35
  83. package/dist/custom-plugins/TransitionPlugin/index.js +1 -1
  84. package/dist/custom-plugins/URLSyncPlugin/doc.json.d.ts +57 -33
  85. package/dist/custom-plugins/URLSyncPlugin/index.js +1 -1
  86. package/dist/custom-plugins/index.js +6 -6
  87. package/dist/entries/plugins.js +7 -7
  88. package/dist/index.js +1 -1
  89. package/dist/presets/dashboard/index.js +2 -2
  90. package/dist/presets/photo-feed/index.js +3 -3
  91. package/dist/presets/product-feed/index.js +2 -2
  92. package/package.json +26 -26
  93. package/dist/chunks/doc-BQQoKNto.js +0 -126
  94. package/dist/chunks/doc-BindRMfO.js +0 -72
  95. package/dist/chunks/doc-CBHjiDG7.js +0 -88
  96. package/dist/chunks/doc-CkU5GtLw.js +0 -136
  97. package/dist/chunks/doc-KN6Bvmty.js +0 -124
  98. package/dist/chunks/index-B8o6R4RZ.js +0 -15
  99. package/dist/chunks/index-BFyYpEY_.js +0 -11
  100. package/dist/chunks/index-CJR0Buju.js +0 -21
  101. package/dist/chunks/index-DHTB3QEP.js +0 -13
  102. package/dist/chunks/withPlugins-DG3YpSgL.js +0 -655
@@ -1,35 +1,46 @@
1
- function g(r = {}) {
1
+ function S(e = {}) {
2
2
  return {
3
3
  name: "SortPlugin",
4
4
  priority: 30,
5
5
  enabled: !0,
6
6
  hooks: {
7
7
  transformProps: (o) => {
8
- const e = Array.isArray(o.items) ? o.items : [], t = o.sortComparator || r.comparator;
8
+ const r = Array.isArray(o.items) ? o.items : [], t = o.sortComparator || e.comparator;
9
9
  if (typeof t != "function") return o;
10
- const s = [...e].sort((a, n) => {
10
+ const s = [...r].sort((n, a) => {
11
11
  try {
12
- return t(a, n);
12
+ return t(n, a);
13
13
  } catch {
14
14
  return 0;
15
15
  }
16
16
  });
17
17
  return { ...o, items: s };
18
18
  },
19
- onPropsChange: (o, e, t) => {
20
- const s = e?.sortComparator, a = t?.sortComparator;
21
- if (((typeof t?.scrollToTopOnSortChange == "boolean" ? t.scrollToTopOnSortChange : void 0) ?? !!r.scrollToTop) && s !== a) {
22
- const l = t?.scrollToTopBehavior ?? r.scrollBehavior ?? "auto";
23
- o.scrollToTop?.({ behavior: l });
19
+ onPropsChange: (o, r, t) => {
20
+ const s = r?.sortComparator, n = t?.sortComparator;
21
+ if (((typeof t?.scrollToTopOnSortChange == "boolean" ? t.scrollToTopOnSortChange : void 0) ?? !!e.scrollToTop) && s !== n) {
22
+ const c = t?.scrollToTopBehavior ?? e.scrollBehavior ?? "auto";
23
+ o.scrollToTop?.({ behavior: c });
24
24
  }
25
25
  }
26
26
  }
27
27
  };
28
28
  }
29
- const c = "SortPlugin", i = "用比较函数排序,优先读 `props.sortComparator`。排序总是在过滤之后、分页之前执行,保证「第 N 页」是排序后的第 N 页。", m = "2.0.0", p = [
29
+ const l = "SortPlugin", i = "用比较函数排序,优先读 `props.sortComparator`。排序总是在过滤之后、分页之前执行,保证「第 N 页」是排序后的第 N 页。", m = "2.0.0", p = [
30
30
  "data",
31
31
  "数据管线"
32
- ], u = [
32
+ ], d = [
33
+ {
34
+ name: "onPropsChange",
35
+ when: "props 变化后",
36
+ description: "数据或配置变化时请求重排"
37
+ },
38
+ {
39
+ name: "transformProps",
40
+ when: "渲染前链式改写瀑布流 props",
41
+ description: "补 gap / columns 默认值、按断点覆盖配置"
42
+ }
43
+ ], u = [], h = "只读取 context 字段(props / state / data),不调用上下文方法", f = [
33
44
  {
34
45
  name: "comparator",
35
46
  type: "(a, b) => number",
@@ -48,7 +59,7 @@ const c = "SortPlugin", i = "用比较函数排序,优先读 `props.sortCompar
48
59
  default: '"auto"',
49
60
  description: "回顶行为"
50
61
  }
51
- ], d = `// 按比较函数排序 items,比较函数变化可自动回顶。
62
+ ], C = `// 按比较函数排序 items,比较函数变化可自动回顶。
52
63
  const Waterfall = withPlugins(WaterfallCore, [
53
64
  createSortPlugin({
54
65
  scrollToTop: false,
@@ -56,28 +67,31 @@ const Waterfall = withPlugins(WaterfallCore, [
56
67
  }),
57
68
  ]);
58
69
 
59
- <Waterfall items={items} renderItem={(item) => <Card data={item} />} />;`, f = [
70
+ <Waterfall items={items} renderItem={(item) => <Card data={item} />} />;`, T = [
60
71
  "稳定排序(不改原数组)",
61
72
  "比较函数抛错按相等处理",
62
73
  "与 Filter / Search 顺序固定"
63
- ], h = [
74
+ ], g = [
64
75
  "价格 / 时间排序",
65
76
  "热度排序",
66
77
  "手动置顶项优先"
67
- ], C = [
78
+ ], v = [
68
79
  "排序会复制数组(`[...items].sort`),不会改调用方传入的 items。"
69
- ], y = {
70
- name: c,
80
+ ], b = {
81
+ name: l,
71
82
  description: i,
72
83
  since: m,
73
84
  tags: p,
74
- config: u,
75
- example: d,
76
- features: f,
77
- useCases: h,
78
- notes: C
85
+ events: d,
86
+ methods: u,
87
+ methodsNote: h,
88
+ config: f,
89
+ example: C,
90
+ features: T,
91
+ useCases: g,
92
+ notes: v
79
93
  };
80
94
  export {
81
- g as c,
82
- y as d
95
+ S as c,
96
+ b as d
83
97
  };
@@ -1,55 +1,69 @@
1
- function u(n) {
1
+ function g(t) {
2
2
  return {
3
3
  name: "AlignmentPlugin",
4
4
  priority: 60,
5
5
  enabled: !0,
6
6
  hooks: {
7
- transformProps: (e) => ({ ...e, alignmentMode: n.mode }),
7
+ transformProps: (e) => ({ ...e, alignmentMode: t.mode }),
8
8
  onResize: (e) => {
9
9
  e.relayout?.();
10
10
  }
11
11
  }
12
12
  };
13
13
  }
14
- const t = "AlignmentPlugin", s = "设置瀑布流的列分配策略。shortest 让每列尽量等高(视觉最自然),balanced 让每列项数接近,sequential 按 index 轮转(可预测位置,适合需要与外部索引对齐的场景)。", o = "2.0.0", a = [
14
+ const n = "AlignmentPlugin", s = "设置瀑布流的列分配策略。shortest 让每列尽量等高(视觉最自然),balanced 让每列项数接近,sequential 按 index 轮转(可预测位置,适合需要与外部索引对齐的场景)。", o = "2.0.0", a = [
15
15
  "layout",
16
16
  "布局"
17
17
  ], i = [
18
+ {
19
+ name: "onResize",
20
+ when: "容器宽度变化触发重排前",
21
+ description: "按新宽度调整列数或卡片密度"
22
+ },
23
+ {
24
+ name: "transformProps",
25
+ when: "渲染前链式改写瀑布流 props",
26
+ description: "补 gap / columns 默认值、按断点覆盖配置"
27
+ }
28
+ ], r = [], c = "只读取 context 字段(props / state / data),不调用上下文方法", l = [
18
29
  {
19
30
  name: "mode",
20
31
  type: '"shortest" | "balanced" | "sequential"',
21
32
  default: "shortest",
22
33
  description: "列分配策略"
23
34
  }
24
- ], l = `// 指定列分配策略:最矮列优先(shortest)/ 项数均衡(balanced)/ 顺序轮转(sequential)。
35
+ ], m = `// 指定列分配策略:最矮列优先(shortest)/ 项数均衡(balanced)/ 顺序轮转(sequential)。
25
36
  const Waterfall = withPlugins(WaterfallCore, [
26
37
  createAlignmentPlugin({
27
38
  mode: "shortest",
28
39
  }),
29
40
  ]);
30
41
 
31
- <Waterfall items={items} renderItem={(item) => <Card data={item} />} />;`, r = [
42
+ <Waterfall items={items} renderItem={(item) => <Card data={item} />} />;`, d = [
32
43
  "三种列分配策略",
33
44
  "只改 props.alignmentMode,不影响其他配置",
34
45
  "与 ResponsiveColumns / AutoColumn 正交"
35
- ], c = [
46
+ ], u = [
36
47
  "内容流:默认 shortest",
37
48
  "等长卡片:balanced 更整齐",
38
49
  "需要与后端顺序对齐:sequential"
39
- ], m = [
50
+ ], p = [
40
51
  "balanced 与 shortest 在列高相同时都取最左列,视觉上左偏是预期行为。"
41
- ], d = {
42
- name: t,
52
+ ], h = {
53
+ name: n,
43
54
  description: s,
44
55
  since: o,
45
56
  tags: a,
46
- config: i,
47
- example: l,
48
- features: r,
49
- useCases: c,
50
- notes: m
57
+ events: i,
58
+ methods: r,
59
+ methodsNote: c,
60
+ config: l,
61
+ example: m,
62
+ features: d,
63
+ useCases: u,
64
+ notes: p
51
65
  };
52
66
  export {
53
- u as c,
54
- d
67
+ g as c,
68
+ h as d
55
69
  };
@@ -1,4 +1,4 @@
1
- function m(e) {
1
+ function h(e) {
2
2
  return {
3
3
  name: "ThrottlePlugin",
4
4
  priority: 80,
@@ -12,10 +12,16 @@ function m(e) {
12
12
  }
13
13
  };
14
14
  }
15
- const n = "ThrottlePlugin", s = "接管 Core 的 throttleDelay(滚动回调节流)与 debounceDelay(尺寸变化后多久重排)。默认 16ms / 150ms,长列表滚动卡顿时可以放宽到 32 / 300。", o = "2.0.0", r = [
15
+ const s = "ThrottlePlugin", n = "接管 Core 的 throttleDelay(滚动回调节流)与 debounceDelay(尺寸变化后多久重排)。默认 16ms / 150ms,长列表滚动卡顿时可以放宽到 32 / 300。", o = "2.0.0", r = [
16
16
  "perf",
17
17
  "性能"
18
18
  ], a = [
19
+ {
20
+ name: "transformProps",
21
+ when: "渲染前链式改写瀑布流 props",
22
+ description: "补 gap / columns 默认值、按断点覆盖配置"
23
+ }
24
+ ], c = [], l = "只读取 context 字段(props / state / data),不调用上下文方法", i = [
19
25
  {
20
26
  name: "scroll",
21
27
  type: "number",
@@ -28,33 +34,36 @@ const n = "ThrottlePlugin", s = "接管 Core 的 throttleDelay(滚动回调节
28
34
  default: "props.debounceDelay",
29
35
  description: "布局防抖 ms"
30
36
  }
31
- ], l = `// 调整滚动节流与尺寸防抖,弱网/低端机可放宽。
37
+ ], m = `// 调整滚动节流与尺寸防抖,弱网/低端机可放宽。
32
38
  const Waterfall = withPlugins(WaterfallCore, [
33
39
  createThrottlePlugin(),
34
40
  ]);
35
41
 
36
- <Waterfall items={items} renderItem={(item) => <Card data={item} />} />;`, c = [
42
+ <Waterfall items={items} renderItem={(item) => <Card data={item} />} />;`, u = [
37
43
  "滚动节流与布局防抖分开调",
38
44
  "只改 props,不改算法",
39
45
  "与 DebounceLayoutPlugin 叠加时后者优先"
40
- ], i = [
46
+ ], d = [
41
47
  "低端安卓机长列表",
42
48
  "滚动时 CPU 占用过高",
43
49
  "拖拽侧栏时减少重排"
44
- ], u = [
50
+ ], p = [
45
51
  "scroll 低于 16ms 没有意义(浏览器帧率上限)。"
46
- ], d = {
47
- name: n,
48
- description: s,
52
+ ], f = {
53
+ name: s,
54
+ description: n,
49
55
  since: o,
50
56
  tags: r,
51
- config: a,
52
- example: l,
53
- features: c,
54
- useCases: i,
55
- notes: u
57
+ events: a,
58
+ methods: c,
59
+ methodsNote: l,
60
+ config: i,
61
+ example: m,
62
+ features: u,
63
+ useCases: d,
64
+ notes: p
56
65
  };
57
66
  export {
58
- m as c,
59
- d
67
+ h as c,
68
+ f as d
60
69
  };
@@ -1,48 +1,48 @@
1
1
  import { jsx as E } from "react/jsx-runtime";
2
2
  const i = "data-drag-over";
3
- function y(s, l) {
3
+ function w(a, c) {
4
4
  if (typeof document > "u") return null;
5
- const c = document.elementFromPoint(s, l)?.closest?.("[data-index]");
6
- if (!c) return null;
7
- const d = Number(c.getAttribute("data-index"));
5
+ const l = document.elementFromPoint(a, c)?.closest?.("[data-index]");
6
+ if (!l) return null;
7
+ const d = Number(l.getAttribute("data-index"));
8
8
  return Number.isFinite(d) ? d : null;
9
9
  }
10
- function C(s = {}) {
11
- const l = s.enabled ?? !0, g = s.showHandle ?? !1, c = s.touchHoldMs ?? 180, d = (t, n, r) => {
10
+ function O(a = {}) {
11
+ const c = a.enabled ?? !0, g = a.showHandle ?? !1, l = a.touchHoldMs ?? 180, d = (t, n, r) => {
12
12
  const e = Number(r);
13
13
  if (!Number.isFinite(e) || e === n) return;
14
14
  t.sharedData.set("drag-from", e), t.sharedData.set("drag-to", n), t.bus.emit("drag:reorder", { from: e, to: n });
15
- const f = t.props.items;
16
- s.onReorder?.(e, n, f?.[e]);
17
- }, b = () => {
15
+ const p = t.props.items;
16
+ a.onReorder?.(e, n, p?.[e]);
17
+ }, h = () => {
18
18
  document.querySelectorAll(`[${i}]`).forEach((t) => t.removeAttribute(i));
19
19
  }, m = () => {
20
- typeof document > "u" || (b(), document.body.style.userSelect = "", document.body.style.cursor = "");
21
- }, w = (t, n, r) => {
20
+ typeof document > "u" || (h(), document.body.style.userSelect = "", document.body.style.cursor = "");
21
+ }, y = (t, n, r) => {
22
22
  if (t.pointerType === "mouse") return;
23
- const e = t.clientX, f = t.clientY, R = Date.now();
24
- let p = !1, h = null;
23
+ const e = t.clientX, p = t.clientY, R = Date.now();
24
+ let f = !1, b = null;
25
25
  const v = (o) => {
26
- if (!p) {
27
- const D = Date.now() - R >= c, H = Math.hypot(o.clientX - e, o.clientY - f) >= 6;
26
+ if (!f) {
27
+ const D = Date.now() - R >= l, H = Math.hypot(o.clientX - e, o.clientY - p) >= 6;
28
28
  if (!D || !H) return;
29
- p = !0, document.body.style.userSelect = "none", document.body.style.cursor = "grabbing";
29
+ f = !0, document.body.style.userSelect = "none", document.body.style.cursor = "grabbing";
30
30
  }
31
31
  o.preventDefault();
32
- const a = y(o.clientX, o.clientY);
33
- a !== h && (b(), h = a, a != null && document.querySelector(`[data-index="${a}"]`)?.setAttribute(i, ""));
32
+ const s = w(o.clientX, o.clientY);
33
+ s !== b && (h(), b = s, s != null && document.querySelector(`[data-index="${s}"]`)?.setAttribute(i, ""));
34
34
  }, u = (o) => {
35
- if (window.removeEventListener("pointermove", v), window.removeEventListener("pointerup", u), window.removeEventListener("pointercancel", u), m(), !p) return;
36
- const a = y(o.clientX, o.clientY);
37
- a != null && d(r, a, String(n));
35
+ if (window.removeEventListener("pointermove", v), window.removeEventListener("pointerup", u), window.removeEventListener("pointercancel", u), m(), !f) return;
36
+ const s = w(o.clientX, o.clientY);
37
+ s != null && d(r, s, String(n));
38
38
  };
39
39
  window.addEventListener("pointermove", v, { passive: !1 }), window.addEventListener("pointerup", u), window.addEventListener("pointercancel", u);
40
40
  };
41
41
  return {
42
42
  name: "DragReorderPlugin",
43
- enabled: l,
43
+ enabled: c,
44
44
  hooks: {
45
- renderItemWrapper: (t, n, r) => l ? /* @__PURE__ */ E(
45
+ renderItemWrapper: (t, n, r) => c ? /* @__PURE__ */ E(
46
46
  "div",
47
47
  {
48
48
  draggable: !0,
@@ -62,7 +62,7 @@ function C(s = {}) {
62
62
  e.preventDefault(), m(), d(t, r, e.dataTransfer?.getData("text/plain") ?? "");
63
63
  },
64
64
  onDragEnd: m,
65
- onPointerDown: (e) => w(e, r, t),
65
+ onPointerDown: (e) => y(e, r, t),
66
66
  style: {
67
67
  cursor: "grab",
68
68
  ...g ? { border: "1px dashed #bdbdbd", borderRadius: 6 } : null
@@ -77,6 +77,17 @@ const L = "DragReorderPlugin", M = "给每个项加拖拽能力,松手时回
77
77
  "interaction",
78
78
  "拖拽"
79
79
  ], S = [
80
+ {
81
+ name: "renderItemWrapper",
82
+ when: "渲染每个卡片时包裹其内容",
83
+ description: "给单卡加包裹层(拖拽、无障碍语义、占位骨架)"
84
+ },
85
+ {
86
+ name: "drag:reorder",
87
+ when: "拖拽排序完成后",
88
+ description: "广播 { from, to },供业务层同步顺序"
89
+ }
90
+ ], T = [], N = "只读取 context 字段(props / state / data),不调用上下文方法", x = [
80
91
  {
81
92
  name: "enabled",
82
93
  type: "boolean",
@@ -101,7 +112,7 @@ const L = "DragReorderPlugin", M = "给每个项加拖拽能力,松手时回
101
112
  default: "180",
102
113
  description: "触屏长按多久进入拖拽(ms),0 表示不需要长按"
103
114
  }
104
- ], T = `// 鼠标走 HTML5 draggable,触屏走长按 + pointer,松手时回调 onReorder(from, to)。
115
+ ], W = `// 鼠标走 HTML5 draggable,触屏走长按 + pointer,松手时回调 onReorder(from, to)。
105
116
  const Waterfall = withPlugins(WaterfallCore, [
106
117
  createDragReorderPlugin({
107
118
  enabled: true,
@@ -121,18 +132,21 @@ const Waterfall = withPlugins(WaterfallCore, [
121
132
  ], q = [
122
133
  "插件只负责「拖」和「告诉你从哪到哪」,数组重排由调用方在 onReorder 里做。",
123
134
  "触屏用长按区分「想滚」和「想拖」:不这样做,手指一滑就变成拖拽,页面滚不动。"
124
- ], N = {
135
+ ], $ = {
125
136
  name: L,
126
137
  description: M,
127
138
  since: A,
128
139
  tags: P,
129
- config: S,
130
- example: T,
140
+ events: S,
141
+ methods: T,
142
+ methodsNote: N,
143
+ config: x,
144
+ example: W,
131
145
  features: X,
132
146
  useCases: Y,
133
147
  notes: q
134
148
  };
135
149
  export {
136
- C as c,
137
- N as d
150
+ O as c,
151
+ $ as d
138
152
  };
@@ -1,39 +1,60 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- function W(n = {}) {
3
- const l = n.containerRole ?? "list", c = n.itemRole ?? "listitem", u = n.enableTabIndex ?? !0, b = n.containerLabel ?? "Waterfall list", a = /* @__PURE__ */ new WeakMap(), i = (e) => e.containerRef?.current ?? e.bus, s = (e) => a.get(i(e)) ?? 0, r = (e) => {
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ function w(n = {}) {
3
+ const l = n.containerRole ?? "list", c = n.itemRole ?? "listitem", m = n.enableTabIndex ?? !0, d = n.containerLabel ?? "Waterfall list", a = /* @__PURE__ */ new WeakMap(), s = (e) => e.containerRef?.current ?? e.bus, i = (e) => a.get(s(e)) ?? 0, o = (e) => {
4
4
  const t = e.containerRef.current;
5
- t && (t.setAttribute("role", l), t.setAttribute("aria-label", b), t.setAttribute("aria-busy", e.isLayouting ? "true" : "false"));
5
+ t && (t.setAttribute("role", l), t.setAttribute("aria-label", d), t.setAttribute("aria-busy", e.isLayouting ? "true" : "false"));
6
6
  };
7
7
  return {
8
8
  name: "A11yPlugin",
9
9
  enabled: !0,
10
10
  hooks: {
11
11
  onMount: (e) => {
12
- r(e);
12
+ o(e);
13
13
  },
14
14
  onLayoutComplete: (e) => {
15
- r(e);
15
+ o(e);
16
16
  },
17
17
  onItemClick: (e, t) => {
18
- s(e) !== t && (a.set(i(e), t), e.forceUpdate?.());
18
+ i(e) !== t && (a.set(s(e), t), e.forceUpdate?.());
19
19
  },
20
- renderItemWrapper: (e, t, o) => /* @__PURE__ */ d(
20
+ renderItemWrapper: (e, t, r) => /* @__PURE__ */ u(
21
21
  "div",
22
22
  {
23
23
  role: c,
24
- "aria-posinset": o + 1,
24
+ "aria-posinset": r + 1,
25
25
  "aria-setsize": e.itemCount,
26
- tabIndex: u ? o === s(e) ? 0 : -1 : void 0,
26
+ tabIndex: m ? r === i(e) ? 0 : -1 : void 0,
27
27
  children: t
28
28
  }
29
29
  )
30
30
  }
31
31
  };
32
32
  }
33
- const m = "A11yPlugin", p = "把瀑布流补成读屏可理解的列表:容器 `role=list` + `aria-label`,每项 `role=listitem` + `aria-posinset` / `aria-setsize`,并可选加 `tabIndex` 让键盘能逐项聚焦。", f = "2.0.0", g = [
33
+ const p = "A11yPlugin", b = "把瀑布流补成读屏可理解的列表:容器 `role=list` + `aria-label`,每项 `role=listitem` + `aria-posinset` / `aria-setsize`,并可选加 `tabIndex` 让键盘能逐项聚焦。", f = "2.0.0", y = [
34
34
  "ui",
35
35
  "a11y"
36
- ], y = [
36
+ ], I = [
37
+ {
38
+ name: "onMount",
39
+ when: "瀑布流挂载完成",
40
+ description: "初始化观察器与滚动监听,返回清理函数"
41
+ },
42
+ {
43
+ name: "onItemClick",
44
+ when: "单个卡片被点击",
45
+ description: "卡片级跳转与点击埋点"
46
+ },
47
+ {
48
+ name: "onLayoutComplete",
49
+ when: "DOM 落位完成(可安全测量)",
50
+ description: "测量真实高度、懒加载判定、曝光上报"
51
+ },
52
+ {
53
+ name: "renderItemWrapper",
54
+ when: "渲染每个卡片时包裹其内容",
55
+ description: "给单卡加包裹层(拖拽、无障碍语义、占位骨架)"
56
+ }
57
+ ], g = [], R = "只读取 context 字段(props / state / data),不调用上下文方法", h = [
37
58
  {
38
59
  name: "containerRole",
39
60
  type: "string",
@@ -58,7 +79,7 @@ const m = "A11yPlugin", p = "把瀑布流补成读屏可理解的列表:容器
58
79
  default: '"Waterfall list"',
59
80
  description: "容器 aria-label"
60
81
  }
61
- ], I = `// 给容器与项补 ARIA role / label / posinset,支持键盘 Tab 遍历。
82
+ ], C = `// 给容器与项补 ARIA role / label / posinset,支持键盘 Tab 遍历。
62
83
  const Waterfall = withPlugins(WaterfallCore, [
63
84
  createA11yPlugin({
64
85
  containerRole: "list",
@@ -67,28 +88,31 @@ const Waterfall = withPlugins(WaterfallCore, [
67
88
  }),
68
89
  ]);
69
90
 
70
- <Waterfall items={items} renderItem={(item) => <Card data={item} />} />;`, R = [
91
+ <Waterfall items={items} renderItem={(item) => <Card data={item} />} />;`, A = [
71
92
  "容器 / 项 role 成对补齐",
72
93
  "aria-posinset + aria-setsize 正确标注序号",
73
94
  "键盘可逐项聚焦"
74
- ], A = [
95
+ ], W = [
75
96
  "政务 / 金融等合规站点",
76
97
  "读屏用户可用的信息流",
77
98
  "键盘操作优先的桌面端"
78
- ], C = [
99
+ ], T = [
79
100
  "项数很多时 `tabIndex=0` 会让 Tab 变长,建议配合「跳转主内容」链接使用。"
80
101
  ], x = {
81
- name: m,
82
- description: p,
102
+ name: p,
103
+ description: b,
83
104
  since: f,
84
- tags: g,
85
- config: y,
86
- example: I,
87
- features: R,
88
- useCases: A,
89
- notes: C
105
+ tags: y,
106
+ events: I,
107
+ methods: g,
108
+ methodsNote: R,
109
+ config: h,
110
+ example: C,
111
+ features: A,
112
+ useCases: W,
113
+ notes: T
90
114
  };
91
115
  export {
92
- W as c,
116
+ w as c,
93
117
  x as d
94
118
  };
@@ -1,4 +1,4 @@
1
- function g(o = {}) {
1
+ function v(o = {}) {
2
2
  return {
3
3
  name: "FilterPlugin",
4
4
  priority: 40,
@@ -7,9 +7,9 @@ function g(o = {}) {
7
7
  transformProps: (e) => {
8
8
  const n = Array.isArray(e.items) ? e.items : [], t = e.filterFn || o.predicate;
9
9
  if (typeof t != "function") return e;
10
- const r = n.filter((a, i) => {
10
+ const r = n.filter((s, a) => {
11
11
  try {
12
- return !!t(a, i);
12
+ return !!t(s, a);
13
13
  } catch {
14
14
  return !0;
15
15
  }
@@ -17,19 +17,30 @@ function g(o = {}) {
17
17
  return { ...e, items: r };
18
18
  },
19
19
  onPropsChange: (e, n, t) => {
20
- const r = n?.filterFn, a = t?.filterFn;
21
- if (((typeof t?.scrollToTopOnFilterChange == "boolean" ? t.scrollToTopOnFilterChange : void 0) ?? !!o.scrollToTop) && r !== a) {
22
- const l = t?.scrollToTopBehavior ?? o.scrollBehavior ?? "auto";
23
- e.scrollToTop?.({ behavior: l });
20
+ const r = n?.filterFn, s = t?.filterFn;
21
+ if (((typeof t?.scrollToTopOnFilterChange == "boolean" ? t.scrollToTopOnFilterChange : void 0) ?? !!o.scrollToTop) && r !== s) {
22
+ const i = t?.scrollToTopBehavior ?? o.scrollBehavior ?? "auto";
23
+ e.scrollToTop?.({ behavior: i });
24
24
  }
25
25
  }
26
26
  }
27
27
  };
28
28
  }
29
- const s = "FilterPlugin", c = "用谓词函数过滤数据,优先读 `props.filterFn`,没有就用工厂里传入的 predicate。过滤条件变了可以自动滚回顶部(默认不开)。", u = "2.0.0", f = [
29
+ const l = "FilterPlugin", c = "用谓词函数过滤数据,优先读 `props.filterFn`,没有就用工厂里传入的 predicate。过滤条件变了可以自动滚回顶部(默认不开)。", p = "2.0.0", d = [
30
30
  "data",
31
31
  "数据管线"
32
- ], d = [
32
+ ], m = [
33
+ {
34
+ name: "onPropsChange",
35
+ when: "props 变化后",
36
+ description: "数据或配置变化时请求重排"
37
+ },
38
+ {
39
+ name: "transformProps",
40
+ when: "渲染前链式改写瀑布流 props",
41
+ description: "补 gap / columns 默认值、按断点覆盖配置"
42
+ }
43
+ ], u = [], f = "只读取 context 字段(props / state / data),不调用上下文方法", h = [
33
44
  {
34
45
  name: "predicate",
35
46
  type: "(item, index) => boolean",
@@ -48,7 +59,7 @@ const s = "FilterPlugin", c = "用谓词函数过滤数据,优先读 `props.fi
48
59
  default: '"auto"',
49
60
  description: "回顶行为"
50
61
  }
51
- ], p = `// 按谓词过滤 items,参数变化可自动回顶。
62
+ ], F = `// 按谓词过滤 items,参数变化可自动回顶。
52
63
  const Waterfall = withPlugins(WaterfallCore, [
53
64
  createFilterPlugin({
54
65
  scrollToTop: false,
@@ -56,29 +67,32 @@ const Waterfall = withPlugins(WaterfallCore, [
56
67
  }),
57
68
  ]);
58
69
 
59
- <Waterfall items={items} renderItem={(item) => <Card data={item} />} />;`, m = [
70
+ <Waterfall items={items} renderItem={(item) => <Card data={item} />} />;`, T = [
60
71
  "谓词抛错时按「保留」处理,不会整表消失",
61
72
  "props.filterFn 优先,便于页面动态换过滤条件",
62
73
  "可与 Sort / Search / Pagination 串联"
63
- ], F = [
74
+ ], g = [
64
75
  "分类 Tab 切换",
65
76
  "只看有货 / 只看促销",
66
77
  "价格区间筛选"
67
- ], h = [
78
+ ], y = [
68
79
  "数据管线的执行顺序由 priority 决定:Filter(40) → Sort(30) → Search(20) → Pagination(10)。",
69
80
  "先过滤再分页,页码总数才是过滤后的总数——顺序反了会出现「第 2 页空」。"
70
- ], y = {
71
- name: s,
81
+ ], b = {
82
+ name: l,
72
83
  description: c,
73
- since: u,
74
- tags: f,
75
- config: d,
76
- example: p,
77
- features: m,
78
- useCases: F,
79
- notes: h
84
+ since: p,
85
+ tags: d,
86
+ events: m,
87
+ methods: u,
88
+ methodsNote: f,
89
+ config: h,
90
+ example: F,
91
+ features: T,
92
+ useCases: g,
93
+ notes: y
80
94
  };
81
95
  export {
82
- g as c,
83
- y as d
96
+ v as c,
97
+ b as d
84
98
  };