@cntrl-site/components 1.0.118-alpha.4 → 1.0.118-alpha.9
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.
- package/dist/{Burger-DyORh_vF.mjs → Burger-C8JIQQwm.mjs} +330 -307
- package/dist/Burger-C_SjPZWp.js +669 -0
- package/dist/{ChroniclesComponent-DVoJ0kdT.mjs → ChroniclesComponent-Bf8jxaas.mjs} +512 -442
- package/dist/ChroniclesComponent-XAHXrzRb.js +1 -0
- package/dist/Components/Burger/Burger.d.ts +4 -2
- package/dist/Components/Grid/CustomGridComponent.d.ts +41 -0
- package/dist/Components/Grid/Grid.d.ts +27 -7
- package/dist/Components/helpers/SvgImage/loadSvgMaskUrl.d.ts +0 -7
- package/dist/{ControlSlider-3w-bHQEg.mjs → ControlSlider-BBAXRDLP.mjs} +3 -4
- package/dist/ControlSlider-BCkVFl4w.js +1 -0
- package/dist/{FAQ-GmiwRdFq.mjs → FAQ-CJHCMSBa.mjs} +1 -1
- package/dist/{FAQ-7HEkaoU6.js → FAQ-DLh63Utr.js} +1 -1
- package/dist/Grid-Dwn03N-q.mjs +1853 -0
- package/dist/Grid-pyPdnAeI.js +445 -0
- package/dist/{Hive-34KvKNsa.js → Hive-CzabuuCc.js} +1 -1
- package/dist/{Hive-7xHXyMM1.mjs → Hive-DyxYd5eg.mjs} +1 -1
- package/dist/{HiveLightboxTitles-BCoL46-V.mjs → HiveLightboxTitles-DhEeFKWs.mjs} +1 -1
- package/dist/{HiveLightboxTitles-DEeyQGcf.js → HiveLightboxTitles-DlyptAaK.js} +1 -1
- package/dist/{Lightbox-DzPqgKP4.mjs → Lightbox-BY99NS14.mjs} +1 -1
- package/dist/{Lightbox-Cb7lyaNt.js → Lightbox-DZckgBzK.js} +1 -1
- package/dist/{LightboxJournal-DisD2DLv.mjs → LightboxJournal-BDUs6T0B.mjs} +1 -1
- package/dist/{LightboxJournal-B-vul_be.js → LightboxJournal-Bf_rZzmz.js} +1 -1
- package/dist/{LightboxStrip-wCHUhAqN.mjs → LightboxStrip-Cuhb2fIR.mjs} +1 -1
- package/dist/{LightboxStrip-YDyEPEb6.js → LightboxStrip-RA4ABUC-.js} +1 -1
- package/dist/{Mercury-BmhtFYOw.js → Mercury-B-s2Kvuq.js} +1 -1
- package/dist/{Mercury-Q788wrYQ.mjs → Mercury-CCW0Es-s.mjs} +1 -1
- package/dist/{OnelinerForm-D8WIB9Qy.mjs → OnelinerForm-BEu7_sho.mjs} +1 -1
- package/dist/{OnelinerForm-CUmY-bXL.js → OnelinerForm-C2Y_XMCY.js} +1 -1
- package/dist/{SimpleButton-DTpzfmb6.mjs → SimpleButton-C-o2W9bS.mjs} +1 -1
- package/dist/{SimpleButton-DtaCYa3y.js → SimpleButton-nGEcO2gB.js} +1 -1
- package/dist/{Slider20-q0iGgnE3.js → Slider20-BOmjDRf2.js} +1 -1
- package/dist/{Slider20-CKngROrc.mjs → Slider20-DUi6qwnd.mjs} +1 -1
- package/dist/SvgImage-B5mR9y6q.mjs +51 -0
- package/dist/SvgImage-DFlmxAoL.js +1 -0
- package/dist/{TestimonialSingle-CpEUendN.js → TestimonialSingle-BORQom3u.js} +1 -1
- package/dist/{TestimonialSingle-Bax71Hyo.mjs → TestimonialSingle-DrnyReim.mjs} +1 -1
- package/dist/{Waterfall-znaoynn5.mjs → Waterfall-3kKioKh2.mjs} +1 -1
- package/dist/{Waterfall-B9YWMhrg.js → Waterfall-DII4-WV5.js} +1 -1
- package/dist/{components-eK82xypT.mjs → components-IX-rNSn-.mjs} +30 -653
- package/dist/components-QVeWZKot.js +1 -0
- package/dist/components.css +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +24 -24
- package/dist/elements.node.js +1 -1
- package/dist/elements.node.mjs +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +36 -63
- package/dist/loadSvgMaskUrl-DfF7ay6h.js +1 -0
- package/dist/loadSvgMaskUrl-xHgGYgPe.mjs +20 -0
- package/dist/sources.js +676 -244
- package/dist/sources.mjs +717 -284
- package/dist/types/Component.d.ts +0 -7
- package/dist/types/SchemaV1.d.ts +0 -3
- package/package.json +1 -1
- package/dist/Burger-B4kXX9aY.js +0 -669
- package/dist/ChroniclesComponent-Nm_yIRmr.js +0 -1
- package/dist/Components/PopupMenu/PopupMenu.d.ts +0 -73
- package/dist/Components/PopupMenu/PopupMenuComponent.d.ts +0 -594
- package/dist/Components/PopupMenu/popupMenuLayout.d.ts +0 -203
- package/dist/Components/PopupMenu/popupMenuSnap.d.ts +0 -61
- package/dist/ControlSlider-DB4nbVLT.js +0 -1
- package/dist/Grid-BuRdth9A.mjs +0 -1622
- package/dist/Grid-tqSSYh2-.js +0 -408
- package/dist/PopupMenu-CYdDyzEt.mjs +0 -1372
- package/dist/PopupMenu-Di1fHgho.js +0 -409
- package/dist/SvgImage-CwRq9-ec.mjs +0 -56
- package/dist/SvgImage-_QN8ngad.js +0 -1
- package/dist/components-BYoTPJk3.js +0 -1
- package/dist/loadSvgMaskUrl-B6kHUyof.js +0 -1
- package/dist/loadSvgMaskUrl-DUhCVvpl.mjs +0 -39
package/dist/sources.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as
|
|
2
|
-
const
|
|
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-Bf8jxaas.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'
|
|
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
|
-
`,
|
|
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
|
-
`,
|
|
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
|
-
`,
|
|
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
|
-
`,
|
|
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
|
-
`,
|
|
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,23 @@ 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
|
+
.\${P}-custom-layout.\${P}-auto-height .\${P}-item-image-link {
|
|
5829
|
+
flex: none;
|
|
5830
|
+
}
|
|
5831
|
+
.\${P}-auto-height .\${P}-item-image-wrapper-fit-slider > .\${P}-item-image-wrapper-sizer :is(img, video) {
|
|
5832
|
+
width: 100%;
|
|
5833
|
+
}
|
|
5783
5834
|
.\${P}-item-text-link {
|
|
5784
5835
|
display: flex;
|
|
5785
5836
|
flex-direction: column;
|
|
@@ -5800,18 +5851,47 @@ function getCSS(P: string): string {
|
|
|
5800
5851
|
display: block;
|
|
5801
5852
|
max-width: 100%;
|
|
5802
5853
|
}
|
|
5803
|
-
.\${P}-item-slider
|
|
5804
|
-
|
|
5805
|
-
.\${P}-item-slider .splide__list,
|
|
5806
|
-
.\${P}-item-slider .splide__slide {
|
|
5854
|
+
.\${P}-item-slider {
|
|
5855
|
+
position: relative;
|
|
5807
5856
|
width: 100%;
|
|
5808
5857
|
height: 100%;
|
|
5858
|
+
overflow: hidden;
|
|
5859
|
+
}
|
|
5860
|
+
.\${P}-item-slider-list {
|
|
5861
|
+
position: relative;
|
|
5862
|
+
display: flex;
|
|
5863
|
+
flex-direction: row;
|
|
5864
|
+
width: 100%;
|
|
5865
|
+
height: 100%;
|
|
5866
|
+
will-change: transform;
|
|
5809
5867
|
}
|
|
5810
|
-
.\${P}-item-slider
|
|
5868
|
+
.\${P}-item-slider-list-vertical {
|
|
5869
|
+
flex-direction: column;
|
|
5870
|
+
}
|
|
5871
|
+
.\${P}-item-slider-list-fade {
|
|
5872
|
+
display: block;
|
|
5873
|
+
will-change: auto;
|
|
5874
|
+
}
|
|
5875
|
+
.\${P}-item-slide {
|
|
5876
|
+
position: relative;
|
|
5877
|
+
flex: 0 0 100%;
|
|
5878
|
+
width: 100%;
|
|
5879
|
+
height: 100%;
|
|
5811
5880
|
display: flex;
|
|
5812
5881
|
justify-content: center;
|
|
5813
5882
|
align-items: center;
|
|
5814
5883
|
}
|
|
5884
|
+
.\${P}-item-slider-list-fade .\${P}-item-slide {
|
|
5885
|
+
position: absolute;
|
|
5886
|
+
top: 0;
|
|
5887
|
+
left: 0;
|
|
5888
|
+
opacity: 0;
|
|
5889
|
+
transition: opacity \${SLIDER_TRANSITION_MS}ms \${SLIDER_EASING};
|
|
5890
|
+
}
|
|
5891
|
+
.\${P}-item-slider-list-fade .\${P}-item-slide-active {
|
|
5892
|
+
opacity: 1;
|
|
5893
|
+
z-index: 1;
|
|
5894
|
+
}
|
|
5815
5895
|
.\${P}-item-title {
|
|
5816
5896
|
white-space: normal;
|
|
5817
5897
|
overflow-wrap: anywhere;
|
|
@@ -5958,13 +6038,13 @@ function getCSS(P: string): string {
|
|
|
5958
6038
|
.\${P}-image-align-bottom .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
|
|
5959
6039
|
align-items: flex-end;
|
|
5960
6040
|
}
|
|
5961
|
-
.\${P}-image-align-top .\${P}-item-slider
|
|
6041
|
+
.\${P}-image-align-top .\${P}-item-slider .\${P}-item-slide {
|
|
5962
6042
|
align-items: flex-start;
|
|
5963
6043
|
}
|
|
5964
|
-
.\${P}-image-align-center .\${P}-item-slider
|
|
6044
|
+
.\${P}-image-align-center .\${P}-item-slider .\${P}-item-slide {
|
|
5965
6045
|
align-items: center;
|
|
5966
6046
|
}
|
|
5967
|
-
.\${P}-image-align-bottom .\${P}-item-slider
|
|
6047
|
+
.\${P}-image-align-bottom .\${P}-item-slider .\${P}-item-slide {
|
|
5968
6048
|
align-items: flex-end;
|
|
5969
6049
|
}
|
|
5970
6050
|
.\${P}-align-entries .\${P}-item {
|
|
@@ -6045,13 +6125,13 @@ function getCSS(P: string): string {
|
|
|
6045
6125
|
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
|
|
6046
6126
|
align-items: flex-end;
|
|
6047
6127
|
}
|
|
6048
|
-
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider
|
|
6128
|
+
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
|
|
6049
6129
|
align-items: flex-start;
|
|
6050
6130
|
}
|
|
6051
|
-
.\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider
|
|
6131
|
+
.\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
|
|
6052
6132
|
align-items: center;
|
|
6053
6133
|
}
|
|
6054
|
-
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider
|
|
6134
|
+
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
|
|
6055
6135
|
align-items: flex-end;
|
|
6056
6136
|
}
|
|
6057
6137
|
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-image-link {
|
|
@@ -6119,27 +6199,9 @@ function pickRandomSlideDirection(): 'ltr' | 'ttb' {
|
|
|
6119
6199
|
return Math.random() < 0.5 ? 'ltr' : 'ttb';
|
|
6120
6200
|
}
|
|
6121
6201
|
|
|
6122
|
-
function
|
|
6123
|
-
|
|
6124
|
-
|
|
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
|
-
});
|
|
6202
|
+
function wrapSlideIndex(index: number, count: number): number {
|
|
6203
|
+
if (count <= 0) return 0;
|
|
6204
|
+
return ((index % count) + count) % count;
|
|
6143
6205
|
}
|
|
6144
6206
|
|
|
6145
6207
|
type GridProps = {
|
|
@@ -6179,6 +6241,8 @@ type LightboxProps = {
|
|
|
6179
6241
|
|
|
6180
6242
|
const LIGHTBOX_ANIM_MS = 500;
|
|
6181
6243
|
const SLIDER_TRANSITION_MS = 750;
|
|
6244
|
+
const SLIDER_EASING = 'cubic-bezier(0.25, 1, 0.5, 1)';
|
|
6245
|
+
const SLIDER_DEFAULT_INTERVAL_MS = 5000;
|
|
6182
6246
|
const LIGHTBOX_EASING = 'cubic-bezier(0.22, 1, 0.36, 1)';
|
|
6183
6247
|
const SWIPE_CLOSE_THRESHOLD = 72;
|
|
6184
6248
|
const SWIPE_NAV_THRESHOLD = 50;
|
|
@@ -6268,7 +6332,7 @@ function collectGridLightboxMedia(content: any[]): GridMedia[] {
|
|
|
6268
6332
|
return result;
|
|
6269
6333
|
}
|
|
6270
6334
|
|
|
6271
|
-
function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
6335
|
+
const LightboxMediaPreloadPool = memo(function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
6272
6336
|
const [pool, setPool] = useState<HTMLDivElement | null>(null);
|
|
6273
6337
|
useLazyVideos(pool, { preload: 'metadata' });
|
|
6274
6338
|
// an embed's player is only ever framed where it shows
|
|
@@ -6307,7 +6371,7 @@ function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
|
6307
6371
|
))}
|
|
6308
6372
|
</div>
|
|
6309
6373
|
);
|
|
6310
|
-
}
|
|
6374
|
+
});
|
|
6311
6375
|
|
|
6312
6376
|
function unloadVideoElement(video: HTMLVideoElement) {
|
|
6313
6377
|
video.pause();
|
|
@@ -6315,15 +6379,121 @@ function unloadVideoElement(video: HTMLVideoElement) {
|
|
|
6315
6379
|
video.load();
|
|
6316
6380
|
}
|
|
6317
6381
|
|
|
6318
|
-
const
|
|
6382
|
+
const GRID_SLIDE_CLASS = 'cntrl-grid-slide';
|
|
6383
|
+
const GRID_SLIDE_PLAYING_CLASS = 'cntrl-grid-slide-playing';
|
|
6384
|
+
const GRID_SLIDE_VIDEOS = \`.\${GRID_SLIDE_CLASS} video\`;
|
|
6319
6385
|
|
|
6320
6386
|
function shouldPlaySlideVideo(video: HTMLVideoElement): boolean {
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6387
|
+
return video.closest(\`.\${GRID_SLIDE_PLAYING_CLASS}\`) !== null;
|
|
6388
|
+
}
|
|
6389
|
+
|
|
6390
|
+
type GridEntrySliderProps = {
|
|
6391
|
+
prefix: string;
|
|
6392
|
+
slides: React.ReactNode[];
|
|
6393
|
+
isFade: boolean;
|
|
6394
|
+
direction: GridSettings['direction'];
|
|
6395
|
+
intervalMs: number;
|
|
6396
|
+
};
|
|
6397
|
+
|
|
6398
|
+
function GridEntrySlider({ prefix: P, slides, isFade, direction, intervalMs }: GridEntrySliderProps) {
|
|
6399
|
+
const count = slides.length;
|
|
6400
|
+
const hasClones = !isFade && count > 1;
|
|
6401
|
+
const isRandom = !isFade && direction === 'random';
|
|
6402
|
+
const delayMs = Number.isFinite(intervalMs) && intervalMs > 0 ? intervalMs : SLIDER_DEFAULT_INTERVAL_MS;
|
|
6403
|
+
const [position, setPosition] = useState(hasClones ? 1 : 0);
|
|
6404
|
+
const [axis, setAxis] = useState<'ltr' | 'ttb'>(!isFade && direction === 'vertical' ? 'ttb' : 'ltr');
|
|
6405
|
+
const [isMoving, setIsMoving] = useState(false);
|
|
6406
|
+
const [skipTransition, setSkipTransition] = useState(false);
|
|
6407
|
+
const [cycle, setCycle] = useState(0);
|
|
6408
|
+
const isMovingRef = useRef(false);
|
|
6409
|
+
|
|
6410
|
+
useEffect(() => {
|
|
6411
|
+
if (count < 2) return;
|
|
6412
|
+
const timeoutId = window.setTimeout(() => {
|
|
6413
|
+
if (isMovingRef.current) {
|
|
6414
|
+
setCycle(prev => prev + 1);
|
|
6415
|
+
return;
|
|
6416
|
+
}
|
|
6417
|
+
isMovingRef.current = true;
|
|
6418
|
+
setIsMoving(true);
|
|
6419
|
+
setSkipTransition(false);
|
|
6420
|
+
setPosition(prev => (hasClones ? prev + 1 : wrapSlideIndex(prev + 1, count)));
|
|
6421
|
+
if (!isRandom) setCycle(prev => prev + 1);
|
|
6422
|
+
}, delayMs);
|
|
6423
|
+
return () => window.clearTimeout(timeoutId);
|
|
6424
|
+
}, [count, cycle, delayMs, hasClones, isRandom]);
|
|
6425
|
+
|
|
6426
|
+
useEffect(() => {
|
|
6427
|
+
if (!isMoving) return;
|
|
6428
|
+
const timeoutId = window.setTimeout(() => {
|
|
6429
|
+
const isOnClone = hasClones && position === count + 1;
|
|
6430
|
+
const nextAxis = isRandom ? pickRandomSlideDirection() : axis;
|
|
6431
|
+
if (isOnClone || nextAxis !== axis) {
|
|
6432
|
+
setSkipTransition(true);
|
|
6433
|
+
if (isOnClone) setPosition(1);
|
|
6434
|
+
setAxis(nextAxis);
|
|
6435
|
+
}
|
|
6436
|
+
isMovingRef.current = false;
|
|
6437
|
+
setIsMoving(false);
|
|
6438
|
+
if (isRandom) setCycle(prev => prev + 1);
|
|
6439
|
+
}, SLIDER_TRANSITION_MS);
|
|
6440
|
+
return () => window.clearTimeout(timeoutId);
|
|
6441
|
+
}, [axis, count, hasClones, isMoving, isRandom, position]);
|
|
6442
|
+
|
|
6443
|
+
useEffect(() => {
|
|
6444
|
+
if (!skipTransition) return;
|
|
6445
|
+
let innerId = 0;
|
|
6446
|
+
const outerId = requestAnimationFrame(() => {
|
|
6447
|
+
innerId = requestAnimationFrame(() => setSkipTransition(false));
|
|
6448
|
+
});
|
|
6449
|
+
return () => {
|
|
6450
|
+
cancelAnimationFrame(outerId);
|
|
6451
|
+
cancelAnimationFrame(innerId);
|
|
6452
|
+
};
|
|
6453
|
+
}, [skipTransition]);
|
|
6454
|
+
|
|
6455
|
+
const slotsCount = hasClones ? count + 2 : count;
|
|
6456
|
+
const getItemIndex = (slot: number) => (hasClones ? wrapSlideIndex(slot - 1, count) : slot);
|
|
6457
|
+
const isCloneSlot = (slot: number) => hasClones && (slot === 0 || slot === count + 1);
|
|
6458
|
+
const activeIndex = getItemIndex(position);
|
|
6459
|
+
const nextSlot = position + 1 < slotsCount ? position + 1 : -1;
|
|
6460
|
+
const isPlayingSlot = (slot: number) => isFade
|
|
6461
|
+
|| (slot === position && !isCloneSlot(slot))
|
|
6462
|
+
|| slot === nextSlot
|
|
6463
|
+
|| (nextSlot >= 0 && !isCloneSlot(slot) && getItemIndex(slot) === getItemIndex(nextSlot));
|
|
6464
|
+
const isVertical = !isFade && axis === 'ttb';
|
|
6465
|
+
const listStyle: React.CSSProperties | undefined = isFade
|
|
6466
|
+
? undefined
|
|
6467
|
+
: {
|
|
6468
|
+
transform: isVertical
|
|
6469
|
+
? \`translate3d(0, \${-position * 100}%, 0)\`
|
|
6470
|
+
: \`translate3d(\${-position * 100}%, 0, 0)\`,
|
|
6471
|
+
transition: skipTransition ? 'none' : \`transform \${SLIDER_TRANSITION_MS}ms \${SLIDER_EASING}\`,
|
|
6472
|
+
};
|
|
6473
|
+
|
|
6474
|
+
return (
|
|
6475
|
+
<div className={\`\${P}-item-slider\`}>
|
|
6476
|
+
<div
|
|
6477
|
+
className={\`\${P}-item-slider-list\${isFade ? \` \${P}-item-slider-list-fade\` : ''}\${isVertical ? \` \${P}-item-slider-list-vertical\` : ''}\`}
|
|
6478
|
+
style={listStyle}
|
|
6479
|
+
>
|
|
6480
|
+
{Array.from({ length: slotsCount }, (_, slot) => {
|
|
6481
|
+
const itemIndex = getItemIndex(slot);
|
|
6482
|
+
const isClone = isCloneSlot(slot);
|
|
6483
|
+
const isShown = isFade ? itemIndex === activeIndex : slot === position;
|
|
6484
|
+
return (
|
|
6485
|
+
<div
|
|
6486
|
+
key={isClone ? \`clone-\${slot === 0 ? 'start' : 'end'}\` : \`slide-\${itemIndex}\`}
|
|
6487
|
+
className={\`\${P}-item-slide \${GRID_SLIDE_CLASS}\${isFade && isShown ? \` \${P}-item-slide-active\` : ''}\${isPlayingSlot(slot) ? \` \${GRID_SLIDE_PLAYING_CLASS}\` : ''}\`}
|
|
6488
|
+
aria-hidden={isShown ? undefined : true}
|
|
6489
|
+
>
|
|
6490
|
+
{slides[itemIndex]}
|
|
6491
|
+
</div>
|
|
6492
|
+
);
|
|
6493
|
+
})}
|
|
6494
|
+
</div>
|
|
6495
|
+
</div>
|
|
6496
|
+
);
|
|
6327
6497
|
}
|
|
6328
6498
|
|
|
6329
6499
|
function GridMediaItem({
|
|
@@ -6331,7 +6501,7 @@ function GridMediaItem({
|
|
|
6331
6501
|
className,
|
|
6332
6502
|
style,
|
|
6333
6503
|
hasLightbox,
|
|
6334
|
-
|
|
6504
|
+
isSliderSlide = false,
|
|
6335
6505
|
onMediaClick,
|
|
6336
6506
|
}: {
|
|
6337
6507
|
media: GridMedia;
|
|
@@ -6339,7 +6509,7 @@ function GridMediaItem({
|
|
|
6339
6509
|
style: React.CSSProperties;
|
|
6340
6510
|
/** An embed then plays here as a silent loop, and as it was set to in the lightbox. */
|
|
6341
6511
|
hasLightbox: boolean;
|
|
6342
|
-
|
|
6512
|
+
isSliderSlide?: boolean;
|
|
6343
6513
|
onMediaClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
6344
6514
|
}) {
|
|
6345
6515
|
if (isEmbedMedia(media)) {
|
|
@@ -6371,7 +6541,7 @@ function GridMediaItem({
|
|
|
6371
6541
|
playsInline: true,
|
|
6372
6542
|
onClick: onMediaClick,
|
|
6373
6543
|
};
|
|
6374
|
-
return
|
|
6544
|
+
return isSliderSlide
|
|
6375
6545
|
? <video {...videoProps} preload='none' />
|
|
6376
6546
|
: <LazyVideo {...videoProps} autoPlay />;
|
|
6377
6547
|
}
|
|
@@ -6400,7 +6570,7 @@ function GridItemMediaWrapper({
|
|
|
6400
6570
|
children: React.ReactNode;
|
|
6401
6571
|
}) {
|
|
6402
6572
|
const [wrapper, setWrapper] = useState<HTMLDivElement | null>(null);
|
|
6403
|
-
useLazyVideos(wrapper, { autoPlay: true, selector:
|
|
6573
|
+
useLazyVideos(wrapper, { autoPlay: true, selector: GRID_SLIDE_VIDEOS, shouldPlay: shouldPlaySlideVideo });
|
|
6404
6574
|
|
|
6405
6575
|
return (
|
|
6406
6576
|
<div ref={setWrapper} className={className} style={style}>
|
|
@@ -7301,11 +7471,149 @@ function resolveLightboxImageDisplay(
|
|
|
7301
7471
|
return value?.display === 'cover' ? 'cover' : 'fit';
|
|
7302
7472
|
}
|
|
7303
7473
|
|
|
7474
|
+
function getCustomGridSpanWidth(layout: CustomGridLayout, span: number): number {
|
|
7475
|
+
return layout.columnWidth * span + layout.gutterWidth * Math.max(0, span - 1);
|
|
7476
|
+
}
|
|
7477
|
+
|
|
7478
|
+
type CustomGridSlot = {
|
|
7479
|
+
column: number;
|
|
7480
|
+
span: number;
|
|
7481
|
+
width: number;
|
|
7482
|
+
top: number;
|
|
7483
|
+
height: number;
|
|
7484
|
+
gridColumn: string;
|
|
7485
|
+
};
|
|
7486
|
+
|
|
7487
|
+
function getCustomGridBlocksBottom(layout: CustomGridLayout): number {
|
|
7488
|
+
return layout.blocks.reduce((bottom, block) => Math.max(bottom, Math.max(0, block.top) + Math.max(0, block.height)), 0);
|
|
7489
|
+
}
|
|
7490
|
+
|
|
7491
|
+
function getCustomGridVerticalGap(layout: CustomGridLayout): number {
|
|
7492
|
+
if (typeof layout.verticalGap === 'number') return Math.max(0, layout.verticalGap);
|
|
7493
|
+
return Math.max(0, (layout.repeatHeight ?? 0) - getCustomGridBlocksBottom(layout));
|
|
7494
|
+
}
|
|
7495
|
+
|
|
7496
|
+
function getCustomGridSlot(layout: CustomGridLayout, index: number): CustomGridSlot {
|
|
7497
|
+
const block = layout.blocks[index % layout.blocks.length];
|
|
7498
|
+
const span = Math.min(Math.max(1, Math.round(block.span)), layout.columnsCount);
|
|
7499
|
+
const column = Math.min(Math.max(0, Math.round(block.column)), layout.columnsCount - span);
|
|
7500
|
+
return {
|
|
7501
|
+
column,
|
|
7502
|
+
span,
|
|
7503
|
+
width: getCustomGridSpanWidth(layout, span),
|
|
7504
|
+
top: Math.max(0, block.top),
|
|
7505
|
+
height: Math.max(0, block.height),
|
|
7506
|
+
gridColumn: \`\${column + 1} / span \${span}\`,
|
|
7507
|
+
};
|
|
7508
|
+
}
|
|
7509
|
+
|
|
7510
|
+
const EDGE_TOLERANCE = 1e-6;
|
|
7511
|
+
|
|
7512
|
+
function getCustomGridRows(layout: CustomGridLayout, entriesCount: number, entryHeights?: number[]) {
|
|
7513
|
+
const beat = layout.beat ?? 0;
|
|
7514
|
+
const onBeats = beat > 0 && !!entryHeights;
|
|
7515
|
+
const snapUp = (value: number) => Math.ceil(value / beat - 1e-3) * beat;
|
|
7516
|
+
const tracks: (number | 'auto')[] = [];
|
|
7517
|
+
const gridRows: string[] = [];
|
|
7518
|
+
const verticalGap = getCustomGridVerticalGap(layout);
|
|
7519
|
+
for (let groupStart = 0; groupStart < entriesCount; groupStart += layout.blocks.length) {
|
|
7520
|
+
if (groupStart > 0 && verticalGap > 0) tracks.push(verticalGap);
|
|
7521
|
+
const slots = Array.from(
|
|
7522
|
+
{ length: Math.min(layout.blocks.length, entriesCount - groupStart) },
|
|
7523
|
+
(_, index) => getCustomGridSlot(layout, groupStart + index),
|
|
7524
|
+
);
|
|
7525
|
+
const ends = slots.map((slot) => {
|
|
7526
|
+
const under = slots.filter(other => other.column < slot.column + slot.span
|
|
7527
|
+
&& slot.column < other.column + other.span
|
|
7528
|
+
&& other.top >= slot.top + slot.height - EDGE_TOLERANCE);
|
|
7529
|
+
return under.length > 0 ? Math.min(...under.map(other => other.top)) : undefined;
|
|
7530
|
+
});
|
|
7531
|
+
const tops = [0, ...slots.map(slot => slot.top)]
|
|
7532
|
+
.sort((a, b) => a - b)
|
|
7533
|
+
.filter((top, index, sorted) => index === 0 || top - sorted[index - 1] > EDGE_TOLERANCE);
|
|
7534
|
+
const isSame = (a: number, b: number) => Math.abs(a - b) <= EDGE_TOLERANCE;
|
|
7535
|
+
const getTop = (value: number) => tops.findIndex(top => isSame(top, value));
|
|
7536
|
+
const positions: number[] = [];
|
|
7537
|
+
let position = 0;
|
|
7538
|
+
const pushContentTrack = (isEnding: (end: number | undefined) => boolean) => {
|
|
7539
|
+
const ending = slots.flatMap((slot, index) => (isEnding(ends[index]) ? [{ slot, entry: groupStart + index }] : []));
|
|
7540
|
+
if (ending.length === 0) return;
|
|
7541
|
+
if (!onBeats) {
|
|
7542
|
+
tracks.push('auto');
|
|
7543
|
+
return;
|
|
7544
|
+
}
|
|
7545
|
+
const needed = Math.max(...ending.map(({ slot, entry }) => positions[getTop(slot.top)] + (entryHeights[entry] ?? 0)));
|
|
7546
|
+
const track = Math.max(0, snapUp(needed) - position);
|
|
7547
|
+
tracks.push(track);
|
|
7548
|
+
position += track;
|
|
7549
|
+
};
|
|
7550
|
+
const lines = tops.map((top, index) => {
|
|
7551
|
+
if (index > 0) {
|
|
7552
|
+
tracks.push(top - tops[index - 1]);
|
|
7553
|
+
position += top - tops[index - 1];
|
|
7554
|
+
}
|
|
7555
|
+
pushContentTrack(end => end !== undefined && isSame(end, top));
|
|
7556
|
+
positions.push(position);
|
|
7557
|
+
return tracks.length + 1;
|
|
7558
|
+
});
|
|
7559
|
+
pushContentTrack(end => end === undefined);
|
|
7560
|
+
const groupEnd = tracks.length + 1;
|
|
7561
|
+
const getLine = (value: number) => lines[getTop(value)];
|
|
7562
|
+
slots.forEach((slot, index) => {
|
|
7563
|
+
const end = ends[index];
|
|
7564
|
+
gridRows.push(\`\${getLine(slot.top)} / \${end === undefined ? groupEnd : getLine(end)}\`);
|
|
7565
|
+
});
|
|
7566
|
+
}
|
|
7567
|
+
return { tracks, gridRows };
|
|
7568
|
+
}
|
|
7569
|
+
|
|
7570
|
+
function getGridMediaAspect(media: GridMedia): number | undefined {
|
|
7571
|
+
if (isEmbedMedia(media)) return getEmbedAspect(media);
|
|
7572
|
+
return media.width && media.height && media.width > 0 && media.height > 0 ? media.width / media.height : undefined;
|
|
7573
|
+
}
|
|
7574
|
+
|
|
7575
|
+
/**
|
|
7576
|
+
* Where each entry stands, given the height it takes; the CMS grid builder places its blocks the same way.
|
|
7577
|
+
* A block keeps its drawn distance to the blocks above it in its group; a block with none above it starts at
|
|
7578
|
+
* its drawn top in the group, or, with masonry on, the vertical gap below whatever earlier group reaches
|
|
7579
|
+
* lowest in its columns.
|
|
7580
|
+
*/
|
|
7581
|
+
function placeCustomGridEntries(layout: CustomGridLayout, slots: CustomGridSlot[], heights: number[]) {
|
|
7582
|
+
const groupSize = layout.blocks.length;
|
|
7583
|
+
const verticalGap = getCustomGridVerticalGap(layout);
|
|
7584
|
+
const isMasonry = layout.masonry === 'on';
|
|
7585
|
+
const tops: number[] = [];
|
|
7586
|
+
const placed: { column: number; span: number; bottom: number; group: number }[] = [];
|
|
7587
|
+
const getBottom = (items: typeof placed) => items.reduce((bottom, item) => Math.max(bottom, item.bottom), 0);
|
|
7588
|
+
let groupStart = 0;
|
|
7589
|
+
for (let start = 0; start < slots.length; start += groupSize) {
|
|
7590
|
+
const group = start / groupSize;
|
|
7591
|
+
const entries = Array.from({ length: Math.min(groupSize, slots.length - start) }, (_, index) => start + index)
|
|
7592
|
+
.sort((a, b) => slots[a].top - slots[b].top || a - b);
|
|
7593
|
+
for (const entry of entries) {
|
|
7594
|
+
const slot = slots[entry];
|
|
7595
|
+
const sharesColumns = (other: { column: number; span: number }) => other.column < slot.column + slot.span
|
|
7596
|
+
&& slot.column < other.column + other.span;
|
|
7597
|
+
const above = entries.filter(other => other !== entry && tops[other] !== undefined && sharesColumns(slots[other])
|
|
7598
|
+
&& slots[other].top + slots[other].height <= slot.top + EDGE_TOLERANCE);
|
|
7599
|
+
const earlier = isMasonry ? placed.filter(item => item.group < group && sharesColumns(item)) : [];
|
|
7600
|
+
const candidates = above.map(other => tops[other] + heights[other] + slot.top - (slots[other].top + slots[other].height));
|
|
7601
|
+
if (earlier.length > 0) candidates.push(getBottom(earlier) + verticalGap);
|
|
7602
|
+
if (candidates.length === 0) candidates.push(groupStart + slot.top);
|
|
7603
|
+
tops[entry] = Math.max(...candidates);
|
|
7604
|
+
placed.push({ column: slot.column, span: slot.span, bottom: tops[entry] + heights[entry], group });
|
|
7605
|
+
}
|
|
7606
|
+
groupStart = getBottom(placed) + verticalGap;
|
|
7607
|
+
}
|
|
7608
|
+
return { tops, bottom: getBottom(placed) };
|
|
7609
|
+
}
|
|
7610
|
+
|
|
7304
7611
|
export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, metadata, activeEvent, layoutId, portalId }: GridProps) {
|
|
7305
7612
|
const { prefix: P } = useScopedStyles();
|
|
7306
7613
|
const {
|
|
7307
7614
|
type = 'a',
|
|
7308
7615
|
gridLayout,
|
|
7616
|
+
customGrid,
|
|
7309
7617
|
textBoxWidth = 100,
|
|
7310
7618
|
verticalGap,
|
|
7311
7619
|
entriesCount,
|
|
@@ -7353,62 +7661,69 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7353
7661
|
hover = 'none',
|
|
7354
7662
|
alignEntries = 'off',
|
|
7355
7663
|
align = 'top',
|
|
7664
|
+
textGrowth = 'inside',
|
|
7356
7665
|
} = settings;
|
|
7357
7666
|
|
|
7358
|
-
const
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7667
|
+
const titleTextStyle = useMemo(() => ({
|
|
7668
|
+
...omitTextColors(textStylesToCss({
|
|
7669
|
+
fontSettings: {
|
|
7670
|
+
fontFamily: titleFontFamily,
|
|
7671
|
+
fontWeight: titleFontSettings?.fontWeight ?? 400,
|
|
7672
|
+
fontStyle: titleFontSettings?.fontStyle ?? 'normal',
|
|
7673
|
+
},
|
|
7674
|
+
fontSize: titleFontSize ?? 0.01,
|
|
7675
|
+
lineHeight: titleLineHeight,
|
|
7676
|
+
letterSpacing: titleLetterSpacing ?? 0,
|
|
7677
|
+
wordSpacing: titleWordSpacing ?? 0,
|
|
7678
|
+
textAppearance: titleTextAppearance,
|
|
7679
|
+
color: titleColor,
|
|
7680
|
+
}, isEditor)),
|
|
7681
|
+
...getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor),
|
|
7682
|
+
} as React.CSSProperties), [
|
|
7683
|
+
titleFontFamily, titleFontSettings, titleFontSize, titleLineHeight, titleLetterSpacing,
|
|
7684
|
+
titleWordSpacing, titleTextAppearance, titleColor, isEditor, P,
|
|
7685
|
+
]);
|
|
7375
7686
|
|
|
7376
|
-
const
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7687
|
+
const subtitleTextStyle = useMemo(() => ({
|
|
7688
|
+
...omitTextColors(textStylesToCss({
|
|
7689
|
+
fontSettings: {
|
|
7690
|
+
fontFamily: subtitleFontFamily,
|
|
7691
|
+
fontWeight: subtitleFontSettings?.fontWeight ?? 400,
|
|
7692
|
+
fontStyle: subtitleFontSettings?.fontStyle ?? 'normal',
|
|
7693
|
+
},
|
|
7694
|
+
fontSize: subtitleFontSize ?? 0.01,
|
|
7695
|
+
lineHeight: subtitleLineHeight,
|
|
7696
|
+
letterSpacing: subtitleLetterSpacing ?? 0,
|
|
7697
|
+
wordSpacing: subtitleWordSpacing ?? 0,
|
|
7698
|
+
textAppearance: subtitleTextAppearance,
|
|
7699
|
+
color: subtitleColor,
|
|
7700
|
+
}, isEditor)),
|
|
7701
|
+
...getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor),
|
|
7702
|
+
} as React.CSSProperties), [
|
|
7703
|
+
subtitleFontFamily, subtitleFontSettings, subtitleFontSize, subtitleLineHeight, subtitleLetterSpacing,
|
|
7704
|
+
subtitleWordSpacing, subtitleTextAppearance, subtitleColor, isEditor, P,
|
|
7705
|
+
]);
|
|
7393
7706
|
|
|
7394
|
-
const
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
const lightboxCounterFieldCss = {
|
|
7409
|
-
...lightboxCounterTypographyCss,
|
|
7707
|
+
const lightboxCounterFieldCss = useMemo(() => ({
|
|
7708
|
+
...omitTextColors(textStylesToCss({
|
|
7709
|
+
fontSettings: {
|
|
7710
|
+
fontFamily: lightboxCounterFontFamily,
|
|
7711
|
+
fontWeight: lightboxCounterFontSettings?.fontWeight ?? 400,
|
|
7712
|
+
fontStyle: lightboxCounterFontSettings?.fontStyle ?? 'normal',
|
|
7713
|
+
},
|
|
7714
|
+
fontSize: lightboxCounterFontSize ?? 0.01,
|
|
7715
|
+
lineHeight: lightboxCounterLineHeight,
|
|
7716
|
+
letterSpacing: lightboxCounterLetterSpacing ?? 0,
|
|
7717
|
+
wordSpacing: lightboxCounterWordSpacing ?? 0,
|
|
7718
|
+
textAppearance: lightboxCounterTextAppearance,
|
|
7719
|
+
color: lightboxCounterColor,
|
|
7720
|
+
}, isEditor)),
|
|
7410
7721
|
...getGridTextLeadingVars(lightboxCounterFontSize, lightboxCounterLineHeight, P, isEditor),
|
|
7411
|
-
} as React.CSSProperties
|
|
7722
|
+
} as React.CSSProperties), [
|
|
7723
|
+
lightboxCounterFontFamily, lightboxCounterFontSettings, lightboxCounterFontSize, lightboxCounterLineHeight,
|
|
7724
|
+
lightboxCounterLetterSpacing, lightboxCounterWordSpacing, lightboxCounterTextAppearance, lightboxCounterColor,
|
|
7725
|
+
isEditor, P,
|
|
7726
|
+
]);
|
|
7412
7727
|
|
|
7413
7728
|
const titleTextClassName = getGridTextClassName(
|
|
7414
7729
|
titleFontSize,
|
|
@@ -7422,8 +7737,6 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7422
7737
|
\`\${P}-item-subtitle\`,
|
|
7423
7738
|
\`\${P}-text-tight-leading\`,
|
|
7424
7739
|
);
|
|
7425
|
-
const titleTextLeadingVars = getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor);
|
|
7426
|
-
const subtitleTextLeadingVars = getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor);
|
|
7427
7740
|
const lightboxCounterClassName = getGridTextClassName(
|
|
7428
7741
|
lightboxCounterFontSize,
|
|
7429
7742
|
lightboxCounterLineHeight,
|
|
@@ -7431,42 +7744,59 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7431
7744
|
\`\${P}-text-tight-leading\`,
|
|
7432
7745
|
);
|
|
7433
7746
|
|
|
7434
|
-
const colorVars = buildColorVars(P, {
|
|
7747
|
+
const colorVars = useMemo(() => buildColorVars(P, {
|
|
7435
7748
|
titleColor,
|
|
7436
7749
|
subtitleColor,
|
|
7437
7750
|
lightboxCounterColor,
|
|
7438
|
-
}, COLOR_VAR_MAP, STATE_KEYS);
|
|
7751
|
+
}, COLOR_VAR_MAP, STATE_KEYS), [P, titleColor, subtitleColor, lightboxCounterColor]);
|
|
7439
7752
|
|
|
7440
7753
|
const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
|
|
7441
7754
|
const showTextOnHover = showText === 'on hover' && (!isEditor || isPreviewMode);
|
|
7442
7755
|
const hoverEffectClass = hover !== 'none' && (!isEditor || isPreviewMode) ? \` \${P}-hover-\${hover}\` : '';
|
|
7443
7756
|
const wrapperStateClasses = \`\${stateClass}\${showTextOnHover ? \` \${P}-show-text-hover\` : ''}\${hoverEffectClass}\`.trim();
|
|
7444
7757
|
|
|
7445
|
-
const
|
|
7758
|
+
const customLayout = customGrid && Array.isArray(customGrid.blocks) && customGrid.blocks.length > 0 ? customGrid : undefined;
|
|
7759
|
+
const resEntriesCount = customLayout || entriesCount === 0 ? Infinity : entriesCount;
|
|
7760
|
+
const isTextOutside = !!customLayout && textGrowth === 'outside';
|
|
7761
|
+
const isAutoHeight = customLayout?.cellHeight === 'auto';
|
|
7762
|
+
// entries stand where placeCustomGridEntries puts them rather than on grid rows
|
|
7763
|
+
const isPlacedLayout = isAutoHeight || customLayout?.masonry === 'on';
|
|
7764
|
+
const itemInnerRefs = useRef<(HTMLDivElement | null)[]>([]);
|
|
7765
|
+
const [customEntryHeights, setCustomEntryHeights] = useState<number[]>([]);
|
|
7446
7766
|
|
|
7447
|
-
const cropContent = (content ?? []).slice(0, resEntriesCount);
|
|
7767
|
+
const cropContent = useMemo<any[]>(() => (content ?? []).slice(0, resEntriesCount), [content, resEntriesCount]);
|
|
7448
7768
|
const lightboxMediaToPreload = useMemo(
|
|
7449
7769
|
() => (lightbox === 'on' ? collectGridLightboxMedia(cropContent) : []),
|
|
7450
7770
|
[cropContent, lightbox],
|
|
7451
7771
|
);
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7772
|
+
const entriesMedia = useMemo(() => cropContent.map((item: any) => {
|
|
7773
|
+
const displayItems = getGridDisplayItems(item.gallery);
|
|
7774
|
+
const lightboxItemsForEntry = displayItems
|
|
7775
|
+
.filter(entry => entry.lightboxMedia)
|
|
7776
|
+
.map(entry => entry.lightboxMedia!);
|
|
7777
|
+
const lightboxIndexes = displayItems.map(({ lightboxMedia }) => (lightboxMedia
|
|
7778
|
+
? lightboxItemsForEntry.findIndex(media => media.assetId === lightboxMedia.assetId)
|
|
7779
|
+
: -1));
|
|
7780
|
+
return { displayItems, lightboxItemsForEntry, lightboxIndexes };
|
|
7781
|
+
}), [cropContent]);
|
|
7782
|
+
|
|
7783
|
+
const size = gridLayout?.entryWidth ?? 0.2;
|
|
7784
|
+
|
|
7785
|
+
const imageDisplaySettings = typeof imageDisplay === 'string' ? { display: imageDisplay } : imageDisplay;
|
|
7786
|
+
const isCover = imageDisplaySettings?.display === 'cover';
|
|
7787
|
+
const ratioValue = imageDisplaySettings?.ratioValue ?? '1:1';
|
|
7788
|
+
const ratioReversed = imageDisplaySettings?.reversed ?? false;
|
|
7458
7789
|
const [rW, rH] = ratioValue.split(':').map(Number);
|
|
7459
7790
|
const effW = ratioReversed ? rH : rW;
|
|
7460
7791
|
const effH = ratioReversed ? rW : rH;
|
|
7461
7792
|
const aspectRatio = \`\${effW} / \${effH}\`;
|
|
7462
7793
|
|
|
7463
|
-
const columnsCount = gridLayout
|
|
7794
|
+
const columnsCount = gridLayout?.columnsCount ?? 1;
|
|
7464
7795
|
const entryWidthScaled = scalingValue(size ?? 0, isEditor);
|
|
7465
|
-
const
|
|
7466
|
-
const isFitSlider = !isCover && slider !== 'off';
|
|
7796
|
+
const isFitSlider = slider !== 'off' && (customLayout ? isAutoHeight : !isCover);
|
|
7467
7797
|
|
|
7468
7798
|
const itemsInLastRow = cropContent.length % columnsCount || columnsCount;
|
|
7469
|
-
const isPartialLastRow = itemsInLastRow < columnsCount && cropContent.length > 0;
|
|
7799
|
+
const isPartialLastRow = !customLayout && itemsInLastRow < columnsCount && cropContent.length > 0;
|
|
7470
7800
|
const lastRowStartIndex = cropContent.length - itemsInLastRow;
|
|
7471
7801
|
const lastRowStartColumn = isPartialLastRow
|
|
7472
7802
|
? Math.floor((columnsCount - itemsInLastRow) / 2) + 1
|
|
@@ -7474,24 +7804,47 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7474
7804
|
|
|
7475
7805
|
const imageBorderRadius = imageCorners ? scalingValue(imageCorners, isEditor) : undefined;
|
|
7476
7806
|
|
|
7477
|
-
const
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7807
|
+
const getImageWrapperStyle = (
|
|
7808
|
+
entryWidth: string,
|
|
7809
|
+
slot?: CustomGridSlot,
|
|
7810
|
+
media?: { aspect?: number; isEmpty: boolean },
|
|
7811
|
+
): React.CSSProperties => ({
|
|
7812
|
+
width: entryWidth,
|
|
7813
|
+
...(slot && isAutoHeight
|
|
7814
|
+
? {
|
|
7815
|
+
// an entry with no media keeps the drawn height, so it can still be seen and filled
|
|
7816
|
+
height: media?.isEmpty ? scalingValue(slot.height, isEditor) : 'auto',
|
|
7817
|
+
flexShrink: 0,
|
|
7818
|
+
overflow: 'hidden',
|
|
7819
|
+
...(media?.aspect && !isFitSlider ? { aspectRatio: \`\${media.aspect}\` } : {}),
|
|
7820
|
+
}
|
|
7821
|
+
: slot
|
|
7822
|
+
? isTextOutside
|
|
7823
|
+
? { height: scalingValue(slot.height, isEditor), flexShrink: 0, overflow: 'hidden' }
|
|
7824
|
+
: { flex: '1 1 0%', minHeight: 0, overflow: 'hidden' }
|
|
7825
|
+
: isCover
|
|
7826
|
+
? { aspectRatio, height: 'auto', overflow: 'hidden' }
|
|
7827
|
+
: { height: 'auto' }),
|
|
7482
7828
|
...(imageBorderRadius ? { borderRadius: imageBorderRadius, overflow: 'hidden' } : {}),
|
|
7483
|
-
};
|
|
7829
|
+
});
|
|
7484
7830
|
|
|
7485
7831
|
const imageWrapperClassName = \`\${P}-item-image-wrapper\${isFitSlider ? \` \${P}-item-image-wrapper-fit-slider\` : ''}\`.trim();
|
|
7486
7832
|
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);
|
|
7833
|
+
const shouldAlignEntries = !customLayout && alignEntries === 'on';
|
|
7490
7834
|
|
|
7491
7835
|
const imageRadiusStyle = imageBorderRadius
|
|
7492
7836
|
? { borderRadius: imageBorderRadius, [MEDIA_RADIUS_VAR]: imageBorderRadius } as React.CSSProperties
|
|
7493
7837
|
: {};
|
|
7494
|
-
const imageStyle: React.CSSProperties =
|
|
7838
|
+
const imageStyle: React.CSSProperties = isAutoHeight
|
|
7839
|
+
? {
|
|
7840
|
+
objectFit: isFitSlider && !isCover ? 'contain' : 'cover',
|
|
7841
|
+
pointerEvents: 'auto',
|
|
7842
|
+
width: '100%',
|
|
7843
|
+
height: '100%',
|
|
7844
|
+
maxWidth: '100%',
|
|
7845
|
+
...imageRadiusStyle,
|
|
7846
|
+
}
|
|
7847
|
+
: isCover
|
|
7495
7848
|
? {
|
|
7496
7849
|
objectFit: 'cover',
|
|
7497
7850
|
pointerEvents: 'auto',
|
|
@@ -7506,31 +7859,94 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7506
7859
|
width: 'auto',
|
|
7507
7860
|
height: 'auto',
|
|
7508
7861
|
maxWidth: '100%',
|
|
7862
|
+
...(customLayout ? { maxHeight: '100%' } : {}),
|
|
7509
7863
|
...imageRadiusStyle,
|
|
7510
7864
|
};
|
|
7511
7865
|
|
|
7512
|
-
const
|
|
7513
|
-
const
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7866
|
+
const shouldMeasureEntries = (customLayout?.beat ?? 0) > 0 || isPlacedLayout;
|
|
7867
|
+
const customGridWidth = customLayout ? getCustomGridSpanWidth(customLayout, customLayout.columnsCount) : 0;
|
|
7868
|
+
useLayoutEffect(() => {
|
|
7869
|
+
if (!shouldMeasureEntries) {
|
|
7870
|
+
setCustomEntryHeights(prev => (prev.length > 0 ? [] : prev));
|
|
7871
|
+
return;
|
|
7872
|
+
}
|
|
7873
|
+
const wrapper = containerRef.current;
|
|
7874
|
+
const inners = itemInnerRefs.current.slice(0, cropContent.length);
|
|
7875
|
+
const measure = () => {
|
|
7876
|
+
const unit = wrapper && customGridWidth > 0 ? wrapper.offsetWidth / customGridWidth : 0;
|
|
7877
|
+
if (unit <= 0) return;
|
|
7878
|
+
const heights = inners.map(inner => (inner ? inner.offsetHeight / unit : 0));
|
|
7879
|
+
setCustomEntryHeights(prev => (
|
|
7880
|
+
prev.length === heights.length && prev.every((height, index) => Math.abs(height - heights[index]) < 1e-5)
|
|
7881
|
+
? prev
|
|
7882
|
+
: heights
|
|
7883
|
+
));
|
|
7884
|
+
};
|
|
7885
|
+
measure();
|
|
7886
|
+
const ro = new ResizeObserver(measure);
|
|
7887
|
+
if (wrapper) ro.observe(wrapper);
|
|
7888
|
+
inners.forEach(inner => inner && ro.observe(inner));
|
|
7530
7889
|
return () => ro.disconnect();
|
|
7531
|
-
}, []);
|
|
7890
|
+
}, [shouldMeasureEntries, cropContent.length, customGridWidth, P]);
|
|
7891
|
+
const measuredEntryHeights = shouldMeasureEntries && customEntryHeights.length === cropContent.length
|
|
7892
|
+
? customEntryHeights
|
|
7893
|
+
: undefined;
|
|
7894
|
+
const customRows = useMemo(() => {
|
|
7895
|
+
if (!customLayout) return undefined;
|
|
7896
|
+
const rows = getCustomGridRows(customLayout, cropContent.length, measuredEntryHeights);
|
|
7897
|
+
return {
|
|
7898
|
+
gridRows: rows.gridRows,
|
|
7899
|
+
gridTemplateRows: rows.tracks.length
|
|
7900
|
+
? rows.tracks.map(track => (track === 'auto' ? 'auto' : scalingValue(track, isEditor))).join(' ')
|
|
7901
|
+
: 'auto',
|
|
7902
|
+
};
|
|
7903
|
+
}, [customLayout, cropContent.length, measuredEntryHeights, isEditor]);
|
|
7904
|
+
const customSlots = useMemo(
|
|
7905
|
+
() => (customLayout ? cropContent.map((_, index) => getCustomGridSlot(customLayout, index)) : undefined),
|
|
7906
|
+
[customLayout, cropContent.length],
|
|
7907
|
+
);
|
|
7908
|
+
// the aspect a single media keeps when the cell takes its height
|
|
7909
|
+
const entryMediaAspects = useMemo(
|
|
7910
|
+
() => entriesMedia.map(({ displayItems }) => (
|
|
7911
|
+
isAutoHeight && displayItems.length > 0 ? getGridMediaAspect(displayItems[0].displayMedia) : undefined
|
|
7912
|
+
)),
|
|
7913
|
+
[entriesMedia, isAutoHeight],
|
|
7914
|
+
);
|
|
7915
|
+
const customPlacement = useMemo(() => {
|
|
7916
|
+
if (!customLayout || !customSlots || !isPlacedLayout) return undefined;
|
|
7917
|
+
const beat = customLayout.beat ?? 0;
|
|
7918
|
+
const heights = customSlots.map((slot, index) => {
|
|
7919
|
+
// until the entries are measured, a media that tells its size gives the height it will take
|
|
7920
|
+
const aspects = entriesMedia[index].displayItems.map(({ displayMedia }) => getGridMediaAspect(displayMedia));
|
|
7921
|
+
const known = aspects.filter((aspect): aspect is number => aspect !== undefined);
|
|
7922
|
+
const estimate = isAutoHeight && known.length > 0 ? Math.max(...known.map(aspect => slot.width / aspect)) : slot.height;
|
|
7923
|
+
const height = measuredEntryHeights?.[index] ?? estimate;
|
|
7924
|
+
return beat > 0 ? Math.ceil(height / beat - 1e-3) * beat : height;
|
|
7925
|
+
});
|
|
7926
|
+
return placeCustomGridEntries(customLayout, customSlots, heights);
|
|
7927
|
+
}, [customLayout, customSlots, isPlacedLayout, isAutoHeight, entriesMedia, measuredEntryHeights]);
|
|
7928
|
+
const wrapperLayoutStyle: React.CSSProperties = customLayout
|
|
7929
|
+
? {
|
|
7930
|
+
gridTemplateColumns: \`repeat(\${customLayout.columnsCount}, \${scalingValue(customLayout.columnWidth, isEditor)})\`,
|
|
7931
|
+
gridTemplateRows: customRows?.gridTemplateRows ?? 'auto',
|
|
7932
|
+
rowGap: 0,
|
|
7933
|
+
columnGap: scalingValue(customLayout.gutterWidth, isEditor),
|
|
7934
|
+
width: scalingValue(getCustomGridSpanWidth(customLayout, customLayout.columnsCount), isEditor),
|
|
7935
|
+
...(customPlacement ? { position: 'relative', height: scalingValue(customPlacement.bottom, isEditor) } : {}),
|
|
7936
|
+
}
|
|
7937
|
+
: {
|
|
7938
|
+
gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
|
|
7939
|
+
rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
|
|
7940
|
+
columnGap: scalingValue(gridLayout?.horizontalGap ?? 0, isEditor),
|
|
7941
|
+
width: scalingValue(gridLayout?.wrapperWidth ?? 0, isEditor),
|
|
7942
|
+
...(shouldAlignEntries
|
|
7943
|
+
? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
|
|
7944
|
+
: {}),
|
|
7945
|
+
};
|
|
7532
7946
|
|
|
7533
|
-
const
|
|
7947
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
7948
|
+
|
|
7949
|
+
const getLightboxPortalStyle = (): React.CSSProperties => {
|
|
7534
7950
|
const style: Record<string, string> = { ...(colorVars as Record<string, string>) };
|
|
7535
7951
|
const articleWidth = containerRef.current
|
|
7536
7952
|
? getComputedStyle(containerRef.current).getPropertyValue('--cntrl-article-width').trim()
|
|
@@ -7539,7 +7955,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7539
7955
|
style['--cntrl-article-width'] = articleWidth;
|
|
7540
7956
|
}
|
|
7541
7957
|
return style as React.CSSProperties;
|
|
7542
|
-
}
|
|
7958
|
+
};
|
|
7543
7959
|
|
|
7544
7960
|
const [lightboxOpen, setLightboxOpen] = useState(false);
|
|
7545
7961
|
const [lightboxItems, setLightboxItems] = useState<GridMedia[]>([]);
|
|
@@ -7578,16 +7994,8 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7578
7994
|
<div style={colorVars}>
|
|
7579
7995
|
<div
|
|
7580
7996
|
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
|
-
}}>
|
|
7997
|
+
className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''}\${customLayout ? \` \${P}-custom-layout\` : ''}\${isTextOutside ? \` \${P}-text-outside\` : ''}\${isAutoHeight ? \` \${P}-auto-height\` : ''} \${P}-image-align-\${customLayout ? 'top' : align} \${wrapperStateClasses}\`.trim()}
|
|
7998
|
+
style={wrapperLayoutStyle}>
|
|
7591
7999
|
{cropContent.map((item: any, index: number) => {
|
|
7592
8000
|
const hasTitle = hasText(item.title);
|
|
7593
8001
|
const hasSubtitle = hasText(item.subtitle);
|
|
@@ -7597,11 +8005,40 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7597
8005
|
const gridColumn = isPartialLastRow && index >= lastRowStartIndex
|
|
7598
8006
|
? \`\${lastRowStartColumn + (index - lastRowStartIndex)}\`
|
|
7599
8007
|
: undefined;
|
|
8008
|
+
const customSlot = customSlots?.[index];
|
|
8009
|
+
const itemSize = customSlot?.width ?? size;
|
|
8010
|
+
const itemWidthScaled = scalingValue(itemSize, isEditor);
|
|
8011
|
+
const textBoxWidthStyle = \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`;
|
|
8012
|
+
const controlWidthStyle = scalingValue(itemSize * textBoxWidth / 100, isEditor);
|
|
8013
|
+
const { displayItems, lightboxItemsForEntry, lightboxIndexes } = entriesMedia[index];
|
|
8014
|
+
const mediaAspect = slider === 'off' ? entryMediaAspects[index] : undefined;
|
|
8015
|
+
const imageWrapperStyle = getImageWrapperStyle(
|
|
8016
|
+
itemWidthScaled,
|
|
8017
|
+
customSlot,
|
|
8018
|
+
{ aspect: mediaAspect, isEmpty: displayItems.length === 0 },
|
|
8019
|
+
);
|
|
8020
|
+
const entryImageStyle = isAutoHeight && slider === 'off' && !mediaAspect
|
|
8021
|
+
? { ...imageStyle, height: 'auto' }
|
|
8022
|
+
: imageStyle;
|
|
8023
|
+
const itemStyle: React.CSSProperties | undefined = customSlot && customLayout && customPlacement
|
|
8024
|
+
? {
|
|
8025
|
+
position: 'absolute',
|
|
8026
|
+
left: scalingValue(customSlot.column * (customLayout.columnWidth + customLayout.gutterWidth), isEditor),
|
|
8027
|
+
top: scalingValue(customPlacement.tops[index], isEditor),
|
|
8028
|
+
width: itemWidthScaled,
|
|
8029
|
+
}
|
|
8030
|
+
: customSlot
|
|
8031
|
+
? {
|
|
8032
|
+
gridColumn: customSlot.gridColumn,
|
|
8033
|
+
gridRow: customRows?.gridRows[index],
|
|
8034
|
+
alignSelf: 'start',
|
|
8035
|
+
}
|
|
8036
|
+
: gridColumn && !shouldAlignEntries ? { gridColumn } : undefined;
|
|
7600
8037
|
|
|
7601
8038
|
const typeCTextBlock = isTextBeforeImage ? (
|
|
7602
8039
|
<div className={\`\${P}-item-text-block\`}>
|
|
7603
8040
|
{hasTitle && (
|
|
7604
|
-
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
8041
|
+
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleTextStyle }}>
|
|
7605
8042
|
{item.title}
|
|
7606
8043
|
</p>
|
|
7607
8044
|
)}
|
|
@@ -7616,7 +8053,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7616
8053
|
/>
|
|
7617
8054
|
)}
|
|
7618
8055
|
{hasSubtitle && (
|
|
7619
|
-
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
8056
|
+
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}>
|
|
7620
8057
|
{item.subtitle}
|
|
7621
8058
|
</p>
|
|
7622
8059
|
)}
|
|
@@ -7646,7 +8083,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7646
8083
|
/>
|
|
7647
8084
|
)}
|
|
7648
8085
|
{hasTitle && (
|
|
7649
|
-
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
8086
|
+
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleTextStyle }}>
|
|
7650
8087
|
{item.title}
|
|
7651
8088
|
</p>
|
|
7652
8089
|
)}
|
|
@@ -7676,7 +8113,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7676
8113
|
/>
|
|
7677
8114
|
)}
|
|
7678
8115
|
{hasSubtitle && (
|
|
7679
|
-
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
8116
|
+
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}>
|
|
7680
8117
|
{item.subtitle}
|
|
7681
8118
|
</p>
|
|
7682
8119
|
)}
|
|
@@ -7700,11 +8137,6 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7700
8137
|
</LinkWrapper>
|
|
7701
8138
|
);
|
|
7702
8139
|
|
|
7703
|
-
const displayItems = getGridDisplayItems(item.gallery);
|
|
7704
|
-
const lightboxItemsForEntry = displayItems
|
|
7705
|
-
.filter(entry => entry.lightboxMedia)
|
|
7706
|
-
.map(entry => entry.lightboxMedia!);
|
|
7707
|
-
|
|
7708
8140
|
const imageContent = (
|
|
7709
8141
|
<GridItemMediaWrapper className={imageWrapperClassName} style={imageWrapperStyle}>
|
|
7710
8142
|
{displayItems.length === 0
|
|
@@ -7712,15 +8144,13 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7712
8144
|
: slider === 'off'
|
|
7713
8145
|
?
|
|
7714
8146
|
(() => {
|
|
7715
|
-
const { displayMedia
|
|
7716
|
-
const lightboxIndex =
|
|
7717
|
-
? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
|
|
7718
|
-
: -1;
|
|
8147
|
+
const { displayMedia } = displayItems[0];
|
|
8148
|
+
const lightboxIndex = lightboxIndexes[0];
|
|
7719
8149
|
return (
|
|
7720
8150
|
<GridMediaItem
|
|
7721
8151
|
media={displayMedia}
|
|
7722
8152
|
className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
|
|
7723
|
-
style={
|
|
8153
|
+
style={entryImageStyle}
|
|
7724
8154
|
hasLightbox={lightbox === 'on'}
|
|
7725
8155
|
onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
|
|
7726
8156
|
? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
|
|
@@ -7743,50 +8173,28 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7743
8173
|
))}
|
|
7744
8174
|
</div>
|
|
7745
8175
|
)}
|
|
7746
|
-
<
|
|
7747
|
-
key={\`\${transition}-\${
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
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;
|
|
8176
|
+
<GridEntrySlider
|
|
8177
|
+
key={\`\${transition}-\${itemSize}-\${direction}-\${sliderTiming}-\${layoutId}-\${displayItems.length}\`}
|
|
8178
|
+
prefix={P}
|
|
8179
|
+
isFade={transition === 'fade'}
|
|
8180
|
+
direction={direction}
|
|
8181
|
+
intervalMs={sliderTiming * 1000}
|
|
8182
|
+
slides={displayItems.map(({ displayMedia }, imgIndex) => {
|
|
8183
|
+
const lightboxIndex = lightboxIndexes[imgIndex];
|
|
7774
8184
|
return (
|
|
7775
|
-
<
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
/>
|
|
7786
|
-
</SplideSlide>
|
|
8185
|
+
<GridMediaItem
|
|
8186
|
+
media={displayMedia}
|
|
8187
|
+
className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
|
|
8188
|
+
style={imageStyle}
|
|
8189
|
+
hasLightbox={lightbox === 'on'}
|
|
8190
|
+
isSliderSlide
|
|
8191
|
+
onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
|
|
8192
|
+
? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
|
|
8193
|
+
: undefined}
|
|
8194
|
+
/>
|
|
7787
8195
|
);
|
|
7788
8196
|
})}
|
|
7789
|
-
|
|
8197
|
+
/>
|
|
7790
8198
|
</>
|
|
7791
8199
|
}
|
|
7792
8200
|
</GridItemMediaWrapper>
|
|
@@ -7804,7 +8212,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7804
8212
|
/>
|
|
7805
8213
|
<p
|
|
7806
8214
|
className={titleTextClassName}
|
|
7807
|
-
style={{ width: textBoxWidthStyle, ...
|
|
8215
|
+
style={{ width: textBoxWidthStyle, ...titleTextStyle }}
|
|
7808
8216
|
>
|
|
7809
8217
|
{item.title}
|
|
7810
8218
|
</p>
|
|
@@ -7818,7 +8226,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7818
8226
|
/>
|
|
7819
8227
|
<p
|
|
7820
8228
|
className={subtitleTextClassName}
|
|
7821
|
-
style={{ width: textBoxWidthStyle, ...
|
|
8229
|
+
style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}
|
|
7822
8230
|
>
|
|
7823
8231
|
{item.subtitle}
|
|
7824
8232
|
</p>
|
|
@@ -7838,16 +8246,18 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7838
8246
|
<div
|
|
7839
8247
|
key={index}
|
|
7840
8248
|
className={\`\${P}-item\`.trim()}
|
|
7841
|
-
style={
|
|
8249
|
+
style={itemStyle}
|
|
7842
8250
|
>
|
|
7843
8251
|
<div
|
|
7844
|
-
|
|
7845
|
-
|
|
8252
|
+
ref={(el) => { itemInnerRefs.current[index] = el; }}
|
|
8253
|
+
className={\`\${isEditMode
|
|
8254
|
+
? \`\${P}-item-inner\`
|
|
7846
8255
|
: \`\${P}-item-inner-hidden\`}\${shouldAlignEntries && isLastRow ? \` \${P}-item-inner-last-row\` : ''}\`.trim()}
|
|
7847
8256
|
style={{
|
|
7848
8257
|
width: (textBoxWidth ?? 0) > 100
|
|
7849
|
-
? \`calc(\${
|
|
7850
|
-
:
|
|
8258
|
+
? \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`
|
|
8259
|
+
: itemWidthScaled,
|
|
8260
|
+
...(customSlot && !isTextOutside && !isAutoHeight ? { height: scalingValue(customSlot.height, isEditor) } : {}),
|
|
7851
8261
|
...(gridColumn && shouldAlignEntries ? { gridColumn } : {}),
|
|
7852
8262
|
}}
|
|
7853
8263
|
>
|
|
@@ -7893,7 +8303,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7893
8303
|
{(!isEditor || isPreviewMode) && lightboxOpen && typeof document !== 'undefined' && lightbox === 'on' && (() => {
|
|
7894
8304
|
const portalTarget = (portalId ? document.getElementById(portalId) : null) ?? document.body;
|
|
7895
8305
|
return createPortal(
|
|
7896
|
-
<div style={
|
|
8306
|
+
<div style={getLightboxPortalStyle()} data-selection="none">
|
|
7897
8307
|
<Lightbox
|
|
7898
8308
|
prefix={P}
|
|
7899
8309
|
items={lightboxItems}
|
|
@@ -7930,17 +8340,38 @@ type GridLayoutConfig = {
|
|
|
7930
8340
|
lockedParam?: 'wrapperWidth' | 'entryWidth' | 'horizontalGap' | null;
|
|
7931
8341
|
};
|
|
7932
8342
|
|
|
8343
|
+
type CustomGridBlock = {
|
|
8344
|
+
column: number;
|
|
8345
|
+
span: number;
|
|
8346
|
+
top: number;
|
|
8347
|
+
height: number;
|
|
8348
|
+
};
|
|
8349
|
+
|
|
8350
|
+
type CustomGridLayout = {
|
|
8351
|
+
columnsCount: number;
|
|
8352
|
+
columnWidth: number;
|
|
8353
|
+
gutterWidth: number;
|
|
8354
|
+
maxWidth: number | null;
|
|
8355
|
+
verticalGap?: number;
|
|
8356
|
+
beat?: number;
|
|
8357
|
+
repeatHeight?: number;
|
|
8358
|
+
blocks: CustomGridBlock[];
|
|
8359
|
+
cellHeight?: 'manual' | 'auto';
|
|
8360
|
+
masonry?: 'off' | 'on';
|
|
8361
|
+
};
|
|
8362
|
+
|
|
7933
8363
|
type GridSettings = {
|
|
7934
8364
|
type: 'a' | 'b' | 'c' | 'd' | 'e' | 'f';
|
|
7935
|
-
gridLayout
|
|
8365
|
+
gridLayout?: GridLayoutConfig;
|
|
8366
|
+
customGrid?: CustomGridLayout;
|
|
7936
8367
|
textBoxWidth: number;
|
|
7937
|
-
verticalGap
|
|
7938
|
-
entriesCount
|
|
8368
|
+
verticalGap?: number;
|
|
8369
|
+
entriesCount?: number;
|
|
7939
8370
|
lightbox: 'on' | 'off';
|
|
7940
|
-
imageDisplay: {
|
|
8371
|
+
imageDisplay: 'fit' | 'cover' | {
|
|
7941
8372
|
display: 'fit' | 'cover';
|
|
7942
|
-
ratioValue
|
|
7943
|
-
reversed
|
|
8373
|
+
ratioValue?: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
|
|
8374
|
+
reversed?: boolean;
|
|
7944
8375
|
};
|
|
7945
8376
|
imageCorners?: number;
|
|
7946
8377
|
lightboxImageDisplay?: 'fit' | 'cover' | { display?: 'fit' | 'cover' };
|
|
@@ -7950,8 +8381,9 @@ type GridSettings = {
|
|
|
7950
8381
|
transition: 'fade' | 'slide',
|
|
7951
8382
|
showText: 'always' | 'on hover';
|
|
7952
8383
|
hover?: 'none' | 'zoom-in' | 'greyscale' | 'scale-down';
|
|
7953
|
-
alignEntries
|
|
8384
|
+
alignEntries?: 'on' | 'off';
|
|
7954
8385
|
align?: 'top' | 'center' | 'bottom';
|
|
8386
|
+
textGrowth?: 'inside' | 'outside';
|
|
7955
8387
|
titleMarginTop: number;
|
|
7956
8388
|
subtitleMarginTop: number;
|
|
7957
8389
|
titleColor: string;
|
|
@@ -7998,7 +8430,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
7998
8430
|
};
|
|
7999
8431
|
|
|
8000
8432
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
8001
|
-
`,
|
|
8433
|
+
`, R = `import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
|
|
8002
8434
|
import { CommonComponentProps } from '../props';
|
|
8003
8435
|
import { scalingValue } from '../utils/scalingValue';
|
|
8004
8436
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -8571,7 +9003,7 @@ export function Helix({
|
|
|
8571
9003
|
</>
|
|
8572
9004
|
);
|
|
8573
9005
|
}
|
|
8574
|
-
`,
|
|
9006
|
+
`, M = `import { CommonComponentProps } from '../props';
|
|
8575
9007
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
|
|
8576
9008
|
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
8577
9009
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -11023,7 +11455,7 @@ export function Hive({
|
|
|
11023
11455
|
</>
|
|
11024
11456
|
);
|
|
11025
11457
|
}
|
|
11026
|
-
`,
|
|
11458
|
+
`, L = `import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
|
|
11027
11459
|
import { createPortal } from 'react-dom';
|
|
11028
11460
|
import { CommonComponentProps } from '../props';
|
|
11029
11461
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -11826,7 +12258,7 @@ export type LightboxJournalSettings = {
|
|
|
11826
12258
|
closeIconColor: string;
|
|
11827
12259
|
closeIconHoverColor: string;
|
|
11828
12260
|
};
|
|
11829
|
-
`,
|
|
12261
|
+
`, k = `import { useEffect, useRef, useState, type MouseEvent } from 'react';
|
|
11830
12262
|
import { createPortal } from 'react-dom';
|
|
11831
12263
|
import { CommonComponentProps } from '../props';
|
|
11832
12264
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -12410,7 +12842,7 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
|
|
|
12410
12842
|
</>
|
|
12411
12843
|
);
|
|
12412
12844
|
};
|
|
12413
|
-
`,
|
|
12845
|
+
`, A = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
12414
12846
|
import { createPortal } from 'react-dom';
|
|
12415
12847
|
import { CommonComponentProps } from '../props';
|
|
12416
12848
|
import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -15515,7 +15947,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
|
|
|
15515
15947
|
</>
|
|
15516
15948
|
);
|
|
15517
15949
|
}
|
|
15518
|
-
`,
|
|
15950
|
+
`, N = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
15519
15951
|
import cn from 'classnames';
|
|
15520
15952
|
import { CommonComponentProps } from '../props';
|
|
15521
15953
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -16373,7 +16805,7 @@ type MarqueeProps = {
|
|
|
16373
16805
|
isPreviewMode?: boolean;
|
|
16374
16806
|
isEditMode?: boolean;
|
|
16375
16807
|
} & CommonComponentProps;
|
|
16376
|
-
`,
|
|
16808
|
+
`, H = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
|
|
16377
16809
|
import cn from 'classnames';
|
|
16378
16810
|
import { CommonComponentProps } from '../props';
|
|
16379
16811
|
import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -17316,7 +17748,7 @@ type MarqueeTextProps = {
|
|
|
17316
17748
|
isPreviewMode?: boolean;
|
|
17317
17749
|
isEditMode?: boolean;
|
|
17318
17750
|
} & CommonComponentProps;
|
|
17319
|
-
`,
|
|
17751
|
+
`, O = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
17320
17752
|
import { createPortal } from 'react-dom';
|
|
17321
17753
|
import type React from 'react';
|
|
17322
17754
|
import { CommonComponentProps } from '../props';
|
|
@@ -19798,7 +20230,7 @@ export function Mercury({
|
|
|
19798
20230
|
</>
|
|
19799
20231
|
);
|
|
19800
20232
|
}
|
|
19801
|
-
`,
|
|
20233
|
+
`, _ = `import React, { useMemo, useState } from 'react';
|
|
19802
20234
|
import { CommonComponentProps } from '../props';
|
|
19803
20235
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
19804
20236
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -20377,7 +20809,7 @@ const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {
|
|
|
20377
20809
|
};
|
|
20378
20810
|
|
|
20379
20811
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
20380
|
-
`,
|
|
20812
|
+
`, F = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
20381
20813
|
import type React from 'react';
|
|
20382
20814
|
import { CommonComponentProps } from '../props';
|
|
20383
20815
|
import { scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -21216,7 +21648,7 @@ export function Pretext({ settings, content, isEditor, isPreviewMode, isEditMode
|
|
|
21216
21648
|
</>
|
|
21217
21649
|
);
|
|
21218
21650
|
}
|
|
21219
|
-
`,
|
|
21651
|
+
`, W = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
21220
21652
|
import cn from 'classnames';
|
|
21221
21653
|
import { CommonComponentProps } from '../props';
|
|
21222
21654
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -21844,7 +22276,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
21844
22276
|
</>
|
|
21845
22277
|
);
|
|
21846
22278
|
}
|
|
21847
|
-
`,
|
|
22279
|
+
`, D = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
|
|
21848
22280
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
21849
22281
|
import { CommonComponentProps } from '../props';
|
|
21850
22282
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
@@ -22476,7 +22908,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
22476
22908
|
</>
|
|
22477
22909
|
);
|
|
22478
22910
|
}
|
|
22479
|
-
`,
|
|
22911
|
+
`, B = `import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
22480
22912
|
import cn from 'classnames';
|
|
22481
22913
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
22482
22914
|
import { scalingValue } from '../utils/scalingValue';
|
|
@@ -23658,7 +24090,7 @@ function ArrowIcon({ color, className }: { color: string, className: string }) {
|
|
|
23658
24090
|
</svg>
|
|
23659
24091
|
);
|
|
23660
24092
|
}
|
|
23661
|
-
`,
|
|
24093
|
+
`, z = `import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
23662
24094
|
import cn from 'classnames';
|
|
23663
24095
|
import { CommonComponentProps } from '../props';
|
|
23664
24096
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -24289,7 +24721,7 @@ type TestimonialsSettings = {
|
|
|
24289
24721
|
logoHeight: number;
|
|
24290
24722
|
captionMarginTop: number;
|
|
24291
24723
|
};
|
|
24292
|
-
`,
|
|
24724
|
+
`, V = `import cn from 'classnames';
|
|
24293
24725
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
24294
24726
|
import { CommonComponentProps } from '../props';
|
|
24295
24727
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -24785,7 +25217,7 @@ type TestimonialsSettings = {
|
|
|
24785
25217
|
icon?: string | null;
|
|
24786
25218
|
};
|
|
24787
25219
|
};
|
|
24788
|
-
`,
|
|
25220
|
+
`, G = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
24789
25221
|
import type React from 'react';
|
|
24790
25222
|
import { createPortal } from 'react-dom';
|
|
24791
25223
|
import { CommonComponentProps } from '../props';
|
|
@@ -25318,30 +25750,31 @@ export function Waterfall({
|
|
|
25318
25750
|
</>
|
|
25319
25751
|
);
|
|
25320
25752
|
}
|
|
25321
|
-
`,
|
|
25322
|
-
[
|
|
25323
|
-
[
|
|
25324
|
-
[
|
|
25325
|
-
[
|
|
25326
|
-
[
|
|
25327
|
-
[
|
|
25328
|
-
[
|
|
25329
|
-
[
|
|
25330
|
-
[
|
|
25331
|
-
[
|
|
25332
|
-
[
|
|
25333
|
-
[
|
|
25334
|
-
[
|
|
25335
|
-
[
|
|
25336
|
-
[
|
|
25337
|
-
[
|
|
25338
|
-
[
|
|
25339
|
-
[
|
|
25340
|
-
[
|
|
25341
|
-
[
|
|
25342
|
-
[
|
|
25343
|
-
[
|
|
25753
|
+
`, K = {
|
|
25754
|
+
[C.id]: w,
|
|
25755
|
+
[S.id]: $,
|
|
25756
|
+
[y.id]: I,
|
|
25757
|
+
[b.id]: n,
|
|
25758
|
+
[x.id]: E,
|
|
25759
|
+
[P.id]: T,
|
|
25760
|
+
[v.id]: n,
|
|
25761
|
+
[f.id]: R,
|
|
25762
|
+
[h.id]: M,
|
|
25763
|
+
[p.id]: L,
|
|
25764
|
+
[m.id]: k,
|
|
25765
|
+
[g.id]: A,
|
|
25766
|
+
[u.id]: N,
|
|
25767
|
+
[d.id]: H,
|
|
25768
|
+
[c.id]: O,
|
|
25769
|
+
[l.id]: _,
|
|
25770
|
+
[s.id]: F,
|
|
25771
|
+
[a.id]: W,
|
|
25772
|
+
[r.id]: D,
|
|
25773
|
+
[o.id]: B,
|
|
25774
|
+
[i.id]: z,
|
|
25775
|
+
[t.id]: V,
|
|
25776
|
+
[e.id]: G
|
|
25344
25777
|
};
|
|
25345
25778
|
export {
|
|
25346
|
-
|
|
25779
|
+
K as componentSources
|
|
25347
25780
|
};
|