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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/{Burger-C3yVbQcq.js → Burger-B4kXX9aY.js} +1 -1
  2. package/dist/{Burger-BkVgNMGU.mjs → Burger-DyORh_vF.mjs} +1 -1
  3. package/dist/{ChroniclesComponent-Ds59v_47.mjs → ChroniclesComponent-DVoJ0kdT.mjs} +442 -512
  4. package/dist/ChroniclesComponent-Nm_yIRmr.js +1 -0
  5. package/dist/Components/Grid/Grid.d.ts +7 -25
  6. package/dist/Components/PopupMenu/PopupMenu.d.ts +73 -0
  7. package/dist/Components/PopupMenu/PopupMenuComponent.d.ts +594 -0
  8. package/dist/Components/PopupMenu/popupMenuLayout.d.ts +203 -0
  9. package/dist/Components/PopupMenu/popupMenuSnap.d.ts +61 -0
  10. package/dist/Components/helpers/SvgImage/loadSvgMaskUrl.d.ts +7 -0
  11. package/dist/{ControlSlider-DqKfaKMG.mjs → ControlSlider-3w-bHQEg.mjs} +1 -1
  12. package/dist/{ControlSlider-C8ckUIDm.js → ControlSlider-DB4nbVLT.js} +1 -1
  13. package/dist/{FAQ-DLh63Utr.js → FAQ-7HEkaoU6.js} +1 -1
  14. package/dist/{FAQ-CJHCMSBa.mjs → FAQ-GmiwRdFq.mjs} +1 -1
  15. package/dist/Grid-BuRdth9A.mjs +1622 -0
  16. package/dist/Grid-tqSSYh2-.js +408 -0
  17. package/dist/{Hive-CzabuuCc.js → Hive-34KvKNsa.js} +1 -1
  18. package/dist/{Hive-DyxYd5eg.mjs → Hive-7xHXyMM1.mjs} +1 -1
  19. package/dist/{HiveLightboxTitles-DhEeFKWs.mjs → HiveLightboxTitles-BCoL46-V.mjs} +1 -1
  20. package/dist/{HiveLightboxTitles-DlyptAaK.js → HiveLightboxTitles-DEeyQGcf.js} +1 -1
  21. package/dist/{Lightbox-DZckgBzK.js → Lightbox-Cb7lyaNt.js} +1 -1
  22. package/dist/{Lightbox-BY99NS14.mjs → Lightbox-DzPqgKP4.mjs} +1 -1
  23. package/dist/{LightboxJournal-Bf_rZzmz.js → LightboxJournal-B-vul_be.js} +1 -1
  24. package/dist/{LightboxJournal-BDUs6T0B.mjs → LightboxJournal-DisD2DLv.mjs} +1 -1
  25. package/dist/{LightboxStrip-RA4ABUC-.js → LightboxStrip-YDyEPEb6.js} +1 -1
  26. package/dist/{LightboxStrip-Cuhb2fIR.mjs → LightboxStrip-wCHUhAqN.mjs} +1 -1
  27. package/dist/{Mercury-B-s2Kvuq.js → Mercury-BmhtFYOw.js} +1 -1
  28. package/dist/{Mercury-CCW0Es-s.mjs → Mercury-Q788wrYQ.mjs} +1 -1
  29. package/dist/{OnelinerForm-C2Y_XMCY.js → OnelinerForm-CUmY-bXL.js} +1 -1
  30. package/dist/{OnelinerForm-BEu7_sho.mjs → OnelinerForm-D8WIB9Qy.mjs} +1 -1
  31. package/dist/PopupMenu-CYdDyzEt.mjs +1372 -0
  32. package/dist/PopupMenu-Di1fHgho.js +409 -0
  33. package/dist/{SimpleButton-C-o2W9bS.mjs → SimpleButton-DTpzfmb6.mjs} +1 -1
  34. package/dist/{SimpleButton-nGEcO2gB.js → SimpleButton-DtaCYa3y.js} +1 -1
  35. package/dist/{Slider20-DUi6qwnd.mjs → Slider20-CKngROrc.mjs} +1 -1
  36. package/dist/{Slider20-BOmjDRf2.js → Slider20-q0iGgnE3.js} +1 -1
  37. package/dist/SvgImage-CwRq9-ec.mjs +56 -0
  38. package/dist/SvgImage-_QN8ngad.js +1 -0
  39. package/dist/{TestimonialSingle-DrnyReim.mjs → TestimonialSingle-Bax71Hyo.mjs} +1 -1
  40. package/dist/{TestimonialSingle-BORQom3u.js → TestimonialSingle-CpEUendN.js} +1 -1
  41. package/dist/{Waterfall-DII4-WV5.js → Waterfall-B9YWMhrg.js} +1 -1
  42. package/dist/{Waterfall-3kKioKh2.mjs → Waterfall-znaoynn5.mjs} +1 -1
  43. package/dist/components-BYoTPJk3.js +1 -0
  44. package/dist/{components-MVf3iei3.mjs → components-eK82xypT.mjs} +653 -30
  45. package/dist/elements.js +1 -1
  46. package/dist/elements.mjs +24 -24
  47. package/dist/elements.node.js +1 -1
  48. package/dist/elements.node.mjs +1 -1
  49. package/dist/index.d.ts +3 -1
  50. package/dist/index.js +1 -1
  51. package/dist/index.mjs +63 -36
  52. package/dist/loadSvgMaskUrl-B6kHUyof.js +1 -0
  53. package/dist/loadSvgMaskUrl-DUhCVvpl.mjs +39 -0
  54. package/dist/sources.js +48 -250
  55. package/dist/sources.mjs +87 -290
  56. package/dist/types/Component.d.ts +7 -0
  57. package/dist/types/SchemaV1.d.ts +3 -0
  58. package/package.json +1 -1
  59. package/dist/ChroniclesComponent--pzhQXVD.js +0 -1
  60. package/dist/Components/Grid/CustomGridComponent.d.ts +0 -41
  61. package/dist/Grid-B0NOfgEm.mjs +0 -1713
  62. package/dist/Grid-DNaBgqZo.js +0 -415
  63. package/dist/SvgImage-B5mR9y6q.mjs +0 -51
  64. package/dist/SvgImage-DFlmxAoL.js +0 -1
  65. package/dist/components-tuVRZ0WY.js +0 -1
  66. package/dist/loadSvgMaskUrl-DfF7ay6h.js +0 -1
  67. package/dist/loadSvgMaskUrl-xHgGYgPe.mjs +0 -20
