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

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 (71) hide show
  1. package/dist/{Burger-DyORh_vF.mjs → Burger-C8JIQQwm.mjs} +330 -307
  2. package/dist/Burger-C_SjPZWp.js +669 -0
  3. package/dist/{ChroniclesComponent-DVoJ0kdT.mjs → ChroniclesComponent-B-93AhZK.mjs} +512 -442
  4. package/dist/ChroniclesComponent-C9sBiR1y.js +1 -0
  5. package/dist/Components/Burger/Burger.d.ts +4 -2
  6. package/dist/Components/Grid/CustomGridComponent.d.ts +41 -0
  7. package/dist/Components/Grid/Grid.d.ts +25 -7
  8. package/dist/Components/helpers/SvgImage/loadSvgMaskUrl.d.ts +0 -7
  9. package/dist/{ControlSlider-3w-bHQEg.mjs → ControlSlider-BBAXRDLP.mjs} +3 -4
  10. package/dist/ControlSlider-BCkVFl4w.js +1 -0
  11. package/dist/{FAQ-GmiwRdFq.mjs → FAQ-CJHCMSBa.mjs} +1 -1
  12. package/dist/{FAQ-7HEkaoU6.js → FAQ-DLh63Utr.js} +1 -1
  13. package/dist/Grid-CUaVUaRa.js +441 -0
  14. package/dist/Grid-D19xZ_mh.mjs +1800 -0
  15. package/dist/{Hive-34KvKNsa.js → Hive-CzabuuCc.js} +1 -1
  16. package/dist/{Hive-7xHXyMM1.mjs → Hive-DyxYd5eg.mjs} +1 -1
  17. package/dist/{HiveLightboxTitles-BCoL46-V.mjs → HiveLightboxTitles-DhEeFKWs.mjs} +1 -1
  18. package/dist/{HiveLightboxTitles-DEeyQGcf.js → HiveLightboxTitles-DlyptAaK.js} +1 -1
  19. package/dist/{Lightbox-DzPqgKP4.mjs → Lightbox-BY99NS14.mjs} +1 -1
  20. package/dist/{Lightbox-Cb7lyaNt.js → Lightbox-DZckgBzK.js} +1 -1
  21. package/dist/{LightboxJournal-DisD2DLv.mjs → LightboxJournal-BDUs6T0B.mjs} +1 -1
  22. package/dist/{LightboxJournal-B-vul_be.js → LightboxJournal-Bf_rZzmz.js} +1 -1
  23. package/dist/{LightboxStrip-wCHUhAqN.mjs → LightboxStrip-Cuhb2fIR.mjs} +1 -1
  24. package/dist/{LightboxStrip-YDyEPEb6.js → LightboxStrip-RA4ABUC-.js} +1 -1
  25. package/dist/{Mercury-BmhtFYOw.js → Mercury-B-s2Kvuq.js} +1 -1
  26. package/dist/{Mercury-Q788wrYQ.mjs → Mercury-CCW0Es-s.mjs} +1 -1
  27. package/dist/{OnelinerForm-D8WIB9Qy.mjs → OnelinerForm-BEu7_sho.mjs} +1 -1
  28. package/dist/{OnelinerForm-CUmY-bXL.js → OnelinerForm-C2Y_XMCY.js} +1 -1
  29. package/dist/{SimpleButton-DTpzfmb6.mjs → SimpleButton-C-o2W9bS.mjs} +1 -1
  30. package/dist/{SimpleButton-DtaCYa3y.js → SimpleButton-nGEcO2gB.js} +1 -1
  31. package/dist/{Slider20-q0iGgnE3.js → Slider20-BOmjDRf2.js} +1 -1
  32. package/dist/{Slider20-CKngROrc.mjs → Slider20-DUi6qwnd.mjs} +1 -1
  33. package/dist/SvgImage-B5mR9y6q.mjs +51 -0
  34. package/dist/SvgImage-DFlmxAoL.js +1 -0
  35. package/dist/{TestimonialSingle-CpEUendN.js → TestimonialSingle-BORQom3u.js} +1 -1
  36. package/dist/{TestimonialSingle-Bax71Hyo.mjs → TestimonialSingle-DrnyReim.mjs} +1 -1
  37. package/dist/{Waterfall-znaoynn5.mjs → Waterfall-3kKioKh2.mjs} +1 -1
  38. package/dist/{Waterfall-B9YWMhrg.js → Waterfall-DII4-WV5.js} +1 -1
  39. package/dist/{components-eK82xypT.mjs → components-M_xX2VXw.mjs} +30 -653
  40. package/dist/components-pNQQ3H27.js +1 -0
  41. package/dist/components.css +1 -1
  42. package/dist/elements.js +1 -1
  43. package/dist/elements.mjs +24 -24
  44. package/dist/elements.node.js +1 -1
  45. package/dist/elements.node.mjs +1 -1
  46. package/dist/index.d.ts +1 -3
  47. package/dist/index.js +1 -1
  48. package/dist/index.mjs +36 -63
  49. package/dist/loadSvgMaskUrl-DfF7ay6h.js +1 -0
  50. package/dist/loadSvgMaskUrl-xHgGYgPe.mjs +20 -0
  51. package/dist/sources.js +567 -241
  52. package/dist/sources.mjs +608 -281
  53. package/dist/types/Component.d.ts +0 -7
  54. package/dist/types/SchemaV1.d.ts +0 -3
  55. package/package.json +1 -1
  56. package/dist/Burger-B4kXX9aY.js +0 -669
  57. package/dist/ChroniclesComponent-Nm_yIRmr.js +0 -1
  58. package/dist/Components/PopupMenu/PopupMenu.d.ts +0 -73
  59. package/dist/Components/PopupMenu/PopupMenuComponent.d.ts +0 -594
  60. package/dist/Components/PopupMenu/popupMenuLayout.d.ts +0 -203
  61. package/dist/Components/PopupMenu/popupMenuSnap.d.ts +0 -61
  62. package/dist/ControlSlider-DB4nbVLT.js +0 -1
  63. package/dist/Grid-BuRdth9A.mjs +0 -1622
  64. package/dist/Grid-tqSSYh2-.js +0 -408
  65. package/dist/PopupMenu-CYdDyzEt.mjs +0 -1372
  66. package/dist/PopupMenu-Di1fHgho.js +0 -409
  67. package/dist/SvgImage-CwRq9-ec.mjs +0 -56
  68. package/dist/SvgImage-_QN8ngad.js +0 -1
  69. package/dist/components-BYoTPJk3.js +0 -1
  70. package/dist/loadSvgMaskUrl-B6kHUyof.js +0 -1
  71. package/dist/loadSvgMaskUrl-DUhCVvpl.mjs +0 -39
package/dist/sources.js CHANGED
@@ -1,4 +1,4 @@
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';
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./ChroniclesComponent-C9sBiR1y.js"),t=`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';
@@ -27,11 +27,12 @@ type BurgerShowInValue = string | Record<string, string>;
27
27
 
