@cntrl-site/components 1.0.118-alpha.3 → 1.0.118-alpha.4

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 (69) hide show
  1. package/dist/{Burger-C3yVbQcq.js → Burger-B4kXX9aY.js} +1 -1
  2. package/dist/{Burger-BkVgNMGU.mjs → Burger-DyORh_vF.mjs} +1 -1
  3. package/dist/{ChroniclesComponent-DD3tqNNm.mjs → ChroniclesComponent-DVoJ0kdT.mjs} +442 -512
  4. package/dist/ChroniclesComponent-Nm_yIRmr.js +1 -0
  5. package/dist/Components/Grid/Grid.d.ts +7 -25
  6. package/dist/Components/PopupMenu/PopupMenu.d.ts +73 -0
  7. package/dist/Components/PopupMenu/PopupMenuComponent.d.ts +594 -0
  8. package/dist/Components/PopupMenu/popupMenuLayout.d.ts +203 -0
  9. package/dist/Components/PopupMenu/popupMenuSnap.d.ts +61 -0
  10. package/dist/Components/helpers/SvgImage/loadSvgMaskUrl.d.ts +7 -0
  11. package/dist/{ControlSlider-BBAXRDLP.mjs → ControlSlider-3w-bHQEg.mjs} +4 -3
  12. package/dist/ControlSlider-DB4nbVLT.js +1 -0
  13. package/dist/{FAQ-DLh63Utr.js → FAQ-7HEkaoU6.js} +1 -1
  14. package/dist/{FAQ-CJHCMSBa.mjs → FAQ-GmiwRdFq.mjs} +1 -1
  15. package/dist/Grid-BuRdth9A.mjs +1622 -0
  16. package/dist/Grid-tqSSYh2-.js +408 -0
  17. package/dist/{Hive-CzabuuCc.js → Hive-34KvKNsa.js} +1 -1
  18. package/dist/{Hive-DyxYd5eg.mjs → Hive-7xHXyMM1.mjs} +1 -1
  19. package/dist/{HiveLightboxTitles-DhEeFKWs.mjs → HiveLightboxTitles-BCoL46-V.mjs} +1 -1
  20. package/dist/{HiveLightboxTitles-DlyptAaK.js → HiveLightboxTitles-DEeyQGcf.js} +1 -1
  21. package/dist/{Lightbox-DZckgBzK.js → Lightbox-Cb7lyaNt.js} +1 -1
  22. package/dist/{Lightbox-BY99NS14.mjs → Lightbox-DzPqgKP4.mjs} +1 -1
  23. package/dist/{LightboxJournal-Bf_rZzmz.js → LightboxJournal-B-vul_be.js} +1 -1
  24. package/dist/{LightboxJournal-BDUs6T0B.mjs → LightboxJournal-DisD2DLv.mjs} +1 -1
  25. package/dist/{LightboxStrip-RA4ABUC-.js → LightboxStrip-YDyEPEb6.js} +1 -1
  26. package/dist/{LightboxStrip-Cuhb2fIR.mjs → LightboxStrip-wCHUhAqN.mjs} +1 -1
  27. package/dist/{Mercury-B-s2Kvuq.js → Mercury-BmhtFYOw.js} +1 -1
  28. package/dist/{Mercury-CCW0Es-s.mjs → Mercury-Q788wrYQ.mjs} +1 -1
  29. package/dist/{OnelinerForm-C2Y_XMCY.js → OnelinerForm-CUmY-bXL.js} +1 -1
  30. package/dist/{OnelinerForm-BEu7_sho.mjs → OnelinerForm-D8WIB9Qy.mjs} +1 -1
  31. package/dist/PopupMenu-CYdDyzEt.mjs +1372 -0
  32. package/dist/PopupMenu-Di1fHgho.js +409 -0
  33. package/dist/{SimpleButton-C-o2W9bS.mjs → SimpleButton-DTpzfmb6.mjs} +1 -1
  34. package/dist/{SimpleButton-nGEcO2gB.js → SimpleButton-DtaCYa3y.js} +1 -1
  35. package/dist/{Slider20-DUi6qwnd.mjs → Slider20-CKngROrc.mjs} +1 -1
  36. package/dist/{Slider20-BOmjDRf2.js → Slider20-q0iGgnE3.js} +1 -1
  37. package/dist/SvgImage-CwRq9-ec.mjs +56 -0
  38. package/dist/SvgImage-_QN8ngad.js +1 -0
  39. package/dist/{TestimonialSingle-DrnyReim.mjs → TestimonialSingle-Bax71Hyo.mjs} +1 -1
  40. package/dist/{TestimonialSingle-BORQom3u.js → TestimonialSingle-CpEUendN.js} +1 -1
  41. package/dist/{Waterfall-DII4-WV5.js → Waterfall-B9YWMhrg.js} +1 -1
  42. package/dist/{Waterfall-3kKioKh2.mjs → Waterfall-znaoynn5.mjs} +1 -1
  43. package/dist/components-BYoTPJk3.js +1 -0
  44. package/dist/{components-BwAmTGJp.mjs → components-eK82xypT.mjs} +653 -30
  45. package/dist/components.css +1 -1
  46. package/dist/elements.js +1 -1
  47. package/dist/elements.mjs +24 -24
  48. package/dist/elements.node.js +1 -1
  49. package/dist/elements.node.mjs +1 -1
  50. package/dist/index.d.ts +3 -1
  51. package/dist/index.js +1 -1
  52. package/dist/index.mjs +63 -36
  53. package/dist/loadSvgMaskUrl-B6kHUyof.js +1 -0
  54. package/dist/loadSvgMaskUrl-DUhCVvpl.mjs +39 -0
  55. package/dist/sources.js +233 -514
  56. package/dist/sources.mjs +273 -555
  57. package/dist/types/Component.d.ts +7 -0
  58. package/dist/types/SchemaV1.d.ts +3 -0
  59. package/package.json +1 -1
  60. package/dist/ChroniclesComponent-BMbUwzk6.js +0 -1
  61. package/dist/Components/Grid/CustomGridComponent.d.ts +0 -41
  62. package/dist/ControlSlider-BCkVFl4w.js +0 -1
  63. package/dist/Grid-CUaVUaRa.js +0 -441
  64. package/dist/Grid-D19xZ_mh.mjs +0 -1800
  65. package/dist/SvgImage-B5mR9y6q.mjs +0 -51
  66. package/dist/SvgImage-DFlmxAoL.js +0 -1
  67. package/dist/components-D8RelPGE.js +0 -1
  68. package/dist/loadSvgMaskUrl-DfF7ay6h.js +0 -1
  69. package/dist/loadSvgMaskUrl-xHgGYgPe.mjs +0 -20
package/dist/sources.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./ChroniclesComponent-BMbUwzk6.js"),t=`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("./ChroniclesComponent-Nm_yIRmr.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';
@@ -2683,7 +2683,7 @@ export function Burger({
2683
2683
  </div>
2684
2684
  );
2685
2685
  }
2686
- `,i=`import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
2686
+ `,t=`import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
2687
2687
  import { createPortal } from 'react-dom';
2688
2688
  import cn from 'classnames';
2689
2689
  import { CommonComponentProps } from '../props';
@@ -3730,7 +3730,7 @@ export function Chronicles({
3730
3730
  </>
3731
3731
  );
3732
3732
  }
3733
- `,o=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3733
+ `,i=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3734
3734
  import { CommonComponentProps } from '../props';
3735
3735
  import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
3736
3736
 
@@ -4259,7 +4259,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
4259
4259
  </>
4260
4260
  );
4261
4261
  }
4262
- `,r=`import { useCallback, useEffect, useMemo, useState } from 'react';
4262
+ `,o=`import { useCallback, useEffect, useMemo, useState } from 'react';
4263
4263
  import cn from 'classnames';
4264
4264
  import { CommonComponentProps } from '../props';
4265
4265
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
@@ -5003,7 +5003,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
5003
5003
  </>
5004
5004
  );
5005
5005
  }
5006
- `,a=`import React, { useMemo, useState } from 'react';
5006
+ `,r=`import React, { useMemo, useState } from 'react';
5007
5007
  import { CommonComponentProps } from '../props';