package/dist/sources.mjs CHANGED
@@ -1,5 +1,5 @@
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-Ds59v_47.mjs";
2
- const w = `import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
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';
3
3
  import { CommonComponentProps } from '../props';
4
4
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
5
5
  import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
@@ -2684,7 +2684,7 @@ export function Burger({
2684
2684
  </div>
2685
2685
  );
2686
2686
  }
2687
- `, $ = `import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
2687
+ `, C = `import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
2688
2688
  import { createPortal } from 'react-dom';
2689
2689
  import cn from 'classnames';
2690
2690
  import { CommonComponentProps } from '../props';
@@ -3731,7 +3731,7 @@ export function Chronicles({
3731
3731
  </>
3732
3732
  );
3733
3733
  }
3734
- `, I = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3734
+ `, w = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3735
3735
  import { CommonComponentProps } from '../props';
3736
3736
  import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
3737
3737
 
@@ -4260,7 +4260,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
4260
4260
  </>
4261
4261
  );
4262
4262
  }
4263
- `, E = `import { useCallback, useEffect, useMemo, useState } from 'react';
4263
+ `, $ = `import { useCallback, useEffect, useMemo, useState } from 'react';
4264
4264
  import cn from 'classnames';
4265
4265
  import { CommonComponentProps } from '../props';
4266
4266
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
@@ -5004,7 +5004,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
5004
5004
  </>
5005
5005
  );
5006
5006
  }
5007
- `, T = `import React, { useMemo, useState } from 'react';
5007
+ `, I = `import React, { useMemo, useState } from 'react';
5008
5008
  import { CommonComponentProps } from '../props';
5009
5009
  import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
5010
5010
  import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
@@ -5642,7 +5642,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
5642
5642
  };
5643
5643
 
5644
5644
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
5645
- `, n = `import { Splide, SplideSlide } from '@splidejs/react-splide';
5645
+ `, E = `import { Splide, SplideSlide } from '@splidejs/react-splide';
5646
5646
  import '@splidejs/react-splide/css/core';
5647
5647
  import { CommonComponentProps } from '../props';
5648
5648
  import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
@@ -5780,13 +5780,6 @@ function getCSS(P: string): string {
5780
5780
  flex-direction: column;
5781
5781
  align-items: center;
5782
5782
  }
5783
- .\${P}-custom-layout .\${P}-item-image-link {
5784
- flex: 1 1 0%;
5785
- min-height: 0;
5786
- }
5787
- .\${P}-custom-layout.\${P}-text-outside .\${P}-item-image-link {
5788
- flex: none;
5789
- }
5790
5783
  .\${P}-item-text-link {
5791
5784
  display: flex;
5792
5785
  flex-direction: column;
@@ -7308,94 +7301,11 @@ function resolveLightboxImageDisplay(
7308
7301
  return value?.display === 'cover' ? 'cover' : 'fit';
7309
7302
  }
7310
7303
 
7311
- function getCustomGridSpanWidth(layout: CustomGridLayout, span: number): number {
7312
- return layout.columnWidth * span + layout.gutterWidth * Math.max(0, span - 1);
7313
- }
7314
-
7315
- type CustomGridSlot = {
7316
- // first column the entry covers and how many, kept in the layout's columns
7317
- column: number;
7318
- span: number;
7319
- width: number;
7320
- top: number;
7321
- height: number;
7322
- gridColumn: string;
7323
- gridRow: string;
7324
- };
7325
-
7326
- function getCustomGridBlocksBottom(layout: CustomGridLayout): number {
7327
- return layout.blocks.reduce((bottom, block) => Math.max(bottom, Math.max(0, block.top) + Math.max(0, block.height)), 0);
7328
- }
7329
-
7330
- function getCustomGridVerticalGap(layout: CustomGridLayout): number {
7331
- if (typeof layout.verticalGap === 'number') return Math.max(0, layout.verticalGap);
7332
- return Math.max(0, (layout.repeatHeight ?? 0) - getCustomGridBlocksBottom(layout));
7333
- }
7334
-
7335
- // entries fill the layout's blocks in order, one group after another
7336
- function getCustomGridSlot(layout: CustomGridLayout, index: number): CustomGridSlot {
7337
- const block = layout.blocks[index % layout.blocks.length];
7338
- const span = Math.min(Math.max(1, Math.round(block.span)), layout.columnsCount);
7339
- const column = Math.min(Math.max(0, Math.round(block.column)), layout.columnsCount - span);
7340
- return {
7341
- column,
7342
- span,
7343
- width: getCustomGridSpanWidth(layout, span),
7344
- top: Math.max(0, block.top),
7345
- height: Math.max(0, block.height),
7346
- gridColumn: \`\${column + 1} / span \${span}\`,
7347
- gridRow: \`\${Math.floor(index / layout.blocks.length) + 1}\`,
7348
- };
7349
- }
7350
-
7351
- // the first of the grid's beats at or under \`value\`, from the top of the group
7352
- function snapDownToCustomGridBeat(layout: CustomGridLayout, value: number): number {
7353
- const beat = layout.beat ?? 0;
7354
- return beat > 0 ? Math.ceil(value / beat - 1e-6) * beat : value;
7355
- }
7356
-
7357
- /**
7358
- * With the text outside the blocks, every entry's text takes room under its block: an entry of its
7359
- * group under it in the same columns keeps where it is drawn, moved along with the entry above,
7360
- * unless that text reaches it, and then goes onto the first beat under the text. The group grows to
7361
- * the first beat under its lowest text. Text heights, tops and group heights are in layout units,
7362
- * like the blocks'.
7363
- */
7364
- function getCustomGridOutsideTextPlacement(layout: CustomGridLayout, textHeights: number[]) {
7365
- const slots = textHeights.map((_, index) => getCustomGridSlot(layout, index));
7366
- const tops = slots.map(slot => slot.top);
7367
- const groupHeights: number[] = [];
7368
- for (let groupStart = 0; groupStart < slots.length; groupStart += layout.blocks.length) {
7369
- const group = slots
7370
- .map((slot, index) => ({ slot, index }))
7371
- .slice(groupStart, groupStart + layout.blocks.length)
7372
- .sort((a, b) => a.slot.top - b.slot.top);
7373
- let bottom = getCustomGridBlocksBottom(layout);
7374
- for (const { slot, index } of group) {
7375
- let top = slot.top;
7376
- for (const { slot: above, index: aboveIndex } of group) {
7377
- const isAbove = above.top + above.height <= slot.top + 1e-6 && aboveIndex !== index;
7378
- const sharesColumns = above.column < slot.column + slot.span && slot.column < above.column + above.span;
7379
- if (isAbove && sharesColumns) {
7380
- const textBottom = tops[aboveIndex] + above.height + textHeights[aboveIndex];
7381
- const drawnTop = slot.top + tops[aboveIndex] - above.top;
7382
- top = Math.max(top, drawnTop >= textBottom - 1e-6 ? drawnTop : snapDownToCustomGridBeat(layout, textBottom));
7383
- }
7384
- }
7385
- tops[index] = top;
7386
- bottom = Math.max(bottom, tops[index] + slot.height + textHeights[index]);
7387
- }
7388
- groupHeights.push(snapDownToCustomGridBeat(layout, bottom));
7389
- }
7390
- return { tops, groupHeights };
7391
- }
7392
-
7393
7304
  export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, metadata, activeEvent, layoutId, portalId }: GridProps) {
7394
7305
  const { prefix: P } = useScopedStyles();
7395
7306
  const {
7396
7307
  type = 'a',
7397
7308
  gridLayout,
7398
- customGrid,
7399
7309
  textBoxWidth = 100,
7400
7310
  verticalGap,
7401
7311
  entriesCount,
@@ -7443,7 +7353,6 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7443
7353
  hover = 'none',
7444
7354
  alignEntries = 'off',
7445
7355
  align = 'top',
7446
- textGrowth = 'inside',
7447
7356
  } = settings;
7448
7357
 
7449
7358
  const resolvedTitleTextStyle: TextStyles = {
@@ -7533,16 +7442,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7533
7442
  const hoverEffectClass = hover !== 'none' && (!isEditor || isPreviewMode) ? \` \${P}-hover-\${hover}\` : '';
7534
7443
  const wrapperStateClasses = \`\${stateClass}\${showTextOnHover ? \` \${P}-show-text-hover\` : ''}\${hoverEffectClass}\`.trim();
7535
7444
 
7536
- // a custom layout places entries itself, in place of the columns, gap and entries count: its
7537
- // group of blocks repeats for as many entries as there are. Stored, it is only the preset it is
7538
- // linked to; the CMS and the site put the blocks in before it gets here
7539
- const customLayout = customGrid && Array.isArray(customGrid.blocks) && customGrid.blocks.length > 0 ? customGrid : undefined;
7540
- const resEntriesCount = customLayout || entriesCount === 0 ? Infinity : entriesCount;
7541
- // outside, the media fills the block and the text takes room of its own beyond it: below the
7542
- // media, or above it when the type puts the text first, moving the entries under it down
7543
- const isTextOutside = !!customLayout && textGrowth === 'outside';
7544
- const itemInnerRefs = useRef<(HTMLDivElement | null)[]>([]);
7545
- const [customTextHeights, setCustomTextHeights] = useState<number[]>([]);
7445
+ const resEntriesCount = entriesCount === 0 ? Infinity : entriesCount;
7546
7446
 
7547
7447
  const cropContent = (content ?? []).slice(0, resEntriesCount);
7548
7448
  const lightboxMediaToPreload = useMemo(
@@ -7550,24 +7450,23 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7550
7450
  [cropContent, lightbox],
7551
7451
  );
7552
7452
 
7553
- const size = gridLayout?.entryWidth ?? 0.2;
7453
+ const size = gridLayout.entryWidth ?? 0.2;
7554
7454
 
7555
- const imageDisplaySettings = typeof imageDisplay === 'string' ? { display: imageDisplay } : imageDisplay;
7556
- const isCover = imageDisplaySettings?.display === 'cover';
7557
- const ratioValue = imageDisplaySettings?.ratioValue ?? '1:1';
7558
- const ratioReversed = imageDisplaySettings?.reversed ?? false;
7455
+ const isCover = imageDisplay?.display === 'cover';
7456
+ const ratioValue = imageDisplay?.ratioValue ?? '1:1';
7457
+ const ratioReversed = imageDisplay?.reversed ?? false;
7559
7458
  const [rW, rH] = ratioValue.split(':').map(Number);
7560
7459
  const effW = ratioReversed ? rH : rW;
7561
7460
  const effH = ratioReversed ? rW : rH;
7562
7461
  const aspectRatio = \`\${effW} / \${effH}\`;
7563
7462
 
7564
- const columnsCount = gridLayout?.columnsCount ?? 1;
7463
+ const columnsCount = gridLayout.columnsCount;
7565
7464
  const entryWidthScaled = scalingValue(size ?? 0, isEditor);
7566
- // a custom block sets the entry's height, so the fit slider has nothing to size it by
7567
- const isFitSlider = !customLayout && !isCover && slider !== 'off';
7465
+ const imageWrapperWidth = entryWidthScaled;
7466
+ const isFitSlider = !isCover && slider !== 'off';
7568
7467
 
7569
7468
  const itemsInLastRow = cropContent.length % columnsCount || columnsCount;
7570
- const isPartialLastRow = !customLayout && itemsInLastRow < columnsCount && cropContent.length > 0;
7469
+ const isPartialLastRow = itemsInLastRow < columnsCount && cropContent.length > 0;
7571
7470
  const lastRowStartIndex = cropContent.length - itemsInLastRow;
7572
7471
  const lastRowStartColumn = isPartialLastRow
7573
7472
  ? Math.floor((columnsCount - itemsInLastRow) / 2) + 1
@@ -7575,23 +7474,19 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7575
7474
 
7576
7475
  const imageBorderRadius = imageCorners ? scalingValue(imageCorners, isEditor) : undefined;
7577
7476
 
7578
- const getImageWrapperStyle = (entryWidth: string, slot?: CustomGridSlot): React.CSSProperties => ({
7579
- width: entryWidth,
7580
- // in a custom block the media takes whatever the entry's text leaves of the block's height,
7581
- // or the whole block when the text goes outside it
7582
- ...(slot
7583
- ? isTextOutside
7584
- ? { height: scalingValue(slot.height, isEditor), flexShrink: 0, overflow: 'hidden' }
7585
- : { flex: '1 1 0%', minHeight: 0, overflow: 'hidden' }
7586
- : isCover
7587
- ? { aspectRatio, height: 'auto', overflow: 'hidden' }
7588
- : { height: 'auto' }),
7477
+ const imageWrapperStyle: React.CSSProperties = {
7478
+ width: imageWrapperWidth,
7479
+ ...(isCover
7480
+ ? { aspectRatio, height: 'auto', overflow: 'hidden' }
7481
+ : { height: 'auto' }),
7589
7482
  ...(imageBorderRadius ? { borderRadius: imageBorderRadius, overflow: 'hidden' } : {}),
7590
- });
7483
+ };
7591
7484
 
7592
7485
  const imageWrapperClassName = \`\${P}-item-image-wrapper\${isFitSlider ? \` \${P}-item-image-wrapper-fit-slider\` : ''}\`.trim();
7593
7486
  const isTextBeforeImage = type === 'd' || type === 'e' || type === 'f';
7594
- const shouldAlignEntries = !customLayout && alignEntries === 'on';
7487
+ const shouldAlignEntries = alignEntries === 'on';
7488
+ const textBoxWidthStyle = \`calc(\${scalingValue(size ?? 0, isEditor)} * (\${textBoxWidth} / 100))\`;
7489
+ const controlWidthStyle = scalingValue(size * textBoxWidth / 100, isEditor);
7595
7490
 
7596
7491
  const imageRadiusStyle = imageBorderRadius
7597
7492
  ? { borderRadius: imageBorderRadius, [MEDIA_RADIUS_VAR]: imageBorderRadius } as React.CSSProperties
@@ -7611,68 +7506,9 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7611
7506
  width: 'auto',
7612
7507
  height: 'auto',
7613
7508
  maxWidth: '100%',
7614
- ...(customLayout ? { maxHeight: '100%' } : {}),
7615
7509
  ...imageRadiusStyle,
7616
7510
  };
7617
7511
 
7618
- // the text's height is only known once laid out: what an entry measures beyond its media, in
7619
- // layout units, the layout's whole width taken as the wrapper's
7620
- const customGridWidth = customLayout ? getCustomGridSpanWidth(customLayout, customLayout.columnsCount) : 0;
7621
- useLayoutEffect(() => {
7622
- if (!isTextOutside) {
7623
- setCustomTextHeights(prev => (prev.length > 0 ? [] : prev));
7624
- return;
7625
- }
7626
- const wrapper = containerRef.current;
7627
- const inners = itemInnerRefs.current.slice(0, cropContent.length);
7628
- const measure = () => {
7629
- const unit = wrapper && customGridWidth > 0 ? wrapper.offsetWidth / customGridWidth : 0;
7630
- const heights = inners.map((inner) => {
7631
- const media = inner?.querySelector<HTMLElement>(\`.\${P}-item-image-wrapper\`);
7632
- return inner && media && unit > 0 ? Math.max(0, inner.offsetHeight - media.offsetHeight) / unit : 0;
7633
- });
7634
- setCustomTextHeights(prev => (
7635
- prev.length === heights.length && prev.every((height, index) => Math.abs(height - heights[index]) < 1e-5)
7636
- ? prev
7637
- : heights
7638
- ));
7639
- };
7640
- measure();
7641
- const ro = new ResizeObserver(measure);
7642
- if (wrapper) ro.observe(wrapper);
7643
- inners.forEach(inner => inner && ro.observe(inner));
7644
- return () => ro.disconnect();
7645
- }, [isTextOutside, cropContent.length, customGridWidth, P]);
7646
- const customOutsideText = customLayout && isTextOutside
7647
- ? getCustomGridOutsideTextPlacement(customLayout, cropContent.map((_: unknown, index: number) => customTextHeights[index] ?? 0))
7648
- : undefined;
7649
-
7650
- const customRowsCount = customLayout ? Math.ceil(cropContent.length / customLayout.blocks.length) : 0;
7651
- const customGroupHeight = customLayout ? scalingValue(getCustomGridBlocksBottom(customLayout), isEditor) : '';
7652
- const wrapperLayoutStyle: React.CSSProperties = customLayout
7653
- ? {
7654
- gridTemplateColumns: \`repeat(\${customLayout.columnsCount}, \${scalingValue(customLayout.columnWidth, isEditor)})\`,
7655
- // every group keeps the height of its blocks, or of the beats its text outside them takes,
7656
- // but the last, which ends where its entries do
7657
- gridTemplateRows: customRowsCount > 1
7658
- ? customOutsideText
7659
- ? \`\${customOutsideText.groupHeights.slice(0, -1).map(height => \`minmax(\${scalingValue(height, isEditor)}, auto)\`).join(' ')} auto\`
7660
- : \`repeat(\${customRowsCount - 1}, minmax(\${customGroupHeight}, auto)) auto\`
7661
- : 'auto',
7662
- rowGap: scalingValue(getCustomGridVerticalGap(customLayout), isEditor),
7663
- columnGap: scalingValue(customLayout.gutterWidth, isEditor),
7664
- width: scalingValue(getCustomGridSpanWidth(customLayout, customLayout.columnsCount), isEditor),
7665
- }
7666
- : {
7667
- gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
7668
- rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
7669
- columnGap: scalingValue(gridLayout?.horizontalGap ?? 0, isEditor),
7670
- width: scalingValue(gridLayout?.wrapperWidth ?? 0, isEditor),
7671
- ...(shouldAlignEntries
7672
- ? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
7673
- : {}),
7674
- };
7675
-
7676
7512
  const [containerWidth, setContainerWidth] = useState(0);
7677
7513
  const containerRef = useRef<HTMLDivElement>(null);
7678
7514
 
@@ -7742,8 +7578,16 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7742
7578
  <div style={colorVars}>
7743
7579
  <div
7744
7580
  ref={containerRef}
7745
- className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''}\${customLayout ? \` \${P}-custom-layout\` : ''}\${isTextOutside ? \` \${P}-text-outside\` : ''} \${P}-image-align-\${align} \${wrapperStateClasses}\`.trim()}
7746
- style={wrapperLayoutStyle}>
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
+ }}>
7747
7591
  {cropContent.map((item: any, index: number) => {
7748
7592
  const hasTitle = hasText(item.title);
7749
7593
  const hasSubtitle = hasText(item.subtitle);
@@ -7753,20 +7597,6 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7753
7597
  const gridColumn = isPartialLastRow && index >= lastRowStartIndex
7754
7598
  ? \`\${lastRowStartColumn + (index - lastRowStartIndex)}\`
7755
7599
  : undefined;
7756
- const customSlot = customLayout ? getCustomGridSlot(customLayout, index) : undefined;
7757
- const itemSize = customSlot?.width ?? size;
7758
- const itemWidthScaled = scalingValue(itemSize, isEditor);
7759
- const textBoxWidthStyle = \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`;
7760
- const controlWidthStyle = scalingValue(itemSize * textBoxWidth / 100, isEditor);
7761
- const imageWrapperStyle = getImageWrapperStyle(itemWidthScaled, customSlot);
7762
- const itemStyle: React.CSSProperties | undefined = customSlot
7763
- ? {
7764
- gridColumn: customSlot.gridColumn,
7765
- gridRow: customSlot.gridRow,
7766
- alignSelf: 'start',
7767
- marginTop: scalingValue(customOutsideText?.tops[index] ?? customSlot.top, isEditor),
7768
- }
7769
- : gridColumn && !shouldAlignEntries ? { gridColumn } : undefined;
7770
7600
 
