@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.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { W as n, b as e, T as t, g as i, f as o, S as r, P as a, O as s, h as l, a as c, M as d, L as u, d as g, e as m, H as p, i as h, G as f, F as v, c as P, C as x, B as b } from "./PretextComponent-
|
|
1
|
+
import { W as n, b as e, T as t, g as i, f as o, S as r, P as a, O as s, h as l, a as c, M as d, L as u, d as g, e as m, H as p, i as h, G as f, F as v, c as P, C as x, B as b } from "./PretextComponent-s4DDfmzY.mjs";
|
|
2
2
|
const y = `import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
|
|
3
3
|
import { CommonComponentProps } from '../props';
|
|
4
4
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
@@ -2663,6 +2663,7 @@ type ClickGallerieSettings = {
|
|
|
2663
2663
|
imageSize?: ImageSizeSettings;
|
|
2664
2664
|
cursor?: 'system' | 'custom';
|
|
2665
2665
|
target?: 'area' | 'image';
|
|
2666
|
+
origin?: 'random' | 'same' | 'on Click';
|
|
2666
2667
|
position?: 'random' | 'same' | 'on Click';
|
|
2667
2668
|
visible?: 'all' | 'last One';
|
|
2668
2669
|
defaultCursor?: string | null;
|
|
@@ -2890,11 +2891,13 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
2890
2891
|
imageSize = DEFAULT_IMAGE_SIZE,
|
|
2891
2892
|
cursor: cursorMode = 'system',
|
|
2892
2893
|
target = 'area',
|
|
2893
|
-
|
|
2894
|
+
origin: originSetting,
|
|
2895
|
+
position: legacyOrigin,
|
|
2894
2896
|
visible = 'all',
|
|
2895
2897
|
defaultCursor = null,
|
|
2896
2898
|
hoverCursor = null,
|
|
2897
2899
|
} = settings;
|
|
2900
|
+
const origin = originSetting ?? legacyOrigin ?? 'random';
|
|
2898
2901
|
|
|
2899
2902
|
const validContent = content.filter(
|
|
2900
2903
|
(item): item is ClickGallerieItem => Boolean(item?.image?.assetId),
|
|
@@ -2994,7 +2997,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
2994
2997
|
|
|
2995
2998
|
let x = 0;
|
|
2996
2999
|
let y = 0;
|
|
2997
|
-
if (
|
|
3000
|
+
if (origin === 'same') {
|
|
2998
3001
|
({ x, y } = getSamePosition(containerWidth, containerHeight, widthPx, aspectRatio));
|
|
2999
3002
|
} else {
|
|
3000
3003
|
x = clickPosition.x ?? Math.random() * containerWidth;
|
|
@@ -3033,7 +3036,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
3033
3036
|
: resolveImageWidthPx(img.assetId, imageSize, imageMetaByUrlRef.current);
|
|
3034
3037
|
const { heightPx } = getImageDimensions(widthPx, img.aspectRatio);
|
|
3035
3038
|
|
|
3036
|
-
if (
|
|
3039
|
+
if (origin === 'same') {
|
|
3037
3040
|
const { x, y } = getSamePosition(containerWidth, containerHeight, widthPx, img.aspectRatio);
|
|
3038
3041
|
return { ...img, x, y, widthPx };
|
|
3039
3042
|
}
|
|
@@ -3064,7 +3067,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
3064
3067
|
|
|
3065
3068
|
setPlacedImages([newImg]);
|
|
3066
3069
|
setCounter(validContent.length > 1 ? 1 : 0);
|
|
3067
|
-
}, [imageSize,
|
|
3070
|
+
}, [imageSize, origin, divRef, content, imagesReady]);
|
|
3068
3071
|
|
|
3069
3072
|
useEffect(() => {
|
|
3070
3073
|
if (!divRef) return;
|
|
@@ -3079,7 +3082,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
3079
3082
|
ro.disconnect();
|
|
3080
3083
|
window.removeEventListener('resize', repositionPlacedImages);
|
|
3081
3084
|
};
|
|
3082
|
-
}, [divRef,
|
|
3085
|
+
}, [divRef, origin, imageSize, placedImages.length]);
|
|
3083
3086
|
|
|
3084
3087
|
useEffect(() => {
|
|
3085
3088
|
if (visible === 'last One') {
|
|
@@ -3098,10 +3101,10 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
3098
3101
|
|
|
3099
3102
|
let x = 0;
|
|
3100
3103
|
let y = 0;
|
|
3101
|
-
if (
|
|
3104
|
+
if (origin === 'on Click') {
|
|
3102
3105
|
x = clickX;
|
|
3103
3106
|
y = clickY;
|
|
3104
|
-
} else if (
|
|
3107
|
+
} else if (origin === 'same') {
|
|
3105
3108
|
x = rect.width / 2;
|
|
3106
3109
|
y = rect.height / 2;
|
|
3107
3110
|
} else {
|
|
@@ -4563,12 +4566,14 @@ import {
|
|
|
4563
4566
|
buildColorVars,
|
|
4564
4567
|
getFormFieldValidationError,
|
|
4565
4568
|
scalingValue,
|
|
4569
|
+
useLazyVideos,
|
|
4566
4570
|
useScopedStyles,
|
|
4567
4571
|
} from '../utils/index';
|
|
4568
4572
|
import { useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
|
|
4569
4573
|
import { createPortal } from 'react-dom';
|
|
4570
4574
|
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
4571
4575
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
4576
|
+
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
4572
4577
|
|
|
4573
4578
|
function sv(px: number): string {
|
|
4574
4579
|
return \`calc(var(--cntrl-article-width, 100vw) * \${px / 1440})\`;
|
|
@@ -5138,10 +5143,13 @@ function collectGridLightboxMedia(content: any[]): GridMedia[] {
|
|
|
5138
5143
|
}
|
|
5139
5144
|
|
|
5140
5145
|
function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
5146
|
+
const [pool, setPool] = useState<HTMLDivElement | null>(null);
|
|
5147
|
+
useLazyVideos(pool, { preload: 'metadata' });
|
|
5141
5148
|
if (mediaList.length === 0) return null;
|
|
5142
5149
|
|
|
5143
5150
|
return (
|
|
5144
5151
|
<div
|
|
5152
|
+
ref={setPool}
|
|
5145
5153
|
aria-hidden
|
|
5146
5154
|
style={{
|
|
5147
5155
|
position: 'absolute',
|
|
@@ -5157,7 +5165,7 @@ function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
|
5157
5165
|
<video
|
|
5158
5166
|
key={media.assetId}
|
|
5159
5167
|
src={media.assetId}
|
|
5160
|
-
preload='
|
|
5168
|
+
preload='none'
|
|
5161
5169
|
muted
|
|
5162
5170
|
playsInline
|
|
5163
5171
|
/>
|
|
@@ -5179,33 +5187,46 @@ function unloadVideoElement(video: HTMLVideoElement) {
|
|
|
5179
5187
|
video.load();
|
|
5180
5188
|
}
|
|
5181
5189
|
|
|
5190
|
+
const SPLIDE_SLIDE_VIDEOS = '.splide__slide video';
|
|
5191
|
+
|
|
5192
|
+
function shouldPlaySlideVideo(video: HTMLVideoElement): boolean {
|
|
5193
|
+
if (video.closest('.splide--fade, .splide__slide.is-active:not(.splide__slide--clone), .splide__slide.is-next')) return true;
|
|
5194
|
+
const slide = video.closest<HTMLElement>('.splide__slide');
|
|
5195
|
+
if (!slide || slide.classList.contains('splide__slide--clone')) return false;
|
|
5196
|
+
const slideIndex = slide.dataset.slideIndex;
|
|
5197
|
+
const upcomingSlide = slide.parentElement?.querySelector<HTMLElement>('.splide__slide.is-next');
|
|
5198
|
+
return slideIndex !== undefined && upcomingSlide?.dataset.slideIndex === slideIndex;
|
|
5199
|
+
}
|
|
5200
|
+
|
|
5182
5201
|
function GridMediaItem({
|
|
5183
5202
|
media,
|
|
5184
5203
|
className,
|
|
5185
5204
|
style,
|
|
5205
|
+
isSplideSlide = false,
|
|
5186
5206
|
onMediaClick,
|
|
5187
5207
|
}: {
|
|
5188
5208
|
media: GridMedia;
|
|
5189
5209
|
className: string;
|
|
5190
5210
|
style: React.CSSProperties;
|
|
5211
|
+
isSplideSlide?: boolean;
|
|
5191
5212
|
onMediaClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
5192
5213
|
}) {
|
|
5193
5214
|
if (isVideoMedia(media)) {
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
style
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
/>
|
|
5208
|
-
|
|
5215
|
+
const videoProps = {
|
|
5216
|
+
src: media.assetId,
|
|
5217
|
+
className,
|
|
5218
|
+
style: {
|
|
5219
|
+
...style,
|
|
5220
|
+
cursor: onMediaClick ? 'pointer' : 'default',
|
|
5221
|
+
},
|
|
5222
|
+
muted: true,
|
|
5223
|
+
loop: true,
|
|
5224
|
+
playsInline: true,
|
|
5225
|
+
onClick: onMediaClick,
|
|
5226
|
+
};
|
|
5227
|
+
return isSplideSlide
|
|
5228
|
+
? <video {...videoProps} preload='none' />
|
|
5229
|
+
: <LazyVideo {...videoProps} autoPlay />;
|
|
5209
5230
|
}
|
|
5210
5231
|
|
|
5211
5232
|
return (
|
|
@@ -5222,6 +5243,25 @@ function GridMediaItem({
|
|
|
5222
5243
|
);
|
|
5223
5244
|
}
|
|
5224
5245
|
|
|
5246
|
+
function GridItemMediaWrapper({
|
|
5247
|
+
className,
|
|
5248
|
+
style,
|
|
5249
|
+
children,
|
|
5250
|
+
}: {
|
|
5251
|
+
className: string;
|
|
5252
|
+
style: React.CSSProperties;
|
|
5253
|
+
children: React.ReactNode;
|
|
5254
|
+
}) {
|
|
5255
|
+
const [wrapper, setWrapper] = useState<HTMLDivElement | null>(null);
|
|
5256
|
+
useLazyVideos(wrapper, { autoPlay: true, selector: SPLIDE_SLIDE_VIDEOS, shouldPlay: shouldPlaySlideVideo });
|
|
5257
|
+
|
|
5258
|
+
return (
|
|
5259
|
+
<div ref={setWrapper} className={className} style={style}>
|
|
5260
|
+
{children}
|
|
5261
|
+
</div>
|
|
5262
|
+
);
|
|
5263
|
+
}
|
|
5264
|
+
|
|
5225
5265
|
function getGhostRect(ghost: HTMLElement): AnimRect {
|
|
5226
5266
|
const cb = ghost.getBoundingClientRect();
|
|
5227
5267
|
return { width: cb.width, height: cb.height, left: cb.left, top: cb.top };
|
|
@@ -6543,7 +6583,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
6543
6583
|
.map(entry => entry.lightboxMedia!);
|
|
6544
6584
|
|
|
6545
6585
|
const imageContent = (
|
|
6546
|
-
<
|
|
6586
|
+
<GridItemMediaWrapper className={imageWrapperClassName} style={imageWrapperStyle}>
|
|
6547
6587
|
{displayItems.length === 0
|
|
6548
6588
|
? null
|
|
6549
6589
|
: slider === 'off'
|
|
@@ -6570,7 +6610,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
6570
6610
|
<div className={\`\${P}-item-image-wrapper-sizer\`} aria-hidden="true">
|
|
6571
6611
|
{displayItems.map(({ displayMedia }) => (
|
|
6572
6612
|
isVideoMedia(displayMedia) ? (
|
|
6573
|
-
<
|
|
6613
|
+
<LazyVideo key={\`sizer-\${displayMedia.assetId}\`} src={displayMedia.assetId} nearPreload='metadata' muted playsInline />
|
|
6574
6614
|
) : (
|
|
6575
6615
|
<img key={\`sizer-\${displayMedia.assetId}\`} src={displayMedia.assetId} alt="" />
|
|
6576
6616
|
)
|
|
@@ -6606,11 +6646,12 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
6606
6646
|
? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
|
|
6607
6647
|
: -1;
|
|
6608
6648
|
return (
|
|
6609
|
-
<SplideSlide key={imgIndex}>
|
|
6649
|
+
<SplideSlide key={imgIndex} data-slide-index={imgIndex}>
|
|
6610
6650
|
<GridMediaItem
|
|
6611
6651
|
media={displayMedia}
|
|
6612
6652
|
className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
|
|
6613
6653
|
style={imageStyle}
|
|
6654
|
+
isSplideSlide
|
|
6614
6655
|
onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
|
|
6615
6656
|
? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
|
|
6616
6657
|
: undefined}
|
|
@@ -6621,7 +6662,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
6621
6662
|
</Splide>
|
|
6622
6663
|
</>
|
|
6623
6664
|
}
|
|
6624
|
-
</
|
|
6665
|
+
</GridItemMediaWrapper>
|
|
6625
6666
|
);
|
|
6626
6667
|
|
|
6627
6668
|
const typeABText = !isTextBeforeImage ? (
|
|
@@ -6828,6 +6869,7 @@ const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
|
6828
6869
|
import { CommonComponentProps } from '../props';
|
|
6829
6870
|
import { scalingValue } from '../utils/scalingValue';
|
|
6830
6871
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
6872
|
+
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
6831
6873
|
|
|
6832
6874
|
const DEG_PER_SEC_PER_SPEED_UNIT = 10;
|
|
6833
6875
|
const MAX_TOTAL_ITEMS = 400;
|
|
@@ -7340,7 +7382,7 @@ export function Helix({
|
|
|
7340
7382
|
}
|
|
7341
7383
|
: mediaStyle;
|
|
7342
7384
|
const mediaNode = isVideoMedia(media) ? (
|
|
7343
|
-
<
|
|
7385
|
+
<LazyVideo
|
|
7344
7386
|
className={\`\${P}-media\`}
|
|
7345
7387
|
style={coverMediaStyle}
|
|
7346
7388
|
src={media.assetId}
|
|
@@ -7348,7 +7390,6 @@ export function Helix({
|
|
|
7348
7390
|
loop
|
|
7349
7391
|
autoPlay
|
|
7350
7392
|
playsInline
|
|
7351
|
-
preload="auto"
|
|
7352
7393
|
/>
|
|
7353
7394
|
) : (
|
|
7354
7395
|
<img
|
|
@@ -7385,7 +7426,8 @@ export function Helix({
|
|
|
7385
7426
|
);
|
|
7386
7427
|
}
|
|
7387
7428
|
`, T = `import { CommonComponentProps } from '../props';
|
|
7388
|
-
import { scalingValue, useScopedStyles } from '../utils/index';
|
|
7429
|
+
import { scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
|
|
7430
|
+
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
7389
7431
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
7390
7432
|
import { createPortal } from 'react-dom';
|
|
7391
7433
|
import {
|
|
@@ -7989,10 +8031,13 @@ function collectAllHiveMedia(content: HiveContentItem[]): HiveMedia[] {
|
|
|
7989
8031
|
}
|
|
7990
8032
|
|
|
7991
8033
|
function PreloadedMediaPool({ mediaList }: { mediaList: HiveMedia[] }) {
|
|
8034
|
+
const [pool, setPool] = useState<HTMLDivElement | null>(null);
|
|
8035
|
+
useLazyVideos(pool, { preload: 'metadata' });
|
|
7992
8036
|
if (mediaList.length === 0) return null;
|
|
7993
8037
|
|
|
7994
8038
|
return (
|
|
7995
8039
|
<div
|
|
8040
|
+
ref={setPool}
|
|
7996
8041
|
aria-hidden
|
|
7997
8042
|
style={{
|
|
7998
8043
|
position: 'absolute',
|
|
@@ -8008,7 +8053,7 @@ function PreloadedMediaPool({ mediaList }: { mediaList: HiveMedia[] }) {
|
|
|
8008
8053
|
<video
|
|
8009
8054
|
key={media.assetId}
|
|
8010
8055
|
src={media.assetId}
|
|
8011
|
-
preload='
|
|
8056
|
+
preload='none'
|
|
8012
8057
|
muted
|
|
8013
8058
|
playsInline
|
|
8014
8059
|
/>
|
|
@@ -8227,7 +8272,7 @@ function MediaItem({
|
|
|
8227
8272
|
}) {
|
|
8228
8273
|
if (isVideoMedia(media)) {
|
|
8229
8274
|
return (
|
|
8230
|
-
<
|
|
8275
|
+
<LazyVideo
|
|
8231
8276
|
src={media.assetId}
|
|
8232
8277
|
className={className}
|
|
8233
8278
|
data-hive-grid-index={gridIndex}
|
|
@@ -8239,7 +8284,6 @@ function MediaItem({
|
|
|
8239
8284
|
autoPlay
|
|
8240
8285
|
loop
|
|
8241
8286
|
playsInline
|
|
8242
|
-
preload='auto'
|
|
8243
8287
|
onClick={onMediaClick}
|
|
8244
8288
|
/>
|
|
8245
8289
|
);
|
|
@@ -14129,6 +14173,7 @@ import cn from 'classnames';
|
|
|
14129
14173
|
import { CommonComponentProps } from '../props';
|
|
14130
14174
|
import { scalingValue } from '../utils/scalingValue';
|
|
14131
14175
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
14176
|
+
import { NEAR_VIEWPORT_MARGIN, observeIntersection, pauseVideo, playVideo, raisePreload } from '../utils/useLazyVideos';
|
|
14132
14177
|
|
|
14133
14178
|
function getCSS(P: string, setWidthPx: number): string {
|
|
14134
14179
|
const distance = setWidthPx > 0 ? \`\${setWidthPx}px\` : '0px';
|
|
@@ -14273,6 +14318,8 @@ const MIN_CONTENT_SEQUENCE_REPEAT = 3;
|
|
|
14273
14318
|
const MAX_CONTENT_SEQUENCE_REPEAT = 12;
|
|
14274
14319
|
const MIN_TRUSTWORTHY_CYCLE_WIDTH_PX = 32;
|
|
14275
14320
|
const OUTER_SET_COPIES = 3;
|
|
14321
|
+
const VIDEO_POLL_MS = 250;
|
|
14322
|
+
const VIDEO_LOOKAHEAD_WRAPPER_WIDTHS = 0.5;
|
|
14276
14323
|
|
|
14277
14324
|
const restartTrackAnimation = (track: HTMLElement) => {
|
|
14278
14325
|
track.style.setProperty('animation-name', 'none');
|
|
@@ -14362,7 +14409,7 @@ const isVideoMedia = (media: Pick<NonNullable<MarqueeItem['image']>, 'assetId' |
|
|
|
14362
14409
|
|
|
14363
14410
|
const isMediaReady = (el: HTMLImageElement | HTMLVideoElement | null): boolean => {
|
|
14364
14411
|
if (!el) return false;
|
|
14365
|
-
if (el instanceof HTMLVideoElement) return el.readyState >=
|
|
14412
|
+
if (el instanceof HTMLVideoElement) return el.readyState >= 1;
|
|
14366
14413
|
return el.complete;
|
|
14367
14414
|
};
|
|
14368
14415
|
|
|
@@ -14446,10 +14493,9 @@ const MarqueeItemCard = ({
|
|
|
14446
14493
|
style={mediaStyle}
|
|
14447
14494
|
muted
|
|
14448
14495
|
loop
|
|
14449
|
-
autoPlay
|
|
14450
14496
|
playsInline
|
|
14451
|
-
preload="
|
|
14452
|
-
|
|
14497
|
+
preload="none"
|
|
14498
|
+
onLoadedMetadata={isFirstSet ? onFirstSetImageDone : undefined}
|
|
14453
14499
|
onError={isFirstSet ? onFirstSetImageDone : undefined}
|
|
14454
14500
|
/>
|
|
14455
14501
|
) : (
|
|
@@ -14524,6 +14570,7 @@ export const Marquee = ({ settings, content, isEditor, isPreviewMode, isEditMode
|
|
|
14524
14570
|
cornerRadius = 0,
|
|
14525
14571
|
} = settings;
|
|
14526
14572
|
const imageFit = useMemo(() => normalizeImageFit(settings.imageFit), [settings.imageFit]);
|
|
14573
|
+
const needsVideoMetadata = imageFit.display !== 'cover';
|
|
14527
14574
|
const originalItemCount = content?.length ?? 0;
|
|
14528
14575
|
const showControls = Boolean(isEditMode);
|
|
14529
14576
|
const showHoverEffects = !isEditor || Boolean(isPreviewMode);
|
|
@@ -14621,26 +14668,56 @@ export const Marquee = ({ settings, content, isEditor, isPreviewMode, isEditMode
|
|
|
14621
14668
|
};
|
|
14622
14669
|
}, [hoverEffect, swappedSlots, showHoverEffects]);
|
|
14623
14670
|
|
|
14624
|
-
// Only decode videos that are actually visible: the track renders many copies of each item,
|
|
14625
|
-
// and playing all of them at once saturates the decoder and drops frames.
|
|
14626
14671
|
useEffect(() => {
|
|
14627
14672
|
const wrapper = wrapperRef.current;
|
|
14628
14673
|
if (!wrapper || typeof IntersectionObserver === 'undefined') return;
|
|
14629
|
-
|
|
14630
|
-
|
|
14631
|
-
|
|
14632
|
-
|
|
14633
|
-
|
|
14634
|
-
|
|
14635
|
-
|
|
14636
|
-
|
|
14637
|
-
|
|
14674
|
+
let isNear = false;
|
|
14675
|
+
let isVisible = false;
|
|
14676
|
+
let pollTimer: ReturnType<typeof setInterval> | undefined;
|
|
14677
|
+
const syncVideos = () => {
|
|
14678
|
+
const videos = wrapper.querySelectorAll('video');
|
|
14679
|
+
if (!isNear) {
|
|
14680
|
+
videos.forEach(pauseVideo);
|
|
14681
|
+
return;
|
|
14682
|
+
}
|
|
14683
|
+
const wrapperRect = wrapper.getBoundingClientRect();
|
|
14684
|
+
const lookahead = wrapperRect.width * VIDEO_LOOKAHEAD_WRAPPER_WIDTHS;
|
|
14685
|
+
videos.forEach((video) => {
|
|
14686
|
+
const rect = video.getBoundingClientRect();
|
|
14687
|
+
const isInView = rect.right > wrapperRect.left && rect.left < wrapperRect.right;
|
|
14688
|
+
const isNearView = rect.right > wrapperRect.left - lookahead && rect.left < wrapperRect.right + lookahead;
|
|
14689
|
+
if (isNearView) raisePreload(video, 'auto');
|
|
14690
|
+
else if (needsVideoMetadata) raisePreload(video, 'metadata');
|
|
14691
|
+
if (isVisible && isInView) {
|
|
14692
|
+
if (video.paused) playVideo(video);
|
|
14693
|
+
} else {
|
|
14694
|
+
pauseVideo(video);
|
|
14638
14695
|
}
|
|
14696
|
+
});
|
|
14697
|
+
};
|
|
14698
|
+
const update = () => {
|
|
14699
|
+
if (isNear && pollTimer === undefined) {
|
|
14700
|
+
pollTimer = setInterval(syncVideos, VIDEO_POLL_MS);
|
|
14701
|
+
} else if (!isNear && pollTimer !== undefined) {
|
|
14702
|
+
clearInterval(pollTimer);
|
|
14703
|
+
pollTimer = undefined;
|
|
14639
14704
|
}
|
|
14640
|
-
|
|
14641
|
-
|
|
14642
|
-
|
|
14643
|
-
|
|
14705
|
+
syncVideos();
|
|
14706
|
+
};
|
|
14707
|
+
const stopNear = observeIntersection(wrapper, NEAR_VIEWPORT_MARGIN, (intersecting) => {
|
|
14708
|
+
isNear = intersecting;
|
|
14709
|
+
update();
|
|
14710
|
+
});
|
|
14711
|
+
const stopVisible = observeIntersection(wrapper, '0px', (intersecting) => {
|
|
14712
|
+
isVisible = intersecting;
|
|
14713
|
+
update();
|
|
14714
|
+
});
|
|
14715
|
+
return () => {
|
|
14716
|
+
stopNear();
|
|
14717
|
+
stopVisible();
|
|
14718
|
+
clearInterval(pollTimer);
|
|
14719
|
+
};
|
|
14720
|
+
}, [useMarqueeTrack, needsVideoMetadata]);
|
|
14644
14721
|
|
|
14645
14722
|
useLayoutEffect(() => {
|
|
14646
14723
|
if (!useMarqueeTrack) return;
|
|
@@ -15874,6 +15951,7 @@ import {
|
|
|
15874
15951
|
} from '../utils/index';
|
|
15875
15952
|
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
15876
15953
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
15954
|
+
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
15877
15955
|
|
|
15878
15956
|
const DEFAULT_IMG_WIDTH = 300 / 1440;
|
|
15879
15957
|
const DEFAULT_CORNER_RADIUS = 8 / 1440;
|
|
@@ -17319,7 +17397,7 @@ function GalleryMediaItem({
|
|
|
17319
17397
|
const galleryPaddingBetweenHeight = Math.max(galleryPaddingBetween, PADDING_HANDLE_SIZE);
|
|
17320
17398
|
|
|
17321
17399
|
const mediaNode = isVideoMedia(media) ? (
|
|
17322
|
-
<
|
|
17400
|
+
<LazyVideo
|
|
17323
17401
|
{...mediaProps}
|
|
17324
17402
|
src={media.assetId}
|
|
17325
17403
|
muted
|
|
@@ -19795,6 +19873,13 @@ type ScaleSettings = {
|
|
|
19795
19873
|
maxHeight?: number;
|
|
19796
19874
|
transition?: number;
|
|
19797
19875
|
bgImage?: 'greyscale' | 'blur' | 'as is';
|
|
19876
|
+
origin?: 'center' | 'mouse' | 'random';
|
|
19877
|
+
position?: 'center' | 'mouse' | 'random';
|
|
19878
|
+
};
|
|
19879
|
+
|
|
19880
|
+
type Point = {
|
|
19881
|
+
x: number;
|
|
19882
|
+
y: number;
|
|
19798
19883
|
};
|
|
19799
19884
|
|
|
19800
19885
|
const GREYSCALE_EFFECT_AMOUNT = 100;
|
|
@@ -19827,11 +19912,8 @@ function getCSS(P: string): string {
|
|
|
19827
19912
|
overflow: hidden;
|
|
19828
19913
|
}
|
|
19829
19914
|
.\${P}-background {
|
|
19830
|
-
position: absolute;
|
|
19831
|
-
inset: 0;
|
|
19832
19915
|
z-index: 1;
|
|
19833
19916
|
pointer-events: none;
|
|
19834
|
-
overflow: hidden;
|
|
19835
19917
|
}
|
|
19836
19918
|
.\${P}-effect-image {
|
|
19837
19919
|
width: 100%;
|
|
@@ -19865,11 +19947,17 @@ function getCSS(P: string): string {
|
|
|
19865
19947
|
}
|
|
19866
19948
|
.\${P}-outgoing-next {
|
|
19867
19949
|
z-index: 3;
|
|
19868
|
-
transition:
|
|
19950
|
+
transition:
|
|
19951
|
+
transform var(--\${P}-transition-ms) \${TRANSITION_TIMING_FUNCTION},
|
|
19952
|
+
left var(--\${P}-transition-ms) \${TRANSITION_TIMING_FUNCTION},
|
|
19953
|
+
top var(--\${P}-transition-ms) \${TRANSITION_TIMING_FUNCTION};
|
|
19869
19954
|
}
|
|
19870
19955
|
.\${P}-outgoing-prev {
|
|
19871
19956
|
z-index: 3;
|
|
19872
|
-
transition:
|
|
19957
|
+
transition:
|
|
19958
|
+
transform var(--\${P}-transition-ms) \${TRANSITION_TIMING_FUNCTION},
|
|
19959
|
+
left var(--\${P}-transition-ms) \${TRANSITION_TIMING_FUNCTION},
|
|
19960
|
+
top var(--\${P}-transition-ms) \${TRANSITION_TIMING_FUNCTION};
|
|
19873
19961
|
}
|
|
19874
19962
|
.\${P}-outgoing-next .\${P}-effect-image {
|
|
19875
19963
|
transition: filter var(--\${P}-transition-ms) \${TRANSITION_TIMING_FUNCTION};
|
|
@@ -19995,6 +20083,28 @@ function computeFitSize(
|
|
|
19995
20083
|
};
|
|
19996
20084
|
}
|
|
19997
20085
|
|
|
20086
|
+
function clampPoint(point: Point, size: SizePercents): Point {
|
|
20087
|
+
const halfW = size.widthPercent / 2;
|
|
20088
|
+
const halfH = size.heightPercent / 2;
|
|
20089
|
+
const minX = halfW;
|
|
20090
|
+
const maxX = 100 - halfW;
|
|
20091
|
+
const minY = halfH;
|
|
20092
|
+
const maxY = 100 - halfH;
|
|
20093
|
+
|
|
20094
|
+
return {
|
|
20095
|
+
x: minX > maxX ? 50 : Math.min(maxX, Math.max(minX, point.x)),
|
|
20096
|
+
y: minY > maxY ? 50 : Math.min(maxY, Math.max(minY, point.y)),
|
|
20097
|
+
};
|
|
20098
|
+
}
|
|
20099
|
+
|
|
20100
|
+
function centerPoint(): Point {
|
|
20101
|
+
return { x: 50, y: 50 };
|
|
20102
|
+
}
|
|
20103
|
+
|
|
20104
|
+
function randomPoint(): Point {
|
|
20105
|
+
return { x: Math.random() * 100, y: Math.random() * 100 };
|
|
20106
|
+
}
|
|
20107
|
+
|
|
19998
20108
|
function computeCoverScale(
|
|
19999
20109
|
containerWidth: number,
|
|
20000
20110
|
containerHeight: number,
|
|
@@ -20016,9 +20126,16 @@ function toSizeStyle(size: SizePercents): React.CSSProperties {
|
|
|
20016
20126
|
};
|
|
20017
20127
|
}
|
|
20018
20128
|
|
|
20019
|
-
function toStageStyle(
|
|
20129
|
+
function toStageStyle(
|
|
20130
|
+
size: SizePercents,
|
|
20131
|
+
scale: number,
|
|
20132
|
+
prefix: string,
|
|
20133
|
+
position: Point,
|
|
20134
|
+
): React.CSSProperties {
|
|
20020
20135
|
return {
|
|
20021
20136
|
...toSizeStyle(size),
|
|
20137
|
+
left: \`\${position.x}%\`,
|
|
20138
|
+
top: \`\${position.y}%\`,
|
|
20022
20139
|
[\`--\${prefix}-stage-scale\`]: scale,
|
|
20023
20140
|
} as React.CSSProperties;
|
|
20024
20141
|
}
|
|
@@ -20048,7 +20165,10 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20048
20165
|
maxHeight,
|
|
20049
20166
|
transition = 1000,
|
|
20050
20167
|
bgImage = 'greyscale',
|
|
20168
|
+
origin: originSetting,
|
|
20169
|
+
position: legacyOrigin,
|
|
20051
20170
|
} = settings;
|
|
20171
|
+
const origin = originSetting ?? legacyOrigin ?? 'center';
|
|
20052
20172
|
const items = content ?? [];
|
|
20053
20173
|
const initialIndices = getInitialIndices(items.length);
|
|
20054
20174
|
const [activeIndex, setActiveIndex] = useState(initialIndices.activeIndex);
|
|
@@ -20060,17 +20180,19 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20060
20180
|
const [incomingScale, setIncomingScale] = useState(0);
|
|
20061
20181
|
const [outgoingScale, setOutgoingScale] = useState(1);
|
|
20062
20182
|
const [outgoingFilter, setOutgoingFilter] = useState('none');
|
|
20183
|
+
const [outgoingPointOverride, setOutgoingPointOverride] = useState<Point | null>(null);
|
|
20063
20184
|
const [transitionDirection, setTransitionDirection] = useState<'next' | 'prev'>('next');
|
|
20064
20185
|
const [imageDimensions, setImageDimensions] = useState<Record<string, ImageDimensions>>({});
|
|
20065
20186
|
const [containerSize, setContainerSize] = useState({ width: 0, height: 0 });
|
|
20187
|
+
const [imagePositions, setImagePositions] = useState<Record<number, Point>>({});
|
|
20066
20188
|
const transitionTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
20067
20189
|
const wrapperRef = useRef<HTMLDivElement>(null);
|
|
20190
|
+
const imagePositionsRef = useRef<Record<number, Point>>({});
|
|
20068
20191
|
const isInteractive = !isEditor || Boolean(isPreviewMode);
|
|
20069
20192
|
const legacyImageSize = imageSize ?? 60;
|
|
20070
20193
|
const maxWidthPercent = Math.max(10, Math.min(100, maxWidth ?? legacyImageSize));
|
|
20071
20194
|
const maxHeightPercent = Math.max(10, Math.min(100, maxHeight ?? legacyImageSize));
|
|
20072
20195
|
const transitionMs = Math.max(100, transition);
|
|
20073
|
-
const backgroundFilter = getBackgroundFilter(bgImage);
|
|
20074
20196
|
|
|
20075
20197
|
const getImageSizePercents = useCallback((url: string | undefined): SizePercents => {
|
|
20076
20198
|
const aspectRatio = getImageAspectRatio(url ? imageDimensions[url] : undefined);
|
|
@@ -20118,16 +20240,42 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20118
20240
|
setIncomingScale(0);
|
|
20119
20241
|
setOutgoingScale(1);
|
|
20120
20242
|
setOutgoingFilter('none');
|
|
20243
|
+
setOutgoingPointOverride(null);
|
|
20121
20244
|
setTransitionDirection('next');
|
|
20122
20245
|
}, [items.length, content]);
|
|
20123
20246
|
|
|
20247
|
+
useEffect(() => {
|
|
20248
|
+
const nextPositions: Record<number, Point> = {};
|
|
20249
|
+
for (let index = 0; index < items.length; index += 1) {
|
|
20250
|
+
nextPositions[index] = origin === 'random' ? randomPoint() : centerPoint();
|
|
20251
|
+
}
|
|
20252
|
+
imagePositionsRef.current = nextPositions;
|
|
20253
|
+
setImagePositions(nextPositions);
|
|
20254
|
+
}, [items.length, content, origin]);
|
|
20255
|
+
|
|
20124
20256
|
useEffect(() => () => {
|
|
20125
20257
|
if (transitionTimeoutRef.current) {
|
|
20126
20258
|
clearTimeout(transitionTimeoutRef.current);
|
|
20127
20259
|
}
|
|
20128
20260
|
}, []);
|
|
20129
20261
|
|
|
20130
|
-
const
|
|
20262
|
+
const resolvePosition = useCallback((event?: React.MouseEvent): Point => {
|
|
20263
|
+
if (origin === 'random') return randomPoint();
|
|
20264
|
+
if (origin !== 'mouse') return centerPoint();
|
|
20265
|
+
|
|
20266
|
+
const wrapper = wrapperRef.current;
|
|
20267
|
+
if (!wrapper || !event) return centerPoint();
|
|
20268
|
+
|
|
20269
|
+
const rect = wrapper.getBoundingClientRect();
|
|
20270
|
+
if (rect.width <= 0 || rect.height <= 0) return centerPoint();
|
|
20271
|
+
|
|
20272
|
+
return {
|
|
20273
|
+
x: ((event.clientX - rect.left) / rect.width) * 100,
|
|
20274
|
+
y: ((event.clientY - rect.top) / rect.height) * 100,
|
|
20275
|
+
};
|
|
20276
|
+
}, [origin]);
|
|
20277
|
+
|
|
20278
|
+
const startTransition = useCallback((direction: 'next' | 'prev', event?: React.MouseEvent) => {
|
|
20131
20279
|
if (!isInteractive || isAnimating || items.length <= 1) return;
|
|
20132
20280
|
|
|
20133
20281
|
const targetIndex = direction === 'next'
|
|
@@ -20135,8 +20283,21 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20135
20283
|
: (activeIndex - 1 + items.length) % items.length;
|
|
20136
20284
|
const activeSize = getImageSizePercents(items[activeIndex]?.image?.assetId);
|
|
20137
20285
|
const targetSize = getImageSizePercents(items[targetIndex]?.image?.assetId);
|
|
20138
|
-
const
|
|
20139
|
-
const
|
|
20286
|
+
const activePoint = clampPoint(imagePositionsRef.current[activeIndex] ?? centerPoint(), activeSize);
|
|
20287
|
+
const targetPoint = clampPoint(resolvePosition(event), targetSize);
|
|
20288
|
+
const nextPositions = { ...imagePositionsRef.current, [targetIndex]: targetPoint };
|
|
20289
|
+
imagePositionsRef.current = nextPositions;
|
|
20290
|
+
setImagePositions(nextPositions);
|
|
20291
|
+
const activeCoverScale = computeCoverScale(
|
|
20292
|
+
containerSize.width,
|
|
20293
|
+
containerSize.height,
|
|
20294
|
+
activeSize,
|
|
20295
|
+
);
|
|
20296
|
+
const targetCoverScale = computeCoverScale(
|
|
20297
|
+
containerSize.width,
|
|
20298
|
+
containerSize.height,
|
|
20299
|
+
targetSize,
|
|
20300
|
+
);
|
|
20140
20301
|
|
|
20141
20302
|
if (transitionTimeoutRef.current) {
|
|
20142
20303
|
clearTimeout(transitionTimeoutRef.current);
|
|
@@ -20147,6 +20308,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20147
20308
|
setIsAnimating(true);
|
|
20148
20309
|
|
|
20149
20310
|
if (direction === 'next') {
|
|
20311
|
+
setOutgoingPointOverride(activePoint);
|
|
20150
20312
|
setOutgoingIndex(activeIndex);
|
|
20151
20313
|
setIncomingIndex(targetIndex);
|
|
20152
20314
|
setIncomingScale(0);
|
|
@@ -20157,6 +20319,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20157
20319
|
setOutgoingIndex(targetIndex);
|
|
20158
20320
|
setIncomingIndex(activeIndex);
|
|
20159
20321
|
setIncomingScale(1);
|
|
20322
|
+
setOutgoingPointOverride(centerPoint());
|
|
20160
20323
|
setOutgoingScale(targetCoverScale);
|
|
20161
20324
|
setOutgoingFilter(getBackgroundFilter(bgImage, 1, targetCoverScale));
|
|
20162
20325
|
}
|
|
@@ -20166,10 +20329,12 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20166
20329
|
requestAnimationFrame(() => {
|
|
20167
20330
|
if (direction === 'next') {
|
|
20168
20331
|
setIncomingScale(1);
|
|
20332
|
+
setOutgoingPointOverride(centerPoint());
|
|
20169
20333
|
setOutgoingScale(activeCoverScale);
|
|
20170
20334
|
setOutgoingFilter(getBackgroundFilter(bgImage, 1, activeCoverScale));
|
|
20171
20335
|
} else {
|
|
20172
20336
|
setIncomingScale(0);
|
|
20337
|
+
setOutgoingPointOverride(targetPoint);
|
|
20173
20338
|
setOutgoingScale(1);
|
|
20174
20339
|
setOutgoingFilter(getBackgroundFilter(bgImage, 0, 1));
|
|
20175
20340
|
}
|
|
@@ -20183,6 +20348,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20183
20348
|
setActiveIndex(targetIndex);
|
|
20184
20349
|
setOutgoingIndex(null);
|
|
20185
20350
|
setIncomingIndex(null);
|
|
20351
|
+
setOutgoingPointOverride(null);
|
|
20186
20352
|
setIsAnimating(false);
|
|
20187
20353
|
}, transitionMs);
|
|
20188
20354
|
}, [
|
|
@@ -20194,6 +20360,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20194
20360
|
isAnimating,
|
|
20195
20361
|
isInteractive,
|
|
20196
20362
|
items,
|
|
20363
|
+
resolvePosition,
|
|
20197
20364
|
transitionMs,
|
|
20198
20365
|
]);
|
|
20199
20366
|
|
|
@@ -20206,6 +20373,22 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20206
20373
|
const foregroundSize = getImageSizePercents(foregroundItem?.image?.assetId);
|
|
20207
20374
|
const outgoingFitSize = getImageSizePercents(outgoingItem?.image?.assetId);
|
|
20208
20375
|
const incomingFitSize = getImageSizePercents(incomingItem?.image?.assetId);
|
|
20376
|
+
const backgroundSize = getImageSizePercents(backgroundItem?.image?.assetId);
|
|
20377
|
+
const backgroundCoverScale = computeCoverScale(
|
|
20378
|
+
containerSize.width,
|
|
20379
|
+
containerSize.height,
|
|
20380
|
+
backgroundSize,
|
|
20381
|
+
);
|
|
20382
|
+
const backgroundFilter = getBackgroundFilter(bgImage, 1, backgroundCoverScale);
|
|
20383
|
+
const foregroundPoint = clampPoint(imagePositions[activeIndex] ?? centerPoint(), foregroundSize);
|
|
20384
|
+
const outgoingPoint = outgoingPointOverride ?? clampPoint(
|
|
20385
|
+
outgoingIndex !== null ? (imagePositions[outgoingIndex] ?? centerPoint()) : centerPoint(),
|
|
20386
|
+
outgoingFitSize,
|
|
20387
|
+
);
|
|
20388
|
+
const incomingPoint = clampPoint(
|
|
20389
|
+
incomingIndex !== null ? (imagePositions[incomingIndex] ?? centerPoint()) : centerPoint(),
|
|
20390
|
+
incomingFitSize,
|
|
20391
|
+
);
|
|
20209
20392
|
const wrapperStyle = {
|
|
20210
20393
|
[\`--\${P}-transition-ms\`]: \`\${transitionMs}ms\`,
|
|
20211
20394
|
} as React.CSSProperties;
|
|
@@ -20220,7 +20403,11 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20220
20403
|
aria-label="Zoom gallery"
|
|
20221
20404
|
>
|
|
20222
20405
|
{backgroundItem?.image?.assetId && (
|
|
20223
|
-
<div
|
|
20406
|
+
<div
|
|
20407
|
+
className={cn(\`\${P}-stage\`, \`\${P}-background\`)}
|
|
20408
|
+
style={toStageStyle(backgroundSize, backgroundCoverScale, P, centerPoint())}
|
|
20409
|
+
aria-hidden="true"
|
|
20410
|
+
>
|
|
20224
20411
|
<img
|
|
20225
20412
|
className={\`\${P}-effect-image\`}
|
|
20226
20413
|
src={backgroundItem.image.assetId}
|
|
@@ -20236,7 +20423,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20236
20423
|
\`\${P}-outgoing\`,
|
|
20237
20424
|
\`\${P}-outgoing-\${transitionDirection}\`,
|
|
20238
20425
|
)}
|
|
20239
|
-
style={toStageStyle(outgoingFitSize, outgoingScale, P)}
|
|
20426
|
+
style={toStageStyle(outgoingFitSize, outgoingScale, P, outgoingPoint)}
|
|
20240
20427
|
aria-hidden="true"
|
|
20241
20428
|
>
|
|
20242
20429
|
<img
|
|
@@ -20254,7 +20441,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20254
20441
|
\`\${P}-incoming\`,
|
|
20255
20442
|
\`\${P}-incoming-\${transitionDirection}\`,
|
|
20256
20443
|
)}
|
|
20257
|
-
style={toStageStyle(incomingFitSize, incomingScale, P)}
|
|
20444
|
+
style={toStageStyle(incomingFitSize, incomingScale, P, incomingPoint)}
|
|
20258
20445
|
aria-hidden="true"
|
|
20259
20446
|
>
|
|
20260
20447
|
<img
|
|
@@ -20267,7 +20454,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20267
20454
|
{!isAnimating && foregroundItem?.image?.assetId && (
|
|
20268
20455
|
<div
|
|
20269
20456
|
className={cn(\`\${P}-stage\`, \`\${P}-foreground\`)}
|
|
20270
|
-
style={
|
|
20457
|
+
style={toStageStyle(foregroundSize, 1, P, foregroundPoint)}
|
|
20271
20458
|
>
|
|
20272
20459
|
<img
|
|
20273
20460
|
className={\`\${P}-image\`}
|
|
@@ -20281,13 +20468,13 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20281
20468
|
<button
|
|
20282
20469
|
type="button"
|
|
20283
20470
|
className={cn(\`\${P}-nav\`, \`\${P}-nav-prev\`)}
|
|
20284
|
-
onClick={() => startTransition('prev')}
|
|
20471
|
+
onClick={(event) => startTransition('prev', event)}
|
|
20285
20472
|
aria-label={\`Show previous image (\${prevIndex + 1} of \${items.length})\`}
|
|
20286
20473
|
/>
|
|
20287
20474
|
<button
|
|
20288
20475
|
type="button"
|
|
20289
20476
|
className={cn(\`\${P}-nav\`, \`\${P}-nav-next\`)}
|
|
20290
|
-
onClick={() => startTransition('next')}
|
|
20477
|
+
onClick={(event) => startTransition('next', event)}
|
|
20291
20478
|
aria-label={\`Show next image (\${nextIndex + 1} of \${items.length})\`}
|
|
20292
20479
|
/>
|
|
20293
20480
|
</>
|
|
@@ -20296,7 +20483,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20296
20483
|
</>
|
|
20297
20484
|
);
|
|
20298
20485
|
}
|
|
20299
|
-
`,
|
|
20486
|
+
`, _ = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
|
|
20300
20487
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
20301
20488
|
import { CommonComponentProps } from '../props';
|
|
20302
20489
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
@@ -20928,7 +21115,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
20928
21115
|
</>
|
|
20929
21116
|
);
|
|
20930
21117
|
}
|
|
20931
|
-
`,
|
|
21118
|
+
`, F = `import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
20932
21119
|
import cn from 'classnames';
|
|
20933
21120
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
20934
21121
|
import { scalingValue } from '../utils/scalingValue';
|
|
@@ -23243,6 +23430,7 @@ import { createPortal } from 'react-dom';
|
|
|
23243
23430
|
import { CommonComponentProps } from '../props';
|
|
23244
23431
|
import { getContainedMediaTransformOrigin } from '../utils/getImageRect';
|
|
23245
23432
|
import { scalingValue, useScopedStyles } from '../utils/index';
|
|
23433
|
+
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
23246
23434
|
import { textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
23247
23435
|
import {
|
|
23248
23436
|
Lightbox,
|
|
@@ -23671,7 +23859,7 @@ export function Waterfall({
|
|
|
23671
23859
|
].filter(Boolean).join(' ')}
|
|
23672
23860
|
>
|
|
23673
23861
|
{item.image.type === 'video' ? (
|
|
23674
|
-
<
|
|
23862
|
+
<LazyVideo
|
|
23675
23863
|
ref={syncFitMediaLayout}
|
|
23676
23864
|
src={item.image.assetId}
|
|
23677
23865
|
data-waterfall-index={index}
|
|
@@ -23681,7 +23869,7 @@ export function Waterfall({
|
|
|
23681
23869
|
loop
|
|
23682
23870
|
autoPlay
|
|
23683
23871
|
onClick={handleOpen}
|
|
23684
|
-
|
|
23872
|
+
onLoadedMetadata={(e) => syncFitMediaLayout(e.currentTarget)}
|
|
23685
23873
|
/>
|
|
23686
23874
|
) : (
|
|
23687
23875
|
<img
|
|
@@ -23768,8 +23956,8 @@ export function Waterfall({
|
|
|
23768
23956
|
[s.id]: N,
|
|
23769
23957
|
[a.id]: H,
|
|
23770
23958
|
[r.id]: O,
|
|
23771
|
-
[o.id]:
|
|
23772
|
-
[i.id]:
|
|
23959
|
+
[o.id]: _,
|
|
23960
|
+
[i.id]: F,
|
|
23773
23961
|
[t.id]: W,
|
|
23774
23962
|
[e.id]: D,
|
|
23775
23963
|
[n.id]: B
|