28
28
  type BurgerLink = {
29
29
  link?: {
30
- type?: 'url' | 'page' | 'anchor';
30
+ type?: 'url' | 'page' | 'anchor' | 'file';
31
31
  value?: string;
32
32
  target?: string;
33
33
  anchor?: string;
34
34
  url?: string;
35
+ download?: string;
35
36
  };
36
37
  mode?: 'page' | 'url';
37
38
  page?: string;
@@ -256,10 +257,11 @@ function isBlankTarget(target?: string): boolean {
256
257
  }
257
258
 
258
259
  function getBurgerDest(item: BurgerLink): {
259
- type: 'url' | 'page' | 'anchor';
260
+ type: 'url' | 'page' | 'anchor' | 'file';
260
261
  value: string;
261
262
  target?: '_blank';
262
263
  anchor?: string;
264
+ download?: string;
263
265
  } {
264
266
  const dest = item.link;
265
267
  if (dest && typeof dest === 'object') {
@@ -273,8 +275,12 @@ function getBurgerDest(item: BurgerLink): {
273
275
  if (dest.type === 'page') {
274
276
  return { type: 'page', value: dest.value ?? '', target, anchor: dest.anchor };
275
277
  }
278
+ if (dest.type === 'file') {
279
+ return { type: 'file', value: dest.value ?? '' };
280
+ }
281
+ // a published file link comes as its file's url, with the name to download it under
276
282
  if (typeof dest.url === 'string') {
277
- return { type: 'url', value: dest.url, target };
283
+ return { type: 'url', value: dest.url, target, download: typeof dest.download === 'string' ? dest.download : undefined };
278
284
  }
279
285
  }
280
286
  const target = isBlankTarget(item.openIn) ? '_blank' : undefined;
@@ -295,12 +301,17 @@ function resolveBurgerLink(item: BurgerLink, pages?: BurgerPageRef[]): {
295
301
  label: string;
296
302
  href: string;
297
303
  target?: '_blank';
304
+ download?: string;
298
305
  } {
299
306
  const label = item.label || 'Link';
300
307
  const dest = getBurgerDest(item);
301
308
 
302
309
  if (dest.type === 'url') {
303
- return { label, href: dest.value, target: dest.target };
310
+ return { label, href: dest.value, target: dest.target, download: dest.download };
311
+ }
312
+ if (dest.type === 'file') {
313
+ // only the editor sees a file by its id, and downloads it through onLinkNavigate, right on the click
314
+ return { label, href: dest.value ? '#' : '', target: '_blank' };
304
315
  }
305
316
  if (dest.type === 'anchor') {
306
317
  const anchor = dest.value.replace(/^#/, '');
@@ -912,10 +923,11 @@ function renderTextPaddingControls(
912
923
  type ColorKeys = 'iconColor' | 'closeButtonColor' | 'linkColor' | 'openLinkColor' | 'compactIconColor' | 'compactLinkColor' | 'compactLogoColor' | 'compactBackgroundColor' | 'openLogoColor' | 'menuBackgroundColor' | 'overlayColor' | 'backgroundColor' | 'logoColor';
913
924
 
914
925
  export type BurgerLinkNavigateEvent = {
915
- mode: 'page' | 'url';
926
+ mode: 'page' | 'url' | 'file';
916
927
  href: string;
917
928
  page?: string;
918
929
  url?: string;
930
+ file?: string;
919
931
  anchor?: string;
920
932
  target?: '_blank';
921
933
  };
@@ -1767,6 +1779,28 @@ function findAnchorTarget(hash: string): HTMLElement | null {
1767
1779
  return target instanceof HTMLElement ? target : null;
1768
1780
  }
1769
1781
 
1782
+ // the file is on the cdn, another origin, where the download attribute alone opens it instead
1783
+ function downloadFile(url: string, name: string) {
1784
+ fetch(url)
1785
+ .then((response) => {
1786
+ if (!response.ok) throw new Error(\`Could not download \${url}: \${response.status}\`);
1787
+ return response.blob();
1788
+ })
1789
+ .then((blob) => {
1790
+ const objectUrl = URL.createObjectURL(blob);
1791
+ const link = document.createElement('a');
1792
+ link.href = objectUrl;
1793
+ link.download = name || decodeURIComponent(url.split('?')[0].split('/').pop() ?? '');
1794
+ document.body.appendChild(link);
1795
+ link.click();
1796
+ link.remove();
1797
+ window.setTimeout(() => URL.revokeObjectURL(objectUrl), 0);
1798
+ })
1799
+ .catch(() => {
1800
+ window.location.assign(url);
1801
+ });
1802
+ }
1803
+
1770
1804
  function scrollToAnchor(hash: string): boolean {
1771
1805
  const target = findAnchorTarget(hash);
1772
1806
  if (!target) return false;
@@ -1800,10 +1834,11 @@ function handleLinkClick(
1800
1834
  const resolved = resolveBurgerLink(item, pages);
1801
1835
  const dest = getBurgerDest(item);
1802
1836
  const navigateEvent: BurgerLinkNavigateEvent = {
1803
- mode: dest.type === 'url' ? 'url' : 'page',
1837
+ mode: dest.type === 'url' || dest.type === 'file' ? dest.type : 'page',
1804
1838
  href: resolved.href || href,
1805
1839
  page: dest.type === 'page' ? dest.value : undefined,
1806
1840
  url: dest.type === 'url' ? dest.value : undefined,
1841
+ file: dest.type === 'file' ? dest.value : undefined,
1807
1842
  anchor: dest.type === 'anchor'
1808
1843
  ? dest.value.replace(/^#/, '')
1809
1844
  : (dest.anchor ?? '').replace(/^#/, ''),
@@ -1825,6 +1860,14 @@ function handleLinkClick(
1825
1860
  return;
1826
1861
  }
1827
1862
 
1863
+ const download = item ? getBurgerDest(item).download : undefined;
1864
+ if (download !== undefined && href && !event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey) {
1865
+ event.preventDefault();
1866
+ downloadFile(href, download);
1867
+ onClose();
1868
+ return;
1869
+ }
1870
+
1828
1871
  if (!opensInNewTab && hash && isSameDocumentHref(href) && findAnchorTarget(hash)) {
1829
1872
  event.preventDefault();
1830
1873
  runAfterClose(() => scrollToAnchor(hash));
@@ -2430,12 +2473,13 @@ export function Burger({
2430
2473
  const showOpenNavControls = showControls && isOpen;
2431
2474
 
2432
2475
  const renderOpenNavItems = (linkClassName: string) => items.filter((item) => isVisibleInOpenNav(item, layoutId)).map((item, index) => {
2433
- const { label, href, target } = resolveBurgerLink(item, pages);
2476
+ const { label, href, target, download } = resolveBurgerLink(item, pages);
2434
2477
  const linkNode = href ? (
2435
2478
  <a
2436
2479
  href={href}
2437
2480
  target={target}
2438
2481
  rel={target === '_blank' ? 'noopener noreferrer' : undefined}
2482
+ download={download}
2439
2483
  className={\`\${linkClassName} \${P}-has-href\`}
2440
2484
  onClick={(event) => onNavLinkClick(event, item)}
2441
2485
  >
@@ -2547,7 +2591,7 @@ export function Burger({
2547
2591
  };
2548
2592
 
2549
2593
  const renderNavLink = (item: BurgerLink, index: number) => {
2550
- const { label, href, target } = resolveBurgerLink(item, pages);
2594
+ const { label, href, target, download } = resolveBurgerLink(item, pages);
2551
2595
  const textContent = (
2552
2596
  <span className={navLinkTextClassName} style={navLinkTextStyle}>
2553
2597
  {renderMultilineText(label)}
@@ -2566,6 +2610,7 @@ export function Burger({
2566
2610
  href={href}
2567
2611
  target={target}
2568
2612
  rel={target === '_blank' ? 'noopener noreferrer' : undefined}
2613
+ download={download}
2569
2614
  className={\`\${P}-nav-link \${P}-has-href\`}
2570
2615
  onClick={(event) => onNavLinkClick(event, item)}
2571
2616
  >
@@ -2683,7 +2728,7 @@ export function Burger({
2683
2728
  </div>
2684
2729
  );
2685
2730
  }
2686
- `,t=`import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
2731
+ `,i=`import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
2687
2732
  import { createPortal } from 'react-dom';
2688
2733
  import cn from 'classnames';
2689
2734
  import { CommonComponentProps } from '../props';
@@ -3730,7 +3775,7 @@ export function Chronicles({
3730
3775
  </>
3731
3776
  );
3732
3777
  }
3733
- `,i=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3778
+ `,o=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3734
3779
  import { CommonComponentProps } from '../props';
3735
3780
  import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
3736
3781
 
@@ -4259,7 +4304,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
4259
4304
  </>
4260
4305
  );
4261
4306
  }
4262
- `,o=`import { useCallback, useEffect, useMemo, useState } from 'react';
4307
+ `,r=`import { useCallback, useEffect, useMemo, useState } from 'react';
4263
4308
  import cn from 'classnames';
4264
4309
  import { CommonComponentProps } from '../props';
4265
4310
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
@@ -5003,7 +5048,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
5003
5048
  </>
5004
5049
  );
5005
5050
  }
5006
- `,r=`import React, { useMemo, useState } from 'react';
5051
+ `,a=`import React, { useMemo, useState } from 'react';
5007
5052
  import { CommonComponentProps } from '../props';
5008
5053
  import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
5009
5054
  import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
@@ -5641,9 +5686,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
5641
5686
  };
5642
5687
 
5643
5688
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
5644
- `,a=`import { Splide, SplideSlide } from '@splidejs/react-splide';
5645
- import '@splidejs/react-splide/css/core';
5646
- import { CommonComponentProps } from '../props';
5689
+ `,e=`import { CommonComponentProps } from '../props';
5647
5690
  import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
5648
5691
  import {
5649
5692
  buildColorVars,
@@ -5653,7 +5696,7 @@ import {
5653
5696
  useLazyVideos,
5654
5697
  useScopedStyles,
5655
5698
  } from '../utils/index';
5656
- import { useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
5699
+ import { memo, useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
5657
5700
  import { createPortal } from 'react-dom';
5658
5701
  import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
5659
5702
  import { SvgImage } from '../helpers/SvgImage/SvgImage';
@@ -5770,15 +5813,19 @@ function getCSS(P: string): string {
5770
5813
  width: 100%;
5771
5814
  overflow: hidden;
5772
5815
  }
5773
- .\${P}-item-slider .splide__track {
5774
- overflow: hidden;
5775
- }
5776
5816
  .\${P}-item-image-link {
5777
5817
  width: 100%;
5778
5818
  display: flex;
5779
5819
  flex-direction: column;
5780
5820
  align-items: center;
5781
5821
  }
5822
+ .\${P}-custom-layout .\${P}-item-image-link {
5823
+ flex: 1 1 0%;
5824
+ min-height: 0;
5825
+ }
5826
+ .\${P}-custom-layout.\${P}-text-outside .\${P}-item-image-link {
5827
+ flex: none;
5828
+ }
5782
5829
  .\${P}-item-text-link {
5783
5830
  display: flex;
5784
5831
  flex-direction: column;
@@ -5799,18 +5846,47 @@ function getCSS(P: string): string {
5799
5846
  display: block;
5800
5847
  max-width: 100%;
5801
5848
  }
5802
- .\${P}-item-slider,
5803
- .\${P}-item-slider .splide__track,
5804
- .\${P}-item-slider .splide__list,
5805
- .\${P}-item-slider .splide__slide {
5849
+ .\${P}-item-slider {
5850
+ position: relative;
5806
5851
  width: 100%;
5807
5852
  height: 100%;
5853
+ overflow: hidden;
5854
+ }
5855
+ .\${P}-item-slider-list {
5856
+ position: relative;
5857
+ display: flex;
5858
+ flex-direction: row;
5859
+ width: 100%;
5860
+ height: 100%;
5861
+ will-change: transform;
5808
5862
  }
5809
- .\${P}-item-slider .splide__slide {
5863
+ .\${P}-item-slider-list-vertical {
5864
+ flex-direction: column;
5865
+ }
5866
+ .\${P}-item-slider-list-fade {
5867
+ display: block;
5868
+ will-change: auto;
5869
+ }
5870
+ .\${P}-item-slide {
5871
+ position: relative;
5872
+ flex: 0 0 100%;
5873
+ width: 100%;
5874
+ height: 100%;
5810
5875
  display: flex;
5811
5876
  justify-content: center;
5812
5877
  align-items: center;
5813
5878
  }
5879
+ .\${P}-item-slider-list-fade .\${P}-item-slide {
5880
+ position: absolute;
5881
+ top: 0;
5882
+ left: 0;
5883
+ opacity: 0;
5884
+ transition: opacity \${SLIDER_TRANSITION_MS}ms \${SLIDER_EASING};
5885
+ }
5886
+ .\${P}-item-slider-list-fade .\${P}-item-slide-active {
5887
+ opacity: 1;
5888
+ z-index: 1;
5889
+ }
5814
5890
  .\${P}-item-title {
5815
5891
  white-space: normal;
5816
5892
  overflow-wrap: anywhere;
@@ -5957,13 +6033,13 @@ function getCSS(P: string): string {
5957
6033
  .\${P}-image-align-bottom .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
5958
6034
  align-items: flex-end;
5959
6035
  }
5960
- .\${P}-image-align-top .\${P}-item-slider .splide__slide {
6036
+ .\${P}-image-align-top .\${P}-item-slider .\${P}-item-slide {
5961
6037
  align-items: flex-start;
5962
6038
  }
5963
- .\${P}-image-align-center .\${P}-item-slider .splide__slide {
6039
+ .\${P}-image-align-center .\${P}-item-slider .\${P}-item-slide {
5964
6040
  align-items: center;
5965
6041
  }
5966
- .\${P}-image-align-bottom .\${P}-item-slider .splide__slide {
6042
+ .\${P}-image-align-bottom .\${P}-item-slider .\${P}-item-slide {
5967
6043
  align-items: flex-end;
5968
6044
  }
5969
6045
  .\${P}-align-entries .\${P}-item {
@@ -6044,13 +6120,13 @@ function getCSS(P: string): string {
6044
6120
  .\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
6045
6121
  align-items: flex-end;
6046
6122
  }
6047
- .\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider .splide__slide {
6123
+ .\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
6048
6124
  align-items: flex-start;
6049
6125
  }
6050
- .\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider .splide__slide {
6126
+ .\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
6051
6127
  align-items: center;
6052
6128
  }
6053
- .\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider .splide__slide {
6129
+ .\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
6054
6130
  align-items: flex-end;
6055
6131
  }
6056
6132
  .\${P}-image-align-top.\${P}-align-entries .\${P}-item-image-link {
@@ -6118,27 +6194,9 @@ function pickRandomSlideDirection(): 'ltr' | 'ttb' {
6118
6194
  return Math.random() < 0.5 ? 'ltr' : 'ttb';
6119
6195
  }
6120
6196
 
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
- });
6197
+ function wrapSlideIndex(index: number, count: number): number {
6198
+ if (count <= 0) return 0;
6199
+ return ((index % count) + count) % count;
6142
6200
  }
6143
6201
 
6144
6202
  type GridProps = {
@@ -6178,6 +6236,8 @@ type LightboxProps = {
6178
6236
 
6179
6237
  const LIGHTBOX_ANIM_MS = 500;
6180
6238
  const SLIDER_TRANSITION_MS = 750;
6239
+ const SLIDER_EASING = 'cubic-bezier(0.25, 1, 0.5, 1)';
6240
+ const SLIDER_DEFAULT_INTERVAL_MS = 5000;
6181
6241
  const LIGHTBOX_EASING = 'cubic-bezier(0.22, 1, 0.36, 1)';
6182
6242
  const SWIPE_CLOSE_THRESHOLD = 72;
6183
6243
  const SWIPE_NAV_THRESHOLD = 50;
@@ -6267,7 +6327,7 @@ function collectGridLightboxMedia(content: any[]): GridMedia[] {
6267
6327
  return result;
6268
6328
  }
6269
6329
 
6270
- function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
6330
+ const LightboxMediaPreloadPool = memo(function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
6271
6331
  const [pool, setPool] = useState<HTMLDivElement | null>(null);
6272
6332
  useLazyVideos(pool, { preload: 'metadata' });
6273
6333
  // an embed's player is only ever framed where it shows
@@ -6306,7 +6366,7 @@ function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
6306
6366
  ))}
6307
6367
  </div>
6308
6368
  );
6309
- }
6369
+ });
6310
6370
 
6311
6371
  function unloadVideoElement(video: HTMLVideoElement) {
6312
6372
  video.pause();
@@ -6314,15 +6374,121 @@ function unloadVideoElement(video: HTMLVideoElement) {
6314
6374
  video.load();
6315
6375
  }
6316
6376
 
6317
- const SPLIDE_SLIDE_VIDEOS = '.splide__slide video';
6377
+ const GRID_SLIDE_CLASS = 'cntrl-grid-slide';
6378
+ const GRID_SLIDE_PLAYING_CLASS = 'cntrl-grid-slide-playing';
6379
+ const GRID_SLIDE_VIDEOS = \`.\${GRID_SLIDE_CLASS} video\`;
6318
6380
 
6319
6381
  function shouldPlaySlideVideo(video: HTMLVideoElement): boolean {
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;
6382
+ return video.closest(\`.\${GRID_SLIDE_PLAYING_CLASS}\`) !== null;
6383
+ }
6384
+
6385
+ type GridEntrySliderProps = {
6386
+ prefix: string;
6387
+ slides: React.ReactNode[];
6388
+ isFade: boolean;
6389
+ direction: GridSettings['direction'];
6390
+ intervalMs: number;
6391
+ };
6392
+
6393
+ function GridEntrySlider({ prefix: P, slides, isFade, direction, intervalMs }: GridEntrySliderProps) {
6394
+ const count = slides.length;
6395
+ const hasClones = !isFade && count > 1;
6396
+ const isRandom = !isFade && direction === 'random';
6397
+ const delayMs = Number.isFinite(intervalMs) && intervalMs > 0 ? intervalMs : SLIDER_DEFAULT_INTERVAL_MS;
6398
+ const [position, setPosition] = useState(hasClones ? 1 : 0);
6399
+ const [axis, setAxis] = useState<'ltr' | 'ttb'>(!isFade && direction === 'vertical' ? 'ttb' : 'ltr');
6400
+ const [isMoving, setIsMoving] = useState(false);
6401
+ const [skipTransition, setSkipTransition] = useState(false);
6402
+ const [cycle, setCycle] = useState(0);
6403
+ const isMovingRef = useRef(false);
6404
+
6405
+ useEffect(() => {
6406
+ if (count < 2) return;
6407
+ const timeoutId = window.setTimeout(() => {
6408
+ if (isMovingRef.current) {
6409
+ setCycle(prev => prev + 1);
6410
+ return;
6411
+ }
6412
+ isMovingRef.current = true;
6413
+ setIsMoving(true);
6414
+ setSkipTransition(false);
6415
+ setPosition(prev => (hasClones ? prev + 1 : wrapSlideIndex(prev + 1, count)));
6416
+ if (!isRandom) setCycle(prev => prev + 1);
6417
+ }, delayMs);
6418
+ return () => window.clearTimeout(timeoutId);
6419
+ }, [count, cycle, delayMs, hasClones, isRandom]);
6420
+
6421
+ useEffect(() => {
6422
+ if (!isMoving) return;
6423
+ const timeoutId = window.setTimeout(() => {
6424
+ const isOnClone = hasClones && position === count + 1;
6425
+ const nextAxis = isRandom ? pickRandomSlideDirection() : axis;
6426
+ if (isOnClone || nextAxis !== axis) {
6427
+ setSkipTransition(true);
6428
+ if (isOnClone) setPosition(1);
6429
+ setAxis(nextAxis);
6430
+ }
6431
+ isMovingRef.current = false;
6432
+ setIsMoving(false);
6433
+ if (isRandom) setCycle(prev => prev + 1);
6434
+ }, SLIDER_TRANSITION_MS);
6435
+ return () => window.clearTimeout(timeoutId);
6436
+ }, [axis, count, hasClones, isMoving, isRandom, position]);
6437
+
6438
+ useEffect(() => {
6439
+ if (!skipTransition) return;
6440
+ let innerId = 0;
6441
+ const outerId = requestAnimationFrame(() => {
6442
+ innerId = requestAnimationFrame(() => setSkipTransition(false));
6443
+ });
6444
+ return () => {
6445
+ cancelAnimationFrame(outerId);
6446
+ cancelAnimationFrame(innerId);
6447
+ };
6448
+ }, [skipTransition]);
6449
+
6450
+ const slotsCount = hasClones ? count + 2 : count;
6451
+ const getItemIndex = (slot: number) => (hasClones ? wrapSlideIndex(slot - 1, count) : slot);
6452
+ const isCloneSlot = (slot: number) => hasClones && (slot === 0 || slot === count + 1);
6453
+ const activeIndex = getItemIndex(position);
6454
+ const nextSlot = position + 1 < slotsCount ? position + 1 : -1;
6455
+ const isPlayingSlot = (slot: number) => isFade
6456
+ || (slot === position && !isCloneSlot(slot))
6457
+ || slot === nextSlot
6458
+ || (nextSlot >= 0 && !isCloneSlot(slot) && getItemIndex(slot) === getItemIndex(nextSlot));
6459
+ const isVertical = !isFade && axis === 'ttb';
6460
+ const listStyle: React.CSSProperties | undefined = isFade
6461
+ ? undefined
6462
+ : {
6463
+ transform: isVertical
6464
+ ? \`translate3d(0, \${-position * 100}%, 0)\`
6465
+ : \`translate3d(\${-position * 100}%, 0, 0)\`,
6466
+ transition: skipTransition ? 'none' : \`transform \${SLIDER_TRANSITION_MS}ms \${SLIDER_EASING}\`,
6467
+ };
6468
+
6469
+ return (
6470
+ <div className={\`\${P}-item-slider\`}>
6471
+ <div
6472
+ className={\`\${P}-item-slider-list\${isFade ? \` \${P}-item-slider-list-fade\` : ''}\${isVertical ? \` \${P}-item-slider-list-vertical\` : ''}\`}
6473
+ style={listStyle}
6474
+ >
6475
+ {Array.from({ length: slotsCount }, (_, slot) => {
6476
+ const itemIndex = getItemIndex(slot);
6477
+ const isClone = isCloneSlot(slot);
6478
+ const isShown = isFade ? itemIndex === activeIndex : slot === position;
6479
+ return (
6480
+ <div
6481
+ key={isClone ? \`clone-\${slot === 0 ? 'start' : 'end'}\` : \`slide-\${itemIndex}\`}
6482
+ className={\`\${P}-item-slide \${GRID_SLIDE_CLASS}\${isFade && isShown ? \` \${P}-item-slide-active\` : ''}\${isPlayingSlot(slot) ? \` \${GRID_SLIDE_PLAYING_CLASS}\` : ''}\`}
6483
+ aria-hidden={isShown ? undefined : true}
6484
+ >
6485
+ {slides[itemIndex]}
6486
+ </div>
6487
+ );
6488
+ })}
6489
+ </div>
6490
+ </div>
6491
+ );
6326
6492
  }
6327
6493
 
6328
6494
  function GridMediaItem({
@@ -6330,7 +6496,7 @@ function GridMediaItem({
6330
6496
  className,
6331
6497
  style,
6332
6498
  hasLightbox,
6333
- isSplideSlide = false,
6499
+ isSliderSlide = false,
6334
6500
  onMediaClick,
6335
6501
  }: {
6336
6502
  media: GridMedia;
@@ -6338,7 +6504,7 @@ function GridMediaItem({
6338
6504
  style: React.CSSProperties;
6339
6505
  /** An embed then plays here as a silent loop, and as it was set to in the lightbox. */
6340
6506
  hasLightbox: boolean;
6341
- isSplideSlide?: boolean;
6507
+ isSliderSlide?: boolean;
6342
6508
  onMediaClick?: (e: React.MouseEvent<HTMLElement>) => void;
6343
6509
  }) {
6344
6510
  if (isEmbedMedia(media)) {
@@ -6370,7 +6536,7 @@ function GridMediaItem({
6370
6536
  playsInline: true,
6371
6537
  onClick: onMediaClick,
6372
6538
  };
6373
- return isSplideSlide
6539
+ return isSliderSlide
6374
6540
  ? <video {...videoProps} preload='none' />
6375
6541
  : <LazyVideo {...videoProps} autoPlay />;
6376
6542
  }
@@ -6399,7 +6565,7 @@ function GridItemMediaWrapper({
6399
6565
  children: React.ReactNode;
6400
6566
  }) {
6401
6567
  const [wrapper, setWrapper] = useState<HTMLDivElement | null>(null);
6402
- useLazyVideos(wrapper, { autoPlay: true, selector: SPLIDE_SLIDE_VIDEOS, shouldPlay: shouldPlaySlideVideo });
6568
+ useLazyVideos(wrapper, { autoPlay: true, selector: GRID_SLIDE_VIDEOS, shouldPlay: shouldPlaySlideVideo });
6403
6569
 
6404
6570
  return (
6405
6571
  <div ref={setWrapper} className={className} style={style}>
@@ -7300,11 +7466,108 @@ function resolveLightboxImageDisplay(
7300
7466
  return value?.display === 'cover' ? 'cover' : 'fit';
7301
7467
  }
7302
7468
 
7469
+ function getCustomGridSpanWidth(layout: CustomGridLayout, span: number): number {
7470
+ return layout.columnWidth * span + layout.gutterWidth * Math.max(0, span - 1);
7471
+ }
7472
+
7473
+ type CustomGridSlot = {
7474
+ column: number;
7475
+ span: number;
7476
+ width: number;
7477
+ top: number;
7478
+ height: number;
7479
+ gridColumn: string;
7480
+ };
7481
+
7482
+ function getCustomGridBlocksBottom(layout: CustomGridLayout): number {
7483
+ return layout.blocks.reduce((bottom, block) => Math.max(bottom, Math.max(0, block.top) + Math.max(0, block.height)), 0);
7484
+ }
7485
+
7486
+ function getCustomGridVerticalGap(layout: CustomGridLayout): number {
7487
+ if (typeof layout.verticalGap === 'number') return Math.max(0, layout.verticalGap);
7488
+ return Math.max(0, (layout.repeatHeight ?? 0) - getCustomGridBlocksBottom(layout));
7489
+ }
7490
+
7491
+ function getCustomGridSlot(layout: CustomGridLayout, index: number): CustomGridSlot {
7492
+ const block = layout.blocks[index % layout.blocks.length];
7493
+ const span = Math.min(Math.max(1, Math.round(block.span)), layout.columnsCount);
7494
+ const column = Math.min(Math.max(0, Math.round(block.column)), layout.columnsCount - span);
7495
+ return {
7496
+ column,
7497
+ span,
7498
+ width: getCustomGridSpanWidth(layout, span),
7499
+ top: Math.max(0, block.top),
7500
+ height: Math.max(0, block.height),
7501
+ gridColumn: \`\${column + 1} / span \${span}\`,
7502
+ };
7503
+ }
7504
+
7505
+ const EDGE_TOLERANCE = 1e-6;
7506
+
7507
+ function getCustomGridRows(layout: CustomGridLayout, entriesCount: number, entryHeights?: number[]) {
7508
+ const beat = layout.beat ?? 0;
7509
+ const onBeats = beat > 0 && !!entryHeights;
7510
+ const snapUp = (value: number) => Math.ceil(value / beat - 1e-3) * beat;
7511
+ const tracks: (number | 'auto')[] = [];
7512
+ const gridRows: string[] = [];
7513
+ const verticalGap = getCustomGridVerticalGap(layout);
7514
+ for (let groupStart = 0; groupStart < entriesCount; groupStart += layout.blocks.length) {
7515
+ if (groupStart > 0 && verticalGap > 0) tracks.push(verticalGap);
7516
+ const slots = Array.from(
7517
+ { length: Math.min(layout.blocks.length, entriesCount - groupStart) },
7518
+ (_, index) => getCustomGridSlot(layout, groupStart + index),
7519
+ );
7520
+ const ends = slots.map((slot) => {
7521
+ const under = slots.filter(other => other.column < slot.column + slot.span
7522
+ && slot.column < other.column + other.span
7523
+ && other.top >= slot.top + slot.height - EDGE_TOLERANCE);
7524
+ return under.length > 0 ? Math.min(...under.map(other => other.top)) : undefined;
7525
+ });
7526
+ const tops = [0, ...slots.map(slot => slot.top)]
7527
+ .sort((a, b) => a - b)
7528
+ .filter((top, index, sorted) => index === 0 || top - sorted[index - 1] > EDGE_TOLERANCE);
7529
+ const isSame = (a: number, b: number) => Math.abs(a - b) <= EDGE_TOLERANCE;
7530
+ const getTop = (value: number) => tops.findIndex(top => isSame(top, value));
7531
+ const positions: number[] = [];
7532
+ let position = 0;
7533
+ const pushContentTrack = (isEnding: (end: number | undefined) => boolean) => {
7534
+ const ending = slots.flatMap((slot, index) => (isEnding(ends[index]) ? [{ slot, entry: groupStart + index }] : []));
7535
+ if (ending.length === 0) return;
7536
+ if (!onBeats) {
7537
+ tracks.push('auto');
7538
+ return;
7539
+ }
7540
+ const needed = Math.max(...ending.map(({ slot, entry }) => positions[getTop(slot.top)] + (entryHeights[entry] ?? 0)));
7541
+ const track = Math.max(0, snapUp(needed) - position);
7542
+ tracks.push(track);
7543
+ position += track;
7544
+ };
7545
+ const lines = tops.map((top, index) => {
7546
+ if (index > 0) {
7547
+ tracks.push(top - tops[index - 1]);
7548
+ position += top - tops[index - 1];
7549
+ }
7550
+ pushContentTrack(end => end !== undefined && isSame(end, top));
7551
+ positions.push(position);
7552
+ return tracks.length + 1;
7553
+ });
7554
+ pushContentTrack(end => end === undefined);
7555
+ const groupEnd = tracks.length + 1;
7556
+ const getLine = (value: number) => lines[getTop(value)];
7557
+ slots.forEach((slot, index) => {
7558
+ const end = ends[index];
7559
+ gridRows.push(\`\${getLine(slot.top)} / \${end === undefined ? groupEnd : getLine(end)}\`);
7560
+ });
7561
+ }
7562
+ return { tracks, gridRows };
7563
+ }
7564
+
7303
7565
  export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, metadata, activeEvent, layoutId, portalId }: GridProps) {
7304
7566
  const { prefix: P } = useScopedStyles();
7305
7567
  const {
7306
7568
  type = 'a',
7307
7569
  gridLayout,
7570
+ customGrid,
7308
7571
  textBoxWidth = 100,
7309
7572
  verticalGap,
7310
7573
  entriesCount,
@@ -7352,62 +7615,69 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7352
7615
  hover = 'none',
7353
7616
  alignEntries = 'off',
7354
7617
  align = 'top',
7618
+ textGrowth = 'inside',
7355
7619
  } = settings;
7356
7620
 
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;
7621
+ const titleTextStyle = useMemo(() => ({
7622
+ ...omitTextColors(textStylesToCss({
7623
+ fontSettings: {
7624
+ fontFamily: titleFontFamily,
7625
+ fontWeight: titleFontSettings?.fontWeight ?? 400,
7626
+ fontStyle: titleFontSettings?.fontStyle ?? 'normal',
7627
+ },
7628
+ fontSize: titleFontSize ?? 0.01,
7629
+ lineHeight: titleLineHeight,
7630
+ letterSpacing: titleLetterSpacing ?? 0,
7631
+ wordSpacing: titleWordSpacing ?? 0,
7632
+ textAppearance: titleTextAppearance,
7633
+ color: titleColor,
7634
+ }, isEditor)),
7635
+ ...getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor),
7636
+ } as React.CSSProperties), [
7637
+ titleFontFamily, titleFontSettings, titleFontSize, titleLineHeight, titleLetterSpacing,
7638
+ titleWordSpacing, titleTextAppearance, titleColor, isEditor, P,
7639
+ ]);
7374
7640
 
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;
7641
+ const subtitleTextStyle = useMemo(() => ({
7642
+ ...omitTextColors(textStylesToCss({
7643
+ fontSettings: {
7644
+ fontFamily: subtitleFontFamily,
7645
+ fontWeight: subtitleFontSettings?.fontWeight ?? 400,
7646
+ fontStyle: subtitleFontSettings?.fontStyle ?? 'normal',
7647
+ },
7648
+ fontSize: subtitleFontSize ?? 0.01,
7649
+ lineHeight: subtitleLineHeight,
7650
+ letterSpacing: subtitleLetterSpacing ?? 0,
7651
+ wordSpacing: subtitleWordSpacing ?? 0,
7652
+ textAppearance: subtitleTextAppearance,
7653
+ color: subtitleColor,
7654
+ }, isEditor)),
7655
+ ...getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor),
7656
+ } as React.CSSProperties), [
7657
+ subtitleFontFamily, subtitleFontSettings, subtitleFontSize, subtitleLineHeight, subtitleLetterSpacing,
7658
+ subtitleWordSpacing, subtitleTextAppearance, subtitleColor, isEditor, P,
7659
+ ]);
7392
7660
 
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,
7661
+ const lightboxCounterFieldCss = useMemo(() => ({
7662
+ ...omitTextColors(textStylesToCss({
7663
+ fontSettings: {
7664
+ fontFamily: lightboxCounterFontFamily,
7665
+ fontWeight: lightboxCounterFontSettings?.fontWeight ?? 400,
7666
+ fontStyle: lightboxCounterFontSettings?.fontStyle ?? 'normal',
7667
+ },
7668
+ fontSize: lightboxCounterFontSize ?? 0.01,
7669
+ lineHeight: lightboxCounterLineHeight,
7670
+ letterSpacing: lightboxCounterLetterSpacing ?? 0,
7671
+ wordSpacing: lightboxCounterWordSpacing ?? 0,
7672
+ textAppearance: lightboxCounterTextAppearance,
7673
+ color: lightboxCounterColor,
7674
+ }, isEditor)),
7409
7675
  ...getGridTextLeadingVars(lightboxCounterFontSize, lightboxCounterLineHeight, P, isEditor),
7410
- } as React.CSSProperties;
7676
+ } as React.CSSProperties), [
7677
+ lightboxCounterFontFamily, lightboxCounterFontSettings, lightboxCounterFontSize, lightboxCounterLineHeight,
7678
+ lightboxCounterLetterSpacing, lightboxCounterWordSpacing, lightboxCounterTextAppearance, lightboxCounterColor,
7679
+ isEditor, P,
7680
+ ]);
7411
7681
 
7412
7682
  const titleTextClassName = getGridTextClassName(
7413
7683
  titleFontSize,
@@ -7421,8 +7691,6 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7421
7691
  \`\${P}-item-subtitle\`,
7422
7692
  \`\${P}-text-tight-leading\`,
7423
7693
  );
7424
- const titleTextLeadingVars = getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor);
7425
- const subtitleTextLeadingVars = getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor);
7426
7694
  const lightboxCounterClassName = getGridTextClassName(
7427
7695
  lightboxCounterFontSize,
7428
7696
  lightboxCounterLineHeight,
@@ -7430,42 +7698,56 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7430
7698
  \`\${P}-text-tight-leading\`,
7431
7699
  );
7432
7700
 
7433
- const colorVars = buildColorVars(P, {
7701
+ const colorVars = useMemo(() => buildColorVars(P, {
7434
7702
  titleColor,
7435
7703
  subtitleColor,
7436
7704
  lightboxCounterColor,
7437
- }, COLOR_VAR_MAP, STATE_KEYS);
7705
+ }, COLOR_VAR_MAP, STATE_KEYS), [P, titleColor, subtitleColor, lightboxCounterColor]);
7438
7706
 
7439
7707
  const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
7440
7708
  const showTextOnHover = showText === 'on hover' && (!isEditor || isPreviewMode);
7441
7709
  const hoverEffectClass = hover !== 'none' && (!isEditor || isPreviewMode) ? \` \${P}-hover-\${hover}\` : '';
7442
7710
  const wrapperStateClasses = \`\${stateClass}\${showTextOnHover ? \` \${P}-show-text-hover\` : ''}\${hoverEffectClass}\`.trim();
7443
7711
 
7444
- const resEntriesCount = entriesCount === 0 ? Infinity : entriesCount;
7712
+ const customLayout = customGrid && Array.isArray(customGrid.blocks) && customGrid.blocks.length > 0 ? customGrid : undefined;
7713
+ const resEntriesCount = customLayout || entriesCount === 0 ? Infinity : entriesCount;
7714
+ const isTextOutside = !!customLayout && textGrowth === 'outside';
7715
+ const itemInnerRefs = useRef<(HTMLDivElement | null)[]>([]);
7716
+ const [customEntryHeights, setCustomEntryHeights] = useState<number[]>([]);
7445
7717
 
7446
- const cropContent = (content ?? []).slice(0, resEntriesCount);
7718
+ const cropContent = useMemo<any[]>(() => (content ?? []).slice(0, resEntriesCount), [content, resEntriesCount]);
7447
7719
  const lightboxMediaToPreload = useMemo(
7448
7720
  () => (lightbox === 'on' ? collectGridLightboxMedia(cropContent) : []),
7449
7721
  [cropContent, lightbox],
7450
7722
  );
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;
7723
+ const entriesMedia = useMemo(() => cropContent.map((item: any) => {
7724
+ const displayItems = getGridDisplayItems(item.gallery);
7725
+ const lightboxItemsForEntry = displayItems
7726
+ .filter(entry => entry.lightboxMedia)
7727
+ .map(entry => entry.lightboxMedia!);
7728
+ const lightboxIndexes = displayItems.map(({ lightboxMedia }) => (lightboxMedia
7729
+ ? lightboxItemsForEntry.findIndex(media => media.assetId === lightboxMedia.assetId)
7730
+ : -1));
7731
+ return { displayItems, lightboxItemsForEntry, lightboxIndexes };
7732
+ }), [cropContent]);
7733
+
7734
+ const size = gridLayout?.entryWidth ?? 0.2;
7735
+
7736
+ const imageDisplaySettings = typeof imageDisplay === 'string' ? { display: imageDisplay } : imageDisplay;
7737
+ const isCover = imageDisplaySettings?.display === 'cover';
7738
+ const ratioValue = imageDisplaySettings?.ratioValue ?? '1:1';
7739
+ const ratioReversed = imageDisplaySettings?.reversed ?? false;
7457
7740
  const [rW, rH] = ratioValue.split(':').map(Number);
7458
7741
  const effW = ratioReversed ? rH : rW;
7459
7742
  const effH = ratioReversed ? rW : rH;
7460
7743
  const aspectRatio = \`\${effW} / \${effH}\`;
7461
7744
 
7462
- const columnsCount = gridLayout.columnsCount;
7745
+ const columnsCount = gridLayout?.columnsCount ?? 1;
7463
7746
  const entryWidthScaled = scalingValue(size ?? 0, isEditor);
7464
- const imageWrapperWidth = entryWidthScaled;
7465
- const isFitSlider = !isCover && slider !== 'off';
7747
+ const isFitSlider = !customLayout && !isCover && slider !== 'off';
7466
7748
 
7467
7749
  const itemsInLastRow = cropContent.length % columnsCount || columnsCount;
7468
- const isPartialLastRow = itemsInLastRow < columnsCount && cropContent.length > 0;
7750
+ const isPartialLastRow = !customLayout && itemsInLastRow < columnsCount && cropContent.length > 0;
7469
7751
  const lastRowStartIndex = cropContent.length - itemsInLastRow;
7470
7752
  const lastRowStartColumn = isPartialLastRow
7471
7753
  ? Math.floor((columnsCount - itemsInLastRow) / 2) + 1
@@ -7473,19 +7755,21 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7473
7755
 
7474
7756
  const imageBorderRadius = imageCorners ? scalingValue(imageCorners, isEditor) : undefined;
7475
7757
 
7476
- const imageWrapperStyle: React.CSSProperties = {
7477
- width: imageWrapperWidth,
7478
- ...(isCover
7479
- ? { aspectRatio, height: 'auto', overflow: 'hidden' }
7480
- : { height: 'auto' }),
7758
+ const getImageWrapperStyle = (entryWidth: string, slot?: CustomGridSlot): React.CSSProperties => ({
7759
+ width: entryWidth,
7760
+ ...(slot
7761
+ ? isTextOutside
7762
+ ? { height: scalingValue(slot.height, isEditor), flexShrink: 0, overflow: 'hidden' }
7763
+ : { flex: '1 1 0%', minHeight: 0, overflow: 'hidden' }
7764
+ : isCover
7765
+ ? { aspectRatio, height: 'auto', overflow: 'hidden' }
7766
+ : { height: 'auto' }),
7481
7767
  ...(imageBorderRadius ? { borderRadius: imageBorderRadius, overflow: 'hidden' } : {}),
7482
- };
7768
+ });
7483
7769
 
7484
7770
  const imageWrapperClassName = \`\${P}-item-image-wrapper\${isFitSlider ? \` \${P}-item-image-wrapper-fit-slider\` : ''}\`.trim();
7485
7771
  const isTextBeforeImage = type === 'd' || type === 'e' || type === 'f';
7486
- const shouldAlignEntries = alignEntries === 'on';
7487
- const textBoxWidthStyle = \`calc(\${scalingValue(size ?? 0, isEditor)} * (\${textBoxWidth} / 100))\`;
7488
- const controlWidthStyle = scalingValue(size * textBoxWidth / 100, isEditor);
7772
+ const shouldAlignEntries = !customLayout && alignEntries === 'on';
7489
7773
 
7490
7774
  const imageRadiusStyle = imageBorderRadius
7491
7775
  ? { borderRadius: imageBorderRadius, [MEDIA_RADIUS_VAR]: imageBorderRadius } as React.CSSProperties
@@ -7505,31 +7789,73 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7505
7789
  width: 'auto',
7506
7790
  height: 'auto',
7507
7791
  maxWidth: '100%',
7792
+ ...(customLayout ? { maxHeight: '100%' } : {}),
7508
7793
  ...imageRadiusStyle,
7509
7794
  };
7510
7795
 
7511
- const [containerWidth, setContainerWidth] = useState(0);
7512
- const containerRef = useRef<HTMLDivElement>(null);
7513
-
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);
7796
+ const shouldMeasureEntries = (customLayout?.beat ?? 0) > 0;
7797
+ const customGridWidth = customLayout ? getCustomGridSpanWidth(customLayout, customLayout.columnsCount) : 0;
7798
+ useLayoutEffect(() => {
7799
+ if (!shouldMeasureEntries) {
7800
+ setCustomEntryHeights(prev => (prev.length > 0 ? [] : prev));
7801
+ return;
7802
+ }
7803
+ const wrapper = containerRef.current;
7804
+ const inners = itemInnerRefs.current.slice(0, cropContent.length);
7805
+ const measure = () => {
7806
+ const unit = wrapper && customGridWidth > 0 ? wrapper.offsetWidth / customGridWidth : 0;
7807
+ if (unit <= 0) return;
7808
+ const heights = inners.map(inner => (inner ? inner.offsetHeight / unit : 0));
7809
+ setCustomEntryHeights(prev => (
7810
+ prev.length === heights.length && prev.every((height, index) => Math.abs(height - heights[index]) < 1e-5)
7811
+ ? prev
7812
+ : heights
7813
+ ));
7814
+ };
7815
+ measure();
7816
+ const ro = new ResizeObserver(measure);
7817
+ if (wrapper) ro.observe(wrapper);
7818
+ inners.forEach(inner => inner && ro.observe(inner));
7529
7819
  return () => ro.disconnect();
7530
- }, []);
7820
+ }, [shouldMeasureEntries, cropContent.length, customGridWidth, P]);
7821
+ const measuredEntryHeights = shouldMeasureEntries && customEntryHeights.length === cropContent.length
7822
+ ? customEntryHeights
7823
+ : undefined;
7824
+ const customRows = useMemo(() => {
7825
+ if (!customLayout) return undefined;
7826
+ const rows = getCustomGridRows(customLayout, cropContent.length, measuredEntryHeights);
7827
+ return {
7828
+ gridRows: rows.gridRows,
7829
+ gridTemplateRows: rows.tracks.length
7830
+ ? rows.tracks.map(track => (track === 'auto' ? 'auto' : scalingValue(track, isEditor))).join(' ')
7831
+ : 'auto',
7832
+ };
7833
+ }, [customLayout, cropContent.length, measuredEntryHeights, isEditor]);
7834
+ const customSlots = useMemo(
7835
+ () => (customLayout ? cropContent.map((_, index) => getCustomGridSlot(customLayout, index)) : undefined),
7836
+ [customLayout, cropContent.length],
7837
+ );
7838
+ const wrapperLayoutStyle: React.CSSProperties = customLayout
7839
+ ? {
7840
+ gridTemplateColumns: \`repeat(\${customLayout.columnsCount}, \${scalingValue(customLayout.columnWidth, isEditor)})\`,
7841
+ gridTemplateRows: customRows?.gridTemplateRows ?? 'auto',
7842
+ rowGap: 0,
7843
+ columnGap: scalingValue(customLayout.gutterWidth, isEditor),
7844
+ width: scalingValue(getCustomGridSpanWidth(customLayout, customLayout.columnsCount), isEditor),
7845
+ }
7846
+ : {
7847
+ gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
7848
+ rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
7849
+ columnGap: scalingValue(gridLayout?.horizontalGap ?? 0, isEditor),
7850
+ width: scalingValue(gridLayout?.wrapperWidth ?? 0, isEditor),
7851
+ ...(shouldAlignEntries
7852
+ ? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
7853
+ : {}),
7854
+ };
7531
7855
 
7532
- const lightboxPortalStyle = (() => {
7856
+ const containerRef = useRef<HTMLDivElement>(null);
7857
+
7858
+ const getLightboxPortalStyle = (): React.CSSProperties => {
7533
7859
  const style: Record<string, string> = { ...(colorVars as Record<string, string>) };
7534
7860
  const articleWidth = containerRef.current
7535
7861
  ? getComputedStyle(containerRef.current).getPropertyValue('--cntrl-article-width').trim()
@@ -7538,7 +7864,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7538
7864
  style['--cntrl-article-width'] = articleWidth;
7539
7865
  }
7540
7866
  return style as React.CSSProperties;
7541
- })();
7867
+ };
7542
7868
 
7543
7869
  const [lightboxOpen, setLightboxOpen] = useState(false);
7544
7870
  const [lightboxItems, setLightboxItems] = useState<GridMedia[]>([]);
@@ -7577,16 +7903,8 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7577
7903
  <div style={colorVars}>
7578
7904
  <div
7579
7905
  ref={containerRef}
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
- }}>
7906
+ className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''}\${customLayout ? \` \${P}-custom-layout\` : ''}\${isTextOutside ? \` \${P}-text-outside\` : ''} \${P}-image-align-\${align} \${wrapperStateClasses}\`.trim()}
7907
+ style={wrapperLayoutStyle}>
7590
7908
  {cropContent.map((item: any, index: number) => {
7591
7909
  const hasTitle = hasText(item.title);
7592
7910
  const hasSubtitle = hasText(item.subtitle);
@@ -7596,11 +7914,24 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7596
7914
  const gridColumn = isPartialLastRow && index >= lastRowStartIndex
7597
7915
  ? \`\${lastRowStartColumn + (index - lastRowStartIndex)}\`
7598
7916
  : undefined;
7917
+ const customSlot = customSlots?.[index];
7918
+ const itemSize = customSlot?.width ?? size;
7919
+ const itemWidthScaled = scalingValue(itemSize, isEditor);
7920
+ const textBoxWidthStyle = \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`;
7921
+ const controlWidthStyle = scalingValue(itemSize * textBoxWidth / 100, isEditor);
7922
+ const imageWrapperStyle = getImageWrapperStyle(itemWidthScaled, customSlot);
7923
+ const itemStyle: React.CSSProperties | undefined = customSlot
7924
+ ? {
7925
+ gridColumn: customSlot.gridColumn,
7926
+ gridRow: customRows?.gridRows[index],
7927
+ alignSelf: 'start',
7928
+ }
7929
+ : gridColumn && !shouldAlignEntries ? { gridColumn } : undefined;
7599
7930
 
7600
7931
  const typeCTextBlock = isTextBeforeImage ? (
7601
7932
  <div className={\`\${P}-item-text-block\`}>
7602
7933
  {hasTitle && (
7603
- <p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}>
7934
+ <p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleTextStyle }}>
7604
7935
  {item.title}
7605
7936
  </p>
7606
7937
  )}
@@ -7615,7 +7946,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7615
7946
  />
7616
7947
  )}
7617
7948
  {hasSubtitle && (
7618
- <p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}>
7949
+ <p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}>
7619
7950
  {item.subtitle}
7620
7951
  </p>
7621
7952
  )}
@@ -7645,7 +7976,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7645
7976
  />
7646
7977
  )}
7647
7978
  {hasTitle && (
7648
- <p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}>
7979
+ <p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleTextStyle }}>
7649
7980
  {item.title}
7650
7981
  </p>
7651
7982
  )}
@@ -7675,7 +8006,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7675
8006
  />
7676
8007
  )}
7677
8008
  {hasSubtitle && (
7678
- <p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}>
8009
+ <p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}>
7679
8010
  {item.subtitle}
7680
8011
  </p>
7681
8012
  )}
@@ -7699,10 +8030,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7699
8030
  </LinkWrapper>
7700
8031
  );
7701
8032
 
7702
- const displayItems = getGridDisplayItems(item.gallery);
7703
- const lightboxItemsForEntry = displayItems
7704
- .filter(entry => entry.lightboxMedia)
7705
- .map(entry => entry.lightboxMedia!);
8033
+ const { displayItems, lightboxItemsForEntry, lightboxIndexes } = entriesMedia[index];
7706
8034
 
7707
8035
  const imageContent = (
7708
8036
  <GridItemMediaWrapper className={imageWrapperClassName} style={imageWrapperStyle}>
@@ -7711,10 +8039,8 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7711
8039
  : slider === 'off'
7712
8040
  ?
7713
8041
  (() => {
7714
- const { displayMedia, lightboxMedia } = displayItems[0];
7715
- const lightboxIndex = lightboxMedia
7716
- ? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
7717
- : -1;
8042
+ const { displayMedia } = displayItems[0];
8043
+ const lightboxIndex = lightboxIndexes[0];
7718
8044
  return (
7719
8045
  <GridMediaItem
7720
8046
  media={displayMedia}
@@ -7742,50 +8068,28 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7742
8068
  ))}
7743
8069
  </div>
7744
8070
  )}
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;
8071
+ <GridEntrySlider
8072
+ key={\`\${transition}-\${itemSize}-\${direction}-\${sliderTiming}-\${layoutId}-\${displayItems.length}\`}
8073
+ prefix={P}
8074
+ isFade={transition === 'fade'}
8075
+ direction={direction}
8076
+ intervalMs={sliderTiming * 1000}
8077
+ slides={displayItems.map(({ displayMedia }, imgIndex) => {
8078
+ const lightboxIndex = lightboxIndexes[imgIndex];
7773
8079
  return (
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>
8080
+ <GridMediaItem
8081
+ media={displayMedia}
8082
+ className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
8083
+ style={imageStyle}
8084
+ hasLightbox={lightbox === 'on'}
8085
+ isSliderSlide
8086
+ onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
8087
+ ? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
8088
+ : undefined}
8089
+ />
7786
8090
  );
7787
8091
  })}
7788
- </Splide>
8092
+ />
7789
8093
  </>
7790
8094
  }
7791
8095
  </GridItemMediaWrapper>
@@ -7803,7 +8107,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7803
8107
  />
7804
8108
  <p
7805
8109
  className={titleTextClassName}
7806
- style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}
8110
+ style={{ width: textBoxWidthStyle, ...titleTextStyle }}
7807
8111
  >
7808
8112
  {item.title}
7809
8113
  </p>
@@ -7817,7 +8121,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7817
8121
  />
7818
8122
  <p
7819
8123
  className={subtitleTextClassName}
7820
- style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}
8124
+ style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}
7821
8125
  >
7822
8126
  {item.subtitle}
7823
8127
  </p>
@@ -7837,16 +8141,18 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7837
8141
  <div
7838
8142
  key={index}
7839
8143
  className={\`\${P}-item\`.trim()}
7840
- style={gridColumn && !shouldAlignEntries ? { gridColumn } : undefined}
8144
+ style={itemStyle}
7841
8145
  >
7842
8146
  <div
7843
- className={\`\${isEditMode
7844
- ? \`\${P}-item-inner\`
8147
+ ref={(el) => { itemInnerRefs.current[index] = el; }}
8148
+ className={\`\${isEditMode
8149
+ ? \`\${P}-item-inner\`
7845
8150
  : \`\${P}-item-inner-hidden\`}\${shouldAlignEntries && isLastRow ? \` \${P}-item-inner-last-row\` : ''}\`.trim()}
7846
8151
  style={{
7847
8152
  width: (textBoxWidth ?? 0) > 100
7848
- ? \`calc(\${entryWidthScaled} * (\${textBoxWidth} / 100))\`
7849
- : entryWidthScaled,
8153
+ ? \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`
8154
+ : itemWidthScaled,
8155
+ ...(customSlot && !isTextOutside ? { height: scalingValue(customSlot.height, isEditor) } : {}),
7850
8156
  ...(gridColumn && shouldAlignEntries ? { gridColumn } : {}),
7851
8157
  }}
7852
8158
  >
@@ -7892,7 +8198,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7892
8198
  {(!isEditor || isPreviewMode) && lightboxOpen && typeof document !== 'undefined' && lightbox === 'on' && (() => {
7893
8199
  const portalTarget = (portalId ? document.getElementById(portalId) : null) ?? document.body;
7894
8200
  return createPortal(
7895
- <div style={lightboxPortalStyle} data-selection="none">
8201
+ <div style={getLightboxPortalStyle()} data-selection="none">
7896
8202
  <Lightbox
7897
8203
  prefix={P}
7898
8204
  items={lightboxItems}
@@ -7929,17 +8235,36 @@ type GridLayoutConfig = {
7929
8235
  lockedParam?: 'wrapperWidth' | 'entryWidth' | 'horizontalGap' | null;
7930
8236
  };
7931
8237
 
8238
+ type CustomGridBlock = {
8239
+ column: number;
8240
+ span: number;
8241
+ top: number;
8242
+ height: number;
8243
+ };
8244
+
8245
+ type CustomGridLayout = {
8246
+ columnsCount: number;
8247
+ columnWidth: number;
8248
+ gutterWidth: number;
8249
+ maxWidth: number | null;
8250
+ verticalGap?: number;
8251
+ beat?: number;
8252
+ repeatHeight?: number;
8253
+ blocks: CustomGridBlock[];
8254
+ };
8255
+
7932
8256
  type GridSettings = {
7933
8257
  type: 'a' | 'b' | 'c' | 'd' | 'e' | 'f';
7934
- gridLayout: GridLayoutConfig;
8258
+ gridLayout?: GridLayoutConfig;
8259
+ customGrid?: CustomGridLayout;
7935
8260
  textBoxWidth: number;
7936
- verticalGap: number;
7937
- entriesCount: number;
8261
+ verticalGap?: number;
8262
+ entriesCount?: number;
7938
8263
  lightbox: 'on' | 'off';
7939
- imageDisplay: {
8264
+ imageDisplay: 'fit' | 'cover' | {
7940
8265
  display: 'fit' | 'cover';
7941
- ratioValue: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
7942
- reversed: boolean;
8266
+ ratioValue?: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
8267
+ reversed?: boolean;
7943
8268
  };
7944
8269
  imageCorners?: number;
7945
8270
  lightboxImageDisplay?: 'fit' | 'cover' | { display?: 'fit' | 'cover' };
@@ -7949,8 +8274,9 @@ type GridSettings = {
7949
8274
  transition: 'fade' | 'slide',
7950
8275
  showText: 'always' | 'on hover';
7951
8276
  hover?: 'none' | 'zoom-in' | 'greyscale' | 'scale-down';
7952
- alignEntries: 'on' | 'off';
8277
+ alignEntries?: 'on' | 'off';
7953
8278
  align?: 'top' | 'center' | 'bottom';
8279
+ textGrowth?: 'inside' | 'outside';
7954
8280
  titleMarginTop: number;
7955
8281
  subtitleMarginTop: number;
7956
8282
  titleColor: string;
@@ -25317,4 +25643,4 @@ export function Waterfall({
25317
25643
  </>
25318
25644
  );
25319
25645
  }
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;
25646
+ `,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;