5008
5008
  import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
5009
5009
  import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
@@ -5641,7 +5641,9 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
5641
5641
  };
5642
5642
 
5643
5643
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
5644
- `,e=`import { CommonComponentProps } from '../props';
5644
+ `,a=`import { Splide, SplideSlide } from '@splidejs/react-splide';
5645
+ import '@splidejs/react-splide/css/core';
5646
+ import { CommonComponentProps } from '../props';
5645
5647
  import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
5646
5648
  import {
5647
5649
  buildColorVars,
@@ -5651,7 +5653,7 @@ import {
5651
5653
  useLazyVideos,
5652
5654
  useScopedStyles,
5653
5655
  } from '../utils/index';
5654
- import { memo, useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
5656
+ import { useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
5655
5657
  import { createPortal } from 'react-dom';
5656
5658
  import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
5657
5659
  import { SvgImage } from '../helpers/SvgImage/SvgImage';
@@ -5768,19 +5770,15 @@ function getCSS(P: string): string {
5768
5770
  width: 100%;
5769
5771
  overflow: hidden;
5770
5772
  }
5773
+ .\${P}-item-slider .splide__track {
5774
+ overflow: hidden;
5775
+ }
5771
5776
  .\${P}-item-image-link {
5772
5777
  width: 100%;
5773
5778
  display: flex;
5774
5779
  flex-direction: column;
5775
5780
  align-items: center;
5776
5781
  }
5777
- .\${P}-custom-layout .\${P}-item-image-link {
5778
- flex: 1 1 0%;
5779
- min-height: 0;
5780
- }
5781
- .\${P}-custom-layout.\${P}-text-outside .\${P}-item-image-link {
5782
- flex: none;
5783
- }
5784
5782
  .\${P}-item-text-link {
5785
5783
  display: flex;
5786
5784
  flex-direction: column;
@@ -5801,47 +5799,18 @@ function getCSS(P: string): string {
5801
5799
  display: block;
5802
5800
  max-width: 100%;
5803
5801
  }
5804
- .\${P}-item-slider {
5805
- position: relative;
5802
+ .\${P}-item-slider,
5803
+ .\${P}-item-slider .splide__track,
5804
+ .\${P}-item-slider .splide__list,
5805
+ .\${P}-item-slider .splide__slide {
5806
5806
  width: 100%;
5807
5807
  height: 100%;
5808
- overflow: hidden;
5809
5808
  }
5810
- .\${P}-item-slider-list {
5811
- position: relative;
5812
- display: flex;
5813
- flex-direction: row;
5814
- width: 100%;
5815
- height: 100%;
5816
- will-change: transform;
5817
- }
5818
- .\${P}-item-slider-list-vertical {
5819
- flex-direction: column;
5820
- }
5821
- .\${P}-item-slider-list-fade {
5822
- display: block;
5823
- will-change: auto;
5824
- }
5825
- .\${P}-item-slide {
5826
- position: relative;
5827
- flex: 0 0 100%;
5828
- width: 100%;
5829
- height: 100%;
5809
+ .\${P}-item-slider .splide__slide {
5830
5810
  display: flex;
5831
5811
  justify-content: center;
5832
5812
  align-items: center;
5833
5813
  }
5834
- .\${P}-item-slider-list-fade .\${P}-item-slide {
5835
- position: absolute;
5836
- top: 0;
5837
- left: 0;
5838
- opacity: 0;
5839
- transition: opacity \${SLIDER_TRANSITION_MS}ms \${SLIDER_EASING};
5840
- }
5841
- .\${P}-item-slider-list-fade .\${P}-item-slide-active {
5842
- opacity: 1;
5843
- z-index: 1;
5844
- }
5845
5814
  .\${P}-item-title {
5846
5815
  white-space: normal;
5847
5816
  overflow-wrap: anywhere;
@@ -5988,13 +5957,13 @@ function getCSS(P: string): string {
5988
5957
  .\${P}-image-align-bottom .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
5989
5958
  align-items: flex-end;
5990
5959
  }
5991
- .\${P}-image-align-top .\${P}-item-slider .\${P}-item-slide {
5960
+ .\${P}-image-align-top .\${P}-item-slider .splide__slide {
5992
5961
  align-items: flex-start;
5993
5962
  }
5994
- .\${P}-image-align-center .\${P}-item-slider .\${P}-item-slide {
5963
+ .\${P}-image-align-center .\${P}-item-slider .splide__slide {
5995
5964
  align-items: center;
5996
5965
  }
5997
- .\${P}-image-align-bottom .\${P}-item-slider .\${P}-item-slide {
5966
+ .\${P}-image-align-bottom .\${P}-item-slider .splide__slide {
5998
5967
  align-items: flex-end;
5999
5968
  }
6000
5969
  .\${P}-align-entries .\${P}-item {
@@ -6075,13 +6044,13 @@ function getCSS(P: string): string {
6075
6044
  .\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
6076
6045
  align-items: flex-end;
6077
6046
  }
6078
- .\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
6047
+ .\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider .splide__slide {
6079
6048
  align-items: flex-start;
6080
6049
  }
6081
- .\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
6050
+ .\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider .splide__slide {
6082
6051
  align-items: center;
6083
6052
  }
6084
- .\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
6053
+ .\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider .splide__slide {
6085
6054
  align-items: flex-end;
6086
6055
  }
6087
6056
  .\${P}-image-align-top.\${P}-align-entries .\${P}-item-image-link {
@@ -6149,9 +6118,27 @@ function pickRandomSlideDirection(): 'ltr' | 'ttb' {
6149
6118
  return Math.random() < 0.5 ? 'ltr' : 'ttb';
6150
6119
  }
6151
6120
 
6152
- function wrapSlideIndex(index: number, count: number): number {
6153
- if (count <= 0) return 0;
6154
- return ((index % count) + count) % count;
6121
+ function resumeSplideAutoplay(splide: { Components: { Autoplay?: { pause: (stop?: boolean) => void; play: () => void } } }) {
6122
+ const autoplay = splide.Components.Autoplay;
6123
+ if (!autoplay) return;
6124
+ autoplay.pause(false);
6125
+ autoplay.play();
6126
+ }
6127
+
6128
+ function handleRandomSlideMoved(splide: {
6129
+ options: { direction?: string };
6130
+ Components: { Autoplay?: { pause: (stop?: boolean) => void; play: () => void } };
6131
+ }) {
6132
+ const next = pickRandomSlideDirection();
6133
+ if (splide.options.direction !== next) {
6134
+ splide.options = { ...splide.options, direction: next };
6135
+ }
6136
+
6137
+ requestAnimationFrame(() => {
6138
+ requestAnimationFrame(() => {
6139
+ resumeSplideAutoplay(splide);
6140
+ });
6141
+ });
6155
6142
  }
6156
6143
 
6157
6144
  type GridProps = {
@@ -6191,8 +6178,6 @@ type LightboxProps = {
6191
6178
 
6192
6179
  const LIGHTBOX_ANIM_MS = 500;
6193
6180
  const SLIDER_TRANSITION_MS = 750;
6194
- const SLIDER_EASING = 'cubic-bezier(0.25, 1, 0.5, 1)';
6195
- const SLIDER_DEFAULT_INTERVAL_MS = 5000;
6196
6181
  const LIGHTBOX_EASING = 'cubic-bezier(0.22, 1, 0.36, 1)';
6197
6182
  const SWIPE_CLOSE_THRESHOLD = 72;
6198
6183
  const SWIPE_NAV_THRESHOLD = 50;
@@ -6282,7 +6267,7 @@ function collectGridLightboxMedia(content: any[]): GridMedia[] {
6282
6267
  return result;
6283
6268
  }
6284
6269
 
6285
- const LightboxMediaPreloadPool = memo(function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
6270
+ function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
6286
6271
  const [pool, setPool] = useState<HTMLDivElement | null>(null);
6287
6272
  useLazyVideos(pool, { preload: 'metadata' });
6288
6273
  // an embed's player is only ever framed where it shows
@@ -6321,7 +6306,7 @@ const LightboxMediaPreloadPool = memo(function LightboxMediaPreloadPool({ mediaL
6321
6306
  ))}
6322
6307
  </div>
6323
6308
  );
6324
- });
6309
+ }
6325
6310
 
6326
6311
  function unloadVideoElement(video: HTMLVideoElement) {
6327
6312
  video.pause();
@@ -6329,121 +6314,15 @@ function unloadVideoElement(video: HTMLVideoElement) {
6329
6314
  video.load();
6330
6315
  }
6331
6316
 
6332
- const GRID_SLIDE_CLASS = 'cntrl-grid-slide';
6333
- const GRID_SLIDE_PLAYING_CLASS = 'cntrl-grid-slide-playing';
6334
- const GRID_SLIDE_VIDEOS = \`.\${GRID_SLIDE_CLASS} video\`;
6317
+ const SPLIDE_SLIDE_VIDEOS = '.splide__slide video';
6335
6318
 
6336
6319
  function shouldPlaySlideVideo(video: HTMLVideoElement): boolean {
6337
- return video.closest(\`.\${GRID_SLIDE_PLAYING_CLASS}\`) !== null;
6338
- }
6339
-
6340
- type GridEntrySliderProps = {
6341
- prefix: string;
6342
- slides: React.ReactNode[];
6343
- isFade: boolean;
6344
- direction: GridSettings['direction'];
6345
- intervalMs: number;
6346
- };
6347
-
6348
- function GridEntrySlider({ prefix: P, slides, isFade, direction, intervalMs }: GridEntrySliderProps) {
6349
- const count = slides.length;
6350
- const hasClones = !isFade && count > 1;
6351
- const isRandom = !isFade && direction === 'random';
6352
- const delayMs = Number.isFinite(intervalMs) && intervalMs > 0 ? intervalMs : SLIDER_DEFAULT_INTERVAL_MS;
6353
- const [position, setPosition] = useState(hasClones ? 1 : 0);
6354
- const [axis, setAxis] = useState<'ltr' | 'ttb'>(!isFade && direction === 'vertical' ? 'ttb' : 'ltr');
6355
- const [isMoving, setIsMoving] = useState(false);
6356
- const [skipTransition, setSkipTransition] = useState(false);
6357
- const [cycle, setCycle] = useState(0);
6358
- const isMovingRef = useRef(false);
6359
-
6360
- useEffect(() => {
6361
- if (count < 2) return;
6362
- const timeoutId = window.setTimeout(() => {
6363
- if (isMovingRef.current) {
6364
- setCycle(prev => prev + 1);
6365
- return;
6366
- }
6367
- isMovingRef.current = true;
6368
- setIsMoving(true);
6369
- setSkipTransition(false);
6370
- setPosition(prev => (hasClones ? prev + 1 : wrapSlideIndex(prev + 1, count)));
6371
- if (!isRandom) setCycle(prev => prev + 1);
6372
- }, delayMs);
6373
- return () => window.clearTimeout(timeoutId);
6374
- }, [count, cycle, delayMs, hasClones, isRandom]);
6375
-
6376
- useEffect(() => {
6377
- if (!isMoving) return;
6378
- const timeoutId = window.setTimeout(() => {
6379
- const isOnClone = hasClones && position === count + 1;
6380
- const nextAxis = isRandom ? pickRandomSlideDirection() : axis;
6381
- if (isOnClone || nextAxis !== axis) {
6382
- setSkipTransition(true);
6383
- if (isOnClone) setPosition(1);
6384
- setAxis(nextAxis);
6385
- }
6386
- isMovingRef.current = false;
6387
- setIsMoving(false);
6388
- if (isRandom) setCycle(prev => prev + 1);
6389
- }, SLIDER_TRANSITION_MS);
6390
- return () => window.clearTimeout(timeoutId);
6391
- }, [axis, count, hasClones, isMoving, isRandom, position]);
6392
-
6393
- useEffect(() => {
6394
- if (!skipTransition) return;
6395
- let innerId = 0;
6396
- const outerId = requestAnimationFrame(() => {
6397
- innerId = requestAnimationFrame(() => setSkipTransition(false));
6398
- });
6399
- return () => {
6400
- cancelAnimationFrame(outerId);
6401
- cancelAnimationFrame(innerId);
6402
- };
6403
- }, [skipTransition]);
6404
-
6405
- const slotsCount = hasClones ? count + 2 : count;
6406
- const getItemIndex = (slot: number) => (hasClones ? wrapSlideIndex(slot - 1, count) : slot);
6407
- const isCloneSlot = (slot: number) => hasClones && (slot === 0 || slot === count + 1);
6408
- const activeIndex = getItemIndex(position);
6409
- const nextSlot = position + 1 < slotsCount ? position + 1 : -1;
6410
- const isPlayingSlot = (slot: number) => isFade
6411
- || (slot === position && !isCloneSlot(slot))
6412
- || slot === nextSlot
6413
- || (nextSlot >= 0 && !isCloneSlot(slot) && getItemIndex(slot) === getItemIndex(nextSlot));
6414
- const isVertical = !isFade && axis === 'ttb';
6415
- const listStyle: React.CSSProperties | undefined = isFade
6416
- ? undefined
6417
- : {
6418
- transform: isVertical
6419
- ? \`translate3d(0, \${-position * 100}%, 0)\`
6420
- : \`translate3d(\${-position * 100}%, 0, 0)\`,
6421
- transition: skipTransition ? 'none' : \`transform \${SLIDER_TRANSITION_MS}ms \${SLIDER_EASING}\`,
6422
- };
6423
-
6424
- return (
6425
- <div className={\`\${P}-item-slider\`}>
6426
- <div
6427
- className={\`\${P}-item-slider-list\${isFade ? \` \${P}-item-slider-list-fade\` : ''}\${isVertical ? \` \${P}-item-slider-list-vertical\` : ''}\`}
6428
- style={listStyle}
6429
- >
6430
- {Array.from({ length: slotsCount }, (_, slot) => {
6431
- const itemIndex = getItemIndex(slot);
6432
- const isClone = isCloneSlot(slot);
6433
- const isShown = isFade ? itemIndex === activeIndex : slot === position;
6434
- return (
6435
- <div
6436
- key={isClone ? \`clone-\${slot === 0 ? 'start' : 'end'}\` : \`slide-\${itemIndex}\`}
6437
- className={\`\${P}-item-slide \${GRID_SLIDE_CLASS}\${isFade && isShown ? \` \${P}-item-slide-active\` : ''}\${isPlayingSlot(slot) ? \` \${GRID_SLIDE_PLAYING_CLASS}\` : ''}\`}
6438
- aria-hidden={isShown ? undefined : true}
6439
- >
6440
- {slides[itemIndex]}
6441
- </div>
6442
- );
6443
- })}
6444
- </div>
6445
- </div>
6446
- );
6320
+ if (video.closest('.splide--fade, .splide__slide.is-active:not(.splide__slide--clone), .splide__slide.is-next')) return true;
6321
+ const slide = video.closest<HTMLElement>('.splide__slide');
6322
+ if (!slide || slide.classList.contains('splide__slide--clone')) return false;
6323
+ const slideIndex = slide.dataset.slideIndex;
6324
+ const upcomingSlide = slide.parentElement?.querySelector<HTMLElement>('.splide__slide.is-next');
6325
+ return slideIndex !== undefined && upcomingSlide?.dataset.slideIndex === slideIndex;
6447
6326
  }
6448
6327
 
6449
6328
  function GridMediaItem({
@@ -6451,7 +6330,7 @@ function GridMediaItem({
6451
6330
  className,
6452
6331
  style,
6453
6332
  hasLightbox,
6454
- isSliderSlide = false,
6333
+ isSplideSlide = false,
6455
6334
  onMediaClick,
6456
6335
  }: {
6457
6336
  media: GridMedia;
@@ -6459,7 +6338,7 @@ function GridMediaItem({
6459
6338
  style: React.CSSProperties;
6460
6339
  /** An embed then plays here as a silent loop, and as it was set to in the lightbox. */
6461
6340
  hasLightbox: boolean;
6462
- isSliderSlide?: boolean;
6341
+ isSplideSlide?: boolean;
6463
6342
  onMediaClick?: (e: React.MouseEvent<HTMLElement>) => void;
6464
6343
  }) {
6465
6344
  if (isEmbedMedia(media)) {
@@ -6491,7 +6370,7 @@ function GridMediaItem({
6491
6370
  playsInline: true,
6492
6371
  onClick: onMediaClick,
6493
6372
  };
6494
- return isSliderSlide
6373
+ return isSplideSlide
6495
6374
  ? <video {...videoProps} preload='none' />
6496
6375
  : <LazyVideo {...videoProps} autoPlay />;
6497
6376
  }
@@ -6520,7 +6399,7 @@ function GridItemMediaWrapper({
6520
6399
  children: React.ReactNode;
6521
6400
  }) {
6522
6401
  const [wrapper, setWrapper] = useState<HTMLDivElement | null>(null);
6523
- useLazyVideos(wrapper, { autoPlay: true, selector: GRID_SLIDE_VIDEOS, shouldPlay: shouldPlaySlideVideo });
6402
+ useLazyVideos(wrapper, { autoPlay: true, selector: SPLIDE_SLIDE_VIDEOS, shouldPlay: shouldPlaySlideVideo });
6524
6403
 
6525
6404
  return (
6526
6405
  <div ref={setWrapper} className={className} style={style}>
@@ -7421,108 +7300,11 @@ function resolveLightboxImageDisplay(
7421
7300
  return value?.display === 'cover' ? 'cover' : 'fit';
7422
7301
  }
7423
7302
 
7424
- function getCustomGridSpanWidth(layout: CustomGridLayout, span: number): number {
7425
- return layout.columnWidth * span + layout.gutterWidth * Math.max(0, span - 1);
7426
- }
7427
-
7428
- type CustomGridSlot = {
7429
- column: number;
7430
- span: number;
7431
- width: number;
7432
- top: number;
7433
- height: number;
7434
- gridColumn: string;
7435
- };
7436
-
7437
- function getCustomGridBlocksBottom(layout: CustomGridLayout): number {
7438
- return layout.blocks.reduce((bottom, block) => Math.max(bottom, Math.max(0, block.top) + Math.max(0, block.height)), 0);
7439
- }
7440
-
7441
- function getCustomGridVerticalGap(layout: CustomGridLayout): number {
7442
- if (typeof layout.verticalGap === 'number') return Math.max(0, layout.verticalGap);
7443
- return Math.max(0, (layout.repeatHeight ?? 0) - getCustomGridBlocksBottom(layout));
7444
- }
7445
-
7446
- function getCustomGridSlot(layout: CustomGridLayout, index: number): CustomGridSlot {
7447
- const block = layout.blocks[index % layout.blocks.length];
7448
- const span = Math.min(Math.max(1, Math.round(block.span)), layout.columnsCount);
7449
- const column = Math.min(Math.max(0, Math.round(block.column)), layout.columnsCount - span);
7450
- return {
7451
- column,
7452
- span,
7453
- width: getCustomGridSpanWidth(layout, span),
7454
- top: Math.max(0, block.top),
7455
- height: Math.max(0, block.height),
7456
- gridColumn: \`\${column + 1} / span \${span}\`,
7457
- };
7458
- }
7459
-
7460
- const EDGE_TOLERANCE = 1e-6;
7461
-
7462
- function getCustomGridRows(layout: CustomGridLayout, entriesCount: number, entryHeights?: number[]) {
7463
- const beat = layout.beat ?? 0;
7464
- const onBeats = beat > 0 && !!entryHeights;
7465
- const snapUp = (value: number) => Math.ceil(value / beat - 1e-3) * beat;
7466
- const tracks: (number | 'auto')[] = [];
7467
- const gridRows: string[] = [];
7468
- const verticalGap = getCustomGridVerticalGap(layout);
7469
- for (let groupStart = 0; groupStart < entriesCount; groupStart += layout.blocks.length) {
7470
- if (groupStart > 0 && verticalGap > 0) tracks.push(verticalGap);
7471
- const slots = Array.from(
7472
- { length: Math.min(layout.blocks.length, entriesCount - groupStart) },
7473
- (_, index) => getCustomGridSlot(layout, groupStart + index),
7474
- );
7475
- const ends = slots.map((slot) => {
7476
- const under = slots.filter(other => other.column < slot.column + slot.span
7477
- && slot.column < other.column + other.span
7478
- && other.top >= slot.top + slot.height - EDGE_TOLERANCE);
7479
- return under.length > 0 ? Math.min(...under.map(other => other.top)) : undefined;
7480
- });
7481
- const tops = [0, ...slots.map(slot => slot.top)]
7482
- .sort((a, b) => a - b)
7483
- .filter((top, index, sorted) => index === 0 || top - sorted[index - 1] > EDGE_TOLERANCE);
7484
- const isSame = (a: number, b: number) => Math.abs(a - b) <= EDGE_TOLERANCE;
7485
- const getTop = (value: number) => tops.findIndex(top => isSame(top, value));
7486
- const positions: number[] = [];
7487
- let position = 0;
7488
- const pushContentTrack = (isEnding: (end: number | undefined) => boolean) => {
7489
- const ending = slots.flatMap((slot, index) => (isEnding(ends[index]) ? [{ slot, entry: groupStart + index }] : []));
7490
- if (ending.length === 0) return;
7491
- if (!onBeats) {
7492
- tracks.push('auto');
7493
- return;
7494
- }
7495
- const needed = Math.max(...ending.map(({ slot, entry }) => positions[getTop(slot.top)] + (entryHeights[entry] ?? 0)));
7496
- const track = Math.max(0, snapUp(needed) - position);
7497
- tracks.push(track);
7498
- position += track;
7499
- };
7500
- const lines = tops.map((top, index) => {
7501
- if (index > 0) {
7502
- tracks.push(top - tops[index - 1]);
7503
- position += top - tops[index - 1];
7504
- }
7505
- pushContentTrack(end => end !== undefined && isSame(end, top));
7506
- positions.push(position);
7507
- return tracks.length + 1;
7508
- });
7509
- pushContentTrack(end => end === undefined);
7510
- const groupEnd = tracks.length + 1;
7511
- const getLine = (value: number) => lines[getTop(value)];
7512
- slots.forEach((slot, index) => {
7513
- const end = ends[index];
7514
- gridRows.push(\`\${getLine(slot.top)} / \${end === undefined ? groupEnd : getLine(end)}\`);
7515
- });
7516
- }
7517
- return { tracks, gridRows };
7518
- }
7519
-
7520
7303
  export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, metadata, activeEvent, layoutId, portalId }: GridProps) {
7521
7304
  const { prefix: P } = useScopedStyles();
7522
7305
  const {
7523
7306
  type = 'a',
7524
7307
  gridLayout,
7525
- customGrid,
7526
7308
  textBoxWidth = 100,
7527
7309
  verticalGap,
7528
7310
  entriesCount,
@@ -7570,69 +7352,62 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7570
7352
  hover = 'none',
7571
7353
  alignEntries = 'off',
7572
7354
  align = 'top',
7573
- textGrowth = 'inside',
7574
7355
  } = settings;
7575
7356
 
7576
- const titleTextStyle = useMemo(() => ({
7577
- ...omitTextColors(textStylesToCss({
7578
- fontSettings: {
7579
- fontFamily: titleFontFamily,
7580
- fontWeight: titleFontSettings?.fontWeight ?? 400,
7581
- fontStyle: titleFontSettings?.fontStyle ?? 'normal',
7582
- },
7583
- fontSize: titleFontSize ?? 0.01,
7584
- lineHeight: titleLineHeight,
7585
- letterSpacing: titleLetterSpacing ?? 0,
7586
- wordSpacing: titleWordSpacing ?? 0,
7587
- textAppearance: titleTextAppearance,
7588
- color: titleColor,
7589
- }, isEditor)),
7590
- ...getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor),
7591
- } as React.CSSProperties), [
7592
- titleFontFamily, titleFontSettings, titleFontSize, titleLineHeight, titleLetterSpacing,
7593
- titleWordSpacing, titleTextAppearance, titleColor, isEditor, P,
7594
- ]);
7357
+ const resolvedTitleTextStyle: TextStyles = {
7358
+ fontSettings: {
7359
+ fontFamily: titleFontFamily,
7360
+ fontWeight: titleFontSettings?.fontWeight ?? 400,
7361
+ fontStyle: titleFontSettings?.fontStyle ?? 'normal',
7362
+ },
7363
+ fontSize: titleFontSize ?? 0.01,
7364
+ lineHeight: titleLineHeight,
7365
+ letterSpacing: titleLetterSpacing ?? 0,
7366
+ wordSpacing: titleWordSpacing ?? 0,
7367
+ textAppearance: titleTextAppearance,
7368
+ color: titleColor,
7369
+ };
7370
+ const titleTypographyCss = omitTextColors(textStylesToCss(resolvedTitleTextStyle, isEditor));
7371
+ const titleFieldCss = {
7372
+ ...titleTypographyCss,
7373
+ } as React.CSSProperties;
7595
7374
 
7596
- const subtitleTextStyle = useMemo(() => ({
7597
- ...omitTextColors(textStylesToCss({
7598
- fontSettings: {
7599
- fontFamily: subtitleFontFamily,
7600
- fontWeight: subtitleFontSettings?.fontWeight ?? 400,
7601
- fontStyle: subtitleFontSettings?.fontStyle ?? 'normal',
7602
- },
7603
- fontSize: subtitleFontSize ?? 0.01,
7604
- lineHeight: subtitleLineHeight,
7605
- letterSpacing: subtitleLetterSpacing ?? 0,
7606
- wordSpacing: subtitleWordSpacing ?? 0,
7607
- textAppearance: subtitleTextAppearance,
7608
- color: subtitleColor,
7609
- }, isEditor)),
7610
- ...getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor),
7611
- } as React.CSSProperties), [
7612
- subtitleFontFamily, subtitleFontSettings, subtitleFontSize, subtitleLineHeight, subtitleLetterSpacing,
7613
- subtitleWordSpacing, subtitleTextAppearance, subtitleColor, isEditor, P,
7614
- ]);
7375
+ const resolvedSubtitleTextStyle: TextStyles = {
7376
+ fontSettings: {
7377
+ fontFamily: subtitleFontFamily,
7378
+ fontWeight: subtitleFontSettings?.fontWeight ?? 400,
7379
+ fontStyle: subtitleFontSettings?.fontStyle ?? 'normal',
7380
+ },
7381
+ fontSize: subtitleFontSize ?? 0.01,
7382
+ lineHeight: subtitleLineHeight,
7383
+ letterSpacing: subtitleLetterSpacing ?? 0,
7384
+ wordSpacing: subtitleWordSpacing ?? 0,
7385
+ textAppearance: subtitleTextAppearance,
7386
+ color: subtitleColor,
7387
+ };
7388
+ const subtitleTypographyCss = omitTextColors(textStylesToCss(resolvedSubtitleTextStyle, isEditor));
7389
+ const subtitleFieldCss = {
7390
+ ...subtitleTypographyCss,
7391
+ } as React.CSSProperties;
7615
7392
 
7616
- const lightboxCounterFieldCss = useMemo(() => ({
7617
- ...omitTextColors(textStylesToCss({
7618
- fontSettings: {
7619
- fontFamily: lightboxCounterFontFamily,
7620
- fontWeight: lightboxCounterFontSettings?.fontWeight ?? 400,
7621
- fontStyle: lightboxCounterFontSettings?.fontStyle ?? 'normal',
7622
- },
7623
- fontSize: lightboxCounterFontSize ?? 0.01,
7624
- lineHeight: lightboxCounterLineHeight,
7625
- letterSpacing: lightboxCounterLetterSpacing ?? 0,
7626
- wordSpacing: lightboxCounterWordSpacing ?? 0,
7627
- textAppearance: lightboxCounterTextAppearance,
7628
- color: lightboxCounterColor,
7629
- }, isEditor)),
7393
+ const resolvedLightboxCounterTextStyle: TextStyles = {
7394
+ fontSettings: {
7395
+ fontFamily: lightboxCounterFontFamily,
7396
+ fontWeight: lightboxCounterFontSettings?.fontWeight ?? 400,
7397
+ fontStyle: lightboxCounterFontSettings?.fontStyle ?? 'normal',
7398
+ },
7399
+ fontSize: lightboxCounterFontSize ?? 0.01,
7400
+ lineHeight: lightboxCounterLineHeight,
7401
+ letterSpacing: lightboxCounterLetterSpacing ?? 0,
7402
+ wordSpacing: lightboxCounterWordSpacing ?? 0,
7403
+ textAppearance: lightboxCounterTextAppearance,
7404
+ color: lightboxCounterColor,
7405
+ };
7406
+ const lightboxCounterTypographyCss = omitTextColors(textStylesToCss(resolvedLightboxCounterTextStyle, isEditor));
7407
+ const lightboxCounterFieldCss = {
7408
+ ...lightboxCounterTypographyCss,
7630
7409
  ...getGridTextLeadingVars(lightboxCounterFontSize, lightboxCounterLineHeight, P, isEditor),
7631
- } as React.CSSProperties), [
7632
- lightboxCounterFontFamily, lightboxCounterFontSettings, lightboxCounterFontSize, lightboxCounterLineHeight,
7633
- lightboxCounterLetterSpacing, lightboxCounterWordSpacing, lightboxCounterTextAppearance, lightboxCounterColor,
7634
- isEditor, P,
7635
- ]);
7410
+ } as React.CSSProperties;
7636
7411
 
7637
7412
  const titleTextClassName = getGridTextClassName(
7638
7413
  titleFontSize,
@@ -7646,6 +7421,8 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7646
7421
  \`\${P}-item-subtitle\`,
7647
7422
  \`\${P}-text-tight-leading\`,
7648
7423
  );
7424
+ const titleTextLeadingVars = getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor);
7425
+ const subtitleTextLeadingVars = getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor);
7649
7426
  const lightboxCounterClassName = getGridTextClassName(
7650
7427
  lightboxCounterFontSize,
7651
7428
  lightboxCounterLineHeight,
@@ -7653,56 +7430,42 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7653
7430
  \`\${P}-text-tight-leading\`,
7654
7431
  );
7655
7432
 
7656
- const colorVars = useMemo(() => buildColorVars(P, {
7433
+ const colorVars = buildColorVars(P, {
7657
7434
  titleColor,
7658
7435
  subtitleColor,
7659
7436
  lightboxCounterColor,
7660
- }, COLOR_VAR_MAP, STATE_KEYS), [P, titleColor, subtitleColor, lightboxCounterColor]);
7437
+ }, COLOR_VAR_MAP, STATE_KEYS);
7661
7438
 
7662
7439
  const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
7663
7440
  const showTextOnHover = showText === 'on hover' && (!isEditor || isPreviewMode);
7664
7441
  const hoverEffectClass = hover !== 'none' && (!isEditor || isPreviewMode) ? \` \${P}-hover-\${hover}\` : '';
7665
7442
  const wrapperStateClasses = \`\${stateClass}\${showTextOnHover ? \` \${P}-show-text-hover\` : ''}\${hoverEffectClass}\`.trim();
7666
7443
 
7667
- const customLayout = customGrid && Array.isArray(customGrid.blocks) && customGrid.blocks.length > 0 ? customGrid : undefined;
7668
- const resEntriesCount = customLayout || entriesCount === 0 ? Infinity : entriesCount;
7669
- const isTextOutside = !!customLayout && textGrowth === 'outside';
7670
- const itemInnerRefs = useRef<(HTMLDivElement | null)[]>([]);
7671
- const [customEntryHeights, setCustomEntryHeights] = useState<number[]>([]);
7444
+ const resEntriesCount = entriesCount === 0 ? Infinity : entriesCount;
7672
7445
 
7673
- const cropContent = useMemo<any[]>(() => (content ?? []).slice(0, resEntriesCount), [content, resEntriesCount]);
7446
+ const cropContent = (content ?? []).slice(0, resEntriesCount);
7674
7447
  const lightboxMediaToPreload = useMemo(
7675
7448
  () => (lightbox === 'on' ? collectGridLightboxMedia(cropContent) : []),
7676
7449
  [cropContent, lightbox],
7677
7450
  );
7678
- const entriesMedia = useMemo(() => cropContent.map((item: any) => {
7679
- const displayItems = getGridDisplayItems(item.gallery);
7680
- const lightboxItemsForEntry = displayItems
7681
- .filter(entry => entry.lightboxMedia)
7682
- .map(entry => entry.lightboxMedia!);
7683
- const lightboxIndexes = displayItems.map(({ lightboxMedia }) => (lightboxMedia
7684
- ? lightboxItemsForEntry.findIndex(media => media.assetId === lightboxMedia.assetId)
7685
- : -1));
7686
- return { displayItems, lightboxItemsForEntry, lightboxIndexes };
7687
- }), [cropContent]);
7688
-
7689
- const size = gridLayout?.entryWidth ?? 0.2;
7690
-
7691
- const imageDisplaySettings = typeof imageDisplay === 'string' ? { display: imageDisplay } : imageDisplay;
7692
- const isCover = imageDisplaySettings?.display === 'cover';
7693
- const ratioValue = imageDisplaySettings?.ratioValue ?? '1:1';
7694
- const ratioReversed = imageDisplaySettings?.reversed ?? false;
7451
+
7452
+ const size = gridLayout.entryWidth ?? 0.2;
7453
+
7454
+ const isCover = imageDisplay?.display === 'cover';
7455
+ const ratioValue = imageDisplay?.ratioValue ?? '1:1';
7456
+ const ratioReversed = imageDisplay?.reversed ?? false;
7695
7457
  const [rW, rH] = ratioValue.split(':').map(Number);
7696
7458
  const effW = ratioReversed ? rH : rW;
7697
7459
  const effH = ratioReversed ? rW : rH;
7698
7460
  const aspectRatio = \`\${effW} / \${effH}\`;
7699
7461
 
7700
- const columnsCount = gridLayout?.columnsCount ?? 1;
7462
+ const columnsCount = gridLayout.columnsCount;
7701
7463
  const entryWidthScaled = scalingValue(size ?? 0, isEditor);
7702
- const isFitSlider = !customLayout && !isCover && slider !== 'off';
7464
+ const imageWrapperWidth = entryWidthScaled;
7465
+ const isFitSlider = !isCover && slider !== 'off';
7703
7466
 
7704
7467
  const itemsInLastRow = cropContent.length % columnsCount || columnsCount;
7705
- const isPartialLastRow = !customLayout && itemsInLastRow < columnsCount && cropContent.length > 0;
7468
+ const isPartialLastRow = itemsInLastRow < columnsCount && cropContent.length > 0;
7706
7469
  const lastRowStartIndex = cropContent.length - itemsInLastRow;
7707
7470
  const lastRowStartColumn = isPartialLastRow
7708
7471
  ? Math.floor((columnsCount - itemsInLastRow) / 2) + 1
@@ -7710,21 +7473,19 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7710
7473
 
7711
7474
  const imageBorderRadius = imageCorners ? scalingValue(imageCorners, isEditor) : undefined;
7712
7475
 
7713
- const getImageWrapperStyle = (entryWidth: string, slot?: CustomGridSlot): React.CSSProperties => ({
7714
- width: entryWidth,
7715
- ...(slot
7716
- ? isTextOutside
7717
- ? { height: scalingValue(slot.height, isEditor), flexShrink: 0, overflow: 'hidden' }
7718
- : { flex: '1 1 0%', minHeight: 0, overflow: 'hidden' }
7719
- : isCover
7720
- ? { aspectRatio, height: 'auto', overflow: 'hidden' }
7721
- : { height: 'auto' }),
7476
+ const imageWrapperStyle: React.CSSProperties = {
7477
+ width: imageWrapperWidth,
7478
+ ...(isCover
7479
+ ? { aspectRatio, height: 'auto', overflow: 'hidden' }
7480
+ : { height: 'auto' }),
7722
7481
  ...(imageBorderRadius ? { borderRadius: imageBorderRadius, overflow: 'hidden' } : {}),
7723
- });
7482
+ };
7724
7483
 
7725
7484
  const imageWrapperClassName = \`\${P}-item-image-wrapper\${isFitSlider ? \` \${P}-item-image-wrapper-fit-slider\` : ''}\`.trim();
7726
7485
  const isTextBeforeImage = type === 'd' || type === 'e' || type === 'f';
7727
- const shouldAlignEntries = !customLayout && alignEntries === 'on';
7486
+ const shouldAlignEntries = alignEntries === 'on';
7487
+ const textBoxWidthStyle = \`calc(\${scalingValue(size ?? 0, isEditor)} * (\${textBoxWidth} / 100))\`;
7488
+ const controlWidthStyle = scalingValue(size * textBoxWidth / 100, isEditor);
7728
7489
 
7729
7490
  const imageRadiusStyle = imageBorderRadius
7730
7491
  ? { borderRadius: imageBorderRadius, [MEDIA_RADIUS_VAR]: imageBorderRadius } as React.CSSProperties
@@ -7744,73 +7505,31 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7744
7505
  width: 'auto',
7745
7506
  height: 'auto',
7746
7507
  maxWidth: '100%',
7747
- ...(customLayout ? { maxHeight: '100%' } : {}),
7748
7508
  ...imageRadiusStyle,
7749
7509
  };
7750
7510
 
7751
- const shouldMeasureEntries = (customLayout?.beat ?? 0) > 0;
7752
- const customGridWidth = customLayout ? getCustomGridSpanWidth(customLayout, customLayout.columnsCount) : 0;
7753
- useLayoutEffect(() => {
7754
- if (!shouldMeasureEntries) {
7755
- setCustomEntryHeights(prev => (prev.length > 0 ? [] : prev));
7756
- return;
7757
- }
7758
- const wrapper = containerRef.current;
7759
- const inners = itemInnerRefs.current.slice(0, cropContent.length);
7760
- const measure = () => {
7761
- const unit = wrapper && customGridWidth > 0 ? wrapper.offsetWidth / customGridWidth : 0;
7762
- if (unit <= 0) return;
7763
- const heights = inners.map(inner => (inner ? inner.offsetHeight / unit : 0));
7764
- setCustomEntryHeights(prev => (
7765
- prev.length === heights.length && prev.every((height, index) => Math.abs(height - heights[index]) < 1e-5)
7766
- ? prev
7767
- : heights
7768
- ));
7769
- };
7770
- measure();
7771
- const ro = new ResizeObserver(measure);
7772
- if (wrapper) ro.observe(wrapper);
7773
- inners.forEach(inner => inner && ro.observe(inner));
7774
- return () => ro.disconnect();
7775
- }, [shouldMeasureEntries, cropContent.length, customGridWidth, P]);
7776
- const measuredEntryHeights = shouldMeasureEntries && customEntryHeights.length === cropContent.length
7777
- ? customEntryHeights
7778
- : undefined;
7779
- const customRows = useMemo(() => {
7780
- if (!customLayout) return undefined;
7781
- const rows = getCustomGridRows(customLayout, cropContent.length, measuredEntryHeights);
7782
- return {
7783
- gridRows: rows.gridRows,
7784
- gridTemplateRows: rows.tracks.length
7785
- ? rows.tracks.map(track => (track === 'auto' ? 'auto' : scalingValue(track, isEditor))).join(' ')
7786
- : 'auto',
7787
- };
7788
- }, [customLayout, cropContent.length, measuredEntryHeights, isEditor]);
7789
- const customSlots = useMemo(
7790
- () => (customLayout ? cropContent.map((_, index) => getCustomGridSlot(customLayout, index)) : undefined),
7791
- [customLayout, cropContent.length],
7792
- );
7793
- const wrapperLayoutStyle: React.CSSProperties = customLayout
7794
- ? {
7795
- gridTemplateColumns: \`repeat(\${customLayout.columnsCount}, \${scalingValue(customLayout.columnWidth, isEditor)})\`,
7796
- gridTemplateRows: customRows?.gridTemplateRows ?? 'auto',
7797
- rowGap: 0,
7798
- columnGap: scalingValue(customLayout.gutterWidth, isEditor),
7799
- width: scalingValue(getCustomGridSpanWidth(customLayout, customLayout.columnsCount), isEditor),
7800
- }
7801
- : {
7802
- gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
7803
- rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
7804
- columnGap: scalingValue(gridLayout?.horizontalGap ?? 0, isEditor),
7805
- width: scalingValue(gridLayout?.wrapperWidth ?? 0, isEditor),
7806
- ...(shouldAlignEntries
7807
- ? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
7808
- : {}),
7809
- };
7810
-
7511
+ const [containerWidth, setContainerWidth] = useState(0);
7811
7512
  const containerRef = useRef<HTMLDivElement>(null);
7812
7513
 
7813
- const getLightboxPortalStyle = (): React.CSSProperties => {
7514
+ const resolvedSplideDirection = transition === 'fade'
7515
+ ? 'ltr'
7516
+ : direction === 'horizontal'
7517
+ ? 'ltr'
7518
+ : direction === 'vertical'
7519
+ ? 'ttb'
7520
+ : 'ltr';
7521
+
7522
+ useEffect(() => {
7523
+ const el = containerRef.current;
7524
+ if (!el) return;
7525
+ const ro = new ResizeObserver((entries) => {
7526
+ setContainerWidth(Math.round(entries[0].contentRect.width));
7527
+ });
7528
+ ro.observe(el);
7529
+ return () => ro.disconnect();
7530
+ }, []);
7531
+
7532
+ const lightboxPortalStyle = (() => {
7814
7533
  const style: Record<string, string> = { ...(colorVars as Record<string, string>) };
7815
7534
  const articleWidth = containerRef.current
7816
7535
  ? getComputedStyle(containerRef.current).getPropertyValue('--cntrl-article-width').trim()
@@ -7819,7 +7538,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7819
7538
  style['--cntrl-article-width'] = articleWidth;
7820
7539
  }
7821
7540
  return style as React.CSSProperties;
7822
- };
7541
+ })();
7823
7542
 
7824
7543
  const [lightboxOpen, setLightboxOpen] = useState(false);
7825
7544
  const [lightboxItems, setLightboxItems] = useState<GridMedia[]>([]);
@@ -7858,8 +7577,16 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7858
7577
  <div style={colorVars}>
7859
7578
  <div
7860
7579
  ref={containerRef}
7861
- className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''}\${customLayout ? \` \${P}-custom-layout\` : ''}\${isTextOutside ? \` \${P}-text-outside\` : ''} \${P}-image-align-\${align} \${wrapperStateClasses}\`.trim()}
7862
- style={wrapperLayoutStyle}>
7580
+ className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''} \${P}-image-align-\${align} \${wrapperStateClasses}\`.trim()}
7581
+ style={{
7582
+ gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
7583
+ rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
7584
+ columnGap: scalingValue(gridLayout.horizontalGap ?? 0, isEditor),
7585
+ width: scalingValue(gridLayout.wrapperWidth ?? 0, isEditor),
7586
+ ...(shouldAlignEntries
7587
+ ? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
7588
+ : {}),
7589
+ }}>
7863
7590
  {cropContent.map((item: any, index: number) => {
7864
7591
  const hasTitle = hasText(item.title);
7865
7592
  const hasSubtitle = hasText(item.subtitle);
@@ -7869,24 +7596,11 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7869
7596
  const gridColumn = isPartialLastRow && index >= lastRowStartIndex
7870
7597
  ? \`\${lastRowStartColumn + (index - lastRowStartIndex)}\`
7871
7598
  : undefined;
7872
- const customSlot = customSlots?.[index];
7873
- const itemSize = customSlot?.width ?? size;
7874
- const itemWidthScaled = scalingValue(itemSize, isEditor);
7875
- const textBoxWidthStyle = \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`;
7876
- const controlWidthStyle = scalingValue(itemSize * textBoxWidth / 100, isEditor);
7877
- const imageWrapperStyle = getImageWrapperStyle(itemWidthScaled, customSlot);
7878
- const itemStyle: React.CSSProperties | undefined = customSlot
7879
- ? {
7880
- gridColumn: customSlot.gridColumn,
7881
- gridRow: customRows?.gridRows[index],
7882
- alignSelf: 'start',
7883
- }
7884
- : gridColumn && !shouldAlignEntries ? { gridColumn } : undefined;
7885
7599
 
7886
7600
  const typeCTextBlock = isTextBeforeImage ? (
7887
7601
  <div className={\`\${P}-item-text-block\`}>
7888
7602
  {hasTitle && (
7889
- <p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleTextStyle }}>
7603
+ <p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}>
7890
7604
  {item.title}
7891
7605
  </p>
7892
7606
  )}
@@ -7901,7 +7615,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7901
7615
  />
7902
7616
  )}
7903
7617
  {hasSubtitle && (
7904
- <p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}>
7618
+ <p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}>
7905
7619
  {item.subtitle}
7906
7620
  </p>
7907
7621
  )}
@@ -7931,7 +7645,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7931
7645
  />
7932
7646
  )}
7933
7647
  {hasTitle && (
7934
- <p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleTextStyle }}>
7648
+ <p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}>
7935
7649
  {item.title}
7936
7650
  </p>
7937
7651
  )}
@@ -7961,7 +7675,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7961
7675
  />
7962
7676
  )}
7963
7677
  {hasSubtitle && (
7964
- <p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}>
7678
+ <p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}>
7965
7679
  {item.subtitle}
7966
7680
  </p>
7967
7681
  )}
@@ -7985,7 +7699,10 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7985
7699
  </LinkWrapper>
7986
7700
  );
7987
7701
 
7988
- const { displayItems, lightboxItemsForEntry, lightboxIndexes } = entriesMedia[index];
7702
+ const displayItems = getGridDisplayItems(item.gallery);
7703
+ const lightboxItemsForEntry = displayItems
7704
+ .filter(entry => entry.lightboxMedia)
7705
+ .map(entry => entry.lightboxMedia!);
7989
7706
 
7990
7707
  const imageContent = (
7991
7708
  <GridItemMediaWrapper className={imageWrapperClassName} style={imageWrapperStyle}>
@@ -7994,8 +7711,10 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7994
7711
  : slider === 'off'
7995
7712
  ?
7996
7713
  (() => {
7997
- const { displayMedia } = displayItems[0];
7998
- const lightboxIndex = lightboxIndexes[0];
7714
+ const { displayMedia, lightboxMedia } = displayItems[0];
7715
+ const lightboxIndex = lightboxMedia
7716
+ ? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
7717
+ : -1;
7999
7718
  return (
8000
7719
  <GridMediaItem
8001
7720
  media={displayMedia}
@@ -8023,28 +7742,50 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
8023
7742
  ))}
8024
7743
  </div>
8025
7744
  )}
8026
- <GridEntrySlider
8027
- key={\`\${transition}-\${itemSize}-\${direction}-\${sliderTiming}-\${layoutId}-\${displayItems.length}\`}
8028
- prefix={P}
8029
- isFade={transition === 'fade'}
8030
- direction={direction}
8031
- intervalMs={sliderTiming * 1000}
8032
- slides={displayItems.map(({ displayMedia }, imgIndex) => {
8033
- const lightboxIndex = lightboxIndexes[imgIndex];
7745
+ <Splide
7746
+ key={\`\${transition}-\${size}-\${direction}-\${sliderTiming}-\${containerWidth}-\${layoutId}\`}
7747
+ className={\`\${P}-item-slider\`}
7748
+ options={{
7749
+ arrows: false,
7750
+ pagination: false,
7751
+ drag: false,
7752
+ perPage: 1,
7753
+ autoplay: true,
7754
+ interval: sliderTiming * 1000,
7755
+ width: '100%',
7756
+ height: '100%',
7757
+ speed: SLIDER_TRANSITION_MS,
7758
+ type: transition === 'fade' ? 'fade' : 'loop',
7759
+ rewind: transition === 'fade',
7760
+ pauseOnHover: false,
7761
+ pauseOnFocus: false,
7762
+ direction: resolvedSplideDirection,
7763
+ }}
7764
+ onMoved={(splide) => {
7765
+ if (direction !== 'random' || transition === 'fade') return;
7766
+ handleRandomSlideMoved(splide);
7767
+ }}
7768
+ >
7769
+ {displayItems.map(({ displayMedia, lightboxMedia }, imgIndex) => {
7770
+ const lightboxIndex = lightboxMedia
7771
+ ? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
7772
+ : -1;
8034
7773
  return (
8035
- <GridMediaItem
8036
- media={displayMedia}
8037
- className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
8038
- style={imageStyle}
8039
- hasLightbox={lightbox === 'on'}
8040
- isSliderSlide
8041
- onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
8042
- ? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
8043
- : undefined}
8044
- />
7774
+ <SplideSlide key={imgIndex} data-slide-index={imgIndex}>
7775
+ <GridMediaItem
7776
+ media={displayMedia}
7777
+ className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
7778
+ style={imageStyle}
7779
+ hasLightbox={lightbox === 'on'}
7780
+ isSplideSlide
7781
+ onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
7782
+ ? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
7783
+ : undefined}
7784
+ />
7785
+ </SplideSlide>
8045
7786
  );
8046
7787
  })}
8047
- />
7788
+ </Splide>
8048
7789
  </>
8049
7790
  }
8050
7791
  </GridItemMediaWrapper>
@@ -8062,7 +7803,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
8062
7803
  />
8063
7804
  <p
8064
7805
  className={titleTextClassName}
8065
- style={{ width: textBoxWidthStyle, ...titleTextStyle }}
7806
+ style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}
8066
7807
  >
8067
7808
  {item.title}
8068
7809
  </p>
@@ -8076,7 +7817,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
8076
7817
  />
8077
7818
  <p
8078
7819
  className={subtitleTextClassName}
8079
- style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}
7820
+ style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}
8080
7821
  >
8081
7822
  {item.subtitle}
8082
7823
  </p>
@@ -8096,18 +7837,16 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
8096
7837
  <div
8097
7838
  key={index}
8098
7839
  className={\`\${P}-item\`.trim()}
8099
- style={itemStyle}
7840
+ style={gridColumn && !shouldAlignEntries ? { gridColumn } : undefined}
8100
7841
  >
8101
7842
  <div
8102
- ref={(el) => { itemInnerRefs.current[index] = el; }}
8103
- className={\`\${isEditMode
8104
- ? \`\${P}-item-inner\`
7843
+ className={\`\${isEditMode
7844
+ ? \`\${P}-item-inner\`
8105
7845
  : \`\${P}-item-inner-hidden\`}\${shouldAlignEntries && isLastRow ? \` \${P}-item-inner-last-row\` : ''}\`.trim()}
8106
7846
  style={{
8107
7847
  width: (textBoxWidth ?? 0) > 100
8108
- ? \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`
8109
- : itemWidthScaled,
8110
- ...(customSlot && !isTextOutside ? { height: scalingValue(customSlot.height, isEditor) } : {}),
7848
+ ? \`calc(\${entryWidthScaled} * (\${textBoxWidth} / 100))\`
7849
+ : entryWidthScaled,
8111
7850
  ...(gridColumn && shouldAlignEntries ? { gridColumn } : {}),
8112
7851
  }}
8113
7852
  >
@@ -8153,7 +7892,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
8153
7892
  {(!isEditor || isPreviewMode) && lightboxOpen && typeof document !== 'undefined' && lightbox === 'on' && (() => {
8154
7893
  const portalTarget = (portalId ? document.getElementById(portalId) : null) ?? document.body;
8155
7894
  return createPortal(
8156
- <div style={getLightboxPortalStyle()} data-selection="none">
7895
+ <div style={lightboxPortalStyle} data-selection="none">
8157
7896
  <Lightbox
8158
7897
  prefix={P}
8159
7898
  items={lightboxItems}
@@ -8190,36 +7929,17 @@ type GridLayoutConfig = {
8190
7929
  lockedParam?: 'wrapperWidth' | 'entryWidth' | 'horizontalGap' | null;
8191
7930
  };
8192
7931
 
8193
- type CustomGridBlock = {
8194
- column: number;
8195
- span: number;
8196
- top: number;
8197
- height: number;
8198
- };
8199
-
8200
- type CustomGridLayout = {
8201
- columnsCount: number;
8202
- columnWidth: number;
8203
- gutterWidth: number;
8204
- maxWidth: number | null;
8205
- verticalGap?: number;
8206
- beat?: number;
8207
- repeatHeight?: number;
8208
- blocks: CustomGridBlock[];
8209
- };
8210
-
8211
7932
  type GridSettings = {
8212
7933
  type: 'a' | 'b' | 'c' | 'd' | 'e' | 'f';
8213
- gridLayout?: GridLayoutConfig;
8214
- customGrid?: CustomGridLayout;
7934
+ gridLayout: GridLayoutConfig;
8215
7935
  textBoxWidth: number;
8216
- verticalGap?: number;
8217
- entriesCount?: number;
7936
+ verticalGap: number;
7937
+ entriesCount: number;
8218
7938
  lightbox: 'on' | 'off';
8219
- imageDisplay: 'fit' | 'cover' | {
7939
+ imageDisplay: {
8220
7940
  display: 'fit' | 'cover';
8221
- ratioValue?: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
8222
- reversed?: boolean;
7941
+ ratioValue: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
7942
+ reversed: boolean;
8223
7943
  };
8224
7944
  imageCorners?: number;
8225
7945
  lightboxImageDisplay?: 'fit' | 'cover' | { display?: 'fit' | 'cover' };
@@ -8229,9 +7949,8 @@ type GridSettings = {
8229
7949
  transition: 'fade' | 'slide',
8230
7950
  showText: 'always' | 'on hover';
8231
7951
  hover?: 'none' | 'zoom-in' | 'greyscale' | 'scale-down';
8232
- alignEntries?: 'on' | 'off';
7952
+ alignEntries: 'on' | 'off';
8233
7953
  align?: 'top' | 'center' | 'bottom';
8234
- textGrowth?: 'inside' | 'outside';
8235
7954
  titleMarginTop: number;
8236
7955
  subtitleMarginTop: number;
8237
7956
  titleColor: string;
@@ -25598,4 +25317,4 @@ export function Waterfall({
25598
25317
  </>
25599
25318
  );
25600
25319
  }
25601
- `,C={[n.BurgerComponent.id]:t,[n.ChroniclesComponent.id]:i,[n.ClickGallerieComponent.id]:o,[n.CustomGridComponent.id]:e,[n.FAQComponent.id]:r,[n.FormComponent.id]:a,[n.GridComponent.id]:e,[n.HelixComponent.id]:s,[n.HiveComponent.id]:l,[n.LightboxJournalComponent.id]:c,[n.LightboxStripComponent.id]:d,[n.ListComponent.id]:u,[n.MarqueeComponent.id]:g,[n.MarqueeTextComponent.id]:m,[n.MercuryComponent.id]:p,[n.OnelinerFormComponent.id]:h,[n.PretextComponent.id]:f,[n.ScaleComponent.id]:v,[n.SimpleButtonComponent.id]:P,[n.Slider20Component.id]:x,[n.TestimonialGridComponent.id]:b,[n.TestimonialSingleComponent.id]:y,[n.WaterfallComponent.id]:S};exports.componentSources=C;
25320
+ `,C={[n.BurgerComponent.id]:e,[n.ChroniclesComponent.id]:t,[n.ClickGallerieComponent.id]:i,[n.FAQComponent.id]:o,[n.FormComponent.id]:r,[n.GridComponent.id]:a,[n.HelixComponent.id]:s,[n.HiveComponent.id]:l,[n.LightboxJournalComponent.id]:c,[n.LightboxStripComponent.id]:d,[n.ListComponent.id]:u,[n.MarqueeComponent.id]:g,[n.MarqueeTextComponent.id]:m,[n.MercuryComponent.id]:p,[n.OnelinerFormComponent.id]:h,[n.PretextComponent.id]:f,[n.ScaleComponent.id]:v,[n.SimpleButtonComponent.id]:P,[n.Slider20Component.id]:x,[n.TestimonialGridComponent.id]:b,[n.TestimonialSingleComponent.id]:y,[n.WaterfallComponent.id]:S};exports.componentSources=C;