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