@cntrl-site/components 1.0.104 → 1.0.106
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-CYQMgrIr.js +36 -0
- package/dist/ClickGallerie-o2U6oyOF.mjs +272 -0
- package/dist/Components/ClickGallerie/ClickGallerie.d.ts +2 -1
- package/dist/Components/Helix/Helix.d.ts +4 -1
- package/dist/Components/Hive/Hive.d.ts +4 -1
- package/dist/Components/ImageRevealSlider/ImageRevealSlider.d.ts +2 -1
- package/dist/Components/List/List.d.ts +6 -2
- package/dist/Components/Marquee/Marquee.d.ts +6 -2
- package/dist/Components/MarqueeText/MarqueeText.d.ts +2 -1
- package/dist/Components/Mercury/Mercury.d.ts +4 -1
- package/dist/Components/Waterfall/WaterfallLightbox.d.ts +4 -1
- package/dist/Components/utils/EmbedMediaFrame.d.ts +27 -0
- package/dist/Components/utils/LinkWrapper.d.ts +16 -0
- package/dist/Components/utils/embedMedia.d.ts +40 -0
- package/dist/Components/utils/index.d.ts +6 -0
- package/dist/Components/utils/observeIntersection.d.ts +4 -0
- package/dist/Components/utils/useLazyVideos.d.ts +0 -3
- package/dist/{ControlSlider-SiOt22l_.js → ControlSlider-Kkec-i14.js} +1 -1
- package/dist/{ControlSlider-pZv7H6BU.mjs → ControlSlider-LcZmviGX.mjs} +1 -1
- package/dist/EmbedMediaFrame-DsOTKE4i.js +1 -0
- package/dist/EmbedMediaFrame-DwHeOAy5.mjs +164 -0
- package/dist/{FAQ-C7823fyi.js → FAQ-BxhMo7T8.js} +1 -1
- package/dist/{FAQ-CZ39u4m8.mjs → FAQ-CdwSft5p.mjs} +1 -1
- package/dist/Grid-CFHTP3mb.js +378 -0
- package/dist/Grid-e-gLfsji.mjs +1590 -0
- package/dist/Helix-BpLo9FD3.js +43 -0
- package/dist/Helix-CidI3ucE.mjs +324 -0
- package/dist/{Hive-BusARSOi.mjs → Hive-BsmFHk2i.mjs} +505 -475
- package/dist/Hive-D1j6wZpV.js +321 -0
- package/dist/ImageRevealSlider-BuukTGAK.js +1 -0
- package/dist/{ImageRevealSlider-BdFGyVEP.mjs → ImageRevealSlider-Df9sygk9.mjs} +63 -70
- package/dist/{LazyVideo-D8eVYFyw.mjs → LazyVideo-CdAWymKO.mjs} +1 -1
- package/dist/{LazyVideo-Cn_vmMq8.js → LazyVideo-imbU18js.js} +1 -1
- package/dist/{Lightbox-eP9qAZzL.mjs → Lightbox-C_fXsfdz.mjs} +1 -1
- package/dist/{Lightbox-CIss_nOG.js → Lightbox-DaunVrkp.js} +1 -1
- package/dist/LinkWrapper-Ca84iPtg.js +1 -0
- package/dist/LinkWrapper-DZs9hlOn.mjs +13 -0
- package/dist/{List-DW7fyJbf.mjs → List-Bh_-l9vD.mjs} +532 -520
- package/dist/List-DVvpQ24J.js +377 -0
- package/dist/Marquee-DByooiWP.mjs +578 -0
- package/dist/Marquee-DfIP-tIN.js +133 -0
- package/dist/MarqueeText-D6FNCe6P.mjs +518 -0
- package/dist/MarqueeText-DsUiV6Zv.js +132 -0
- package/dist/Mercury-B-s2Kvuq.js +267 -0
- package/dist/Mercury-CCW0Es-s.mjs +1700 -0
- package/dist/PretextComponent-Dnbenstn.js +1 -0
- package/dist/{PretextComponent-s4DDfmzY.mjs → PretextComponent-OygSO3fr.mjs} +312 -269
- package/dist/{RichTextRenderer-B6WtTYlR.mjs → RichTextRenderer-BptwNpbJ.mjs} +10 -9
- package/dist/RichTextRenderer-K90Dd7pt.js +1 -0
- package/dist/{Slider20-Dm8BeCli.mjs → Slider20-CCzixTiN.mjs} +1 -1
- package/dist/{Slider20-C9o2REDl.js → Slider20-fMVeRfgx.js} +1 -1
- package/dist/{TestimonialGrid-CPu4qQ6B.mjs → TestimonialGrid-CbsVxSn9.mjs} +1 -1
- package/dist/{TestimonialGrid-D4ieiz9e.js → TestimonialGrid-CiCagfBU.js} +1 -1
- package/dist/{TestimonialSingle-DLdnAVF7.mjs → TestimonialSingle-BVm3Amrl.mjs} +1 -1
- package/dist/{TestimonialSingle-CVu15ZtV.js → TestimonialSingle-BWXynGjv.js} +1 -1
- package/dist/Waterfall-3kKioKh2.mjs +1432 -0
- package/dist/Waterfall-DII4-WV5.js +288 -0
- package/dist/{components-Yf9Zjska.mjs → components-BRmbflgg.mjs} +15 -15
- package/dist/components-nvbH4l0S.js +1 -0
- package/dist/content/postFieldBindings.d.ts +29 -0
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +16 -16
- package/dist/elements.node.js +1 -1
- package/dist/elements.node.mjs +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +52 -15
- package/dist/observeIntersection-B0f3L2iK.mjs +23 -0
- package/dist/observeIntersection-DxGj9Ctt.js +1 -0
- package/dist/sources.js +335 -223
- package/dist/sources.mjs +339 -227
- package/dist/types/SchemaV1.d.ts +53 -1
- package/dist/useLazyVideos-CdCbc2j0.js +1 -0
- package/dist/useLazyVideos-CxXyEjRQ.mjs +52 -0
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +30 -20
- package/package.json +1 -1
- package/dist/ClickGallerie-D7g093HX.js +0 -36
- package/dist/ClickGallerie-QSOQjSdv.mjs +0 -271
- package/dist/Grid-B2_o1dvz.mjs +0 -1576
- package/dist/Grid-Bq6bk2AQ.js +0 -374
- package/dist/Helix-B7rxlvKq.js +0 -43
- package/dist/Helix-BrKQzGX5.mjs +0 -315
- package/dist/Hive-Dh5nKPGm.js +0 -321
- package/dist/ImageRevealSlider-BBWtFjUF.js +0 -1
- package/dist/List-C32WImI3.js +0 -377
- package/dist/Marquee-CdtAqhQE.mjs +0 -563
- package/dist/Marquee-DUN8wUax.js +0 -133
- package/dist/MarqueeText-4Rip_sQX.mjs +0 -515
- package/dist/MarqueeText-E6OubMOG.js +0 -132
- package/dist/Mercury-BRqlbk4i.mjs +0 -1702
- package/dist/Mercury-C-O2VGkK.js +0 -267
- package/dist/PretextComponent-D5P0AjnL.js +0 -1
- package/dist/RichTextRenderer-CIy6yI8U.js +0 -1
- package/dist/Waterfall-DKuh4bnv.mjs +0 -1404
- package/dist/Waterfall-fdiHR0Rc.js +0 -287
- package/dist/components-DzNixU7Q.js +0 -1
- package/dist/useLazyVideos-BbgdvELi.js +0 -1
- package/dist/useLazyVideos-CZLyNolX.mjs +0 -72
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-OygSO3fr.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';
|
|
@@ -2642,14 +2642,14 @@ export function Burger({
|
|
|
2642
2642
|
}
|
|
2643
2643
|
`, S = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2644
2644
|
import { CommonComponentProps } from '../props';
|
|
2645
|
-
import { useScopedStyles } from '../utils/index';
|
|
2645
|
+
import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
|
|
2646
2646
|
|
|
2647
2647
|
type ClickGallerieItem = {
|
|
2648
2648
|
image: {
|
|
2649
2649
|
assetId: string;
|
|
2650
2650
|
name: string;
|
|
2651
2651
|
};
|
|
2652
|
-
link
|
|
2652
|
+
link?: ContentLink;
|
|
2653
2653
|
};
|
|
2654
2654
|
|
|
2655
2655
|
type ImageSizeSettings = {
|
|
@@ -2684,7 +2684,7 @@ type ImageMeta = {
|
|
|
2684
2684
|
interface PlacedImage {
|
|
2685
2685
|
id: number;
|
|
2686
2686
|
assetId: string;
|
|
2687
|
-
link
|
|
2687
|
+
link?: ContentLink;
|
|
2688
2688
|
name: string;
|
|
2689
2689
|
x: number;
|
|
2690
2690
|
y: number;
|
|
@@ -3147,13 +3147,9 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
3147
3147
|
cursor: useCustomCursor ? 'none' : 'default',
|
|
3148
3148
|
}}
|
|
3149
3149
|
>
|
|
3150
|
-
{target === 'area'
|
|
3151
|
-
<a href={img.link} target="_blank" rel="noreferrer" className={\`\${P}-link\`}>
|
|
3152
|
-
<img src={img.assetId} alt={img.name} className={\`\${P}-image\`} />
|
|
3153
|
-
</a>
|
|
3154
|
-
) : (
|
|
3150
|
+
<LinkWrapper link={target === 'area' ? img.link : undefined} className={\`\${P}-link\`}>
|
|
3155
3151
|
<img src={img.assetId} alt={img.name} className={\`\${P}-image\`} />
|
|
3156
|
-
|
|
3152
|
+
</LinkWrapper>
|
|
3157
3153
|
</div>
|
|
3158
3154
|
))}
|
|
3159
3155
|
{isInside && useCustomCursor && (
|
|
@@ -3173,7 +3169,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
3173
3169
|
</>
|
|
3174
3170
|
);
|
|
3175
3171
|
}
|
|
3176
|
-
`,
|
|
3172
|
+
`, w = `import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3177
3173
|
import cn from 'classnames';
|
|
3178
3174
|
import { CommonComponentProps } from '../props';
|
|
3179
3175
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -3921,7 +3917,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
|
|
|
3921
3917
|
</>
|
|
3922
3918
|
);
|
|
3923
3919
|
}
|
|
3924
|
-
`,
|
|
3920
|
+
`, C = `import React, { useMemo, useState } from 'react';
|
|
3925
3921
|
import { CommonComponentProps } from '../props';
|
|
3926
3922
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
3927
3923
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -4562,9 +4558,11 @@ const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
|
4562
4558
|
`, $ = `import { Splide, SplideSlide } from '@splidejs/react-splide';
|
|
4563
4559
|
import '@splidejs/react-splide/css/core';
|
|
4564
4560
|
import { CommonComponentProps } from '../props';
|
|
4561
|
+
import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
|
|
4565
4562
|
import {
|
|
4566
4563
|
buildColorVars,
|
|
4567
4564
|
getFormFieldValidationError,
|
|
4565
|
+
LinkWrapper,
|
|
4568
4566
|
scalingValue,
|
|
4569
4567
|
useLazyVideos,
|
|
4570
4568
|
useScopedStyles,
|
|
@@ -4671,6 +4669,10 @@ function getCSS(P: string): string {
|
|
|
4671
4669
|
max-width: 100%;
|
|
4672
4670
|
object-fit: contain;
|
|
4673
4671
|
}
|
|
4672
|
+
.\${P}-item-image-wrapper-fit-slider > .\${P}-item-image-wrapper-sizer div {
|
|
4673
|
+
grid-area: 1 / 1;
|
|
4674
|
+
width: 100%;
|
|
4675
|
+
}
|
|
4674
4676
|
.\${P}-item-image-wrapper-fit-slider > .\${P}-item-slider {
|
|
4675
4677
|
position: absolute;
|
|
4676
4678
|
inset: 0;
|
|
@@ -5064,7 +5066,10 @@ type SwipeAxis = 'none' | 'horizontal' | 'vertical';
|
|
|
5064
5066
|
type GridMedia = {
|
|
5065
5067
|
assetId: string;
|
|
5066
5068
|
name?: string;
|
|
5067
|
-
type: 'image' | 'video';
|
|
5069
|
+
type: 'image' | 'video' | 'vimeo' | 'youtube';
|
|
5070
|
+
thumbnail?: string;
|
|
5071
|
+
width?: number;
|
|
5072
|
+
height?: number;
|
|
5068
5073
|
};
|
|
5069
5074
|
|
|
5070
5075
|
type GridMediaPair = {
|
|
@@ -5120,8 +5125,7 @@ function getGridDisplayItems(image: GridMedia[] | GridMediaPair[] | undefined):
|
|
|
5120
5125
|
}
|
|
5121
5126
|
|
|
5122
5127
|
function isVideoMedia(media: GridMedia): boolean {
|
|
5123
|
-
|
|
5124
|
-
return false;
|
|
5128
|
+
return !isEmbedMedia(media) && media.type === 'video';
|
|
5125
5129
|
}
|
|
5126
5130
|
|
|
5127
5131
|
function collectGridLightboxMedia(content: any[]): GridMedia[] {
|
|
@@ -5145,7 +5149,9 @@ function collectGridLightboxMedia(content: any[]): GridMedia[] {
|
|
|
5145
5149
|
function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
5146
5150
|
const [pool, setPool] = useState<HTMLDivElement | null>(null);
|
|
5147
5151
|
useLazyVideos(pool, { preload: 'metadata' });
|
|
5148
|
-
|
|
5152
|
+
// an embed's player is only ever framed where it shows
|
|
5153
|
+
const files = mediaList.filter(media => !isEmbedMedia(media));
|
|
5154
|
+
if (files.length === 0) return null;
|
|
5149
5155
|
|
|
5150
5156
|
return (
|
|
5151
5157
|
<div
|
|
@@ -5160,7 +5166,7 @@ function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
|
5160
5166
|
pointerEvents: 'none',
|
|
5161
5167
|
}}
|
|
5162
5168
|
>
|
|
5163
|
-
{
|
|
5169
|
+
{files.map((media) => (
|
|
5164
5170
|
isVideoMedia(media) ? (
|
|
5165
5171
|
<video
|
|
5166
5172
|
key={media.assetId}
|
|
@@ -5202,15 +5208,34 @@ function GridMediaItem({
|
|
|
5202
5208
|
media,
|
|
5203
5209
|
className,
|
|
5204
5210
|
style,
|
|
5211
|
+
hasLightbox,
|
|
5205
5212
|
isSplideSlide = false,
|
|
5206
5213
|
onMediaClick,
|
|
5207
5214
|
}: {
|
|
5208
5215
|
media: GridMedia;
|
|
5209
5216
|
className: string;
|
|
5210
5217
|
style: React.CSSProperties;
|
|
5218
|
+
/** An embed then plays here as a silent loop, and as it was set to in the lightbox. */
|
|
5219
|
+
hasLightbox: boolean;
|
|
5211
5220
|
isSplideSlide?: boolean;
|
|
5212
5221
|
onMediaClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
5213
5222
|
}) {
|
|
5223
|
+
if (isEmbedMedia(media)) {
|
|
5224
|
+
return (
|
|
5225
|
+
<EmbedMediaFrame
|
|
5226
|
+
media={media}
|
|
5227
|
+
fit={style.objectFit === 'contain' ? 'contain' : 'cover'}
|
|
5228
|
+
silentLoop={hasLightbox}
|
|
5229
|
+
className={className}
|
|
5230
|
+
style={{
|
|
5231
|
+
...style,
|
|
5232
|
+
cursor: onMediaClick ? 'pointer' : 'default',
|
|
5233
|
+
}}
|
|
5234
|
+
onClick={onMediaClick}
|
|
5235
|
+
/>
|
|
5236
|
+
);
|
|
5237
|
+
}
|
|
5238
|
+
|
|
5214
5239
|
if (isVideoMedia(media)) {
|
|
5215
5240
|
const videoProps = {
|
|
5216
5241
|
src: media.assetId,
|
|
@@ -5281,20 +5306,14 @@ function getContainRect(box: AnimRect, natural: { width: number; height: number
|
|
|
5281
5306
|
|
|
5282
5307
|
function LightboxVideo({
|
|
5283
5308
|
src,
|
|
5284
|
-
phase,
|
|
5285
5309
|
mediaRef,
|
|
5286
5310
|
mediaStyle,
|
|
5287
5311
|
onLoadedMetadata,
|
|
5288
|
-
onClick,
|
|
5289
|
-
onMouseMove,
|
|
5290
5312
|
}: {
|
|
5291
5313
|
src: string;
|
|
5292
|
-
phase: 'opening' | 'open' | 'closing';
|
|
5293
5314
|
mediaRef: React.RefObject<HTMLVideoElement>;
|
|
5294
5315
|
mediaStyle: React.CSSProperties;
|
|
5295
5316
|
onLoadedMetadata: (e: React.SyntheticEvent<HTMLVideoElement>) => void;
|
|
5296
|
-
onClick: (e: React.MouseEvent<HTMLVideoElement>) => void;
|
|
5297
|
-
onMouseMove: (e: React.MouseEvent<HTMLVideoElement>) => void;
|
|
5298
5317
|
}) {
|
|
5299
5318
|
useEffect(() => {
|
|
5300
5319
|
const video = mediaRef.current;
|
|
@@ -5309,12 +5328,12 @@ function LightboxVideo({
|
|
|
5309
5328
|
<video
|
|
5310
5329
|
ref={mediaRef}
|
|
5311
5330
|
src={src}
|
|
5312
|
-
|
|
5331
|
+
muted
|
|
5332
|
+
autoPlay
|
|
5333
|
+
loop
|
|
5313
5334
|
playsInline
|
|
5314
5335
|
preload='auto'
|
|
5315
5336
|
onLoadedMetadata={onLoadedMetadata}
|
|
5316
|
-
onClick={onClick}
|
|
5317
|
-
onMouseMove={onMouseMove}
|
|
5318
5337
|
style={mediaStyle}
|
|
5319
5338
|
/>
|
|
5320
5339
|
);
|
|
@@ -5499,7 +5518,7 @@ function Lightbox({
|
|
|
5499
5518
|
const prevItemUrlRef = useRef<string | undefined>(undefined);
|
|
5500
5519
|
const currentItem = items[index];
|
|
5501
5520
|
const isCurrentVideo = currentItem ? isVideoMedia(currentItem) : false;
|
|
5502
|
-
const
|
|
5521
|
+
const isCurrentEmbed = currentItem ? isEmbedMedia(currentItem) : false;
|
|
5503
5522
|
const isSliding = slideDir !== null;
|
|
5504
5523
|
|
|
5505
5524
|
const handleMediaLoad = useCallback((e: React.SyntheticEvent<HTMLImageElement | HTMLVideoElement>) => {
|
|
@@ -5853,50 +5872,14 @@ function Lightbox({
|
|
|
5853
5872
|
const swipeBackdropOpacity = swipeOffset > 0 ? Math.max(0, 1 - swipeOffset / 500) : 1;
|
|
5854
5873
|
const swipeMediaOpacity = swipeOffset > 0 ? Math.max(0.35, 1 - swipeOffset / 500) : 1;
|
|
5855
5874
|
|
|
5875
|
+
// an embed's player reports no size of its own, so its stored aspect stands in
|
|
5876
|
+
const naturalSize = isCurrentEmbed && currentItem
|
|
5877
|
+
? { width: getEmbedAspect(currentItem), height: 1 }
|
|
5878
|
+
: mediaNaturalSize;
|
|
5856
5879
|
const contentRect = finalRect
|
|
5857
|
-
? (isCover ? finalRect : getContainRect(finalRect,
|
|
5880
|
+
? (isCover ? finalRect : getContainRect(finalRect, naturalSize))
|
|
5858
5881
|
: null;
|
|
5859
5882
|
|
|
5860
|
-
const handleVideoClick = (e: React.MouseEvent<HTMLVideoElement>) => {
|
|
5861
|
-
e.stopPropagation();
|
|
5862
|
-
if (touchInteractionRef.current) {
|
|
5863
|
-
touchInteractionRef.current = false;
|
|
5864
|
-
return;
|
|
5865
|
-
}
|
|
5866
|
-
if (items.length <= 1) return;
|
|
5867
|
-
|
|
5868
|
-
const rect = contentRect ?? e.currentTarget.getBoundingClientRect();
|
|
5869
|
-
const y = e.clientY - rect.top;
|
|
5870
|
-
const controlsZoneHeight = Math.min(52, rect.height * 0.2);
|
|
5871
|
-
|
|
5872
|
-
if (y > rect.height - controlsZoneHeight) {
|
|
5873
|
-
return;
|
|
5874
|
-
}
|
|
5875
|
-
|
|
5876
|
-
if (e.clientX - rect.left < rect.width / 2) {
|
|
5877
|
-
startProgrammaticSlide(-1);
|
|
5878
|
-
return;
|
|
5879
|
-
}
|
|
5880
|
-
|
|
5881
|
-
startProgrammaticSlide(1);
|
|
5882
|
-
};
|
|
5883
|
-
|
|
5884
|
-
const handleVideoMouseMove = (e: React.MouseEvent<HTMLVideoElement>) => {
|
|
5885
|
-
if (items.length <= 1) return;
|
|
5886
|
-
|
|
5887
|
-
const rect = contentRect ?? e.currentTarget.getBoundingClientRect();
|
|
5888
|
-
const x = e.clientX - rect.left;
|
|
5889
|
-
const y = e.clientY - rect.top;
|
|
5890
|
-
const controlsZoneHeight = Math.min(52, rect.height * 0.2);
|
|
5891
|
-
|
|
5892
|
-
if (y > rect.height - controlsZoneHeight) {
|
|
5893
|
-
e.currentTarget.style.cursor = 'default';
|
|
5894
|
-
return;
|
|
5895
|
-
}
|
|
5896
|
-
|
|
5897
|
-
e.currentTarget.style.cursor = x < rect.width / 2 ? 'w-resize' : 'e-resize';
|
|
5898
|
-
};
|
|
5899
|
-
|
|
5900
5883
|
const backingBaseStyle: React.CSSProperties = {
|
|
5901
5884
|
position: 'fixed',
|
|
5902
5885
|
top: viewportRect?.top,
|
|
@@ -5941,8 +5924,7 @@ function Lightbox({
|
|
|
5941
5924
|
width: contentRect?.width,
|
|
5942
5925
|
height: contentRect?.height,
|
|
5943
5926
|
objectFit: objectFitStyle,
|
|
5944
|
-
pointerEvents:
|
|
5945
|
-
touchAction: isCurrentVideo && isOpen ? 'none' : undefined,
|
|
5927
|
+
pointerEvents: 'none',
|
|
5946
5928
|
};
|
|
5947
5929
|
|
|
5948
5930
|
const slideWidth = viewportRect?.width ?? 0;
|
|
@@ -5965,10 +5947,14 @@ function Lightbox({
|
|
|
5965
5947
|
pointerEvents: 'none',
|
|
5966
5948
|
};
|
|
5967
5949
|
|
|
5950
|
+
// over an embed with controls the overlays stop short of the player's own control bar
|
|
5951
|
+
const navOverlayInset = isCurrentEmbed && currentItem && getEmbedPlayback(currentItem).controls && contentRect
|
|
5952
|
+
? Math.min(52, contentRect.height * 0.2)
|
|
5953
|
+
: 0;
|
|
5968
5954
|
const navOverlayBaseStyle = contentRect ? {
|
|
5969
5955
|
position: 'fixed' as const,
|
|
5970
5956
|
top: contentRect.top,
|
|
5971
|
-
height: contentRect.height,
|
|
5957
|
+
height: contentRect.height - navOverlayInset,
|
|
5972
5958
|
width: contentRect.width / 2,
|
|
5973
5959
|
zIndex: 9999,
|
|
5974
5960
|
} : null;
|
|
@@ -6069,11 +6055,20 @@ function Lightbox({
|
|
|
6069
6055
|
|
|
6070
6056
|
{finalRect && viewportRect && neighborItem && (
|
|
6071
6057
|
<div style={neighborBackingStyle} onTransitionEnd={handleSlideTransitionEnd}>
|
|
6072
|
-
{
|
|
6058
|
+
{isEmbedMedia(neighborItem) ? (
|
|
6059
|
+
<img
|
|
6060
|
+
key={\`neighbor-\${neighborIndex}-\${neighborItem.assetId}\`}
|
|
6061
|
+
src={neighborItem.thumbnail}
|
|
6062
|
+
alt={neighborItem.name}
|
|
6063
|
+
style={neighborMediaStyle}
|
|
6064
|
+
/>
|
|
6065
|
+
) : isVideoMedia(neighborItem) ? (
|
|
6073
6066
|
<video
|
|
6074
6067
|
key={\`neighbor-\${neighborIndex}-\${neighborItem.assetId}\`}
|
|
6075
6068
|
src={neighborItem.assetId}
|
|
6076
6069
|
muted
|
|
6070
|
+
autoPlay
|
|
6071
|
+
loop
|
|
6077
6072
|
playsInline
|
|
6078
6073
|
preload='auto'
|
|
6079
6074
|
style={neighborMediaStyle}
|
|
@@ -6091,16 +6086,22 @@ function Lightbox({
|
|
|
6091
6086
|
|
|
6092
6087
|
{finalRect && viewportRect && currentItem && (
|
|
6093
6088
|
<div style={currentBackingStyle} onTransitionEnd={handleSlideTransitionEnd}>
|
|
6094
|
-
{
|
|
6089
|
+
{isCurrentEmbed ? (
|
|
6090
|
+
<EmbedMediaFrame
|
|
6091
|
+
key={\`\${index}-\${currentItem.assetId}\`}
|
|
6092
|
+
media={currentItem}
|
|
6093
|
+
fit={isCover ? 'cover' : 'contain'}
|
|
6094
|
+
lazy={false}
|
|
6095
|
+
startsAtOnce
|
|
6096
|
+
style={currentMediaStyle}
|
|
6097
|
+
/>
|
|
6098
|
+
) : isCurrentVideo ? (
|
|
6095
6099
|
<LightboxVideo
|
|
6096
6100
|
key={\`\${index}-\${currentItem.assetId}\`}
|
|
6097
6101
|
src={currentItem.assetId}
|
|
6098
|
-
phase={phase}
|
|
6099
6102
|
mediaRef={mediaRef as React.RefObject<HTMLVideoElement>}
|
|
6100
6103
|
mediaStyle={currentMediaStyle}
|
|
6101
6104
|
onLoadedMetadata={handleMediaLoad}
|
|
6102
|
-
onClick={handleVideoClick}
|
|
6103
|
-
onMouseMove={handleVideoMouseMove}
|
|
6104
6105
|
/>
|
|
6105
6106
|
) : (
|
|
6106
6107
|
<img
|
|
@@ -6115,7 +6116,7 @@ function Lightbox({
|
|
|
6115
6116
|
</div>
|
|
6116
6117
|
)}
|
|
6117
6118
|
|
|
6118
|
-
{isOpen && navOverlayBaseStyle && items.length > 1 &&
|
|
6119
|
+
{isOpen && navOverlayBaseStyle && items.length > 1 && (
|
|
6119
6120
|
<>
|
|
6120
6121
|
<div
|
|
6121
6122
|
style={{
|
|
@@ -6463,7 +6464,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
6463
6464
|
{cropContent.map((item: any, index: number) => {
|
|
6464
6465
|
const hasTitle = hasText(item.title);
|
|
6465
6466
|
const hasSubtitle = hasText(item.subtitle);
|
|
6466
|
-
const itemLink =
|
|
6467
|
+
const itemLink = lightbox === 'off' && item.link?.value ? item.link : undefined;
|
|
6467
6468
|
const isLastRow = Math.floor(index / columnsCount)
|
|
6468
6469
|
=== Math.ceil(cropContent.length / columnsCount) - 1;
|
|
6469
6470
|
const gridColumn = isPartialLastRow && index >= lastRowStartIndex
|
|
@@ -6565,16 +6566,11 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
6565
6566
|
</div>
|
|
6566
6567
|
) : null;
|
|
6567
6568
|
|
|
6568
|
-
const alignedTextRows =
|
|
6569
|
-
<
|
|
6570
|
-
{titleRow}
|
|
6571
|
-
{subtitleRow}
|
|
6572
|
-
</a>
|
|
6573
|
-
) : (
|
|
6574
|
-
<>
|
|
6569
|
+
const alignedTextRows = (
|
|
6570
|
+
<LinkWrapper link={itemLink} className={\`\${P}-item-text-link\`}>
|
|
6575
6571
|
{titleRow}
|
|
6576
6572
|
{subtitleRow}
|
|
6577
|
-
|
|
6573
|
+
</LinkWrapper>
|
|
6578
6574
|
);
|
|
6579
6575
|
|
|
6580
6576
|
const displayItems = getGridDisplayItems(item.gallery);
|
|
@@ -6598,6 +6594,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
6598
6594
|
media={displayMedia}
|
|
6599
6595
|
className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
|
|
6600
6596
|
style={imageStyle}
|
|
6597
|
+
hasLightbox={lightbox === 'on'}
|
|
6601
6598
|
onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
|
|
6602
6599
|
? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
|
|
6603
6600
|
: undefined}
|
|
@@ -6609,7 +6606,9 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
6609
6606
|
{isFitSlider && (
|
|
6610
6607
|
<div className={\`\${P}-item-image-wrapper-sizer\`} aria-hidden="true">
|
|
6611
6608
|
{displayItems.map(({ displayMedia }) => (
|
|
6612
|
-
|
|
6609
|
+
isEmbedMedia(displayMedia) ? (
|
|
6610
|
+
<div key={\`sizer-\${displayMedia.assetId}\`} style={{ aspectRatio: \`\${getEmbedAspect(displayMedia)}\` }} />
|
|
6611
|
+
) : isVideoMedia(displayMedia) ? (
|
|
6613
6612
|
<LazyVideo key={\`sizer-\${displayMedia.assetId}\`} src={displayMedia.assetId} nearPreload='metadata' muted playsInline />
|
|
6614
6613
|
) : (
|
|
6615
6614
|
<img key={\`sizer-\${displayMedia.assetId}\`} src={displayMedia.assetId} alt="" />
|
|
@@ -6651,6 +6650,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
6651
6650
|
media={displayMedia}
|
|
6652
6651
|
className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
|
|
6653
6652
|
style={imageStyle}
|
|
6653
|
+
hasLightbox={lightbox === 'on'}
|
|
6654
6654
|
isSplideSlide
|
|
6655
6655
|
onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
|
|
6656
6656
|
? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
|
|
@@ -6698,6 +6698,15 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
6698
6698
|
</>
|
|
6699
6699
|
) : null;
|
|
6700
6700
|
|
|
6701
|
+
// the aligned layout sizes this box whether or not it links anywhere
|
|
6702
|
+
const alignedImage = itemLink ? (
|
|
6703
|
+
<LinkWrapper link={itemLink} className={\`\${P}-item-image-link\`}>
|
|
6704
|
+
{imageContent}
|
|
6705
|
+
</LinkWrapper>
|
|
6706
|
+
) : (
|
|
6707
|
+
<a className={\`\${P}-item-image-link\`}>{imageContent}</a>
|
|
6708
|
+
);
|
|
6709
|
+
|
|
6701
6710
|
return (
|
|
6702
6711
|
<div
|
|
6703
6712
|
key={index}
|
|
@@ -6720,29 +6729,25 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
6720
6729
|
{isTextBeforeImage ? (
|
|
6721
6730
|
<>
|
|
6722
6731
|
{alignedTextRows}
|
|
6723
|
-
|
|
6724
|
-
{imageContent}
|
|
6725
|
-
</a>
|
|
6732
|
+
{alignedImage}
|
|
6726
6733
|
</>
|
|
6727
6734
|
) : (
|
|
6728
6735
|
<>
|
|
6729
|
-
|
|
6730
|
-
{imageContent}
|
|
6731
|
-
</a>
|
|
6736
|
+
{alignedImage}
|
|
6732
6737
|
{alignedTextRows}
|
|
6733
6738
|
</>
|
|
6734
6739
|
)}
|
|
6735
6740
|
</>
|
|
6736
6741
|
) : itemLink ? (
|
|
6737
6742
|
<>
|
|
6738
|
-
<
|
|
6743
|
+
<LinkWrapper link={itemLink} className={\`\${P}-item-image-link\`}>
|
|
6739
6744
|
{typeCTextBlock}
|
|
6740
6745
|
{imageContent}
|
|
6741
|
-
</
|
|
6746
|
+
</LinkWrapper>
|
|
6742
6747
|
{!isTextBeforeImage && (
|
|
6743
|
-
<
|
|
6748
|
+
<LinkWrapper link={itemLink} className={\`\${P}-item-text-link\`}>
|
|
6744
6749
|
{typeABText}
|
|
6745
|
-
</
|
|
6750
|
+
</LinkWrapper>
|
|
6746
6751
|
)}
|
|
6747
6752
|
</>
|
|
6748
6753
|
) : (
|
|
@@ -6869,6 +6874,7 @@ const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
|
6869
6874
|
import { CommonComponentProps } from '../props';
|
|
6870
6875
|
import { scalingValue } from '../utils/scalingValue';
|
|
6871
6876
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
6877
|
+
import { EmbedMediaFrame, isEmbedMedia } from '../utils/index';
|
|
6872
6878
|
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
6873
6879
|
|
|
6874
6880
|
const DEG_PER_SEC_PER_SPEED_UNIT = 10;
|
|
@@ -6939,7 +6945,10 @@ function getCSS(P: string): string {
|
|
|
6939
6945
|
type HelixMedia = {
|
|
6940
6946
|
assetId?: string;
|
|
6941
6947
|
name?: string;
|
|
6942
|
-
type?: 'image' | 'video';
|
|
6948
|
+
type?: 'image' | 'video' | 'vimeo' | 'youtube';
|
|
6949
|
+
thumbnail?: string;
|
|
6950
|
+
width?: number;
|
|
6951
|
+
height?: number;
|
|
6943
6952
|
};
|
|
6944
6953
|
|
|
6945
6954
|
export type HelixContentItem = {
|
|
@@ -7034,6 +7043,7 @@ function getAspectHeightFactor(imageDisplay: ImageDisplay): number {
|
|
|
7034
7043
|
}
|
|
7035
7044
|
|
|
7036
7045
|
function isVideoMedia(media: HelixMedia): boolean {
|
|
7046
|
+
if (isEmbedMedia(media)) return false;
|
|
7037
7047
|
if (media.type === 'video') return true;
|
|
7038
7048
|
if (media.type === 'image') return false;
|
|
7039
7049
|
return /\\.(mp4|webm|ogg|mov)(\\?|$)/i.test(media.name ?? '') || /\\.(mp4|webm|ogg|mov)(\\?|$)/i.test(media.assetId ?? '');
|
|
@@ -7381,7 +7391,15 @@ export function Helix({
|
|
|
7381
7391
|
objectPosition: 'center',
|
|
7382
7392
|
}
|
|
7383
7393
|
: mediaStyle;
|
|
7384
|
-
const mediaNode =
|
|
7394
|
+
const mediaNode = isEmbedMedia(media) ? (
|
|
7395
|
+
<EmbedMediaFrame
|
|
7396
|
+
className={\`\${P}-media\`}
|
|
7397
|
+
// the frame positions itself inline, so the cover's absolute placement is given the same way
|
|
7398
|
+
style={isCover ? { ...coverMediaStyle, position: 'absolute', inset: 0 } : coverMediaStyle}
|
|
7399
|
+
media={media}
|
|
7400
|
+
fit={isCover ? 'cover' : 'contain'}
|
|
7401
|
+
/>
|
|
7402
|
+
) : isVideoMedia(media) ? (
|
|
7385
7403
|
<LazyVideo
|
|
7386
7404
|
className={\`\${P}-media\`}
|
|
7387
7405
|
style={coverMediaStyle}
|
|
@@ -7426,7 +7444,7 @@ export function Helix({
|
|
|
7426
7444
|
);
|
|
7427
7445
|
}
|
|
7428
7446
|
`, T = `import { CommonComponentProps } from '../props';
|
|
7429
|
-
import { scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
|
|
7447
|
+
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
|
|
7430
7448
|
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
7431
7449
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
7432
7450
|
import { createPortal } from 'react-dom';
|
|
@@ -7788,7 +7806,10 @@ type HiveMedia = {
|
|
|
7788
7806
|
assetId: string;
|
|
7789
7807
|
name?: string;
|
|
7790
7808
|
objectFit?: 'cover' | 'contain';
|
|
7791
|
-
type?: 'image' | 'video';
|
|
7809
|
+
type?: 'image' | 'video' | 'vimeo' | 'youtube';
|
|
7810
|
+
thumbnail?: string;
|
|
7811
|
+
width?: number;
|
|
7812
|
+
height?: number;
|
|
7792
7813
|
};
|
|
7793
7814
|
|
|
7794
7815
|
type HiveMediaPair = {
|
|
@@ -7986,6 +8007,11 @@ function preloadMediaDimensions(
|
|
|
7986
8007
|
media: HiveMedia,
|
|
7987
8008
|
onDimensions: (url: string, width: number, height: number) => void,
|
|
7988
8009
|
) {
|
|
8010
|
+
if (isEmbedMedia(media)) {
|
|
8011
|
+
onDimensions(media.assetId, getEmbedAspect(media), 1);
|
|
8012
|
+
return;
|
|
8013
|
+
}
|
|
8014
|
+
|
|
7989
8015
|
if (isVideoMedia(media)) {
|
|
7990
8016
|
const video = document.createElement('video');
|
|
7991
8017
|
const handleMetadata = () => {
|
|
@@ -8033,7 +8059,9 @@ function collectAllHiveMedia(content: HiveContentItem[]): HiveMedia[] {
|
|
|
8033
8059
|
function PreloadedMediaPool({ mediaList }: { mediaList: HiveMedia[] }) {
|
|
8034
8060
|
const [pool, setPool] = useState<HTMLDivElement | null>(null);
|
|
8035
8061
|
useLazyVideos(pool, { preload: 'metadata' });
|
|
8036
|
-
|
|
8062
|
+
// an embed's player is only ever framed where it shows
|
|
8063
|
+
const files = mediaList.filter(media => !isEmbedMedia(media));
|
|
8064
|
+
if (files.length === 0) return null;
|
|
8037
8065
|
|
|
8038
8066
|
return (
|
|
8039
8067
|
<div
|
|
@@ -8048,7 +8076,7 @@ function PreloadedMediaPool({ mediaList }: { mediaList: HiveMedia[] }) {
|
|
|
8048
8076
|
pointerEvents: 'none',
|
|
8049
8077
|
}}
|
|
8050
8078
|
>
|
|
8051
|
-
{
|
|
8079
|
+
{files.map((media) => (
|
|
8052
8080
|
isVideoMedia(media) ? (
|
|
8053
8081
|
<video
|
|
8054
8082
|
key={media.assetId}
|
|
@@ -8253,6 +8281,7 @@ function getDisplayItems(gallery: HiveMedia[] | HiveMediaPair[] | undefined): Di
|
|
|
8253
8281
|
}
|
|
8254
8282
|
|
|
8255
8283
|
function isVideoMedia(media: HiveMedia): boolean {
|
|
8284
|
+
if (isEmbedMedia(media)) return false;
|
|
8256
8285
|
if (media.type === 'video') return true;
|
|
8257
8286
|
return /\\.(mp4|webm|ogg|mov)(\\?|#|$)/i.test(media.assetId);
|
|
8258
8287
|
}
|
|
@@ -8270,6 +8299,24 @@ function MediaItem({
|
|
|
8270
8299
|
gridIndex?: number;
|
|
8271
8300
|
onMediaClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
8272
8301
|
}) {
|
|
8302
|
+
if (isEmbedMedia(media)) {
|
|
8303
|
+
return (
|
|
8304
|
+
<EmbedMediaFrame
|
|
8305
|
+
media={media}
|
|
8306
|
+
fit={style.objectFit === 'contain' ? 'contain' : 'cover'}
|
|
8307
|
+
// a cell opens the lightbox, where the video plays as it was set to
|
|
8308
|
+
silentLoop
|
|
8309
|
+
className={className}
|
|
8310
|
+
data-hive-grid-index={gridIndex}
|
|
8311
|
+
style={{
|
|
8312
|
+
...style,
|
|
8313
|
+
cursor: onMediaClick ? 'pointer' : 'default',
|
|
8314
|
+
}}
|
|
8315
|
+
onClick={onMediaClick}
|
|
8316
|
+
/>
|
|
8317
|
+
);
|
|
8318
|
+
}
|
|
8319
|
+
|
|
8273
8320
|
if (isVideoMedia(media)) {
|
|
8274
8321
|
return (
|
|
8275
8322
|
<LazyVideo
|
|
@@ -8306,7 +8353,6 @@ function MediaItem({
|
|
|
8306
8353
|
|
|
8307
8354
|
function LightboxVideo({
|
|
8308
8355
|
src,
|
|
8309
|
-
phase,
|
|
8310
8356
|
onMediaElement,
|
|
8311
8357
|
wrapperStyle,
|
|
8312
8358
|
videoStyle,
|
|
@@ -8314,7 +8360,6 @@ function LightboxVideo({
|
|
|
8314
8360
|
onTransitionEnd,
|
|
8315
8361
|
}: {
|
|
8316
8362
|
src: string;
|
|
8317
|
-
phase: 'opening' | 'open' | 'closing';
|
|
8318
8363
|
onMediaElement?: (element: HTMLVideoElement | null) => void;
|
|
8319
8364
|
wrapperStyle: React.CSSProperties;
|
|
8320
8365
|
videoStyle: React.CSSProperties;
|
|
@@ -8339,11 +8384,12 @@ function LightboxVideo({
|
|
|
8339
8384
|
key={src}
|
|
8340
8385
|
ref={videoRef}
|
|
8341
8386
|
src={src}
|
|
8342
|
-
|
|
8387
|
+
muted
|
|
8388
|
+
autoPlay
|
|
8389
|
+
loop
|
|
8343
8390
|
playsInline
|
|
8344
8391
|
preload='auto'
|
|
8345
8392
|
onLoadedMetadata={onLoadedMetadata}
|
|
8346
|
-
onClick={(e) => e.stopPropagation()}
|
|
8347
8393
|
style={videoStyle}
|
|
8348
8394
|
/>
|
|
8349
8395
|
</div>
|
|
@@ -8361,11 +8407,17 @@ function LightboxSideMedia({
|
|
|
8361
8407
|
onTransitionEnd?: (e: React.TransitionEvent<HTMLElement>) => void;
|
|
8362
8408
|
onMeasure?: (url: string, width: number, height: number) => void;
|
|
8363
8409
|
}) {
|
|
8410
|
+
if (isEmbedMedia(media)) {
|
|
8411
|
+
return <img src={media.thumbnail} alt={media.name} style={style} onTransitionEnd={onTransitionEnd} />;
|
|
8412
|
+
}
|
|
8413
|
+
|
|
8364
8414
|
if (isVideoMedia(media)) {
|
|
8365
8415
|
return (
|
|
8366
8416
|
<video
|
|
8367
8417
|
src={media.assetId}
|
|
8368
8418
|
muted
|
|
8419
|
+
autoPlay
|
|
8420
|
+
loop
|
|
8369
8421
|
playsInline
|
|
8370
8422
|
preload='auto'
|
|
8371
8423
|
style={style}
|
|
@@ -8473,6 +8525,7 @@ function Lightbox({
|
|
|
8473
8525
|
const prevItemUrlRef = useRef<string | undefined>(undefined);
|
|
8474
8526
|
const currentItem = items[index];
|
|
8475
8527
|
const isCurrentVideo = currentItem ? isVideoMedia(currentItem) : false;
|
|
8528
|
+
const isCurrentEmbed = currentItem ? isEmbedMedia(currentItem) : false;
|
|
8476
8529
|
const isHorizontalNavActive = navSwipeOffset !== 0 || navSwipeAnimating;
|
|
8477
8530
|
const allowSwipeDismiss = !isEditMode && (!isEditor || Boolean(isPreviewMode));
|
|
8478
8531
|
const allowNavigation = canNavigate && !isEditMode;
|
|
@@ -9237,10 +9290,9 @@ function Lightbox({
|
|
|
9237
9290
|
: phase === 'opening' || isClosing
|
|
9238
9291
|
? \`opacity \${LIGHTBOX_ANIM_MS}ms \${LIGHTBOX_EASING}\`
|
|
9239
9292
|
: 'none',
|
|
9240
|
-
pointerEvents:
|
|
9241
|
-
touchAction: isCurrentVideo && isOpen ? 'none' : undefined,
|
|
9293
|
+
pointerEvents: 'none',
|
|
9242
9294
|
zIndex: 1,
|
|
9243
|
-
overflow: isCurrentVideo ? 'hidden' : undefined,
|
|
9295
|
+
overflow: isCurrentVideo || isCurrentEmbed ? 'hidden' : undefined,
|
|
9244
9296
|
};
|
|
9245
9297
|
|
|
9246
9298
|
const lightboxVideoStyle: React.CSSProperties = {
|
|
@@ -9248,7 +9300,7 @@ function Lightbox({
|
|
|
9248
9300
|
height: '100%',
|
|
9249
9301
|
display: 'block',
|
|
9250
9302
|
objectFit: 'contain',
|
|
9251
|
-
pointerEvents:
|
|
9303
|
+
pointerEvents: 'none',
|
|
9252
9304
|
};
|
|
9253
9305
|
|
|
9254
9306
|
const getSideMediaStyle = (
|
|
@@ -9486,11 +9538,20 @@ function Lightbox({
|
|
|
9486
9538
|
)}
|
|
9487
9539
|
|
|
9488
9540
|
{finalRect && currentItem && (
|
|
9489
|
-
|
|
9541
|
+
isCurrentEmbed ? (
|
|
9542
|
+
<div key={\`\${index}-\${currentItem.assetId}\`} style={mediaStyle} onTransitionEnd={handleNavSwipeTransitionEnd}>
|
|
9543
|
+
<EmbedMediaFrame
|
|
9544
|
+
media={currentItem}
|
|
9545
|
+
fit="contain"
|
|
9546
|
+
lazy={false}
|
|
9547
|
+
startsAtOnce
|
|
9548
|
+
style={lightboxVideoStyle}
|
|
9549
|
+
/>
|
|
9550
|
+
</div>
|
|
9551
|
+
) : isCurrentVideo ? (
|
|
9490
9552
|
<LightboxVideo
|
|
9491
9553
|
key={\`\${index}-\${currentItem.assetId}\`}
|
|
9492
9554
|
src={currentItem.assetId}
|
|
9493
|
-
phase={phase}
|
|
9494
9555
|
onMediaElement={setCenterMediaElement}
|
|
9495
9556
|
wrapperStyle={mediaStyle}
|
|
9496
9557
|
videoStyle={lightboxVideoStyle}
|
|
@@ -11085,7 +11146,7 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
|
|
|
11085
11146
|
`, M = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
11086
11147
|
import { createPortal } from 'react-dom';
|
|
11087
11148
|
import { CommonComponentProps } from '../props';
|
|
11088
|
-
import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
|
|
11149
|
+
import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
11089
11150
|
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
11090
11151
|
import type { LayoutItem, LayoutTab } from '../../types/SchemaV1';
|
|
11091
11152
|
|
|
@@ -11215,7 +11276,10 @@ type ListMedia = {
|
|
|
11215
11276
|
objectFit?: 'cover' | 'contain';
|
|
11216
11277
|
assetId: string;
|
|
11217
11278
|
name: string;
|
|
11218
|
-
type?: 'image' | 'video';
|
|
11279
|
+
type?: 'image' | 'video' | 'vimeo' | 'youtube';
|
|
11280
|
+
thumbnail?: string;
|
|
11281
|
+
width?: number;
|
|
11282
|
+
height?: number;
|
|
11219
11283
|
};
|
|
11220
11284
|
|
|
11221
11285
|
type ListContentItem = {
|
|
@@ -11225,14 +11289,14 @@ type ListContentItem = {
|
|
|
11225
11289
|
DColumnWidth?: string;
|
|
11226
11290
|
EColumnWidth?: string;
|
|
11227
11291
|
image?: ListMedia;
|
|
11228
|
-
link?:
|
|
11292
|
+
link?: ContentLink;
|
|
11229
11293
|
};
|
|
11230
11294
|
|
|
11231
11295
|
type ListItemRow = {
|
|
11232
11296
|
id: string | number;
|
|
11233
11297
|
cells: Record<string, React.ReactNode>;
|
|
11234
11298
|
image?: ListContentItem['image'];
|
|
11235
|
-
link?:
|
|
11299
|
+
link?: ContentLink;
|
|
11236
11300
|
};
|
|
11237
11301
|
|
|
11238
11302
|
type HoverImageState = {
|
|
@@ -11240,10 +11304,13 @@ type HoverImageState = {
|
|
|
11240
11304
|
assetId: string;
|
|
11241
11305
|
objectFit: 'cover' | 'contain';
|
|
11242
11306
|
isVideo: boolean;
|
|
11307
|
+
/** The media itself when it is a Vimeo or YouTube video, framed rather than drawn. */
|
|
11308
|
+
embed?: ListMedia;
|
|
11243
11309
|
widthPx: number;
|
|
11244
11310
|
};
|
|
11245
11311
|
|
|
11246
11312
|
function isVideoMedia(media: Pick<ListMedia, 'assetId' | 'type' | 'name'>): boolean {
|
|
11313
|
+
if (isEmbedMedia(media)) return false;
|
|
11247
11314
|
if (media.type === 'video') return true;
|
|
11248
11315
|
if (media.type === 'image') return false;
|
|
11249
11316
|
const name = media.name ?? '';
|
|
@@ -11256,7 +11323,7 @@ function ListHoverMedia({
|
|
|
11256
11323
|
className,
|
|
11257
11324
|
style,
|
|
11258
11325
|
}: {
|
|
11259
|
-
media: Pick<HoverImageState, 'assetId' | 'objectFit' | 'isVideo'>;
|
|
11326
|
+
media: Pick<HoverImageState, 'assetId' | 'objectFit' | 'isVideo' | 'embed'>;
|
|
11260
11327
|
className: string;
|
|
11261
11328
|
style: React.CSSProperties;
|
|
11262
11329
|
}) {
|
|
@@ -11273,6 +11340,18 @@ function ListHoverMedia({
|
|
|
11273
11340
|
}
|
|
11274
11341
|
}, [media.isVideo, media.assetId]);
|
|
11275
11342
|
|
|
11343
|
+
if (media.embed) {
|
|
11344
|
+
return (
|
|
11345
|
+
<EmbedMediaFrame
|
|
11346
|
+
media={media.embed}
|
|
11347
|
+
startsAtOnce
|
|
11348
|
+
fit="contain"
|
|
11349
|
+
className={className}
|
|
11350
|
+
style={style}
|
|
11351
|
+
/>
|
|
11352
|
+
);
|
|
11353
|
+
}
|
|
11354
|
+
|
|
11276
11355
|
if (media.isVideo) {
|
|
11277
11356
|
return (
|
|
11278
11357
|
<video
|
|
@@ -13435,6 +13514,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
|
|
|
13435
13514
|
assetId: image.assetId,
|
|
13436
13515
|
objectFit: 'contain',
|
|
13437
13516
|
isVideo: isVideoMedia(image),
|
|
13517
|
+
embed: isEmbedMedia(image) ? image : undefined,
|
|
13438
13518
|
widthPx,
|
|
13439
13519
|
});
|
|
13440
13520
|
hoverShowPositionRef.current = { x, y };
|
|
@@ -13720,7 +13800,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
|
|
|
13720
13800
|
>
|
|
13721
13801
|
<div style={{ width: '100%', position: 'relative' }}>
|
|
13722
13802
|
{visibleRows.map((row, rowIdx) => {
|
|
13723
|
-
const hasLink = (row.link?.length ?? 0) > 0;
|
|
13803
|
+
const hasLink = (row.link?.value.length ?? 0) > 0;
|
|
13724
13804
|
const RowElement = hasLink && (!isEditor || isPreviewMode) ? 'a' : 'div';
|
|
13725
13805
|
const rowStyle = getEntryDividerWidths(
|
|
13726
13806
|
rowIdx,
|
|
@@ -13737,7 +13817,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
|
|
|
13737
13817
|
key={row.id}
|
|
13738
13818
|
ref={rowIdx === 0 ? (el: HTMLElement | null) => { firstRowRef.current = el; } : undefined}
|
|
13739
13819
|
className={\`\${P}-list-item\${hasLink || entryHoverShowOption === 'always' ? \` \${P}-list-item-has-link\` : ''}\${showCutLabel && rowIdx === visibleRows.length - 1 ? \` \${P}-list-item-before-cut\` : ''}\`}
|
|
13740
|
-
{...(hasLink ? { href: row.link, target: '_blank' } : {})}
|
|
13820
|
+
{...(hasLink ? { href: row.link?.value, target: row.link?.target === 'blank' ? '_blank' : '_self' } : {})}
|
|
13741
13821
|
style={rowStyle}
|
|
13742
13822
|
onMouseEnter={(event) => {
|
|
13743
13823
|
if (revealHoverActive && (hasLink || entryHoverShowOption === 'always')) {
|
|
@@ -14171,9 +14251,9 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
|
|
|
14171
14251
|
`, L = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
14172
14252
|
import cn from 'classnames';
|
|
14173
14253
|
import { CommonComponentProps } from '../props';
|
|
14174
|
-
import { scalingValue } from '../utils/
|
|
14175
|
-
import {
|
|
14176
|
-
import {
|
|
14254
|
+
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
14255
|
+
import { NEAR_VIEWPORT_MARGIN, observeIntersection } from '../utils/observeIntersection';
|
|
14256
|
+
import { pauseVideo, playVideo, raisePreload } from '../utils/useLazyVideos';
|
|
14177
14257
|
|
|
14178
14258
|
function getCSS(P: string, setWidthPx: number): string {
|
|
14179
14259
|
const distance = setWidthPx > 0 ? \`\${setWidthPx}px\` : '0px';
|
|
@@ -14400,6 +14480,7 @@ const isAnyCopyOfSlotInView = (wrapper: Element, itemIndex: number): boolean =>
|
|
|
14400
14480
|
};
|
|
14401
14481
|
|
|
14402
14482
|
const isVideoMedia = (media: Pick<NonNullable<MarqueeItem['image']>, 'assetId' | 'type' | 'name'>): boolean => {
|
|
14483
|
+
if (isEmbedMedia(media)) return false;
|
|
14403
14484
|
if (media.type === 'video') return true;
|
|
14404
14485
|
if (media.type === 'image') return false;
|
|
14405
14486
|
const name = media.name ?? '';
|
|
@@ -14441,11 +14522,13 @@ const MarqueeItemCard = ({
|
|
|
14441
14522
|
}: MarqueeItemCardProps) => {
|
|
14442
14523
|
const mediaRef = useRef<HTMLImageElement | HTMLVideoElement | null>(null);
|
|
14443
14524
|
const isVideo = Boolean(item.image?.assetId && isVideoMedia(item.image));
|
|
14525
|
+
// an embed's box is sized from what is stored, so there is nothing to wait for
|
|
14526
|
+
const isEmbed = Boolean(item.image?.assetId && isEmbedMedia(item.image));
|
|
14444
14527
|
|
|
14445
14528
|
useLayoutEffect(() => {
|
|
14446
14529
|
if (!isFirstSet) return;
|
|
14447
|
-
if (isMediaReady(mediaRef.current)) onFirstSetImageDone?.();
|
|
14448
|
-
}, [isFirstSet, item.image?.assetId, onFirstSetImageDone]);
|
|
14530
|
+
if (isEmbed || isMediaReady(mediaRef.current)) onFirstSetImageDone?.();
|
|
14531
|
+
}, [isFirstSet, isEmbed, item.image?.assetId, onFirstSetImageDone]);
|
|
14449
14532
|
|
|
14450
14533
|
const isCover = imageFit.display === 'cover';
|
|
14451
14534
|
const ratioValue = imageFit.ratioValue ?? '1:1';
|
|
@@ -14484,9 +14567,27 @@ const MarqueeItemCard = ({
|
|
|
14484
14567
|
...radiusStyle,
|
|
14485
14568
|
};
|
|
14486
14569
|
|
|
14570
|
+
// a frame has no size of its own: fitted, it takes the box a video of its aspect would
|
|
14571
|
+
const embedAspect = isEmbed && item.image ? getEmbedAspect(item.image) : null;
|
|
14572
|
+
const embedStyle: CSSProperties | undefined = embedAspect === null
|
|
14573
|
+
? undefined
|
|
14574
|
+
: isCover
|
|
14575
|
+
? mediaStyle
|
|
14576
|
+
: {
|
|
14577
|
+
...mediaStyle,
|
|
14578
|
+
width: scaled(imageMaxWidth / embedAspect > imageMaxHeight ? imageMaxHeight * embedAspect : imageMaxWidth),
|
|
14579
|
+
height: scaled(imageMaxWidth / embedAspect > imageMaxHeight ? imageMaxHeight : imageMaxWidth / embedAspect),
|
|
14580
|
+
};
|
|
14581
|
+
|
|
14487
14582
|
const imageNode =
|
|
14488
14583
|
item.image?.assetId &&
|
|
14489
|
-
(
|
|
14584
|
+
(isEmbed ? (
|
|
14585
|
+
<EmbedMediaFrame
|
|
14586
|
+
media={item.image}
|
|
14587
|
+
fit={isCover ? 'cover' : 'contain'}
|
|
14588
|
+
style={embedStyle}
|
|
14589
|
+
/>
|
|
14590
|
+
) : isVideo ? (
|
|
14490
14591
|
<video
|
|
14491
14592
|
ref={(el) => { mediaRef.current = el; }}
|
|
14492
14593
|
src={item.image.assetId}
|
|
@@ -14541,14 +14642,11 @@ const MarqueeItemCard = ({
|
|
|
14541
14642
|
}),
|
|
14542
14643
|
}}
|
|
14543
14644
|
>
|
|
14544
|
-
{imageNode &&
|
|
14545
|
-
|
|
14546
|
-
|
|
14547
|
-
|
|
14548
|
-
|
|
14549
|
-
)
|
|
14550
|
-
: imageNode
|
|
14551
|
-
}
|
|
14645
|
+
{imageNode && (
|
|
14646
|
+
<LinkWrapper link={item.link} className={cn(\`\${P}-marquee-link\`, !isCover && \`\${P}-marquee-link-contain\`)}>
|
|
14647
|
+
{imageNode}
|
|
14648
|
+
</LinkWrapper>
|
|
14649
|
+
)}
|
|
14552
14650
|
</div>
|
|
14553
14651
|
</div>
|
|
14554
14652
|
);
|
|
@@ -14977,9 +15075,12 @@ export type MarqueeItem = {
|
|
|
14977
15075
|
image?: {
|
|
14978
15076
|
assetId?: string;
|
|
14979
15077
|
name?: string;
|
|
14980
|
-
type?: 'image' | 'video';
|
|
15078
|
+
type?: 'image' | 'video' | 'vimeo' | 'youtube';
|
|
15079
|
+
thumbnail?: string;
|
|
15080
|
+
width?: number;
|
|
15081
|
+
height?: number;
|
|
14981
15082
|
};
|
|
14982
|
-
link?:
|
|
15083
|
+
link?: ContentLink;
|
|
14983
15084
|
};
|
|
14984
15085
|
|
|
14985
15086
|
export type MarqueeSettings = {
|
|
@@ -15008,9 +15109,9 @@ type MarqueeProps = {
|
|
|
15008
15109
|
`, k = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
|
|
15009
15110
|
import cn from 'classnames';
|
|
15010
15111
|
import { CommonComponentProps } from '../props';
|
|
15011
|
-
import { scalingValue } from '../utils/
|
|
15012
|
-
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
15112
|
+
import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
15013
15113
|
import { textStylesToCss } from '../utils/textStylesToCss';
|
|
15114
|
+
import { observeIntersection } from '../utils/observeIntersection';
|
|
15014
15115
|
|
|
15015
15116
|
function getCSS(P: string, setWidthPx: number, isCurve: boolean): string {
|
|
15016
15117
|
const distance = setWidthPx > 0 ? \`\${setWidthPx}px\` : '0px';
|
|
@@ -15348,9 +15449,7 @@ const MarqueeTextItemView = ({ item, prefix: P, textCss, capHeightPx, opticalOff
|
|
|
15348
15449
|
);
|
|
15349
15450
|
return (
|
|
15350
15451
|
<div className={\`\${P}-item\`} data-marquee-text-item style={{ gap: imageGapPx }}>
|
|
15351
|
-
{item.link
|
|
15352
|
-
? <a href={item.link} className={\`\${P}-item-link\`} style={{ gap: imageGapPx }}>{content}</a>
|
|
15353
|
-
: content}
|
|
15452
|
+
<LinkWrapper link={item.link} className={\`\${P}-item-link\`} style={{ gap: imageGapPx }}>{content}</LinkWrapper>
|
|
15354
15453
|
</div>
|
|
15355
15454
|
);
|
|
15356
15455
|
};
|
|
@@ -15433,7 +15532,7 @@ export const MarqueeText = ({ settings, content, isEditor, isPreviewMode }: Marq
|
|
|
15433
15532
|
const [ribbonHeightPx, setRibbonHeightPx] = useState(0);
|
|
15434
15533
|
|
|
15435
15534
|
const contentKey = useMemo(
|
|
15436
|
-
() => (content ?? []).map((i) => \`\${i.text}\\0\${i.image?.assetId ?? ''}\\0\${i.link ?? ''}\`).join('\\0'),
|
|
15535
|
+
() => (content ?? []).map((i) => \`\${i.text}\\0\${i.image?.assetId ?? ''}\\0\${i.link?.value ?? ''}\`).join('\\0'),
|
|
15437
15536
|
[content],
|
|
15438
15537
|
);
|
|
15439
15538
|
const [contentSequenceRepeat, setContentSequenceRepeat] = useState(MIN_CONTENT_SEQUENCE_REPEAT);
|
|
@@ -15610,9 +15709,11 @@ export const MarqueeText = ({ settings, content, isEditor, isPreviewMode }: Marq
|
|
|
15610
15709
|
const wrapper = wrapperRef.current;
|
|
15611
15710
|
if (!wrapper) return;
|
|
15612
15711
|
|
|
15712
|
+
const canObserve = typeof IntersectionObserver !== 'undefined';
|
|
15613
15713
|
const wave = {
|
|
15614
15714
|
raf: 0,
|
|
15615
15715
|
cancelled: false,
|
|
15716
|
+
isOnScreen: !canObserve,
|
|
15616
15717
|
lut: null as WaveArcLut | null,
|
|
15617
15718
|
lutKey: '',
|
|
15618
15719
|
itemsCache: [] as WaveItemCache[],
|
|
@@ -15699,18 +15800,24 @@ export const MarqueeText = ({ settings, content, isEditor, isPreviewMode }: Marq
|
|
|
15699
15800
|
if (wave.cancelled) return;
|
|
15700
15801
|
wave.raf = 0;
|
|
15701
15802
|
applyWave();
|
|
15702
|
-
if (waveShouldLoopRef.current && !document.hidden) {
|
|
15803
|
+
if (waveShouldLoopRef.current && wave.isOnScreen && !document.hidden) {
|
|
15703
15804
|
wave.raf = requestAnimationFrame(tick);
|
|
15704
15805
|
}
|
|
15705
15806
|
};
|
|
15706
15807
|
|
|
15707
15808
|
const kick = () => {
|
|
15708
|
-
if (wave.cancelled || wave.raf) return;
|
|
15809
|
+
if (wave.cancelled || wave.raf || !wave.isOnScreen) return;
|
|
15709
15810
|
wave.raf = requestAnimationFrame(tick);
|
|
15710
15811
|
};
|
|
15711
15812
|
|
|
15813
|
+
const stop = () => {
|
|
15814
|
+
cancelAnimationFrame(wave.raf);
|
|
15815
|
+
wave.raf = 0;
|
|
15816
|
+
};
|
|
15817
|
+
|
|
15712
15818
|
const invalidate = () => {
|
|
15713
15819
|
wave.cacheDirty = true;
|
|
15820
|
+
if (!wave.isOnScreen) return;
|
|
15714
15821
|
applyWave();
|
|
15715
15822
|
kick();
|
|
15716
15823
|
};
|
|
@@ -15719,15 +15826,16 @@ export const MarqueeText = ({ settings, content, isEditor, isPreviewMode }: Marq
|
|
|
15719
15826
|
waveInvalidateRef.current = invalidate;
|
|
15720
15827
|
applyWave();
|
|
15721
15828
|
kick();
|
|
15829
|
+
const stopObserving = canObserve
|
|
15830
|
+
? observeIntersection(wrapper, '0px', (isIntersecting) => {
|
|
15831
|
+
wave.isOnScreen = isIntersecting;
|
|
15832
|
+
if (isIntersecting) invalidate();
|
|
15833
|
+
else stop();
|
|
15834
|
+
})
|
|
15835
|
+
: null;
|
|
15722
15836
|
const onVisibility = () => {
|
|
15723
|
-
|
|
15724
|
-
|
|
15725
|
-
wave.raf = 0;
|
|
15726
|
-
return;
|
|
15727
|
-
}
|
|
15728
|
-
cancelAnimationFrame(wave.raf);
|
|
15729
|
-
wave.raf = 0;
|
|
15730
|
-
invalidate();
|
|
15837
|
+
stop();
|
|
15838
|
+
if (!document.hidden) invalidate();
|
|
15731
15839
|
};
|
|
15732
15840
|
document.addEventListener('visibilitychange', onVisibility);
|
|
15733
15841
|
window.addEventListener('pageshow', onVisibility);
|
|
@@ -15737,6 +15845,7 @@ export const MarqueeText = ({ settings, content, isEditor, isPreviewMode }: Marq
|
|
|
15737
15845
|
wave.cancelled = true;
|
|
15738
15846
|
waveKickRef.current = null;
|
|
15739
15847
|
waveInvalidateRef.current = null;
|
|
15848
|
+
stopObserving?.();
|
|
15740
15849
|
cancelAnimationFrame(wave.raf);
|
|
15741
15850
|
document.removeEventListener('visibilitychange', onVisibility);
|
|
15742
15851
|
window.removeEventListener('pageshow', onVisibility);
|
|
@@ -15904,7 +16013,7 @@ export type MarqueeTextItem = {
|
|
|
15904
16013
|
assetId?: string;
|
|
15905
16014
|
name?: string;
|
|
15906
16015
|
};
|
|
15907
|
-
link?:
|
|
16016
|
+
link?: ContentLink;
|
|
15908
16017
|
};
|
|
15909
16018
|
|
|
15910
16019
|
export type MarqueeTextSettings = {
|
|
@@ -15944,6 +16053,7 @@ type MarqueeTextProps = {
|
|
|
15944
16053
|
import { createPortal } from 'react-dom';
|
|
15945
16054
|
import type React from 'react';
|
|
15946
16055
|
import { CommonComponentProps } from '../props';
|
|
16056
|
+
import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
|
|
15947
16057
|
import {
|
|
15948
16058
|
buildColorVars,
|
|
15949
16059
|
scalingValue,
|
|
@@ -16335,8 +16445,11 @@ function getTitlePositionAxes(position: TitlePosition): TitlePositionAxes {
|
|
|
16335
16445
|
type MercuryMedia = {
|
|
16336
16446
|
assetId: string;
|
|
16337
16447
|
name?: string;
|
|
16338
|
-
type?: 'image' | 'video';
|
|
16448
|
+
type?: 'image' | 'video' | 'vimeo' | 'youtube';
|
|
16339
16449
|
objectFit?: 'cover' | 'contain';
|
|
16450
|
+
thumbnail?: string;
|
|
16451
|
+
width?: number;
|
|
16452
|
+
height?: number;
|
|
16340
16453
|
};
|
|
16341
16454
|
|
|
16342
16455
|
type MercuryMediaPair = {
|
|
@@ -16575,21 +16688,15 @@ function resolveLightboxImageDisplay(
|
|
|
16575
16688
|
|
|
16576
16689
|
function LightboxVideo({
|
|
16577
16690
|
src,
|
|
16578
|
-
phase,
|
|
16579
16691
|
mediaRef,
|
|
16580
16692
|
mediaStyle,
|
|
16581
16693
|
onLoadedMetadata,
|
|
16582
|
-
onClick,
|
|
16583
|
-
onMouseMove,
|
|
16584
16694
|
onTransitionEnd,
|
|
16585
16695
|
}: {
|
|
16586
16696
|
src: string;
|
|
16587
|
-
phase: 'opening' | 'open' | 'closing';
|
|
16588
16697
|
mediaRef: React.RefObject<HTMLVideoElement>;
|
|
16589
16698
|
mediaStyle: React.CSSProperties;
|
|
16590
16699
|
onLoadedMetadata: () => void;
|
|
16591
|
-
onClick: (e: React.MouseEvent<HTMLVideoElement>) => void;
|
|
16592
|
-
onMouseMove: (e: React.MouseEvent<HTMLVideoElement>) => void;
|
|
16593
16700
|
onTransitionEnd: (e: React.TransitionEvent<HTMLVideoElement>) => void;
|
|
16594
16701
|
}) {
|
|
16595
16702
|
useEffect(() => {
|
|
@@ -16605,12 +16712,12 @@ function LightboxVideo({
|
|
|
16605
16712
|
<video
|
|
16606
16713
|
ref={mediaRef}
|
|
16607
16714
|
src={src}
|
|
16608
|
-
|
|
16715
|
+
muted
|
|
16716
|
+
autoPlay
|
|
16717
|
+
loop
|
|
16609
16718
|
playsInline
|
|
16610
16719
|
preload="auto"
|
|
16611
16720
|
onLoadedMetadata={onLoadedMetadata}
|
|
16612
|
-
onClick={onClick}
|
|
16613
|
-
onMouseMove={onMouseMove}
|
|
16614
16721
|
onTransitionEnd={onTransitionEnd}
|
|
16615
16722
|
style={mediaStyle}
|
|
16616
16723
|
/>
|
|
@@ -16786,6 +16893,7 @@ function Lightbox({
|
|
|
16786
16893
|
const prevIndexRef = useRef(index);
|
|
16787
16894
|
const currentItem = items[index];
|
|
16788
16895
|
const isCurrentVideo = currentItem ? isVideoMedia(currentItem) : false;
|
|
16896
|
+
const isCurrentEmbed = currentItem ? isEmbedMedia(currentItem) : false;
|
|
16789
16897
|
const isHorizontalNavActive = navSwipeOffset !== 0 || navSwipeAnimating;
|
|
16790
16898
|
|
|
16791
16899
|
const setNavSwipeAnimatingState = useCallback((value: boolean) => {
|
|
@@ -16822,18 +16930,22 @@ function Lightbox({
|
|
|
16822
16930
|
return;
|
|
16823
16931
|
}
|
|
16824
16932
|
|
|
16825
|
-
|
|
16826
|
-
|
|
16827
|
-
|
|
16828
|
-
|
|
16933
|
+
// an embed's player reports no size of its own, so its stored aspect stands in
|
|
16934
|
+
let ir = currentItem && isEmbedMedia(currentItem) ? getEmbedAspect(currentItem) : null;
|
|
16935
|
+
if (ir === null) {
|
|
16936
|
+
if (!media) {
|
|
16937
|
+
setFinalRect(getGhostRect(ghost));
|
|
16938
|
+
return;
|
|
16939
|
+
}
|
|
16829
16940
|
|
|
16830
|
-
|
|
16831
|
-
|
|
16832
|
-
|
|
16833
|
-
|
|
16941
|
+
const { width: nw, height: nh } = getLightboxMediaDimensions(media);
|
|
16942
|
+
if (!nw || !nh) {
|
|
16943
|
+
setFinalRect(getGhostRect(ghost));
|
|
16944
|
+
return;
|
|
16945
|
+
}
|
|
16946
|
+
ir = nw / nh;
|
|
16834
16947
|
}
|
|
16835
16948
|
|
|
16836
|
-
const ir = nw / nh;
|
|
16837
16949
|
const cr = cw / ch;
|
|
16838
16950
|
if (ir > cr) {
|
|
16839
16951
|
const dh = cw / ir;
|
|
@@ -16842,7 +16954,7 @@ function Lightbox({
|
|
|
16842
16954
|
const dw = ch * ir;
|
|
16843
16955
|
setFinalRect({ width: dw, height: ch, left: cb.left + (cw - dw) / 2, top: cb.top });
|
|
16844
16956
|
}
|
|
16845
|
-
}, [imageDisplay]);
|
|
16957
|
+
}, [imageDisplay, currentItem]);
|
|
16846
16958
|
|
|
16847
16959
|
useEffect(() => {
|
|
16848
16960
|
computeFinalRect();
|
|
@@ -17062,46 +17174,6 @@ function Lightbox({
|
|
|
17062
17174
|
const swipeBackdropOpacity = swipeOffset > 0 ? Math.max(0, 1 - swipeOffset / 500) : 1;
|
|
17063
17175
|
const swipeMediaOpacity = swipeOffset > 0 ? Math.max(0.35, 1 - swipeOffset / 500) : 1;
|
|
17064
17176
|
|
|
17065
|
-
const handleVideoClick = (e: React.MouseEvent<HTMLVideoElement>) => {
|
|
17066
|
-
e.stopPropagation();
|
|
17067
|
-
if (touchInteractionRef.current) {
|
|
17068
|
-
touchInteractionRef.current = false;
|
|
17069
|
-
return;
|
|
17070
|
-
}
|
|
17071
|
-
if (items.length <= 1) return;
|
|
17072
|
-
|
|
17073
|
-
const rect = e.currentTarget.getBoundingClientRect();
|
|
17074
|
-
const y = e.clientY - rect.top;
|
|
17075
|
-
const controlsZoneHeight = Math.min(52, rect.height * 0.2);
|
|
17076
|
-
|
|
17077
|
-
if (y > rect.height - controlsZoneHeight) {
|
|
17078
|
-
return;
|
|
17079
|
-
}
|
|
17080
|
-
|
|
17081
|
-
if (e.clientX - rect.left < rect.width / 2) {
|
|
17082
|
-
onPrev();
|
|
17083
|
-
return;
|
|
17084
|
-
}
|
|
17085
|
-
|
|
17086
|
-
onNext();
|
|
17087
|
-
};
|
|
17088
|
-
|
|
17089
|
-
const handleVideoMouseMove = (e: React.MouseEvent<HTMLVideoElement>) => {
|
|
17090
|
-
if (items.length <= 1) return;
|
|
17091
|
-
|
|
17092
|
-
const rect = e.currentTarget.getBoundingClientRect();
|
|
17093
|
-
const x = e.clientX - rect.left;
|
|
17094
|
-
const y = e.clientY - rect.top;
|
|
17095
|
-
const controlsZoneHeight = Math.min(52, rect.height * 0.2);
|
|
17096
|
-
|
|
17097
|
-
if (y > rect.height - controlsZoneHeight) {
|
|
17098
|
-
e.currentTarget.style.cursor = 'default';
|
|
17099
|
-
return;
|
|
17100
|
-
}
|
|
17101
|
-
|
|
17102
|
-
e.currentTarget.style.cursor = x < rect.width / 2 ? 'w-resize' : 'e-resize';
|
|
17103
|
-
};
|
|
17104
|
-
|
|
17105
17177
|
const handleNavSwipeTransitionEnd = useCallback((e: React.TransitionEvent<HTMLElement>) => {
|
|
17106
17178
|
if (e.propertyName !== 'transform' || !navSwipeAnimatingRef.current) return;
|
|
17107
17179
|
|
|
@@ -17137,15 +17209,18 @@ function Lightbox({
|
|
|
17137
17209
|
: phase === 'opening' || isClosing
|
|
17138
17210
|
? \`opacity \${LIGHTBOX_ANIM_MS}ms \${LIGHTBOX_EASING}\`
|
|
17139
17211
|
: 'none',
|
|
17140
|
-
pointerEvents:
|
|
17141
|
-
touchAction: isCurrentVideo && isOpen ? 'none' : undefined,
|
|
17212
|
+
pointerEvents: 'none',
|
|
17142
17213
|
zIndex: 9998,
|
|
17143
17214
|
};
|
|
17144
17215
|
|
|
17216
|
+
// over an embed with controls the overlays stop short of the player's own control bar
|
|
17217
|
+
const navOverlayInset = isCurrentEmbed && currentItem && getEmbedPlayback(currentItem).controls && finalRect
|
|
17218
|
+
? Math.min(52, finalRect.height * 0.2)
|
|
17219
|
+
: 0;
|
|
17145
17220
|
const navOverlayBaseStyle = finalRect ? {
|
|
17146
17221
|
position: 'fixed' as const,
|
|
17147
17222
|
top: finalRect.top,
|
|
17148
|
-
height: finalRect.height,
|
|
17223
|
+
height: finalRect.height - navOverlayInset,
|
|
17149
17224
|
width: finalRect.width / 2,
|
|
17150
17225
|
zIndex: 9999,
|
|
17151
17226
|
} : null;
|
|
@@ -17245,16 +17320,23 @@ function Lightbox({
|
|
|
17245
17320
|
</div>
|
|
17246
17321
|
|
|
17247
17322
|
{finalRect && currentItem && (
|
|
17248
|
-
|
|
17323
|
+
isCurrentEmbed ? (
|
|
17324
|
+
<EmbedMediaFrame
|
|
17325
|
+
key={\`\${index}-\${currentItem.assetId}\`}
|
|
17326
|
+
media={currentItem}
|
|
17327
|
+
fit={imageDisplay === 'cover' ? 'cover' : 'contain'}
|
|
17328
|
+
lazy={false}
|
|
17329
|
+
startsAtOnce
|
|
17330
|
+
style={mediaStyle}
|
|
17331
|
+
onTransitionEnd={handleNavSwipeTransitionEnd}
|
|
17332
|
+
/>
|
|
17333
|
+
) : isCurrentVideo ? (
|
|
17249
17334
|
<LightboxVideo
|
|
17250
17335
|
key={\`\${index}-\${currentItem.assetId}\`}
|
|
17251
17336
|
src={currentItem.assetId}
|
|
17252
|
-
phase={phase}
|
|
17253
17337
|
mediaRef={mediaRef as React.RefObject<HTMLVideoElement>}
|
|
17254
17338
|
mediaStyle={mediaStyle}
|
|
17255
17339
|
onLoadedMetadata={computeFinalRect}
|
|
17256
|
-
onClick={handleVideoClick}
|
|
17257
|
-
onMouseMove={handleVideoMouseMove}
|
|
17258
17340
|
onTransitionEnd={handleNavSwipeTransitionEnd}
|
|
17259
17341
|
/>
|
|
17260
17342
|
) : (
|
|
@@ -17270,7 +17352,7 @@ function Lightbox({
|
|
|
17270
17352
|
)
|
|
17271
17353
|
)}
|
|
17272
17354
|
|
|
17273
|
-
{isOpen && navOverlayBaseStyle && items.length > 1 &&
|
|
17355
|
+
{isOpen && navOverlayBaseStyle && items.length > 1 && (
|
|
17274
17356
|
<>
|
|
17275
17357
|
<div
|
|
17276
17358
|
style={{
|
|
@@ -17335,6 +17417,7 @@ function GalleryMediaItem({
|
|
|
17335
17417
|
galleryPaddingBetween = 0,
|
|
17336
17418
|
showPaddingAfter = false,
|
|
17337
17419
|
showControls = false,
|
|
17420
|
+
hasLightbox,
|
|
17338
17421
|
onMediaClick,
|
|
17339
17422
|
}: {
|
|
17340
17423
|
P: string;
|
|
@@ -17347,6 +17430,8 @@ function GalleryMediaItem({
|
|
|
17347
17430
|
galleryPaddingBetween?: number;
|
|
17348
17431
|
showPaddingAfter?: boolean;
|
|
17349
17432
|
showControls?: boolean;
|
|
17433
|
+
/** An embed then plays here as a silent loop, and as it was set to in the lightbox. */
|
|
17434
|
+
hasLightbox: boolean;
|
|
17350
17435
|
onMediaClick?: () => void;
|
|
17351
17436
|
}) {
|
|
17352
17437
|
const mediaClassName = \`\${P}-gallery-\${isVideoMedia(media) ? 'video' : 'image'}\`;
|
|
@@ -17396,7 +17481,14 @@ function GalleryMediaItem({
|
|
|
17396
17481
|
};
|
|
17397
17482
|
const galleryPaddingBetweenHeight = Math.max(galleryPaddingBetween, PADDING_HANDLE_SIZE);
|
|
17398
17483
|
|
|
17399
|
-
const mediaNode =
|
|
17484
|
+
const mediaNode = isEmbedMedia(media) ? (
|
|
17485
|
+
<EmbedMediaFrame
|
|
17486
|
+
{...mediaProps}
|
|
17487
|
+
media={media}
|
|
17488
|
+
fit={isCover ? 'cover' : 'contain'}
|
|
17489
|
+
silentLoop={hasLightbox}
|
|
17490
|
+
/>
|
|
17491
|
+
) : isVideoMedia(media) ? (
|
|
17400
17492
|
<LazyVideo
|
|
17401
17493
|
{...mediaProps}
|
|
17402
17494
|
src={media.assetId}
|
|
@@ -18339,6 +18431,7 @@ export function Mercury({
|
|
|
18339
18431
|
galleryPaddingBetween={galleryPaddingBetween}
|
|
18340
18432
|
showPaddingAfter={mediaIndex < displayItems.length - 1}
|
|
18341
18433
|
showControls={showControls}
|
|
18434
|
+
hasLightbox={lightbox === 'on'}
|
|
18342
18435
|
onMediaClick={canOpenLightbox && lightboxItemIndex >= 0
|
|
18343
18436
|
? () => openLightbox(lightboxItemsForEntry, lightboxItemIndex)
|
|
18344
18437
|
: undefined}
|
|
@@ -18390,6 +18483,7 @@ export function Mercury({
|
|
|
18390
18483
|
galleryPaddingBetween={galleryPaddingBetween}
|
|
18391
18484
|
showPaddingAfter={mediaIndex < displayItems.length - 1}
|
|
18392
18485
|
showControls={showControls}
|
|
18486
|
+
hasLightbox={lightbox === 'on'}
|
|
18393
18487
|
onMediaClick={canOpenLightbox && lightboxItemIndex >= 0
|
|
18394
18488
|
? () => openLightbox(lightboxItemsForEntry, lightboxItemIndex)
|
|
18395
18489
|
: undefined}
|
|
@@ -23428,6 +23522,7 @@ type TestimonialsSettings = {
|
|
|
23428
23522
|
import type React from 'react';
|
|
23429
23523
|
import { createPortal } from 'react-dom';
|
|
23430
23524
|
import { CommonComponentProps } from '../props';
|
|
23525
|
+
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia } from '../utils/index';
|
|
23431
23526
|
import { getContainedMediaTransformOrigin } from '../utils/getImageRect';
|
|
23432
23527
|
import { scalingValue, useScopedStyles } from '../utils/index';
|
|
23433
23528
|
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
@@ -23547,7 +23642,8 @@ function getCSS(P: string): string {
|
|
|
23547
23642
|
object-position: bottom;
|
|
23548
23643
|
}
|
|
23549
23644
|
.\${P}-item-image-hover-scale img,
|
|
23550
|
-
.\${P}-item-image-hover-scale video
|
|
23645
|
+
.\${P}-item-image-hover-scale video,
|
|
23646
|
+
.\${P}-item-image-hover-scale [data-embed-frame] {
|
|
23551
23647
|
transition: transform 0.3s ease;
|
|
23552
23648
|
}
|
|
23553
23649
|
.\${P}-item-image-hover-scale:hover {
|
|
@@ -23753,7 +23849,9 @@ export function Waterfall({
|
|
|
23753
23849
|
return style as React.CSSProperties;
|
|
23754
23850
|
})();
|
|
23755
23851
|
|
|
23756
|
-
const
|
|
23852
|
+
const hasLightbox = (settings?.lightbox ?? 'on') === 'on';
|
|
23853
|
+
// an embed in a cell that opens the lightbox plays there as it was set to, and here as a silent loop
|
|
23854
|
+
const canOpenLightbox = hasLightbox && (!isEditor || isPreviewMode || isEditMode);
|
|
23757
23855
|
const allLightboxEntries = useMemo(() => buildLightboxEntries(items), [items]);
|
|
23758
23856
|
const allMedia = useMemo(() => collectAllWaterfallMedia(items), [items]);
|
|
23759
23857
|
|
|
@@ -23857,8 +23955,22 @@ export function Waterfall({
|
|
|
23857
23955
|
objectFitMode === 'contain' ? \`\${P}-item-image-fit\` : undefined,
|
|
23858
23956
|
imageHoverClass,
|
|
23859
23957
|
].filter(Boolean).join(' ')}
|
|
23958
|
+
// a frame reports no size of its own, so the stored aspect is set here up front
|
|
23959
|
+
style={isEmbedMedia(item.image)
|
|
23960
|
+
? { [\`--\${P}-item-media-aspect\`]: String(getEmbedAspect(item.image)) } as React.CSSProperties
|
|
23961
|
+
: undefined}
|
|
23860
23962
|
>
|
|
23861
|
-
{item.image
|
|
23963
|
+
{isEmbedMedia(item.image) ? (
|
|
23964
|
+
<EmbedMediaFrame
|
|
23965
|
+
media={item.image}
|
|
23966
|
+
fit={objectFitMode}
|
|
23967
|
+
silentLoop={hasLightbox}
|
|
23968
|
+
data-waterfall-index={index}
|
|
23969
|
+
// placed the way the image rule above places a picture, inline since the frame positions itself inline
|
|
23970
|
+
style={{ ...imageStyle, position: 'absolute', left: 0, bottom: 0, width: '100%', height: '1cap' }}
|
|
23971
|
+
onClick={handleOpen}
|
|
23972
|
+
/>
|
|
23973
|
+
) : item.image.type === 'video' ? (
|
|
23862
23974
|
<LazyVideo
|
|
23863
23975
|
ref={syncFitMediaLayout}
|
|
23864
23976
|
src={item.image.assetId}
|
|
@@ -23942,8 +24054,8 @@ export function Waterfall({
|
|
|
23942
24054
|
`, V = {
|
|
23943
24055
|
[b.id]: y,
|
|
23944
24056
|
[x.id]: S,
|
|
23945
|
-
[P.id]:
|
|
23946
|
-
[v.id]:
|
|
24057
|
+
[P.id]: w,
|
|
24058
|
+
[v.id]: C,
|
|
23947
24059
|
[f.id]: $,
|
|
23948
24060
|
[h.id]: I,
|
|
23949
24061
|
[p.id]: T,
|