@wyxos/vibe 4.5.2 → 4.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/MediaCard.vue.d.ts +3 -0
- package/lib/components/ReelFeed.vue.d.ts +4 -0
- package/lib/components/ReelLayout.vue.d.ts +4 -0
- package/lib/components/VibeSurface.vue.d.ts +2 -0
- package/lib/core/feed.d.ts +10 -0
- package/lib/core/itemRemovalController.d.ts +1 -0
- package/lib/core/reelRemovalTransitionController.d.ts +21 -0
- package/lib/core/reelScrollTransition.d.ts +1 -0
- package/lib/core/removalControllers.d.ts +4 -1
- package/lib/index.cjs +1 -1
- package/lib/index.js +984 -863
- package/lib/style.css +1 -1
- package/lib/types.d.ts +1 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment as e,
|
|
1
|
+
import { Fragment as e, Teleport as t, Transition as n, computed as r, createApp as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, guardReactiveProps as f, h as p, nextTick as m, normalizeClass as h, normalizeProps as g, normalizeStyle as _, onBeforeUnmount as ee, onMounted as v, openBlock as y, reactive as b, renderList as x, resolveDynamicComponent as S, shallowRef as C, toDisplayString as w, unref as T, useId as E, watch as D, withCtx as O, withKeys as k, withModifiers as A } from "vue";
|
|
2
2
|
//#region src/core/mediaAsset.ts
|
|
3
3
|
function j(e) {
|
|
4
4
|
return [e, ...e.items];
|
|
@@ -52,7 +52,7 @@ var I = {
|
|
|
52
52
|
}, R = ["disabled"], z = {
|
|
53
53
|
key: 2,
|
|
54
54
|
class: "end-feed"
|
|
55
|
-
}, B = ["disabled"], V = /* @__PURE__ */
|
|
55
|
+
}, B = ["disabled"], V = /* @__PURE__ */ d({
|
|
56
56
|
__name: "GalleryFooter",
|
|
57
57
|
props: {
|
|
58
58
|
canRetryEnd: { type: Boolean },
|
|
@@ -67,25 +67,25 @@ var I = {
|
|
|
67
67
|
function i() {
|
|
68
68
|
n.loadMoreLocked || (n.hasNext ? r("loadMore") : r("retryEnd"));
|
|
69
69
|
}
|
|
70
|
-
return (t, n) => e.hasNext || e.isLoading || e.hasError || e.canRetryEnd ? (y(),
|
|
70
|
+
return (t, n) => e.hasNext || e.isLoading || e.hasError || e.canRetryEnd ? (y(), s("footer", I, [e.isLoading ? (y(), s("p", L, " Loading more… ")) : e.hasError || e.hasNext ? (y(), s("button", {
|
|
71
71
|
key: 1,
|
|
72
72
|
"data-test": "load-more",
|
|
73
73
|
class: "load-more-button",
|
|
74
74
|
type: "button",
|
|
75
75
|
disabled: e.loadMoreLocked,
|
|
76
76
|
onClick: i
|
|
77
|
-
}, w(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, R)) : (y(),
|
|
77
|
+
}, w(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, R)) : (y(), s("div", z, [n[1] ||= c("p", {
|
|
78
78
|
class: "end-feed-message",
|
|
79
79
|
role: "status"
|
|
80
|
-
}, " You've reached the end. ", -1),
|
|
80
|
+
}, " You've reached the end. ", -1), c("button", {
|
|
81
81
|
"data-test": "retry-end",
|
|
82
82
|
class: "load-more-button",
|
|
83
83
|
type: "button",
|
|
84
84
|
disabled: e.loadMoreLocked,
|
|
85
85
|
onClick: n[0] ||= (e) => t.$emit("retryEnd")
|
|
86
|
-
}, " Check for more ", 8, B)]))])) :
|
|
86
|
+
}, " Check for more ", 8, B)]))])) : o("", !0);
|
|
87
87
|
}
|
|
88
|
-
}),
|
|
88
|
+
}), H = /* @__PURE__ */ d({
|
|
89
89
|
__name: "FeedFooter",
|
|
90
90
|
props: {
|
|
91
91
|
actions: {},
|
|
@@ -100,18 +100,18 @@ var I = {
|
|
|
100
100
|
emits: ["loadMore", "retryEnd"],
|
|
101
101
|
setup(e, { emit: t }) {
|
|
102
102
|
let n = e, r = t;
|
|
103
|
-
function
|
|
103
|
+
function i() {
|
|
104
104
|
n.actions?.cancelAutofill();
|
|
105
105
|
}
|
|
106
106
|
function o() {
|
|
107
107
|
n.actions?.retry();
|
|
108
108
|
}
|
|
109
|
-
return (t, n) => e.feedFooter && e.actions && e.state ? (y(),
|
|
109
|
+
return (t, n) => e.feedFooter && e.actions && e.state ? (y(), a(S(e.feedFooter.component), {
|
|
110
110
|
key: 0,
|
|
111
111
|
actions: e.actions,
|
|
112
112
|
"can-retry-end": e.canRetryEnd,
|
|
113
113
|
state: e.state,
|
|
114
|
-
onAutofillCancel:
|
|
114
|
+
onAutofillCancel: i,
|
|
115
115
|
onLoadMore: n[0] ||= (e) => r("loadMore"),
|
|
116
116
|
onRetry: o,
|
|
117
117
|
onRetryEnd: n[1] ||= (e) => r("retryEnd")
|
|
@@ -119,7 +119,7 @@ var I = {
|
|
|
119
119
|
"actions",
|
|
120
120
|
"can-retry-end",
|
|
121
121
|
"state"
|
|
122
|
-
])) : (y(),
|
|
122
|
+
])) : (y(), a(V, {
|
|
123
123
|
key: 1,
|
|
124
124
|
"can-retry-end": e.canRetryEnd,
|
|
125
125
|
"has-error": e.hasError,
|
|
@@ -136,7 +136,7 @@ var I = {
|
|
|
136
136
|
"load-more-locked"
|
|
137
137
|
]));
|
|
138
138
|
}
|
|
139
|
-
}),
|
|
139
|
+
}), U = ["role"], W = { class: "gallery-status" }, te = /* @__PURE__ */ d({
|
|
140
140
|
__name: "FeedStatus",
|
|
141
141
|
props: {
|
|
142
142
|
actions: {},
|
|
@@ -146,11 +146,11 @@ var I = {
|
|
|
146
146
|
},
|
|
147
147
|
emits: ["loadMore", "retryEnd"],
|
|
148
148
|
setup(t, { emit: n }) {
|
|
149
|
-
let r = t,
|
|
150
|
-
return (n, u) => (y(),
|
|
149
|
+
let r = t, i = n;
|
|
150
|
+
return (n, u) => (y(), s("main", {
|
|
151
151
|
class: "gallery-shell",
|
|
152
152
|
role: r.state.error ? "alert" : r.state.isLoading ? "status" : void 0
|
|
153
|
-
}, [
|
|
153
|
+
}, [c("p", W, [r.state.error ? (y(), s(e, { key: 0 }, [l(" Unable to load media. ")], 64)) : r.state.isLoading ? (y(), s(e, { key: 1 }, [l(" Loading media… ")], 64)) : (y(), s(e, { key: 2 }, [l(" No media found. ")], 64))]), t.feedFooter ? (y(), a(H, {
|
|
154
154
|
key: 0,
|
|
155
155
|
actions: t.actions,
|
|
156
156
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -160,8 +160,8 @@ var I = {
|
|
|
160
160
|
"is-loading": t.state.isLoadingMore,
|
|
161
161
|
"load-more-locked": t.state.loadMoreLocked,
|
|
162
162
|
state: t.state,
|
|
163
|
-
onLoadMore: u[0] ||= (e) =>
|
|
164
|
-
onRetryEnd: u[1] ||= (e) =>
|
|
163
|
+
onLoadMore: u[0] ||= (e) => i("loadMore"),
|
|
164
|
+
onRetryEnd: u[1] ||= (e) => i("retryEnd")
|
|
165
165
|
}, null, 8, [
|
|
166
166
|
"actions",
|
|
167
167
|
"can-retry-end",
|
|
@@ -171,10 +171,10 @@ var I = {
|
|
|
171
171
|
"is-loading",
|
|
172
172
|
"load-more-locked",
|
|
173
173
|
"state"
|
|
174
|
-
])) :
|
|
174
|
+
])) : o("", !0)], 8, U));
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
|
-
function
|
|
177
|
+
function G(e) {
|
|
178
178
|
return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
|
|
179
179
|
}
|
|
180
180
|
//#endregion
|
|
@@ -189,11 +189,11 @@ function re(e) {
|
|
|
189
189
|
function ie(e) {
|
|
190
190
|
return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
|
|
191
191
|
}
|
|
192
|
-
function
|
|
192
|
+
function K(e, t) {
|
|
193
193
|
let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n;
|
|
194
194
|
return e.reduce((e, t, n) => (t.y + t.height >= r && t.y <= i && e.push(n), e), []);
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function q(e, t, n) {
|
|
197
197
|
if (t <= 0 || e.length === 0) return {
|
|
198
198
|
columns: 0,
|
|
199
199
|
height: 0,
|
|
@@ -216,7 +216,7 @@ function K(e, t, n) {
|
|
|
216
216
|
}
|
|
217
217
|
//#endregion
|
|
218
218
|
//#region src/core/scrollbar.ts
|
|
219
|
-
function
|
|
219
|
+
function ae(e, t, n) {
|
|
220
220
|
return Math.min(n, Math.max(t, e));
|
|
221
221
|
}
|
|
222
222
|
function J({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
|
|
@@ -228,23 +228,23 @@ function J({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
|
|
|
228
228
|
thumbSize: o,
|
|
229
229
|
thumbTravel: 0
|
|
230
230
|
};
|
|
231
|
-
let l =
|
|
231
|
+
let l = ae(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
|
|
232
232
|
return {
|
|
233
233
|
maximumScrollPosition: c,
|
|
234
234
|
scrollable: !0,
|
|
235
|
-
thumbOffset: u * (
|
|
235
|
+
thumbOffset: u * (ae(n, 0, c) / c),
|
|
236
236
|
thumbSize: l,
|
|
237
237
|
thumbTravel: u
|
|
238
238
|
};
|
|
239
239
|
}
|
|
240
240
|
//#endregion
|
|
241
241
|
//#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
242
|
-
var
|
|
242
|
+
var Y = ["aria-hidden"], oe = [
|
|
243
243
|
"aria-controls",
|
|
244
244
|
"aria-valuemax",
|
|
245
245
|
"aria-valuenow",
|
|
246
246
|
"tabindex"
|
|
247
|
-
],
|
|
247
|
+
], se = 32, X = 40, ce = 120, le = /* @__PURE__ */ d({
|
|
248
248
|
__name: "GalleryScrollbar",
|
|
249
249
|
props: {
|
|
250
250
|
contentSize: {},
|
|
@@ -253,40 +253,40 @@ var ae = ["aria-hidden"], oe = [
|
|
|
253
253
|
suspended: { type: Boolean }
|
|
254
254
|
},
|
|
255
255
|
setup(e) {
|
|
256
|
-
let t = e,
|
|
256
|
+
let t = e, n = {
|
|
257
257
|
maximumScrollPosition: 0,
|
|
258
258
|
scrollable: !1,
|
|
259
259
|
thumbOffset: 0,
|
|
260
260
|
thumbSize: 0,
|
|
261
261
|
thumbTravel: 0
|
|
262
|
-
}, i = C(null), a = C(
|
|
262
|
+
}, i = C(null), a = C(n), o = C(!1), l = C(!1), u = C(!1), d = null, f = 0, p = 0, g = null, v = null, b = null, x = null, S = !1, w = null, T = r(() => a.value.scrollable && !t.suspended), E = r(() => ({
|
|
263
263
|
height: `${a.value.thumbSize}px`,
|
|
264
264
|
transform: `translate3d(0, ${a.value.thumbOffset}px, 0)`
|
|
265
265
|
}));
|
|
266
|
+
function O() {
|
|
267
|
+
g !== null && clearTimeout(g), g = setTimeout(() => {
|
|
268
|
+
g = null, o.value || (l.value = !1);
|
|
269
|
+
}, ce);
|
|
270
|
+
}
|
|
266
271
|
function k() {
|
|
267
|
-
|
|
268
|
-
v = null, c.value || (l.value = !1);
|
|
269
|
-
}, Z);
|
|
272
|
+
l.value = !0, O();
|
|
270
273
|
}
|
|
271
274
|
function A() {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
function j() {
|
|
275
|
-
let e = t.scrollElement, n = i.value;
|
|
276
|
-
return !e || !n ? r : J({
|
|
275
|
+
let e = t.scrollElement, r = i.value;
|
|
276
|
+
return !e || !r ? n : J({
|
|
277
277
|
contentSize: e.scrollHeight,
|
|
278
|
-
minimumThumbSize:
|
|
278
|
+
minimumThumbSize: se,
|
|
279
279
|
scrollPosition: e.scrollTop,
|
|
280
|
-
trackSize:
|
|
280
|
+
trackSize: r.clientHeight,
|
|
281
281
|
viewportSize: e.clientHeight
|
|
282
282
|
});
|
|
283
283
|
}
|
|
284
|
-
function
|
|
285
|
-
if (
|
|
286
|
-
|
|
284
|
+
function j(e) {
|
|
285
|
+
if (o.value && e !== "scroll") {
|
|
286
|
+
S = !0;
|
|
287
287
|
return;
|
|
288
288
|
}
|
|
289
|
-
if (
|
|
289
|
+
if (o.value) {
|
|
290
290
|
let e = t.scrollElement;
|
|
291
291
|
if (!e || a.value.maximumScrollPosition <= 0) return;
|
|
292
292
|
let n = Math.min(1, Math.max(0, e.scrollTop / a.value.maximumScrollPosition));
|
|
@@ -296,69 +296,69 @@ var ae = ["aria-hidden"], oe = [
|
|
|
296
296
|
};
|
|
297
297
|
return;
|
|
298
298
|
}
|
|
299
|
-
a.value =
|
|
300
|
-
|
|
299
|
+
a.value = A(), !(u.value || v !== null) && (v = requestAnimationFrame(() => {
|
|
300
|
+
v = null, u.value = !0;
|
|
301
301
|
}));
|
|
302
302
|
}
|
|
303
|
-
function
|
|
304
|
-
|
|
303
|
+
function M() {
|
|
304
|
+
k(), j("scroll");
|
|
305
305
|
}
|
|
306
|
-
function
|
|
306
|
+
function N(e) {
|
|
307
307
|
let n = t.scrollElement;
|
|
308
|
-
n && (n.scrollTop = Math.min(a.value.maximumScrollPosition, Math.max(0, e)),
|
|
308
|
+
n && (n.scrollTop = Math.min(a.value.maximumScrollPosition, Math.max(0, e)), j("scroll"));
|
|
309
309
|
}
|
|
310
|
-
function
|
|
311
|
-
if (!
|
|
310
|
+
function P(e) {
|
|
311
|
+
if (!T.value || e.target !== e.currentTarget) return;
|
|
312
312
|
let t = i.value;
|
|
313
313
|
if (!t || a.value.thumbTravel <= 0) return;
|
|
314
|
-
e.preventDefault(),
|
|
314
|
+
e.preventDefault(), k();
|
|
315
315
|
let n = e.clientY - t.getBoundingClientRect().top - a.value.thumbSize / 2;
|
|
316
|
-
|
|
316
|
+
N(Math.min(1, Math.max(0, n / a.value.thumbTravel)) * a.value.maximumScrollPosition);
|
|
317
|
+
}
|
|
318
|
+
function F(e) {
|
|
319
|
+
T.value && (e.preventDefault(), e.stopPropagation(), e.currentTarget.setPointerCapture?.(e.pointerId), d = e.pointerId, f = e.clientY, p = t.scrollElement?.scrollTop ?? 0, o.value = !0, l.value = !0, g !== null && clearTimeout(g), g = null);
|
|
317
320
|
}
|
|
318
321
|
function I(e) {
|
|
319
|
-
|
|
322
|
+
if (!o.value || e.pointerId !== d || (e.preventDefault(), a.value.thumbTravel <= 0)) return;
|
|
323
|
+
let t = (e.clientY - f) / a.value.thumbTravel * a.value.maximumScrollPosition;
|
|
324
|
+
N(p + t);
|
|
320
325
|
}
|
|
321
326
|
function L(e) {
|
|
322
|
-
|
|
323
|
-
let t = (e.clientY - f) / a.value.thumbTravel * a.value.maximumScrollPosition;
|
|
324
|
-
P(h + t);
|
|
327
|
+
!o.value || e.pointerId !== d || (e.currentTarget.releasePointerCapture?.(e.pointerId), d = null, o.value = !1, S && (S = !1, j("content")), O());
|
|
325
328
|
}
|
|
326
329
|
function R(e) {
|
|
327
|
-
|
|
328
|
-
}
|
|
329
|
-
function z(e) {
|
|
330
|
-
if (!E.value) return;
|
|
330
|
+
if (!T.value) return;
|
|
331
331
|
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - X : e.key === "ArrowDown" ? r + X : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
|
|
332
|
-
i !== null && (e.preventDefault(),
|
|
332
|
+
i !== null && (e.preventDefault(), k(), N(i));
|
|
333
333
|
}
|
|
334
|
-
function
|
|
335
|
-
if (
|
|
336
|
-
|
|
337
|
-
for (let t of e.children)
|
|
334
|
+
function z(e) {
|
|
335
|
+
if (x?.disconnect(), !(typeof ResizeObserver > "u")) {
|
|
336
|
+
x = new ResizeObserver(() => j("content"));
|
|
337
|
+
for (let t of e.children) x.observe(t);
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
340
|
return D(() => t.scrollElement, (e, t) => {
|
|
341
|
-
t?.removeEventListener("scroll",
|
|
342
|
-
|
|
343
|
-
}),
|
|
344
|
-
|
|
345
|
-
}),
|
|
341
|
+
t?.removeEventListener("scroll", M), b?.disconnect(), b = null, x?.disconnect(), x = null, w?.disconnect(), w = null, e?.addEventListener("scroll", M, { passive: !0 }), e && typeof ResizeObserver < "u" && (w = new ResizeObserver(() => {
|
|
342
|
+
k(), j("resize");
|
|
343
|
+
}), w.observe(e), z(e)), e && typeof MutationObserver < "u" && (b = new MutationObserver(() => {
|
|
344
|
+
z(e), j("content");
|
|
345
|
+
}), b.observe(e, { childList: !0 })), m(() => j("resize"));
|
|
346
346
|
}, { immediate: !0 }), D(() => t.contentSize, () => {
|
|
347
|
-
|
|
348
|
-
}),
|
|
349
|
-
t.scrollElement?.removeEventListener("scroll",
|
|
350
|
-
}), (t, n) => (y(),
|
|
347
|
+
m(() => j("content"));
|
|
348
|
+
}), ee(() => {
|
|
349
|
+
t.scrollElement?.removeEventListener("scroll", M), b?.disconnect(), x?.disconnect(), w?.disconnect(), g !== null && clearTimeout(g), v !== null && cancelAnimationFrame(v);
|
|
350
|
+
}), (t, n) => (y(), s("div", {
|
|
351
351
|
ref_key: "trackElement",
|
|
352
352
|
ref: i,
|
|
353
|
-
class:
|
|
354
|
-
"gallery-scrollbar--dragging":
|
|
353
|
+
class: h(["gallery-scrollbar", {
|
|
354
|
+
"gallery-scrollbar--dragging": o.value,
|
|
355
355
|
"gallery-scrollbar--interacting": l.value,
|
|
356
356
|
"gallery-scrollbar--ready": u.value,
|
|
357
|
-
"gallery-scrollbar--visible":
|
|
357
|
+
"gallery-scrollbar--visible": T.value
|
|
358
358
|
}]),
|
|
359
|
-
"aria-hidden": !
|
|
360
|
-
onPointerdown:
|
|
361
|
-
}, [
|
|
359
|
+
"aria-hidden": !T.value || void 0,
|
|
360
|
+
onPointerdown: P
|
|
361
|
+
}, [c("div", {
|
|
362
362
|
class: "gallery-scrollbar-thumb",
|
|
363
363
|
"aria-controls": e.controlsId,
|
|
364
364
|
"aria-label": "Media gallery scroll position",
|
|
@@ -367,22 +367,22 @@ var ae = ["aria-hidden"], oe = [
|
|
|
367
367
|
"aria-valuemin": "0",
|
|
368
368
|
"aria-valuenow": Math.round(e.scrollElement?.scrollTop ?? 0),
|
|
369
369
|
role: "scrollbar",
|
|
370
|
-
style:
|
|
371
|
-
tabindex:
|
|
372
|
-
onKeydown:
|
|
373
|
-
onPointercancel:
|
|
374
|
-
onPointerdown:
|
|
375
|
-
onPointermove:
|
|
376
|
-
onPointerup:
|
|
377
|
-
}, null, 44, oe)], 42,
|
|
378
|
-
}
|
|
379
|
-
}),
|
|
370
|
+
style: _(E.value),
|
|
371
|
+
tabindex: T.value ? 0 : -1,
|
|
372
|
+
onKeydown: R,
|
|
373
|
+
onPointercancel: L,
|
|
374
|
+
onPointerdown: F,
|
|
375
|
+
onPointermove: I,
|
|
376
|
+
onPointerup: L
|
|
377
|
+
}, null, 44, oe)], 42, Y));
|
|
378
|
+
}
|
|
379
|
+
}), Z = (e) => {
|
|
380
380
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
381
381
|
return !1;
|
|
382
|
-
},
|
|
383
|
-
let t =
|
|
382
|
+
}, ue = (e) => e === "", de = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), fe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), pe = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), me = (e) => {
|
|
383
|
+
let t = pe(e);
|
|
384
384
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
385
|
-
},
|
|
385
|
+
}, he = {
|
|
386
386
|
xmlns: "http://www.w3.org/2000/svg",
|
|
387
387
|
width: 24,
|
|
388
388
|
height: 24,
|
|
@@ -392,27 +392,27 @@ var ae = ["aria-hidden"], oe = [
|
|
|
392
392
|
"stroke-width": 2,
|
|
393
393
|
"stroke-linecap": "round",
|
|
394
394
|
"stroke-linejoin": "round"
|
|
395
|
-
},
|
|
396
|
-
...
|
|
395
|
+
}, ge = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = he.width, color: s = he.stroke, ...c }, { slots: l }) => p("svg", {
|
|
396
|
+
...he,
|
|
397
397
|
...c,
|
|
398
398
|
width: o,
|
|
399
399
|
height: o,
|
|
400
400
|
stroke: s,
|
|
401
|
-
"stroke-width":
|
|
402
|
-
class:
|
|
403
|
-
...!l.default && !
|
|
404
|
-
}, [...t.map((e) =>
|
|
401
|
+
"stroke-width": ue(n) || ue(r) || n === !0 || r === !0 ? Number(i || a || he["stroke-width"]) * 24 / Number(o) : i || a || he["stroke-width"],
|
|
402
|
+
class: de("lucide", c.class, ...e ? [`lucide-${fe(me(e))}-icon`, `lucide-${fe(e)}`] : ["lucide-icon"]),
|
|
403
|
+
...!l.default && !Z(c) && { "aria-hidden": "true" }
|
|
404
|
+
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), _e = (e, t) => (n, { slots: r, attrs: i }) => p(ge, {
|
|
405
405
|
...i,
|
|
406
406
|
...n,
|
|
407
407
|
iconNode: t,
|
|
408
408
|
name: e
|
|
409
|
-
}, r),
|
|
409
|
+
}, r), ve = _e("chevron-left", [["path", {
|
|
410
410
|
d: "m15 18-6-6 6-6",
|
|
411
411
|
key: "1wnfg3"
|
|
412
|
-
}]]),
|
|
412
|
+
}]]), ye = _e("chevron-right", [["path", {
|
|
413
413
|
d: "m9 18 6-6-6-6",
|
|
414
414
|
key: "mthhwq"
|
|
415
|
-
}]]),
|
|
415
|
+
}]]), be = _e("pause", [["rect", {
|
|
416
416
|
x: "14",
|
|
417
417
|
y: "3",
|
|
418
418
|
width: "5",
|
|
@@ -426,10 +426,10 @@ var ae = ["aria-hidden"], oe = [
|
|
|
426
426
|
height: "18",
|
|
427
427
|
rx: "1",
|
|
428
428
|
key: "1wsw3u"
|
|
429
|
-
}]]),
|
|
429
|
+
}]]), xe = _e("play", [["path", {
|
|
430
430
|
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",
|
|
431
431
|
key: "10ikf1"
|
|
432
|
-
}]]),
|
|
432
|
+
}]]), Se = _e("volume-2", [
|
|
433
433
|
["path", {
|
|
434
434
|
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",
|
|
435
435
|
key: "uqj9uw"
|
|
@@ -442,7 +442,7 @@ var ae = ["aria-hidden"], oe = [
|
|
|
442
442
|
d: "M19.364 18.364a9 9 0 0 0 0-12.728",
|
|
443
443
|
key: "ijwkga"
|
|
444
444
|
}]
|
|
445
|
-
]),
|
|
445
|
+
]), Ce = _e("volume-x", [
|
|
446
446
|
["path", {
|
|
447
447
|
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",
|
|
448
448
|
key: "uqj9uw"
|
|
@@ -461,32 +461,32 @@ var ae = ["aria-hidden"], oe = [
|
|
|
461
461
|
y2: "15",
|
|
462
462
|
key: "5ykzw1"
|
|
463
463
|
}]
|
|
464
|
-
]),
|
|
464
|
+
]), we = {
|
|
465
465
|
401: "Authentication required",
|
|
466
466
|
403: "Access forbidden",
|
|
467
467
|
404: "Preview not found",
|
|
468
468
|
419: "Session expired",
|
|
469
469
|
500: "Server error"
|
|
470
470
|
};
|
|
471
|
-
function
|
|
471
|
+
function Te(e) {
|
|
472
472
|
return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
|
|
473
473
|
}
|
|
474
|
-
function
|
|
475
|
-
return
|
|
474
|
+
function Ee(e) {
|
|
475
|
+
return we[Te(e)] ?? "Preview unavailable";
|
|
476
476
|
}
|
|
477
477
|
//#endregion
|
|
478
478
|
//#region src/core/mediaType.ts
|
|
479
|
-
var
|
|
480
|
-
function
|
|
479
|
+
var De = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
480
|
+
function Oe(e) {
|
|
481
481
|
try {
|
|
482
|
-
return
|
|
482
|
+
return De.test(new URL(e).pathname);
|
|
483
483
|
} catch {
|
|
484
|
-
return
|
|
484
|
+
return De.test(e.split("?")[0] ?? e);
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
487
|
//#endregion
|
|
488
488
|
//#region src/components/CardRegion.vue
|
|
489
|
-
var
|
|
489
|
+
var ke = /* @__PURE__ */ d({
|
|
490
490
|
__name: "CardRegion",
|
|
491
491
|
props: {
|
|
492
492
|
index: {},
|
|
@@ -501,24 +501,24 @@ var Oe = /* @__PURE__ */ u({
|
|
|
501
501
|
total: {}
|
|
502
502
|
},
|
|
503
503
|
setup(e) {
|
|
504
|
-
let t = e,
|
|
504
|
+
let t = e, n = r(() => M(t.item, t.mediaIndex)), i = r(() => j(t.item)), o = r(() => N(t.item, n.value)), c = r(() => ({
|
|
505
505
|
height: `${t.region.height}px`,
|
|
506
506
|
paddingBlock: t.style?.paddingY === void 0 ? void 0 : `${t.style.paddingY}px`,
|
|
507
507
|
paddingInline: t.style?.paddingX === void 0 ? void 0 : `${t.style.paddingX}px`
|
|
508
|
-
})), l =
|
|
509
|
-
return (t,
|
|
510
|
-
class:
|
|
511
|
-
style:
|
|
512
|
-
onClick:
|
|
513
|
-
onKeydown:
|
|
514
|
-
}, [(y(),
|
|
508
|
+
})), l = r(() => t.style?.background ?? t.region.background);
|
|
509
|
+
return (t, r) => (y(), s("div", {
|
|
510
|
+
class: h(["media-card-region", [`media-card-${e.placement}`, { "media-card-region--transparent": l.value === "transparent" }]]),
|
|
511
|
+
style: _(c.value),
|
|
512
|
+
onClick: r[0] ||= A(() => {}, ["stop"]),
|
|
513
|
+
onKeydown: r[1] ||= A(() => {}, ["stop"])
|
|
514
|
+
}, [(y(), a(S(e.region.component), {
|
|
515
515
|
index: e.index,
|
|
516
516
|
item: e.item,
|
|
517
517
|
layout: e.layout,
|
|
518
518
|
"loaded-count": e.loadedCount,
|
|
519
|
-
"media-count":
|
|
520
|
-
"media-index":
|
|
521
|
-
"media-item":
|
|
519
|
+
"media-count": i.value.length,
|
|
520
|
+
"media-index": n.value,
|
|
521
|
+
"media-item": o.value,
|
|
522
522
|
"media-source": e.mediaSource ?? "preview",
|
|
523
523
|
total: e.total
|
|
524
524
|
}, null, 8, [
|
|
@@ -533,18 +533,18 @@ var Oe = /* @__PURE__ */ u({
|
|
|
533
533
|
"total"
|
|
534
534
|
]))], 38));
|
|
535
535
|
}
|
|
536
|
-
}),
|
|
536
|
+
}), Ae = [
|
|
537
537
|
"max",
|
|
538
538
|
"value",
|
|
539
539
|
"aria-valuetext",
|
|
540
540
|
"disabled"
|
|
541
|
-
],
|
|
541
|
+
], je = {
|
|
542
542
|
key: 0,
|
|
543
543
|
class: "media-controls-row"
|
|
544
|
-
},
|
|
544
|
+
}, Me = ["aria-label", "title"], Ne = { class: "media-controls-audio" }, Pe = ["aria-label", "title"], Fe = ["value", "aria-valuetext"], Ie = {
|
|
545
545
|
class: "media-control-time",
|
|
546
546
|
"aria-live": "off"
|
|
547
|
-
},
|
|
547
|
+
}, Le = /* @__PURE__ */ d({
|
|
548
548
|
__name: "MediaControls",
|
|
549
549
|
props: {
|
|
550
550
|
currentTime: {},
|
|
@@ -561,7 +561,7 @@ var Oe = /* @__PURE__ */ u({
|
|
|
561
561
|
"volumeChange"
|
|
562
562
|
],
|
|
563
563
|
setup(e, { emit: t }) {
|
|
564
|
-
let
|
|
564
|
+
let n = e, i = t;
|
|
565
565
|
function l(e, t = 1) {
|
|
566
566
|
return Number.isFinite(e) ? Math.min(t, Math.max(0, e)) : 0;
|
|
567
567
|
}
|
|
@@ -572,70 +572,70 @@ var Oe = /* @__PURE__ */ u({
|
|
|
572
572
|
function d(e) {
|
|
573
573
|
return Number(e.target.value);
|
|
574
574
|
}
|
|
575
|
-
let f =
|
|
576
|
-
return (t, n) => (y(),
|
|
577
|
-
class:
|
|
575
|
+
let f = r(() => Math.max(0, n.duration)), p = r(() => l(n.currentTime, f.value)), m = r(() => ({ "--media-range-progress": `${f.value > 0 ? p.value / f.value * 100 : 0}%` })), g = r(() => ({ "--media-range-progress": `${l(n.volume) * 100}%` }));
|
|
576
|
+
return (t, n) => (y(), s("div", {
|
|
577
|
+
class: h(["media-controls", `media-controls--${e.layout}`]),
|
|
578
578
|
"aria-label": "Video controls",
|
|
579
579
|
onClick: n[4] ||= A(() => {}, ["stop"]),
|
|
580
580
|
onDblclick: n[5] ||= A(() => {}, ["stop"]),
|
|
581
581
|
onKeydown: n[6] ||= A(() => {}, ["stop"]),
|
|
582
582
|
onWheel: n[7] ||= A(() => {}, ["stop"])
|
|
583
|
-
}, [
|
|
583
|
+
}, [c("input", {
|
|
584
584
|
class: "media-control-range media-control-seek",
|
|
585
585
|
type: "range",
|
|
586
586
|
min: "0",
|
|
587
587
|
max: f.value || 0,
|
|
588
588
|
step: "0.1",
|
|
589
589
|
value: p.value,
|
|
590
|
-
style:
|
|
590
|
+
style: _(m.value),
|
|
591
591
|
"aria-label": "Seek video",
|
|
592
592
|
"aria-valuetext": `${u(p.value)} of ${u(f.value)}`,
|
|
593
593
|
disabled: f.value <= 0,
|
|
594
|
-
onInput: n[0] ||= (e) =>
|
|
595
|
-
}, null, 44,
|
|
596
|
-
|
|
594
|
+
onInput: n[0] ||= (e) => i("seek", d(e))
|
|
595
|
+
}, null, 44, Ae), e.layout === "reel" ? (y(), s("div", je, [
|
|
596
|
+
c("button", {
|
|
597
597
|
type: "button",
|
|
598
598
|
class: "media-control-button media-control-playback",
|
|
599
599
|
"aria-label": e.playing ? "Pause video" : "Play video",
|
|
600
600
|
title: e.playing ? "Pause" : "Play",
|
|
601
|
-
onClick: n[1] ||= (e) =>
|
|
602
|
-
}, [e.playing ? (y(),
|
|
601
|
+
onClick: n[1] ||= (e) => i("togglePlayback")
|
|
602
|
+
}, [e.playing ? (y(), a(T(be), {
|
|
603
603
|
key: 0,
|
|
604
604
|
size: 18,
|
|
605
605
|
fill: "currentColor"
|
|
606
|
-
})) : (y(),
|
|
606
|
+
})) : (y(), a(T(xe), {
|
|
607
607
|
key: 1,
|
|
608
608
|
size: 18,
|
|
609
609
|
fill: "currentColor"
|
|
610
|
-
}))], 8,
|
|
611
|
-
|
|
610
|
+
}))], 8, Me),
|
|
611
|
+
c("div", Ne, [c("button", {
|
|
612
612
|
type: "button",
|
|
613
613
|
class: "media-control-button",
|
|
614
614
|
"aria-label": e.muted ? "Unmute video" : "Mute video",
|
|
615
615
|
title: e.muted ? "Unmute" : "Mute",
|
|
616
|
-
onClick: n[2] ||= (e) =>
|
|
617
|
-
}, [e.muted || e.volume === 0 ? (y(),
|
|
616
|
+
onClick: n[2] ||= (e) => i("toggleMute")
|
|
617
|
+
}, [e.muted || e.volume === 0 ? (y(), a(T(Ce), {
|
|
618
618
|
key: 0,
|
|
619
619
|
size: 18
|
|
620
|
-
})) : (y(),
|
|
620
|
+
})) : (y(), a(T(Se), {
|
|
621
621
|
key: 1,
|
|
622
622
|
size: 18
|
|
623
|
-
}))], 8,
|
|
623
|
+
}))], 8, Pe), c("input", {
|
|
624
624
|
class: "media-control-range media-control-volume",
|
|
625
625
|
type: "range",
|
|
626
626
|
min: "0",
|
|
627
627
|
max: "1",
|
|
628
628
|
step: "0.05",
|
|
629
629
|
value: e.volume,
|
|
630
|
-
style: g
|
|
630
|
+
style: _(g.value),
|
|
631
631
|
"aria-label": "Video volume",
|
|
632
632
|
"aria-valuetext": `${Math.round(e.volume * 100)} percent`,
|
|
633
|
-
onInput: n[3] ||= (e) =>
|
|
634
|
-
}, null, 44,
|
|
635
|
-
|
|
636
|
-
])) :
|
|
633
|
+
onInput: n[3] ||= (e) => i("volumeChange", d(e))
|
|
634
|
+
}, null, 44, Fe)]),
|
|
635
|
+
c("output", Ie, w(u(p.value)) + " / " + w(u(f.value)), 1)
|
|
636
|
+
])) : o("", !0)], 34));
|
|
637
637
|
}
|
|
638
|
-
}),
|
|
638
|
+
}), Re = [
|
|
639
639
|
"data-post-id",
|
|
640
640
|
"data-media-index",
|
|
641
641
|
"aria-hidden",
|
|
@@ -643,26 +643,27 @@ var Oe = /* @__PURE__ */ u({
|
|
|
643
643
|
"inert",
|
|
644
644
|
"role",
|
|
645
645
|
"tabindex"
|
|
646
|
-
],
|
|
646
|
+
], ze = { class: "media-card-content" }, Be = ["data-media-direction"], Ve = ["data-media-index"], He = {
|
|
647
647
|
key: 0,
|
|
648
648
|
"data-test": "media-loading",
|
|
649
649
|
class: "media-loading",
|
|
650
650
|
"aria-hidden": "true"
|
|
651
|
-
},
|
|
651
|
+
}, Ue = ["aria-label"], We = { class: "media-error-code" }, Ge = [
|
|
652
652
|
"src",
|
|
653
653
|
"width",
|
|
654
654
|
"height",
|
|
655
655
|
"loop",
|
|
656
656
|
"muted",
|
|
657
657
|
"preload"
|
|
658
|
-
],
|
|
658
|
+
], Ke = [
|
|
659
659
|
"src",
|
|
660
660
|
"width",
|
|
661
661
|
"height",
|
|
662
662
|
"fetchpriority"
|
|
663
|
-
],
|
|
663
|
+
], qe = ["aria-label"], Je = ["aria-label"], Ye = ["aria-label"], Xe = 40, Ze = 160, Qe = 24, $e = /* @__PURE__ */ d({
|
|
664
664
|
__name: "MediaCard",
|
|
665
665
|
props: {
|
|
666
|
+
active: { type: Boolean },
|
|
666
667
|
advanceOnMediaEnd: { type: Boolean },
|
|
667
668
|
cardFooter: {},
|
|
668
669
|
cardHeader: {},
|
|
@@ -679,6 +680,8 @@ var Oe = /* @__PURE__ */ u({
|
|
|
679
680
|
mediaCard: {},
|
|
680
681
|
mediaSource: {},
|
|
681
682
|
previewState: {},
|
|
683
|
+
reelControlsTarget: {},
|
|
684
|
+
stationaryReelControls: { type: Boolean },
|
|
682
685
|
total: {}
|
|
683
686
|
},
|
|
684
687
|
emits: [
|
|
@@ -688,16 +691,16 @@ var Oe = /* @__PURE__ */ u({
|
|
|
688
691
|
"mediaChange",
|
|
689
692
|
"ready"
|
|
690
693
|
],
|
|
691
|
-
setup(e, { emit:
|
|
692
|
-
let
|
|
694
|
+
setup(e, { emit: i }) {
|
|
695
|
+
let l = e, d = null, f = 0, p = !1, m = null, g = null, v = C("next"), b = i;
|
|
693
696
|
function x(e = !1, t = "pointer") {
|
|
694
697
|
e && b("activate", t);
|
|
695
698
|
}
|
|
696
|
-
let S =
|
|
699
|
+
let S = r(() => j(l.item)), E = r(() => M(l.item, l.mediaIndex)), D = r(() => N(l.item, E.value)), P = r(() => l.mediaSource === "original" ? D.value.src : D.value.preview.src), F = r(() => l.mediaSource === "original" ? D.value.width : D.value.preview.width), I = r(() => l.mediaSource === "original" ? D.value.height : D.value.preview.height), L = C(null), R = C(0), z = C(0), B = C(!0), V = C(!1), H = C(1), U = 1, W = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
697
700
|
function te(e) {
|
|
698
701
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
699
702
|
}
|
|
700
|
-
function
|
|
703
|
+
function G(e, t) {
|
|
701
704
|
let n = S.value.length, r = (e + n) % n;
|
|
702
705
|
r !== E.value && (v.value = e < E.value ? "previous" : "next", b("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
|
|
703
706
|
}
|
|
@@ -705,33 +708,33 @@ var Oe = /* @__PURE__ */ u({
|
|
|
705
708
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
706
709
|
}
|
|
707
710
|
function re() {
|
|
708
|
-
|
|
711
|
+
f = 0, p = !1, d !== null && clearTimeout(d), d = null;
|
|
709
712
|
}
|
|
710
713
|
function ie() {
|
|
711
|
-
|
|
714
|
+
d !== null && clearTimeout(d), d = setTimeout(re, Ze);
|
|
712
715
|
}
|
|
713
|
-
function
|
|
716
|
+
function K(e) {
|
|
714
717
|
if (S.value.length <= 1) return;
|
|
715
718
|
let t = e.currentTarget?.clientWidth || 1, n = ne(e.deltaX, e.deltaMode, t);
|
|
716
|
-
if (n === 0 || (e.preventDefault(), ie(),
|
|
717
|
-
let r = Math.sign(
|
|
718
|
-
|
|
719
|
+
if (n === 0 || (e.preventDefault(), ie(), p) || (f += n, Math.abs(f) < Qe)) return;
|
|
720
|
+
let r = Math.sign(f);
|
|
721
|
+
f = 0, p = !0, G(E.value + r);
|
|
719
722
|
}
|
|
720
|
-
function
|
|
723
|
+
function q(e) {
|
|
721
724
|
let t = e.touches[0];
|
|
722
|
-
|
|
725
|
+
l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
|
|
723
726
|
}
|
|
724
|
-
function
|
|
727
|
+
function ae(e) {
|
|
725
728
|
let t = e.changedTouches[0];
|
|
726
|
-
if (
|
|
727
|
-
let n =
|
|
728
|
-
|
|
729
|
+
if (m === null || g === null || !t) return;
|
|
730
|
+
let n = m - t.clientX, r = g - t.clientY;
|
|
731
|
+
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < Xe || G(E.value + Math.sign(n)));
|
|
729
732
|
}
|
|
730
|
-
let J =
|
|
731
|
-
function
|
|
732
|
-
|
|
733
|
+
let J = r(() => Oe(P.value)), Y = r(() => l.layout === "reel" && l.stationaryReelControls === !0), oe = r(() => J.value && l.previewState === "ready" && (!Y.value || !!(l.active && l.reelControlsTarget))), se = r(() => `${l.item.postId}:${E.value}:${P.value}`);
|
|
734
|
+
function X(e) {
|
|
735
|
+
l.layout === "reel" && (e.stopPropagation(), ce());
|
|
733
736
|
}
|
|
734
|
-
async function
|
|
737
|
+
async function ce() {
|
|
735
738
|
if (L.value) {
|
|
736
739
|
if (V.value) {
|
|
737
740
|
L.value.pause();
|
|
@@ -744,54 +747,54 @@ var Oe = /* @__PURE__ */ u({
|
|
|
744
747
|
}
|
|
745
748
|
}
|
|
746
749
|
}
|
|
747
|
-
function
|
|
750
|
+
function le(e) {
|
|
748
751
|
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
749
752
|
}
|
|
750
|
-
function
|
|
753
|
+
function Z(e) {
|
|
751
754
|
let t = e?.currentTarget ?? L.value;
|
|
752
|
-
t && (R.value =
|
|
755
|
+
t && (R.value = le(t.currentTime), z.value = le(t.duration), B.value = t.muted, H.value = t.volume, t.volume > 0 && (U = t.volume));
|
|
753
756
|
}
|
|
754
|
-
function
|
|
755
|
-
|
|
757
|
+
function ue(e) {
|
|
758
|
+
Z(e), b("ready", E.value);
|
|
756
759
|
}
|
|
757
|
-
function
|
|
760
|
+
function de() {
|
|
758
761
|
V.value = !1, b("ended", E.value);
|
|
759
762
|
}
|
|
760
|
-
function
|
|
763
|
+
function fe(e) {
|
|
761
764
|
let t = L.value;
|
|
762
|
-
!t || !Number.isFinite(e) || (t.currentTime = Math.min(
|
|
765
|
+
!t || !Number.isFinite(e) || (t.currentTime = Math.min(le(t.duration), Math.max(0, e)), R.value = t.currentTime);
|
|
763
766
|
}
|
|
764
|
-
function
|
|
767
|
+
function pe(e) {
|
|
765
768
|
let t = L.value;
|
|
766
769
|
if (!t || !Number.isFinite(e)) return;
|
|
767
770
|
let n = Math.min(1, Math.max(0, e));
|
|
768
|
-
t.volume = n, t.muted = n === 0, n > 0 && (
|
|
771
|
+
t.volume = n, t.muted = n === 0, n > 0 && (U = n), Z();
|
|
769
772
|
}
|
|
770
|
-
function
|
|
773
|
+
function me() {
|
|
771
774
|
let e = L.value;
|
|
772
|
-
e && (e.muted && e.volume === 0 && (e.volume =
|
|
775
|
+
e && (e.muted && e.volume === 0 && (e.volume = U), e.muted = !e.muted, Z());
|
|
773
776
|
}
|
|
774
|
-
return
|
|
777
|
+
return ee(() => {
|
|
775
778
|
re();
|
|
776
|
-
}), (
|
|
779
|
+
}), (r, i) => (y(), s("article", {
|
|
777
780
|
"data-post-id": e.item.postId,
|
|
778
781
|
"data-media-index": E.value,
|
|
779
|
-
class:
|
|
782
|
+
class: h(["media-card", {
|
|
780
783
|
"media-card--entering": e.entering,
|
|
781
784
|
"media-card--leaving": e.leaving,
|
|
782
785
|
"media-card--error": e.previewState === "error",
|
|
783
786
|
"media-card--transparent-chrome": e.mediaCard?.header?.background === "transparent" || e.mediaCard?.footer?.background === "transparent" || e.cardHeader?.background === "transparent" || e.cardFooter?.background === "transparent"
|
|
784
787
|
}]),
|
|
785
|
-
style:
|
|
788
|
+
style: _(e.itemStyle),
|
|
786
789
|
"aria-hidden": e.leaving || void 0,
|
|
787
790
|
"aria-busy": e.previewState === "loading",
|
|
788
791
|
inert: e.leaving || void 0,
|
|
789
|
-
role: e.interactive && !e.leaving && !
|
|
790
|
-
tabindex: e.interactive && !e.leaving && !
|
|
791
|
-
onClick:
|
|
792
|
-
onKeydown: [
|
|
793
|
-
}, [
|
|
794
|
-
e.cardHeader ? (y(),
|
|
792
|
+
role: e.interactive && !e.leaving && !W.value ? "button" : void 0,
|
|
793
|
+
tabindex: e.interactive && !e.leaving && !W.value ? 0 : void 0,
|
|
794
|
+
onClick: i[11] ||= (t) => x(e.interactive && !W.value, te(t)),
|
|
795
|
+
onKeydown: [i[12] ||= k((t) => x(e.interactive && !W.value, "keyboard"), ["enter"]), i[13] ||= k(A((t) => x(e.interactive && !W.value, "keyboard"), ["prevent"]), ["space"])]
|
|
796
|
+
}, [c("div", ze, [
|
|
797
|
+
e.cardHeader ? (y(), a(ke, {
|
|
795
798
|
key: 0,
|
|
796
799
|
index: e.index,
|
|
797
800
|
item: e.item,
|
|
@@ -801,7 +804,7 @@ var Oe = /* @__PURE__ */ u({
|
|
|
801
804
|
"media-source": e.mediaSource,
|
|
802
805
|
placement: "header",
|
|
803
806
|
region: e.cardHeader,
|
|
804
|
-
style:
|
|
807
|
+
style: _(e.mediaCard?.header),
|
|
805
808
|
total: e.total
|
|
806
809
|
}, null, 8, [
|
|
807
810
|
"index",
|
|
@@ -813,30 +816,30 @@ var Oe = /* @__PURE__ */ u({
|
|
|
813
816
|
"region",
|
|
814
817
|
"style",
|
|
815
818
|
"total"
|
|
816
|
-
])) :
|
|
817
|
-
|
|
818
|
-
class:
|
|
819
|
+
])) : o("", !0),
|
|
820
|
+
c("div", {
|
|
821
|
+
class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && S.value.length > 1 }]),
|
|
819
822
|
"data-media-direction": v.value,
|
|
820
|
-
onWheel:
|
|
821
|
-
onTouchstartPassive:
|
|
822
|
-
onTouchendPassive:
|
|
823
|
+
onWheel: K,
|
|
824
|
+
onTouchstartPassive: q,
|
|
825
|
+
onTouchendPassive: ae
|
|
823
826
|
}, [
|
|
824
|
-
|
|
825
|
-
default: O(() => [(y(),
|
|
826
|
-
key: `${e.item.postId}:${
|
|
827
|
+
u(n, { name: `media-slide-${v.value}` }, {
|
|
828
|
+
default: O(() => [(y(), s("div", {
|
|
829
|
+
key: `${e.item.postId}:${D.value.src}:${e.mediaSource ?? "preview"}`,
|
|
827
830
|
class: "media-card-frame",
|
|
828
831
|
"data-media-index": E.value
|
|
829
|
-
}, [e.previewState === "loading" ? (y(),
|
|
832
|
+
}, [e.previewState === "loading" ? (y(), s("div", He, [...i[14] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : e.previewState === "error" ? (y(), s("div", {
|
|
830
833
|
key: 1,
|
|
831
834
|
"data-test": "media-error",
|
|
832
835
|
class: "media-error",
|
|
833
836
|
role: "img",
|
|
834
|
-
"aria-label": `${T(
|
|
835
|
-
}, [
|
|
837
|
+
"aria-label": `${T(Te)(P.value)} ${T(Ee)(P.value)}`
|
|
838
|
+
}, [c("strong", We, w(T(Te)(P.value)), 1), c("span", null, w(T(Ee)(P.value)), 1)], 8, Ue)) : o("", !0), J.value ? (y(), s("video", {
|
|
836
839
|
key: 2,
|
|
837
840
|
ref_key: "videoElement",
|
|
838
841
|
ref: L,
|
|
839
|
-
class:
|
|
842
|
+
class: h(["media-preview", {
|
|
840
843
|
"media-preview--ready": e.previewState === "ready",
|
|
841
844
|
"media-preview--reel-video": e.layout === "reel"
|
|
842
845
|
}]),
|
|
@@ -848,18 +851,18 @@ var Oe = /* @__PURE__ */ u({
|
|
|
848
851
|
muted: B.value,
|
|
849
852
|
playsinline: "",
|
|
850
853
|
preload: e.fetchPriority === "high" ? "auto" : "metadata",
|
|
851
|
-
onLoadedmetadata:
|
|
852
|
-
onDurationchange:
|
|
853
|
-
onTimeupdate:
|
|
854
|
-
onVolumechange:
|
|
855
|
-
onPlaying:
|
|
856
|
-
onPause:
|
|
857
|
-
onEnded:
|
|
858
|
-
onClick:
|
|
859
|
-
onError:
|
|
860
|
-
}, null, 42,
|
|
854
|
+
onLoadedmetadata: ue,
|
|
855
|
+
onDurationchange: Z,
|
|
856
|
+
onTimeupdate: Z,
|
|
857
|
+
onVolumechange: Z,
|
|
858
|
+
onPlaying: i[0] ||= (e) => V.value = !0,
|
|
859
|
+
onPause: i[1] ||= (e) => V.value = !1,
|
|
860
|
+
onEnded: de,
|
|
861
|
+
onClick: X,
|
|
862
|
+
onError: i[2] ||= (e) => r.$emit("error", E.value)
|
|
863
|
+
}, null, 42, Ge)) : (y(), s("img", {
|
|
861
864
|
key: 3,
|
|
862
|
-
class:
|
|
865
|
+
class: h(["media-preview", { "media-preview--ready": e.previewState === "ready" }]),
|
|
863
866
|
src: P.value,
|
|
864
867
|
width: F.value ?? void 0,
|
|
865
868
|
height: I.value ?? void 0,
|
|
@@ -867,58 +870,69 @@ var Oe = /* @__PURE__ */ u({
|
|
|
867
870
|
alt: "",
|
|
868
871
|
decoding: "async",
|
|
869
872
|
loading: "eager",
|
|
870
|
-
onLoad:
|
|
871
|
-
onError:
|
|
872
|
-
}, null, 42,
|
|
873
|
+
onLoad: i[3] ||= (e) => r.$emit("ready", E.value),
|
|
874
|
+
onError: i[4] ||= (e) => r.$emit("error", E.value)
|
|
875
|
+
}, null, 42, Ke))], 8, Ve))]),
|
|
873
876
|
_: 1
|
|
874
877
|
}, 8, ["name"]),
|
|
875
|
-
|
|
878
|
+
(y(), a(t, {
|
|
879
|
+
disabled: !Y.value || !e.reelControlsTarget,
|
|
880
|
+
to: e.reelControlsTarget ?? "body"
|
|
881
|
+
}, [u(n, {
|
|
882
|
+
name: "vibe-reel-media-controls",
|
|
883
|
+
css: Y.value
|
|
884
|
+
}, {
|
|
885
|
+
default: O(() => [oe.value ? (y(), a(Le, {
|
|
886
|
+
key: se.value,
|
|
887
|
+
"current-time": R.value,
|
|
888
|
+
"data-control-post-id": Y.value ? e.item.postId : void 0,
|
|
889
|
+
duration: z.value,
|
|
890
|
+
layout: e.layout,
|
|
891
|
+
muted: B.value,
|
|
892
|
+
playing: V.value,
|
|
893
|
+
volume: H.value,
|
|
894
|
+
onSeek: fe,
|
|
895
|
+
onToggleMute: me,
|
|
896
|
+
onTogglePlayback: ce,
|
|
897
|
+
onVolumeChange: pe
|
|
898
|
+
}, null, 8, [
|
|
899
|
+
"current-time",
|
|
900
|
+
"data-control-post-id",
|
|
901
|
+
"duration",
|
|
902
|
+
"layout",
|
|
903
|
+
"muted",
|
|
904
|
+
"playing",
|
|
905
|
+
"volume"
|
|
906
|
+
])) : o("", !0)]),
|
|
907
|
+
_: 1
|
|
908
|
+
}, 8, ["css"])], 8, ["disabled", "to"])),
|
|
909
|
+
S.value.length > 1 ? (y(), s("div", {
|
|
876
910
|
key: 0,
|
|
877
|
-
"
|
|
878
|
-
duration: z.value,
|
|
879
|
-
layout: e.layout,
|
|
880
|
-
muted: B.value,
|
|
881
|
-
playing: V.value,
|
|
882
|
-
volume: ee.value,
|
|
883
|
-
onSeek: ce,
|
|
884
|
-
onToggleMute: ue,
|
|
885
|
-
onTogglePlayback: oe,
|
|
886
|
-
onVolumeChange: le
|
|
887
|
-
}, null, 8, [
|
|
888
|
-
"current-time",
|
|
889
|
-
"duration",
|
|
890
|
-
"layout",
|
|
891
|
-
"muted",
|
|
892
|
-
"playing",
|
|
893
|
-
"volume"
|
|
894
|
-
])) : a("", !0),
|
|
895
|
-
S.value.length > 1 ? (y(), o("div", {
|
|
896
|
-
key: 1,
|
|
897
|
-
class: m(["media-carousel-controls", { "media-carousel-controls--persistent": e.layout === "reel" }]),
|
|
911
|
+
class: h(["media-carousel-controls", { "media-carousel-controls--persistent": e.layout === "reel" }]),
|
|
898
912
|
"aria-label": "Media navigation"
|
|
899
|
-
}, [
|
|
913
|
+
}, [c("button", {
|
|
900
914
|
type: "button",
|
|
901
915
|
class: "media-carousel-control media-carousel-control--previous",
|
|
902
916
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
903
|
-
onClick:
|
|
904
|
-
onKeydown:
|
|
905
|
-
}, [
|
|
917
|
+
onClick: i[5] ||= A((e) => G(E.value - 1, e), ["stop"]),
|
|
918
|
+
onKeydown: i[6] ||= A(() => {}, ["stop"])
|
|
919
|
+
}, [u(T(ve), { size: 20 })], 40, qe), c("button", {
|
|
906
920
|
type: "button",
|
|
907
921
|
class: "media-carousel-control media-carousel-control--next",
|
|
908
922
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
909
|
-
onClick:
|
|
910
|
-
onKeydown:
|
|
911
|
-
}, [
|
|
912
|
-
|
|
913
|
-
key:
|
|
923
|
+
onClick: i[7] ||= A((e) => G(E.value + 1, e), ["stop"]),
|
|
924
|
+
onKeydown: i[8] ||= A(() => {}, ["stop"])
|
|
925
|
+
}, [u(T(ye), { size: 20 })], 40, Je)], 2)) : o("", !0),
|
|
926
|
+
W.value ? (y(), s("button", {
|
|
927
|
+
key: 1,
|
|
914
928
|
class: "media-card-activator",
|
|
915
929
|
type: "button",
|
|
916
930
|
"aria-label": `Open post ${e.item.postId}`,
|
|
917
|
-
onClick:
|
|
918
|
-
onKeydown:
|
|
919
|
-
}, null, 40,
|
|
920
|
-
], 42,
|
|
921
|
-
e.cardFooter ? (y(),
|
|
931
|
+
onClick: i[9] ||= A((e) => r.$emit("activate", te(e)), ["stop"]),
|
|
932
|
+
onKeydown: i[10] ||= A(() => {}, ["stop"])
|
|
933
|
+
}, null, 40, Ye)) : o("", !0)
|
|
934
|
+
], 42, Be),
|
|
935
|
+
e.cardFooter ? (y(), a(ke, {
|
|
922
936
|
key: 1,
|
|
923
937
|
index: e.index,
|
|
924
938
|
item: e.item,
|
|
@@ -928,7 +942,7 @@ var Oe = /* @__PURE__ */ u({
|
|
|
928
942
|
"media-source": e.mediaSource,
|
|
929
943
|
placement: "footer",
|
|
930
944
|
region: e.cardFooter,
|
|
931
|
-
style:
|
|
945
|
+
style: _(e.mediaCard?.footer),
|
|
932
946
|
total: e.total
|
|
933
947
|
}, null, 8, [
|
|
934
948
|
"index",
|
|
@@ -940,10 +954,10 @@ var Oe = /* @__PURE__ */ u({
|
|
|
940
954
|
"region",
|
|
941
955
|
"style",
|
|
942
956
|
"total"
|
|
943
|
-
])) :
|
|
944
|
-
])], 46,
|
|
957
|
+
])) : o("", !0)
|
|
958
|
+
])], 46, Re));
|
|
945
959
|
}
|
|
946
|
-
}),
|
|
960
|
+
}), et = { class: "masonry-feed-shell" }, tt = ["aria-hidden", "inert"], nt = 240, rt = 6, it = 12, at = 800, ot = 1.5, st = /* @__PURE__ */ d({
|
|
947
961
|
__name: "MasonryFeed",
|
|
948
962
|
props: {
|
|
949
963
|
enteringPostIds: {},
|
|
@@ -976,115 +990,115 @@ var Oe = /* @__PURE__ */ u({
|
|
|
976
990
|
"ready",
|
|
977
991
|
"retryEnd"
|
|
978
992
|
],
|
|
979
|
-
setup(t, { expose:
|
|
980
|
-
let
|
|
981
|
-
additionalHeight: (
|
|
982
|
-
gap:
|
|
983
|
-
minColumnWidth:
|
|
984
|
-
})),
|
|
985
|
-
let e =
|
|
986
|
-
if (
|
|
987
|
-
let t =
|
|
988
|
-
additionalHeight: (
|
|
989
|
-
gap:
|
|
990
|
-
minColumnWidth:
|
|
993
|
+
setup(t, { expose: n, emit: i }) {
|
|
994
|
+
let o = t, l = i, d = C(null), f = `vibe-masonry-${E()}`, p = C(null), m = C(0), g = C(rt), v = C(0), b = C(0), S = C(0), w = null, O = null, k = null, A = r(() => q(o.items, m.value, {
|
|
995
|
+
additionalHeight: (o.cardHeader?.height ?? 0) + (o.cardFooter?.height ?? 0),
|
|
996
|
+
gap: g.value,
|
|
997
|
+
minColumnWidth: nt
|
|
998
|
+
})), j = r(() => {
|
|
999
|
+
let e = A.value;
|
|
1000
|
+
if (o.leavingPostIds.size === 0) return e;
|
|
1001
|
+
let t = o.items.filter((e) => !o.leavingPostIds.has(e.postId)), n = q(t, m.value, {
|
|
1002
|
+
additionalHeight: (o.cardHeader?.height ?? 0) + (o.cardFooter?.height ?? 0),
|
|
1003
|
+
gap: g.value,
|
|
1004
|
+
minColumnWidth: nt
|
|
991
1005
|
}), r = new Map(t.map((e, t) => [e.postId, n.items[t]]));
|
|
992
1006
|
return {
|
|
993
1007
|
...n,
|
|
994
|
-
items:
|
|
1008
|
+
items: o.items.map((t, n) => o.leavingPostIds.has(t.postId) ? e.items[n] : r.get(t.postId) ?? e.items[n])
|
|
995
1009
|
};
|
|
996
|
-
}),
|
|
997
|
-
let e = Math.max(
|
|
998
|
-
scrollTop:
|
|
999
|
-
viewportHeight:
|
|
1000
|
-
}, n =
|
|
1010
|
+
}), M = r(() => ({ height: `${o.leavingPostIds.size === 0 ? j.value.height : A.value.height}px` })), N = r(() => {
|
|
1011
|
+
let e = Math.max(at, b.value * ot), t = {
|
|
1012
|
+
scrollTop: v.value - S.value,
|
|
1013
|
+
viewportHeight: b.value
|
|
1014
|
+
}, n = K(j.value.items, {
|
|
1001
1015
|
...t,
|
|
1002
1016
|
overscan: e
|
|
1003
|
-
}), r =
|
|
1017
|
+
}), r = o.leavingPostIds.size === 0 ? [] : K(A.value.items, {
|
|
1004
1018
|
...t,
|
|
1005
1019
|
overscan: e
|
|
1006
|
-
}), i = [...new Set([...n, ...r])].sort((e, t) => e - t), a =
|
|
1020
|
+
}), i = [...new Set([...n, ...r])].sort((e, t) => e - t), a = K(j.value.items, {
|
|
1007
1021
|
...t,
|
|
1008
1022
|
overscan: 0
|
|
1009
|
-
}),
|
|
1023
|
+
}), s = o.leavingPostIds.size === 0 ? [] : K(A.value.items, {
|
|
1010
1024
|
...t,
|
|
1011
1025
|
overscan: 0
|
|
1012
|
-
}),
|
|
1026
|
+
}), c = new Set([...a, ...s]);
|
|
1013
1027
|
return i.flatMap((e) => {
|
|
1014
|
-
let t =
|
|
1028
|
+
let t = o.items[e];
|
|
1015
1029
|
return t ? [{
|
|
1016
|
-
fetchPriority:
|
|
1030
|
+
fetchPriority: c.has(e) ? "high" : "low",
|
|
1017
1031
|
index: e,
|
|
1018
1032
|
item: t
|
|
1019
1033
|
}] : [];
|
|
1020
1034
|
});
|
|
1021
1035
|
});
|
|
1022
|
-
function
|
|
1023
|
-
let t =
|
|
1036
|
+
function F(e) {
|
|
1037
|
+
let t = j.value.items[e], n = o.items[e]?.postId;
|
|
1024
1038
|
if (!t) return {};
|
|
1025
|
-
let r = n !== void 0 &&
|
|
1026
|
-
containerHeight:
|
|
1027
|
-
gap:
|
|
1028
|
-
}) : 0,
|
|
1039
|
+
let r = n !== void 0 && o.enteringPostIds.has(n), i = n !== void 0 && o.leavingPostIds.has(n), a = r || i ? ie({
|
|
1040
|
+
containerHeight: A.value.height,
|
|
1041
|
+
gap: g.value
|
|
1042
|
+
}) : 0, s = n === void 0 ? 0 : i ? o.removalDelays.get(n) ?? 0 : r ? o.entryDelays.get(n) ?? 0 : 0;
|
|
1029
1043
|
return {
|
|
1030
|
-
"--masonry-entry-delay": `${
|
|
1044
|
+
"--masonry-entry-delay": `${s}ms`,
|
|
1031
1045
|
width: `${t.width}px`,
|
|
1032
1046
|
height: `${t.height}px`,
|
|
1033
1047
|
transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
|
|
1034
1048
|
};
|
|
1035
1049
|
}
|
|
1036
|
-
function
|
|
1050
|
+
function I() {
|
|
1037
1051
|
let e = d.value;
|
|
1038
1052
|
if (!e) return;
|
|
1039
|
-
|
|
1053
|
+
v.value = e.scrollTop, b.value = e.clientHeight;
|
|
1040
1054
|
let t = p.value;
|
|
1041
|
-
t && (
|
|
1055
|
+
t && (S.value = t.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop);
|
|
1042
1056
|
}
|
|
1043
|
-
function
|
|
1057
|
+
function L(e) {
|
|
1044
1058
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1045
|
-
|
|
1059
|
+
m.value = e.clientWidth, g.value = Math.min(it, Math.max(rt, t * .0075)), I();
|
|
1046
1060
|
}
|
|
1047
|
-
function
|
|
1061
|
+
function R(e) {
|
|
1048
1062
|
let t = e.currentTarget;
|
|
1049
|
-
t && (
|
|
1063
|
+
t && (v.value = t.scrollTop, !o.loadMoreLocked && o.infiniteScroll && G(t) && l("loadMore"));
|
|
1050
1064
|
}
|
|
1051
|
-
function
|
|
1065
|
+
function z() {
|
|
1052
1066
|
let e = d.value;
|
|
1053
|
-
!
|
|
1067
|
+
!o.loadMoreLocked && e && G(e) && l("loadMore");
|
|
1054
1068
|
}
|
|
1055
|
-
function
|
|
1069
|
+
function B() {
|
|
1056
1070
|
return d.value;
|
|
1057
1071
|
}
|
|
1058
1072
|
return D(p, (e) => {
|
|
1059
|
-
|
|
1073
|
+
w?.disconnect(), w = null, k !== null && cancelAnimationFrame(k), e && (L(e), !(typeof ResizeObserver > "u") && (w = new ResizeObserver(([t]) => {
|
|
1060
1074
|
let n = t?.contentRect.width ?? e.clientWidth;
|
|
1061
|
-
Math.abs(n -
|
|
1062
|
-
|
|
1075
|
+
Math.abs(n - m.value) < .5 || (k = requestAnimationFrame(() => {
|
|
1076
|
+
k = null, L(e);
|
|
1063
1077
|
}));
|
|
1064
|
-
}),
|
|
1078
|
+
}), w.observe(e)));
|
|
1065
1079
|
}), D(d, (e) => {
|
|
1066
|
-
|
|
1067
|
-
}),
|
|
1068
|
-
|
|
1069
|
-
}),
|
|
1070
|
-
getScrollElement:
|
|
1071
|
-
loadIfNearBottom:
|
|
1072
|
-
}), (n, r) => (y(),
|
|
1080
|
+
O?.disconnect(), O = null, e && (I(), !(typeof ResizeObserver > "u") && (O = new ResizeObserver(I), O.observe(e)));
|
|
1081
|
+
}), ee(() => {
|
|
1082
|
+
w?.disconnect(), O?.disconnect(), k !== null && cancelAnimationFrame(k);
|
|
1083
|
+
}), n({
|
|
1084
|
+
getScrollElement: B,
|
|
1085
|
+
loadIfNearBottom: z
|
|
1086
|
+
}), (n, r) => (y(), s("div", et, [c("main", {
|
|
1073
1087
|
id: f,
|
|
1074
1088
|
ref_key: "galleryElement",
|
|
1075
1089
|
ref: d,
|
|
1076
|
-
class:
|
|
1090
|
+
class: h(["gallery-shell masonry-feed", { "masonry-feed--suspended": t.suspended }]),
|
|
1077
1091
|
"data-layout-mode": "masonry",
|
|
1078
1092
|
"aria-hidden": t.suspended || void 0,
|
|
1079
1093
|
inert: t.suspended || void 0,
|
|
1080
|
-
onScrollPassive:
|
|
1081
|
-
}, [
|
|
1094
|
+
onScrollPassive: R
|
|
1095
|
+
}, [c("section", {
|
|
1082
1096
|
ref_key: "masonryElement",
|
|
1083
1097
|
ref: p,
|
|
1084
|
-
class:
|
|
1085
|
-
style:
|
|
1098
|
+
class: h(["masonry", { "masonry--ready": m.value > 0 }]),
|
|
1099
|
+
style: _(M.value),
|
|
1086
1100
|
"aria-label": "Media gallery"
|
|
1087
|
-
}, [(y(!0),
|
|
1101
|
+
}, [(y(!0), s(e, null, x(N.value, ({ fetchPriority: e, item: n, index: r }) => (y(), a($e, {
|
|
1088
1102
|
key: n.postId,
|
|
1089
1103
|
class: "masonry-item",
|
|
1090
1104
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1095,17 +1109,17 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1095
1109
|
"media-card": t.mediaCard,
|
|
1096
1110
|
index: r,
|
|
1097
1111
|
item: n,
|
|
1098
|
-
"item-style":
|
|
1112
|
+
"item-style": F(r),
|
|
1099
1113
|
interactive: "",
|
|
1100
1114
|
layout: "masonry",
|
|
1101
1115
|
"loaded-count": t.items.length,
|
|
1102
1116
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
1103
1117
|
"preview-state": t.previewStates.get(T(P)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
1104
1118
|
total: t.total,
|
|
1105
|
-
onActivate: (e) =>
|
|
1106
|
-
onMediaChange: (e) =>
|
|
1107
|
-
onReady: (e) =>
|
|
1108
|
-
onError: (e) =>
|
|
1119
|
+
onActivate: (e) => l("activate", n.postId, e),
|
|
1120
|
+
onMediaChange: (e) => l("mediaChange", n.postId, e),
|
|
1121
|
+
onReady: (e) => l("ready", n.postId, e),
|
|
1122
|
+
onError: (e) => l("error", n.postId, e)
|
|
1109
1123
|
}, null, 8, [
|
|
1110
1124
|
"entering",
|
|
1111
1125
|
"leaving",
|
|
@@ -1124,7 +1138,7 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1124
1138
|
"onMediaChange",
|
|
1125
1139
|
"onReady",
|
|
1126
1140
|
"onError"
|
|
1127
|
-
]))), 128))], 6),
|
|
1141
|
+
]))), 128))], 6), u(H, {
|
|
1128
1142
|
actions: t.feedFooterActions,
|
|
1129
1143
|
"can-retry-end": t.canRetryEnd,
|
|
1130
1144
|
"feed-footer": t.feedFooter,
|
|
@@ -1133,8 +1147,8 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1133
1147
|
"is-loading": t.isLoadingMore,
|
|
1134
1148
|
"load-more-locked": t.loadMoreLocked,
|
|
1135
1149
|
state: t.state,
|
|
1136
|
-
onLoadMore: r[0] ||= (e) =>
|
|
1137
|
-
onRetryEnd: r[1] ||= (e) =>
|
|
1150
|
+
onLoadMore: r[0] ||= (e) => l("loadMore"),
|
|
1151
|
+
onRetryEnd: r[1] ||= (e) => l("retryEnd")
|
|
1138
1152
|
}, null, 8, [
|
|
1139
1153
|
"actions",
|
|
1140
1154
|
"can-retry-end",
|
|
@@ -1144,8 +1158,8 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1144
1158
|
"is-loading",
|
|
1145
1159
|
"load-more-locked",
|
|
1146
1160
|
"state"
|
|
1147
|
-
])], 42,
|
|
1148
|
-
"content-size":
|
|
1161
|
+
])], 42, tt), u(le, {
|
|
1162
|
+
"content-size": j.value.height,
|
|
1149
1163
|
"controls-id": f,
|
|
1150
1164
|
"scroll-element": d.value,
|
|
1151
1165
|
suspended: t.suspended
|
|
@@ -1155,7 +1169,28 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1155
1169
|
"suspended"
|
|
1156
1170
|
])]));
|
|
1157
1171
|
}
|
|
1158
|
-
}),
|
|
1172
|
+
}), ct = 300;
|
|
1173
|
+
function lt(e, t, n) {
|
|
1174
|
+
let r = e.scrollTop;
|
|
1175
|
+
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
1176
|
+
e.setAttribute("data-transitioning", "");
|
|
1177
|
+
let i = performance.now(), a = 0;
|
|
1178
|
+
return new Promise((n) => {
|
|
1179
|
+
let o = (s) => {
|
|
1180
|
+
a += 1;
|
|
1181
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / ct), u = 1 - (1 - l) ** 3;
|
|
1182
|
+
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
1183
|
+
requestAnimationFrame(o);
|
|
1184
|
+
return;
|
|
1185
|
+
}
|
|
1186
|
+
e.removeAttribute("data-transitioning"), e.scrollTop = t, n();
|
|
1187
|
+
};
|
|
1188
|
+
requestAnimationFrame(o);
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
//#endregion
|
|
1192
|
+
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1193
|
+
var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
1159
1194
|
__name: "ReelAutoAdvanceProgress",
|
|
1160
1195
|
props: {
|
|
1161
1196
|
durationMs: {},
|
|
@@ -1163,19 +1198,19 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1163
1198
|
},
|
|
1164
1199
|
emits: ["complete"],
|
|
1165
1200
|
setup(e, { emit: t }) {
|
|
1166
|
-
let
|
|
1167
|
-
return (t, n) => (y(),
|
|
1201
|
+
let n = e, i = t, a = r(() => ({ "--vibe-reel-auto-advance-duration": `${n.durationMs}ms` }));
|
|
1202
|
+
return (t, n) => (y(), s("div", {
|
|
1168
1203
|
class: "reel-auto-advance",
|
|
1169
1204
|
"data-test": "reel-auto-advance",
|
|
1170
1205
|
role: "timer",
|
|
1171
1206
|
"aria-label": e.label
|
|
1172
|
-
}, [
|
|
1207
|
+
}, [c("span", {
|
|
1173
1208
|
class: "reel-auto-advance-progress",
|
|
1174
|
-
style:
|
|
1209
|
+
style: _(a.value),
|
|
1175
1210
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1176
|
-
}, null, 36)], 8,
|
|
1211
|
+
}, null, 36)], 8, ut));
|
|
1177
1212
|
}
|
|
1178
|
-
}),
|
|
1213
|
+
}), ft = { class: "reel-viewport" }, pt = ["data-active-post-id", "data-active-media-index"], mt = ["role", "data-status"], ht = 2, gt = 300, _t = /* @__PURE__ */ d({
|
|
1179
1214
|
__name: "ReelFeed",
|
|
1180
1215
|
props: {
|
|
1181
1216
|
initialPostId: {},
|
|
@@ -1211,154 +1246,161 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1211
1246
|
"retryEnd",
|
|
1212
1247
|
"retryForward"
|
|
1213
1248
|
],
|
|
1214
|
-
setup(t, { expose:
|
|
1215
|
-
let l = t, u =
|
|
1216
|
-
let e = Math.max(0,
|
|
1249
|
+
setup(t, { expose: n, emit: i }) {
|
|
1250
|
+
let l = t, u = i, d = C(null), f = C(null), p = l.initialPostId === null || l.initialPostId === void 0 ? -1 : l.items.findIndex((e) => e.postId === l.initialPostId), g = C(Math.max(0, p)), b = C(!1), S = C(!1), E = 0, O = null, k = null, A = null, M = r(() => ({ gridTemplateRows: `repeat(${l.items.length}, 100cqh)` })), F = r(() => {
|
|
1251
|
+
let e = Math.max(0, g.value - ht), t = Math.min(l.items.length - 1, g.value + ht);
|
|
1217
1252
|
return l.items.slice(e, t + 1).map((t, n) => ({
|
|
1218
|
-
fetchPriority: e + n ===
|
|
1253
|
+
fetchPriority: e + n === g.value ? "high" : "low",
|
|
1219
1254
|
index: e + n,
|
|
1220
1255
|
item: t
|
|
1221
1256
|
}));
|
|
1222
|
-
}),
|
|
1223
|
-
let e =
|
|
1257
|
+
}), I = r(() => l.items[g.value]?.postId), L = r(() => l.items[g.value]), R = r(() => {
|
|
1258
|
+
let e = I.value;
|
|
1224
1259
|
return e === void 0 ? 0 : l.mediaIndices.get(e) ?? 0;
|
|
1225
|
-
}),
|
|
1226
|
-
let e = F.value;
|
|
1227
|
-
return e === void 0 ? "loading" : l.previewStates.get(P(e, L.value)) ?? "loading";
|
|
1228
|
-
}), z = n(() => {
|
|
1260
|
+
}), z = r(() => {
|
|
1229
1261
|
let e = I.value;
|
|
1262
|
+
return e === void 0 ? "loading" : l.previewStates.get(P(e, R.value)) ?? "loading";
|
|
1263
|
+
}), B = r(() => {
|
|
1264
|
+
let e = L.value;
|
|
1230
1265
|
if (!e) return "";
|
|
1231
|
-
let t = N(e,
|
|
1266
|
+
let t = N(e, R.value);
|
|
1232
1267
|
return l.mediaSource === "original" ? t.src : t.preview.src;
|
|
1233
|
-
}),
|
|
1234
|
-
|
|
1235
|
-
|
|
1268
|
+
}), V = r(() => z.value === "ready" && Oe(B.value)), U = r(() => [
|
|
1269
|
+
I.value,
|
|
1270
|
+
R.value,
|
|
1236
1271
|
l.items.length,
|
|
1237
1272
|
l.loadMoreLocked,
|
|
1238
1273
|
l.reelAutoAdvance.enabled,
|
|
1239
1274
|
l.reelAutoAdvance.includePostItems,
|
|
1240
1275
|
l.reelAutoAdvance.intervalMs
|
|
1241
|
-
].join(":")),
|
|
1242
|
-
let e =
|
|
1276
|
+
].join(":")), W = r(() => {
|
|
1277
|
+
let e = L.value, t = !!(e && l.reelAutoAdvance.includePostItems && R.value < j(e).length - 1), n = l.reelAutoAdvance.intervalMs / 1e3;
|
|
1243
1278
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
1244
|
-
}),
|
|
1245
|
-
function
|
|
1279
|
+
}), te = r(() => l.reelAutoAdvance.enabled && l.reelForward.status === "idle" && L.value !== void 0 && z.value !== "loading" && !V.value), ne = 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.");
|
|
1280
|
+
function re(e) {
|
|
1246
1281
|
return { gridRow: `${e + 1}` };
|
|
1247
1282
|
}
|
|
1248
|
-
function
|
|
1249
|
-
let t =
|
|
1283
|
+
function ie(e) {
|
|
1284
|
+
let t = E || e.clientHeight;
|
|
1250
1285
|
return t <= 0 || l.items.length === 0 ? 0 : Math.min(l.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
1251
1286
|
}
|
|
1252
|
-
function
|
|
1287
|
+
function K(e) {
|
|
1253
1288
|
let t = e.currentTarget;
|
|
1254
|
-
|
|
1289
|
+
if (!t) return;
|
|
1290
|
+
let n = E || t.clientHeight, r = Math.max(0, l.items.length - 1) * n;
|
|
1291
|
+
b.value = l.items.length > 0 && t.scrollTop > r + 1, S.value || (g.value = ie(t)), !l.loadMoreLocked && l.infiniteScroll && G(t) && u("loadMore");
|
|
1255
1292
|
}
|
|
1256
|
-
function
|
|
1293
|
+
function q() {
|
|
1257
1294
|
let e = d.value;
|
|
1258
|
-
e && (
|
|
1259
|
-
e.scrollTop =
|
|
1260
|
-
}),
|
|
1295
|
+
e && (b.value = !1, Y(!0), E = e.clientHeight, e.scrollTop = g.value * E, k !== null && cancelAnimationFrame(k), k = requestAnimationFrame(() => {
|
|
1296
|
+
e.scrollTop = g.value * e.clientHeight, E = e.clientHeight, k = null;
|
|
1297
|
+
}), ae());
|
|
1261
1298
|
}
|
|
1262
|
-
function
|
|
1263
|
-
|
|
1264
|
-
|
|
1299
|
+
function ae() {
|
|
1300
|
+
A !== null && clearTimeout(A), A = setTimeout(() => {
|
|
1301
|
+
A = null;
|
|
1265
1302
|
let e = d.value;
|
|
1266
|
-
e && (
|
|
1303
|
+
e && (E = e.clientHeight, e.scrollTop = g.value * E), Y(!1);
|
|
1267
1304
|
}, 120);
|
|
1268
1305
|
}
|
|
1269
|
-
function
|
|
1270
|
-
|
|
1306
|
+
function J() {
|
|
1307
|
+
Y(!0);
|
|
1271
1308
|
let e = d.value;
|
|
1272
|
-
e && (
|
|
1309
|
+
e && (E = e.clientHeight, e.scrollTop = g.value * E), ae();
|
|
1273
1310
|
}
|
|
1274
|
-
function
|
|
1275
|
-
|
|
1311
|
+
function Y(e) {
|
|
1312
|
+
S.value = e, d.value?.toggleAttribute("data-resizing", e);
|
|
1276
1313
|
}
|
|
1277
|
-
function
|
|
1314
|
+
function oe() {
|
|
1278
1315
|
let e = d.value;
|
|
1279
|
-
!l.loadMoreLocked && e &&
|
|
1316
|
+
!l.loadMoreLocked && e && G(e) && u("loadMore");
|
|
1280
1317
|
}
|
|
1281
|
-
function
|
|
1282
|
-
let t =
|
|
1318
|
+
function se(e) {
|
|
1319
|
+
let t = L.value;
|
|
1283
1320
|
if (!t) return !1;
|
|
1284
1321
|
let n = j(t).length;
|
|
1285
1322
|
if (n <= 1) return !1;
|
|
1286
|
-
let r = (
|
|
1323
|
+
let r = (R.value + e + n) % n;
|
|
1287
1324
|
return u("mediaChange", t.postId, r), !0;
|
|
1288
1325
|
}
|
|
1289
|
-
function
|
|
1290
|
-
let t =
|
|
1326
|
+
function X(e) {
|
|
1327
|
+
let t = g.value + e;
|
|
1291
1328
|
return !d.value || t < 0 || t >= l.items.length ? !1 : (Z(t), !0);
|
|
1292
1329
|
}
|
|
1293
|
-
function
|
|
1330
|
+
function ce() {
|
|
1294
1331
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1295
1332
|
}
|
|
1296
|
-
function
|
|
1333
|
+
function le(e) {
|
|
1297
1334
|
let t = d.value;
|
|
1298
|
-
if (!t) return;
|
|
1299
|
-
let n = e * (
|
|
1300
|
-
|
|
1301
|
-
t.scrollTo({
|
|
1302
|
-
behavior: "smooth",
|
|
1303
|
-
top: n
|
|
1304
|
-
});
|
|
1305
|
-
return;
|
|
1306
|
-
}
|
|
1307
|
-
t.scrollTop = n;
|
|
1335
|
+
if (!t) return Promise.resolve();
|
|
1336
|
+
let n = e * (E || t.clientHeight);
|
|
1337
|
+
return g.value = e, lt(t, n, ce());
|
|
1308
1338
|
}
|
|
1309
|
-
function
|
|
1339
|
+
function Z(e) {
|
|
1340
|
+
le(e);
|
|
1341
|
+
}
|
|
1342
|
+
async function ue(e) {
|
|
1343
|
+
let t = l.items.findIndex((t) => t.postId === e);
|
|
1344
|
+
return t < 0 || t === g.value ? !1 : (await le(t), !0);
|
|
1345
|
+
}
|
|
1346
|
+
async function de(e) {
|
|
1347
|
+
return se(e) ? (ce() || await new Promise((e) => setTimeout(e, gt)), !0) : !1;
|
|
1348
|
+
}
|
|
1349
|
+
function fe() {
|
|
1310
1350
|
if (!l.reelAutoAdvance.enabled) return;
|
|
1311
|
-
let e =
|
|
1351
|
+
let e = L.value;
|
|
1312
1352
|
if (!e) return;
|
|
1313
|
-
if (l.reelAutoAdvance.includePostItems &&
|
|
1314
|
-
u("mediaChange", e.postId,
|
|
1353
|
+
if (l.reelAutoAdvance.includePostItems && R.value < j(e).length - 1) {
|
|
1354
|
+
u("mediaChange", e.postId, R.value + 1);
|
|
1315
1355
|
return;
|
|
1316
1356
|
}
|
|
1317
|
-
let t =
|
|
1357
|
+
let t = g.value + 1, n = l.items[t];
|
|
1318
1358
|
if (!n) {
|
|
1319
1359
|
l.hasNext && !l.loadMoreLocked && u("loadMore");
|
|
1320
1360
|
return;
|
|
1321
1361
|
}
|
|
1322
1362
|
l.reelAutoAdvance.includePostItems && (l.mediaIndices.get(n.postId) ?? 0) !== 0 && u("mediaChange", n.postId, 0), Z(t);
|
|
1323
1363
|
}
|
|
1324
|
-
function
|
|
1325
|
-
!l.reelAutoAdvance.enabled || e !==
|
|
1364
|
+
function pe(e, t) {
|
|
1365
|
+
!l.reelAutoAdvance.enabled || e !== I.value || t !== R.value || !V.value || fe();
|
|
1326
1366
|
}
|
|
1327
1367
|
return D(d, (e) => {
|
|
1328
|
-
|
|
1329
|
-
}), D(
|
|
1330
|
-
let n = t == null ? -1 : l.items.findIndex(({ postId: e }) => e === t);
|
|
1331
|
-
|
|
1332
|
-
}), D(
|
|
1368
|
+
O?.disconnect(), O = null, e && (E = e.clientHeight, !(typeof ResizeObserver > "u") && (O = new ResizeObserver(q), O.observe(e)));
|
|
1369
|
+
}), D(() => l.items.length, async (e) => {
|
|
1370
|
+
let t = l.initialPostId, n = t == null ? -1 : l.items.findIndex(({ postId: e }) => e === t);
|
|
1371
|
+
g.value = n >= 0 ? n : Math.min(g.value, Math.max(0, e - 1)), await m(), q();
|
|
1372
|
+
}), D(I, (e) => {
|
|
1333
1373
|
e !== void 0 && u("activeChange", e);
|
|
1334
1374
|
}, { immediate: !0 }), v(() => {
|
|
1335
|
-
window.addEventListener("resize",
|
|
1336
|
-
}),
|
|
1337
|
-
window.removeEventListener("resize",
|
|
1338
|
-
}),
|
|
1339
|
-
activeIndex:
|
|
1340
|
-
activePostId:
|
|
1341
|
-
changeActiveMedia:
|
|
1342
|
-
loadIfNearBottom:
|
|
1343
|
-
moveActivePost:
|
|
1344
|
-
|
|
1345
|
-
|
|
1375
|
+
window.addEventListener("resize", J), window.addEventListener("orientationchange", J), p >= 0 && m(q);
|
|
1376
|
+
}), ee(() => {
|
|
1377
|
+
window.removeEventListener("resize", J), window.removeEventListener("orientationchange", J), O?.disconnect(), k !== null && cancelAnimationFrame(k), A !== null && clearTimeout(A);
|
|
1378
|
+
}), n({
|
|
1379
|
+
activeIndex: g,
|
|
1380
|
+
activePostId: I,
|
|
1381
|
+
changeActiveMedia: se,
|
|
1382
|
+
loadIfNearBottom: oe,
|
|
1383
|
+
moveActivePost: X,
|
|
1384
|
+
transitionActiveMedia: de,
|
|
1385
|
+
transitionActivePost: ue
|
|
1386
|
+
}), (n, r) => (y(), s("main", {
|
|
1387
|
+
class: h(["reel-shell", {
|
|
1346
1388
|
"reel-shell--has-footer": !!t.cardFooter,
|
|
1347
1389
|
"reel-shell--has-header": !!t.cardHeader
|
|
1348
1390
|
}]),
|
|
1349
1391
|
"data-layout-mode": "reel"
|
|
1350
1392
|
}, [
|
|
1351
|
-
t.cardHeader &&
|
|
1393
|
+
t.cardHeader && L.value && t.reelForward.status === "idle" ? (y(), a(ke, {
|
|
1352
1394
|
key: 0,
|
|
1353
|
-
index:
|
|
1354
|
-
item:
|
|
1395
|
+
index: g.value,
|
|
1396
|
+
item: L.value,
|
|
1355
1397
|
layout: "reel",
|
|
1356
1398
|
"loaded-count": t.items.length,
|
|
1357
|
-
"media-index":
|
|
1399
|
+
"media-index": R.value,
|
|
1358
1400
|
"media-source": t.mediaSource,
|
|
1359
1401
|
placement: "header",
|
|
1360
1402
|
region: t.cardHeader,
|
|
1361
|
-
style:
|
|
1403
|
+
style: _(t.mediaCard?.header),
|
|
1362
1404
|
total: t.total
|
|
1363
1405
|
}, null, 8, [
|
|
1364
1406
|
"index",
|
|
@@ -1369,40 +1411,44 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1369
1411
|
"region",
|
|
1370
1412
|
"style",
|
|
1371
1413
|
"total"
|
|
1372
|
-
])) :
|
|
1373
|
-
|
|
1414
|
+
])) : o("", !0),
|
|
1415
|
+
c("div", ft, [c("div", {
|
|
1374
1416
|
ref_key: "galleryElement",
|
|
1375
1417
|
ref: d,
|
|
1376
1418
|
class: "gallery-shell reel-feed",
|
|
1377
|
-
"data-active-post-id":
|
|
1378
|
-
"data-active-media-index":
|
|
1379
|
-
onScrollPassive:
|
|
1380
|
-
}, [t.reelForward.status === "idle" ? (y(),
|
|
1419
|
+
"data-active-post-id": I.value,
|
|
1420
|
+
"data-active-media-index": R.value,
|
|
1421
|
+
onScrollPassive: K
|
|
1422
|
+
}, [t.reelForward.status === "idle" ? (y(), s("section", {
|
|
1381
1423
|
key: 1,
|
|
1382
1424
|
class: "reel-track",
|
|
1383
|
-
style:
|
|
1425
|
+
style: _(M.value),
|
|
1384
1426
|
"aria-label": "Media gallery"
|
|
1385
|
-
}, [(y(!0),
|
|
1427
|
+
}, [(y(!0), s(e, null, x(F.value, ({ fetchPriority: e, item: n, index: r }) => (y(), a($e, {
|
|
1386
1428
|
key: n.postId,
|
|
1387
|
-
|
|
1429
|
+
active: r === g.value && !b.value,
|
|
1430
|
+
"advance-on-media-end": l.reelAutoAdvance.enabled && r === g.value,
|
|
1388
1431
|
class: "reel-item",
|
|
1389
1432
|
entering: !1,
|
|
1390
1433
|
"fetch-priority": e,
|
|
1391
1434
|
index: r,
|
|
1392
1435
|
item: n,
|
|
1393
|
-
"item-style":
|
|
1436
|
+
"item-style": re(r),
|
|
1394
1437
|
"media-card": t.mediaCard,
|
|
1395
1438
|
layout: "reel",
|
|
1396
1439
|
"loaded-count": t.items.length,
|
|
1397
1440
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
1398
1441
|
"media-source": t.mediaSource,
|
|
1399
1442
|
"preview-state": t.previewStates.get(T(P)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
1443
|
+
"reel-controls-target": f.value,
|
|
1444
|
+
"stationary-reel-controls": "",
|
|
1400
1445
|
total: t.total,
|
|
1401
1446
|
onMediaChange: (e) => u("mediaChange", n.postId, e),
|
|
1402
|
-
onEnded: (e) =>
|
|
1447
|
+
onEnded: (e) => pe(n.postId, e),
|
|
1403
1448
|
onReady: (e) => u("ready", n.postId, e),
|
|
1404
1449
|
onError: (e) => u("error", n.postId, e)
|
|
1405
1450
|
}, null, 8, [
|
|
1451
|
+
"active",
|
|
1406
1452
|
"advance-on-media-end",
|
|
1407
1453
|
"fetch-priority",
|
|
1408
1454
|
"index",
|
|
@@ -1413,22 +1459,23 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1413
1459
|
"media-index",
|
|
1414
1460
|
"media-source",
|
|
1415
1461
|
"preview-state",
|
|
1462
|
+
"reel-controls-target",
|
|
1416
1463
|
"total",
|
|
1417
1464
|
"onMediaChange",
|
|
1418
1465
|
"onEnded",
|
|
1419
1466
|
"onReady",
|
|
1420
1467
|
"onError"
|
|
1421
|
-
]))), 128))], 4)) : (y(),
|
|
1468
|
+
]))), 128))], 4)) : (y(), s("div", {
|
|
1422
1469
|
key: 0,
|
|
1423
1470
|
class: "reel-forward-status",
|
|
1424
1471
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
1425
1472
|
"data-status": t.reelForward.status
|
|
1426
|
-
}, [
|
|
1473
|
+
}, [c("p", null, w(ne.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (y(), s("button", {
|
|
1427
1474
|
key: 0,
|
|
1428
1475
|
class: "reel-forward-retry",
|
|
1429
1476
|
type: "button",
|
|
1430
1477
|
onClick: r[0] ||= (e) => u("retryForward")
|
|
1431
|
-
}, " Retry ")) :
|
|
1478
|
+
}, " Retry ")) : o("", !0)], 8, mt)), t.reelForward.status === "idle" ? (y(), a(H, {
|
|
1432
1479
|
key: 2,
|
|
1433
1480
|
actions: t.feedFooterActions,
|
|
1434
1481
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -1449,18 +1496,23 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1449
1496
|
"is-loading",
|
|
1450
1497
|
"load-more-locked",
|
|
1451
1498
|
"state"
|
|
1452
|
-
])) :
|
|
1453
|
-
|
|
1499
|
+
])) : o("", !0)], 40, pt), c("div", {
|
|
1500
|
+
ref_key: "reelControlsElement",
|
|
1501
|
+
ref: f,
|
|
1502
|
+
class: "reel-media-controls-host",
|
|
1503
|
+
"data-test": "reel-media-controls-host"
|
|
1504
|
+
}, null, 512)]),
|
|
1505
|
+
t.cardFooter && L.value && t.reelForward.status === "idle" ? (y(), a(ke, {
|
|
1454
1506
|
key: 1,
|
|
1455
|
-
index:
|
|
1456
|
-
item:
|
|
1507
|
+
index: g.value,
|
|
1508
|
+
item: L.value,
|
|
1457
1509
|
layout: "reel",
|
|
1458
1510
|
"loaded-count": t.items.length,
|
|
1459
|
-
"media-index":
|
|
1511
|
+
"media-index": R.value,
|
|
1460
1512
|
"media-source": t.mediaSource,
|
|
1461
1513
|
placement: "footer",
|
|
1462
1514
|
region: t.cardFooter,
|
|
1463
|
-
style:
|
|
1515
|
+
style: _(t.mediaCard?.footer),
|
|
1464
1516
|
total: t.total
|
|
1465
1517
|
}, null, 8, [
|
|
1466
1518
|
"index",
|
|
@@ -1471,25 +1523,25 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1471
1523
|
"region",
|
|
1472
1524
|
"style",
|
|
1473
1525
|
"total"
|
|
1474
|
-
])) :
|
|
1475
|
-
|
|
1476
|
-
key:
|
|
1526
|
+
])) : o("", !0),
|
|
1527
|
+
te.value ? (y(), a(dt, {
|
|
1528
|
+
key: U.value,
|
|
1477
1529
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1478
|
-
label:
|
|
1479
|
-
onComplete:
|
|
1480
|
-
}, null, 8, ["duration-ms", "label"])) :
|
|
1530
|
+
label: W.value,
|
|
1531
|
+
onComplete: fe
|
|
1532
|
+
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
1481
1533
|
], 2));
|
|
1482
1534
|
}
|
|
1483
|
-
}),
|
|
1535
|
+
}), vt = ["data-info-sheet-open", "data-info-sheet-mode"], yt = ["aria-hidden", "inert"], bt = {
|
|
1484
1536
|
key: 0,
|
|
1485
1537
|
class: "reel-info-sheet-layer",
|
|
1486
1538
|
"data-test": "reel-info-sheet"
|
|
1487
|
-
},
|
|
1539
|
+
}, xt = [
|
|
1488
1540
|
"role",
|
|
1489
1541
|
"aria-modal",
|
|
1490
1542
|
"tabindex",
|
|
1491
1543
|
"data-active-post-id"
|
|
1492
|
-
],
|
|
1544
|
+
], St = /* @__PURE__ */ d({
|
|
1493
1545
|
__name: "ReelLayout",
|
|
1494
1546
|
props: {
|
|
1495
1547
|
forwardIndex: { default: null },
|
|
@@ -1532,79 +1584,87 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1532
1584
|
"retryEnd",
|
|
1533
1585
|
"retryForward"
|
|
1534
1586
|
],
|
|
1535
|
-
setup(e, { expose:
|
|
1536
|
-
let
|
|
1537
|
-
let e =
|
|
1587
|
+
setup(e, { expose: t, emit: i }) {
|
|
1588
|
+
let l = e, d = i, p = C(null), _ = C(null), v = null, b = r(() => {
|
|
1589
|
+
let e = l.initialPostId === null || l.initialPostId === void 0 ? -1 : l.items.findIndex((e) => e.postId === l.initialPostId);
|
|
1538
1590
|
return Math.max(0, e);
|
|
1539
|
-
}),
|
|
1540
|
-
let e =
|
|
1541
|
-
return e === void 0 ? 0 :
|
|
1542
|
-
}),
|
|
1543
|
-
let e =
|
|
1591
|
+
}), x = r(() => l.items[b.value]), w = r(() => x.value ?? (l.reelForward.status === "idle" ? void 0 : l.forwardItem ?? void 0)), T = r(() => x.value ? b.value : l.forwardIndex ?? 0), E = r(() => {
|
|
1592
|
+
let e = w.value?.postId;
|
|
1593
|
+
return e === void 0 ? 0 : l.mediaIndices.get(e) ?? 0;
|
|
1594
|
+
}), k = r(() => !!(l.infoSheet && l.infoSheetEnabled && w.value)), A = r(() => {
|
|
1595
|
+
let e = w.value;
|
|
1544
1596
|
return e ? {
|
|
1545
|
-
close:
|
|
1546
|
-
index:
|
|
1597
|
+
close: M,
|
|
1598
|
+
index: T.value,
|
|
1547
1599
|
item: e,
|
|
1548
1600
|
layout: "reel",
|
|
1549
|
-
loadedCount:
|
|
1601
|
+
loadedCount: l.items.length,
|
|
1550
1602
|
mediaCount: j(e).length,
|
|
1551
|
-
mediaIndex:
|
|
1552
|
-
mediaItem: N(e,
|
|
1553
|
-
mediaSource:
|
|
1554
|
-
origin:
|
|
1555
|
-
total:
|
|
1603
|
+
mediaIndex: E.value,
|
|
1604
|
+
mediaItem: N(e, E.value),
|
|
1605
|
+
mediaSource: l.mediaSource ?? "preview",
|
|
1606
|
+
origin: l.origin,
|
|
1607
|
+
total: l.total
|
|
1556
1608
|
} : null;
|
|
1557
1609
|
});
|
|
1558
|
-
function
|
|
1559
|
-
|
|
1610
|
+
function M() {
|
|
1611
|
+
d("closeInfoSheet");
|
|
1560
1612
|
}
|
|
1561
|
-
function
|
|
1562
|
-
return
|
|
1613
|
+
function P(e) {
|
|
1614
|
+
return p.value?.changeActiveMedia(e) ?? !1;
|
|
1563
1615
|
}
|
|
1564
|
-
function
|
|
1565
|
-
|
|
1616
|
+
function F() {
|
|
1617
|
+
p.value?.loadIfNearBottom();
|
|
1618
|
+
}
|
|
1619
|
+
function I(e) {
|
|
1620
|
+
return p.value?.moveActivePost(e) ?? !1;
|
|
1566
1621
|
}
|
|
1567
1622
|
function L(e) {
|
|
1568
|
-
return
|
|
1623
|
+
return p.value?.transitionActiveMedia(e) ?? Promise.resolve(!1);
|
|
1569
1624
|
}
|
|
1570
|
-
function R(e
|
|
1571
|
-
|
|
1625
|
+
function R(e) {
|
|
1626
|
+
return p.value?.transitionActivePost(e) ?? Promise.resolve(!1);
|
|
1572
1627
|
}
|
|
1573
1628
|
function z(e, t) {
|
|
1574
|
-
|
|
1629
|
+
d("error", e, t);
|
|
1575
1630
|
}
|
|
1576
1631
|
function B(e, t) {
|
|
1577
|
-
|
|
1632
|
+
d("mediaChange", e, t);
|
|
1633
|
+
}
|
|
1634
|
+
function V(e, t) {
|
|
1635
|
+
d("ready", e, t);
|
|
1578
1636
|
}
|
|
1579
1637
|
return D(() => ({
|
|
1580
|
-
overlay:
|
|
1581
|
-
visible:
|
|
1638
|
+
overlay: l.infoSheetOverlay,
|
|
1639
|
+
visible: k.value
|
|
1582
1640
|
}), async (e, t) => {
|
|
1583
1641
|
if (e.visible && !t?.visible) {
|
|
1584
|
-
|
|
1642
|
+
v = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.overlay && (await m(), _.value?.focus({ preventScroll: !0 }));
|
|
1585
1643
|
return;
|
|
1586
1644
|
}
|
|
1587
|
-
if (!e.visible && t?.visible &&
|
|
1588
|
-
let e =
|
|
1589
|
-
|
|
1645
|
+
if (!e.visible && t?.visible && v?.isConnected) {
|
|
1646
|
+
let e = v;
|
|
1647
|
+
v = null, await m(), e.focus({ preventScroll: !0 });
|
|
1590
1648
|
}
|
|
1591
|
-
}),
|
|
1592
|
-
|
|
1593
|
-
}),
|
|
1594
|
-
changeActiveMedia:
|
|
1595
|
-
loadIfNearBottom:
|
|
1596
|
-
moveActivePost:
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1649
|
+
}), ee(() => {
|
|
1650
|
+
v = null;
|
|
1651
|
+
}), t({
|
|
1652
|
+
changeActiveMedia: P,
|
|
1653
|
+
loadIfNearBottom: F,
|
|
1654
|
+
moveActivePost: I,
|
|
1655
|
+
transitionActiveMedia: L,
|
|
1656
|
+
transitionActivePost: R
|
|
1657
|
+
}), (t, r) => (y(), s("section", {
|
|
1658
|
+
class: h(["reel-layout", `reel-layout--${e.infoSheetOverlay ? "overlay" : "layout"}`]),
|
|
1659
|
+
"data-info-sheet-open": k.value || void 0,
|
|
1600
1660
|
"data-info-sheet-mode": e.infoSheetOverlay ? "overlay" : "layout"
|
|
1601
|
-
}, [
|
|
1661
|
+
}, [c("div", {
|
|
1602
1662
|
class: "reel-layout-main",
|
|
1603
|
-
"aria-hidden": e.infoSheetOverlay &&
|
|
1604
|
-
inert: e.infoSheetOverlay &&
|
|
1605
|
-
}, [
|
|
1663
|
+
"aria-hidden": e.infoSheetOverlay && k.value || void 0,
|
|
1664
|
+
inert: e.infoSheetOverlay && k.value || void 0
|
|
1665
|
+
}, [u(_t, {
|
|
1606
1666
|
ref_key: "reelFeed",
|
|
1607
|
-
ref:
|
|
1667
|
+
ref: p,
|
|
1608
1668
|
"can-retry-end": e.canRetryEnd,
|
|
1609
1669
|
"card-footer": e.cardFooter,
|
|
1610
1670
|
"card-header": e.cardHeader,
|
|
@@ -1625,13 +1685,13 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1625
1685
|
"reel-forward": e.reelForward,
|
|
1626
1686
|
state: e.state,
|
|
1627
1687
|
total: e.total,
|
|
1628
|
-
onActiveChange: r[0] ||= (e) =>
|
|
1629
|
-
onError:
|
|
1630
|
-
onLoadMore: r[1] ||= (e) =>
|
|
1631
|
-
onMediaChange:
|
|
1632
|
-
onReady:
|
|
1633
|
-
onRetryEnd: r[2] ||= (e) =>
|
|
1634
|
-
onRetryForward: r[3] ||= (e) =>
|
|
1688
|
+
onActiveChange: r[0] ||= (e) => d("activeChange", e),
|
|
1689
|
+
onError: z,
|
|
1690
|
+
onLoadMore: r[1] ||= (e) => d("loadMore"),
|
|
1691
|
+
onMediaChange: B,
|
|
1692
|
+
onReady: V,
|
|
1693
|
+
onRetryEnd: r[2] ||= (e) => d("retryEnd"),
|
|
1694
|
+
onRetryForward: r[3] ||= (e) => d("retryForward")
|
|
1635
1695
|
}, null, 8, [
|
|
1636
1696
|
"can-retry-end",
|
|
1637
1697
|
"card-footer",
|
|
@@ -1653,21 +1713,21 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1653
1713
|
"reel-forward",
|
|
1654
1714
|
"state",
|
|
1655
1715
|
"total"
|
|
1656
|
-
])], 8,
|
|
1657
|
-
default: O(() => [
|
|
1716
|
+
])], 8, yt), u(n, { name: "vibe-info-sheet" }, {
|
|
1717
|
+
default: O(() => [k.value && e.infoSheet && A.value ? (y(), s("div", bt, [c("aside", {
|
|
1658
1718
|
ref_key: "sheetElement",
|
|
1659
|
-
ref:
|
|
1719
|
+
ref: _,
|
|
1660
1720
|
class: "reel-info-sheet",
|
|
1661
1721
|
role: e.infoSheetOverlay ? "dialog" : "complementary",
|
|
1662
1722
|
"aria-label": "Reel information",
|
|
1663
1723
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
1664
1724
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
1665
|
-
"data-active-post-id":
|
|
1666
|
-
}, [(y(),
|
|
1725
|
+
"data-active-post-id": w.value?.postId
|
|
1726
|
+
}, [(y(), a(S(e.infoSheet.component), g(f(A.value)), null, 16))], 8, xt)])) : o("", !0)]),
|
|
1667
1727
|
_: 1
|
|
1668
|
-
})], 10,
|
|
1728
|
+
})], 10, vt));
|
|
1669
1729
|
}
|
|
1670
|
-
}),
|
|
1730
|
+
}), Ct = 35, wt = 420, Tt = /* @__PURE__ */ d({
|
|
1671
1731
|
__name: "VibeSurface",
|
|
1672
1732
|
props: {
|
|
1673
1733
|
canRetryEnd: { type: Boolean },
|
|
@@ -1688,94 +1748,94 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1688
1748
|
"retryEnd",
|
|
1689
1749
|
"retryForward"
|
|
1690
1750
|
],
|
|
1691
|
-
setup(
|
|
1692
|
-
let
|
|
1693
|
-
function
|
|
1751
|
+
setup(t, { expose: i, emit: c }) {
|
|
1752
|
+
let l = t, d = c, f = C(null), p = C(null), h = C(null), g = C(null), b = C({}), x = C(!1), S = C(/* @__PURE__ */ new Set()), w = C(/* @__PURE__ */ new Map()), T = C(/* @__PURE__ */ new Set()), E = C(/* @__PURE__ */ new Map()), k = C(/* @__PURE__ */ new Map()), A = C(/* @__PURE__ */ new Map()), j = r(() => F(l.state)), N = r(() => l.state.reelMediaSource === "original" ? A.value : k.value), I = new Set(l.state.items.map((e) => e.postId)), L = null, R = null, z = !1;
|
|
1753
|
+
function B() {
|
|
1694
1754
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1695
1755
|
}
|
|
1696
|
-
function
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1756
|
+
function V() {
|
|
1757
|
+
L !== null && cancelAnimationFrame(L), L = requestAnimationFrame(() => {
|
|
1758
|
+
L = requestAnimationFrame(() => {
|
|
1759
|
+
L = null, S.value = /* @__PURE__ */ new Set();
|
|
1700
1760
|
});
|
|
1701
1761
|
});
|
|
1702
1762
|
}
|
|
1703
1763
|
function H(e, t, n) {
|
|
1704
1764
|
let r = P(e, t);
|
|
1705
|
-
|
|
1765
|
+
k.value.get(r) !== n && (k.value = new Map(k.value).set(r, n));
|
|
1706
1766
|
}
|
|
1707
1767
|
function U(e, t, n) {
|
|
1708
1768
|
let r = P(e, t);
|
|
1709
|
-
|
|
1769
|
+
A.value.get(r) !== n && (A.value = new Map(A.value).set(r, n));
|
|
1710
1770
|
}
|
|
1711
1771
|
function W(e, t) {
|
|
1712
1772
|
H(e, t, "error");
|
|
1713
1773
|
}
|
|
1714
|
-
function
|
|
1774
|
+
function G(e, t) {
|
|
1715
1775
|
H(e, t, "ready");
|
|
1716
1776
|
}
|
|
1717
|
-
function
|
|
1777
|
+
function ne(e, t) {
|
|
1718
1778
|
U(e, t, "error");
|
|
1719
1779
|
}
|
|
1720
|
-
function
|
|
1780
|
+
function re(e, t) {
|
|
1721
1781
|
U(e, t, "ready");
|
|
1722
1782
|
}
|
|
1723
|
-
function
|
|
1724
|
-
if (
|
|
1725
|
-
|
|
1783
|
+
function ie(e, t) {
|
|
1784
|
+
if (l.state.reelMediaSource === "original") {
|
|
1785
|
+
ne(e, t);
|
|
1726
1786
|
return;
|
|
1727
1787
|
}
|
|
1728
1788
|
W(e, t);
|
|
1729
1789
|
}
|
|
1730
1790
|
function K(e, t) {
|
|
1731
|
-
if (
|
|
1732
|
-
|
|
1791
|
+
if (l.state.reelMediaSource === "original") {
|
|
1792
|
+
re(e, t);
|
|
1733
1793
|
return;
|
|
1734
1794
|
}
|
|
1735
|
-
|
|
1795
|
+
G(e, t);
|
|
1736
1796
|
}
|
|
1737
1797
|
function q(e, t) {
|
|
1738
|
-
let n =
|
|
1798
|
+
let n = l.state.items.find((t) => t.postId === e);
|
|
1739
1799
|
if (!n) return;
|
|
1740
1800
|
let r = M(n, t);
|
|
1741
|
-
(
|
|
1801
|
+
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
1742
1802
|
}
|
|
1743
|
-
async function
|
|
1744
|
-
await
|
|
1803
|
+
async function ae() {
|
|
1804
|
+
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
1745
1805
|
}
|
|
1746
|
-
function
|
|
1747
|
-
return
|
|
1806
|
+
function J(e) {
|
|
1807
|
+
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
1748
1808
|
}
|
|
1749
|
-
function
|
|
1750
|
-
return
|
|
1809
|
+
function Y(e) {
|
|
1810
|
+
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
1751
1811
|
}
|
|
1752
|
-
function
|
|
1753
|
-
return
|
|
1812
|
+
function oe() {
|
|
1813
|
+
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
1754
1814
|
}
|
|
1755
|
-
function
|
|
1756
|
-
|
|
1815
|
+
function se(e, t) {
|
|
1816
|
+
R = e, z = t === "keyboard", b.value = Z(e), d("openReel", e), m(() => h.value?.focus());
|
|
1757
1817
|
}
|
|
1758
|
-
function
|
|
1759
|
-
let t =
|
|
1818
|
+
function X(e) {
|
|
1819
|
+
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
1760
1820
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
1761
1821
|
}
|
|
1762
|
-
function
|
|
1763
|
-
if (
|
|
1764
|
-
let t = [...new Set(e)], n = t.filter(
|
|
1822
|
+
function ce(e) {
|
|
1823
|
+
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || B()) return 0;
|
|
1824
|
+
let t = [...new Set(e)], n = t.filter(X);
|
|
1765
1825
|
if (n.length === 0) return 0;
|
|
1766
|
-
let r = new Map(
|
|
1826
|
+
let r = new Map(E.value);
|
|
1767
1827
|
return n.forEach((e, t) => {
|
|
1768
|
-
r.set(e, t *
|
|
1769
|
-
}),
|
|
1828
|
+
r.set(e, t * Ct);
|
|
1829
|
+
}), S.value = new Set([...S.value].filter((e) => !n.includes(e))), T.value = new Set([...T.value, ...t]), E.value = r, wt + (n.length - 1) * Ct;
|
|
1770
1830
|
}
|
|
1771
|
-
function
|
|
1772
|
-
let n =
|
|
1831
|
+
function le(e, t) {
|
|
1832
|
+
let n = X(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
1773
1833
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
1774
1834
|
r.classList.remove("media-card-focus-silent");
|
|
1775
1835
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
1776
1836
|
}
|
|
1777
|
-
function
|
|
1778
|
-
let t =
|
|
1837
|
+
function Z(e) {
|
|
1838
|
+
let t = g.value, n = X(e);
|
|
1779
1839
|
if (t === null || n === null) return {};
|
|
1780
1840
|
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
1781
1841
|
return {
|
|
@@ -1786,25 +1846,25 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1786
1846
|
};
|
|
1787
1847
|
}
|
|
1788
1848
|
function ue() {
|
|
1789
|
-
|
|
1849
|
+
l.state.reelOrigin === "masonry" && (R ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
|
|
1790
1850
|
}
|
|
1791
1851
|
function de() {
|
|
1792
|
-
let e =
|
|
1793
|
-
|
|
1794
|
-
e !== null &&
|
|
1852
|
+
let e = R, t = z;
|
|
1853
|
+
x.value = !1, R = null, z = !1, b.value = {}, m(() => {
|
|
1854
|
+
e !== null && le(e, t);
|
|
1795
1855
|
});
|
|
1796
1856
|
}
|
|
1797
1857
|
function fe(e) {
|
|
1798
|
-
let t =
|
|
1799
|
-
if (e.key === "Escape" &&
|
|
1800
|
-
e.preventDefault(),
|
|
1858
|
+
let t = l.state.layout === "reel" || l.state.reelOrigin === "masonry";
|
|
1859
|
+
if (e.key === "Escape" && l.state.reelOrigin === "masonry") {
|
|
1860
|
+
e.preventDefault(), l.state.reelInfoSheetOverlay && l.state.reelInfoSheet.enabled && d("reelInfoSheetChange", !1), ue();
|
|
1801
1861
|
return;
|
|
1802
1862
|
}
|
|
1803
|
-
if (e.key === "Escape" && t &&
|
|
1863
|
+
if (e.key === "Escape" && t && l.state.reelInfoSheet.enabled) {
|
|
1804
1864
|
e.preventDefault(), d("reelInfoSheetChange", !1);
|
|
1805
1865
|
return;
|
|
1806
1866
|
}
|
|
1807
|
-
if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey ||
|
|
1867
|
+
if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || x.value || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry") return;
|
|
1808
1868
|
let n = e.target;
|
|
1809
1869
|
if (n instanceof HTMLElement && (n.isContentEditable || [
|
|
1810
1870
|
"INPUT",
|
|
@@ -1812,68 +1872,70 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1812
1872
|
"TEXTAREA"
|
|
1813
1873
|
].includes(n.tagName))) return;
|
|
1814
1874
|
let r = e.key === "ArrowLeft" ? -1 : e.key === "ArrowRight" ? 1 : 0;
|
|
1815
|
-
r !== 0 &&
|
|
1875
|
+
r !== 0 && p.value?.changeActiveMedia?.(r) && e.preventDefault();
|
|
1816
1876
|
}
|
|
1817
|
-
return D(() =>
|
|
1818
|
-
let t = e.filter((e) => !
|
|
1819
|
-
if (
|
|
1877
|
+
return D(() => l.state.items.map((e) => e.postId), (e) => {
|
|
1878
|
+
let t = e.filter((e) => !I.has(e)), n = new Set(e);
|
|
1879
|
+
if (I = 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 || B()) return;
|
|
1820
1880
|
let r = /* @__PURE__ */ new Map();
|
|
1821
1881
|
e.forEach((e) => {
|
|
1822
|
-
let t =
|
|
1882
|
+
let t = w.value.get(e);
|
|
1823
1883
|
t !== void 0 && r.set(e, t);
|
|
1824
1884
|
}), t.forEach((e, t) => {
|
|
1825
|
-
r.set(e, t *
|
|
1826
|
-
}),
|
|
1827
|
-
}, { flush: "sync" }), v(() => window.addEventListener("keydown", fe)),
|
|
1828
|
-
window.removeEventListener("keydown", fe),
|
|
1829
|
-
}),
|
|
1830
|
-
changeActiveReelMedia:
|
|
1831
|
-
getAutoScrollElement:
|
|
1832
|
-
loadIfNearBottom:
|
|
1833
|
-
moveActiveReelPost:
|
|
1834
|
-
startItemRemoval:
|
|
1835
|
-
|
|
1885
|
+
r.set(e, t * Ct);
|
|
1886
|
+
}), w.value = r, S.value = new Set([...S.value, ...t]), V();
|
|
1887
|
+
}, { flush: "sync" }), v(() => window.addEventListener("keydown", fe)), ee(() => {
|
|
1888
|
+
window.removeEventListener("keydown", fe), L !== null && cancelAnimationFrame(L);
|
|
1889
|
+
}), i({
|
|
1890
|
+
changeActiveReelMedia: J,
|
|
1891
|
+
getAutoScrollElement: oe,
|
|
1892
|
+
loadIfNearBottom: ae,
|
|
1893
|
+
moveActiveReelPost: Y,
|
|
1894
|
+
startItemRemoval: ce,
|
|
1895
|
+
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
1896
|
+
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
1897
|
+
}), (r, i) => (y(), s("div", {
|
|
1836
1898
|
ref_key: "surfaceElement",
|
|
1837
|
-
ref:
|
|
1899
|
+
ref: g,
|
|
1838
1900
|
class: "vibe-surface"
|
|
1839
|
-
}, [
|
|
1901
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (y(), a(St, {
|
|
1840
1902
|
key: 0,
|
|
1841
1903
|
ref_key: "reelRenderer",
|
|
1842
|
-
ref:
|
|
1843
|
-
"can-retry-end":
|
|
1844
|
-
"has-next":
|
|
1845
|
-
"card-footer":
|
|
1846
|
-
"card-header":
|
|
1847
|
-
"feed-footer":
|
|
1848
|
-
"feed-footer-actions":
|
|
1849
|
-
"forward-index":
|
|
1850
|
-
"forward-item":
|
|
1851
|
-
"media-card":
|
|
1852
|
-
"infinite-scroll":
|
|
1853
|
-
"is-loading-more":
|
|
1854
|
-
items:
|
|
1855
|
-
"load-more-locked":
|
|
1856
|
-
"media-source":
|
|
1857
|
-
"media-indices":
|
|
1858
|
-
"initial-post-id":
|
|
1859
|
-
"info-sheet":
|
|
1860
|
-
"info-sheet-enabled":
|
|
1861
|
-
"info-sheet-overlay":
|
|
1862
|
-
"next-page-error": !!
|
|
1904
|
+
ref: p,
|
|
1905
|
+
"can-retry-end": t.canRetryEnd,
|
|
1906
|
+
"has-next": t.state.next !== null,
|
|
1907
|
+
"card-footer": t.cardFooter,
|
|
1908
|
+
"card-header": t.cardHeader,
|
|
1909
|
+
"feed-footer": t.feedFooter,
|
|
1910
|
+
"feed-footer-actions": t.feedFooterActions,
|
|
1911
|
+
"forward-index": t.state.reelForwardIndex,
|
|
1912
|
+
"forward-item": t.state.reelForwardItem,
|
|
1913
|
+
"media-card": t.mediaCard,
|
|
1914
|
+
"infinite-scroll": t.state.infiniteScroll,
|
|
1915
|
+
"is-loading-more": t.state.isLoadingMore,
|
|
1916
|
+
items: t.state.items,
|
|
1917
|
+
"load-more-locked": t.state.loadMoreLocked,
|
|
1918
|
+
"media-source": t.state.reelMediaSource,
|
|
1919
|
+
"media-indices": t.state.mediaIndices,
|
|
1920
|
+
"initial-post-id": t.state.activeReelPostId,
|
|
1921
|
+
"info-sheet": t.reelInfoSheet,
|
|
1922
|
+
"info-sheet-enabled": t.state.reelInfoSheet.enabled,
|
|
1923
|
+
"info-sheet-overlay": t.state.reelInfoSheetOverlay,
|
|
1924
|
+
"next-page-error": !!t.state.nextPageError,
|
|
1863
1925
|
origin: "reel",
|
|
1864
|
-
"preview-states":
|
|
1865
|
-
"reel-auto-advance":
|
|
1866
|
-
"reel-forward":
|
|
1867
|
-
state:
|
|
1868
|
-
total:
|
|
1869
|
-
onActiveChange:
|
|
1870
|
-
onCloseInfoSheet:
|
|
1871
|
-
onError:
|
|
1872
|
-
onLoadMore:
|
|
1926
|
+
"preview-states": N.value,
|
|
1927
|
+
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
1928
|
+
"reel-forward": t.state.reelForward,
|
|
1929
|
+
state: j.value,
|
|
1930
|
+
total: t.state.total,
|
|
1931
|
+
onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
|
|
1932
|
+
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
1933
|
+
onError: ie,
|
|
1934
|
+
onLoadMore: i[2] ||= (e) => d("loadMore"),
|
|
1873
1935
|
onMediaChange: q,
|
|
1874
1936
|
onReady: K,
|
|
1875
|
-
onRetryEnd:
|
|
1876
|
-
onRetryForward:
|
|
1937
|
+
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
1938
|
+
onRetryForward: i[4] ||= (e) => d("retryForward")
|
|
1877
1939
|
}, null, 8, [
|
|
1878
1940
|
"can-retry-end",
|
|
1879
1941
|
"has-next",
|
|
@@ -1900,49 +1962,49 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1900
1962
|
"reel-forward",
|
|
1901
1963
|
"state",
|
|
1902
1964
|
"total"
|
|
1903
|
-
])) :
|
|
1965
|
+
])) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (y(), a(te, {
|
|
1904
1966
|
key: 1,
|
|
1905
|
-
actions:
|
|
1906
|
-
"can-retry-end":
|
|
1907
|
-
"feed-footer":
|
|
1908
|
-
state:
|
|
1909
|
-
onLoadMore:
|
|
1910
|
-
onRetryEnd:
|
|
1967
|
+
actions: t.feedFooterActions,
|
|
1968
|
+
"can-retry-end": t.canRetryEnd,
|
|
1969
|
+
"feed-footer": t.feedFooter,
|
|
1970
|
+
state: j.value,
|
|
1971
|
+
onLoadMore: i[5] ||= (e) => d("loadMore"),
|
|
1972
|
+
onRetryEnd: i[6] ||= (e) => d("retryEnd")
|
|
1911
1973
|
}, null, 8, [
|
|
1912
1974
|
"actions",
|
|
1913
1975
|
"can-retry-end",
|
|
1914
1976
|
"feed-footer",
|
|
1915
1977
|
"state"
|
|
1916
|
-
])) : (y(),
|
|
1978
|
+
])) : (y(), s(e, { key: 2 }, [u(st, {
|
|
1917
1979
|
ref_key: "masonryRenderer",
|
|
1918
1980
|
ref: f,
|
|
1919
|
-
"can-retry-end":
|
|
1920
|
-
"entering-post-ids":
|
|
1921
|
-
"entry-delays":
|
|
1922
|
-
"leaving-post-ids":
|
|
1923
|
-
"removal-delays":
|
|
1924
|
-
"card-footer":
|
|
1925
|
-
"card-header":
|
|
1926
|
-
"feed-footer":
|
|
1927
|
-
"feed-footer-actions":
|
|
1928
|
-
"media-card":
|
|
1929
|
-
"has-next":
|
|
1930
|
-
"infinite-scroll":
|
|
1931
|
-
"is-loading-more":
|
|
1932
|
-
items:
|
|
1933
|
-
"load-more-locked":
|
|
1934
|
-
"media-indices":
|
|
1935
|
-
"next-page-error": !!
|
|
1936
|
-
"preview-states":
|
|
1937
|
-
suspended:
|
|
1938
|
-
state:
|
|
1939
|
-
total:
|
|
1940
|
-
onActivate:
|
|
1981
|
+
"can-retry-end": t.canRetryEnd,
|
|
1982
|
+
"entering-post-ids": S.value,
|
|
1983
|
+
"entry-delays": w.value,
|
|
1984
|
+
"leaving-post-ids": T.value,
|
|
1985
|
+
"removal-delays": E.value,
|
|
1986
|
+
"card-footer": t.cardFooter,
|
|
1987
|
+
"card-header": t.cardHeader,
|
|
1988
|
+
"feed-footer": t.feedFooter,
|
|
1989
|
+
"feed-footer-actions": t.feedFooterActions,
|
|
1990
|
+
"media-card": t.mediaCard,
|
|
1991
|
+
"has-next": t.state.next !== null,
|
|
1992
|
+
"infinite-scroll": t.state.infiniteScroll,
|
|
1993
|
+
"is-loading-more": t.state.isLoadingMore,
|
|
1994
|
+
items: t.state.items,
|
|
1995
|
+
"load-more-locked": t.state.loadMoreLocked,
|
|
1996
|
+
"media-indices": t.state.mediaIndices,
|
|
1997
|
+
"next-page-error": !!t.state.nextPageError,
|
|
1998
|
+
"preview-states": k.value,
|
|
1999
|
+
suspended: t.state.reelOrigin === "masonry" || x.value,
|
|
2000
|
+
state: j.value,
|
|
2001
|
+
total: t.state.total,
|
|
2002
|
+
onActivate: se,
|
|
1941
2003
|
onError: W,
|
|
1942
|
-
onLoadMore:
|
|
2004
|
+
onLoadMore: i[7] ||= (e) => d("loadMore"),
|
|
1943
2005
|
onMediaChange: q,
|
|
1944
|
-
onReady:
|
|
1945
|
-
onRetryEnd:
|
|
2006
|
+
onReady: G,
|
|
2007
|
+
onRetryEnd: i[8] ||= (e) => d("retryEnd")
|
|
1946
2008
|
}, null, 8, [
|
|
1947
2009
|
"can-retry-end",
|
|
1948
2010
|
"entering-post-ids",
|
|
@@ -1965,11 +2027,11 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1965
2027
|
"suspended",
|
|
1966
2028
|
"state",
|
|
1967
2029
|
"total"
|
|
1968
|
-
]),
|
|
2030
|
+
]), u(n, {
|
|
1969
2031
|
name: "vibe-reel-viewer",
|
|
1970
2032
|
onAfterLeave: de
|
|
1971
2033
|
}, {
|
|
1972
|
-
default: O(() => [
|
|
2034
|
+
default: O(() => [t.state.reelOrigin === "masonry" ? (y(), s("section", {
|
|
1973
2035
|
key: 0,
|
|
1974
2036
|
ref_key: "reelOverlay",
|
|
1975
2037
|
ref: h,
|
|
@@ -1978,44 +2040,44 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1978
2040
|
"aria-label": "Media viewer",
|
|
1979
2041
|
"aria-modal": "true",
|
|
1980
2042
|
tabindex: "-1",
|
|
1981
|
-
style:
|
|
1982
|
-
}, [
|
|
2043
|
+
style: _(b.value)
|
|
2044
|
+
}, [u(St, {
|
|
1983
2045
|
ref_key: "reelRenderer",
|
|
1984
|
-
ref:
|
|
1985
|
-
"can-retry-end":
|
|
1986
|
-
"card-footer":
|
|
1987
|
-
"card-header":
|
|
1988
|
-
"feed-footer":
|
|
1989
|
-
"feed-footer-actions":
|
|
1990
|
-
"forward-index":
|
|
1991
|
-
"forward-item":
|
|
1992
|
-
"media-card":
|
|
1993
|
-
"has-next":
|
|
1994
|
-
"infinite-scroll":
|
|
1995
|
-
"initial-post-id":
|
|
1996
|
-
"info-sheet":
|
|
1997
|
-
"info-sheet-enabled":
|
|
1998
|
-
"info-sheet-overlay":
|
|
1999
|
-
"is-loading-more":
|
|
2000
|
-
items:
|
|
2001
|
-
"load-more-locked":
|
|
2002
|
-
"media-indices":
|
|
2046
|
+
ref: p,
|
|
2047
|
+
"can-retry-end": t.canRetryEnd,
|
|
2048
|
+
"card-footer": t.cardFooter,
|
|
2049
|
+
"card-header": t.cardHeader,
|
|
2050
|
+
"feed-footer": t.feedFooter,
|
|
2051
|
+
"feed-footer-actions": t.feedFooterActions,
|
|
2052
|
+
"forward-index": t.state.reelForwardIndex,
|
|
2053
|
+
"forward-item": t.state.reelForwardItem,
|
|
2054
|
+
"media-card": t.mediaCard,
|
|
2055
|
+
"has-next": t.state.next !== null,
|
|
2056
|
+
"infinite-scroll": t.state.infiniteScroll,
|
|
2057
|
+
"initial-post-id": t.state.activeReelPostId,
|
|
2058
|
+
"info-sheet": t.reelInfoSheet,
|
|
2059
|
+
"info-sheet-enabled": t.state.reelInfoSheet.enabled,
|
|
2060
|
+
"info-sheet-overlay": t.state.reelInfoSheetOverlay,
|
|
2061
|
+
"is-loading-more": t.state.isLoadingMore,
|
|
2062
|
+
items: t.state.items,
|
|
2063
|
+
"load-more-locked": t.state.loadMoreLocked,
|
|
2064
|
+
"media-indices": t.state.mediaIndices,
|
|
2003
2065
|
"media-source": "original",
|
|
2004
|
-
"next-page-error": !!
|
|
2066
|
+
"next-page-error": !!t.state.nextPageError,
|
|
2005
2067
|
origin: "masonry",
|
|
2006
|
-
"preview-states":
|
|
2007
|
-
"reel-auto-advance":
|
|
2008
|
-
"reel-forward":
|
|
2009
|
-
state:
|
|
2010
|
-
total:
|
|
2011
|
-
onActiveChange:
|
|
2012
|
-
onCloseInfoSheet:
|
|
2013
|
-
onError:
|
|
2014
|
-
onLoadMore:
|
|
2068
|
+
"preview-states": A.value,
|
|
2069
|
+
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2070
|
+
"reel-forward": t.state.reelForward,
|
|
2071
|
+
state: j.value,
|
|
2072
|
+
total: t.state.total,
|
|
2073
|
+
onActiveChange: i[9] ||= (e) => d("activeReelChange", e),
|
|
2074
|
+
onCloseInfoSheet: i[10] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2075
|
+
onError: ne,
|
|
2076
|
+
onLoadMore: i[11] ||= (e) => d("loadMore"),
|
|
2015
2077
|
onMediaChange: q,
|
|
2016
|
-
onReady:
|
|
2017
|
-
onRetryEnd:
|
|
2018
|
-
onRetryForward:
|
|
2078
|
+
onReady: re,
|
|
2079
|
+
onRetryEnd: i[12] ||= (e) => d("retryEnd"),
|
|
2080
|
+
onRetryForward: i[13] ||= (e) => d("retryForward")
|
|
2019
2081
|
}, null, 8, [
|
|
2020
2082
|
"can-retry-end",
|
|
2021
2083
|
"card-footer",
|
|
@@ -2041,14 +2103,14 @@ var Oe = /* @__PURE__ */ u({
|
|
|
2041
2103
|
"reel-forward",
|
|
2042
2104
|
"state",
|
|
2043
2105
|
"total"
|
|
2044
|
-
])], 4)) :
|
|
2106
|
+
])], 4)) : o("", !0)]),
|
|
2045
2107
|
_: 1
|
|
2046
2108
|
})], 64))], 512));
|
|
2047
2109
|
}
|
|
2048
2110
|
});
|
|
2049
2111
|
//#endregion
|
|
2050
2112
|
//#region src/core/page.ts
|
|
2051
|
-
function
|
|
2113
|
+
function Et(e) {
|
|
2052
2114
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2053
2115
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
2054
2116
|
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.");
|
|
@@ -2060,32 +2122,32 @@ function Q(e, t) {
|
|
|
2060
2122
|
}
|
|
2061
2123
|
//#endregion
|
|
2062
2124
|
//#region src/core/requestDelay.ts
|
|
2063
|
-
var
|
|
2125
|
+
var Dt = 2e3, Ot = 1e4, kt = 250, At = {
|
|
2064
2126
|
delayRemainingMs: null,
|
|
2065
2127
|
nextRequestAt: null
|
|
2066
2128
|
};
|
|
2067
|
-
function
|
|
2129
|
+
function jt(e, t) {
|
|
2068
2130
|
return e === void 0 ? t : Math.floor(e);
|
|
2069
2131
|
}
|
|
2070
|
-
function
|
|
2132
|
+
function Mt(e, t) {
|
|
2071
2133
|
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.`);
|
|
2072
2134
|
}
|
|
2073
|
-
function
|
|
2074
|
-
let n =
|
|
2135
|
+
function Nt(e, t = {}) {
|
|
2136
|
+
let n = jt(t.delayStepMs, Dt), r = jt(t.delayMaxMs, Ot);
|
|
2075
2137
|
return Math.min(Math.max(0, e) * n, r);
|
|
2076
2138
|
}
|
|
2077
2139
|
function $(e) {
|
|
2078
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
2140
|
+
if (e == null || !Number.isFinite(e)) return { ...At };
|
|
2079
2141
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2080
2142
|
return t > 0 ? {
|
|
2081
2143
|
delayRemainingMs: t,
|
|
2082
2144
|
nextRequestAt: e
|
|
2083
|
-
} : { ...
|
|
2145
|
+
} : { ...At };
|
|
2084
2146
|
}
|
|
2085
|
-
async function
|
|
2147
|
+
async function Pt({ delayMs: e, onChange: t, signal: n }) {
|
|
2086
2148
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2087
2149
|
if (e <= 0) {
|
|
2088
|
-
t({ ...
|
|
2150
|
+
t({ ...At });
|
|
2089
2151
|
return;
|
|
2090
2152
|
}
|
|
2091
2153
|
let r = Date.now() + e;
|
|
@@ -2093,9 +2155,9 @@ async function kt({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2093
2155
|
delayRemainingMs: e,
|
|
2094
2156
|
nextRequestAt: r
|
|
2095
2157
|
}), await new Promise((i, a) => {
|
|
2096
|
-
let o = !1, s = setInterval(f,
|
|
2158
|
+
let o = !1, s = setInterval(f, kt), c = setTimeout(() => u(), e);
|
|
2097
2159
|
function l() {
|
|
2098
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
2160
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...At });
|
|
2099
2161
|
}
|
|
2100
2162
|
function u(e) {
|
|
2101
2163
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2110,13 +2172,13 @@ async function kt({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2110
2172
|
n.addEventListener("abort", d, { once: !0 });
|
|
2111
2173
|
});
|
|
2112
2174
|
}
|
|
2113
|
-
var
|
|
2175
|
+
var Ft = class {
|
|
2114
2176
|
interval = null;
|
|
2115
2177
|
constructor(e) {
|
|
2116
2178
|
this.onChange = e;
|
|
2117
2179
|
}
|
|
2118
2180
|
clear() {
|
|
2119
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
2181
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...At });
|
|
2120
2182
|
}
|
|
2121
2183
|
sync(e) {
|
|
2122
2184
|
this.clear();
|
|
@@ -2124,22 +2186,22 @@ var At = class {
|
|
|
2124
2186
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2125
2187
|
let t = $(e);
|
|
2126
2188
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2127
|
-
},
|
|
2189
|
+
}, kt));
|
|
2128
2190
|
}
|
|
2129
2191
|
};
|
|
2130
|
-
function
|
|
2192
|
+
function It(e, t = !0) {
|
|
2131
2193
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2132
2194
|
}
|
|
2133
|
-
function
|
|
2195
|
+
function Lt(e) {
|
|
2134
2196
|
return `${typeof e}:${String(e)}`;
|
|
2135
2197
|
}
|
|
2136
|
-
function
|
|
2198
|
+
function Rt(e, t) {
|
|
2137
2199
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2138
2200
|
}
|
|
2139
|
-
function
|
|
2201
|
+
function zt(e) {
|
|
2140
2202
|
if (!e) return;
|
|
2141
|
-
if (
|
|
2142
|
-
|
|
2203
|
+
if (Rt(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
2204
|
+
Mt(e, "frontend autofill");
|
|
2143
2205
|
let t = e.maxAdditionalPages;
|
|
2144
2206
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
2145
2207
|
return;
|
|
@@ -2151,7 +2213,7 @@ function Pt(e) {
|
|
|
2151
2213
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2152
2214
|
}
|
|
2153
2215
|
}
|
|
2154
|
-
function
|
|
2216
|
+
function Bt(e, t, n = !0) {
|
|
2155
2217
|
if (!e) return {
|
|
2156
2218
|
cycleId: null,
|
|
2157
2219
|
delayRemainingMs: null,
|
|
@@ -2185,7 +2247,7 @@ function Ft(e, t, n = !0) {
|
|
|
2185
2247
|
strategy: e.strategy
|
|
2186
2248
|
};
|
|
2187
2249
|
}
|
|
2188
|
-
function
|
|
2250
|
+
function Vt(e) {
|
|
2189
2251
|
return [
|
|
2190
2252
|
"cancelling",
|
|
2191
2253
|
"filling",
|
|
@@ -2193,9 +2255,9 @@ function It(e) {
|
|
|
2193
2255
|
"waiting"
|
|
2194
2256
|
].includes(e.status);
|
|
2195
2257
|
}
|
|
2196
|
-
async function
|
|
2258
|
+
async function Ht(e, t, n) {
|
|
2197
2259
|
let r = t.autofill;
|
|
2198
|
-
if (!
|
|
2260
|
+
if (!Vt(r) || !r.cycleId) return;
|
|
2199
2261
|
let i = {
|
|
2200
2262
|
cycleId: r.cycleId,
|
|
2201
2263
|
feedKey: r.feedKey ?? "",
|
|
@@ -2208,20 +2270,20 @@ async function Lt(e, t, n) {
|
|
|
2208
2270
|
throw r.error = e, r.status = "error", e;
|
|
2209
2271
|
}
|
|
2210
2272
|
}
|
|
2211
|
-
function
|
|
2273
|
+
function Ut(e, t, n) {
|
|
2212
2274
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2213
2275
|
}
|
|
2214
|
-
async function
|
|
2215
|
-
let u = [], d = [...e], f = /* @__PURE__ */ new Set(), p = r ??
|
|
2276
|
+
async function Wt({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onDelayChange: i, onProgress: a, options: o, receivedOffset: s = 0, requestOffset: c = 0, signal: l }) {
|
|
2277
|
+
let u = [], d = [...e], f = /* @__PURE__ */ new Set(), p = r ?? It(o), m = t, h = t, g = 0, _;
|
|
2216
2278
|
for (; g < p;) {
|
|
2217
|
-
let e =
|
|
2279
|
+
let e = Lt(m);
|
|
2218
2280
|
if (f.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2219
|
-
f.add(e), await
|
|
2220
|
-
delayMs:
|
|
2281
|
+
f.add(e), await Pt({
|
|
2282
|
+
delayMs: Nt(c + g, o),
|
|
2221
2283
|
onChange: i,
|
|
2222
2284
|
signal: l
|
|
2223
2285
|
});
|
|
2224
|
-
let t =
|
|
2286
|
+
let t = Et(await n({
|
|
2225
2287
|
cursor: m,
|
|
2226
2288
|
signal: l
|
|
2227
2289
|
}));
|
|
@@ -2261,30 +2323,30 @@ async function zt({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2261
2323
|
total: _
|
|
2262
2324
|
};
|
|
2263
2325
|
}
|
|
2264
|
-
var
|
|
2265
|
-
function
|
|
2326
|
+
var Gt = 100;
|
|
2327
|
+
function Kt(e, t) {
|
|
2266
2328
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2267
2329
|
}
|
|
2268
|
-
function
|
|
2330
|
+
function qt(e, t, n) {
|
|
2269
2331
|
return Math.min(n, Math.max(t, e));
|
|
2270
2332
|
}
|
|
2271
|
-
function
|
|
2333
|
+
function Jt(e) {
|
|
2272
2334
|
if (!e) return;
|
|
2273
2335
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2274
|
-
if (
|
|
2275
|
-
e.speedPxPerSecond !== void 0 &&
|
|
2336
|
+
if (Kt("autoScroll.minSpeedPxPerSecond", t), Kt("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
2337
|
+
e.speedPxPerSecond !== void 0 && Kt("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
2276
2338
|
}
|
|
2277
|
-
function
|
|
2339
|
+
function Yt(e) {
|
|
2278
2340
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2279
2341
|
return {
|
|
2280
2342
|
enabled: e?.enabled ?? !1,
|
|
2281
2343
|
maxSpeedPxPerSecond: n,
|
|
2282
2344
|
minSpeedPxPerSecond: t,
|
|
2283
2345
|
paused: !1,
|
|
2284
|
-
speedPxPerSecond:
|
|
2346
|
+
speedPxPerSecond: qt(e?.speedPxPerSecond ?? 80, t, n)
|
|
2285
2347
|
};
|
|
2286
2348
|
}
|
|
2287
|
-
var
|
|
2349
|
+
var Xt = class {
|
|
2288
2350
|
frame = null;
|
|
2289
2351
|
lastTimestamp = null;
|
|
2290
2352
|
mounted = !1;
|
|
@@ -2304,9 +2366,9 @@ var Gt = class {
|
|
|
2304
2366
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
2305
2367
|
}
|
|
2306
2368
|
setSpeed(e) {
|
|
2307
|
-
|
|
2369
|
+
Kt("auto-scroll speed", e);
|
|
2308
2370
|
let t = this.options.state;
|
|
2309
|
-
t.speedPxPerSecond =
|
|
2371
|
+
t.speedPxPerSecond = qt(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
2310
2372
|
}
|
|
2311
2373
|
tick = (e) => {
|
|
2312
2374
|
this.frame = null;
|
|
@@ -2318,7 +2380,7 @@ var Gt = class {
|
|
|
2318
2380
|
return;
|
|
2319
2381
|
}
|
|
2320
2382
|
if (this.lastTimestamp !== null) {
|
|
2321
|
-
let r = Math.min(
|
|
2383
|
+
let r = Math.min(Gt, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
2322
2384
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
2323
2385
|
}
|
|
2324
2386
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -2332,7 +2394,7 @@ var Gt = class {
|
|
|
2332
2394
|
};
|
|
2333
2395
|
//#endregion
|
|
2334
2396
|
//#region src/core/backendAutofill.ts
|
|
2335
|
-
async function
|
|
2397
|
+
async function Zt(e, t, n, r) {
|
|
2336
2398
|
let i = await e.onUnderfilled(n);
|
|
2337
2399
|
if (!r()) return;
|
|
2338
2400
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
@@ -2346,19 +2408,19 @@ async function Kt(e, t, n, r) {
|
|
|
2346
2408
|
status: "waiting"
|
|
2347
2409
|
});
|
|
2348
2410
|
}
|
|
2349
|
-
function
|
|
2411
|
+
function Qt(e, t) {
|
|
2350
2412
|
["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);
|
|
2351
2413
|
}
|
|
2352
|
-
function
|
|
2414
|
+
function $t(e, t, n) {
|
|
2353
2415
|
let r = t.autofill;
|
|
2354
|
-
return !
|
|
2416
|
+
return !Ut(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (Qt(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);
|
|
2355
2417
|
}
|
|
2356
|
-
function
|
|
2357
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
2418
|
+
function en(e, t, n) {
|
|
2419
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Bt(e, n), Qt(t, n), !0);
|
|
2358
2420
|
}
|
|
2359
2421
|
//#endregion
|
|
2360
2422
|
//#region src/core/initialAutofill.ts
|
|
2361
|
-
async function
|
|
2423
|
+
async function tn({ cycleId: e, isCurrent: t, onLastCursor: n, options: r, signal: i, state: a }) {
|
|
2362
2424
|
let o = r.autofill;
|
|
2363
2425
|
if (!o) return;
|
|
2364
2426
|
let s = a.items.length;
|
|
@@ -2371,7 +2433,7 @@ async function Xt({ cycleId: e, isCurrent: t, onLastCursor: n, options: r, signa
|
|
|
2371
2433
|
return;
|
|
2372
2434
|
}
|
|
2373
2435
|
if (o.strategy === "backend") {
|
|
2374
|
-
await
|
|
2436
|
+
await Zt(o, a, {
|
|
2375
2437
|
cycleId: e,
|
|
2376
2438
|
feedKey: o.feedKey,
|
|
2377
2439
|
items: [...a.items],
|
|
@@ -2388,11 +2450,11 @@ async function Xt({ cycleId: e, isCurrent: t, onLastCursor: n, options: r, signa
|
|
|
2388
2450
|
a.autofill.status = "exhausted";
|
|
2389
2451
|
return;
|
|
2390
2452
|
}
|
|
2391
|
-
let c = await
|
|
2453
|
+
let c = await Wt({
|
|
2392
2454
|
existingItems: a.items,
|
|
2393
2455
|
initialCursor: a.next,
|
|
2394
2456
|
loadPage: r.loadPage,
|
|
2395
|
-
maximumRequests:
|
|
2457
|
+
maximumRequests: It(o, !1),
|
|
2396
2458
|
onDelayChange: (e) => {
|
|
2397
2459
|
t() && Object.assign(a.autofill, e);
|
|
2398
2460
|
},
|
|
@@ -2413,13 +2475,13 @@ async function Xt({ cycleId: e, isCurrent: t, onLastCursor: n, options: r, signa
|
|
|
2413
2475
|
}
|
|
2414
2476
|
//#endregion
|
|
2415
2477
|
//#region src/core/fill.ts
|
|
2416
|
-
function
|
|
2478
|
+
function nn(e) {
|
|
2417
2479
|
return "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
2418
2480
|
}
|
|
2419
|
-
function
|
|
2481
|
+
function rn(e) {
|
|
2420
2482
|
return `${typeof e}:${String(e)}`;
|
|
2421
2483
|
}
|
|
2422
|
-
function
|
|
2484
|
+
function an(e) {
|
|
2423
2485
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
2424
2486
|
if ("pages" in e) {
|
|
2425
2487
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -2428,20 +2490,20 @@ function $t(e) {
|
|
|
2428
2490
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
2429
2491
|
throw TypeError("Vibe fill target must be { pages } or { until: 'end' }.");
|
|
2430
2492
|
}
|
|
2431
|
-
function
|
|
2493
|
+
function on(e) {
|
|
2432
2494
|
if (!e) return;
|
|
2433
2495
|
if (e.strategy === "frontend") {
|
|
2434
|
-
|
|
2496
|
+
Mt(e, "frontend fill");
|
|
2435
2497
|
return;
|
|
2436
2498
|
}
|
|
2437
2499
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
2438
2500
|
let t = e.initialSession;
|
|
2439
2501
|
if (t) {
|
|
2440
2502
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
2441
|
-
|
|
2503
|
+
an(t.target);
|
|
2442
2504
|
}
|
|
2443
2505
|
}
|
|
2444
|
-
function
|
|
2506
|
+
function sn(e, t, n = !0) {
|
|
2445
2507
|
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = $(i?.nextRequestAt);
|
|
2446
2508
|
return {
|
|
2447
2509
|
completedPages: i?.completedPages ?? 0,
|
|
@@ -2455,10 +2517,10 @@ function tn(e, t, n = !0) {
|
|
|
2455
2517
|
sessionId: i?.sessionId ?? null,
|
|
2456
2518
|
status: i?.status ?? "idle",
|
|
2457
2519
|
strategy: e?.strategy ?? null,
|
|
2458
|
-
target: i ?
|
|
2520
|
+
target: i ? nn(i.target) : null
|
|
2459
2521
|
};
|
|
2460
2522
|
}
|
|
2461
|
-
function
|
|
2523
|
+
function cn(e) {
|
|
2462
2524
|
return [
|
|
2463
2525
|
"cancelling",
|
|
2464
2526
|
"filling",
|
|
@@ -2466,17 +2528,17 @@ function nn(e) {
|
|
|
2466
2528
|
"waiting"
|
|
2467
2529
|
].includes(e.status);
|
|
2468
2530
|
}
|
|
2469
|
-
async function
|
|
2531
|
+
async function ln({ existingItems: e, initialCursor: t, loadPage: n, onDelayChange: r, onProgress: i, options: a, signal: o, target: s }) {
|
|
2470
2532
|
let c = [], l = [...e], u = /* @__PURE__ */ new Set(), d = 0, f = t, p = t, m = 0, h;
|
|
2471
2533
|
for (; p !== null;) {
|
|
2472
|
-
let e =
|
|
2534
|
+
let e = rn(f);
|
|
2473
2535
|
if (u.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
2474
|
-
u.add(e), await
|
|
2475
|
-
delayMs:
|
|
2536
|
+
u.add(e), await Pt({
|
|
2537
|
+
delayMs: Nt(d, a),
|
|
2476
2538
|
onChange: r,
|
|
2477
2539
|
signal: o
|
|
2478
2540
|
});
|
|
2479
|
-
let t =
|
|
2541
|
+
let t = Et(await n({
|
|
2480
2542
|
cursor: f,
|
|
2481
2543
|
signal: o
|
|
2482
2544
|
}));
|
|
@@ -2518,7 +2580,7 @@ async function rn({ existingItems: e, initialCursor: t, loadPage: n, onDelayChan
|
|
|
2518
2580
|
}
|
|
2519
2581
|
//#endregion
|
|
2520
2582
|
//#region src/core/backendFill.ts
|
|
2521
|
-
async function
|
|
2583
|
+
async function un(e, t, n, r) {
|
|
2522
2584
|
let i = await e.onStart(n);
|
|
2523
2585
|
if (r()) {
|
|
2524
2586
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
@@ -2532,22 +2594,22 @@ async function an(e, t, n, r) {
|
|
|
2532
2594
|
});
|
|
2533
2595
|
}
|
|
2534
2596
|
}
|
|
2535
|
-
function
|
|
2597
|
+
function dn(e, t, n) {
|
|
2536
2598
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
2537
2599
|
}
|
|
2538
|
-
function
|
|
2600
|
+
function fn(e) {
|
|
2539
2601
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
2540
2602
|
}
|
|
2541
|
-
function
|
|
2603
|
+
function pn(e, t) {
|
|
2542
2604
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
2543
2605
|
let n = e.fill.target;
|
|
2544
2606
|
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;
|
|
2545
2607
|
}
|
|
2546
|
-
function
|
|
2608
|
+
function mn(e, t, n) {
|
|
2547
2609
|
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));
|
|
2548
2610
|
}
|
|
2549
|
-
function
|
|
2550
|
-
return !
|
|
2611
|
+
function hn(e, t, n, r) {
|
|
2612
|
+
return !dn(e, t, n) || !fn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !pn(t, n) ? !1 : (mn(t, n, r), Object.assign(t.fill, {
|
|
2551
2613
|
...$(n.status === "waiting" ? n.nextRequestAt : null),
|
|
2552
2614
|
completedPages: n.completedPages,
|
|
2553
2615
|
error: n.error ?? null,
|
|
@@ -2556,41 +2618,41 @@ function un(e, t, n, r) {
|
|
|
2556
2618
|
status: n.status
|
|
2557
2619
|
}), !0);
|
|
2558
2620
|
}
|
|
2559
|
-
function
|
|
2621
|
+
function gn(e, t, n, r) {
|
|
2560
2622
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
2561
2623
|
let i = t.fill;
|
|
2562
|
-
return t.fill =
|
|
2624
|
+
return t.fill = sn(e, n), !fn(n) || !pn(t, n) ? (t.fill = i, !1) : (mn(t, n, r), !0);
|
|
2563
2625
|
}
|
|
2564
2626
|
//#endregion
|
|
2565
2627
|
//#region src/core/fillController.ts
|
|
2566
|
-
var
|
|
2628
|
+
var _n = class {
|
|
2567
2629
|
abortController = null;
|
|
2568
2630
|
cycle = 0;
|
|
2569
2631
|
delayCountdown;
|
|
2570
2632
|
requestVersion = 0;
|
|
2571
2633
|
constructor(e) {
|
|
2572
|
-
this.options = e, this.delayCountdown = new
|
|
2634
|
+
this.options = e, this.delayCountdown = new Ft((e) => {
|
|
2573
2635
|
Object.assign(this.options.state.fill, e);
|
|
2574
2636
|
}), this.syncBackendCountdown();
|
|
2575
2637
|
}
|
|
2576
2638
|
isActive() {
|
|
2577
|
-
return
|
|
2639
|
+
return cn(this.options.state.fill);
|
|
2578
2640
|
}
|
|
2579
2641
|
applyUpdate(e) {
|
|
2580
|
-
let t =
|
|
2642
|
+
let t = hn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2581
2643
|
return t && this.syncBackendCountdown(), t;
|
|
2582
2644
|
}
|
|
2583
2645
|
restoreSession(e) {
|
|
2584
|
-
let t =
|
|
2646
|
+
let t = gn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2585
2647
|
return t && this.syncBackendCountdown(), t;
|
|
2586
2648
|
}
|
|
2587
2649
|
async start(e) {
|
|
2588
2650
|
let t = this.options.fill;
|
|
2589
2651
|
if (!t) throw Error("Vibe fill is not configured.");
|
|
2590
2652
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
2591
|
-
let n =
|
|
2653
|
+
let n = an(e), r = `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2592
2654
|
if (this.options.state.fill = {
|
|
2593
|
-
...
|
|
2655
|
+
...sn(t, void 0, !1),
|
|
2594
2656
|
cycleId: r,
|
|
2595
2657
|
status: "filling",
|
|
2596
2658
|
target: n
|
|
@@ -2601,7 +2663,7 @@ var fn = class {
|
|
|
2601
2663
|
let i = ++this.requestVersion, a = new AbortController();
|
|
2602
2664
|
this.abortController = a;
|
|
2603
2665
|
try {
|
|
2604
|
-
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await
|
|
2666
|
+
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await un(t, this.options.state, {
|
|
2605
2667
|
cycleId: r,
|
|
2606
2668
|
feedKey: t.feedKey,
|
|
2607
2669
|
items: [...this.options.state.items],
|
|
@@ -2619,7 +2681,7 @@ var fn = class {
|
|
|
2619
2681
|
}
|
|
2620
2682
|
async cancel() {
|
|
2621
2683
|
let { fill: e, state: t } = this.options;
|
|
2622
|
-
if (!
|
|
2684
|
+
if (!cn(t.fill) || !t.fill.cycleId) return;
|
|
2623
2685
|
let n = {
|
|
2624
2686
|
cycleId: t.fill.cycleId,
|
|
2625
2687
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -2633,7 +2695,7 @@ var fn = class {
|
|
|
2633
2695
|
}
|
|
2634
2696
|
}
|
|
2635
2697
|
reset() {
|
|
2636
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
2698
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = sn(this.options.fill, void 0, !1);
|
|
2637
2699
|
}
|
|
2638
2700
|
destroy() {
|
|
2639
2701
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -2649,7 +2711,7 @@ var fn = class {
|
|
|
2649
2711
|
if (!i) throw Error("Vibe frontend fill requires loadPage.");
|
|
2650
2712
|
let a = this.options.state;
|
|
2651
2713
|
a.isLoadingMore = !0;
|
|
2652
|
-
let o = await
|
|
2714
|
+
let o = await ln({
|
|
2653
2715
|
existingItems: a.items,
|
|
2654
2716
|
initialCursor: a.next,
|
|
2655
2717
|
loadPage: i,
|
|
@@ -2676,7 +2738,7 @@ var fn = class {
|
|
|
2676
2738
|
};
|
|
2677
2739
|
//#endregion
|
|
2678
2740
|
//#region src/core/feedFooter.ts
|
|
2679
|
-
function
|
|
2741
|
+
function vn(e) {
|
|
2680
2742
|
return {
|
|
2681
2743
|
cancelAutofill: () => e.cancelAutofill(),
|
|
2682
2744
|
loadMore: () => e.loadNext(),
|
|
@@ -2684,45 +2746,45 @@ function pn(e) {
|
|
|
2684
2746
|
retryEnd: () => e.retryEnd()
|
|
2685
2747
|
};
|
|
2686
2748
|
}
|
|
2687
|
-
function
|
|
2749
|
+
function yn(e) {
|
|
2688
2750
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
2689
2751
|
}
|
|
2690
|
-
function
|
|
2691
|
-
e?.intervalMs !== void 0 &&
|
|
2752
|
+
function bn(e) {
|
|
2753
|
+
e?.intervalMs !== void 0 && yn(e.intervalMs);
|
|
2692
2754
|
}
|
|
2693
|
-
function
|
|
2755
|
+
function xn(e) {
|
|
2694
2756
|
return {
|
|
2695
2757
|
enabled: e?.enabled ?? !1,
|
|
2696
2758
|
includePostItems: e?.includePostItems ?? !1,
|
|
2697
2759
|
intervalMs: e?.intervalMs ?? 5e3
|
|
2698
2760
|
};
|
|
2699
2761
|
}
|
|
2700
|
-
function
|
|
2762
|
+
function Sn(e, t) {
|
|
2701
2763
|
if (typeof t == "boolean") {
|
|
2702
2764
|
e.enabled = t;
|
|
2703
2765
|
return;
|
|
2704
2766
|
}
|
|
2705
|
-
|
|
2767
|
+
bn(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);
|
|
2706
2768
|
}
|
|
2707
2769
|
//#endregion
|
|
2708
2770
|
//#region src/core/reelInfoSheet.ts
|
|
2709
|
-
function
|
|
2771
|
+
function Cn(e) {
|
|
2710
2772
|
return { enabled: e?.enabled ?? !1 };
|
|
2711
2773
|
}
|
|
2712
|
-
function
|
|
2774
|
+
function wn(e, t, n) {
|
|
2713
2775
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
2714
2776
|
e.enabled = n;
|
|
2715
2777
|
}
|
|
2716
2778
|
//#endregion
|
|
2717
2779
|
//#region src/core/initialRuntimeState.ts
|
|
2718
|
-
function
|
|
2780
|
+
function Tn(e, t) {
|
|
2719
2781
|
let n = e.initialPage;
|
|
2720
2782
|
return {
|
|
2721
2783
|
activeReelPostId: null,
|
|
2722
|
-
autoScroll:
|
|
2723
|
-
autofill:
|
|
2784
|
+
autoScroll: Yt(e.autoScroll),
|
|
2785
|
+
autofill: Bt(e.autofill),
|
|
2724
2786
|
error: null,
|
|
2725
|
-
fill:
|
|
2787
|
+
fill: sn(e.fill),
|
|
2726
2788
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
2727
2789
|
isLoading: !n,
|
|
2728
2790
|
isLoadingMore: !1,
|
|
@@ -2732,14 +2794,14 @@ function bn(e, t) {
|
|
|
2732
2794
|
mediaIndices: /* @__PURE__ */ new Map(),
|
|
2733
2795
|
next: n?.next ?? null,
|
|
2734
2796
|
nextPageError: null,
|
|
2735
|
-
reelAutoAdvance:
|
|
2797
|
+
reelAutoAdvance: xn(e.reelAutoAdvance),
|
|
2736
2798
|
reelForward: {
|
|
2737
2799
|
error: null,
|
|
2738
2800
|
status: "idle"
|
|
2739
2801
|
},
|
|
2740
2802
|
reelForwardIndex: null,
|
|
2741
2803
|
reelForwardItem: null,
|
|
2742
|
-
reelInfoSheet:
|
|
2804
|
+
reelInfoSheet: Cn(e.reelInfoSheet),
|
|
2743
2805
|
reelInfoSheetOverlay: !1,
|
|
2744
2806
|
reelMediaSource: "original",
|
|
2745
2807
|
reelOrigin: null,
|
|
@@ -2748,26 +2810,26 @@ function bn(e, t) {
|
|
|
2748
2810
|
}
|
|
2749
2811
|
//#endregion
|
|
2750
2812
|
//#region src/core/options.ts
|
|
2751
|
-
function
|
|
2813
|
+
function En(e, t) {
|
|
2752
2814
|
if (t) {
|
|
2753
2815
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
2754
2816
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
2755
2817
|
}
|
|
2756
2818
|
}
|
|
2757
|
-
function
|
|
2819
|
+
function Dn(e, t) {
|
|
2758
2820
|
if (t) {
|
|
2759
2821
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
2760
2822
|
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.`);
|
|
2761
2823
|
}
|
|
2762
2824
|
}
|
|
2763
|
-
function
|
|
2764
|
-
if (
|
|
2825
|
+
function On(e) {
|
|
2826
|
+
if (Jt(e.autoScroll), En("cardHeader", e.cardHeader), En("cardFooter", e.cardFooter), Dn("header", e.mediaCard?.header), Dn("footer", e.mediaCard?.footer), zt(e.autofill), on(e.fill), bn(e.reelAutoAdvance), e.removalHistoryLimit !== void 0 && (!Number.isInteger(e.removalHistoryLimit) || e.removalHistoryLimit < 0)) throw TypeError("Vibe removalHistoryLimit must be a non-negative integer.");
|
|
2765
2827
|
if (!e.initialPage && !e.loadPage) throw TypeError("Vibe requires either initialPage or loadPage.");
|
|
2766
2828
|
if (e.initialPage?.next !== null && !e.loadPage) throw TypeError("Vibe requires loadPage when initialPage has a next cursor.");
|
|
2767
2829
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
2768
2830
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
2769
2831
|
}
|
|
2770
|
-
function
|
|
2832
|
+
function kn(e) {
|
|
2771
2833
|
if (typeof e != "string") return e;
|
|
2772
2834
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
2773
2835
|
let t = document.querySelector(e);
|
|
@@ -2776,7 +2838,7 @@ function wn(e) {
|
|
|
2776
2838
|
}
|
|
2777
2839
|
//#endregion
|
|
2778
2840
|
//#region src/core/activeItemRemoval.ts
|
|
2779
|
-
function
|
|
2841
|
+
function An(e, t, n, r, i) {
|
|
2780
2842
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
2781
2843
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
2782
2844
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -2789,7 +2851,7 @@ function Tn(e, t, n, r, i) {
|
|
|
2789
2851
|
}
|
|
2790
2852
|
//#endregion
|
|
2791
2853
|
//#region src/core/exactMediaRemovalController.ts
|
|
2792
|
-
function
|
|
2854
|
+
function jn(e, t) {
|
|
2793
2855
|
let [n, ...r] = t;
|
|
2794
2856
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
2795
2857
|
return {
|
|
@@ -2798,10 +2860,10 @@ function En(e, t) {
|
|
|
2798
2860
|
items: r
|
|
2799
2861
|
};
|
|
2800
2862
|
}
|
|
2801
|
-
function
|
|
2863
|
+
function Mn(e) {
|
|
2802
2864
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
2803
2865
|
}
|
|
2804
|
-
var
|
|
2866
|
+
var Nn = class {
|
|
2805
2867
|
generation = 0;
|
|
2806
2868
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
2807
2869
|
state;
|
|
@@ -2809,7 +2871,7 @@ var On = class {
|
|
|
2809
2871
|
this.options = e, this.state = e.state;
|
|
2810
2872
|
}
|
|
2811
2873
|
remove(e) {
|
|
2812
|
-
|
|
2874
|
+
Mn(e);
|
|
2813
2875
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
2814
2876
|
if (!n) return null;
|
|
2815
2877
|
let r = [...j(n)], i = r[e.mediaIndex];
|
|
@@ -2826,7 +2888,7 @@ var On = class {
|
|
|
2826
2888
|
restored: !1
|
|
2827
2889
|
});
|
|
2828
2890
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
2829
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
2891
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = jn(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);
|
|
2830
2892
|
}
|
|
2831
2893
|
reset() {
|
|
2832
2894
|
this.generation += 1;
|
|
@@ -2852,7 +2914,7 @@ var On = class {
|
|
|
2852
2914
|
}
|
|
2853
2915
|
restoreIntoPost(e, t) {
|
|
2854
2916
|
let n = this.state.items[e], r = [...j(n)], i = Math.min(t.mediaIndex, r.length);
|
|
2855
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
2917
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = jn(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
2856
2918
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
2857
2919
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
2858
2920
|
}
|
|
@@ -2865,18 +2927,18 @@ var On = class {
|
|
|
2865
2927
|
};
|
|
2866
2928
|
//#endregion
|
|
2867
2929
|
//#region src/core/itemPlacement.ts
|
|
2868
|
-
function
|
|
2930
|
+
function Pn(e, t) {
|
|
2869
2931
|
let n = new Set(t);
|
|
2870
2932
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
2871
2933
|
index: t,
|
|
2872
2934
|
item: e
|
|
2873
2935
|
}] : []);
|
|
2874
2936
|
}
|
|
2875
|
-
function
|
|
2937
|
+
function Fn(e, t) {
|
|
2876
2938
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
2877
2939
|
return e.filter((e) => !n.has(e.postId));
|
|
2878
2940
|
}
|
|
2879
|
-
function
|
|
2941
|
+
function In(e, t) {
|
|
2880
2942
|
t.forEach(({ index: e }) => {
|
|
2881
2943
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
2882
2944
|
});
|
|
@@ -2887,7 +2949,7 @@ function jn(e, t) {
|
|
|
2887
2949
|
}
|
|
2888
2950
|
//#endregion
|
|
2889
2951
|
//#region src/core/itemRemovalController.ts
|
|
2890
|
-
var
|
|
2952
|
+
var Ln = 20, Rn = class {
|
|
2891
2953
|
generation = 0;
|
|
2892
2954
|
historyLimit;
|
|
2893
2955
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -2896,7 +2958,7 @@ var Mn = 20, Nn = class {
|
|
|
2896
2958
|
itemOrder;
|
|
2897
2959
|
stopItemsWatcher;
|
|
2898
2960
|
constructor(e) {
|
|
2899
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
2961
|
+
this.options = e, this.historyLimit = e.historyLimit ?? Ln, this.state = e.state, this.itemOrder = this.state.items.map(({ postId: e }) => e), this.stopItemsWatcher = D(() => this.state.items, (e) => this.appendUnknownItems(e), { flush: "sync" });
|
|
2900
2962
|
}
|
|
2901
2963
|
destroy() {
|
|
2902
2964
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -2904,10 +2966,12 @@ var Mn = 20, Nn = class {
|
|
|
2904
2966
|
async remove(e) {
|
|
2905
2967
|
let t = this.collectOrderedPlacements(e), n = this.createRemoval(t);
|
|
2906
2968
|
if (t.length === 0) return n;
|
|
2907
|
-
let r = t.map(({ item: e }) => e.postId)
|
|
2969
|
+
let r = t.map(({ item: e }) => e.postId);
|
|
2970
|
+
if (await this.options.prepareRemoval(r), this.metadata.get(n)?.generation !== this.generation) return n;
|
|
2971
|
+
let i = this.options.startRemoval(r);
|
|
2908
2972
|
if (i > 0 && await new Promise((e) => setTimeout(e, i)), this.metadata.get(n)?.generation !== this.generation) return n;
|
|
2909
2973
|
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);
|
|
2910
|
-
return this.state.items =
|
|
2974
|
+
return this.state.items = Fn(this.state.items, t), this.options.onItemsRemoved(n, t, c), this.record(n), n;
|
|
2911
2975
|
}
|
|
2912
2976
|
reset() {
|
|
2913
2977
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -2918,7 +2982,7 @@ var Mn = 20, Nn = class {
|
|
|
2918
2982
|
this.restoreRemoval(t);
|
|
2919
2983
|
return;
|
|
2920
2984
|
}
|
|
2921
|
-
let n =
|
|
2985
|
+
let n = In(this.state.items, e);
|
|
2922
2986
|
this.registerExternalPlacements(e), this.state.items = n;
|
|
2923
2987
|
}
|
|
2924
2988
|
restoreRemoval(e) {
|
|
@@ -2944,7 +3008,7 @@ var Mn = 20, Nn = class {
|
|
|
2944
3008
|
}
|
|
2945
3009
|
collectOrderedPlacements(e) {
|
|
2946
3010
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
2947
|
-
return
|
|
3011
|
+
return Pn(this.state.items, e).map((e) => ({
|
|
2948
3012
|
index: t.get(e.item.postId) ?? e.index,
|
|
2949
3013
|
item: e.item
|
|
2950
3014
|
}));
|
|
@@ -2975,7 +3039,7 @@ var Mn = 20, Nn = class {
|
|
|
2975
3039
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
2976
3040
|
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;
|
|
2977
3041
|
}
|
|
2978
|
-
},
|
|
3042
|
+
}, zn = class {
|
|
2979
3043
|
forward = null;
|
|
2980
3044
|
forwardPromise = null;
|
|
2981
3045
|
forwardVersion = 0;
|
|
@@ -3053,43 +3117,96 @@ var Mn = 20, Nn = class {
|
|
|
3053
3117
|
}
|
|
3054
3118
|
}
|
|
3055
3119
|
}
|
|
3120
|
+
}, Bn = class {
|
|
3121
|
+
generation = 0;
|
|
3122
|
+
pending = Promise.resolve();
|
|
3123
|
+
constructor(e) {
|
|
3124
|
+
this.options = e;
|
|
3125
|
+
}
|
|
3126
|
+
prepareItems(e) {
|
|
3127
|
+
return this.serialize(() => this.preparePosts(e));
|
|
3128
|
+
}
|
|
3129
|
+
prepareMedia(e) {
|
|
3130
|
+
return this.serialize(async () => {
|
|
3131
|
+
let { state: t } = this.options;
|
|
3132
|
+
if (!this.isReelActive() || t.activeReelPostId !== e.postId) return;
|
|
3133
|
+
let n = t.items.find(({ postId: t }) => t === e.postId);
|
|
3134
|
+
if (!n) return;
|
|
3135
|
+
let r = t.mediaIndices.get(e.postId) ?? 0;
|
|
3136
|
+
if (e.mediaIndex === r) {
|
|
3137
|
+
if (j(n).length > 1) {
|
|
3138
|
+
await this.options.transitionMedia(1);
|
|
3139
|
+
return;
|
|
3140
|
+
}
|
|
3141
|
+
await this.preparePosts([e.postId]);
|
|
3142
|
+
}
|
|
3143
|
+
});
|
|
3144
|
+
}
|
|
3145
|
+
reset() {
|
|
3146
|
+
this.generation += 1, this.pending = Promise.resolve();
|
|
3147
|
+
}
|
|
3148
|
+
async preparePosts(e) {
|
|
3149
|
+
let { state: t } = this.options, n = t.activeReelPostId, r = new Set(e);
|
|
3150
|
+
if (!this.isReelActive() || n === null || !r.has(n)) return;
|
|
3151
|
+
let i = this.generation, a = t.items.findIndex(({ postId: e }) => e === n);
|
|
3152
|
+
if (a < 0) return;
|
|
3153
|
+
let o = this.nextSurvivor(a, r);
|
|
3154
|
+
o && i === this.generation && t.activeReelPostId === n && await this.options.transitionPost(o.postId);
|
|
3155
|
+
}
|
|
3156
|
+
isReelActive() {
|
|
3157
|
+
let { state: e } = this.options;
|
|
3158
|
+
return e.layout === "reel" || e.reelOrigin === "masonry";
|
|
3159
|
+
}
|
|
3160
|
+
nextSurvivor(e, t) {
|
|
3161
|
+
if (!(e < 0)) return this.options.state.items.slice(e + 1).find(({ postId: e }) => !t.has(e));
|
|
3162
|
+
}
|
|
3163
|
+
serialize(e) {
|
|
3164
|
+
let t = this.pending.then(e, e);
|
|
3165
|
+
return this.pending = t.catch(() => void 0), t;
|
|
3166
|
+
}
|
|
3056
3167
|
};
|
|
3057
3168
|
//#endregion
|
|
3058
3169
|
//#region src/core/removalControllers.ts
|
|
3059
|
-
function
|
|
3060
|
-
let t = new
|
|
3170
|
+
function Vn(e) {
|
|
3171
|
+
let t = new zn(e), n = new Bn({
|
|
3172
|
+
state: e.state,
|
|
3173
|
+
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
3174
|
+
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
3175
|
+
});
|
|
3061
3176
|
return {
|
|
3062
|
-
exactMediaRemoval: new
|
|
3177
|
+
exactMediaRemoval: new Nn({
|
|
3063
3178
|
onActivate: e.onActivate,
|
|
3064
3179
|
reelForward: t,
|
|
3065
3180
|
state: e.state
|
|
3066
3181
|
}),
|
|
3067
|
-
itemRemoval: new
|
|
3182
|
+
itemRemoval: new Rn({
|
|
3068
3183
|
historyLimit: e.historyLimit,
|
|
3069
3184
|
onItemsRemoved: (n, r, i) => {
|
|
3070
|
-
|
|
3185
|
+
An(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
3071
3186
|
},
|
|
3072
3187
|
onRemovalRestored: (n) => {
|
|
3073
3188
|
let r = t.cancel(n);
|
|
3074
3189
|
r && e.onActivate(r.postId);
|
|
3075
3190
|
},
|
|
3076
|
-
|
|
3191
|
+
prepareRemoval: (e) => n.prepareItems(e),
|
|
3192
|
+
startRemoval: (t) => e.surface()?.startItemRemoval(t) ?? 0,
|
|
3077
3193
|
state: e.state
|
|
3078
3194
|
}),
|
|
3079
|
-
reelForward: t
|
|
3195
|
+
reelForward: t,
|
|
3196
|
+
reelRemoval: n
|
|
3080
3197
|
};
|
|
3081
3198
|
}
|
|
3082
|
-
var
|
|
3083
|
-
function
|
|
3199
|
+
var Hn = 1.5;
|
|
3200
|
+
function Un(e) {
|
|
3084
3201
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
3085
3202
|
if (t > 0 && t < 600) return !0;
|
|
3086
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
3203
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Hn;
|
|
3087
3204
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
3088
3205
|
}
|
|
3089
|
-
function
|
|
3090
|
-
return
|
|
3206
|
+
function Wn(e) {
|
|
3207
|
+
return Un(e) ? "reel" : "masonry";
|
|
3091
3208
|
}
|
|
3092
|
-
function
|
|
3209
|
+
function Gn(e) {
|
|
3093
3210
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
3094
3211
|
return {
|
|
3095
3212
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -3099,15 +3216,15 @@ function zn(e) {
|
|
|
3099
3216
|
viewportWidth: n.clientWidth
|
|
3100
3217
|
};
|
|
3101
3218
|
}
|
|
3102
|
-
function
|
|
3103
|
-
return
|
|
3219
|
+
function Kn(e) {
|
|
3220
|
+
return Un(Gn(e));
|
|
3104
3221
|
}
|
|
3105
|
-
function
|
|
3106
|
-
return
|
|
3222
|
+
function qn(e) {
|
|
3223
|
+
return Wn(Gn(e));
|
|
3107
3224
|
}
|
|
3108
3225
|
//#endregion
|
|
3109
3226
|
//#region src/core/responsiveLayoutController.ts
|
|
3110
|
-
var
|
|
3227
|
+
var Jn = class {
|
|
3111
3228
|
layoutMode;
|
|
3112
3229
|
resizeObserver = null;
|
|
3113
3230
|
target = null;
|
|
@@ -3132,10 +3249,10 @@ var Hn = class {
|
|
|
3132
3249
|
}
|
|
3133
3250
|
handleResponsiveLayout = () => {
|
|
3134
3251
|
if (!this.target) return;
|
|
3135
|
-
let e =
|
|
3136
|
-
this.state.reelInfoSheetOverlay =
|
|
3252
|
+
let e = qn(this.target);
|
|
3253
|
+
this.state.reelInfoSheetOverlay = Kn(this.target), this.state.reelMediaSource = e === "reel" ? "preview" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
3137
3254
|
};
|
|
3138
|
-
},
|
|
3255
|
+
}, Yn = class {
|
|
3139
3256
|
routedReelPostId = null;
|
|
3140
3257
|
reelRouteIsActive = !1;
|
|
3141
3258
|
constructor(e, t) {
|
|
@@ -3162,7 +3279,7 @@ var Hn = class {
|
|
|
3162
3279
|
let i = this.reelRouteIsActive ? "replace" : "push";
|
|
3163
3280
|
this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
|
|
3164
3281
|
}
|
|
3165
|
-
},
|
|
3282
|
+
}, Xn = class {
|
|
3166
3283
|
app = null;
|
|
3167
3284
|
autoScroll;
|
|
3168
3285
|
autofillDelayCountdown;
|
|
@@ -3176,46 +3293,47 @@ var Hn = class {
|
|
|
3176
3293
|
exactMediaRemoval;
|
|
3177
3294
|
itemRemoval;
|
|
3178
3295
|
reelForward;
|
|
3296
|
+
reelRemoval;
|
|
3179
3297
|
surface = null;
|
|
3180
3298
|
stopStateWatcher = null;
|
|
3181
3299
|
lastLoadedCursor = null;
|
|
3182
3300
|
state;
|
|
3183
3301
|
constructor(e) {
|
|
3184
|
-
this.options = e,
|
|
3302
|
+
this.options = e, On(e);
|
|
3185
3303
|
let t = e.layout ?? "masonry";
|
|
3186
|
-
this.state = b(
|
|
3304
|
+
this.state = b(Tn(e, t)), this.autoScroll = new Xt({
|
|
3187
3305
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
3188
3306
|
state: this.state.autoScroll
|
|
3189
|
-
}), this.autofillDelayCountdown = new
|
|
3307
|
+
}), this.autofillDelayCountdown = new Ft((e) => Object.assign(this.state.autofill, e)), this.syncAutofillCountdown(), this.fillController = new _n({
|
|
3190
3308
|
fill: e.fill,
|
|
3191
3309
|
loadPage: e.loadPage,
|
|
3192
3310
|
onLastCursor: (e) => {
|
|
3193
3311
|
this.lastLoadedCursor = e;
|
|
3194
3312
|
},
|
|
3195
3313
|
state: this.state
|
|
3196
|
-
}), this.routing = new
|
|
3197
|
-
let n =
|
|
3314
|
+
}), this.routing = new Yn(e.routing, this.state);
|
|
3315
|
+
let n = Vn({
|
|
3198
3316
|
historyLimit: e.removalHistoryLimit,
|
|
3199
3317
|
loadNext: () => this.loadNext(),
|
|
3200
3318
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
3201
3319
|
retryEnd: () => this.retryEnd(),
|
|
3202
|
-
|
|
3203
|
-
|
|
3320
|
+
state: this.state,
|
|
3321
|
+
surface: () => this.surface
|
|
3204
3322
|
});
|
|
3205
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.responsiveLayout = new
|
|
3323
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new Jn(t, this.state, () => {
|
|
3206
3324
|
this.routing.syncFeed();
|
|
3207
3325
|
}), this.startStateNotifications();
|
|
3208
3326
|
}
|
|
3209
3327
|
async mount() {
|
|
3210
3328
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
3211
3329
|
this.startStateNotifications();
|
|
3212
|
-
let e =
|
|
3213
|
-
this.responsiveLayout.mount(e), this.app =
|
|
3330
|
+
let e = kn(this.options.target);
|
|
3331
|
+
this.responsiveLayout.mount(e), this.app = i(Tt, {
|
|
3214
3332
|
canRetryEnd: !!this.options.loadPage,
|
|
3215
3333
|
cardFooter: this.options.cardFooter,
|
|
3216
3334
|
cardHeader: this.options.cardHeader,
|
|
3217
3335
|
feedFooter: this.options.feedFooter,
|
|
3218
|
-
feedFooterActions:
|
|
3336
|
+
feedFooterActions: vn(this),
|
|
3219
3337
|
mediaCard: this.options.mediaCard,
|
|
3220
3338
|
reelInfoSheet: this.options.reelInfoSheet,
|
|
3221
3339
|
state: this.state,
|
|
@@ -3237,7 +3355,7 @@ var Hn = class {
|
|
|
3237
3355
|
}), this.surface = this.app.mount(e), this.autoScroll.mount(), this.options.initialPage ? this.options.autofill && this.state.autofill.status === "idle" && !this.fillController.isActive() && await this.startInitialAutofill() : await this.reload();
|
|
3238
3356
|
}
|
|
3239
3357
|
destroy() {
|
|
3240
|
-
this.autoScroll.destroy(), this.fillController.destroy(), this.cancelRequest(), this.reelForward.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.destroy(), this.responsiveLayout.destroy(), this.stopStateWatcher?.(), this.stopStateWatcher = null, this.app?.unmount(), this.app = null, this.surface = null;
|
|
3358
|
+
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;
|
|
3241
3359
|
}
|
|
3242
3360
|
getState() {
|
|
3243
3361
|
return F(this.state);
|
|
@@ -3245,6 +3363,9 @@ var Hn = class {
|
|
|
3245
3363
|
removeMedia(e) {
|
|
3246
3364
|
return this.exactMediaRemoval.remove(e);
|
|
3247
3365
|
}
|
|
3366
|
+
removeMediaAnimated(e) {
|
|
3367
|
+
return this.reelRemoval.prepareMedia(e).then(() => this.exactMediaRemoval.remove(e));
|
|
3368
|
+
}
|
|
3248
3369
|
removeItems(e) {
|
|
3249
3370
|
return this.itemRemoval.remove(e);
|
|
3250
3371
|
}
|
|
@@ -3288,11 +3409,11 @@ var Hn = class {
|
|
|
3288
3409
|
this.autoScroll.setSpeed(e);
|
|
3289
3410
|
}
|
|
3290
3411
|
applyAutofillUpdate(e) {
|
|
3291
|
-
let t =
|
|
3412
|
+
let t = $t(this.options.autofill, this.state, e);
|
|
3292
3413
|
return t && this.syncAutofillCountdown(), t;
|
|
3293
3414
|
}
|
|
3294
3415
|
async cancelAutofill() {
|
|
3295
|
-
await
|
|
3416
|
+
await Ht(this.options.autofill, this.state, () => this.cancelRequest());
|
|
3296
3417
|
}
|
|
3297
3418
|
applyFillUpdate(e) {
|
|
3298
3419
|
return this.fillController.applyUpdate(e);
|
|
@@ -3301,11 +3422,11 @@ var Hn = class {
|
|
|
3301
3422
|
return this.fillController.cancel();
|
|
3302
3423
|
}
|
|
3303
3424
|
async fill(e) {
|
|
3304
|
-
if (this.pendingRequest ||
|
|
3425
|
+
if (this.pendingRequest || Vt(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
3305
3426
|
await this.fillController.start(e);
|
|
3306
3427
|
}
|
|
3307
3428
|
restoreAutofillSession(e) {
|
|
3308
|
-
let t =
|
|
3429
|
+
let t = en(this.options.autofill, this.state, e);
|
|
3309
3430
|
return t && this.syncAutofillCountdown(), t;
|
|
3310
3431
|
}
|
|
3311
3432
|
restoreFillSession(e) {
|
|
@@ -3313,7 +3434,7 @@ var Hn = class {
|
|
|
3313
3434
|
}
|
|
3314
3435
|
async loadNext() {
|
|
3315
3436
|
if (this.pendingRequest) return this.pendingRequest;
|
|
3316
|
-
if (!this.state.loadMoreLocked && !(
|
|
3437
|
+
if (!this.state.loadMoreLocked && !(Vt(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);
|
|
3317
3438
|
}
|
|
3318
3439
|
async refresh() {
|
|
3319
3440
|
return this.replaceFeed(this.state.next ?? this.lastLoadedCursor, "refresh");
|
|
@@ -3323,23 +3444,23 @@ var Hn = class {
|
|
|
3323
3444
|
}
|
|
3324
3445
|
async replaceFeed(e, t) {
|
|
3325
3446
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
3326
|
-
return
|
|
3447
|
+
return Vt(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = Bt(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);
|
|
3327
3448
|
}
|
|
3328
3449
|
async retryEnd() {
|
|
3329
3450
|
if (this.pendingRequest) return this.pendingRequest;
|
|
3330
|
-
if (!this.state.loadMoreLocked && !(
|
|
3451
|
+
if (!this.state.loadMoreLocked && !(Vt(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);
|
|
3331
3452
|
}
|
|
3332
3453
|
setInfiniteScroll(e) {
|
|
3333
|
-
this.state.infiniteScroll = e, e &&
|
|
3454
|
+
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
3334
3455
|
}
|
|
3335
3456
|
setLoadMoreLocked(e) {
|
|
3336
|
-
this.state.loadMoreLocked !== e && (this.state.loadMoreLocked = e, !e && this.state.infiniteScroll &&
|
|
3457
|
+
this.state.loadMoreLocked !== e && (this.state.loadMoreLocked = e, !e && this.state.infiniteScroll && m(() => this.surface?.loadIfNearBottom()));
|
|
3337
3458
|
}
|
|
3338
3459
|
setReelAutoAdvance(e) {
|
|
3339
|
-
|
|
3460
|
+
Sn(this.state.reelAutoAdvance, e);
|
|
3340
3461
|
}
|
|
3341
3462
|
setReelInfoSheet(e) {
|
|
3342
|
-
|
|
3463
|
+
wn(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
3343
3464
|
}
|
|
3344
3465
|
setLayout(e) {
|
|
3345
3466
|
this.responsiveLayout.setLayout(e);
|
|
@@ -3363,7 +3484,7 @@ var Hn = class {
|
|
|
3363
3484
|
this.abortController = i;
|
|
3364
3485
|
try {
|
|
3365
3486
|
if (a?.strategy === "frontend") {
|
|
3366
|
-
let o = await
|
|
3487
|
+
let o = await Wt({
|
|
3367
3488
|
existingItems: t ? this.state.items : [],
|
|
3368
3489
|
initialCursor: e,
|
|
3369
3490
|
loadPage: n,
|
|
@@ -3385,7 +3506,7 @@ var Hn = class {
|
|
|
3385
3506
|
});
|
|
3386
3507
|
return;
|
|
3387
3508
|
}
|
|
3388
|
-
let c =
|
|
3509
|
+
let c = Et(await n({
|
|
3389
3510
|
cursor: e,
|
|
3390
3511
|
signal: i.signal
|
|
3391
3512
|
}));
|
|
@@ -3400,7 +3521,7 @@ var Hn = class {
|
|
|
3400
3521
|
this.state.autofill.status = "complete";
|
|
3401
3522
|
return;
|
|
3402
3523
|
}
|
|
3403
|
-
await
|
|
3524
|
+
await Zt(a, this.state, {
|
|
3404
3525
|
cycleId: o,
|
|
3405
3526
|
feedKey: a.feedKey,
|
|
3406
3527
|
items: u.slice(l.length),
|
|
@@ -3425,7 +3546,7 @@ var Hn = class {
|
|
|
3425
3546
|
this.autofillDelayCountdown.clear();
|
|
3426
3547
|
let t = `vibe-autofill-${Date.now().toString(36)}-${++this.autofillCycle}`;
|
|
3427
3548
|
return this.state.autofill = {
|
|
3428
|
-
...
|
|
3549
|
+
...Bt(e, void 0, !1),
|
|
3429
3550
|
cycleId: t,
|
|
3430
3551
|
status: "filling"
|
|
3431
3552
|
}, t;
|
|
@@ -3443,7 +3564,7 @@ var Hn = class {
|
|
|
3443
3564
|
startInitialAutofill() {
|
|
3444
3565
|
let e = ++this.requestVersion, t = new AbortController(), n = this.beginAutofillCycle();
|
|
3445
3566
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
3446
|
-
let r =
|
|
3567
|
+
let r = tn({
|
|
3447
3568
|
cycleId: n,
|
|
3448
3569
|
isCurrent: () => e === this.requestVersion,
|
|
3449
3570
|
onLastCursor: (e) => {
|
|
@@ -3467,8 +3588,8 @@ var Hn = class {
|
|
|
3467
3588
|
}));
|
|
3468
3589
|
}
|
|
3469
3590
|
};
|
|
3470
|
-
function
|
|
3471
|
-
return new
|
|
3591
|
+
function Zn(e) {
|
|
3592
|
+
return new Xn(e);
|
|
3472
3593
|
}
|
|
3473
3594
|
//#endregion
|
|
3474
|
-
export {
|
|
3595
|
+
export { Zn as createVibe };
|