@wyxos/vibe 1.6.25 → 1.6.27
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 +287 -254
- package/lib/index.js +1201 -1115
- package/lib/vibe.css +1 -1
- package/package.json +1 -1
- package/src/Masonry.vue +159 -188
- package/src/components/MasonryItem.vue +501 -434
- package/src/components/examples/BasicExample.vue +2 -1
- package/src/components/examples/CustomItemExample.vue +2 -1
- package/src/components/examples/HeaderFooterExample.vue +79 -78
- package/src/components/examples/ManualInitExample.vue +78 -0
- package/src/components/examples/SwipeModeExample.vue +2 -1
- package/src/{useMasonryTransitions.ts → createMasonryTransitions.ts} +6 -6
- package/src/useMasonryItems.ts +234 -218
- package/src/useMasonryLayout.ts +4 -0
- package/src/useMasonryPagination.ts +465 -342
- package/src/views/Examples.vue +80 -32
- package/src/views/Home.vue +321 -321
package/lib/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { nextTick as
|
|
2
|
-
let
|
|
3
|
-
function
|
|
4
|
-
if (
|
|
1
|
+
import { nextTick as X, ref as W, computed as K, defineComponent as _e, onMounted as Xe, onUnmounted as Ge, watch as ee, createElementBlock as q, openBlock as Y, createCommentVNode as te, createElementVNode as U, normalizeStyle as he, renderSlot as J, normalizeClass as re, withModifiers as Ae, toDisplayString as Pe, unref as G, Fragment as Re, renderList as Oe, createVNode as Se, withCtx as ve, mergeProps as fe, TransitionGroup as It } from "vue";
|
|
2
|
+
let ke = null;
|
|
3
|
+
function Lt() {
|
|
4
|
+
if (ke != null) return ke;
|
|
5
5
|
const e = document.createElement("div");
|
|
6
6
|
e.style.visibility = "hidden", e.style.overflow = "scroll", e.style.msOverflowStyle = "scrollbar", e.style.width = "100px", e.style.height = "100px", document.body.appendChild(e);
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
return document.body.removeChild(e),
|
|
7
|
+
const n = document.createElement("div");
|
|
8
|
+
n.style.width = "100%", e.appendChild(n);
|
|
9
|
+
const i = e.offsetWidth - n.offsetWidth;
|
|
10
|
+
return document.body.removeChild(e), ke = i, i;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function Ce(e, n, i, a = {}) {
|
|
13
13
|
const {
|
|
14
|
-
gutterX:
|
|
15
|
-
gutterY:
|
|
16
|
-
header:
|
|
17
|
-
footer:
|
|
18
|
-
paddingLeft:
|
|
19
|
-
paddingRight:
|
|
20
|
-
sizes:
|
|
14
|
+
gutterX: m = 0,
|
|
15
|
+
gutterY: d = 0,
|
|
16
|
+
header: f = 0,
|
|
17
|
+
footer: o = 0,
|
|
18
|
+
paddingLeft: c = 0,
|
|
19
|
+
paddingRight: y = 0,
|
|
20
|
+
sizes: t = {
|
|
21
21
|
base: 1,
|
|
22
22
|
sm: 2,
|
|
23
23
|
md: 3,
|
|
@@ -25,195 +25,195 @@ function Xe(e, l, r, t = {}) {
|
|
|
25
25
|
xl: 5,
|
|
26
26
|
"2xl": 6
|
|
27
27
|
},
|
|
28
|
-
placement:
|
|
29
|
-
} =
|
|
30
|
-
let
|
|
28
|
+
placement: w = "masonry"
|
|
29
|
+
} = a;
|
|
30
|
+
let T = 0, p = 0;
|
|
31
31
|
try {
|
|
32
|
-
if (
|
|
33
|
-
const
|
|
34
|
-
|
|
32
|
+
if (n && n.nodeType === 1 && typeof window < "u" && window.getComputedStyle) {
|
|
33
|
+
const k = window.getComputedStyle(n);
|
|
34
|
+
T = parseFloat(k.paddingLeft) || 0, p = parseFloat(k.paddingRight) || 0;
|
|
35
35
|
}
|
|
36
36
|
} catch {
|
|
37
37
|
}
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
return Math.round(
|
|
38
|
+
const h = (c || 0) + T, I = (y || 0) + p, S = n.offsetWidth - n.clientWidth, v = S > 0 ? S + 2 : Lt() + 2, r = n.offsetWidth - v - h - I, s = m * (i - 1), L = Math.floor((r - s) / i), M = e.map((k) => {
|
|
39
|
+
const N = k.width, A = k.height;
|
|
40
|
+
return Math.round(L * A / N) + o + f;
|
|
41
41
|
});
|
|
42
|
-
if (
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
let
|
|
47
|
-
const
|
|
48
|
-
let
|
|
49
|
-
for (let
|
|
50
|
-
const ie =
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
else if (
|
|
42
|
+
if (w === "sequential-balanced") {
|
|
43
|
+
const k = M.length;
|
|
44
|
+
if (k === 0) return [];
|
|
45
|
+
const N = (b, H, R) => b + (H > 0 ? d : 0) + R;
|
|
46
|
+
let A = Math.max(...M), P = M.reduce((b, H) => b + H, 0) + d * Math.max(0, k - 1);
|
|
47
|
+
const z = (b) => {
|
|
48
|
+
let H = 1, R = 0, ne = 0;
|
|
49
|
+
for (let _ = 0; _ < k; _++) {
|
|
50
|
+
const ie = M[_], Q = N(R, ne, ie);
|
|
51
|
+
if (Q <= b)
|
|
52
|
+
R = Q, ne++;
|
|
53
|
+
else if (H++, R = ie, ne = 1, ie > b || H > i) return !1;
|
|
54
54
|
}
|
|
55
|
-
return
|
|
55
|
+
return H <= i;
|
|
56
56
|
};
|
|
57
|
-
for (;
|
|
58
|
-
const
|
|
59
|
-
|
|
57
|
+
for (; A < P; ) {
|
|
58
|
+
const b = Math.floor((A + P) / 2);
|
|
59
|
+
z(b) ? P = b : A = b + 1;
|
|
60
60
|
}
|
|
61
|
-
const
|
|
62
|
-
let
|
|
63
|
-
for (let
|
|
64
|
-
const
|
|
65
|
-
!(
|
|
61
|
+
const F = P, l = new Array(i).fill(0);
|
|
62
|
+
let x = i - 1, E = 0, D = 0;
|
|
63
|
+
for (let b = k - 1; b >= 0; b--) {
|
|
64
|
+
const H = M[b], R = b < x;
|
|
65
|
+
!(N(E, D, H) <= F) || R ? (l[x] = b + 1, x--, E = H, D = 1) : (E = N(E, D, H), D++);
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
for (let
|
|
70
|
-
const
|
|
71
|
-
for (let
|
|
72
|
-
const
|
|
73
|
-
...e[
|
|
74
|
-
columnWidth:
|
|
67
|
+
l[0] = 0;
|
|
68
|
+
const V = [], C = new Array(i).fill(0);
|
|
69
|
+
for (let b = 0; b < i; b++) {
|
|
70
|
+
const H = l[b], R = b + 1 < i ? l[b + 1] : k, ne = b * (L + m);
|
|
71
|
+
for (let _ = H; _ < R; _++) {
|
|
72
|
+
const Q = {
|
|
73
|
+
...e[_],
|
|
74
|
+
columnWidth: L,
|
|
75
75
|
imageHeight: 0,
|
|
76
76
|
columnHeight: 0,
|
|
77
77
|
left: 0,
|
|
78
78
|
top: 0
|
|
79
79
|
};
|
|
80
|
-
|
|
80
|
+
Q.imageHeight = M[_] - (o + f), Q.columnHeight = M[_], Q.left = ne, Q.top = C[b], C[b] += Q.columnHeight + (_ + 1 < R ? d : 0), V.push(Q);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
return
|
|
83
|
+
return V;
|
|
84
84
|
}
|
|
85
|
-
const
|
|
86
|
-
for (let
|
|
87
|
-
const
|
|
88
|
-
...
|
|
85
|
+
const g = new Array(i).fill(0), $ = [];
|
|
86
|
+
for (let k = 0; k < e.length; k++) {
|
|
87
|
+
const N = e[k], A = {
|
|
88
|
+
...N,
|
|
89
89
|
columnWidth: 0,
|
|
90
90
|
imageHeight: 0,
|
|
91
91
|
columnHeight: 0,
|
|
92
92
|
left: 0,
|
|
93
93
|
top: 0
|
|
94
|
-
},
|
|
95
|
-
|
|
94
|
+
}, P = g.indexOf(Math.min(...g)), z = N.width, F = N.height;
|
|
95
|
+
A.columnWidth = L, A.left = P * (L + m), A.imageHeight = Math.round(L * F / z), A.columnHeight = A.imageHeight + o + f, A.top = g[P], g[P] += A.columnHeight + d, $.push(A);
|
|
96
96
|
}
|
|
97
|
-
return
|
|
97
|
+
return $;
|
|
98
98
|
}
|
|
99
|
-
var
|
|
100
|
-
function
|
|
101
|
-
var
|
|
99
|
+
var St = typeof global == "object" && global && global.Object === Object && global, kt = typeof self == "object" && self && self.Object === Object && self, Je = St || kt || Function("return this")(), we = Je.Symbol, Ke = Object.prototype, Et = Ke.hasOwnProperty, Pt = Ke.toString, de = we ? we.toStringTag : void 0;
|
|
100
|
+
function Ht(e) {
|
|
101
|
+
var n = Et.call(e, de), i = e[de];
|
|
102
102
|
try {
|
|
103
|
-
e[
|
|
104
|
-
var
|
|
103
|
+
e[de] = void 0;
|
|
104
|
+
var a = !0;
|
|
105
105
|
} catch {
|
|
106
106
|
}
|
|
107
|
-
var
|
|
108
|
-
return
|
|
107
|
+
var m = Pt.call(e);
|
|
108
|
+
return a && (n ? e[de] = i : delete e[de]), m;
|
|
109
109
|
}
|
|
110
|
-
var
|
|
111
|
-
function Nt(e) {
|
|
112
|
-
return $t.call(e);
|
|
113
|
-
}
|
|
114
|
-
var Bt = "[object Null]", Dt = "[object Undefined]", Ge = xe ? xe.toStringTag : void 0;
|
|
110
|
+
var $t = Object.prototype, Ft = $t.toString;
|
|
115
111
|
function zt(e) {
|
|
116
|
-
return
|
|
112
|
+
return Ft.call(e);
|
|
113
|
+
}
|
|
114
|
+
var Dt = "[object Null]", Bt = "[object Undefined]", Ve = we ? we.toStringTag : void 0;
|
|
115
|
+
function Nt(e) {
|
|
116
|
+
return e == null ? e === void 0 ? Bt : Dt : Ve && Ve in Object(e) ? Ht(e) : zt(e);
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function Wt(e) {
|
|
119
119
|
return e != null && typeof e == "object";
|
|
120
120
|
}
|
|
121
121
|
var At = "[object Symbol]";
|
|
122
|
-
function
|
|
123
|
-
return typeof e == "symbol" ||
|
|
122
|
+
function Rt(e) {
|
|
123
|
+
return typeof e == "symbol" || Wt(e) && Nt(e) == At;
|
|
124
124
|
}
|
|
125
|
-
var
|
|
126
|
-
function
|
|
127
|
-
for (var
|
|
125
|
+
var Ot = /\s/;
|
|
126
|
+
function Ct(e) {
|
|
127
|
+
for (var n = e.length; n-- && Ot.test(e.charAt(n)); )
|
|
128
128
|
;
|
|
129
|
-
return
|
|
129
|
+
return n;
|
|
130
130
|
}
|
|
131
|
-
var
|
|
131
|
+
var Vt = /^\s+/;
|
|
132
132
|
function jt(e) {
|
|
133
|
-
return e && e.slice(0,
|
|
133
|
+
return e && e.slice(0, Ct(e) + 1).replace(Vt, "");
|
|
134
134
|
}
|
|
135
|
-
function
|
|
136
|
-
var
|
|
137
|
-
return e != null && (
|
|
135
|
+
function He(e) {
|
|
136
|
+
var n = typeof e;
|
|
137
|
+
return e != null && (n == "object" || n == "function");
|
|
138
138
|
}
|
|
139
|
-
var
|
|
140
|
-
function
|
|
139
|
+
var je = NaN, qt = /^[-+]0x[0-9a-f]+$/i, Yt = /^0b[01]+$/i, Ut = /^0o[0-7]+$/i, _t = parseInt;
|
|
140
|
+
function qe(e) {
|
|
141
141
|
if (typeof e == "number")
|
|
142
142
|
return e;
|
|
143
|
-
if (
|
|
144
|
-
return
|
|
145
|
-
if (
|
|
146
|
-
var
|
|
147
|
-
e =
|
|
143
|
+
if (Rt(e))
|
|
144
|
+
return je;
|
|
145
|
+
if (He(e)) {
|
|
146
|
+
var n = typeof e.valueOf == "function" ? e.valueOf() : e;
|
|
147
|
+
e = He(n) ? n + "" : n;
|
|
148
148
|
}
|
|
149
149
|
if (typeof e != "string")
|
|
150
150
|
return e === 0 ? e : +e;
|
|
151
151
|
e = jt(e);
|
|
152
|
-
var
|
|
153
|
-
return
|
|
152
|
+
var i = Yt.test(e);
|
|
153
|
+
return i || Ut.test(e) ? _t(e.slice(2), i ? 2 : 8) : qt.test(e) ? je : +e;
|
|
154
154
|
}
|
|
155
|
-
var
|
|
156
|
-
return
|
|
157
|
-
},
|
|
158
|
-
function
|
|
159
|
-
var
|
|
155
|
+
var Ee = function() {
|
|
156
|
+
return Je.Date.now();
|
|
157
|
+
}, Xt = "Expected a function", Gt = Math.max, Jt = Math.min;
|
|
158
|
+
function Ye(e, n, i) {
|
|
159
|
+
var a, m, d, f, o, c, y = 0, t = !1, w = !1, T = !0;
|
|
160
160
|
if (typeof e != "function")
|
|
161
|
-
throw new TypeError(
|
|
162
|
-
|
|
163
|
-
function
|
|
164
|
-
var
|
|
165
|
-
return
|
|
161
|
+
throw new TypeError(Xt);
|
|
162
|
+
n = qe(n) || 0, He(i) && (t = !!i.leading, w = "maxWait" in i, d = w ? Gt(qe(i.maxWait) || 0, n) : d, T = "trailing" in i ? !!i.trailing : T);
|
|
163
|
+
function p(g) {
|
|
164
|
+
var $ = a, k = m;
|
|
165
|
+
return a = m = void 0, y = g, f = e.apply(k, $), f;
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
return
|
|
167
|
+
function h(g) {
|
|
168
|
+
return y = g, o = setTimeout(v, n), t ? p(g) : f;
|
|
169
169
|
}
|
|
170
|
-
function
|
|
171
|
-
var
|
|
172
|
-
return
|
|
170
|
+
function I(g) {
|
|
171
|
+
var $ = g - c, k = g - y, N = n - $;
|
|
172
|
+
return w ? Jt(N, d - k) : N;
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
var
|
|
176
|
-
return
|
|
174
|
+
function S(g) {
|
|
175
|
+
var $ = g - c, k = g - y;
|
|
176
|
+
return c === void 0 || $ >= n || $ < 0 || w && k >= d;
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
var
|
|
180
|
-
if (
|
|
181
|
-
return
|
|
182
|
-
|
|
178
|
+
function v() {
|
|
179
|
+
var g = Ee();
|
|
180
|
+
if (S(g))
|
|
181
|
+
return r(g);
|
|
182
|
+
o = setTimeout(v, I(g));
|
|
183
183
|
}
|
|
184
|
-
function
|
|
185
|
-
return
|
|
184
|
+
function r(g) {
|
|
185
|
+
return o = void 0, T && a ? p(g) : (a = m = void 0, f);
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
|
|
187
|
+
function s() {
|
|
188
|
+
o !== void 0 && clearTimeout(o), y = 0, a = c = m = o = void 0;
|
|
189
189
|
}
|
|
190
|
-
function
|
|
191
|
-
return
|
|
190
|
+
function L() {
|
|
191
|
+
return o === void 0 ? f : r(Ee());
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
var
|
|
195
|
-
if (
|
|
196
|
-
if (
|
|
197
|
-
return
|
|
198
|
-
if (
|
|
199
|
-
return clearTimeout(
|
|
193
|
+
function M() {
|
|
194
|
+
var g = Ee(), $ = S(g);
|
|
195
|
+
if (a = arguments, m = this, c = g, $) {
|
|
196
|
+
if (o === void 0)
|
|
197
|
+
return h(c);
|
|
198
|
+
if (w)
|
|
199
|
+
return clearTimeout(o), o = setTimeout(v, n), p(c);
|
|
200
200
|
}
|
|
201
|
-
return
|
|
201
|
+
return o === void 0 && (o = setTimeout(v, n)), f;
|
|
202
202
|
}
|
|
203
|
-
return
|
|
204
|
-
}
|
|
205
|
-
function ue(e, l) {
|
|
206
|
-
const r = l ?? (typeof window < "u" ? window.innerWidth : 1024), t = e.sizes;
|
|
207
|
-
return r >= 1536 && t["2xl"] ? t["2xl"] : r >= 1280 && t.xl ? t.xl : r >= 1024 && t.lg ? t.lg : r >= 768 && t.md ? t.md : r >= 640 && t.sm ? t.sm : t.base;
|
|
203
|
+
return M.cancel = s, M.flush = L, M;
|
|
208
204
|
}
|
|
209
|
-
function
|
|
210
|
-
const
|
|
211
|
-
return
|
|
205
|
+
function se(e, n) {
|
|
206
|
+
const i = n ?? (typeof window < "u" ? window.innerWidth : 1024), a = e.sizes;
|
|
207
|
+
return i >= 1536 && a["2xl"] ? a["2xl"] : i >= 1280 && a.xl ? a.xl : i >= 1024 && a.lg ? a.lg : i >= 768 && a.md ? a.md : i >= 640 && a.sm ? a.sm : a.base;
|
|
212
208
|
}
|
|
213
209
|
function Kt(e) {
|
|
214
|
-
|
|
210
|
+
const n = e ?? (typeof window < "u" ? window.innerWidth : 1024);
|
|
211
|
+
return n >= 1536 ? "2xl" : n >= 1280 ? "xl" : n >= 1024 ? "lg" : n >= 768 ? "md" : n >= 640 ? "sm" : "base";
|
|
215
212
|
}
|
|
216
213
|
function Qt(e) {
|
|
214
|
+
return e.reduce((i, a) => Math.max(i, a.top + a.columnHeight), 0) + 500;
|
|
215
|
+
}
|
|
216
|
+
function Zt(e) {
|
|
217
217
|
return {
|
|
218
218
|
transform: `translate3d(${e.left}px, ${e.top}px, 0)`,
|
|
219
219
|
top: "0px",
|
|
@@ -222,647 +222,674 @@ function Qt(e) {
|
|
|
222
222
|
height: `${e.columnHeight}px`
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function ea(e, n = 0) {
|
|
226
226
|
return {
|
|
227
|
-
style:
|
|
227
|
+
style: Zt(e),
|
|
228
228
|
"data-top": e.top,
|
|
229
229
|
"data-left": e.left,
|
|
230
230
|
"data-id": `${e.page}-${e.id}`,
|
|
231
|
-
"data-index":
|
|
231
|
+
"data-index": n
|
|
232
232
|
};
|
|
233
233
|
}
|
|
234
|
-
function
|
|
235
|
-
if (!e.length ||
|
|
236
|
-
return new Array(Math.max(1,
|
|
237
|
-
const
|
|
238
|
-
for (let
|
|
239
|
-
const
|
|
240
|
-
for (const
|
|
241
|
-
const
|
|
242
|
-
|
|
234
|
+
function $e(e, n) {
|
|
235
|
+
if (!e.length || n <= 0)
|
|
236
|
+
return new Array(Math.max(1, n)).fill(0);
|
|
237
|
+
const a = Array.from(new Set(e.map((f) => f.left))).sort((f, o) => f - o).slice(0, n), m = /* @__PURE__ */ new Map();
|
|
238
|
+
for (let f = 0; f < a.length; f++) m.set(a[f], f);
|
|
239
|
+
const d = new Array(a.length).fill(0);
|
|
240
|
+
for (const f of e) {
|
|
241
|
+
const o = m.get(f.left);
|
|
242
|
+
o != null && (d[o] = Math.max(d[o], f.top + f.columnHeight));
|
|
243
243
|
}
|
|
244
|
-
for (;
|
|
245
|
-
return
|
|
244
|
+
for (; d.length < n; ) d.push(0);
|
|
245
|
+
return d;
|
|
246
246
|
}
|
|
247
|
-
function
|
|
248
|
-
let
|
|
249
|
-
const
|
|
250
|
-
function
|
|
251
|
-
var
|
|
252
|
-
const
|
|
253
|
-
if (
|
|
254
|
-
const
|
|
255
|
-
|
|
247
|
+
function ta(e, n) {
|
|
248
|
+
let i = 0, a = 0;
|
|
249
|
+
const m = 1e3;
|
|
250
|
+
function d(t, w) {
|
|
251
|
+
var h;
|
|
252
|
+
const T = (h = e.container) == null ? void 0 : h.value;
|
|
253
|
+
if (T) {
|
|
254
|
+
const I = T.scrollTop, S = T.clientHeight;
|
|
255
|
+
i = I - m, a = I + S + m;
|
|
256
256
|
}
|
|
257
|
-
return
|
|
257
|
+
return t + w >= i && t <= a;
|
|
258
258
|
}
|
|
259
|
-
function
|
|
260
|
-
var
|
|
261
|
-
const
|
|
262
|
-
if ((
|
|
263
|
-
|
|
264
|
-
|
|
259
|
+
function f(t, w) {
|
|
260
|
+
var r;
|
|
261
|
+
const T = parseInt(t.dataset.left || "0", 10), p = parseInt(t.dataset.top || "0", 10), h = parseInt(t.dataset.index || "0", 10), I = t.offsetHeight || parseInt(getComputedStyle(t).height || "200", 10) || 200;
|
|
262
|
+
if ((r = n == null ? void 0 : n.virtualizing) != null && r.value) {
|
|
263
|
+
t.style.transition = "none", t.style.opacity = "1", t.style.transform = `translate3d(${T}px, ${p}px, 0) scale(1)`, t.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
|
|
264
|
+
t.style.transition = "", w();
|
|
265
265
|
});
|
|
266
266
|
return;
|
|
267
267
|
}
|
|
268
|
-
if (!
|
|
269
|
-
|
|
268
|
+
if (!d(p, I)) {
|
|
269
|
+
t.style.opacity = "1", t.style.transform = `translate3d(${T}px, ${p}px, 0) scale(1)`, t.style.transition = "none", w();
|
|
270
270
|
return;
|
|
271
271
|
}
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
const
|
|
276
|
-
|
|
272
|
+
const S = Math.min(h * 20, 160), v = t.style.getPropertyValue("--masonry-opacity-delay");
|
|
273
|
+
t.style.setProperty("--masonry-opacity-delay", `${S}ms`), requestAnimationFrame(() => {
|
|
274
|
+
t.style.opacity = "1", t.style.transform = `translate3d(${T}px, ${p}px, 0) scale(1)`;
|
|
275
|
+
const s = () => {
|
|
276
|
+
v ? t.style.setProperty("--masonry-opacity-delay", v) : t.style.removeProperty("--masonry-opacity-delay"), t.removeEventListener("transitionend", s), w();
|
|
277
277
|
};
|
|
278
|
-
|
|
278
|
+
t.addEventListener("transitionend", s);
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
var
|
|
283
|
-
const
|
|
284
|
-
if ((
|
|
285
|
-
|
|
281
|
+
function o(t) {
|
|
282
|
+
var p;
|
|
283
|
+
const w = parseInt(t.dataset.left || "0", 10), T = parseInt(t.dataset.top || "0", 10);
|
|
284
|
+
if ((p = n == null ? void 0 : n.virtualizing) != null && p.value) {
|
|
285
|
+
t.style.transition = "none", t.style.opacity = "1", t.style.transform = `translate3d(${w}px, ${T}px, 0) scale(1)`, t.style.removeProperty("--masonry-opacity-delay");
|
|
286
286
|
return;
|
|
287
287
|
}
|
|
288
|
-
|
|
288
|
+
t.style.opacity = "0", t.style.transform = `translate3d(${w}px, ${T + 10}px, 0) scale(0.985)`;
|
|
289
289
|
}
|
|
290
|
-
function
|
|
291
|
-
var
|
|
292
|
-
const
|
|
293
|
-
if (!((
|
|
294
|
-
if (!
|
|
295
|
-
|
|
290
|
+
function c(t) {
|
|
291
|
+
var h;
|
|
292
|
+
const w = parseInt(t.dataset.left || "0", 10), T = parseInt(t.dataset.top || "0", 10), p = t.offsetHeight || parseInt(getComputedStyle(t).height || "200", 10) || 200;
|
|
293
|
+
if (!((h = n == null ? void 0 : n.virtualizing) != null && h.value)) {
|
|
294
|
+
if (!d(T, p)) {
|
|
295
|
+
t.style.transition = "none";
|
|
296
296
|
return;
|
|
297
297
|
}
|
|
298
|
-
|
|
299
|
-
|
|
298
|
+
t.style.transition = "none", t.style.opacity = "1", t.style.transform = `translate3d(${w}px, ${T}px, 0) scale(1)`, t.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
|
|
299
|
+
t.style.transition = "";
|
|
300
300
|
});
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
-
function
|
|
304
|
-
var
|
|
305
|
-
const
|
|
306
|
-
if ((
|
|
307
|
-
|
|
303
|
+
function y(t, w) {
|
|
304
|
+
var M;
|
|
305
|
+
const T = parseInt(t.dataset.left || "0", 10), p = parseInt(t.dataset.top || "0", 10), h = t.offsetHeight || parseInt(getComputedStyle(t).height || "200", 10) || 200;
|
|
306
|
+
if ((M = n == null ? void 0 : n.virtualizing) != null && M.value) {
|
|
307
|
+
w();
|
|
308
308
|
return;
|
|
309
309
|
}
|
|
310
|
-
if (!
|
|
311
|
-
|
|
310
|
+
if (!d(p, h)) {
|
|
311
|
+
t.style.transition = "none", t.style.opacity = "0", w();
|
|
312
312
|
return;
|
|
313
313
|
}
|
|
314
|
-
const
|
|
315
|
-
let
|
|
316
|
-
if (!Number.isFinite(
|
|
317
|
-
const
|
|
318
|
-
|
|
314
|
+
const I = typeof (n == null ? void 0 : n.leaveDurationMs) == "number" ? n.leaveDurationMs : Number.NaN;
|
|
315
|
+
let S = Number.isFinite(I) && I > 0 ? I : Number.NaN;
|
|
316
|
+
if (!Number.isFinite(S)) {
|
|
317
|
+
const $ = getComputedStyle(t).getPropertyValue("--masonry-leave-duration") || "", k = parseFloat($);
|
|
318
|
+
S = Number.isFinite(k) && k > 0 ? k : 200;
|
|
319
319
|
}
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
},
|
|
323
|
-
(!
|
|
324
|
-
},
|
|
325
|
-
|
|
326
|
-
},
|
|
320
|
+
const v = t.style.transitionDuration, r = () => {
|
|
321
|
+
t.removeEventListener("transitionend", s), clearTimeout(L), t.style.transitionDuration = v || "";
|
|
322
|
+
}, s = (g) => {
|
|
323
|
+
(!g || g.target === t) && (r(), w());
|
|
324
|
+
}, L = setTimeout(() => {
|
|
325
|
+
r(), w();
|
|
326
|
+
}, S + 100);
|
|
327
327
|
requestAnimationFrame(() => {
|
|
328
|
-
|
|
328
|
+
t.style.transitionDuration = `${S}ms`, t.style.opacity = "0", t.style.transform = `translate3d(${T}px, ${p + 10}px, 0) scale(0.985)`, t.addEventListener("transitionend", s);
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
331
|
return {
|
|
332
|
-
onEnter:
|
|
333
|
-
onBeforeEnter:
|
|
334
|
-
onBeforeLeave:
|
|
335
|
-
onLeave:
|
|
332
|
+
onEnter: f,
|
|
333
|
+
onBeforeEnter: o,
|
|
334
|
+
onBeforeLeave: c,
|
|
335
|
+
onLeave: y
|
|
336
336
|
};
|
|
337
337
|
}
|
|
338
|
-
function
|
|
338
|
+
function aa({
|
|
339
339
|
container: e,
|
|
340
|
-
masonry:
|
|
341
|
-
columns:
|
|
342
|
-
containerHeight:
|
|
343
|
-
isLoading:
|
|
344
|
-
pageSize:
|
|
345
|
-
refreshLayout:
|
|
346
|
-
setItemsRaw:
|
|
347
|
-
loadNext:
|
|
348
|
-
loadThresholdPx:
|
|
340
|
+
masonry: n,
|
|
341
|
+
columns: i,
|
|
342
|
+
containerHeight: a,
|
|
343
|
+
isLoading: m,
|
|
344
|
+
pageSize: d,
|
|
345
|
+
refreshLayout: f,
|
|
346
|
+
setItemsRaw: o,
|
|
347
|
+
loadNext: c,
|
|
348
|
+
loadThresholdPx: y
|
|
349
349
|
}) {
|
|
350
|
-
let
|
|
351
|
-
async function
|
|
350
|
+
let t = 0;
|
|
351
|
+
async function w(T, p = !1) {
|
|
352
352
|
if (!e.value) return;
|
|
353
|
-
const
|
|
354
|
-
|
|
355
|
-
const
|
|
356
|
-
if (
|
|
357
|
-
await
|
|
353
|
+
const h = T ?? $e(n.value, i.value), I = h.length ? Math.max(...h) : 0, S = e.value.scrollTop + e.value.clientHeight, v = e.value.scrollTop > t + 1;
|
|
354
|
+
t = e.value.scrollTop;
|
|
355
|
+
const r = typeof y == "number" ? y : 200, s = r >= 0 ? Math.max(0, I - r) : Math.max(0, I + r);
|
|
356
|
+
if (S >= s && (v || p) && !m.value) {
|
|
357
|
+
await c(), await X();
|
|
358
358
|
return;
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
361
|
return {
|
|
362
|
-
handleScroll:
|
|
362
|
+
handleScroll: w
|
|
363
363
|
};
|
|
364
364
|
}
|
|
365
|
-
function
|
|
366
|
-
const { useSwipeMode:
|
|
367
|
-
if (!
|
|
368
|
-
const
|
|
369
|
-
return
|
|
370
|
-
}),
|
|
371
|
-
if (!
|
|
372
|
-
const
|
|
373
|
-
return
|
|
374
|
-
}),
|
|
375
|
-
if (!
|
|
376
|
-
const
|
|
377
|
-
return
|
|
365
|
+
function na(e) {
|
|
366
|
+
const { useSwipeMode: n, masonry: i, isLoading: a, loadNext: m, loadPage: d, paginationHistory: f } = e, o = W(0), c = W(0), y = W(!1), t = W(0), w = W(0), T = W(null), p = K(() => {
|
|
367
|
+
if (!n.value || i.value.length === 0) return null;
|
|
368
|
+
const P = Math.max(0, Math.min(o.value, i.value.length - 1));
|
|
369
|
+
return i.value[P] || null;
|
|
370
|
+
}), h = K(() => {
|
|
371
|
+
if (!n.value || !p.value) return null;
|
|
372
|
+
const P = o.value + 1;
|
|
373
|
+
return P >= i.value.length ? null : i.value[P] || null;
|
|
374
|
+
}), I = K(() => {
|
|
375
|
+
if (!n.value || !p.value) return null;
|
|
376
|
+
const P = o.value - 1;
|
|
377
|
+
return P < 0 ? null : i.value[P] || null;
|
|
378
378
|
});
|
|
379
|
-
function
|
|
380
|
-
if (!
|
|
381
|
-
const
|
|
382
|
-
|
|
379
|
+
function S() {
|
|
380
|
+
if (!T.value) return;
|
|
381
|
+
const P = T.value.clientHeight;
|
|
382
|
+
c.value = -o.value * P;
|
|
383
383
|
}
|
|
384
|
-
function
|
|
385
|
-
if (!
|
|
386
|
-
|
|
384
|
+
function v() {
|
|
385
|
+
if (!h.value) {
|
|
386
|
+
m();
|
|
387
387
|
return;
|
|
388
388
|
}
|
|
389
|
-
|
|
389
|
+
o.value++, S(), o.value >= i.value.length - 5 && m();
|
|
390
390
|
}
|
|
391
|
-
function
|
|
392
|
-
|
|
391
|
+
function r() {
|
|
392
|
+
I.value && (o.value--, S());
|
|
393
393
|
}
|
|
394
|
-
function
|
|
395
|
-
|
|
394
|
+
function s(P) {
|
|
395
|
+
n.value && (y.value = !0, t.value = P.touches[0].clientY, w.value = c.value, P.preventDefault());
|
|
396
396
|
}
|
|
397
|
-
function P
|
|
398
|
-
if (!
|
|
399
|
-
const
|
|
400
|
-
|
|
397
|
+
function L(P) {
|
|
398
|
+
if (!n.value || !y.value) return;
|
|
399
|
+
const z = P.touches[0].clientY - t.value;
|
|
400
|
+
c.value = w.value + z, P.preventDefault();
|
|
401
401
|
}
|
|
402
|
-
function
|
|
403
|
-
if (!
|
|
404
|
-
|
|
405
|
-
const
|
|
406
|
-
Math.abs(
|
|
402
|
+
function M(P) {
|
|
403
|
+
if (!n.value || !y.value) return;
|
|
404
|
+
y.value = !1;
|
|
405
|
+
const z = c.value - w.value;
|
|
406
|
+
Math.abs(z) > 100 ? z > 0 && I.value ? r() : z < 0 && h.value ? v() : S() : S(), P.preventDefault();
|
|
407
407
|
}
|
|
408
|
-
function
|
|
409
|
-
|
|
408
|
+
function g(P) {
|
|
409
|
+
n.value && (y.value = !0, t.value = P.clientY, w.value = c.value, P.preventDefault());
|
|
410
410
|
}
|
|
411
|
-
function
|
|
412
|
-
if (!
|
|
413
|
-
const
|
|
414
|
-
|
|
411
|
+
function $(P) {
|
|
412
|
+
if (!n.value || !y.value) return;
|
|
413
|
+
const z = P.clientY - t.value;
|
|
414
|
+
c.value = w.value + z, P.preventDefault();
|
|
415
415
|
}
|
|
416
|
-
function
|
|
417
|
-
if (!
|
|
418
|
-
|
|
419
|
-
const
|
|
420
|
-
Math.abs(
|
|
416
|
+
function k(P) {
|
|
417
|
+
if (!n.value || !y.value) return;
|
|
418
|
+
y.value = !1;
|
|
419
|
+
const z = c.value - w.value;
|
|
420
|
+
Math.abs(z) > 100 ? z > 0 && I.value ? r() : z < 0 && h.value ? v() : S() : S(), P.preventDefault();
|
|
421
421
|
}
|
|
422
|
-
function
|
|
423
|
-
!
|
|
422
|
+
function N() {
|
|
423
|
+
!n.value && o.value > 0 && (o.value = 0, c.value = 0), n.value && i.value.length === 0 && !a.value && d(f.value[0]), n.value && S();
|
|
424
424
|
}
|
|
425
|
-
function
|
|
426
|
-
|
|
425
|
+
function A() {
|
|
426
|
+
o.value = 0, c.value = 0, y.value = !1;
|
|
427
427
|
}
|
|
428
428
|
return {
|
|
429
429
|
// State
|
|
430
|
-
currentSwipeIndex:
|
|
431
|
-
swipeOffset:
|
|
432
|
-
isDragging:
|
|
433
|
-
swipeContainer:
|
|
430
|
+
currentSwipeIndex: o,
|
|
431
|
+
swipeOffset: c,
|
|
432
|
+
isDragging: y,
|
|
433
|
+
swipeContainer: T,
|
|
434
434
|
// Computed
|
|
435
|
-
currentItem:
|
|
436
|
-
nextItem:
|
|
437
|
-
previousItem:
|
|
435
|
+
currentItem: p,
|
|
436
|
+
nextItem: h,
|
|
437
|
+
previousItem: I,
|
|
438
438
|
// Functions
|
|
439
|
-
handleTouchStart:
|
|
440
|
-
handleTouchMove:
|
|
441
|
-
handleTouchEnd:
|
|
442
|
-
handleMouseDown:
|
|
443
|
-
handleMouseMove:
|
|
444
|
-
handleMouseUp:
|
|
445
|
-
goToNextItem:
|
|
446
|
-
goToPreviousItem:
|
|
447
|
-
snapToCurrentItem:
|
|
448
|
-
handleWindowResize:
|
|
449
|
-
reset:
|
|
439
|
+
handleTouchStart: s,
|
|
440
|
+
handleTouchMove: L,
|
|
441
|
+
handleTouchEnd: M,
|
|
442
|
+
handleMouseDown: g,
|
|
443
|
+
handleMouseMove: $,
|
|
444
|
+
handleMouseUp: k,
|
|
445
|
+
goToNextItem: v,
|
|
446
|
+
goToPreviousItem: r,
|
|
447
|
+
snapToCurrentItem: S,
|
|
448
|
+
handleWindowResize: N,
|
|
449
|
+
reset: A
|
|
450
450
|
};
|
|
451
451
|
}
|
|
452
452
|
function me(e) {
|
|
453
453
|
return e instanceof Error ? e : new Error(String(e));
|
|
454
454
|
}
|
|
455
|
-
function
|
|
455
|
+
function la(e) {
|
|
456
456
|
const {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
emits:
|
|
474
|
-
} = e,
|
|
475
|
-
let
|
|
476
|
-
function
|
|
477
|
-
return
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
457
|
+
getPage: n,
|
|
458
|
+
context: i,
|
|
459
|
+
masonry: a,
|
|
460
|
+
isLoading: m,
|
|
461
|
+
hasReachedEnd: d,
|
|
462
|
+
loadError: f,
|
|
463
|
+
currentPage: o,
|
|
464
|
+
paginationHistory: c,
|
|
465
|
+
refreshLayout: y,
|
|
466
|
+
retryMaxAttempts: t,
|
|
467
|
+
retryInitialDelayMs: w,
|
|
468
|
+
retryBackoffStepMs: T,
|
|
469
|
+
mode: p,
|
|
470
|
+
backfillDelayMs: h,
|
|
471
|
+
backfillMaxCalls: I,
|
|
472
|
+
pageSize: S,
|
|
473
|
+
emits: v
|
|
474
|
+
} = e, r = W(!1);
|
|
475
|
+
let s = !1;
|
|
476
|
+
function L(F) {
|
|
477
|
+
return a.value.filter((l) => l.page === F).length;
|
|
478
|
+
}
|
|
479
|
+
function M(F, l) {
|
|
480
|
+
return new Promise((x) => {
|
|
481
|
+
const E = Math.max(0, F | 0), D = Date.now();
|
|
482
|
+
l(E, E);
|
|
483
|
+
const V = setInterval(() => {
|
|
484
|
+
if (r.value) {
|
|
485
|
+
clearInterval(V), x();
|
|
483
486
|
return;
|
|
484
487
|
}
|
|
485
|
-
const
|
|
486
|
-
|
|
488
|
+
const C = Date.now() - D, b = Math.max(0, E - C);
|
|
489
|
+
l(b, E), b <= 0 && (clearInterval(V), x());
|
|
487
490
|
}, 100);
|
|
488
491
|
});
|
|
489
492
|
}
|
|
490
|
-
async function
|
|
491
|
-
let
|
|
492
|
-
const
|
|
493
|
-
let
|
|
493
|
+
async function g(F) {
|
|
494
|
+
let l = 0;
|
|
495
|
+
const x = t;
|
|
496
|
+
let E = w;
|
|
494
497
|
for (; ; )
|
|
495
498
|
try {
|
|
496
|
-
const
|
|
497
|
-
return
|
|
498
|
-
} catch (
|
|
499
|
-
if (
|
|
500
|
-
throw
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
}),
|
|
499
|
+
const D = await F();
|
|
500
|
+
return l > 0 && v("retry:stop", { attempt: l, success: !0 }), D;
|
|
501
|
+
} catch (D) {
|
|
502
|
+
if (l++, l > x)
|
|
503
|
+
throw v("retry:stop", { attempt: l - 1, success: !1 }), D;
|
|
504
|
+
v("retry:start", { attempt: l, max: x, totalMs: E }), await M(E, (V, C) => {
|
|
505
|
+
v("retry:tick", { attempt: l, remainingMs: V, totalMs: C });
|
|
506
|
+
}), E += T;
|
|
504
507
|
}
|
|
505
508
|
}
|
|
506
|
-
async function
|
|
509
|
+
async function $(F) {
|
|
507
510
|
try {
|
|
508
|
-
const
|
|
509
|
-
return
|
|
510
|
-
} catch (
|
|
511
|
-
throw
|
|
511
|
+
const l = await g(() => n(F, i == null ? void 0 : i.value));
|
|
512
|
+
return y([...a.value, ...l.items]), l;
|
|
513
|
+
} catch (l) {
|
|
514
|
+
throw l;
|
|
512
515
|
}
|
|
513
516
|
}
|
|
514
|
-
async function
|
|
515
|
-
if (!
|
|
516
|
-
const
|
|
517
|
-
if (!
|
|
518
|
-
if (
|
|
519
|
-
|
|
517
|
+
async function k(F, l = !1) {
|
|
518
|
+
if (!l && p !== "backfill" || s || r.value || d.value) return;
|
|
519
|
+
const x = (F || 0) + (S || 0);
|
|
520
|
+
if (!S || S <= 0) return;
|
|
521
|
+
if (c.value[c.value.length - 1] == null) {
|
|
522
|
+
d.value = !0;
|
|
520
523
|
return;
|
|
521
524
|
}
|
|
522
|
-
if (!(
|
|
523
|
-
|
|
525
|
+
if (!(a.value.length >= x)) {
|
|
526
|
+
s = !0, m.value || (m.value = !0, v("loading:start"));
|
|
524
527
|
try {
|
|
525
|
-
let
|
|
526
|
-
for (
|
|
527
|
-
|
|
528
|
-
fetched:
|
|
529
|
-
target:
|
|
530
|
-
calls:
|
|
531
|
-
remainingMs:
|
|
532
|
-
totalMs:
|
|
528
|
+
let D = 0;
|
|
529
|
+
for (v("backfill:start", { target: x, fetched: a.value.length, calls: D }); a.value.length < x && D < I && c.value[c.value.length - 1] != null && !r.value && !d.value && s && (await M(h, (C, b) => {
|
|
530
|
+
v("backfill:tick", {
|
|
531
|
+
fetched: a.value.length,
|
|
532
|
+
target: x,
|
|
533
|
+
calls: D,
|
|
534
|
+
remainingMs: C,
|
|
535
|
+
totalMs: b
|
|
533
536
|
});
|
|
534
|
-
}), !(
|
|
535
|
-
const
|
|
536
|
-
if (
|
|
537
|
-
|
|
537
|
+
}), !(r.value || !s)); ) {
|
|
538
|
+
const V = c.value[c.value.length - 1];
|
|
539
|
+
if (V == null) {
|
|
540
|
+
d.value = !0;
|
|
538
541
|
break;
|
|
539
542
|
}
|
|
540
543
|
try {
|
|
541
|
-
if (
|
|
542
|
-
const
|
|
543
|
-
if (
|
|
544
|
-
|
|
545
|
-
} catch (
|
|
546
|
-
if (
|
|
547
|
-
|
|
544
|
+
if (r.value || !s) break;
|
|
545
|
+
const C = await $(V);
|
|
546
|
+
if (r.value || !s) break;
|
|
547
|
+
f.value = null, c.value.push(C.nextPage), C.nextPage == null && (d.value = !0);
|
|
548
|
+
} catch (C) {
|
|
549
|
+
if (r.value || !s) break;
|
|
550
|
+
f.value = me(C);
|
|
548
551
|
}
|
|
549
|
-
|
|
552
|
+
D++;
|
|
550
553
|
}
|
|
551
|
-
|
|
554
|
+
v("backfill:stop", { fetched: a.value.length, calls: D });
|
|
552
555
|
} finally {
|
|
553
|
-
|
|
556
|
+
s = !1, m.value = !1, v("loading:stop", { fetched: a.value.length });
|
|
554
557
|
}
|
|
555
558
|
}
|
|
556
559
|
}
|
|
557
|
-
async function
|
|
558
|
-
if (!
|
|
559
|
-
|
|
560
|
+
async function N(F) {
|
|
561
|
+
if (!m.value) {
|
|
562
|
+
r.value = !1, m.value || (m.value = !0, v("loading:start")), d.value = !1, f.value = null;
|
|
560
563
|
try {
|
|
561
|
-
const
|
|
562
|
-
if (
|
|
563
|
-
const
|
|
564
|
-
return
|
|
565
|
-
} catch (
|
|
566
|
-
throw
|
|
564
|
+
const l = a.value.length;
|
|
565
|
+
if (r.value) return;
|
|
566
|
+
const x = await $(F);
|
|
567
|
+
return r.value ? void 0 : (f.value = null, o.value = F, c.value.push(x.nextPage), x.nextPage == null && (d.value = !0), await k(l), x);
|
|
568
|
+
} catch (l) {
|
|
569
|
+
throw f.value = me(l), l;
|
|
567
570
|
} finally {
|
|
568
|
-
|
|
571
|
+
m.value = !1;
|
|
569
572
|
}
|
|
570
573
|
}
|
|
571
574
|
}
|
|
572
|
-
async function
|
|
573
|
-
if (!
|
|
574
|
-
|
|
575
|
+
async function A() {
|
|
576
|
+
if (!m.value && !d.value) {
|
|
577
|
+
r.value = !1, m.value || (m.value = !0, v("loading:start")), f.value = null;
|
|
575
578
|
try {
|
|
576
|
-
const
|
|
577
|
-
if (
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
579
|
+
const F = a.value.length;
|
|
580
|
+
if (r.value) return;
|
|
581
|
+
if (p === "refresh" && o.value != null && L(o.value) < S) {
|
|
582
|
+
const D = await g(() => n(o.value, i == null ? void 0 : i.value));
|
|
583
|
+
if (r.value) return;
|
|
584
|
+
const V = [...a.value], C = D.items.filter((H) => !H || H.id == null || H.page == null ? !1 : !V.some((R) => R && R.id === H.id && R.page === H.page));
|
|
585
|
+
if (C.length > 0) {
|
|
586
|
+
const H = [...a.value, ...C];
|
|
587
|
+
y(H), await new Promise((R) => setTimeout(R, 0));
|
|
588
|
+
}
|
|
589
|
+
if (f.value = null, C.length === 0) {
|
|
590
|
+
const H = c.value[c.value.length - 1];
|
|
591
|
+
if (H == null) {
|
|
592
|
+
d.value = !0;
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
const R = await $(H);
|
|
596
|
+
return r.value ? void 0 : (f.value = null, o.value = H, c.value.push(R.nextPage), R.nextPage == null && (d.value = !0), await k(F), R);
|
|
597
|
+
}
|
|
598
|
+
if (L(o.value) >= S) {
|
|
599
|
+
const H = c.value[c.value.length - 1];
|
|
600
|
+
if (H == null) {
|
|
601
|
+
d.value = !0;
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
const R = await $(H);
|
|
605
|
+
return r.value ? void 0 : (f.value = null, o.value = H, c.value.push(R.nextPage), R.nextPage == null && (d.value = !0), await k(F), R);
|
|
606
|
+
} else
|
|
607
|
+
return D;
|
|
608
|
+
}
|
|
609
|
+
const l = c.value[c.value.length - 1];
|
|
610
|
+
if (l == null) {
|
|
611
|
+
d.value = !0;
|
|
581
612
|
return;
|
|
582
613
|
}
|
|
583
|
-
const
|
|
584
|
-
return
|
|
585
|
-
} catch (
|
|
586
|
-
throw
|
|
614
|
+
const x = await $(l);
|
|
615
|
+
return r.value ? void 0 : (f.value = null, o.value = l, c.value.push(x.nextPage), x.nextPage == null && (d.value = !0), await k(F), x);
|
|
616
|
+
} catch (F) {
|
|
617
|
+
throw f.value = me(F), F;
|
|
587
618
|
} finally {
|
|
588
|
-
|
|
619
|
+
m.value = !1, v("loading:stop", { fetched: a.value.length });
|
|
589
620
|
}
|
|
590
621
|
}
|
|
591
622
|
}
|
|
592
|
-
async function
|
|
593
|
-
if (!
|
|
594
|
-
|
|
623
|
+
async function P() {
|
|
624
|
+
if (!m.value) {
|
|
625
|
+
r.value = !1, m.value = !0, v("loading:start");
|
|
595
626
|
try {
|
|
596
|
-
const
|
|
597
|
-
if (
|
|
598
|
-
console.warn("[Masonry] No current page to refresh - currentPage:",
|
|
627
|
+
const F = o.value;
|
|
628
|
+
if (F == null) {
|
|
629
|
+
console.warn("[Masonry] No current page to refresh - currentPage:", o.value, "paginationHistory:", c.value);
|
|
599
630
|
return;
|
|
600
631
|
}
|
|
601
|
-
|
|
602
|
-
const
|
|
603
|
-
if (
|
|
604
|
-
|
|
605
|
-
const
|
|
606
|
-
return await
|
|
607
|
-
} catch (
|
|
608
|
-
throw
|
|
632
|
+
a.value = [], d.value = !1, f.value = null, c.value = [F];
|
|
633
|
+
const l = await $(F);
|
|
634
|
+
if (r.value) return;
|
|
635
|
+
f.value = null, o.value = F, c.value.push(l.nextPage), l.nextPage == null && (d.value = !0);
|
|
636
|
+
const x = a.value.length;
|
|
637
|
+
return await k(x), l;
|
|
638
|
+
} catch (F) {
|
|
639
|
+
throw f.value = me(F), F;
|
|
609
640
|
} finally {
|
|
610
|
-
|
|
641
|
+
m.value = !1, v("loading:stop", { fetched: a.value.length });
|
|
611
642
|
}
|
|
612
643
|
}
|
|
613
644
|
}
|
|
614
|
-
function
|
|
615
|
-
const
|
|
616
|
-
|
|
645
|
+
function z() {
|
|
646
|
+
const F = s;
|
|
647
|
+
r.value = !0, m.value = !1, s = !1, F && v("backfill:stop", { fetched: a.value.length, calls: 0, cancelled: !0 }), v("loading:stop", { fetched: a.value.length });
|
|
617
648
|
}
|
|
618
649
|
return {
|
|
619
|
-
loadPage:
|
|
620
|
-
loadNext:
|
|
621
|
-
refreshCurrentPage:
|
|
622
|
-
cancelLoad:
|
|
623
|
-
maybeBackfillToTarget:
|
|
624
|
-
getContent:
|
|
650
|
+
loadPage: N,
|
|
651
|
+
loadNext: A,
|
|
652
|
+
refreshCurrentPage: P,
|
|
653
|
+
cancelLoad: z,
|
|
654
|
+
maybeBackfillToTarget: k,
|
|
655
|
+
getContent: $
|
|
625
656
|
};
|
|
626
657
|
}
|
|
627
|
-
function
|
|
658
|
+
function oa(e) {
|
|
628
659
|
const {
|
|
629
|
-
masonry:
|
|
630
|
-
useSwipeMode:
|
|
631
|
-
refreshLayout:
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
autoRefreshOnEmpty: i,
|
|
636
|
-
paginationHistory: w
|
|
660
|
+
masonry: n,
|
|
661
|
+
useSwipeMode: i,
|
|
662
|
+
refreshLayout: a,
|
|
663
|
+
loadNext: m,
|
|
664
|
+
maybeBackfillToTarget: d,
|
|
665
|
+
paginationHistory: f
|
|
637
666
|
} = e;
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
if (
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
try {
|
|
645
|
-
await g(), await h(0, !0);
|
|
646
|
-
} catch {
|
|
647
|
-
}
|
|
648
|
-
return;
|
|
649
|
-
}
|
|
650
|
-
await new Promise((a) => requestAnimationFrame(() => a())), requestAnimationFrame(() => {
|
|
651
|
-
t(m);
|
|
652
|
-
});
|
|
667
|
+
let o = /* @__PURE__ */ new Set(), c = null, y = !1;
|
|
668
|
+
async function t() {
|
|
669
|
+
if (o.size === 0 || y) return;
|
|
670
|
+
y = !0;
|
|
671
|
+
const v = Array.from(o);
|
|
672
|
+
o.clear(), c = null, await T(v), y = !1;
|
|
653
673
|
}
|
|
654
|
-
async function
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
674
|
+
async function w(v) {
|
|
675
|
+
o.add(v), c && clearTimeout(c), c = setTimeout(() => {
|
|
676
|
+
t();
|
|
677
|
+
}, 16);
|
|
678
|
+
}
|
|
679
|
+
async function T(v) {
|
|
680
|
+
if (!v || v.length === 0) return;
|
|
681
|
+
const r = new Set(v.map((L) => L.id)), s = n.value.filter((L) => !r.has(L.id));
|
|
682
|
+
if (n.value = s, await X(), s.length === 0 && f.value.length > 0) {
|
|
683
|
+
try {
|
|
684
|
+
await m(), await d(0, !0);
|
|
685
|
+
} catch {
|
|
686
|
+
}
|
|
665
687
|
return;
|
|
666
688
|
}
|
|
667
|
-
await new Promise((
|
|
668
|
-
|
|
689
|
+
await new Promise((L) => requestAnimationFrame(() => L())), requestAnimationFrame(() => {
|
|
690
|
+
a(s);
|
|
669
691
|
});
|
|
670
692
|
}
|
|
671
|
-
async function p(
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
693
|
+
async function p(v) {
|
|
694
|
+
!v || v.length === 0 || (v.forEach((r) => o.add(r)), c && clearTimeout(c), c = setTimeout(() => {
|
|
695
|
+
t();
|
|
696
|
+
}, 16));
|
|
697
|
+
}
|
|
698
|
+
async function h(v, r) {
|
|
699
|
+
if (!v) return;
|
|
700
|
+
const s = n.value;
|
|
701
|
+
if (s.findIndex(($) => $.id === v.id) !== -1) return;
|
|
702
|
+
const M = [...s], g = Math.min(r, M.length);
|
|
703
|
+
M.splice(g, 0, v), n.value = M, await X(), i.value || (await new Promise(($) => requestAnimationFrame(() => $())), requestAnimationFrame(() => {
|
|
704
|
+
a(M);
|
|
678
705
|
}));
|
|
679
706
|
}
|
|
680
|
-
async function
|
|
681
|
-
var
|
|
682
|
-
if (!
|
|
683
|
-
if (!
|
|
707
|
+
async function I(v, r) {
|
|
708
|
+
var P;
|
|
709
|
+
if (!v || v.length === 0) return;
|
|
710
|
+
if (!r || r.length !== v.length) {
|
|
684
711
|
console.warn("[Masonry] restoreMany: items and indices arrays must have the same length");
|
|
685
712
|
return;
|
|
686
713
|
}
|
|
687
|
-
const
|
|
688
|
-
for (let
|
|
689
|
-
|
|
690
|
-
if (
|
|
691
|
-
const
|
|
692
|
-
for (const { item:
|
|
693
|
-
|
|
694
|
-
const
|
|
695
|
-
let
|
|
696
|
-
for (let
|
|
697
|
-
|
|
698
|
-
for (;
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
714
|
+
const s = n.value, L = new Set(s.map((z) => z.id)), M = [];
|
|
715
|
+
for (let z = 0; z < v.length; z++)
|
|
716
|
+
L.has((P = v[z]) == null ? void 0 : P.id) || M.push({ item: v[z], index: r[z] });
|
|
717
|
+
if (M.length === 0) return;
|
|
718
|
+
const g = /* @__PURE__ */ new Map();
|
|
719
|
+
for (const { item: z, index: F } of M)
|
|
720
|
+
g.set(F, z);
|
|
721
|
+
const $ = M.length > 0 ? Math.max(...M.map(({ index: z }) => z)) : -1, k = Math.max(s.length - 1, $), N = [];
|
|
722
|
+
let A = 0;
|
|
723
|
+
for (let z = 0; z <= k; z++)
|
|
724
|
+
g.has(z) ? N.push(g.get(z)) : A < s.length && (N.push(s[A]), A++);
|
|
725
|
+
for (; A < s.length; )
|
|
726
|
+
N.push(s[A]), A++;
|
|
727
|
+
n.value = N, await X(), i.value || (await new Promise((z) => requestAnimationFrame(() => z())), requestAnimationFrame(() => {
|
|
728
|
+
a(N);
|
|
702
729
|
}));
|
|
703
730
|
}
|
|
704
|
-
async function
|
|
705
|
-
|
|
731
|
+
async function S() {
|
|
732
|
+
n.value = [];
|
|
706
733
|
}
|
|
707
734
|
return {
|
|
708
|
-
remove:
|
|
709
|
-
removeMany:
|
|
710
|
-
restore:
|
|
711
|
-
restoreMany:
|
|
712
|
-
removeAll:
|
|
735
|
+
remove: w,
|
|
736
|
+
removeMany: p,
|
|
737
|
+
restore: h,
|
|
738
|
+
restoreMany: I,
|
|
739
|
+
removeAll: S
|
|
713
740
|
};
|
|
714
741
|
}
|
|
715
|
-
function
|
|
742
|
+
function ra(e) {
|
|
716
743
|
const {
|
|
717
|
-
masonry:
|
|
718
|
-
useSwipeMode:
|
|
719
|
-
container:
|
|
720
|
-
columns:
|
|
721
|
-
containerWidth:
|
|
722
|
-
masonryContentHeight:
|
|
723
|
-
layout:
|
|
724
|
-
fixedDimensions:
|
|
725
|
-
checkItemDimensions:
|
|
744
|
+
masonry: n,
|
|
745
|
+
useSwipeMode: i,
|
|
746
|
+
container: a,
|
|
747
|
+
columns: m,
|
|
748
|
+
containerWidth: d,
|
|
749
|
+
masonryContentHeight: f,
|
|
750
|
+
layout: o,
|
|
751
|
+
fixedDimensions: c,
|
|
752
|
+
checkItemDimensions: y
|
|
726
753
|
} = e;
|
|
727
|
-
let
|
|
728
|
-
function
|
|
729
|
-
const
|
|
730
|
-
let
|
|
731
|
-
if (
|
|
732
|
-
const { scrollTop:
|
|
733
|
-
|
|
754
|
+
let t = [];
|
|
755
|
+
function w(I) {
|
|
756
|
+
const S = Qt(I);
|
|
757
|
+
let v = 0;
|
|
758
|
+
if (a.value) {
|
|
759
|
+
const { scrollTop: r, clientHeight: s } = a.value;
|
|
760
|
+
v = r + s + 100;
|
|
734
761
|
}
|
|
735
|
-
|
|
762
|
+
f.value = Math.max(S, v);
|
|
736
763
|
}
|
|
737
|
-
function
|
|
738
|
-
var
|
|
739
|
-
if (
|
|
740
|
-
|
|
764
|
+
function T(I) {
|
|
765
|
+
var s, L;
|
|
766
|
+
if (i.value) {
|
|
767
|
+
n.value = I;
|
|
741
768
|
return;
|
|
742
769
|
}
|
|
743
|
-
if (!
|
|
744
|
-
if (
|
|
745
|
-
let
|
|
746
|
-
for (let
|
|
747
|
-
if (((
|
|
748
|
-
|
|
770
|
+
if (n.value = I, !a.value) return;
|
|
771
|
+
if (y(I, "refreshLayout"), I.length > 1e3 && t.length > I.length && t.length - I.length < 100) {
|
|
772
|
+
let M = !0;
|
|
773
|
+
for (let g = 0; g < I.length; g++)
|
|
774
|
+
if (((s = I[g]) == null ? void 0 : s.id) !== ((L = t[g]) == null ? void 0 : L.id)) {
|
|
775
|
+
M = !1;
|
|
749
776
|
break;
|
|
750
777
|
}
|
|
751
|
-
if (
|
|
752
|
-
const
|
|
753
|
-
...
|
|
754
|
-
originalIndex:
|
|
778
|
+
if (M) {
|
|
779
|
+
const g = I.map(($, k) => ({
|
|
780
|
+
...t[k],
|
|
781
|
+
originalIndex: k
|
|
755
782
|
}));
|
|
756
|
-
|
|
783
|
+
w(g), n.value = g, t = g;
|
|
757
784
|
return;
|
|
758
785
|
}
|
|
759
786
|
}
|
|
760
|
-
const
|
|
761
|
-
...
|
|
762
|
-
originalIndex:
|
|
763
|
-
})),
|
|
764
|
-
if (
|
|
765
|
-
const
|
|
766
|
-
|
|
767
|
-
const
|
|
768
|
-
|
|
787
|
+
const v = I.map((M, g) => ({
|
|
788
|
+
...M,
|
|
789
|
+
originalIndex: g
|
|
790
|
+
})), r = a.value;
|
|
791
|
+
if (c.value && c.value.width !== void 0) {
|
|
792
|
+
const M = r.style.width, g = r.style.boxSizing;
|
|
793
|
+
r.style.boxSizing = "border-box", r.style.width = `${c.value.width}px`, r.offsetWidth;
|
|
794
|
+
const $ = Ce(v, r, m.value, o.value);
|
|
795
|
+
r.style.width = M, r.style.boxSizing = g, w($), n.value = $, t = $;
|
|
769
796
|
} else {
|
|
770
|
-
const
|
|
771
|
-
|
|
797
|
+
const M = Ce(v, r, m.value, o.value);
|
|
798
|
+
w(M), n.value = M, t = M;
|
|
772
799
|
}
|
|
773
800
|
}
|
|
774
|
-
function
|
|
775
|
-
|
|
776
|
-
|
|
801
|
+
function p(I, S) {
|
|
802
|
+
c.value = I, I && (I.width !== void 0 && (d.value = I.width), !i.value && a.value && n.value.length > 0 && X(() => {
|
|
803
|
+
m.value = se(o.value, d.value), T(n.value), S && S();
|
|
777
804
|
}));
|
|
778
805
|
}
|
|
779
|
-
function
|
|
780
|
-
|
|
806
|
+
function h() {
|
|
807
|
+
m.value = se(o.value, d.value), T(n.value);
|
|
781
808
|
}
|
|
782
809
|
return {
|
|
783
|
-
refreshLayout:
|
|
784
|
-
setFixedDimensions:
|
|
785
|
-
onResize:
|
|
786
|
-
calculateHeight:
|
|
810
|
+
refreshLayout: T,
|
|
811
|
+
setFixedDimensions: p,
|
|
812
|
+
onResize: h,
|
|
813
|
+
calculateHeight: w
|
|
787
814
|
};
|
|
788
815
|
}
|
|
789
|
-
function
|
|
816
|
+
function ia(e) {
|
|
790
817
|
const {
|
|
791
|
-
masonry:
|
|
792
|
-
container:
|
|
793
|
-
columns:
|
|
794
|
-
virtualBufferPx:
|
|
795
|
-
loadThresholdPx:
|
|
796
|
-
} = e,
|
|
818
|
+
masonry: n,
|
|
819
|
+
container: i,
|
|
820
|
+
columns: a,
|
|
821
|
+
virtualBufferPx: m,
|
|
822
|
+
loadThresholdPx: d
|
|
823
|
+
} = e, f = W(e.handleScroll), o = W(0), c = W(0), y = m, t = W(!1), w = W({
|
|
797
824
|
distanceToTrigger: 0,
|
|
798
825
|
isNearTrigger: !1
|
|
799
|
-
}),
|
|
800
|
-
const
|
|
801
|
-
return !
|
|
802
|
-
if (typeof
|
|
826
|
+
}), T = K(() => {
|
|
827
|
+
const S = o.value - y, v = o.value + c.value + y, r = n.value;
|
|
828
|
+
return !r || r.length === 0 ? [] : r.filter((L) => {
|
|
829
|
+
if (typeof L.top != "number" || typeof L.columnHeight != "number")
|
|
803
830
|
return !0;
|
|
804
|
-
const
|
|
805
|
-
return
|
|
831
|
+
const M = L.top;
|
|
832
|
+
return L.top + L.columnHeight >= S && M <= v;
|
|
806
833
|
});
|
|
807
834
|
});
|
|
808
|
-
function
|
|
809
|
-
if (!
|
|
810
|
-
const { scrollTop:
|
|
811
|
-
|
|
812
|
-
distanceToTrigger: Math.round(
|
|
813
|
-
isNearTrigger:
|
|
835
|
+
function p(S) {
|
|
836
|
+
if (!i.value) return;
|
|
837
|
+
const { scrollTop: v, clientHeight: r } = i.value, s = v + r, L = S ?? $e(n.value, a.value), M = L.length ? Math.max(...L) : 0, g = typeof d == "number" ? d : 200, $ = g >= 0 ? Math.max(0, M - g) : Math.max(0, M + g), k = Math.max(0, $ - s), N = k <= 100;
|
|
838
|
+
w.value = {
|
|
839
|
+
distanceToTrigger: Math.round(k),
|
|
840
|
+
isNearTrigger: N
|
|
814
841
|
};
|
|
815
842
|
}
|
|
816
|
-
async function
|
|
817
|
-
if (
|
|
818
|
-
const
|
|
819
|
-
|
|
843
|
+
async function h() {
|
|
844
|
+
if (i.value) {
|
|
845
|
+
const v = i.value.scrollTop, r = i.value.clientHeight || window.innerHeight, s = r > 0 ? r : window.innerHeight;
|
|
846
|
+
o.value = v, c.value = s;
|
|
820
847
|
}
|
|
821
|
-
|
|
822
|
-
const
|
|
823
|
-
|
|
848
|
+
t.value = !0, await X(), await new Promise((v) => requestAnimationFrame(() => v())), t.value = !1;
|
|
849
|
+
const S = $e(n.value, a.value);
|
|
850
|
+
f.value(S), p(S);
|
|
824
851
|
}
|
|
825
|
-
function
|
|
826
|
-
|
|
852
|
+
function I() {
|
|
853
|
+
o.value = 0, c.value = 0, t.value = !1, w.value = {
|
|
827
854
|
distanceToTrigger: 0,
|
|
828
855
|
isNearTrigger: !1
|
|
829
856
|
};
|
|
830
857
|
}
|
|
831
858
|
return {
|
|
832
|
-
viewportTop:
|
|
833
|
-
viewportHeight:
|
|
834
|
-
virtualizing:
|
|
835
|
-
scrollProgress:
|
|
836
|
-
visibleMasonry:
|
|
837
|
-
updateScrollProgress:
|
|
838
|
-
updateViewport:
|
|
839
|
-
reset:
|
|
840
|
-
handleScroll:
|
|
859
|
+
viewportTop: o,
|
|
860
|
+
viewportHeight: c,
|
|
861
|
+
virtualizing: t,
|
|
862
|
+
scrollProgress: w,
|
|
863
|
+
visibleMasonry: T,
|
|
864
|
+
updateScrollProgress: p,
|
|
865
|
+
updateViewport: h,
|
|
866
|
+
reset: I,
|
|
867
|
+
handleScroll: f
|
|
841
868
|
};
|
|
842
869
|
}
|
|
843
|
-
function
|
|
844
|
-
const { masonry:
|
|
845
|
-
function
|
|
846
|
-
return typeof
|
|
870
|
+
function sa(e) {
|
|
871
|
+
const { masonry: n } = e, i = W(/* @__PURE__ */ new Set());
|
|
872
|
+
function a(f) {
|
|
873
|
+
return typeof f == "number" && f > 0 && Number.isFinite(f);
|
|
847
874
|
}
|
|
848
|
-
function
|
|
875
|
+
function m(f, o) {
|
|
849
876
|
try {
|
|
850
|
-
if (!Array.isArray(
|
|
851
|
-
const
|
|
852
|
-
if (
|
|
853
|
-
const
|
|
854
|
-
for (const
|
|
855
|
-
const
|
|
856
|
-
|
|
877
|
+
if (!Array.isArray(f) || f.length === 0) return;
|
|
878
|
+
const c = f.filter((t) => !a(t == null ? void 0 : t.width) || !a(t == null ? void 0 : t.height));
|
|
879
|
+
if (c.length === 0) return;
|
|
880
|
+
const y = [];
|
|
881
|
+
for (const t of c) {
|
|
882
|
+
const w = (t == null ? void 0 : t.id) ?? `idx:${n.value.indexOf(t)}`;
|
|
883
|
+
i.value.has(w) || (i.value.add(w), y.push(w));
|
|
857
884
|
}
|
|
858
|
-
if (
|
|
859
|
-
const
|
|
885
|
+
if (y.length > 0) {
|
|
886
|
+
const t = y.slice(0, 10);
|
|
860
887
|
console.warn(
|
|
861
888
|
"[Masonry] Items missing width/height detected:",
|
|
862
889
|
{
|
|
863
|
-
context:
|
|
864
|
-
count:
|
|
865
|
-
sampleIds:
|
|
890
|
+
context: o,
|
|
891
|
+
count: y.length,
|
|
892
|
+
sampleIds: t,
|
|
866
893
|
hint: "Ensure each item has positive width and height. Consider providing fallbacks (e.g., 512x512) at the data layer."
|
|
867
894
|
}
|
|
868
895
|
);
|
|
@@ -870,28 +897,28 @@ function ia(e) {
|
|
|
870
897
|
} catch {
|
|
871
898
|
}
|
|
872
899
|
}
|
|
873
|
-
function
|
|
874
|
-
|
|
900
|
+
function d() {
|
|
901
|
+
i.value.clear();
|
|
875
902
|
}
|
|
876
903
|
return {
|
|
877
|
-
checkItemDimensions:
|
|
878
|
-
invalidDimensionIds:
|
|
879
|
-
reset:
|
|
904
|
+
checkItemDimensions: m,
|
|
905
|
+
invalidDimensionIds: i,
|
|
906
|
+
reset: d
|
|
880
907
|
};
|
|
881
908
|
}
|
|
882
|
-
const
|
|
909
|
+
const ua = { class: "flex-1 relative min-h-0" }, ca = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm transition-all duration-300 bg-white relative" }, va = {
|
|
883
910
|
key: 0,
|
|
884
911
|
class: "absolute inset-0 flex flex-col items-center justify-center bg-slate-100 text-slate-400 text-sm p-4 text-center"
|
|
885
|
-
},
|
|
912
|
+
}, fa = {
|
|
886
913
|
key: 1,
|
|
887
914
|
class: "relative w-full h-full"
|
|
888
|
-
},
|
|
915
|
+
}, da = ["src"], ma = ["src", "autoplay", "controls"], ha = { class: "w-12 h-12 rounded-full bg-white/80 backdrop-blur-sm flex items-center justify-center shadow-sm" }, ga = {
|
|
889
916
|
key: 3,
|
|
890
917
|
class: "absolute bottom-2 left-1/2 transform -translate-x-1/2 flex items-center justify-center z-10"
|
|
891
|
-
},
|
|
918
|
+
}, pa = {
|
|
892
919
|
key: 4,
|
|
893
920
|
class: "absolute inset-0 flex flex-col items-center justify-center bg-slate-50 text-slate-400 text-sm p-4 text-center"
|
|
894
|
-
},
|
|
921
|
+
}, xe = /* @__PURE__ */ _e({
|
|
895
922
|
__name: "MasonryItem",
|
|
896
923
|
props: {
|
|
897
924
|
item: {},
|
|
@@ -901,284 +928,318 @@ const sa = { class: "flex-1 relative min-h-0" }, ua = { class: "w-full h-full ro
|
|
|
901
928
|
headerHeight: { default: 0 },
|
|
902
929
|
footerHeight: { default: 0 },
|
|
903
930
|
isActive: { type: Boolean, default: !1 },
|
|
904
|
-
inSwipeMode: { type: Boolean, default: !1 }
|
|
931
|
+
inSwipeMode: { type: Boolean, default: !1 },
|
|
932
|
+
preloadThreshold: { default: 1 }
|
|
905
933
|
},
|
|
906
|
-
emits: ["preload:success", "preload:error", "mouse-enter", "mouse-leave"],
|
|
907
|
-
setup(e, { emit:
|
|
908
|
-
const
|
|
909
|
-
let
|
|
910
|
-
const
|
|
911
|
-
var
|
|
912
|
-
return
|
|
913
|
-
}),
|
|
914
|
-
var
|
|
915
|
-
return
|
|
916
|
-
}),
|
|
917
|
-
function M(
|
|
918
|
-
|
|
934
|
+
emits: ["preload:success", "preload:error", "mouse-enter", "mouse-leave", "in-view", "in-view-and-loaded"],
|
|
935
|
+
setup(e, { emit: n }) {
|
|
936
|
+
const i = e, a = n, m = W(!1), d = W(!1), f = W(null), o = W(!1), c = W(!1), y = W(null), t = W(!1), w = W(!1), T = W(!1), p = W(!1), h = W(!1), I = W(null), S = W(null);
|
|
937
|
+
let v = null;
|
|
938
|
+
const r = K(() => {
|
|
939
|
+
var l;
|
|
940
|
+
return i.type ?? ((l = i.item) == null ? void 0 : l.type) ?? "image";
|
|
941
|
+
}), s = K(() => {
|
|
942
|
+
var l;
|
|
943
|
+
return i.notFound ?? ((l = i.item) == null ? void 0 : l.notFound) ?? !1;
|
|
944
|
+
}), L = K(() => !!i.inSwipeMode);
|
|
945
|
+
function M(l, x) {
|
|
946
|
+
const E = l === "image" ? m.value : o.value;
|
|
947
|
+
w.value && E && !T.value && (T.value = !0, a("in-view-and-loaded", { item: i.item, type: l, src: x }));
|
|
948
|
+
}
|
|
949
|
+
function g(l) {
|
|
950
|
+
a("mouse-enter", { item: i.item, type: l });
|
|
919
951
|
}
|
|
920
|
-
function
|
|
921
|
-
|
|
952
|
+
function $(l) {
|
|
953
|
+
a("mouse-leave", { item: i.item, type: l });
|
|
922
954
|
}
|
|
923
|
-
function
|
|
924
|
-
if (
|
|
925
|
-
const
|
|
926
|
-
|
|
955
|
+
function k(l) {
|
|
956
|
+
if (L.value) return;
|
|
957
|
+
const x = l.target;
|
|
958
|
+
x && (x.paused ? x.play() : x.pause());
|
|
927
959
|
}
|
|
928
|
-
function
|
|
929
|
-
const
|
|
930
|
-
|
|
960
|
+
function N(l) {
|
|
961
|
+
const x = l.target;
|
|
962
|
+
x && (L.value || x.play(), g("video"));
|
|
931
963
|
}
|
|
932
|
-
function
|
|
933
|
-
const
|
|
934
|
-
|
|
964
|
+
function A(l) {
|
|
965
|
+
const x = l.target;
|
|
966
|
+
x && (L.value || x.pause(), $("video"));
|
|
935
967
|
}
|
|
936
|
-
function
|
|
937
|
-
return new Promise((
|
|
938
|
-
if (!
|
|
939
|
-
const
|
|
940
|
-
|
|
968
|
+
function P(l) {
|
|
969
|
+
return new Promise((x, E) => {
|
|
970
|
+
if (!l) {
|
|
971
|
+
const b = new Error("No image source provided");
|
|
972
|
+
a("preload:error", { item: i.item, type: "image", src: l, error: b }), E(b);
|
|
941
973
|
return;
|
|
942
974
|
}
|
|
943
|
-
const
|
|
944
|
-
|
|
945
|
-
const
|
|
975
|
+
const D = new Image(), V = Date.now(), C = 300;
|
|
976
|
+
D.onload = () => {
|
|
977
|
+
const b = Date.now() - V, H = Math.max(0, C - b);
|
|
946
978
|
setTimeout(async () => {
|
|
947
|
-
|
|
948
|
-
},
|
|
949
|
-
},
|
|
950
|
-
|
|
951
|
-
const
|
|
952
|
-
|
|
953
|
-
},
|
|
979
|
+
m.value = !0, d.value = !1, p.value = !1, await X(), await new Promise((R) => setTimeout(R, 100)), h.value = !0, a("preload:success", { item: i.item, type: "image", src: l }), M("image", l), x();
|
|
980
|
+
}, H);
|
|
981
|
+
}, D.onerror = () => {
|
|
982
|
+
d.value = !0, m.value = !1, p.value = !1;
|
|
983
|
+
const b = new Error("Failed to load image");
|
|
984
|
+
a("preload:error", { item: i.item, type: "image", src: l, error: b }), E(b);
|
|
985
|
+
}, D.src = l;
|
|
954
986
|
});
|
|
955
987
|
}
|
|
956
|
-
function
|
|
957
|
-
return new Promise((
|
|
958
|
-
if (!
|
|
959
|
-
const
|
|
960
|
-
|
|
988
|
+
function z(l) {
|
|
989
|
+
return new Promise((x, E) => {
|
|
990
|
+
if (!l) {
|
|
991
|
+
const b = new Error("No video source provided");
|
|
992
|
+
a("preload:error", { item: i.item, type: "video", src: l, error: b }), E(b);
|
|
961
993
|
return;
|
|
962
994
|
}
|
|
963
|
-
const
|
|
964
|
-
|
|
965
|
-
const
|
|
995
|
+
const D = document.createElement("video"), V = Date.now(), C = 300;
|
|
996
|
+
D.preload = "metadata", D.muted = !0, D.onloadedmetadata = () => {
|
|
997
|
+
const b = Date.now() - V, H = Math.max(0, C - b);
|
|
966
998
|
setTimeout(async () => {
|
|
967
|
-
|
|
968
|
-
},
|
|
969
|
-
},
|
|
970
|
-
|
|
971
|
-
const
|
|
972
|
-
|
|
973
|
-
},
|
|
999
|
+
o.value = !0, c.value = !1, p.value = !1, await X(), await new Promise((R) => setTimeout(R, 100)), h.value = !0, a("preload:success", { item: i.item, type: "video", src: l }), M("video", l), x();
|
|
1000
|
+
}, H);
|
|
1001
|
+
}, D.onerror = () => {
|
|
1002
|
+
c.value = !0, o.value = !1, p.value = !1;
|
|
1003
|
+
const b = new Error("Failed to load video");
|
|
1004
|
+
a("preload:error", { item: i.item, type: "video", src: l, error: b }), E(b);
|
|
1005
|
+
}, D.src = l;
|
|
974
1006
|
});
|
|
975
1007
|
}
|
|
976
|
-
async function
|
|
977
|
-
var
|
|
978
|
-
if (!
|
|
1008
|
+
async function F() {
|
|
1009
|
+
var x;
|
|
1010
|
+
if (!t.value || p.value || s.value || r.value === "video" && o.value || r.value === "image" && m.value)
|
|
979
1011
|
return;
|
|
980
|
-
const
|
|
981
|
-
if (
|
|
982
|
-
if (p.value = !0,
|
|
983
|
-
|
|
1012
|
+
const l = (x = i.item) == null ? void 0 : x.src;
|
|
1013
|
+
if (l)
|
|
1014
|
+
if (p.value = !0, h.value = !1, r.value === "video") {
|
|
1015
|
+
y.value = l, o.value = !1, c.value = !1;
|
|
984
1016
|
try {
|
|
985
|
-
await
|
|
1017
|
+
await z(l);
|
|
986
1018
|
} catch {
|
|
987
1019
|
}
|
|
988
1020
|
} else {
|
|
989
|
-
|
|
1021
|
+
f.value = l, m.value = !1, d.value = !1;
|
|
990
1022
|
try {
|
|
991
|
-
await
|
|
1023
|
+
await P(l);
|
|
992
1024
|
} catch {
|
|
993
1025
|
}
|
|
994
1026
|
}
|
|
995
1027
|
}
|
|
996
|
-
return
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1028
|
+
return Xe(async () => {
|
|
1029
|
+
if (!I.value) return;
|
|
1030
|
+
const l = [i.preloadThreshold, 1].filter((E, D, V) => V.indexOf(E) === D).sort((E, D) => E - D);
|
|
1031
|
+
v = new IntersectionObserver(
|
|
1032
|
+
(E) => {
|
|
1033
|
+
E.forEach((D) => {
|
|
1034
|
+
const V = D.intersectionRatio, C = V >= 1, b = V >= i.preloadThreshold;
|
|
1035
|
+
if (C && !w.value) {
|
|
1036
|
+
w.value = !0, a("in-view", { item: i.item, type: r.value });
|
|
1037
|
+
const H = r.value === "image" ? f.value : y.value, R = r.value === "image" ? m.value : o.value;
|
|
1038
|
+
H && R && M(r.value, H);
|
|
1039
|
+
}
|
|
1040
|
+
b && !t.value ? (t.value = !0, F()) : D.isIntersecting;
|
|
1001
1041
|
});
|
|
1002
1042
|
},
|
|
1003
1043
|
{
|
|
1004
|
-
//
|
|
1005
|
-
threshold:
|
|
1044
|
+
// Trigger at both preloadThreshold and 1.0 (fully in view)
|
|
1045
|
+
threshold: l
|
|
1046
|
+
}
|
|
1047
|
+
), v.observe(I.value), await X(), requestAnimationFrame(() => {
|
|
1048
|
+
requestAnimationFrame(() => {
|
|
1049
|
+
x();
|
|
1050
|
+
});
|
|
1051
|
+
}), setTimeout(() => {
|
|
1052
|
+
x();
|
|
1053
|
+
}, 100);
|
|
1054
|
+
function x() {
|
|
1055
|
+
if (!I.value || w.value) return;
|
|
1056
|
+
const E = I.value.getBoundingClientRect(), D = window.innerHeight, V = window.innerWidth;
|
|
1057
|
+
if (E.top >= 0 && E.bottom <= D && E.left >= 0 && E.right <= V && E.height > 0 && E.width > 0) {
|
|
1058
|
+
w.value = !0, a("in-view", { item: i.item, type: r.value });
|
|
1059
|
+
const b = r.value === "image" ? f.value : y.value, H = r.value === "image" ? m.value : o.value;
|
|
1060
|
+
b && H && M(r.value, b);
|
|
1006
1061
|
}
|
|
1007
|
-
|
|
1008
|
-
}),
|
|
1009
|
-
|
|
1010
|
-
}),
|
|
1062
|
+
}
|
|
1063
|
+
}), Ge(() => {
|
|
1064
|
+
v && (v.disconnect(), v = null);
|
|
1065
|
+
}), ee(
|
|
1011
1066
|
() => {
|
|
1012
|
-
var
|
|
1013
|
-
return (
|
|
1067
|
+
var l;
|
|
1068
|
+
return (l = i.item) == null ? void 0 : l.src;
|
|
1014
1069
|
},
|
|
1015
|
-
async (
|
|
1016
|
-
if (!(!
|
|
1017
|
-
if (
|
|
1018
|
-
if (
|
|
1070
|
+
async (l) => {
|
|
1071
|
+
if (!(!l || s.value)) {
|
|
1072
|
+
if (r.value === "video") {
|
|
1073
|
+
if (l !== y.value && (o.value = !1, c.value = !1, y.value = l, t.value)) {
|
|
1019
1074
|
p.value = !0;
|
|
1020
1075
|
try {
|
|
1021
|
-
await
|
|
1076
|
+
await z(l);
|
|
1022
1077
|
} catch {
|
|
1023
1078
|
}
|
|
1024
1079
|
}
|
|
1025
|
-
} else if (
|
|
1080
|
+
} else if (l !== f.value && (m.value = !1, d.value = !1, f.value = l, t.value)) {
|
|
1026
1081
|
p.value = !0;
|
|
1027
1082
|
try {
|
|
1028
|
-
await
|
|
1083
|
+
await P(l);
|
|
1029
1084
|
} catch {
|
|
1030
1085
|
}
|
|
1031
1086
|
}
|
|
1032
1087
|
}
|
|
1033
1088
|
}
|
|
1034
|
-
),
|
|
1035
|
-
() =>
|
|
1036
|
-
(
|
|
1037
|
-
!
|
|
1089
|
+
), ee(
|
|
1090
|
+
() => i.isActive,
|
|
1091
|
+
(l) => {
|
|
1092
|
+
!L.value || !S.value || (l ? S.value.play() : S.value.pause());
|
|
1038
1093
|
}
|
|
1039
|
-
), (
|
|
1094
|
+
), (l, x) => (Y(), q("div", {
|
|
1040
1095
|
ref_key: "containerRef",
|
|
1041
|
-
ref:
|
|
1096
|
+
ref: I,
|
|
1042
1097
|
class: "relative w-full h-full flex flex-col"
|
|
1043
1098
|
}, [
|
|
1044
|
-
|
|
1099
|
+
l.headerHeight > 0 ? (Y(), q("div", {
|
|
1045
1100
|
key: 0,
|
|
1046
1101
|
class: "relative z-10",
|
|
1047
|
-
style:
|
|
1102
|
+
style: he({ height: `${l.headerHeight}px` })
|
|
1048
1103
|
}, [
|
|
1049
|
-
|
|
1050
|
-
item:
|
|
1051
|
-
remove:
|
|
1052
|
-
imageLoaded:
|
|
1053
|
-
imageError:
|
|
1054
|
-
videoLoaded:
|
|
1055
|
-
videoError:
|
|
1056
|
-
showNotFound:
|
|
1104
|
+
J(l.$slots, "header", {
|
|
1105
|
+
item: l.item,
|
|
1106
|
+
remove: l.remove,
|
|
1107
|
+
imageLoaded: m.value,
|
|
1108
|
+
imageError: d.value,
|
|
1109
|
+
videoLoaded: o.value,
|
|
1110
|
+
videoError: c.value,
|
|
1111
|
+
showNotFound: s.value,
|
|
1057
1112
|
isLoading: p.value,
|
|
1058
|
-
mediaType:
|
|
1113
|
+
mediaType: r.value,
|
|
1114
|
+
isFullyInView: w.value
|
|
1059
1115
|
})
|
|
1060
|
-
], 4)) :
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
item:
|
|
1064
|
-
remove:
|
|
1065
|
-
imageLoaded:
|
|
1066
|
-
imageError:
|
|
1067
|
-
videoLoaded:
|
|
1068
|
-
videoError:
|
|
1069
|
-
showNotFound:
|
|
1116
|
+
], 4)) : te("", !0),
|
|
1117
|
+
U("div", ua, [
|
|
1118
|
+
J(l.$slots, "default", {
|
|
1119
|
+
item: l.item,
|
|
1120
|
+
remove: l.remove,
|
|
1121
|
+
imageLoaded: m.value,
|
|
1122
|
+
imageError: d.value,
|
|
1123
|
+
videoLoaded: o.value,
|
|
1124
|
+
videoError: c.value,
|
|
1125
|
+
showNotFound: s.value,
|
|
1070
1126
|
isLoading: p.value,
|
|
1071
|
-
mediaType:
|
|
1072
|
-
imageSrc:
|
|
1073
|
-
videoSrc:
|
|
1074
|
-
showMedia:
|
|
1127
|
+
mediaType: r.value,
|
|
1128
|
+
imageSrc: f.value,
|
|
1129
|
+
videoSrc: y.value,
|
|
1130
|
+
showMedia: h.value,
|
|
1131
|
+
isFullyInView: w.value
|
|
1075
1132
|
}, () => [
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
]))) : (
|
|
1082
|
-
|
|
1133
|
+
U("div", ca, [
|
|
1134
|
+
s.value ? (Y(), q("div", va, x[3] || (x[3] = [
|
|
1135
|
+
U("i", { class: "fas fa-search text-3xl mb-3 opacity-50" }, null, -1),
|
|
1136
|
+
U("span", { class: "font-medium" }, "Not Found", -1),
|
|
1137
|
+
U("span", { class: "text-xs mt-1 opacity-75" }, "This item could not be located", -1)
|
|
1138
|
+
]))) : (Y(), q("div", fa, [
|
|
1139
|
+
r.value === "image" && f.value ? (Y(), q("img", {
|
|
1083
1140
|
key: 0,
|
|
1084
|
-
src:
|
|
1141
|
+
src: f.value,
|
|
1085
1142
|
class: re([
|
|
1086
1143
|
"w-full h-full object-cover transition-opacity duration-700 ease-in-out",
|
|
1087
|
-
|
|
1144
|
+
m.value && h.value ? "opacity-100" : "opacity-0"
|
|
1088
1145
|
]),
|
|
1089
1146
|
style: { position: "absolute", top: "0", left: "0" },
|
|
1090
1147
|
loading: "lazy",
|
|
1091
1148
|
decoding: "async",
|
|
1092
1149
|
alt: "",
|
|
1093
|
-
onMouseenter:
|
|
1094
|
-
onMouseleave:
|
|
1095
|
-
}, null, 42,
|
|
1096
|
-
|
|
1150
|
+
onMouseenter: x[0] || (x[0] = (E) => g("image")),
|
|
1151
|
+
onMouseleave: x[1] || (x[1] = (E) => $("image"))
|
|
1152
|
+
}, null, 42, da)) : te("", !0),
|
|
1153
|
+
r.value === "video" && y.value ? (Y(), q("video", {
|
|
1097
1154
|
key: 1,
|
|
1098
1155
|
ref_key: "videoEl",
|
|
1099
|
-
ref:
|
|
1100
|
-
src:
|
|
1156
|
+
ref: S,
|
|
1157
|
+
src: y.value,
|
|
1101
1158
|
class: re([
|
|
1102
1159
|
"w-full h-full object-cover transition-opacity duration-700 ease-in-out",
|
|
1103
|
-
|
|
1160
|
+
o.value && h.value ? "opacity-100" : "opacity-0"
|
|
1104
1161
|
]),
|
|
1105
1162
|
style: { position: "absolute", top: "0", left: "0" },
|
|
1106
1163
|
muted: "",
|
|
1107
1164
|
loop: "",
|
|
1108
1165
|
playsinline: "",
|
|
1109
|
-
autoplay:
|
|
1110
|
-
controls:
|
|
1111
|
-
onClick:
|
|
1112
|
-
onTouchend:
|
|
1113
|
-
onMouseenter:
|
|
1114
|
-
onMouseleave:
|
|
1115
|
-
onError:
|
|
1116
|
-
}, null, 42,
|
|
1117
|
-
!
|
|
1166
|
+
autoplay: L.value && i.isActive,
|
|
1167
|
+
controls: L.value,
|
|
1168
|
+
onClick: Ae(k, ["stop"]),
|
|
1169
|
+
onTouchend: Ae(k, ["stop", "prevent"]),
|
|
1170
|
+
onMouseenter: N,
|
|
1171
|
+
onMouseleave: A,
|
|
1172
|
+
onError: x[2] || (x[2] = (E) => c.value = !0)
|
|
1173
|
+
}, null, 42, ma)) : te("", !0),
|
|
1174
|
+
!m.value && !o.value && !d.value && !c.value ? (Y(), q("div", {
|
|
1118
1175
|
key: 2,
|
|
1119
1176
|
class: re([
|
|
1120
1177
|
"absolute inset-0 bg-slate-100 flex items-center justify-center transition-opacity duration-500",
|
|
1121
|
-
|
|
1178
|
+
h.value ? "opacity-0 pointer-events-none" : "opacity-100"
|
|
1122
1179
|
])
|
|
1123
1180
|
}, [
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
class: re(
|
|
1181
|
+
U("div", ha, [
|
|
1182
|
+
J(l.$slots, "placeholder-icon", { mediaType: r.value }, () => [
|
|
1183
|
+
U("i", {
|
|
1184
|
+
class: re(r.value === "video" ? "fas fa-video text-xl text-slate-400" : "fas fa-image text-xl text-slate-400")
|
|
1128
1185
|
}, null, 2)
|
|
1129
1186
|
])
|
|
1130
1187
|
])
|
|
1131
|
-
], 2)) :
|
|
1132
|
-
p.value ? (
|
|
1133
|
-
|
|
1134
|
-
|
|
1188
|
+
], 2)) : te("", !0),
|
|
1189
|
+
p.value ? (Y(), q("div", ga, x[4] || (x[4] = [
|
|
1190
|
+
U("div", { class: "bg-white/90 backdrop-blur-sm rounded-full px-3 py-1.5 shadow-sm" }, [
|
|
1191
|
+
U("div", { class: "animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500" })
|
|
1135
1192
|
], -1)
|
|
1136
|
-
]))) :
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
class: re(
|
|
1193
|
+
]))) : te("", !0),
|
|
1194
|
+
r.value === "image" && d.value || r.value === "video" && c.value ? (Y(), q("div", pa, [
|
|
1195
|
+
U("i", {
|
|
1196
|
+
class: re(r.value === "video" ? "fas fa-video text-2xl mb-2 opacity-50" : "fas fa-image text-2xl mb-2 opacity-50")
|
|
1140
1197
|
}, null, 2),
|
|
1141
|
-
|
|
1142
|
-
])) :
|
|
1198
|
+
U("span", null, "Failed to load " + Pe(r.value), 1)
|
|
1199
|
+
])) : te("", !0)
|
|
1143
1200
|
]))
|
|
1144
1201
|
])
|
|
1145
1202
|
])
|
|
1146
1203
|
]),
|
|
1147
|
-
|
|
1204
|
+
l.footerHeight > 0 ? (Y(), q("div", {
|
|
1148
1205
|
key: 1,
|
|
1149
1206
|
class: "relative z-10",
|
|
1150
|
-
style:
|
|
1207
|
+
style: he({ height: `${l.footerHeight}px` })
|
|
1151
1208
|
}, [
|
|
1152
|
-
|
|
1153
|
-
item:
|
|
1154
|
-
remove:
|
|
1155
|
-
imageLoaded:
|
|
1156
|
-
imageError:
|
|
1157
|
-
videoLoaded:
|
|
1158
|
-
videoError:
|
|
1159
|
-
showNotFound:
|
|
1209
|
+
J(l.$slots, "footer", {
|
|
1210
|
+
item: l.item,
|
|
1211
|
+
remove: l.remove,
|
|
1212
|
+
imageLoaded: m.value,
|
|
1213
|
+
imageError: d.value,
|
|
1214
|
+
videoLoaded: o.value,
|
|
1215
|
+
videoError: c.value,
|
|
1216
|
+
showNotFound: s.value,
|
|
1160
1217
|
isLoading: p.value,
|
|
1161
|
-
mediaType:
|
|
1218
|
+
mediaType: r.value,
|
|
1219
|
+
isFullyInView: w.value
|
|
1162
1220
|
})
|
|
1163
|
-
], 4)) :
|
|
1221
|
+
], 4)) : te("", !0)
|
|
1164
1222
|
], 512));
|
|
1165
1223
|
}
|
|
1166
|
-
}),
|
|
1224
|
+
}), ya = {
|
|
1225
|
+
key: 0,
|
|
1226
|
+
class: "w-full h-full flex items-center justify-center"
|
|
1227
|
+
}, wa = { class: "w-full h-full flex items-center justify-center p-4" }, xa = { class: "w-full h-full max-w-full max-h-full relative" }, ba = {
|
|
1167
1228
|
key: 0,
|
|
1168
1229
|
class: "w-full py-8 text-center"
|
|
1169
|
-
},
|
|
1230
|
+
}, Ma = {
|
|
1170
1231
|
key: 1,
|
|
1171
1232
|
class: "w-full py-8 text-center"
|
|
1172
|
-
},
|
|
1233
|
+
}, Ta = { class: "text-red-500 dark:text-red-400" }, Ia = {
|
|
1173
1234
|
key: 0,
|
|
1174
1235
|
class: "w-full py-8 text-center"
|
|
1175
|
-
},
|
|
1236
|
+
}, La = {
|
|
1176
1237
|
key: 1,
|
|
1177
1238
|
class: "w-full py-8 text-center"
|
|
1178
|
-
},
|
|
1239
|
+
}, Sa = { class: "text-red-500 dark:text-red-400" }, ka = /* @__PURE__ */ _e({
|
|
1179
1240
|
__name: "Masonry",
|
|
1180
1241
|
props: {
|
|
1181
|
-
|
|
1242
|
+
getPage: {
|
|
1182
1243
|
type: Function,
|
|
1183
1244
|
default: () => {
|
|
1184
1245
|
}
|
|
@@ -1191,6 +1252,12 @@ const sa = { class: "flex-1 relative min-h-0" }, ua = { class: "w-full h-full ro
|
|
|
1191
1252
|
type: Array,
|
|
1192
1253
|
default: () => []
|
|
1193
1254
|
},
|
|
1255
|
+
// Opaque caller-owned context passed through to getPage(page, context).
|
|
1256
|
+
// Useful for including filters, service selection, tabId, etc.
|
|
1257
|
+
context: {
|
|
1258
|
+
type: Object,
|
|
1259
|
+
default: null
|
|
1260
|
+
},
|
|
1194
1261
|
layout: {
|
|
1195
1262
|
type: Object
|
|
1196
1263
|
},
|
|
@@ -1200,27 +1267,20 @@ const sa = { class: "flex-1 relative min-h-0" }, ua = { class: "w-full h-full ro
|
|
|
1200
1267
|
// or 'cursor'
|
|
1201
1268
|
validator: (e) => ["page", "cursor"].includes(e)
|
|
1202
1269
|
},
|
|
1203
|
-
|
|
1204
|
-
type:
|
|
1205
|
-
default:
|
|
1206
|
-
|
|
1207
|
-
// Initial pagination state when skipInitialLoad is true and items are provided
|
|
1208
|
-
initialPage: {
|
|
1209
|
-
type: [Number, String],
|
|
1210
|
-
default: null
|
|
1211
|
-
},
|
|
1212
|
-
initialNextPage: {
|
|
1213
|
-
type: [Number, String],
|
|
1214
|
-
default: null
|
|
1270
|
+
init: {
|
|
1271
|
+
type: String,
|
|
1272
|
+
default: "manual",
|
|
1273
|
+
validator: (e) => ["auto", "manual"].includes(e)
|
|
1215
1274
|
},
|
|
1216
1275
|
pageSize: {
|
|
1217
1276
|
type: Number,
|
|
1218
1277
|
default: 40
|
|
1219
1278
|
},
|
|
1220
1279
|
// Backfill configuration
|
|
1221
|
-
|
|
1222
|
-
type:
|
|
1223
|
-
default:
|
|
1280
|
+
mode: {
|
|
1281
|
+
type: String,
|
|
1282
|
+
default: "backfill",
|
|
1283
|
+
validator: (e) => ["backfill", "none", "refresh"].includes(e)
|
|
1224
1284
|
},
|
|
1225
1285
|
backfillDelayMs: {
|
|
1226
1286
|
type: Number,
|
|
@@ -1269,10 +1329,6 @@ const sa = { class: "flex-1 relative min-h-0" }, ua = { class: "w-full h-full ro
|
|
|
1269
1329
|
type: Number,
|
|
1270
1330
|
default: 200
|
|
1271
1331
|
},
|
|
1272
|
-
autoRefreshOnEmpty: {
|
|
1273
|
-
type: Boolean,
|
|
1274
|
-
default: !1
|
|
1275
|
-
},
|
|
1276
1332
|
// Layout mode: 'auto' (detect from screen size), 'masonry', or 'swipe'
|
|
1277
1333
|
layoutMode: {
|
|
1278
1334
|
type: String,
|
|
@@ -1288,22 +1344,25 @@ const sa = { class: "flex-1 relative min-h-0" }, ua = { class: "w-full h-full ro
|
|
|
1288
1344
|
},
|
|
1289
1345
|
emits: [
|
|
1290
1346
|
"update:items",
|
|
1347
|
+
"loading:start",
|
|
1291
1348
|
"backfill:start",
|
|
1292
1349
|
"backfill:tick",
|
|
1293
1350
|
"backfill:stop",
|
|
1294
1351
|
"retry:start",
|
|
1295
1352
|
"retry:tick",
|
|
1296
1353
|
"retry:stop",
|
|
1354
|
+
"loading:stop",
|
|
1297
1355
|
"remove-all:complete",
|
|
1298
1356
|
// Re-emit item-level preload events from the default MasonryItem
|
|
1299
1357
|
"item:preload:success",
|
|
1300
1358
|
"item:preload:error",
|
|
1301
1359
|
// Mouse events from MasonryItem content
|
|
1302
1360
|
"item:mouse-enter",
|
|
1303
|
-
"item:mouse-leave"
|
|
1361
|
+
"item:mouse-leave",
|
|
1362
|
+
"update:context"
|
|
1304
1363
|
],
|
|
1305
|
-
setup(e, { expose:
|
|
1306
|
-
const
|
|
1364
|
+
setup(e, { expose: n, emit: i }) {
|
|
1365
|
+
const a = e, m = {
|
|
1307
1366
|
sizes: { base: 1, sm: 2, md: 3, lg: 4, xl: 5, "2xl": 6 },
|
|
1308
1367
|
gutterX: 10,
|
|
1309
1368
|
gutterY: 10,
|
|
@@ -1312,314 +1371,337 @@ const sa = { class: "flex-1 relative min-h-0" }, ua = { class: "w-full h-full ro
|
|
|
1312
1371
|
paddingLeft: 0,
|
|
1313
1372
|
paddingRight: 0,
|
|
1314
1373
|
placement: "masonry"
|
|
1315
|
-
},
|
|
1316
|
-
var
|
|
1374
|
+
}, d = K(() => {
|
|
1375
|
+
var u;
|
|
1317
1376
|
return {
|
|
1318
|
-
...
|
|
1319
|
-
...
|
|
1377
|
+
...m,
|
|
1378
|
+
...a.layout,
|
|
1320
1379
|
sizes: {
|
|
1321
|
-
...
|
|
1322
|
-
...((
|
|
1380
|
+
...m.sizes,
|
|
1381
|
+
...((u = a.layout) == null ? void 0 : u.sizes) || {}
|
|
1323
1382
|
}
|
|
1324
1383
|
};
|
|
1325
|
-
}),
|
|
1326
|
-
let
|
|
1327
|
-
function
|
|
1384
|
+
}), f = W(null), o = W(typeof window < "u" ? window.innerWidth : 1024), c = W(typeof window < "u" ? window.innerHeight : 768), y = W(null);
|
|
1385
|
+
let t = null;
|
|
1386
|
+
function w(u) {
|
|
1328
1387
|
return {
|
|
1329
1388
|
sm: 640,
|
|
1330
1389
|
md: 768,
|
|
1331
1390
|
lg: 1024,
|
|
1332
1391
|
xl: 1280,
|
|
1333
1392
|
"2xl": 1536
|
|
1334
|
-
}[
|
|
1393
|
+
}[u] || 768;
|
|
1394
|
+
}
|
|
1395
|
+
const T = K(() => {
|
|
1396
|
+
if (a.layoutMode === "masonry") return !1;
|
|
1397
|
+
if (a.layoutMode === "swipe") return !0;
|
|
1398
|
+
const u = typeof a.mobileBreakpoint == "string" ? w(a.mobileBreakpoint) : a.mobileBreakpoint;
|
|
1399
|
+
return o.value < u;
|
|
1400
|
+
}), p = i, h = K({
|
|
1401
|
+
get: () => a.items,
|
|
1402
|
+
set: (u) => p("update:items", u)
|
|
1403
|
+
}), I = K({
|
|
1404
|
+
get: () => a.context,
|
|
1405
|
+
set: (u) => p("update:context", u)
|
|
1406
|
+
});
|
|
1407
|
+
function S(u) {
|
|
1408
|
+
I.value = u;
|
|
1335
1409
|
}
|
|
1336
|
-
const
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
}),
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
masonry: s,
|
|
1358
|
-
container: a,
|
|
1359
|
-
columns: m,
|
|
1360
|
-
virtualBufferPx: t.virtualBufferPx,
|
|
1361
|
-
loadThresholdPx: t.loadThresholdPx,
|
|
1410
|
+
const v = K(() => {
|
|
1411
|
+
const u = h.value;
|
|
1412
|
+
return (u == null ? void 0 : u.length) ?? 0;
|
|
1413
|
+
}), r = W(7), s = W(null), L = W([]), M = W(null), g = W(!1), $ = W(0), k = W(!1), N = W(null), A = W(!1), P = K(() => Kt(o.value)), z = sa({
|
|
1414
|
+
masonry: h
|
|
1415
|
+
}), { checkItemDimensions: F, reset: l } = z, x = ra({
|
|
1416
|
+
masonry: h,
|
|
1417
|
+
useSwipeMode: T,
|
|
1418
|
+
container: s,
|
|
1419
|
+
columns: r,
|
|
1420
|
+
containerWidth: o,
|
|
1421
|
+
masonryContentHeight: $,
|
|
1422
|
+
layout: d,
|
|
1423
|
+
fixedDimensions: y,
|
|
1424
|
+
checkItemDimensions: F
|
|
1425
|
+
}), { refreshLayout: E, setFixedDimensions: D, onResize: V } = x, C = ia({
|
|
1426
|
+
masonry: h,
|
|
1427
|
+
container: s,
|
|
1428
|
+
columns: r,
|
|
1429
|
+
virtualBufferPx: a.virtualBufferPx,
|
|
1430
|
+
loadThresholdPx: a.loadThresholdPx,
|
|
1362
1431
|
handleScroll: () => {
|
|
1363
1432
|
}
|
|
1364
1433
|
// Will be set after pagination is initialized
|
|
1365
|
-
}), { viewportTop:
|
|
1366
|
-
{ container:
|
|
1367
|
-
{ leaveDurationMs:
|
|
1368
|
-
),
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
emits:
|
|
1386
|
-
}), { loadPage:
|
|
1387
|
-
useSwipeMode:
|
|
1388
|
-
masonry:
|
|
1389
|
-
isLoading:
|
|
1390
|
-
loadNext:
|
|
1391
|
-
loadPage:
|
|
1392
|
-
paginationHistory:
|
|
1393
|
-
}), { handleScroll:
|
|
1394
|
-
container:
|
|
1395
|
-
masonry:
|
|
1396
|
-
columns:
|
|
1397
|
-
containerHeight:
|
|
1398
|
-
isLoading:
|
|
1399
|
-
pageSize:
|
|
1400
|
-
refreshLayout:
|
|
1401
|
-
setItemsRaw: (
|
|
1402
|
-
|
|
1434
|
+
}), { viewportTop: b, viewportHeight: H, virtualizing: R, visibleMasonry: ne, updateScrollProgress: _, updateViewport: ie, reset: Q } = C, { onEnter: Qe, onBeforeEnter: Ze, onBeforeLeave: et, onLeave: tt } = ta(
|
|
1435
|
+
{ container: s },
|
|
1436
|
+
{ leaveDurationMs: a.leaveDurationMs, virtualizing: R }
|
|
1437
|
+
), at = Qe, nt = Ze, lt = et, ot = tt, rt = la({
|
|
1438
|
+
getPage: a.getPage,
|
|
1439
|
+
context: I,
|
|
1440
|
+
masonry: h,
|
|
1441
|
+
isLoading: g,
|
|
1442
|
+
hasReachedEnd: k,
|
|
1443
|
+
loadError: N,
|
|
1444
|
+
currentPage: M,
|
|
1445
|
+
paginationHistory: L,
|
|
1446
|
+
refreshLayout: E,
|
|
1447
|
+
retryMaxAttempts: a.retryMaxAttempts,
|
|
1448
|
+
retryInitialDelayMs: a.retryInitialDelayMs,
|
|
1449
|
+
retryBackoffStepMs: a.retryBackoffStepMs,
|
|
1450
|
+
mode: a.mode,
|
|
1451
|
+
backfillDelayMs: a.backfillDelayMs,
|
|
1452
|
+
backfillMaxCalls: a.backfillMaxCalls,
|
|
1453
|
+
pageSize: a.pageSize,
|
|
1454
|
+
emits: p
|
|
1455
|
+
}), { loadPage: be, loadNext: ge, refreshCurrentPage: it, cancelLoad: Me, maybeBackfillToTarget: st } = rt, Z = na({
|
|
1456
|
+
useSwipeMode: T,
|
|
1457
|
+
masonry: h,
|
|
1458
|
+
isLoading: g,
|
|
1459
|
+
loadNext: ge,
|
|
1460
|
+
loadPage: be,
|
|
1461
|
+
paginationHistory: L
|
|
1462
|
+
}), { handleScroll: ut } = aa({
|
|
1463
|
+
container: s,
|
|
1464
|
+
masonry: h,
|
|
1465
|
+
columns: r,
|
|
1466
|
+
containerHeight: $,
|
|
1467
|
+
isLoading: g,
|
|
1468
|
+
pageSize: a.pageSize,
|
|
1469
|
+
refreshLayout: E,
|
|
1470
|
+
setItemsRaw: (u) => {
|
|
1471
|
+
h.value = u;
|
|
1403
1472
|
},
|
|
1404
|
-
loadNext:
|
|
1405
|
-
loadThresholdPx:
|
|
1473
|
+
loadNext: ge,
|
|
1474
|
+
loadThresholdPx: a.loadThresholdPx
|
|
1406
1475
|
});
|
|
1407
|
-
C.handleScroll.value =
|
|
1408
|
-
const
|
|
1409
|
-
masonry:
|
|
1410
|
-
useSwipeMode:
|
|
1411
|
-
refreshLayout:
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
function gt(c) {
|
|
1419
|
-
E(c, D), !c && h.value && (i.value = h.value.clientWidth, w.value = h.value.clientHeight);
|
|
1476
|
+
C.handleScroll.value = ut;
|
|
1477
|
+
const ct = oa({
|
|
1478
|
+
masonry: h,
|
|
1479
|
+
useSwipeMode: T,
|
|
1480
|
+
refreshLayout: E,
|
|
1481
|
+
loadNext: ge,
|
|
1482
|
+
maybeBackfillToTarget: st,
|
|
1483
|
+
paginationHistory: L
|
|
1484
|
+
}), { remove: ue, removeMany: vt, restore: ft, restoreMany: dt, removeAll: mt } = ct;
|
|
1485
|
+
function ht(u) {
|
|
1486
|
+
D(u, _), !u && f.value && (o.value = f.value.clientWidth, c.value = f.value.clientHeight);
|
|
1420
1487
|
}
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
//
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1488
|
+
n({
|
|
1489
|
+
// Cancels any ongoing load operations (page loads, backfills, etc.)
|
|
1490
|
+
cancelLoad: Me,
|
|
1491
|
+
// Opaque caller context passed through to getPage(page, context). Useful for including filters, service selection, tabId, etc.
|
|
1492
|
+
context: I,
|
|
1493
|
+
// Container height (wrapper element) in pixels
|
|
1494
|
+
containerHeight: c,
|
|
1495
|
+
// Container width (wrapper element) in pixels
|
|
1496
|
+
containerWidth: o,
|
|
1497
|
+
// Current Tailwind breakpoint name (base, sm, md, lg, xl, 2xl) based on containerWidth
|
|
1498
|
+
currentBreakpoint: P,
|
|
1499
|
+
// Current page number or cursor being displayed
|
|
1500
|
+
currentPage: M,
|
|
1501
|
+
// Completely destroys the component, clearing all state and resetting to initial state
|
|
1502
|
+
destroy: Mt,
|
|
1503
|
+
// Boolean indicating if the end of the list has been reached (no more pages to load)
|
|
1504
|
+
hasReachedEnd: k,
|
|
1505
|
+
// Initializes the component with items, page, and next page cursor. Use this for manual init mode.
|
|
1506
|
+
initialize: Tt,
|
|
1507
|
+
// Boolean indicating if the component has been initialized (first content has loaded)
|
|
1508
|
+
isInitialized: A,
|
|
1509
|
+
// Boolean indicating if a page load or backfill operation is currently in progress
|
|
1510
|
+
isLoading: g,
|
|
1511
|
+
// Error object if the last load operation failed, null otherwise
|
|
1512
|
+
loadError: N,
|
|
1513
|
+
// Loads the next page of items asynchronously
|
|
1514
|
+
loadNext: ge,
|
|
1515
|
+
// Loads a specific page number or cursor asynchronously
|
|
1516
|
+
loadPage: be,
|
|
1517
|
+
// Array tracking pagination history (pages/cursors that have been loaded)
|
|
1518
|
+
paginationHistory: L,
|
|
1519
|
+
// Refreshes the current page by clearing items and reloading from the current page
|
|
1520
|
+
refreshCurrentPage: it,
|
|
1521
|
+
// Recalculates the layout positions for all items. Call this after manually modifying items.
|
|
1522
|
+
refreshLayout: E,
|
|
1523
|
+
// Removes a single item from the masonry
|
|
1524
|
+
remove: ue,
|
|
1525
|
+
// Removes all items from the masonry
|
|
1439
1526
|
removeAll: mt,
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
scrollToTop:
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1527
|
+
// Removes multiple items from the masonry in a single operation
|
|
1528
|
+
removeMany: vt,
|
|
1529
|
+
// Resets the component to initial state (clears items, resets pagination, scrolls to top)
|
|
1530
|
+
reset: bt,
|
|
1531
|
+
// Restores a single item at its original index (useful for undo operations)
|
|
1532
|
+
restore: ft,
|
|
1533
|
+
// Restores multiple items at their original indices (useful for undo operations)
|
|
1534
|
+
restoreMany: dt,
|
|
1535
|
+
// Scrolls the container to a specific position
|
|
1536
|
+
scrollTo: wt,
|
|
1537
|
+
// Scrolls the container to the top
|
|
1538
|
+
scrollToTop: yt,
|
|
1539
|
+
// Sets the opaque caller context (alternative to v-model:context)
|
|
1540
|
+
setContext: S,
|
|
1541
|
+
// Sets fixed dimensions for the container, overriding ResizeObserver. Pass null to restore automatic sizing.
|
|
1542
|
+
setFixedDimensions: ht,
|
|
1543
|
+
// Computed property returning the total number of items currently in the masonry
|
|
1544
|
+
totalItems: K(() => h.value.length)
|
|
1455
1545
|
});
|
|
1456
|
-
const
|
|
1457
|
-
function
|
|
1458
|
-
|
|
1546
|
+
const ce = Z.currentSwipeIndex, pe = Z.swipeOffset, ye = Z.isDragging, le = Z.swipeContainer, Fe = Z.handleTouchStart, ze = Z.handleTouchMove, De = Z.handleTouchEnd, Be = Z.handleMouseDown, Te = Z.handleMouseMove, Ie = Z.handleMouseUp, Le = Z.snapToCurrentItem;
|
|
1547
|
+
function gt(u) {
|
|
1548
|
+
const B = v.value, j = typeof u == "string" ? parseInt(u, 10) : u;
|
|
1549
|
+
return B > 0 ? `${j * (100 / B)}%` : "0%";
|
|
1550
|
+
}
|
|
1551
|
+
function pt() {
|
|
1552
|
+
const u = v.value;
|
|
1553
|
+
return u > 0 ? `${100 / u}%` : "0%";
|
|
1554
|
+
}
|
|
1555
|
+
function yt(u) {
|
|
1556
|
+
s.value && s.value.scrollTo({
|
|
1459
1557
|
top: 0,
|
|
1460
|
-
behavior: (
|
|
1461
|
-
...
|
|
1558
|
+
behavior: (u == null ? void 0 : u.behavior) ?? "smooth",
|
|
1559
|
+
...u
|
|
1462
1560
|
});
|
|
1463
1561
|
}
|
|
1464
|
-
function
|
|
1465
|
-
|
|
1466
|
-
top:
|
|
1467
|
-
left:
|
|
1468
|
-
behavior:
|
|
1469
|
-
}),
|
|
1470
|
-
}
|
|
1471
|
-
function wt() {
|
|
1472
|
-
$(), a.value && (A.value = a.value.scrollTop, N.value = a.value.clientHeight);
|
|
1562
|
+
function wt(u) {
|
|
1563
|
+
s.value && (s.value.scrollTo({
|
|
1564
|
+
top: u.top ?? s.value.scrollTop,
|
|
1565
|
+
left: u.left ?? s.value.scrollLeft,
|
|
1566
|
+
behavior: u.behavior ?? "auto"
|
|
1567
|
+
}), s.value && (b.value = s.value.scrollTop, H.value = s.value.clientHeight || window.innerHeight));
|
|
1473
1568
|
}
|
|
1474
1569
|
function xt() {
|
|
1475
|
-
|
|
1570
|
+
V(), s.value && (b.value = s.value.scrollTop, H.value = s.value.clientHeight);
|
|
1571
|
+
}
|
|
1572
|
+
function bt() {
|
|
1573
|
+
Me(), s.value && s.value.scrollTo({
|
|
1476
1574
|
top: 0,
|
|
1477
1575
|
behavior: "smooth"
|
|
1478
|
-
}),
|
|
1576
|
+
}), h.value = [], c.value = 0, M.value = a.loadAtPage, L.value = [a.loadAtPage], k.value = !1, N.value = null, A.value = !1, Q();
|
|
1479
1577
|
}
|
|
1480
|
-
function
|
|
1481
|
-
|
|
1578
|
+
function Mt() {
|
|
1579
|
+
Me(), h.value = [], $.value = 0, M.value = null, L.value = [], k.value = !1, N.value = null, g.value = !1, A.value = !1, ce.value = 0, pe.value = 0, ye.value = !1, Q(), l(), s.value && s.value.scrollTo({
|
|
1482
1580
|
top: 0,
|
|
1483
1581
|
behavior: "auto"
|
|
1484
1582
|
// Instant scroll for destroy
|
|
1485
1583
|
});
|
|
1486
1584
|
}
|
|
1487
|
-
const oe =
|
|
1488
|
-
|
|
1489
|
-
}, 200),
|
|
1490
|
-
function
|
|
1491
|
-
|
|
1585
|
+
const oe = Ye(async () => {
|
|
1586
|
+
T.value || await ie();
|
|
1587
|
+
}, 200), Ne = Ye(xt, 200);
|
|
1588
|
+
function We() {
|
|
1589
|
+
Z.handleWindowResize();
|
|
1492
1590
|
}
|
|
1493
|
-
function
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1591
|
+
function Tt(u, B, j) {
|
|
1592
|
+
M.value = B, L.value = [B], j != null && L.value.push(j), k.value = j === null, F(u, "initialize");
|
|
1593
|
+
const ae = h.value, O = ae.length === 0 ? u : [...ae, ...u];
|
|
1594
|
+
h.value = O, T.value ? ce.value === 0 && h.value.length > 0 && (pe.value = 0) : (E(O), s.value && (b.value = s.value.scrollTop, H.value = s.value.clientHeight || window.innerHeight), X(() => {
|
|
1595
|
+
s.value && (b.value = s.value.scrollTop, H.value = s.value.clientHeight || window.innerHeight, _());
|
|
1596
|
+
})), u && u.length > 0 && (A.value = !0);
|
|
1497
1597
|
}
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
Ve(c, S, z);
|
|
1501
|
-
return;
|
|
1502
|
-
}
|
|
1503
|
-
if (v.value = S, d.value = [S], z != null && d.value.push(z), I.value = z === null, f.value = null, k(c, "restoreItems"), x.value)
|
|
1504
|
-
s.value = c, se.value === 0 && s.value.length > 0 && (ve.value = 0);
|
|
1505
|
-
else if (u(c), a.value && (A.value = a.value.scrollTop, N.value = a.value.clientHeight || window.innerHeight), await q(), a.value) {
|
|
1506
|
-
A.value = a.value.scrollTop, N.value = a.value.clientHeight || window.innerHeight, D(), await q();
|
|
1507
|
-
const _ = be(s.value, m.value), F = _.length ? Math.max(..._) : 0, qe = a.value.scrollTop + a.value.clientHeight, Se = typeof t.loadThresholdPx == "number" ? t.loadThresholdPx : 200, Mt = Se >= 0 ? Math.max(0, F - Se) : Math.max(0, F + Se);
|
|
1508
|
-
qe >= Mt && !I.value && !M.value && d.value.length > 0 && d.value[d.value.length - 1] != null && await Fe(_, !0);
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
te(
|
|
1512
|
-
g,
|
|
1598
|
+
return ee(
|
|
1599
|
+
d,
|
|
1513
1600
|
() => {
|
|
1514
|
-
|
|
1601
|
+
T.value || s.value && (r.value = se(d.value, o.value), E(h.value));
|
|
1515
1602
|
},
|
|
1516
1603
|
{ deep: !0 }
|
|
1517
|
-
),
|
|
1518
|
-
|
|
1519
|
-
}),
|
|
1520
|
-
|
|
1521
|
-
}, { immediate: !0 })
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
([c, S, z, _]) => {
|
|
1526
|
-
if (S && c && c.length > 0 && !we) {
|
|
1527
|
-
we = !0;
|
|
1528
|
-
const F = z ?? t.loadAtPage;
|
|
1529
|
-
Le(c, F, _ !== void 0 ? _ : void 0);
|
|
1530
|
-
}
|
|
1604
|
+
), ee(() => a.layoutMode, () => {
|
|
1605
|
+
y.value && y.value.width !== void 0 ? o.value = y.value.width : f.value && (o.value = f.value.clientWidth);
|
|
1606
|
+
}), ee(s, (u) => {
|
|
1607
|
+
u && !T.value ? (u.removeEventListener("scroll", oe), u.addEventListener("scroll", oe, { passive: !0 })) : u && u.removeEventListener("scroll", oe);
|
|
1608
|
+
}, { immediate: !0 }), ee(
|
|
1609
|
+
() => h.value.length,
|
|
1610
|
+
(u, B) => {
|
|
1611
|
+
a.init === "manual" && !A.value && u > 0 && B === 0 && (A.value = !0);
|
|
1531
1612
|
},
|
|
1532
1613
|
{ immediate: !1 }
|
|
1533
|
-
),
|
|
1534
|
-
|
|
1535
|
-
|
|
1614
|
+
), ee(T, (u, B) => {
|
|
1615
|
+
B === void 0 && u === !1 || X(() => {
|
|
1616
|
+
u ? (document.addEventListener("mousemove", Te), document.addEventListener("mouseup", Ie), s.value && s.value.removeEventListener("scroll", oe), ce.value = 0, pe.value = 0, h.value.length > 0 && Le()) : (document.removeEventListener("mousemove", Te), document.removeEventListener("mouseup", Ie), s.value && f.value && (y.value && y.value.width !== void 0 ? o.value = y.value.width : o.value = f.value.clientWidth, s.value.removeEventListener("scroll", oe), s.value.addEventListener("scroll", oe, { passive: !0 }), h.value.length > 0 && (r.value = se(d.value, o.value), E(h.value), b.value = s.value.scrollTop, H.value = s.value.clientHeight, _())));
|
|
1536
1617
|
});
|
|
1537
|
-
}, { immediate: !0 }),
|
|
1538
|
-
|
|
1539
|
-
}),
|
|
1540
|
-
|
|
1541
|
-
}),
|
|
1542
|
-
|
|
1543
|
-
if (!
|
|
1544
|
-
for (const
|
|
1545
|
-
const
|
|
1546
|
-
|
|
1618
|
+
}, { immediate: !0 }), ee(le, (u) => {
|
|
1619
|
+
u && (u.addEventListener("touchstart", Fe, { passive: !1 }), u.addEventListener("touchmove", ze, { passive: !1 }), u.addEventListener("touchend", De), u.addEventListener("mousedown", Be));
|
|
1620
|
+
}), ee(() => h.value.length, (u, B) => {
|
|
1621
|
+
T.value && u > 0 && B === 0 && (ce.value = 0, X(() => Le()));
|
|
1622
|
+
}), ee(f, (u) => {
|
|
1623
|
+
t && (t.disconnect(), t = null), u && typeof ResizeObserver < "u" ? (t = new ResizeObserver((B) => {
|
|
1624
|
+
if (!y.value)
|
|
1625
|
+
for (const j of B) {
|
|
1626
|
+
const ae = j.contentRect.width, O = j.contentRect.height;
|
|
1627
|
+
o.value !== ae && (o.value = ae), c.value !== O && (c.value = O);
|
|
1547
1628
|
}
|
|
1548
|
-
}),
|
|
1549
|
-
}, { immediate: !0 }),
|
|
1550
|
-
|
|
1551
|
-
|
|
1629
|
+
}), t.observe(u), y.value || (o.value = u.clientWidth, c.value = u.clientHeight)) : u && (y.value || (o.value = u.clientWidth, c.value = u.clientHeight));
|
|
1630
|
+
}, { immediate: !0 }), ee(o, (u, B) => {
|
|
1631
|
+
u !== B && u > 0 && !T.value && s.value && h.value.length > 0 && X(() => {
|
|
1632
|
+
r.value = se(d.value, u), E(h.value), _();
|
|
1552
1633
|
});
|
|
1553
|
-
}),
|
|
1634
|
+
}), Xe(async () => {
|
|
1554
1635
|
try {
|
|
1555
|
-
await
|
|
1556
|
-
const
|
|
1557
|
-
if (
|
|
1558
|
-
await
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1636
|
+
await X(), f.value && !t && (o.value = f.value.clientWidth, c.value = f.value.clientHeight), T.value || (r.value = se(d.value, o.value), s.value && (b.value = s.value.scrollTop, H.value = s.value.clientHeight));
|
|
1637
|
+
const u = a.loadAtPage;
|
|
1638
|
+
if (L.value = [u], a.init === "auto") {
|
|
1639
|
+
A.value = !0, await X();
|
|
1640
|
+
try {
|
|
1641
|
+
await be(u);
|
|
1642
|
+
} catch {
|
|
1643
|
+
}
|
|
1562
1644
|
}
|
|
1563
|
-
|
|
1564
|
-
} catch (
|
|
1565
|
-
|
|
1645
|
+
T.value ? X(() => Le()) : _();
|
|
1646
|
+
} catch (u) {
|
|
1647
|
+
N.value || (console.error("Error during component initialization:", u), N.value = me(u)), g.value = !1;
|
|
1566
1648
|
}
|
|
1567
|
-
window.addEventListener("resize",
|
|
1568
|
-
}),
|
|
1569
|
-
var
|
|
1570
|
-
|
|
1571
|
-
}), (
|
|
1649
|
+
window.addEventListener("resize", Ne), window.addEventListener("resize", We);
|
|
1650
|
+
}), Ge(() => {
|
|
1651
|
+
var u;
|
|
1652
|
+
t && (t.disconnect(), t = null), (u = s.value) == null || u.removeEventListener("scroll", oe), window.removeEventListener("resize", Ne), window.removeEventListener("resize", We), le.value && (le.value.removeEventListener("touchstart", Fe), le.value.removeEventListener("touchmove", ze), le.value.removeEventListener("touchend", De), le.value.removeEventListener("mousedown", Be)), document.removeEventListener("mousemove", Te), document.removeEventListener("mouseup", Ie);
|
|
1653
|
+
}), (u, B) => (Y(), q("div", {
|
|
1572
1654
|
ref_key: "wrapper",
|
|
1573
|
-
ref:
|
|
1655
|
+
ref: f,
|
|
1574
1656
|
class: "w-full h-full flex flex-col relative"
|
|
1575
1657
|
}, [
|
|
1576
|
-
|
|
1577
|
-
key:
|
|
1578
|
-
class: re(["overflow-hidden w-full flex-1 swipe-container touch-none select-none", { "force-motion":
|
|
1658
|
+
A.value ? T.value ? (Y(), q("div", {
|
|
1659
|
+
key: 1,
|
|
1660
|
+
class: re(["overflow-hidden w-full flex-1 swipe-container touch-none select-none", { "force-motion": a.forceMotion, "cursor-grab": !G(ye), "cursor-grabbing": G(ye) }]),
|
|
1579
1661
|
ref_key: "swipeContainer",
|
|
1580
1662
|
ref: le,
|
|
1581
1663
|
style: { height: "100%", "max-height": "100%", position: "relative" }
|
|
1582
1664
|
}, [
|
|
1583
|
-
|
|
1665
|
+
U("div", {
|
|
1584
1666
|
class: "relative w-full",
|
|
1585
|
-
style:
|
|
1586
|
-
transform: `translateY(${
|
|
1587
|
-
transition:
|
|
1588
|
-
height: `${
|
|
1667
|
+
style: he({
|
|
1668
|
+
transform: `translateY(${G(pe)}px)`,
|
|
1669
|
+
transition: G(ye) ? "none" : `transform ${e.transitionDurationMs}ms ${e.transitionEasing}`,
|
|
1670
|
+
height: `${v.value * 100}%`
|
|
1589
1671
|
})
|
|
1590
1672
|
}, [
|
|
1591
|
-
(
|
|
1592
|
-
key: `${
|
|
1673
|
+
(Y(!0), q(Re, null, Oe(h.value, (j, ae) => (Y(), q("div", {
|
|
1674
|
+
key: `${j.page}-${j.id}`,
|
|
1593
1675
|
class: "absolute top-0 left-0 w-full",
|
|
1594
|
-
style:
|
|
1595
|
-
top:
|
|
1596
|
-
height:
|
|
1676
|
+
style: he({
|
|
1677
|
+
top: gt(ae),
|
|
1678
|
+
height: pt()
|
|
1597
1679
|
})
|
|
1598
1680
|
}, [
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
item:
|
|
1603
|
-
remove:
|
|
1604
|
-
index:
|
|
1681
|
+
U("div", wa, [
|
|
1682
|
+
U("div", xa, [
|
|
1683
|
+
J(u.$slots, "default", {
|
|
1684
|
+
item: j,
|
|
1685
|
+
remove: G(ue),
|
|
1686
|
+
index: j.originalIndex ?? h.value.indexOf(j)
|
|
1605
1687
|
}, () => [
|
|
1606
|
-
|
|
1607
|
-
item:
|
|
1608
|
-
remove:
|
|
1609
|
-
"header-height":
|
|
1610
|
-
"footer-height":
|
|
1688
|
+
Se(xe, {
|
|
1689
|
+
item: j,
|
|
1690
|
+
remove: G(ue),
|
|
1691
|
+
"header-height": d.value.header,
|
|
1692
|
+
"footer-height": d.value.footer,
|
|
1611
1693
|
"in-swipe-mode": !0,
|
|
1612
|
-
"is-active":
|
|
1613
|
-
"onPreload:success":
|
|
1614
|
-
"onPreload:error":
|
|
1615
|
-
onMouseEnter:
|
|
1616
|
-
onMouseLeave:
|
|
1694
|
+
"is-active": ae === G(ce),
|
|
1695
|
+
"onPreload:success": B[0] || (B[0] = (O) => p("item:preload:success", O)),
|
|
1696
|
+
"onPreload:error": B[1] || (B[1] = (O) => p("item:preload:error", O)),
|
|
1697
|
+
onMouseEnter: B[2] || (B[2] = (O) => p("item:mouse-enter", O)),
|
|
1698
|
+
onMouseLeave: B[3] || (B[3] = (O) => p("item:mouse-leave", O))
|
|
1617
1699
|
}, {
|
|
1618
|
-
header:
|
|
1619
|
-
|
|
1700
|
+
header: ve((O) => [
|
|
1701
|
+
J(u.$slots, "item-header", fe({ ref_for: !0 }, O), void 0, !0)
|
|
1620
1702
|
]),
|
|
1621
|
-
footer:
|
|
1622
|
-
|
|
1703
|
+
footer: ve((O) => [
|
|
1704
|
+
J(u.$slots, "item-footer", fe({ ref_for: !0 }, O), void 0, !0)
|
|
1623
1705
|
]),
|
|
1624
1706
|
_: 2
|
|
1625
1707
|
}, 1032, ["item", "remove", "header-height", "footer-height", "is-active"])
|
|
@@ -1628,62 +1710,62 @@ const sa = { class: "flex-1 relative min-h-0" }, ua = { class: "w-full h-full ro
|
|
|
1628
1710
|
])
|
|
1629
1711
|
], 4))), 128))
|
|
1630
1712
|
], 4),
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1713
|
+
k.value && h.value.length > 0 ? (Y(), q("div", ba, [
|
|
1714
|
+
J(u.$slots, "end-message", {}, () => [
|
|
1715
|
+
B[9] || (B[9] = U("p", { class: "text-gray-500 dark:text-gray-400" }, "You've reached the end", -1))
|
|
1634
1716
|
], !0)
|
|
1635
|
-
])) :
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1717
|
+
])) : te("", !0),
|
|
1718
|
+
N.value && h.value.length > 0 ? (Y(), q("div", Ma, [
|
|
1719
|
+
J(u.$slots, "error-message", { error: N.value }, () => [
|
|
1720
|
+
U("p", Ta, "Failed to load content: " + Pe(N.value.message), 1)
|
|
1639
1721
|
], !0)
|
|
1640
|
-
])) :
|
|
1641
|
-
], 2)) : (
|
|
1642
|
-
key:
|
|
1643
|
-
class: re(["overflow-auto w-full flex-1 masonry-container", { "force-motion":
|
|
1722
|
+
])) : te("", !0)
|
|
1723
|
+
], 2)) : (Y(), q("div", {
|
|
1724
|
+
key: 2,
|
|
1725
|
+
class: re(["overflow-auto w-full flex-1 masonry-container", { "force-motion": a.forceMotion }]),
|
|
1644
1726
|
ref_key: "container",
|
|
1645
|
-
ref:
|
|
1727
|
+
ref: s
|
|
1646
1728
|
}, [
|
|
1647
|
-
|
|
1729
|
+
U("div", {
|
|
1648
1730
|
class: "relative",
|
|
1649
|
-
style:
|
|
1731
|
+
style: he({ height: `${$.value}px`, "--masonry-duration": `${e.transitionDurationMs}ms`, "--masonry-leave-duration": `${e.leaveDurationMs}ms`, "--masonry-ease": e.transitionEasing })
|
|
1650
1732
|
}, [
|
|
1651
|
-
|
|
1733
|
+
Se(It, {
|
|
1652
1734
|
name: "masonry",
|
|
1653
1735
|
css: !1,
|
|
1654
|
-
onEnter:
|
|
1655
|
-
onBeforeEnter:
|
|
1656
|
-
onLeave:
|
|
1657
|
-
onBeforeLeave:
|
|
1736
|
+
onEnter: G(at),
|
|
1737
|
+
onBeforeEnter: G(nt),
|
|
1738
|
+
onLeave: G(ot),
|
|
1739
|
+
onBeforeLeave: G(lt)
|
|
1658
1740
|
}, {
|
|
1659
|
-
default:
|
|
1660
|
-
(
|
|
1661
|
-
key: `${
|
|
1741
|
+
default: ve(() => [
|
|
1742
|
+
(Y(!0), q(Re, null, Oe(G(ne), (j, ae) => (Y(), q("div", fe({
|
|
1743
|
+
key: `${j.page}-${j.id}`,
|
|
1662
1744
|
class: "absolute masonry-item",
|
|
1663
1745
|
ref_for: !0
|
|
1664
|
-
},
|
|
1665
|
-
|
|
1666
|
-
item:
|
|
1667
|
-
remove:
|
|
1668
|
-
index:
|
|
1746
|
+
}, G(ea)(j, ae)), [
|
|
1747
|
+
J(u.$slots, "default", {
|
|
1748
|
+
item: j,
|
|
1749
|
+
remove: G(ue),
|
|
1750
|
+
index: j.originalIndex ?? h.value.indexOf(j)
|
|
1669
1751
|
}, () => [
|
|
1670
|
-
|
|
1671
|
-
item:
|
|
1672
|
-
remove:
|
|
1673
|
-
"header-height":
|
|
1674
|
-
"footer-height":
|
|
1752
|
+
Se(xe, {
|
|
1753
|
+
item: j,
|
|
1754
|
+
remove: G(ue),
|
|
1755
|
+
"header-height": d.value.header,
|
|
1756
|
+
"footer-height": d.value.footer,
|
|
1675
1757
|
"in-swipe-mode": !1,
|
|
1676
1758
|
"is-active": !1,
|
|
1677
|
-
"onPreload:success":
|
|
1678
|
-
"onPreload:error":
|
|
1679
|
-
onMouseEnter:
|
|
1680
|
-
onMouseLeave:
|
|
1759
|
+
"onPreload:success": B[4] || (B[4] = (O) => p("item:preload:success", O)),
|
|
1760
|
+
"onPreload:error": B[5] || (B[5] = (O) => p("item:preload:error", O)),
|
|
1761
|
+
onMouseEnter: B[6] || (B[6] = (O) => p("item:mouse-enter", O)),
|
|
1762
|
+
onMouseLeave: B[7] || (B[7] = (O) => p("item:mouse-leave", O))
|
|
1681
1763
|
}, {
|
|
1682
|
-
header:
|
|
1683
|
-
|
|
1764
|
+
header: ve((O) => [
|
|
1765
|
+
J(u.$slots, "item-header", fe({ ref_for: !0 }, O), void 0, !0)
|
|
1684
1766
|
]),
|
|
1685
|
-
footer:
|
|
1686
|
-
|
|
1767
|
+
footer: ve((O) => [
|
|
1768
|
+
J(u.$slots, "item-footer", fe({ ref_for: !0 }, O), void 0, !0)
|
|
1687
1769
|
]),
|
|
1688
1770
|
_: 2
|
|
1689
1771
|
}, 1032, ["item", "remove", "header-height", "footer-height"])
|
|
@@ -1693,31 +1775,35 @@ const sa = { class: "flex-1 relative min-h-0" }, ua = { class: "w-full h-full ro
|
|
|
1693
1775
|
_: 3
|
|
1694
1776
|
}, 8, ["onEnter", "onBeforeEnter", "onLeave", "onBeforeLeave"])
|
|
1695
1777
|
], 4),
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1778
|
+
k.value && h.value.length > 0 ? (Y(), q("div", Ia, [
|
|
1779
|
+
J(u.$slots, "end-message", {}, () => [
|
|
1780
|
+
B[10] || (B[10] = U("p", { class: "text-gray-500 dark:text-gray-400" }, "You've reached the end", -1))
|
|
1699
1781
|
], !0)
|
|
1700
|
-
])) :
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1782
|
+
])) : te("", !0),
|
|
1783
|
+
N.value && h.value.length > 0 ? (Y(), q("div", La, [
|
|
1784
|
+
J(u.$slots, "error-message", { error: N.value }, () => [
|
|
1785
|
+
U("p", Sa, "Failed to load content: " + Pe(N.value.message), 1)
|
|
1704
1786
|
], !0)
|
|
1705
|
-
])) :
|
|
1706
|
-
], 2))
|
|
1787
|
+
])) : te("", !0)
|
|
1788
|
+
], 2)) : (Y(), q("div", ya, [
|
|
1789
|
+
J(u.$slots, "loading-message", {}, () => [
|
|
1790
|
+
B[8] || (B[8] = U("p", { class: "text-gray-500 dark:text-gray-400" }, "Waiting for content to load...", -1))
|
|
1791
|
+
], !0)
|
|
1792
|
+
]))
|
|
1707
1793
|
], 512));
|
|
1708
1794
|
}
|
|
1709
|
-
}),
|
|
1710
|
-
const
|
|
1711
|
-
for (const [
|
|
1712
|
-
|
|
1713
|
-
return
|
|
1714
|
-
},
|
|
1795
|
+
}), Ea = (e, n) => {
|
|
1796
|
+
const i = e.__vccOpts || e;
|
|
1797
|
+
for (const [a, m] of n)
|
|
1798
|
+
i[a] = m;
|
|
1799
|
+
return i;
|
|
1800
|
+
}, Ue = /* @__PURE__ */ Ea(ka, [["__scopeId", "data-v-ce75570c"]]), Ha = {
|
|
1715
1801
|
install(e) {
|
|
1716
|
-
e.component("WyxosMasonry",
|
|
1802
|
+
e.component("WyxosMasonry", Ue), e.component("WMasonry", Ue), e.component("WyxosMasonryItem", xe), e.component("WMasonryItem", xe);
|
|
1717
1803
|
}
|
|
1718
1804
|
};
|
|
1719
1805
|
export {
|
|
1720
|
-
|
|
1721
|
-
|
|
1806
|
+
Ue as Masonry,
|
|
1807
|
+
xe as MasonryItem,
|
|
1722
1808
|
Ha as default
|
|
1723
1809
|
};
|