@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.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { W as n, b as e, T as t, g as i, f as o, S as r, P as a, O as s, h as l, a as c, M as d, L as u, d as g, e as m, H as p, i as h, G as f, F as v, c as P, C as x, j as b, B as y } from "./ChroniclesComponent-DVoJ0kdT.mjs";
2
- const S = `import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
1
+ import { W as e, b as t, T as i, h as o, g as r, S as a, P as s, O as l, i as c, a as d, M as u, L as g, e as m, f as p, H as h, j as f, G as v, F as P, d as x, c as b, C as y, k as S, B as C } from "./ChroniclesComponent-B-93AhZK.mjs";
2
+ const w = `import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
3
3
  import { CommonComponentProps } from '../props';
4
4
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
5
5
  import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
@@ -28,11 +28,12 @@ type BurgerShowInValue = string | Record<string, string>;
28
28
 
29
29
  type BurgerLink = {
30
30
  link?: {
31
- type?: 'url' | 'page' | 'anchor';
31
+ type?: 'url' | 'page' | 'anchor' | 'file';
32
32
  value?: string;
33
33
  target?: string;
34
34
  anchor?: string;
35
35
  url?: string;
36
+ download?: string;
36
37
  };
37
38
  mode?: 'page' | 'url';
38
39
  page?: string;
@@ -257,10 +258,11 @@ function isBlankTarget(target?: string): boolean {
257
258
  }
258
259
 
259
260
  function getBurgerDest(item: BurgerLink): {
260
- type: 'url' | 'page' | 'anchor';
261
+ type: 'url' | 'page' | 'anchor' | 'file';
261
262
  value: string;
262
263
  target?: '_blank';
263
264
  anchor?: string;
265
+ download?: string;
264
266
  } {
265
267
  const dest = item.link;
266
268
  if (dest && typeof dest === 'object') {
@@ -274,8 +276,12 @@ function getBurgerDest(item: BurgerLink): {
274
276
  if (dest.type === 'page') {
275
277
  return { type: 'page', value: dest.value ?? '', target, anchor: dest.anchor };
276
278
  }
279
+ if (dest.type === 'file') {
280
+ return { type: 'file', value: dest.value ?? '' };
281
+ }
282
+ // a published file link comes as its file's url, with the name to download it under
277
283
  if (typeof dest.url === 'string') {
278
- return { type: 'url', value: dest.url, target };
284
+ return { type: 'url', value: dest.url, target, download: typeof dest.download === 'string' ? dest.download : undefined };
279
285
  }
280
286
  }
281
287
  const target = isBlankTarget(item.openIn) ? '_blank' : undefined;
@@ -296,12 +302,17 @@ function resolveBurgerLink(item: BurgerLink, pages?: BurgerPageRef[]): {
296
302
  label: string;
297
303
  href: string;
298
304
  target?: '_blank';
305
+ download?: string;
299
306
  } {
300
307
  const label = item.label || 'Link';
301
308
  const dest = getBurgerDest(item);
302
309
 
303
310
  if (dest.type === 'url') {
304
- return { label, href: dest.value, target: dest.target };
311
+ return { label, href: dest.value, target: dest.target, download: dest.download };
312
+ }
313
+ if (dest.type === 'file') {
314
+ // only the editor sees a file by its id, and downloads it through onLinkNavigate, right on the click
315
+ return { label, href: dest.value ? '#' : '', target: '_blank' };
305
316
  }
306
317
  if (dest.type === 'anchor') {
307
318
  const anchor = dest.value.replace(/^#/, '');
@@ -913,10 +924,11 @@ function renderTextPaddingControls(
913
924
  type ColorKeys = 'iconColor' | 'closeButtonColor' | 'linkColor' | 'openLinkColor' | 'compactIconColor' | 'compactLinkColor' | 'compactLogoColor' | 'compactBackgroundColor' | 'openLogoColor' | 'menuBackgroundColor' | 'overlayColor' | 'backgroundColor' | 'logoColor';
914
925
 
915
926
  export type BurgerLinkNavigateEvent = {
916
- mode: 'page' | 'url';
927
+ mode: 'page' | 'url' | 'file';
917
928
  href: string;
918
929
  page?: string;
919
930
  url?: string;
931
+ file?: string;
920
932
  anchor?: string;
921
933
  target?: '_blank';
922
934
  };
@@ -1768,6 +1780,28 @@ function findAnchorTarget(hash: string): HTMLElement | null {
1768
1780
  return target instanceof HTMLElement ? target : null;
1769
1781
  }
1770
1782
 
1783
+ // the file is on the cdn, another origin, where the download attribute alone opens it instead
1784
+ function downloadFile(url: string, name: string) {
1785
+ fetch(url)
1786
+ .then((response) => {
1787
+ if (!response.ok) throw new Error(\`Could not download \${url}: \${response.status}\`);
1788
+ return response.blob();
1789
+ })
1790
+ .then((blob) => {
1791
+ const objectUrl = URL.createObjectURL(blob);
1792
+ const link = document.createElement('a');
1793
+ link.href = objectUrl;
1794
+ link.download = name || decodeURIComponent(url.split('?')[0].split('/').pop() ?? '');
1795
+ document.body.appendChild(link);
1796
+ link.click();
1797
+ link.remove();
1798
+ window.setTimeout(() => URL.revokeObjectURL(objectUrl), 0);
1799
+ })
1800
+ .catch(() => {
1801
+ window.location.assign(url);
1802
+ });
1803
+ }
1804
+
1771
1805
  function scrollToAnchor(hash: string): boolean {
1772
1806
  const target = findAnchorTarget(hash);
1773
1807
  if (!target) return false;
@@ -1801,10 +1835,11 @@ function handleLinkClick(
1801
1835
  const resolved = resolveBurgerLink(item, pages);
1802
1836
  const dest = getBurgerDest(item);
1803
1837
  const navigateEvent: BurgerLinkNavigateEvent = {
1804
- mode: dest.type === 'url' ? 'url' : 'page',
1838
+ mode: dest.type === 'url' || dest.type === 'file' ? dest.type : 'page',
1805
1839
  href: resolved.href || href,
1806
1840
  page: dest.type === 'page' ? dest.value : undefined,
1807
1841
  url: dest.type === 'url' ? dest.value : undefined,
1842
+ file: dest.type === 'file' ? dest.value : undefined,
1808
1843
  anchor: dest.type === 'anchor'
1809
1844
  ? dest.value.replace(/^#/, '')
1810
1845
  : (dest.anchor ?? '').replace(/^#/, ''),
@@ -1826,6 +1861,14 @@ function handleLinkClick(
1826
1861
  return;
1827
1862
  }
1828
1863
 
1864
+ const download = item ? getBurgerDest(item).download : undefined;
1865
+ if (download !== undefined && href && !event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey) {
1866
+ event.preventDefault();
1867
+ downloadFile(href, download);
1868
+ onClose();
1869
+ return;
1870
+ }
1871
+
1829
1872
  if (!opensInNewTab && hash && isSameDocumentHref(href) && findAnchorTarget(hash)) {
1830
1873
  event.preventDefault();
1831
1874
  runAfterClose(() => scrollToAnchor(hash));
@@ -2431,12 +2474,13 @@ export function Burger({
2431
2474
  const showOpenNavControls = showControls && isOpen;
2432
2475
 
2433
2476
  const renderOpenNavItems = (linkClassName: string) => items.filter((item) => isVisibleInOpenNav(item, layoutId)).map((item, index) => {
2434
- const { label, href, target } = resolveBurgerLink(item, pages);
2477
+ const { label, href, target, download } = resolveBurgerLink(item, pages);
2435
2478
  const linkNode = href ? (
2436
2479
  <a
2437
2480
  href={href}
2438
2481
  target={target}
2439
2482
  rel={target === '_blank' ? 'noopener noreferrer' : undefined}
2483
+ download={download}
2440
2484
  className={\`\${linkClassName} \${P}-has-href\`}
2441
2485
  onClick={(event) => onNavLinkClick(event, item)}
2442
2486
  >
@@ -2548,7 +2592,7 @@ export function Burger({
2548
2592
  };
2549
2593
 
2550
2594
  const renderNavLink = (item: BurgerLink, index: number) => {
2551
- const { label, href, target } = resolveBurgerLink(item, pages);
2595
+ const { label, href, target, download } = resolveBurgerLink(item, pages);
2552
2596
  const textContent = (
2553
2597
  <span className={navLinkTextClassName} style={navLinkTextStyle}>
2554
2598
  {renderMultilineText(label)}
@@ -2567,6 +2611,7 @@ export function Burger({
2567
2611
  href={href}
2568
2612
  target={target}
2569
2613
  rel={target === '_blank' ? 'noopener noreferrer' : undefined}
2614
+ download={download}
2570
2615
  className={\`\${P}-nav-link \${P}-has-href\`}
2571
2616
  onClick={(event) => onNavLinkClick(event, item)}
2572
2617
  >
@@ -2684,7 +2729,7 @@ export function Burger({
2684
2729
  </div>
2685
2730
  );
2686
2731
  }
2687
- `, C = `import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
2732
+ `, $ = `import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
2688
2733
  import { createPortal } from 'react-dom';
2689
2734
  import cn from 'classnames';
2690
2735
  import { CommonComponentProps } from '../props';
@@ -3731,7 +3776,7 @@ export function Chronicles({
3731
3776
  </>
3732
3777
  );
3733
3778
  }
3734
- `, w = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3779
+ `, I = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3735
3780
  import { CommonComponentProps } from '../props';
3736
3781
  import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
3737
3782
 
@@ -4260,7 +4305,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
4260
4305
  </>
4261
4306
  );
4262
4307
  }
4263
- `, $ = `import { useCallback, useEffect, useMemo, useState } from 'react';
4308
+ `, E = `import { useCallback, useEffect, useMemo, useState } from 'react';
4264
4309
  import cn from 'classnames';
4265
4310
  import { CommonComponentProps } from '../props';
4266
4311
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
@@ -5004,7 +5049,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
5004
5049
  </>
5005
5050
  );
5006
5051
  }
5007
- `, I = `import React, { useMemo, useState } from 'react';
5052
+ `, T = `import React, { useMemo, useState } from 'react';
5008
5053
  import { CommonComponentProps } from '../props';
5009
5054
  import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
5010
5055
  import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
@@ -5642,9 +5687,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
5642
5687
  };
5643
5688
 
5644
5689
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
5645
- `, E = `import { Splide, SplideSlide } from '@splidejs/react-splide';
5646
- import '@splidejs/react-splide/css/core';
5647
- import { CommonComponentProps } from '../props';
5690
+ `, n = `import { CommonComponentProps } from '../props';
5648
5691
  import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
5649
5692
  import {
5650
5693
  buildColorVars,
@@ -5654,7 +5697,7 @@ import {
5654
5697
  useLazyVideos,
5655
5698
  useScopedStyles,
5656
5699
  } from '../utils/index';
5657
- import { useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
5700
+ import { memo, useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
5658
5701
  import { createPortal } from 'react-dom';
5659
5702
  import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
5660
5703
  import { SvgImage } from '../helpers/SvgImage/SvgImage';
@@ -5771,15 +5814,19 @@ function getCSS(P: string): string {
5771
5814
  width: 100%;
5772
5815
  overflow: hidden;
5773
5816
  }
5774
- .\${P}-item-slider .splide__track {
5775
- overflow: hidden;
5776
- }
5777
5817
  .\${P}-item-image-link {
5778
5818
  width: 100%;
5779
5819
  display: flex;
5780
5820
  flex-direction: column;
5781
5821
  align-items: center;
5782
5822
  }
5823
+ .\${P}-custom-layout .\${P}-item-image-link {
5824
+ flex: 1 1 0%;
5825
+ min-height: 0;
5826
+ }
5827
+ .\${P}-custom-layout.\${P}-text-outside .\${P}-item-image-link {
5828
+ flex: none;
5829
+ }
5783
5830
  .\${P}-item-text-link {
5784
5831
  display: flex;
5785
5832
  flex-direction: column;
@@ -5800,18 +5847,47 @@ function getCSS(P: string): string {
5800
5847
  display: block;
5801
5848
  max-width: 100%;
5802
5849
  }
5803
- .\${P}-item-slider,
5804
- .\${P}-item-slider .splide__track,
5805
- .\${P}-item-slider .splide__list,
5806
- .\${P}-item-slider .splide__slide {
5850
+ .\${P}-item-slider {
5851
+ position: relative;
5807
5852
  width: 100%;
5808
5853
  height: 100%;
5854
+ overflow: hidden;
5855
+ }
5856
+ .\${P}-item-slider-list {
5857
+ position: relative;
5858
+ display: flex;
5859
+ flex-direction: row;
5860
+ width: 100%;
5861
+ height: 100%;
5862
+ will-change: transform;
5809
5863
  }
5810
- .\${P}-item-slider .splide__slide {
5864
+ .\${P}-item-slider-list-vertical {
5865
+ flex-direction: column;
5866
+ }
5867
+ .\${P}-item-slider-list-fade {
5868
+ display: block;
5869
+ will-change: auto;
5870
+ }
5871
+ .\${P}-item-slide {
5872
+ position: relative;
5873
+ flex: 0 0 100%;
5874
+ width: 100%;
5875
+ height: 100%;
5811
5876
  display: flex;
5812
5877
  justify-content: center;
5813
5878
  align-items: center;
5814
5879
  }
5880
+ .\${P}-item-slider-list-fade .\${P}-item-slide {
5881
+ position: absolute;
5882
+ top: 0;
5883
+ left: 0;
5884
+ opacity: 0;
5885
+ transition: opacity \${SLIDER_TRANSITION_MS}ms \${SLIDER_EASING};
5886
+ }
5887
+ .\${P}-item-slider-list-fade .\${P}-item-slide-active {
5888
+ opacity: 1;
5889
+ z-index: 1;
5890
+ }
5815
5891
  .\${P}-item-title {
5816
5892
  white-space: normal;
5817
5893
  overflow-wrap: anywhere;
@@ -5958,13 +6034,13 @@ function getCSS(P: string): string {
5958
6034
  .\${P}-image-align-bottom .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
5959
6035
  align-items: flex-end;
5960
6036
  }
5961
- .\${P}-image-align-top .\${P}-item-slider .splide__slide {
6037
+ .\${P}-image-align-top .\${P}-item-slider .\${P}-item-slide {
5962
6038
  align-items: flex-start;
5963
6039
  }
5964
- .\${P}-image-align-center .\${P}-item-slider .splide__slide {
6040
+ .\${P}-image-align-center .\${P}-item-slider .\${P}-item-slide {
5965
6041
  align-items: center;
5966
6042
  }
5967
- .\${P}-image-align-bottom .\${P}-item-slider .splide__slide {
6043
+ .\${P}-image-align-bottom .\${P}-item-slider .\${P}-item-slide {
5968
6044
  align-items: flex-end;
5969
6045
  }
5970
6046
  .\${P}-align-entries .\${P}-item {
@@ -6045,13 +6121,13 @@ function getCSS(P: string): string {
6045
6121
  .\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
6046
6122
  align-items: flex-end;
6047
6123
  }
6048
- .\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider .splide__slide {
6124
+ .\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
6049
6125
  align-items: flex-start;
6050
6126
  }
6051
- .\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider .splide__slide {
6127
+ .\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
6052
6128
  align-items: center;
6053
6129
  }
6054
- .\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider .splide__slide {
6130
+ .\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
6055
6131
  align-items: flex-end;
6056
6132
  }
6057
6133
  .\${P}-image-align-top.\${P}-align-entries .\${P}-item-image-link {
@@ -6119,27 +6195,9 @@ function pickRandomSlideDirection(): 'ltr' | 'ttb' {
6119
6195
  return Math.random() < 0.5 ? 'ltr' : 'ttb';
6120
6196
  }
6121
6197
 
6122
- function resumeSplideAutoplay(splide: { Components: { Autoplay?: { pause: (stop?: boolean) => void; play: () => void } } }) {
6123
- const autoplay = splide.Components.Autoplay;
6124
- if (!autoplay) return;
6125
- autoplay.pause(false);
6126
- autoplay.play();
6127
- }
6128
-
6129
- function handleRandomSlideMoved(splide: {
6130
- options: { direction?: string };
6131
- Components: { Autoplay?: { pause: (stop?: boolean) => void; play: () => void } };
6132
- }) {
6133
- const next = pickRandomSlideDirection();
6134
- if (splide.options.direction !== next) {
6135
- splide.options = { ...splide.options, direction: next };
6136
- }
6137
-
6138
- requestAnimationFrame(() => {
6139
- requestAnimationFrame(() => {
6140
- resumeSplideAutoplay(splide);
6141
- });
6142
- });
6198
+ function wrapSlideIndex(index: number, count: number): number {
6199
+ if (count <= 0) return 0;
6200
+ return ((index % count) + count) % count;
6143
6201
  }
6144
6202
 
6145
6203
  type GridProps = {
@@ -6179,6 +6237,8 @@ type LightboxProps = {
6179
6237
 
6180
6238
  const LIGHTBOX_ANIM_MS = 500;
6181
6239
  const SLIDER_TRANSITION_MS = 750;
6240
+ const SLIDER_EASING = 'cubic-bezier(0.25, 1, 0.5, 1)';
6241
+ const SLIDER_DEFAULT_INTERVAL_MS = 5000;
6182
6242
  const LIGHTBOX_EASING = 'cubic-bezier(0.22, 1, 0.36, 1)';
6183
6243
  const SWIPE_CLOSE_THRESHOLD = 72;
6184
6244
  const SWIPE_NAV_THRESHOLD = 50;
@@ -6268,7 +6328,7 @@ function collectGridLightboxMedia(content: any[]): GridMedia[] {
6268
6328
  return result;
6269
6329
  }
6270
6330
 
6271
- function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
6331
+ const LightboxMediaPreloadPool = memo(function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
6272
6332
  const [pool, setPool] = useState<HTMLDivElement | null>(null);
6273
6333
  useLazyVideos(pool, { preload: 'metadata' });
6274
6334
  // an embed's player is only ever framed where it shows
@@ -6307,7 +6367,7 @@ function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
6307
6367
  ))}
6308
6368
  </div>
6309
6369
  );
6310
- }
6370
+ });
6311
6371
 
6312
6372
  function unloadVideoElement(video: HTMLVideoElement) {
6313
6373
  video.pause();
@@ -6315,15 +6375,121 @@ function unloadVideoElement(video: HTMLVideoElement) {
6315
6375
  video.load();
6316
6376
  }
6317
6377
 
6318
- const SPLIDE_SLIDE_VIDEOS = '.splide__slide video';
6378
+ const GRID_SLIDE_CLASS = 'cntrl-grid-slide';
6379
+ const GRID_SLIDE_PLAYING_CLASS = 'cntrl-grid-slide-playing';
6380
+ const GRID_SLIDE_VIDEOS = \`.\${GRID_SLIDE_CLASS} video\`;
6319
6381
 
6320
6382
  function shouldPlaySlideVideo(video: HTMLVideoElement): boolean {
6321
- if (video.closest('.splide--fade, .splide__slide.is-active:not(.splide__slide--clone), .splide__slide.is-next')) return true;
6322
- const slide = video.closest<HTMLElement>('.splide__slide');
6323
- if (!slide || slide.classList.contains('splide__slide--clone')) return false;
6324
- const slideIndex = slide.dataset.slideIndex;
6325
- const upcomingSlide = slide.parentElement?.querySelector<HTMLElement>('.splide__slide.is-next');
6326
- return slideIndex !== undefined && upcomingSlide?.dataset.slideIndex === slideIndex;
6383
+ return video.closest(\`.\${GRID_SLIDE_PLAYING_CLASS}\`) !== null;
6384
+ }
6385
+
6386
+ type GridEntrySliderProps = {
6387
+ prefix: string;
6388
+ slides: React.ReactNode[];
6389
+ isFade: boolean;
6390
+ direction: GridSettings['direction'];
6391
+ intervalMs: number;
6392
+ };
6393
+
6394
+ function GridEntrySlider({ prefix: P, slides, isFade, direction, intervalMs }: GridEntrySliderProps) {
6395
+ const count = slides.length;
6396
+ const hasClones = !isFade && count > 1;
6397
+ const isRandom = !isFade && direction === 'random';
6398
+ const delayMs = Number.isFinite(intervalMs) && intervalMs > 0 ? intervalMs : SLIDER_DEFAULT_INTERVAL_MS;
6399
+ const [position, setPosition] = useState(hasClones ? 1 : 0);
6400
+ const [axis, setAxis] = useState<'ltr' | 'ttb'>(!isFade && direction === 'vertical' ? 'ttb' : 'ltr');
6401
+ const [isMoving, setIsMoving] = useState(false);
6402
+ const [skipTransition, setSkipTransition] = useState(false);
6403
+ const [cycle, setCycle] = useState(0);
6404
+ const isMovingRef = useRef(false);
6405
+
6406
+ useEffect(() => {
6407
+ if (count < 2) return;
6408
+ const timeoutId = window.setTimeout(() => {
6409
+ if (isMovingRef.current) {
6410
+ setCycle(prev => prev + 1);
6411
+ return;
6412
+ }
6413
+ isMovingRef.current = true;
6414
+ setIsMoving(true);
6415
+ setSkipTransition(false);
6416
+ setPosition(prev => (hasClones ? prev + 1 : wrapSlideIndex(prev + 1, count)));
6417
+ if (!isRandom) setCycle(prev => prev + 1);
6418
+ }, delayMs);
6419
+ return () => window.clearTimeout(timeoutId);
6420
+ }, [count, cycle, delayMs, hasClones, isRandom]);
6421
+
6422
+ useEffect(() => {
6423
+ if (!isMoving) return;
6424
+ const timeoutId = window.setTimeout(() => {
6425
+ const isOnClone = hasClones && position === count + 1;
6426
+ const nextAxis = isRandom ? pickRandomSlideDirection() : axis;
6427
+ if (isOnClone || nextAxis !== axis) {
6428
+ setSkipTransition(true);
6429
+ if (isOnClone) setPosition(1);
6430
+ setAxis(nextAxis);
6431
+ }
6432
+ isMovingRef.current = false;
6433
+ setIsMoving(false);
6434
+ if (isRandom) setCycle(prev => prev + 1);
6435
+ }, SLIDER_TRANSITION_MS);
6436
+ return () => window.clearTimeout(timeoutId);
6437
+ }, [axis, count, hasClones, isMoving, isRandom, position]);
6438
+
6439
+ useEffect(() => {
6440
+ if (!skipTransition) return;
6441
+ let innerId = 0;
6442
+ const outerId = requestAnimationFrame(() => {
6443
+ innerId = requestAnimationFrame(() => setSkipTransition(false));
6444
+ });
6445
+ return () => {
6446
+ cancelAnimationFrame(outerId);
6447
+ cancelAnimationFrame(innerId);
6448
+ };
6449
+ }, [skipTransition]);
6450
+
6451
+ const slotsCount = hasClones ? count + 2 : count;
6452
+ const getItemIndex = (slot: number) => (hasClones ? wrapSlideIndex(slot - 1, count) : slot);
6453
+ const isCloneSlot = (slot: number) => hasClones && (slot === 0 || slot === count + 1);
6454
+ const activeIndex = getItemIndex(position);
6455
+ const nextSlot = position + 1 < slotsCount ? position + 1 : -1;
6456
+ const isPlayingSlot = (slot: number) => isFade
6457
+ || (slot === position && !isCloneSlot(slot))
6458
+ || slot === nextSlot
6459
+ || (nextSlot >= 0 && !isCloneSlot(slot) && getItemIndex(slot) === getItemIndex(nextSlot));
6460
+ const isVertical = !isFade && axis === 'ttb';
6461
+ const listStyle: React.CSSProperties | undefined = isFade
6462
+ ? undefined
6463
+ : {
6464
+ transform: isVertical
6465
+ ? \`translate3d(0, \${-position * 100}%, 0)\`
6466
+ : \`translate3d(\${-position * 100}%, 0, 0)\`,
6467
+ transition: skipTransition ? 'none' : \`transform \${SLIDER_TRANSITION_MS}ms \${SLIDER_EASING}\`,
6468
+ };
6469
+
6470
+ return (
6471
+ <div className={\`\${P}-item-slider\`}>
6472
+ <div
6473
+ className={\`\${P}-item-slider-list\${isFade ? \` \${P}-item-slider-list-fade\` : ''}\${isVertical ? \` \${P}-item-slider-list-vertical\` : ''}\`}
6474
+ style={listStyle}
6475
+ >
6476
+ {Array.from({ length: slotsCount }, (_, slot) => {
6477
+ const itemIndex = getItemIndex(slot);
6478
+ const isClone = isCloneSlot(slot);
6479
+ const isShown = isFade ? itemIndex === activeIndex : slot === position;
6480
+ return (
6481
+ <div
6482
+ key={isClone ? \`clone-\${slot === 0 ? 'start' : 'end'}\` : \`slide-\${itemIndex}\`}
6483
+ className={\`\${P}-item-slide \${GRID_SLIDE_CLASS}\${isFade && isShown ? \` \${P}-item-slide-active\` : ''}\${isPlayingSlot(slot) ? \` \${GRID_SLIDE_PLAYING_CLASS}\` : ''}\`}
6484
+ aria-hidden={isShown ? undefined : true}
6485
+ >
6486
+ {slides[itemIndex]}
6487
+ </div>
6488
+ );
6489
+ })}
6490
+ </div>
6491
+ </div>
6492
+ );
6327
6493
  }
6328
6494
 
6329
6495
  function GridMediaItem({
@@ -6331,7 +6497,7 @@ function GridMediaItem({
6331
6497
  className,
6332
6498
  style,
6333
6499
  hasLightbox,
6334
- isSplideSlide = false,
6500
+ isSliderSlide = false,
6335
6501
  onMediaClick,
6336
6502
  }: {
6337
6503
  media: GridMedia;
@@ -6339,7 +6505,7 @@ function GridMediaItem({
6339
6505
  style: React.CSSProperties;
6340
6506
  /** An embed then plays here as a silent loop, and as it was set to in the lightbox. */
6341
6507
  hasLightbox: boolean;
6342
- isSplideSlide?: boolean;
6508
+ isSliderSlide?: boolean;
6343
6509
  onMediaClick?: (e: React.MouseEvent<HTMLElement>) => void;
6344
6510
  }) {
6345
6511
  if (isEmbedMedia(media)) {
@@ -6371,7 +6537,7 @@ function GridMediaItem({
6371
6537
  playsInline: true,
6372
6538
  onClick: onMediaClick,
6373
6539
  };
6374
- return isSplideSlide
6540
+ return isSliderSlide
6375
6541
  ? <video {...videoProps} preload='none' />
6376
6542
  : <LazyVideo {...videoProps} autoPlay />;
6377
6543
  }
@@ -6400,7 +6566,7 @@ function GridItemMediaWrapper({
6400
6566
  children: React.ReactNode;
6401
6567
  }) {
6402
6568
  const [wrapper, setWrapper] = useState<HTMLDivElement | null>(null);
6403
- useLazyVideos(wrapper, { autoPlay: true, selector: SPLIDE_SLIDE_VIDEOS, shouldPlay: shouldPlaySlideVideo });
6569
+ useLazyVideos(wrapper, { autoPlay: true, selector: GRID_SLIDE_VIDEOS, shouldPlay: shouldPlaySlideVideo });
6404
6570
 
6405
6571
  return (
6406
6572
  <div ref={setWrapper} className={className} style={style}>
@@ -7301,11 +7467,108 @@ function resolveLightboxImageDisplay(
7301
7467
  return value?.display === 'cover' ? 'cover' : 'fit';
7302
7468
  }
7303
7469
 
7470
+ function getCustomGridSpanWidth(layout: CustomGridLayout, span: number): number {
7471
+ return layout.columnWidth * span + layout.gutterWidth * Math.max(0, span - 1);
7472
+ }
7473
+
7474
+ type CustomGridSlot = {
7475
+ column: number;
7476
+ span: number;
7477
+ width: number;
7478
+ top: number;
7479
+ height: number;
7480
+ gridColumn: string;
7481
+ };
7482
+
7483
+ function getCustomGridBlocksBottom(layout: CustomGridLayout): number {
7484
+ return layout.blocks.reduce((bottom, block) => Math.max(bottom, Math.max(0, block.top) + Math.max(0, block.height)), 0);
7485
+ }
7486
+
7487
+ function getCustomGridVerticalGap(layout: CustomGridLayout): number {
7488
+ if (typeof layout.verticalGap === 'number') return Math.max(0, layout.verticalGap);
7489
+ return Math.max(0, (layout.repeatHeight ?? 0) - getCustomGridBlocksBottom(layout));
7490
+ }
7491
+
7492
+ function getCustomGridSlot(layout: CustomGridLayout, index: number): CustomGridSlot {
7493
+ const block = layout.blocks[index % layout.blocks.length];
7494
+ const span = Math.min(Math.max(1, Math.round(block.span)), layout.columnsCount);
7495
+ const column = Math.min(Math.max(0, Math.round(block.column)), layout.columnsCount - span);
7496
+ return {
7497
+ column,
7498
+ span,
7499
+ width: getCustomGridSpanWidth(layout, span),
7500
+ top: Math.max(0, block.top),
7501
+ height: Math.max(0, block.height),
7502
+ gridColumn: \`\${column + 1} / span \${span}\`,
7503
+ };
7504
+ }
7505
+
7506
+ const EDGE_TOLERANCE = 1e-6;
7507
+
7508
+ function getCustomGridRows(layout: CustomGridLayout, entriesCount: number, entryHeights?: number[]) {
7509
+ const beat = layout.beat ?? 0;
7510
+ const onBeats = beat > 0 && !!entryHeights;
7511
+ const snapUp = (value: number) => Math.ceil(value / beat - 1e-3) * beat;
7512
+ const tracks: (number | 'auto')[] = [];
7513
+ const gridRows: string[] = [];
7514
+ const verticalGap = getCustomGridVerticalGap(layout);
7515
+ for (let groupStart = 0; groupStart < entriesCount; groupStart += layout.blocks.length) {
7516
+ if (groupStart > 0 && verticalGap > 0) tracks.push(verticalGap);
7517
+ const slots = Array.from(
7518
+ { length: Math.min(layout.blocks.length, entriesCount - groupStart) },
7519
+ (_, index) => getCustomGridSlot(layout, groupStart + index),
7520
+ );
7521
+ const ends = slots.map((slot) => {
7522
+ const under = slots.filter(other => other.column < slot.column + slot.span
7523
+ && slot.column < other.column + other.span
7524
+ && other.top >= slot.top + slot.height - EDGE_TOLERANCE);
7525
+ return under.length > 0 ? Math.min(...under.map(other => other.top)) : undefined;
7526
+ });
7527
+ const tops = [0, ...slots.map(slot => slot.top)]
7528
+ .sort((a, b) => a - b)
7529
+ .filter((top, index, sorted) => index === 0 || top - sorted[index - 1] > EDGE_TOLERANCE);
7530
+ const isSame = (a: number, b: number) => Math.abs(a - b) <= EDGE_TOLERANCE;
7531
+ const getTop = (value: number) => tops.findIndex(top => isSame(top, value));
7532
+ const positions: number[] = [];
7533
+ let position = 0;
7534
+ const pushContentTrack = (isEnding: (end: number | undefined) => boolean) => {
7535
+ const ending = slots.flatMap((slot, index) => (isEnding(ends[index]) ? [{ slot, entry: groupStart + index }] : []));
7536
+ if (ending.length === 0) return;
7537
+ if (!onBeats) {
7538
+ tracks.push('auto');
7539
+ return;
7540
+ }
7541
+ const needed = Math.max(...ending.map(({ slot, entry }) => positions[getTop(slot.top)] + (entryHeights[entry] ?? 0)));
7542
+ const track = Math.max(0, snapUp(needed) - position);
7543
+ tracks.push(track);
7544
+ position += track;
7545
+ };
7546
+ const lines = tops.map((top, index) => {
7547
+ if (index > 0) {
7548
+ tracks.push(top - tops[index - 1]);
7549
+ position += top - tops[index - 1];
7550
+ }
7551
+ pushContentTrack(end => end !== undefined && isSame(end, top));
7552
+ positions.push(position);
7553
+ return tracks.length + 1;
7554
+ });
7555
+ pushContentTrack(end => end === undefined);
7556
+ const groupEnd = tracks.length + 1;
7557
+ const getLine = (value: number) => lines[getTop(value)];
7558
+ slots.forEach((slot, index) => {
7559
+ const end = ends[index];
7560
+ gridRows.push(\`\${getLine(slot.top)} / \${end === undefined ? groupEnd : getLine(end)}\`);
7561
+ });
7562
+ }
7563
+ return { tracks, gridRows };
7564
+ }
7565
+
7304
7566
  export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, metadata, activeEvent, layoutId, portalId }: GridProps) {
7305
7567
  const { prefix: P } = useScopedStyles();
7306
7568
  const {
7307
7569
  type = 'a',
7308
7570
  gridLayout,
7571
+ customGrid,
7309
7572
  textBoxWidth = 100,
7310
7573
  verticalGap,
7311
7574
  entriesCount,
@@ -7353,62 +7616,69 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7353
7616
  hover = 'none',
7354
7617
  alignEntries = 'off',
7355
7618
  align = 'top',
7619
+ textGrowth = 'inside',
7356
7620
  } = settings;
7357
7621
 
7358
- const resolvedTitleTextStyle: TextStyles = {
7359
- fontSettings: {
7360
- fontFamily: titleFontFamily,
7361
- fontWeight: titleFontSettings?.fontWeight ?? 400,
7362
- fontStyle: titleFontSettings?.fontStyle ?? 'normal',
7363
- },
7364
- fontSize: titleFontSize ?? 0.01,
7365
- lineHeight: titleLineHeight,
7366
- letterSpacing: titleLetterSpacing ?? 0,
7367
- wordSpacing: titleWordSpacing ?? 0,
7368
- textAppearance: titleTextAppearance,
7369
- color: titleColor,
7370
- };
7371
- const titleTypographyCss = omitTextColors(textStylesToCss(resolvedTitleTextStyle, isEditor));
7372
- const titleFieldCss = {
7373
- ...titleTypographyCss,
7374
- } as React.CSSProperties;
7622
+ const titleTextStyle = useMemo(() => ({
7623
+ ...omitTextColors(textStylesToCss({
7624
+ fontSettings: {
7625
+ fontFamily: titleFontFamily,
7626
+ fontWeight: titleFontSettings?.fontWeight ?? 400,
7627
+ fontStyle: titleFontSettings?.fontStyle ?? 'normal',
7628
+ },
7629
+ fontSize: titleFontSize ?? 0.01,
7630
+ lineHeight: titleLineHeight,
7631
+ letterSpacing: titleLetterSpacing ?? 0,
7632
+ wordSpacing: titleWordSpacing ?? 0,
7633
+ textAppearance: titleTextAppearance,
7634
+ color: titleColor,
7635
+ }, isEditor)),
7636
+ ...getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor),
7637
+ } as React.CSSProperties), [
7638
+ titleFontFamily, titleFontSettings, titleFontSize, titleLineHeight, titleLetterSpacing,
7639
+ titleWordSpacing, titleTextAppearance, titleColor, isEditor, P,
7640
+ ]);
7375
7641
 
7376
- const resolvedSubtitleTextStyle: TextStyles = {
7377
- fontSettings: {
7378
- fontFamily: subtitleFontFamily,
7379
- fontWeight: subtitleFontSettings?.fontWeight ?? 400,
7380
- fontStyle: subtitleFontSettings?.fontStyle ?? 'normal',
7381
- },
7382
- fontSize: subtitleFontSize ?? 0.01,
7383
- lineHeight: subtitleLineHeight,
7384
- letterSpacing: subtitleLetterSpacing ?? 0,
7385
- wordSpacing: subtitleWordSpacing ?? 0,
7386
- textAppearance: subtitleTextAppearance,
7387
- color: subtitleColor,
7388
- };
7389
- const subtitleTypographyCss = omitTextColors(textStylesToCss(resolvedSubtitleTextStyle, isEditor));
7390
- const subtitleFieldCss = {
7391
- ...subtitleTypographyCss,
7392
- } as React.CSSProperties;
7642
+ const subtitleTextStyle = useMemo(() => ({
7643
+ ...omitTextColors(textStylesToCss({
7644
+ fontSettings: {
7645
+ fontFamily: subtitleFontFamily,
7646
+ fontWeight: subtitleFontSettings?.fontWeight ?? 400,
7647
+ fontStyle: subtitleFontSettings?.fontStyle ?? 'normal',
7648
+ },
7649
+ fontSize: subtitleFontSize ?? 0.01,
7650
+ lineHeight: subtitleLineHeight,
7651
+ letterSpacing: subtitleLetterSpacing ?? 0,
7652
+ wordSpacing: subtitleWordSpacing ?? 0,
7653
+ textAppearance: subtitleTextAppearance,
7654
+ color: subtitleColor,
7655
+ }, isEditor)),
7656
+ ...getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor),
7657
+ } as React.CSSProperties), [
7658
+ subtitleFontFamily, subtitleFontSettings, subtitleFontSize, subtitleLineHeight, subtitleLetterSpacing,
7659
+ subtitleWordSpacing, subtitleTextAppearance, subtitleColor, isEditor, P,
7660
+ ]);
7393
7661
 
7394
- const resolvedLightboxCounterTextStyle: TextStyles = {
7395
- fontSettings: {
7396
- fontFamily: lightboxCounterFontFamily,
7397
- fontWeight: lightboxCounterFontSettings?.fontWeight ?? 400,
7398
- fontStyle: lightboxCounterFontSettings?.fontStyle ?? 'normal',
7399
- },
7400
- fontSize: lightboxCounterFontSize ?? 0.01,
7401
- lineHeight: lightboxCounterLineHeight,
7402
- letterSpacing: lightboxCounterLetterSpacing ?? 0,
7403
- wordSpacing: lightboxCounterWordSpacing ?? 0,
7404
- textAppearance: lightboxCounterTextAppearance,
7405
- color: lightboxCounterColor,
7406
- };
7407
- const lightboxCounterTypographyCss = omitTextColors(textStylesToCss(resolvedLightboxCounterTextStyle, isEditor));
7408
- const lightboxCounterFieldCss = {
7409
- ...lightboxCounterTypographyCss,
7662
+ const lightboxCounterFieldCss = useMemo(() => ({
7663
+ ...omitTextColors(textStylesToCss({
7664
+ fontSettings: {
7665
+ fontFamily: lightboxCounterFontFamily,
7666
+ fontWeight: lightboxCounterFontSettings?.fontWeight ?? 400,
7667
+ fontStyle: lightboxCounterFontSettings?.fontStyle ?? 'normal',
7668
+ },
7669
+ fontSize: lightboxCounterFontSize ?? 0.01,
7670
+ lineHeight: lightboxCounterLineHeight,
7671
+ letterSpacing: lightboxCounterLetterSpacing ?? 0,
7672
+ wordSpacing: lightboxCounterWordSpacing ?? 0,
7673
+ textAppearance: lightboxCounterTextAppearance,
7674
+ color: lightboxCounterColor,
7675
+ }, isEditor)),
7410
7676
  ...getGridTextLeadingVars(lightboxCounterFontSize, lightboxCounterLineHeight, P, isEditor),
7411
- } as React.CSSProperties;
7677
+ } as React.CSSProperties), [
7678
+ lightboxCounterFontFamily, lightboxCounterFontSettings, lightboxCounterFontSize, lightboxCounterLineHeight,
7679
+ lightboxCounterLetterSpacing, lightboxCounterWordSpacing, lightboxCounterTextAppearance, lightboxCounterColor,
7680
+ isEditor, P,
7681
+ ]);
7412
7682
 
7413
7683
  const titleTextClassName = getGridTextClassName(
7414
7684
  titleFontSize,
@@ -7422,8 +7692,6 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7422
7692
  \`\${P}-item-subtitle\`,
7423
7693
  \`\${P}-text-tight-leading\`,
7424
7694
  );
7425
- const titleTextLeadingVars = getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor);
7426
- const subtitleTextLeadingVars = getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor);
7427
7695
  const lightboxCounterClassName = getGridTextClassName(
7428
7696
  lightboxCounterFontSize,
7429
7697
  lightboxCounterLineHeight,
@@ -7431,42 +7699,56 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7431
7699
  \`\${P}-text-tight-leading\`,
7432
7700
  );
7433
7701
 
7434
- const colorVars = buildColorVars(P, {
7702
+ const colorVars = useMemo(() => buildColorVars(P, {
7435
7703
  titleColor,
7436
7704
  subtitleColor,
7437
7705
  lightboxCounterColor,
7438
- }, COLOR_VAR_MAP, STATE_KEYS);
7706
+ }, COLOR_VAR_MAP, STATE_KEYS), [P, titleColor, subtitleColor, lightboxCounterColor]);
7439
7707
 
7440
7708
  const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
7441
7709
  const showTextOnHover = showText === 'on hover' && (!isEditor || isPreviewMode);
7442
7710
  const hoverEffectClass = hover !== 'none' && (!isEditor || isPreviewMode) ? \` \${P}-hover-\${hover}\` : '';
7443
7711
  const wrapperStateClasses = \`\${stateClass}\${showTextOnHover ? \` \${P}-show-text-hover\` : ''}\${hoverEffectClass}\`.trim();
7444
7712
 
7445
- const resEntriesCount = entriesCount === 0 ? Infinity : entriesCount;
7713
+ const customLayout = customGrid && Array.isArray(customGrid.blocks) && customGrid.blocks.length > 0 ? customGrid : undefined;
7714
+ const resEntriesCount = customLayout || entriesCount === 0 ? Infinity : entriesCount;
7715
+ const isTextOutside = !!customLayout && textGrowth === 'outside';
7716
+ const itemInnerRefs = useRef<(HTMLDivElement | null)[]>([]);
7717
+ const [customEntryHeights, setCustomEntryHeights] = useState<number[]>([]);
7446
7718
 
7447
- const cropContent = (content ?? []).slice(0, resEntriesCount);
7719
+ const cropContent = useMemo<any[]>(() => (content ?? []).slice(0, resEntriesCount), [content, resEntriesCount]);
7448
7720
  const lightboxMediaToPreload = useMemo(
7449
7721
  () => (lightbox === 'on' ? collectGridLightboxMedia(cropContent) : []),
7450
7722
  [cropContent, lightbox],
7451
7723
  );
7452
-
7453
- const size = gridLayout.entryWidth ?? 0.2;
7454
-
7455
- const isCover = imageDisplay?.display === 'cover';
7456
- const ratioValue = imageDisplay?.ratioValue ?? '1:1';
7457
- const ratioReversed = imageDisplay?.reversed ?? false;
7724
+ const entriesMedia = useMemo(() => cropContent.map((item: any) => {
7725
+ const displayItems = getGridDisplayItems(item.gallery);
7726
+ const lightboxItemsForEntry = displayItems
7727
+ .filter(entry => entry.lightboxMedia)
7728
+ .map(entry => entry.lightboxMedia!);
7729
+ const lightboxIndexes = displayItems.map(({ lightboxMedia }) => (lightboxMedia
7730
+ ? lightboxItemsForEntry.findIndex(media => media.assetId === lightboxMedia.assetId)
7731
+ : -1));
7732
+ return { displayItems, lightboxItemsForEntry, lightboxIndexes };
7733
+ }), [cropContent]);
7734
+
7735
+ const size = gridLayout?.entryWidth ?? 0.2;
7736
+
7737
+ const imageDisplaySettings = typeof imageDisplay === 'string' ? { display: imageDisplay } : imageDisplay;
7738
+ const isCover = imageDisplaySettings?.display === 'cover';
7739
+ const ratioValue = imageDisplaySettings?.ratioValue ?? '1:1';
7740
+ const ratioReversed = imageDisplaySettings?.reversed ?? false;
7458
7741
  const [rW, rH] = ratioValue.split(':').map(Number);
7459
7742
  const effW = ratioReversed ? rH : rW;
7460
7743
  const effH = ratioReversed ? rW : rH;
7461
7744
  const aspectRatio = \`\${effW} / \${effH}\`;
7462
7745
 
7463
- const columnsCount = gridLayout.columnsCount;
7746
+ const columnsCount = gridLayout?.columnsCount ?? 1;
7464
7747
  const entryWidthScaled = scalingValue(size ?? 0, isEditor);
7465
- const imageWrapperWidth = entryWidthScaled;
7466
- const isFitSlider = !isCover && slider !== 'off';
7748
+ const isFitSlider = !customLayout && !isCover && slider !== 'off';
7467
7749
 
7468
7750
  const itemsInLastRow = cropContent.length % columnsCount || columnsCount;
7469
- const isPartialLastRow = itemsInLastRow < columnsCount && cropContent.length > 0;
7751
+ const isPartialLastRow = !customLayout && itemsInLastRow < columnsCount && cropContent.length > 0;
7470
7752
  const lastRowStartIndex = cropContent.length - itemsInLastRow;
7471
7753
  const lastRowStartColumn = isPartialLastRow
7472
7754
  ? Math.floor((columnsCount - itemsInLastRow) / 2) + 1
@@ -7474,19 +7756,21 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7474
7756
 
7475
7757
  const imageBorderRadius = imageCorners ? scalingValue(imageCorners, isEditor) : undefined;
7476
7758
 
7477
- const imageWrapperStyle: React.CSSProperties = {
7478
- width: imageWrapperWidth,
7479
- ...(isCover
7480
- ? { aspectRatio, height: 'auto', overflow: 'hidden' }
7481
- : { height: 'auto' }),
7759
+ const getImageWrapperStyle = (entryWidth: string, slot?: CustomGridSlot): React.CSSProperties => ({
7760
+ width: entryWidth,
7761
+ ...(slot
7762
+ ? isTextOutside
7763
+ ? { height: scalingValue(slot.height, isEditor), flexShrink: 0, overflow: 'hidden' }
7764
+ : { flex: '1 1 0%', minHeight: 0, overflow: 'hidden' }
7765
+ : isCover
7766
+ ? { aspectRatio, height: 'auto', overflow: 'hidden' }
7767
+ : { height: 'auto' }),
7482
7768
  ...(imageBorderRadius ? { borderRadius: imageBorderRadius, overflow: 'hidden' } : {}),
7483
- };
7769
+ });
7484
7770
 
7485
7771
  const imageWrapperClassName = \`\${P}-item-image-wrapper\${isFitSlider ? \` \${P}-item-image-wrapper-fit-slider\` : ''}\`.trim();
7486
7772
  const isTextBeforeImage = type === 'd' || type === 'e' || type === 'f';
7487
- const shouldAlignEntries = alignEntries === 'on';
7488
- const textBoxWidthStyle = \`calc(\${scalingValue(size ?? 0, isEditor)} * (\${textBoxWidth} / 100))\`;
7489
- const controlWidthStyle = scalingValue(size * textBoxWidth / 100, isEditor);
7773
+ const shouldAlignEntries = !customLayout && alignEntries === 'on';
7490
7774
 
7491
7775
  const imageRadiusStyle = imageBorderRadius
7492
7776
  ? { borderRadius: imageBorderRadius, [MEDIA_RADIUS_VAR]: imageBorderRadius } as React.CSSProperties
@@ -7506,31 +7790,73 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7506
7790
  width: 'auto',
7507
7791
  height: 'auto',
7508
7792
  maxWidth: '100%',
7793
+ ...(customLayout ? { maxHeight: '100%' } : {}),
7509
7794
  ...imageRadiusStyle,
7510
7795
  };
7511
7796
 
7512
- const [containerWidth, setContainerWidth] = useState(0);
7513
- const containerRef = useRef<HTMLDivElement>(null);
7514
-
7515
- const resolvedSplideDirection = transition === 'fade'
7516
- ? 'ltr'
7517
- : direction === 'horizontal'
7518
- ? 'ltr'
7519
- : direction === 'vertical'
7520
- ? 'ttb'
7521
- : 'ltr';
7522
-
7523
- useEffect(() => {
7524
- const el = containerRef.current;
7525
- if (!el) return;
7526
- const ro = new ResizeObserver((entries) => {
7527
- setContainerWidth(Math.round(entries[0].contentRect.width));
7528
- });
7529
- ro.observe(el);
7797
+ const shouldMeasureEntries = (customLayout?.beat ?? 0) > 0;
7798
+ const customGridWidth = customLayout ? getCustomGridSpanWidth(customLayout, customLayout.columnsCount) : 0;
7799
+ useLayoutEffect(() => {
7800
+ if (!shouldMeasureEntries) {
7801
+ setCustomEntryHeights(prev => (prev.length > 0 ? [] : prev));
7802
+ return;
7803
+ }
7804
+ const wrapper = containerRef.current;
7805
+ const inners = itemInnerRefs.current.slice(0, cropContent.length);
7806
+ const measure = () => {
7807
+ const unit = wrapper && customGridWidth > 0 ? wrapper.offsetWidth / customGridWidth : 0;
7808
+ if (unit <= 0) return;
7809
+ const heights = inners.map(inner => (inner ? inner.offsetHeight / unit : 0));
7810
+ setCustomEntryHeights(prev => (
7811
+ prev.length === heights.length && prev.every((height, index) => Math.abs(height - heights[index]) < 1e-5)
7812
+ ? prev
7813
+ : heights
7814
+ ));
7815
+ };
7816
+ measure();
7817
+ const ro = new ResizeObserver(measure);
7818
+ if (wrapper) ro.observe(wrapper);
7819
+ inners.forEach(inner => inner && ro.observe(inner));
7530
7820
  return () => ro.disconnect();
7531
- }, []);
7821
+ }, [shouldMeasureEntries, cropContent.length, customGridWidth, P]);
7822
+ const measuredEntryHeights = shouldMeasureEntries && customEntryHeights.length === cropContent.length
7823
+ ? customEntryHeights
7824
+ : undefined;
7825
+ const customRows = useMemo(() => {
7826
+ if (!customLayout) return undefined;
7827
+ const rows = getCustomGridRows(customLayout, cropContent.length, measuredEntryHeights);
7828
+ return {
7829
+ gridRows: rows.gridRows,
7830
+ gridTemplateRows: rows.tracks.length
7831
+ ? rows.tracks.map(track => (track === 'auto' ? 'auto' : scalingValue(track, isEditor))).join(' ')
7832
+ : 'auto',
7833
+ };
7834
+ }, [customLayout, cropContent.length, measuredEntryHeights, isEditor]);
7835
+ const customSlots = useMemo(
7836
+ () => (customLayout ? cropContent.map((_, index) => getCustomGridSlot(customLayout, index)) : undefined),
7837
+ [customLayout, cropContent.length],
7838
+ );
7839
+ const wrapperLayoutStyle: React.CSSProperties = customLayout
7840
+ ? {
7841
+ gridTemplateColumns: \`repeat(\${customLayout.columnsCount}, \${scalingValue(customLayout.columnWidth, isEditor)})\`,
7842
+ gridTemplateRows: customRows?.gridTemplateRows ?? 'auto',
7843
+ rowGap: 0,
7844
+ columnGap: scalingValue(customLayout.gutterWidth, isEditor),
7845
+ width: scalingValue(getCustomGridSpanWidth(customLayout, customLayout.columnsCount), isEditor),
7846
+ }
7847
+ : {
7848
+ gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
7849
+ rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
7850
+ columnGap: scalingValue(gridLayout?.horizontalGap ?? 0, isEditor),
7851
+ width: scalingValue(gridLayout?.wrapperWidth ?? 0, isEditor),
7852
+ ...(shouldAlignEntries
7853
+ ? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
7854
+ : {}),
7855
+ };
7532
7856
 
7533
- const lightboxPortalStyle = (() => {
7857
+ const containerRef = useRef<HTMLDivElement>(null);
7858
+
7859
+ const getLightboxPortalStyle = (): React.CSSProperties => {
7534
7860
  const style: Record<string, string> = { ...(colorVars as Record<string, string>) };
7535
7861
  const articleWidth = containerRef.current
7536
7862
  ? getComputedStyle(containerRef.current).getPropertyValue('--cntrl-article-width').trim()
@@ -7539,7 +7865,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7539
7865
  style['--cntrl-article-width'] = articleWidth;
7540
7866
  }
7541
7867
  return style as React.CSSProperties;
7542
- })();
7868
+ };
7543
7869
 
7544
7870
  const [lightboxOpen, setLightboxOpen] = useState(false);
7545
7871
  const [lightboxItems, setLightboxItems] = useState<GridMedia[]>([]);
@@ -7578,16 +7904,8 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7578
7904
  <div style={colorVars}>
7579
7905
  <div
7580
7906
  ref={containerRef}
7581
- className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''} \${P}-image-align-\${align} \${wrapperStateClasses}\`.trim()}
7582
- style={{
7583
- gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
7584
- rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
7585
- columnGap: scalingValue(gridLayout.horizontalGap ?? 0, isEditor),
7586
- width: scalingValue(gridLayout.wrapperWidth ?? 0, isEditor),
7587
- ...(shouldAlignEntries
7588
- ? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
7589
- : {}),
7590
- }}>
7907
+ className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''}\${customLayout ? \` \${P}-custom-layout\` : ''}\${isTextOutside ? \` \${P}-text-outside\` : ''} \${P}-image-align-\${align} \${wrapperStateClasses}\`.trim()}
7908
+ style={wrapperLayoutStyle}>
7591
7909
  {cropContent.map((item: any, index: number) => {
7592
7910
  const hasTitle = hasText(item.title);
7593
7911
  const hasSubtitle = hasText(item.subtitle);
@@ -7597,11 +7915,24 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7597
7915
  const gridColumn = isPartialLastRow && index >= lastRowStartIndex
7598
7916
  ? \`\${lastRowStartColumn + (index - lastRowStartIndex)}\`
7599
7917
  : undefined;
7918
+ const customSlot = customSlots?.[index];
7919
+ const itemSize = customSlot?.width ?? size;
7920
+ const itemWidthScaled = scalingValue(itemSize, isEditor);
7921
+ const textBoxWidthStyle = \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`;
7922
+ const controlWidthStyle = scalingValue(itemSize * textBoxWidth / 100, isEditor);
7923
+ const imageWrapperStyle = getImageWrapperStyle(itemWidthScaled, customSlot);
7924
+ const itemStyle: React.CSSProperties | undefined = customSlot
7925
+ ? {
7926
+ gridColumn: customSlot.gridColumn,
7927
+ gridRow: customRows?.gridRows[index],
7928
+ alignSelf: 'start',
7929
+ }
7930
+ : gridColumn && !shouldAlignEntries ? { gridColumn } : undefined;
7600
7931
 
7601
7932
  const typeCTextBlock = isTextBeforeImage ? (
7602
7933
  <div className={\`\${P}-item-text-block\`}>
7603
7934
  {hasTitle && (
7604
- <p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}>
7935
+ <p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleTextStyle }}>
7605
7936
  {item.title}
7606
7937
  </p>
7607
7938
  )}
@@ -7616,7 +7947,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7616
7947
  />
7617
7948
  )}
7618
7949
  {hasSubtitle && (
7619
- <p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}>
7950
+ <p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}>
7620
7951
  {item.subtitle}
7621
7952
  </p>
7622
7953
  )}
@@ -7646,7 +7977,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7646
7977
  />
7647
7978
  )}
7648
7979
  {hasTitle && (
7649
- <p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}>
7980
+ <p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleTextStyle }}>
7650
7981
  {item.title}
7651
7982
  </p>
7652
7983
  )}
@@ -7676,7 +8007,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7676
8007
  />
7677
8008
  )}
7678
8009
  {hasSubtitle && (
7679
- <p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}>
8010
+ <p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}>
7680
8011
  {item.subtitle}
7681
8012
  </p>
7682
8013
  )}
@@ -7700,10 +8031,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7700
8031
  </LinkWrapper>
7701
8032
  );
7702
8033
 
7703
- const displayItems = getGridDisplayItems(item.gallery);
7704
- const lightboxItemsForEntry = displayItems
7705
- .filter(entry => entry.lightboxMedia)
7706
- .map(entry => entry.lightboxMedia!);
8034
+ const { displayItems, lightboxItemsForEntry, lightboxIndexes } = entriesMedia[index];
7707
8035
 
7708
8036
  const imageContent = (
7709
8037
  <GridItemMediaWrapper className={imageWrapperClassName} style={imageWrapperStyle}>
@@ -7712,10 +8040,8 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7712
8040
  : slider === 'off'
7713
8041
  ?
7714
8042
  (() => {
7715
- const { displayMedia, lightboxMedia } = displayItems[0];
7716
- const lightboxIndex = lightboxMedia
7717
- ? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
7718
- : -1;
8043
+ const { displayMedia } = displayItems[0];
8044
+ const lightboxIndex = lightboxIndexes[0];
7719
8045
  return (
7720
8046
  <GridMediaItem
7721
8047
  media={displayMedia}
@@ -7743,50 +8069,28 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7743
8069
  ))}
7744
8070
  </div>
7745
8071
  )}
7746
- <Splide
7747
- key={\`\${transition}-\${size}-\${direction}-\${sliderTiming}-\${containerWidth}-\${layoutId}\`}
7748
- className={\`\${P}-item-slider\`}
7749
- options={{
7750
- arrows: false,
7751
- pagination: false,
7752
- drag: false,
7753
- perPage: 1,
7754
- autoplay: true,
7755
- interval: sliderTiming * 1000,
7756
- width: '100%',
7757
- height: '100%',
7758
- speed: SLIDER_TRANSITION_MS,
7759
- type: transition === 'fade' ? 'fade' : 'loop',
7760
- rewind: transition === 'fade',
7761
- pauseOnHover: false,
7762
- pauseOnFocus: false,
7763
- direction: resolvedSplideDirection,
7764
- }}
7765
- onMoved={(splide) => {
7766
- if (direction !== 'random' || transition === 'fade') return;
7767
- handleRandomSlideMoved(splide);
7768
- }}
7769
- >
7770
- {displayItems.map(({ displayMedia, lightboxMedia }, imgIndex) => {
7771
- const lightboxIndex = lightboxMedia
7772
- ? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
7773
- : -1;
8072
+ <GridEntrySlider
8073
+ key={\`\${transition}-\${itemSize}-\${direction}-\${sliderTiming}-\${layoutId}-\${displayItems.length}\`}
8074
+ prefix={P}
8075
+ isFade={transition === 'fade'}
8076
+ direction={direction}
8077
+ intervalMs={sliderTiming * 1000}
8078
+ slides={displayItems.map(({ displayMedia }, imgIndex) => {
8079
+ const lightboxIndex = lightboxIndexes[imgIndex];
7774
8080
  return (
7775
- <SplideSlide key={imgIndex} data-slide-index={imgIndex}>
7776
- <GridMediaItem
7777
- media={displayMedia}
7778
- className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
7779
- style={imageStyle}
7780
- hasLightbox={lightbox === 'on'}
7781
- isSplideSlide
7782
- onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
7783
- ? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
7784
- : undefined}
7785
- />
7786
- </SplideSlide>
8081
+ <GridMediaItem
8082
+ media={displayMedia}
8083
+ className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
8084
+ style={imageStyle}
8085
+ hasLightbox={lightbox === 'on'}
8086
+ isSliderSlide
8087
+ onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
8088
+ ? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
8089
+ : undefined}
8090
+ />
7787
8091
  );
7788
8092
  })}
7789
- </Splide>
8093
+ />
7790
8094
  </>
7791
8095
  }
7792
8096
  </GridItemMediaWrapper>
@@ -7804,7 +8108,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7804
8108
  />
7805
8109
  <p
7806
8110
  className={titleTextClassName}
7807
- style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}
8111
+ style={{ width: textBoxWidthStyle, ...titleTextStyle }}
7808
8112
  >
7809
8113
  {item.title}
7810
8114
  </p>
@@ -7818,7 +8122,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7818
8122
  />
7819
8123
  <p
7820
8124
  className={subtitleTextClassName}
7821
- style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}
8125
+ style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}
7822
8126
  >
7823
8127
  {item.subtitle}
7824
8128
  </p>
@@ -7838,16 +8142,18 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7838
8142
  <div
7839
8143
  key={index}
7840
8144
  className={\`\${P}-item\`.trim()}
7841
- style={gridColumn && !shouldAlignEntries ? { gridColumn } : undefined}
8145
+ style={itemStyle}
7842
8146
  >
7843
8147
  <div
7844
- className={\`\${isEditMode
7845
- ? \`\${P}-item-inner\`
8148
+ ref={(el) => { itemInnerRefs.current[index] = el; }}
8149
+ className={\`\${isEditMode
8150
+ ? \`\${P}-item-inner\`
7846
8151
  : \`\${P}-item-inner-hidden\`}\${shouldAlignEntries && isLastRow ? \` \${P}-item-inner-last-row\` : ''}\`.trim()}
7847
8152
  style={{
7848
8153
  width: (textBoxWidth ?? 0) > 100
7849
- ? \`calc(\${entryWidthScaled} * (\${textBoxWidth} / 100))\`
7850
- : entryWidthScaled,
8154
+ ? \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`
8155
+ : itemWidthScaled,
8156
+ ...(customSlot && !isTextOutside ? { height: scalingValue(customSlot.height, isEditor) } : {}),
7851
8157
  ...(gridColumn && shouldAlignEntries ? { gridColumn } : {}),
7852
8158
  }}
7853
8159
  >
@@ -7893,7 +8199,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7893
8199
  {(!isEditor || isPreviewMode) && lightboxOpen && typeof document !== 'undefined' && lightbox === 'on' && (() => {
7894
8200
  const portalTarget = (portalId ? document.getElementById(portalId) : null) ?? document.body;
7895
8201
  return createPortal(
7896
- <div style={lightboxPortalStyle} data-selection="none">
8202
+ <div style={getLightboxPortalStyle()} data-selection="none">
7897
8203
  <Lightbox
7898
8204
  prefix={P}
7899
8205
  items={lightboxItems}
@@ -7930,17 +8236,36 @@ type GridLayoutConfig = {
7930
8236
  lockedParam?: 'wrapperWidth' | 'entryWidth' | 'horizontalGap' | null;
7931
8237
  };
7932
8238
 
8239
+ type CustomGridBlock = {
8240
+ column: number;
8241
+ span: number;
8242
+ top: number;
8243
+ height: number;
8244
+ };
8245
+
8246
+ type CustomGridLayout = {
8247
+ columnsCount: number;
8248
+ columnWidth: number;
8249
+ gutterWidth: number;
8250
+ maxWidth: number | null;
8251
+ verticalGap?: number;
8252
+ beat?: number;
8253
+ repeatHeight?: number;
8254
+ blocks: CustomGridBlock[];
8255
+ };
8256
+
7933
8257
  type GridSettings = {
7934
8258
  type: 'a' | 'b' | 'c' | 'd' | 'e' | 'f';
7935
- gridLayout: GridLayoutConfig;
8259
+ gridLayout?: GridLayoutConfig;
8260
+ customGrid?: CustomGridLayout;
7936
8261
  textBoxWidth: number;
7937
- verticalGap: number;
7938
- entriesCount: number;
8262
+ verticalGap?: number;
8263
+ entriesCount?: number;
7939
8264
  lightbox: 'on' | 'off';
7940
- imageDisplay: {
8265
+ imageDisplay: 'fit' | 'cover' | {
7941
8266
  display: 'fit' | 'cover';
7942
- ratioValue: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
7943
- reversed: boolean;
8267
+ ratioValue?: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
8268
+ reversed?: boolean;
7944
8269
  };
7945
8270
  imageCorners?: number;
7946
8271
  lightboxImageDisplay?: 'fit' | 'cover' | { display?: 'fit' | 'cover' };
@@ -7950,8 +8275,9 @@ type GridSettings = {
7950
8275
  transition: 'fade' | 'slide',
7951
8276
  showText: 'always' | 'on hover';
7952
8277
  hover?: 'none' | 'zoom-in' | 'greyscale' | 'scale-down';
7953
- alignEntries: 'on' | 'off';
8278
+ alignEntries?: 'on' | 'off';
7954
8279
  align?: 'top' | 'center' | 'bottom';
8280
+ textGrowth?: 'inside' | 'outside';
7955
8281
  titleMarginTop: number;
7956
8282
  subtitleMarginTop: number;
7957
8283
  titleColor: string;
@@ -7998,7 +8324,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
7998
8324
  };
7999
8325
 
8000
8326
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
8001
- `, T = `import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
8327
+ `, R = `import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
8002
8328
  import { CommonComponentProps } from '../props';
8003
8329
  import { scalingValue } from '../utils/scalingValue';
8004
8330
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -8571,7 +8897,7 @@ export function Helix({
8571
8897
  </>
8572
8898
  );
8573
8899
  }
8574
- `, R = `import { CommonComponentProps } from '../props';
8900
+ `, M = `import { CommonComponentProps } from '../props';
8575
8901
  import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
8576
8902
  import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
8577
8903
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
@@ -11023,7 +11349,7 @@ export function Hive({
11023
11349
  </>
11024
11350
  );
11025
11351
  }
11026
- `, M = `import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
11352
+ `, L = `import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
11027
11353
  import { createPortal } from 'react-dom';
11028
11354
  import { CommonComponentProps } from '../props';
11029
11355
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -11826,7 +12152,7 @@ export type LightboxJournalSettings = {
11826
12152
  closeIconColor: string;
11827
12153
  closeIconHoverColor: string;
11828
12154
  };
11829
- `, L = `import { useEffect, useRef, useState, type MouseEvent } from 'react';
12155
+ `, k = `import { useEffect, useRef, useState, type MouseEvent } from 'react';
11830
12156
  import { createPortal } from 'react-dom';
11831
12157
  import { CommonComponentProps } from '../props';
11832
12158
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -12410,7 +12736,7 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
12410
12736
  </>
12411
12737
  );
12412
12738
  };
12413
- `, k = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
12739
+ `, A = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
12414
12740
  import { createPortal } from 'react-dom';
12415
12741
  import { CommonComponentProps } from '../props';
12416
12742
  import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -15515,7 +15841,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
15515
15841
  </>
15516
15842
  );
15517
15843
  }
15518
- `, A = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
15844
+ `, N = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
15519
15845
  import cn from 'classnames';
15520
15846
  import { CommonComponentProps } from '../props';
15521
15847
  import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -16373,7 +16699,7 @@ type MarqueeProps = {
16373
16699
  isPreviewMode?: boolean;
16374
16700
  isEditMode?: boolean;
16375
16701
  } & CommonComponentProps;
16376
- `, N = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
16702
+ `, H = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
16377
16703
  import cn from 'classnames';
16378
16704
  import { CommonComponentProps } from '../props';
16379
16705
  import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -17316,7 +17642,7 @@ type MarqueeTextProps = {
17316
17642
  isPreviewMode?: boolean;
17317
17643
  isEditMode?: boolean;
17318
17644
  } & CommonComponentProps;
17319
- `, H = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
17645
+ `, O = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
17320
17646
  import { createPortal } from 'react-dom';
17321
17647
  import type React from 'react';
17322
17648
  import { CommonComponentProps } from '../props';
@@ -19798,7 +20124,7 @@ export function Mercury({
19798
20124
  </>
19799
20125
  );
19800
20126
  }
19801
- `, O = `import React, { useMemo, useState } from 'react';
20127
+ `, _ = `import React, { useMemo, useState } from 'react';
19802
20128
  import { CommonComponentProps } from '../props';
19803
20129
  import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
19804
20130
  import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
@@ -20377,7 +20703,7 @@ const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {
20377
20703
  };
20378
20704
 
20379
20705
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
20380
- `, _ = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
20706
+ `, F = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
20381
20707
  import type React from 'react';
20382
20708
  import { CommonComponentProps } from '../props';
20383
20709
  import { scalingValue, useScopedStyles } from '../utils/index';
@@ -21216,7 +21542,7 @@ export function Pretext({ settings, content, isEditor, isPreviewMode, isEditMode
21216
21542
  </>
21217
21543
  );
21218
21544
  }
21219
- `, F = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
21545
+ `, W = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
21220
21546
  import cn from 'classnames';
21221
21547
  import { CommonComponentProps } from '../props';
21222
21548
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -21844,7 +22170,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
21844
22170
  </>
21845
22171
  );
21846
22172
  }
21847
- `, W = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
22173
+ `, D = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
21848
22174
  import { SvgImage } from '../helpers/SvgImage/SvgImage';
21849
22175
  import { CommonComponentProps } from '../props';
21850
22176
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
@@ -22476,7 +22802,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
22476
22802
  </>
22477
22803
  );
22478
22804
  }
22479
- `, D = `import React, { useCallback, useEffect, useRef, useState } from 'react';
22805
+ `, B = `import React, { useCallback, useEffect, useRef, useState } from 'react';
22480
22806
  import cn from 'classnames';
22481
22807
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
22482
22808
  import { scalingValue } from '../utils/scalingValue';
@@ -23658,7 +23984,7 @@ function ArrowIcon({ color, className }: { color: string, className: string }) {
23658
23984
  </svg>
23659
23985
  );
23660
23986
  }
23661
- `, B = `import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
23987
+ `, z = `import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
23662
23988
  import cn from 'classnames';
23663
23989
  import { CommonComponentProps } from '../props';
23664
23990
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
@@ -24289,7 +24615,7 @@ type TestimonialsSettings = {
24289
24615
  logoHeight: number;
24290
24616
  captionMarginTop: number;
24291
24617
  };
24292
- `, z = `import cn from 'classnames';
24618
+ `, V = `import cn from 'classnames';
24293
24619
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
24294
24620
  import { CommonComponentProps } from '../props';
24295
24621
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
@@ -24785,7 +25111,7 @@ type TestimonialsSettings = {
24785
25111
  icon?: string | null;
24786
25112
  };
24787
25113
  };
24788
- `, V = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
25114
+ `, G = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
24789
25115
  import type React from 'react';
24790
25116
  import { createPortal } from 'react-dom';
24791
25117
  import { CommonComponentProps } from '../props';
@@ -25318,30 +25644,31 @@ export function Waterfall({
25318
25644
  </>
25319
25645
  );
25320
25646
  }
25321
- `, U = {
25322
- [y.id]: S,
25323
- [b.id]: C,
25324
- [x.id]: w,
25325
- [P.id]: $,
25326
- [v.id]: I,
25327
- [f.id]: E,
25328
- [h.id]: T,
25329
- [p.id]: R,
25330
- [m.id]: M,
25331
- [g.id]: L,
25332
- [u.id]: k,
25333
- [d.id]: A,
25334
- [c.id]: N,
25335
- [l.id]: H,
25336
- [s.id]: O,
25337
- [a.id]: _,
25338
- [r.id]: F,
25339
- [o.id]: W,
25340
- [i.id]: D,
25341
- [t.id]: B,
25342
- [e.id]: z,
25343
- [n.id]: V
25647
+ `, K = {
25648
+ [C.id]: w,
25649
+ [S.id]: $,
25650
+ [y.id]: I,
25651
+ [b.id]: n,
25652
+ [x.id]: E,
25653
+ [P.id]: T,
25654
+ [v.id]: n,
25655
+ [f.id]: R,
25656
+ [h.id]: M,
25657
+ [p.id]: L,
25658
+ [m.id]: k,
25659
+ [g.id]: A,
25660
+ [u.id]: N,
25661
+ [d.id]: H,
25662
+ [c.id]: O,
25663
+ [l.id]: _,
25664
+ [s.id]: F,
25665
+ [a.id]: W,
25666
+ [r.id]: D,
25667
+ [o.id]: B,
25668
+ [i.id]: z,
25669
+ [t.id]: V,
25670
+ [e.id]: G
25344
25671
  };
25345
25672
  export {
25346
- U as componentSources
25673
+ K as componentSources
25347
25674
  };