@cntrl-site/components 1.0.103 → 1.0.104
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/Components/helpers/LazyVideo/LazyVideo.d.ts +4 -0
- package/dist/Components/utils/index.d.ts +1 -0
- package/dist/Components/utils/useLazyVideos.d.ts +15 -0
- package/dist/Grid-B2_o1dvz.mjs +1576 -0
- package/dist/Grid-Bq6bk2AQ.js +374 -0
- package/dist/{Helix-2Vr-9WBa.js → Helix-B7rxlvKq.js} +2 -2
- package/dist/{Helix-BmkAKT1G.mjs → Helix-BrKQzGX5.mjs} +53 -53
- package/dist/{Hive-BGMWinrW.mjs → Hive-BusARSOi.mjs} +114 -111
- package/dist/Hive-Dh5nKPGm.js +321 -0
- package/dist/LazyVideo-Cn_vmMq8.js +1 -0
- package/dist/LazyVideo-D8eVYFyw.mjs +15 -0
- package/dist/Marquee-CdtAqhQE.mjs +563 -0
- package/dist/Marquee-DUN8wUax.js +133 -0
- package/dist/{Mercury-DuKJQ1Zo.mjs → Mercury-BRqlbk4i.mjs} +55 -54
- package/dist/Mercury-C-O2VGkK.js +267 -0
- package/dist/{PretextComponent-CGycuNNn.js → PretextComponent-D5P0AjnL.js} +1 -1
- package/dist/{PretextComponent-DN8cyZ8x.mjs → PretextComponent-s4DDfmzY.mjs} +6 -6
- package/dist/{Waterfall-A0FjM2my.mjs → Waterfall-DKuh4bnv.mjs} +299 -295
- package/dist/Waterfall-fdiHR0Rc.js +287 -0
- package/dist/{components-DTCDEBo0.js → components-DzNixU7Q.js} +1 -1
- package/dist/{components-BFJINCME.mjs → components-Yf9Zjska.mjs} +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +6 -6
- package/dist/elements.node.js +1 -1
- package/dist/elements.node.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +2 -2
- package/dist/sources.js +125 -49
- package/dist/sources.mjs +129 -53
- package/dist/useLazyVideos-BbgdvELi.js +1 -0
- package/dist/useLazyVideos-CZLyNolX.mjs +72 -0
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +14 -12
- package/package.json +5 -3
- package/dist/Grid-CemGhf3F.js +0 -374
- package/dist/Grid-cfQsXW3b.mjs +0 -1553
- package/dist/Hive-BC6zQBsv.js +0 -321
- package/dist/Marquee-BYClHHws.mjs +0 -551
- package/dist/Marquee-vmHaTGIP.js +0 -133
- package/dist/Mercury-BwF_XW2w.js +0 -267
- package/dist/Waterfall-DnPDHbCL.js +0 -287
package/dist/sources.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./PretextComponent-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./PretextComponent-D5P0AjnL.js"),e=`import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
|
|
2
2
|
import { CommonComponentProps } from '../props';
|
|
3
3
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
4
4
|
import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
|
|
@@ -4565,12 +4565,14 @@ import {
|
|
|
4565
4565
|
buildColorVars,
|
|
4566
4566
|
getFormFieldValidationError,
|
|
4567
4567
|
scalingValue,
|
|
4568
|
+
useLazyVideos,
|
|
4568
4569
|
useScopedStyles,
|
|
4569
4570
|
} from '../utils/index';
|
|
4570
4571
|
import { useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
|
|
4571
4572
|
import { createPortal } from 'react-dom';
|
|
4572
4573
|
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
4573
4574
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
4575
|
+
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
4574
4576
|
|
|
4575
4577
|
function sv(px: number): string {
|
|
4576
4578
|
return \`calc(var(--cntrl-article-width, 100vw) * \${px / 1440})\`;
|
|
@@ -5140,10 +5142,13 @@ function collectGridLightboxMedia(content: any[]): GridMedia[] {
|
|
|
5140
5142
|
}
|
|
5141
5143
|
|
|
5142
5144
|
function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
5145
|
+
const [pool, setPool] = useState<HTMLDivElement | null>(null);
|
|
5146
|
+
useLazyVideos(pool, { preload: 'metadata' });
|
|
5143
5147
|
if (mediaList.length === 0) return null;
|
|
5144
5148
|
|
|
5145
5149
|
return (
|
|
5146
5150
|
<div
|
|
5151
|
+
ref={setPool}
|
|
5147
5152
|
aria-hidden
|
|
5148
5153
|
style={{
|
|
5149
5154
|
position: 'absolute',
|
|
@@ -5159,7 +5164,7 @@ function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
|
5159
5164
|
<video
|
|
5160
5165
|
key={media.assetId}
|
|
5161
5166
|
src={media.assetId}
|
|
5162
|
-
preload='
|
|
5167
|
+
preload='none'
|
|
5163
5168
|
muted
|
|
5164
5169
|
playsInline
|
|
5165
5170
|
/>
|
|
@@ -5181,33 +5186,46 @@ function unloadVideoElement(video: HTMLVideoElement) {
|
|
|
5181
5186
|
video.load();
|
|
5182
5187
|
}
|
|
5183
5188
|
|
|
5189
|
+
const SPLIDE_SLIDE_VIDEOS = '.splide__slide video';
|
|
5190
|
+
|
|
5191
|
+
function shouldPlaySlideVideo(video: HTMLVideoElement): boolean {
|
|
5192
|
+
if (video.closest('.splide--fade, .splide__slide.is-active:not(.splide__slide--clone), .splide__slide.is-next')) return true;
|
|
5193
|
+
const slide = video.closest<HTMLElement>('.splide__slide');
|
|
5194
|
+
if (!slide || slide.classList.contains('splide__slide--clone')) return false;
|
|
5195
|
+
const slideIndex = slide.dataset.slideIndex;
|
|
5196
|
+
const upcomingSlide = slide.parentElement?.querySelector<HTMLElement>('.splide__slide.is-next');
|
|
5197
|
+
return slideIndex !== undefined && upcomingSlide?.dataset.slideIndex === slideIndex;
|
|
5198
|
+
}
|
|
5199
|
+
|
|
5184
5200
|
function GridMediaItem({
|
|
5185
5201
|
media,
|
|
5186
5202
|
className,
|
|
5187
5203
|
style,
|
|
5204
|
+
isSplideSlide = false,
|
|
5188
5205
|
onMediaClick,
|
|
5189
5206
|
}: {
|
|
5190
5207
|
media: GridMedia;
|
|
5191
5208
|
className: string;
|
|
5192
5209
|
style: React.CSSProperties;
|
|
5210
|
+
isSplideSlide?: boolean;
|
|
5193
5211
|
onMediaClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
5194
5212
|
}) {
|
|
5195
5213
|
if (isVideoMedia(media)) {
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
style
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
/>
|
|
5210
|
-
|
|
5214
|
+
const videoProps = {
|
|
5215
|
+
src: media.assetId,
|
|
5216
|
+
className,
|
|
5217
|
+
style: {
|
|
5218
|
+
...style,
|
|
5219
|
+
cursor: onMediaClick ? 'pointer' : 'default',
|
|
5220
|
+
},
|
|
5221
|
+
muted: true,
|
|
5222
|
+
loop: true,
|
|
5223
|
+
playsInline: true,
|
|
5224
|
+
onClick: onMediaClick,
|
|
5225
|
+
};
|
|
5226
|
+
return isSplideSlide
|
|
5227
|
+
? <video {...videoProps} preload='none' />
|
|
5228
|
+
: <LazyVideo {...videoProps} autoPlay />;
|
|
5211
5229
|
}
|
|
5212
5230
|
|
|
5213
5231
|
return (
|
|
@@ -5224,6 +5242,25 @@ function GridMediaItem({
|
|
|
5224
5242
|
);
|
|
5225
5243
|
}
|
|
5226
5244
|
|
|
5245
|
+
function GridItemMediaWrapper({
|
|
5246
|
+
className,
|
|
5247
|
+
style,
|
|
5248
|
+
children,
|
|
5249
|
+
}: {
|
|
5250
|
+
className: string;
|
|
5251
|
+
style: React.CSSProperties;
|
|
5252
|
+
children: React.ReactNode;
|
|
5253
|
+
}) {
|
|
5254
|
+
const [wrapper, setWrapper] = useState<HTMLDivElement | null>(null);
|
|
5255
|
+
useLazyVideos(wrapper, { autoPlay: true, selector: SPLIDE_SLIDE_VIDEOS, shouldPlay: shouldPlaySlideVideo });
|
|
5256
|
+
|
|
5257
|
+
return (
|
|
5258
|
+
<div ref={setWrapper} className={className} style={style}>
|
|
5259
|
+
{children}
|
|
5260
|
+
</div>
|
|
5261
|
+
);
|
|
5262
|
+
}
|
|
5263
|
+
|
|
5227
5264
|
function getGhostRect(ghost: HTMLElement): AnimRect {
|
|
5228
5265
|
const cb = ghost.getBoundingClientRect();
|
|
5229
5266
|
return { width: cb.width, height: cb.height, left: cb.left, top: cb.top };
|
|
@@ -6545,7 +6582,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
6545
6582
|
.map(entry => entry.lightboxMedia!);
|
|
6546
6583
|
|
|
6547
6584
|
const imageContent = (
|
|
6548
|
-
<
|
|
6585
|
+
<GridItemMediaWrapper className={imageWrapperClassName} style={imageWrapperStyle}>
|
|
6549
6586
|
{displayItems.length === 0
|
|
6550
6587
|
? null
|
|
6551
6588
|
: slider === 'off'
|
|
@@ -6572,7 +6609,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
6572
6609
|
<div className={\`\${P}-item-image-wrapper-sizer\`} aria-hidden="true">
|
|
6573
6610
|
{displayItems.map(({ displayMedia }) => (
|
|
6574
6611
|
isVideoMedia(displayMedia) ? (
|
|
6575
|
-
<
|
|
6612
|
+
<LazyVideo key={\`sizer-\${displayMedia.assetId}\`} src={displayMedia.assetId} nearPreload='metadata' muted playsInline />
|
|
6576
6613
|
) : (
|
|
6577
6614
|
<img key={\`sizer-\${displayMedia.assetId}\`} src={displayMedia.assetId} alt="" />
|
|
6578
6615
|
)
|
|
@@ -6608,11 +6645,12 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
6608
6645
|
? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
|
|
6609
6646
|
: -1;
|
|
6610
6647
|
return (
|
|
6611
|
-
<SplideSlide key={imgIndex}>
|
|
6648
|
+
<SplideSlide key={imgIndex} data-slide-index={imgIndex}>
|
|
6612
6649
|
<GridMediaItem
|
|
6613
6650
|
media={displayMedia}
|
|
6614
6651
|
className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
|
|
6615
6652
|
style={imageStyle}
|
|
6653
|
+
isSplideSlide
|
|
6616
6654
|
onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
|
|
6617
6655
|
? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
|
|
6618
6656
|
: undefined}
|
|
@@ -6623,7 +6661,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
6623
6661
|
</Splide>
|
|
6624
6662
|
</>
|
|
6625
6663
|
}
|
|
6626
|
-
</
|
|
6664
|
+
</GridItemMediaWrapper>
|
|
6627
6665
|
);
|
|
6628
6666
|
|
|
6629
6667
|
const typeABText = !isTextBeforeImage ? (
|
|
@@ -6830,6 +6868,7 @@ const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
|
6830
6868
|
import { CommonComponentProps } from '../props';
|
|
6831
6869
|
import { scalingValue } from '../utils/scalingValue';
|
|
6832
6870
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
6871
|
+
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
6833
6872
|
|
|
6834
6873
|
const DEG_PER_SEC_PER_SPEED_UNIT = 10;
|
|
6835
6874
|
const MAX_TOTAL_ITEMS = 400;
|
|
@@ -7342,7 +7381,7 @@ export function Helix({
|
|
|
7342
7381
|
}
|
|
7343
7382
|
: mediaStyle;
|
|
7344
7383
|
const mediaNode = isVideoMedia(media) ? (
|
|
7345
|
-
<
|
|
7384
|
+
<LazyVideo
|
|
7346
7385
|
className={\`\${P}-media\`}
|
|
7347
7386
|
style={coverMediaStyle}
|
|
7348
7387
|
src={media.assetId}
|
|
@@ -7350,7 +7389,6 @@ export function Helix({
|
|
|
7350
7389
|
loop
|
|
7351
7390
|
autoPlay
|
|
7352
7391
|
playsInline
|
|
7353
|
-
preload="auto"
|
|
7354
7392
|
/>
|
|
7355
7393
|
) : (
|
|
7356
7394
|
<img
|
|
@@ -7387,7 +7425,8 @@ export function Helix({
|
|
|
7387
7425
|
);
|
|
7388
7426
|
}
|
|
7389
7427
|
`,s=`import { CommonComponentProps } from '../props';
|
|
7390
|
-
import { scalingValue, useScopedStyles } from '../utils/index';
|
|
7428
|
+
import { scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
|
|
7429
|
+
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
7391
7430
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
7392
7431
|
import { createPortal } from 'react-dom';
|
|
7393
7432
|
import {
|
|
@@ -7991,10 +8030,13 @@ function collectAllHiveMedia(content: HiveContentItem[]): HiveMedia[] {
|
|
|
7991
8030
|
}
|
|
7992
8031
|
|
|
7993
8032
|
function PreloadedMediaPool({ mediaList }: { mediaList: HiveMedia[] }) {
|
|
8033
|
+
const [pool, setPool] = useState<HTMLDivElement | null>(null);
|
|
8034
|
+
useLazyVideos(pool, { preload: 'metadata' });
|
|
7994
8035
|
if (mediaList.length === 0) return null;
|
|
7995
8036
|
|
|
7996
8037
|
return (
|
|
7997
8038
|
<div
|
|
8039
|
+
ref={setPool}
|
|
7998
8040
|
aria-hidden
|
|
7999
8041
|
style={{
|
|
8000
8042
|
position: 'absolute',
|
|
@@ -8010,7 +8052,7 @@ function PreloadedMediaPool({ mediaList }: { mediaList: HiveMedia[] }) {
|
|
|
8010
8052
|
<video
|
|
8011
8053
|
key={media.assetId}
|
|
8012
8054
|
src={media.assetId}
|
|
8013
|
-
preload='
|
|
8055
|
+
preload='none'
|
|
8014
8056
|
muted
|
|
8015
8057
|
playsInline
|
|
8016
8058
|
/>
|
|
@@ -8229,7 +8271,7 @@ function MediaItem({
|
|
|
8229
8271
|
}) {
|
|
8230
8272
|
if (isVideoMedia(media)) {
|
|
8231
8273
|
return (
|
|
8232
|
-
<
|
|
8274
|
+
<LazyVideo
|
|
8233
8275
|
src={media.assetId}
|
|
8234
8276
|
className={className}
|
|
8235
8277
|
data-hive-grid-index={gridIndex}
|
|
@@ -8241,7 +8283,6 @@ function MediaItem({
|
|
|
8241
8283
|
autoPlay
|
|
8242
8284
|
loop
|
|
8243
8285
|
playsInline
|
|
8244
|
-
preload='auto'
|
|
8245
8286
|
onClick={onMediaClick}
|
|
8246
8287
|
/>
|
|
8247
8288
|
);
|
|
@@ -14131,6 +14172,7 @@ import cn from 'classnames';
|
|
|
14131
14172
|
import { CommonComponentProps } from '../props';
|
|
14132
14173
|
import { scalingValue } from '../utils/scalingValue';
|
|
14133
14174
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
14175
|
+
import { NEAR_VIEWPORT_MARGIN, observeIntersection, pauseVideo, playVideo, raisePreload } from '../utils/useLazyVideos';
|
|
14134
14176
|
|
|
14135
14177
|
function getCSS(P: string, setWidthPx: number): string {
|
|
14136
14178
|
const distance = setWidthPx > 0 ? \`\${setWidthPx}px\` : '0px';
|
|
@@ -14275,6 +14317,8 @@ const MIN_CONTENT_SEQUENCE_REPEAT = 3;
|
|
|
14275
14317
|
const MAX_CONTENT_SEQUENCE_REPEAT = 12;
|
|
14276
14318
|
const MIN_TRUSTWORTHY_CYCLE_WIDTH_PX = 32;
|
|
14277
14319
|
const OUTER_SET_COPIES = 3;
|
|
14320
|
+
const VIDEO_POLL_MS = 250;
|
|
14321
|
+
const VIDEO_LOOKAHEAD_WRAPPER_WIDTHS = 0.5;
|
|
14278
14322
|
|
|
14279
14323
|
const restartTrackAnimation = (track: HTMLElement) => {
|
|
14280
14324
|
track.style.setProperty('animation-name', 'none');
|
|
@@ -14364,7 +14408,7 @@ const isVideoMedia = (media: Pick<NonNullable<MarqueeItem['image']>, 'assetId' |
|
|
|
14364
14408
|
|
|
14365
14409
|
const isMediaReady = (el: HTMLImageElement | HTMLVideoElement | null): boolean => {
|
|
14366
14410
|
if (!el) return false;
|
|
14367
|
-
if (el instanceof HTMLVideoElement) return el.readyState >=
|
|
14411
|
+
if (el instanceof HTMLVideoElement) return el.readyState >= 1;
|
|
14368
14412
|
return el.complete;
|
|
14369
14413
|
};
|
|
14370
14414
|
|
|
@@ -14448,10 +14492,9 @@ const MarqueeItemCard = ({
|
|
|
14448
14492
|
style={mediaStyle}
|
|
14449
14493
|
muted
|
|
14450
14494
|
loop
|
|
14451
|
-
autoPlay
|
|
14452
14495
|
playsInline
|
|
14453
|
-
preload="
|
|
14454
|
-
|
|
14496
|
+
preload="none"
|
|
14497
|
+
onLoadedMetadata={isFirstSet ? onFirstSetImageDone : undefined}
|
|
14455
14498
|
onError={isFirstSet ? onFirstSetImageDone : undefined}
|
|
14456
14499
|
/>
|
|
14457
14500
|
) : (
|
|
@@ -14526,6 +14569,7 @@ export const Marquee = ({ settings, content, isEditor, isPreviewMode, isEditMode
|
|
|
14526
14569
|
cornerRadius = 0,
|
|
14527
14570
|
} = settings;
|
|
14528
14571
|
const imageFit = useMemo(() => normalizeImageFit(settings.imageFit), [settings.imageFit]);
|
|
14572
|
+
const needsVideoMetadata = imageFit.display !== 'cover';
|
|
14529
14573
|
const originalItemCount = content?.length ?? 0;
|
|
14530
14574
|
const showControls = Boolean(isEditMode);
|
|
14531
14575
|
const showHoverEffects = !isEditor || Boolean(isPreviewMode);
|
|
@@ -14623,26 +14667,56 @@ export const Marquee = ({ settings, content, isEditor, isPreviewMode, isEditMode
|
|
|
14623
14667
|
};
|
|
14624
14668
|
}, [hoverEffect, swappedSlots, showHoverEffects]);
|
|
14625
14669
|
|
|
14626
|
-
// Only decode videos that are actually visible: the track renders many copies of each item,
|
|
14627
|
-
// and playing all of them at once saturates the decoder and drops frames.
|
|
14628
14670
|
useEffect(() => {
|
|
14629
14671
|
const wrapper = wrapperRef.current;
|
|
14630
14672
|
if (!wrapper || typeof IntersectionObserver === 'undefined') return;
|
|
14631
|
-
|
|
14632
|
-
|
|
14633
|
-
|
|
14634
|
-
|
|
14635
|
-
|
|
14636
|
-
|
|
14637
|
-
|
|
14638
|
-
|
|
14639
|
-
|
|
14673
|
+
let isNear = false;
|
|
14674
|
+
let isVisible = false;
|
|
14675
|
+
let pollTimer: ReturnType<typeof setInterval> | undefined;
|
|
14676
|
+
const syncVideos = () => {
|
|
14677
|
+
const videos = wrapper.querySelectorAll('video');
|
|
14678
|
+
if (!isNear) {
|
|
14679
|
+
videos.forEach(pauseVideo);
|
|
14680
|
+
return;
|
|
14681
|
+
}
|
|
14682
|
+
const wrapperRect = wrapper.getBoundingClientRect();
|
|
14683
|
+
const lookahead = wrapperRect.width * VIDEO_LOOKAHEAD_WRAPPER_WIDTHS;
|
|
14684
|
+
videos.forEach((video) => {
|
|
14685
|
+
const rect = video.getBoundingClientRect();
|
|
14686
|
+
const isInView = rect.right > wrapperRect.left && rect.left < wrapperRect.right;
|
|
14687
|
+
const isNearView = rect.right > wrapperRect.left - lookahead && rect.left < wrapperRect.right + lookahead;
|
|
14688
|
+
if (isNearView) raisePreload(video, 'auto');
|
|
14689
|
+
else if (needsVideoMetadata) raisePreload(video, 'metadata');
|
|
14690
|
+
if (isVisible && isInView) {
|
|
14691
|
+
if (video.paused) playVideo(video);
|
|
14692
|
+
} else {
|
|
14693
|
+
pauseVideo(video);
|
|
14640
14694
|
}
|
|
14695
|
+
});
|
|
14696
|
+
};
|
|
14697
|
+
const update = () => {
|
|
14698
|
+
if (isNear && pollTimer === undefined) {
|
|
14699
|
+
pollTimer = setInterval(syncVideos, VIDEO_POLL_MS);
|
|
14700
|
+
} else if (!isNear && pollTimer !== undefined) {
|
|
14701
|
+
clearInterval(pollTimer);
|
|
14702
|
+
pollTimer = undefined;
|
|
14641
14703
|
}
|
|
14642
|
-
|
|
14643
|
-
|
|
14644
|
-
|
|
14645
|
-
|
|
14704
|
+
syncVideos();
|
|
14705
|
+
};
|
|
14706
|
+
const stopNear = observeIntersection(wrapper, NEAR_VIEWPORT_MARGIN, (intersecting) => {
|
|
14707
|
+
isNear = intersecting;
|
|
14708
|
+
update();
|
|
14709
|
+
});
|
|
14710
|
+
const stopVisible = observeIntersection(wrapper, '0px', (intersecting) => {
|
|
14711
|
+
isVisible = intersecting;
|
|
14712
|
+
update();
|
|
14713
|
+
});
|
|
14714
|
+
return () => {
|
|
14715
|
+
stopNear();
|
|
14716
|
+
stopVisible();
|
|
14717
|
+
clearInterval(pollTimer);
|
|
14718
|
+
};
|
|
14719
|
+
}, [useMarqueeTrack, needsVideoMetadata]);
|
|
14646
14720
|
|
|
14647
14721
|
useLayoutEffect(() => {
|
|
14648
14722
|
if (!useMarqueeTrack) return;
|
|
@@ -15876,6 +15950,7 @@ import {
|
|
|
15876
15950
|
} from '../utils/index';
|
|
15877
15951
|
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
15878
15952
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
15953
|
+
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
15879
15954
|
|
|
15880
15955
|
const DEFAULT_IMG_WIDTH = 300 / 1440;
|
|
15881
15956
|
const DEFAULT_CORNER_RADIUS = 8 / 1440;
|
|
@@ -17321,7 +17396,7 @@ function GalleryMediaItem({
|
|
|
17321
17396
|
const galleryPaddingBetweenHeight = Math.max(galleryPaddingBetween, PADDING_HANDLE_SIZE);
|
|
17322
17397
|
|
|
17323
17398
|
const mediaNode = isVideoMedia(media) ? (
|
|
17324
|
-
<
|
|
17399
|
+
<LazyVideo
|
|
17325
17400
|
{...mediaProps}
|
|
17326
17401
|
src={media.assetId}
|
|
17327
17402
|
muted
|
|
@@ -23354,6 +23429,7 @@ import { createPortal } from 'react-dom';
|
|
|
23354
23429
|
import { CommonComponentProps } from '../props';
|
|
23355
23430
|
import { getContainedMediaTransformOrigin } from '../utils/getImageRect';
|
|
23356
23431
|
import { scalingValue, useScopedStyles } from '../utils/index';
|
|
23432
|
+
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
23357
23433
|
import { textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
23358
23434
|
import {
|
|
23359
23435
|
Lightbox,
|
|
@@ -23782,7 +23858,7 @@ export function Waterfall({
|
|
|
23782
23858
|
].filter(Boolean).join(' ')}
|
|
23783
23859
|
>
|
|
23784
23860
|
{item.image.type === 'video' ? (
|
|
23785
|
-
<
|
|
23861
|
+
<LazyVideo
|
|
23786
23862
|
ref={syncFitMediaLayout}
|
|
23787
23863
|
src={item.image.assetId}
|
|
23788
23864
|
data-waterfall-index={index}
|
|
@@ -23792,7 +23868,7 @@ export function Waterfall({
|
|
|
23792
23868
|
loop
|
|
23793
23869
|
autoPlay
|
|
23794
23870
|
onClick={handleOpen}
|
|
23795
|
-
|
|
23871
|
+
onLoadedMetadata={(e) => syncFitMediaLayout(e.currentTarget)}
|
|
23796
23872
|
/>
|
|
23797
23873
|
) : (
|
|
23798
23874
|
<img
|