@wyxos/vibe 1.6.12 → 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 +778 -701
- package/lib/vibe.css +1 -1
- package/package.json +92 -67
- package/src/Masonry.vue +1233 -1213
- package/src/components/CodeTabs.vue +158 -0
- package/src/components/MasonryItem.vue +431 -346
- package/src/components/examples/BasicExample.vue +45 -0
- package/src/components/examples/CustomItemExample.vue +86 -0
- package/src/components/examples/HeaderFooterExample.vue +78 -0
- package/src/components/examples/SwipeModeExample.vue +39 -0
- package/src/pages.json +36401 -36401
- package/src/useMasonryScroll.ts +60 -60
- package/src/views/Examples.vue +275 -20
- package/src/views/Home.vue +236 -208
- package/toggle-link.mjs +92 -92
package/lib/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { nextTick as
|
|
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
2
|
let Pe = null;
|
|
3
3
|
function yt() {
|
|
4
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), Pe =
|
|
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, s, 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
|
|
132
|
-
function
|
|
133
|
-
return t && t.slice(0, At(t) + 1).replace(
|
|
131
|
+
var Ft = /^\s+/;
|
|
132
|
+
function Bt(t) {
|
|
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
|
-
t =
|
|
152
|
-
var
|
|
153
|
-
return
|
|
151
|
+
t = Bt(t);
|
|
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
155
|
var Se = function() {
|
|
156
|
-
return
|
|
157
|
-
},
|
|
158
|
-
function
|
|
159
|
-
var
|
|
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,326 +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
|
-
}),
|
|
538
|
-
key: 0,
|
|
539
|
-
class: "fixed bottom-4 left-1/2 transform -translate-x-1/2 flex gap-2 z-10 pointer-events-none"
|
|
540
|
-
}, ca = { class: "fixed top-20 right-4 bg-black/50 backdrop-blur-sm text-white text-xs font-medium px-3 py-1.5 rounded-full z-20 pointer-events-none" }, fa = /* @__PURE__ */ Je({
|
|
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({
|
|
541
599
|
__name: "Masonry",
|
|
542
600
|
props: {
|
|
543
601
|
getNextPage: {
|
|
@@ -647,10 +705,16 @@ const Jt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
|
|
|
647
705
|
"retry:start",
|
|
648
706
|
"retry:tick",
|
|
649
707
|
"retry:stop",
|
|
650
|
-
"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"
|
|
651
715
|
],
|
|
652
|
-
setup(t, { expose:
|
|
653
|
-
const
|
|
716
|
+
setup(t, { expose: f, emit: s }) {
|
|
717
|
+
const r = t, M = {
|
|
654
718
|
sizes: { base: 1, sm: 2, md: 3, lg: 4, xl: 5, "2xl": 6 },
|
|
655
719
|
gutterX: 10,
|
|
656
720
|
gutterY: 10,
|
|
@@ -659,19 +723,19 @@ const Jt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
|
|
|
659
723
|
paddingLeft: 0,
|
|
660
724
|
paddingRight: 0,
|
|
661
725
|
placement: "masonry"
|
|
662
|
-
},
|
|
726
|
+
}, d = Z(() => {
|
|
663
727
|
var e;
|
|
664
728
|
return {
|
|
665
|
-
...
|
|
666
|
-
...
|
|
729
|
+
...M,
|
|
730
|
+
...r.layout,
|
|
667
731
|
sizes: {
|
|
668
|
-
...
|
|
669
|
-
...((e =
|
|
732
|
+
...M.sizes,
|
|
733
|
+
...((e = r.layout) == null ? void 0 : e.sizes) || {}
|
|
670
734
|
}
|
|
671
735
|
};
|
|
672
|
-
}),
|
|
673
|
-
let
|
|
674
|
-
function
|
|
736
|
+
}), o = I(null), u = I(typeof window < "u" ? window.innerWidth : 1024);
|
|
737
|
+
let y = null;
|
|
738
|
+
function $(e) {
|
|
675
739
|
return {
|
|
676
740
|
sm: 640,
|
|
677
741
|
md: 768,
|
|
@@ -680,48 +744,48 @@ const Jt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
|
|
|
680
744
|
"2xl": 1536
|
|
681
745
|
}[e] || 768;
|
|
682
746
|
}
|
|
683
|
-
const
|
|
684
|
-
if (
|
|
685
|
-
if (
|
|
686
|
-
const e = typeof
|
|
687
|
-
return
|
|
688
|
-
}),
|
|
689
|
-
if (!
|
|
690
|
-
const e = Math.max(0, Math.min(
|
|
691
|
-
return
|
|
692
|
-
}),
|
|
693
|
-
if (!
|
|
694
|
-
const e =
|
|
695
|
-
return e >=
|
|
696
|
-
}),
|
|
697
|
-
if (!
|
|
698
|
-
const e =
|
|
699
|
-
return e < 0 ? null :
|
|
700
|
-
}),
|
|
701
|
-
get: () =>
|
|
702
|
-
set: (e) =>
|
|
703
|
-
}),
|
|
704
|
-
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) {
|
|
705
769
|
return typeof e == "number" && Number.isFinite(e) && e > 0;
|
|
706
770
|
}
|
|
707
|
-
function
|
|
771
|
+
function F(e, a) {
|
|
708
772
|
try {
|
|
709
773
|
if (!Array.isArray(e) || e.length === 0) return;
|
|
710
|
-
const i = e.filter((
|
|
774
|
+
const i = e.filter((c) => !j(c == null ? void 0 : c.width) || !j(c == null ? void 0 : c.height));
|
|
711
775
|
if (i.length === 0) return;
|
|
712
|
-
const
|
|
713
|
-
for (const
|
|
714
|
-
const
|
|
715
|
-
|
|
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));
|
|
716
780
|
}
|
|
717
|
-
if (
|
|
718
|
-
const
|
|
781
|
+
if (h.length > 0) {
|
|
782
|
+
const c = h.slice(0, 10);
|
|
719
783
|
console.warn(
|
|
720
784
|
"[Masonry] Items missing width/height detected:",
|
|
721
785
|
{
|
|
722
786
|
context: a,
|
|
723
|
-
count:
|
|
724
|
-
sampleIds:
|
|
787
|
+
count: h.length,
|
|
788
|
+
sampleIds: c,
|
|
725
789
|
hint: "Ensure each item has positive width and height. Consider providing fallbacks (e.g., 512x512) at the data layer."
|
|
726
790
|
}
|
|
727
791
|
);
|
|
@@ -729,488 +793,501 @@ const Jt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
|
|
|
729
793
|
} catch {
|
|
730
794
|
}
|
|
731
795
|
}
|
|
732
|
-
const V =
|
|
796
|
+
const V = I(0), Y = I(0), W = r.virtualBufferPx, G = I(!1), ae = I({
|
|
733
797
|
distanceToTrigger: 0,
|
|
734
798
|
isNearTrigger: !1
|
|
735
|
-
}),
|
|
736
|
-
if (!
|
|
737
|
-
const { scrollTop: a, clientHeight: i } =
|
|
738
|
-
|
|
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 = {
|
|
739
803
|
distanceToTrigger: Math.round(qe),
|
|
740
|
-
isNearTrigger:
|
|
804
|
+
isNearTrigger: mt
|
|
741
805
|
};
|
|
742
|
-
}, { onEnter:
|
|
743
|
-
function
|
|
744
|
-
if (
|
|
745
|
-
const i = parseInt(e.dataset.left || "0", 10),
|
|
746
|
-
e.style.transition = "none", e.style.opacity = "1", e.style.transform = `translate3d(${i}px, ${
|
|
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(() => {
|
|
747
811
|
e.style.transition = "", a();
|
|
748
812
|
});
|
|
749
813
|
} else
|
|
750
|
-
|
|
814
|
+
R(e, a);
|
|
751
815
|
}
|
|
752
|
-
function
|
|
753
|
-
if (
|
|
816
|
+
function K(e) {
|
|
817
|
+
if (G.value) {
|
|
754
818
|
const a = parseInt(e.dataset.left || "0", 10), i = parseInt(e.dataset.top || "0", 10);
|
|
755
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");
|
|
756
820
|
} else
|
|
757
821
|
_(e);
|
|
758
822
|
}
|
|
759
|
-
function
|
|
760
|
-
|
|
823
|
+
function nt(e) {
|
|
824
|
+
G.value || oe(e);
|
|
761
825
|
}
|
|
762
|
-
function
|
|
763
|
-
|
|
826
|
+
function ot(e, a) {
|
|
827
|
+
G.value ? a() : J(e, a);
|
|
764
828
|
}
|
|
765
|
-
const
|
|
766
|
-
const e = V.value -
|
|
767
|
-
return !i || i.length === 0 ? [] : i.filter((
|
|
768
|
-
const
|
|
769
|
-
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;
|
|
770
834
|
});
|
|
771
|
-
}), { handleScroll: lt } =
|
|
772
|
-
container:
|
|
773
|
-
masonry:
|
|
774
|
-
columns:
|
|
775
|
-
containerHeight:
|
|
776
|
-
isLoading:
|
|
777
|
-
pageSize:
|
|
778
|
-
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,
|
|
779
843
|
setItemsRaw: (e) => {
|
|
780
|
-
|
|
844
|
+
l.value = e;
|
|
781
845
|
},
|
|
782
|
-
loadNext:
|
|
783
|
-
loadThresholdPx:
|
|
846
|
+
loadNext: ue,
|
|
847
|
+
loadThresholdPx: r.loadThresholdPx
|
|
784
848
|
});
|
|
785
|
-
|
|
786
|
-
isLoading:
|
|
787
|
-
refreshLayout:
|
|
788
|
-
containerHeight:
|
|
849
|
+
f({
|
|
850
|
+
isLoading: k,
|
|
851
|
+
refreshLayout: ee,
|
|
852
|
+
containerHeight: D,
|
|
789
853
|
remove: fe,
|
|
790
|
-
removeMany:
|
|
791
|
-
removeAll:
|
|
792
|
-
loadNext:
|
|
793
|
-
loadPage:
|
|
794
|
-
refreshCurrentPage:
|
|
795
|
-
reset:
|
|
796
|
-
init:
|
|
797
|
-
paginationHistory:
|
|
798
|
-
cancelLoad:
|
|
799
|
-
scrollToTop:
|
|
800
|
-
totalItems:
|
|
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)
|
|
801
865
|
});
|
|
802
|
-
function
|
|
866
|
+
function it(e) {
|
|
803
867
|
const a = Yt(e);
|
|
804
868
|
let i = 0;
|
|
805
|
-
if (
|
|
806
|
-
const { scrollTop:
|
|
807
|
-
i =
|
|
869
|
+
if (v.value) {
|
|
870
|
+
const { scrollTop: h, clientHeight: c } = v.value;
|
|
871
|
+
i = h + c + 100;
|
|
808
872
|
}
|
|
809
|
-
|
|
873
|
+
D.value = Math.max(a, i);
|
|
810
874
|
}
|
|
811
|
-
function
|
|
812
|
-
if (
|
|
813
|
-
|
|
875
|
+
function ee(e) {
|
|
876
|
+
if (m.value) {
|
|
877
|
+
l.value = e;
|
|
814
878
|
return;
|
|
815
879
|
}
|
|
816
|
-
if (!
|
|
817
|
-
|
|
818
|
-
const a = e.map((
|
|
819
|
-
...
|
|
820
|
-
originalIndex:
|
|
821
|
-
})), i = wt(a,
|
|
822
|
-
|
|
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;
|
|
823
887
|
}
|
|
824
|
-
function
|
|
888
|
+
function Ne(e, a) {
|
|
825
889
|
return new Promise((i) => {
|
|
826
|
-
const
|
|
827
|
-
a(
|
|
828
|
-
const
|
|
829
|
-
if (
|
|
830
|
-
clearInterval(
|
|
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();
|
|
831
895
|
return;
|
|
832
896
|
}
|
|
833
|
-
const
|
|
834
|
-
a(
|
|
897
|
+
const Q = Date.now() - c, ce = Math.max(0, h - Q);
|
|
898
|
+
a(ce, h), ce <= 0 && (clearInterval(U), i());
|
|
835
899
|
}, 100);
|
|
836
900
|
});
|
|
837
901
|
}
|
|
838
|
-
async function
|
|
902
|
+
async function ye(e) {
|
|
839
903
|
try {
|
|
840
|
-
const a = await
|
|
841
|
-
return
|
|
904
|
+
const a = await st(() => r.getNextPage(e));
|
|
905
|
+
return ee([...l.value, ...a.items]), a;
|
|
842
906
|
} catch (a) {
|
|
843
907
|
throw console.error("Error in getContent:", a), a;
|
|
844
908
|
}
|
|
845
909
|
}
|
|
846
|
-
async function
|
|
910
|
+
async function st(e) {
|
|
847
911
|
let a = 0;
|
|
848
|
-
const i =
|
|
849
|
-
let
|
|
912
|
+
const i = r.retryMaxAttempts;
|
|
913
|
+
let h = r.retryInitialDelayMs;
|
|
850
914
|
for (; ; )
|
|
851
915
|
try {
|
|
852
|
-
const
|
|
853
|
-
return a > 0 &&
|
|
854
|
-
} catch (
|
|
916
|
+
const c = await e();
|
|
917
|
+
return a > 0 && E("retry:stop", { attempt: a, success: !0 }), c;
|
|
918
|
+
} catch (c) {
|
|
855
919
|
if (a++, a > i)
|
|
856
|
-
throw
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
}),
|
|
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;
|
|
860
924
|
}
|
|
861
925
|
}
|
|
862
|
-
async function
|
|
863
|
-
if (!
|
|
864
|
-
|
|
926
|
+
async function Me(e) {
|
|
927
|
+
if (!k.value) {
|
|
928
|
+
C.value = !1, k.value = !0;
|
|
865
929
|
try {
|
|
866
|
-
const a =
|
|
867
|
-
if (
|
|
868
|
-
const i = await
|
|
869
|
-
return
|
|
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);
|
|
870
934
|
} catch (a) {
|
|
871
935
|
throw console.error("Error loading page:", a), a;
|
|
872
936
|
} finally {
|
|
873
|
-
|
|
937
|
+
k.value = !1;
|
|
874
938
|
}
|
|
875
939
|
}
|
|
876
940
|
}
|
|
877
|
-
async function
|
|
878
|
-
if (!
|
|
879
|
-
|
|
941
|
+
async function ue() {
|
|
942
|
+
if (!k.value) {
|
|
943
|
+
C.value = !1, k.value = !0;
|
|
880
944
|
try {
|
|
881
|
-
const e =
|
|
882
|
-
if (
|
|
883
|
-
const a =
|
|
884
|
-
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);
|
|
885
949
|
} catch (e) {
|
|
886
950
|
throw console.error("Error loading next page:", e), e;
|
|
887
951
|
} finally {
|
|
888
|
-
|
|
952
|
+
k.value = !1;
|
|
889
953
|
}
|
|
890
954
|
}
|
|
891
955
|
}
|
|
892
|
-
async function
|
|
893
|
-
if (
|
|
894
|
-
|
|
956
|
+
async function Te() {
|
|
957
|
+
if (!k.value) {
|
|
958
|
+
C.value = !1, k.value = !0;
|
|
895
959
|
try {
|
|
896
|
-
const e =
|
|
897
|
-
if (
|
|
898
|
-
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);
|
|
899
963
|
return;
|
|
900
964
|
}
|
|
901
|
-
|
|
902
|
-
const a = await
|
|
903
|
-
if (
|
|
904
|
-
|
|
905
|
-
const i =
|
|
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;
|
|
906
970
|
return await ve(i), a;
|
|
907
971
|
} catch (e) {
|
|
908
972
|
throw console.error("[Masonry] Error refreshing current page:", e), e;
|
|
909
973
|
} finally {
|
|
910
|
-
|
|
974
|
+
k.value = !1;
|
|
911
975
|
}
|
|
912
976
|
}
|
|
913
977
|
}
|
|
914
978
|
async function fe(e) {
|
|
915
|
-
const a =
|
|
916
|
-
if (
|
|
917
|
-
if (
|
|
918
|
-
|
|
919
|
-
else
|
|
920
|
-
console.log("[Masonry] All items removed, calling loadNext and forcing backfill");
|
|
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
|
|
921
984
|
try {
|
|
922
|
-
await
|
|
985
|
+
await ue(), await ve(0, !0);
|
|
923
986
|
} catch {
|
|
924
987
|
}
|
|
925
|
-
}
|
|
926
988
|
return;
|
|
927
989
|
}
|
|
928
990
|
await new Promise((i) => requestAnimationFrame(() => i())), requestAnimationFrame(() => {
|
|
929
|
-
|
|
991
|
+
ee(a);
|
|
930
992
|
});
|
|
931
993
|
}
|
|
932
|
-
async function
|
|
994
|
+
async function ut(e) {
|
|
933
995
|
if (!e || e.length === 0) return;
|
|
934
|
-
const a = new Set(e.map((
|
|
935
|
-
if (
|
|
936
|
-
if (
|
|
937
|
-
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();
|
|
938
1000
|
else
|
|
939
1001
|
try {
|
|
940
|
-
await
|
|
1002
|
+
await ue(), await ve(0, !0);
|
|
941
1003
|
} catch {
|
|
942
1004
|
}
|
|
943
1005
|
return;
|
|
944
1006
|
}
|
|
945
|
-
await new Promise((
|
|
946
|
-
|
|
1007
|
+
await new Promise((h) => requestAnimationFrame(() => h())), requestAnimationFrame(() => {
|
|
1008
|
+
ee(i);
|
|
947
1009
|
});
|
|
948
1010
|
}
|
|
949
|
-
function
|
|
950
|
-
|
|
1011
|
+
function We(e) {
|
|
1012
|
+
v.value && v.value.scrollTo({
|
|
951
1013
|
top: 0,
|
|
952
1014
|
behavior: (e == null ? void 0 : e.behavior) ?? "smooth",
|
|
953
1015
|
...e
|
|
954
1016
|
});
|
|
955
1017
|
}
|
|
956
|
-
async function
|
|
957
|
-
|
|
1018
|
+
async function ct() {
|
|
1019
|
+
We({ behavior: "smooth" }), l.value = [], D.value = 0, await X(), E("remove-all:complete");
|
|
958
1020
|
}
|
|
959
|
-
function
|
|
960
|
-
|
|
1021
|
+
function ft() {
|
|
1022
|
+
b.value = he(d.value), ee(l.value), v.value && (V.value = v.value.scrollTop, Y.value = v.value.clientHeight);
|
|
961
1023
|
}
|
|
962
|
-
let
|
|
963
|
-
const
|
|
1024
|
+
let we = !1;
|
|
1025
|
+
const C = I(!1);
|
|
964
1026
|
async function ve(e, a = !1) {
|
|
965
|
-
if (!a && !
|
|
966
|
-
const i = (e || 0) + (
|
|
967
|
-
if (!(!
|
|
968
|
-
|
|
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;
|
|
969
1031
|
try {
|
|
970
|
-
let
|
|
971
|
-
for (
|
|
972
|
-
|
|
973
|
-
fetched:
|
|
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,
|
|
974
1036
|
target: i,
|
|
975
|
-
calls:
|
|
976
|
-
remainingMs:
|
|
977
|
-
totalMs:
|
|
1037
|
+
calls: c,
|
|
1038
|
+
remainingMs: Q,
|
|
1039
|
+
totalMs: ce
|
|
978
1040
|
});
|
|
979
|
-
}), !
|
|
980
|
-
const
|
|
1041
|
+
}), !C.value); ) {
|
|
1042
|
+
const U = p.value[p.value.length - 1];
|
|
981
1043
|
try {
|
|
982
|
-
|
|
983
|
-
const
|
|
984
|
-
if (
|
|
985
|
-
|
|
1044
|
+
k.value = !0;
|
|
1045
|
+
const Q = await ye(U);
|
|
1046
|
+
if (C.value) break;
|
|
1047
|
+
p.value.push(Q.nextPage);
|
|
986
1048
|
} finally {
|
|
987
|
-
|
|
1049
|
+
k.value = !1;
|
|
988
1050
|
}
|
|
989
|
-
|
|
1051
|
+
c++;
|
|
990
1052
|
}
|
|
991
|
-
|
|
1053
|
+
E("backfill:stop", { fetched: l.value.length, calls: c });
|
|
992
1054
|
} finally {
|
|
993
|
-
|
|
1055
|
+
we = !1;
|
|
994
1056
|
}
|
|
995
1057
|
}
|
|
996
1058
|
}
|
|
997
|
-
function
|
|
998
|
-
|
|
1059
|
+
function De() {
|
|
1060
|
+
C.value = !0, k.value = !1, we = !1;
|
|
999
1061
|
}
|
|
1000
|
-
function
|
|
1001
|
-
|
|
1062
|
+
function vt() {
|
|
1063
|
+
De(), C.value = !1, v.value && v.value.scrollTo({
|
|
1002
1064
|
top: 0,
|
|
1003
1065
|
behavior: "smooth"
|
|
1004
|
-
}),
|
|
1066
|
+
}), l.value = [], D.value = 0, z.value = r.loadAtPage, p.value = [r.loadAtPage], ae.value = {
|
|
1005
1067
|
distanceToTrigger: 0,
|
|
1006
1068
|
isNearTrigger: !1
|
|
1007
1069
|
};
|
|
1008
1070
|
}
|
|
1009
|
-
const
|
|
1010
|
-
if (
|
|
1011
|
-
|
|
1012
|
-
const e =
|
|
1013
|
-
lt(e),
|
|
1014
|
-
}, 200),
|
|
1015
|
-
function
|
|
1016
|
-
|
|
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());
|
|
1017
1079
|
}
|
|
1018
1080
|
function Be(e) {
|
|
1019
|
-
if (!
|
|
1020
|
-
const a = e.touches[0].clientY -
|
|
1021
|
-
|
|
1081
|
+
if (!m.value || !x.value) return;
|
|
1082
|
+
const a = e.touches[0].clientY - A.value;
|
|
1083
|
+
S.value = N.value + a, e.preventDefault();
|
|
1022
1084
|
}
|
|
1023
|
-
function
|
|
1024
|
-
if (!
|
|
1025
|
-
|
|
1026
|
-
const a =
|
|
1027
|
-
Math.abs(a) > 100 ? a > 0 &&
|
|
1085
|
+
function Oe(e) {
|
|
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();
|
|
1028
1090
|
}
|
|
1029
|
-
function
|
|
1030
|
-
|
|
1091
|
+
function ze(e) {
|
|
1092
|
+
m.value && (x.value = !0, A.value = e.clientY, N.value = S.value, e.preventDefault());
|
|
1031
1093
|
}
|
|
1032
|
-
function
|
|
1033
|
-
if (!
|
|
1034
|
-
const a = e.clientY -
|
|
1035
|
-
|
|
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();
|
|
1036
1098
|
}
|
|
1037
|
-
function
|
|
1038
|
-
if (!
|
|
1039
|
-
|
|
1040
|
-
const a =
|
|
1041
|
-
Math.abs(a) > 100 ? a > 0 &&
|
|
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();
|
|
1042
1104
|
}
|
|
1043
|
-
function
|
|
1044
|
-
if (!
|
|
1045
|
-
|
|
1105
|
+
function je() {
|
|
1106
|
+
if (!P.value) {
|
|
1107
|
+
ue();
|
|
1046
1108
|
return;
|
|
1047
1109
|
}
|
|
1048
|
-
|
|
1110
|
+
g.value++, te(), g.value >= l.value.length - 5 && ue();
|
|
1049
1111
|
}
|
|
1050
|
-
function
|
|
1051
|
-
|
|
1112
|
+
function Re() {
|
|
1113
|
+
H.value && (g.value--, te());
|
|
1052
1114
|
}
|
|
1053
|
-
function
|
|
1054
|
-
if (!
|
|
1055
|
-
const e =
|
|
1056
|
-
|
|
1115
|
+
function te() {
|
|
1116
|
+
if (!n.value) return;
|
|
1117
|
+
const e = n.value.clientHeight;
|
|
1118
|
+
S.value = -g.value * e;
|
|
1057
1119
|
}
|
|
1058
1120
|
function Ce() {
|
|
1059
|
-
|
|
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();
|
|
1060
1122
|
}
|
|
1061
|
-
function
|
|
1062
|
-
|
|
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());
|
|
1063
1125
|
}
|
|
1064
|
-
return
|
|
1065
|
-
|
|
1126
|
+
return re(
|
|
1127
|
+
d,
|
|
1066
1128
|
() => {
|
|
1067
|
-
|
|
1129
|
+
m.value || v.value && (b.value = he(d.value, u.value), ee(l.value));
|
|
1068
1130
|
},
|
|
1069
1131
|
{ deep: !0 }
|
|
1070
|
-
),
|
|
1071
|
-
|
|
1072
|
-
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())));
|
|
1073
1135
|
});
|
|
1074
|
-
}, { immediate: !0 }),
|
|
1075
|
-
e && (e.addEventListener("touchstart",
|
|
1076
|
-
}),
|
|
1077
|
-
|
|
1078
|
-
}),
|
|
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) => {
|
|
1080
1142
|
for (const i of a) {
|
|
1081
|
-
const
|
|
1082
|
-
|
|
1143
|
+
const h = i.contentRect.width;
|
|
1144
|
+
u.value !== h && (u.value = h);
|
|
1083
1145
|
}
|
|
1084
|
-
}),
|
|
1085
|
-
}, { immediate: !0 }),
|
|
1086
|
-
e !== a && e > 0 && !
|
|
1087
|
-
|
|
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();
|
|
1088
1150
|
});
|
|
1089
|
-
}),
|
|
1151
|
+
}), Ze(async () => {
|
|
1090
1152
|
try {
|
|
1091
|
-
await
|
|
1092
|
-
const e =
|
|
1093
|
-
|
|
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();
|
|
1094
1156
|
} catch (e) {
|
|
1095
|
-
console.error("Error during component initialization:", e),
|
|
1157
|
+
console.error("Error during component initialization:", e), k.value = !1;
|
|
1096
1158
|
}
|
|
1097
|
-
window.addEventListener("resize",
|
|
1098
|
-
}),
|
|
1159
|
+
window.addEventListener("resize", Ae), window.addEventListener("resize", Ce);
|
|
1160
|
+
}), et(() => {
|
|
1099
1161
|
var e;
|
|
1100
|
-
|
|
1101
|
-
}), (e, a) => (O(),
|
|
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", {
|
|
1102
1164
|
ref_key: "wrapper",
|
|
1103
|
-
ref:
|
|
1165
|
+
ref: o,
|
|
1104
1166
|
class: "w-full h-full flex flex-col relative"
|
|
1105
1167
|
}, [
|
|
1106
|
-
|
|
1168
|
+
m.value ? (O(), B("div", {
|
|
1107
1169
|
key: 0,
|
|
1108
|
-
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 }]),
|
|
1109
1171
|
ref_key: "swipeContainer",
|
|
1110
|
-
ref:
|
|
1172
|
+
ref: n,
|
|
1111
1173
|
style: { height: "100%", "max-height": "100%", position: "relative" }
|
|
1112
1174
|
}, [
|
|
1113
|
-
|
|
1175
|
+
q("div", {
|
|
1114
1176
|
class: "relative w-full",
|
|
1115
|
-
style:
|
|
1116
|
-
transform: `translateY(${
|
|
1117
|
-
transition:
|
|
1118
|
-
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}%`
|
|
1119
1181
|
})
|
|
1120
1182
|
}, [
|
|
1121
|
-
(O(!0),
|
|
1183
|
+
(O(!0), B(Ye, null, Ue(l.value, (i, h) => (O(), B("div", {
|
|
1122
1184
|
key: `${i.page}-${i.id}`,
|
|
1123
1185
|
class: "absolute top-0 left-0 w-full",
|
|
1124
|
-
style:
|
|
1125
|
-
top: `${
|
|
1126
|
-
height: `${100 /
|
|
1186
|
+
style: ge({
|
|
1187
|
+
top: `${h * (100 / l.value.length)}%`,
|
|
1188
|
+
height: `${100 / l.value.length}%`
|
|
1127
1189
|
})
|
|
1128
1190
|
}, [
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1191
|
+
q("div", ra, [
|
|
1192
|
+
q("div", la, [
|
|
1193
|
+
ne(e.$slots, "default", {
|
|
1132
1194
|
item: i,
|
|
1133
1195
|
remove: fe
|
|
1134
1196
|
}, () => [
|
|
1135
|
-
|
|
1197
|
+
ke(xe, {
|
|
1136
1198
|
item: i,
|
|
1137
|
-
remove: fe
|
|
1138
|
-
|
|
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"])
|
|
1139
1217
|
], !0)
|
|
1140
1218
|
])
|
|
1141
1219
|
])
|
|
1142
1220
|
], 4))), 128))
|
|
1143
|
-
], 4)
|
|
1144
|
-
|
|
1145
|
-
(O(!0), A(Ie, null, Ee(r.value.slice(0, Math.min(10, r.value.length)), (i, m) => (O(), A("div", {
|
|
1146
|
-
key: `dot-${i.id}`,
|
|
1147
|
-
class: K(["w-1.5 h-1.5 rounded-full transition-all duration-300", m === v.value ? "bg-white w-4" : "bg-white/40"])
|
|
1148
|
-
}, null, 2))), 128))
|
|
1149
|
-
])) : Z("", !0),
|
|
1150
|
-
W("div", ca, ce(v.value + 1) + " / " + ce(r.value.length), 1)
|
|
1151
|
-
], 2)) : (O(), A("div", {
|
|
1221
|
+
], 4)
|
|
1222
|
+
], 2)) : (O(), B("div", {
|
|
1152
1223
|
key: 1,
|
|
1153
|
-
class:
|
|
1224
|
+
class: ie(["overflow-auto w-full flex-1 masonry-container", { "force-motion": r.forceMotion }]),
|
|
1154
1225
|
ref_key: "container",
|
|
1155
|
-
ref:
|
|
1226
|
+
ref: v
|
|
1156
1227
|
}, [
|
|
1157
|
-
|
|
1228
|
+
q("div", {
|
|
1158
1229
|
class: "relative",
|
|
1159
|
-
style:
|
|
1230
|
+
style: ge({ height: `${D.value}px`, "--masonry-duration": `${t.transitionDurationMs}ms`, "--masonry-leave-duration": `${t.leaveDurationMs}ms`, "--masonry-ease": t.transitionEasing })
|
|
1160
1231
|
}, [
|
|
1161
|
-
|
|
1232
|
+
ke(ht, {
|
|
1162
1233
|
name: "masonry",
|
|
1163
1234
|
css: !1,
|
|
1164
|
-
onEnter:
|
|
1165
|
-
onBeforeEnter:
|
|
1166
|
-
onLeave:
|
|
1167
|
-
onBeforeLeave:
|
|
1235
|
+
onEnter: se,
|
|
1236
|
+
onBeforeEnter: K,
|
|
1237
|
+
onLeave: ot,
|
|
1238
|
+
onBeforeLeave: nt
|
|
1168
1239
|
}, {
|
|
1169
|
-
default:
|
|
1170
|
-
(O(!0),
|
|
1240
|
+
default: de(() => [
|
|
1241
|
+
(O(!0), B(Ye, null, Ue(rt.value, (i, h) => (O(), B("div", me({
|
|
1171
1242
|
key: `${i.page}-${i.id}`,
|
|
1172
1243
|
class: "absolute masonry-item",
|
|
1173
1244
|
ref_for: !0
|
|
1174
|
-
}, gt(
|
|
1175
|
-
|
|
1176
|
-
}), [
|
|
1177
|
-
$e(e.$slots, "default", {
|
|
1245
|
+
}, gt(Gt)(i, h)), [
|
|
1246
|
+
ne(e.$slots, "default", {
|
|
1178
1247
|
item: i,
|
|
1179
1248
|
remove: fe
|
|
1180
1249
|
}, () => [
|
|
1181
|
-
|
|
1250
|
+
ke(xe, {
|
|
1182
1251
|
item: i,
|
|
1183
|
-
remove: fe
|
|
1184
|
-
|
|
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"])
|
|
1185
1270
|
], !0)
|
|
1186
1271
|
], 16))), 128))
|
|
1187
1272
|
]),
|
|
1188
1273
|
_: 3
|
|
1189
|
-
})
|
|
1190
|
-
T.value > 0 ? (O(), A("div", {
|
|
1191
|
-
key: 0,
|
|
1192
|
-
class: K(["fixed bottom-4 right-4 bg-gray-800 text-white text-xs rounded-full px-3 py-1.5 shadow-lg z-10 transition-opacity duration-300", { "opacity-50 hover:opacity-100": !ee.value.isNearTrigger, "opacity-100": ee.value.isNearTrigger }])
|
|
1193
|
-
}, [
|
|
1194
|
-
W("span", null, ce(r.value.length) + " items", 1),
|
|
1195
|
-
a[0] || (a[0] = W("span", { class: "mx-2" }, "|", -1)),
|
|
1196
|
-
W("span", null, ce(ee.value.distanceToTrigger) + "px to load", 1)
|
|
1197
|
-
], 2)) : Z("", !0)
|
|
1274
|
+
})
|
|
1198
1275
|
], 4)
|
|
1199
1276
|
], 2))
|
|
1200
1277
|
], 512));
|
|
1201
1278
|
}
|
|
1202
|
-
}),
|
|
1203
|
-
const
|
|
1204
|
-
for (const [
|
|
1205
|
-
|
|
1206
|
-
return
|
|
1207
|
-
},
|
|
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 = {
|
|
1208
1285
|
install(t) {
|
|
1209
|
-
t.component("WyxosMasonry",
|
|
1286
|
+
t.component("WyxosMasonry", Ke), t.component("WMasonry", Ke), t.component("WyxosMasonryItem", xe), t.component("WMasonryItem", xe);
|
|
1210
1287
|
}
|
|
1211
1288
|
};
|
|
1212
1289
|
export {
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1290
|
+
Ke as Masonry,
|
|
1291
|
+
xe as MasonryItem,
|
|
1292
|
+
ca as default
|
|
1216
1293
|
};
|