@cntrl-site/components 1.0.106-alpha.0 → 1.0.107-alpha.0

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.
Files changed (88) hide show
  1. package/dist/ClickGallerie-CYQMgrIr.js +36 -0
  2. package/dist/ClickGallerie-o2U6oyOF.mjs +272 -0
  3. package/dist/Components/ClickGallerie/ClickGallerie.d.ts +2 -1
  4. package/dist/Components/Helix/Helix.d.ts +4 -1
  5. package/dist/Components/Hive/Hive.d.ts +4 -1
  6. package/dist/Components/ImageRevealSlider/ImageRevealSlider.d.ts +2 -1
  7. package/dist/Components/List/List.d.ts +6 -2
  8. package/dist/Components/Marquee/Marquee.d.ts +6 -2
  9. package/dist/Components/MarqueeText/MarqueeText.d.ts +2 -1
  10. package/dist/Components/Mercury/Mercury.d.ts +4 -1
  11. package/dist/Components/Waterfall/WaterfallLightbox.d.ts +4 -1
  12. package/dist/Components/utils/EmbedMediaFrame.d.ts +27 -0
  13. package/dist/Components/utils/LinkWrapper.d.ts +16 -0
  14. package/dist/Components/utils/embedMedia.d.ts +40 -0
  15. package/dist/Components/utils/index.d.ts +6 -0
  16. package/dist/{ControlSlider-SiOt22l_.js → ControlSlider-Kkec-i14.js} +1 -1
  17. package/dist/{ControlSlider-pZv7H6BU.mjs → ControlSlider-LcZmviGX.mjs} +1 -1
  18. package/dist/EmbedMediaFrame-DsOTKE4i.js +1 -0
  19. package/dist/EmbedMediaFrame-DwHeOAy5.mjs +164 -0
  20. package/dist/{FAQ-C7823fyi.js → FAQ-BxhMo7T8.js} +1 -1
  21. package/dist/{FAQ-CZ39u4m8.mjs → FAQ-CdwSft5p.mjs} +1 -1
  22. package/dist/Grid-CFHTP3mb.js +378 -0
  23. package/dist/Grid-e-gLfsji.mjs +1590 -0
  24. package/dist/Helix-BpLo9FD3.js +43 -0
  25. package/dist/Helix-CidI3ucE.mjs +324 -0
  26. package/dist/{Hive-D6-R6TwM.mjs → Hive-BsmFHk2i.mjs} +505 -475
  27. package/dist/Hive-D1j6wZpV.js +321 -0
  28. package/dist/ImageRevealSlider-BuukTGAK.js +1 -0
  29. package/dist/{ImageRevealSlider-BdFGyVEP.mjs → ImageRevealSlider-Df9sygk9.mjs} +63 -70
  30. package/dist/{Lightbox-eP9qAZzL.mjs → Lightbox-C_fXsfdz.mjs} +1 -1
  31. package/dist/{Lightbox-CIss_nOG.js → Lightbox-DaunVrkp.js} +1 -1
  32. package/dist/LinkWrapper-Ca84iPtg.js +1 -0
  33. package/dist/LinkWrapper-DZs9hlOn.mjs +13 -0
  34. package/dist/{List-DW7fyJbf.mjs → List-Bh_-l9vD.mjs} +532 -520
  35. package/dist/List-DVvpQ24J.js +377 -0
  36. package/dist/Marquee-DByooiWP.mjs +578 -0
  37. package/dist/Marquee-DfIP-tIN.js +133 -0
  38. package/dist/{MarqueeText-Rzt2fJYt.mjs → MarqueeText-D6FNCe6P.mjs} +115 -114
  39. package/dist/MarqueeText-DsUiV6Zv.js +132 -0
  40. package/dist/Mercury-B-s2Kvuq.js +267 -0
  41. package/dist/Mercury-CCW0Es-s.mjs +1700 -0
  42. package/dist/PretextComponent-Dnbenstn.js +1 -0
  43. package/dist/{PretextComponent-j-OsRZTx.mjs → PretextComponent-OygSO3fr.mjs} +312 -269
  44. package/dist/{RichTextRenderer-B6WtTYlR.mjs → RichTextRenderer-BptwNpbJ.mjs} +10 -9
  45. package/dist/RichTextRenderer-K90Dd7pt.js +1 -0
  46. package/dist/{Slider20-Dm8BeCli.mjs → Slider20-CCzixTiN.mjs} +1 -1
  47. package/dist/{Slider20-C9o2REDl.js → Slider20-fMVeRfgx.js} +1 -1
  48. package/dist/{TestimonialGrid-CPu4qQ6B.mjs → TestimonialGrid-CbsVxSn9.mjs} +1 -1
  49. package/dist/{TestimonialGrid-D4ieiz9e.js → TestimonialGrid-CiCagfBU.js} +1 -1
  50. package/dist/{TestimonialSingle-DLdnAVF7.mjs → TestimonialSingle-BVm3Amrl.mjs} +1 -1
  51. package/dist/{TestimonialSingle-CVu15ZtV.js → TestimonialSingle-BWXynGjv.js} +1 -1
  52. package/dist/Waterfall-3kKioKh2.mjs +1432 -0
  53. package/dist/Waterfall-DII4-WV5.js +288 -0
  54. package/dist/{components-D2LyuDm-.mjs → components-BRmbflgg.mjs} +15 -15
  55. package/dist/components-nvbH4l0S.js +1 -0
  56. package/dist/content/postFieldBindings.d.ts +29 -0
  57. package/dist/elements.js +1 -1
  58. package/dist/elements.mjs +16 -16
  59. package/dist/elements.node.js +1 -1
  60. package/dist/elements.node.mjs +1 -1
  61. package/dist/index.d.ts +3 -1
  62. package/dist/index.js +1 -1
  63. package/dist/index.mjs +52 -15
  64. package/dist/sources.js +312 -212
  65. package/dist/sources.mjs +312 -212
  66. package/dist/types/SchemaV1.d.ts +53 -1
  67. package/dist/utils.js +1 -1
  68. package/dist/utils.mjs +30 -20
  69. package/package.json +1 -1
  70. package/dist/ClickGallerie-D7g093HX.js +0 -36
  71. package/dist/ClickGallerie-QSOQjSdv.mjs +0 -271
  72. package/dist/Grid-BBpdl60K.js +0 -374
  73. package/dist/Grid-DS53S_gA.mjs +0 -1576
  74. package/dist/Helix-BPn9V1sg.mjs +0 -315
  75. package/dist/Helix-DcgsCc4D.js +0 -43
  76. package/dist/Hive-n8Fz-j3o.js +0 -321
  77. package/dist/ImageRevealSlider-BBWtFjUF.js +0 -1
  78. package/dist/List-C32WImI3.js +0 -377
  79. package/dist/Marquee-DOIRRCu4.js +0 -133
  80. package/dist/Marquee-O_PDwlIb.mjs +0 -564
  81. package/dist/MarqueeText-DkaO2lQ5.js +0 -132
  82. package/dist/Mercury-C9D10TTT.mjs +0 -1702
  83. package/dist/Mercury-DynO-NxY.js +0 -267
  84. package/dist/PretextComponent-BnsS2zJ6.js +0 -1
  85. package/dist/RichTextRenderer-CIy6yI8U.js +0 -1
  86. package/dist/Waterfall-DC2WQ3GT.js +0 -287
  87. package/dist/Waterfall-Yud2VR62.mjs +0 -1404
  88. package/dist/components-B9Vdjf0w.js +0 -1
