@wyxos/vibe 1.5.0 → 1.6.0
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 +401 -349
- package/lib/vibe.css +1 -1
- package/package.json +1 -1
- package/src/Masonry.vue +112 -9
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { nextTick as
|
|
1
|
+
import { nextTick as J, defineComponent as $e, computed as re, ref as B, onMounted as We, onUnmounted as Oe, createElementBlock as oe, openBlock as le, normalizeClass as ve, createElementVNode as V, normalizeStyle as Be, createVNode as ze, createCommentVNode as Fe, TransitionGroup as De, withCtx as je, Fragment as Re, renderList as Ce, mergeProps as me, unref as _e, renderSlot as qe, toDisplayString as be } from "vue";
|
|
2
2
|
let se = null;
|
|
3
|
-
function
|
|
3
|
+
function Ve() {
|
|
4
4
|
if (se != null) return se;
|
|
5
5
|
const e = document.createElement("div");
|
|
6
6
|
e.style.visibility = "hidden", e.style.overflow = "scroll", e.style.msOverflowStyle = "scrollbar", e.style.width = "100px", e.style.height = "100px", document.body.appendChild(e);
|
|
@@ -9,15 +9,15 @@ function Ce() {
|
|
|
9
9
|
const i = e.offsetWidth - o.offsetWidth;
|
|
10
10
|
return document.body.removeChild(e), se = i, i;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function Ge(e, o, i, s = {}) {
|
|
13
13
|
const {
|
|
14
|
-
gutterX:
|
|
15
|
-
gutterY:
|
|
14
|
+
gutterX: b = 0,
|
|
15
|
+
gutterY: x = 0,
|
|
16
16
|
header: n = 0,
|
|
17
17
|
footer: r = 0,
|
|
18
18
|
paddingLeft: y = 0,
|
|
19
|
-
paddingRight:
|
|
20
|
-
sizes:
|
|
19
|
+
paddingRight: u = 0,
|
|
20
|
+
sizes: c = {
|
|
21
21
|
base: 1,
|
|
22
22
|
sm: 2,
|
|
23
23
|
md: 3,
|
|
@@ -25,191 +25,191 @@ function qe(e, o, i, s = {}) {
|
|
|
25
25
|
xl: 5,
|
|
26
26
|
"2xl": 6
|
|
27
27
|
},
|
|
28
|
-
placement:
|
|
28
|
+
placement: v = "masonry"
|
|
29
29
|
} = s;
|
|
30
|
-
let
|
|
30
|
+
let g = 0, m = 0;
|
|
31
31
|
try {
|
|
32
32
|
if (o && o.nodeType === 1 && typeof window < "u" && window.getComputedStyle) {
|
|
33
|
-
const
|
|
34
|
-
|
|
33
|
+
const w = window.getComputedStyle(o);
|
|
34
|
+
g = parseFloat(w.paddingLeft) || 0, m = parseFloat(w.paddingRight) || 0;
|
|
35
35
|
}
|
|
36
36
|
} catch {
|
|
37
37
|
}
|
|
38
|
-
const
|
|
39
|
-
const L =
|
|
40
|
-
return Math.round(
|
|
38
|
+
const O = (y || 0) + g, R = (u || 0) + m, E = o.offsetWidth - o.clientWidth, T = E > 0 ? E + 2 : Ve() + 2, I = o.offsetWidth - T - O - R, q = b * (i - 1), S = Math.floor((I - q) / i), M = e.map((w) => {
|
|
39
|
+
const L = w.width, P = w.height;
|
|
40
|
+
return Math.round(S * P / L) + r + n;
|
|
41
41
|
});
|
|
42
|
-
if (
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const L = (
|
|
46
|
-
let
|
|
47
|
-
const
|
|
48
|
-
let
|
|
49
|
-
for (let
|
|
50
|
-
const
|
|
51
|
-
if (D <=
|
|
52
|
-
|
|
53
|
-
else if (
|
|
42
|
+
if (v === "sequential-balanced") {
|
|
43
|
+
const w = M.length;
|
|
44
|
+
if (w === 0) return [];
|
|
45
|
+
const L = (h, H, W) => h + (H > 0 ? x : 0) + W;
|
|
46
|
+
let P = Math.max(...M), z = M.reduce((h, H) => h + H, 0) + x * Math.max(0, w - 1);
|
|
47
|
+
const K = (h) => {
|
|
48
|
+
let H = 1, W = 0, F = 0;
|
|
49
|
+
for (let N = 0; N < w; N++) {
|
|
50
|
+
const _ = M[N], D = L(W, F, _);
|
|
51
|
+
if (D <= h)
|
|
52
|
+
W = D, F++;
|
|
53
|
+
else if (H++, W = _, F = 1, _ > h || H > i) return !1;
|
|
54
54
|
}
|
|
55
|
-
return
|
|
55
|
+
return H <= i;
|
|
56
56
|
};
|
|
57
|
-
for (;
|
|
58
|
-
const
|
|
59
|
-
|
|
57
|
+
for (; P < z; ) {
|
|
58
|
+
const h = Math.floor((P + z) / 2);
|
|
59
|
+
K(h) ? z = h : P = h + 1;
|
|
60
60
|
}
|
|
61
|
-
const
|
|
62
|
-
let
|
|
63
|
-
for (let
|
|
64
|
-
const
|
|
65
|
-
!(L(U,
|
|
61
|
+
const Q = z, G = new Array(i).fill(0);
|
|
62
|
+
let Z = i - 1, U = 0, X = 0;
|
|
63
|
+
for (let h = w - 1; h >= 0; h--) {
|
|
64
|
+
const H = M[h], W = h < Z;
|
|
65
|
+
!(L(U, X, H) <= Q) || W ? (G[Z] = h + 1, Z--, U = H, X = 1) : (U = L(U, X, H), X++);
|
|
66
66
|
}
|
|
67
67
|
G[0] = 0;
|
|
68
|
-
const
|
|
69
|
-
for (let
|
|
70
|
-
const
|
|
71
|
-
for (let
|
|
68
|
+
const C = [], ee = new Array(i).fill(0);
|
|
69
|
+
for (let h = 0; h < i; h++) {
|
|
70
|
+
const H = G[h], W = h + 1 < i ? G[h + 1] : w, F = h * (S + b);
|
|
71
|
+
for (let N = H; N < W; N++) {
|
|
72
72
|
const D = {
|
|
73
|
-
...e[
|
|
74
|
-
columnWidth:
|
|
73
|
+
...e[N],
|
|
74
|
+
columnWidth: S,
|
|
75
75
|
imageHeight: 0,
|
|
76
76
|
columnHeight: 0,
|
|
77
77
|
left: 0,
|
|
78
78
|
top: 0
|
|
79
79
|
};
|
|
80
|
-
D.imageHeight =
|
|
80
|
+
D.imageHeight = M[N] - (r + n), D.columnHeight = M[N], D.left = F, D.top = ee[h], ee[h] += D.columnHeight + (N + 1 < W ? x : 0), C.push(D);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
return
|
|
83
|
+
return C;
|
|
84
84
|
}
|
|
85
|
-
const
|
|
86
|
-
for (let
|
|
87
|
-
const L = e[
|
|
85
|
+
const p = new Array(i).fill(0), $ = [];
|
|
86
|
+
for (let w = 0; w < e.length; w++) {
|
|
87
|
+
const L = e[w], P = {
|
|
88
88
|
...L,
|
|
89
89
|
columnWidth: 0,
|
|
90
90
|
imageHeight: 0,
|
|
91
91
|
columnHeight: 0,
|
|
92
92
|
left: 0,
|
|
93
93
|
top: 0
|
|
94
|
-
},
|
|
95
|
-
|
|
94
|
+
}, z = p.indexOf(Math.min(...p)), K = L.width, Q = L.height;
|
|
95
|
+
P.columnWidth = S, P.left = z * (S + b), P.imageHeight = Math.round(S * Q / K), P.columnHeight = P.imageHeight + r + n, P.top = p[z], p[z] += P.columnHeight + x, $.push(P);
|
|
96
96
|
}
|
|
97
97
|
return $;
|
|
98
98
|
}
|
|
99
|
-
var
|
|
100
|
-
function
|
|
101
|
-
var o =
|
|
99
|
+
var Ue = typeof global == "object" && global && global.Object === Object && global, Xe = typeof self == "object" && self && self.Object === Object && self, Se = Ue || Xe || Function("return this")(), ie = Se.Symbol, He = Object.prototype, Ye = He.hasOwnProperty, Je = He.toString, ne = ie ? ie.toStringTag : void 0;
|
|
100
|
+
function Ke(e) {
|
|
101
|
+
var o = Ye.call(e, ne), i = e[ne];
|
|
102
102
|
try {
|
|
103
|
-
e[
|
|
103
|
+
e[ne] = void 0;
|
|
104
104
|
var s = !0;
|
|
105
105
|
} catch {
|
|
106
106
|
}
|
|
107
|
-
var
|
|
108
|
-
return s && (o ? e[
|
|
107
|
+
var b = Je.call(e);
|
|
108
|
+
return s && (o ? e[ne] = i : delete e[ne]), b;
|
|
109
109
|
}
|
|
110
|
-
var
|
|
111
|
-
function
|
|
112
|
-
return
|
|
110
|
+
var Qe = Object.prototype, Ze = Qe.toString;
|
|
111
|
+
function et(e) {
|
|
112
|
+
return Ze.call(e);
|
|
113
113
|
}
|
|
114
|
-
var
|
|
115
|
-
function
|
|
116
|
-
return e == null ? e === void 0 ?
|
|
114
|
+
var tt = "[object Null]", nt = "[object Undefined]", xe = ie ? ie.toStringTag : void 0;
|
|
115
|
+
function at(e) {
|
|
116
|
+
return e == null ? e === void 0 ? nt : tt : xe && xe in Object(e) ? Ke(e) : et(e);
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function rt(e) {
|
|
119
119
|
return e != null && typeof e == "object";
|
|
120
120
|
}
|
|
121
|
-
var
|
|
122
|
-
function
|
|
123
|
-
return typeof e == "symbol" ||
|
|
121
|
+
var ot = "[object Symbol]";
|
|
122
|
+
function lt(e) {
|
|
123
|
+
return typeof e == "symbol" || rt(e) && at(e) == ot;
|
|
124
124
|
}
|
|
125
|
-
var
|
|
126
|
-
function
|
|
127
|
-
for (var o = e.length; o-- &&
|
|
125
|
+
var it = /\s/;
|
|
126
|
+
function st(e) {
|
|
127
|
+
for (var o = e.length; o-- && it.test(e.charAt(o)); )
|
|
128
128
|
;
|
|
129
129
|
return o;
|
|
130
130
|
}
|
|
131
|
-
var
|
|
132
|
-
function
|
|
133
|
-
return e && e.slice(0,
|
|
131
|
+
var ut = /^\s+/;
|
|
132
|
+
function ct(e) {
|
|
133
|
+
return e && e.slice(0, st(e) + 1).replace(ut, "");
|
|
134
134
|
}
|
|
135
135
|
function ce(e) {
|
|
136
136
|
var o = typeof e;
|
|
137
137
|
return e != null && (o == "object" || o == "function");
|
|
138
138
|
}
|
|
139
|
-
var
|
|
140
|
-
function
|
|
139
|
+
var we = NaN, ft = /^[-+]0x[0-9a-f]+$/i, dt = /^0b[01]+$/i, gt = /^0o[0-7]+$/i, ht = parseInt;
|
|
140
|
+
function Te(e) {
|
|
141
141
|
if (typeof e == "number")
|
|
142
142
|
return e;
|
|
143
|
-
if (
|
|
144
|
-
return
|
|
143
|
+
if (lt(e))
|
|
144
|
+
return we;
|
|
145
145
|
if (ce(e)) {
|
|
146
146
|
var o = typeof e.valueOf == "function" ? e.valueOf() : e;
|
|
147
147
|
e = ce(o) ? o + "" : o;
|
|
148
148
|
}
|
|
149
149
|
if (typeof e != "string")
|
|
150
150
|
return e === 0 ? e : +e;
|
|
151
|
-
e =
|
|
152
|
-
var i =
|
|
153
|
-
return i ||
|
|
151
|
+
e = ct(e);
|
|
152
|
+
var i = dt.test(e);
|
|
153
|
+
return i || gt.test(e) ? ht(e.slice(2), i ? 2 : 8) : ft.test(e) ? we : +e;
|
|
154
154
|
}
|
|
155
|
-
var
|
|
156
|
-
return
|
|
157
|
-
},
|
|
158
|
-
function
|
|
159
|
-
var s,
|
|
155
|
+
var ue = function() {
|
|
156
|
+
return Se.Date.now();
|
|
157
|
+
}, pt = "Expected a function", yt = Math.max, vt = Math.min;
|
|
158
|
+
function Me(e, o, i) {
|
|
159
|
+
var s, b, x, n, r, y, u = 0, c = !1, v = !1, g = !0;
|
|
160
160
|
if (typeof e != "function")
|
|
161
|
-
throw new TypeError(
|
|
162
|
-
o =
|
|
163
|
-
function
|
|
164
|
-
var $ = s,
|
|
165
|
-
return s =
|
|
161
|
+
throw new TypeError(pt);
|
|
162
|
+
o = Te(o) || 0, ce(i) && (c = !!i.leading, v = "maxWait" in i, x = v ? yt(Te(i.maxWait) || 0, o) : x, g = "trailing" in i ? !!i.trailing : g);
|
|
163
|
+
function m(p) {
|
|
164
|
+
var $ = s, w = b;
|
|
165
|
+
return s = b = void 0, u = p, n = e.apply(w, $), n;
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
return
|
|
167
|
+
function O(p) {
|
|
168
|
+
return u = p, r = setTimeout(T, o), c ? m(p) : n;
|
|
169
169
|
}
|
|
170
|
-
function R(
|
|
171
|
-
var $ =
|
|
172
|
-
return
|
|
170
|
+
function R(p) {
|
|
171
|
+
var $ = p - y, w = p - u, L = o - $;
|
|
172
|
+
return v ? vt(L, x - w) : L;
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
var $ =
|
|
176
|
-
return y === void 0 || $ >= o || $ < 0 ||
|
|
174
|
+
function E(p) {
|
|
175
|
+
var $ = p - y, w = p - u;
|
|
176
|
+
return y === void 0 || $ >= o || $ < 0 || v && w >= x;
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
var
|
|
180
|
-
if (
|
|
181
|
-
return
|
|
182
|
-
r = setTimeout(
|
|
178
|
+
function T() {
|
|
179
|
+
var p = ue();
|
|
180
|
+
if (E(p))
|
|
181
|
+
return I(p);
|
|
182
|
+
r = setTimeout(T, R(p));
|
|
183
183
|
}
|
|
184
|
-
function
|
|
185
|
-
return r = void 0,
|
|
184
|
+
function I(p) {
|
|
185
|
+
return r = void 0, g && s ? m(p) : (s = b = void 0, n);
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
r !== void 0 && clearTimeout(r),
|
|
187
|
+
function q() {
|
|
188
|
+
r !== void 0 && clearTimeout(r), u = 0, s = y = b = r = void 0;
|
|
189
189
|
}
|
|
190
|
-
function
|
|
191
|
-
return r === void 0 ? n :
|
|
190
|
+
function S() {
|
|
191
|
+
return r === void 0 ? n : I(ue());
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
var
|
|
195
|
-
if (s = arguments,
|
|
193
|
+
function M() {
|
|
194
|
+
var p = ue(), $ = E(p);
|
|
195
|
+
if (s = arguments, b = this, y = p, $) {
|
|
196
196
|
if (r === void 0)
|
|
197
|
-
return
|
|
198
|
-
if (
|
|
199
|
-
return clearTimeout(r), r = setTimeout(
|
|
197
|
+
return O(y);
|
|
198
|
+
if (v)
|
|
199
|
+
return clearTimeout(r), r = setTimeout(T, o), m(y);
|
|
200
200
|
}
|
|
201
|
-
return r === void 0 && (r = setTimeout(
|
|
201
|
+
return r === void 0 && (r = setTimeout(T, o)), n;
|
|
202
202
|
}
|
|
203
|
-
return
|
|
203
|
+
return M.cancel = q, M.flush = S, M;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function Pe(e) {
|
|
206
206
|
const o = window.innerWidth, i = e.sizes;
|
|
207
207
|
return o >= 1536 && i["2xl"] ? i["2xl"] : o >= 1280 && i.xl ? i.xl : o >= 1024 && i.lg ? i.lg : o >= 768 && i.md ? i.md : o >= 640 && i.sm ? i.sm : i.base;
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function mt(e) {
|
|
210
210
|
return e.reduce((i, s) => Math.max(i, s.top + s.columnHeight), 0) + 500;
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function bt(e) {
|
|
213
213
|
return {
|
|
214
214
|
transform: `translate3d(${e.left}px, ${e.top}px, 0)`,
|
|
215
215
|
top: "0px",
|
|
@@ -218,102 +218,102 @@ function mt(e) {
|
|
|
218
218
|
height: `${e.columnHeight}px`
|
|
219
219
|
};
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function xt(e, o = 0) {
|
|
222
222
|
return {
|
|
223
|
-
style:
|
|
223
|
+
style: bt(e),
|
|
224
224
|
"data-top": e.top,
|
|
225
225
|
"data-left": e.left,
|
|
226
226
|
"data-id": `${e.page}-${e.id}`,
|
|
227
227
|
"data-index": o
|
|
228
228
|
};
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function fe(e, o) {
|
|
231
231
|
if (!e.length || o <= 0)
|
|
232
232
|
return new Array(Math.max(1, o)).fill(0);
|
|
233
|
-
const s = Array.from(new Set(e.map((n) => n.left))).sort((n, r) => n - r).slice(0, o),
|
|
234
|
-
for (let n = 0; n < s.length; n++)
|
|
235
|
-
const
|
|
233
|
+
const s = Array.from(new Set(e.map((n) => n.left))).sort((n, r) => n - r).slice(0, o), b = /* @__PURE__ */ new Map();
|
|
234
|
+
for (let n = 0; n < s.length; n++) b.set(s[n], n);
|
|
235
|
+
const x = new Array(s.length).fill(0);
|
|
236
236
|
for (const n of e) {
|
|
237
|
-
const r =
|
|
238
|
-
r != null && (
|
|
237
|
+
const r = b.get(n.left);
|
|
238
|
+
r != null && (x[r] = Math.max(x[r], n.top + n.columnHeight));
|
|
239
239
|
}
|
|
240
|
-
for (;
|
|
241
|
-
return
|
|
240
|
+
for (; x.length < o; ) x.push(0);
|
|
241
|
+
return x;
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function wt(e, o) {
|
|
244
244
|
function i(n, r) {
|
|
245
|
-
const y = parseInt(n.dataset.left || "0", 10),
|
|
246
|
-
n.style.setProperty("--masonry-opacity-delay", `${
|
|
247
|
-
n.style.opacity = "1", n.style.transform = `translate3d(${y}px, ${
|
|
248
|
-
const
|
|
249
|
-
|
|
245
|
+
const y = parseInt(n.dataset.left || "0", 10), u = parseInt(n.dataset.top || "0", 10), c = parseInt(n.dataset.index || "0", 10), v = Math.min(c * 20, 160), g = n.style.getPropertyValue("--masonry-opacity-delay");
|
|
246
|
+
n.style.setProperty("--masonry-opacity-delay", `${v}ms`), requestAnimationFrame(() => {
|
|
247
|
+
n.style.opacity = "1", n.style.transform = `translate3d(${y}px, ${u}px, 0) scale(1)`;
|
|
248
|
+
const m = () => {
|
|
249
|
+
g ? n.style.setProperty("--masonry-opacity-delay", g) : n.style.removeProperty("--masonry-opacity-delay"), n.removeEventListener("transitionend", m), r();
|
|
250
250
|
};
|
|
251
|
-
n.addEventListener("transitionend",
|
|
251
|
+
n.addEventListener("transitionend", m);
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
254
|
function s(n) {
|
|
255
255
|
const r = parseInt(n.dataset.left || "0", 10), y = parseInt(n.dataset.top || "0", 10);
|
|
256
256
|
n.style.opacity = "0", n.style.transform = `translate3d(${r}px, ${y + 10}px, 0) scale(0.985)`;
|
|
257
257
|
}
|
|
258
|
-
function
|
|
258
|
+
function b(n) {
|
|
259
259
|
const r = parseInt(n.dataset.left || "0", 10), y = parseInt(n.dataset.top || "0", 10);
|
|
260
260
|
n.style.transition = "none", n.style.opacity = "1", n.style.transform = `translate3d(${r}px, ${y}px, 0) scale(1)`, n.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
|
|
261
261
|
n.style.transition = "";
|
|
262
262
|
});
|
|
263
263
|
}
|
|
264
|
-
function
|
|
265
|
-
const y = parseInt(n.dataset.left || "0", 10),
|
|
266
|
-
let
|
|
267
|
-
if (!Number.isFinite(
|
|
268
|
-
const
|
|
269
|
-
|
|
264
|
+
function x(n, r) {
|
|
265
|
+
const y = parseInt(n.dataset.left || "0", 10), u = parseInt(n.dataset.top || "0", 10), c = typeof (o == null ? void 0 : o.leaveDurationMs) == "number" ? o.leaveDurationMs : NaN;
|
|
266
|
+
let v = Number.isFinite(c) && c > 0 ? c : NaN;
|
|
267
|
+
if (!Number.isFinite(v)) {
|
|
268
|
+
const T = getComputedStyle(n).getPropertyValue("--masonry-leave-duration") || "", I = parseFloat(T);
|
|
269
|
+
v = Number.isFinite(I) && I > 0 ? I : 200;
|
|
270
270
|
}
|
|
271
|
-
const
|
|
272
|
-
n.removeEventListener("transitionend",
|
|
273
|
-
},
|
|
274
|
-
(!
|
|
271
|
+
const g = n.style.transitionDuration, m = () => {
|
|
272
|
+
n.removeEventListener("transitionend", O), clearTimeout(R), n.style.transitionDuration = g || "";
|
|
273
|
+
}, O = (E) => {
|
|
274
|
+
(!E || E.target === n) && (m(), r());
|
|
275
275
|
}, R = setTimeout(() => {
|
|
276
|
-
|
|
277
|
-
},
|
|
276
|
+
m(), r();
|
|
277
|
+
}, v + 100);
|
|
278
278
|
requestAnimationFrame(() => {
|
|
279
|
-
n.style.transitionDuration = `${
|
|
279
|
+
n.style.transitionDuration = `${v}ms`, n.style.opacity = "0", n.style.transform = `translate3d(${y}px, ${u + 10}px, 0) scale(0.985)`, n.addEventListener("transitionend", O);
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
282
|
return {
|
|
283
283
|
onEnter: i,
|
|
284
284
|
onBeforeEnter: s,
|
|
285
|
-
onBeforeLeave:
|
|
286
|
-
onLeave:
|
|
285
|
+
onBeforeLeave: b,
|
|
286
|
+
onLeave: x
|
|
287
287
|
};
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function Tt({
|
|
290
290
|
container: e,
|
|
291
291
|
masonry: o,
|
|
292
292
|
columns: i,
|
|
293
293
|
containerHeight: s,
|
|
294
|
-
isLoading:
|
|
295
|
-
pageSize:
|
|
294
|
+
isLoading: b,
|
|
295
|
+
pageSize: x,
|
|
296
296
|
refreshLayout: n,
|
|
297
297
|
setItemsRaw: r,
|
|
298
298
|
loadNext: y,
|
|
299
|
-
loadThresholdPx:
|
|
299
|
+
loadThresholdPx: u
|
|
300
300
|
}) {
|
|
301
|
-
let
|
|
302
|
-
async function
|
|
301
|
+
let c = 0;
|
|
302
|
+
async function v(g) {
|
|
303
303
|
if (!e.value) return;
|
|
304
|
-
const
|
|
305
|
-
|
|
306
|
-
const
|
|
307
|
-
if (R >=
|
|
308
|
-
await y(), await
|
|
304
|
+
const m = g ?? fe(o.value, i.value), O = m.length ? Math.max(...m) : 0, R = e.value.scrollTop + e.value.clientHeight, E = e.value.scrollTop > c + 1;
|
|
305
|
+
c = e.value.scrollTop;
|
|
306
|
+
const T = typeof u == "number" ? u : 200, I = T >= 0 ? Math.max(0, O - T) : Math.max(0, O + T);
|
|
307
|
+
if (R >= I && E && !b.value) {
|
|
308
|
+
await y(), await J();
|
|
309
309
|
return;
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
312
|
return {
|
|
313
|
-
handleScroll:
|
|
313
|
+
handleScroll: v
|
|
314
314
|
};
|
|
315
315
|
}
|
|
316
|
-
const
|
|
316
|
+
const Mt = ["src"], Pt = ["onClick"], It = /* @__PURE__ */ $e({
|
|
317
317
|
__name: "Masonry",
|
|
318
318
|
props: {
|
|
319
319
|
getNextPage: {
|
|
@@ -397,6 +397,10 @@ const wt = ["src"], Tt = ["onClick"], Mt = /* @__PURE__ */ Ne({
|
|
|
397
397
|
loadThresholdPx: {
|
|
398
398
|
type: Number,
|
|
399
399
|
default: 200
|
|
400
|
+
},
|
|
401
|
+
autoRefreshOnEmpty: {
|
|
402
|
+
type: Boolean,
|
|
403
|
+
default: !1
|
|
400
404
|
}
|
|
401
405
|
},
|
|
402
406
|
emits: [
|
|
@@ -410,7 +414,7 @@ const wt = ["src"], Tt = ["onClick"], Mt = /* @__PURE__ */ Ne({
|
|
|
410
414
|
"remove-all:complete"
|
|
411
415
|
],
|
|
412
416
|
setup(e, { expose: o, emit: i }) {
|
|
413
|
-
const s = e,
|
|
417
|
+
const s = e, b = {
|
|
414
418
|
sizes: { base: 1, sm: 2, md: 3, lg: 4, xl: 5, "2xl": 6 },
|
|
415
419
|
gutterX: 10,
|
|
416
420
|
gutterY: 10,
|
|
@@ -419,41 +423,41 @@ const wt = ["src"], Tt = ["onClick"], Mt = /* @__PURE__ */ Ne({
|
|
|
419
423
|
paddingLeft: 0,
|
|
420
424
|
paddingRight: 0,
|
|
421
425
|
placement: "masonry"
|
|
422
|
-
},
|
|
426
|
+
}, x = re(() => {
|
|
423
427
|
var t;
|
|
424
428
|
return {
|
|
425
|
-
...
|
|
429
|
+
...b,
|
|
426
430
|
...s.layout,
|
|
427
431
|
sizes: {
|
|
428
|
-
...
|
|
432
|
+
...b.sizes,
|
|
429
433
|
...((t = s.layout) == null ? void 0 : t.sizes) || {}
|
|
430
434
|
}
|
|
431
435
|
};
|
|
432
|
-
}), n = i, r =
|
|
436
|
+
}), n = i, r = re({
|
|
433
437
|
get: () => s.items,
|
|
434
438
|
set: (t) => n("update:items", t)
|
|
435
|
-
}), y =
|
|
436
|
-
function
|
|
439
|
+
}), y = B(7), u = B(null), c = B([]), v = B(null), g = B(!1), m = B(0), O = B(/* @__PURE__ */ new Set());
|
|
440
|
+
function R(t) {
|
|
437
441
|
return typeof t == "number" && Number.isFinite(t) && t > 0;
|
|
438
442
|
}
|
|
439
|
-
function
|
|
443
|
+
function E(t, a) {
|
|
440
444
|
try {
|
|
441
445
|
if (!Array.isArray(t) || t.length === 0) return;
|
|
442
|
-
const l = t.filter((
|
|
446
|
+
const l = t.filter((d) => !R(d == null ? void 0 : d.width) || !R(d == null ? void 0 : d.height));
|
|
443
447
|
if (l.length === 0) return;
|
|
444
|
-
const
|
|
445
|
-
for (const
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
+
const f = [];
|
|
449
|
+
for (const d of l) {
|
|
450
|
+
const A = (d == null ? void 0 : d.id) ?? `idx:${t.indexOf(d)}`;
|
|
451
|
+
O.value.has(A) || (O.value.add(A), f.push(A));
|
|
448
452
|
}
|
|
449
|
-
if (
|
|
450
|
-
const
|
|
453
|
+
if (f.length > 0) {
|
|
454
|
+
const d = f.slice(0, 10);
|
|
451
455
|
console.warn(
|
|
452
456
|
"[Masonry] Items missing width/height detected:",
|
|
453
457
|
{
|
|
454
458
|
context: a,
|
|
455
|
-
count:
|
|
456
|
-
sampleIds:
|
|
459
|
+
count: f.length,
|
|
460
|
+
sampleIds: d,
|
|
457
461
|
hint: "Ensure each item has positive width and height. Consider providing fallbacks (e.g., 512x512) at the data layer."
|
|
458
462
|
}
|
|
459
463
|
);
|
|
@@ -461,315 +465,363 @@ const wt = ["src"], Tt = ["onClick"], Mt = /* @__PURE__ */ Ne({
|
|
|
461
465
|
} catch {
|
|
462
466
|
}
|
|
463
467
|
}
|
|
464
|
-
const T =
|
|
468
|
+
const T = B(0), I = B(0), q = s.virtualBufferPx, S = B(!1), M = B({
|
|
465
469
|
distanceToTrigger: 0,
|
|
466
470
|
isNearTrigger: !1
|
|
467
|
-
}),
|
|
468
|
-
if (!
|
|
469
|
-
const { scrollTop: a, clientHeight: l } =
|
|
470
|
-
|
|
471
|
+
}), p = (t) => {
|
|
472
|
+
if (!u.value) return;
|
|
473
|
+
const { scrollTop: a, clientHeight: l } = u.value, f = a + l, d = t ?? fe(r.value, y.value), A = d.length ? Math.max(...d) : 0, j = typeof s.loadThresholdPx == "number" ? s.loadThresholdPx : 200, Y = j >= 0 ? Math.max(0, A - j) : Math.max(0, A + j), ye = Math.max(0, Y - f), Ae = ye <= 100;
|
|
474
|
+
M.value = {
|
|
471
475
|
distanceToTrigger: Math.round(ye),
|
|
472
|
-
isNearTrigger:
|
|
476
|
+
isNearTrigger: Ae
|
|
473
477
|
};
|
|
474
|
-
}, { onEnter:
|
|
475
|
-
function
|
|
476
|
-
if (
|
|
477
|
-
const l = parseInt(t.dataset.left || "0", 10),
|
|
478
|
-
t.style.transition = "none", t.style.opacity = "1", t.style.transform = `translate3d(${l}px, ${
|
|
478
|
+
}, { onEnter: $, onBeforeEnter: w, onBeforeLeave: L, onLeave: P } = wt(r, { leaveDurationMs: s.leaveDurationMs });
|
|
479
|
+
function z(t, a) {
|
|
480
|
+
if (S.value) {
|
|
481
|
+
const l = parseInt(t.dataset.left || "0", 10), f = parseInt(t.dataset.top || "0", 10);
|
|
482
|
+
t.style.transition = "none", t.style.opacity = "1", t.style.transform = `translate3d(${l}px, ${f}px, 0) scale(1)`, t.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
|
|
479
483
|
t.style.transition = "", a();
|
|
480
484
|
});
|
|
481
485
|
} else
|
|
482
|
-
|
|
486
|
+
$(t, a);
|
|
483
487
|
}
|
|
484
|
-
function
|
|
485
|
-
if (
|
|
488
|
+
function K(t) {
|
|
489
|
+
if (S.value) {
|
|
486
490
|
const a = parseInt(t.dataset.left || "0", 10), l = parseInt(t.dataset.top || "0", 10);
|
|
487
491
|
t.style.transition = "none", t.style.opacity = "1", t.style.transform = `translate3d(${a}px, ${l}px, 0) scale(1)`, t.style.removeProperty("--masonry-opacity-delay");
|
|
488
492
|
} else
|
|
489
|
-
|
|
493
|
+
w(t);
|
|
490
494
|
}
|
|
491
|
-
function
|
|
492
|
-
|
|
495
|
+
function Q(t) {
|
|
496
|
+
S.value || L(t);
|
|
493
497
|
}
|
|
494
|
-
function
|
|
495
|
-
|
|
498
|
+
function G(t, a) {
|
|
499
|
+
S.value ? a() : P(t, a);
|
|
496
500
|
}
|
|
497
|
-
const
|
|
498
|
-
const t = T.value -
|
|
499
|
-
return !l || l.length === 0 ? [] : l.filter((
|
|
500
|
-
const
|
|
501
|
-
return
|
|
501
|
+
const Z = re(() => {
|
|
502
|
+
const t = T.value - q, a = T.value + I.value + q, l = r.value;
|
|
503
|
+
return !l || l.length === 0 ? [] : l.filter((f) => {
|
|
504
|
+
const d = f.top;
|
|
505
|
+
return f.top + f.columnHeight >= t && d <= a;
|
|
502
506
|
});
|
|
503
|
-
}), { handleScroll:
|
|
504
|
-
container:
|
|
507
|
+
}), { handleScroll: U } = Tt({
|
|
508
|
+
container: u,
|
|
505
509
|
masonry: r,
|
|
506
510
|
columns: y,
|
|
507
|
-
containerHeight:
|
|
508
|
-
isLoading:
|
|
511
|
+
containerHeight: m,
|
|
512
|
+
isLoading: g,
|
|
509
513
|
pageSize: s.pageSize,
|
|
510
|
-
refreshLayout:
|
|
514
|
+
refreshLayout: C,
|
|
511
515
|
setItemsRaw: (t) => {
|
|
512
516
|
r.value = t;
|
|
513
517
|
},
|
|
514
|
-
loadNext:
|
|
518
|
+
loadNext: F,
|
|
515
519
|
loadThresholdPx: s.loadThresholdPx
|
|
516
520
|
});
|
|
517
521
|
o({
|
|
518
|
-
isLoading:
|
|
519
|
-
refreshLayout:
|
|
520
|
-
containerHeight:
|
|
522
|
+
isLoading: g,
|
|
523
|
+
refreshLayout: C,
|
|
524
|
+
containerHeight: m,
|
|
521
525
|
remove: _,
|
|
522
|
-
removeMany:
|
|
523
|
-
removeAll:
|
|
524
|
-
loadNext:
|
|
525
|
-
loadPage:
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
526
|
+
removeMany: D,
|
|
527
|
+
removeAll: ke,
|
|
528
|
+
loadNext: F,
|
|
529
|
+
loadPage: W,
|
|
530
|
+
refreshCurrentPage: N,
|
|
531
|
+
reset: Le,
|
|
532
|
+
init: Ne,
|
|
533
|
+
paginationHistory: c,
|
|
534
|
+
cancelLoad: ge,
|
|
535
|
+
scrollToTop: de,
|
|
536
|
+
totalItems: re(() => r.value.length)
|
|
532
537
|
});
|
|
533
|
-
function
|
|
534
|
-
const a =
|
|
538
|
+
function X(t) {
|
|
539
|
+
const a = mt(t);
|
|
535
540
|
let l = 0;
|
|
536
|
-
if (
|
|
537
|
-
const { scrollTop:
|
|
538
|
-
l =
|
|
541
|
+
if (u.value) {
|
|
542
|
+
const { scrollTop: f, clientHeight: d } = u.value;
|
|
543
|
+
l = f + d + 100;
|
|
539
544
|
}
|
|
540
|
-
|
|
545
|
+
m.value = Math.max(a, l);
|
|
541
546
|
}
|
|
542
|
-
function
|
|
543
|
-
if (!
|
|
544
|
-
|
|
545
|
-
const a =
|
|
546
|
-
|
|
547
|
+
function C(t) {
|
|
548
|
+
if (!u.value) return;
|
|
549
|
+
E(t, "refreshLayout");
|
|
550
|
+
const a = t.map((f, d) => ({
|
|
551
|
+
...f,
|
|
552
|
+
originalIndex: f.originalIndex ?? d
|
|
553
|
+
})), l = Ge(a, u.value, y.value, x.value);
|
|
554
|
+
X(l), r.value = l;
|
|
547
555
|
}
|
|
548
|
-
function
|
|
556
|
+
function ee(t, a) {
|
|
549
557
|
return new Promise((l) => {
|
|
550
|
-
const
|
|
551
|
-
a(
|
|
552
|
-
const
|
|
553
|
-
if (
|
|
554
|
-
clearInterval(
|
|
558
|
+
const f = Math.max(0, t | 0), d = Date.now();
|
|
559
|
+
a(f, f);
|
|
560
|
+
const A = setInterval(() => {
|
|
561
|
+
if (k.value) {
|
|
562
|
+
clearInterval(A), l();
|
|
555
563
|
return;
|
|
556
564
|
}
|
|
557
|
-
const
|
|
558
|
-
a(
|
|
565
|
+
const j = Date.now() - d, Y = Math.max(0, f - j);
|
|
566
|
+
a(Y, f), Y <= 0 && (clearInterval(A), l());
|
|
559
567
|
}, 100);
|
|
560
568
|
});
|
|
561
569
|
}
|
|
562
|
-
async function
|
|
570
|
+
async function h(t) {
|
|
563
571
|
try {
|
|
564
|
-
const a = await
|
|
565
|
-
return
|
|
572
|
+
const a = await H(() => s.getNextPage(t));
|
|
573
|
+
return C([...r.value, ...a.items]), a;
|
|
566
574
|
} catch (a) {
|
|
567
575
|
throw console.error("Error in getContent:", a), a;
|
|
568
576
|
}
|
|
569
577
|
}
|
|
570
|
-
async function
|
|
578
|
+
async function H(t) {
|
|
571
579
|
let a = 0;
|
|
572
580
|
const l = s.retryMaxAttempts;
|
|
573
|
-
let
|
|
581
|
+
let f = s.retryInitialDelayMs;
|
|
574
582
|
for (; ; )
|
|
575
583
|
try {
|
|
576
|
-
const
|
|
577
|
-
return a > 0 && n("retry:stop", { attempt: a, success: !0 }),
|
|
578
|
-
} catch (
|
|
584
|
+
const d = await t();
|
|
585
|
+
return a > 0 && n("retry:stop", { attempt: a, success: !0 }), d;
|
|
586
|
+
} catch (d) {
|
|
579
587
|
if (a++, a > l)
|
|
580
|
-
throw n("retry:stop", { attempt: a - 1, success: !1 }),
|
|
581
|
-
n("retry:start", { attempt: a, max: l, totalMs:
|
|
582
|
-
n("retry:tick", { attempt: a, remainingMs:
|
|
583
|
-
}),
|
|
588
|
+
throw n("retry:stop", { attempt: a - 1, success: !1 }), d;
|
|
589
|
+
n("retry:start", { attempt: a, max: l, totalMs: f }), await ee(f, (A, j) => {
|
|
590
|
+
n("retry:tick", { attempt: a, remainingMs: A, totalMs: j });
|
|
591
|
+
}), f += s.retryBackoffStepMs;
|
|
584
592
|
}
|
|
585
593
|
}
|
|
586
|
-
async function
|
|
587
|
-
if (!
|
|
588
|
-
|
|
594
|
+
async function W(t) {
|
|
595
|
+
if (!g.value) {
|
|
596
|
+
k.value = !1, g.value = !0;
|
|
589
597
|
try {
|
|
590
598
|
const a = r.value.length;
|
|
591
|
-
if (
|
|
592
|
-
const l = await
|
|
593
|
-
return
|
|
599
|
+
if (k.value) return;
|
|
600
|
+
const l = await h(t);
|
|
601
|
+
return k.value ? void 0 : (v.value = t, c.value.push(l.nextPage), await te(a), l);
|
|
594
602
|
} catch (a) {
|
|
595
603
|
throw console.error("Error loading page:", a), a;
|
|
596
604
|
} finally {
|
|
597
|
-
|
|
605
|
+
g.value = !1;
|
|
598
606
|
}
|
|
599
607
|
}
|
|
600
608
|
}
|
|
601
|
-
async function
|
|
602
|
-
if (!
|
|
603
|
-
|
|
609
|
+
async function F() {
|
|
610
|
+
if (!g.value) {
|
|
611
|
+
k.value = !1, g.value = !0;
|
|
604
612
|
try {
|
|
605
613
|
const t = r.value.length;
|
|
606
|
-
if (
|
|
607
|
-
const a =
|
|
608
|
-
return
|
|
614
|
+
if (k.value) return;
|
|
615
|
+
const a = c.value[c.value.length - 1], l = await h(a);
|
|
616
|
+
return k.value ? void 0 : (v.value = a, c.value.push(l.nextPage), await te(t), l);
|
|
609
617
|
} catch (t) {
|
|
610
618
|
throw console.error("Error loading next page:", t), t;
|
|
611
619
|
} finally {
|
|
612
|
-
|
|
620
|
+
g.value = !1;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
async function N() {
|
|
625
|
+
if (console.log("[Masonry] refreshCurrentPage called, isLoading:", g.value, "currentPage:", v.value), !g.value) {
|
|
626
|
+
k.value = !1, g.value = !0;
|
|
627
|
+
try {
|
|
628
|
+
const t = v.value;
|
|
629
|
+
if (console.log("[Masonry] pageToRefresh:", t), t == null) {
|
|
630
|
+
console.warn("[Masonry] No current page to refresh - currentPage:", v.value, "paginationHistory:", c.value);
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
r.value = [], m.value = 0, c.value = [t], await J();
|
|
634
|
+
const a = await h(t);
|
|
635
|
+
if (k.value) return;
|
|
636
|
+
v.value = t, c.value.push(a.nextPage);
|
|
637
|
+
const l = r.value.length;
|
|
638
|
+
return await te(l), a;
|
|
639
|
+
} catch (t) {
|
|
640
|
+
throw console.error("[Masonry] Error refreshing current page:", t), t;
|
|
641
|
+
} finally {
|
|
642
|
+
g.value = !1;
|
|
613
643
|
}
|
|
614
644
|
}
|
|
615
645
|
}
|
|
616
646
|
async function _(t) {
|
|
617
647
|
const a = r.value.filter((l) => l.id !== t.id);
|
|
618
|
-
r.value = a, await
|
|
619
|
-
|
|
648
|
+
if (r.value = a, await J(), console.log("[Masonry] remove - next.length:", a.length, "paginationHistory.length:", c.value.length), a.length === 0 && c.value.length > 0) {
|
|
649
|
+
if (s.autoRefreshOnEmpty)
|
|
650
|
+
console.log("[Masonry] All items removed, calling refreshCurrentPage"), await N();
|
|
651
|
+
else {
|
|
652
|
+
console.log("[Masonry] All items removed, calling loadNext and forcing backfill");
|
|
653
|
+
try {
|
|
654
|
+
await F(), await te(0, !0);
|
|
655
|
+
} catch {
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
await new Promise((l) => requestAnimationFrame(() => l())), requestAnimationFrame(() => {
|
|
661
|
+
C(a);
|
|
620
662
|
});
|
|
621
663
|
}
|
|
622
|
-
async function
|
|
664
|
+
async function D(t) {
|
|
623
665
|
if (!t || t.length === 0) return;
|
|
624
|
-
const a = new Set(t.map((
|
|
625
|
-
r.value = l, await
|
|
626
|
-
|
|
666
|
+
const a = new Set(t.map((f) => f.id)), l = r.value.filter((f) => !a.has(f.id));
|
|
667
|
+
if (r.value = l, await J(), l.length === 0 && c.value.length > 0) {
|
|
668
|
+
if (s.autoRefreshOnEmpty)
|
|
669
|
+
await N();
|
|
670
|
+
else
|
|
671
|
+
try {
|
|
672
|
+
await F(), await te(0, !0);
|
|
673
|
+
} catch {
|
|
674
|
+
}
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
await new Promise((f) => requestAnimationFrame(() => f())), requestAnimationFrame(() => {
|
|
678
|
+
C(l);
|
|
627
679
|
});
|
|
628
680
|
}
|
|
629
|
-
function
|
|
630
|
-
|
|
681
|
+
function de(t) {
|
|
682
|
+
u.value && u.value.scrollTo({
|
|
631
683
|
top: 0,
|
|
632
684
|
behavior: (t == null ? void 0 : t.behavior) ?? "smooth",
|
|
633
685
|
...t
|
|
634
686
|
});
|
|
635
687
|
}
|
|
636
|
-
async function
|
|
637
|
-
|
|
688
|
+
async function ke() {
|
|
689
|
+
de({ behavior: "smooth" }), r.value = [], m.value = 0, await J(), n("remove-all:complete");
|
|
638
690
|
}
|
|
639
|
-
function
|
|
640
|
-
y.value =
|
|
691
|
+
function Ee() {
|
|
692
|
+
y.value = Pe(x.value), C(r.value), u.value && (T.value = u.value.scrollTop, I.value = u.value.clientHeight);
|
|
641
693
|
}
|
|
642
|
-
let
|
|
643
|
-
const
|
|
644
|
-
async function
|
|
645
|
-
if (!s.backfillEnabled ||
|
|
646
|
-
const
|
|
647
|
-
if (!(!s.pageSize || s.pageSize <= 0 ||
|
|
648
|
-
|
|
694
|
+
let ae = !1;
|
|
695
|
+
const k = B(!1);
|
|
696
|
+
async function te(t, a = !1) {
|
|
697
|
+
if (!a && !s.backfillEnabled || ae || k.value) return;
|
|
698
|
+
const l = (t || 0) + (s.pageSize || 0);
|
|
699
|
+
if (!(!s.pageSize || s.pageSize <= 0 || c.value[c.value.length - 1] == null) && !(r.value.length >= l)) {
|
|
700
|
+
ae = !0;
|
|
649
701
|
try {
|
|
650
|
-
let
|
|
651
|
-
for (n("backfill:start", { target:
|
|
702
|
+
let d = 0;
|
|
703
|
+
for (n("backfill:start", { target: l, fetched: r.value.length, calls: d }); r.value.length < l && d < s.backfillMaxCalls && c.value[c.value.length - 1] != null && !k.value && (await ee(s.backfillDelayMs, (j, Y) => {
|
|
652
704
|
n("backfill:tick", {
|
|
653
705
|
fetched: r.value.length,
|
|
654
|
-
target:
|
|
655
|
-
calls:
|
|
656
|
-
remainingMs:
|
|
657
|
-
totalMs:
|
|
706
|
+
target: l,
|
|
707
|
+
calls: d,
|
|
708
|
+
remainingMs: j,
|
|
709
|
+
totalMs: Y
|
|
658
710
|
});
|
|
659
|
-
}), !
|
|
660
|
-
const
|
|
711
|
+
}), !k.value); ) {
|
|
712
|
+
const A = c.value[c.value.length - 1];
|
|
661
713
|
try {
|
|
662
|
-
|
|
663
|
-
const
|
|
664
|
-
if (
|
|
665
|
-
|
|
714
|
+
g.value = !0;
|
|
715
|
+
const j = await h(A);
|
|
716
|
+
if (k.value) break;
|
|
717
|
+
c.value.push(j.nextPage);
|
|
666
718
|
} finally {
|
|
667
|
-
|
|
719
|
+
g.value = !1;
|
|
668
720
|
}
|
|
669
|
-
|
|
721
|
+
d++;
|
|
670
722
|
}
|
|
671
|
-
n("backfill:stop", { fetched: r.value.length, calls:
|
|
723
|
+
n("backfill:stop", { fetched: r.value.length, calls: d });
|
|
672
724
|
} finally {
|
|
673
|
-
|
|
725
|
+
ae = !1;
|
|
674
726
|
}
|
|
675
727
|
}
|
|
676
728
|
}
|
|
677
|
-
function
|
|
678
|
-
|
|
729
|
+
function ge() {
|
|
730
|
+
k.value = !0, g.value = !1, ae = !1;
|
|
679
731
|
}
|
|
680
|
-
function
|
|
681
|
-
|
|
732
|
+
function Le() {
|
|
733
|
+
ge(), k.value = !1, u.value && u.value.scrollTo({
|
|
682
734
|
top: 0,
|
|
683
735
|
behavior: "smooth"
|
|
684
|
-
}), r.value = [],
|
|
736
|
+
}), r.value = [], m.value = 0, v.value = s.loadAtPage, c.value = [s.loadAtPage], M.value = {
|
|
685
737
|
distanceToTrigger: 0,
|
|
686
738
|
isNearTrigger: !1
|
|
687
739
|
};
|
|
688
740
|
}
|
|
689
|
-
const
|
|
690
|
-
|
|
691
|
-
const t =
|
|
692
|
-
|
|
693
|
-
}, 200), pe =
|
|
694
|
-
function
|
|
695
|
-
|
|
741
|
+
const he = Me(async () => {
|
|
742
|
+
u.value && (T.value = u.value.scrollTop, I.value = u.value.clientHeight), S.value = !0, await J(), await new Promise((a) => requestAnimationFrame(() => a())), S.value = !1;
|
|
743
|
+
const t = fe(r.value, y.value);
|
|
744
|
+
U(t), p(t);
|
|
745
|
+
}, 200), pe = Me(Ee, 200);
|
|
746
|
+
function Ne(t, a, l) {
|
|
747
|
+
v.value = a, c.value = [a], c.value.push(l), E(t, "init"), C([...r.value, ...t]), p();
|
|
696
748
|
}
|
|
697
|
-
return
|
|
749
|
+
return We(async () => {
|
|
698
750
|
var t;
|
|
699
751
|
try {
|
|
700
|
-
y.value =
|
|
752
|
+
y.value = Pe(x.value), u.value && (T.value = u.value.scrollTop, I.value = u.value.clientHeight);
|
|
701
753
|
const a = s.loadAtPage;
|
|
702
|
-
|
|
754
|
+
c.value = [a], s.skipInitialLoad || await W(c.value[0]), p();
|
|
703
755
|
} catch (a) {
|
|
704
|
-
console.error("Error during component initialization:", a),
|
|
756
|
+
console.error("Error during component initialization:", a), g.value = !1;
|
|
705
757
|
}
|
|
706
|
-
(t =
|
|
707
|
-
}),
|
|
758
|
+
(t = u.value) == null || t.addEventListener("scroll", he, { passive: !0 }), window.addEventListener("resize", pe);
|
|
759
|
+
}), Oe(() => {
|
|
708
760
|
var t;
|
|
709
|
-
(t =
|
|
710
|
-
}), (t, a) => (
|
|
711
|
-
class:
|
|
761
|
+
(t = u.value) == null || t.removeEventListener("scroll", he), window.removeEventListener("resize", pe);
|
|
762
|
+
}), (t, a) => (le(), oe("div", {
|
|
763
|
+
class: ve(["overflow-auto w-full flex-1 masonry-container", { "force-motion": s.forceMotion }]),
|
|
712
764
|
ref_key: "container",
|
|
713
|
-
ref:
|
|
765
|
+
ref: u
|
|
714
766
|
}, [
|
|
715
767
|
V("div", {
|
|
716
768
|
class: "relative",
|
|
717
|
-
style:
|
|
769
|
+
style: Be({ height: `${m.value}px`, "--masonry-duration": `${e.transitionDurationMs}ms`, "--masonry-leave-duration": `${e.leaveDurationMs}ms`, "--masonry-ease": e.transitionEasing })
|
|
718
770
|
}, [
|
|
719
|
-
|
|
771
|
+
ze(De, {
|
|
720
772
|
name: "masonry",
|
|
721
773
|
css: !1,
|
|
722
|
-
onEnter:
|
|
723
|
-
onBeforeEnter:
|
|
724
|
-
onLeave:
|
|
725
|
-
onBeforeLeave:
|
|
774
|
+
onEnter: z,
|
|
775
|
+
onBeforeEnter: K,
|
|
776
|
+
onLeave: G,
|
|
777
|
+
onBeforeLeave: Q
|
|
726
778
|
}, {
|
|
727
|
-
default:
|
|
728
|
-
(
|
|
779
|
+
default: je(() => [
|
|
780
|
+
(le(!0), oe(Re, null, Ce(Z.value, (l, f) => (le(), oe("div", me({
|
|
729
781
|
key: `${l.page}-${l.id}`,
|
|
730
782
|
class: "absolute masonry-item",
|
|
731
783
|
ref_for: !0
|
|
732
|
-
},
|
|
733
|
-
|
|
784
|
+
}, _e(xt)(l, f)), [
|
|
785
|
+
qe(t.$slots, "item", me({ ref_for: !0 }, { item: l, remove: _ }), () => [
|
|
734
786
|
V("img", {
|
|
735
787
|
src: l.src,
|
|
736
788
|
class: "w-full",
|
|
737
789
|
loading: "lazy",
|
|
738
790
|
decoding: "async"
|
|
739
|
-
}, null, 8,
|
|
791
|
+
}, null, 8, Mt),
|
|
740
792
|
V("button", {
|
|
741
793
|
class: "absolute bottom-0 right-0 bg-red-500 text-white p-2 rounded cursor-pointer",
|
|
742
|
-
onClick: (
|
|
794
|
+
onClick: (d) => _(l)
|
|
743
795
|
}, a[0] || (a[0] = [
|
|
744
796
|
V("i", { class: "fas fa-trash" }, null, -1)
|
|
745
|
-
]), 8,
|
|
797
|
+
]), 8, Pt)
|
|
746
798
|
], !0)
|
|
747
799
|
], 16))), 128))
|
|
748
800
|
]),
|
|
749
801
|
_: 3
|
|
750
802
|
}),
|
|
751
|
-
|
|
803
|
+
m.value > 0 ? (le(), oe("div", {
|
|
752
804
|
key: 0,
|
|
753
|
-
class:
|
|
805
|
+
class: ve(["fixed bottom-4 right-4 bg-gray-800 text-white text-xs rounded-full px-3 py-1.5 shadow-lg z-10 transition-opacity duration-300", { "opacity-50 hover:opacity-100": !M.value.isNearTrigger, "opacity-100": M.value.isNearTrigger }])
|
|
754
806
|
}, [
|
|
755
|
-
V("span", null,
|
|
807
|
+
V("span", null, be(r.value.length) + " items", 1),
|
|
756
808
|
a[1] || (a[1] = V("span", { class: "mx-2" }, "|", -1)),
|
|
757
|
-
V("span", null,
|
|
758
|
-
], 2)) :
|
|
809
|
+
V("span", null, be(M.value.distanceToTrigger) + "px to load", 1)
|
|
810
|
+
], 2)) : Fe("", !0)
|
|
759
811
|
], 4)
|
|
760
812
|
], 2));
|
|
761
813
|
}
|
|
762
814
|
}), St = (e, o) => {
|
|
763
815
|
const i = e.__vccOpts || e;
|
|
764
|
-
for (const [s,
|
|
765
|
-
i[s] =
|
|
816
|
+
for (const [s, b] of o)
|
|
817
|
+
i[s] = b;
|
|
766
818
|
return i;
|
|
767
|
-
},
|
|
819
|
+
}, Ie = /* @__PURE__ */ St(It, [["__scopeId", "data-v-fa62094f"]]), kt = {
|
|
768
820
|
install(e) {
|
|
769
|
-
e.component("WyxosMasonry",
|
|
821
|
+
e.component("WyxosMasonry", Ie), e.component("WMasonry", Ie);
|
|
770
822
|
}
|
|
771
823
|
};
|
|
772
824
|
export {
|
|
773
|
-
|
|
774
|
-
|
|
825
|
+
Ie as Masonry,
|
|
826
|
+
kt as default
|
|
775
827
|
};
|