@wyxos/vibe 1.6.16 → 1.6.17
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 +203 -201
- package/lib/vibe.css +1 -1
- package/package.json +1 -1
- package/src/Masonry.vue +1334 -1317
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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
|
|
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 ie, createElementVNode as V, normalizeStyle as ye, renderSlot as le, normalizeClass as se, withModifiers as Ye, toDisplayString as bt, Fragment as Ue, renderList as Ge, createVNode as ke, withCtx as he, mergeProps as pe, TransitionGroup as xt, unref as Mt } from "vue";
|
|
2
2
|
let Se = null;
|
|
3
3
|
function Tt() {
|
|
4
4
|
if (Se != null) return Se;
|
|
@@ -27,15 +27,15 @@ function Xe(t, c, v, l = {}) {
|
|
|
27
27
|
},
|
|
28
28
|
placement: E = "masonry"
|
|
29
29
|
} = l;
|
|
30
|
-
let
|
|
30
|
+
let f = 0, D = 0;
|
|
31
31
|
try {
|
|
32
32
|
if (c && c.nodeType === 1 && typeof window < "u" && window.getComputedStyle) {
|
|
33
33
|
const H = window.getComputedStyle(c);
|
|
34
|
-
|
|
34
|
+
f = parseFloat(H.paddingLeft) || 0, D = parseFloat(H.paddingRight) || 0;
|
|
35
35
|
}
|
|
36
36
|
} catch {
|
|
37
37
|
}
|
|
38
|
-
const A = (g || 0) +
|
|
38
|
+
const A = (g || 0) + f, O = (b || 0) + D, m = c.offsetWidth - c.clientWidth, r = m > 0 ? m + 2 : Tt() + 2, L = c.offsetWidth - r - A - O, y = M * (v - 1), x = Math.floor((L - y) / v), N = t.map((H) => {
|
|
39
39
|
const I = H.width, S = H.height;
|
|
40
40
|
return Math.round(x * S / I) + s + o;
|
|
41
41
|
});
|
|
@@ -44,19 +44,19 @@ function Xe(t, c, v, l = {}) {
|
|
|
44
44
|
if (H === 0) return [];
|
|
45
45
|
const I = (P, B, G) => P + (B > 0 ? h : 0) + G;
|
|
46
46
|
let S = Math.max(...N), n = N.reduce((P, B) => P + B, 0) + h * Math.max(0, H - 1);
|
|
47
|
-
const
|
|
47
|
+
const w = (P) => {
|
|
48
48
|
let B = 1, G = 0, X = 0;
|
|
49
49
|
for (let J = 0; J < H; J++) {
|
|
50
|
-
const
|
|
50
|
+
const ue = N[J], Z = I(G, X, ue);
|
|
51
51
|
if (Z <= P)
|
|
52
52
|
G = Z, X++;
|
|
53
|
-
else if (B++, G =
|
|
53
|
+
else if (B++, G = ue, X = 1, ue > P || B > v) return !1;
|
|
54
54
|
}
|
|
55
55
|
return B <= v;
|
|
56
56
|
};
|
|
57
57
|
for (; S < n; ) {
|
|
58
58
|
const P = Math.floor((S + n) / 2);
|
|
59
|
-
|
|
59
|
+
w(P) ? n = P : S = P + 1;
|
|
60
60
|
}
|
|
61
61
|
const F = n, $ = new Array(v).fill(0);
|
|
62
62
|
let ae = v - 1, Q = 0, W = 0;
|
|
@@ -91,27 +91,27 @@ function Xe(t, c, v, l = {}) {
|
|
|
91
91
|
columnHeight: 0,
|
|
92
92
|
left: 0,
|
|
93
93
|
top: 0
|
|
94
|
-
}, n = p.indexOf(Math.min(...p)),
|
|
95
|
-
S.columnWidth = x, S.left = n * (x + M), S.imageHeight = Math.round(x * F /
|
|
94
|
+
}, n = p.indexOf(Math.min(...p)), w = I.width, F = I.height;
|
|
95
|
+
S.columnWidth = x, S.left = n * (x + M), S.imageHeight = Math.round(x * F / w), S.columnHeight = S.imageHeight + s + o, S.top = p[n], p[n] += S.columnHeight + h, z.push(S);
|
|
96
96
|
}
|
|
97
97
|
return z;
|
|
98
98
|
}
|
|
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")(),
|
|
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")(), xe = nt.Symbol, ot = Object.prototype, It = ot.hasOwnProperty, kt = ot.toString, ge = xe ? xe.toStringTag : void 0;
|
|
100
100
|
function St(t) {
|
|
101
|
-
var c = It.call(t,
|
|
101
|
+
var c = It.call(t, ge), v = t[ge];
|
|
102
102
|
try {
|
|
103
|
-
t[
|
|
103
|
+
t[ge] = void 0;
|
|
104
104
|
var l = !0;
|
|
105
105
|
} catch {
|
|
106
106
|
}
|
|
107
107
|
var M = kt.call(t);
|
|
108
|
-
return l && (c ? t[
|
|
108
|
+
return l && (c ? t[ge] = v : delete t[ge]), M;
|
|
109
109
|
}
|
|
110
110
|
var Pt = Object.prototype, Ht = Pt.toString;
|
|
111
111
|
function $t(t) {
|
|
112
112
|
return Ht.call(t);
|
|
113
113
|
}
|
|
114
|
-
var Nt = "[object Null]", Wt = "[object Undefined]", _e =
|
|
114
|
+
var Nt = "[object Null]", Wt = "[object Undefined]", _e = xe ? xe.toStringTag : void 0;
|
|
115
115
|
function Dt(t) {
|
|
116
116
|
return t == null ? t === void 0 ? Wt : Nt : _e && _e in Object(t) ? St(t) : $t(t);
|
|
117
117
|
}
|
|
@@ -156,10 +156,10 @@ var Pe = function() {
|
|
|
156
156
|
return nt.Date.now();
|
|
157
157
|
}, Ut = "Expected a function", Gt = Math.max, Xt = Math.min;
|
|
158
158
|
function Qe(t, c, v) {
|
|
159
|
-
var l, M, h, o, s, g, b = 0, k = !1, E = !1,
|
|
159
|
+
var l, M, h, o, s, g, b = 0, k = !1, E = !1, f = !0;
|
|
160
160
|
if (typeof t != "function")
|
|
161
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,
|
|
162
|
+
c = Ke(c) || 0, He(v) && (k = !!v.leading, E = "maxWait" in v, h = E ? Gt(Ke(v.maxWait) || 0, c) : h, f = "trailing" in v ? !!v.trailing : f);
|
|
163
163
|
function D(p) {
|
|
164
164
|
var z = l, H = M;
|
|
165
165
|
return l = M = void 0, b = p, o = t.apply(H, z), o;
|
|
@@ -182,9 +182,9 @@ function Qe(t, c, v) {
|
|
|
182
182
|
s = setTimeout(r, O(p));
|
|
183
183
|
}
|
|
184
184
|
function L(p) {
|
|
185
|
-
return s = void 0,
|
|
185
|
+
return s = void 0, f && l ? D(p) : (l = M = void 0, o);
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function y() {
|
|
188
188
|
s !== void 0 && clearTimeout(s), b = 0, l = g = M = s = void 0;
|
|
189
189
|
}
|
|
190
190
|
function x() {
|
|
@@ -200,9 +200,9 @@ function Qe(t, c, v) {
|
|
|
200
200
|
}
|
|
201
201
|
return s === void 0 && (s = setTimeout(r, c)), o;
|
|
202
202
|
}
|
|
203
|
-
return N.cancel =
|
|
203
|
+
return N.cancel = y, N.flush = x, N;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function fe(t, c) {
|
|
206
206
|
const v = c ?? (typeof window < "u" ? window.innerWidth : 1024), l = t.sizes;
|
|
207
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;
|
|
208
208
|
}
|
|
@@ -246,11 +246,11 @@ function $e(t, c) {
|
|
|
246
246
|
}
|
|
247
247
|
function Zt(t, c) {
|
|
248
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),
|
|
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), f = o.style.getPropertyValue("--masonry-opacity-delay");
|
|
250
250
|
o.style.setProperty("--masonry-opacity-delay", `${E}ms`), requestAnimationFrame(() => {
|
|
251
251
|
o.style.opacity = "1", o.style.transform = `translate3d(${g}px, ${b}px, 0) scale(1)`;
|
|
252
252
|
const D = () => {
|
|
253
|
-
|
|
253
|
+
f ? o.style.setProperty("--masonry-opacity-delay", f) : o.style.removeProperty("--masonry-opacity-delay"), o.removeEventListener("transitionend", D), s();
|
|
254
254
|
};
|
|
255
255
|
o.addEventListener("transitionend", D);
|
|
256
256
|
});
|
|
@@ -272,8 +272,8 @@ function Zt(t, c) {
|
|
|
272
272
|
const r = getComputedStyle(o).getPropertyValue("--masonry-leave-duration") || "", L = parseFloat(r);
|
|
273
273
|
E = Number.isFinite(L) && L > 0 ? L : 200;
|
|
274
274
|
}
|
|
275
|
-
const
|
|
276
|
-
o.removeEventListener("transitionend", A), clearTimeout(O), o.style.transitionDuration =
|
|
275
|
+
const f = o.style.transitionDuration, D = () => {
|
|
276
|
+
o.removeEventListener("transitionend", A), clearTimeout(O), o.style.transitionDuration = f || "";
|
|
277
277
|
}, A = (m) => {
|
|
278
278
|
(!m || m.target === o) && (D(), s());
|
|
279
279
|
}, O = setTimeout(() => {
|
|
@@ -303,9 +303,9 @@ function ea({
|
|
|
303
303
|
loadThresholdPx: b
|
|
304
304
|
}) {
|
|
305
305
|
let k = 0;
|
|
306
|
-
async function E(
|
|
306
|
+
async function E(f) {
|
|
307
307
|
if (!t.value) return;
|
|
308
|
-
const D =
|
|
308
|
+
const D = f ?? $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
309
|
k = t.value.scrollTop;
|
|
310
310
|
const r = typeof b == "number" ? b : 200, L = r >= 0 ? Math.max(0, A - r) : Math.max(0, A + r);
|
|
311
311
|
if (O >= L && m && !M.value) {
|
|
@@ -329,7 +329,7 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
329
329
|
}, ua = {
|
|
330
330
|
key: 4,
|
|
331
331
|
class: "absolute inset-0 flex flex-col items-center justify-center bg-slate-50 text-slate-400 text-sm p-4 text-center"
|
|
332
|
-
},
|
|
332
|
+
}, Me = /* @__PURE__ */ et({
|
|
333
333
|
__name: "MasonryItem",
|
|
334
334
|
props: {
|
|
335
335
|
item: {},
|
|
@@ -343,7 +343,7 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
343
343
|
},
|
|
344
344
|
emits: ["preload:success", "preload:error", "mouse-enter", "mouse-leave"],
|
|
345
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),
|
|
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), f = T(!1), D = T(null), A = T(null);
|
|
347
347
|
let O = null;
|
|
348
348
|
const m = K(() => {
|
|
349
349
|
var n;
|
|
@@ -352,7 +352,7 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
352
352
|
var n;
|
|
353
353
|
return v.notFound ?? ((n = v.item) == null ? void 0 : n.notFound) ?? !1;
|
|
354
354
|
}), L = K(() => !!v.inSwipeMode);
|
|
355
|
-
function
|
|
355
|
+
function y(n) {
|
|
356
356
|
l("mouse-enter", { item: v.item, type: n });
|
|
357
357
|
}
|
|
358
358
|
function x(n) {
|
|
@@ -360,19 +360,19 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
360
360
|
}
|
|
361
361
|
function N(n) {
|
|
362
362
|
if (L.value) return;
|
|
363
|
-
const
|
|
364
|
-
|
|
363
|
+
const w = n.target;
|
|
364
|
+
w && (w.paused ? w.play() : w.pause());
|
|
365
365
|
}
|
|
366
366
|
function p(n) {
|
|
367
|
-
const
|
|
368
|
-
|
|
367
|
+
const w = n.target;
|
|
368
|
+
w && (L.value || w.play(), y("video"));
|
|
369
369
|
}
|
|
370
370
|
function z(n) {
|
|
371
|
-
const
|
|
372
|
-
|
|
371
|
+
const w = n.target;
|
|
372
|
+
w && (L.value || w.pause(), x("video"));
|
|
373
373
|
}
|
|
374
374
|
function H(n) {
|
|
375
|
-
return new Promise((
|
|
375
|
+
return new Promise((w, F) => {
|
|
376
376
|
if (!n) {
|
|
377
377
|
const W = new Error("No image source provided");
|
|
378
378
|
l("preload:error", { item: v.item, type: "image", src: n, error: W }), F(W);
|
|
@@ -382,7 +382,7 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
382
382
|
$.onload = () => {
|
|
383
383
|
const W = Date.now() - ae, U = Math.max(0, Q - W);
|
|
384
384
|
setTimeout(async () => {
|
|
385
|
-
M.value = !0, h.value = !1, E.value = !1, await Y(), await new Promise((_) => setTimeout(_, 100)),
|
|
385
|
+
M.value = !0, h.value = !1, E.value = !1, await Y(), await new Promise((_) => setTimeout(_, 100)), f.value = !0, l("preload:success", { item: v.item, type: "image", src: n }), w();
|
|
386
386
|
}, U);
|
|
387
387
|
}, $.onerror = () => {
|
|
388
388
|
h.value = !0, M.value = !1, E.value = !1;
|
|
@@ -392,7 +392,7 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
392
392
|
});
|
|
393
393
|
}
|
|
394
394
|
function I(n) {
|
|
395
|
-
return new Promise((
|
|
395
|
+
return new Promise((w, F) => {
|
|
396
396
|
if (!n) {
|
|
397
397
|
const W = new Error("No video source provided");
|
|
398
398
|
l("preload:error", { item: v.item, type: "video", src: n, error: W }), F(W);
|
|
@@ -402,7 +402,7 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
402
402
|
$.preload = "metadata", $.muted = !0, $.onloadedmetadata = () => {
|
|
403
403
|
const W = Date.now() - ae, U = Math.max(0, Q - W);
|
|
404
404
|
setTimeout(async () => {
|
|
405
|
-
s.value = !0, g.value = !1, E.value = !1, await Y(), await new Promise((_) => setTimeout(_, 100)),
|
|
405
|
+
s.value = !0, g.value = !1, E.value = !1, await Y(), await new Promise((_) => setTimeout(_, 100)), f.value = !0, l("preload:success", { item: v.item, type: "video", src: n }), w();
|
|
406
406
|
}, U);
|
|
407
407
|
}, $.onerror = () => {
|
|
408
408
|
g.value = !0, s.value = !1, E.value = !1;
|
|
@@ -412,12 +412,12 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
412
412
|
});
|
|
413
413
|
}
|
|
414
414
|
async function S() {
|
|
415
|
-
var
|
|
415
|
+
var w;
|
|
416
416
|
if (!k.value || E.value || r.value || m.value === "video" && s.value || m.value === "image" && M.value)
|
|
417
417
|
return;
|
|
418
|
-
const n = (
|
|
418
|
+
const n = (w = v.item) == null ? void 0 : w.src;
|
|
419
419
|
if (n)
|
|
420
|
-
if (E.value = !0,
|
|
420
|
+
if (E.value = !0, f.value = !1, m.value === "video") {
|
|
421
421
|
b.value = n, s.value = !1, g.value = !1;
|
|
422
422
|
try {
|
|
423
423
|
await I(n);
|
|
@@ -434,8 +434,8 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
434
434
|
return tt(() => {
|
|
435
435
|
D.value && (O = new IntersectionObserver(
|
|
436
436
|
(n) => {
|
|
437
|
-
n.forEach((
|
|
438
|
-
|
|
437
|
+
n.forEach((w) => {
|
|
438
|
+
w.isIntersecting && w.intersectionRatio >= 1 ? k.value || (k.value = !0, S()) : w.isIntersecting;
|
|
439
439
|
});
|
|
440
440
|
},
|
|
441
441
|
{
|
|
@@ -474,7 +474,7 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
474
474
|
(n) => {
|
|
475
475
|
!L.value || !A.value || (n ? A.value.play() : A.value.pause());
|
|
476
476
|
}
|
|
477
|
-
), (n,
|
|
477
|
+
), (n, w) => (C(), j("div", {
|
|
478
478
|
ref_key: "containerRef",
|
|
479
479
|
ref: D,
|
|
480
480
|
class: "relative w-full h-full flex flex-col"
|
|
@@ -482,7 +482,7 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
482
482
|
n.headerHeight > 0 ? (C(), j("div", {
|
|
483
483
|
key: 0,
|
|
484
484
|
class: "relative z-10",
|
|
485
|
-
style:
|
|
485
|
+
style: ye({ height: `${n.headerHeight}px` })
|
|
486
486
|
}, [
|
|
487
487
|
le(n.$slots, "header", {
|
|
488
488
|
item: n.item,
|
|
@@ -495,7 +495,7 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
495
495
|
isLoading: E.value,
|
|
496
496
|
mediaType: m.value
|
|
497
497
|
})
|
|
498
|
-
], 4)) :
|
|
498
|
+
], 4)) : ie("", !0),
|
|
499
499
|
V("div", ta, [
|
|
500
500
|
le(n.$slots, "default", {
|
|
501
501
|
item: n.item,
|
|
@@ -509,10 +509,10 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
509
509
|
mediaType: m.value,
|
|
510
510
|
imageSrc: o.value,
|
|
511
511
|
videoSrc: b.value,
|
|
512
|
-
showMedia:
|
|
512
|
+
showMedia: f.value
|
|
513
513
|
}, () => [
|
|
514
514
|
V("div", aa, [
|
|
515
|
-
r.value ? (C(), j("div", na,
|
|
515
|
+
r.value ? (C(), j("div", na, w[3] || (w[3] = [
|
|
516
516
|
V("i", { class: "fas fa-search text-3xl mb-3 opacity-50" }, null, -1),
|
|
517
517
|
V("span", { class: "font-medium" }, "Not Found", -1),
|
|
518
518
|
V("span", { class: "text-xs mt-1 opacity-75" }, "This item could not be located", -1)
|
|
@@ -520,25 +520,25 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
520
520
|
m.value === "image" && o.value ? (C(), j("img", {
|
|
521
521
|
key: 0,
|
|
522
522
|
src: o.value,
|
|
523
|
-
class:
|
|
523
|
+
class: se([
|
|
524
524
|
"w-full h-full object-cover transition-opacity duration-700 ease-in-out",
|
|
525
|
-
M.value &&
|
|
525
|
+
M.value && f.value ? "opacity-100" : "opacity-0"
|
|
526
526
|
]),
|
|
527
527
|
style: { position: "absolute", top: "0", left: "0" },
|
|
528
528
|
loading: "lazy",
|
|
529
529
|
decoding: "async",
|
|
530
530
|
alt: "",
|
|
531
|
-
onMouseenter:
|
|
532
|
-
onMouseleave:
|
|
533
|
-
}, null, 42, la)) :
|
|
531
|
+
onMouseenter: w[0] || (w[0] = (F) => y("image")),
|
|
532
|
+
onMouseleave: w[1] || (w[1] = (F) => x("image"))
|
|
533
|
+
}, null, 42, la)) : ie("", !0),
|
|
534
534
|
m.value === "video" && b.value ? (C(), j("video", {
|
|
535
535
|
key: 1,
|
|
536
536
|
ref_key: "videoEl",
|
|
537
537
|
ref: A,
|
|
538
538
|
src: b.value,
|
|
539
|
-
class:
|
|
539
|
+
class: se([
|
|
540
540
|
"w-full h-full object-cover transition-opacity duration-700 ease-in-out",
|
|
541
|
-
s.value &&
|
|
541
|
+
s.value && f.value ? "opacity-100" : "opacity-0"
|
|
542
542
|
]),
|
|
543
543
|
style: { position: "absolute", top: "0", left: "0" },
|
|
544
544
|
muted: "",
|
|
@@ -550,32 +550,32 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
550
550
|
onTouchend: Ye(N, ["stop", "prevent"]),
|
|
551
551
|
onMouseenter: p,
|
|
552
552
|
onMouseleave: z,
|
|
553
|
-
onError:
|
|
554
|
-
}, null, 42, ra)) :
|
|
553
|
+
onError: w[2] || (w[2] = (F) => g.value = !0)
|
|
554
|
+
}, null, 42, ra)) : ie("", !0),
|
|
555
555
|
!M.value && !s.value && !h.value && !g.value ? (C(), j("div", {
|
|
556
556
|
key: 2,
|
|
557
|
-
class:
|
|
557
|
+
class: se([
|
|
558
558
|
"absolute inset-0 bg-slate-100 flex items-center justify-center transition-opacity duration-500",
|
|
559
|
-
|
|
559
|
+
f.value ? "opacity-0 pointer-events-none" : "opacity-100"
|
|
560
560
|
])
|
|
561
561
|
}, [
|
|
562
562
|
V("div", ia, [
|
|
563
563
|
V("i", {
|
|
564
|
-
class:
|
|
564
|
+
class: se(m.value === "video" ? "fas fa-video text-xl text-slate-400" : "fas fa-image text-xl text-slate-400")
|
|
565
565
|
}, null, 2)
|
|
566
566
|
])
|
|
567
|
-
], 2)) :
|
|
568
|
-
E.value ? (C(), j("div", sa,
|
|
567
|
+
], 2)) : ie("", !0),
|
|
568
|
+
E.value ? (C(), j("div", sa, w[4] || (w[4] = [
|
|
569
569
|
V("div", { class: "bg-white/90 backdrop-blur-sm rounded-full px-3 py-1.5 shadow-sm" }, [
|
|
570
570
|
V("div", { class: "animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500" })
|
|
571
571
|
], -1)
|
|
572
|
-
]))) :
|
|
572
|
+
]))) : ie("", !0),
|
|
573
573
|
m.value === "image" && h.value || m.value === "video" && g.value ? (C(), j("div", ua, [
|
|
574
574
|
V("i", {
|
|
575
|
-
class:
|
|
575
|
+
class: se(m.value === "video" ? "fas fa-video text-2xl mb-2 opacity-50" : "fas fa-image text-2xl mb-2 opacity-50")
|
|
576
576
|
}, null, 2),
|
|
577
577
|
V("span", null, "Failed to load " + bt(m.value), 1)
|
|
578
|
-
])) :
|
|
578
|
+
])) : ie("", !0)
|
|
579
579
|
]))
|
|
580
580
|
])
|
|
581
581
|
])
|
|
@@ -583,7 +583,7 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
583
583
|
n.footerHeight > 0 ? (C(), j("div", {
|
|
584
584
|
key: 1,
|
|
585
585
|
class: "relative z-10",
|
|
586
|
-
style:
|
|
586
|
+
style: ye({ height: `${n.footerHeight}px` })
|
|
587
587
|
}, [
|
|
588
588
|
le(n.$slots, "footer", {
|
|
589
589
|
item: n.item,
|
|
@@ -596,7 +596,7 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
596
596
|
isLoading: E.value,
|
|
597
597
|
mediaType: m.value
|
|
598
598
|
})
|
|
599
|
-
], 4)) :
|
|
599
|
+
], 4)) : ie("", !0)
|
|
600
600
|
], 512));
|
|
601
601
|
}
|
|
602
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({
|
|
@@ -748,27 +748,27 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
748
748
|
"2xl": 1536
|
|
749
749
|
}[e] || 768;
|
|
750
750
|
}
|
|
751
|
-
const
|
|
751
|
+
const f = K(() => {
|
|
752
752
|
if (l.layoutMode === "masonry") return !1;
|
|
753
753
|
if (l.layoutMode === "swipe") return !0;
|
|
754
754
|
const e = typeof l.mobileBreakpoint == "string" ? E(l.mobileBreakpoint) : l.mobileBreakpoint;
|
|
755
755
|
return s.value < e;
|
|
756
756
|
}), D = K(() => {
|
|
757
|
-
if (!
|
|
757
|
+
if (!f.value || r.value.length === 0) return null;
|
|
758
758
|
const e = Math.max(0, Math.min(I.value, r.value.length - 1));
|
|
759
759
|
return r.value[e] || null;
|
|
760
760
|
}), A = K(() => {
|
|
761
|
-
if (!
|
|
761
|
+
if (!f.value || !D.value) return null;
|
|
762
762
|
const e = I.value + 1;
|
|
763
763
|
return e >= r.value.length ? null : r.value[e] || null;
|
|
764
764
|
}), O = K(() => {
|
|
765
|
-
if (!
|
|
765
|
+
if (!f.value || !D.value) return null;
|
|
766
766
|
const e = I.value - 1;
|
|
767
767
|
return e < 0 ? null : r.value[e] || null;
|
|
768
768
|
}), m = v, r = K({
|
|
769
769
|
get: () => l.items,
|
|
770
770
|
set: (e) => m("update:items", e)
|
|
771
|
-
}), L = T(7),
|
|
771
|
+
}), L = T(7), y = 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), w = T(0), F = T(0), $ = T(null), ae = T(/* @__PURE__ */ new Set());
|
|
772
772
|
function Q(e) {
|
|
773
773
|
return typeof e == "number" && Number.isFinite(e) && e > 0;
|
|
774
774
|
}
|
|
@@ -777,18 +777,18 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
777
777
|
if (!Array.isArray(e) || e.length === 0) return;
|
|
778
778
|
const i = e.filter((u) => !Q(u == null ? void 0 : u.width) || !Q(u == null ? void 0 : u.height));
|
|
779
779
|
if (i.length === 0) return;
|
|
780
|
-
const
|
|
780
|
+
const d = [];
|
|
781
781
|
for (const u of i) {
|
|
782
782
|
const R = (u == null ? void 0 : u.id) ?? `idx:${e.indexOf(u)}`;
|
|
783
|
-
ae.value.has(R) || (ae.value.add(R),
|
|
783
|
+
ae.value.has(R) || (ae.value.add(R), d.push(R));
|
|
784
784
|
}
|
|
785
|
-
if (
|
|
786
|
-
const u =
|
|
785
|
+
if (d.length > 0) {
|
|
786
|
+
const u = d.slice(0, 10);
|
|
787
787
|
console.warn(
|
|
788
788
|
"[Masonry] Items missing width/height detected:",
|
|
789
789
|
{
|
|
790
790
|
context: a,
|
|
791
|
-
count:
|
|
791
|
+
count: d.length,
|
|
792
792
|
sampleIds: u,
|
|
793
793
|
hint: "Ensure each item has positive width and height. Consider providing fallbacks (e.g., 512x512) at the data layer."
|
|
794
794
|
}
|
|
@@ -801,17 +801,17 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
801
801
|
distanceToTrigger: 0,
|
|
802
802
|
isNearTrigger: !1
|
|
803
803
|
}), X = (e) => {
|
|
804
|
-
if (!
|
|
805
|
-
const { scrollTop: a, clientHeight: i } =
|
|
804
|
+
if (!y.value) return;
|
|
805
|
+
const { scrollTop: a, clientHeight: i } = y.value, d = a + i, u = e ?? $e(r.value, L.value), R = u.length ? Math.max(...u) : 0, te = typeof l.loadThresholdPx == "number" ? l.loadThresholdPx : 200, ve = te >= 0 ? Math.max(0, R - te) : Math.max(0, R + te), Ve = Math.max(0, ve - d), wt = Ve <= 100;
|
|
806
806
|
G.value = {
|
|
807
807
|
distanceToTrigger: Math.round(Ve),
|
|
808
808
|
isNearTrigger: wt
|
|
809
809
|
};
|
|
810
|
-
}, { onEnter: J, onBeforeEnter:
|
|
810
|
+
}, { onEnter: J, onBeforeEnter: ue, onBeforeLeave: Z, onLeave: lt } = Zt(r, { leaveDurationMs: l.leaveDurationMs });
|
|
811
811
|
function rt(e, a) {
|
|
812
812
|
if (B.value) {
|
|
813
|
-
const i = parseInt(e.dataset.left || "0", 10),
|
|
814
|
-
e.style.transition = "none", e.style.opacity = "1", e.style.transform = `translate3d(${i}px, ${
|
|
813
|
+
const i = parseInt(e.dataset.left || "0", 10), d = parseInt(e.dataset.top || "0", 10);
|
|
814
|
+
e.style.transition = "none", e.style.opacity = "1", e.style.transform = `translate3d(${i}px, ${d}px, 0) scale(1)`, e.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
|
|
815
815
|
e.style.transition = "", a();
|
|
816
816
|
});
|
|
817
817
|
} else
|
|
@@ -822,7 +822,7 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
822
822
|
const a = parseInt(e.dataset.left || "0", 10), i = parseInt(e.dataset.top || "0", 10);
|
|
823
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");
|
|
824
824
|
} else
|
|
825
|
-
|
|
825
|
+
ue(e);
|
|
826
826
|
}
|
|
827
827
|
function st(e) {
|
|
828
828
|
B.value || Z(e);
|
|
@@ -832,12 +832,12 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
832
832
|
}
|
|
833
833
|
const ct = K(() => {
|
|
834
834
|
const e = U.value - P, a = U.value + _.value + P, i = r.value;
|
|
835
|
-
return !i || i.length === 0 ? [] : i.filter((
|
|
836
|
-
const u =
|
|
837
|
-
return
|
|
835
|
+
return !i || i.length === 0 ? [] : i.filter((d) => {
|
|
836
|
+
const u = d.top;
|
|
837
|
+
return d.top + d.columnHeight >= e && u <= a;
|
|
838
838
|
});
|
|
839
839
|
}), { handleScroll: vt } = ea({
|
|
840
|
-
container:
|
|
840
|
+
container: y,
|
|
841
841
|
masonry: r,
|
|
842
842
|
columns: L,
|
|
843
843
|
containerHeight: z,
|
|
@@ -847,12 +847,12 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
847
847
|
setItemsRaw: (e) => {
|
|
848
848
|
r.value = e;
|
|
849
849
|
},
|
|
850
|
-
loadNext:
|
|
850
|
+
loadNext: ce,
|
|
851
851
|
loadThresholdPx: l.loadThresholdPx
|
|
852
852
|
});
|
|
853
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), !
|
|
855
|
-
L.value =
|
|
854
|
+
b.value = e, e ? (e.width !== void 0 && (s.value = e.width), e.height !== void 0 && (g.value = e.height), !f.value && y.value && r.value.length > 0 && Y(() => {
|
|
855
|
+
L.value = fe(h.value, s.value), ee(r.value), X();
|
|
856
856
|
})) : o.value && (s.value = o.value.clientWidth, g.value = o.value.clientHeight);
|
|
857
857
|
}
|
|
858
858
|
c({
|
|
@@ -867,12 +867,12 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
867
867
|
currentPage: N,
|
|
868
868
|
// Set fixed dimensions (overrides ResizeObserver)
|
|
869
869
|
setFixedDimensions: ft,
|
|
870
|
-
remove:
|
|
870
|
+
remove: de,
|
|
871
871
|
removeMany: mt,
|
|
872
872
|
removeAll: ht,
|
|
873
|
-
loadNext:
|
|
874
|
-
loadPage:
|
|
875
|
-
refreshCurrentPage:
|
|
873
|
+
loadNext: ce,
|
|
874
|
+
loadPage: Te,
|
|
875
|
+
refreshCurrentPage: Ee,
|
|
876
876
|
reset: gt,
|
|
877
877
|
init: yt,
|
|
878
878
|
paginationHistory: x,
|
|
@@ -884,48 +884,48 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
884
884
|
function Ne(e) {
|
|
885
885
|
const a = Jt(e);
|
|
886
886
|
let i = 0;
|
|
887
|
-
if (
|
|
888
|
-
const { scrollTop:
|
|
889
|
-
i =
|
|
887
|
+
if (y.value) {
|
|
888
|
+
const { scrollTop: d, clientHeight: u } = y.value;
|
|
889
|
+
i = d + u + 100;
|
|
890
890
|
}
|
|
891
891
|
z.value = Math.max(a, i);
|
|
892
892
|
}
|
|
893
893
|
function ee(e) {
|
|
894
|
-
if (
|
|
894
|
+
if (f.value) {
|
|
895
895
|
r.value = e;
|
|
896
896
|
return;
|
|
897
897
|
}
|
|
898
|
-
if (!
|
|
898
|
+
if (!y.value) return;
|
|
899
899
|
W(e, "refreshLayout");
|
|
900
|
-
const a = e.map((
|
|
901
|
-
...
|
|
902
|
-
originalIndex:
|
|
903
|
-
})), i =
|
|
900
|
+
const a = e.map((d, u) => ({
|
|
901
|
+
...d,
|
|
902
|
+
originalIndex: d.originalIndex ?? u
|
|
903
|
+
})), i = y.value;
|
|
904
904
|
if (b.value && b.value.width !== void 0) {
|
|
905
|
-
const
|
|
905
|
+
const d = i.style.width, u = i.style.boxSizing;
|
|
906
906
|
i.style.boxSizing = "border-box", i.style.width = `${b.value.width}px`, i.offsetWidth;
|
|
907
907
|
const R = Xe(a, i, L.value, h.value);
|
|
908
|
-
i.style.width =
|
|
908
|
+
i.style.width = d, i.style.boxSizing = u, Ne(R), r.value = R;
|
|
909
909
|
} else {
|
|
910
|
-
const
|
|
911
|
-
Ne(
|
|
910
|
+
const d = Xe(a, i, L.value, h.value);
|
|
911
|
+
Ne(d), r.value = d;
|
|
912
912
|
}
|
|
913
913
|
}
|
|
914
914
|
function We(e, a) {
|
|
915
915
|
return new Promise((i) => {
|
|
916
|
-
const
|
|
917
|
-
a(
|
|
916
|
+
const d = Math.max(0, e | 0), u = Date.now();
|
|
917
|
+
a(d, d);
|
|
918
918
|
const R = setInterval(() => {
|
|
919
919
|
if (q.value) {
|
|
920
920
|
clearInterval(R), i();
|
|
921
921
|
return;
|
|
922
922
|
}
|
|
923
|
-
const te = Date.now() - u,
|
|
924
|
-
a(
|
|
923
|
+
const te = Date.now() - u, ve = Math.max(0, d - te);
|
|
924
|
+
a(ve, d), ve <= 0 && (clearInterval(R), i());
|
|
925
925
|
}, 100);
|
|
926
926
|
});
|
|
927
927
|
}
|
|
928
|
-
async function
|
|
928
|
+
async function we(e) {
|
|
929
929
|
try {
|
|
930
930
|
const a = await dt(() => l.getNextPage(e));
|
|
931
931
|
return ee([...r.value, ...a.items]), a;
|
|
@@ -936,7 +936,7 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
936
936
|
async function dt(e) {
|
|
937
937
|
let a = 0;
|
|
938
938
|
const i = l.retryMaxAttempts;
|
|
939
|
-
let
|
|
939
|
+
let d = l.retryInitialDelayMs;
|
|
940
940
|
for (; ; )
|
|
941
941
|
try {
|
|
942
942
|
const u = await e();
|
|
@@ -944,19 +944,19 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
944
944
|
} catch (u) {
|
|
945
945
|
if (a++, a > i)
|
|
946
946
|
throw m("retry:stop", { attempt: a - 1, success: !1 }), u;
|
|
947
|
-
m("retry:start", { attempt: a, max: i, totalMs:
|
|
947
|
+
m("retry:start", { attempt: a, max: i, totalMs: d }), await We(d, (R, te) => {
|
|
948
948
|
m("retry:tick", { attempt: a, remainingMs: R, totalMs: te });
|
|
949
|
-
}),
|
|
949
|
+
}), d += l.retryBackoffStepMs;
|
|
950
950
|
}
|
|
951
951
|
}
|
|
952
|
-
async function
|
|
952
|
+
async function Te(e) {
|
|
953
953
|
if (!p.value) {
|
|
954
954
|
q.value = !1, p.value = !0;
|
|
955
955
|
try {
|
|
956
956
|
const a = r.value.length;
|
|
957
957
|
if (q.value) return;
|
|
958
|
-
const i = await
|
|
959
|
-
return q.value ? void 0 : (N.value = e, x.value.push(i.nextPage), await
|
|
958
|
+
const i = await we(e);
|
|
959
|
+
return q.value ? void 0 : (N.value = e, x.value.push(i.nextPage), await me(a), i);
|
|
960
960
|
} catch (a) {
|
|
961
961
|
throw console.error("Error loading page:", a), a;
|
|
962
962
|
} finally {
|
|
@@ -964,14 +964,14 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
964
964
|
}
|
|
965
965
|
}
|
|
966
966
|
}
|
|
967
|
-
async function
|
|
967
|
+
async function ce() {
|
|
968
968
|
if (!p.value) {
|
|
969
969
|
q.value = !1, p.value = !0;
|
|
970
970
|
try {
|
|
971
971
|
const e = r.value.length;
|
|
972
972
|
if (q.value) return;
|
|
973
|
-
const a = x.value[x.value.length - 1], i = await
|
|
974
|
-
return q.value ? void 0 : (N.value = a, x.value.push(i.nextPage), await
|
|
973
|
+
const a = x.value[x.value.length - 1], i = await we(a);
|
|
974
|
+
return q.value ? void 0 : (N.value = a, x.value.push(i.nextPage), await me(e), i);
|
|
975
975
|
} catch (e) {
|
|
976
976
|
throw console.error("Error loading next page:", e), e;
|
|
977
977
|
} finally {
|
|
@@ -979,7 +979,7 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
979
979
|
}
|
|
980
980
|
}
|
|
981
981
|
}
|
|
982
|
-
async function
|
|
982
|
+
async function Ee() {
|
|
983
983
|
if (!p.value) {
|
|
984
984
|
q.value = !1, p.value = !0;
|
|
985
985
|
try {
|
|
@@ -989,11 +989,11 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
989
989
|
return;
|
|
990
990
|
}
|
|
991
991
|
r.value = [], z.value = 0, x.value = [e], await Y();
|
|
992
|
-
const a = await
|
|
992
|
+
const a = await we(e);
|
|
993
993
|
if (q.value) return;
|
|
994
994
|
N.value = e, x.value.push(a.nextPage);
|
|
995
995
|
const i = r.value.length;
|
|
996
|
-
return await
|
|
996
|
+
return await me(i), a;
|
|
997
997
|
} catch (e) {
|
|
998
998
|
throw console.error("[Masonry] Error refreshing current page:", e), e;
|
|
999
999
|
} finally {
|
|
@@ -1001,14 +1001,14 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
1001
1001
|
}
|
|
1002
1002
|
}
|
|
1003
1003
|
}
|
|
1004
|
-
async function
|
|
1004
|
+
async function de(e) {
|
|
1005
1005
|
const a = r.value.filter((i) => i.id !== e.id);
|
|
1006
1006
|
if (r.value = a, await Y(), a.length === 0 && x.value.length > 0) {
|
|
1007
1007
|
if (l.autoRefreshOnEmpty)
|
|
1008
|
-
await
|
|
1008
|
+
await Ee();
|
|
1009
1009
|
else
|
|
1010
1010
|
try {
|
|
1011
|
-
await
|
|
1011
|
+
await ce(), await me(0, !0);
|
|
1012
1012
|
} catch {
|
|
1013
1013
|
}
|
|
1014
1014
|
return;
|
|
@@ -1019,23 +1019,23 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
1019
1019
|
}
|
|
1020
1020
|
async function mt(e) {
|
|
1021
1021
|
if (!e || e.length === 0) return;
|
|
1022
|
-
const a = new Set(e.map((
|
|
1022
|
+
const a = new Set(e.map((d) => d.id)), i = r.value.filter((d) => !a.has(d.id));
|
|
1023
1023
|
if (r.value = i, await Y(), i.length === 0 && x.value.length > 0) {
|
|
1024
1024
|
if (l.autoRefreshOnEmpty)
|
|
1025
|
-
await
|
|
1025
|
+
await Ee();
|
|
1026
1026
|
else
|
|
1027
1027
|
try {
|
|
1028
|
-
await
|
|
1028
|
+
await ce(), await me(0, !0);
|
|
1029
1029
|
} catch {
|
|
1030
1030
|
}
|
|
1031
1031
|
return;
|
|
1032
1032
|
}
|
|
1033
|
-
await new Promise((
|
|
1033
|
+
await new Promise((d) => requestAnimationFrame(() => d())), requestAnimationFrame(() => {
|
|
1034
1034
|
ee(i);
|
|
1035
1035
|
});
|
|
1036
1036
|
}
|
|
1037
1037
|
function De(e) {
|
|
1038
|
-
|
|
1038
|
+
y.value && y.value.scrollTo({
|
|
1039
1039
|
top: 0,
|
|
1040
1040
|
behavior: (e == null ? void 0 : e.behavior) ?? "smooth",
|
|
1041
1041
|
...e
|
|
@@ -1045,30 +1045,30 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
1045
1045
|
De({ behavior: "smooth" }), r.value = [], g.value = 0, await Y(), m("remove-all:complete");
|
|
1046
1046
|
}
|
|
1047
1047
|
function pt() {
|
|
1048
|
-
L.value =
|
|
1048
|
+
L.value = fe(h.value, s.value), ee(r.value), y.value && (U.value = y.value.scrollTop, _.value = y.value.clientHeight);
|
|
1049
1049
|
}
|
|
1050
|
-
let
|
|
1050
|
+
let be = !1;
|
|
1051
1051
|
const q = T(!1);
|
|
1052
|
-
async function
|
|
1053
|
-
if (!a && !l.backfillEnabled ||
|
|
1052
|
+
async function me(e, a = !1) {
|
|
1053
|
+
if (!a && !l.backfillEnabled || be || q.value) return;
|
|
1054
1054
|
const i = (e || 0) + (l.pageSize || 0);
|
|
1055
1055
|
if (!(!l.pageSize || l.pageSize <= 0 || x.value[x.value.length - 1] == null) && !(r.value.length >= i)) {
|
|
1056
|
-
|
|
1056
|
+
be = !0;
|
|
1057
1057
|
try {
|
|
1058
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,
|
|
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, ve) => {
|
|
1060
1060
|
m("backfill:tick", {
|
|
1061
1061
|
fetched: r.value.length,
|
|
1062
1062
|
target: i,
|
|
1063
1063
|
calls: u,
|
|
1064
1064
|
remainingMs: te,
|
|
1065
|
-
totalMs:
|
|
1065
|
+
totalMs: ve
|
|
1066
1066
|
});
|
|
1067
1067
|
}), !q.value); ) {
|
|
1068
1068
|
const R = x.value[x.value.length - 1];
|
|
1069
1069
|
try {
|
|
1070
1070
|
p.value = !0;
|
|
1071
|
-
const te = await
|
|
1071
|
+
const te = await we(R);
|
|
1072
1072
|
if (q.value) break;
|
|
1073
1073
|
x.value.push(te.nextPage);
|
|
1074
1074
|
} finally {
|
|
@@ -1078,15 +1078,15 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
1078
1078
|
}
|
|
1079
1079
|
m("backfill:stop", { fetched: r.value.length, calls: u });
|
|
1080
1080
|
} finally {
|
|
1081
|
-
|
|
1081
|
+
be = !1;
|
|
1082
1082
|
}
|
|
1083
1083
|
}
|
|
1084
1084
|
}
|
|
1085
1085
|
function Be() {
|
|
1086
|
-
q.value = !0, p.value = !1,
|
|
1086
|
+
q.value = !0, p.value = !1, be = !1;
|
|
1087
1087
|
}
|
|
1088
1088
|
function gt() {
|
|
1089
|
-
Be(), q.value = !1,
|
|
1089
|
+
Be(), q.value = !1, y.value && y.value.scrollTo({
|
|
1090
1090
|
top: 0,
|
|
1091
1091
|
behavior: "smooth"
|
|
1092
1092
|
}), r.value = [], g.value = 0, N.value = l.loadAtPage, x.value = [l.loadAtPage], G.value = {
|
|
@@ -1094,46 +1094,46 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
1094
1094
|
isNearTrigger: !1
|
|
1095
1095
|
};
|
|
1096
1096
|
}
|
|
1097
|
-
const
|
|
1098
|
-
if (
|
|
1099
|
-
|
|
1097
|
+
const re = Qe(async () => {
|
|
1098
|
+
if (f.value) return;
|
|
1099
|
+
y.value && (U.value = y.value.scrollTop, _.value = y.value.clientHeight), B.value = !0, await Y(), await new Promise((a) => requestAnimationFrame(() => a())), B.value = !1;
|
|
1100
1100
|
const e = $e(r.value, L.value);
|
|
1101
1101
|
vt(e), X(e);
|
|
1102
1102
|
}, 200), ze = Qe(pt, 200);
|
|
1103
1103
|
function Fe(e) {
|
|
1104
|
-
|
|
1104
|
+
f.value && (n.value = !0, w.value = e.touches[0].clientY, F.value = S.value, e.preventDefault());
|
|
1105
1105
|
}
|
|
1106
1106
|
function Ae(e) {
|
|
1107
|
-
if (!
|
|
1108
|
-
const a = e.touches[0].clientY -
|
|
1107
|
+
if (!f.value || !n.value) return;
|
|
1108
|
+
const a = e.touches[0].clientY - w.value;
|
|
1109
1109
|
S.value = F.value + a, e.preventDefault();
|
|
1110
1110
|
}
|
|
1111
1111
|
function Oe(e) {
|
|
1112
|
-
if (!
|
|
1112
|
+
if (!f.value || !n.value) return;
|
|
1113
1113
|
n.value = !1;
|
|
1114
1114
|
const a = S.value - F.value;
|
|
1115
1115
|
Math.abs(a) > 100 ? a > 0 && O.value ? Ce() : a < 0 && A.value ? je() : ne() : ne(), e.preventDefault();
|
|
1116
1116
|
}
|
|
1117
1117
|
function Re(e) {
|
|
1118
|
-
|
|
1118
|
+
f.value && (n.value = !0, w.value = e.clientY, F.value = S.value, e.preventDefault());
|
|
1119
1119
|
}
|
|
1120
1120
|
function Le(e) {
|
|
1121
|
-
if (!
|
|
1122
|
-
const a = e.clientY -
|
|
1121
|
+
if (!f.value || !n.value) return;
|
|
1122
|
+
const a = e.clientY - w.value;
|
|
1123
1123
|
S.value = F.value + a, e.preventDefault();
|
|
1124
1124
|
}
|
|
1125
1125
|
function Ie(e) {
|
|
1126
|
-
if (!
|
|
1126
|
+
if (!f.value || !n.value) return;
|
|
1127
1127
|
n.value = !1;
|
|
1128
1128
|
const a = S.value - F.value;
|
|
1129
1129
|
Math.abs(a) > 100 ? a > 0 && O.value ? Ce() : a < 0 && A.value ? je() : ne() : ne(), e.preventDefault();
|
|
1130
1130
|
}
|
|
1131
1131
|
function je() {
|
|
1132
1132
|
if (!A.value) {
|
|
1133
|
-
|
|
1133
|
+
ce();
|
|
1134
1134
|
return;
|
|
1135
1135
|
}
|
|
1136
|
-
I.value++, ne(), I.value >= r.value.length - 5 &&
|
|
1136
|
+
I.value++, ne(), I.value >= r.value.length - 5 && ce();
|
|
1137
1137
|
}
|
|
1138
1138
|
function Ce() {
|
|
1139
1139
|
O.value && (I.value--, ne());
|
|
@@ -1144,76 +1144,78 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
1144
1144
|
S.value = -I.value * e;
|
|
1145
1145
|
}
|
|
1146
1146
|
function qe() {
|
|
1147
|
-
!
|
|
1147
|
+
!f.value && I.value > 0 && (I.value = 0, S.value = 0), f.value && r.value.length === 0 && !p.value && Te(x.value[0]), f.value && ne();
|
|
1148
1148
|
}
|
|
1149
1149
|
function yt(e, a, i) {
|
|
1150
|
-
N.value = a, x.value = [a], x.value.push(i), W(e, "init"),
|
|
1150
|
+
N.value = a, x.value = [a], x.value.push(i), W(e, "init"), f.value ? (r.value = [...r.value, ...e], I.value === 0 && r.value.length > 0 && (S.value = 0)) : (ee([...r.value, ...e]), X());
|
|
1151
1151
|
}
|
|
1152
1152
|
return oe(
|
|
1153
1153
|
h,
|
|
1154
1154
|
() => {
|
|
1155
|
-
|
|
1155
|
+
f.value || y.value && (L.value = fe(h.value, s.value), ee(r.value));
|
|
1156
1156
|
},
|
|
1157
1157
|
{ deep: !0 }
|
|
1158
1158
|
), oe(() => l.layoutMode, () => {
|
|
1159
1159
|
b.value && b.value.width !== void 0 ? s.value = b.value.width : o.value && (s.value = o.value.clientWidth);
|
|
1160
|
-
}), oe(
|
|
1160
|
+
}), oe(y, (e) => {
|
|
1161
|
+
e && !f.value ? (e.removeEventListener("scroll", re), e.addEventListener("scroll", re, { passive: !0 })) : e && e.removeEventListener("scroll", re);
|
|
1162
|
+
}, { immediate: !0 }), oe(f, (e, a) => {
|
|
1161
1163
|
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),
|
|
1164
|
+
e ? (document.addEventListener("mousemove", Le), document.addEventListener("mouseup", Ie), y.value && y.value.removeEventListener("scroll", re), I.value = 0, S.value = 0, r.value.length > 0 && ne()) : (document.removeEventListener("mousemove", Le), document.removeEventListener("mouseup", Ie), y.value && o.value && (b.value && b.value.width !== void 0 ? s.value = b.value.width : s.value = o.value.clientWidth, y.value.removeEventListener("scroll", re), y.value.addEventListener("scroll", re, { passive: !0 }), r.value.length > 0 && (L.value = fe(h.value, s.value), ee(r.value), U.value = y.value.scrollTop, _.value = y.value.clientHeight, X())));
|
|
1163
1165
|
});
|
|
1164
1166
|
}, { immediate: !0 }), oe($, (e) => {
|
|
1165
1167
|
e && (e.addEventListener("touchstart", Fe, { passive: !1 }), e.addEventListener("touchmove", Ae, { passive: !1 }), e.addEventListener("touchend", Oe), e.addEventListener("mousedown", Re));
|
|
1166
1168
|
}), oe(() => r.value.length, (e, a) => {
|
|
1167
|
-
|
|
1169
|
+
f.value && e > 0 && a === 0 && (I.value = 0, Y(() => ne()));
|
|
1168
1170
|
}), oe(o, (e) => {
|
|
1169
1171
|
k && (k.disconnect(), k = null), e && typeof ResizeObserver < "u" ? (k = new ResizeObserver((a) => {
|
|
1170
1172
|
if (!b.value)
|
|
1171
1173
|
for (const i of a) {
|
|
1172
|
-
const
|
|
1173
|
-
s.value !==
|
|
1174
|
+
const d = i.contentRect.width, u = i.contentRect.height;
|
|
1175
|
+
s.value !== d && (s.value = d), g.value !== u && (g.value = u);
|
|
1174
1176
|
}
|
|
1175
1177
|
}), 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
1178
|
}, { immediate: !0 }), oe(s, (e, a) => {
|
|
1177
|
-
e !== a && e > 0 && !
|
|
1178
|
-
L.value =
|
|
1179
|
+
e !== a && e > 0 && !f.value && y.value && r.value.length > 0 && Y(() => {
|
|
1180
|
+
L.value = fe(h.value, e), ee(r.value), X();
|
|
1179
1181
|
});
|
|
1180
1182
|
}), tt(async () => {
|
|
1181
1183
|
try {
|
|
1182
|
-
await Y(), o.value && !k && (s.value = o.value.clientWidth, g.value = o.value.clientHeight),
|
|
1184
|
+
await Y(), o.value && !k && (s.value = o.value.clientWidth, g.value = o.value.clientHeight), f.value || (L.value = fe(h.value, s.value), y.value && (U.value = y.value.scrollTop, _.value = y.value.clientHeight));
|
|
1183
1185
|
const e = l.loadAtPage;
|
|
1184
|
-
x.value = [e], l.skipInitialLoad || await
|
|
1186
|
+
x.value = [e], l.skipInitialLoad || await Te(x.value[0]), f.value ? Y(() => ne()) : X();
|
|
1185
1187
|
} catch (e) {
|
|
1186
1188
|
console.error("Error during component initialization:", e), p.value = !1;
|
|
1187
1189
|
}
|
|
1188
1190
|
window.addEventListener("resize", ze), window.addEventListener("resize", qe);
|
|
1189
1191
|
}), at(() => {
|
|
1190
1192
|
var e;
|
|
1191
|
-
k && (k.disconnect(), k = null), (e =
|
|
1193
|
+
k && (k.disconnect(), k = null), (e = y.value) == null || e.removeEventListener("scroll", re), 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
1194
|
}), (e, a) => (C(), j("div", {
|
|
1193
1195
|
ref_key: "wrapper",
|
|
1194
1196
|
ref: o,
|
|
1195
1197
|
class: "w-full h-full flex flex-col relative"
|
|
1196
1198
|
}, [
|
|
1197
|
-
|
|
1199
|
+
f.value ? (C(), j("div", {
|
|
1198
1200
|
key: 0,
|
|
1199
|
-
class:
|
|
1201
|
+
class: se(["overflow-hidden w-full flex-1 swipe-container touch-none select-none", { "force-motion": l.forceMotion, "cursor-grab": !n.value, "cursor-grabbing": n.value }]),
|
|
1200
1202
|
ref_key: "swipeContainer",
|
|
1201
1203
|
ref: $,
|
|
1202
1204
|
style: { height: "100%", "max-height": "100%", position: "relative" }
|
|
1203
1205
|
}, [
|
|
1204
1206
|
V("div", {
|
|
1205
1207
|
class: "relative w-full",
|
|
1206
|
-
style:
|
|
1208
|
+
style: ye({
|
|
1207
1209
|
transform: `translateY(${S.value}px)`,
|
|
1208
1210
|
transition: n.value ? "none" : `transform ${t.transitionDurationMs}ms ${t.transitionEasing}`,
|
|
1209
1211
|
height: `${r.value.length * 100}%`
|
|
1210
1212
|
})
|
|
1211
1213
|
}, [
|
|
1212
|
-
(C(!0), j(Ue, null, Ge(r.value, (i,
|
|
1214
|
+
(C(!0), j(Ue, null, Ge(r.value, (i, d) => (C(), j("div", {
|
|
1213
1215
|
key: `${i.page}-${i.id}`,
|
|
1214
1216
|
class: "absolute top-0 left-0 w-full",
|
|
1215
|
-
style:
|
|
1216
|
-
top: `${
|
|
1217
|
+
style: ye({
|
|
1218
|
+
top: `${d * (100 / r.value.length)}%`,
|
|
1217
1219
|
height: `${100 / r.value.length}%`
|
|
1218
1220
|
})
|
|
1219
1221
|
}, [
|
|
@@ -1221,25 +1223,25 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
1221
1223
|
V("div", va, [
|
|
1222
1224
|
le(e.$slots, "default", {
|
|
1223
1225
|
item: i,
|
|
1224
|
-
remove:
|
|
1226
|
+
remove: de
|
|
1225
1227
|
}, () => [
|
|
1226
|
-
ke(
|
|
1228
|
+
ke(Me, {
|
|
1227
1229
|
item: i,
|
|
1228
|
-
remove:
|
|
1230
|
+
remove: de,
|
|
1229
1231
|
"header-height": h.value.header,
|
|
1230
1232
|
"footer-height": h.value.footer,
|
|
1231
1233
|
"in-swipe-mode": !0,
|
|
1232
|
-
"is-active":
|
|
1234
|
+
"is-active": d === I.value,
|
|
1233
1235
|
"onPreload:success": a[0] || (a[0] = (u) => m("item:preload:success", u)),
|
|
1234
1236
|
"onPreload:error": a[1] || (a[1] = (u) => m("item:preload:error", u)),
|
|
1235
1237
|
onMouseEnter: a[2] || (a[2] = (u) => m("item:mouse-enter", u)),
|
|
1236
1238
|
onMouseLeave: a[3] || (a[3] = (u) => m("item:mouse-leave", u))
|
|
1237
1239
|
}, {
|
|
1238
|
-
header:
|
|
1239
|
-
le(e.$slots, "item-header",
|
|
1240
|
+
header: he((u) => [
|
|
1241
|
+
le(e.$slots, "item-header", pe({ ref_for: !0 }, u), void 0, !0)
|
|
1240
1242
|
]),
|
|
1241
|
-
footer:
|
|
1242
|
-
le(e.$slots, "item-footer",
|
|
1243
|
+
footer: he((u) => [
|
|
1244
|
+
le(e.$slots, "item-footer", pe({ ref_for: !0 }, u), void 0, !0)
|
|
1243
1245
|
]),
|
|
1244
1246
|
_: 2
|
|
1245
1247
|
}, 1032, ["item", "header-height", "footer-height", "is-active"])
|
|
@@ -1250,13 +1252,13 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
1250
1252
|
], 4)
|
|
1251
1253
|
], 2)) : (C(), j("div", {
|
|
1252
1254
|
key: 1,
|
|
1253
|
-
class:
|
|
1255
|
+
class: se(["overflow-auto w-full flex-1 masonry-container", { "force-motion": l.forceMotion }]),
|
|
1254
1256
|
ref_key: "container",
|
|
1255
|
-
ref:
|
|
1257
|
+
ref: y
|
|
1256
1258
|
}, [
|
|
1257
1259
|
V("div", {
|
|
1258
1260
|
class: "relative",
|
|
1259
|
-
style:
|
|
1261
|
+
style: ye({ height: `${z.value}px`, "--masonry-duration": `${t.transitionDurationMs}ms`, "--masonry-leave-duration": `${t.leaveDurationMs}ms`, "--masonry-ease": t.transitionEasing })
|
|
1260
1262
|
}, [
|
|
1261
1263
|
ke(xt, {
|
|
1262
1264
|
name: "masonry",
|
|
@@ -1266,19 +1268,19 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
1266
1268
|
onLeave: ut,
|
|
1267
1269
|
onBeforeLeave: st
|
|
1268
1270
|
}, {
|
|
1269
|
-
default:
|
|
1270
|
-
(C(!0), j(Ue, null, Ge(ct.value, (i,
|
|
1271
|
+
default: he(() => [
|
|
1272
|
+
(C(!0), j(Ue, null, Ge(ct.value, (i, d) => (C(), j("div", pe({
|
|
1271
1273
|
key: `${i.page}-${i.id}`,
|
|
1272
1274
|
class: "absolute masonry-item",
|
|
1273
1275
|
ref_for: !0
|
|
1274
|
-
}, Mt(Qt)(i,
|
|
1276
|
+
}, Mt(Qt)(i, d)), [
|
|
1275
1277
|
le(e.$slots, "default", {
|
|
1276
1278
|
item: i,
|
|
1277
|
-
remove:
|
|
1279
|
+
remove: de
|
|
1278
1280
|
}, () => [
|
|
1279
|
-
ke(
|
|
1281
|
+
ke(Me, {
|
|
1280
1282
|
item: i,
|
|
1281
|
-
remove:
|
|
1283
|
+
remove: de,
|
|
1282
1284
|
"header-height": h.value.header,
|
|
1283
1285
|
"footer-height": h.value.footer,
|
|
1284
1286
|
"in-swipe-mode": !1,
|
|
@@ -1288,11 +1290,11 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
1288
1290
|
onMouseEnter: a[6] || (a[6] = (u) => m("item:mouse-enter", u)),
|
|
1289
1291
|
onMouseLeave: a[7] || (a[7] = (u) => m("item:mouse-leave", u))
|
|
1290
1292
|
}, {
|
|
1291
|
-
header:
|
|
1292
|
-
le(e.$slots, "item-header",
|
|
1293
|
+
header: he((u) => [
|
|
1294
|
+
le(e.$slots, "item-header", pe({ ref_for: !0 }, u), void 0, !0)
|
|
1293
1295
|
]),
|
|
1294
|
-
footer:
|
|
1295
|
-
le(e.$slots, "item-footer",
|
|
1296
|
+
footer: he((u) => [
|
|
1297
|
+
le(e.$slots, "item-footer", pe({ ref_for: !0 }, u), void 0, !0)
|
|
1296
1298
|
]),
|
|
1297
1299
|
_: 2
|
|
1298
1300
|
}, 1032, ["item", "header-height", "footer-height"])
|
|
@@ -1310,13 +1312,13 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
|
|
|
1310
1312
|
for (const [l, M] of c)
|
|
1311
1313
|
v[l] = M;
|
|
1312
1314
|
return v;
|
|
1313
|
-
}, Ze = /* @__PURE__ */ da(fa, [["__scopeId", "data-v-
|
|
1315
|
+
}, Ze = /* @__PURE__ */ da(fa, [["__scopeId", "data-v-ce6222b3"]]), ha = {
|
|
1314
1316
|
install(t) {
|
|
1315
|
-
t.component("WyxosMasonry", Ze), t.component("WMasonry", Ze), t.component("WyxosMasonryItem",
|
|
1317
|
+
t.component("WyxosMasonry", Ze), t.component("WMasonry", Ze), t.component("WyxosMasonryItem", Me), t.component("WMasonryItem", Me);
|
|
1316
1318
|
}
|
|
1317
1319
|
};
|
|
1318
1320
|
export {
|
|
1319
1321
|
Ze as Masonry,
|
|
1320
|
-
|
|
1322
|
+
Me as MasonryItem,
|
|
1321
1323
|
ha as default
|
|
1322
1324
|
};
|