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