@cntrl-site/components 1.0.102 → 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/ClickGallerie-D7g093HX.js +36 -0
- package/dist/{ClickGallerie-D_O1XhAO.mjs → ClickGallerie-QSOQjSdv.mjs} +92 -91
- package/dist/Components/ClickGallerie/ClickGallerie.d.ts +1 -0
- package/dist/Components/Scale/Scale.d.ts +2 -0
- 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-C3YFICy8.js → PretextComponent-D5P0AjnL.js} +1 -1
- package/dist/{PretextComponent-Ct0newmn.mjs → PretextComponent-s4DDfmzY.mjs} +25 -16
- package/dist/Scale-Bg3bGICG.js +114 -0
- package/dist/Scale-TnkWtRrs.mjs +409 -0
- package/dist/{Waterfall-A0FjM2my.mjs → Waterfall-DKuh4bnv.mjs} +299 -295
- package/dist/Waterfall-fdiHR0Rc.js +287 -0
- package/dist/{components-OE3ac1dr.js → components-DzNixU7Q.js} +1 -1
- package/dist/{components-w-jHX-2U.mjs → components-Yf9Zjska.mjs} +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +8 -8
- 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 +260 -72
- package/dist/sources.mjs +264 -76
- 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/ClickGallerie-M9xdGR1G.js +0 -36
- 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/Scale-976sjO8e.js +0 -111
- package/dist/Scale-rLNT4KAk.mjs +0 -345
- 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';
|
|
@@ -2662,6 +2662,7 @@ type ClickGallerieSettings = {
|
|
|
2662
2662
|
imageSize?: ImageSizeSettings;
|
|
2663
2663
|
cursor?: 'system' | 'custom';
|
|
2664
2664
|
target?: 'area' | 'image';
|
|
2665
|
+
origin?: 'random' | 'same' | 'on Click';
|
|
2665
2666
|
position?: 'random' | 'same' | 'on Click';
|
|
2666
2667
|
visible?: 'all' | 'last One';
|
|
2667
2668
|
defaultCursor?: string | null;
|
|
@@ -2889,11 +2890,13 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
2889
2890
|
imageSize = DEFAULT_IMAGE_SIZE,
|
|
2890
2891
|
cursor: cursorMode = 'system',
|
|
2891
2892
|
target = 'area',
|
|
2892
|
-
|
|
2893
|
+
origin: originSetting,
|
|
2894
|
+
position: legacyOrigin,
|
|
2893
2895
|
visible = 'all',
|
|
2894
2896
|
defaultCursor = null,
|
|
2895
2897
|
hoverCursor = null,
|
|
2896
2898
|
} = settings;
|
|
2899
|
+
const origin = originSetting ?? legacyOrigin ?? 'random';
|
|
2897
2900
|
|
|
2898
2901
|
const validContent = content.filter(
|
|
2899
2902
|
(item): item is ClickGallerieItem => Boolean(item?.image?.assetId),
|
|
@@ -2993,7 +2996,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
2993
2996
|
|
|
2994
2997
|
let x = 0;
|
|
2995
2998
|
let y = 0;
|
|
2996
|
-
if (
|
|
2999
|
+
if (origin === 'same') {
|
|
2997
3000
|
({ x, y } = getSamePosition(containerWidth, containerHeight, widthPx, aspectRatio));
|
|
2998
3001
|
} else {
|
|
2999
3002
|
x = clickPosition.x ?? Math.random() * containerWidth;
|
|
@@ -3032,7 +3035,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
3032
3035
|
: resolveImageWidthPx(img.assetId, imageSize, imageMetaByUrlRef.current);
|
|
3033
3036
|
const { heightPx } = getImageDimensions(widthPx, img.aspectRatio);
|
|
3034
3037
|
|
|
3035
|
-
if (
|
|
3038
|
+
if (origin === 'same') {
|
|
3036
3039
|
const { x, y } = getSamePosition(containerWidth, containerHeight, widthPx, img.aspectRatio);
|
|
3037
3040
|
return { ...img, x, y, widthPx };
|
|
3038
3041
|
}
|
|
@@ -3063,7 +3066,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
3063
3066
|
|
|
3064
3067
|
setPlacedImages([newImg]);
|
|
3065
3068
|
setCounter(validContent.length > 1 ? 1 : 0);
|
|
3066
|
-
}, [imageSize,
|
|
3069
|
+
}, [imageSize, origin, divRef, content, imagesReady]);
|
|
3067
3070
|
|
|
3068
3071
|
useEffect(() => {
|
|
3069
3072
|
if (!divRef) return;
|
|
@@ -3078,7 +3081,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
3078
3081
|
ro.disconnect();
|
|
3079
3082
|
window.removeEventListener('resize', repositionPlacedImages);
|
|
3080
3083
|
};
|
|
3081
|
-
}, [divRef,
|
|
3084
|
+
}, [divRef, origin, imageSize, placedImages.length]);
|
|
3082
3085
|
|
|
3083
3086
|
useEffect(() => {
|
|
3084
3087
|
if (visible === 'last One') {
|
|
@@ -3097,10 +3100,10 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
3097
3100
|
|
|
3098
3101
|
let x = 0;
|
|
3099
3102
|
let y = 0;
|
|
3100
|
-
if (
|
|
3103
|
+
if (origin === 'on Click') {
|
|
3101
3104
|
x = clickX;
|
|
3102
3105
|
y = clickY;
|
|
3103
|
-
} else if (
|
|
3106
|
+
} else if (origin === 'same') {
|
|
3104
3107
|
x = rect.width / 2;
|
|
3105
3108
|
y = rect.height / 2;
|
|
3106
3109
|
} else {
|
|
@@ -4562,12 +4565,14 @@ import {
|
|
|
4562
4565
|
buildColorVars,
|
|
4563
4566
|
getFormFieldValidationError,
|
|
4564
4567
|
scalingValue,
|
|
4568
|
+
useLazyVideos,
|
|
4565
4569
|
useScopedStyles,
|
|
4566
4570
|
} from '../utils/index';
|
|
4567
4571
|
import { useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
|
|
4568
4572
|
import { createPortal } from 'react-dom';
|
|
4569
4573
|
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
4570
4574
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
4575
|
+
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
4571
4576
|
|
|
4572
4577
|
function sv(px: number): string {
|
|
4573
4578
|
return \`calc(var(--cntrl-article-width, 100vw) * \${px / 1440})\`;
|
|
@@ -5137,10 +5142,13 @@ function collectGridLightboxMedia(content: any[]): GridMedia[] {
|
|
|
5137
5142
|
}
|
|
5138
5143
|
|
|
5139
5144
|
function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
5145
|
+
const [pool, setPool] = useState<HTMLDivElement | null>(null);
|
|
5146
|
+
useLazyVideos(pool, { preload: 'metadata' });
|
|
5140
5147
|
if (mediaList.length === 0) return null;
|
|
5141
5148
|
|
|
5142
5149
|
return (
|
|
5143
5150
|
<div
|
|
5151
|
+
ref={setPool}
|
|
5144
5152
|
aria-hidden
|
|
5145
5153
|
style={{
|
|
5146
5154
|
position: 'absolute',
|
|
@@ -5156,7 +5164,7 @@ function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
|
5156
5164
|
<video
|
|
5157
5165
|
key={media.assetId}
|
|
5158
5166
|
src={media.assetId}
|
|
5159
|
-
preload='
|
|
5167
|
+
preload='none'
|
|
5160
5168
|
muted
|
|
5161
5169
|
playsInline
|
|
5162
5170
|
/>
|
|
@@ -5178,33 +5186,46 @@ function unloadVideoElement(video: HTMLVideoElement) {
|
|
|
5178
5186
|
video.load();
|
|
5179
5187
|
}
|
|
5180
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
|
+
|
|
5181
5200
|
function GridMediaItem({
|
|
5182
5201
|
media,
|
|
5183
5202
|
className,
|
|
5184
5203
|
style,
|
|
5204
|
+
isSplideSlide = false,
|
|
5185
5205
|
onMediaClick,
|
|
5186
5206
|
}: {
|
|
5187
5207
|
media: GridMedia;
|
|
5188
5208
|
className: string;
|
|
5189
5209
|
style: React.CSSProperties;
|
|
5210
|
+
isSplideSlide?: boolean;
|
|
5190
5211
|
onMediaClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
5191
5212
|
}) {
|
|
5192
5213
|
if (isVideoMedia(media)) {
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
style
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
/>
|
|
5207
|
-
|
|
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 />;
|
|
5208
5229
|
}
|
|
5209
5230
|
|
|
5210
5231
|
return (
|
|
@@ -5221,6 +5242,25 @@ function GridMediaItem({
|
|
|
5221
5242
|
);
|
|
5222
5243
|
}
|
|
5223
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
|
+
|
|
5224
5264
|
function getGhostRect(ghost: HTMLElement): AnimRect {
|
|
5225
5265
|
const cb = ghost.getBoundingClientRect();
|
|
5226
5266
|
return { width: cb.width, height: cb.height, left: cb.left, top: cb.top };
|
|
@@ -6542,7 +6582,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
6542
6582
|
.map(entry => entry.lightboxMedia!);
|
|
6543
6583
|
|
|
6544
6584
|
const imageContent = (
|
|
6545
|
-
<
|
|
6585
|
+
<GridItemMediaWrapper className={imageWrapperClassName} style={imageWrapperStyle}>
|
|
6546
6586
|
{displayItems.length === 0
|
|
6547
6587
|
? null
|
|
6548
6588
|
: slider === 'off'
|
|
@@ -6569,7 +6609,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
6569
6609
|
<div className={\`\${P}-item-image-wrapper-sizer\`} aria-hidden="true">
|
|
6570
6610
|
{displayItems.map(({ displayMedia }) => (
|
|
6571
6611
|
isVideoMedia(displayMedia) ? (
|
|
6572
|
-
<
|
|
6612
|
+
<LazyVideo key={\`sizer-\${displayMedia.assetId}\`} src={displayMedia.assetId} nearPreload='metadata' muted playsInline />
|
|
6573
6613
|
) : (
|
|
6574
6614
|
<img key={\`sizer-\${displayMedia.assetId}\`} src={displayMedia.assetId} alt="" />
|
|
6575
6615
|
)
|
|
@@ -6605,11 +6645,12 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
6605
6645
|
? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
|
|
6606
6646
|
: -1;
|
|
6607
6647
|
return (
|
|
6608
|
-
<SplideSlide key={imgIndex}>
|
|
6648
|
+
<SplideSlide key={imgIndex} data-slide-index={imgIndex}>
|
|
6609
6649
|
<GridMediaItem
|
|
6610
6650
|
media={displayMedia}
|
|
6611
6651
|
className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
|
|
6612
6652
|
style={imageStyle}
|
|
6653
|
+
isSplideSlide
|
|
6613
6654
|
onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
|
|
6614
6655
|
? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
|
|
6615
6656
|
: undefined}
|
|
@@ -6620,7 +6661,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
6620
6661
|
</Splide>
|
|
6621
6662
|
</>
|
|
6622
6663
|
}
|
|
6623
|
-
</
|
|
6664
|
+
</GridItemMediaWrapper>
|
|
6624
6665
|
);
|
|
6625
6666
|
|
|
6626
6667
|
const typeABText = !isTextBeforeImage ? (
|
|
@@ -6827,6 +6868,7 @@ const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
|
6827
6868
|
import { CommonComponentProps } from '../props';
|
|
6828
6869
|
import { scalingValue } from '../utils/scalingValue';
|
|
6829
6870
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
6871
|
+
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
6830
6872
|
|
|
6831
6873
|
const DEG_PER_SEC_PER_SPEED_UNIT = 10;
|
|
6832
6874
|
const MAX_TOTAL_ITEMS = 400;
|
|
@@ -7339,7 +7381,7 @@ export function Helix({
|
|
|
7339
7381
|
}
|
|
7340
7382
|
: mediaStyle;
|
|
7341
7383
|
const mediaNode = isVideoMedia(media) ? (
|
|
7342
|
-
<
|
|
7384
|
+
<LazyVideo
|
|
7343
7385
|
className={\`\${P}-media\`}
|
|
7344
7386
|
style={coverMediaStyle}
|
|
7345
7387
|
src={media.assetId}
|
|
@@ -7347,7 +7389,6 @@ export function Helix({
|
|
|
7347
7389
|
loop
|
|
7348
7390
|
autoPlay
|
|
7349
7391
|
playsInline
|
|
7350
|
-
preload="auto"
|
|
7351
7392
|
/>
|
|
7352
7393
|
) : (
|
|
7353
7394
|
<img
|
|
@@ -7384,7 +7425,8 @@ export function Helix({
|
|
|
7384
7425
|
);
|
|
7385
7426
|
}
|
|
7386
7427
|
`,s=`import { CommonComponentProps } from '../props';
|
|
7387
|
-
import { scalingValue, useScopedStyles } from '../utils/index';
|
|
7428
|
+
import { scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
|
|
7429
|
+
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
7388
7430
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
7389
7431
|
import { createPortal } from 'react-dom';
|
|
7390
7432
|
import {
|
|
@@ -7988,10 +8030,13 @@ function collectAllHiveMedia(content: HiveContentItem[]): HiveMedia[] {
|
|
|
7988
8030
|
}
|
|
7989
8031
|
|
|
7990
8032
|
function PreloadedMediaPool({ mediaList }: { mediaList: HiveMedia[] }) {
|
|
8033
|
+
const [pool, setPool] = useState<HTMLDivElement | null>(null);
|
|
8034
|
+
useLazyVideos(pool, { preload: 'metadata' });
|
|
7991
8035
|
if (mediaList.length === 0) return null;
|
|
7992
8036
|
|
|
7993
8037
|
return (
|
|
7994
8038
|
<div
|
|
8039
|
+
ref={setPool}
|
|
7995
8040
|
aria-hidden
|
|
7996
8041
|
style={{
|
|
7997
8042
|
position: 'absolute',
|
|
@@ -8007,7 +8052,7 @@ function PreloadedMediaPool({ mediaList }: { mediaList: HiveMedia[] }) {
|
|
|
8007
8052
|
<video
|
|
8008
8053
|
key={media.assetId}
|
|
8009
8054
|
src={media.assetId}
|
|
8010
|
-
preload='
|
|
8055
|
+
preload='none'
|
|
8011
8056
|
muted
|
|
8012
8057
|
playsInline
|
|
8013
8058
|
/>
|
|
@@ -8226,7 +8271,7 @@ function MediaItem({
|
|
|
8226
8271
|
}) {
|
|
8227
8272
|
if (isVideoMedia(media)) {
|
|
8228
8273
|
return (
|
|
8229
|
-
<
|
|
8274
|
+
<LazyVideo
|
|
8230
8275
|
src={media.assetId}
|
|
8231
8276
|
className={className}
|
|
8232
8277
|
data-hive-grid-index={gridIndex}
|
|
@@ -8238,7 +8283,6 @@ function MediaItem({
|
|
|
8238
8283
|
autoPlay
|
|
8239
8284
|
loop
|
|
8240
8285
|
playsInline
|
|
8241
|
-
preload='auto'
|
|
8242
8286
|
onClick={onMediaClick}
|
|
8243
8287
|
/>
|
|
8244
8288
|
);
|
|
@@ -14128,6 +14172,7 @@ import cn from 'classnames';
|
|
|
14128
14172
|
import { CommonComponentProps } from '../props';
|
|
14129
14173
|
import { scalingValue } from '../utils/scalingValue';
|
|
14130
14174
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
14175
|
+
import { NEAR_VIEWPORT_MARGIN, observeIntersection, pauseVideo, playVideo, raisePreload } from '../utils/useLazyVideos';
|
|
14131
14176
|
|
|
14132
14177
|
function getCSS(P: string, setWidthPx: number): string {
|
|
14133
14178
|
const distance = setWidthPx > 0 ? \`\${setWidthPx}px\` : '0px';
|
|
@@ -14272,6 +14317,8 @@ const MIN_CONTENT_SEQUENCE_REPEAT = 3;
|
|
|
14272
14317
|
const MAX_CONTENT_SEQUENCE_REPEAT = 12;
|
|
14273
14318
|
const MIN_TRUSTWORTHY_CYCLE_WIDTH_PX = 32;
|
|
14274
14319
|
const OUTER_SET_COPIES = 3;
|
|
14320
|
+
const VIDEO_POLL_MS = 250;
|
|
14321
|
+
const VIDEO_LOOKAHEAD_WRAPPER_WIDTHS = 0.5;
|
|
14275
14322
|
|
|
14276
14323
|
const restartTrackAnimation = (track: HTMLElement) => {
|
|
14277
14324
|
track.style.setProperty('animation-name', 'none');
|
|
@@ -14361,7 +14408,7 @@ const isVideoMedia = (media: Pick<NonNullable<MarqueeItem['image']>, 'assetId' |
|
|
|
14361
14408
|
|
|
14362
14409
|
const isMediaReady = (el: HTMLImageElement | HTMLVideoElement | null): boolean => {
|
|
14363
14410
|
if (!el) return false;
|
|
14364
|
-
if (el instanceof HTMLVideoElement) return el.readyState >=
|
|
14411
|
+
if (el instanceof HTMLVideoElement) return el.readyState >= 1;
|
|
14365
14412
|
return el.complete;
|
|
14366
14413
|
};
|
|
14367
14414
|
|
|
@@ -14445,10 +14492,9 @@ const MarqueeItemCard = ({
|
|
|
14445
14492
|
style={mediaStyle}
|
|
14446
14493
|
muted
|
|
14447
14494
|
loop
|
|
14448
|
-
autoPlay
|
|
14449
14495
|
playsInline
|
|
14450
|
-
preload="
|
|
14451
|
-
|
|
14496
|
+
preload="none"
|
|
14497
|
+
onLoadedMetadata={isFirstSet ? onFirstSetImageDone : undefined}
|
|
14452
14498
|
onError={isFirstSet ? onFirstSetImageDone : undefined}
|
|
14453
14499
|
/>
|
|
14454
14500
|
) : (
|
|
@@ -14523,6 +14569,7 @@ export const Marquee = ({ settings, content, isEditor, isPreviewMode, isEditMode
|
|
|
14523
14569
|
cornerRadius = 0,
|
|
14524
14570
|
} = settings;
|
|
14525
14571
|
const imageFit = useMemo(() => normalizeImageFit(settings.imageFit), [settings.imageFit]);
|
|
14572
|
+
const needsVideoMetadata = imageFit.display !== 'cover';
|
|
14526
14573
|
const originalItemCount = content?.length ?? 0;
|
|
14527
14574
|
const showControls = Boolean(isEditMode);
|
|
14528
14575
|
const showHoverEffects = !isEditor || Boolean(isPreviewMode);
|
|
@@ -14620,26 +14667,56 @@ export const Marquee = ({ settings, content, isEditor, isPreviewMode, isEditMode
|
|
|
14620
14667
|
};
|
|
14621
14668
|
}, [hoverEffect, swappedSlots, showHoverEffects]);
|
|
14622
14669
|
|
|
14623
|
-
// Only decode videos that are actually visible: the track renders many copies of each item,
|
|
14624
|
-
// and playing all of them at once saturates the decoder and drops frames.
|
|
14625
14670
|
useEffect(() => {
|
|
14626
14671
|
const wrapper = wrapperRef.current;
|
|
14627
14672
|
if (!wrapper || typeof IntersectionObserver === 'undefined') return;
|
|
14628
|
-
|
|
14629
|
-
|
|
14630
|
-
|
|
14631
|
-
|
|
14632
|
-
|
|
14633
|
-
|
|
14634
|
-
|
|
14635
|
-
|
|
14636
|
-
|
|
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);
|
|
14637
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;
|
|
14638
14703
|
}
|
|
14639
|
-
|
|
14640
|
-
|
|
14641
|
-
|
|
14642
|
-
|
|
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]);
|
|
14643
14720
|
|
|
14644
14721
|
useLayoutEffect(() => {
|
|
14645
14722
|
if (!useMarqueeTrack) return;
|
|
@@ -15873,6 +15950,7 @@ import {
|
|
|
15873
15950
|
} from '../utils/index';
|
|
15874
15951
|
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
15875
15952
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
15953
|
+
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
15876
15954
|
|
|
15877
15955
|
const DEFAULT_IMG_WIDTH = 300 / 1440;
|
|
15878
15956
|
const DEFAULT_CORNER_RADIUS = 8 / 1440;
|
|
@@ -17318,7 +17396,7 @@ function GalleryMediaItem({
|
|
|
17318
17396
|
const galleryPaddingBetweenHeight = Math.max(galleryPaddingBetween, PADDING_HANDLE_SIZE);
|
|
17319
17397
|
|
|
17320
17398
|
const mediaNode = isVideoMedia(media) ? (
|
|
17321
|
-
<
|
|
17399
|
+
<LazyVideo
|
|
17322
17400
|
{...mediaProps}
|
|
17323
17401
|
src={media.assetId}
|
|
17324
17402
|
muted
|
|
@@ -19794,6 +19872,13 @@ type ScaleSettings = {
|
|
|
19794
19872
|
maxHeight?: number;
|
|
19795
19873
|
transition?: number;
|
|
19796
19874
|
bgImage?: 'greyscale' | 'blur' | 'as is';
|
|
19875
|
+
origin?: 'center' | 'mouse' | 'random';
|
|
19876
|
+
position?: 'center' | 'mouse' | 'random';
|
|
19877
|
+
};
|
|
19878
|
+
|
|
19879
|
+
type Point = {
|
|
19880
|
+
x: number;
|
|
19881
|
+
y: number;
|
|
19797
19882
|
};
|
|
19798
19883
|
|
|
19799
19884
|
const GREYSCALE_EFFECT_AMOUNT = 100;
|
|
@@ -19826,11 +19911,8 @@ function getCSS(P: string): string {
|
|
|
19826
19911
|
overflow: hidden;
|
|
19827
19912
|
}
|
|
19828
19913
|
.\${P}-background {
|
|
19829
|
-
position: absolute;
|
|
19830
|
-
inset: 0;
|
|
19831
19914
|
z-index: 1;
|
|
19832
19915
|
pointer-events: none;
|
|
19833
|
-
overflow: hidden;
|
|
19834
19916
|
}
|
|
19835
19917
|
.\${P}-effect-image {
|
|
19836
19918
|
width: 100%;
|
|
@@ -19864,11 +19946,17 @@ function getCSS(P: string): string {
|
|
|
19864
19946
|
}
|
|
19865
19947
|
.\${P}-outgoing-next {
|
|
19866
19948
|
z-index: 3;
|
|
19867
|
-
transition:
|
|
19949
|
+
transition:
|
|
19950
|
+
transform var(--\${P}-transition-ms) \${TRANSITION_TIMING_FUNCTION},
|
|
19951
|
+
left var(--\${P}-transition-ms) \${TRANSITION_TIMING_FUNCTION},
|
|
19952
|
+
top var(--\${P}-transition-ms) \${TRANSITION_TIMING_FUNCTION};
|
|
19868
19953
|
}
|
|
19869
19954
|
.\${P}-outgoing-prev {
|
|
19870
19955
|
z-index: 3;
|
|
19871
|
-
transition:
|
|
19956
|
+
transition:
|
|
19957
|
+
transform var(--\${P}-transition-ms) \${TRANSITION_TIMING_FUNCTION},
|
|
19958
|
+
left var(--\${P}-transition-ms) \${TRANSITION_TIMING_FUNCTION},
|
|
19959
|
+
top var(--\${P}-transition-ms) \${TRANSITION_TIMING_FUNCTION};
|
|
19872
19960
|
}
|
|
19873
19961
|
.\${P}-outgoing-next .\${P}-effect-image {
|
|
19874
19962
|
transition: filter var(--\${P}-transition-ms) \${TRANSITION_TIMING_FUNCTION};
|
|
@@ -19994,6 +20082,28 @@ function computeFitSize(
|
|
|
19994
20082
|
};
|
|
19995
20083
|
}
|
|
19996
20084
|
|
|
20085
|
+
function clampPoint(point: Point, size: SizePercents): Point {
|
|
20086
|
+
const halfW = size.widthPercent / 2;
|
|
20087
|
+
const halfH = size.heightPercent / 2;
|
|
20088
|
+
const minX = halfW;
|
|
20089
|
+
const maxX = 100 - halfW;
|
|
20090
|
+
const minY = halfH;
|
|
20091
|
+
const maxY = 100 - halfH;
|
|
20092
|
+
|
|
20093
|
+
return {
|
|
20094
|
+
x: minX > maxX ? 50 : Math.min(maxX, Math.max(minX, point.x)),
|
|
20095
|
+
y: minY > maxY ? 50 : Math.min(maxY, Math.max(minY, point.y)),
|
|
20096
|
+
};
|
|
20097
|
+
}
|
|
20098
|
+
|
|
20099
|
+
function centerPoint(): Point {
|
|
20100
|
+
return { x: 50, y: 50 };
|
|
20101
|
+
}
|
|
20102
|
+
|
|
20103
|
+
function randomPoint(): Point {
|
|
20104
|
+
return { x: Math.random() * 100, y: Math.random() * 100 };
|
|
20105
|
+
}
|
|
20106
|
+
|
|
19997
20107
|
function computeCoverScale(
|
|
19998
20108
|
containerWidth: number,
|
|
19999
20109
|
containerHeight: number,
|
|
@@ -20015,9 +20125,16 @@ function toSizeStyle(size: SizePercents): React.CSSProperties {
|
|
|
20015
20125
|
};
|
|
20016
20126
|
}
|
|
20017
20127
|
|
|
20018
|
-
function toStageStyle(
|
|
20128
|
+
function toStageStyle(
|
|
20129
|
+
size: SizePercents,
|
|
20130
|
+
scale: number,
|
|
20131
|
+
prefix: string,
|
|
20132
|
+
position: Point,
|
|
20133
|
+
): React.CSSProperties {
|
|
20019
20134
|
return {
|
|
20020
20135
|
...toSizeStyle(size),
|
|
20136
|
+
left: \`\${position.x}%\`,
|
|
20137
|
+
top: \`\${position.y}%\`,
|
|
20021
20138
|
[\`--\${prefix}-stage-scale\`]: scale,
|
|
20022
20139
|
} as React.CSSProperties;
|
|
20023
20140
|
}
|
|
@@ -20047,7 +20164,10 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20047
20164
|
maxHeight,
|
|
20048
20165
|
transition = 1000,
|
|
20049
20166
|
bgImage = 'greyscale',
|
|
20167
|
+
origin: originSetting,
|
|
20168
|
+
position: legacyOrigin,
|
|
20050
20169
|
} = settings;
|
|
20170
|
+
const origin = originSetting ?? legacyOrigin ?? 'center';
|
|
20051
20171
|
const items = content ?? [];
|
|
20052
20172
|
const initialIndices = getInitialIndices(items.length);
|
|
20053
20173
|
const [activeIndex, setActiveIndex] = useState(initialIndices.activeIndex);
|
|
@@ -20059,17 +20179,19 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20059
20179
|
const [incomingScale, setIncomingScale] = useState(0);
|
|
20060
20180
|
const [outgoingScale, setOutgoingScale] = useState(1);
|
|
20061
20181
|
const [outgoingFilter, setOutgoingFilter] = useState('none');
|
|
20182
|
+
const [outgoingPointOverride, setOutgoingPointOverride] = useState<Point | null>(null);
|
|
20062
20183
|
const [transitionDirection, setTransitionDirection] = useState<'next' | 'prev'>('next');
|
|
20063
20184
|
const [imageDimensions, setImageDimensions] = useState<Record<string, ImageDimensions>>({});
|
|
20064
20185
|
const [containerSize, setContainerSize] = useState({ width: 0, height: 0 });
|
|
20186
|
+
const [imagePositions, setImagePositions] = useState<Record<number, Point>>({});
|
|
20065
20187
|
const transitionTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
20066
20188
|
const wrapperRef = useRef<HTMLDivElement>(null);
|
|
20189
|
+
const imagePositionsRef = useRef<Record<number, Point>>({});
|
|
20067
20190
|
const isInteractive = !isEditor || Boolean(isPreviewMode);
|
|
20068
20191
|
const legacyImageSize = imageSize ?? 60;
|
|
20069
20192
|
const maxWidthPercent = Math.max(10, Math.min(100, maxWidth ?? legacyImageSize));
|
|
20070
20193
|
const maxHeightPercent = Math.max(10, Math.min(100, maxHeight ?? legacyImageSize));
|
|
20071
20194
|
const transitionMs = Math.max(100, transition);
|
|
20072
|
-
const backgroundFilter = getBackgroundFilter(bgImage);
|
|
20073
20195
|
|
|
20074
20196
|
const getImageSizePercents = useCallback((url: string | undefined): SizePercents => {
|
|
20075
20197
|
const aspectRatio = getImageAspectRatio(url ? imageDimensions[url] : undefined);
|
|
@@ -20117,16 +20239,42 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20117
20239
|
setIncomingScale(0);
|
|
20118
20240
|
setOutgoingScale(1);
|
|
20119
20241
|
setOutgoingFilter('none');
|
|
20242
|
+
setOutgoingPointOverride(null);
|
|
20120
20243
|
setTransitionDirection('next');
|
|
20121
20244
|
}, [items.length, content]);
|
|
20122
20245
|
|
|
20246
|
+
useEffect(() => {
|
|
20247
|
+
const nextPositions: Record<number, Point> = {};
|
|
20248
|
+
for (let index = 0; index < items.length; index += 1) {
|
|
20249
|
+
nextPositions[index] = origin === 'random' ? randomPoint() : centerPoint();
|
|
20250
|
+
}
|
|
20251
|
+
imagePositionsRef.current = nextPositions;
|
|
20252
|
+
setImagePositions(nextPositions);
|
|
20253
|
+
}, [items.length, content, origin]);
|
|
20254
|
+
|
|
20123
20255
|
useEffect(() => () => {
|
|
20124
20256
|
if (transitionTimeoutRef.current) {
|
|
20125
20257
|
clearTimeout(transitionTimeoutRef.current);
|
|
20126
20258
|
}
|
|
20127
20259
|
}, []);
|
|
20128
20260
|
|
|
20129
|
-
const
|
|
20261
|
+
const resolvePosition = useCallback((event?: React.MouseEvent): Point => {
|
|
20262
|
+
if (origin === 'random') return randomPoint();
|
|
20263
|
+
if (origin !== 'mouse') return centerPoint();
|
|
20264
|
+
|
|
20265
|
+
const wrapper = wrapperRef.current;
|
|
20266
|
+
if (!wrapper || !event) return centerPoint();
|
|
20267
|
+
|
|
20268
|
+
const rect = wrapper.getBoundingClientRect();
|
|
20269
|
+
if (rect.width <= 0 || rect.height <= 0) return centerPoint();
|
|
20270
|
+
|
|
20271
|
+
return {
|
|
20272
|
+
x: ((event.clientX - rect.left) / rect.width) * 100,
|
|
20273
|
+
y: ((event.clientY - rect.top) / rect.height) * 100,
|
|
20274
|
+
};
|
|
20275
|
+
}, [origin]);
|
|
20276
|
+
|
|
20277
|
+
const startTransition = useCallback((direction: 'next' | 'prev', event?: React.MouseEvent) => {
|
|
20130
20278
|
if (!isInteractive || isAnimating || items.length <= 1) return;
|
|
20131
20279
|
|
|
20132
20280
|
const targetIndex = direction === 'next'
|
|
@@ -20134,8 +20282,21 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20134
20282
|
: (activeIndex - 1 + items.length) % items.length;
|
|
20135
20283
|
const activeSize = getImageSizePercents(items[activeIndex]?.image?.assetId);
|
|
20136
20284
|
const targetSize = getImageSizePercents(items[targetIndex]?.image?.assetId);
|
|
20137
|
-
const
|
|
20138
|
-
const
|
|
20285
|
+
const activePoint = clampPoint(imagePositionsRef.current[activeIndex] ?? centerPoint(), activeSize);
|
|
20286
|
+
const targetPoint = clampPoint(resolvePosition(event), targetSize);
|
|
20287
|
+
const nextPositions = { ...imagePositionsRef.current, [targetIndex]: targetPoint };
|
|
20288
|
+
imagePositionsRef.current = nextPositions;
|
|
20289
|
+
setImagePositions(nextPositions);
|
|
20290
|
+
const activeCoverScale = computeCoverScale(
|
|
20291
|
+
containerSize.width,
|
|
20292
|
+
containerSize.height,
|
|
20293
|
+
activeSize,
|
|
20294
|
+
);
|
|
20295
|
+
const targetCoverScale = computeCoverScale(
|
|
20296
|
+
containerSize.width,
|
|
20297
|
+
containerSize.height,
|
|
20298
|
+
targetSize,
|
|
20299
|
+
);
|
|
20139
20300
|
|
|
20140
20301
|
if (transitionTimeoutRef.current) {
|
|
20141
20302
|
clearTimeout(transitionTimeoutRef.current);
|
|
@@ -20146,6 +20307,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20146
20307
|
setIsAnimating(true);
|
|
20147
20308
|
|
|
20148
20309
|
if (direction === 'next') {
|
|
20310
|
+
setOutgoingPointOverride(activePoint);
|
|
20149
20311
|
setOutgoingIndex(activeIndex);
|
|
20150
20312
|
setIncomingIndex(targetIndex);
|
|
20151
20313
|
setIncomingScale(0);
|
|
@@ -20156,6 +20318,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20156
20318
|
setOutgoingIndex(targetIndex);
|
|
20157
20319
|
setIncomingIndex(activeIndex);
|
|
20158
20320
|
setIncomingScale(1);
|
|
20321
|
+
setOutgoingPointOverride(centerPoint());
|
|
20159
20322
|
setOutgoingScale(targetCoverScale);
|
|
20160
20323
|
setOutgoingFilter(getBackgroundFilter(bgImage, 1, targetCoverScale));
|
|
20161
20324
|
}
|
|
@@ -20165,10 +20328,12 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20165
20328
|
requestAnimationFrame(() => {
|
|
20166
20329
|
if (direction === 'next') {
|
|
20167
20330
|
setIncomingScale(1);
|
|
20331
|
+
setOutgoingPointOverride(centerPoint());
|
|
20168
20332
|
setOutgoingScale(activeCoverScale);
|
|
20169
20333
|
setOutgoingFilter(getBackgroundFilter(bgImage, 1, activeCoverScale));
|
|
20170
20334
|
} else {
|
|
20171
20335
|
setIncomingScale(0);
|
|
20336
|
+
setOutgoingPointOverride(targetPoint);
|
|
20172
20337
|
setOutgoingScale(1);
|
|
20173
20338
|
setOutgoingFilter(getBackgroundFilter(bgImage, 0, 1));
|
|
20174
20339
|
}
|
|
@@ -20182,6 +20347,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20182
20347
|
setActiveIndex(targetIndex);
|
|
20183
20348
|
setOutgoingIndex(null);
|
|
20184
20349
|
setIncomingIndex(null);
|
|
20350
|
+
setOutgoingPointOverride(null);
|
|
20185
20351
|
setIsAnimating(false);
|
|
20186
20352
|
}, transitionMs);
|
|
20187
20353
|
}, [
|
|
@@ -20193,6 +20359,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20193
20359
|
isAnimating,
|
|
20194
20360
|
isInteractive,
|
|
20195
20361
|
items,
|
|
20362
|
+
resolvePosition,
|
|
20196
20363
|
transitionMs,
|
|
20197
20364
|
]);
|
|
20198
20365
|
|
|
@@ -20205,6 +20372,22 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20205
20372
|
const foregroundSize = getImageSizePercents(foregroundItem?.image?.assetId);
|
|
20206
20373
|
const outgoingFitSize = getImageSizePercents(outgoingItem?.image?.assetId);
|
|
20207
20374
|
const incomingFitSize = getImageSizePercents(incomingItem?.image?.assetId);
|
|
20375
|
+
const backgroundSize = getImageSizePercents(backgroundItem?.image?.assetId);
|
|
20376
|
+
const backgroundCoverScale = computeCoverScale(
|
|
20377
|
+
containerSize.width,
|
|
20378
|
+
containerSize.height,
|
|
20379
|
+
backgroundSize,
|
|
20380
|
+
);
|
|
20381
|
+
const backgroundFilter = getBackgroundFilter(bgImage, 1, backgroundCoverScale);
|
|
20382
|
+
const foregroundPoint = clampPoint(imagePositions[activeIndex] ?? centerPoint(), foregroundSize);
|
|
20383
|
+
const outgoingPoint = outgoingPointOverride ?? clampPoint(
|
|
20384
|
+
outgoingIndex !== null ? (imagePositions[outgoingIndex] ?? centerPoint()) : centerPoint(),
|
|
20385
|
+
outgoingFitSize,
|
|
20386
|
+
);
|
|
20387
|
+
const incomingPoint = clampPoint(
|
|
20388
|
+
incomingIndex !== null ? (imagePositions[incomingIndex] ?? centerPoint()) : centerPoint(),
|
|
20389
|
+
incomingFitSize,
|
|
20390
|
+
);
|
|
20208
20391
|
const wrapperStyle = {
|
|
20209
20392
|
[\`--\${P}-transition-ms\`]: \`\${transitionMs}ms\`,
|
|
20210
20393
|
} as React.CSSProperties;
|
|
@@ -20219,7 +20402,11 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20219
20402
|
aria-label="Zoom gallery"
|
|
20220
20403
|
>
|
|
20221
20404
|
{backgroundItem?.image?.assetId && (
|
|
20222
|
-
<div
|
|
20405
|
+
<div
|
|
20406
|
+
className={cn(\`\${P}-stage\`, \`\${P}-background\`)}
|
|
20407
|
+
style={toStageStyle(backgroundSize, backgroundCoverScale, P, centerPoint())}
|
|
20408
|
+
aria-hidden="true"
|
|
20409
|
+
>
|
|
20223
20410
|
<img
|
|
20224
20411
|
className={\`\${P}-effect-image\`}
|
|
20225
20412
|
src={backgroundItem.image.assetId}
|
|
@@ -20235,7 +20422,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20235
20422
|
\`\${P}-outgoing\`,
|
|
20236
20423
|
\`\${P}-outgoing-\${transitionDirection}\`,
|
|
20237
20424
|
)}
|
|
20238
|
-
style={toStageStyle(outgoingFitSize, outgoingScale, P)}
|
|
20425
|
+
style={toStageStyle(outgoingFitSize, outgoingScale, P, outgoingPoint)}
|
|
20239
20426
|
aria-hidden="true"
|
|
20240
20427
|
>
|
|
20241
20428
|
<img
|
|
@@ -20253,7 +20440,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20253
20440
|
\`\${P}-incoming\`,
|
|
20254
20441
|
\`\${P}-incoming-\${transitionDirection}\`,
|
|
20255
20442
|
)}
|
|
20256
|
-
style={toStageStyle(incomingFitSize, incomingScale, P)}
|
|
20443
|
+
style={toStageStyle(incomingFitSize, incomingScale, P, incomingPoint)}
|
|
20257
20444
|
aria-hidden="true"
|
|
20258
20445
|
>
|
|
20259
20446
|
<img
|
|
@@ -20266,7 +20453,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20266
20453
|
{!isAnimating && foregroundItem?.image?.assetId && (
|
|
20267
20454
|
<div
|
|
20268
20455
|
className={cn(\`\${P}-stage\`, \`\${P}-foreground\`)}
|
|
20269
|
-
style={
|
|
20456
|
+
style={toStageStyle(foregroundSize, 1, P, foregroundPoint)}
|
|
20270
20457
|
>
|
|
20271
20458
|
<img
|
|
20272
20459
|
className={\`\${P}-image\`}
|
|
@@ -20280,13 +20467,13 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20280
20467
|
<button
|
|
20281
20468
|
type="button"
|
|
20282
20469
|
className={cn(\`\${P}-nav\`, \`\${P}-nav-prev\`)}
|
|
20283
|
-
onClick={() => startTransition('prev')}
|
|
20470
|
+
onClick={(event) => startTransition('prev', event)}
|
|
20284
20471
|
aria-label={\`Show previous image (\${prevIndex + 1} of \${items.length})\`}
|
|
20285
20472
|
/>
|
|
20286
20473
|
<button
|
|
20287
20474
|
type="button"
|
|
20288
20475
|
className={cn(\`\${P}-nav\`, \`\${P}-nav-next\`)}
|
|
20289
|
-
onClick={() => startTransition('next')}
|
|
20476
|
+
onClick={(event) => startTransition('next', event)}
|
|
20290
20477
|
aria-label={\`Show next image (\${nextIndex + 1} of \${items.length})\`}
|
|
20291
20478
|
/>
|
|
20292
20479
|
</>
|
|
@@ -23242,6 +23429,7 @@ import { createPortal } from 'react-dom';
|
|
|
23242
23429
|
import { CommonComponentProps } from '../props';
|
|
23243
23430
|
import { getContainedMediaTransformOrigin } from '../utils/getImageRect';
|
|
23244
23431
|
import { scalingValue, useScopedStyles } from '../utils/index';
|
|
23432
|
+
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
23245
23433
|
import { textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
23246
23434
|
import {
|
|
23247
23435
|
Lightbox,
|
|
@@ -23670,7 +23858,7 @@ export function Waterfall({
|
|
|
23670
23858
|
].filter(Boolean).join(' ')}
|
|
23671
23859
|
>
|
|
23672
23860
|
{item.image.type === 'video' ? (
|
|
23673
|
-
<
|
|
23861
|
+
<LazyVideo
|
|
23674
23862
|
ref={syncFitMediaLayout}
|
|
23675
23863
|
src={item.image.assetId}
|
|
23676
23864
|
data-waterfall-index={index}
|
|
@@ -23680,7 +23868,7 @@ export function Waterfall({
|
|
|
23680
23868
|
loop
|
|
23681
23869
|
autoPlay
|
|
23682
23870
|
onClick={handleOpen}
|
|
23683
|
-
|
|
23871
|
+
onLoadedMetadata={(e) => syncFitMediaLayout(e.currentTarget)}
|
|
23684
23872
|
/>
|
|
23685
23873
|
) : (
|
|
23686
23874
|
<img
|