@wyxos/vibe 1.6.6 → 1.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/apple-touch-icon-114x114.png +0 -0
- package/lib/apple-touch-icon-120x120.png +0 -0
- package/lib/apple-touch-icon-144x144.png +0 -0
- package/lib/apple-touch-icon-152x152.png +0 -0
- package/lib/apple-touch-icon-180x180.png +0 -0
- package/lib/apple-touch-icon-57x57.png +0 -0
- package/lib/apple-touch-icon-60x60.png +0 -0
- package/lib/apple-touch-icon-72x72.png +0 -0
- package/lib/apple-touch-icon-76x76.png +0 -0
- package/lib/favicon-128x128.png +0 -0
- package/lib/favicon-16x16.png +0 -0
- package/lib/favicon-256x256.png +0 -0
- package/lib/favicon-32x32.png +0 -0
- package/lib/favicon-48x48.png +0 -0
- package/lib/favicon-64x64.png +0 -0
- package/lib/favicon.ico +0 -0
- package/lib/index.js +538 -470
- package/lib/logo-dark.svg +36 -0
- package/lib/logo-light.svg +29 -0
- package/lib/logo.svg +32 -0
- package/lib/manifest.json +41 -0
- package/lib/vibe.css +1 -1
- package/package.json +5 -2
- package/src/App.vue +30 -159
- package/src/Masonry.vue +3 -2
- package/src/components/MasonryItem.vue +123 -21
- package/src/main.ts +2 -1
- package/src/pages.json +36401 -32501
- package/src/router/index.ts +20 -0
- package/src/style.css +31 -31
- package/src/views/Examples.vue +20 -0
- package/src/views/Home.vue +169 -0
package/lib/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { nextTick as Q, defineComponent as
|
|
2
|
-
let
|
|
1
|
+
import { nextTick as Q, defineComponent as Se, ref as k, computed as Z, onMounted as Le, watch as Ne, createElementBlock as V, openBlock as G, renderSlot as He, createElementVNode as A, createCommentVNode as le, normalizeClass as ve, toDisplayString as ie, withModifiers as je, onUnmounted as ze, normalizeStyle as Re, createVNode as Te, TransitionGroup as Ce, withCtx as qe, Fragment as _e, renderList as Ve, mergeProps as Ge, unref as Ue } from "vue";
|
|
2
|
+
let ce = null;
|
|
3
3
|
function Xe() {
|
|
4
|
-
if (
|
|
4
|
+
if (ce != null) return ce;
|
|
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);
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
return document.body.removeChild(e),
|
|
7
|
+
const l = document.createElement("div");
|
|
8
|
+
l.style.width = "100%", e.appendChild(l);
|
|
9
|
+
const s = e.offsetWidth - l.offsetWidth;
|
|
10
|
+
return document.body.removeChild(e), ce = s, s;
|
|
11
11
|
}
|
|
12
|
-
function Ye(e,
|
|
12
|
+
function Ye(e, l, s, i = {}) {
|
|
13
13
|
const {
|
|
14
14
|
gutterX: h = 0,
|
|
15
|
-
gutterY:
|
|
15
|
+
gutterY: m = 0,
|
|
16
16
|
header: a = 0,
|
|
17
17
|
footer: n = 0,
|
|
18
|
-
paddingLeft:
|
|
19
|
-
paddingRight:
|
|
20
|
-
sizes:
|
|
18
|
+
paddingLeft: v = 0,
|
|
19
|
+
paddingRight: f = 0,
|
|
20
|
+
sizes: d = {
|
|
21
21
|
base: 1,
|
|
22
22
|
sm: 2,
|
|
23
23
|
md: 3,
|
|
@@ -26,94 +26,94 @@ function Ye(e, o, l, s = {}) {
|
|
|
26
26
|
"2xl": 6
|
|
27
27
|
},
|
|
28
28
|
placement: b = "masonry"
|
|
29
|
-
} =
|
|
30
|
-
let
|
|
29
|
+
} = i;
|
|
30
|
+
let r = 0, c = 0;
|
|
31
31
|
try {
|
|
32
|
-
if (
|
|
33
|
-
const
|
|
34
|
-
|
|
32
|
+
if (l && l.nodeType === 1 && typeof window < "u" && window.getComputedStyle) {
|
|
33
|
+
const T = window.getComputedStyle(l);
|
|
34
|
+
r = parseFloat(T.paddingLeft) || 0, c = parseFloat(T.paddingRight) || 0;
|
|
35
35
|
}
|
|
36
36
|
} catch {
|
|
37
37
|
}
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
return Math.round(
|
|
38
|
+
const w = (v || 0) + r, I = (f || 0) + c, E = l.offsetWidth - l.clientWidth, M = E > 0 ? E + 2 : Xe() + 2, P = l.offsetWidth - M - w - I, j = h * (s - 1), N = Math.floor((P - j) / s), S = e.map((T) => {
|
|
39
|
+
const F = T.width, L = T.height;
|
|
40
|
+
return Math.round(N * L / F) + n + a;
|
|
41
41
|
});
|
|
42
42
|
if (b === "sequential-balanced") {
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
let
|
|
47
|
-
const
|
|
48
|
-
let
|
|
49
|
-
for (let
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
else if (
|
|
43
|
+
const T = S.length;
|
|
44
|
+
if (T === 0) return [];
|
|
45
|
+
const F = (y, H, O) => y + (H > 0 ? m : 0) + O;
|
|
46
|
+
let L = Math.max(...S), z = S.reduce((y, H) => y + H, 0) + m * Math.max(0, T - 1);
|
|
47
|
+
const ee = (y) => {
|
|
48
|
+
let H = 1, O = 0, C = 0;
|
|
49
|
+
for (let W = 0; W < T; W++) {
|
|
50
|
+
const U = S[W], q = F(O, C, U);
|
|
51
|
+
if (q <= y)
|
|
52
|
+
O = q, C++;
|
|
53
|
+
else if (H++, O = U, C = 1, U > y || H > s) return !1;
|
|
54
54
|
}
|
|
55
|
-
return
|
|
55
|
+
return H <= s;
|
|
56
56
|
};
|
|
57
|
-
for (;
|
|
58
|
-
const
|
|
59
|
-
|
|
57
|
+
for (; L < z; ) {
|
|
58
|
+
const y = Math.floor((L + z) / 2);
|
|
59
|
+
ee(y) ? z = y : L = y + 1;
|
|
60
60
|
}
|
|
61
|
-
const
|
|
62
|
-
let
|
|
63
|
-
for (let
|
|
64
|
-
const
|
|
65
|
-
!(
|
|
61
|
+
const te = z, X = new Array(s).fill(0);
|
|
62
|
+
let ae = s - 1, Y = 0, J = 0;
|
|
63
|
+
for (let y = T - 1; y >= 0; y--) {
|
|
64
|
+
const H = S[y], O = y < ae;
|
|
65
|
+
!(F(Y, J, H) <= te) || O ? (X[ae] = y + 1, ae--, Y = H, J = 1) : (Y = F(Y, J, H), J++);
|
|
66
66
|
}
|
|
67
67
|
X[0] = 0;
|
|
68
|
-
const
|
|
69
|
-
for (let
|
|
70
|
-
const
|
|
71
|
-
for (let
|
|
72
|
-
const
|
|
73
|
-
...e[
|
|
74
|
-
columnWidth:
|
|
68
|
+
const R = [], ne = new Array(s).fill(0);
|
|
69
|
+
for (let y = 0; y < s; y++) {
|
|
70
|
+
const H = X[y], O = y + 1 < s ? X[y + 1] : T, C = y * (N + h);
|
|
71
|
+
for (let W = H; W < O; W++) {
|
|
72
|
+
const q = {
|
|
73
|
+
...e[W],
|
|
74
|
+
columnWidth: N,
|
|
75
75
|
imageHeight: 0,
|
|
76
76
|
columnHeight: 0,
|
|
77
77
|
left: 0,
|
|
78
78
|
top: 0
|
|
79
79
|
};
|
|
80
|
-
|
|
80
|
+
q.imageHeight = S[W] - (n + a), q.columnHeight = S[W], q.left = C, q.top = ne[y], ne[y] += q.columnHeight + (W + 1 < O ? m : 0), R.push(q);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
return
|
|
83
|
+
return R;
|
|
84
84
|
}
|
|
85
|
-
const
|
|
86
|
-
for (let
|
|
87
|
-
const
|
|
88
|
-
...
|
|
85
|
+
const x = new Array(s).fill(0), D = [];
|
|
86
|
+
for (let T = 0; T < e.length; T++) {
|
|
87
|
+
const F = e[T], L = {
|
|
88
|
+
...F,
|
|
89
89
|
columnWidth: 0,
|
|
90
90
|
imageHeight: 0,
|
|
91
91
|
columnHeight: 0,
|
|
92
92
|
left: 0,
|
|
93
93
|
top: 0
|
|
94
|
-
},
|
|
95
|
-
|
|
94
|
+
}, z = x.indexOf(Math.min(...x)), ee = F.width, te = F.height;
|
|
95
|
+
L.columnWidth = N, L.left = z * (N + h), L.imageHeight = Math.round(N * te / ee), L.columnHeight = L.imageHeight + n + a, L.top = x[z], x[z] += L.columnHeight + m, D.push(L);
|
|
96
96
|
}
|
|
97
|
-
return
|
|
97
|
+
return D;
|
|
98
98
|
}
|
|
99
|
-
var Je = typeof global == "object" && global && global.Object === Object && global, Ke = typeof self == "object" && self && self.Object === Object && self,
|
|
99
|
+
var Je = typeof global == "object" && global && global.Object === Object && global, Ke = typeof self == "object" && self && self.Object === Object && self, $e = Je || Ke || Function("return this")(), ue = $e.Symbol, Ae = Object.prototype, Qe = Ae.hasOwnProperty, Ze = Ae.toString, oe = ue ? ue.toStringTag : void 0;
|
|
100
100
|
function et(e) {
|
|
101
|
-
var
|
|
101
|
+
var l = Qe.call(e, oe), s = e[oe];
|
|
102
102
|
try {
|
|
103
|
-
e[
|
|
104
|
-
var
|
|
103
|
+
e[oe] = void 0;
|
|
104
|
+
var i = !0;
|
|
105
105
|
} catch {
|
|
106
106
|
}
|
|
107
107
|
var h = Ze.call(e);
|
|
108
|
-
return
|
|
108
|
+
return i && (l ? e[oe] = s : delete e[oe]), h;
|
|
109
109
|
}
|
|
110
110
|
var tt = Object.prototype, at = tt.toString;
|
|
111
111
|
function nt(e) {
|
|
112
112
|
return at.call(e);
|
|
113
113
|
}
|
|
114
|
-
var rt = "[object Null]", ot = "[object Undefined]",
|
|
114
|
+
var rt = "[object Null]", ot = "[object Undefined]", Me = ue ? ue.toStringTag : void 0;
|
|
115
115
|
function lt(e) {
|
|
116
|
-
return e == null ? e === void 0 ? ot : rt :
|
|
116
|
+
return e == null ? e === void 0 ? ot : rt : Me && Me in Object(e) ? et(e) : nt(e);
|
|
117
117
|
}
|
|
118
118
|
function st(e) {
|
|
119
119
|
return e != null && typeof e == "object";
|
|
@@ -124,92 +124,92 @@ function ut(e) {
|
|
|
124
124
|
}
|
|
125
125
|
var ct = /\s/;
|
|
126
126
|
function ft(e) {
|
|
127
|
-
for (var
|
|
127
|
+
for (var l = e.length; l-- && ct.test(e.charAt(l)); )
|
|
128
128
|
;
|
|
129
|
-
return
|
|
129
|
+
return l;
|
|
130
130
|
}
|
|
131
131
|
var dt = /^\s+/;
|
|
132
|
-
function
|
|
132
|
+
function vt(e) {
|
|
133
133
|
return e && e.slice(0, ft(e) + 1).replace(dt, "");
|
|
134
134
|
}
|
|
135
|
-
function
|
|
136
|
-
var
|
|
137
|
-
return e != null && (
|
|
135
|
+
function me(e) {
|
|
136
|
+
var l = typeof e;
|
|
137
|
+
return e != null && (l == "object" || l == "function");
|
|
138
138
|
}
|
|
139
|
-
var
|
|
140
|
-
function
|
|
139
|
+
var Ie = NaN, mt = /^[-+]0x[0-9a-f]+$/i, gt = /^0b[01]+$/i, pt = /^0o[0-7]+$/i, yt = parseInt;
|
|
140
|
+
function Pe(e) {
|
|
141
141
|
if (typeof e == "number")
|
|
142
142
|
return e;
|
|
143
143
|
if (ut(e))
|
|
144
|
-
return
|
|
145
|
-
if (
|
|
146
|
-
var
|
|
147
|
-
e =
|
|
144
|
+
return Ie;
|
|
145
|
+
if (me(e)) {
|
|
146
|
+
var l = typeof e.valueOf == "function" ? e.valueOf() : e;
|
|
147
|
+
e = me(l) ? l + "" : l;
|
|
148
148
|
}
|
|
149
149
|
if (typeof e != "string")
|
|
150
150
|
return e === 0 ? e : +e;
|
|
151
|
-
e =
|
|
152
|
-
var
|
|
153
|
-
return
|
|
151
|
+
e = vt(e);
|
|
152
|
+
var s = gt.test(e);
|
|
153
|
+
return s || pt.test(e) ? yt(e.slice(2), s ? 2 : 8) : mt.test(e) ? Ie : +e;
|
|
154
154
|
}
|
|
155
|
-
var
|
|
156
|
-
return
|
|
157
|
-
},
|
|
158
|
-
function
|
|
159
|
-
var
|
|
155
|
+
var fe = function() {
|
|
156
|
+
return $e.Date.now();
|
|
157
|
+
}, ht = "Expected a function", bt = Math.max, xt = Math.min;
|
|
158
|
+
function Ee(e, l, s) {
|
|
159
|
+
var i, h, m, a, n, v, f = 0, d = !1, b = !1, r = !0;
|
|
160
160
|
if (typeof e != "function")
|
|
161
|
-
throw new TypeError(
|
|
162
|
-
|
|
163
|
-
function x
|
|
164
|
-
var
|
|
165
|
-
return
|
|
161
|
+
throw new TypeError(ht);
|
|
162
|
+
l = Pe(l) || 0, me(s) && (d = !!s.leading, b = "maxWait" in s, m = b ? bt(Pe(s.maxWait) || 0, l) : m, r = "trailing" in s ? !!s.trailing : r);
|
|
163
|
+
function c(x) {
|
|
164
|
+
var D = i, T = h;
|
|
165
|
+
return i = h = void 0, f = x, a = e.apply(T, D), a;
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
return
|
|
167
|
+
function w(x) {
|
|
168
|
+
return f = x, n = setTimeout(M, l), d ? c(x) : a;
|
|
169
169
|
}
|
|
170
|
-
function
|
|
171
|
-
var
|
|
172
|
-
return b ? xt(
|
|
170
|
+
function I(x) {
|
|
171
|
+
var D = x - v, T = x - f, F = l - D;
|
|
172
|
+
return b ? xt(F, m - T) : F;
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
var
|
|
176
|
-
return
|
|
174
|
+
function E(x) {
|
|
175
|
+
var D = x - v, T = x - f;
|
|
176
|
+
return v === void 0 || D >= l || D < 0 || b && T >= m;
|
|
177
177
|
}
|
|
178
178
|
function M() {
|
|
179
|
-
var
|
|
180
|
-
if (
|
|
181
|
-
return P(
|
|
182
|
-
n = setTimeout(M,
|
|
179
|
+
var x = fe();
|
|
180
|
+
if (E(x))
|
|
181
|
+
return P(x);
|
|
182
|
+
n = setTimeout(M, I(x));
|
|
183
183
|
}
|
|
184
|
-
function P(
|
|
185
|
-
return n = void 0,
|
|
184
|
+
function P(x) {
|
|
185
|
+
return n = void 0, r && i ? c(x) : (i = h = void 0, a);
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
n !== void 0 && clearTimeout(n),
|
|
187
|
+
function j() {
|
|
188
|
+
n !== void 0 && clearTimeout(n), f = 0, i = v = h = n = void 0;
|
|
189
189
|
}
|
|
190
|
-
function
|
|
191
|
-
return n === void 0 ? a : P(
|
|
190
|
+
function N() {
|
|
191
|
+
return n === void 0 ? a : P(fe());
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
var
|
|
195
|
-
if (
|
|
193
|
+
function S() {
|
|
194
|
+
var x = fe(), D = E(x);
|
|
195
|
+
if (i = arguments, h = this, v = x, D) {
|
|
196
196
|
if (n === void 0)
|
|
197
|
-
return
|
|
197
|
+
return w(v);
|
|
198
198
|
if (b)
|
|
199
|
-
return clearTimeout(n), n = setTimeout(M,
|
|
199
|
+
return clearTimeout(n), n = setTimeout(M, l), c(v);
|
|
200
200
|
}
|
|
201
|
-
return n === void 0 && (n = setTimeout(M,
|
|
201
|
+
return n === void 0 && (n = setTimeout(M, l)), a;
|
|
202
202
|
}
|
|
203
|
-
return
|
|
203
|
+
return S.cancel = j, S.flush = N, S;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
const
|
|
207
|
-
return
|
|
205
|
+
function de(e) {
|
|
206
|
+
const l = window.innerWidth, s = e.sizes;
|
|
207
|
+
return l >= 1536 && s["2xl"] ? s["2xl"] : l >= 1280 && s.xl ? s.xl : l >= 1024 && s.lg ? s.lg : l >= 768 && s.md ? s.md : l >= 640 && s.sm ? s.sm : s.base;
|
|
208
208
|
}
|
|
209
209
|
function wt(e) {
|
|
210
|
-
return e.reduce((
|
|
210
|
+
return e.reduce((s, i) => Math.max(s, i.top + i.columnHeight), 0) + 500;
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function Tt(e) {
|
|
213
213
|
return {
|
|
214
214
|
transform: `translate3d(${e.left}px, ${e.top}px, 0)`,
|
|
215
215
|
top: "0px",
|
|
@@ -218,94 +218,94 @@ function Mt(e) {
|
|
|
218
218
|
height: `${e.columnHeight}px`
|
|
219
219
|
};
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function Mt(e, l = 0) {
|
|
222
222
|
return {
|
|
223
|
-
style:
|
|
223
|
+
style: Tt(e),
|
|
224
224
|
"data-top": e.top,
|
|
225
225
|
"data-left": e.left,
|
|
226
226
|
"data-id": `${e.page}-${e.id}`,
|
|
227
|
-
"data-index":
|
|
227
|
+
"data-index": l
|
|
228
228
|
};
|
|
229
229
|
}
|
|
230
|
-
function
|
|
231
|
-
if (!e.length ||
|
|
232
|
-
return new Array(Math.max(1,
|
|
233
|
-
const
|
|
234
|
-
for (let a = 0; a <
|
|
235
|
-
const
|
|
230
|
+
function ge(e, l) {
|
|
231
|
+
if (!e.length || l <= 0)
|
|
232
|
+
return new Array(Math.max(1, l)).fill(0);
|
|
233
|
+
const i = Array.from(new Set(e.map((a) => a.left))).sort((a, n) => a - n).slice(0, l), h = /* @__PURE__ */ new Map();
|
|
234
|
+
for (let a = 0; a < i.length; a++) h.set(i[a], a);
|
|
235
|
+
const m = new Array(i.length).fill(0);
|
|
236
236
|
for (const a of e) {
|
|
237
237
|
const n = h.get(a.left);
|
|
238
|
-
n != null && (
|
|
238
|
+
n != null && (m[n] = Math.max(m[n], a.top + a.columnHeight));
|
|
239
239
|
}
|
|
240
|
-
for (;
|
|
241
|
-
return
|
|
240
|
+
for (; m.length < l; ) m.push(0);
|
|
241
|
+
return m;
|
|
242
242
|
}
|
|
243
|
-
function It(e,
|
|
244
|
-
function
|
|
245
|
-
const
|
|
243
|
+
function It(e, l) {
|
|
244
|
+
function s(a, n) {
|
|
245
|
+
const v = parseInt(a.dataset.left || "0", 10), f = parseInt(a.dataset.top || "0", 10), d = parseInt(a.dataset.index || "0", 10), b = Math.min(d * 20, 160), r = a.style.getPropertyValue("--masonry-opacity-delay");
|
|
246
246
|
a.style.setProperty("--masonry-opacity-delay", `${b}ms`), requestAnimationFrame(() => {
|
|
247
|
-
a.style.opacity = "1", a.style.transform = `translate3d(${
|
|
248
|
-
const
|
|
249
|
-
|
|
247
|
+
a.style.opacity = "1", a.style.transform = `translate3d(${v}px, ${f}px, 0) scale(1)`;
|
|
248
|
+
const c = () => {
|
|
249
|
+
r ? a.style.setProperty("--masonry-opacity-delay", r) : a.style.removeProperty("--masonry-opacity-delay"), a.removeEventListener("transitionend", c), n();
|
|
250
250
|
};
|
|
251
|
-
a.addEventListener("transitionend",
|
|
251
|
+
a.addEventListener("transitionend", c);
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
|
-
function
|
|
255
|
-
const n = parseInt(a.dataset.left || "0", 10),
|
|
256
|
-
a.style.opacity = "0", a.style.transform = `translate3d(${n}px, ${
|
|
254
|
+
function i(a) {
|
|
255
|
+
const n = parseInt(a.dataset.left || "0", 10), v = parseInt(a.dataset.top || "0", 10);
|
|
256
|
+
a.style.opacity = "0", a.style.transform = `translate3d(${n}px, ${v + 10}px, 0) scale(0.985)`;
|
|
257
257
|
}
|
|
258
258
|
function h(a) {
|
|
259
|
-
const n = parseInt(a.dataset.left || "0", 10),
|
|
260
|
-
a.style.transition = "none", a.style.opacity = "1", a.style.transform = `translate3d(${n}px, ${
|
|
259
|
+
const n = parseInt(a.dataset.left || "0", 10), v = parseInt(a.dataset.top || "0", 10);
|
|
260
|
+
a.style.transition = "none", a.style.opacity = "1", a.style.transform = `translate3d(${n}px, ${v}px, 0) scale(1)`, a.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
|
|
261
261
|
a.style.transition = "";
|
|
262
262
|
});
|
|
263
263
|
}
|
|
264
|
-
function
|
|
265
|
-
const
|
|
266
|
-
let b = Number.isFinite(
|
|
264
|
+
function m(a, n) {
|
|
265
|
+
const v = parseInt(a.dataset.left || "0", 10), f = parseInt(a.dataset.top || "0", 10), d = typeof (l == null ? void 0 : l.leaveDurationMs) == "number" ? l.leaveDurationMs : NaN;
|
|
266
|
+
let b = Number.isFinite(d) && d > 0 ? d : NaN;
|
|
267
267
|
if (!Number.isFinite(b)) {
|
|
268
268
|
const M = getComputedStyle(a).getPropertyValue("--masonry-leave-duration") || "", P = parseFloat(M);
|
|
269
269
|
b = Number.isFinite(P) && P > 0 ? P : 200;
|
|
270
270
|
}
|
|
271
|
-
const
|
|
272
|
-
a.removeEventListener("transitionend",
|
|
273
|
-
},
|
|
274
|
-
(!
|
|
275
|
-
},
|
|
276
|
-
|
|
271
|
+
const r = a.style.transitionDuration, c = () => {
|
|
272
|
+
a.removeEventListener("transitionend", w), clearTimeout(I), a.style.transitionDuration = r || "";
|
|
273
|
+
}, w = (E) => {
|
|
274
|
+
(!E || E.target === a) && (c(), n());
|
|
275
|
+
}, I = setTimeout(() => {
|
|
276
|
+
c(), n();
|
|
277
277
|
}, b + 100);
|
|
278
278
|
requestAnimationFrame(() => {
|
|
279
|
-
a.style.transitionDuration = `${b}ms`, a.style.opacity = "0", a.style.transform = `translate3d(${
|
|
279
|
+
a.style.transitionDuration = `${b}ms`, a.style.opacity = "0", a.style.transform = `translate3d(${v}px, ${f + 10}px, 0) scale(0.985)`, a.addEventListener("transitionend", w);
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
282
|
return {
|
|
283
|
-
onEnter:
|
|
284
|
-
onBeforeEnter:
|
|
283
|
+
onEnter: s,
|
|
284
|
+
onBeforeEnter: i,
|
|
285
285
|
onBeforeLeave: h,
|
|
286
|
-
onLeave:
|
|
286
|
+
onLeave: m
|
|
287
287
|
};
|
|
288
288
|
}
|
|
289
289
|
function Pt({
|
|
290
290
|
container: e,
|
|
291
|
-
masonry:
|
|
292
|
-
columns:
|
|
293
|
-
containerHeight:
|
|
291
|
+
masonry: l,
|
|
292
|
+
columns: s,
|
|
293
|
+
containerHeight: i,
|
|
294
294
|
isLoading: h,
|
|
295
|
-
pageSize:
|
|
295
|
+
pageSize: m,
|
|
296
296
|
refreshLayout: a,
|
|
297
297
|
setItemsRaw: n,
|
|
298
|
-
loadNext:
|
|
299
|
-
loadThresholdPx:
|
|
298
|
+
loadNext: v,
|
|
299
|
+
loadThresholdPx: f
|
|
300
300
|
}) {
|
|
301
|
-
let
|
|
302
|
-
async function b(
|
|
301
|
+
let d = 0;
|
|
302
|
+
async function b(r) {
|
|
303
303
|
if (!e.value) return;
|
|
304
|
-
const
|
|
305
|
-
|
|
306
|
-
const M = typeof
|
|
307
|
-
if (
|
|
308
|
-
await
|
|
304
|
+
const c = r ?? ge(l.value, s.value), w = c.length ? Math.max(...c) : 0, I = e.value.scrollTop + e.value.clientHeight, E = e.value.scrollTop > d + 1;
|
|
305
|
+
d = e.value.scrollTop;
|
|
306
|
+
const M = typeof f == "number" ? f : 200, P = M >= 0 ? Math.max(0, w - M) : Math.max(0, w + M);
|
|
307
|
+
if (I >= P && E && !h.value) {
|
|
308
|
+
await v(), await Q();
|
|
309
309
|
return;
|
|
310
310
|
}
|
|
311
311
|
}
|
|
@@ -313,101 +313,166 @@ function Pt({
|
|
|
313
313
|
handleScroll: b
|
|
314
314
|
};
|
|
315
315
|
}
|
|
316
|
-
const
|
|
316
|
+
const Et = { class: "relative w-full h-full group" }, kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:shadow-md transition-all duration-300 bg-white relative" }, St = {
|
|
317
317
|
key: 0,
|
|
318
|
-
class: "absolute inset-0 flex items-center justify-center bg-slate-100"
|
|
318
|
+
class: "absolute inset-0 flex flex-col items-center justify-center bg-slate-100 text-slate-400 text-sm p-4 text-center"
|
|
319
319
|
}, Lt = {
|
|
320
320
|
key: 1,
|
|
321
|
+
class: "absolute inset-0 flex items-center justify-center bg-slate-100"
|
|
322
|
+
}, Nt = {
|
|
323
|
+
key: 2,
|
|
321
324
|
class: "absolute inset-0 flex flex-col items-center justify-center bg-slate-50 text-slate-400 text-sm p-4 text-center"
|
|
322
|
-
}, Ht = ["src"],
|
|
325
|
+
}, Ht = ["src"], $t = ["src"], At = { class: "absolute bottom-0 left-0 right-0 p-3 opacity-0 group-hover:opacity-100 transform translate-y-2 group-hover:translate-y-0 transition-all duration-300 delay-75 pointer-events-none" }, Ft = { class: "text-white text-xs font-medium truncate drop-shadow-md" }, pe = /* @__PURE__ */ Se({
|
|
323
326
|
__name: "MasonryItem",
|
|
324
327
|
props: {
|
|
325
328
|
item: {},
|
|
326
|
-
remove: {
|
|
329
|
+
remove: {},
|
|
330
|
+
type: { default: void 0 },
|
|
331
|
+
notFound: { type: Boolean, default: void 0 }
|
|
327
332
|
},
|
|
328
333
|
setup(e) {
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
return
|
|
332
|
-
|
|
333
|
-
|
|
334
|
+
const l = e, s = k(!1), i = k(!1), h = k(null), m = k(!1), a = k(!1), n = k(null), v = Z(() => {
|
|
335
|
+
var r;
|
|
336
|
+
return l.type ?? ((r = l.item) == null ? void 0 : r.type) ?? "image";
|
|
337
|
+
}), f = Z(() => {
|
|
338
|
+
var r;
|
|
339
|
+
return l.notFound ?? ((r = l.item) == null ? void 0 : r.notFound) ?? !1;
|
|
340
|
+
});
|
|
341
|
+
function d(r) {
|
|
342
|
+
return new Promise((c, w) => {
|
|
343
|
+
if (!r) {
|
|
344
|
+
w(new Error("No image source provided"));
|
|
334
345
|
return;
|
|
335
346
|
}
|
|
336
|
-
const
|
|
337
|
-
|
|
338
|
-
const
|
|
347
|
+
const I = new Image(), E = Date.now(), M = 300;
|
|
348
|
+
I.onload = () => {
|
|
349
|
+
const P = Date.now() - E, j = Math.max(0, M - P);
|
|
339
350
|
setTimeout(() => {
|
|
340
|
-
|
|
341
|
-
},
|
|
342
|
-
},
|
|
343
|
-
|
|
344
|
-
},
|
|
351
|
+
s.value = !0, i.value = !1, c();
|
|
352
|
+
}, j);
|
|
353
|
+
}, I.onerror = () => {
|
|
354
|
+
i.value = !0, s.value = !1, w(new Error("Failed to load image"));
|
|
355
|
+
}, I.src = r;
|
|
345
356
|
});
|
|
346
357
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
358
|
+
function b(r) {
|
|
359
|
+
return new Promise((c, w) => {
|
|
360
|
+
if (!r) {
|
|
361
|
+
w(new Error("No video source provided"));
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
const I = document.createElement("video"), E = Date.now(), M = 300;
|
|
365
|
+
I.preload = "metadata", I.muted = !0, I.onloadedmetadata = () => {
|
|
366
|
+
const P = Date.now() - E, j = Math.max(0, M - P);
|
|
367
|
+
setTimeout(() => {
|
|
368
|
+
m.value = !0, a.value = !1, c();
|
|
369
|
+
}, j);
|
|
370
|
+
}, I.onerror = () => {
|
|
371
|
+
a.value = !0, m.value = !1, w(new Error("Failed to load video"));
|
|
372
|
+
}, I.src = r;
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
return Le(async () => {
|
|
376
|
+
var c, w;
|
|
377
|
+
if (console.log("[MasonryItem] Component mounted", (c = l.item) == null ? void 0 : c.id), f.value)
|
|
378
|
+
return;
|
|
379
|
+
const r = (w = l.item) == null ? void 0 : w.src;
|
|
380
|
+
if (r)
|
|
381
|
+
if (v.value === "video") {
|
|
382
|
+
n.value = r, m.value = !1, a.value = !1;
|
|
383
|
+
try {
|
|
384
|
+
await b(r);
|
|
385
|
+
} catch {
|
|
386
|
+
}
|
|
387
|
+
} else {
|
|
388
|
+
h.value = r, s.value = !1, i.value = !1;
|
|
389
|
+
try {
|
|
390
|
+
await d(r);
|
|
391
|
+
} catch {
|
|
392
|
+
}
|
|
356
393
|
}
|
|
357
|
-
}
|
|
358
394
|
}), Ne(
|
|
359
395
|
() => {
|
|
360
|
-
var
|
|
361
|
-
return (
|
|
396
|
+
var r;
|
|
397
|
+
return (r = l.item) == null ? void 0 : r.src;
|
|
362
398
|
},
|
|
363
|
-
async (
|
|
364
|
-
if (
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
399
|
+
async (r) => {
|
|
400
|
+
if (!(!r || f.value)) {
|
|
401
|
+
if (v.value === "video") {
|
|
402
|
+
if (r !== n.value) {
|
|
403
|
+
m.value = !1, a.value = !1, n.value = r;
|
|
404
|
+
try {
|
|
405
|
+
await b(r);
|
|
406
|
+
} catch {
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
} else if (r !== h.value) {
|
|
410
|
+
s.value = !1, i.value = !1, h.value = r;
|
|
411
|
+
try {
|
|
412
|
+
await d(r);
|
|
413
|
+
} catch {
|
|
414
|
+
}
|
|
369
415
|
}
|
|
370
416
|
}
|
|
371
417
|
}
|
|
372
|
-
), (
|
|
373
|
-
|
|
374
|
-
item:
|
|
375
|
-
remove:
|
|
376
|
-
imageLoaded:
|
|
377
|
-
imageError:
|
|
418
|
+
), (r, c) => (G(), V("div", Et, [
|
|
419
|
+
He(r.$slots, "default", {
|
|
420
|
+
item: r.item,
|
|
421
|
+
remove: r.remove,
|
|
422
|
+
imageLoaded: s.value,
|
|
423
|
+
imageError: i.value,
|
|
424
|
+
videoLoaded: m.value,
|
|
425
|
+
videoError: a.value,
|
|
426
|
+
showNotFound: f.value
|
|
378
427
|
}, () => [
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
]))) :
|
|
387
|
-
|
|
388
|
-
|
|
428
|
+
A("div", kt, [
|
|
429
|
+
f.value ? (G(), V("div", St, c[4] || (c[4] = [
|
|
430
|
+
A("i", { class: "fas fa-search text-3xl mb-3 opacity-50" }, null, -1),
|
|
431
|
+
A("span", { class: "font-medium" }, "Not Found", -1),
|
|
432
|
+
A("span", { class: "text-xs mt-1 opacity-75" }, "This item could not be located", -1)
|
|
433
|
+
]))) : v.value === "image" && !s.value && !i.value || v.value === "video" && !m.value && !a.value ? (G(), V("div", Lt, c[5] || (c[5] = [
|
|
434
|
+
A("div", { class: "animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500" }, null, -1)
|
|
435
|
+
]))) : v.value === "image" && i.value || v.value === "video" && a.value ? (G(), V("div", Nt, [
|
|
436
|
+
A("i", {
|
|
437
|
+
class: ve(v.value === "video" ? "fas fa-video text-2xl mb-2 opacity-50" : "fas fa-image text-2xl mb-2 opacity-50")
|
|
438
|
+
}, null, 2),
|
|
439
|
+
A("span", null, "Failed to load " + ie(v.value), 1)
|
|
440
|
+
])) : le("", !0),
|
|
441
|
+
v.value === "image" && s.value && h.value && !f.value ? (G(), V("img", {
|
|
442
|
+
key: 3,
|
|
389
443
|
src: h.value,
|
|
390
444
|
class: "w-full h-full object-cover transition-transform duration-500 group-hover:scale-105",
|
|
391
445
|
loading: "lazy",
|
|
392
446
|
decoding: "async"
|
|
393
|
-
}, null, 8, Ht)) :
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
447
|
+
}, null, 8, Ht)) : le("", !0),
|
|
448
|
+
v.value === "video" && m.value && n.value && !f.value ? (G(), V("video", {
|
|
449
|
+
key: 4,
|
|
450
|
+
src: n.value,
|
|
451
|
+
class: "w-full h-full object-cover transition-transform duration-500 group-hover:scale-105",
|
|
452
|
+
muted: "",
|
|
453
|
+
loop: "",
|
|
454
|
+
playsinline: "",
|
|
455
|
+
onMouseenter: c[0] || (c[0] = (w) => w.target.play()),
|
|
456
|
+
onMouseleave: c[1] || (c[1] = (w) => w.target.pause()),
|
|
457
|
+
onError: c[2] || (c[2] = (w) => a.value = !0)
|
|
458
|
+
}, null, 40, $t)) : le("", !0),
|
|
459
|
+
c[7] || (c[7] = A("div", { class: "absolute inset-0 bg-gradient-to-t from-black/50 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none" }, null, -1)),
|
|
460
|
+
r.remove ? (G(), V("button", {
|
|
461
|
+
key: 5,
|
|
397
462
|
class: "absolute top-2 right-2 w-8 h-8 flex items-center justify-center bg-white/90 backdrop-blur-sm text-slate-700 rounded-full shadow-sm opacity-0 group-hover:opacity-100 transform translate-y-2 group-hover:translate-y-0 transition-all duration-300 hover:bg-red-500 hover:text-white cursor-pointer",
|
|
398
|
-
onClick:
|
|
463
|
+
onClick: c[3] || (c[3] = je((w) => r.remove(r.item), ["stop"])),
|
|
399
464
|
"aria-label": "Remove item"
|
|
400
|
-
},
|
|
401
|
-
|
|
402
|
-
]))) :
|
|
403
|
-
|
|
404
|
-
|
|
465
|
+
}, c[6] || (c[6] = [
|
|
466
|
+
A("i", { class: "fas fa-times text-sm" }, null, -1)
|
|
467
|
+
]))) : le("", !0),
|
|
468
|
+
A("div", At, [
|
|
469
|
+
A("p", Ft, "Item #" + ie(String(r.item.id).split("-")[0]), 1)
|
|
405
470
|
])
|
|
406
471
|
])
|
|
407
472
|
])
|
|
408
473
|
]));
|
|
409
474
|
}
|
|
410
|
-
}),
|
|
475
|
+
}), Wt = /* @__PURE__ */ Se({
|
|
411
476
|
__name: "Masonry",
|
|
412
477
|
props: {
|
|
413
478
|
getNextPage: {
|
|
@@ -507,8 +572,8 @@ const St = { class: "relative w-full h-full group" }, kt = { class: "w-full h-fu
|
|
|
507
572
|
"retry:stop",
|
|
508
573
|
"remove-all:complete"
|
|
509
574
|
],
|
|
510
|
-
setup(e, { expose:
|
|
511
|
-
const
|
|
575
|
+
setup(e, { expose: l, emit: s }) {
|
|
576
|
+
const i = e, h = {
|
|
512
577
|
sizes: { base: 1, sm: 2, md: 3, lg: 4, xl: 5, "2xl": 6 },
|
|
513
578
|
gutterX: 10,
|
|
514
579
|
gutterY: 10,
|
|
@@ -517,41 +582,41 @@ const St = { class: "relative w-full h-full group" }, kt = { class: "w-full h-fu
|
|
|
517
582
|
paddingLeft: 0,
|
|
518
583
|
paddingRight: 0,
|
|
519
584
|
placement: "masonry"
|
|
520
|
-
},
|
|
585
|
+
}, m = Z(() => {
|
|
521
586
|
var t;
|
|
522
587
|
return {
|
|
523
588
|
...h,
|
|
524
|
-
...
|
|
589
|
+
...i.layout,
|
|
525
590
|
sizes: {
|
|
526
591
|
...h.sizes,
|
|
527
|
-
...((t =
|
|
592
|
+
...((t = i.layout) == null ? void 0 : t.sizes) || {}
|
|
528
593
|
}
|
|
529
594
|
};
|
|
530
|
-
}), a =
|
|
531
|
-
get: () =>
|
|
595
|
+
}), a = s, n = Z({
|
|
596
|
+
get: () => i.items,
|
|
532
597
|
set: (t) => a("update:items", t)
|
|
533
|
-
}),
|
|
534
|
-
function
|
|
598
|
+
}), v = k(7), f = k(null), d = k([]), b = k(null), r = k(!1), c = k(0), w = k(/* @__PURE__ */ new Set());
|
|
599
|
+
function I(t) {
|
|
535
600
|
return typeof t == "number" && Number.isFinite(t) && t > 0;
|
|
536
601
|
}
|
|
537
|
-
function
|
|
602
|
+
function E(t, o) {
|
|
538
603
|
try {
|
|
539
604
|
if (!Array.isArray(t) || t.length === 0) return;
|
|
540
|
-
const
|
|
541
|
-
if (
|
|
542
|
-
const
|
|
543
|
-
for (const
|
|
544
|
-
const
|
|
545
|
-
|
|
605
|
+
const u = t.filter((p) => !I(p == null ? void 0 : p.width) || !I(p == null ? void 0 : p.height));
|
|
606
|
+
if (u.length === 0) return;
|
|
607
|
+
const g = [];
|
|
608
|
+
for (const p of u) {
|
|
609
|
+
const B = (p == null ? void 0 : p.id) ?? `idx:${t.indexOf(p)}`;
|
|
610
|
+
w.value.has(B) || (w.value.add(B), g.push(B));
|
|
546
611
|
}
|
|
547
|
-
if (
|
|
548
|
-
const
|
|
612
|
+
if (g.length > 0) {
|
|
613
|
+
const p = g.slice(0, 10);
|
|
549
614
|
console.warn(
|
|
550
615
|
"[Masonry] Items missing width/height detected:",
|
|
551
616
|
{
|
|
552
|
-
context:
|
|
553
|
-
count:
|
|
554
|
-
sampleIds:
|
|
617
|
+
context: o,
|
|
618
|
+
count: g.length,
|
|
619
|
+
sampleIds: p,
|
|
555
620
|
hint: "Ensure each item has positive width and height. Consider providing fallbacks (e.g., 512x512) at the data layer."
|
|
556
621
|
}
|
|
557
622
|
);
|
|
@@ -559,364 +624,367 @@ const St = { class: "relative w-full h-full group" }, kt = { class: "w-full h-fu
|
|
|
559
624
|
} catch {
|
|
560
625
|
}
|
|
561
626
|
}
|
|
562
|
-
const M =
|
|
627
|
+
const M = k(0), P = k(0), j = i.virtualBufferPx, N = k(!1), S = k({
|
|
563
628
|
distanceToTrigger: 0,
|
|
564
629
|
isNearTrigger: !1
|
|
565
|
-
}),
|
|
566
|
-
if (!
|
|
567
|
-
const { scrollTop:
|
|
568
|
-
|
|
569
|
-
distanceToTrigger: Math.round(
|
|
570
|
-
isNearTrigger:
|
|
630
|
+
}), x = (t) => {
|
|
631
|
+
if (!f.value) return;
|
|
632
|
+
const { scrollTop: o, clientHeight: u } = f.value, g = o + u, p = t ?? ge(n.value, v.value), B = p.length ? Math.max(...p) : 0, _ = typeof i.loadThresholdPx == "number" ? i.loadThresholdPx : 200, K = _ >= 0 ? Math.max(0, B - _) : Math.max(0, B + _), we = Math.max(0, K - g), Oe = we <= 100;
|
|
633
|
+
S.value = {
|
|
634
|
+
distanceToTrigger: Math.round(we),
|
|
635
|
+
isNearTrigger: Oe
|
|
571
636
|
};
|
|
572
|
-
}, { onEnter:
|
|
573
|
-
function
|
|
574
|
-
if (
|
|
575
|
-
const
|
|
576
|
-
t.style.transition = "none", t.style.opacity = "1", t.style.transform = `translate3d(${
|
|
577
|
-
t.style.transition = "",
|
|
637
|
+
}, { onEnter: D, onBeforeEnter: T, onBeforeLeave: F, onLeave: L } = It(n, { leaveDurationMs: i.leaveDurationMs });
|
|
638
|
+
function z(t, o) {
|
|
639
|
+
if (N.value) {
|
|
640
|
+
const u = parseInt(t.dataset.left || "0", 10), g = parseInt(t.dataset.top || "0", 10);
|
|
641
|
+
t.style.transition = "none", t.style.opacity = "1", t.style.transform = `translate3d(${u}px, ${g}px, 0) scale(1)`, t.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
|
|
642
|
+
t.style.transition = "", o();
|
|
578
643
|
});
|
|
579
644
|
} else
|
|
580
|
-
|
|
645
|
+
D(t, o);
|
|
581
646
|
}
|
|
582
|
-
function
|
|
583
|
-
if (
|
|
584
|
-
const
|
|
585
|
-
t.style.transition = "none", t.style.opacity = "1", t.style.transform = `translate3d(${
|
|
647
|
+
function ee(t) {
|
|
648
|
+
if (N.value) {
|
|
649
|
+
const o = parseInt(t.dataset.left || "0", 10), u = parseInt(t.dataset.top || "0", 10);
|
|
650
|
+
t.style.transition = "none", t.style.opacity = "1", t.style.transform = `translate3d(${o}px, ${u}px, 0) scale(1)`, t.style.removeProperty("--masonry-opacity-delay");
|
|
586
651
|
} else
|
|
587
|
-
|
|
652
|
+
T(t);
|
|
588
653
|
}
|
|
589
|
-
function
|
|
590
|
-
|
|
654
|
+
function te(t) {
|
|
655
|
+
N.value || F(t);
|
|
591
656
|
}
|
|
592
|
-
function X(t,
|
|
593
|
-
|
|
657
|
+
function X(t, o) {
|
|
658
|
+
N.value ? o() : L(t, o);
|
|
594
659
|
}
|
|
595
|
-
const
|
|
596
|
-
const t = M.value -
|
|
597
|
-
return !
|
|
598
|
-
const
|
|
599
|
-
return
|
|
660
|
+
const ae = Z(() => {
|
|
661
|
+
const t = M.value - j, o = M.value + P.value + j, u = n.value;
|
|
662
|
+
return !u || u.length === 0 ? [] : u.filter((g) => {
|
|
663
|
+
const p = g.top;
|
|
664
|
+
return g.top + g.columnHeight >= t && p <= o;
|
|
600
665
|
});
|
|
601
666
|
}), { handleScroll: Y } = Pt({
|
|
602
|
-
container:
|
|
667
|
+
container: f,
|
|
603
668
|
masonry: n,
|
|
604
|
-
columns:
|
|
605
|
-
containerHeight:
|
|
606
|
-
isLoading:
|
|
607
|
-
pageSize:
|
|
608
|
-
refreshLayout:
|
|
669
|
+
columns: v,
|
|
670
|
+
containerHeight: c,
|
|
671
|
+
isLoading: r,
|
|
672
|
+
pageSize: i.pageSize,
|
|
673
|
+
refreshLayout: R,
|
|
609
674
|
setItemsRaw: (t) => {
|
|
610
675
|
n.value = t;
|
|
611
676
|
},
|
|
612
|
-
loadNext:
|
|
613
|
-
loadThresholdPx:
|
|
677
|
+
loadNext: C,
|
|
678
|
+
loadThresholdPx: i.loadThresholdPx
|
|
614
679
|
});
|
|
615
|
-
|
|
616
|
-
isLoading:
|
|
617
|
-
refreshLayout:
|
|
618
|
-
containerHeight:
|
|
619
|
-
remove:
|
|
620
|
-
removeMany:
|
|
621
|
-
removeAll:
|
|
622
|
-
loadNext:
|
|
623
|
-
loadPage:
|
|
624
|
-
refreshCurrentPage:
|
|
625
|
-
reset:
|
|
680
|
+
l({
|
|
681
|
+
isLoading: r,
|
|
682
|
+
refreshLayout: R,
|
|
683
|
+
containerHeight: c,
|
|
684
|
+
remove: U,
|
|
685
|
+
removeMany: q,
|
|
686
|
+
removeAll: Fe,
|
|
687
|
+
loadNext: C,
|
|
688
|
+
loadPage: O,
|
|
689
|
+
refreshCurrentPage: W,
|
|
690
|
+
reset: Be,
|
|
626
691
|
init: De,
|
|
627
|
-
paginationHistory:
|
|
692
|
+
paginationHistory: d,
|
|
628
693
|
cancelLoad: he,
|
|
629
|
-
scrollToTop:
|
|
630
|
-
totalItems:
|
|
694
|
+
scrollToTop: ye,
|
|
695
|
+
totalItems: Z(() => n.value.length)
|
|
631
696
|
});
|
|
632
697
|
function J(t) {
|
|
633
|
-
const
|
|
634
|
-
let
|
|
635
|
-
if (
|
|
636
|
-
const { scrollTop:
|
|
637
|
-
|
|
698
|
+
const o = wt(t);
|
|
699
|
+
let u = 0;
|
|
700
|
+
if (f.value) {
|
|
701
|
+
const { scrollTop: g, clientHeight: p } = f.value;
|
|
702
|
+
u = g + p + 100;
|
|
638
703
|
}
|
|
639
|
-
|
|
640
|
-
}
|
|
641
|
-
function
|
|
642
|
-
if (!
|
|
643
|
-
|
|
644
|
-
const
|
|
645
|
-
...
|
|
646
|
-
originalIndex:
|
|
647
|
-
})),
|
|
648
|
-
J(
|
|
649
|
-
}
|
|
650
|
-
function
|
|
651
|
-
return new Promise((
|
|
652
|
-
const
|
|
653
|
-
|
|
654
|
-
const
|
|
655
|
-
if (
|
|
656
|
-
clearInterval(
|
|
704
|
+
c.value = Math.max(o, u);
|
|
705
|
+
}
|
|
706
|
+
function R(t) {
|
|
707
|
+
if (!f.value) return;
|
|
708
|
+
E(t, "refreshLayout");
|
|
709
|
+
const o = t.map((g, p) => ({
|
|
710
|
+
...g,
|
|
711
|
+
originalIndex: g.originalIndex ?? p
|
|
712
|
+
})), u = Ye(o, f.value, v.value, m.value);
|
|
713
|
+
J(u), n.value = u;
|
|
714
|
+
}
|
|
715
|
+
function ne(t, o) {
|
|
716
|
+
return new Promise((u) => {
|
|
717
|
+
const g = Math.max(0, t | 0), p = Date.now();
|
|
718
|
+
o(g, g);
|
|
719
|
+
const B = setInterval(() => {
|
|
720
|
+
if ($.value) {
|
|
721
|
+
clearInterval(B), u();
|
|
657
722
|
return;
|
|
658
723
|
}
|
|
659
|
-
const
|
|
660
|
-
|
|
724
|
+
const _ = Date.now() - p, K = Math.max(0, g - _);
|
|
725
|
+
o(K, g), K <= 0 && (clearInterval(B), u());
|
|
661
726
|
}, 100);
|
|
662
727
|
});
|
|
663
728
|
}
|
|
664
|
-
async function
|
|
729
|
+
async function y(t) {
|
|
665
730
|
try {
|
|
666
|
-
const
|
|
667
|
-
return
|
|
668
|
-
} catch (
|
|
669
|
-
throw console.error("Error in getContent:",
|
|
731
|
+
const o = await H(() => i.getNextPage(t));
|
|
732
|
+
return R([...n.value, ...o.items]), o;
|
|
733
|
+
} catch (o) {
|
|
734
|
+
throw console.error("Error in getContent:", o), o;
|
|
670
735
|
}
|
|
671
736
|
}
|
|
672
|
-
async function
|
|
673
|
-
let
|
|
674
|
-
const
|
|
675
|
-
let
|
|
737
|
+
async function H(t) {
|
|
738
|
+
let o = 0;
|
|
739
|
+
const u = i.retryMaxAttempts;
|
|
740
|
+
let g = i.retryInitialDelayMs;
|
|
676
741
|
for (; ; )
|
|
677
742
|
try {
|
|
678
|
-
const
|
|
679
|
-
return
|
|
680
|
-
} catch (
|
|
681
|
-
if (
|
|
682
|
-
throw a("retry:stop", { attempt:
|
|
683
|
-
a("retry:start", { attempt:
|
|
684
|
-
a("retry:tick", { attempt:
|
|
685
|
-
}),
|
|
743
|
+
const p = await t();
|
|
744
|
+
return o > 0 && a("retry:stop", { attempt: o, success: !0 }), p;
|
|
745
|
+
} catch (p) {
|
|
746
|
+
if (o++, o > u)
|
|
747
|
+
throw a("retry:stop", { attempt: o - 1, success: !1 }), p;
|
|
748
|
+
a("retry:start", { attempt: o, max: u, totalMs: g }), await ne(g, (B, _) => {
|
|
749
|
+
a("retry:tick", { attempt: o, remainingMs: B, totalMs: _ });
|
|
750
|
+
}), g += i.retryBackoffStepMs;
|
|
686
751
|
}
|
|
687
752
|
}
|
|
688
|
-
async function
|
|
689
|
-
if (!
|
|
690
|
-
|
|
753
|
+
async function O(t) {
|
|
754
|
+
if (!r.value) {
|
|
755
|
+
$.value = !1, r.value = !0;
|
|
691
756
|
try {
|
|
692
|
-
const
|
|
693
|
-
if (
|
|
694
|
-
const
|
|
695
|
-
return
|
|
696
|
-
} catch (
|
|
697
|
-
throw console.error("Error loading page:",
|
|
757
|
+
const o = n.value.length;
|
|
758
|
+
if ($.value) return;
|
|
759
|
+
const u = await y(t);
|
|
760
|
+
return $.value ? void 0 : (b.value = t, d.value.push(u.nextPage), await re(o), u);
|
|
761
|
+
} catch (o) {
|
|
762
|
+
throw console.error("Error loading page:", o), o;
|
|
698
763
|
} finally {
|
|
699
|
-
|
|
764
|
+
r.value = !1;
|
|
700
765
|
}
|
|
701
766
|
}
|
|
702
767
|
}
|
|
703
|
-
async function
|
|
704
|
-
if (!
|
|
705
|
-
|
|
768
|
+
async function C() {
|
|
769
|
+
if (!r.value) {
|
|
770
|
+
$.value = !1, r.value = !0;
|
|
706
771
|
try {
|
|
707
772
|
const t = n.value.length;
|
|
708
|
-
if (
|
|
709
|
-
const
|
|
710
|
-
return
|
|
773
|
+
if ($.value) return;
|
|
774
|
+
const o = d.value[d.value.length - 1], u = await y(o);
|
|
775
|
+
return $.value ? void 0 : (b.value = o, d.value.push(u.nextPage), await re(t), u);
|
|
711
776
|
} catch (t) {
|
|
712
777
|
throw console.error("Error loading next page:", t), t;
|
|
713
778
|
} finally {
|
|
714
|
-
|
|
779
|
+
r.value = !1;
|
|
715
780
|
}
|
|
716
781
|
}
|
|
717
782
|
}
|
|
718
|
-
async function
|
|
719
|
-
if (console.log("[Masonry] refreshCurrentPage called, isLoading:",
|
|
720
|
-
|
|
783
|
+
async function W() {
|
|
784
|
+
if (console.log("[Masonry] refreshCurrentPage called, isLoading:", r.value, "currentPage:", b.value), !r.value) {
|
|
785
|
+
$.value = !1, r.value = !0;
|
|
721
786
|
try {
|
|
722
787
|
const t = b.value;
|
|
723
788
|
if (console.log("[Masonry] pageToRefresh:", t), t == null) {
|
|
724
|
-
console.warn("[Masonry] No current page to refresh - currentPage:", b.value, "paginationHistory:",
|
|
789
|
+
console.warn("[Masonry] No current page to refresh - currentPage:", b.value, "paginationHistory:", d.value);
|
|
725
790
|
return;
|
|
726
791
|
}
|
|
727
|
-
n.value = [],
|
|
728
|
-
const
|
|
729
|
-
if (
|
|
730
|
-
b.value = t,
|
|
731
|
-
const
|
|
732
|
-
return await
|
|
792
|
+
n.value = [], c.value = 0, d.value = [t], await Q();
|
|
793
|
+
const o = await y(t);
|
|
794
|
+
if ($.value) return;
|
|
795
|
+
b.value = t, d.value.push(o.nextPage);
|
|
796
|
+
const u = n.value.length;
|
|
797
|
+
return await re(u), o;
|
|
733
798
|
} catch (t) {
|
|
734
799
|
throw console.error("[Masonry] Error refreshing current page:", t), t;
|
|
735
800
|
} finally {
|
|
736
|
-
|
|
801
|
+
r.value = !1;
|
|
737
802
|
}
|
|
738
803
|
}
|
|
739
804
|
}
|
|
740
|
-
async function
|
|
741
|
-
const
|
|
742
|
-
if (n.value =
|
|
743
|
-
if (
|
|
744
|
-
console.log("[Masonry] All items removed, calling refreshCurrentPage"), await
|
|
805
|
+
async function U(t) {
|
|
806
|
+
const o = n.value.filter((u) => u.id !== t.id);
|
|
807
|
+
if (n.value = o, await Q(), console.log("[Masonry] remove - next.length:", o.length, "paginationHistory.length:", d.value.length), o.length === 0 && d.value.length > 0) {
|
|
808
|
+
if (i.autoRefreshOnEmpty)
|
|
809
|
+
console.log("[Masonry] All items removed, calling refreshCurrentPage"), await W();
|
|
745
810
|
else {
|
|
746
811
|
console.log("[Masonry] All items removed, calling loadNext and forcing backfill");
|
|
747
812
|
try {
|
|
748
|
-
await
|
|
813
|
+
await C(), await re(0, !0);
|
|
749
814
|
} catch {
|
|
750
815
|
}
|
|
751
816
|
}
|
|
752
817
|
return;
|
|
753
818
|
}
|
|
754
|
-
await new Promise((
|
|
755
|
-
|
|
819
|
+
await new Promise((u) => requestAnimationFrame(() => u())), requestAnimationFrame(() => {
|
|
820
|
+
R(o);
|
|
756
821
|
});
|
|
757
822
|
}
|
|
758
|
-
async function
|
|
823
|
+
async function q(t) {
|
|
759
824
|
if (!t || t.length === 0) return;
|
|
760
|
-
const
|
|
761
|
-
if (n.value =
|
|
762
|
-
if (
|
|
763
|
-
await
|
|
825
|
+
const o = new Set(t.map((g) => g.id)), u = n.value.filter((g) => !o.has(g.id));
|
|
826
|
+
if (n.value = u, await Q(), u.length === 0 && d.value.length > 0) {
|
|
827
|
+
if (i.autoRefreshOnEmpty)
|
|
828
|
+
await W();
|
|
764
829
|
else
|
|
765
830
|
try {
|
|
766
|
-
await
|
|
831
|
+
await C(), await re(0, !0);
|
|
767
832
|
} catch {
|
|
768
833
|
}
|
|
769
834
|
return;
|
|
770
835
|
}
|
|
771
|
-
await new Promise((
|
|
772
|
-
|
|
836
|
+
await new Promise((g) => requestAnimationFrame(() => g())), requestAnimationFrame(() => {
|
|
837
|
+
R(u);
|
|
773
838
|
});
|
|
774
839
|
}
|
|
775
|
-
function
|
|
776
|
-
|
|
840
|
+
function ye(t) {
|
|
841
|
+
f.value && f.value.scrollTo({
|
|
777
842
|
top: 0,
|
|
778
843
|
behavior: (t == null ? void 0 : t.behavior) ?? "smooth",
|
|
779
844
|
...t
|
|
780
845
|
});
|
|
781
846
|
}
|
|
782
|
-
async function
|
|
783
|
-
|
|
847
|
+
async function Fe() {
|
|
848
|
+
ye({ behavior: "smooth" }), n.value = [], c.value = 0, await Q(), a("remove-all:complete");
|
|
784
849
|
}
|
|
785
|
-
function
|
|
786
|
-
|
|
850
|
+
function We() {
|
|
851
|
+
v.value = de(m.value), R(n.value), f.value && (M.value = f.value.scrollTop, P.value = f.value.clientHeight);
|
|
787
852
|
}
|
|
788
|
-
let
|
|
789
|
-
const
|
|
790
|
-
async function
|
|
791
|
-
if (!
|
|
792
|
-
const
|
|
793
|
-
if (!(!
|
|
794
|
-
|
|
853
|
+
let se = !1;
|
|
854
|
+
const $ = k(!1);
|
|
855
|
+
async function re(t, o = !1) {
|
|
856
|
+
if (!o && !i.backfillEnabled || se || $.value) return;
|
|
857
|
+
const u = (t || 0) + (i.pageSize || 0);
|
|
858
|
+
if (!(!i.pageSize || i.pageSize <= 0 || d.value[d.value.length - 1] == null) && !(n.value.length >= u)) {
|
|
859
|
+
se = !0;
|
|
795
860
|
try {
|
|
796
|
-
let
|
|
797
|
-
for (a("backfill:start", { target:
|
|
861
|
+
let p = 0;
|
|
862
|
+
for (a("backfill:start", { target: u, fetched: n.value.length, calls: p }); n.value.length < u && p < i.backfillMaxCalls && d.value[d.value.length - 1] != null && !$.value && (await ne(i.backfillDelayMs, (_, K) => {
|
|
798
863
|
a("backfill:tick", {
|
|
799
864
|
fetched: n.value.length,
|
|
800
|
-
target:
|
|
801
|
-
calls:
|
|
802
|
-
remainingMs:
|
|
865
|
+
target: u,
|
|
866
|
+
calls: p,
|
|
867
|
+
remainingMs: _,
|
|
803
868
|
totalMs: K
|
|
804
869
|
});
|
|
805
|
-
}),
|
|
806
|
-
const
|
|
870
|
+
}), !$.value); ) {
|
|
871
|
+
const B = d.value[d.value.length - 1];
|
|
807
872
|
try {
|
|
808
|
-
|
|
809
|
-
const
|
|
810
|
-
if (
|
|
811
|
-
|
|
873
|
+
r.value = !0;
|
|
874
|
+
const _ = await y(B);
|
|
875
|
+
if ($.value) break;
|
|
876
|
+
d.value.push(_.nextPage);
|
|
812
877
|
} finally {
|
|
813
|
-
|
|
878
|
+
r.value = !1;
|
|
814
879
|
}
|
|
815
|
-
|
|
880
|
+
p++;
|
|
816
881
|
}
|
|
817
|
-
a("backfill:stop", { fetched: n.value.length, calls:
|
|
882
|
+
a("backfill:stop", { fetched: n.value.length, calls: p });
|
|
818
883
|
} finally {
|
|
819
|
-
|
|
884
|
+
se = !1;
|
|
820
885
|
}
|
|
821
886
|
}
|
|
822
887
|
}
|
|
823
888
|
function he() {
|
|
824
|
-
|
|
889
|
+
$.value = !0, r.value = !1, se = !1;
|
|
825
890
|
}
|
|
826
|
-
function
|
|
827
|
-
he(),
|
|
891
|
+
function Be() {
|
|
892
|
+
he(), $.value = !1, f.value && f.value.scrollTo({
|
|
828
893
|
top: 0,
|
|
829
894
|
behavior: "smooth"
|
|
830
|
-
}), n.value = [],
|
|
895
|
+
}), n.value = [], c.value = 0, b.value = i.loadAtPage, d.value = [i.loadAtPage], S.value = {
|
|
831
896
|
distanceToTrigger: 0,
|
|
832
897
|
isNearTrigger: !1
|
|
833
898
|
};
|
|
834
899
|
}
|
|
835
|
-
const
|
|
836
|
-
|
|
837
|
-
const t =
|
|
838
|
-
Y(t),
|
|
839
|
-
}, 200),
|
|
840
|
-
function De(t,
|
|
841
|
-
b.value =
|
|
900
|
+
const be = Ee(async () => {
|
|
901
|
+
f.value && (M.value = f.value.scrollTop, P.value = f.value.clientHeight), N.value = !0, await Q(), await new Promise((o) => requestAnimationFrame(() => o())), N.value = !1;
|
|
902
|
+
const t = ge(n.value, v.value);
|
|
903
|
+
Y(t), x(t);
|
|
904
|
+
}, 200), xe = Ee(We, 200);
|
|
905
|
+
function De(t, o, u) {
|
|
906
|
+
b.value = o, d.value = [o], d.value.push(u), E(t, "init"), R([...n.value, ...t]), x();
|
|
842
907
|
}
|
|
843
908
|
return Ne(
|
|
844
|
-
|
|
909
|
+
m,
|
|
845
910
|
() => {
|
|
846
|
-
|
|
911
|
+
f.value && (v.value = de(m.value), R(n.value));
|
|
847
912
|
},
|
|
848
913
|
{ deep: !0 }
|
|
849
|
-
),
|
|
914
|
+
), Le(async () => {
|
|
850
915
|
var t;
|
|
851
916
|
try {
|
|
852
|
-
|
|
853
|
-
const
|
|
854
|
-
|
|
855
|
-
} catch (
|
|
856
|
-
console.error("Error during component initialization:",
|
|
917
|
+
v.value = de(m.value), f.value && (M.value = f.value.scrollTop, P.value = f.value.clientHeight);
|
|
918
|
+
const o = i.loadAtPage;
|
|
919
|
+
d.value = [o], i.skipInitialLoad || await O(d.value[0]), x();
|
|
920
|
+
} catch (o) {
|
|
921
|
+
console.error("Error during component initialization:", o), r.value = !1;
|
|
857
922
|
}
|
|
858
|
-
(t =
|
|
859
|
-
}),
|
|
923
|
+
(t = f.value) == null || t.addEventListener("scroll", be, { passive: !0 }), window.addEventListener("resize", xe);
|
|
924
|
+
}), ze(() => {
|
|
860
925
|
var t;
|
|
861
|
-
(t =
|
|
862
|
-
}), (t,
|
|
863
|
-
class:
|
|
926
|
+
(t = f.value) == null || t.removeEventListener("scroll", be), window.removeEventListener("resize", xe);
|
|
927
|
+
}), (t, o) => (G(), V("div", {
|
|
928
|
+
class: ve(["overflow-auto w-full flex-1 masonry-container", { "force-motion": i.forceMotion }]),
|
|
864
929
|
ref_key: "container",
|
|
865
|
-
ref:
|
|
930
|
+
ref: f
|
|
866
931
|
}, [
|
|
867
|
-
|
|
932
|
+
A("div", {
|
|
868
933
|
class: "relative",
|
|
869
|
-
style:
|
|
934
|
+
style: Re({ height: `${c.value}px`, "--masonry-duration": `${e.transitionDurationMs}ms`, "--masonry-leave-duration": `${e.leaveDurationMs}ms`, "--masonry-ease": e.transitionEasing })
|
|
870
935
|
}, [
|
|
871
|
-
|
|
936
|
+
Te(Ce, {
|
|
872
937
|
name: "masonry",
|
|
873
938
|
css: !1,
|
|
874
|
-
onEnter:
|
|
875
|
-
onBeforeEnter:
|
|
939
|
+
onEnter: z,
|
|
940
|
+
onBeforeEnter: ee,
|
|
876
941
|
onLeave: X,
|
|
877
|
-
onBeforeLeave:
|
|
942
|
+
onBeforeLeave: te
|
|
878
943
|
}, {
|
|
879
944
|
default: qe(() => [
|
|
880
|
-
(
|
|
881
|
-
key: `${
|
|
945
|
+
(G(!0), V(_e, null, Ve(ae.value, (u, g) => (G(), V("div", Ge({
|
|
946
|
+
key: `${u.page}-${u.id}`,
|
|
882
947
|
class: "absolute masonry-item",
|
|
883
948
|
ref_for: !0
|
|
884
|
-
}, Ue(
|
|
885
|
-
style: { paddingTop: `${
|
|
949
|
+
}, Ue(Mt)(u, g), {
|
|
950
|
+
style: { paddingTop: `${m.value.header}px`, paddingBottom: `${m.value.footer}px` }
|
|
886
951
|
}), [
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
952
|
+
He(t.$slots, "default", {
|
|
953
|
+
item: u,
|
|
954
|
+
remove: U
|
|
955
|
+
}, () => [
|
|
956
|
+
Te(pe, {
|
|
957
|
+
item: u,
|
|
958
|
+
remove: U
|
|
891
959
|
}, null, 8, ["item"])
|
|
892
960
|
], !0)
|
|
893
961
|
], 16))), 128))
|
|
894
962
|
]),
|
|
895
963
|
_: 3
|
|
896
964
|
}),
|
|
897
|
-
|
|
965
|
+
c.value > 0 ? (G(), V("div", {
|
|
898
966
|
key: 0,
|
|
899
|
-
class:
|
|
967
|
+
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": !S.value.isNearTrigger, "opacity-100": S.value.isNearTrigger }])
|
|
900
968
|
}, [
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
], 2)) :
|
|
969
|
+
A("span", null, ie(n.value.length) + " items", 1),
|
|
970
|
+
o[0] || (o[0] = A("span", { class: "mx-2" }, "|", -1)),
|
|
971
|
+
A("span", null, ie(S.value.distanceToTrigger) + "px to load", 1)
|
|
972
|
+
], 2)) : le("", !0)
|
|
905
973
|
], 4)
|
|
906
974
|
], 2));
|
|
907
975
|
}
|
|
908
|
-
}),
|
|
909
|
-
const
|
|
910
|
-
for (const [
|
|
911
|
-
|
|
912
|
-
return
|
|
913
|
-
},
|
|
976
|
+
}), Bt = (e, l) => {
|
|
977
|
+
const s = e.__vccOpts || e;
|
|
978
|
+
for (const [i, h] of l)
|
|
979
|
+
s[i] = h;
|
|
980
|
+
return s;
|
|
981
|
+
}, ke = /* @__PURE__ */ Bt(Wt, [["__scopeId", "data-v-110c3294"]]), Ot = {
|
|
914
982
|
install(e) {
|
|
915
|
-
e.component("WyxosMasonry",
|
|
983
|
+
e.component("WyxosMasonry", ke), e.component("WMasonry", ke), e.component("WyxosMasonryItem", pe), e.component("WMasonryItem", pe);
|
|
916
984
|
}
|
|
917
985
|
};
|
|
918
986
|
export {
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
987
|
+
ke as Masonry,
|
|
988
|
+
pe as MasonryItem,
|
|
989
|
+
Ot as default
|
|
922
990
|
};
|