@wyxos/vibe 1.6.13 → 1.6.14
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/lib/index.js +808 -713
- package/lib/vibe.css +1 -1
- package/package.json +1 -2
- package/src/Masonry.vue +1233 -1195
- package/src/components/MasonryItem.vue +431 -346
- package/src/components/examples/HeaderFooterExample.vue +78 -0
- package/src/useMasonryScroll.ts +60 -60
- package/src/views/Examples.vue +28 -0
- package/src/views/Home.vue +236 -208
package/lib/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { nextTick as
|
|
2
|
-
let
|
|
1
|
+
import { nextTick as X, defineComponent as Qe, ref as I, computed as Z, onMounted as Ze, onUnmounted as et, watch as re, createElementBlock as B, openBlock as O, createCommentVNode as le, createElementVNode as q, normalizeStyle as ge, renderSlot as ne, normalizeClass as ie, withModifiers as Ve, toDisplayString as pt, Fragment as Ye, renderList as Ue, createVNode as ke, withCtx as de, mergeProps as me, TransitionGroup as ht, unref as gt } from "vue";
|
|
2
|
+
let Pe = null;
|
|
3
3
|
function yt() {
|
|
4
|
-
if (
|
|
4
|
+
if (Pe != null) return Pe;
|
|
5
5
|
const t = document.createElement("div");
|
|
6
6
|
t.style.visibility = "hidden", t.style.overflow = "scroll", t.style.msOverflowStyle = "scrollbar", t.style.width = "100px", t.style.height = "100px", document.body.appendChild(t);
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
return document.body.removeChild(t),
|
|
7
|
+
const f = document.createElement("div");
|
|
8
|
+
f.style.width = "100%", t.appendChild(f);
|
|
9
|
+
const s = t.offsetWidth - f.offsetWidth;
|
|
10
|
+
return document.body.removeChild(t), Pe = s, s;
|
|
11
11
|
}
|
|
12
|
-
function wt(t,
|
|
12
|
+
function wt(t, f, s, r = {}) {
|
|
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: o = 0,
|
|
17
|
+
footer: u = 0,
|
|
18
|
+
paddingLeft: y = 0,
|
|
19
|
+
paddingRight: $ = 0,
|
|
20
|
+
sizes: m = {
|
|
21
21
|
base: 1,
|
|
22
22
|
sm: 2,
|
|
23
23
|
md: 3,
|
|
@@ -25,95 +25,95 @@ function wt(t, i, u, l = {}) {
|
|
|
25
25
|
xl: 5,
|
|
26
26
|
"2xl": 6
|
|
27
27
|
},
|
|
28
|
-
placement:
|
|
29
|
-
} =
|
|
30
|
-
let
|
|
28
|
+
placement: T = "masonry"
|
|
29
|
+
} = r;
|
|
30
|
+
let P = 0, H = 0;
|
|
31
31
|
try {
|
|
32
|
-
if (
|
|
33
|
-
const
|
|
34
|
-
|
|
32
|
+
if (f && f.nodeType === 1 && typeof window < "u" && window.getComputedStyle) {
|
|
33
|
+
const x = window.getComputedStyle(f);
|
|
34
|
+
P = parseFloat(x.paddingLeft) || 0, H = parseFloat(x.paddingRight) || 0;
|
|
35
35
|
}
|
|
36
36
|
} catch {
|
|
37
37
|
}
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
return Math.round(
|
|
38
|
+
const E = (y || 0) + P, l = ($ || 0) + H, b = f.offsetWidth - f.clientWidth, v = b > 0 ? b + 2 : yt() + 2, p = f.offsetWidth - v - E - l, z = M * (s - 1), k = Math.floor((p - z) / s), D = t.map((x) => {
|
|
39
|
+
const A = x.width, N = x.height;
|
|
40
|
+
return Math.round(k * N / A) + u + o;
|
|
41
41
|
});
|
|
42
|
-
if (
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
let
|
|
47
|
-
const
|
|
48
|
-
let
|
|
49
|
-
for (let
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
52
|
-
_ =
|
|
53
|
-
else if (
|
|
42
|
+
if (T === "sequential-balanced") {
|
|
43
|
+
const x = D.length;
|
|
44
|
+
if (x === 0) return [];
|
|
45
|
+
const A = (L, R, _) => L + (R > 0 ? d : 0) + _;
|
|
46
|
+
let N = Math.max(...D), n = D.reduce((L, R) => L + R, 0) + d * Math.max(0, x - 1);
|
|
47
|
+
const w = (L) => {
|
|
48
|
+
let R = 1, _ = 0, oe = 0;
|
|
49
|
+
for (let J = 0; J < x; J++) {
|
|
50
|
+
const se = D[J], K = A(_, oe, se);
|
|
51
|
+
if (K <= L)
|
|
52
|
+
_ = K, oe++;
|
|
53
|
+
else if (R++, _ = se, oe = 1, se > L || R > s) return !1;
|
|
54
54
|
}
|
|
55
|
-
return
|
|
55
|
+
return R <= s;
|
|
56
56
|
};
|
|
57
|
-
for (;
|
|
58
|
-
const
|
|
59
|
-
|
|
57
|
+
for (; N < n; ) {
|
|
58
|
+
const L = Math.floor((N + n) / 2);
|
|
59
|
+
w(L) ? n = L : N = L + 1;
|
|
60
60
|
}
|
|
61
|
-
const
|
|
62
|
-
let V =
|
|
63
|
-
for (let
|
|
64
|
-
const
|
|
65
|
-
!(
|
|
61
|
+
const j = n, F = new Array(s).fill(0);
|
|
62
|
+
let V = s - 1, Y = 0, W = 0;
|
|
63
|
+
for (let L = x - 1; L >= 0; L--) {
|
|
64
|
+
const R = D[L], _ = L < V;
|
|
65
|
+
!(A(Y, W, R) <= j) || _ ? (F[V] = L + 1, V--, Y = R, W = 1) : (Y = A(Y, W, R), W++);
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
for (let
|
|
70
|
-
const
|
|
71
|
-
for (let
|
|
72
|
-
const
|
|
73
|
-
...t[
|
|
74
|
-
columnWidth:
|
|
67
|
+
F[0] = 0;
|
|
68
|
+
const G = [], ae = new Array(s).fill(0);
|
|
69
|
+
for (let L = 0; L < s; L++) {
|
|
70
|
+
const R = F[L], _ = L + 1 < s ? F[L + 1] : x, oe = L * (k + M);
|
|
71
|
+
for (let J = R; J < _; J++) {
|
|
72
|
+
const K = {
|
|
73
|
+
...t[J],
|
|
74
|
+
columnWidth: k,
|
|
75
75
|
imageHeight: 0,
|
|
76
76
|
columnHeight: 0,
|
|
77
77
|
left: 0,
|
|
78
78
|
top: 0
|
|
79
79
|
};
|
|
80
|
-
|
|
80
|
+
K.imageHeight = D[J] - (u + o), K.columnHeight = D[J], K.left = oe, K.top = ae[L], ae[L] += K.columnHeight + (J + 1 < _ ? d : 0), G.push(K);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
return
|
|
83
|
+
return G;
|
|
84
84
|
}
|
|
85
|
-
const
|
|
86
|
-
for (let
|
|
87
|
-
const
|
|
88
|
-
...
|
|
85
|
+
const g = new Array(s).fill(0), S = [];
|
|
86
|
+
for (let x = 0; x < t.length; x++) {
|
|
87
|
+
const A = t[x], N = {
|
|
88
|
+
...A,
|
|
89
89
|
columnWidth: 0,
|
|
90
90
|
imageHeight: 0,
|
|
91
91
|
columnHeight: 0,
|
|
92
92
|
left: 0,
|
|
93
93
|
top: 0
|
|
94
|
-
},
|
|
95
|
-
|
|
94
|
+
}, n = g.indexOf(Math.min(...g)), w = A.width, j = A.height;
|
|
95
|
+
N.columnWidth = k, N.left = n * (k + M), N.imageHeight = Math.round(k * j / w), N.columnHeight = N.imageHeight + u + o, N.top = g[n], g[n] += N.columnHeight + d, S.push(N);
|
|
96
96
|
}
|
|
97
|
-
return
|
|
97
|
+
return S;
|
|
98
98
|
}
|
|
99
|
-
var bt = typeof global == "object" && global && global.Object === Object && global, xt = typeof self == "object" && self && self.Object === Object && self,
|
|
100
|
-
function
|
|
101
|
-
var
|
|
99
|
+
var bt = typeof global == "object" && global && global.Object === Object && global, xt = typeof self == "object" && self && self.Object === Object && self, tt = bt || xt || Function("return this")(), be = tt.Symbol, at = Object.prototype, Mt = at.hasOwnProperty, Tt = at.toString, pe = be ? be.toStringTag : void 0;
|
|
100
|
+
function Et(t) {
|
|
101
|
+
var f = Mt.call(t, pe), s = t[pe];
|
|
102
102
|
try {
|
|
103
|
-
t[
|
|
104
|
-
var
|
|
103
|
+
t[pe] = void 0;
|
|
104
|
+
var r = !0;
|
|
105
105
|
} catch {
|
|
106
106
|
}
|
|
107
|
-
var
|
|
108
|
-
return
|
|
107
|
+
var M = Tt.call(t);
|
|
108
|
+
return r && (f ? t[pe] = s : delete t[pe]), M;
|
|
109
109
|
}
|
|
110
|
-
var
|
|
111
|
-
function
|
|
112
|
-
return
|
|
110
|
+
var Lt = Object.prototype, It = Lt.toString;
|
|
111
|
+
function kt(t) {
|
|
112
|
+
return It.call(t);
|
|
113
113
|
}
|
|
114
|
-
var Pt = "[object Null]", St = "[object Undefined]",
|
|
114
|
+
var Pt = "[object Null]", St = "[object Undefined]", Ge = be ? be.toStringTag : void 0;
|
|
115
115
|
function $t(t) {
|
|
116
|
-
return t == null ? t === void 0 ? St : Pt :
|
|
116
|
+
return t == null ? t === void 0 ? St : Pt : Ge && Ge in Object(t) ? Et(t) : kt(t);
|
|
117
117
|
}
|
|
118
118
|
function Ht(t) {
|
|
119
119
|
return t != null && typeof t == "object";
|
|
@@ -124,92 +124,92 @@ function Wt(t) {
|
|
|
124
124
|
}
|
|
125
125
|
var Dt = /\s/;
|
|
126
126
|
function At(t) {
|
|
127
|
-
for (var
|
|
127
|
+
for (var f = t.length; f-- && Dt.test(t.charAt(f)); )
|
|
128
128
|
;
|
|
129
|
-
return
|
|
129
|
+
return f;
|
|
130
130
|
}
|
|
131
|
-
var
|
|
131
|
+
var Ft = /^\s+/;
|
|
132
132
|
function Bt(t) {
|
|
133
|
-
return t && t.slice(0, At(t) + 1).replace(
|
|
133
|
+
return t && t.slice(0, At(t) + 1).replace(Ft, "");
|
|
134
134
|
}
|
|
135
|
-
function
|
|
136
|
-
var
|
|
137
|
-
return t != null && (
|
|
135
|
+
function $e(t) {
|
|
136
|
+
var f = typeof t;
|
|
137
|
+
return t != null && (f == "object" || f == "function");
|
|
138
138
|
}
|
|
139
|
-
var
|
|
140
|
-
function
|
|
139
|
+
var Xe = NaN, Ot = /^[-+]0x[0-9a-f]+$/i, zt = /^0b[01]+$/i, jt = /^0o[0-7]+$/i, Rt = parseInt;
|
|
140
|
+
function _e(t) {
|
|
141
141
|
if (typeof t == "number")
|
|
142
142
|
return t;
|
|
143
143
|
if (Wt(t))
|
|
144
|
-
return
|
|
145
|
-
if (
|
|
146
|
-
var
|
|
147
|
-
t =
|
|
144
|
+
return Xe;
|
|
145
|
+
if ($e(t)) {
|
|
146
|
+
var f = typeof t.valueOf == "function" ? t.valueOf() : t;
|
|
147
|
+
t = $e(f) ? f + "" : f;
|
|
148
148
|
}
|
|
149
149
|
if (typeof t != "string")
|
|
150
150
|
return t === 0 ? t : +t;
|
|
151
151
|
t = Bt(t);
|
|
152
|
-
var
|
|
153
|
-
return
|
|
152
|
+
var s = zt.test(t);
|
|
153
|
+
return s || jt.test(t) ? Rt(t.slice(2), s ? 2 : 8) : Ot.test(t) ? Xe : +t;
|
|
154
154
|
}
|
|
155
|
-
var
|
|
156
|
-
return
|
|
157
|
-
},
|
|
158
|
-
function
|
|
159
|
-
var
|
|
155
|
+
var Se = function() {
|
|
156
|
+
return tt.Date.now();
|
|
157
|
+
}, Ct = "Expected a function", qt = Math.max, Vt = Math.min;
|
|
158
|
+
function Je(t, f, s) {
|
|
159
|
+
var r, M, d, o, u, y, $ = 0, m = !1, T = !1, P = !0;
|
|
160
160
|
if (typeof t != "function")
|
|
161
|
-
throw new TypeError(
|
|
162
|
-
|
|
163
|
-
function
|
|
164
|
-
var
|
|
165
|
-
return
|
|
161
|
+
throw new TypeError(Ct);
|
|
162
|
+
f = _e(f) || 0, $e(s) && (m = !!s.leading, T = "maxWait" in s, d = T ? qt(_e(s.maxWait) || 0, f) : d, P = "trailing" in s ? !!s.trailing : P);
|
|
163
|
+
function H(g) {
|
|
164
|
+
var S = r, x = M;
|
|
165
|
+
return r = M = void 0, $ = g, o = t.apply(x, S), o;
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
return
|
|
167
|
+
function E(g) {
|
|
168
|
+
return $ = g, u = setTimeout(v, f), m ? H(g) : o;
|
|
169
169
|
}
|
|
170
|
-
function
|
|
171
|
-
var
|
|
172
|
-
return
|
|
170
|
+
function l(g) {
|
|
171
|
+
var S = g - y, x = g - $, A = f - S;
|
|
172
|
+
return T ? Vt(A, d - x) : A;
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
var
|
|
176
|
-
return
|
|
174
|
+
function b(g) {
|
|
175
|
+
var S = g - y, x = g - $;
|
|
176
|
+
return y === void 0 || S >= f || S < 0 || T && x >= d;
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
var
|
|
180
|
-
if (
|
|
181
|
-
return
|
|
182
|
-
|
|
178
|
+
function v() {
|
|
179
|
+
var g = Se();
|
|
180
|
+
if (b(g))
|
|
181
|
+
return p(g);
|
|
182
|
+
u = setTimeout(v, l(g));
|
|
183
183
|
}
|
|
184
|
-
function
|
|
185
|
-
return
|
|
184
|
+
function p(g) {
|
|
185
|
+
return u = void 0, P && r ? H(g) : (r = M = void 0, o);
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
|
|
187
|
+
function z() {
|
|
188
|
+
u !== void 0 && clearTimeout(u), $ = 0, r = y = M = u = void 0;
|
|
189
189
|
}
|
|
190
|
-
function
|
|
191
|
-
return
|
|
190
|
+
function k() {
|
|
191
|
+
return u === void 0 ? o : p(Se());
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
var
|
|
195
|
-
if (
|
|
196
|
-
if (
|
|
197
|
-
return
|
|
198
|
-
if (
|
|
199
|
-
return clearTimeout(
|
|
193
|
+
function D() {
|
|
194
|
+
var g = Se(), S = b(g);
|
|
195
|
+
if (r = arguments, M = this, y = g, S) {
|
|
196
|
+
if (u === void 0)
|
|
197
|
+
return E(y);
|
|
198
|
+
if (T)
|
|
199
|
+
return clearTimeout(u), u = setTimeout(v, f), H(y);
|
|
200
200
|
}
|
|
201
|
-
return
|
|
201
|
+
return u === void 0 && (u = setTimeout(v, f)), o;
|
|
202
202
|
}
|
|
203
|
-
return
|
|
203
|
+
return D.cancel = z, D.flush = k, D;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
const
|
|
207
|
-
return
|
|
205
|
+
function he(t, f) {
|
|
206
|
+
const s = f ?? (typeof window < "u" ? window.innerWidth : 1024), r = t.sizes;
|
|
207
|
+
return s >= 1536 && r["2xl"] ? r["2xl"] : s >= 1280 && r.xl ? r.xl : s >= 1024 && r.lg ? r.lg : s >= 768 && r.md ? r.md : s >= 640 && r.sm ? r.sm : r.base;
|
|
208
208
|
}
|
|
209
209
|
function Yt(t) {
|
|
210
|
-
return t.reduce((
|
|
210
|
+
return t.reduce((s, r) => Math.max(s, r.top + r.columnHeight), 0) + 500;
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function Ut(t) {
|
|
213
213
|
return {
|
|
214
214
|
transform: `translate3d(${t.left}px, ${t.top}px, 0)`,
|
|
215
215
|
top: "0px",
|
|
@@ -218,323 +218,384 @@ function Vt(t) {
|
|
|
218
218
|
height: `${t.columnHeight}px`
|
|
219
219
|
};
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function Gt(t, f = 0) {
|
|
222
222
|
return {
|
|
223
|
-
style:
|
|
223
|
+
style: Ut(t),
|
|
224
224
|
"data-top": t.top,
|
|
225
225
|
"data-left": t.left,
|
|
226
226
|
"data-id": `${t.page}-${t.id}`,
|
|
227
|
-
"data-index":
|
|
227
|
+
"data-index": f
|
|
228
228
|
};
|
|
229
229
|
}
|
|
230
|
-
function
|
|
231
|
-
if (!t.length ||
|
|
232
|
-
return new Array(Math.max(1,
|
|
233
|
-
const
|
|
234
|
-
for (let
|
|
235
|
-
const
|
|
236
|
-
for (const
|
|
237
|
-
const
|
|
238
|
-
|
|
230
|
+
function He(t, f) {
|
|
231
|
+
if (!t.length || f <= 0)
|
|
232
|
+
return new Array(Math.max(1, f)).fill(0);
|
|
233
|
+
const r = Array.from(new Set(t.map((o) => o.left))).sort((o, u) => o - u).slice(0, f), M = /* @__PURE__ */ new Map();
|
|
234
|
+
for (let o = 0; o < r.length; o++) M.set(r[o], o);
|
|
235
|
+
const d = new Array(r.length).fill(0);
|
|
236
|
+
for (const o of t) {
|
|
237
|
+
const u = M.get(o.left);
|
|
238
|
+
u != null && (d[u] = Math.max(d[u], o.top + o.columnHeight));
|
|
239
239
|
}
|
|
240
|
-
for (;
|
|
241
|
-
return
|
|
240
|
+
for (; d.length < f; ) d.push(0);
|
|
241
|
+
return d;
|
|
242
242
|
}
|
|
243
|
-
function
|
|
244
|
-
function
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
const
|
|
249
|
-
|
|
243
|
+
function Xt(t, f) {
|
|
244
|
+
function s(o, u) {
|
|
245
|
+
const y = parseInt(o.dataset.left || "0", 10), $ = parseInt(o.dataset.top || "0", 10), m = parseInt(o.dataset.index || "0", 10), T = Math.min(m * 20, 160), P = o.style.getPropertyValue("--masonry-opacity-delay");
|
|
246
|
+
o.style.setProperty("--masonry-opacity-delay", `${T}ms`), requestAnimationFrame(() => {
|
|
247
|
+
o.style.opacity = "1", o.style.transform = `translate3d(${y}px, ${$}px, 0) scale(1)`;
|
|
248
|
+
const H = () => {
|
|
249
|
+
P ? o.style.setProperty("--masonry-opacity-delay", P) : o.style.removeProperty("--masonry-opacity-delay"), o.removeEventListener("transitionend", H), u();
|
|
250
250
|
};
|
|
251
|
-
|
|
251
|
+
o.addEventListener("transitionend", H);
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
|
-
function
|
|
255
|
-
const
|
|
256
|
-
|
|
254
|
+
function r(o) {
|
|
255
|
+
const u = parseInt(o.dataset.left || "0", 10), y = parseInt(o.dataset.top || "0", 10);
|
|
256
|
+
o.style.opacity = "0", o.style.transform = `translate3d(${u}px, ${y + 10}px, 0) scale(0.985)`;
|
|
257
257
|
}
|
|
258
|
-
function
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
|
|
258
|
+
function M(o) {
|
|
259
|
+
const u = parseInt(o.dataset.left || "0", 10), y = parseInt(o.dataset.top || "0", 10);
|
|
260
|
+
o.style.transition = "none", o.style.opacity = "1", o.style.transform = `translate3d(${u}px, ${y}px, 0) scale(1)`, o.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
|
|
261
|
+
o.style.transition = "";
|
|
262
262
|
});
|
|
263
263
|
}
|
|
264
|
-
function
|
|
265
|
-
const
|
|
266
|
-
let
|
|
267
|
-
if (!Number.isFinite(
|
|
268
|
-
const
|
|
269
|
-
|
|
264
|
+
function d(o, u) {
|
|
265
|
+
const y = parseInt(o.dataset.left || "0", 10), $ = parseInt(o.dataset.top || "0", 10), m = typeof (f == null ? void 0 : f.leaveDurationMs) == "number" ? f.leaveDurationMs : NaN;
|
|
266
|
+
let T = Number.isFinite(m) && m > 0 ? m : NaN;
|
|
267
|
+
if (!Number.isFinite(T)) {
|
|
268
|
+
const v = getComputedStyle(o).getPropertyValue("--masonry-leave-duration") || "", p = parseFloat(v);
|
|
269
|
+
T = Number.isFinite(p) && p > 0 ? p : 200;
|
|
270
270
|
}
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
},
|
|
274
|
-
(
|
|
275
|
-
},
|
|
276
|
-
|
|
277
|
-
},
|
|
271
|
+
const P = o.style.transitionDuration, H = () => {
|
|
272
|
+
o.removeEventListener("transitionend", E), clearTimeout(l), o.style.transitionDuration = P || "";
|
|
273
|
+
}, E = (b) => {
|
|
274
|
+
(!b || b.target === o) && (H(), u());
|
|
275
|
+
}, l = setTimeout(() => {
|
|
276
|
+
H(), u();
|
|
277
|
+
}, T + 100);
|
|
278
278
|
requestAnimationFrame(() => {
|
|
279
|
-
|
|
279
|
+
o.style.transitionDuration = `${T}ms`, o.style.opacity = "0", o.style.transform = `translate3d(${y}px, ${$ + 10}px, 0) scale(0.985)`, o.addEventListener("transitionend", E);
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
282
|
return {
|
|
283
|
-
onEnter:
|
|
284
|
-
onBeforeEnter:
|
|
285
|
-
onBeforeLeave:
|
|
286
|
-
onLeave:
|
|
283
|
+
onEnter: s,
|
|
284
|
+
onBeforeEnter: r,
|
|
285
|
+
onBeforeLeave: M,
|
|
286
|
+
onLeave: d
|
|
287
287
|
};
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function _t({
|
|
290
290
|
container: t,
|
|
291
|
-
masonry:
|
|
292
|
-
columns:
|
|
293
|
-
containerHeight:
|
|
294
|
-
isLoading:
|
|
295
|
-
pageSize:
|
|
296
|
-
refreshLayout:
|
|
297
|
-
setItemsRaw:
|
|
298
|
-
loadNext:
|
|
299
|
-
loadThresholdPx:
|
|
291
|
+
masonry: f,
|
|
292
|
+
columns: s,
|
|
293
|
+
containerHeight: r,
|
|
294
|
+
isLoading: M,
|
|
295
|
+
pageSize: d,
|
|
296
|
+
refreshLayout: o,
|
|
297
|
+
setItemsRaw: u,
|
|
298
|
+
loadNext: y,
|
|
299
|
+
loadThresholdPx: $
|
|
300
300
|
}) {
|
|
301
|
-
let
|
|
302
|
-
async function
|
|
301
|
+
let m = 0;
|
|
302
|
+
async function T(P) {
|
|
303
303
|
if (!t.value) return;
|
|
304
|
-
const
|
|
305
|
-
|
|
306
|
-
const
|
|
307
|
-
if (
|
|
308
|
-
await
|
|
304
|
+
const H = P ?? He(f.value, s.value), E = H.length ? Math.max(...H) : 0, l = t.value.scrollTop + t.value.clientHeight, b = t.value.scrollTop > m + 1;
|
|
305
|
+
m = t.value.scrollTop;
|
|
306
|
+
const v = typeof $ == "number" ? $ : 200, p = v >= 0 ? Math.max(0, E - v) : Math.max(0, E + v);
|
|
307
|
+
if (l >= p && b && !M.value) {
|
|
308
|
+
await y(), await X();
|
|
309
309
|
return;
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
312
|
return {
|
|
313
|
-
handleScroll:
|
|
313
|
+
handleScroll: T
|
|
314
314
|
};
|
|
315
315
|
}
|
|
316
|
-
const Jt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm
|
|
316
|
+
const Jt = { class: "flex-1 relative min-h-0" }, Kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm transition-all duration-300 bg-white relative" }, Qt = {
|
|
317
317
|
key: 0,
|
|
318
318
|
class: "absolute inset-0 flex flex-col items-center justify-center bg-slate-100 text-slate-400 text-sm p-4 text-center"
|
|
319
|
-
},
|
|
319
|
+
}, Zt = {
|
|
320
320
|
key: 1,
|
|
321
321
|
class: "relative w-full h-full"
|
|
322
|
-
},
|
|
322
|
+
}, ea = ["src"], ta = ["src", "autoplay", "controls"], aa = { class: "w-12 h-12 rounded-full bg-white/80 backdrop-blur-sm flex items-center justify-center shadow-sm" }, na = {
|
|
323
323
|
key: 3,
|
|
324
|
-
class: "absolute bottom-2 left-1/2 transform -translate-x-1/2 flex items-center justify-center"
|
|
325
|
-
},
|
|
324
|
+
class: "absolute bottom-2 left-1/2 transform -translate-x-1/2 flex items-center justify-center z-10"
|
|
325
|
+
}, oa = {
|
|
326
326
|
key: 4,
|
|
327
327
|
class: "absolute inset-0 flex flex-col items-center justify-center bg-slate-50 text-slate-400 text-sm p-4 text-center"
|
|
328
|
-
},
|
|
328
|
+
}, xe = /* @__PURE__ */ Qe({
|
|
329
329
|
__name: "MasonryItem",
|
|
330
330
|
props: {
|
|
331
331
|
item: {},
|
|
332
332
|
remove: {},
|
|
333
333
|
type: { default: void 0 },
|
|
334
|
-
notFound: { type: Boolean, default: void 0 }
|
|
334
|
+
notFound: { type: Boolean, default: void 0 },
|
|
335
|
+
headerHeight: { default: 0 },
|
|
336
|
+
footerHeight: { default: 0 },
|
|
337
|
+
isActive: { type: Boolean, default: !1 },
|
|
338
|
+
inSwipeMode: { type: Boolean, default: !1 }
|
|
335
339
|
},
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
340
|
+
emits: ["preload:success", "preload:error", "mouse-enter", "mouse-leave"],
|
|
341
|
+
setup(t, { emit: f }) {
|
|
342
|
+
const s = t, r = f, M = I(!1), d = I(!1), o = I(null), u = I(!1), y = I(!1), $ = I(null), m = I(!1), T = I(!1), P = I(!1), H = I(null), E = I(null);
|
|
343
|
+
let l = null;
|
|
344
|
+
const b = Z(() => {
|
|
345
|
+
var n;
|
|
346
|
+
return s.type ?? ((n = s.item) == null ? void 0 : n.type) ?? "image";
|
|
347
|
+
}), v = Z(() => {
|
|
348
|
+
var n;
|
|
349
|
+
return s.notFound ?? ((n = s.item) == null ? void 0 : n.notFound) ?? !1;
|
|
350
|
+
}), p = Z(() => !!s.inSwipeMode);
|
|
351
|
+
function z(n) {
|
|
352
|
+
r("mouse-enter", { item: s.item, type: n });
|
|
353
|
+
}
|
|
354
|
+
function k(n) {
|
|
355
|
+
r("mouse-leave", { item: s.item, type: n });
|
|
356
|
+
}
|
|
357
|
+
function D(n) {
|
|
358
|
+
if (p.value) return;
|
|
359
|
+
const w = n.target;
|
|
360
|
+
w && (w.paused ? w.play() : w.pause());
|
|
361
|
+
}
|
|
362
|
+
function g(n) {
|
|
363
|
+
const w = n.target;
|
|
364
|
+
w && (p.value || w.play(), z("video"));
|
|
365
|
+
}
|
|
366
|
+
function S(n) {
|
|
367
|
+
const w = n.target;
|
|
368
|
+
w && (p.value || w.pause(), k("video"));
|
|
369
|
+
}
|
|
370
|
+
function x(n) {
|
|
371
|
+
return new Promise((w, j) => {
|
|
372
|
+
if (!n) {
|
|
373
|
+
const W = new Error("No image source provided");
|
|
374
|
+
r("preload:error", { item: s.item, type: "image", src: n, error: W }), j(W);
|
|
350
375
|
return;
|
|
351
376
|
}
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
const
|
|
377
|
+
const F = new Image(), V = Date.now(), Y = 300;
|
|
378
|
+
F.onload = () => {
|
|
379
|
+
const W = Date.now() - V, G = Math.max(0, Y - W);
|
|
355
380
|
setTimeout(async () => {
|
|
356
|
-
|
|
357
|
-
},
|
|
358
|
-
},
|
|
359
|
-
|
|
360
|
-
|
|
381
|
+
M.value = !0, d.value = !1, T.value = !1, await X(), await new Promise((ae) => setTimeout(ae, 100)), P.value = !0, r("preload:success", { item: s.item, type: "image", src: n }), w();
|
|
382
|
+
}, G);
|
|
383
|
+
}, F.onerror = () => {
|
|
384
|
+
d.value = !0, M.value = !1, T.value = !1;
|
|
385
|
+
const W = new Error("Failed to load image");
|
|
386
|
+
r("preload:error", { item: s.item, type: "image", src: n, error: W }), j(W);
|
|
387
|
+
}, F.src = n;
|
|
361
388
|
});
|
|
362
389
|
}
|
|
363
|
-
function
|
|
364
|
-
return new Promise((
|
|
365
|
-
if (!
|
|
366
|
-
|
|
390
|
+
function A(n) {
|
|
391
|
+
return new Promise((w, j) => {
|
|
392
|
+
if (!n) {
|
|
393
|
+
const W = new Error("No video source provided");
|
|
394
|
+
r("preload:error", { item: s.item, type: "video", src: n, error: W }), j(W);
|
|
367
395
|
return;
|
|
368
396
|
}
|
|
369
|
-
const
|
|
370
|
-
|
|
371
|
-
const
|
|
397
|
+
const F = document.createElement("video"), V = Date.now(), Y = 300;
|
|
398
|
+
F.preload = "metadata", F.muted = !0, F.onloadedmetadata = () => {
|
|
399
|
+
const W = Date.now() - V, G = Math.max(0, Y - W);
|
|
372
400
|
setTimeout(async () => {
|
|
373
|
-
|
|
374
|
-
},
|
|
375
|
-
},
|
|
376
|
-
|
|
377
|
-
|
|
401
|
+
u.value = !0, y.value = !1, T.value = !1, await X(), await new Promise((ae) => setTimeout(ae, 100)), P.value = !0, r("preload:success", { item: s.item, type: "video", src: n }), w();
|
|
402
|
+
}, G);
|
|
403
|
+
}, F.onerror = () => {
|
|
404
|
+
y.value = !0, u.value = !1, T.value = !1;
|
|
405
|
+
const W = new Error("Failed to load video");
|
|
406
|
+
r("preload:error", { item: s.item, type: "video", src: n, error: W }), j(W);
|
|
407
|
+
}, F.src = n;
|
|
378
408
|
});
|
|
379
409
|
}
|
|
380
|
-
async function
|
|
381
|
-
var
|
|
382
|
-
if (!
|
|
410
|
+
async function N() {
|
|
411
|
+
var w;
|
|
412
|
+
if (!m.value || T.value || v.value || b.value === "video" && u.value || b.value === "image" && M.value)
|
|
383
413
|
return;
|
|
384
|
-
const
|
|
385
|
-
if (
|
|
386
|
-
if (
|
|
387
|
-
|
|
414
|
+
const n = (w = s.item) == null ? void 0 : w.src;
|
|
415
|
+
if (n)
|
|
416
|
+
if (T.value = !0, P.value = !1, b.value === "video") {
|
|
417
|
+
$.value = n, u.value = !1, y.value = !1;
|
|
388
418
|
try {
|
|
389
|
-
await
|
|
419
|
+
await A(n);
|
|
390
420
|
} catch {
|
|
391
421
|
}
|
|
392
422
|
} else {
|
|
393
|
-
|
|
423
|
+
o.value = n, M.value = !1, d.value = !1;
|
|
394
424
|
try {
|
|
395
|
-
await
|
|
425
|
+
await x(n);
|
|
396
426
|
} catch {
|
|
397
427
|
}
|
|
398
428
|
}
|
|
399
429
|
}
|
|
400
|
-
return
|
|
401
|
-
H.value && (
|
|
402
|
-
(
|
|
403
|
-
|
|
404
|
-
|
|
430
|
+
return Ze(() => {
|
|
431
|
+
H.value && (l = new IntersectionObserver(
|
|
432
|
+
(n) => {
|
|
433
|
+
n.forEach((w) => {
|
|
434
|
+
w.isIntersecting && w.intersectionRatio >= 1 ? m.value || (m.value = !0, N()) : w.isIntersecting;
|
|
405
435
|
});
|
|
406
436
|
},
|
|
407
437
|
{
|
|
408
438
|
// Only trigger when item is 100% visible (full height in view)
|
|
409
439
|
threshold: [1]
|
|
410
440
|
}
|
|
411
|
-
),
|
|
412
|
-
}),
|
|
413
|
-
|
|
414
|
-
}),
|
|
441
|
+
), l.observe(H.value));
|
|
442
|
+
}), et(() => {
|
|
443
|
+
l && (l.disconnect(), l = null);
|
|
444
|
+
}), re(
|
|
415
445
|
() => {
|
|
416
|
-
var
|
|
417
|
-
return (
|
|
446
|
+
var n;
|
|
447
|
+
return (n = s.item) == null ? void 0 : n.src;
|
|
418
448
|
},
|
|
419
|
-
async (
|
|
420
|
-
if (!(!
|
|
449
|
+
async (n) => {
|
|
450
|
+
if (!(!n || v.value)) {
|
|
421
451
|
if (b.value === "video") {
|
|
422
|
-
if (
|
|
423
|
-
|
|
452
|
+
if (n !== $.value && (u.value = !1, y.value = !1, $.value = n, m.value)) {
|
|
453
|
+
T.value = !0;
|
|
424
454
|
try {
|
|
425
|
-
await
|
|
455
|
+
await A(n);
|
|
426
456
|
} catch {
|
|
427
457
|
}
|
|
428
458
|
}
|
|
429
|
-
} else if (
|
|
430
|
-
|
|
459
|
+
} else if (n !== o.value && (M.value = !1, d.value = !1, o.value = n, m.value)) {
|
|
460
|
+
T.value = !0;
|
|
431
461
|
try {
|
|
432
|
-
await
|
|
462
|
+
await x(n);
|
|
433
463
|
} catch {
|
|
434
464
|
}
|
|
435
465
|
}
|
|
436
466
|
}
|
|
437
467
|
}
|
|
438
|
-
), (
|
|
468
|
+
), re(
|
|
469
|
+
() => s.isActive,
|
|
470
|
+
(n) => {
|
|
471
|
+
!p.value || !E.value || (n ? E.value.play() : E.value.pause());
|
|
472
|
+
}
|
|
473
|
+
), (n, w) => (O(), B("div", {
|
|
439
474
|
ref_key: "containerRef",
|
|
440
475
|
ref: H,
|
|
441
|
-
class: "relative w-full h-full
|
|
476
|
+
class: "relative w-full h-full flex flex-col"
|
|
442
477
|
}, [
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
478
|
+
n.headerHeight > 0 ? (O(), B("div", {
|
|
479
|
+
key: 0,
|
|
480
|
+
class: "relative z-10",
|
|
481
|
+
style: ge({ height: `${n.headerHeight}px` })
|
|
482
|
+
}, [
|
|
483
|
+
ne(n.$slots, "header", {
|
|
484
|
+
item: n.item,
|
|
485
|
+
remove: n.remove,
|
|
486
|
+
imageLoaded: M.value,
|
|
487
|
+
imageError: d.value,
|
|
488
|
+
videoLoaded: u.value,
|
|
489
|
+
videoError: y.value,
|
|
490
|
+
showNotFound: v.value,
|
|
491
|
+
isLoading: T.value,
|
|
492
|
+
mediaType: b.value
|
|
493
|
+
})
|
|
494
|
+
], 4)) : le("", !0),
|
|
495
|
+
q("div", Jt, [
|
|
496
|
+
ne(n.$slots, "default", {
|
|
497
|
+
item: n.item,
|
|
498
|
+
remove: n.remove,
|
|
499
|
+
imageLoaded: M.value,
|
|
500
|
+
imageError: d.value,
|
|
501
|
+
videoLoaded: u.value,
|
|
502
|
+
videoError: y.value,
|
|
503
|
+
showNotFound: v.value,
|
|
504
|
+
isLoading: T.value,
|
|
505
|
+
mediaType: b.value,
|
|
506
|
+
imageSrc: o.value,
|
|
507
|
+
videoSrc: $.value,
|
|
508
|
+
showMedia: P.value
|
|
509
|
+
}, () => [
|
|
510
|
+
q("div", Kt, [
|
|
511
|
+
v.value ? (O(), B("div", Qt, w[3] || (w[3] = [
|
|
512
|
+
q("i", { class: "fas fa-search text-3xl mb-3 opacity-50" }, null, -1),
|
|
513
|
+
q("span", { class: "font-medium" }, "Not Found", -1),
|
|
514
|
+
q("span", { class: "text-xs mt-1 opacity-75" }, "This item could not be located", -1)
|
|
515
|
+
]))) : (O(), B("div", Zt, [
|
|
516
|
+
b.value === "image" && o.value ? (O(), B("img", {
|
|
517
|
+
key: 0,
|
|
518
|
+
src: o.value,
|
|
519
|
+
class: ie([
|
|
520
|
+
"w-full h-full object-cover transition-opacity duration-700 ease-in-out",
|
|
521
|
+
M.value && P.value ? "opacity-100" : "opacity-0"
|
|
522
|
+
]),
|
|
523
|
+
style: { position: "absolute", top: "0", left: "0" },
|
|
524
|
+
loading: "lazy",
|
|
525
|
+
decoding: "async",
|
|
526
|
+
alt: "",
|
|
527
|
+
onMouseenter: w[0] || (w[0] = (j) => z("image")),
|
|
528
|
+
onMouseleave: w[1] || (w[1] = (j) => k("image"))
|
|
529
|
+
}, null, 42, ea)) : le("", !0),
|
|
530
|
+
b.value === "video" && $.value ? (O(), B("video", {
|
|
531
|
+
key: 1,
|
|
532
|
+
ref_key: "videoEl",
|
|
533
|
+
ref: E,
|
|
534
|
+
src: $.value,
|
|
535
|
+
class: ie([
|
|
536
|
+
"w-full h-full object-cover transition-opacity duration-700 ease-in-out",
|
|
537
|
+
u.value && P.value ? "opacity-100" : "opacity-0"
|
|
538
|
+
]),
|
|
539
|
+
style: { position: "absolute", top: "0", left: "0" },
|
|
540
|
+
muted: "",
|
|
541
|
+
loop: "",
|
|
542
|
+
playsinline: "",
|
|
543
|
+
autoplay: p.value && s.isActive,
|
|
544
|
+
controls: p.value,
|
|
545
|
+
onClick: Ve(D, ["stop"]),
|
|
546
|
+
onTouchend: Ve(D, ["stop", "prevent"]),
|
|
547
|
+
onMouseenter: g,
|
|
548
|
+
onMouseleave: S,
|
|
549
|
+
onError: w[2] || (w[2] = (j) => y.value = !0)
|
|
550
|
+
}, null, 42, ta)) : le("", !0),
|
|
551
|
+
!M.value && !u.value && !d.value && !y.value ? (O(), B("div", {
|
|
552
|
+
key: 2,
|
|
553
|
+
class: ie([
|
|
554
|
+
"absolute inset-0 bg-slate-100 flex items-center justify-center transition-opacity duration-500",
|
|
555
|
+
P.value ? "opacity-0 pointer-events-none" : "opacity-100"
|
|
556
|
+
])
|
|
557
|
+
}, [
|
|
558
|
+
q("div", aa, [
|
|
559
|
+
q("i", {
|
|
560
|
+
class: ie(b.value === "video" ? "fas fa-video text-xl text-slate-400" : "fas fa-image text-xl text-slate-400")
|
|
561
|
+
}, null, 2)
|
|
562
|
+
])
|
|
563
|
+
], 2)) : le("", !0),
|
|
564
|
+
T.value ? (O(), B("div", na, w[4] || (w[4] = [
|
|
565
|
+
q("div", { class: "bg-white/90 backdrop-blur-sm rounded-full px-3 py-1.5 shadow-sm" }, [
|
|
566
|
+
q("div", { class: "animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500" })
|
|
567
|
+
], -1)
|
|
568
|
+
]))) : le("", !0),
|
|
569
|
+
b.value === "image" && d.value || b.value === "video" && y.value ? (O(), B("div", oa, [
|
|
570
|
+
q("i", {
|
|
571
|
+
class: ie(b.value === "video" ? "fas fa-video text-2xl mb-2 opacity-50" : "fas fa-image text-2xl mb-2 opacity-50")
|
|
572
|
+
}, null, 2),
|
|
573
|
+
q("span", null, "Failed to load " + pt(b.value), 1)
|
|
574
|
+
])) : le("", !0)
|
|
575
|
+
]))
|
|
532
576
|
])
|
|
533
577
|
])
|
|
534
|
-
])
|
|
578
|
+
]),
|
|
579
|
+
n.footerHeight > 0 ? (O(), B("div", {
|
|
580
|
+
key: 1,
|
|
581
|
+
class: "relative z-10",
|
|
582
|
+
style: ge({ height: `${n.footerHeight}px` })
|
|
583
|
+
}, [
|
|
584
|
+
ne(n.$slots, "footer", {
|
|
585
|
+
item: n.item,
|
|
586
|
+
remove: n.remove,
|
|
587
|
+
imageLoaded: M.value,
|
|
588
|
+
imageError: d.value,
|
|
589
|
+
videoLoaded: u.value,
|
|
590
|
+
videoError: y.value,
|
|
591
|
+
showNotFound: v.value,
|
|
592
|
+
isLoading: T.value,
|
|
593
|
+
mediaType: b.value
|
|
594
|
+
})
|
|
595
|
+
], 4)) : le("", !0)
|
|
535
596
|
], 512));
|
|
536
597
|
}
|
|
537
|
-
}),
|
|
598
|
+
}), ra = { class: "w-full h-full flex items-center justify-center p-4" }, la = { class: "w-full h-full max-w-full max-h-full relative" }, ia = /* @__PURE__ */ Qe({
|
|
538
599
|
__name: "Masonry",
|
|
539
600
|
props: {
|
|
540
601
|
getNextPage: {
|
|
@@ -644,10 +705,16 @@ const Jt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
|
|
|
644
705
|
"retry:start",
|
|
645
706
|
"retry:tick",
|
|
646
707
|
"retry:stop",
|
|
647
|
-
"remove-all:complete"
|
|
708
|
+
"remove-all:complete",
|
|
709
|
+
// Re-emit item-level preload events from the default MasonryItem
|
|
710
|
+
"item:preload:success",
|
|
711
|
+
"item:preload:error",
|
|
712
|
+
// Mouse events from MasonryItem content
|
|
713
|
+
"item:mouse-enter",
|
|
714
|
+
"item:mouse-leave"
|
|
648
715
|
],
|
|
649
|
-
setup(t, { expose:
|
|
650
|
-
const
|
|
716
|
+
setup(t, { expose: f, emit: s }) {
|
|
717
|
+
const r = t, M = {
|
|
651
718
|
sizes: { base: 1, sm: 2, md: 3, lg: 4, xl: 5, "2xl": 6 },
|
|
652
719
|
gutterX: 10,
|
|
653
720
|
gutterY: 10,
|
|
@@ -656,19 +723,19 @@ const Jt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
|
|
|
656
723
|
paddingLeft: 0,
|
|
657
724
|
paddingRight: 0,
|
|
658
725
|
placement: "masonry"
|
|
659
|
-
},
|
|
726
|
+
}, d = Z(() => {
|
|
660
727
|
var e;
|
|
661
728
|
return {
|
|
662
|
-
...
|
|
663
|
-
...
|
|
729
|
+
...M,
|
|
730
|
+
...r.layout,
|
|
664
731
|
sizes: {
|
|
665
|
-
...
|
|
666
|
-
...((e =
|
|
732
|
+
...M.sizes,
|
|
733
|
+
...((e = r.layout) == null ? void 0 : e.sizes) || {}
|
|
667
734
|
}
|
|
668
735
|
};
|
|
669
|
-
}),
|
|
670
|
-
let
|
|
671
|
-
function
|
|
736
|
+
}), o = I(null), u = I(typeof window < "u" ? window.innerWidth : 1024);
|
|
737
|
+
let y = null;
|
|
738
|
+
function $(e) {
|
|
672
739
|
return {
|
|
673
740
|
sm: 640,
|
|
674
741
|
md: 768,
|
|
@@ -677,48 +744,48 @@ const Jt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
|
|
|
677
744
|
"2xl": 1536
|
|
678
745
|
}[e] || 768;
|
|
679
746
|
}
|
|
680
|
-
const
|
|
681
|
-
if (
|
|
682
|
-
if (
|
|
683
|
-
const e = typeof
|
|
684
|
-
return
|
|
685
|
-
}),
|
|
686
|
-
if (!
|
|
687
|
-
const e = Math.max(0, Math.min(
|
|
688
|
-
return
|
|
689
|
-
}),
|
|
690
|
-
if (!
|
|
691
|
-
const e =
|
|
692
|
-
return e >=
|
|
693
|
-
}),
|
|
694
|
-
if (!
|
|
695
|
-
const e =
|
|
696
|
-
return e < 0 ? null :
|
|
697
|
-
}),
|
|
698
|
-
get: () =>
|
|
699
|
-
set: (e) =>
|
|
700
|
-
}),
|
|
701
|
-
function
|
|
747
|
+
const m = Z(() => {
|
|
748
|
+
if (r.layoutMode === "masonry") return !1;
|
|
749
|
+
if (r.layoutMode === "swipe") return !0;
|
|
750
|
+
const e = typeof r.mobileBreakpoint == "string" ? $(r.mobileBreakpoint) : r.mobileBreakpoint;
|
|
751
|
+
return u.value < e;
|
|
752
|
+
}), T = Z(() => {
|
|
753
|
+
if (!m.value || l.value.length === 0) return null;
|
|
754
|
+
const e = Math.max(0, Math.min(g.value, l.value.length - 1));
|
|
755
|
+
return l.value[e] || null;
|
|
756
|
+
}), P = Z(() => {
|
|
757
|
+
if (!m.value || !T.value) return null;
|
|
758
|
+
const e = g.value + 1;
|
|
759
|
+
return e >= l.value.length ? null : l.value[e] || null;
|
|
760
|
+
}), H = Z(() => {
|
|
761
|
+
if (!m.value || !T.value) return null;
|
|
762
|
+
const e = g.value - 1;
|
|
763
|
+
return e < 0 ? null : l.value[e] || null;
|
|
764
|
+
}), E = s, l = Z({
|
|
765
|
+
get: () => r.items,
|
|
766
|
+
set: (e) => E("update:items", e)
|
|
767
|
+
}), b = I(7), v = I(null), p = I([]), z = I(null), k = I(!1), D = I(0), g = I(0), S = I(0), x = I(!1), A = I(0), N = I(0), n = I(null), w = I(/* @__PURE__ */ new Set());
|
|
768
|
+
function j(e) {
|
|
702
769
|
return typeof e == "number" && Number.isFinite(e) && e > 0;
|
|
703
770
|
}
|
|
704
|
-
function
|
|
771
|
+
function F(e, a) {
|
|
705
772
|
try {
|
|
706
773
|
if (!Array.isArray(e) || e.length === 0) return;
|
|
707
|
-
const
|
|
708
|
-
if (
|
|
709
|
-
const
|
|
710
|
-
for (const
|
|
711
|
-
const
|
|
712
|
-
|
|
774
|
+
const i = e.filter((c) => !j(c == null ? void 0 : c.width) || !j(c == null ? void 0 : c.height));
|
|
775
|
+
if (i.length === 0) return;
|
|
776
|
+
const h = [];
|
|
777
|
+
for (const c of i) {
|
|
778
|
+
const U = (c == null ? void 0 : c.id) ?? `idx:${e.indexOf(c)}`;
|
|
779
|
+
w.value.has(U) || (w.value.add(U), h.push(U));
|
|
713
780
|
}
|
|
714
|
-
if (
|
|
715
|
-
const
|
|
781
|
+
if (h.length > 0) {
|
|
782
|
+
const c = h.slice(0, 10);
|
|
716
783
|
console.warn(
|
|
717
784
|
"[Masonry] Items missing width/height detected:",
|
|
718
785
|
{
|
|
719
|
-
context:
|
|
720
|
-
count:
|
|
721
|
-
sampleIds:
|
|
786
|
+
context: a,
|
|
787
|
+
count: h.length,
|
|
788
|
+
sampleIds: c,
|
|
722
789
|
hint: "Ensure each item has positive width and height. Consider providing fallbacks (e.g., 512x512) at the data layer."
|
|
723
790
|
}
|
|
724
791
|
);
|
|
@@ -726,452 +793,480 @@ const Jt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
|
|
|
726
793
|
} catch {
|
|
727
794
|
}
|
|
728
795
|
}
|
|
729
|
-
const V =
|
|
796
|
+
const V = I(0), Y = I(0), W = r.virtualBufferPx, G = I(!1), ae = I({
|
|
730
797
|
distanceToTrigger: 0,
|
|
731
798
|
isNearTrigger: !1
|
|
732
|
-
}),
|
|
733
|
-
if (!
|
|
734
|
-
const { scrollTop:
|
|
735
|
-
|
|
736
|
-
distanceToTrigger: Math.round(
|
|
737
|
-
isNearTrigger:
|
|
799
|
+
}), L = (e) => {
|
|
800
|
+
if (!v.value) return;
|
|
801
|
+
const { scrollTop: a, clientHeight: i } = v.value, h = a + i, c = e ?? He(l.value, b.value), U = c.length ? Math.max(...c) : 0, Q = typeof r.loadThresholdPx == "number" ? r.loadThresholdPx : 200, ce = Q >= 0 ? Math.max(0, U - Q) : Math.max(0, U + Q), qe = Math.max(0, ce - h), mt = qe <= 100;
|
|
802
|
+
ae.value = {
|
|
803
|
+
distanceToTrigger: Math.round(qe),
|
|
804
|
+
isNearTrigger: mt
|
|
738
805
|
};
|
|
739
|
-
}, { onEnter:
|
|
740
|
-
function
|
|
741
|
-
if (
|
|
742
|
-
const
|
|
743
|
-
e.style.transition = "none", e.style.opacity = "1", e.style.transform = `translate3d(${
|
|
744
|
-
e.style.transition = "",
|
|
806
|
+
}, { onEnter: R, onBeforeEnter: _, onBeforeLeave: oe, onLeave: J } = Xt(l, { leaveDurationMs: r.leaveDurationMs });
|
|
807
|
+
function se(e, a) {
|
|
808
|
+
if (G.value) {
|
|
809
|
+
const i = parseInt(e.dataset.left || "0", 10), h = parseInt(e.dataset.top || "0", 10);
|
|
810
|
+
e.style.transition = "none", e.style.opacity = "1", e.style.transform = `translate3d(${i}px, ${h}px, 0) scale(1)`, e.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
|
|
811
|
+
e.style.transition = "", a();
|
|
745
812
|
});
|
|
746
813
|
} else
|
|
747
|
-
|
|
814
|
+
R(e, a);
|
|
748
815
|
}
|
|
749
|
-
function
|
|
750
|
-
if (
|
|
751
|
-
const
|
|
752
|
-
e.style.transition = "none", e.style.opacity = "1", e.style.transform = `translate3d(${
|
|
816
|
+
function K(e) {
|
|
817
|
+
if (G.value) {
|
|
818
|
+
const a = parseInt(e.dataset.left || "0", 10), i = parseInt(e.dataset.top || "0", 10);
|
|
819
|
+
e.style.transition = "none", e.style.opacity = "1", e.style.transform = `translate3d(${a}px, ${i}px, 0) scale(1)`, e.style.removeProperty("--masonry-opacity-delay");
|
|
753
820
|
} else
|
|
754
821
|
_(e);
|
|
755
822
|
}
|
|
756
|
-
function
|
|
757
|
-
|
|
823
|
+
function nt(e) {
|
|
824
|
+
G.value || oe(e);
|
|
758
825
|
}
|
|
759
|
-
function
|
|
760
|
-
|
|
826
|
+
function ot(e, a) {
|
|
827
|
+
G.value ? a() : J(e, a);
|
|
761
828
|
}
|
|
762
|
-
const
|
|
763
|
-
const e = V.value -
|
|
764
|
-
return !
|
|
765
|
-
const
|
|
766
|
-
return
|
|
829
|
+
const rt = Z(() => {
|
|
830
|
+
const e = V.value - W, a = V.value + Y.value + W, i = l.value;
|
|
831
|
+
return !i || i.length === 0 ? [] : i.filter((h) => {
|
|
832
|
+
const c = h.top;
|
|
833
|
+
return h.top + h.columnHeight >= e && c <= a;
|
|
767
834
|
});
|
|
768
|
-
}), { handleScroll: lt } =
|
|
769
|
-
container:
|
|
770
|
-
masonry:
|
|
771
|
-
columns:
|
|
772
|
-
containerHeight:
|
|
773
|
-
isLoading:
|
|
774
|
-
pageSize:
|
|
775
|
-
refreshLayout:
|
|
835
|
+
}), { handleScroll: lt } = _t({
|
|
836
|
+
container: v,
|
|
837
|
+
masonry: l,
|
|
838
|
+
columns: b,
|
|
839
|
+
containerHeight: D,
|
|
840
|
+
isLoading: k,
|
|
841
|
+
pageSize: r.pageSize,
|
|
842
|
+
refreshLayout: ee,
|
|
776
843
|
setItemsRaw: (e) => {
|
|
777
|
-
|
|
844
|
+
l.value = e;
|
|
778
845
|
},
|
|
779
|
-
loadNext:
|
|
780
|
-
loadThresholdPx:
|
|
846
|
+
loadNext: ue,
|
|
847
|
+
loadThresholdPx: r.loadThresholdPx
|
|
781
848
|
});
|
|
782
|
-
|
|
783
|
-
isLoading:
|
|
784
|
-
refreshLayout:
|
|
785
|
-
containerHeight:
|
|
786
|
-
remove:
|
|
787
|
-
removeMany:
|
|
788
|
-
removeAll:
|
|
789
|
-
loadNext:
|
|
790
|
-
loadPage:
|
|
791
|
-
refreshCurrentPage:
|
|
792
|
-
reset:
|
|
793
|
-
init:
|
|
794
|
-
paginationHistory:
|
|
795
|
-
cancelLoad:
|
|
796
|
-
scrollToTop:
|
|
797
|
-
totalItems:
|
|
849
|
+
f({
|
|
850
|
+
isLoading: k,
|
|
851
|
+
refreshLayout: ee,
|
|
852
|
+
containerHeight: D,
|
|
853
|
+
remove: fe,
|
|
854
|
+
removeMany: ut,
|
|
855
|
+
removeAll: ct,
|
|
856
|
+
loadNext: ue,
|
|
857
|
+
loadPage: Me,
|
|
858
|
+
refreshCurrentPage: Te,
|
|
859
|
+
reset: vt,
|
|
860
|
+
init: dt,
|
|
861
|
+
paginationHistory: p,
|
|
862
|
+
cancelLoad: De,
|
|
863
|
+
scrollToTop: We,
|
|
864
|
+
totalItems: Z(() => l.value.length)
|
|
798
865
|
});
|
|
799
|
-
function
|
|
800
|
-
const
|
|
801
|
-
let
|
|
802
|
-
if (
|
|
803
|
-
const { scrollTop:
|
|
804
|
-
|
|
866
|
+
function it(e) {
|
|
867
|
+
const a = Yt(e);
|
|
868
|
+
let i = 0;
|
|
869
|
+
if (v.value) {
|
|
870
|
+
const { scrollTop: h, clientHeight: c } = v.value;
|
|
871
|
+
i = h + c + 100;
|
|
805
872
|
}
|
|
806
|
-
|
|
873
|
+
D.value = Math.max(a, i);
|
|
807
874
|
}
|
|
808
|
-
function
|
|
809
|
-
if (
|
|
810
|
-
|
|
875
|
+
function ee(e) {
|
|
876
|
+
if (m.value) {
|
|
877
|
+
l.value = e;
|
|
811
878
|
return;
|
|
812
879
|
}
|
|
813
|
-
if (!
|
|
814
|
-
|
|
815
|
-
const
|
|
816
|
-
...
|
|
817
|
-
originalIndex:
|
|
818
|
-
})),
|
|
819
|
-
|
|
880
|
+
if (!v.value) return;
|
|
881
|
+
F(e, "refreshLayout");
|
|
882
|
+
const a = e.map((h, c) => ({
|
|
883
|
+
...h,
|
|
884
|
+
originalIndex: h.originalIndex ?? c
|
|
885
|
+
})), i = wt(a, v.value, b.value, d.value);
|
|
886
|
+
it(i), l.value = i;
|
|
820
887
|
}
|
|
821
|
-
function
|
|
822
|
-
return new Promise((
|
|
823
|
-
const
|
|
824
|
-
|
|
825
|
-
const
|
|
826
|
-
if (
|
|
827
|
-
clearInterval(
|
|
888
|
+
function Ne(e, a) {
|
|
889
|
+
return new Promise((i) => {
|
|
890
|
+
const h = Math.max(0, e | 0), c = Date.now();
|
|
891
|
+
a(h, h);
|
|
892
|
+
const U = setInterval(() => {
|
|
893
|
+
if (C.value) {
|
|
894
|
+
clearInterval(U), i();
|
|
828
895
|
return;
|
|
829
896
|
}
|
|
830
|
-
const
|
|
831
|
-
|
|
897
|
+
const Q = Date.now() - c, ce = Math.max(0, h - Q);
|
|
898
|
+
a(ce, h), ce <= 0 && (clearInterval(U), i());
|
|
832
899
|
}, 100);
|
|
833
900
|
});
|
|
834
901
|
}
|
|
835
|
-
async function
|
|
902
|
+
async function ye(e) {
|
|
836
903
|
try {
|
|
837
|
-
const
|
|
838
|
-
return
|
|
839
|
-
} catch (
|
|
840
|
-
throw console.error("Error in getContent:",
|
|
904
|
+
const a = await st(() => r.getNextPage(e));
|
|
905
|
+
return ee([...l.value, ...a.items]), a;
|
|
906
|
+
} catch (a) {
|
|
907
|
+
throw console.error("Error in getContent:", a), a;
|
|
841
908
|
}
|
|
842
909
|
}
|
|
843
|
-
async function
|
|
844
|
-
let
|
|
845
|
-
const
|
|
846
|
-
let
|
|
910
|
+
async function st(e) {
|
|
911
|
+
let a = 0;
|
|
912
|
+
const i = r.retryMaxAttempts;
|
|
913
|
+
let h = r.retryInitialDelayMs;
|
|
847
914
|
for (; ; )
|
|
848
915
|
try {
|
|
849
|
-
const
|
|
850
|
-
return
|
|
851
|
-
} catch (
|
|
852
|
-
if (
|
|
853
|
-
throw
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
}),
|
|
916
|
+
const c = await e();
|
|
917
|
+
return a > 0 && E("retry:stop", { attempt: a, success: !0 }), c;
|
|
918
|
+
} catch (c) {
|
|
919
|
+
if (a++, a > i)
|
|
920
|
+
throw E("retry:stop", { attempt: a - 1, success: !1 }), c;
|
|
921
|
+
E("retry:start", { attempt: a, max: i, totalMs: h }), await Ne(h, (U, Q) => {
|
|
922
|
+
E("retry:tick", { attempt: a, remainingMs: U, totalMs: Q });
|
|
923
|
+
}), h += r.retryBackoffStepMs;
|
|
857
924
|
}
|
|
858
925
|
}
|
|
859
|
-
async function
|
|
860
|
-
if (!
|
|
861
|
-
|
|
926
|
+
async function Me(e) {
|
|
927
|
+
if (!k.value) {
|
|
928
|
+
C.value = !1, k.value = !0;
|
|
862
929
|
try {
|
|
863
|
-
const
|
|
864
|
-
if (
|
|
865
|
-
const
|
|
866
|
-
return
|
|
867
|
-
} catch (
|
|
868
|
-
throw console.error("Error loading page:",
|
|
930
|
+
const a = l.value.length;
|
|
931
|
+
if (C.value) return;
|
|
932
|
+
const i = await ye(e);
|
|
933
|
+
return C.value ? void 0 : (z.value = e, p.value.push(i.nextPage), await ve(a), i);
|
|
934
|
+
} catch (a) {
|
|
935
|
+
throw console.error("Error loading page:", a), a;
|
|
869
936
|
} finally {
|
|
870
|
-
|
|
937
|
+
k.value = !1;
|
|
871
938
|
}
|
|
872
939
|
}
|
|
873
940
|
}
|
|
874
|
-
async function
|
|
875
|
-
if (!
|
|
876
|
-
|
|
941
|
+
async function ue() {
|
|
942
|
+
if (!k.value) {
|
|
943
|
+
C.value = !1, k.value = !0;
|
|
877
944
|
try {
|
|
878
|
-
const e =
|
|
879
|
-
if (
|
|
880
|
-
const
|
|
881
|
-
return
|
|
945
|
+
const e = l.value.length;
|
|
946
|
+
if (C.value) return;
|
|
947
|
+
const a = p.value[p.value.length - 1], i = await ye(a);
|
|
948
|
+
return C.value ? void 0 : (z.value = a, p.value.push(i.nextPage), await ve(e), i);
|
|
882
949
|
} catch (e) {
|
|
883
950
|
throw console.error("Error loading next page:", e), e;
|
|
884
951
|
} finally {
|
|
885
|
-
|
|
952
|
+
k.value = !1;
|
|
886
953
|
}
|
|
887
954
|
}
|
|
888
955
|
}
|
|
889
|
-
async function
|
|
890
|
-
if (
|
|
891
|
-
|
|
956
|
+
async function Te() {
|
|
957
|
+
if (!k.value) {
|
|
958
|
+
C.value = !1, k.value = !0;
|
|
892
959
|
try {
|
|
893
|
-
const e =
|
|
894
|
-
if (
|
|
895
|
-
console.warn("[Masonry] No current page to refresh - currentPage:",
|
|
960
|
+
const e = z.value;
|
|
961
|
+
if (e == null) {
|
|
962
|
+
console.warn("[Masonry] No current page to refresh - currentPage:", z.value, "paginationHistory:", p.value);
|
|
896
963
|
return;
|
|
897
964
|
}
|
|
898
|
-
|
|
899
|
-
const
|
|
900
|
-
if (
|
|
901
|
-
|
|
902
|
-
const
|
|
903
|
-
return await
|
|
965
|
+
l.value = [], D.value = 0, p.value = [e], await X();
|
|
966
|
+
const a = await ye(e);
|
|
967
|
+
if (C.value) return;
|
|
968
|
+
z.value = e, p.value.push(a.nextPage);
|
|
969
|
+
const i = l.value.length;
|
|
970
|
+
return await ve(i), a;
|
|
904
971
|
} catch (e) {
|
|
905
972
|
throw console.error("[Masonry] Error refreshing current page:", e), e;
|
|
906
973
|
} finally {
|
|
907
|
-
|
|
974
|
+
k.value = !1;
|
|
908
975
|
}
|
|
909
976
|
}
|
|
910
977
|
}
|
|
911
|
-
async function
|
|
912
|
-
const
|
|
913
|
-
if (
|
|
914
|
-
if (
|
|
915
|
-
|
|
916
|
-
else
|
|
917
|
-
console.log("[Masonry] All items removed, calling loadNext and forcing backfill");
|
|
978
|
+
async function fe(e) {
|
|
979
|
+
const a = l.value.filter((i) => i.id !== e.id);
|
|
980
|
+
if (l.value = a, await X(), a.length === 0 && p.value.length > 0) {
|
|
981
|
+
if (r.autoRefreshOnEmpty)
|
|
982
|
+
await Te();
|
|
983
|
+
else
|
|
918
984
|
try {
|
|
919
|
-
await
|
|
985
|
+
await ue(), await ve(0, !0);
|
|
920
986
|
} catch {
|
|
921
987
|
}
|
|
922
|
-
}
|
|
923
988
|
return;
|
|
924
989
|
}
|
|
925
|
-
await new Promise((
|
|
926
|
-
|
|
990
|
+
await new Promise((i) => requestAnimationFrame(() => i())), requestAnimationFrame(() => {
|
|
991
|
+
ee(a);
|
|
927
992
|
});
|
|
928
993
|
}
|
|
929
|
-
async function
|
|
994
|
+
async function ut(e) {
|
|
930
995
|
if (!e || e.length === 0) return;
|
|
931
|
-
const
|
|
932
|
-
if (
|
|
933
|
-
if (
|
|
934
|
-
await
|
|
996
|
+
const a = new Set(e.map((h) => h.id)), i = l.value.filter((h) => !a.has(h.id));
|
|
997
|
+
if (l.value = i, await X(), i.length === 0 && p.value.length > 0) {
|
|
998
|
+
if (r.autoRefreshOnEmpty)
|
|
999
|
+
await Te();
|
|
935
1000
|
else
|
|
936
1001
|
try {
|
|
937
|
-
await
|
|
1002
|
+
await ue(), await ve(0, !0);
|
|
938
1003
|
} catch {
|
|
939
1004
|
}
|
|
940
1005
|
return;
|
|
941
1006
|
}
|
|
942
|
-
await new Promise((
|
|
943
|
-
|
|
1007
|
+
await new Promise((h) => requestAnimationFrame(() => h())), requestAnimationFrame(() => {
|
|
1008
|
+
ee(i);
|
|
944
1009
|
});
|
|
945
1010
|
}
|
|
946
|
-
function
|
|
947
|
-
|
|
1011
|
+
function We(e) {
|
|
1012
|
+
v.value && v.value.scrollTo({
|
|
948
1013
|
top: 0,
|
|
949
1014
|
behavior: (e == null ? void 0 : e.behavior) ?? "smooth",
|
|
950
1015
|
...e
|
|
951
1016
|
});
|
|
952
1017
|
}
|
|
953
|
-
async function
|
|
954
|
-
|
|
1018
|
+
async function ct() {
|
|
1019
|
+
We({ behavior: "smooth" }), l.value = [], D.value = 0, await X(), E("remove-all:complete");
|
|
955
1020
|
}
|
|
956
|
-
function
|
|
957
|
-
|
|
1021
|
+
function ft() {
|
|
1022
|
+
b.value = he(d.value), ee(l.value), v.value && (V.value = v.value.scrollTop, Y.value = v.value.clientHeight);
|
|
958
1023
|
}
|
|
959
|
-
let
|
|
960
|
-
const
|
|
961
|
-
async function
|
|
962
|
-
if (!
|
|
963
|
-
const
|
|
964
|
-
if (!(!
|
|
965
|
-
|
|
1024
|
+
let we = !1;
|
|
1025
|
+
const C = I(!1);
|
|
1026
|
+
async function ve(e, a = !1) {
|
|
1027
|
+
if (!a && !r.backfillEnabled || we || C.value) return;
|
|
1028
|
+
const i = (e || 0) + (r.pageSize || 0);
|
|
1029
|
+
if (!(!r.pageSize || r.pageSize <= 0 || p.value[p.value.length - 1] == null) && !(l.value.length >= i)) {
|
|
1030
|
+
we = !0;
|
|
966
1031
|
try {
|
|
967
|
-
let
|
|
968
|
-
for (
|
|
969
|
-
|
|
970
|
-
fetched:
|
|
971
|
-
target:
|
|
972
|
-
calls:
|
|
973
|
-
remainingMs:
|
|
974
|
-
totalMs:
|
|
1032
|
+
let c = 0;
|
|
1033
|
+
for (E("backfill:start", { target: i, fetched: l.value.length, calls: c }); l.value.length < i && c < r.backfillMaxCalls && p.value[p.value.length - 1] != null && !C.value && (await Ne(r.backfillDelayMs, (Q, ce) => {
|
|
1034
|
+
E("backfill:tick", {
|
|
1035
|
+
fetched: l.value.length,
|
|
1036
|
+
target: i,
|
|
1037
|
+
calls: c,
|
|
1038
|
+
remainingMs: Q,
|
|
1039
|
+
totalMs: ce
|
|
975
1040
|
});
|
|
976
|
-
}), !
|
|
977
|
-
const
|
|
1041
|
+
}), !C.value); ) {
|
|
1042
|
+
const U = p.value[p.value.length - 1];
|
|
978
1043
|
try {
|
|
979
|
-
|
|
980
|
-
const
|
|
981
|
-
if (
|
|
982
|
-
|
|
1044
|
+
k.value = !0;
|
|
1045
|
+
const Q = await ye(U);
|
|
1046
|
+
if (C.value) break;
|
|
1047
|
+
p.value.push(Q.nextPage);
|
|
983
1048
|
} finally {
|
|
984
|
-
|
|
1049
|
+
k.value = !1;
|
|
985
1050
|
}
|
|
986
|
-
|
|
1051
|
+
c++;
|
|
987
1052
|
}
|
|
988
|
-
|
|
1053
|
+
E("backfill:stop", { fetched: l.value.length, calls: c });
|
|
989
1054
|
} finally {
|
|
990
|
-
|
|
1055
|
+
we = !1;
|
|
991
1056
|
}
|
|
992
1057
|
}
|
|
993
1058
|
}
|
|
994
|
-
function
|
|
995
|
-
|
|
1059
|
+
function De() {
|
|
1060
|
+
C.value = !0, k.value = !1, we = !1;
|
|
996
1061
|
}
|
|
997
|
-
function
|
|
998
|
-
|
|
1062
|
+
function vt() {
|
|
1063
|
+
De(), C.value = !1, v.value && v.value.scrollTo({
|
|
999
1064
|
top: 0,
|
|
1000
1065
|
behavior: "smooth"
|
|
1001
|
-
}),
|
|
1066
|
+
}), l.value = [], D.value = 0, z.value = r.loadAtPage, p.value = [r.loadAtPage], ae.value = {
|
|
1002
1067
|
distanceToTrigger: 0,
|
|
1003
1068
|
isNearTrigger: !1
|
|
1004
1069
|
};
|
|
1005
1070
|
}
|
|
1006
|
-
const
|
|
1007
|
-
if (
|
|
1008
|
-
|
|
1009
|
-
const e =
|
|
1010
|
-
lt(e),
|
|
1011
|
-
}, 200),
|
|
1012
|
-
function
|
|
1013
|
-
|
|
1071
|
+
const Ee = Je(async () => {
|
|
1072
|
+
if (m.value) return;
|
|
1073
|
+
v.value && (V.value = v.value.scrollTop, Y.value = v.value.clientHeight), G.value = !0, await X(), await new Promise((a) => requestAnimationFrame(() => a())), G.value = !1;
|
|
1074
|
+
const e = He(l.value, b.value);
|
|
1075
|
+
lt(e), L(e);
|
|
1076
|
+
}, 200), Ae = Je(ft, 200);
|
|
1077
|
+
function Fe(e) {
|
|
1078
|
+
m.value && (x.value = !0, A.value = e.touches[0].clientY, N.value = S.value, e.preventDefault());
|
|
1014
1079
|
}
|
|
1015
|
-
function
|
|
1016
|
-
if (!
|
|
1017
|
-
const
|
|
1018
|
-
|
|
1080
|
+
function Be(e) {
|
|
1081
|
+
if (!m.value || !x.value) return;
|
|
1082
|
+
const a = e.touches[0].clientY - A.value;
|
|
1083
|
+
S.value = N.value + a, e.preventDefault();
|
|
1019
1084
|
}
|
|
1020
1085
|
function Oe(e) {
|
|
1021
|
-
if (!
|
|
1022
|
-
|
|
1023
|
-
const
|
|
1024
|
-
Math.abs(
|
|
1086
|
+
if (!m.value || !x.value) return;
|
|
1087
|
+
x.value = !1;
|
|
1088
|
+
const a = S.value - N.value;
|
|
1089
|
+
Math.abs(a) > 100 ? a > 0 && H.value ? Re() : a < 0 && P.value ? je() : te() : te(), e.preventDefault();
|
|
1025
1090
|
}
|
|
1026
|
-
function
|
|
1027
|
-
|
|
1091
|
+
function ze(e) {
|
|
1092
|
+
m.value && (x.value = !0, A.value = e.clientY, N.value = S.value, e.preventDefault());
|
|
1028
1093
|
}
|
|
1029
|
-
function
|
|
1030
|
-
if (!
|
|
1031
|
-
const
|
|
1032
|
-
|
|
1094
|
+
function Le(e) {
|
|
1095
|
+
if (!m.value || !x.value) return;
|
|
1096
|
+
const a = e.clientY - A.value;
|
|
1097
|
+
S.value = N.value + a, e.preventDefault();
|
|
1033
1098
|
}
|
|
1034
|
-
function
|
|
1035
|
-
if (!
|
|
1036
|
-
|
|
1037
|
-
const
|
|
1038
|
-
Math.abs(
|
|
1099
|
+
function Ie(e) {
|
|
1100
|
+
if (!m.value || !x.value) return;
|
|
1101
|
+
x.value = !1;
|
|
1102
|
+
const a = S.value - N.value;
|
|
1103
|
+
Math.abs(a) > 100 ? a > 0 && H.value ? Re() : a < 0 && P.value ? je() : te() : te(), e.preventDefault();
|
|
1039
1104
|
}
|
|
1040
|
-
function
|
|
1041
|
-
if (!
|
|
1042
|
-
|
|
1105
|
+
function je() {
|
|
1106
|
+
if (!P.value) {
|
|
1107
|
+
ue();
|
|
1043
1108
|
return;
|
|
1044
1109
|
}
|
|
1045
|
-
|
|
1110
|
+
g.value++, te(), g.value >= l.value.length - 5 && ue();
|
|
1046
1111
|
}
|
|
1047
|
-
function
|
|
1048
|
-
|
|
1112
|
+
function Re() {
|
|
1113
|
+
H.value && (g.value--, te());
|
|
1049
1114
|
}
|
|
1050
|
-
function
|
|
1051
|
-
if (!
|
|
1052
|
-
const e =
|
|
1053
|
-
|
|
1115
|
+
function te() {
|
|
1116
|
+
if (!n.value) return;
|
|
1117
|
+
const e = n.value.clientHeight;
|
|
1118
|
+
S.value = -g.value * e;
|
|
1054
1119
|
}
|
|
1055
|
-
function
|
|
1056
|
-
|
|
1120
|
+
function Ce() {
|
|
1121
|
+
o.value ? u.value = o.value.clientWidth : typeof window < "u" && (u.value = window.innerWidth), !m.value && g.value > 0 && (g.value = 0, S.value = 0), m.value && l.value.length === 0 && !k.value && Me(p.value[0]), m.value && te();
|
|
1057
1122
|
}
|
|
1058
|
-
function
|
|
1059
|
-
|
|
1123
|
+
function dt(e, a, i) {
|
|
1124
|
+
z.value = a, p.value = [a], p.value.push(i), F(e, "init"), m.value ? (l.value = [...l.value, ...e], g.value === 0 && l.value.length > 0 && (S.value = 0)) : (ee([...l.value, ...e]), L());
|
|
1060
1125
|
}
|
|
1061
|
-
return
|
|
1062
|
-
|
|
1126
|
+
return re(
|
|
1127
|
+
d,
|
|
1063
1128
|
() => {
|
|
1064
|
-
|
|
1129
|
+
m.value || v.value && (b.value = he(d.value, u.value), ee(l.value));
|
|
1065
1130
|
},
|
|
1066
1131
|
{ deep: !0 }
|
|
1067
|
-
),
|
|
1068
|
-
|
|
1069
|
-
e ? (document.addEventListener("mousemove",
|
|
1132
|
+
), re(m, (e) => {
|
|
1133
|
+
X(() => {
|
|
1134
|
+
e ? (document.addEventListener("mousemove", Le), document.addEventListener("mouseup", Ie), g.value = 0, S.value = 0, l.value.length > 0 && te()) : (document.removeEventListener("mousemove", Le), document.removeEventListener("mouseup", Ie), v.value && o.value && (u.value = o.value.clientWidth, v.value.removeEventListener("scroll", Ee), v.value.addEventListener("scroll", Ee, { passive: !0 }), l.value.length > 0 && (b.value = he(d.value, u.value), ee(l.value), V.value = v.value.scrollTop, Y.value = v.value.clientHeight, L())));
|
|
1070
1135
|
});
|
|
1071
|
-
}, { immediate: !0 }),
|
|
1072
|
-
e && (e.addEventListener("touchstart",
|
|
1073
|
-
}),
|
|
1074
|
-
|
|
1075
|
-
}),
|
|
1076
|
-
|
|
1077
|
-
for (const
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1136
|
+
}, { immediate: !0 }), re(n, (e) => {
|
|
1137
|
+
e && (e.addEventListener("touchstart", Fe, { passive: !1 }), e.addEventListener("touchmove", Be, { passive: !1 }), e.addEventListener("touchend", Oe), e.addEventListener("mousedown", ze));
|
|
1138
|
+
}), re(() => l.value.length, (e, a) => {
|
|
1139
|
+
m.value && e > 0 && a === 0 && (g.value = 0, X(() => te()));
|
|
1140
|
+
}), re(o, (e) => {
|
|
1141
|
+
y && (y.disconnect(), y = null), e && typeof ResizeObserver < "u" ? (y = new ResizeObserver((a) => {
|
|
1142
|
+
for (const i of a) {
|
|
1143
|
+
const h = i.contentRect.width;
|
|
1144
|
+
u.value !== h && (u.value = h);
|
|
1080
1145
|
}
|
|
1081
|
-
}),
|
|
1082
|
-
}, { immediate: !0 }),
|
|
1083
|
-
e !==
|
|
1084
|
-
|
|
1146
|
+
}), y.observe(e), u.value = e.clientWidth) : e && (u.value = e.clientWidth);
|
|
1147
|
+
}, { immediate: !0 }), re(u, (e, a) => {
|
|
1148
|
+
e !== a && e > 0 && !m.value && v.value && l.value.length > 0 && X(() => {
|
|
1149
|
+
b.value = he(d.value, e), ee(l.value), L();
|
|
1085
1150
|
});
|
|
1086
|
-
}),
|
|
1151
|
+
}), Ze(async () => {
|
|
1087
1152
|
try {
|
|
1088
|
-
await
|
|
1089
|
-
const e =
|
|
1090
|
-
|
|
1153
|
+
await X(), o.value ? u.value = o.value.clientWidth : typeof window < "u" && (u.value = window.innerWidth), m.value || (b.value = he(d.value, u.value), v.value && (V.value = v.value.scrollTop, Y.value = v.value.clientHeight));
|
|
1154
|
+
const e = r.loadAtPage;
|
|
1155
|
+
p.value = [e], r.skipInitialLoad || await Me(p.value[0]), m.value ? X(() => te()) : L();
|
|
1091
1156
|
} catch (e) {
|
|
1092
|
-
console.error("Error during component initialization:", e),
|
|
1157
|
+
console.error("Error during component initialization:", e), k.value = !1;
|
|
1093
1158
|
}
|
|
1094
|
-
window.addEventListener("resize",
|
|
1095
|
-
}),
|
|
1159
|
+
window.addEventListener("resize", Ae), window.addEventListener("resize", Ce);
|
|
1160
|
+
}), et(() => {
|
|
1096
1161
|
var e;
|
|
1097
|
-
|
|
1098
|
-
}), (e,
|
|
1162
|
+
y && (y.disconnect(), y = null), (e = v.value) == null || e.removeEventListener("scroll", Ee), window.removeEventListener("resize", Ae), window.removeEventListener("resize", Ce), n.value && (n.value.removeEventListener("touchstart", Fe), n.value.removeEventListener("touchmove", Be), n.value.removeEventListener("touchend", Oe), n.value.removeEventListener("mousedown", ze)), document.removeEventListener("mousemove", Le), document.removeEventListener("mouseup", Ie);
|
|
1163
|
+
}), (e, a) => (O(), B("div", {
|
|
1099
1164
|
ref_key: "wrapper",
|
|
1100
|
-
ref:
|
|
1165
|
+
ref: o,
|
|
1101
1166
|
class: "w-full h-full flex flex-col relative"
|
|
1102
1167
|
}, [
|
|
1103
|
-
|
|
1168
|
+
m.value ? (O(), B("div", {
|
|
1104
1169
|
key: 0,
|
|
1105
|
-
class:
|
|
1170
|
+
class: ie(["overflow-hidden w-full flex-1 swipe-container touch-none select-none", { "force-motion": r.forceMotion, "cursor-grab": !x.value, "cursor-grabbing": x.value }]),
|
|
1106
1171
|
ref_key: "swipeContainer",
|
|
1107
|
-
ref:
|
|
1172
|
+
ref: n,
|
|
1108
1173
|
style: { height: "100%", "max-height": "100%", position: "relative" }
|
|
1109
1174
|
}, [
|
|
1110
|
-
|
|
1175
|
+
q("div", {
|
|
1111
1176
|
class: "relative w-full",
|
|
1112
|
-
style:
|
|
1113
|
-
transform: `translateY(${
|
|
1114
|
-
transition:
|
|
1115
|
-
height: `${
|
|
1177
|
+
style: ge({
|
|
1178
|
+
transform: `translateY(${S.value}px)`,
|
|
1179
|
+
transition: x.value ? "none" : `transform ${t.transitionDurationMs}ms ${t.transitionEasing}`,
|
|
1180
|
+
height: `${l.value.length * 100}%`
|
|
1116
1181
|
})
|
|
1117
1182
|
}, [
|
|
1118
|
-
(
|
|
1119
|
-
key: `${
|
|
1183
|
+
(O(!0), B(Ye, null, Ue(l.value, (i, h) => (O(), B("div", {
|
|
1184
|
+
key: `${i.page}-${i.id}`,
|
|
1120
1185
|
class: "absolute top-0 left-0 w-full",
|
|
1121
|
-
style:
|
|
1122
|
-
top: `${
|
|
1123
|
-
height: `${100 /
|
|
1186
|
+
style: ge({
|
|
1187
|
+
top: `${h * (100 / l.value.length)}%`,
|
|
1188
|
+
height: `${100 / l.value.length}%`
|
|
1124
1189
|
})
|
|
1125
1190
|
}, [
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
item:
|
|
1130
|
-
remove:
|
|
1191
|
+
q("div", ra, [
|
|
1192
|
+
q("div", la, [
|
|
1193
|
+
ne(e.$slots, "default", {
|
|
1194
|
+
item: i,
|
|
1195
|
+
remove: fe
|
|
1131
1196
|
}, () => [
|
|
1132
|
-
|
|
1133
|
-
item:
|
|
1134
|
-
remove:
|
|
1135
|
-
|
|
1197
|
+
ke(xe, {
|
|
1198
|
+
item: i,
|
|
1199
|
+
remove: fe,
|
|
1200
|
+
"header-height": d.value.header,
|
|
1201
|
+
"footer-height": d.value.footer,
|
|
1202
|
+
"in-swipe-mode": !0,
|
|
1203
|
+
"is-active": h === g.value,
|
|
1204
|
+
"onPreload:success": a[0] || (a[0] = (c) => E("item:preload:success", c)),
|
|
1205
|
+
"onPreload:error": a[1] || (a[1] = (c) => E("item:preload:error", c)),
|
|
1206
|
+
onMouseEnter: a[2] || (a[2] = (c) => E("item:mouse-enter", c)),
|
|
1207
|
+
onMouseLeave: a[3] || (a[3] = (c) => E("item:mouse-leave", c))
|
|
1208
|
+
}, {
|
|
1209
|
+
header: de((c) => [
|
|
1210
|
+
ne(e.$slots, "item-header", me({ ref_for: !0 }, c), void 0, !0)
|
|
1211
|
+
]),
|
|
1212
|
+
footer: de((c) => [
|
|
1213
|
+
ne(e.$slots, "item-footer", me({ ref_for: !0 }, c), void 0, !0)
|
|
1214
|
+
]),
|
|
1215
|
+
_: 2
|
|
1216
|
+
}, 1032, ["item", "header-height", "footer-height", "is-active"])
|
|
1136
1217
|
], !0)
|
|
1137
1218
|
])
|
|
1138
1219
|
])
|
|
1139
1220
|
], 4))), 128))
|
|
1140
1221
|
], 4)
|
|
1141
|
-
], 2)) : (
|
|
1222
|
+
], 2)) : (O(), B("div", {
|
|
1142
1223
|
key: 1,
|
|
1143
|
-
class:
|
|
1224
|
+
class: ie(["overflow-auto w-full flex-1 masonry-container", { "force-motion": r.forceMotion }]),
|
|
1144
1225
|
ref_key: "container",
|
|
1145
|
-
ref:
|
|
1226
|
+
ref: v
|
|
1146
1227
|
}, [
|
|
1147
|
-
|
|
1228
|
+
q("div", {
|
|
1148
1229
|
class: "relative",
|
|
1149
|
-
style:
|
|
1230
|
+
style: ge({ height: `${D.value}px`, "--masonry-duration": `${t.transitionDurationMs}ms`, "--masonry-leave-duration": `${t.leaveDurationMs}ms`, "--masonry-ease": t.transitionEasing })
|
|
1150
1231
|
}, [
|
|
1151
|
-
|
|
1232
|
+
ke(ht, {
|
|
1152
1233
|
name: "masonry",
|
|
1153
1234
|
css: !1,
|
|
1154
|
-
onEnter:
|
|
1155
|
-
onBeforeEnter:
|
|
1156
|
-
onLeave:
|
|
1157
|
-
onBeforeLeave:
|
|
1235
|
+
onEnter: se,
|
|
1236
|
+
onBeforeEnter: K,
|
|
1237
|
+
onLeave: ot,
|
|
1238
|
+
onBeforeLeave: nt
|
|
1158
1239
|
}, {
|
|
1159
|
-
default:
|
|
1160
|
-
(
|
|
1161
|
-
key: `${
|
|
1240
|
+
default: de(() => [
|
|
1241
|
+
(O(!0), B(Ye, null, Ue(rt.value, (i, h) => (O(), B("div", me({
|
|
1242
|
+
key: `${i.page}-${i.id}`,
|
|
1162
1243
|
class: "absolute masonry-item",
|
|
1163
1244
|
ref_for: !0
|
|
1164
|
-
}, gt(
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
item: r,
|
|
1169
|
-
remove: ce
|
|
1245
|
+
}, gt(Gt)(i, h)), [
|
|
1246
|
+
ne(e.$slots, "default", {
|
|
1247
|
+
item: i,
|
|
1248
|
+
remove: fe
|
|
1170
1249
|
}, () => [
|
|
1171
|
-
|
|
1172
|
-
item:
|
|
1173
|
-
remove:
|
|
1174
|
-
|
|
1250
|
+
ke(xe, {
|
|
1251
|
+
item: i,
|
|
1252
|
+
remove: fe,
|
|
1253
|
+
"header-height": d.value.header,
|
|
1254
|
+
"footer-height": d.value.footer,
|
|
1255
|
+
"in-swipe-mode": !1,
|
|
1256
|
+
"is-active": !1,
|
|
1257
|
+
"onPreload:success": a[4] || (a[4] = (c) => E("item:preload:success", c)),
|
|
1258
|
+
"onPreload:error": a[5] || (a[5] = (c) => E("item:preload:error", c)),
|
|
1259
|
+
onMouseEnter: a[6] || (a[6] = (c) => E("item:mouse-enter", c)),
|
|
1260
|
+
onMouseLeave: a[7] || (a[7] = (c) => E("item:mouse-leave", c))
|
|
1261
|
+
}, {
|
|
1262
|
+
header: de((c) => [
|
|
1263
|
+
ne(e.$slots, "item-header", me({ ref_for: !0 }, c), void 0, !0)
|
|
1264
|
+
]),
|
|
1265
|
+
footer: de((c) => [
|
|
1266
|
+
ne(e.$slots, "item-footer", me({ ref_for: !0 }, c), void 0, !0)
|
|
1267
|
+
]),
|
|
1268
|
+
_: 2
|
|
1269
|
+
}, 1032, ["item", "header-height", "footer-height"])
|
|
1175
1270
|
], !0)
|
|
1176
1271
|
], 16))), 128))
|
|
1177
1272
|
]),
|
|
@@ -1181,18 +1276,18 @@ const Jt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
|
|
|
1181
1276
|
], 2))
|
|
1182
1277
|
], 512));
|
|
1183
1278
|
}
|
|
1184
|
-
}),
|
|
1185
|
-
const
|
|
1186
|
-
for (const [
|
|
1187
|
-
|
|
1188
|
-
return
|
|
1189
|
-
},
|
|
1279
|
+
}), sa = (t, f) => {
|
|
1280
|
+
const s = t.__vccOpts || t;
|
|
1281
|
+
for (const [r, M] of f)
|
|
1282
|
+
s[r] = M;
|
|
1283
|
+
return s;
|
|
1284
|
+
}, Ke = /* @__PURE__ */ sa(ia, [["__scopeId", "data-v-0764371c"]]), ca = {
|
|
1190
1285
|
install(t) {
|
|
1191
|
-
t.component("WyxosMasonry",
|
|
1286
|
+
t.component("WyxosMasonry", Ke), t.component("WMasonry", Ke), t.component("WyxosMasonryItem", xe), t.component("WMasonryItem", xe);
|
|
1192
1287
|
}
|
|
1193
1288
|
};
|
|
1194
1289
|
export {
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1290
|
+
Ke as Masonry,
|
|
1291
|
+
xe as MasonryItem,
|
|
1292
|
+
ca as default
|
|
1198
1293
|
};
|