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