@wyxos/vibe 5.0.3 → 5.1.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/README.md +27 -0
- package/lib/components/VibeSurface.vue.d.ts +5 -1
- package/lib/core/mediaLifecycle.d.ts +4 -0
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +509 -477
- package/lib/types.d.ts +8 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -13,8 +13,39 @@ function F(e, t) {
|
|
|
13
13
|
return `${String(e)}:${t}`;
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
16
|
+
//#region src/core/mediaLifecycle.ts
|
|
17
|
+
function I(e, t, n, r, i) {
|
|
18
|
+
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
19
|
+
if (!o) return null;
|
|
20
|
+
let s = N(o, n), c = P(o, s);
|
|
21
|
+
return {
|
|
22
|
+
item: o,
|
|
23
|
+
layout: r,
|
|
24
|
+
media: c,
|
|
25
|
+
mediaId: c.mediaId ?? null,
|
|
26
|
+
mediaIndex: s,
|
|
27
|
+
origin: i,
|
|
28
|
+
postId: o.postId,
|
|
29
|
+
postIndex: a
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function L(e, t) {
|
|
33
|
+
O(() => {
|
|
34
|
+
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
35
|
+
return {
|
|
36
|
+
mediaIndex: t === null ? 0 : e.mediaIndices.get(t) ?? 0,
|
|
37
|
+
origin: e.reelOrigin ?? "reel",
|
|
38
|
+
postId: t
|
|
39
|
+
};
|
|
40
|
+
}, (n, r) => {
|
|
41
|
+
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
42
|
+
let i = I(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
43
|
+
i && t(i);
|
|
44
|
+
}, { flush: "sync" });
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
16
47
|
//#region src/core/runtime.ts
|
|
17
|
-
function
|
|
48
|
+
function R(e) {
|
|
18
49
|
return {
|
|
19
50
|
activeReelPostId: e.activeReelPostId,
|
|
20
51
|
autoScroll: { ...e.autoScroll },
|
|
@@ -42,17 +73,17 @@ function I(e) {
|
|
|
42
73
|
}
|
|
43
74
|
//#endregion
|
|
44
75
|
//#region src/components/GalleryFooter.vue?vue&type=script&setup=true&lang.ts
|
|
45
|
-
var
|
|
76
|
+
var z = {
|
|
46
77
|
key: 0,
|
|
47
78
|
class: "gallery-footer"
|
|
48
|
-
},
|
|
79
|
+
}, B = {
|
|
49
80
|
key: 0,
|
|
50
81
|
class: "load-more-status",
|
|
51
82
|
role: "status"
|
|
52
|
-
},
|
|
83
|
+
}, V = ["disabled"], H = {
|
|
53
84
|
key: 2,
|
|
54
85
|
class: "end-feed"
|
|
55
|
-
},
|
|
86
|
+
}, ee = ["disabled"], te = /* @__PURE__ */ d({
|
|
56
87
|
__name: "GalleryFooter",
|
|
57
88
|
props: {
|
|
58
89
|
canRetryEnd: { type: Boolean },
|
|
@@ -68,14 +99,14 @@ var L = {
|
|
|
68
99
|
function i() {
|
|
69
100
|
n.loadMoreLocked || (n.hasNext ? r("loadMore") : r("retryEnd"));
|
|
70
101
|
}
|
|
71
|
-
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer",
|
|
102
|
+
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer", z, [e.isLoading ? (b(), s("p", B, " Loading more… ")) : e.hasError || e.hasNext && e.showLoadMore ? (b(), s("button", {
|
|
72
103
|
key: 1,
|
|
73
104
|
"data-test": "load-more",
|
|
74
105
|
class: "load-more-button",
|
|
75
106
|
type: "button",
|
|
76
107
|
disabled: e.loadMoreLocked,
|
|
77
108
|
onClick: i
|
|
78
|
-
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9,
|
|
109
|
+
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, V)) : (b(), s("div", H, [n[1] ||= c("p", {
|
|
79
110
|
class: "end-feed-message",
|
|
80
111
|
role: "status"
|
|
81
112
|
}, " You've reached the end. ", -1), c("button", {
|
|
@@ -84,9 +115,9 @@ var L = {
|
|
|
84
115
|
type: "button",
|
|
85
116
|
disabled: e.loadMoreLocked,
|
|
86
117
|
onClick: n[0] ||= (e) => t.$emit("retryEnd")
|
|
87
|
-
}, " Check for more ", 8,
|
|
118
|
+
}, " Check for more ", 8, ee)]))])) : o("", !0);
|
|
88
119
|
}
|
|
89
|
-
}),
|
|
120
|
+
}), ne = /* @__PURE__ */ d({
|
|
90
121
|
__name: "FeedFooter",
|
|
91
122
|
props: {
|
|
92
123
|
actions: {},
|
|
@@ -123,7 +154,7 @@ var L = {
|
|
|
123
154
|
"can-retry-end",
|
|
124
155
|
"show-load-more",
|
|
125
156
|
"state"
|
|
126
|
-
])) : (b(), a(
|
|
157
|
+
])) : (b(), a(te, {
|
|
127
158
|
key: 1,
|
|
128
159
|
"can-retry-end": e.canRetryEnd,
|
|
129
160
|
"has-error": e.hasError,
|
|
@@ -142,7 +173,7 @@ var L = {
|
|
|
142
173
|
"show-load-more"
|
|
143
174
|
]));
|
|
144
175
|
}
|
|
145
|
-
}),
|
|
176
|
+
}), re = ["role"], ie = { class: "gallery-status" }, U = /* @__PURE__ */ d({
|
|
146
177
|
__name: "FeedStatus",
|
|
147
178
|
props: {
|
|
148
179
|
actions: {},
|
|
@@ -156,7 +187,7 @@ var L = {
|
|
|
156
187
|
return (n, u) => (b(), s("main", {
|
|
157
188
|
class: "gallery-shell",
|
|
158
189
|
role: r.state.error ? "alert" : r.state.isLoading ? "status" : void 0
|
|
159
|
-
}, [c("p",
|
|
190
|
+
}, [c("p", ie, [r.state.error ? (b(), s(e, { key: 0 }, [l(" Unable to load media. ")], 64)) : r.state.isLoading ? (b(), s(e, { key: 1 }, [l(" Loading media… ")], 64)) : (b(), s(e, { key: 2 }, [l(" No media found. ")], 64))]), t.feedFooter ? (b(), a(ne, {
|
|
160
191
|
key: 0,
|
|
161
192
|
actions: t.actions,
|
|
162
193
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -178,36 +209,36 @@ var L = {
|
|
|
178
209
|
"is-loading",
|
|
179
210
|
"load-more-locked",
|
|
180
211
|
"state"
|
|
181
|
-
])) : o("", !0)], 8,
|
|
212
|
+
])) : o("", !0)], 8, re));
|
|
182
213
|
}
|
|
183
214
|
});
|
|
184
|
-
function
|
|
215
|
+
function ae(e) {
|
|
185
216
|
return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
|
|
186
217
|
}
|
|
187
218
|
//#endregion
|
|
188
219
|
//#region src/core/masonry.ts
|
|
189
|
-
function
|
|
220
|
+
function W(e) {
|
|
190
221
|
let t = e.preview.width ?? e.width, n = e.preview.height ?? e.height;
|
|
191
222
|
return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
|
|
192
223
|
}
|
|
193
|
-
function
|
|
224
|
+
function oe(e) {
|
|
194
225
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
195
226
|
}
|
|
196
|
-
function
|
|
227
|
+
function se(e) {
|
|
197
228
|
return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
|
|
198
229
|
}
|
|
199
|
-
function
|
|
230
|
+
function G(e, t) {
|
|
200
231
|
let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n;
|
|
201
232
|
return e.reduce((e, t, n) => (t.y + t.height >= r && t.y <= i && e.push(n), e), []);
|
|
202
233
|
}
|
|
203
|
-
function
|
|
234
|
+
function K(e, t, n) {
|
|
204
235
|
if (t <= 0 || e.length === 0) return {
|
|
205
236
|
columns: 0,
|
|
206
237
|
height: 0,
|
|
207
238
|
items: []
|
|
208
239
|
};
|
|
209
240
|
let r = Math.max(0, n.gap), i = Number.isFinite(n.additionalHeight) ? Math.max(0, n.additionalHeight ?? 0) : 0, a = Math.max(1, n.minColumnWidth), o = Math.max(1, Math.floor((t + r) / (a + r))), s = (t - r * (o - 1)) / o, c = Array.from({ length: o }, () => 0), l = e.map((e) => {
|
|
210
|
-
let t =
|
|
241
|
+
let t = oe(c), n = s * W(e) + i, a = {
|
|
211
242
|
x: t * (s + r),
|
|
212
243
|
y: c[t],
|
|
213
244
|
width: s,
|
|
@@ -223,10 +254,10 @@ function J(e, t, n) {
|
|
|
223
254
|
}
|
|
224
255
|
//#endregion
|
|
225
256
|
//#region src/core/scrollbar.ts
|
|
226
|
-
function
|
|
257
|
+
function q(e, t, n) {
|
|
227
258
|
return Math.min(n, Math.max(t, e));
|
|
228
259
|
}
|
|
229
|
-
function
|
|
260
|
+
function ce({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
|
|
230
261
|
let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
|
|
231
262
|
if (!(c > 0 && o > 0)) return {
|
|
232
263
|
maximumScrollPosition: c,
|
|
@@ -235,23 +266,23 @@ function ae({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
|
|
|
235
266
|
thumbSize: o,
|
|
236
267
|
thumbTravel: 0
|
|
237
268
|
};
|
|
238
|
-
let l =
|
|
269
|
+
let l = q(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
|
|
239
270
|
return {
|
|
240
271
|
maximumScrollPosition: c,
|
|
241
272
|
scrollable: !0,
|
|
242
|
-
thumbOffset: u * (
|
|
273
|
+
thumbOffset: u * (q(n, 0, c) / c),
|
|
243
274
|
thumbSize: l,
|
|
244
275
|
thumbTravel: u
|
|
245
276
|
};
|
|
246
277
|
}
|
|
247
278
|
//#endregion
|
|
248
279
|
//#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
249
|
-
var
|
|
280
|
+
var le = ["aria-hidden"], J = [
|
|
250
281
|
"aria-controls",
|
|
251
282
|
"aria-valuemax",
|
|
252
283
|
"aria-valuenow",
|
|
253
284
|
"tabindex"
|
|
254
|
-
],
|
|
285
|
+
], ue = 32, de = 40, Y = 120, fe = /* @__PURE__ */ d({
|
|
255
286
|
__name: "GalleryScrollbar",
|
|
256
287
|
props: {
|
|
257
288
|
contentSize: {},
|
|
@@ -273,16 +304,16 @@ var oe = ["aria-hidden"], se = [
|
|
|
273
304
|
function k() {
|
|
274
305
|
g !== null && clearTimeout(g), g = setTimeout(() => {
|
|
275
306
|
g = null, o.value || (l.value = !1);
|
|
276
|
-
},
|
|
307
|
+
}, Y);
|
|
277
308
|
}
|
|
278
309
|
function A() {
|
|
279
310
|
l.value = !0, k();
|
|
280
311
|
}
|
|
281
312
|
function j() {
|
|
282
313
|
let e = t.scrollElement, r = i.value;
|
|
283
|
-
return !e || !r ? n :
|
|
314
|
+
return !e || !r ? n : ce({
|
|
284
315
|
contentSize: e.scrollHeight,
|
|
285
|
-
minimumThumbSize:
|
|
316
|
+
minimumThumbSize: ue,
|
|
286
317
|
scrollPosition: e.scrollTop,
|
|
287
318
|
trackSize: r.clientHeight,
|
|
288
319
|
viewportSize: e.clientHeight
|
|
@@ -335,7 +366,7 @@ var oe = ["aria-hidden"], se = [
|
|
|
335
366
|
}
|
|
336
367
|
function z(e) {
|
|
337
368
|
if (!E.value) return;
|
|
338
|
-
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r -
|
|
369
|
+
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - de : e.key === "ArrowDown" ? r + de : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
|
|
339
370
|
i !== null && (e.preventDefault(), A(), P(i));
|
|
340
371
|
}
|
|
341
372
|
function B(e) {
|
|
@@ -381,15 +412,15 @@ var oe = ["aria-hidden"], se = [
|
|
|
381
412
|
onPointerdown: I,
|
|
382
413
|
onPointermove: L,
|
|
383
414
|
onPointerup: R
|
|
384
|
-
}, null, 44,
|
|
415
|
+
}, null, 44, J)], 42, le));
|
|
385
416
|
}
|
|
386
|
-
}),
|
|
417
|
+
}), X = (e) => {
|
|
387
418
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
388
419
|
return !1;
|
|
389
|
-
},
|
|
390
|
-
let t =
|
|
420
|
+
}, Z = (e) => e === "", pe = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), me = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), he = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), ge = (e) => {
|
|
421
|
+
let t = he(e);
|
|
391
422
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
392
|
-
},
|
|
423
|
+
}, _e = {
|
|
393
424
|
xmlns: "http://www.w3.org/2000/svg",
|
|
394
425
|
width: 24,
|
|
395
426
|
height: 24,
|
|
@@ -399,27 +430,27 @@ var oe = ["aria-hidden"], se = [
|
|
|
399
430
|
"stroke-width": 2,
|
|
400
431
|
"stroke-linecap": "round",
|
|
401
432
|
"stroke-linejoin": "round"
|
|
402
|
-
},
|
|
403
|
-
...
|
|
433
|
+
}, ve = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = _e.width, color: s = _e.stroke, ...c }, { slots: l }) => p("svg", {
|
|
434
|
+
..._e,
|
|
404
435
|
...c,
|
|
405
436
|
width: o,
|
|
406
437
|
height: o,
|
|
407
438
|
stroke: s,
|
|
408
|
-
"stroke-width":
|
|
409
|
-
class:
|
|
410
|
-
...!l.default && !
|
|
411
|
-
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]),
|
|
439
|
+
"stroke-width": Z(n) || Z(r) || n === !0 || r === !0 ? Number(i || a || _e["stroke-width"]) * 24 / Number(o) : i || a || _e["stroke-width"],
|
|
440
|
+
class: pe("lucide", c.class, ...e ? [`lucide-${me(ge(e))}-icon`, `lucide-${me(e)}`] : ["lucide-icon"]),
|
|
441
|
+
...!l.default && !X(c) && { "aria-hidden": "true" }
|
|
442
|
+
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), ye = (e, t) => (n, { slots: r, attrs: i }) => p(ve, {
|
|
412
443
|
...i,
|
|
413
444
|
...n,
|
|
414
445
|
iconNode: t,
|
|
415
446
|
name: e
|
|
416
|
-
}, r),
|
|
447
|
+
}, r), be = ye("chevron-left", [["path", {
|
|
417
448
|
d: "m15 18-6-6 6-6",
|
|
418
449
|
key: "1wnfg3"
|
|
419
|
-
}]]),
|
|
450
|
+
}]]), xe = ye("chevron-right", [["path", {
|
|
420
451
|
d: "m9 18 6-6-6-6",
|
|
421
452
|
key: "mthhwq"
|
|
422
|
-
}]]),
|
|
453
|
+
}]]), Se = ye("pause", [["rect", {
|
|
423
454
|
x: "14",
|
|
424
455
|
y: "3",
|
|
425
456
|
width: "5",
|
|
@@ -433,10 +464,10 @@ var oe = ["aria-hidden"], se = [
|
|
|
433
464
|
height: "18",
|
|
434
465
|
rx: "1",
|
|
435
466
|
key: "1wsw3u"
|
|
436
|
-
}]]),
|
|
467
|
+
}]]), Ce = ye("play", [["path", {
|
|
437
468
|
d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",
|
|
438
469
|
key: "10ikf1"
|
|
439
|
-
}]]),
|
|
470
|
+
}]]), we = ye("volume-2", [
|
|
440
471
|
["path", {
|
|
441
472
|
d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
|
|
442
473
|
key: "uqj9uw"
|
|
@@ -449,7 +480,7 @@ var oe = ["aria-hidden"], se = [
|
|
|
449
480
|
d: "M19.364 18.364a9 9 0 0 0 0-12.728",
|
|
450
481
|
key: "ijwkga"
|
|
451
482
|
}]
|
|
452
|
-
]),
|
|
483
|
+
]), Te = ye("volume-x", [
|
|
453
484
|
["path", {
|
|
454
485
|
d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
|
|
455
486
|
key: "uqj9uw"
|
|
@@ -468,32 +499,32 @@ var oe = ["aria-hidden"], se = [
|
|
|
468
499
|
y2: "15",
|
|
469
500
|
key: "5ykzw1"
|
|
470
501
|
}]
|
|
471
|
-
]),
|
|
502
|
+
]), Ee = {
|
|
472
503
|
401: "Authentication required",
|
|
473
504
|
403: "Access forbidden",
|
|
474
505
|
404: "Preview not found",
|
|
475
506
|
419: "Session expired",
|
|
476
507
|
500: "Server error"
|
|
477
508
|
};
|
|
478
|
-
function
|
|
509
|
+
function De(e) {
|
|
479
510
|
return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
|
|
480
511
|
}
|
|
481
|
-
function
|
|
482
|
-
return
|
|
512
|
+
function Oe(e) {
|
|
513
|
+
return Ee[De(e)] ?? "Preview unavailable";
|
|
483
514
|
}
|
|
484
515
|
//#endregion
|
|
485
516
|
//#region src/core/mediaType.ts
|
|
486
|
-
var
|
|
487
|
-
function
|
|
517
|
+
var ke = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
518
|
+
function Ae(e) {
|
|
488
519
|
try {
|
|
489
|
-
return
|
|
520
|
+
return ke.test(new URL(e).pathname);
|
|
490
521
|
} catch {
|
|
491
|
-
return
|
|
522
|
+
return ke.test(e.split("?")[0] ?? e);
|
|
492
523
|
}
|
|
493
524
|
}
|
|
494
525
|
//#endregion
|
|
495
526
|
//#region src/components/CardRegion.vue
|
|
496
|
-
var
|
|
527
|
+
var je = /* @__PURE__ */ d({
|
|
497
528
|
__name: "CardRegion",
|
|
498
529
|
props: {
|
|
499
530
|
index: {},
|
|
@@ -540,18 +571,18 @@ var ke = /* @__PURE__ */ d({
|
|
|
540
571
|
"total"
|
|
541
572
|
]))], 38));
|
|
542
573
|
}
|
|
543
|
-
}),
|
|
574
|
+
}), Me = [
|
|
544
575
|
"max",
|
|
545
576
|
"value",
|
|
546
577
|
"aria-valuetext",
|
|
547
578
|
"disabled"
|
|
548
|
-
],
|
|
579
|
+
], Ne = {
|
|
549
580
|
key: 0,
|
|
550
581
|
class: "media-controls-row"
|
|
551
|
-
},
|
|
582
|
+
}, Pe = ["aria-label", "title"], Fe = { class: "media-controls-audio" }, Ie = ["aria-label", "title"], Le = ["value", "aria-valuetext"], Re = {
|
|
552
583
|
class: "media-control-time",
|
|
553
584
|
"aria-live": "off"
|
|
554
|
-
},
|
|
585
|
+
}, ze = /* @__PURE__ */ d({
|
|
555
586
|
__name: "MediaControls",
|
|
556
587
|
props: {
|
|
557
588
|
currentTime: {},
|
|
@@ -599,35 +630,35 @@ var ke = /* @__PURE__ */ d({
|
|
|
599
630
|
"aria-valuetext": `${u(p.value)} of ${u(f.value)}`,
|
|
600
631
|
disabled: f.value <= 0,
|
|
601
632
|
onInput: n[0] ||= (e) => i("seek", d(e))
|
|
602
|
-
}, null, 44,
|
|
633
|
+
}, null, 44, Me), e.layout === "reel" ? (b(), s("div", Ne, [
|
|
603
634
|
c("button", {
|
|
604
635
|
type: "button",
|
|
605
636
|
class: "media-control-button media-control-playback",
|
|
606
637
|
"aria-label": e.playing ? "Pause video" : "Play video",
|
|
607
638
|
title: e.playing ? "Pause" : "Play",
|
|
608
639
|
onClick: n[1] ||= (e) => i("togglePlayback")
|
|
609
|
-
}, [e.playing ? (b(), a(E(
|
|
640
|
+
}, [e.playing ? (b(), a(E(Se), {
|
|
610
641
|
key: 0,
|
|
611
642
|
size: 18,
|
|
612
643
|
fill: "currentColor"
|
|
613
|
-
})) : (b(), a(E(
|
|
644
|
+
})) : (b(), a(E(Ce), {
|
|
614
645
|
key: 1,
|
|
615
646
|
size: 18,
|
|
616
647
|
fill: "currentColor"
|
|
617
|
-
}))], 8,
|
|
618
|
-
c("div",
|
|
648
|
+
}))], 8, Pe),
|
|
649
|
+
c("div", Fe, [c("button", {
|
|
619
650
|
type: "button",
|
|
620
651
|
class: "media-control-button",
|
|
621
652
|
"aria-label": e.muted ? "Unmute video" : "Mute video",
|
|
622
653
|
title: e.muted ? "Unmute" : "Mute",
|
|
623
654
|
onClick: n[2] ||= (e) => i("toggleMute")
|
|
624
|
-
}, [e.muted || e.volume === 0 ? (b(), a(E(
|
|
655
|
+
}, [e.muted || e.volume === 0 ? (b(), a(E(Te), {
|
|
625
656
|
key: 0,
|
|
626
657
|
size: 18
|
|
627
|
-
})) : (b(), a(E(
|
|
658
|
+
})) : (b(), a(E(we), {
|
|
628
659
|
key: 1,
|
|
629
660
|
size: 18
|
|
630
|
-
}))], 8,
|
|
661
|
+
}))], 8, Ie), c("input", {
|
|
631
662
|
class: "media-control-range media-control-volume",
|
|
632
663
|
type: "range",
|
|
633
664
|
min: "0",
|
|
@@ -638,14 +669,14 @@ var ke = /* @__PURE__ */ d({
|
|
|
638
669
|
"aria-label": "Video volume",
|
|
639
670
|
"aria-valuetext": `${Math.round(e.volume * 100)} percent`,
|
|
640
671
|
onInput: n[3] ||= (e) => i("volumeChange", d(e))
|
|
641
|
-
}, null, 44,
|
|
642
|
-
c("output",
|
|
672
|
+
}, null, 44, Le)]),
|
|
673
|
+
c("output", Re, T(u(p.value)) + " / " + T(u(f.value)), 1)
|
|
643
674
|
])) : o("", !0)], 34));
|
|
644
675
|
}
|
|
645
676
|
});
|
|
646
677
|
//#endregion
|
|
647
678
|
//#region src/components/useReelVideoActivity.ts
|
|
648
|
-
function
|
|
679
|
+
function Be(e) {
|
|
649
680
|
let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
|
|
650
681
|
function i() {
|
|
651
682
|
if (!t.value) {
|
|
@@ -679,7 +710,7 @@ function Re(e) {
|
|
|
679
710
|
}
|
|
680
711
|
//#endregion
|
|
681
712
|
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
682
|
-
var
|
|
713
|
+
var Ve = [
|
|
683
714
|
"data-post-id",
|
|
684
715
|
"data-media-index",
|
|
685
716
|
"aria-hidden",
|
|
@@ -687,12 +718,12 @@ var ze = [
|
|
|
687
718
|
"inert",
|
|
688
719
|
"role",
|
|
689
720
|
"tabindex"
|
|
690
|
-
],
|
|
721
|
+
], He = { class: "media-card-content" }, Ue = ["data-media-direction"], We = ["data-media-index"], Ge = {
|
|
691
722
|
key: 0,
|
|
692
723
|
"data-test": "media-loading",
|
|
693
724
|
class: "media-loading",
|
|
694
725
|
"aria-hidden": "true"
|
|
695
|
-
},
|
|
726
|
+
}, Ke = ["aria-label"], qe = { class: "media-error-code" }, Je = [
|
|
696
727
|
"src",
|
|
697
728
|
"width",
|
|
698
729
|
"height",
|
|
@@ -700,12 +731,12 @@ var ze = [
|
|
|
700
731
|
"loop",
|
|
701
732
|
"muted",
|
|
702
733
|
"preload"
|
|
703
|
-
],
|
|
734
|
+
], Ye = [
|
|
704
735
|
"src",
|
|
705
736
|
"width",
|
|
706
737
|
"height",
|
|
707
738
|
"fetchpriority"
|
|
708
|
-
],
|
|
739
|
+
], Xe = ["aria-label"], Ze = ["aria-label"], Qe = ["aria-label"], $e = 40, et = 160, tt = 24, nt = /* @__PURE__ */ d({
|
|
709
740
|
__name: "MediaCard",
|
|
710
741
|
props: {
|
|
711
742
|
active: { type: Boolean },
|
|
@@ -741,52 +772,52 @@ var ze = [
|
|
|
741
772
|
function S(e = !1, t = "pointer") {
|
|
742
773
|
e && x("activate", t);
|
|
743
774
|
}
|
|
744
|
-
let C = r(() => M(l.item)), D = r(() => N(l.item, l.mediaIndex)), O = r(() => P(l.item, D.value)), F = r(() => l.mediaSource === "original" ? O.value.src : O.value.preview.src), I = r(() => l.mediaSource === "original" ? O.value.width : O.value.preview.width), L = r(() => l.mediaSource === "original" ? O.value.height : O.value.preview.height), R = w(null), z = w(0), B = w(0), V = w(l.mediaCard?.videoMuted ?? l.layout === "masonry"), H = w(!1),
|
|
775
|
+
let C = r(() => M(l.item)), D = r(() => N(l.item, l.mediaIndex)), O = r(() => P(l.item, D.value)), F = r(() => l.mediaSource === "original" ? O.value.src : O.value.preview.src), I = r(() => l.mediaSource === "original" ? O.value.width : O.value.preview.width), L = r(() => l.mediaSource === "original" ? O.value.height : O.value.preview.height), R = w(null), z = w(0), B = w(0), V = w(l.mediaCard?.videoMuted ?? l.layout === "masonry"), H = w(!1), ee = w(1), te = 1, { effectiveMuted: ne, onPlaying: re, playbackAllowed: ie } = Be({
|
|
745
776
|
active: () => l.active,
|
|
746
777
|
layout: () => l.layout,
|
|
747
778
|
videoElement: R,
|
|
748
779
|
videoIsMuted: V,
|
|
749
780
|
videoIsPlaying: H
|
|
750
|
-
}),
|
|
751
|
-
function
|
|
781
|
+
}), U = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
782
|
+
function ae(e) {
|
|
752
783
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
753
784
|
}
|
|
754
|
-
function
|
|
785
|
+
function W(e, t) {
|
|
755
786
|
let n = C.value.length, r = (e + n) % n;
|
|
756
787
|
r !== D.value && (y.value = e < D.value ? "previous" : "next", x("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
|
|
757
788
|
}
|
|
758
|
-
function
|
|
789
|
+
function oe(e, t, n) {
|
|
759
790
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
760
791
|
}
|
|
761
|
-
function
|
|
792
|
+
function se() {
|
|
762
793
|
f = 0, p = !1, d !== null && clearTimeout(d), d = null;
|
|
763
794
|
}
|
|
764
|
-
function
|
|
765
|
-
d !== null && clearTimeout(d), d = setTimeout(
|
|
795
|
+
function G() {
|
|
796
|
+
d !== null && clearTimeout(d), d = setTimeout(se, et);
|
|
766
797
|
}
|
|
767
|
-
function
|
|
798
|
+
function K(e) {
|
|
768
799
|
if (C.value.length <= 1) return;
|
|
769
|
-
let t = e.currentTarget?.clientWidth || 1, n =
|
|
770
|
-
if (n === 0 || (e.preventDefault(),
|
|
800
|
+
let t = e.currentTarget?.clientWidth || 1, n = oe(e.deltaX, e.deltaMode, t);
|
|
801
|
+
if (n === 0 || (e.preventDefault(), G(), p) || (f += n, Math.abs(f) < tt)) return;
|
|
771
802
|
let r = Math.sign(f);
|
|
772
|
-
f = 0, p = !0,
|
|
803
|
+
f = 0, p = !0, W(D.value + r);
|
|
773
804
|
}
|
|
774
|
-
function
|
|
805
|
+
function q(e) {
|
|
775
806
|
let t = e.touches[0];
|
|
776
807
|
l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
|
|
777
808
|
}
|
|
778
|
-
function
|
|
809
|
+
function ce(e) {
|
|
779
810
|
let t = e.changedTouches[0];
|
|
780
811
|
if (m === null || g === null || !t) return;
|
|
781
812
|
let n = m - t.clientX, r = g - t.clientY;
|
|
782
|
-
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) <
|
|
813
|
+
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < $e || W(D.value + Math.sign(n)));
|
|
783
814
|
}
|
|
784
|
-
let
|
|
785
|
-
function
|
|
815
|
+
let le = r(() => Ae(F.value)), J = r(() => l.layout === "reel" && l.stationaryReelControls === !0), ue = r(() => le.value && l.previewState === "ready" && (!J.value || !!(l.active && l.reelControlsTarget))), de = r(() => `${l.item.postId}:${D.value}:${F.value}`);
|
|
816
|
+
function Y(e) {
|
|
786
817
|
l.layout === "reel" && (e.stopPropagation(), fe());
|
|
787
818
|
}
|
|
788
819
|
async function fe() {
|
|
789
|
-
if (!(!R.value || !
|
|
820
|
+
if (!(!R.value || !ie.value)) {
|
|
790
821
|
if (H.value) {
|
|
791
822
|
R.value.pause();
|
|
792
823
|
return;
|
|
@@ -803,7 +834,7 @@ var ze = [
|
|
|
803
834
|
}
|
|
804
835
|
function Z(e) {
|
|
805
836
|
let t = e?.currentTarget ?? R.value;
|
|
806
|
-
t && (z.value = X(t.currentTime), B.value = X(t.duration),
|
|
837
|
+
t && (z.value = X(t.currentTime), B.value = X(t.duration), ie.value && (V.value = t.muted), ee.value = t.volume, t.volume > 0 && (te = t.volume));
|
|
807
838
|
}
|
|
808
839
|
function pe(e) {
|
|
809
840
|
Z(e), x("ready", D.value);
|
|
@@ -819,14 +850,14 @@ var ze = [
|
|
|
819
850
|
let t = R.value;
|
|
820
851
|
if (!t || !Number.isFinite(e)) return;
|
|
821
852
|
let n = Math.min(1, Math.max(0, e));
|
|
822
|
-
t.volume = n, t.muted = n === 0, n > 0 && (
|
|
853
|
+
t.volume = n, t.muted = n === 0, n > 0 && (te = n), Z();
|
|
823
854
|
}
|
|
824
855
|
function _e() {
|
|
825
856
|
let e = R.value;
|
|
826
|
-
e && (e.muted && e.volume === 0 && (e.volume =
|
|
857
|
+
e && (e.muted && e.volume === 0 && (e.volume = te), e.muted = !e.muted, Z());
|
|
827
858
|
}
|
|
828
859
|
return v(() => {
|
|
829
|
-
|
|
860
|
+
se();
|
|
830
861
|
}), (r, i) => (b(), s("article", {
|
|
831
862
|
"data-post-id": e.item.postId,
|
|
832
863
|
"data-media-index": D.value,
|
|
@@ -840,12 +871,12 @@ var ze = [
|
|
|
840
871
|
"aria-hidden": e.leaving || void 0,
|
|
841
872
|
"aria-busy": e.previewState === "loading",
|
|
842
873
|
inert: e.leaving || void 0,
|
|
843
|
-
role: e.interactive && !e.leaving && !
|
|
844
|
-
tabindex: e.interactive && !e.leaving && !
|
|
845
|
-
onClick: i[11] ||= (t) => S(e.interactive && !
|
|
846
|
-
onKeydown: [i[12] ||= A((t) => S(e.interactive && !
|
|
847
|
-
}, [c("div",
|
|
848
|
-
e.cardHeader ? (b(), a(
|
|
874
|
+
role: e.interactive && !e.leaving && !U.value ? "button" : void 0,
|
|
875
|
+
tabindex: e.interactive && !e.leaving && !U.value ? 0 : void 0,
|
|
876
|
+
onClick: i[11] ||= (t) => S(e.interactive && !U.value, ae(t)),
|
|
877
|
+
onKeydown: [i[12] ||= A((t) => S(e.interactive && !U.value, "keyboard"), ["enter"]), i[13] ||= A(j((t) => S(e.interactive && !U.value, "keyboard"), ["prevent"]), ["space"])]
|
|
878
|
+
}, [c("div", He, [
|
|
879
|
+
e.cardHeader ? (b(), a(je, {
|
|
849
880
|
key: 0,
|
|
850
881
|
index: e.index,
|
|
851
882
|
item: e.item,
|
|
@@ -871,22 +902,22 @@ var ze = [
|
|
|
871
902
|
c("div", {
|
|
872
903
|
class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && C.value.length > 1 }]),
|
|
873
904
|
"data-media-direction": y.value,
|
|
874
|
-
onWheel:
|
|
875
|
-
onTouchstartPassive:
|
|
876
|
-
onTouchendPassive:
|
|
905
|
+
onWheel: K,
|
|
906
|
+
onTouchstartPassive: q,
|
|
907
|
+
onTouchendPassive: ce
|
|
877
908
|
}, [
|
|
878
909
|
u(n, { name: `media-slide-${y.value}` }, {
|
|
879
910
|
default: k(() => [(b(), s("div", {
|
|
880
911
|
key: `${e.item.postId}:${O.value.src}:${e.mediaSource ?? "preview"}`,
|
|
881
912
|
class: "media-card-frame",
|
|
882
913
|
"data-media-index": D.value
|
|
883
|
-
}, [e.previewState === "loading" ? (b(), s("div",
|
|
914
|
+
}, [e.previewState === "loading" ? (b(), s("div", Ge, [...i[14] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : e.previewState === "error" ? (b(), s("div", {
|
|
884
915
|
key: 1,
|
|
885
916
|
"data-test": "media-error",
|
|
886
917
|
class: "media-error",
|
|
887
918
|
role: "img",
|
|
888
|
-
"aria-label": `${E(
|
|
889
|
-
}, [c("strong",
|
|
919
|
+
"aria-label": `${E(De)(F.value)} ${E(Oe)(F.value)}`
|
|
920
|
+
}, [c("strong", qe, T(E(De)(F.value)), 1), c("span", null, T(E(Oe)(F.value)), 1)], 8, Ke)) : o("", !0), le.value ? (b(), s("video", {
|
|
890
921
|
key: 2,
|
|
891
922
|
ref_key: "videoElement",
|
|
892
923
|
ref: R,
|
|
@@ -897,21 +928,21 @@ var ze = [
|
|
|
897
928
|
src: F.value,
|
|
898
929
|
width: I.value ?? void 0,
|
|
899
930
|
height: L.value ?? void 0,
|
|
900
|
-
autoplay: E(
|
|
931
|
+
autoplay: E(ie),
|
|
901
932
|
loop: !e.advanceOnMediaEnd,
|
|
902
|
-
muted: E(
|
|
933
|
+
muted: E(ne),
|
|
903
934
|
playsinline: "",
|
|
904
935
|
preload: e.fetchPriority === "high" ? "auto" : "metadata",
|
|
905
936
|
onLoadedmetadata: pe,
|
|
906
937
|
onDurationchange: Z,
|
|
907
938
|
onTimeupdate: Z,
|
|
908
939
|
onVolumechange: Z,
|
|
909
|
-
onPlaying: i[0] ||= (...e) => E(
|
|
940
|
+
onPlaying: i[0] ||= (...e) => E(re) && E(re)(...e),
|
|
910
941
|
onPause: i[1] ||= (e) => H.value = !1,
|
|
911
942
|
onEnded: me,
|
|
912
|
-
onClick:
|
|
943
|
+
onClick: Y,
|
|
913
944
|
onError: i[2] ||= (e) => r.$emit("error", D.value)
|
|
914
|
-
}, null, 42,
|
|
945
|
+
}, null, 42, Je)) : (b(), s("img", {
|
|
915
946
|
key: 3,
|
|
916
947
|
class: h(["media-preview", { "media-preview--ready": e.previewState === "ready" }]),
|
|
917
948
|
src: F.value,
|
|
@@ -923,25 +954,25 @@ var ze = [
|
|
|
923
954
|
loading: "eager",
|
|
924
955
|
onLoad: i[3] ||= (e) => r.$emit("ready", D.value),
|
|
925
956
|
onError: i[4] ||= (e) => r.$emit("error", D.value)
|
|
926
|
-
}, null, 42,
|
|
957
|
+
}, null, 42, Ye))], 8, We))]),
|
|
927
958
|
_: 1
|
|
928
959
|
}, 8, ["name"]),
|
|
929
960
|
(b(), a(t, {
|
|
930
|
-
disabled: !
|
|
961
|
+
disabled: !J.value || !e.reelControlsTarget,
|
|
931
962
|
to: e.reelControlsTarget ?? "body"
|
|
932
963
|
}, [u(n, {
|
|
933
964
|
name: "vibe-reel-media-controls",
|
|
934
|
-
css:
|
|
965
|
+
css: J.value
|
|
935
966
|
}, {
|
|
936
|
-
default: k(() => [
|
|
937
|
-
key:
|
|
967
|
+
default: k(() => [ue.value ? (b(), a(ze, {
|
|
968
|
+
key: de.value,
|
|
938
969
|
"current-time": z.value,
|
|
939
|
-
"data-control-post-id":
|
|
970
|
+
"data-control-post-id": J.value ? e.item.postId : void 0,
|
|
940
971
|
duration: B.value,
|
|
941
972
|
layout: e.layout,
|
|
942
973
|
muted: V.value,
|
|
943
974
|
playing: H.value,
|
|
944
|
-
volume:
|
|
975
|
+
volume: ee.value,
|
|
945
976
|
onSeek: he,
|
|
946
977
|
onToggleMute: _e,
|
|
947
978
|
onTogglePlayback: fe,
|
|
@@ -965,25 +996,25 @@ var ze = [
|
|
|
965
996
|
type: "button",
|
|
966
997
|
class: "media-carousel-control media-carousel-control--previous",
|
|
967
998
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
968
|
-
onClick: i[5] ||= j((e) =>
|
|
999
|
+
onClick: i[5] ||= j((e) => W(D.value - 1, e), ["stop"]),
|
|
969
1000
|
onKeydown: i[6] ||= j(() => {}, ["stop"])
|
|
970
|
-
}, [u(E(
|
|
1001
|
+
}, [u(E(be), { size: 20 })], 40, Xe), c("button", {
|
|
971
1002
|
type: "button",
|
|
972
1003
|
class: "media-carousel-control media-carousel-control--next",
|
|
973
1004
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
974
|
-
onClick: i[7] ||= j((e) =>
|
|
1005
|
+
onClick: i[7] ||= j((e) => W(D.value + 1, e), ["stop"]),
|
|
975
1006
|
onKeydown: i[8] ||= j(() => {}, ["stop"])
|
|
976
|
-
}, [u(E(
|
|
977
|
-
|
|
1007
|
+
}, [u(E(xe), { size: 20 })], 40, Ze)], 2)) : o("", !0),
|
|
1008
|
+
U.value ? (b(), s("button", {
|
|
978
1009
|
key: 1,
|
|
979
1010
|
class: "media-card-activator",
|
|
980
1011
|
type: "button",
|
|
981
1012
|
"aria-label": `Open post ${e.item.postId}`,
|
|
982
|
-
onClick: i[9] ||= j((e) => r.$emit("activate",
|
|
1013
|
+
onClick: i[9] ||= j((e) => r.$emit("activate", ae(e)), ["stop"]),
|
|
983
1014
|
onKeydown: i[10] ||= j(() => {}, ["stop"])
|
|
984
|
-
}, null, 40,
|
|
985
|
-
], 42,
|
|
986
|
-
e.cardFooter ? (b(), a(
|
|
1015
|
+
}, null, 40, Qe)) : o("", !0)
|
|
1016
|
+
], 42, Ue),
|
|
1017
|
+
e.cardFooter ? (b(), a(je, {
|
|
987
1018
|
key: 1,
|
|
988
1019
|
index: e.index,
|
|
989
1020
|
item: e.item,
|
|
@@ -1006,9 +1037,9 @@ var ze = [
|
|
|
1006
1037
|
"style",
|
|
1007
1038
|
"total"
|
|
1008
1039
|
])) : o("", !0)
|
|
1009
|
-
])], 46,
|
|
1040
|
+
])], 46, Ve));
|
|
1010
1041
|
}
|
|
1011
|
-
}),
|
|
1042
|
+
}), rt = { class: "masonry-feed-shell" }, it = ["aria-hidden", "inert"], at = 240, ot = 6, st = 12, ct = 800, lt = 1.5, ut = /* @__PURE__ */ d({
|
|
1012
1043
|
__name: "MasonryFeed",
|
|
1013
1044
|
props: {
|
|
1014
1045
|
enteringPostIds: {},
|
|
@@ -1042,36 +1073,36 @@ var ze = [
|
|
|
1042
1073
|
"retryEnd"
|
|
1043
1074
|
],
|
|
1044
1075
|
setup(t, { expose: n, emit: i }) {
|
|
1045
|
-
let o = t, l = i, d = w(null), f = `vibe-masonry-${D()}`, p = w(null), m = w(0), g = w(
|
|
1076
|
+
let o = t, l = i, d = w(null), f = `vibe-masonry-${D()}`, p = w(null), m = w(0), g = w(ot), y = w(0), x = w(0), C = w(0), T = null, k = null, A = null, j = r(() => K(o.items, m.value, {
|
|
1046
1077
|
additionalHeight: (o.cardHeader?.height ?? 0) + (o.cardFooter?.height ?? 0),
|
|
1047
1078
|
gap: g.value,
|
|
1048
|
-
minColumnWidth:
|
|
1079
|
+
minColumnWidth: at
|
|
1049
1080
|
})), M = r(() => {
|
|
1050
1081
|
let e = j.value;
|
|
1051
1082
|
if (o.leavingPostIds.size === 0) return e;
|
|
1052
|
-
let t = o.items.filter((e) => !o.leavingPostIds.has(e.postId)), n =
|
|
1083
|
+
let t = o.items.filter((e) => !o.leavingPostIds.has(e.postId)), n = K(t, m.value, {
|
|
1053
1084
|
additionalHeight: (o.cardHeader?.height ?? 0) + (o.cardFooter?.height ?? 0),
|
|
1054
1085
|
gap: g.value,
|
|
1055
|
-
minColumnWidth:
|
|
1086
|
+
minColumnWidth: at
|
|
1056
1087
|
}), r = new Map(t.map((e, t) => [e.postId, n.items[t]]));
|
|
1057
1088
|
return {
|
|
1058
1089
|
...n,
|
|
1059
1090
|
items: o.items.map((t, n) => o.leavingPostIds.has(t.postId) ? e.items[n] : r.get(t.postId) ?? e.items[n])
|
|
1060
1091
|
};
|
|
1061
1092
|
}), N = r(() => ({ height: `${o.leavingPostIds.size === 0 ? M.value.height : j.value.height}px` })), P = r(() => !o.infiniteScroll || x.value > 0 && C.value + M.value.height <= x.value + 1), I = r(() => {
|
|
1062
|
-
let e = Math.max(
|
|
1093
|
+
let e = Math.max(ct, x.value * lt), t = {
|
|
1063
1094
|
scrollTop: y.value - C.value,
|
|
1064
1095
|
viewportHeight: x.value
|
|
1065
|
-
}, n =
|
|
1096
|
+
}, n = G(M.value.items, {
|
|
1066
1097
|
...t,
|
|
1067
1098
|
overscan: e
|
|
1068
|
-
}), r = o.leavingPostIds.size === 0 ? [] :
|
|
1099
|
+
}), r = o.leavingPostIds.size === 0 ? [] : G(j.value.items, {
|
|
1069
1100
|
...t,
|
|
1070
1101
|
overscan: e
|
|
1071
|
-
}), i = [...new Set([...n, ...r])].sort((e, t) => e - t), a =
|
|
1102
|
+
}), i = [...new Set([...n, ...r])].sort((e, t) => e - t), a = G(M.value.items, {
|
|
1072
1103
|
...t,
|
|
1073
1104
|
overscan: 0
|
|
1074
|
-
}), s = o.leavingPostIds.size === 0 ? [] :
|
|
1105
|
+
}), s = o.leavingPostIds.size === 0 ? [] : G(j.value.items, {
|
|
1075
1106
|
...t,
|
|
1076
1107
|
overscan: 0
|
|
1077
1108
|
}), c = new Set([...a, ...s]);
|
|
@@ -1087,7 +1118,7 @@ var ze = [
|
|
|
1087
1118
|
function L(e) {
|
|
1088
1119
|
let t = M.value.items[e], n = o.items[e]?.postId;
|
|
1089
1120
|
if (!t) return {};
|
|
1090
|
-
let r = n !== void 0 && o.enteringPostIds.has(n), i = n !== void 0 && o.leavingPostIds.has(n), a = r || i ?
|
|
1121
|
+
let r = n !== void 0 && o.enteringPostIds.has(n), i = n !== void 0 && o.leavingPostIds.has(n), a = r || i ? se({
|
|
1091
1122
|
containerHeight: j.value.height,
|
|
1092
1123
|
gap: g.value
|
|
1093
1124
|
}) : 0, s = n === void 0 ? 0 : i ? o.removalDelays.get(n) ?? 0 : r ? o.entryDelays.get(n) ?? 0 : 0;
|
|
@@ -1107,15 +1138,15 @@ var ze = [
|
|
|
1107
1138
|
}
|
|
1108
1139
|
function z(e) {
|
|
1109
1140
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1110
|
-
m.value = e.clientWidth, g.value = Math.min(
|
|
1141
|
+
m.value = e.clientWidth, g.value = Math.min(st, Math.max(ot, t * .0075)), R();
|
|
1111
1142
|
}
|
|
1112
1143
|
function B(e) {
|
|
1113
1144
|
let t = e.currentTarget;
|
|
1114
|
-
t && (y.value = t.scrollTop, !o.loadMoreLocked && o.infiniteScroll &&
|
|
1145
|
+
t && (y.value = t.scrollTop, !o.loadMoreLocked && o.infiniteScroll && ae(t) && l("loadMore"));
|
|
1115
1146
|
}
|
|
1116
1147
|
function V() {
|
|
1117
1148
|
let e = d.value;
|
|
1118
|
-
!o.loadMoreLocked && e &&
|
|
1149
|
+
!o.loadMoreLocked && e && ae(e) && l("loadMore");
|
|
1119
1150
|
}
|
|
1120
1151
|
function H() {
|
|
1121
1152
|
return d.value;
|
|
@@ -1134,7 +1165,7 @@ var ze = [
|
|
|
1134
1165
|
}), n({
|
|
1135
1166
|
getScrollElement: H,
|
|
1136
1167
|
loadIfNearBottom: V
|
|
1137
|
-
}), (n, r) => (b(), s("div",
|
|
1168
|
+
}), (n, r) => (b(), s("div", rt, [c("main", {
|
|
1138
1169
|
id: f,
|
|
1139
1170
|
ref_key: "galleryElement",
|
|
1140
1171
|
ref: d,
|
|
@@ -1149,7 +1180,7 @@ var ze = [
|
|
|
1149
1180
|
class: h(["masonry", { "masonry--ready": m.value > 0 }]),
|
|
1150
1181
|
style: _(N.value),
|
|
1151
1182
|
"aria-label": "Media gallery"
|
|
1152
|
-
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(
|
|
1183
|
+
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(nt, {
|
|
1153
1184
|
key: n.postId,
|
|
1154
1185
|
class: "masonry-item",
|
|
1155
1186
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1189,7 +1220,7 @@ var ze = [
|
|
|
1189
1220
|
"onMediaChange",
|
|
1190
1221
|
"onReady",
|
|
1191
1222
|
"onError"
|
|
1192
|
-
]))), 128))], 6), u(
|
|
1223
|
+
]))), 128))], 6), u(ne, {
|
|
1193
1224
|
actions: t.feedFooterActions,
|
|
1194
1225
|
"can-retry-end": t.canRetryEnd,
|
|
1195
1226
|
"feed-footer": t.feedFooter,
|
|
@@ -1211,7 +1242,7 @@ var ze = [
|
|
|
1211
1242
|
"load-more-locked",
|
|
1212
1243
|
"show-load-more",
|
|
1213
1244
|
"state"
|
|
1214
|
-
])], 42,
|
|
1245
|
+
])], 42, it), u(fe, {
|
|
1215
1246
|
"content-size": M.value.height,
|
|
1216
1247
|
"controls-id": f,
|
|
1217
1248
|
"scroll-element": d.value,
|
|
@@ -1222,8 +1253,8 @@ var ze = [
|
|
|
1222
1253
|
"suspended"
|
|
1223
1254
|
])]));
|
|
1224
1255
|
}
|
|
1225
|
-
}),
|
|
1226
|
-
function
|
|
1256
|
+
}), dt = 300;
|
|
1257
|
+
function ft(e, t, n) {
|
|
1227
1258
|
let r = e.scrollTop;
|
|
1228
1259
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
1229
1260
|
e.setAttribute("data-transitioning", "");
|
|
@@ -1231,7 +1262,7 @@ function ut(e, t, n) {
|
|
|
1231
1262
|
return new Promise((n) => {
|
|
1232
1263
|
let o = (s) => {
|
|
1233
1264
|
a += 1;
|
|
1234
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
1265
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / dt), u = 1 - (1 - l) ** 3;
|
|
1235
1266
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
1236
1267
|
requestAnimationFrame(o);
|
|
1237
1268
|
return;
|
|
@@ -1243,7 +1274,7 @@ function ut(e, t, n) {
|
|
|
1243
1274
|
}
|
|
1244
1275
|
//#endregion
|
|
1245
1276
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1246
|
-
var
|
|
1277
|
+
var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
1247
1278
|
__name: "ReelAutoAdvanceProgress",
|
|
1248
1279
|
props: {
|
|
1249
1280
|
durationMs: {},
|
|
@@ -1261,9 +1292,9 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1261
1292
|
class: "reel-auto-advance-progress",
|
|
1262
1293
|
style: _(a.value),
|
|
1263
1294
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1264
|
-
}, null, 36)], 8,
|
|
1295
|
+
}, null, 36)], 8, pt));
|
|
1265
1296
|
}
|
|
1266
|
-
}),
|
|
1297
|
+
}), ht = { class: "reel-viewport" }, gt = ["data-active-post-id", "data-active-media-index"], _t = ["role", "data-status"], vt = 2, yt = 300, bt = /* @__PURE__ */ d({
|
|
1267
1298
|
__name: "ReelFeed",
|
|
1268
1299
|
props: {
|
|
1269
1300
|
initialPostId: {},
|
|
@@ -1301,7 +1332,7 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1301
1332
|
],
|
|
1302
1333
|
setup(t, { expose: n, emit: i }) {
|
|
1303
1334
|
let l = t, u = i, d = w(null), f = w(null), p = l.initialPostId === null || l.initialPostId === void 0 ? -1 : l.items.findIndex((e) => e.postId === l.initialPostId), g = w(Math.max(0, p)), x = w(!1), C = w(!1), D = 0, k = null, A = null, j = null, N = r(() => ({ gridTemplateRows: `repeat(${l.items.length}, 100cqh)` })), I = r(() => {
|
|
1304
|
-
let e = Math.max(0, g.value -
|
|
1335
|
+
let e = Math.max(0, g.value - vt), t = Math.min(l.items.length - 1, g.value + vt);
|
|
1305
1336
|
return l.items.slice(e, t + 1).map((t, n) => ({
|
|
1306
1337
|
fetchPriority: e + n === g.value ? "high" : "low",
|
|
1307
1338
|
index: e + n,
|
|
@@ -1318,7 +1349,7 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1318
1349
|
if (!e) return "";
|
|
1319
1350
|
let t = P(e, z.value);
|
|
1320
1351
|
return l.mediaSource === "original" ? t.src : t.preview.src;
|
|
1321
|
-
}), H = r(() => B.value === "ready" &&
|
|
1352
|
+
}), H = r(() => B.value === "ready" && Ae(V.value)), ee = r(() => [
|
|
1322
1353
|
L.value,
|
|
1323
1354
|
z.value,
|
|
1324
1355
|
l.items.length,
|
|
@@ -1326,49 +1357,49 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1326
1357
|
l.reelAutoAdvance.enabled,
|
|
1327
1358
|
l.reelAutoAdvance.includePostItems,
|
|
1328
1359
|
l.reelAutoAdvance.intervalMs
|
|
1329
|
-
].join(":")),
|
|
1360
|
+
].join(":")), te = r(() => {
|
|
1330
1361
|
let e = R.value, t = !!(e && l.reelAutoAdvance.includePostItems && z.value < M(e).length - 1), n = l.reelAutoAdvance.intervalMs / 1e3;
|
|
1331
1362
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
1332
|
-
}),
|
|
1333
|
-
function
|
|
1363
|
+
}), re = r(() => l.reelAutoAdvance.enabled && l.reelForward.status === "idle" && R.value !== void 0 && B.value !== "loading" && !H.value), ie = r(() => !l.infiniteScroll || l.items.length <= 1), U = r(() => l.reelForward.status === "loading" ? "Loading the next media…" : l.reelForward.status === "error" ? "Unable to load the next media." : "You reached the end of this feed.");
|
|
1364
|
+
function W(e) {
|
|
1334
1365
|
return { gridRow: `${e + 1}` };
|
|
1335
1366
|
}
|
|
1336
|
-
function
|
|
1367
|
+
function oe(e) {
|
|
1337
1368
|
let t = D || e.clientHeight;
|
|
1338
1369
|
return t <= 0 || l.items.length === 0 ? 0 : Math.min(l.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
1339
1370
|
}
|
|
1340
|
-
function
|
|
1371
|
+
function se(e) {
|
|
1341
1372
|
let t = e.currentTarget;
|
|
1342
1373
|
if (!t) return;
|
|
1343
1374
|
let n = D || t.clientHeight, r = Math.max(0, l.items.length - 1) * n;
|
|
1344
|
-
x.value = l.items.length > 0 && t.scrollTop > r + 1, C.value || (g.value =
|
|
1375
|
+
x.value = l.items.length > 0 && t.scrollTop > r + 1, C.value || (g.value = oe(t)), !l.loadMoreLocked && l.infiniteScroll && ae(t) && u("loadMore");
|
|
1345
1376
|
}
|
|
1346
|
-
function
|
|
1377
|
+
function G() {
|
|
1347
1378
|
let e = d.value;
|
|
1348
|
-
e && (x.value = !1,
|
|
1379
|
+
e && (x.value = !1, ce(!0), D = e.clientHeight, e.scrollTop = g.value * D, A !== null && cancelAnimationFrame(A), A = requestAnimationFrame(() => {
|
|
1349
1380
|
e.scrollTop = g.value * e.clientHeight, D = e.clientHeight, A = null;
|
|
1350
|
-
}),
|
|
1381
|
+
}), K());
|
|
1351
1382
|
}
|
|
1352
|
-
function
|
|
1383
|
+
function K() {
|
|
1353
1384
|
j !== null && clearTimeout(j), j = setTimeout(() => {
|
|
1354
1385
|
j = null;
|
|
1355
1386
|
let e = d.value;
|
|
1356
|
-
e && (D = e.clientHeight, e.scrollTop = g.value * D),
|
|
1387
|
+
e && (D = e.clientHeight, e.scrollTop = g.value * D), ce(!1);
|
|
1357
1388
|
}, 120);
|
|
1358
1389
|
}
|
|
1359
|
-
function
|
|
1360
|
-
|
|
1390
|
+
function q() {
|
|
1391
|
+
ce(!0);
|
|
1361
1392
|
let e = d.value;
|
|
1362
|
-
e && (D = e.clientHeight, e.scrollTop = g.value * D),
|
|
1393
|
+
e && (D = e.clientHeight, e.scrollTop = g.value * D), K();
|
|
1363
1394
|
}
|
|
1364
|
-
function
|
|
1395
|
+
function ce(e) {
|
|
1365
1396
|
C.value = e, d.value?.toggleAttribute("data-resizing", e);
|
|
1366
1397
|
}
|
|
1367
|
-
function
|
|
1398
|
+
function le() {
|
|
1368
1399
|
let e = d.value;
|
|
1369
|
-
!l.loadMoreLocked && e &&
|
|
1400
|
+
!l.loadMoreLocked && e && ae(e) && u("loadMore");
|
|
1370
1401
|
}
|
|
1371
|
-
function
|
|
1402
|
+
function J(e) {
|
|
1372
1403
|
let t = R.value;
|
|
1373
1404
|
if (!t) return !1;
|
|
1374
1405
|
let n = M(t).length;
|
|
@@ -1376,22 +1407,22 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1376
1407
|
let r = (z.value + e + n) % n;
|
|
1377
1408
|
return u("mediaChange", t.postId, r), !0;
|
|
1378
1409
|
}
|
|
1379
|
-
function
|
|
1410
|
+
function ue(e) {
|
|
1380
1411
|
let t = g.value + e;
|
|
1381
1412
|
return !d.value || t < 0 || t >= l.items.length ? !1 : (X(t), !0);
|
|
1382
1413
|
}
|
|
1383
|
-
function
|
|
1414
|
+
function de(e, t) {
|
|
1384
1415
|
let n = l.items.findIndex((t) => t.postId === e), r = l.items[n];
|
|
1385
1416
|
return !d.value || !r || t < 0 || t > r.items.length ? !1 : ((l.mediaIndices.get(e) ?? 0) !== t && u("mediaChange", e, t), n !== g.value && X(n), !0);
|
|
1386
1417
|
}
|
|
1387
|
-
function
|
|
1418
|
+
function Y() {
|
|
1388
1419
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1389
1420
|
}
|
|
1390
1421
|
function fe(e) {
|
|
1391
1422
|
let t = d.value;
|
|
1392
1423
|
if (!t) return Promise.resolve();
|
|
1393
1424
|
let n = e * (D || t.clientHeight);
|
|
1394
|
-
return g.value = e,
|
|
1425
|
+
return g.value = e, ft(t, n, Y());
|
|
1395
1426
|
}
|
|
1396
1427
|
function X(e) {
|
|
1397
1428
|
fe(e);
|
|
@@ -1401,7 +1432,7 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1401
1432
|
return t < 0 || t === g.value ? !1 : (await fe(t), !0);
|
|
1402
1433
|
}
|
|
1403
1434
|
async function pe(e) {
|
|
1404
|
-
return
|
|
1435
|
+
return J(e) ? (Y() || await new Promise((e) => setTimeout(e, yt)), !0) : !1;
|
|
1405
1436
|
}
|
|
1406
1437
|
function me() {
|
|
1407
1438
|
if (!l.reelAutoAdvance.enabled) return;
|
|
@@ -1422,23 +1453,23 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1422
1453
|
!l.reelAutoAdvance.enabled || e !== L.value || t !== z.value || !H.value || me();
|
|
1423
1454
|
}
|
|
1424
1455
|
return O(d, (e) => {
|
|
1425
|
-
k?.disconnect(), k = null, e && (D = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(
|
|
1456
|
+
k?.disconnect(), k = null, e && (D = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(G), k.observe(e)));
|
|
1426
1457
|
}), O(() => l.items.length, async (e) => {
|
|
1427
1458
|
let t = l.initialPostId, n = t == null ? -1 : l.items.findIndex(({ postId: e }) => e === t);
|
|
1428
|
-
g.value = n >= 0 ? n : Math.min(g.value, Math.max(0, e - 1)), await m(),
|
|
1459
|
+
g.value = n >= 0 ? n : Math.min(g.value, Math.max(0, e - 1)), await m(), G();
|
|
1429
1460
|
}), O(L, (e) => {
|
|
1430
1461
|
e !== void 0 && u("activeChange", e);
|
|
1431
1462
|
}, { immediate: !0 }), y(() => {
|
|
1432
|
-
window.addEventListener("resize",
|
|
1463
|
+
window.addEventListener("resize", q), window.addEventListener("orientationchange", q), p >= 0 && m(G);
|
|
1433
1464
|
}), v(() => {
|
|
1434
|
-
window.removeEventListener("resize",
|
|
1465
|
+
window.removeEventListener("resize", q), window.removeEventListener("orientationchange", q), k?.disconnect(), A !== null && cancelAnimationFrame(A), j !== null && clearTimeout(j);
|
|
1435
1466
|
}), n({
|
|
1436
1467
|
activeIndex: g,
|
|
1437
1468
|
activePostId: L,
|
|
1438
|
-
changeActiveMedia:
|
|
1439
|
-
loadIfNearBottom:
|
|
1440
|
-
moveActivePost:
|
|
1441
|
-
navigateToItem:
|
|
1469
|
+
changeActiveMedia: J,
|
|
1470
|
+
loadIfNearBottom: le,
|
|
1471
|
+
moveActivePost: ue,
|
|
1472
|
+
navigateToItem: de,
|
|
1442
1473
|
transitionActiveMedia: pe,
|
|
1443
1474
|
transitionActivePost: Z
|
|
1444
1475
|
}), (n, r) => (b(), s("main", {
|
|
@@ -1448,7 +1479,7 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1448
1479
|
}]),
|
|
1449
1480
|
"data-layout-mode": "reel"
|
|
1450
1481
|
}, [
|
|
1451
|
-
t.cardHeader && R.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1482
|
+
t.cardHeader && R.value && t.reelForward.status === "idle" ? (b(), a(je, {
|
|
1452
1483
|
key: 0,
|
|
1453
1484
|
index: g.value,
|
|
1454
1485
|
item: R.value,
|
|
@@ -1470,19 +1501,19 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1470
1501
|
"style",
|
|
1471
1502
|
"total"
|
|
1472
1503
|
])) : o("", !0),
|
|
1473
|
-
c("div",
|
|
1504
|
+
c("div", ht, [c("div", {
|
|
1474
1505
|
ref_key: "galleryElement",
|
|
1475
1506
|
ref: d,
|
|
1476
1507
|
class: "gallery-shell reel-feed",
|
|
1477
1508
|
"data-active-post-id": L.value,
|
|
1478
1509
|
"data-active-media-index": z.value,
|
|
1479
|
-
onScrollPassive:
|
|
1510
|
+
onScrollPassive: se
|
|
1480
1511
|
}, [t.reelForward.status === "idle" ? (b(), s("section", {
|
|
1481
1512
|
key: 1,
|
|
1482
1513
|
class: "reel-track",
|
|
1483
1514
|
style: _(N.value),
|
|
1484
1515
|
"aria-label": "Media gallery"
|
|
1485
|
-
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(
|
|
1516
|
+
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(nt, {
|
|
1486
1517
|
key: n.postId,
|
|
1487
1518
|
active: r === g.value && !x.value,
|
|
1488
1519
|
"advance-on-media-end": l.reelAutoAdvance.enabled && r === g.value,
|
|
@@ -1491,7 +1522,7 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1491
1522
|
"fetch-priority": e,
|
|
1492
1523
|
index: r,
|
|
1493
1524
|
item: n,
|
|
1494
|
-
"item-style":
|
|
1525
|
+
"item-style": W(r),
|
|
1495
1526
|
"media-card": t.mediaCard,
|
|
1496
1527
|
layout: "reel",
|
|
1497
1528
|
"loaded-count": t.items.length,
|
|
@@ -1528,12 +1559,12 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1528
1559
|
class: "reel-forward-status",
|
|
1529
1560
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
1530
1561
|
"data-status": t.reelForward.status
|
|
1531
|
-
}, [c("p", null, T(
|
|
1562
|
+
}, [c("p", null, T(U.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
|
|
1532
1563
|
key: 0,
|
|
1533
1564
|
class: "reel-forward-retry",
|
|
1534
1565
|
type: "button",
|
|
1535
1566
|
onClick: r[0] ||= (e) => u("retryForward")
|
|
1536
|
-
}, " Retry ")) : o("", !0)], 8,
|
|
1567
|
+
}, " Retry ")) : o("", !0)], 8, _t)), t.reelForward.status === "idle" ? (b(), a(ne, {
|
|
1537
1568
|
key: 2,
|
|
1538
1569
|
actions: t.feedFooterActions,
|
|
1539
1570
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -1542,7 +1573,7 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1542
1573
|
"has-next": t.hasNext,
|
|
1543
1574
|
"is-loading": t.isLoadingMore,
|
|
1544
1575
|
"load-more-locked": t.loadMoreLocked,
|
|
1545
|
-
"show-load-more":
|
|
1576
|
+
"show-load-more": ie.value,
|
|
1546
1577
|
state: t.state,
|
|
1547
1578
|
onLoadMore: r[1] ||= (e) => u("loadMore"),
|
|
1548
1579
|
onRetryEnd: r[2] ||= (e) => u("retryEnd")
|
|
@@ -1556,13 +1587,13 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1556
1587
|
"load-more-locked",
|
|
1557
1588
|
"show-load-more",
|
|
1558
1589
|
"state"
|
|
1559
|
-
])) : o("", !0)], 40,
|
|
1590
|
+
])) : o("", !0)], 40, gt), c("div", {
|
|
1560
1591
|
ref_key: "reelControlsElement",
|
|
1561
1592
|
ref: f,
|
|
1562
1593
|
class: "reel-media-controls-host",
|
|
1563
1594
|
"data-test": "reel-media-controls-host"
|
|
1564
1595
|
}, null, 512)]),
|
|
1565
|
-
t.cardFooter && R.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1596
|
+
t.cardFooter && R.value && t.reelForward.status === "idle" ? (b(), a(je, {
|
|
1566
1597
|
key: 1,
|
|
1567
1598
|
index: g.value,
|
|
1568
1599
|
item: R.value,
|
|
@@ -1584,24 +1615,24 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1584
1615
|
"style",
|
|
1585
1616
|
"total"
|
|
1586
1617
|
])) : o("", !0),
|
|
1587
|
-
|
|
1588
|
-
key:
|
|
1618
|
+
re.value ? (b(), a(mt, {
|
|
1619
|
+
key: ee.value,
|
|
1589
1620
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1590
|
-
label:
|
|
1621
|
+
label: te.value,
|
|
1591
1622
|
onComplete: me
|
|
1592
1623
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
1593
1624
|
], 2));
|
|
1594
1625
|
}
|
|
1595
|
-
}),
|
|
1626
|
+
}), xt = ["data-info-sheet-open", "data-info-sheet-mode"], St = ["aria-hidden", "inert"], Ct = {
|
|
1596
1627
|
key: 0,
|
|
1597
1628
|
class: "reel-info-sheet-layer",
|
|
1598
1629
|
"data-test": "reel-info-sheet"
|
|
1599
|
-
},
|
|
1630
|
+
}, wt = [
|
|
1600
1631
|
"role",
|
|
1601
1632
|
"aria-modal",
|
|
1602
1633
|
"tabindex",
|
|
1603
1634
|
"data-active-post-id"
|
|
1604
|
-
],
|
|
1635
|
+
], Tt = /* @__PURE__ */ d({
|
|
1605
1636
|
__name: "ReelLayout",
|
|
1606
1637
|
props: {
|
|
1607
1638
|
forwardIndex: { default: null },
|
|
@@ -1694,7 +1725,7 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1694
1725
|
function H(e, t) {
|
|
1695
1726
|
d("mediaChange", e, t);
|
|
1696
1727
|
}
|
|
1697
|
-
function
|
|
1728
|
+
function ee(e, t) {
|
|
1698
1729
|
d("ready", e, t);
|
|
1699
1730
|
}
|
|
1700
1731
|
return O(() => ({
|
|
@@ -1726,7 +1757,7 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1726
1757
|
class: "reel-layout-main",
|
|
1727
1758
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
1728
1759
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
1729
|
-
}, [u(
|
|
1760
|
+
}, [u(bt, {
|
|
1730
1761
|
ref_key: "reelFeed",
|
|
1731
1762
|
ref: p,
|
|
1732
1763
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -1753,7 +1784,7 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1753
1784
|
onError: V,
|
|
1754
1785
|
onLoadMore: r[1] ||= (e) => d("loadMore"),
|
|
1755
1786
|
onMediaChange: H,
|
|
1756
|
-
onReady:
|
|
1787
|
+
onReady: ee,
|
|
1757
1788
|
onRetryEnd: r[2] ||= (e) => d("retryEnd"),
|
|
1758
1789
|
onRetryForward: r[3] ||= (e) => d("retryForward")
|
|
1759
1790
|
}, null, 8, [
|
|
@@ -1777,8 +1808,8 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1777
1808
|
"reel-forward",
|
|
1778
1809
|
"state",
|
|
1779
1810
|
"total"
|
|
1780
|
-
])], 8,
|
|
1781
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
1811
|
+
])], 8, St), u(n, { name: "vibe-info-sheet" }, {
|
|
1812
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", Ct, [c("aside", {
|
|
1782
1813
|
ref_key: "sheetElement",
|
|
1783
1814
|
ref: _,
|
|
1784
1815
|
class: "reel-info-sheet",
|
|
@@ -1787,20 +1818,20 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1787
1818
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
1788
1819
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
1789
1820
|
"data-active-post-id": T.value?.postId
|
|
1790
|
-
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8,
|
|
1821
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, wt)])) : o("", !0)]),
|
|
1791
1822
|
_: 1
|
|
1792
|
-
})], 10,
|
|
1823
|
+
})], 10, xt));
|
|
1793
1824
|
}
|
|
1794
|
-
}),
|
|
1795
|
-
function
|
|
1796
|
-
return
|
|
1797
|
-
let t =
|
|
1798
|
-
t >= 0 &&
|
|
1825
|
+
}), Et = [];
|
|
1826
|
+
function Dt(e) {
|
|
1827
|
+
return Et.push(e), () => {
|
|
1828
|
+
let t = Et.indexOf(e);
|
|
1829
|
+
t >= 0 && Et.splice(t, 1);
|
|
1799
1830
|
};
|
|
1800
1831
|
}
|
|
1801
|
-
function
|
|
1832
|
+
function Ot(e) {
|
|
1802
1833
|
if (!e.isActive()) return !1;
|
|
1803
|
-
let t =
|
|
1834
|
+
let t = Et.filter((e) => e.isActive()), n = e.element();
|
|
1804
1835
|
return n !== null && t.some((t) => {
|
|
1805
1836
|
if (t === e) return !1;
|
|
1806
1837
|
let r = t.element();
|
|
@@ -1816,14 +1847,14 @@ function Et(e) {
|
|
|
1816
1847
|
}
|
|
1817
1848
|
//#endregion
|
|
1818
1849
|
//#region src/components/useReelKeyboard.ts
|
|
1819
|
-
function
|
|
1850
|
+
function kt(e) {
|
|
1820
1851
|
let t = {
|
|
1821
1852
|
element: e.element,
|
|
1822
1853
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
1823
1854
|
}, n = null;
|
|
1824
1855
|
function r(n) {
|
|
1825
1856
|
let r = t.isActive();
|
|
1826
|
-
if (n.key === "Escape" && r && !
|
|
1857
|
+
if (n.key === "Escape" && r && !Ot(t)) return;
|
|
1827
1858
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
1828
1859
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
1829
1860
|
return;
|
|
@@ -1843,14 +1874,14 @@ function Dt(e) {
|
|
|
1843
1874
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
1844
1875
|
}
|
|
1845
1876
|
y(() => {
|
|
1846
|
-
n =
|
|
1877
|
+
n = Dt(t), window.addEventListener("keydown", r);
|
|
1847
1878
|
}), v(() => {
|
|
1848
1879
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
1849
1880
|
});
|
|
1850
1881
|
}
|
|
1851
1882
|
//#endregion
|
|
1852
1883
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
1853
|
-
var
|
|
1884
|
+
var At = 35, jt = 420, Mt = /* @__PURE__ */ d({
|
|
1854
1885
|
__name: "VibeSurface",
|
|
1855
1886
|
props: {
|
|
1856
1887
|
canRetryEnd: { type: Boolean },
|
|
@@ -1866,106 +1897,105 @@ var Ot = 35, kt = 420, At = /* @__PURE__ */ d({
|
|
|
1866
1897
|
"activeReelChange",
|
|
1867
1898
|
"closeReel",
|
|
1868
1899
|
"loadMore",
|
|
1900
|
+
"mediaReady",
|
|
1869
1901
|
"openReel",
|
|
1902
|
+
"reelMediaChange",
|
|
1870
1903
|
"reelInfoSheetChange",
|
|
1871
1904
|
"retryEnd",
|
|
1872
1905
|
"retryForward"
|
|
1873
1906
|
],
|
|
1874
1907
|
setup(t, { expose: i, emit: c }) {
|
|
1875
|
-
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), E = w(/* @__PURE__ */ new Map()), D = w(/* @__PURE__ */ new Map()), A = w(/* @__PURE__ */ new Map()), j = r(() =>
|
|
1876
|
-
function
|
|
1908
|
+
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), E = w(/* @__PURE__ */ new Map()), D = w(/* @__PURE__ */ new Map()), A = w(/* @__PURE__ */ new Map()), j = r(() => R(l.state)), P = r(() => l.state.reelMediaSource === "original" ? A.value : D.value), z = new Set(l.state.items.map((e) => e.postId)), B = null, V = null, H = !1;
|
|
1909
|
+
function ee() {
|
|
1877
1910
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1878
1911
|
}
|
|
1879
|
-
function
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1912
|
+
function te() {
|
|
1913
|
+
B !== null && cancelAnimationFrame(B), B = requestAnimationFrame(() => {
|
|
1914
|
+
B = requestAnimationFrame(() => {
|
|
1915
|
+
B = null, S.value = /* @__PURE__ */ new Set();
|
|
1883
1916
|
});
|
|
1884
1917
|
});
|
|
1885
1918
|
}
|
|
1886
|
-
function
|
|
1919
|
+
function ne(e, t, n) {
|
|
1887
1920
|
let r = F(e, t);
|
|
1888
1921
|
D.value.get(r) !== n && (D.value = new Map(D.value).set(r, n));
|
|
1889
1922
|
}
|
|
1890
|
-
function
|
|
1923
|
+
function re(e, t, n) {
|
|
1891
1924
|
let r = F(e, t);
|
|
1892
1925
|
A.value.get(r) !== n && (A.value = new Map(A.value).set(r, n));
|
|
1893
1926
|
}
|
|
1894
|
-
function
|
|
1895
|
-
|
|
1896
|
-
}
|
|
1897
|
-
function G(e, t) {
|
|
1898
|
-
U(e, t, "ready");
|
|
1927
|
+
function ie(e, t) {
|
|
1928
|
+
ne(e, t, "error");
|
|
1899
1929
|
}
|
|
1900
|
-
function
|
|
1901
|
-
|
|
1930
|
+
function ae(e, t) {
|
|
1931
|
+
ne(e, t, "ready"), G(e, t, "masonry", null);
|
|
1902
1932
|
}
|
|
1903
|
-
function
|
|
1904
|
-
|
|
1933
|
+
function W(e, t) {
|
|
1934
|
+
re(e, t, "error");
|
|
1905
1935
|
}
|
|
1906
|
-
function
|
|
1936
|
+
function oe(e, t) {
|
|
1907
1937
|
if (l.state.reelMediaSource === "original") {
|
|
1908
|
-
|
|
1938
|
+
W(e, t);
|
|
1909
1939
|
return;
|
|
1910
1940
|
}
|
|
1911
|
-
|
|
1941
|
+
ie(e, t);
|
|
1912
1942
|
}
|
|
1913
|
-
function
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1943
|
+
function se(e, t) {
|
|
1944
|
+
l.state.reelMediaSource === "original" ? re(e, t, "ready") : ne(e, t, "ready"), G(e, t, "reel", l.state.reelOrigin ?? "reel");
|
|
1945
|
+
}
|
|
1946
|
+
function G(e, t, n, r) {
|
|
1947
|
+
let i = I(l.state, e, t, n, r);
|
|
1948
|
+
i && d("mediaReady", i);
|
|
1919
1949
|
}
|
|
1920
|
-
function
|
|
1950
|
+
function K(e, t) {
|
|
1921
1951
|
let n = l.state.items.find((t) => t.postId === e);
|
|
1922
1952
|
if (!n) return;
|
|
1923
1953
|
let r = N(n, t);
|
|
1924
1954
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
1925
1955
|
}
|
|
1926
|
-
async function
|
|
1956
|
+
async function q() {
|
|
1927
1957
|
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
1928
1958
|
}
|
|
1929
|
-
function
|
|
1959
|
+
function ce(e) {
|
|
1930
1960
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
1931
1961
|
}
|
|
1932
|
-
function
|
|
1962
|
+
function le(e) {
|
|
1933
1963
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
1934
1964
|
}
|
|
1935
|
-
function
|
|
1965
|
+
function J(e) {
|
|
1936
1966
|
if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
|
|
1937
1967
|
let t = l.state.items.find((t) => t.postId === e.postId);
|
|
1938
1968
|
if (!t) return "not-found";
|
|
1939
1969
|
let n = M(t).findIndex((t) => t.mediaId === e.mediaId);
|
|
1940
1970
|
return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
|
|
1941
1971
|
}
|
|
1942
|
-
function
|
|
1972
|
+
function ue() {
|
|
1943
1973
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
1944
1974
|
}
|
|
1945
|
-
function
|
|
1946
|
-
|
|
1975
|
+
function de(e, t) {
|
|
1976
|
+
V = e, H = t === "keyboard", y.value = Z(e), d("openReel", e), m(() => h.value?.focus());
|
|
1947
1977
|
}
|
|
1948
|
-
function
|
|
1978
|
+
function Y(e) {
|
|
1949
1979
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
1950
1980
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
1951
1981
|
}
|
|
1952
|
-
function
|
|
1953
|
-
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null ||
|
|
1954
|
-
let t = [...new Set(e)], n = t.filter(
|
|
1982
|
+
function fe(e) {
|
|
1983
|
+
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || ee()) return 0;
|
|
1984
|
+
let t = [...new Set(e)], n = t.filter(Y);
|
|
1955
1985
|
if (n.length === 0) return 0;
|
|
1956
1986
|
let r = new Map(E.value);
|
|
1957
1987
|
return n.forEach((e, t) => {
|
|
1958
|
-
r.set(e, t *
|
|
1959
|
-
}), S.value = new Set([...S.value].filter((e) => !n.includes(e))), T.value = new Set([...T.value, ...t]), E.value = r,
|
|
1988
|
+
r.set(e, t * At);
|
|
1989
|
+
}), S.value = new Set([...S.value].filter((e) => !n.includes(e))), T.value = new Set([...T.value, ...t]), E.value = r, jt + (n.length - 1) * At;
|
|
1960
1990
|
}
|
|
1961
|
-
function
|
|
1962
|
-
let n =
|
|
1991
|
+
function X(e, t) {
|
|
1992
|
+
let n = Y(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
1963
1993
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
1964
1994
|
r.classList.remove("media-card-focus-silent");
|
|
1965
1995
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
1966
1996
|
}
|
|
1967
|
-
function
|
|
1968
|
-
let t = g.value, n =
|
|
1997
|
+
function Z(e) {
|
|
1998
|
+
let t = g.value, n = Y(e);
|
|
1969
1999
|
if (t === null || n === null) return {};
|
|
1970
2000
|
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
1971
2001
|
return {
|
|
@@ -1975,48 +2005,48 @@ var Ot = 35, kt = 420, At = /* @__PURE__ */ d({
|
|
|
1975
2005
|
"--vibe-reel-origin-left": `${Math.max(0, i.left - r.left)}px`
|
|
1976
2006
|
};
|
|
1977
2007
|
}
|
|
1978
|
-
function
|
|
1979
|
-
l.state.reelOrigin === "masonry" && (
|
|
2008
|
+
function pe() {
|
|
2009
|
+
l.state.reelOrigin === "masonry" && (V ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
|
|
1980
2010
|
}
|
|
1981
|
-
function
|
|
1982
|
-
let e =
|
|
1983
|
-
x.value = !1,
|
|
1984
|
-
e !== null &&
|
|
2011
|
+
function me() {
|
|
2012
|
+
let e = V, t = H;
|
|
2013
|
+
x.value = !1, V = null, H = !1, y.value = {}, m(() => {
|
|
2014
|
+
e !== null && X(e, t);
|
|
1985
2015
|
});
|
|
1986
2016
|
}
|
|
1987
|
-
return
|
|
1988
|
-
closeMasonryReel:
|
|
2017
|
+
return kt({
|
|
2018
|
+
closeMasonryReel: pe,
|
|
1989
2019
|
element: () => g.value,
|
|
1990
2020
|
isReelLeaving: () => x.value,
|
|
1991
2021
|
reelRenderer: () => p.value,
|
|
1992
2022
|
setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
|
|
1993
2023
|
state: l.state
|
|
1994
|
-
}), O(() => l.state.items.map((e) => e.postId), (e) => {
|
|
1995
|
-
let t = e.filter((e) => !
|
|
1996
|
-
if (
|
|
2024
|
+
}), L(l.state, (e) => d("reelMediaChange", e)), O(() => l.state.items.map((e) => e.postId), (e) => {
|
|
2025
|
+
let t = e.filter((e) => !z.has(e)), n = new Set(e);
|
|
2026
|
+
if (z = new Set(e), T.value = new Set([...T.value].filter((e) => n.has(e))), E.value = new Map([...E.value].filter(([e]) => n.has(e))), t.length === 0 || ee()) return;
|
|
1997
2027
|
let r = /* @__PURE__ */ new Map();
|
|
1998
2028
|
e.forEach((e) => {
|
|
1999
2029
|
let t = C.value.get(e);
|
|
2000
2030
|
t !== void 0 && r.set(e, t);
|
|
2001
2031
|
}), t.forEach((e, t) => {
|
|
2002
|
-
r.set(e, t *
|
|
2003
|
-
}), C.value = r, S.value = new Set([...S.value, ...t]),
|
|
2032
|
+
r.set(e, t * At);
|
|
2033
|
+
}), C.value = r, S.value = new Set([...S.value, ...t]), te();
|
|
2004
2034
|
}, { flush: "sync" }), v(() => {
|
|
2005
|
-
|
|
2035
|
+
B !== null && cancelAnimationFrame(B);
|
|
2006
2036
|
}), i({
|
|
2007
|
-
changeActiveReelMedia:
|
|
2008
|
-
getAutoScrollElement:
|
|
2009
|
-
loadIfNearBottom:
|
|
2010
|
-
moveActiveReelPost:
|
|
2011
|
-
navigateToReelItem:
|
|
2012
|
-
startItemRemoval:
|
|
2037
|
+
changeActiveReelMedia: ce,
|
|
2038
|
+
getAutoScrollElement: ue,
|
|
2039
|
+
loadIfNearBottom: q,
|
|
2040
|
+
moveActiveReelPost: le,
|
|
2041
|
+
navigateToReelItem: J,
|
|
2042
|
+
startItemRemoval: fe,
|
|
2013
2043
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
2014
2044
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
2015
2045
|
}), (r, i) => (b(), s("div", {
|
|
2016
2046
|
ref_key: "surfaceElement",
|
|
2017
2047
|
ref: g,
|
|
2018
2048
|
class: "vibe-surface"
|
|
2019
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
2049
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Tt, {
|
|
2020
2050
|
key: 0,
|
|
2021
2051
|
ref_key: "reelRenderer",
|
|
2022
2052
|
ref: p,
|
|
@@ -2048,10 +2078,10 @@ var Ot = 35, kt = 420, At = /* @__PURE__ */ d({
|
|
|
2048
2078
|
total: t.state.total,
|
|
2049
2079
|
onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
|
|
2050
2080
|
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2051
|
-
onError:
|
|
2081
|
+
onError: oe,
|
|
2052
2082
|
onLoadMore: i[2] ||= (e) => d("loadMore"),
|
|
2053
|
-
onMediaChange:
|
|
2054
|
-
onReady:
|
|
2083
|
+
onMediaChange: K,
|
|
2084
|
+
onReady: se,
|
|
2055
2085
|
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
2056
2086
|
onRetryForward: i[4] ||= (e) => d("retryForward")
|
|
2057
2087
|
}, null, 8, [
|
|
@@ -2080,7 +2110,7 @@ var Ot = 35, kt = 420, At = /* @__PURE__ */ d({
|
|
|
2080
2110
|
"reel-forward",
|
|
2081
2111
|
"state",
|
|
2082
2112
|
"total"
|
|
2083
|
-
])) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(
|
|
2113
|
+
])) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(U, {
|
|
2084
2114
|
key: 1,
|
|
2085
2115
|
actions: t.feedFooterActions,
|
|
2086
2116
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2093,7 +2123,7 @@ var Ot = 35, kt = 420, At = /* @__PURE__ */ d({
|
|
|
2093
2123
|
"can-retry-end",
|
|
2094
2124
|
"feed-footer",
|
|
2095
2125
|
"state"
|
|
2096
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
2126
|
+
])) : (b(), s(e, { key: 2 }, [u(ut, {
|
|
2097
2127
|
ref_key: "masonryRenderer",
|
|
2098
2128
|
ref: f,
|
|
2099
2129
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2117,11 +2147,11 @@ var Ot = 35, kt = 420, At = /* @__PURE__ */ d({
|
|
|
2117
2147
|
suspended: t.state.reelOrigin === "masonry" || x.value,
|
|
2118
2148
|
state: j.value,
|
|
2119
2149
|
total: t.state.total,
|
|
2120
|
-
onActivate:
|
|
2121
|
-
onError:
|
|
2150
|
+
onActivate: de,
|
|
2151
|
+
onError: ie,
|
|
2122
2152
|
onLoadMore: i[7] ||= (e) => d("loadMore"),
|
|
2123
|
-
onMediaChange:
|
|
2124
|
-
onReady:
|
|
2153
|
+
onMediaChange: K,
|
|
2154
|
+
onReady: ae,
|
|
2125
2155
|
onRetryEnd: i[8] ||= (e) => d("retryEnd")
|
|
2126
2156
|
}, null, 8, [
|
|
2127
2157
|
"can-retry-end",
|
|
@@ -2147,7 +2177,7 @@ var Ot = 35, kt = 420, At = /* @__PURE__ */ d({
|
|
|
2147
2177
|
"total"
|
|
2148
2178
|
]), u(n, {
|
|
2149
2179
|
name: "vibe-reel-viewer",
|
|
2150
|
-
onAfterLeave:
|
|
2180
|
+
onAfterLeave: me
|
|
2151
2181
|
}, {
|
|
2152
2182
|
default: k(() => [t.state.reelOrigin === "masonry" ? (b(), s("section", {
|
|
2153
2183
|
key: 0,
|
|
@@ -2159,7 +2189,7 @@ var Ot = 35, kt = 420, At = /* @__PURE__ */ d({
|
|
|
2159
2189
|
"aria-modal": "true",
|
|
2160
2190
|
tabindex: "-1",
|
|
2161
2191
|
style: _(y.value)
|
|
2162
|
-
}, [u(
|
|
2192
|
+
}, [u(Tt, {
|
|
2163
2193
|
ref_key: "reelRenderer",
|
|
2164
2194
|
ref: p,
|
|
2165
2195
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2190,10 +2220,10 @@ var Ot = 35, kt = 420, At = /* @__PURE__ */ d({
|
|
|
2190
2220
|
total: t.state.total,
|
|
2191
2221
|
onActiveChange: i[9] ||= (e) => d("activeReelChange", e),
|
|
2192
2222
|
onCloseInfoSheet: i[10] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2193
|
-
onError:
|
|
2223
|
+
onError: W,
|
|
2194
2224
|
onLoadMore: i[11] ||= (e) => d("loadMore"),
|
|
2195
|
-
onMediaChange:
|
|
2196
|
-
onReady:
|
|
2225
|
+
onMediaChange: K,
|
|
2226
|
+
onReady: se,
|
|
2197
2227
|
onRetryEnd: i[12] ||= (e) => d("retryEnd"),
|
|
2198
2228
|
onRetryForward: i[13] ||= (e) => d("retryForward")
|
|
2199
2229
|
}, null, 8, [
|
|
@@ -2228,7 +2258,7 @@ var Ot = 35, kt = 420, At = /* @__PURE__ */ d({
|
|
|
2228
2258
|
});
|
|
2229
2259
|
//#endregion
|
|
2230
2260
|
//#region src/core/page.ts
|
|
2231
|
-
function
|
|
2261
|
+
function Nt(e) {
|
|
2232
2262
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2233
2263
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
2234
2264
|
if (e.total !== void 0 && (!Number.isFinite(e.total) || e.total < 0)) throw TypeError("Vibe page total must be a non-negative number when provided.");
|
|
@@ -2240,32 +2270,32 @@ function Q(e, t) {
|
|
|
2240
2270
|
}
|
|
2241
2271
|
//#endregion
|
|
2242
2272
|
//#region src/core/requestDelay.ts
|
|
2243
|
-
var
|
|
2273
|
+
var Pt = 2e3, Ft = 1e4, It = 250, Lt = {
|
|
2244
2274
|
delayRemainingMs: null,
|
|
2245
2275
|
nextRequestAt: null
|
|
2246
2276
|
};
|
|
2247
|
-
function
|
|
2277
|
+
function Rt(e, t) {
|
|
2248
2278
|
return e === void 0 ? t : Math.floor(e);
|
|
2249
2279
|
}
|
|
2250
|
-
function
|
|
2280
|
+
function zt(e, t) {
|
|
2251
2281
|
for (let [n, r] of [["delayStepMs", e.delayStepMs], ["delayMaxMs", e.delayMaxMs]]) if (r !== void 0 && (!Number.isFinite(r) || r < 0)) throw TypeError(`Vibe ${t} ${n} must be a non-negative number.`);
|
|
2252
2282
|
}
|
|
2253
|
-
function
|
|
2254
|
-
let n =
|
|
2283
|
+
function Bt(e, t = {}) {
|
|
2284
|
+
let n = Rt(t.delayStepMs, Pt), r = Rt(t.delayMaxMs, Ft);
|
|
2255
2285
|
return Math.min(Math.max(0, e) * n, r);
|
|
2256
2286
|
}
|
|
2257
2287
|
function $(e) {
|
|
2258
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
2288
|
+
if (e == null || !Number.isFinite(e)) return { ...Lt };
|
|
2259
2289
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2260
2290
|
return t > 0 ? {
|
|
2261
2291
|
delayRemainingMs: t,
|
|
2262
2292
|
nextRequestAt: e
|
|
2263
|
-
} : { ...
|
|
2293
|
+
} : { ...Lt };
|
|
2264
2294
|
}
|
|
2265
|
-
async function
|
|
2295
|
+
async function Vt({ delayMs: e, onChange: t, signal: n }) {
|
|
2266
2296
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2267
2297
|
if (e <= 0) {
|
|
2268
|
-
t({ ...
|
|
2298
|
+
t({ ...Lt });
|
|
2269
2299
|
return;
|
|
2270
2300
|
}
|
|
2271
2301
|
let r = Date.now() + e;
|
|
@@ -2273,9 +2303,9 @@ async function zt({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2273
2303
|
delayRemainingMs: e,
|
|
2274
2304
|
nextRequestAt: r
|
|
2275
2305
|
}), await new Promise((i, a) => {
|
|
2276
|
-
let o = !1, s = setInterval(f,
|
|
2306
|
+
let o = !1, s = setInterval(f, It), c = setTimeout(() => u(), e);
|
|
2277
2307
|
function l() {
|
|
2278
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
2308
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Lt });
|
|
2279
2309
|
}
|
|
2280
2310
|
function u(e) {
|
|
2281
2311
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2290,13 +2320,13 @@ async function zt({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2290
2320
|
n.addEventListener("abort", d, { once: !0 });
|
|
2291
2321
|
});
|
|
2292
2322
|
}
|
|
2293
|
-
var
|
|
2323
|
+
var Ht = class {
|
|
2294
2324
|
interval = null;
|
|
2295
2325
|
constructor(e) {
|
|
2296
2326
|
this.onChange = e;
|
|
2297
2327
|
}
|
|
2298
2328
|
clear() {
|
|
2299
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
2329
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Lt });
|
|
2300
2330
|
}
|
|
2301
2331
|
sync(e) {
|
|
2302
2332
|
this.clear();
|
|
@@ -2304,22 +2334,22 @@ var Bt = class {
|
|
|
2304
2334
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2305
2335
|
let t = $(e);
|
|
2306
2336
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2307
|
-
},
|
|
2337
|
+
}, It));
|
|
2308
2338
|
}
|
|
2309
2339
|
};
|
|
2310
|
-
function
|
|
2340
|
+
function Ut(e, t = !0) {
|
|
2311
2341
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2312
2342
|
}
|
|
2313
|
-
function
|
|
2343
|
+
function Wt(e) {
|
|
2314
2344
|
return `${typeof e}:${String(e)}`;
|
|
2315
2345
|
}
|
|
2316
|
-
function
|
|
2346
|
+
function Gt(e, t) {
|
|
2317
2347
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2318
2348
|
}
|
|
2319
|
-
function
|
|
2349
|
+
function Kt(e) {
|
|
2320
2350
|
if (!e) return;
|
|
2321
|
-
if (
|
|
2322
|
-
|
|
2351
|
+
if (Gt(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
2352
|
+
zt(e, "frontend autofill");
|
|
2323
2353
|
let t = e.maxAdditionalPages;
|
|
2324
2354
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
2325
2355
|
return;
|
|
@@ -2331,7 +2361,7 @@ function Wt(e) {
|
|
|
2331
2361
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2332
2362
|
}
|
|
2333
2363
|
}
|
|
2334
|
-
function
|
|
2364
|
+
function qt(e, t, n = !0) {
|
|
2335
2365
|
if (!e) return {
|
|
2336
2366
|
cycleId: null,
|
|
2337
2367
|
delayRemainingMs: null,
|
|
@@ -2365,7 +2395,7 @@ function Gt(e, t, n = !0) {
|
|
|
2365
2395
|
strategy: e.strategy
|
|
2366
2396
|
};
|
|
2367
2397
|
}
|
|
2368
|
-
function
|
|
2398
|
+
function Jt(e) {
|
|
2369
2399
|
return [
|
|
2370
2400
|
"cancelling",
|
|
2371
2401
|
"filling",
|
|
@@ -2373,9 +2403,9 @@ function Kt(e) {
|
|
|
2373
2403
|
"waiting"
|
|
2374
2404
|
].includes(e.status);
|
|
2375
2405
|
}
|
|
2376
|
-
async function
|
|
2406
|
+
async function Yt(e, t, n) {
|
|
2377
2407
|
let r = t.autofill;
|
|
2378
|
-
if (!
|
|
2408
|
+
if (!Jt(r) || !r.cycleId) return;
|
|
2379
2409
|
let i = {
|
|
2380
2410
|
cycleId: r.cycleId,
|
|
2381
2411
|
feedKey: r.feedKey ?? "",
|
|
@@ -2388,20 +2418,20 @@ async function qt(e, t, n) {
|
|
|
2388
2418
|
throw r.error = e, r.status = "error", e;
|
|
2389
2419
|
}
|
|
2390
2420
|
}
|
|
2391
|
-
function
|
|
2421
|
+
function Xt(e, t, n) {
|
|
2392
2422
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2393
2423
|
}
|
|
2394
|
-
async function
|
|
2395
|
-
let d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = r ??
|
|
2424
|
+
async function Zt({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onCollection: i, onDelayChange: a, onProgress: o, options: s, receivedOffset: c = 0, requestOffset: l = 0, signal: u }) {
|
|
2425
|
+
let d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = r ?? Ut(s), h = t, g = t, _ = 0, v;
|
|
2396
2426
|
for (; _ < m;) {
|
|
2397
|
-
let e =
|
|
2427
|
+
let e = Wt(h);
|
|
2398
2428
|
if (p.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2399
|
-
p.add(e), await
|
|
2400
|
-
delayMs:
|
|
2429
|
+
p.add(e), await Vt({
|
|
2430
|
+
delayMs: Bt(l + _, s),
|
|
2401
2431
|
onChange: a,
|
|
2402
2432
|
signal: u
|
|
2403
2433
|
});
|
|
2404
|
-
let t =
|
|
2434
|
+
let t = Nt(await n({
|
|
2405
2435
|
cursor: h,
|
|
2406
2436
|
signal: u
|
|
2407
2437
|
}));
|
|
@@ -2444,12 +2474,12 @@ async function Yt({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2444
2474
|
}
|
|
2445
2475
|
//#endregion
|
|
2446
2476
|
//#region src/core/autofillController.ts
|
|
2447
|
-
var
|
|
2477
|
+
var Qt = class {
|
|
2448
2478
|
collection = null;
|
|
2449
2479
|
cycle = 0;
|
|
2450
2480
|
delayCountdown;
|
|
2451
2481
|
constructor(e) {
|
|
2452
|
-
this.context = e, this.delayCountdown = new
|
|
2482
|
+
this.context = e, this.delayCountdown = new Ht((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
2453
2483
|
}
|
|
2454
2484
|
beginCycle() {
|
|
2455
2485
|
let { options: e, state: t } = this.context;
|
|
@@ -2457,14 +2487,14 @@ var Xt = class {
|
|
|
2457
2487
|
this.clear();
|
|
2458
2488
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2459
2489
|
return t.autofill = {
|
|
2460
|
-
...
|
|
2490
|
+
...qt(e, void 0, !1),
|
|
2461
2491
|
cycleId: n,
|
|
2462
2492
|
status: "filling"
|
|
2463
2493
|
}, n;
|
|
2464
2494
|
}
|
|
2465
2495
|
async cancel() {
|
|
2466
2496
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
2467
|
-
await
|
|
2497
|
+
await Yt(t, n, e), this.commitCollection();
|
|
2468
2498
|
}
|
|
2469
2499
|
captureCollection(e, t) {
|
|
2470
2500
|
t && (this.collection = e);
|
|
@@ -2492,30 +2522,30 @@ var Xt = class {
|
|
|
2492
2522
|
requests: r.requests
|
|
2493
2523
|
}));
|
|
2494
2524
|
}
|
|
2495
|
-
},
|
|
2496
|
-
function
|
|
2525
|
+
}, $t = 100;
|
|
2526
|
+
function en(e, t) {
|
|
2497
2527
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2498
2528
|
}
|
|
2499
|
-
function
|
|
2529
|
+
function tn(e, t, n) {
|
|
2500
2530
|
return Math.min(n, Math.max(t, e));
|
|
2501
2531
|
}
|
|
2502
|
-
function
|
|
2532
|
+
function nn(e) {
|
|
2503
2533
|
if (!e) return;
|
|
2504
2534
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2505
|
-
if (
|
|
2506
|
-
e.speedPxPerSecond !== void 0 &&
|
|
2535
|
+
if (en("autoScroll.minSpeedPxPerSecond", t), en("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
2536
|
+
e.speedPxPerSecond !== void 0 && en("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
2507
2537
|
}
|
|
2508
|
-
function
|
|
2538
|
+
function rn(e) {
|
|
2509
2539
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2510
2540
|
return {
|
|
2511
2541
|
enabled: e?.enabled ?? !1,
|
|
2512
2542
|
maxSpeedPxPerSecond: n,
|
|
2513
2543
|
minSpeedPxPerSecond: t,
|
|
2514
2544
|
paused: !1,
|
|
2515
|
-
speedPxPerSecond:
|
|
2545
|
+
speedPxPerSecond: tn(e?.speedPxPerSecond ?? 80, t, n)
|
|
2516
2546
|
};
|
|
2517
2547
|
}
|
|
2518
|
-
var
|
|
2548
|
+
var an = class {
|
|
2519
2549
|
frame = null;
|
|
2520
2550
|
lastTimestamp = null;
|
|
2521
2551
|
mounted = !1;
|
|
@@ -2535,9 +2565,9 @@ var nn = class {
|
|
|
2535
2565
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
2536
2566
|
}
|
|
2537
2567
|
setSpeed(e) {
|
|
2538
|
-
|
|
2568
|
+
en("auto-scroll speed", e);
|
|
2539
2569
|
let t = this.options.state;
|
|
2540
|
-
t.speedPxPerSecond =
|
|
2570
|
+
t.speedPxPerSecond = tn(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
2541
2571
|
}
|
|
2542
2572
|
tick = (e) => {
|
|
2543
2573
|
this.frame = null;
|
|
@@ -2549,7 +2579,7 @@ var nn = class {
|
|
|
2549
2579
|
return;
|
|
2550
2580
|
}
|
|
2551
2581
|
if (this.lastTimestamp !== null) {
|
|
2552
|
-
let r = Math.min(
|
|
2582
|
+
let r = Math.min($t, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
2553
2583
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
2554
2584
|
}
|
|
2555
2585
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -2563,7 +2593,7 @@ var nn = class {
|
|
|
2563
2593
|
};
|
|
2564
2594
|
//#endregion
|
|
2565
2595
|
//#region src/core/backendAutofill.ts
|
|
2566
|
-
async function
|
|
2596
|
+
async function on(e, t, n, r) {
|
|
2567
2597
|
let i = await e.onUnderfilled(n);
|
|
2568
2598
|
if (!r()) return;
|
|
2569
2599
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
@@ -2577,19 +2607,19 @@ async function rn(e, t, n, r) {
|
|
|
2577
2607
|
status: "waiting"
|
|
2578
2608
|
});
|
|
2579
2609
|
}
|
|
2580
|
-
function
|
|
2610
|
+
function sn(e, t) {
|
|
2581
2611
|
["complete", "exhausted"].includes(t.status) && t.items && (e.items = Q(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
|
|
2582
2612
|
}
|
|
2583
|
-
function
|
|
2613
|
+
function cn(e, t, n) {
|
|
2584
2614
|
let r = t.autofill;
|
|
2585
|
-
return !
|
|
2615
|
+
return !Xt(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (sn(t, n), Object.assign(r, $(n.status === "waiting" ? n.nextRequestAt : null)), r.error = n.error ?? null, r.missing = Math.max(0, (r.pageSize ?? 0) - n.received), r.received = n.received, n.requests !== void 0 && (r.requests = n.requests), r.sequence = n.sequence, r.status = n.status, !0);
|
|
2586
2616
|
}
|
|
2587
|
-
function
|
|
2588
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
2617
|
+
function ln(e, t, n) {
|
|
2618
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = qt(e, n), sn(t, n), !0);
|
|
2589
2619
|
}
|
|
2590
2620
|
//#endregion
|
|
2591
2621
|
//#region src/core/initialAutofill.ts
|
|
2592
|
-
async function
|
|
2622
|
+
async function un({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, options: i, signal: a, state: o }) {
|
|
2593
2623
|
let s = i.autofill;
|
|
2594
2624
|
if (!s) return;
|
|
2595
2625
|
let c = o.items.length;
|
|
@@ -2602,7 +2632,7 @@ async function cn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2602
2632
|
return;
|
|
2603
2633
|
}
|
|
2604
2634
|
if (s.strategy === "backend") {
|
|
2605
|
-
await
|
|
2635
|
+
await on(s, o, {
|
|
2606
2636
|
cycleId: e,
|
|
2607
2637
|
feedKey: s.feedKey,
|
|
2608
2638
|
items: [...o.items],
|
|
@@ -2619,11 +2649,11 @@ async function cn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2619
2649
|
o.autofill.status = "exhausted";
|
|
2620
2650
|
return;
|
|
2621
2651
|
}
|
|
2622
|
-
let l = await
|
|
2652
|
+
let l = await Zt({
|
|
2623
2653
|
existingItems: o.items,
|
|
2624
2654
|
initialCursor: o.next,
|
|
2625
2655
|
loadPage: i.loadPage,
|
|
2626
|
-
maximumRequests:
|
|
2656
|
+
maximumRequests: Ut(s, !1),
|
|
2627
2657
|
onCollection: n,
|
|
2628
2658
|
onDelayChange: (e) => {
|
|
2629
2659
|
t() && Object.assign(o.autofill, e);
|
|
@@ -2645,13 +2675,13 @@ async function cn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2645
2675
|
}
|
|
2646
2676
|
//#endregion
|
|
2647
2677
|
//#region src/core/fill.ts
|
|
2648
|
-
function
|
|
2678
|
+
function dn(e) {
|
|
2649
2679
|
return "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
2650
2680
|
}
|
|
2651
|
-
function
|
|
2681
|
+
function fn(e) {
|
|
2652
2682
|
return `${typeof e}:${String(e)}`;
|
|
2653
2683
|
}
|
|
2654
|
-
function
|
|
2684
|
+
function pn(e) {
|
|
2655
2685
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
2656
2686
|
if ("pages" in e) {
|
|
2657
2687
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -2660,20 +2690,20 @@ function dn(e) {
|
|
|
2660
2690
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
2661
2691
|
throw TypeError("Vibe fill target must be { pages } or { until: 'end' }.");
|
|
2662
2692
|
}
|
|
2663
|
-
function
|
|
2693
|
+
function mn(e) {
|
|
2664
2694
|
if (!e) return;
|
|
2665
2695
|
if (e.strategy === "frontend") {
|
|
2666
|
-
|
|
2696
|
+
zt(e, "frontend fill");
|
|
2667
2697
|
return;
|
|
2668
2698
|
}
|
|
2669
2699
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
2670
2700
|
let t = e.initialSession;
|
|
2671
2701
|
if (t) {
|
|
2672
2702
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
2673
|
-
|
|
2703
|
+
pn(t.target);
|
|
2674
2704
|
}
|
|
2675
2705
|
}
|
|
2676
|
-
function
|
|
2706
|
+
function hn(e, t, n = !0) {
|
|
2677
2707
|
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = $(i?.nextRequestAt);
|
|
2678
2708
|
return {
|
|
2679
2709
|
completedPages: i?.completedPages ?? 0,
|
|
@@ -2687,10 +2717,10 @@ function pn(e, t, n = !0) {
|
|
|
2687
2717
|
sessionId: i?.sessionId ?? null,
|
|
2688
2718
|
status: i?.status ?? "idle",
|
|
2689
2719
|
strategy: e?.strategy ?? null,
|
|
2690
|
-
target: i ?
|
|
2720
|
+
target: i ? dn(i.target) : null
|
|
2691
2721
|
};
|
|
2692
2722
|
}
|
|
2693
|
-
function
|
|
2723
|
+
function gn(e) {
|
|
2694
2724
|
return [
|
|
2695
2725
|
"cancelling",
|
|
2696
2726
|
"filling",
|
|
@@ -2698,17 +2728,17 @@ function mn(e) {
|
|
|
2698
2728
|
"waiting"
|
|
2699
2729
|
].includes(e.status);
|
|
2700
2730
|
}
|
|
2701
|
-
async function
|
|
2731
|
+
async function _n({ existingItems: e, initialCursor: t, loadPage: n, onDelayChange: r, onProgress: i, options: a, signal: o, target: s }) {
|
|
2702
2732
|
let c = [], l = [...e], u = /* @__PURE__ */ new Set(), d = 0, f = t, p = t, m = 0, h;
|
|
2703
2733
|
for (; p !== null;) {
|
|
2704
|
-
let e =
|
|
2734
|
+
let e = fn(f);
|
|
2705
2735
|
if (u.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
2706
|
-
u.add(e), await
|
|
2707
|
-
delayMs:
|
|
2736
|
+
u.add(e), await Vt({
|
|
2737
|
+
delayMs: Bt(d, a),
|
|
2708
2738
|
onChange: r,
|
|
2709
2739
|
signal: o
|
|
2710
2740
|
});
|
|
2711
|
-
let t =
|
|
2741
|
+
let t = Nt(await n({
|
|
2712
2742
|
cursor: f,
|
|
2713
2743
|
signal: o
|
|
2714
2744
|
}));
|
|
@@ -2750,7 +2780,7 @@ async function hn({ existingItems: e, initialCursor: t, loadPage: n, onDelayChan
|
|
|
2750
2780
|
}
|
|
2751
2781
|
//#endregion
|
|
2752
2782
|
//#region src/core/backendFill.ts
|
|
2753
|
-
async function
|
|
2783
|
+
async function vn(e, t, n, r) {
|
|
2754
2784
|
let i = await e.onStart(n);
|
|
2755
2785
|
if (r()) {
|
|
2756
2786
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
@@ -2764,22 +2794,22 @@ async function gn(e, t, n, r) {
|
|
|
2764
2794
|
});
|
|
2765
2795
|
}
|
|
2766
2796
|
}
|
|
2767
|
-
function
|
|
2797
|
+
function yn(e, t, n) {
|
|
2768
2798
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
2769
2799
|
}
|
|
2770
|
-
function
|
|
2800
|
+
function bn(e) {
|
|
2771
2801
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
2772
2802
|
}
|
|
2773
|
-
function
|
|
2803
|
+
function xn(e, t) {
|
|
2774
2804
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
2775
2805
|
let n = e.fill.target;
|
|
2776
2806
|
return !n || !Array.isArray(t.items) || t.next === void 0 || t.lastCursor === void 0 ? !1 : t.status === "exhausted" ? "pages" in n && t.completedPages < n.pages && t.next === null : "pages" in n ? t.completedPages === n.pages : t.next === null;
|
|
2777
2807
|
}
|
|
2778
|
-
function
|
|
2808
|
+
function Sn(e, t, n) {
|
|
2779
2809
|
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = Q(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
|
|
2780
2810
|
}
|
|
2781
|
-
function
|
|
2782
|
-
return !
|
|
2811
|
+
function Cn(e, t, n, r) {
|
|
2812
|
+
return !yn(e, t, n) || !bn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !xn(t, n) ? !1 : (Sn(t, n, r), Object.assign(t.fill, {
|
|
2783
2813
|
...$(n.status === "waiting" ? n.nextRequestAt : null),
|
|
2784
2814
|
completedPages: n.completedPages,
|
|
2785
2815
|
error: n.error ?? null,
|
|
@@ -2788,41 +2818,41 @@ function xn(e, t, n, r) {
|
|
|
2788
2818
|
status: n.status
|
|
2789
2819
|
}), !0);
|
|
2790
2820
|
}
|
|
2791
|
-
function
|
|
2821
|
+
function wn(e, t, n, r) {
|
|
2792
2822
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
2793
2823
|
let i = t.fill;
|
|
2794
|
-
return t.fill =
|
|
2824
|
+
return t.fill = hn(e, n), !bn(n) || !xn(t, n) ? (t.fill = i, !1) : (Sn(t, n, r), !0);
|
|
2795
2825
|
}
|
|
2796
2826
|
//#endregion
|
|
2797
2827
|
//#region src/core/fillController.ts
|
|
2798
|
-
var
|
|
2828
|
+
var Tn = class {
|
|
2799
2829
|
abortController = null;
|
|
2800
2830
|
cycle = 0;
|
|
2801
2831
|
delayCountdown;
|
|
2802
2832
|
requestVersion = 0;
|
|
2803
2833
|
constructor(e) {
|
|
2804
|
-
this.options = e, this.delayCountdown = new
|
|
2834
|
+
this.options = e, this.delayCountdown = new Ht((e) => {
|
|
2805
2835
|
Object.assign(this.options.state.fill, e);
|
|
2806
2836
|
}), this.syncBackendCountdown();
|
|
2807
2837
|
}
|
|
2808
2838
|
isActive() {
|
|
2809
|
-
return
|
|
2839
|
+
return gn(this.options.state.fill);
|
|
2810
2840
|
}
|
|
2811
2841
|
applyUpdate(e) {
|
|
2812
|
-
let t =
|
|
2842
|
+
let t = Cn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2813
2843
|
return t && this.syncBackendCountdown(), t;
|
|
2814
2844
|
}
|
|
2815
2845
|
restoreSession(e) {
|
|
2816
|
-
let t =
|
|
2846
|
+
let t = wn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2817
2847
|
return t && this.syncBackendCountdown(), t;
|
|
2818
2848
|
}
|
|
2819
2849
|
async start(e) {
|
|
2820
2850
|
let t = this.options.fill;
|
|
2821
2851
|
if (!t) throw Error("Vibe fill is not configured.");
|
|
2822
2852
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
2823
|
-
let n =
|
|
2853
|
+
let n = pn(e), r = `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2824
2854
|
if (this.options.state.fill = {
|
|
2825
|
-
...
|
|
2855
|
+
...hn(t, void 0, !1),
|
|
2826
2856
|
cycleId: r,
|
|
2827
2857
|
status: "filling",
|
|
2828
2858
|
target: n
|
|
@@ -2833,7 +2863,7 @@ var Cn = class {
|
|
|
2833
2863
|
let i = ++this.requestVersion, a = new AbortController();
|
|
2834
2864
|
this.abortController = a;
|
|
2835
2865
|
try {
|
|
2836
|
-
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await
|
|
2866
|
+
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await vn(t, this.options.state, {
|
|
2837
2867
|
cycleId: r,
|
|
2838
2868
|
feedKey: t.feedKey,
|
|
2839
2869
|
items: [...this.options.state.items],
|
|
@@ -2851,7 +2881,7 @@ var Cn = class {
|
|
|
2851
2881
|
}
|
|
2852
2882
|
async cancel() {
|
|
2853
2883
|
let { fill: e, state: t } = this.options;
|
|
2854
|
-
if (!
|
|
2884
|
+
if (!gn(t.fill) || !t.fill.cycleId) return;
|
|
2855
2885
|
let n = {
|
|
2856
2886
|
cycleId: t.fill.cycleId,
|
|
2857
2887
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -2865,7 +2895,7 @@ var Cn = class {
|
|
|
2865
2895
|
}
|
|
2866
2896
|
}
|
|
2867
2897
|
reset() {
|
|
2868
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
2898
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = hn(this.options.fill, void 0, !1);
|
|
2869
2899
|
}
|
|
2870
2900
|
destroy() {
|
|
2871
2901
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -2881,7 +2911,7 @@ var Cn = class {
|
|
|
2881
2911
|
if (!i) throw Error("Vibe frontend fill requires loadPage.");
|
|
2882
2912
|
let a = this.options.state;
|
|
2883
2913
|
a.isLoadingMore = !0;
|
|
2884
|
-
let o = await
|
|
2914
|
+
let o = await _n({
|
|
2885
2915
|
existingItems: a.items,
|
|
2886
2916
|
initialCursor: a.next,
|
|
2887
2917
|
loadPage: i,
|
|
@@ -2908,7 +2938,7 @@ var Cn = class {
|
|
|
2908
2938
|
};
|
|
2909
2939
|
//#endregion
|
|
2910
2940
|
//#region src/core/feedFooter.ts
|
|
2911
|
-
function
|
|
2941
|
+
function En(e) {
|
|
2912
2942
|
return {
|
|
2913
2943
|
cancelAutofill: () => e.cancelAutofill(),
|
|
2914
2944
|
loadMore: () => e.loadNext(),
|
|
@@ -2916,45 +2946,45 @@ function wn(e) {
|
|
|
2916
2946
|
retryEnd: () => e.retryEnd()
|
|
2917
2947
|
};
|
|
2918
2948
|
}
|
|
2919
|
-
function
|
|
2949
|
+
function Dn(e) {
|
|
2920
2950
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
2921
2951
|
}
|
|
2922
|
-
function
|
|
2923
|
-
e?.intervalMs !== void 0 &&
|
|
2952
|
+
function On(e) {
|
|
2953
|
+
e?.intervalMs !== void 0 && Dn(e.intervalMs);
|
|
2924
2954
|
}
|
|
2925
|
-
function
|
|
2955
|
+
function kn(e) {
|
|
2926
2956
|
return {
|
|
2927
2957
|
enabled: e?.enabled ?? !1,
|
|
2928
2958
|
includePostItems: e?.includePostItems ?? !1,
|
|
2929
2959
|
intervalMs: e?.intervalMs ?? 5e3
|
|
2930
2960
|
};
|
|
2931
2961
|
}
|
|
2932
|
-
function
|
|
2962
|
+
function An(e, t) {
|
|
2933
2963
|
if (typeof t == "boolean") {
|
|
2934
2964
|
e.enabled = t;
|
|
2935
2965
|
return;
|
|
2936
2966
|
}
|
|
2937
|
-
|
|
2967
|
+
On(t), t.enabled !== void 0 && (e.enabled = t.enabled), t.includePostItems !== void 0 && (e.includePostItems = t.includePostItems), t.intervalMs !== void 0 && (e.intervalMs = t.intervalMs);
|
|
2938
2968
|
}
|
|
2939
2969
|
//#endregion
|
|
2940
2970
|
//#region src/core/reelInfoSheet.ts
|
|
2941
|
-
function
|
|
2971
|
+
function jn(e) {
|
|
2942
2972
|
return { enabled: e?.enabled ?? !1 };
|
|
2943
2973
|
}
|
|
2944
|
-
function
|
|
2974
|
+
function Mn(e, t, n) {
|
|
2945
2975
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
2946
2976
|
e.enabled = n;
|
|
2947
2977
|
}
|
|
2948
2978
|
//#endregion
|
|
2949
2979
|
//#region src/core/initialRuntimeState.ts
|
|
2950
|
-
function
|
|
2980
|
+
function Nn(e, t) {
|
|
2951
2981
|
let n = e.initialPage;
|
|
2952
2982
|
return {
|
|
2953
2983
|
activeReelPostId: null,
|
|
2954
|
-
autoScroll:
|
|
2955
|
-
autofill:
|
|
2984
|
+
autoScroll: rn(e.autoScroll),
|
|
2985
|
+
autofill: qt(e.autofill),
|
|
2956
2986
|
error: null,
|
|
2957
|
-
fill:
|
|
2987
|
+
fill: hn(e.fill),
|
|
2958
2988
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
2959
2989
|
isLoading: !n,
|
|
2960
2990
|
isLoadingMore: !1,
|
|
@@ -2964,14 +2994,14 @@ function jn(e, t) {
|
|
|
2964
2994
|
mediaIndices: /* @__PURE__ */ new Map(),
|
|
2965
2995
|
next: n?.next ?? null,
|
|
2966
2996
|
nextPageError: null,
|
|
2967
|
-
reelAutoAdvance:
|
|
2997
|
+
reelAutoAdvance: kn(e.reelAutoAdvance),
|
|
2968
2998
|
reelForward: {
|
|
2969
2999
|
error: null,
|
|
2970
3000
|
status: "idle"
|
|
2971
3001
|
},
|
|
2972
3002
|
reelForwardIndex: null,
|
|
2973
3003
|
reelForwardItem: null,
|
|
2974
|
-
reelInfoSheet:
|
|
3004
|
+
reelInfoSheet: jn(e.reelInfoSheet),
|
|
2975
3005
|
reelInfoSheetOverlay: !1,
|
|
2976
3006
|
reelMediaSource: "original",
|
|
2977
3007
|
reelOrigin: null,
|
|
@@ -2980,26 +3010,26 @@ function jn(e, t) {
|
|
|
2980
3010
|
}
|
|
2981
3011
|
//#endregion
|
|
2982
3012
|
//#region src/core/options.ts
|
|
2983
|
-
function
|
|
3013
|
+
function Pn(e, t) {
|
|
2984
3014
|
if (t) {
|
|
2985
3015
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
2986
3016
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
2987
3017
|
}
|
|
2988
3018
|
}
|
|
2989
|
-
function
|
|
3019
|
+
function Fn(e, t) {
|
|
2990
3020
|
if (t) {
|
|
2991
3021
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
2992
3022
|
for (let [n, r] of [["paddingX", t.paddingX], ["paddingY", t.paddingY]]) if (r !== void 0 && (!Number.isFinite(r) || r < 0)) throw TypeError(`Vibe mediaCard ${e} ${n} must be a non-negative number.`);
|
|
2993
3023
|
}
|
|
2994
3024
|
}
|
|
2995
|
-
function
|
|
2996
|
-
if (
|
|
3025
|
+
function In(e) {
|
|
3026
|
+
if (nn(e.autoScroll), Pn("cardHeader", e.cardHeader), Pn("cardFooter", e.cardFooter), Fn("header", e.mediaCard?.header), Fn("footer", e.mediaCard?.footer), Kt(e.autofill), mn(e.fill), On(e.reelAutoAdvance), e.removalHistoryLimit !== void 0 && (!Number.isInteger(e.removalHistoryLimit) || e.removalHistoryLimit < 0)) throw TypeError("Vibe removalHistoryLimit must be a non-negative integer.");
|
|
2997
3027
|
if (!e.initialPage && !e.loadPage) throw TypeError("Vibe requires either initialPage or loadPage.");
|
|
2998
3028
|
if (e.initialPage?.next !== null && !e.loadPage) throw TypeError("Vibe requires loadPage when initialPage has a next cursor.");
|
|
2999
3029
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
3000
3030
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
3001
3031
|
}
|
|
3002
|
-
function
|
|
3032
|
+
function Ln(e) {
|
|
3003
3033
|
if (typeof e != "string") return e;
|
|
3004
3034
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
3005
3035
|
let t = document.querySelector(e);
|
|
@@ -3008,7 +3038,7 @@ function Fn(e) {
|
|
|
3008
3038
|
}
|
|
3009
3039
|
//#endregion
|
|
3010
3040
|
//#region src/core/activeItemRemoval.ts
|
|
3011
|
-
function
|
|
3041
|
+
function Rn(e, t, n, r, i) {
|
|
3012
3042
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
3013
3043
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
3014
3044
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -3021,7 +3051,7 @@ function In(e, t, n, r, i) {
|
|
|
3021
3051
|
}
|
|
3022
3052
|
//#endregion
|
|
3023
3053
|
//#region src/core/exactMediaRemovalController.ts
|
|
3024
|
-
function
|
|
3054
|
+
function zn(e, t) {
|
|
3025
3055
|
let [n, ...r] = t;
|
|
3026
3056
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
3027
3057
|
return {
|
|
@@ -3030,10 +3060,10 @@ function Ln(e, t) {
|
|
|
3030
3060
|
items: r
|
|
3031
3061
|
};
|
|
3032
3062
|
}
|
|
3033
|
-
function
|
|
3063
|
+
function Bn(e) {
|
|
3034
3064
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
3035
3065
|
}
|
|
3036
|
-
var
|
|
3066
|
+
var Vn = class {
|
|
3037
3067
|
generation = 0;
|
|
3038
3068
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
3039
3069
|
state;
|
|
@@ -3041,7 +3071,7 @@ var zn = class {
|
|
|
3041
3071
|
this.options = e, this.state = e.state;
|
|
3042
3072
|
}
|
|
3043
3073
|
remove(e) {
|
|
3044
|
-
|
|
3074
|
+
Bn(e);
|
|
3045
3075
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
3046
3076
|
if (!n) return null;
|
|
3047
3077
|
let r = [...M(n)], i = r[e.mediaIndex];
|
|
@@ -3058,7 +3088,7 @@ var zn = class {
|
|
|
3058
3088
|
restored: !1
|
|
3059
3089
|
});
|
|
3060
3090
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
3061
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
3091
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = zn(n, r), this.updateMediaIndexAfterRemoval(n.postId, e.mediaIndex, c), a) : (this.state.items.splice(t, 1), this.state.mediaIndices.delete(n.postId), s && this.advanceFromRemovedPost(a, n), a);
|
|
3062
3092
|
}
|
|
3063
3093
|
reset() {
|
|
3064
3094
|
this.generation += 1;
|
|
@@ -3084,7 +3114,7 @@ var zn = class {
|
|
|
3084
3114
|
}
|
|
3085
3115
|
restoreIntoPost(e, t) {
|
|
3086
3116
|
let n = this.state.items[e], r = [...M(n)], i = Math.min(t.mediaIndex, r.length);
|
|
3087
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
3117
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = zn(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
3088
3118
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
3089
3119
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
3090
3120
|
}
|
|
@@ -3097,18 +3127,18 @@ var zn = class {
|
|
|
3097
3127
|
};
|
|
3098
3128
|
//#endregion
|
|
3099
3129
|
//#region src/core/itemPlacement.ts
|
|
3100
|
-
function
|
|
3130
|
+
function Hn(e, t) {
|
|
3101
3131
|
let n = new Set(t);
|
|
3102
3132
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
3103
3133
|
index: t,
|
|
3104
3134
|
item: e
|
|
3105
3135
|
}] : []);
|
|
3106
3136
|
}
|
|
3107
|
-
function
|
|
3137
|
+
function Un(e, t) {
|
|
3108
3138
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
3109
3139
|
return e.filter((e) => !n.has(e.postId));
|
|
3110
3140
|
}
|
|
3111
|
-
function
|
|
3141
|
+
function Wn(e, t) {
|
|
3112
3142
|
t.forEach(({ index: e }) => {
|
|
3113
3143
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
3114
3144
|
});
|
|
@@ -3119,7 +3149,7 @@ function Hn(e, t) {
|
|
|
3119
3149
|
}
|
|
3120
3150
|
//#endregion
|
|
3121
3151
|
//#region src/core/itemRemovalController.ts
|
|
3122
|
-
var
|
|
3152
|
+
var Gn = 20, Kn = class {
|
|
3123
3153
|
generation = 0;
|
|
3124
3154
|
historyLimit;
|
|
3125
3155
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -3128,7 +3158,7 @@ var Un = 20, Wn = class {
|
|
|
3128
3158
|
itemOrder;
|
|
3129
3159
|
stopItemsWatcher;
|
|
3130
3160
|
constructor(e) {
|
|
3131
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
3161
|
+
this.options = e, this.historyLimit = e.historyLimit ?? Gn, this.state = e.state, this.itemOrder = this.state.items.map(({ postId: e }) => e), this.stopItemsWatcher = O(() => this.state.items, (e) => this.appendUnknownItems(e), { flush: "sync" });
|
|
3132
3162
|
}
|
|
3133
3163
|
destroy() {
|
|
3134
3164
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -3141,7 +3171,7 @@ var Un = 20, Wn = class {
|
|
|
3141
3171
|
let i = this.options.startRemoval(r);
|
|
3142
3172
|
if (i > 0 && await new Promise((e) => setTimeout(e, i)), this.metadata.get(n)?.generation !== this.generation) return n;
|
|
3143
3173
|
let a = this.state.items.findIndex((e) => e.postId === this.state.activeReelPostId), o = new Set(t.map(({ item: e }) => e.postId)), s = a < 0 ? 0 : this.state.items.slice(0, a).filter(({ postId: e }) => o.has(e)).length, c = Math.max(a - s, 0);
|
|
3144
|
-
return this.state.items =
|
|
3174
|
+
return this.state.items = Un(this.state.items, t), this.options.onItemsRemoved(n, t, c), this.record(n), n;
|
|
3145
3175
|
}
|
|
3146
3176
|
reset() {
|
|
3147
3177
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -3152,7 +3182,7 @@ var Un = 20, Wn = class {
|
|
|
3152
3182
|
this.restoreRemoval(t);
|
|
3153
3183
|
return;
|
|
3154
3184
|
}
|
|
3155
|
-
let n =
|
|
3185
|
+
let n = Wn(this.state.items, e);
|
|
3156
3186
|
this.registerExternalPlacements(e), this.state.items = n;
|
|
3157
3187
|
}
|
|
3158
3188
|
restoreRemoval(e) {
|
|
@@ -3178,7 +3208,7 @@ var Un = 20, Wn = class {
|
|
|
3178
3208
|
}
|
|
3179
3209
|
collectOrderedPlacements(e) {
|
|
3180
3210
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3181
|
-
return
|
|
3211
|
+
return Hn(this.state.items, e).map((e) => ({
|
|
3182
3212
|
index: t.get(e.item.postId) ?? e.index,
|
|
3183
3213
|
item: e.item
|
|
3184
3214
|
}));
|
|
@@ -3209,7 +3239,7 @@ var Un = 20, Wn = class {
|
|
|
3209
3239
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3210
3240
|
return this.state.items = [...this.state.items, ...n].sort((e, t) => (r.get(e.postId) ?? 2 ** 53 - 1) - (r.get(t.postId) ?? 2 ** 53 - 1)), !0;
|
|
3211
3241
|
}
|
|
3212
|
-
},
|
|
3242
|
+
}, qn = class {
|
|
3213
3243
|
forward = null;
|
|
3214
3244
|
forwardPromise = null;
|
|
3215
3245
|
forwardVersion = 0;
|
|
@@ -3287,7 +3317,7 @@ var Un = 20, Wn = class {
|
|
|
3287
3317
|
}
|
|
3288
3318
|
}
|
|
3289
3319
|
}
|
|
3290
|
-
},
|
|
3320
|
+
}, Jn = class {
|
|
3291
3321
|
generation = 0;
|
|
3292
3322
|
pending = Promise.resolve();
|
|
3293
3323
|
constructor(e) {
|
|
@@ -3337,22 +3367,22 @@ var Un = 20, Wn = class {
|
|
|
3337
3367
|
};
|
|
3338
3368
|
//#endregion
|
|
3339
3369
|
//#region src/core/removalControllers.ts
|
|
3340
|
-
function
|
|
3341
|
-
let t = new
|
|
3370
|
+
function Yn(e) {
|
|
3371
|
+
let t = new qn(e), n = new Jn({
|
|
3342
3372
|
state: e.state,
|
|
3343
3373
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
3344
3374
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
3345
3375
|
});
|
|
3346
3376
|
return {
|
|
3347
|
-
exactMediaRemoval: new
|
|
3377
|
+
exactMediaRemoval: new Vn({
|
|
3348
3378
|
onActivate: e.onActivate,
|
|
3349
3379
|
reelForward: t,
|
|
3350
3380
|
state: e.state
|
|
3351
3381
|
}),
|
|
3352
|
-
itemRemoval: new
|
|
3382
|
+
itemRemoval: new Kn({
|
|
3353
3383
|
historyLimit: e.historyLimit,
|
|
3354
3384
|
onItemsRemoved: (n, r, i) => {
|
|
3355
|
-
|
|
3385
|
+
Rn(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
3356
3386
|
},
|
|
3357
3387
|
onRemovalRestored: (n) => {
|
|
3358
3388
|
let r = t.cancel(n);
|
|
@@ -3366,17 +3396,17 @@ function qn(e) {
|
|
|
3366
3396
|
reelRemoval: n
|
|
3367
3397
|
};
|
|
3368
3398
|
}
|
|
3369
|
-
var
|
|
3370
|
-
function
|
|
3399
|
+
var Xn = 1.5;
|
|
3400
|
+
function Zn(e) {
|
|
3371
3401
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
3372
3402
|
if (t > 0 && t < 600) return !0;
|
|
3373
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
3403
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Xn;
|
|
3374
3404
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
3375
3405
|
}
|
|
3376
|
-
function
|
|
3377
|
-
return
|
|
3406
|
+
function Qn(e) {
|
|
3407
|
+
return Zn(e) ? "reel" : "masonry";
|
|
3378
3408
|
}
|
|
3379
|
-
function
|
|
3409
|
+
function $n(e) {
|
|
3380
3410
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
3381
3411
|
return {
|
|
3382
3412
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -3386,15 +3416,15 @@ function Zn(e) {
|
|
|
3386
3416
|
viewportWidth: n.clientWidth
|
|
3387
3417
|
};
|
|
3388
3418
|
}
|
|
3389
|
-
function
|
|
3390
|
-
return
|
|
3419
|
+
function er(e) {
|
|
3420
|
+
return Zn($n(e));
|
|
3391
3421
|
}
|
|
3392
|
-
function
|
|
3393
|
-
return
|
|
3422
|
+
function tr(e) {
|
|
3423
|
+
return Qn($n(e));
|
|
3394
3424
|
}
|
|
3395
3425
|
//#endregion
|
|
3396
3426
|
//#region src/core/responsiveLayoutController.ts
|
|
3397
|
-
var
|
|
3427
|
+
var nr = class {
|
|
3398
3428
|
layoutMode;
|
|
3399
3429
|
resizeObserver = null;
|
|
3400
3430
|
target = null;
|
|
@@ -3419,10 +3449,10 @@ var er = class {
|
|
|
3419
3449
|
}
|
|
3420
3450
|
handleResponsiveLayout = () => {
|
|
3421
3451
|
if (!this.target) return;
|
|
3422
|
-
let e =
|
|
3423
|
-
this.state.reelInfoSheetOverlay =
|
|
3452
|
+
let e = tr(this.target);
|
|
3453
|
+
this.state.reelInfoSheetOverlay = er(this.target), this.state.reelMediaSource = e === "reel" ? "preview" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
3424
3454
|
};
|
|
3425
|
-
},
|
|
3455
|
+
}, rr = class {
|
|
3426
3456
|
routedReelPostId = null;
|
|
3427
3457
|
reelRouteIsActive = !1;
|
|
3428
3458
|
constructor(e, t) {
|
|
@@ -3449,7 +3479,7 @@ var er = class {
|
|
|
3449
3479
|
let i = this.reelRouteIsActive ? "replace" : "push";
|
|
3450
3480
|
this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
|
|
3451
3481
|
}
|
|
3452
|
-
},
|
|
3482
|
+
}, ir = class {
|
|
3453
3483
|
app = null;
|
|
3454
3484
|
autoScroll;
|
|
3455
3485
|
autofillController;
|
|
@@ -3468,27 +3498,27 @@ var er = class {
|
|
|
3468
3498
|
lastLoadedCursor = null;
|
|
3469
3499
|
state;
|
|
3470
3500
|
constructor(e) {
|
|
3471
|
-
this.options = e,
|
|
3501
|
+
this.options = e, In(e);
|
|
3472
3502
|
let t = e.layout ?? "masonry";
|
|
3473
|
-
this.state = x(
|
|
3503
|
+
this.state = x(Nn(e, t)), this.autoScroll = new an({
|
|
3474
3504
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
3475
3505
|
state: this.state.autoScroll
|
|
3476
|
-
}), this.autofillController = new
|
|
3506
|
+
}), this.autofillController = new Qt({
|
|
3477
3507
|
cancelRequest: () => this.cancelRequest(),
|
|
3478
3508
|
onLastCursor: (e) => {
|
|
3479
3509
|
this.lastLoadedCursor = e;
|
|
3480
3510
|
},
|
|
3481
3511
|
options: e.autofill,
|
|
3482
3512
|
state: this.state
|
|
3483
|
-
}), this.fillController = new
|
|
3513
|
+
}), this.fillController = new Tn({
|
|
3484
3514
|
fill: e.fill,
|
|
3485
3515
|
loadPage: e.loadPage,
|
|
3486
3516
|
onLastCursor: (e) => {
|
|
3487
3517
|
this.lastLoadedCursor = e;
|
|
3488
3518
|
},
|
|
3489
3519
|
state: this.state
|
|
3490
|
-
}), this.routing = new
|
|
3491
|
-
let n =
|
|
3520
|
+
}), this.routing = new rr(e.routing, this.state);
|
|
3521
|
+
let n = Yn({
|
|
3492
3522
|
historyLimit: e.removalHistoryLimit,
|
|
3493
3523
|
loadNext: () => this.loadNext(),
|
|
3494
3524
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
@@ -3496,21 +3526,23 @@ var er = class {
|
|
|
3496
3526
|
state: this.state,
|
|
3497
3527
|
surface: () => this.surface
|
|
3498
3528
|
});
|
|
3499
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new
|
|
3529
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new nr(t, this.state, () => {
|
|
3500
3530
|
this.routing.syncFeed();
|
|
3501
3531
|
}), this.startStateNotifications();
|
|
3502
3532
|
}
|
|
3503
3533
|
async mount() {
|
|
3504
3534
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
3505
3535
|
this.startStateNotifications();
|
|
3506
|
-
let e =
|
|
3507
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
3536
|
+
let e = Ln(this.options.target);
|
|
3537
|
+
this.responsiveLayout.mount(e), this.app = i(Mt, {
|
|
3508
3538
|
canRetryEnd: !!this.options.loadPage,
|
|
3509
3539
|
cardFooter: this.options.cardFooter,
|
|
3510
3540
|
cardHeader: this.options.cardHeader,
|
|
3511
3541
|
feedFooter: this.options.feedFooter,
|
|
3512
|
-
feedFooterActions:
|
|
3542
|
+
feedFooterActions: En(this),
|
|
3513
3543
|
mediaCard: this.options.mediaCard,
|
|
3544
|
+
onMediaReady: this.options.onMediaReady,
|
|
3545
|
+
onReelMediaChange: this.options.onReelMediaChange,
|
|
3514
3546
|
reelInfoSheet: this.options.reelInfoSheet,
|
|
3515
3547
|
state: this.state,
|
|
3516
3548
|
onActiveReelChange: (e) => {
|
|
@@ -3534,7 +3566,7 @@ var er = class {
|
|
|
3534
3566
|
this.autoScroll.destroy(), this.fillController.destroy(), this.cancelRequest(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.destroy(), this.responsiveLayout.destroy(), this.stopStateWatcher?.(), this.stopStateWatcher = null, this.app?.unmount(), this.app = null, this.surface = null;
|
|
3535
3567
|
}
|
|
3536
3568
|
getState() {
|
|
3537
|
-
return
|
|
3569
|
+
return R(this.state);
|
|
3538
3570
|
}
|
|
3539
3571
|
removeMedia(e) {
|
|
3540
3572
|
return this.exactMediaRemoval.remove(e);
|
|
@@ -3588,7 +3620,7 @@ var er = class {
|
|
|
3588
3620
|
this.autoScroll.setSpeed(e);
|
|
3589
3621
|
}
|
|
3590
3622
|
applyAutofillUpdate(e) {
|
|
3591
|
-
let t =
|
|
3623
|
+
let t = cn(this.options.autofill, this.state, e);
|
|
3592
3624
|
return t && this.autofillController.syncCountdown(), t;
|
|
3593
3625
|
}
|
|
3594
3626
|
cancelAutofill() {
|
|
@@ -3601,11 +3633,11 @@ var er = class {
|
|
|
3601
3633
|
return this.fillController.cancel();
|
|
3602
3634
|
}
|
|
3603
3635
|
async fill(e) {
|
|
3604
|
-
if (this.pendingRequest ||
|
|
3636
|
+
if (this.pendingRequest || Jt(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
3605
3637
|
await this.fillController.start(e);
|
|
3606
3638
|
}
|
|
3607
3639
|
restoreAutofillSession(e) {
|
|
3608
|
-
let t =
|
|
3640
|
+
let t = ln(this.options.autofill, this.state, e);
|
|
3609
3641
|
return t && this.autofillController.syncCountdown(), t;
|
|
3610
3642
|
}
|
|
3611
3643
|
restoreFillSession(e) {
|
|
@@ -3613,7 +3645,7 @@ var er = class {
|
|
|
3613
3645
|
}
|
|
3614
3646
|
async loadNext() {
|
|
3615
3647
|
if (this.pendingRequest) return this.pendingRequest;
|
|
3616
|
-
if (!this.state.loadMoreLocked && !(
|
|
3648
|
+
if (!this.state.loadMoreLocked && !(Jt(this.state.autofill) || this.fillController.isActive()) && !(this.state.next === null || !this.options.loadPage)) return this.state.isLoadingMore = !0, this.state.nextPageError = null, this.startRequest(this.state.next, !0);
|
|
3617
3649
|
}
|
|
3618
3650
|
async refresh() {
|
|
3619
3651
|
return this.replaceFeed(this.state.next ?? this.lastLoadedCursor, "refresh");
|
|
@@ -3623,11 +3655,11 @@ var er = class {
|
|
|
3623
3655
|
}
|
|
3624
3656
|
async replaceFeed(e, t) {
|
|
3625
3657
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
3626
|
-
return
|
|
3658
|
+
return Jt(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = qt(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.state.error = null, this.state.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
|
|
3627
3659
|
}
|
|
3628
3660
|
async retryEnd() {
|
|
3629
3661
|
if (this.pendingRequest) return this.pendingRequest;
|
|
3630
|
-
if (!this.state.loadMoreLocked && !(
|
|
3662
|
+
if (!this.state.loadMoreLocked && !(Jt(this.state.autofill) || this.fillController.isActive()) && !(this.state.next !== null || !this.options.loadPage)) return this.state.isLoadingMore = !0, this.state.nextPageError = null, this.startRequest(this.lastLoadedCursor, !0);
|
|
3631
3663
|
}
|
|
3632
3664
|
setInfiniteScroll(e) {
|
|
3633
3665
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
@@ -3636,10 +3668,10 @@ var er = class {
|
|
|
3636
3668
|
this.state.loadMoreLocked !== e && (this.state.loadMoreLocked = e, !e && this.state.infiniteScroll && m(() => this.surface?.loadIfNearBottom()));
|
|
3637
3669
|
}
|
|
3638
3670
|
setReelAutoAdvance(e) {
|
|
3639
|
-
|
|
3671
|
+
An(this.state.reelAutoAdvance, e);
|
|
3640
3672
|
}
|
|
3641
3673
|
setReelInfoSheet(e) {
|
|
3642
|
-
|
|
3674
|
+
Mn(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
3643
3675
|
}
|
|
3644
3676
|
setLayout(e) {
|
|
3645
3677
|
this.responsiveLayout.setLayout(e);
|
|
@@ -3663,7 +3695,7 @@ var er = class {
|
|
|
3663
3695
|
this.abortController = i;
|
|
3664
3696
|
try {
|
|
3665
3697
|
if (a?.strategy === "frontend") {
|
|
3666
|
-
let o = await
|
|
3698
|
+
let o = await Zt({
|
|
3667
3699
|
existingItems: t ? this.state.items : [],
|
|
3668
3700
|
initialCursor: e,
|
|
3669
3701
|
loadPage: n,
|
|
@@ -3686,7 +3718,7 @@ var er = class {
|
|
|
3686
3718
|
}), this.autofillController.clearCollection();
|
|
3687
3719
|
return;
|
|
3688
3720
|
}
|
|
3689
|
-
let c =
|
|
3721
|
+
let c = Nt(await n({
|
|
3690
3722
|
cursor: e,
|
|
3691
3723
|
signal: i.signal
|
|
3692
3724
|
}));
|
|
@@ -3701,7 +3733,7 @@ var er = class {
|
|
|
3701
3733
|
this.state.autofill.status = "complete";
|
|
3702
3734
|
return;
|
|
3703
3735
|
}
|
|
3704
|
-
await
|
|
3736
|
+
await on(a, this.state, {
|
|
3705
3737
|
cycleId: o,
|
|
3706
3738
|
feedKey: a.feedKey,
|
|
3707
3739
|
items: u.slice(l.length),
|
|
@@ -3729,7 +3761,7 @@ var er = class {
|
|
|
3729
3761
|
startInitialAutofill() {
|
|
3730
3762
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
3731
3763
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
3732
|
-
let r =
|
|
3764
|
+
let r = un({
|
|
3733
3765
|
cycleId: n,
|
|
3734
3766
|
isCurrent: () => e === this.requestVersion,
|
|
3735
3767
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -3754,8 +3786,8 @@ var er = class {
|
|
|
3754
3786
|
}));
|
|
3755
3787
|
}
|
|
3756
3788
|
};
|
|
3757
|
-
function
|
|
3758
|
-
return new
|
|
3789
|
+
function ar(e) {
|
|
3790
|
+
return new ir(e);
|
|
3759
3791
|
}
|
|
3760
3792
|
//#endregion
|
|
3761
|
-
export {
|
|
3793
|
+
export { ar as createVibe };
|