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