7771
7601
  const typeCTextBlock = isTextBeforeImage ? (
7772
7602
  <div className={\`\${P}-item-text-block\`}>
@@ -7914,7 +7744,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
7914
7744
  </div>
7915
7745
  )}
7916
7746
  <Splide
7917
- key={\`\${transition}-\${itemSize}-\${direction}-\${sliderTiming}-\${containerWidth}-\${layoutId}\`}
7747
+ key={\`\${transition}-\${size}-\${direction}-\${sliderTiming}-\${containerWidth}-\${layoutId}\`}
7918
7748
  className={\`\${P}-item-slider\`}
7919
7749
  options={{
7920
7750
  arrows: false,
@@ -8008,18 +7838,16 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
8008
7838
  <div
8009
7839
  key={index}
8010
7840
  className={\`\${P}-item\`.trim()}
8011
- style={itemStyle}
7841
+ style={gridColumn && !shouldAlignEntries ? { gridColumn } : undefined}
8012
7842
  >
8013
7843
  <div
8014
- ref={(el) => { itemInnerRefs.current[index] = el; }}
8015
- className={\`\${isEditMode
8016
- ? \`\${P}-item-inner\`
7844
+ className={\`\${isEditMode
7845
+ ? \`\${P}-item-inner\`
8017
7846
  : \`\${P}-item-inner-hidden\`}\${shouldAlignEntries && isLastRow ? \` \${P}-item-inner-last-row\` : ''}\`.trim()}
8018
7847
  style={{
8019
7848
  width: (textBoxWidth ?? 0) > 100
8020
- ? \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`
8021
- : itemWidthScaled,
8022
- ...(customSlot && !isTextOutside ? { height: scalingValue(customSlot.height, isEditor) } : {}),
7849
+ ? \`calc(\${entryWidthScaled} * (\${textBoxWidth} / 100))\`
7850
+ : entryWidthScaled,
8023
7851
  ...(gridColumn && shouldAlignEntries ? { gridColumn } : {}),
8024
7852
  }}
8025
7853
  >
@@ -8102,45 +7930,17 @@ type GridLayoutConfig = {
8102
7930
  lockedParam?: 'wrapperWidth' | 'entryWidth' | 'horizontalGap' | null;
8103
7931
  };
8104
7932
 
8105
- type CustomGridBlock = {
8106
- // first column the block covers, from 0
8107
- column: number;
8108
- span: number;
8109
- // offset from the top of its group
8110
- top: number;
8111
- // height of the whole entry: its media fills what the text leaves
8112
- height: number;
8113
- };
8114
-
8115
- // lengths are fractions of the layout width, like the article grid's
8116
- type CustomGridLayout = {
8117
- columnsCount: number;
8118
- columnWidth: number;
8119
- gutterWidth: number;
8120
- maxWidth: number | null;
8121
- // space between one group of blocks and the next
8122
- verticalGap?: number;
8123
- // the article grid's beat: entries the text outside the blocks pushes down land on it; 0, or
8124
- // missing from layouts resolved before it, when there is none
8125
- beat?: number;
8126
- // layouts saved before the vertical gap kept the height of a whole group instead
8127
- repeatHeight?: number;
8128
- blocks: CustomGridBlock[];
8129
- };
8130
-
8131
7933
  type GridSettings = {
8132
7934
  type: 'a' | 'b' | 'c' | 'd' | 'e' | 'f';
8133
- // one of the two places entries: Neptune's columns, or a layout drawn in the custom grid builder
8134
- gridLayout?: GridLayoutConfig;
8135
- customGrid?: CustomGridLayout;
7935
+ gridLayout: GridLayoutConfig;
8136
7936
  textBoxWidth: number;
8137
- verticalGap?: number;
8138
- entriesCount?: number;
7937
+ verticalGap: number;
7938
+ entriesCount: number;
8139
7939
  lightbox: 'on' | 'off';
8140
- imageDisplay: 'fit' | 'cover' | {
7940
+ imageDisplay: {
8141
7941
  display: 'fit' | 'cover';
8142
- ratioValue?: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
8143
- reversed?: boolean;
7942
+ ratioValue: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
7943
+ reversed: boolean;
8144
7944
  };
8145
7945
  imageCorners?: number;
8146
7946
  lightboxImageDisplay?: 'fit' | 'cover' | { display?: 'fit' | 'cover' };
@@ -8150,10 +7950,8 @@ type GridSettings = {
8150
7950
  transition: 'fade' | 'slide',
8151
7951
  showText: 'always' | 'on hover';
8152
7952
  hover?: 'none' | 'zoom-in' | 'greyscale' | 'scale-down';
8153
- alignEntries?: 'on' | 'off';
7953
+ alignEntries: 'on' | 'off';
8154
7954
  align?: 'top' | 'center' | 'bottom';
8155
- // with a custom layout: whether a block holds the entry's text or only its media
8156
- textGrowth?: 'inside' | 'outside';
8157
7955
  titleMarginTop: number;
8158
7956
  subtitleMarginTop: number;
8159
7957
  titleColor: string;
@@ -8200,7 +7998,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
8200
7998
  };
8201
7999
 
8202
8000
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
8203
- `, R = `import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
8001
+ `, T = `import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
8204
8002
  import { CommonComponentProps } from '../props';
8205
8003
  import { scalingValue } from '../utils/scalingValue';
8206
8004
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -8773,7 +8571,7 @@ export function Helix({
8773
8571
  </>
8774
8572
  );
8775
8573
  }
8776
- `, M = `import { CommonComponentProps } from '../props';
8574
+ `, R = `import { CommonComponentProps } from '../props';
8777
8575
  import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
8778
8576
  import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
8779
8577
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
@@ -11225,7 +11023,7 @@ export function Hive({
11225
11023
  </>
11226
11024
  );
11227
11025
  }
11228
- `, L = `import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
11026
+ `, M = `import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
11229
11027
  import { createPortal } from 'react-dom';
11230
11028
  import { CommonComponentProps } from '../props';
11231
11029
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -12028,7 +11826,7 @@ export type LightboxJournalSettings = {
12028
11826
  closeIconColor: string;
12029
11827
  closeIconHoverColor: string;
12030
11828
  };
12031
- `, k = `import { useEffect, useRef, useState, type MouseEvent } from 'react';
11829
+ `, L = `import { useEffect, useRef, useState, type MouseEvent } from 'react';
12032
11830
  import { createPortal } from 'react-dom';
12033
11831
  import { CommonComponentProps } from '../props';
12034
11832
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -12612,7 +12410,7 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
12612
12410
  </>
12613
12411
  );
12614
12412
  };
12615
- `, A = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
12413
+ `, k = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
12616
12414
  import { createPortal } from 'react-dom';
12617
12415
  import { CommonComponentProps } from '../props';
12618
12416
  import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -15717,7 +15515,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
15717
15515
  </>
15718
15516
  );
15719
15517
  }
15720
- `, N = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
15518
+ `, A = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
15721
15519
  import cn from 'classnames';
15722
15520
  import { CommonComponentProps } from '../props';
15723
15521
  import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -16575,7 +16373,7 @@ type MarqueeProps = {
16575
16373
  isPreviewMode?: boolean;
16576
16374
  isEditMode?: boolean;
16577
16375
  } & CommonComponentProps;
16578
- `, H = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
16376
+ `, N = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
16579
16377
  import cn from 'classnames';
16580
16378
  import { CommonComponentProps } from '../props';
16581
16379
  import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -17518,7 +17316,7 @@ type MarqueeTextProps = {
17518
17316
  isPreviewMode?: boolean;
17519
17317
  isEditMode?: boolean;
17520
17318
  } & CommonComponentProps;
17521
- `, O = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
17319
+ `, H = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
17522
17320
  import { createPortal } from 'react-dom';
17523
17321
  import type React from 'react';
17524
17322
  import { CommonComponentProps } from '../props';
@@ -20000,7 +19798,7 @@ export function Mercury({
20000
19798
  </>
20001
19799
  );
20002
19800
  }
20003
- `, _ = `import React, { useMemo, useState } from 'react';
19801
+ `, O = `import React, { useMemo, useState } from 'react';
20004
19802
  import { CommonComponentProps } from '../props';
20005
19803
  import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
20006
19804
  import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
@@ -20579,7 +20377,7 @@ const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {
20579
20377
  };
20580
20378
 
20581
20379
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
20582
- `, W = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
20380
+ `, _ = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
20583
20381
  import type React from 'react';
20584
20382
  import { CommonComponentProps } from '../props';
20585
20383
  import { scalingValue, useScopedStyles } from '../utils/index';
@@ -22046,7 +21844,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
22046
21844
  </>
22047
21845
  );
22048
21846
  }
22049
- `, D = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
21847
+ `, W = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
22050
21848
  import { SvgImage } from '../helpers/SvgImage/SvgImage';
22051
21849
  import { CommonComponentProps } from '../props';
22052
21850
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
@@ -22678,7 +22476,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
22678
22476
  </>
22679
22477
  );
22680
22478
  }
22681
- `, B = `import React, { useCallback, useEffect, useRef, useState } from 'react';
22479
+ `, D = `import React, { useCallback, useEffect, useRef, useState } from 'react';
22682
22480
  import cn from 'classnames';
22683
22481
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
22684
22482
  import { scalingValue } from '../utils/scalingValue';
@@ -23860,7 +23658,7 @@ function ArrowIcon({ color, className }: { color: string, className: string }) {
23860
23658
  </svg>
23861
23659
  );
23862
23660
  }
23863
- `, z = `import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
23661
+ `, B = `import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
23864
23662
  import cn from 'classnames';
23865
23663
  import { CommonComponentProps } from '../props';
23866
23664
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
@@ -24491,7 +24289,7 @@ type TestimonialsSettings = {
24491
24289
  logoHeight: number;
24492
24290
  captionMarginTop: number;
24493
24291
  };
24494
- `, V = `import cn from 'classnames';
24292
+ `, z = `import cn from 'classnames';
24495
24293
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
24496
24294
  import { CommonComponentProps } from '../props';
24497
24295
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
@@ -24987,7 +24785,7 @@ type TestimonialsSettings = {
24987
24785
  icon?: string | null;
24988
24786
  };
24989
24787
  };
24990
- `, G = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
24788
+ `, V = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
24991
24789
  import type React from 'react';
24992
24790
  import { createPortal } from 'react-dom';
24993
24791
  import { CommonComponentProps } from '../props';
@@ -25520,31 +25318,30 @@ export function Waterfall({
25520
25318
  </>
25521
25319
  );
25522
25320
  }
25523
- `, K = {
25524
- [C.id]: w,
25525
- [S.id]: $,
25526
- [y.id]: I,
25527
- [b.id]: n,
25528
- [x.id]: E,
25529
- [P.id]: T,
25530
- [v.id]: n,
25531
- [f.id]: R,
25532
- [h.id]: M,
25533
- [p.id]: L,
25534
- [m.id]: k,
25535
- [g.id]: A,
25536
- [u.id]: N,
25537
- [d.id]: H,
25538
- [c.id]: O,
25539
- [l.id]: _,
25540
- [s.id]: W,
25541
- [a.id]: F,
25542
- [r.id]: D,
25543
- [o.id]: B,
25544
- [i.id]: z,
25545
- [t.id]: V,
25546
- [e.id]: G
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
25547
25344
  };
25548
25345
  export {
25549
- K as componentSources
25346
+ U as componentSources
25550
25347
  };
@@ -8,6 +8,11 @@ export type ComponentSize = {
8
8
  export type ComponentDefaultSize = Partial<Record<Breakpoint, ComponentSize>>;
9
9
  export type ComponentNavigationPosition = 'default' | 'stickyTop' | 'switch';
10
10
  export type ComponentDefaultNavigationPosition = Partial<Record<Breakpoint, ComponentNavigationPosition>>;
11
+ /**
12
+ * How a navigation component is laid out: across the page's width ('full-width'), or placed and sized
13
+ * like an item, staying put on the screen ('freeform').
14
+ */
15
+ export type ComponentNavigationLayout = 'full-width' | 'freeform';
11
16
  export type Component = {
12
17
  element: (props: any) => React.ReactElement;
13
18
  id: string;
@@ -17,6 +22,8 @@ export type Component = {
17
22
  layoutMode?: 'freeform' | 'structured' | 'navigation';
18
23
  defaultSize?: ComponentDefaultSize;
19
24
  defaultNavigationPosition?: ComponentDefaultNavigationPosition;
25
+ /** For a `layoutMode: 'navigation'` component; none is 'full-width'. */
26
+ navigationLayout?: ComponentNavigationLayout;
20
27
  schema: any;
21
28
  preview?: {
22
29
  type: 'image' | 'video';