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.
- package/README.md +174 -365
- package/dist/chunks/WaterfallCore-BSXw7bl_.js +581 -0
- package/dist/chunks/doc-3Fpag2G8.js +84 -0
- package/dist/chunks/doc-78xF08vt.js +82 -0
- package/dist/chunks/doc-B-7dugGv.js +79 -0
- package/dist/chunks/doc-B6kLfMPv.js +121 -0
- package/dist/chunks/doc-BCGQ8Cp5.js +114 -0
- package/dist/chunks/doc-BIzjYAZW.js +50 -0
- package/dist/chunks/doc-BP0DmB7-.js +91 -0
- package/dist/chunks/doc-BXElhF2h.js +138 -0
- package/dist/chunks/doc-BXSy2aPP.js +59 -0
- package/dist/chunks/doc-BfWnfTst.js +83 -0
- package/dist/chunks/doc-BtzhgTYj.js +85 -0
- package/dist/chunks/doc-C5xrHNoC.js +70 -0
- package/dist/chunks/doc-CBHjiDG7.js +88 -0
- package/dist/chunks/doc-CTUoMe7o.js +79 -0
- package/dist/chunks/doc-CcPFavOs.js +56 -0
- package/dist/chunks/doc-CraXjOaA.js +68 -0
- package/dist/chunks/doc-DElLNjIc.js +61 -0
- package/dist/chunks/doc-DJjxOYzW.js +111 -0
- package/dist/chunks/doc-DukOmDCo.js +95 -0
- package/dist/chunks/doc-DzvTrZ13.js +60 -0
- package/dist/chunks/doc-NhL4Ux8q.js +125 -0
- package/dist/chunks/doc-bTHwfIVb.js +78 -0
- package/dist/chunks/doc-f4Uijujv.js +102 -0
- package/dist/chunks/doc-gTAsLjVx.js +55 -0
- package/dist/chunks/doc-j4W9SUrY.js +76 -0
- package/dist/chunks/doc-kTbJE7rY.js +92 -0
- package/dist/chunks/index-BAWlVYr3.js +5 -0
- package/dist/chunks/index-COaun3nf.js +15 -0
- package/dist/chunks/index-DXAtA2f6.js +11 -0
- package/dist/chunks/index-DsRLmBW-.js +13 -0
- package/dist/chunks/index-gjoCq0yC.js +21 -0
- package/dist/chunks/index-wLI6UXkY.js +5 -0
- package/dist/chunks/withPlugins-DLoKg4AP.js +559 -0
- package/dist/components/WaterfallPlugin/WaterfallCore.d.ts +124 -0
- package/dist/components/WaterfallPlugin/WaterfallCore.d.ts.map +1 -0
- package/dist/components/WaterfallPlugin/index.d.ts +9 -10
- package/dist/components/WaterfallPlugin/index.d.ts.map +1 -0
- package/dist/components/WaterfallPlugin/layout.d.ts +41 -0
- package/dist/components/WaterfallPlugin/layout.d.ts.map +1 -0
- package/dist/components/WaterfallPlugin/plugins/types.d.ts +76 -380
- package/dist/components/WaterfallPlugin/plugins/types.d.ts.map +1 -0
- package/dist/components/WaterfallPlugin/virtualize.d.ts +62 -0
- package/dist/components/WaterfallPlugin/virtualize.d.ts.map +1 -0
- package/dist/components/WaterfallPlugin/{plugins/withPlugins.d.ts → withPlugins.d.ts} +4 -2
- package/dist/components/WaterfallPlugin/withPlugins.d.ts.map +1 -0
- package/dist/custom-plugins/A11yPlugin/create.d.ts +23 -0
- package/dist/custom-plugins/A11yPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/A11yPlugin/doc.json.d.ts +52 -0
- package/dist/custom-plugins/A11yPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/A11yPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/A11yPlugin/index.js +5 -0
- package/dist/{components/WaterfallPlugin/custom-plugins/Alignment/index.d.ts → custom-plugins/AlignmentPlugin/create.d.ts} +3 -3
- package/dist/custom-plugins/AlignmentPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/AlignmentPlugin/doc.json.d.ts +34 -0
- package/dist/custom-plugins/AlignmentPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/AlignmentPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/AlignmentPlugin/index.js +5 -0
- package/dist/custom-plugins/AutoColumnPlugin/create.d.ts +18 -0
- package/dist/custom-plugins/AutoColumnPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/AutoColumnPlugin/doc.json.d.ts +50 -0
- package/dist/custom-plugins/AutoColumnPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/AutoColumnPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/AutoColumnPlugin/index.js +5 -0
- package/dist/{components/WaterfallPlugin/custom-plugins/Bookmark/index.d.ts → custom-plugins/BookmarkPlugin/create.d.ts} +3 -3
- package/dist/custom-plugins/BookmarkPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/BookmarkPlugin/doc.json.d.ts +41 -0
- package/dist/custom-plugins/BookmarkPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/BookmarkPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/BookmarkPlugin/index.js +5 -0
- package/dist/custom-plugins/ClickAnalyticsPlugin/create.d.ts +25 -0
- package/dist/custom-plugins/ClickAnalyticsPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/ClickAnalyticsPlugin/doc.json.d.ts +41 -0
- package/dist/custom-plugins/ClickAnalyticsPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/ClickAnalyticsPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/ClickAnalyticsPlugin/index.js +5 -0
- package/dist/{components/WaterfallPlugin/custom-plugins/DebounceLayout/index.d.ts → custom-plugins/DebounceLayoutPlugin/create.d.ts} +3 -3
- package/dist/custom-plugins/DebounceLayoutPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/DebounceLayoutPlugin/doc.json.d.ts +34 -0
- package/dist/custom-plugins/DebounceLayoutPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/DebounceLayoutPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/DebounceLayoutPlugin/index.js +5 -0
- package/dist/custom-plugins/DragReorderPlugin/create.d.ts +33 -0
- package/dist/custom-plugins/DragReorderPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/DragReorderPlugin/doc.json.d.ts +53 -0
- package/dist/custom-plugins/DragReorderPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/DragReorderPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/DragReorderPlugin/index.js +5 -0
- package/dist/{components/WaterfallPlugin/custom-plugins/Filter/index.d.ts → custom-plugins/FilterPlugin/create.d.ts} +3 -3
- package/dist/custom-plugins/FilterPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/FilterPlugin/doc.json.d.ts +47 -0
- package/dist/custom-plugins/FilterPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/FilterPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/FilterPlugin/index.js +5 -0
- package/dist/{components/WaterfallPlugin/custom-plugins/FixedHeight/index.d.ts → custom-plugins/FixedHeightPlugin/create.d.ts} +3 -3
- package/dist/custom-plugins/FixedHeightPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/FixedHeightPlugin/doc.json.d.ts +34 -0
- package/dist/custom-plugins/FixedHeightPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/FixedHeightPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/FixedHeightPlugin/index.js +5 -0
- package/dist/{components/WaterfallPlugin/custom-plugins/Gap/index.d.ts → custom-plugins/GapPlugin/create.d.ts} +3 -3
- package/dist/custom-plugins/GapPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/GapPlugin/doc.json.d.ts +47 -0
- package/dist/custom-plugins/GapPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/GapPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/GapPlugin/index.js +5 -0
- package/dist/custom-plugins/GroupingPlugin/create.d.ts +16 -0
- package/dist/custom-plugins/GroupingPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/GroupingPlugin/doc.json.d.ts +40 -0
- package/dist/custom-plugins/GroupingPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/GroupingPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/GroupingPlugin/index.js +5 -0
- package/dist/custom-plugins/HeatmapAnalyticsPlugin/create.d.ts +31 -0
- package/dist/custom-plugins/HeatmapAnalyticsPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/HeatmapAnalyticsPlugin/doc.json.d.ts +43 -0
- package/dist/custom-plugins/HeatmapAnalyticsPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/HeatmapAnalyticsPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/HeatmapAnalyticsPlugin/index.js +5 -0
- package/dist/custom-plugins/InfiniteScrollPlugin/create.d.ts +17 -0
- package/dist/custom-plugins/InfiniteScrollPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/InfiniteScrollPlugin/doc.json.d.ts +44 -0
- package/dist/custom-plugins/InfiniteScrollPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/InfiniteScrollPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/InfiniteScrollPlugin/index.js +5 -0
- package/dist/{components/WaterfallPlugin/custom-plugins/Pagination/index.d.ts → custom-plugins/PaginationPlugin/create.d.ts} +3 -3
- package/dist/custom-plugins/PaginationPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/PaginationPlugin/doc.json.d.ts +50 -0
- package/dist/custom-plugins/PaginationPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/PaginationPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/PaginationPlugin/index.js +5 -0
- package/dist/custom-plugins/PinItemPlugin/create.d.ts +23 -0
- package/dist/custom-plugins/PinItemPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/PinItemPlugin/doc.json.d.ts +43 -0
- package/dist/custom-plugins/PinItemPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/PinItemPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/PinItemPlugin/index.js +5 -0
- package/dist/{components/WaterfallPlugin/custom-plugins/Recycle/index.d.ts → custom-plugins/RecyclePlugin/create.d.ts} +3 -3
- package/dist/custom-plugins/RecyclePlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/RecyclePlugin/doc.json.d.ts +35 -0
- package/dist/custom-plugins/RecyclePlugin/index.d.ts +11 -0
- package/dist/custom-plugins/RecyclePlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/RecyclePlugin/index.js +5 -0
- package/dist/custom-plugins/ReducedMotionPlugin/create.d.ts +25 -0
- package/dist/custom-plugins/ReducedMotionPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/ReducedMotionPlugin/doc.json.d.ts +42 -0
- package/dist/custom-plugins/ReducedMotionPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/ReducedMotionPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/ReducedMotionPlugin/index.js +5 -0
- package/dist/custom-plugins/ResponsiveColumnsPlugin/create.d.ts +22 -0
- package/dist/custom-plugins/ResponsiveColumnsPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/ResponsiveColumnsPlugin/doc.json.d.ts +37 -0
- package/dist/custom-plugins/ResponsiveColumnsPlugin/index.d.ts +10 -0
- package/dist/custom-plugins/ResponsiveColumnsPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/ResponsiveColumnsPlugin/index.js +5 -0
- package/dist/{components/WaterfallPlugin/custom-plugins/ScrollAnchor/index.d.ts → custom-plugins/ScrollAnchorPlugin/create.d.ts} +3 -3
- package/dist/custom-plugins/ScrollAnchorPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/ScrollAnchorPlugin/doc.json.d.ts +34 -0
- package/dist/custom-plugins/ScrollAnchorPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/ScrollAnchorPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/ScrollAnchorPlugin/index.js +5 -0
- package/dist/{components/WaterfallPlugin/custom-plugins/Search/index.d.ts → custom-plugins/SearchPlugin/create.d.ts} +3 -3
- package/dist/custom-plugins/SearchPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/SearchPlugin/doc.json.d.ts +47 -0
- package/dist/custom-plugins/SearchPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/SearchPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/SearchPlugin/index.js +5 -0
- package/dist/{components/WaterfallPlugin/custom-plugins/Sort/index.d.ts → custom-plugins/SortPlugin/create.d.ts} +3 -3
- package/dist/custom-plugins/SortPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/SortPlugin/doc.json.d.ts +46 -0
- package/dist/custom-plugins/SortPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/SortPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/SortPlugin/index.js +5 -0
- package/dist/{components/WaterfallPlugin/custom-plugins/StatePersistence/index.d.ts → custom-plugins/StatePersistencePlugin/create.d.ts} +3 -3
- package/dist/custom-plugins/StatePersistencePlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/StatePersistencePlugin/doc.json.d.ts +47 -0
- package/dist/custom-plugins/StatePersistencePlugin/index.d.ts +11 -0
- package/dist/custom-plugins/StatePersistencePlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/StatePersistencePlugin/index.js +5 -0
- package/dist/custom-plugins/StickyHeaderPlugin/create.d.ts +13 -0
- package/dist/custom-plugins/StickyHeaderPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/StickyHeaderPlugin/doc.json.d.ts +40 -0
- package/dist/custom-plugins/StickyHeaderPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/StickyHeaderPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/StickyHeaderPlugin/index.js +5 -0
- package/dist/{components/WaterfallPlugin/custom-plugins/Throttle/index.d.ts → custom-plugins/ThrottlePlugin/create.d.ts} +3 -3
- package/dist/custom-plugins/ThrottlePlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/ThrottlePlugin/doc.json.d.ts +40 -0
- package/dist/custom-plugins/ThrottlePlugin/index.d.ts +11 -0
- package/dist/custom-plugins/ThrottlePlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/ThrottlePlugin/index.js +5 -0
- package/dist/{components/WaterfallPlugin/custom-plugins/Transition/index.d.ts → custom-plugins/TransitionPlugin/create.d.ts} +3 -3
- package/dist/custom-plugins/TransitionPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/TransitionPlugin/doc.json.d.ts +43 -0
- package/dist/custom-plugins/TransitionPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/TransitionPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/TransitionPlugin/index.js +5 -0
- package/dist/{components/WaterfallPlugin/custom-plugins/URLSync/index.d.ts → custom-plugins/URLSyncPlugin/create.d.ts} +3 -3
- package/dist/custom-plugins/URLSyncPlugin/create.d.ts.map +1 -0
- package/dist/custom-plugins/URLSyncPlugin/doc.json.d.ts +41 -0
- package/dist/custom-plugins/URLSyncPlugin/index.d.ts +11 -0
- package/dist/custom-plugins/URLSyncPlugin/index.d.ts.map +1 -0
- package/dist/custom-plugins/URLSyncPlugin/index.js +5 -0
- package/dist/custom-plugins/index.d.ts +61 -0
- package/dist/custom-plugins/index.d.ts.map +1 -0
- package/dist/custom-plugins/index.js +34 -0
- package/dist/entries/core.d.ts +8 -0
- package/dist/entries/core.d.ts.map +1 -0
- package/dist/entries/core.js +7 -0
- package/dist/entries/plugins.d.ts +7 -0
- package/dist/entries/plugins.d.ts.map +1 -0
- package/dist/entries/plugins.js +36 -0
- package/dist/index.d.ts +14 -9
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/presets/dashboard/index.d.ts +13 -0
- package/dist/presets/dashboard/index.d.ts.map +1 -0
- package/dist/presets/dashboard/index.js +21 -0
- package/dist/presets/photo-feed/index.d.ts +13 -0
- package/dist/presets/photo-feed/index.d.ts.map +1 -0
- package/dist/presets/photo-feed/index.js +17 -0
- package/dist/presets/product-feed/index.d.ts +9 -0
- package/dist/presets/product-feed/index.d.ts.map +1 -0
- package/dist/presets/product-feed/index.js +23 -0
- package/package.json +222 -82
- package/dist/404.jpg +0 -0
- package/dist/components/WaterfallPlugin/core/WaterfallCore.d.ts +0 -174
- package/dist/components/WaterfallPlugin/custom-plugins/A11y/index.d.ts +0 -16
- package/dist/components/WaterfallPlugin/custom-plugins/AutoColumn/index.d.ts +0 -17
- package/dist/components/WaterfallPlugin/custom-plugins/ClickAnalytics/index.d.ts +0 -12
- package/dist/components/WaterfallPlugin/custom-plugins/DragReorder/index.d.ts +0 -13
- package/dist/components/WaterfallPlugin/custom-plugins/Grouping/index.d.ts +0 -12
- package/dist/components/WaterfallPlugin/custom-plugins/HeatmapAnalytics/index.d.ts +0 -14
- package/dist/components/WaterfallPlugin/custom-plugins/InfiniteScroll/index.d.ts +0 -13
- package/dist/components/WaterfallPlugin/custom-plugins/PinItem/index.d.ts +0 -13
- package/dist/components/WaterfallPlugin/custom-plugins/ReducedMotion/index.d.ts +0 -13
- package/dist/components/WaterfallPlugin/custom-plugins/ResponsiveColumns/index.d.ts +0 -10
- package/dist/components/WaterfallPlugin/custom-plugins/StickyHeader/index.d.ts +0 -11
- package/dist/components/WaterfallPlugin/custom-plugins/VirtualWaterfall/index.d.ts +0 -12
- package/dist/components/WaterfallPlugin/custom-plugins/index.d.ts +0 -30
- package/dist/components/WaterfallPlugin/plugins/PluginBus.d.ts +0 -2
- package/dist/components/WaterfallPlugin/plugins/PluginManager.d.ts +0 -2
- package/dist/components/WaterfallPlugin/plugins/index.d.ts +0 -8
- package/dist/index.es.js +0 -2382
- package/dist/index.umd.js +0 -30
- package/dist/vite.svg +0 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
function L(i = {}) {
|
|
2
|
+
const h = i.mode || "hash", r = i.keys || ["pageIndex", "pageSize", "searchQuery"];
|
|
3
|
+
function l() {
|
|
4
|
+
try {
|
|
5
|
+
if (h === "hash") {
|
|
6
|
+
const s = window.location.hash || "", t = s.indexOf("?"), a = t >= 0 ? s.slice(t + 1) : s.replace(/^#/, ""), e = new URLSearchParams(a), n = {};
|
|
7
|
+
return r.forEach((c) => {
|
|
8
|
+
const o = e.get(c);
|
|
9
|
+
o !== null && (n[c] = o);
|
|
10
|
+
}), n;
|
|
11
|
+
} else {
|
|
12
|
+
const s = new URLSearchParams(window.location.search), t = {};
|
|
13
|
+
return r.forEach((a) => {
|
|
14
|
+
const e = s.get(a);
|
|
15
|
+
e !== null && (t[a] = e);
|
|
16
|
+
}), t;
|
|
17
|
+
}
|
|
18
|
+
} catch {
|
|
19
|
+
return {};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function p(s) {
|
|
23
|
+
try {
|
|
24
|
+
const t = new URLSearchParams();
|
|
25
|
+
r.forEach((e) => {
|
|
26
|
+
const n = s[e];
|
|
27
|
+
n != null && String(n).length > 0 && t.set(e, String(n));
|
|
28
|
+
});
|
|
29
|
+
const a = t.toString();
|
|
30
|
+
if (h === "hash") {
|
|
31
|
+
const e = window.location.hash || "", o = `#${e.replace(/^#/, "").split("?")[0] || ""}${a ? `?${a}` : ""}`;
|
|
32
|
+
e !== o && history.replaceState(
|
|
33
|
+
null,
|
|
34
|
+
"",
|
|
35
|
+
`${window.location.pathname}${window.location.search}${o}`
|
|
36
|
+
);
|
|
37
|
+
} else {
|
|
38
|
+
const n = window.location.pathname + (a ? `?${a}` : "") + (window.location.hash || "");
|
|
39
|
+
history.replaceState(null, "", n);
|
|
40
|
+
}
|
|
41
|
+
} catch {
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
name: "URLSyncPlugin",
|
|
46
|
+
enabled: !0,
|
|
47
|
+
hooks: {
|
|
48
|
+
onMount: (s) => {
|
|
49
|
+
const t = l();
|
|
50
|
+
s.bus?.emit("urlsync:init", t);
|
|
51
|
+
},
|
|
52
|
+
onPropsChange: (s, t, a) => {
|
|
53
|
+
const e = {}, n = a ?? {};
|
|
54
|
+
r.forEach((c) => {
|
|
55
|
+
const o = n[c];
|
|
56
|
+
o !== void 0 && (e[c] = o);
|
|
57
|
+
}), p(e);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const u = "URLSyncPlugin", d = "props 变化时把指定键写进 URL(hash 或 search),挂载时读出来广播 `urlsync:init`。刷新与分享都能还原筛选状态。", m = "2.0.0", w = [
|
|
63
|
+
"ui",
|
|
64
|
+
"URL",
|
|
65
|
+
"可分享"
|
|
66
|
+
], f = [
|
|
67
|
+
{
|
|
68
|
+
name: "mode",
|
|
69
|
+
type: '"hash" | "search"',
|
|
70
|
+
default: '"hash"',
|
|
71
|
+
description: "写 hash 还是 search"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "keys",
|
|
75
|
+
type: "string[]",
|
|
76
|
+
default: '["pageIndex","pageSize","searchQuery"]',
|
|
77
|
+
description: "要同步的 props 键"
|
|
78
|
+
}
|
|
79
|
+
], g = `// 把分页/搜索/排序同步进 URL(hash 或 search),链接可分享。
|
|
80
|
+
const Waterfall = withPlugins(WaterfallCore, [
|
|
81
|
+
createURLSyncPlugin({
|
|
82
|
+
mode: "hash",
|
|
83
|
+
keys: ["pageIndex","pageSize","searchQuery"],
|
|
84
|
+
}),
|
|
85
|
+
]);
|
|
86
|
+
|
|
87
|
+
<Waterfall items={items} renderItem={(item) => <Card data={item} />} />;`, S = [
|
|
88
|
+
"hash 模式会保留已有路由路径",
|
|
89
|
+
"用 replaceState,不污染后退栈",
|
|
90
|
+
"SSR 安全:无 window 时直接跳过"
|
|
91
|
+
], y = [
|
|
92
|
+
"搜索结果可分享",
|
|
93
|
+
"后台筛选状态可刷新",
|
|
94
|
+
"带参数的深链"
|
|
95
|
+
], R = [
|
|
96
|
+
"只做单向同步(props → URL)与初始读取;URL 前进后退的监听请页面自己做。"
|
|
97
|
+
], U = {
|
|
98
|
+
name: u,
|
|
99
|
+
description: d,
|
|
100
|
+
since: m,
|
|
101
|
+
tags: w,
|
|
102
|
+
config: f,
|
|
103
|
+
example: g,
|
|
104
|
+
features: S,
|
|
105
|
+
useCases: y,
|
|
106
|
+
notes: R
|
|
107
|
+
};
|
|
108
|
+
export {
|
|
109
|
+
L as c,
|
|
110
|
+
U as d
|
|
111
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
const l = "(prefers-reduced-motion: reduce)";
|
|
2
|
+
function R(c = {}) {
|
|
3
|
+
const i = typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia(l) : null;
|
|
4
|
+
let s = i?.matches ?? !1;
|
|
5
|
+
const m = c.disableTransform ?? !0, u = c.removeTransitions ?? !0, o = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), a = (e) => {
|
|
6
|
+
if (!(!e || !u))
|
|
7
|
+
if (s) {
|
|
8
|
+
const n = e.style.transitionDuration;
|
|
9
|
+
n && n !== "0s" ? t.set(e, n) : t.has(e) || t.set(e, n), e.style.setProperty("transition-duration", "0s");
|
|
10
|
+
} else {
|
|
11
|
+
const n = t.get(e);
|
|
12
|
+
if (n === void 0) return;
|
|
13
|
+
n ? e.style.setProperty("transition-duration", n) : e.style.removeProperty("transition-duration"), t.delete(e);
|
|
14
|
+
}
|
|
15
|
+
}, f = () => o.forEach((e) => a(e)), d = (e) => {
|
|
16
|
+
e.matches !== s && (s = e.matches, f());
|
|
17
|
+
};
|
|
18
|
+
return i?.addEventListener?.("change", d), {
|
|
19
|
+
name: "ReducedMotionPlugin",
|
|
20
|
+
priority: 70,
|
|
21
|
+
enabled: !0,
|
|
22
|
+
hooks: {
|
|
23
|
+
transformProps: (e) => {
|
|
24
|
+
if (!s) return e;
|
|
25
|
+
const n = { ...e };
|
|
26
|
+
return m && (n.useTransform = !1), u && (n.itemStyle = { ...e.itemStyle ?? {}, transitionDuration: "0s" }), n;
|
|
27
|
+
},
|
|
28
|
+
onItemMount: (e, n, r) => {
|
|
29
|
+
o.set(n, r), a(r);
|
|
30
|
+
},
|
|
31
|
+
onItemUnmount: (e, n) => {
|
|
32
|
+
o.delete(n);
|
|
33
|
+
},
|
|
34
|
+
onLayoutComplete: (e) => {
|
|
35
|
+
e.itemRefs.forEach((n, r) => {
|
|
36
|
+
n && o.set(r, n), a(n);
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
onUnmount: () => {
|
|
40
|
+
i?.removeEventListener?.("change", d), o.clear(), t.clear();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const p = "ReducedMotionPlugin", y = "检测 `prefers-reduced-motion: reduce`,命中后把 useTransform 关掉并清掉项上的 transition。前庭功能敏感用户不会因为滚动时的位置微动而不适。", g = "2.0.0", h = [
|
|
46
|
+
"perf",
|
|
47
|
+
"a11y"
|
|
48
|
+
], T = [
|
|
49
|
+
{
|
|
50
|
+
name: "disableTransform",
|
|
51
|
+
type: "boolean",
|
|
52
|
+
default: "true",
|
|
53
|
+
description: "命中偏好时改用 left/top 定位"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "removeTransitions",
|
|
57
|
+
type: "boolean",
|
|
58
|
+
default: "true",
|
|
59
|
+
description: "命中偏好时清掉项过渡"
|
|
60
|
+
}
|
|
61
|
+
], P = `// 尊重系统「减少动画」偏好:关掉 transform 定位与项过渡。
|
|
62
|
+
const Waterfall = withPlugins(WaterfallCore, [
|
|
63
|
+
createReducedMotionPlugin({
|
|
64
|
+
disableTransform: true,
|
|
65
|
+
removeTransitions: true,
|
|
66
|
+
}),
|
|
67
|
+
]);
|
|
68
|
+
|
|
69
|
+
<Waterfall items={items} renderItem={(item) => <Card data={item} />} />;`, M = [
|
|
70
|
+
"系统偏好驱动,零配置生效",
|
|
71
|
+
"两项能力可分别关闭",
|
|
72
|
+
"与 TransitionPlugin 同装时优先生效"
|
|
73
|
+
], v = [
|
|
74
|
+
"政务 / 医疗类站点",
|
|
75
|
+
"无障碍合规要求",
|
|
76
|
+
"低性能设备"
|
|
77
|
+
], w = [
|
|
78
|
+
"偏好由 matchMedia 驱动,并监听 change:运行中改系统设置即时生效(定位方式要等下一次重渲染才切过来)。",
|
|
79
|
+
"只压 `transition-duration`,不写 `transition: none` —— 写简写会把 TransitionPlugin 的过渡整条覆盖,撤销偏好后无从还原。",
|
|
80
|
+
"与 TransitionPlugin 同装不是冲突:ReducedMotion 优先级更高,会先执行并压住过渡。"
|
|
81
|
+
], b = {
|
|
82
|
+
name: p,
|
|
83
|
+
description: y,
|
|
84
|
+
since: g,
|
|
85
|
+
tags: h,
|
|
86
|
+
config: T,
|
|
87
|
+
example: P,
|
|
88
|
+
features: M,
|
|
89
|
+
useCases: v,
|
|
90
|
+
notes: w
|
|
91
|
+
};
|
|
92
|
+
export {
|
|
93
|
+
R as c,
|
|
94
|
+
b as d
|
|
95
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
function m(e) {
|
|
2
|
+
return {
|
|
3
|
+
name: "ThrottlePlugin",
|
|
4
|
+
priority: 80,
|
|
5
|
+
enabled: !0,
|
|
6
|
+
hooks: {
|
|
7
|
+
transformProps: (t) => ({
|
|
8
|
+
...t,
|
|
9
|
+
throttleDelay: e.scroll,
|
|
10
|
+
debounceDelay: e.resize ?? t.debounceDelay
|
|
11
|
+
})
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const n = "ThrottlePlugin", s = "接管 Core 的 throttleDelay(滚动回调节流)与 debounceDelay(尺寸变化后多久重排)。默认 16ms / 150ms,长列表滚动卡顿时可以放宽到 32 / 300。", o = "2.0.0", r = [
|
|
16
|
+
"perf",
|
|
17
|
+
"性能"
|
|
18
|
+
], a = [
|
|
19
|
+
{
|
|
20
|
+
name: "scroll",
|
|
21
|
+
type: "number",
|
|
22
|
+
default: "—",
|
|
23
|
+
description: "滚动节流 ms(必填)"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "resize",
|
|
27
|
+
type: "number",
|
|
28
|
+
default: "props.debounceDelay",
|
|
29
|
+
description: "布局防抖 ms"
|
|
30
|
+
}
|
|
31
|
+
], l = `// 调整滚动节流与尺寸防抖,弱网/低端机可放宽。
|
|
32
|
+
const Waterfall = withPlugins(WaterfallCore, [
|
|
33
|
+
createThrottlePlugin(),
|
|
34
|
+
]);
|
|
35
|
+
|
|
36
|
+
<Waterfall items={items} renderItem={(item) => <Card data={item} />} />;`, c = [
|
|
37
|
+
"滚动节流与布局防抖分开调",
|
|
38
|
+
"只改 props,不改算法",
|
|
39
|
+
"与 DebounceLayoutPlugin 叠加时后者优先"
|
|
40
|
+
], i = [
|
|
41
|
+
"低端安卓机长列表",
|
|
42
|
+
"滚动时 CPU 占用过高",
|
|
43
|
+
"拖拽侧栏时减少重排"
|
|
44
|
+
], u = [
|
|
45
|
+
"scroll 低于 16ms 没有意义(浏览器帧率上限)。"
|
|
46
|
+
], d = {
|
|
47
|
+
name: n,
|
|
48
|
+
description: s,
|
|
49
|
+
since: o,
|
|
50
|
+
tags: r,
|
|
51
|
+
config: a,
|
|
52
|
+
example: l,
|
|
53
|
+
features: c,
|
|
54
|
+
useCases: i,
|
|
55
|
+
notes: u
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
m as c,
|
|
59
|
+
d
|
|
60
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
function K(o = {}) {
|
|
2
|
+
const i = o.storageKey || "waterfall-state", l = o.persistScroll ?? !0, a = o.persistKeys || ["pageIndex", "pageSize", "searchQuery"];
|
|
3
|
+
let u = !1;
|
|
4
|
+
function c() {
|
|
5
|
+
try {
|
|
6
|
+
const e = localStorage.getItem(i);
|
|
7
|
+
return e ? JSON.parse(e) : null;
|
|
8
|
+
} catch {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function p(e) {
|
|
13
|
+
try {
|
|
14
|
+
localStorage.setItem(i, JSON.stringify(e));
|
|
15
|
+
} catch {
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
name: "StatePersistencePlugin",
|
|
20
|
+
enabled: !0,
|
|
21
|
+
hooks: {
|
|
22
|
+
// 首次渲染时,尽量将本地快照中的分页/查询键注入到 props,便于核心按恢复后的状态渲染
|
|
23
|
+
transformProps: (e) => {
|
|
24
|
+
if (u) return e;
|
|
25
|
+
const t = c();
|
|
26
|
+
if (!t) return e;
|
|
27
|
+
const n = { ...e };
|
|
28
|
+
let s = !1;
|
|
29
|
+
return a.forEach((r) => {
|
|
30
|
+
t[r] !== void 0 && (n[r] = t[r], s = !0);
|
|
31
|
+
}), s && (u = !0), n;
|
|
32
|
+
},
|
|
33
|
+
onMount: (e) => {
|
|
34
|
+
const t = c();
|
|
35
|
+
if (!t) return;
|
|
36
|
+
if (l) {
|
|
37
|
+
const s = Number(t.scrollTop ?? 0), r = e.containerRef.current;
|
|
38
|
+
r ? r.scrollTo({ top: s, behavior: "auto" }) : e.scrollToTop?.({ behavior: "auto" });
|
|
39
|
+
}
|
|
40
|
+
const n = {};
|
|
41
|
+
if (a.forEach((s) => {
|
|
42
|
+
t[s] !== void 0 && (n[s] = t[s]);
|
|
43
|
+
}), Object.keys(n).length > 0 && (e.bus?.emit("state:restored", n), typeof window < "u"))
|
|
44
|
+
try {
|
|
45
|
+
window.dispatchEvent(new CustomEvent("waterfall:state-restored", { detail: n }));
|
|
46
|
+
} catch {
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
// props 变化时,增量更新快照(立即持久化分页/查询键)
|
|
50
|
+
onPropsChange: (e, t, n) => {
|
|
51
|
+
const r = { ...c() || {} }, g = n ?? {};
|
|
52
|
+
a.forEach((f) => {
|
|
53
|
+
const d = g[f];
|
|
54
|
+
d !== void 0 && (r[f] = d);
|
|
55
|
+
}), p(r);
|
|
56
|
+
},
|
|
57
|
+
onUnmount: (e) => {
|
|
58
|
+
const t = {};
|
|
59
|
+
l && (t.scrollTop = e.containerRef.current?.scrollTop || 0);
|
|
60
|
+
const n = e.props ?? {};
|
|
61
|
+
a.forEach((s) => {
|
|
62
|
+
const r = n[s];
|
|
63
|
+
r !== void 0 && (t[s] = r);
|
|
64
|
+
}), p(t);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const y = "StatePersistencePlugin", m = "三个时机各做一件事:首次渲染把快照里的 pageIndex / searchQuery 注入 props;挂载后恢复 scrollTop;props 变化与卸载时写回快照。刷新页面不丢进度。", S = "2.0.0", h = [
|
|
70
|
+
"ui",
|
|
71
|
+
"持久化"
|
|
72
|
+
], w = [
|
|
73
|
+
{
|
|
74
|
+
name: "storageKey",
|
|
75
|
+
type: "string",
|
|
76
|
+
default: '"waterfall-state"',
|
|
77
|
+
description: "localStorage 键名"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "persistScroll",
|
|
81
|
+
type: "boolean",
|
|
82
|
+
default: "true",
|
|
83
|
+
description: "是否持久化滚动位置"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "persistKeys",
|
|
87
|
+
type: "string[]",
|
|
88
|
+
default: '["pageIndex","pageSize","searchQuery"]',
|
|
89
|
+
description: "要持久化的 props 键"
|
|
90
|
+
}
|
|
91
|
+
], v = `// 把滚动位置与分页/查询状态存 localStorage,回来时恢复。
|
|
92
|
+
const Waterfall = withPlugins(WaterfallCore, [
|
|
93
|
+
createStatePersistencePlugin({
|
|
94
|
+
storageKey: "waterfall-state",
|
|
95
|
+
persistScroll: true,
|
|
96
|
+
persistKeys: ["pageIndex","pageSize","searchQuery"],
|
|
97
|
+
}),
|
|
98
|
+
]);
|
|
99
|
+
|
|
100
|
+
<Waterfall items={items} renderItem={(item) => <Card data={item} />} />;`, P = [
|
|
101
|
+
"滚动位置 + 分页/查询一起存",
|
|
102
|
+
"首帧注入只做一次,不会覆盖用户操作",
|
|
103
|
+
"SSR / 隐私模式下降级为不持久化"
|
|
104
|
+
], b = [
|
|
105
|
+
"后台列表刷新不丢页",
|
|
106
|
+
"搜索结果返回定位",
|
|
107
|
+
"移动端来回切换页面"
|
|
108
|
+
], I = [
|
|
109
|
+
"只能恢复「值」,不能替你把它写回 React state——页面应订阅 `state:restored` 事件或读 bus。",
|
|
110
|
+
"localStorage 不可用(隐私模式/配额满)时静默跳过,不会抛错。"
|
|
111
|
+
], T = {
|
|
112
|
+
name: y,
|
|
113
|
+
description: m,
|
|
114
|
+
since: S,
|
|
115
|
+
tags: h,
|
|
116
|
+
config: w,
|
|
117
|
+
example: v,
|
|
118
|
+
features: P,
|
|
119
|
+
useCases: b,
|
|
120
|
+
notes: I
|
|
121
|
+
};
|
|
122
|
+
export {
|
|
123
|
+
K as c,
|
|
124
|
+
T as d
|
|
125
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
function w(s) {
|
|
2
|
+
const r = new Set(s.pinnedIndices), e = Math.max(0, s.column ?? 0), n = /* @__PURE__ */ new Map();
|
|
3
|
+
return {
|
|
4
|
+
name: "PinItemPlugin",
|
|
5
|
+
priority: 100,
|
|
6
|
+
enabled: !0,
|
|
7
|
+
hooks: {
|
|
8
|
+
onBeforeLayout: () => (n.clear(), !0),
|
|
9
|
+
calculateItemPosition: (i, u, c, t) => {
|
|
10
|
+
const l = i.props.rowGap ?? i.props.gap ?? 0;
|
|
11
|
+
if (!r.has(u)) {
|
|
12
|
+
const o = n.get(t.column);
|
|
13
|
+
return o !== void 0 && t.y < o ? { y: o } : void 0;
|
|
14
|
+
}
|
|
15
|
+
const a = n.get(e) ?? 0;
|
|
16
|
+
return n.set(e, a + c + l), {
|
|
17
|
+
column: e,
|
|
18
|
+
y: a,
|
|
19
|
+
width: t.width,
|
|
20
|
+
height: c,
|
|
21
|
+
row: 0
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const m = "PinItemPlugin", d = "把若干索引的项钉在顶部指定列,其余项从它们下方继续排。走 D1-A 布局钩子(calculateItemPosition),是旧版宣称但从未生效的能力。", p = "2.0.0", f = [
|
|
28
|
+
"layout",
|
|
29
|
+
"layout-hook",
|
|
30
|
+
"置顶"
|
|
31
|
+
], g = [
|
|
32
|
+
{
|
|
33
|
+
name: "pinnedIndices",
|
|
34
|
+
type: "number[]",
|
|
35
|
+
default: "[]",
|
|
36
|
+
description: "要钉住的项索引"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "column",
|
|
40
|
+
type: "number",
|
|
41
|
+
default: "0",
|
|
42
|
+
description: "钉到第几列"
|
|
43
|
+
}
|
|
44
|
+
], I = `// 把指定索引的项钉在顶部同一列,不参与常规列高推进(广告位 / 公告卡)。
|
|
45
|
+
const Waterfall = withPlugins(WaterfallCore, [
|
|
46
|
+
createPinItemPlugin({
|
|
47
|
+
pinnedIndices: [],
|
|
48
|
+
column: 0,
|
|
49
|
+
}),
|
|
50
|
+
]);
|
|
51
|
+
|
|
52
|
+
<Waterfall items={items} renderItem={(item) => <Card data={item} />} />;`, P = [
|
|
53
|
+
"置顶项不占常规列高:后续项从置顶块下方开始",
|
|
54
|
+
"支持多列分别置顶(column 可不同)",
|
|
55
|
+
"每次布局前重置偏移,items 变化后不会累加错位"
|
|
56
|
+
], y = [
|
|
57
|
+
"信息流首位的推广卡",
|
|
58
|
+
"公告 / 置顶帖",
|
|
59
|
+
"需要固定在左上角的活动位"
|
|
60
|
+
], h = [
|
|
61
|
+
"置顶项之间按 pinnedIndices 顺序纵向堆叠,同一列多条会依次往下排。",
|
|
62
|
+
"置顶会挤掉该列的正常网格位置,pinnedIndices 建议控制在 1~2 条。",
|
|
63
|
+
"换列后的 x 由布局引擎按本轮列宽补齐,插件只返回 column 即可 —— 自己用「列宽 + 间距」反推 x 会在间距由其它插件(GapPlugin)注入时算错。"
|
|
64
|
+
], C = {
|
|
65
|
+
name: m,
|
|
66
|
+
description: d,
|
|
67
|
+
since: p,
|
|
68
|
+
tags: f,
|
|
69
|
+
config: g,
|
|
70
|
+
example: I,
|
|
71
|
+
features: P,
|
|
72
|
+
useCases: y,
|
|
73
|
+
notes: h
|
|
74
|
+
};
|
|
75
|
+
export {
|
|
76
|
+
w as c,
|
|
77
|
+
C as d
|
|
78
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsxs as u, jsx as f } from "react/jsx-runtime";
|
|
2
|
+
function v(o = {}) {
|
|
3
|
+
const { log: i = !1, showOverlay: l = !1 } = o, n = /* @__PURE__ */ new Map(), s = () => Array.from(n.values()).reduce((t, e) => t + e, 0);
|
|
4
|
+
return {
|
|
5
|
+
name: "ClickAnalyticsPlugin",
|
|
6
|
+
enabled: !0,
|
|
7
|
+
getStats: () => ({
|
|
8
|
+
total: s(),
|
|
9
|
+
byIndex: Array.from(n.entries()).map(([t, e]) => ({ index: t, clicks: e })).sort((t, e) => t.index - e.index)
|
|
10
|
+
}),
|
|
11
|
+
hooks: {
|
|
12
|
+
onMount: (t) => {
|
|
13
|
+
t.sharedData?.set("click-count", s());
|
|
14
|
+
},
|
|
15
|
+
onItemClick: (t, e, c, r) => {
|
|
16
|
+
const d = (n.get(e) ?? 0) + 1;
|
|
17
|
+
n.set(e, d);
|
|
18
|
+
const a = s();
|
|
19
|
+
t.sharedData?.set("click-count", a), t.bus?.emit("analytics:click", { index: e, item: c, event: r, total: a }), t.forceUpdate?.(), i && console.log(`[ClickAnalytics] item=${e} total=${a}`);
|
|
20
|
+
},
|
|
21
|
+
renderOverlay: (t) => {
|
|
22
|
+
if (!l) return null;
|
|
23
|
+
const e = t.sharedData?.get("click-count") || 0;
|
|
24
|
+
return /* @__PURE__ */ u(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
style: {
|
|
28
|
+
position: "absolute",
|
|
29
|
+
top: 12,
|
|
30
|
+
right: 12,
|
|
31
|
+
padding: "10px 12px",
|
|
32
|
+
background: "#222",
|
|
33
|
+
color: "#fff",
|
|
34
|
+
borderRadius: 8,
|
|
35
|
+
fontSize: 14,
|
|
36
|
+
fontWeight: 600,
|
|
37
|
+
boxShadow: "0 4px 12px rgba(0,0,0,0.25)",
|
|
38
|
+
border: "1px solid rgba(255,255,255,0.15)",
|
|
39
|
+
pointerEvents: "none",
|
|
40
|
+
zIndex: 99
|
|
41
|
+
},
|
|
42
|
+
children: [
|
|
43
|
+
"点击次数:",
|
|
44
|
+
e,
|
|
45
|
+
/* @__PURE__ */ f("div", { style: { fontSize: 12, fontWeight: 400, opacity: 0.85, marginTop: 4 }, children: "提示:点击任意卡片观察计数变化" })
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const g = "ClickAnalyticsPlugin", p = "统计每次项点击并累计总数,向 bus 发 `analytics:click`(带 index / item / total),`getStats()` 可随时取出按 index 的计数。默认只上报不显示角标,接入真实版式时不会被调试面板盖住内容。", m = "2.0.0", y = [
|
|
54
|
+
"interaction",
|
|
55
|
+
"埋点"
|
|
56
|
+
], k = [
|
|
57
|
+
{
|
|
58
|
+
name: "log",
|
|
59
|
+
type: "boolean",
|
|
60
|
+
default: "false",
|
|
61
|
+
description: "是否在控制台打印每次点击"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "showOverlay",
|
|
65
|
+
type: "boolean",
|
|
66
|
+
default: "false",
|
|
67
|
+
description: "是否显示右上角计数角标"
|
|
68
|
+
}
|
|
69
|
+
], b = `// 统计项点击次数,发 \`analytics:click\` 事件,可选角标与日志。
|
|
70
|
+
const Waterfall = withPlugins(WaterfallCore, [
|
|
71
|
+
createClickAnalyticsPlugin({
|
|
72
|
+
log: false,
|
|
73
|
+
showOverlay: false,
|
|
74
|
+
}),
|
|
75
|
+
]);
|
|
76
|
+
|
|
77
|
+
<Waterfall items={items} renderItem={(item) => <Card data={item} />} />;`, h = [
|
|
78
|
+
"点击总量 + 按 index 明细(getStats)",
|
|
79
|
+
"bus 事件可被外部订阅上报",
|
|
80
|
+
"角标默认关闭"
|
|
81
|
+
], x = [
|
|
82
|
+
"内容流点击率统计",
|
|
83
|
+
"AB 实验埋点",
|
|
84
|
+
"调试点击行为"
|
|
85
|
+
], C = [
|
|
86
|
+
"生产环境请把数据从 bus 事件或 getStats() 接到自己的埋点 SDK,不要让插件直接打日志。",
|
|
87
|
+
"计数只在内存里,刷新即清零 —— 想持久化要自己定时取 getStats() 上报。"
|
|
88
|
+
], A = {
|
|
89
|
+
name: g,
|
|
90
|
+
description: p,
|
|
91
|
+
since: m,
|
|
92
|
+
tags: y,
|
|
93
|
+
config: k,
|
|
94
|
+
example: b,
|
|
95
|
+
features: h,
|
|
96
|
+
useCases: x,
|
|
97
|
+
notes: C
|
|
98
|
+
};
|
|
99
|
+
export {
|
|
100
|
+
v as c,
|
|
101
|
+
A as d
|
|
102
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
function u(n) {
|
|
2
|
+
return {
|
|
3
|
+
name: "AlignmentPlugin",
|
|
4
|
+
priority: 60,
|
|
5
|
+
enabled: !0,
|
|
6
|
+
hooks: {
|
|
7
|
+
transformProps: (e) => ({ ...e, alignmentMode: n.mode }),
|
|
8
|
+
onResize: (e) => {
|
|
9
|
+
e.relayout?.();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
const t = "AlignmentPlugin", s = "设置瀑布流的列分配策略。shortest 让每列尽量等高(视觉最自然),balanced 让每列项数接近,sequential 按 index 轮转(可预测位置,适合需要与外部索引对齐的场景)。", o = "2.0.0", a = [
|
|
15
|
+
"layout",
|
|
16
|
+
"布局"
|
|
17
|
+
], i = [
|
|
18
|
+
{
|
|
19
|
+
name: "mode",
|
|
20
|
+
type: '"shortest" | "balanced" | "sequential"',
|
|
21
|
+
default: "shortest",
|
|
22
|
+
description: "列分配策略"
|
|
23
|
+
}
|
|
24
|
+
], l = `// 指定列分配策略:最矮列优先(shortest)/ 项数均衡(balanced)/ 顺序轮转(sequential)。
|
|
25
|
+
const Waterfall = withPlugins(WaterfallCore, [
|
|
26
|
+
createAlignmentPlugin({
|
|
27
|
+
mode: "shortest",
|
|
28
|
+
}),
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
<Waterfall items={items} renderItem={(item) => <Card data={item} />} />;`, r = [
|
|
32
|
+
"三种列分配策略",
|
|
33
|
+
"只改 props.alignmentMode,不影响其他配置",
|
|
34
|
+
"与 ResponsiveColumns / AutoColumn 正交"
|
|
35
|
+
], c = [
|
|
36
|
+
"内容流:默认 shortest",
|
|
37
|
+
"等长卡片:balanced 更整齐",
|
|
38
|
+
"需要与后端顺序对齐:sequential"
|
|
39
|
+
], m = [
|
|
40
|
+
"balanced 与 shortest 在列高相同时都取最左列,视觉上左偏是预期行为。"
|
|
41
|
+
], d = {
|
|
42
|
+
name: t,
|
|
43
|
+
description: s,
|
|
44
|
+
since: o,
|
|
45
|
+
tags: a,
|
|
46
|
+
config: i,
|
|
47
|
+
example: l,
|
|
48
|
+
features: r,
|
|
49
|
+
useCases: c,
|
|
50
|
+
notes: m
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
u as c,
|
|
54
|
+
d
|
|
55
|
+
};
|