package/dist/sources.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./PretextComponent-BnsS2zJ6.js"),e=`import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
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: string;
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: string;
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' && img.link ? (
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
- if (media.type === 'video') return true;
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
- if (mediaList.length === 0) return null;
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
- {mediaList.map((media) => (
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
- controls={phase === 'open'}
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 isHorizontalNavActive = slideOffset !== 0 || slideAnimating;
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, mediaNaturalSize))
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: isCurrentVideo && isOpen && !isHorizontalNavActive ? 'auto' : 'none',
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
- {isVideoMedia(neighborItem) ? (
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
- {isCurrentVideo ? (
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 && !isCurrentVideo && (
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 = (item.link?.length ?? 0) > 0 && lightbox === 'off' ? item.link : undefined;
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 = itemLink ? (
6568
- <a href={itemLink} target="_blank" className={\`\${P}-item-text-link\`}>
6568
+ const alignedTextRows = (
6569
+ <LinkWrapper link={itemLink} className={\`\${P}-item-text-link\`}>
6569
6570
  {titleRow}
6570
6571
  {subtitleRow}
6571
- </a>
6572
- ) : (
6573
- <>
6574
- {titleRow}
6575
- {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
- isVideoMedia(displayMedia) ? (
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
- <a href={itemLink} target="_blank" className={\`\${P}-item-image-link\`}>
6723
- {imageContent}
6724
- </a>
6731
+ {alignedImage}
6725
6732
  </>
6726
6733
  ) : (
6727
6734
  <>
6728
- <a href={itemLink} target="_blank" className={\`\${P}-item-image-link\`}>
6729
- {imageContent}
6730
- </a>
6735
+ {alignedImage}
6731
6736
  {alignedTextRows}
6732
6737
  </>
6733
6738
  )}
6734
6739
  </>
6735
6740
  ) : itemLink ? (
6736
6741
  <>
6737
- <a href={itemLink} target="_blank" className={\`\${P}-item-image-link\`}>
6742
+ <LinkWrapper link={itemLink} className={\`\${P}-item-image-link\`}>
6738
6743
  {typeCTextBlock}
6739
6744
  {imageContent}
6740
- </a>
6745
+ </LinkWrapper>
6741
6746
  {!isTextBeforeImage && (
6742
- <a href={itemLink} target="_blank" className={\`\${P}-item-text-link\`}>
6747
+ <LinkWrapper link={itemLink} className={\`\${P}-item-text-link\`}>
6743
6748
  {typeABText}
6744
- </a>
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 = isVideoMedia(media) ? (
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
- if (mediaList.length === 0) return null;
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
- {mediaList.map((media) => (
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
- controls={phase === 'open'}
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: isCurrentVideo && isOpen && !isHorizontalNavActive ? 'auto' : 'none',
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: isOpen && !isHorizontalNavActive ? 'auto' : 'none',
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
- isCurrentVideo ? (
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?: string;
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?: string;
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,8 +14250,7 @@ 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/scalingValue';
14174
- import { useScopedStyles } from '../utils/useScopedStyles';
14253
+ import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
14175
14254
  import { NEAR_VIEWPORT_MARGIN, observeIntersection } from '../utils/observeIntersection';
14176
14255
  import { pauseVideo, playVideo, raisePreload } from '../utils/useLazyVideos';
14177
14256
 
@@ -14400,6 +14479,7 @@ const isAnyCopyOfSlotInView = (wrapper: Element, itemIndex: number): boolean =>
14400
14479
  };
14401
14480
 
14402
14481
  const isVideoMedia = (media: Pick<NonNullable<MarqueeItem['image']>, 'assetId' | 'type' | 'name'>): boolean => {
14482
+ if (isEmbedMedia(media)) return false;
14403
14483
  if (media.type === 'video') return true;
14404
14484
  if (media.type === 'image') return false;
14405
14485
  const name = media.name ?? '';
@@ -14441,11 +14521,13 @@ const MarqueeItemCard = ({
14441
14521
  }: MarqueeItemCardProps) => {
14442
14522
  const mediaRef = useRef<HTMLImageElement | HTMLVideoElement | null>(null);
14443
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));
14444
14526
 
14445
14527
  useLayoutEffect(() => {
14446
14528
  if (!isFirstSet) return;
14447
- if (isMediaReady(mediaRef.current)) onFirstSetImageDone?.();
14448
- }, [isFirstSet, item.image?.assetId, onFirstSetImageDone]);
14529
+ if (isEmbed || isMediaReady(mediaRef.current)) onFirstSetImageDone?.();
14530
+ }, [isFirstSet, isEmbed, item.image?.assetId, onFirstSetImageDone]);
14449
14531
 
14450
14532
  const isCover = imageFit.display === 'cover';
14451
14533
  const ratioValue = imageFit.ratioValue ?? '1:1';
@@ -14484,9 +14566,27 @@ const MarqueeItemCard = ({
14484
14566
  ...radiusStyle,
14485
14567
  };
14486
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
+
14487
14581
  const imageNode =
14488
14582
  item.image?.assetId &&
14489
- (isVideo ? (
14583
+ (isEmbed ? (
14584
+ <EmbedMediaFrame
14585
+ media={item.image}
14586
+ fit={isCover ? 'cover' : 'contain'}
14587
+ style={embedStyle}
14588
+ />
14589
+ ) : isVideo ? (
14490
14590
  <video
14491
14591
  ref={(el) => { mediaRef.current = el; }}
14492
14592
  src={item.image.assetId}
@@ -14541,14 +14641,11 @@ const MarqueeItemCard = ({
14541
14641
  }),
14542
14642
  }}
14543
14643
  >
14544
- {imageNode && item.link
14545
- ? (
14546
- <a href={item.link} target='_self' rel='noopener noreferrer' className={cn(\`\${P}-marquee-link\`, !isCover && \`\${P}-marquee-link-contain\`)}>
14547
- {imageNode}
14548
- </a>
14549
- )
14550
- : imageNode
14551
- }
14644
+ {imageNode && (
14645
+ <LinkWrapper link={item.link} className={cn(\`\${P}-marquee-link\`, !isCover && \`\${P}-marquee-link-contain\`)}>
14646
+ {imageNode}
14647
+ </LinkWrapper>
14648
+ )}
14552
14649
  </div>
14553
14650
  </div>
14554
14651
  );
@@ -14977,9 +15074,12 @@ export type MarqueeItem = {
14977
15074
  image?: {
14978
15075
  assetId?: string;
14979
15076
  name?: string;
14980
- type?: 'image' | 'video';
15077
+ type?: 'image' | 'video' | 'vimeo' | 'youtube';
15078
+ thumbnail?: string;
15079
+ width?: number;
15080
+ height?: number;
14981
15081
  };
14982
- link?: string;
15082
+ link?: ContentLink;
14983
15083
  };
14984
15084
 
14985
15085
  export type MarqueeSettings = {
@@ -15008,8 +15108,7 @@ type MarqueeProps = {
15008
15108
  `,g=`import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
15009
15109
  import cn from 'classnames';
15010
15110
  import { CommonComponentProps } from '../props';
15011
- import { scalingValue } from '../utils/scalingValue';
15012
- import { useScopedStyles } from '../utils/useScopedStyles';
15111
+ import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
15013
15112
  import { textStylesToCss } from '../utils/textStylesToCss';
15014
15113
  import { observeIntersection } from '../utils/observeIntersection';
15015
15114
 
@@ -15349,9 +15448,7 @@ const MarqueeTextItemView = ({ item, prefix: P, textCss, capHeightPx, opticalOff
15349
15448
  );
15350
15449
  return (
15351
15450
  <div className={\`\${P}-item\`} data-marquee-text-item style={{ gap: imageGapPx }}>
15352
- {item.link
15353
- ? <a href={item.link} className={\`\${P}-item-link\`} style={{ gap: imageGapPx }}>{content}</a>
15354
- : content}
15451
+ <LinkWrapper link={item.link} className={\`\${P}-item-link\`} style={{ gap: imageGapPx }}>{content}</LinkWrapper>
15355
15452
  </div>
15356
15453
  );
15357
15454
  };
@@ -15434,7 +15531,7 @@ export const MarqueeText = ({ settings, content, isEditor, isPreviewMode }: Marq
15434
15531
  const [ribbonHeightPx, setRibbonHeightPx] = useState(0);
15435
15532
 
15436
15533
  const contentKey = useMemo(
15437
- () => (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'),
15438
15535
  [content],
15439
15536
  );
15440
15537
  const [contentSequenceRepeat, setContentSequenceRepeat] = useState(MIN_CONTENT_SEQUENCE_REPEAT);
@@ -15915,7 +16012,7 @@ export type MarqueeTextItem = {
15915
16012
  assetId?: string;
15916
16013
  name?: string;
15917
16014
  };
15918
- link?: string;
16015
+ link?: ContentLink;
15919
16016
  };
15920
16017
 
15921
16018
  export type MarqueeTextSettings = {
@@ -15955,6 +16052,7 @@ type MarqueeTextProps = {
15955
16052
  import { createPortal } from 'react-dom';
15956
16053
  import type React from 'react';
15957
16054
  import { CommonComponentProps } from '../props';
16055
+ import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
15958
16056
  import {
15959
16057
  buildColorVars,
15960
16058
  scalingValue,
@@ -16346,8 +16444,11 @@ function getTitlePositionAxes(position: TitlePosition): TitlePositionAxes {
16346
16444
  type MercuryMedia = {
16347
16445
  assetId: string;
16348
16446
  name?: string;
16349
- type?: 'image' | 'video';
16447
+ type?: 'image' | 'video' | 'vimeo' | 'youtube';
16350
16448
  objectFit?: 'cover' | 'contain';
16449
+ thumbnail?: string;
16450
+ width?: number;
16451
+ height?: number;
16351
16452
  };
16352
16453
 
16353
16454
  type MercuryMediaPair = {
@@ -16586,21 +16687,15 @@ function resolveLightboxImageDisplay(
16586
16687
 
16587
16688
  function LightboxVideo({
16588
16689
  src,
16589
- phase,
16590
16690
  mediaRef,
16591
16691
  mediaStyle,
16592
16692
  onLoadedMetadata,
16593
- onClick,
16594
- onMouseMove,
16595
16693
  onTransitionEnd,
16596
16694
  }: {
16597
16695
  src: string;
16598
- phase: 'opening' | 'open' | 'closing';
16599
16696
  mediaRef: React.RefObject<HTMLVideoElement>;
16600
16697
  mediaStyle: React.CSSProperties;
16601
16698
  onLoadedMetadata: () => void;
16602
- onClick: (e: React.MouseEvent<HTMLVideoElement>) => void;
16603
- onMouseMove: (e: React.MouseEvent<HTMLVideoElement>) => void;
16604
16699
  onTransitionEnd: (e: React.TransitionEvent<HTMLVideoElement>) => void;
16605
16700
  }) {
16606
16701
  useEffect(() => {
@@ -16616,12 +16711,12 @@ function LightboxVideo({
16616
16711
  <video
16617
16712
  ref={mediaRef}
16618
16713
  src={src}
16619
- controls={phase === 'open'}
16714
+ muted
16715
+ autoPlay
16716
+ loop
16620
16717
  playsInline
16621
16718
  preload="auto"
16622
16719
  onLoadedMetadata={onLoadedMetadata}
16623
- onClick={onClick}
16624
- onMouseMove={onMouseMove}
16625
16720
  onTransitionEnd={onTransitionEnd}
16626
16721
  style={mediaStyle}
16627
16722
  />
@@ -16797,6 +16892,7 @@ function Lightbox({
16797
16892
  const prevIndexRef = useRef(index);
16798
16893
  const currentItem = items[index];
16799
16894
  const isCurrentVideo = currentItem ? isVideoMedia(currentItem) : false;
16895
+ const isCurrentEmbed = currentItem ? isEmbedMedia(currentItem) : false;
16800
16896
  const isHorizontalNavActive = navSwipeOffset !== 0 || navSwipeAnimating;
16801
16897
 
16802
16898
  const setNavSwipeAnimatingState = useCallback((value: boolean) => {
@@ -16833,18 +16929,22 @@ function Lightbox({
16833
16929
  return;
16834
16930
  }
16835
16931
 
16836
- if (!media) {
16837
- setFinalRect(getGhostRect(ghost));
16838
- return;
16839
- }
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
+ }
16840
16939
 
16841
- const { width: nw, height: nh } = getLightboxMediaDimensions(media);
16842
- if (!nw || !nh) {
16843
- setFinalRect(getGhostRect(ghost));
16844
- return;
16940
+ const { width: nw, height: nh } = getLightboxMediaDimensions(media);
16941
+ if (!nw || !nh) {
16942
+ setFinalRect(getGhostRect(ghost));
16943
+ return;
16944
+ }
16945
+ ir = nw / nh;
16845
16946
  }
16846
16947
 
16847
- const ir = nw / nh;
16848
16948
  const cr = cw / ch;
16849
16949
  if (ir > cr) {
16850
16950
  const dh = cw / ir;
@@ -16853,7 +16953,7 @@ function Lightbox({
16853
16953
  const dw = ch * ir;
16854
16954
  setFinalRect({ width: dw, height: ch, left: cb.left + (cw - dw) / 2, top: cb.top });
16855
16955
  }
16856
- }, [imageDisplay]);
16956
+ }, [imageDisplay, currentItem]);
16857
16957
 
16858
16958
  useEffect(() => {
16859
16959
  computeFinalRect();
@@ -17073,46 +17173,6 @@ function Lightbox({
17073
17173
  const swipeBackdropOpacity = swipeOffset > 0 ? Math.max(0, 1 - swipeOffset / 500) : 1;
17074
17174
  const swipeMediaOpacity = swipeOffset > 0 ? Math.max(0.35, 1 - swipeOffset / 500) : 1;
17075
17175
 
17076
- const handleVideoClick = (e: React.MouseEvent<HTMLVideoElement>) => {
17077
- e.stopPropagation();
17078
- if (touchInteractionRef.current) {
17079
- touchInteractionRef.current = false;
17080
- return;
17081
- }
17082
- if (items.length <= 1) return;
17083
-
17084
- const rect = e.currentTarget.getBoundingClientRect();
17085
- const y = e.clientY - rect.top;
17086
- const controlsZoneHeight = Math.min(52, rect.height * 0.2);
17087
-
17088
- if (y > rect.height - controlsZoneHeight) {
17089
- return;
17090
- }
17091
-
17092
- if (e.clientX - rect.left < rect.width / 2) {
17093
- onPrev();
17094
- return;
17095
- }
17096
-
17097
- onNext();
17098
- };
17099
-
17100
- const handleVideoMouseMove = (e: React.MouseEvent<HTMLVideoElement>) => {
17101
- if (items.length <= 1) return;
17102
-
17103
- const rect = e.currentTarget.getBoundingClientRect();
17104
- const x = e.clientX - rect.left;
17105
- const y = e.clientY - rect.top;
17106
- const controlsZoneHeight = Math.min(52, rect.height * 0.2);
17107
-
17108
- if (y > rect.height - controlsZoneHeight) {
17109
- e.currentTarget.style.cursor = 'default';
17110
- return;
17111
- }
17112
-
17113
- e.currentTarget.style.cursor = x < rect.width / 2 ? 'w-resize' : 'e-resize';
17114
- };
17115
-
17116
17176
  const handleNavSwipeTransitionEnd = useCallback((e: React.TransitionEvent<HTMLElement>) => {
17117
17177
  if (e.propertyName !== 'transform' || !navSwipeAnimatingRef.current) return;
17118
17178
 
@@ -17148,15 +17208,18 @@ function Lightbox({
17148
17208
  : phase === 'opening' || isClosing
17149
17209
  ? \`opacity \${LIGHTBOX_ANIM_MS}ms \${LIGHTBOX_EASING}\`
17150
17210
  : 'none',
17151
- pointerEvents: isCurrentVideo && isOpen && !isHorizontalNavActive ? 'auto' : 'none',
17152
- touchAction: isCurrentVideo && isOpen ? 'none' : undefined,
17211
+ pointerEvents: 'none',
17153
17212
  zIndex: 9998,
17154
17213
  };
17155
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;
17156
17219
  const navOverlayBaseStyle = finalRect ? {
17157
17220
  position: 'fixed' as const,
17158
17221
  top: finalRect.top,
17159
- height: finalRect.height,
17222
+ height: finalRect.height - navOverlayInset,
17160
17223
  width: finalRect.width / 2,
17161
17224
  zIndex: 9999,
17162
17225
  } : null;
@@ -17256,16 +17319,23 @@ function Lightbox({
17256
17319
  </div>
17257
17320
 
17258
17321
  {finalRect && currentItem && (
17259
- isCurrentVideo ? (
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 ? (
17260
17333
  <LightboxVideo
17261
17334
  key={\`\${index}-\${currentItem.assetId}\`}
17262
17335
  src={currentItem.assetId}
17263
- phase={phase}
17264
17336
  mediaRef={mediaRef as React.RefObject<HTMLVideoElement>}
17265
17337
  mediaStyle={mediaStyle}
17266
17338
  onLoadedMetadata={computeFinalRect}
17267
- onClick={handleVideoClick}
17268
- onMouseMove={handleVideoMouseMove}
17269
17339
  onTransitionEnd={handleNavSwipeTransitionEnd}
17270
17340
  />
17271
17341
  ) : (
@@ -17281,7 +17351,7 @@ function Lightbox({
17281
17351
  )
17282
17352
  )}
17283
17353
 
17284
- {isOpen && navOverlayBaseStyle && items.length > 1 && !isCurrentVideo && (
17354
+ {isOpen && navOverlayBaseStyle && items.length > 1 && (
17285
17355
  <>
17286
17356
  <div
17287
17357
  style={{
@@ -17346,6 +17416,7 @@ function GalleryMediaItem({
17346
17416
  galleryPaddingBetween = 0,
17347
17417
  showPaddingAfter = false,
17348
17418
  showControls = false,
17419
+ hasLightbox,
17349
17420
  onMediaClick,
17350
17421
  }: {
17351
17422
  P: string;
@@ -17358,6 +17429,8 @@ function GalleryMediaItem({
17358
17429
  galleryPaddingBetween?: number;
17359
17430
  showPaddingAfter?: boolean;
17360
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;
17361
17434
  onMediaClick?: () => void;
17362
17435
  }) {
17363
17436
  const mediaClassName = \`\${P}-gallery-\${isVideoMedia(media) ? 'video' : 'image'}\`;
@@ -17407,7 +17480,14 @@ function GalleryMediaItem({
17407
17480
  };
17408
17481
  const galleryPaddingBetweenHeight = Math.max(galleryPaddingBetween, PADDING_HANDLE_SIZE);
17409
17482
 
17410
- const mediaNode = isVideoMedia(media) ? (
17483
+ const mediaNode = isEmbedMedia(media) ? (
17484
+ <EmbedMediaFrame
17485
+ {...mediaProps}
17486
+ media={media}
17487
+ fit={isCover ? 'cover' : 'contain'}
17488
+ silentLoop={hasLightbox}
17489
+ />
17490
+ ) : isVideoMedia(media) ? (
17411
17491
  <LazyVideo
17412
17492
  {...mediaProps}
17413
17493
  src={media.assetId}
@@ -18350,6 +18430,7 @@ export function Mercury({
18350
18430
  galleryPaddingBetween={galleryPaddingBetween}
18351
18431
  showPaddingAfter={mediaIndex < displayItems.length - 1}
18352
18432
  showControls={showControls}
18433
+ hasLightbox={lightbox === 'on'}
18353
18434
  onMediaClick={canOpenLightbox && lightboxItemIndex >= 0
18354
18435
  ? () => openLightbox(lightboxItemsForEntry, lightboxItemIndex)
18355
18436
  : undefined}
@@ -18401,6 +18482,7 @@ export function Mercury({
18401
18482
  galleryPaddingBetween={galleryPaddingBetween}
18402
18483
  showPaddingAfter={mediaIndex < displayItems.length - 1}
18403
18484
  showControls={showControls}
18485
+ hasLightbox={lightbox === 'on'}
18404
18486
  onMediaClick={canOpenLightbox && lightboxItemIndex >= 0
18405
18487
  ? () => openLightbox(lightboxItemsForEntry, lightboxItemIndex)
18406
18488
  : undefined}
@@ -23439,6 +23521,7 @@ type TestimonialsSettings = {
23439
23521
  import type React from 'react';
23440
23522
  import { createPortal } from 'react-dom';
23441
23523
  import { CommonComponentProps } from '../props';
23524
+ import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia } from '../utils/index';
23442
23525
  import { getContainedMediaTransformOrigin } from '../utils/getImageRect';
23443
23526
  import { scalingValue, useScopedStyles } from '../utils/index';
23444
23527
  import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
@@ -23558,7 +23641,8 @@ function getCSS(P: string): string {
23558
23641
  object-position: bottom;
23559
23642
  }
23560
23643
  .\${P}-item-image-hover-scale img,
23561
- .\${P}-item-image-hover-scale video {
23644
+ .\${P}-item-image-hover-scale video,
23645
+ .\${P}-item-image-hover-scale [data-embed-frame] {
23562
23646
  transition: transform 0.3s ease;
23563
23647
  }
23564
23648
  .\${P}-item-image-hover-scale:hover {
@@ -23764,7 +23848,9 @@ export function Waterfall({
23764
23848
  return style as React.CSSProperties;
23765
23849
  })();
23766
23850
 
23767
- const canOpenLightbox = (settings?.lightbox ?? 'on') === 'on' && (!isEditor || isPreviewMode || isEditMode);
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);
23768
23854
  const allLightboxEntries = useMemo(() => buildLightboxEntries(items), [items]);
23769
23855
  const allMedia = useMemo(() => collectAllWaterfallMedia(items), [items]);
23770
23856
 
@@ -23868,8 +23954,22 @@ export function Waterfall({
23868
23954
  objectFitMode === 'contain' ? \`\${P}-item-image-fit\` : undefined,
23869
23955
  imageHoverClass,
23870
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}
23871
23961
  >
23872
- {item.image.type === 'video' ? (
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' ? (
23873
23973
  <LazyVideo
23874
23974
  ref={syncFitMediaLayout}
23875
23975
  src={item.image.assetId}