@flamingo-stack/openframe-frontend-core 0.0.396 → 0.0.397-snapshot.20260710044003
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/dist/{chunk-HWJUWOXK.cjs → chunk-2DGA5LHT.cjs} +19 -19
- package/dist/{chunk-HWJUWOXK.cjs.map → chunk-2DGA5LHT.cjs.map} +1 -1
- package/dist/{chunk-J2UHW4UM.js → chunk-2TBXIW7L.js} +3 -3
- package/dist/{chunk-HNXZFKDQ.cjs → chunk-4BVRLCCA.cjs} +73 -73
- package/dist/{chunk-HNXZFKDQ.cjs.map → chunk-4BVRLCCA.cjs.map} +1 -1
- package/dist/{chunk-WWHPTP4B.js → chunk-4KWIQEZT.js} +2 -2
- package/dist/{chunk-6DGQPKVA.cjs → chunk-7Q2DZEUA.cjs} +32 -32
- package/dist/{chunk-6DGQPKVA.cjs.map → chunk-7Q2DZEUA.cjs.map} +1 -1
- package/dist/{chunk-SV7IJPIH.js → chunk-B2K5COVE.js} +5458 -5029
- package/dist/chunk-B2K5COVE.js.map +1 -0
- package/dist/{chunk-AODSKL5I.cjs → chunk-C4DHYDXB.cjs} +12 -12
- package/dist/{chunk-AODSKL5I.cjs.map → chunk-C4DHYDXB.cjs.map} +1 -1
- package/dist/{chunk-HEH47UTC.cjs → chunk-FZIMFLJG.cjs} +15 -15
- package/dist/{chunk-HEH47UTC.cjs.map → chunk-FZIMFLJG.cjs.map} +1 -1
- package/dist/{chunk-PQXUY6SB.js → chunk-G42EXM23.js} +2 -2
- package/dist/{chunk-TIC3UE6L.js → chunk-GKRJOS6S.js} +3 -3
- package/dist/{chunk-NAFW3LKI.cjs → chunk-HMTOQGYU.cjs} +7 -7
- package/dist/{chunk-NAFW3LKI.cjs.map → chunk-HMTOQGYU.cjs.map} +1 -1
- package/dist/{chunk-743FCO64.cjs → chunk-JWBRDNYH.cjs} +31 -31
- package/dist/{chunk-743FCO64.cjs.map → chunk-JWBRDNYH.cjs.map} +1 -1
- package/dist/{chunk-VSPNWVIE.cjs → chunk-LBDKAMOH.cjs} +75 -75
- package/dist/{chunk-VSPNWVIE.cjs.map → chunk-LBDKAMOH.cjs.map} +1 -1
- package/dist/{chunk-LWNPMLIH.cjs → chunk-LPH2JDOW.cjs} +56 -2
- package/dist/chunk-LPH2JDOW.cjs.map +1 -0
- package/dist/{chunk-OP3H7VB2.js → chunk-MGJZQ3EE.js} +2 -2
- package/dist/{chunk-GA3R77TB.js → chunk-MNQVBME4.js} +3 -3
- package/dist/{chunk-H4WIS6RJ.js → chunk-MQXUIYYN.js} +4 -4
- package/dist/{chunk-2PTEK3D6.js → chunk-N4R7TRF3.js} +2 -2
- package/dist/{chunk-LQHMXPOJ.js → chunk-N7YBNHVT.js} +563 -509
- package/dist/chunk-N7YBNHVT.js.map +1 -0
- package/dist/{chunk-KRMGVMIO.cjs → chunk-PE37UDPF.cjs} +40 -40
- package/dist/{chunk-KRMGVMIO.cjs.map → chunk-PE37UDPF.cjs.map} +1 -1
- package/dist/{chunk-FAUC7EA3.js → chunk-URODM26E.js} +6 -6
- package/dist/{chunk-EKYE2VJU.js → chunk-VDDNJ6XC.js} +5 -5
- package/dist/{chunk-Y36KVLBX.cjs → chunk-VVO7AZKZ.cjs} +1413 -984
- package/dist/chunk-VVO7AZKZ.cjs.map +1 -0
- package/dist/{chunk-2U3YPWHG.cjs → chunk-WBLRUO3F.cjs} +3 -3
- package/dist/{chunk-2U3YPWHG.cjs.map → chunk-WBLRUO3F.cjs.map} +1 -1
- package/dist/{chunk-RUYZ5QMK.cjs → chunk-WJSUUOPU.cjs} +40 -40
- package/dist/{chunk-RUYZ5QMK.cjs.map → chunk-WJSUUOPU.cjs.map} +1 -1
- package/dist/{chunk-STEM5CPV.js → chunk-WXOIEYXW.js} +5 -5
- package/dist/{chunk-XQILJ7FF.cjs → chunk-XYT5PIKZ.cjs} +5 -5
- package/dist/{chunk-XQILJ7FF.cjs.map → chunk-XYT5PIKZ.cjs.map} +1 -1
- package/dist/{chunk-NFRHBR7W.js → chunk-Y3FREU4B.js} +7 -7
- package/dist/{chunk-CCV6Z3CL.cjs → chunk-YEWGFWNM.cjs} +29 -29
- package/dist/{chunk-CCV6Z3CL.cjs.map → chunk-YEWGFWNM.cjs.map} +1 -1
- package/dist/{chunk-KQESCGVG.js → chunk-ZSZRJWY3.js} +2 -2
- package/dist/components/case-studies/index.cjs +14 -14
- package/dist/components/case-studies/index.js +4 -4
- package/dist/components/chat/entity-cards/blog-card.d.ts +6 -3
- package/dist/components/chat/entity-cards/blog-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/case-study-card.d.ts +7 -3
- package/dist/components/chat/entity-cards/case-study-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/customer-interview-card.d.ts +6 -3
- package/dist/components/chat/entity-cards/customer-interview-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/entity-portrait-card.d.ts +59 -0
- package/dist/components/chat/entity-cards/entity-portrait-card.d.ts.map +1 -0
- package/dist/components/chat/entity-cards/index.d.ts +3 -0
- package/dist/components/chat/entity-cards/index.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/investor-update-card.d.ts +6 -3
- package/dist/components/chat/entity-cards/investor-update-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/onboarding-guide-card.d.ts +4 -2
- package/dist/components/chat/entity-cards/onboarding-guide-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/program-card.d.ts +17 -5
- package/dist/components/chat/entity-cards/program-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/use-cover-image-fallback.d.ts +26 -0
- package/dist/components/chat/entity-cards/use-cover-image-fallback.d.ts.map +1 -0
- package/dist/components/chat/index.cjs +12 -4
- package/dist/components/chat/index.cjs.map +1 -1
- package/dist/components/chat/index.js +11 -3
- package/dist/components/chat/types/entities/program-types.d.ts +23 -0
- package/dist/components/chat/types/entities/program-types.d.ts.map +1 -1
- package/dist/components/contact/index.cjs +5 -5
- package/dist/components/contact/index.js +4 -4
- package/dist/components/docs/index.cjs +7 -7
- package/dist/components/docs/index.js +6 -6
- package/dist/components/embeds/index.cjs +5 -5
- package/dist/components/embeds/index.js +4 -4
- package/dist/components/faq/index.cjs +6 -6
- package/dist/components/faq/index.js +5 -5
- package/dist/components/features/cards-strip.d.ts.map +1 -1
- package/dist/components/features/index.cjs +8 -4
- package/dist/components/features/index.cjs.map +1 -1
- package/dist/components/features/index.d.ts +1 -0
- package/dist/components/features/index.d.ts.map +1 -1
- package/dist/components/features/index.js +7 -3
- package/dist/components/features/video-bites-strip.d.ts.map +1 -1
- package/dist/components/features/video-center-badge.d.ts +40 -0
- package/dist/components/features/video-center-badge.d.ts.map +1 -0
- package/dist/components/features/video.d.ts +7 -4
- package/dist/components/features/video.d.ts.map +1 -1
- package/dist/components/help-center-pages/index.cjs +23 -23
- package/dist/components/help-center-pages/index.js +14 -14
- package/dist/components/icons/index.cjs +6 -2
- package/dist/components/icons/index.cjs.map +1 -1
- package/dist/components/icons/index.d.ts +2 -0
- package/dist/components/icons/index.d.ts.map +1 -1
- package/dist/components/icons/index.js +5 -1
- package/dist/components/icons/play-filled-icon.d.ts +15 -0
- package/dist/components/icons/play-filled-icon.d.ts.map +1 -0
- package/dist/components/icons/volume-off-filled-icon.d.ts +14 -0
- package/dist/components/icons/volume-off-filled-icon.d.ts.map +1 -0
- package/dist/components/index.cjs +160 -142
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +30 -12
- package/dist/components/index.js.map +1 -1
- package/dist/components/media-carousel.d.ts.map +1 -1
- package/dist/components/navigation/index.cjs +4 -4
- package/dist/components/navigation/index.js +3 -3
- package/dist/components/onboarding-guides/index.cjs +8 -8
- package/dist/components/onboarding-guides/index.js +7 -7
- package/dist/components/related-content/index.cjs +6 -6
- package/dist/components/related-content/index.js +5 -5
- package/dist/components/tickets/index.cjs +7 -7
- package/dist/components/tickets/index.js +6 -6
- package/dist/components/ui/crossfade-panels.d.ts +52 -0
- package/dist/components/ui/crossfade-panels.d.ts.map +1 -0
- package/dist/components/ui/index.cjs +14 -4
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +13 -3
- package/dist/components/ui/tab-navigation.d.ts +6 -2
- package/dist/components/ui/tab-navigation.d.ts.map +1 -1
- package/dist/hooks/index.cjs +3 -3
- package/dist/hooks/index.js +2 -2
- package/dist/index.cjs +22 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -3
- package/package.json +4 -4
- package/src/components/chat/entity-cards/blog-card.tsx +40 -7
- package/src/components/chat/entity-cards/case-study-card.tsx +32 -6
- package/src/components/chat/entity-cards/customer-interview-card.tsx +31 -6
- package/src/components/chat/entity-cards/entity-portrait-card.tsx +201 -0
- package/src/components/chat/entity-cards/index.ts +18 -0
- package/src/components/chat/entity-cards/investor-update-card.tsx +28 -2
- package/src/components/chat/entity-cards/onboarding-guide-card.tsx +30 -1
- package/src/components/chat/entity-cards/program-card.tsx +69 -17
- package/src/components/chat/entity-cards/use-cover-image-fallback.ts +50 -0
- package/src/components/chat/types/entities/program-types.ts +34 -0
- package/src/components/features/cards-strip.tsx +122 -8
- package/src/components/features/index.ts +1 -0
- package/src/components/features/video-bites-strip.tsx +77 -15
- package/src/components/features/video-center-badge.tsx +77 -0
- package/src/components/features/video.tsx +51 -28
- package/src/components/icons/index.ts +2 -0
- package/src/components/icons/play-filled-icon.tsx +36 -0
- package/src/components/icons/volume-off-filled-icon.tsx +38 -0
- package/src/components/media-carousel.tsx +2 -4
- package/src/components/ui/crossfade-panels.tsx +88 -0
- package/src/components/ui/index.ts +1 -0
- package/src/components/ui/tab-navigation.tsx +31 -14
- package/src/styles/app-globals.css +23 -0
- package/dist/chunk-LQHMXPOJ.js.map +0 -1
- package/dist/chunk-LWNPMLIH.cjs.map +0 -1
- package/dist/chunk-SV7IJPIH.js.map +0 -1
- package/dist/chunk-Y36KVLBX.cjs.map +0 -1
- /package/dist/{chunk-J2UHW4UM.js.map → chunk-2TBXIW7L.js.map} +0 -0
- /package/dist/{chunk-WWHPTP4B.js.map → chunk-4KWIQEZT.js.map} +0 -0
- /package/dist/{chunk-PQXUY6SB.js.map → chunk-G42EXM23.js.map} +0 -0
- /package/dist/{chunk-TIC3UE6L.js.map → chunk-GKRJOS6S.js.map} +0 -0
- /package/dist/{chunk-OP3H7VB2.js.map → chunk-MGJZQ3EE.js.map} +0 -0
- /package/dist/{chunk-GA3R77TB.js.map → chunk-MNQVBME4.js.map} +0 -0
- /package/dist/{chunk-H4WIS6RJ.js.map → chunk-MQXUIYYN.js.map} +0 -0
- /package/dist/{chunk-2PTEK3D6.js.map → chunk-N4R7TRF3.js.map} +0 -0
- /package/dist/{chunk-FAUC7EA3.js.map → chunk-URODM26E.js.map} +0 -0
- /package/dist/{chunk-EKYE2VJU.js.map → chunk-VDDNJ6XC.js.map} +0 -0
- /package/dist/{chunk-STEM5CPV.js.map → chunk-WXOIEYXW.js.map} +0 -0
- /package/dist/{chunk-NFRHBR7W.js.map → chunk-Y3FREU4B.js.map} +0 -0
- /package/dist/{chunk-KQESCGVG.js.map → chunk-ZSZRJWY3.js.map} +0 -0
|
@@ -284,6 +284,11 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
|
|
|
284
284
|
// modulo the copy width each frame, so warps are invisible to it.
|
|
285
285
|
const marqueePosRef = useRef(0);
|
|
286
286
|
const glideRemainingRef = useRef(0);
|
|
287
|
+
// Velocity envelope (px/s): the marquee EASES between 0 and autoScrollSpeed
|
|
288
|
+
// (~250ms time constant) instead of binary stop/start — pause decelerates,
|
|
289
|
+
// resume accelerates from the current position (GSAP-marquee behavior;
|
|
290
|
+
// hard cuts read as jank).
|
|
291
|
+
const speedEnvRef = useRef(0);
|
|
287
292
|
useEffect(() => {
|
|
288
293
|
if (!marqueeActive) return;
|
|
289
294
|
const scroller = scrollerRef.current;
|
|
@@ -301,11 +306,21 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
|
|
|
301
306
|
const tick = (now: number) => {
|
|
302
307
|
const dt = Math.min(now - last, 100) / 1000; // clamp tab-wake jumps
|
|
303
308
|
last = now;
|
|
309
|
+
// Container-level pause (industry-standard marquee behavior): the
|
|
310
|
+
// marquee freezes whenever a hover-capable pointer is ANYWHERE over the
|
|
311
|
+
// cards row — content must never move under a pointing cursor. Per-card
|
|
312
|
+
// activeKey still pauses for keyboard focus (no pointer involved).
|
|
304
313
|
const paused =
|
|
305
|
-
(pauseOnHover && activeKeyRef.current !== null) ||
|
|
314
|
+
(pauseOnHover && (hoverPointerRef.current.inside || activeKeyRef.current !== null)) ||
|
|
306
315
|
!nearViewportRef.current ||
|
|
307
316
|
document.visibilityState === 'hidden' ||
|
|
308
317
|
now < Math.max(chevronSuppressUntilRef.current, userScrollSuppressUntilRef.current);
|
|
318
|
+
// Ease the marquee velocity toward its target (0 when paused) — smooth
|
|
319
|
+
// decel on hover, smooth accel on leave, always from the CURRENT position.
|
|
320
|
+
const targetSpeed = paused ? 0 : autoScrollSpeed;
|
|
321
|
+
speedEnvRef.current += (targetSpeed - speedEnvRef.current) * Math.min(1, dt / 0.25);
|
|
322
|
+
if (targetSpeed === 0 && speedEnvRef.current < 0.5) speedEnvRef.current = 0;
|
|
323
|
+
|
|
309
324
|
const glide = glideRemainingRef.current;
|
|
310
325
|
if (glide !== 0) {
|
|
311
326
|
// Ease-out toward the chevron target; runs even while "paused"
|
|
@@ -318,20 +333,26 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
|
|
|
318
333
|
glideRemainingRef.current = Math.abs(glide - step) < 0.5 ? 0 : glide - step;
|
|
319
334
|
marqueePosRef.current = wrap(marqueePosRef.current + step);
|
|
320
335
|
scroller.scrollLeft = marqueePosRef.current;
|
|
321
|
-
} else if (
|
|
336
|
+
} else if (speedEnvRef.current > 0) {
|
|
322
337
|
// Resync after external movement (user scroll, seam warp).
|
|
323
338
|
if (Math.abs(scroller.scrollLeft - marqueePosRef.current) > 1.5) {
|
|
324
339
|
marqueePosRef.current = scroller.scrollLeft;
|
|
325
340
|
}
|
|
326
|
-
marqueePosRef.current = wrap(marqueePosRef.current +
|
|
341
|
+
marqueePosRef.current = wrap(marqueePosRef.current + speedEnvRef.current * dt);
|
|
327
342
|
scroller.scrollLeft = marqueePosRef.current;
|
|
328
343
|
} else {
|
|
329
344
|
marqueePosRef.current = scroller.scrollLeft;
|
|
330
345
|
}
|
|
346
|
+
// Track moved under a possibly-stationary pointer → re-resolve which
|
|
347
|
+
// card is hovered (declared below; stable useCallback identity, called
|
|
348
|
+
// lazily per frame so source order is irrelevant — deliberately NOT a
|
|
349
|
+
// dep, same as the activeKeyRef read above).
|
|
350
|
+
syncHoverIfScrolled();
|
|
331
351
|
raf = requestAnimationFrame(tick);
|
|
332
352
|
};
|
|
333
353
|
raf = requestAnimationFrame(tick);
|
|
334
354
|
return () => cancelAnimationFrame(raf);
|
|
355
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- syncHoverIfScrolled is identity-stable
|
|
335
356
|
}, [marqueeActive, autoScrollSpeed, pauseOnHover]);
|
|
336
357
|
|
|
337
358
|
// ---- hover / overlay state -----------------------------------------------------
|
|
@@ -357,6 +378,72 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
|
|
|
357
378
|
setActiveKey(current => (current === key ? null : current));
|
|
358
379
|
}, []);
|
|
359
380
|
|
|
381
|
+
// ---- container-level hover pause + pointer-tracked activation sync ---------
|
|
382
|
+
// TWO separate concerns, deliberately decoupled (matches how production
|
|
383
|
+
// marquees — react-fast-marquee, GSAP — behave):
|
|
384
|
+
//
|
|
385
|
+
// 1. MARQUEE PAUSE is container-level: `hoverPointerRef.inside` is true
|
|
386
|
+
// whenever a hover-capable pointer is over the SCROLLER (the cards row).
|
|
387
|
+
// The rAF freezes on it, so content NEVER auto-moves under a pointing
|
|
388
|
+
// cursor — which is what made per-card boundary pausing feel flaky
|
|
389
|
+
// (cards sliding under/away from a stationary pointer don't emit
|
|
390
|
+
// pointerenter/leave, gaps caused stutter-steps, seam warps swapped the
|
|
391
|
+
// hovered card's identity mid-playback).
|
|
392
|
+
//
|
|
393
|
+
// 2. CARD ACTIVATION (overlay + video playback) stays per-card: the card/
|
|
394
|
+
// cell pointer handlers are the zero-latency path, and the
|
|
395
|
+
// elementFromPoint sync below re-resolves the card under the pointer
|
|
396
|
+
// whenever the track moves WHILE the pointer is inside (user wheel
|
|
397
|
+
// scroll, chevron glide, seam warp) — scoped to THIS strip's scroller so
|
|
398
|
+
// stacked strips can never activate/pause each other.
|
|
399
|
+
const hoverPointerRef = useRef<{ x: number; y: number; inside: boolean }>({ x: 0, y: 0, inside: false });
|
|
400
|
+
const lastHoverSyncScrollRef = useRef(-1);
|
|
401
|
+
const syncHoverToPointer = useCallback(() => {
|
|
402
|
+
const p = hoverPointerRef.current;
|
|
403
|
+
if (!p.inside) return;
|
|
404
|
+
const el = typeof document !== 'undefined' ? document.elementFromPoint(p.x, p.y) : null;
|
|
405
|
+
const cardEl = el?.closest?.('[data-strip-card-key]') as HTMLElement | null;
|
|
406
|
+
// Strip-scoped: a card from ANOTHER CardsStrip under the tracked point
|
|
407
|
+
// must read as "no card here" (stacked strips share the viewport).
|
|
408
|
+
const scoped = cardEl && scrollerRef.current?.contains(cardEl) ? cardEl : null;
|
|
409
|
+
const key = scoped?.getAttribute('data-strip-card-key') ?? null;
|
|
410
|
+
const current = activeKeyRef.current;
|
|
411
|
+
if (key === current) return;
|
|
412
|
+
if (current !== null) deactivate(current);
|
|
413
|
+
if (key !== null) activate(key);
|
|
414
|
+
}, [activate, deactivate]);
|
|
415
|
+
// Hover-capable pointers only (mouse/pen) — touch drags must not fake hover.
|
|
416
|
+
const onHoverPointerEnter = useCallback((e: React.PointerEvent) => {
|
|
417
|
+
if (e.pointerType === 'touch') return;
|
|
418
|
+
hoverPointerRef.current = { x: e.clientX, y: e.clientY, inside: true };
|
|
419
|
+
}, []);
|
|
420
|
+
const onHoverPointerMove = useCallback((e: React.PointerEvent) => {
|
|
421
|
+
if (e.pointerType === 'touch') return;
|
|
422
|
+
hoverPointerRef.current = { x: e.clientX, y: e.clientY, inside: true };
|
|
423
|
+
}, []);
|
|
424
|
+
const onHoverPointerLeave = useCallback((e: React.PointerEvent) => {
|
|
425
|
+
if (e.pointerType === 'touch') return;
|
|
426
|
+
hoverPointerRef.current.inside = false;
|
|
427
|
+
// The pointer left the whole scroller — no card can be hovered anymore
|
|
428
|
+
// (covers leave events swallowed by DOM churn under the cursor).
|
|
429
|
+
const current = activeKeyRef.current;
|
|
430
|
+
if (current !== null) deactivate(current);
|
|
431
|
+
}, [deactivate]);
|
|
432
|
+
/** Re-sync hover only when the track actually moved under the pointer.
|
|
433
|
+
* KNOWN HOT-PATH COST (intentional): while the marquee runs with the
|
|
434
|
+
* pointer parked over strip whitespace (no card → not paused), scrollLeft
|
|
435
|
+
* changes every frame, so this invokes `document.elementFromPoint` ~60×/s
|
|
436
|
+
* — a synchronous hit-test. It's inherent to detecting a card sliding
|
|
437
|
+
* under a stationary cursor; any throttle trades hover latency for it.
|
|
438
|
+
* Revisit only if profiling flags it on pages with many stacked strips. */
|
|
439
|
+
const syncHoverIfScrolled = useCallback(() => {
|
|
440
|
+
const scroller = scrollerRef.current;
|
|
441
|
+
if (!scroller) return;
|
|
442
|
+
if (scroller.scrollLeft === lastHoverSyncScrollRef.current) return;
|
|
443
|
+
lastHoverSyncScrollRef.current = scroller.scrollLeft;
|
|
444
|
+
syncHoverToPointer();
|
|
445
|
+
}, [syncHoverToPointer]);
|
|
446
|
+
|
|
360
447
|
// ---- shared card-mount gate (by ITEM index, across both copies) -------------
|
|
361
448
|
// A card and its clone show identical content half a copy-width apart. If
|
|
362
449
|
// each card gated its own expensive content (e.g. video players), a seam warp
|
|
@@ -433,6 +520,15 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
|
|
|
433
520
|
const onUserScrollIntent = useCallback(() => {
|
|
434
521
|
userScrollSuppressUntilRef.current = performance.now() + USER_SCROLL_SUPPRESS_MS;
|
|
435
522
|
}, []);
|
|
523
|
+
// Suppress ONLY on genuine horizontal-scroll intent. Vertical page-scroll
|
|
524
|
+
// wheel events over the strip and plain clicks (pointerdown) used to arm the
|
|
525
|
+
// 3s suppression — the "marquee resumes only after a delay" bug.
|
|
526
|
+
const onWheelIntent = useCallback((e: React.WheelEvent) => {
|
|
527
|
+
if (Math.abs(e.deltaX) > Math.abs(e.deltaY)) onUserScrollIntent();
|
|
528
|
+
}, [onUserScrollIntent]);
|
|
529
|
+
const onPointerDownIntent = useCallback((e: React.PointerEvent) => {
|
|
530
|
+
if (e.pointerType === 'touch') onUserScrollIntent();
|
|
531
|
+
}, [onUserScrollIntent]);
|
|
436
532
|
|
|
437
533
|
// Never-ending strip: warp across the clone seam on EVERY scroll (manual
|
|
438
534
|
// wheel/drag/chevron included — the rAF only wraps while the marquee runs,
|
|
@@ -445,7 +541,12 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
|
|
|
445
541
|
marqueeActiveRef.current = marqueeActive;
|
|
446
542
|
const onSeamWarp = useCallback(() => {
|
|
447
543
|
const scroller = scrollerRef.current;
|
|
448
|
-
if (!scroller
|
|
544
|
+
if (!scroller) return;
|
|
545
|
+
// Every scroll (native wheel/drag, smooth chevron scroll, marquee) moves
|
|
546
|
+
// cards under a possibly-stationary pointer — re-resolve hover regardless
|
|
547
|
+
// of marquee state (pointerenter/leave never fire for track motion).
|
|
548
|
+
syncHoverIfScrolled();
|
|
549
|
+
if (!marqueeActiveRef.current) return;
|
|
449
550
|
const half = singleCopyWidthRef.current;
|
|
450
551
|
if (half <= 0) return;
|
|
451
552
|
let sl = scroller.scrollLeft;
|
|
@@ -459,7 +560,7 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
|
|
|
459
560
|
marqueePosRef.current = sl;
|
|
460
561
|
}
|
|
461
562
|
lastScrollLeftRef.current = sl;
|
|
462
|
-
}, []);
|
|
563
|
+
}, [syncHoverIfScrolled]);
|
|
463
564
|
|
|
464
565
|
// ---- render ----------------------------------------------------------------
|
|
465
566
|
|
|
@@ -468,6 +569,15 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
|
|
|
468
569
|
// Seam assertion (see normalization comment above).
|
|
469
570
|
return (props.renderCard as (item: unknown, ctx: CardStripRenderCtx) => React.ReactNode)(item, ctx);
|
|
470
571
|
}
|
|
572
|
+
// Per-child DESKTOP cell-width hint: heterogeneous card designs need
|
|
573
|
+
// heterogeneous cells (wide horizontal cards vs 400px vertical cards —
|
|
574
|
+
// variable widths are native to the engine, exactly like bite ratios).
|
|
575
|
+
// Read from the child ELEMENT's `data-strip-cell-width` prop; mobile keeps
|
|
576
|
+
// the strip-level width (wide cards stack vertically below md anyway).
|
|
577
|
+
const hintedWidth = React.isValidElement(item)
|
|
578
|
+
? (item.props as Record<string, unknown>)['data-strip-cell-width']
|
|
579
|
+
: undefined;
|
|
580
|
+
const desktopWidth = typeof hintedWidth === 'number' ? hintedWidth : cardWidthDesktop;
|
|
471
581
|
// Managed cell — the ONLY place cell width / activation / clone a11y are
|
|
472
582
|
// encoded for children mode.
|
|
473
583
|
return (
|
|
@@ -476,7 +586,8 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
|
|
|
476
586
|
// clones).
|
|
477
587
|
<div
|
|
478
588
|
className="shrink-0 self-stretch"
|
|
479
|
-
style={{ width: ctx.isMobile ? cardWidthMobile :
|
|
589
|
+
style={{ width: ctx.isMobile ? cardWidthMobile : desktopWidth, maxWidth: STRIP_CELL_MAX_WIDTH }}
|
|
590
|
+
data-strip-card-key={ctx.cardKey}
|
|
480
591
|
onPointerEnter={ctx.isTouch ? undefined : () => ctx.onActivate(ctx.cardKey)}
|
|
481
592
|
onPointerLeave={ctx.isTouch ? undefined : () => ctx.onDeactivate(ctx.cardKey)}
|
|
482
593
|
// Keyboard pause parity (focus bubbles from the card's anchor; WCAG 2.2.2).
|
|
@@ -520,9 +631,12 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
|
|
|
520
631
|
<div
|
|
521
632
|
ref={scrollerRef}
|
|
522
633
|
className="overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
|
|
523
|
-
onWheel={
|
|
634
|
+
onWheel={onWheelIntent}
|
|
524
635
|
onTouchStart={onUserScrollIntent}
|
|
525
|
-
onPointerDown={
|
|
636
|
+
onPointerDown={onPointerDownIntent}
|
|
637
|
+
onPointerEnter={onHoverPointerEnter}
|
|
638
|
+
onPointerMove={onHoverPointerMove}
|
|
639
|
+
onPointerLeave={onHoverPointerLeave}
|
|
526
640
|
onScroll={onSeamWarp}
|
|
527
641
|
>
|
|
528
642
|
<div ref={trackRef} data-copies={copies} className="flex w-max items-stretch gap-4">
|
|
@@ -60,6 +60,7 @@ export * from './warning-block'
|
|
|
60
60
|
// `video-bites-shared` is the SERVER-SAFE leaf (also its own published subpath).
|
|
61
61
|
export * from './cards-strip'
|
|
62
62
|
export * from './video'
|
|
63
|
+
export * from './video-center-badge'
|
|
63
64
|
export * from './video-ratio-tabs'
|
|
64
65
|
export * from './video-bites-shared'
|
|
65
66
|
export * from './video-bites-strip'
|
|
@@ -36,9 +36,12 @@ import {
|
|
|
36
36
|
sortBitesByCreatedAtDesc,
|
|
37
37
|
type VideoBiteStripProfile,
|
|
38
38
|
} from './video-bites-shared';
|
|
39
|
+
import Image from '../../embed-shims/next-image';
|
|
39
40
|
import { CardsStrip, STRIP_CELL_MAX_WIDTH } from './cards-strip';
|
|
41
|
+
import { useCoverImageFallback } from '../chat/entity-cards/use-cover-image-fallback';
|
|
40
42
|
import { UserDisplay } from '../user-display';
|
|
41
43
|
import { Chevron02RightIcon } from '../icons-v2-generated/arrows/chevron-02-right-icon';
|
|
44
|
+
import { VideoPlayBadge } from './video-center-badge';
|
|
42
45
|
|
|
43
46
|
// NOTE: the title constant / profile adapter / sort comparator live in the
|
|
44
47
|
// server-safe leaf `video-bites-shared.ts` (its own published subpath). The
|
|
@@ -252,7 +255,23 @@ export function VideoBiteCard({
|
|
|
252
255
|
io.observe(el);
|
|
253
256
|
return () => io.disconnect();
|
|
254
257
|
}, [gateControlled]);
|
|
255
|
-
const
|
|
258
|
+
const showMedia = gateControlled ? playerMounted : isNear;
|
|
259
|
+
|
|
260
|
+
// Player mounts at NEAR-VIEWPORT (not on first hover) so hover playback is
|
|
261
|
+
// INSTANT for any card the user can reach — mounting on activation made
|
|
262
|
+
// freshly-scrolled cards stall for seconds while MuxPlayer initialized and
|
|
263
|
+
// buffered. Always-mounted players are visually safe now that every bite
|
|
264
|
+
// carries a poster: the player renders with a transparent media background
|
|
265
|
+
// over the card's poster layer, so a not-yet-decoded player never shows as
|
|
266
|
+
// a black rectangle (the original wrap-seam flash came from POSTERLESS
|
|
267
|
+
// mounted players, not from mounting itself).
|
|
268
|
+
const showPlayer = showMedia;
|
|
269
|
+
|
|
270
|
+
// Poster resolution — THE shared entity-card cover fallback chain
|
|
271
|
+
// (use-cover-image-fallback): the bite's real thumbnail_url, dropped on
|
|
272
|
+
// load error. When it resolves to null (no thumbnail yet, or it failed)
|
|
273
|
+
// the media zone falls back to the first-frame <video> facade below.
|
|
274
|
+
const { src: posterSrc, onError: onPosterError } = useCoverImageFallback(bite.thumbnail_url);
|
|
256
275
|
|
|
257
276
|
const navigate = () => {
|
|
258
277
|
if (bite.onNavigate) bite.onNavigate();
|
|
@@ -342,26 +361,65 @@ export function VideoBiteCard({
|
|
|
342
361
|
// same as the old single-box layout). Editor mode: width-driven.
|
|
343
362
|
style={{ aspectRatio: cssAspect, ...(height !== undefined ? { height, maxWidth: STRIP_CELL_MAX_WIDTH } : {}) }}
|
|
344
363
|
>
|
|
345
|
-
{
|
|
364
|
+
{showMedia ? (
|
|
346
365
|
// Clones: `inert` (not just the wrapper's aria-hidden) — the player's
|
|
347
366
|
// shadow-DOM center control is otherwise still tab-reachable inside a
|
|
348
367
|
// hidden subtree (axe aria-hidden-focus). Hover preview on clones
|
|
349
368
|
// keeps working: playback is driven imperatively from the CARD's own
|
|
350
369
|
// pointer handlers, never from focus/clicks on the player chrome.
|
|
351
370
|
<div className="absolute inset-0" inert={isClone || undefined}>
|
|
352
|
-
{/*
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
371
|
+
{/* Poster layer. Preferred: the bite's REAL thumbnail (generated at
|
|
372
|
+
Vizard-ingestion time by vizard-persistence-utils via Shotstack
|
|
373
|
+
capture — the provider sends no cover), resolved through the
|
|
374
|
+
shared cover fallback chain. Fallback when it's absent or fails
|
|
375
|
+
to load: the <Video> component's `firstFrameOnly` facade paints
|
|
376
|
+
the `#t=0.1` frame. Either way the box is never a black
|
|
377
|
+
rectangle, and original + clone paint the IDENTICAL image so the
|
|
378
|
+
marquee's wrap seam stays pixel-invisible. */}
|
|
379
|
+
{posterSrc ? (
|
|
380
|
+
<Image
|
|
381
|
+
src={posterSrc}
|
|
382
|
+
alt=""
|
|
383
|
+
fill
|
|
384
|
+
unoptimized
|
|
385
|
+
onError={onPosterError}
|
|
386
|
+
className="object-cover"
|
|
387
|
+
/>
|
|
388
|
+
) : (
|
|
389
|
+
<Video kind="file" url={bite.url} firstFrameOnly layout="fill" />
|
|
390
|
+
)}
|
|
391
|
+
|
|
392
|
+
{/* Play affordance for every non-playing state (resting poster,
|
|
393
|
+
facade, mounted-but-paused): <VideoPlayBadge> — a pixel replica
|
|
394
|
+
of MuxPlayer's pre-play center button (media-chrome's own PAUSED
|
|
395
|
+
center control is a different, smaller bare glyph, so the
|
|
396
|
+
mounted player runs chromeless and the replica keeps all states
|
|
397
|
+
identical to the mux button). Hidden while playing. */}
|
|
398
|
+
{!isActive && <VideoPlayBadge className="absolute inset-0 z-10 m-auto" />}
|
|
399
|
+
{showPlayer && (
|
|
400
|
+
// `--media-background-color: transparent` (inherited into
|
|
401
|
+
// media-chrome) — the freshly-mounted player must not blank the
|
|
402
|
+
// facade behind it with its default black fill while it loads.
|
|
403
|
+
<div
|
|
404
|
+
className="absolute inset-0"
|
|
405
|
+
style={{ '--media-background-color': 'transparent' } as React.CSSProperties}
|
|
406
|
+
>
|
|
407
|
+
{/* CONTROLLED hover playback keyed to CARD hover (`isActive`): the
|
|
408
|
+
detail overlay is part of the card, so moving the pointer onto
|
|
409
|
+
it keeps playing. Sound at 50% (pre-activation: muted start +
|
|
410
|
+
live unmute on the user's first gesture); CHROMELESS — the
|
|
411
|
+
card's mux-replica badge above is the play affordance for
|
|
412
|
+
every non-playing state. */}
|
|
413
|
+
<Video
|
|
414
|
+
kind="file"
|
|
415
|
+
url={bite.url}
|
|
416
|
+
poster={bite.thumbnail_url}
|
|
417
|
+
playWhenHovered={isActive}
|
|
418
|
+
chromeless
|
|
419
|
+
layout="fill"
|
|
420
|
+
/>
|
|
421
|
+
</div>
|
|
422
|
+
)}
|
|
365
423
|
</div>
|
|
366
424
|
) : (
|
|
367
425
|
// Aspect-matched placeholder until the card nears the viewport (CLS-free).
|
|
@@ -391,6 +449,10 @@ export function VideoBiteCard({
|
|
|
391
449
|
return rootRef?.(node);
|
|
392
450
|
}}
|
|
393
451
|
aria-hidden={isClone || undefined}
|
|
452
|
+
// Hit-test marker for the strip engine's pointer-tracked hover re-sync
|
|
453
|
+
// (cards move under a stationary pointer — see cards-strip.tsx). The
|
|
454
|
+
// hover area is exactly this card root: media + overlay + toolbar.
|
|
455
|
+
data-strip-card-key={key}
|
|
394
456
|
className={cn(
|
|
395
457
|
'relative rounded-md border border-ods-border bg-ods-card overflow-hidden group/card',
|
|
396
458
|
height !== undefined ? 'shrink-0' : 'w-full',
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* THE center media glyphs — the single visual identity for every play/unmute
|
|
5
|
+
* affordance over video, across the whole project: a SOLID WHITE GLYPH
|
|
6
|
+
* (`text-ods-text-primary`), NO background disc, with a soft drop-shadow for
|
|
7
|
+
* legibility over arbitrary frames. Accent color appears ONLY while the
|
|
8
|
+
* icon's own control is hovered (hosts pass `group-hover:text-ods-accent`;
|
|
9
|
+
* mux-player controls get the same via `::part(button):hover` in
|
|
10
|
+
* styles/app-globals.css).
|
|
11
|
+
*
|
|
12
|
+
* Glyphs come from THE icon system — never inline SVG paths here:
|
|
13
|
+
* PlayFilledIcon / VolumeOffFilledIcon (components/icons — the FILLED
|
|
14
|
+
* media-chrome-matching glyphs, so custom affordances are pixel-identical to
|
|
15
|
+
* MuxPlayer's native center button on real players).
|
|
16
|
+
*
|
|
17
|
+
* Consumers:
|
|
18
|
+
* - <VideoBiteCard> resting/paused posters (md)
|
|
19
|
+
* - <YouTubeFacade> poster (lg)
|
|
20
|
+
* - <MediaCarousel> video thumbnails (sm)
|
|
21
|
+
* - <FilePlayer>'s unmute chip (VideoUnmuteGlyph, md)
|
|
22
|
+
* - MuxPlayer's native center pre-play button is stripped to the same bare
|
|
23
|
+
* glyph language via CSS (see styles/app-globals.css).
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import React from 'react'
|
|
27
|
+
import { PlayFilledIcon } from '../icons/play-filled-icon'
|
|
28
|
+
import { VolumeOffFilledIcon } from '../icons/volume-off-filled-icon'
|
|
29
|
+
import { cn } from '../../utils/cn'
|
|
30
|
+
|
|
31
|
+
export type VideoCenterBadgeSize = 'sm' | 'md' | 'lg'
|
|
32
|
+
|
|
33
|
+
const SIZES: Record<VideoCenterBadgeSize, number> = {
|
|
34
|
+
sm: 20, // gallery thumbnails
|
|
35
|
+
md: 56, // strip cards + unmute chip
|
|
36
|
+
lg: 64, // hero facades
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Soft legibility shadow — NOT a background (per design: bare glyphs). */
|
|
40
|
+
const GLYPH_SHADOW = 'drop-shadow(0 1px 4px rgba(0,0,0,0.5))'
|
|
41
|
+
|
|
42
|
+
export interface VideoPlayBadgeProps {
|
|
43
|
+
size?: VideoCenterBadgeSize
|
|
44
|
+
className?: string
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Bare play glyph (the icon system's PlayIcon). Decorative
|
|
48
|
+
* (`pointer-events-none`) — the host surface owns activation. */
|
|
49
|
+
export function VideoPlayBadge({ size = 'md', className }: VideoPlayBadgeProps): React.ReactElement {
|
|
50
|
+
return (
|
|
51
|
+
<div
|
|
52
|
+
className={cn('pointer-events-none flex items-center justify-center text-ods-text-primary transition-colors', className)}
|
|
53
|
+
style={{ filter: GLYPH_SHADOW }}
|
|
54
|
+
>
|
|
55
|
+
<PlayFilledIcon size={SIZES[size]} color="currentColor" />
|
|
56
|
+
</div>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface VideoUnmuteGlyphProps {
|
|
61
|
+
size?: VideoCenterBadgeSize
|
|
62
|
+
className?: string
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Bare muted-volume glyph (the icon system's VolumeOffFilledIcon). Rendered
|
|
66
|
+
* by FilePlayer's unmute button; exported here so play + unmute share one
|
|
67
|
+
* identity. */
|
|
68
|
+
export function VideoUnmuteGlyph({ size = 'md', className }: VideoUnmuteGlyphProps): React.ReactElement {
|
|
69
|
+
return (
|
|
70
|
+
<VolumeOffFilledIcon
|
|
71
|
+
size={SIZES[size]}
|
|
72
|
+
color="currentColor"
|
|
73
|
+
className={className}
|
|
74
|
+
style={{ filter: GLYPH_SHADOW }}
|
|
75
|
+
/>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
@@ -32,8 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
34
34
|
import MuxPlayer from '@mux/mux-player-react';
|
|
35
|
-
import {
|
|
36
|
-
import { VolumeXmarkIcon } from '../icons-v2-generated/audio-and-visual/volume-xmark-icon';
|
|
35
|
+
import { VideoPlayBadge, VideoUnmuteGlyph } from './video-center-badge';
|
|
37
36
|
import { fetchPriorityProp } from '../../utils/fetch-priority';
|
|
38
37
|
|
|
39
38
|
// =============================================================================
|
|
@@ -250,9 +249,12 @@ interface VideoFileProps extends VideoCommonProps {
|
|
|
250
249
|
* true → start hover playback, false → pause. When provided, the internal
|
|
251
250
|
* pointer handlers are disabled. */
|
|
252
251
|
playWhenHovered?: boolean;
|
|
253
|
-
/**
|
|
254
|
-
* (
|
|
255
|
-
|
|
252
|
+
/** Render ONLY a lightweight first-frame preview — a metadata-only element
|
|
253
|
+
* seeked to `#t=0.1` (media-fragment trick; paints on iOS Safari where a
|
|
254
|
+
* fragmentless metadata load stays blank). No chrome, no playback, no
|
|
255
|
+
* MuxPlayer cost — the resting facade layer under strip cards when no
|
|
256
|
+
* poster asset exists. All player props are ignored. */
|
|
257
|
+
firstFrameOnly?: boolean;
|
|
256
258
|
}
|
|
257
259
|
|
|
258
260
|
interface VideoYouTubeProps extends VideoCommonProps {
|
|
@@ -272,7 +274,7 @@ interface VideoAutoProps extends VideoCommonProps {
|
|
|
272
274
|
chromeless?: boolean;
|
|
273
275
|
playOnHover?: boolean;
|
|
274
276
|
playWhenHovered?: boolean;
|
|
275
|
-
|
|
277
|
+
firstFrameOnly?: boolean;
|
|
276
278
|
}
|
|
277
279
|
|
|
278
280
|
export type VideoProps = VideoFileProps | VideoYouTubeProps | VideoAutoProps;
|
|
@@ -297,6 +299,8 @@ export function Video(props: VideoProps): React.ReactElement | null {
|
|
|
297
299
|
className={props.className}
|
|
298
300
|
minimalControls={props.minimalControls}
|
|
299
301
|
/>
|
|
302
|
+
) : 'firstFrameOnly' in props && props.firstFrameOnly ? (
|
|
303
|
+
<FirstFramePreview url={url} className={props.className} />
|
|
300
304
|
) : (
|
|
301
305
|
<FilePlayer
|
|
302
306
|
url={url}
|
|
@@ -309,7 +313,6 @@ export function Video(props: VideoProps): React.ReactElement | null {
|
|
|
309
313
|
chromeless={'chromeless' in props ? props.chromeless : undefined}
|
|
310
314
|
playOnHover={'playOnHover' in props ? props.playOnHover : undefined}
|
|
311
315
|
playWhenHovered={'playWhenHovered' in props ? props.playWhenHovered : undefined}
|
|
312
|
-
centerControlsOnly={'centerControlsOnly' in props ? props.centerControlsOnly : undefined}
|
|
313
316
|
className={props.className}
|
|
314
317
|
/>
|
|
315
318
|
);
|
|
@@ -373,6 +376,35 @@ function wrapWithLayout(
|
|
|
373
376
|
}
|
|
374
377
|
}
|
|
375
378
|
|
|
379
|
+
// -----------------------------------------------------------------------------
|
|
380
|
+
// First-frame preview — the `firstFrameOnly` facade branch
|
|
381
|
+
// -----------------------------------------------------------------------------
|
|
382
|
+
|
|
383
|
+
/** First-frame paint through the SAME FilePlayer/MuxPlayer pipeline as
|
|
384
|
+
* playback (one rendering path for every file source — HLS included, which a
|
|
385
|
+
* plain `<video>` couldn't decode in Chromium): a chromeless, muted,
|
|
386
|
+
* metadata-only instance whose `#t=0.1` media fragment seeks-and-paints the
|
|
387
|
+
* first frame (also fixes iOS Safari, which stays blank on a fragmentless
|
|
388
|
+
* metadata load). The transparent media background keeps the box showing the
|
|
389
|
+
* card surface (never black) until the frame decodes. */
|
|
390
|
+
function FirstFramePreview({ url, className }: { url: string; className?: string }): React.ReactElement {
|
|
391
|
+
return (
|
|
392
|
+
<div
|
|
393
|
+
aria-hidden
|
|
394
|
+
className="h-full w-full"
|
|
395
|
+
style={{ '--media-background-color': 'transparent' } as React.CSSProperties}
|
|
396
|
+
>
|
|
397
|
+
<FilePlayer
|
|
398
|
+
url={`${url}#t=0.1`}
|
|
399
|
+
preload="metadata"
|
|
400
|
+
muted
|
|
401
|
+
chromeless
|
|
402
|
+
className={className}
|
|
403
|
+
/>
|
|
404
|
+
</div>
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
|
|
376
408
|
// -----------------------------------------------------------------------------
|
|
377
409
|
// File branch — MuxPlayer (handles both .m3u8 HLS and plain .mp4)
|
|
378
410
|
// -----------------------------------------------------------------------------
|
|
@@ -388,7 +420,8 @@ interface FilePlayerProps {
|
|
|
388
420
|
chromeless?: boolean;
|
|
389
421
|
playOnHover?: boolean;
|
|
390
422
|
playWhenHovered?: boolean;
|
|
391
|
-
|
|
423
|
+
/** Media preload hint — the firstFrameOnly facade passes 'metadata'. */
|
|
424
|
+
preload?: 'none' | 'metadata' | 'auto';
|
|
392
425
|
className?: string;
|
|
393
426
|
}
|
|
394
427
|
|
|
@@ -403,12 +436,9 @@ function FilePlayer({
|
|
|
403
436
|
chromeless,
|
|
404
437
|
playOnHover,
|
|
405
438
|
playWhenHovered,
|
|
406
|
-
|
|
439
|
+
preload,
|
|
407
440
|
className,
|
|
408
441
|
}: FilePlayerProps): React.ReactElement {
|
|
409
|
-
// centerControlsOnly: the center play button shows at REST only — while
|
|
410
|
-
// playing, ALL chrome hides (no pause sign over the hover-preview).
|
|
411
|
-
const [isPlaying, setIsPlaying] = useState(false);
|
|
412
442
|
// True while hover playback is running MUTED because the browser's autoplay
|
|
413
443
|
// policy blocked sound (no user activation yet). Drives the center unmute
|
|
414
444
|
// control — the industry pattern (muted autoplay + explicit unmute button)
|
|
@@ -546,11 +576,10 @@ function FilePlayer({
|
|
|
546
576
|
const player = (
|
|
547
577
|
<MuxPlayer
|
|
548
578
|
ref={hoverPlayerRef as React.Ref<never>}
|
|
549
|
-
onPlay={centerControlsOnly ? () => setIsPlaying(true) : undefined}
|
|
550
|
-
onPause={centerControlsOnly ? () => setIsPlaying(false) : undefined}
|
|
551
579
|
src={url}
|
|
552
580
|
poster={poster || undefined}
|
|
553
581
|
streamType="on-demand"
|
|
582
|
+
preload={preload}
|
|
554
583
|
playsInline
|
|
555
584
|
muted={muted}
|
|
556
585
|
preferCmcd="header"
|
|
@@ -581,15 +610,6 @@ function FilePlayer({
|
|
|
581
610
|
width: '100%',
|
|
582
611
|
height: '100%',
|
|
583
612
|
...(chromeless ? ({ '--controls': 'none' } as React.CSSProperties) : {}),
|
|
584
|
-
...(centerControlsOnly && !chromeless
|
|
585
|
-
? ({
|
|
586
|
-
'--bottom-controls': 'none',
|
|
587
|
-
'--top-controls': 'none',
|
|
588
|
-
// While playing, hide the center control too — no pause sign
|
|
589
|
-
// over the hover-preview; it reappears when playback pauses.
|
|
590
|
-
...(isPlaying ? { '--center-controls': 'none' } : {}),
|
|
591
|
-
} as React.CSSProperties)
|
|
592
|
-
: {}),
|
|
593
613
|
}}
|
|
594
614
|
>
|
|
595
615
|
{captionsUrl ? (
|
|
@@ -616,9 +636,11 @@ function FilePlayer({
|
|
|
616
636
|
aria-label="Unmute"
|
|
617
637
|
title="Unmute"
|
|
618
638
|
onClick={unmuteNow}
|
|
619
|
-
|
|
639
|
+
// White at rest, ACCENT while the icon itself is hovered — the same
|
|
640
|
+
// hover language as every mux control icon (see app-globals.css).
|
|
641
|
+
className="absolute inset-0 z-10 m-auto flex h-14 w-14 items-center justify-center text-ods-text-primary transition-colors hover:text-ods-accent"
|
|
620
642
|
>
|
|
621
|
-
<
|
|
643
|
+
<VideoUnmuteGlyph />
|
|
622
644
|
</button>
|
|
623
645
|
) : null;
|
|
624
646
|
|
|
@@ -882,9 +904,10 @@ function YouTubeFacadeInner({
|
|
|
882
904
|
/>
|
|
883
905
|
</picture>
|
|
884
906
|
<div className="absolute inset-0 flex items-center justify-center bg-ods-bg-inverse bg-opacity-20 transition-opacity duration-200 group-hover:bg-opacity-30">
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
907
|
+
{/* THE shared center play badge (video-center-badge.tsx) — same disc
|
|
908
|
+
as strip cards / carousel thumbs / unmute chip; hero size + the
|
|
909
|
+
facade's hover-scale affordance. */}
|
|
910
|
+
<VideoPlayBadge size="lg" className="transition-transform duration-200 group-hover:scale-110 group-hover:text-ods-accent" />
|
|
888
911
|
</div>
|
|
889
912
|
</button>
|
|
890
913
|
</div>
|
|
@@ -35,6 +35,8 @@ export { VendorDirectoryIcon } from './vendor-directory-icon';
|
|
|
35
35
|
export { OpenSourceIcon } from './open-source-icon';
|
|
36
36
|
export { CommunityHubIcon } from './community-hub-icon';
|
|
37
37
|
export { AboutIcon } from './about-icon';
|
|
38
|
+
export { PlayFilledIcon } from './play-filled-icon';
|
|
39
|
+
export { VolumeOffFilledIcon } from './volume-off-filled-icon';
|
|
38
40
|
export { UserIcon } from './user-icon';
|
|
39
41
|
export { HamburgerIcon } from './hamburger-icon';
|
|
40
42
|
export { MenuIcon } from './menu-icon';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { SVGProps } from "react";
|
|
2
|
+
|
|
3
|
+
export interface PlayFilledIconProps
|
|
4
|
+
extends Omit<SVGProps<SVGSVGElement>, "width" | "height"> {
|
|
5
|
+
className?: string;
|
|
6
|
+
size?: number;
|
|
7
|
+
color?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Solid play triangle — the SAME glyph media-chrome/MuxPlayer renders in its
|
|
12
|
+
* native center play button, so custom video affordances (strip cards,
|
|
13
|
+
* facades, carousels) stay pixel-consistent with real player chrome.
|
|
14
|
+
* Hand-maintained (not in the Figma-generated set, which has only the
|
|
15
|
+
* outline `PlayIcon`).
|
|
16
|
+
*/
|
|
17
|
+
export function PlayFilledIcon({
|
|
18
|
+
className = "",
|
|
19
|
+
size = 24,
|
|
20
|
+
color = "currentColor",
|
|
21
|
+
...props
|
|
22
|
+
}: PlayFilledIconProps) {
|
|
23
|
+
return (
|
|
24
|
+
<svg
|
|
25
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
26
|
+
width={size}
|
|
27
|
+
height={size}
|
|
28
|
+
fill="none"
|
|
29
|
+
viewBox="0 0 24 24"
|
|
30
|
+
className={className}
|
|
31
|
+
{...props}
|
|
32
|
+
>
|
|
33
|
+
<path fill={color} d="m6 21 15-9L6 3v18Z" />
|
|
34
|
+
</svg>
|
|
35
|
+
);
|
|
36
|
+
}
|