@cntrl-site/components 1.0.118-alpha.3 → 1.0.118
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-BkVgNMGU.mjs → Burger-C8JIQQwm.mjs} +330 -307
- package/dist/Burger-C_SjPZWp.js +669 -0
- package/dist/ChroniclesComponent-DkG1aICD.js +1 -0
- package/dist/{ChroniclesComponent-DD3tqNNm.mjs → ChroniclesComponent-kkKhL_qt.mjs} +442 -512
- package/dist/Components/Burger/Burger.d.ts +4 -2
- package/dist/Components/Grid/Grid.d.ts +7 -25
- package/dist/ControlSlider-C8ckUIDm.js +1 -0
- package/dist/{ControlSlider-BBAXRDLP.mjs → ControlSlider-DqKfaKMG.mjs} +3 -2
- package/dist/Grid-C4hO8KCr.js +408 -0
- package/dist/Grid-Dud7PLS9.mjs +1622 -0
- package/dist/{components-BwAmTGJp.mjs → components-BLyOKMdK.mjs} +13 -14
- package/dist/{components-D8RelPGE.js → components-CVetdKi7.js} +1 -1
- package/dist/components.css +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +8 -9
- package/dist/elements.node.js +1 -1
- package/dist/elements.node.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +2 -2
- package/dist/sources.js +286 -522
- package/dist/sources.mjs +326 -563
- package/package.json +1 -1
- package/dist/Burger-C3yVbQcq.js +0 -669
- package/dist/ChroniclesComponent-BMbUwzk6.js +0 -1
- package/dist/Components/Grid/CustomGridComponent.d.ts +0 -41
- package/dist/ControlSlider-BCkVFl4w.js +0 -1
- package/dist/Grid-CUaVUaRa.js +0 -441
- package/dist/Grid-D19xZ_mh.mjs +0 -1800
package/dist/sources.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as
|
|
2
|
-
const
|
|
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-kkKhL_qt.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';
|
|
@@ -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
|
+
`, w = `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
|
+
`, C = `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
|
+
`, $ = `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
|
+
`, I = `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,7 +5687,9 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
5642
5687
|
};
|
|
5643
5688
|
|
|
5644
5689
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
5645
|
-
`,
|
|
5690
|
+
`, E = `import { Splide, SplideSlide } from '@splidejs/react-splide';
|
|
5691
|
+
import '@splidejs/react-splide/css/core';
|
|
5692
|
+
import { CommonComponentProps } from '../props';
|
|
5646
5693
|
import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
|
|
5647
5694
|
import {
|
|
5648
5695
|
buildColorVars,
|
|
@@ -5652,7 +5699,7 @@ import {
|
|
|
5652
5699
|
useLazyVideos,
|
|
5653
5700
|
useScopedStyles,
|
|
5654
5701
|
} from '../utils/index';
|
|
5655
|
-
import {
|
|
5702
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
|
|
5656
5703
|
import { createPortal } from 'react-dom';
|
|
5657
5704
|
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
5658
5705
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
@@ -5769,19 +5816,15 @@ function getCSS(P: string): string {
|
|
|
5769
5816
|
width: 100%;
|
|
5770
5817
|
overflow: hidden;
|
|
5771
5818
|
}
|
|
5819
|
+
.\${P}-item-slider .splide__track {
|
|
5820
|
+
overflow: hidden;
|
|
5821
|
+
}
|
|
5772
5822
|
.\${P}-item-image-link {
|
|
5773
5823
|
width: 100%;
|
|
5774
5824
|
display: flex;
|
|
5775
5825
|
flex-direction: column;
|
|
5776
5826
|
align-items: center;
|
|
5777
5827
|
}
|
|
5778
|
-
.\${P}-custom-layout .\${P}-item-image-link {
|
|
5779
|
-
flex: 1 1 0%;
|
|
5780
|
-
min-height: 0;
|
|
5781
|
-
}
|
|
5782
|
-
.\${P}-custom-layout.\${P}-text-outside .\${P}-item-image-link {
|
|
5783
|
-
flex: none;
|
|
5784
|
-
}
|
|
5785
5828
|
.\${P}-item-text-link {
|
|
5786
5829
|
display: flex;
|
|
5787
5830
|
flex-direction: column;
|
|
@@ -5802,47 +5845,18 @@ function getCSS(P: string): string {
|
|
|
5802
5845
|
display: block;
|
|
5803
5846
|
max-width: 100%;
|
|
5804
5847
|
}
|
|
5805
|
-
.\${P}-item-slider
|
|
5806
|
-
|
|
5848
|
+
.\${P}-item-slider,
|
|
5849
|
+
.\${P}-item-slider .splide__track,
|
|
5850
|
+
.\${P}-item-slider .splide__list,
|
|
5851
|
+
.\${P}-item-slider .splide__slide {
|
|
5807
5852
|
width: 100%;
|
|
5808
5853
|
height: 100%;
|
|
5809
|
-
overflow: hidden;
|
|
5810
|
-
}
|
|
5811
|
-
.\${P}-item-slider-list {
|
|
5812
|
-
position: relative;
|
|
5813
|
-
display: flex;
|
|
5814
|
-
flex-direction: row;
|
|
5815
|
-
width: 100%;
|
|
5816
|
-
height: 100%;
|
|
5817
|
-
will-change: transform;
|
|
5818
5854
|
}
|
|
5819
|
-
.\${P}-item-slider
|
|
5820
|
-
flex-direction: column;
|
|
5821
|
-
}
|
|
5822
|
-
.\${P}-item-slider-list-fade {
|
|
5823
|
-
display: block;
|
|
5824
|
-
will-change: auto;
|
|
5825
|
-
}
|
|
5826
|
-
.\${P}-item-slide {
|
|
5827
|
-
position: relative;
|
|
5828
|
-
flex: 0 0 100%;
|
|
5829
|
-
width: 100%;
|
|
5830
|
-
height: 100%;
|
|
5855
|
+
.\${P}-item-slider .splide__slide {
|
|
5831
5856
|
display: flex;
|
|
5832
5857
|
justify-content: center;
|
|
5833
5858
|
align-items: center;
|
|
5834
5859
|
}
|
|
5835
|
-
.\${P}-item-slider-list-fade .\${P}-item-slide {
|
|
5836
|
-
position: absolute;
|
|
5837
|
-
top: 0;
|
|
5838
|
-
left: 0;
|
|
5839
|
-
opacity: 0;
|
|
5840
|
-
transition: opacity \${SLIDER_TRANSITION_MS}ms \${SLIDER_EASING};
|
|
5841
|
-
}
|
|
5842
|
-
.\${P}-item-slider-list-fade .\${P}-item-slide-active {
|
|
5843
|
-
opacity: 1;
|
|
5844
|
-
z-index: 1;
|
|
5845
|
-
}
|
|
5846
5860
|
.\${P}-item-title {
|
|
5847
5861
|
white-space: normal;
|
|
5848
5862
|
overflow-wrap: anywhere;
|
|
@@ -5989,13 +6003,13 @@ function getCSS(P: string): string {
|
|
|
5989
6003
|
.\${P}-image-align-bottom .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
|
|
5990
6004
|
align-items: flex-end;
|
|
5991
6005
|
}
|
|
5992
|
-
.\${P}-image-align-top .\${P}-item-slider
|
|
6006
|
+
.\${P}-image-align-top .\${P}-item-slider .splide__slide {
|
|
5993
6007
|
align-items: flex-start;
|
|
5994
6008
|
}
|
|
5995
|
-
.\${P}-image-align-center .\${P}-item-slider
|
|
6009
|
+
.\${P}-image-align-center .\${P}-item-slider .splide__slide {
|
|
5996
6010
|
align-items: center;
|
|
5997
6011
|
}
|
|
5998
|
-
.\${P}-image-align-bottom .\${P}-item-slider
|
|
6012
|
+
.\${P}-image-align-bottom .\${P}-item-slider .splide__slide {
|
|
5999
6013
|
align-items: flex-end;
|
|
6000
6014
|
}
|
|
6001
6015
|
.\${P}-align-entries .\${P}-item {
|
|
@@ -6076,13 +6090,13 @@ function getCSS(P: string): string {
|
|
|
6076
6090
|
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
|
|
6077
6091
|
align-items: flex-end;
|
|
6078
6092
|
}
|
|
6079
|
-
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider
|
|
6093
|
+
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider .splide__slide {
|
|
6080
6094
|
align-items: flex-start;
|
|
6081
6095
|
}
|
|
6082
|
-
.\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider
|
|
6096
|
+
.\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider .splide__slide {
|
|
6083
6097
|
align-items: center;
|
|
6084
6098
|
}
|
|
6085
|
-
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider
|
|
6099
|
+
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider .splide__slide {
|
|
6086
6100
|
align-items: flex-end;
|
|
6087
6101
|
}
|
|
6088
6102
|
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-image-link {
|
|
@@ -6150,9 +6164,27 @@ function pickRandomSlideDirection(): 'ltr' | 'ttb' {
|
|
|
6150
6164
|
return Math.random() < 0.5 ? 'ltr' : 'ttb';
|
|
6151
6165
|
}
|
|
6152
6166
|
|
|
6153
|
-
function
|
|
6154
|
-
|
|
6155
|
-
|
|
6167
|
+
function resumeSplideAutoplay(splide: { Components: { Autoplay?: { pause: (stop?: boolean) => void; play: () => void } } }) {
|
|
6168
|
+
const autoplay = splide.Components.Autoplay;
|
|
6169
|
+
if (!autoplay) return;
|
|
6170
|
+
autoplay.pause(false);
|
|
6171
|
+
autoplay.play();
|
|
6172
|
+
}
|
|
6173
|
+
|
|
6174
|
+
function handleRandomSlideMoved(splide: {
|
|
6175
|
+
options: { direction?: string };
|
|
6176
|
+
Components: { Autoplay?: { pause: (stop?: boolean) => void; play: () => void } };
|
|
6177
|
+
}) {
|
|
6178
|
+
const next = pickRandomSlideDirection();
|
|
6179
|
+
if (splide.options.direction !== next) {
|
|
6180
|
+
splide.options = { ...splide.options, direction: next };
|
|
6181
|
+
}
|
|
6182
|
+
|
|
6183
|
+
requestAnimationFrame(() => {
|
|
6184
|
+
requestAnimationFrame(() => {
|
|
6185
|
+
resumeSplideAutoplay(splide);
|
|
6186
|
+
});
|
|
6187
|
+
});
|
|
6156
6188
|
}
|
|
6157
6189
|
|
|
6158
6190
|
type GridProps = {
|
|
@@ -6192,8 +6224,6 @@ type LightboxProps = {
|
|
|
6192
6224
|
|
|
6193
6225
|
const LIGHTBOX_ANIM_MS = 500;
|
|
6194
6226
|
const SLIDER_TRANSITION_MS = 750;
|
|
6195
|
-
const SLIDER_EASING = 'cubic-bezier(0.25, 1, 0.5, 1)';
|
|
6196
|
-
const SLIDER_DEFAULT_INTERVAL_MS = 5000;
|
|
6197
6227
|
const LIGHTBOX_EASING = 'cubic-bezier(0.22, 1, 0.36, 1)';
|
|
6198
6228
|
const SWIPE_CLOSE_THRESHOLD = 72;
|
|
6199
6229
|
const SWIPE_NAV_THRESHOLD = 50;
|
|
@@ -6283,7 +6313,7 @@ function collectGridLightboxMedia(content: any[]): GridMedia[] {
|
|
|
6283
6313
|
return result;
|
|
6284
6314
|
}
|
|
6285
6315
|
|
|
6286
|
-
|
|
6316
|
+
function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
6287
6317
|
const [pool, setPool] = useState<HTMLDivElement | null>(null);
|
|
6288
6318
|
useLazyVideos(pool, { preload: 'metadata' });
|
|
6289
6319
|
// an embed's player is only ever framed where it shows
|
|
@@ -6322,7 +6352,7 @@ const LightboxMediaPreloadPool = memo(function LightboxMediaPreloadPool({ mediaL
|
|
|
6322
6352
|
))}
|
|
6323
6353
|
</div>
|
|
6324
6354
|
);
|
|
6325
|
-
}
|
|
6355
|
+
}
|
|
6326
6356
|
|
|
6327
6357
|
function unloadVideoElement(video: HTMLVideoElement) {
|
|
6328
6358
|
video.pause();
|
|
@@ -6330,121 +6360,15 @@ function unloadVideoElement(video: HTMLVideoElement) {
|
|
|
6330
6360
|
video.load();
|
|
6331
6361
|
}
|
|
6332
6362
|
|
|
6333
|
-
const
|
|
6334
|
-
const GRID_SLIDE_PLAYING_CLASS = 'cntrl-grid-slide-playing';
|
|
6335
|
-
const GRID_SLIDE_VIDEOS = \`.\${GRID_SLIDE_CLASS} video\`;
|
|
6363
|
+
const SPLIDE_SLIDE_VIDEOS = '.splide__slide video';
|
|
6336
6364
|
|
|
6337
6365
|
function shouldPlaySlideVideo(video: HTMLVideoElement): boolean {
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
isFade: boolean;
|
|
6345
|
-
direction: GridSettings['direction'];
|
|
6346
|
-
intervalMs: number;
|
|
6347
|
-
};
|
|
6348
|
-
|
|
6349
|
-
function GridEntrySlider({ prefix: P, slides, isFade, direction, intervalMs }: GridEntrySliderProps) {
|
|
6350
|
-
const count = slides.length;
|
|
6351
|
-
const hasClones = !isFade && count > 1;
|
|
6352
|
-
const isRandom = !isFade && direction === 'random';
|
|
6353
|
-
const delayMs = Number.isFinite(intervalMs) && intervalMs > 0 ? intervalMs : SLIDER_DEFAULT_INTERVAL_MS;
|
|
6354
|
-
const [position, setPosition] = useState(hasClones ? 1 : 0);
|
|
6355
|
-
const [axis, setAxis] = useState<'ltr' | 'ttb'>(!isFade && direction === 'vertical' ? 'ttb' : 'ltr');
|
|
6356
|
-
const [isMoving, setIsMoving] = useState(false);
|
|
6357
|
-
const [skipTransition, setSkipTransition] = useState(false);
|
|
6358
|
-
const [cycle, setCycle] = useState(0);
|
|
6359
|
-
const isMovingRef = useRef(false);
|
|
6360
|
-
|
|
6361
|
-
useEffect(() => {
|
|
6362
|
-
if (count < 2) return;
|
|
6363
|
-
const timeoutId = window.setTimeout(() => {
|
|
6364
|
-
if (isMovingRef.current) {
|
|
6365
|
-
setCycle(prev => prev + 1);
|
|
6366
|
-
return;
|
|
6367
|
-
}
|
|
6368
|
-
isMovingRef.current = true;
|
|
6369
|
-
setIsMoving(true);
|
|
6370
|
-
setSkipTransition(false);
|
|
6371
|
-
setPosition(prev => (hasClones ? prev + 1 : wrapSlideIndex(prev + 1, count)));
|
|
6372
|
-
if (!isRandom) setCycle(prev => prev + 1);
|
|
6373
|
-
}, delayMs);
|
|
6374
|
-
return () => window.clearTimeout(timeoutId);
|
|
6375
|
-
}, [count, cycle, delayMs, hasClones, isRandom]);
|
|
6376
|
-
|
|
6377
|
-
useEffect(() => {
|
|
6378
|
-
if (!isMoving) return;
|
|
6379
|
-
const timeoutId = window.setTimeout(() => {
|
|
6380
|
-
const isOnClone = hasClones && position === count + 1;
|
|
6381
|
-
const nextAxis = isRandom ? pickRandomSlideDirection() : axis;
|
|
6382
|
-
if (isOnClone || nextAxis !== axis) {
|
|
6383
|
-
setSkipTransition(true);
|
|
6384
|
-
if (isOnClone) setPosition(1);
|
|
6385
|
-
setAxis(nextAxis);
|
|
6386
|
-
}
|
|
6387
|
-
isMovingRef.current = false;
|
|
6388
|
-
setIsMoving(false);
|
|
6389
|
-
if (isRandom) setCycle(prev => prev + 1);
|
|
6390
|
-
}, SLIDER_TRANSITION_MS);
|
|
6391
|
-
return () => window.clearTimeout(timeoutId);
|
|
6392
|
-
}, [axis, count, hasClones, isMoving, isRandom, position]);
|
|
6393
|
-
|
|
6394
|
-
useEffect(() => {
|
|
6395
|
-
if (!skipTransition) return;
|
|
6396
|
-
let innerId = 0;
|
|
6397
|
-
const outerId = requestAnimationFrame(() => {
|
|
6398
|
-
innerId = requestAnimationFrame(() => setSkipTransition(false));
|
|
6399
|
-
});
|
|
6400
|
-
return () => {
|
|
6401
|
-
cancelAnimationFrame(outerId);
|
|
6402
|
-
cancelAnimationFrame(innerId);
|
|
6403
|
-
};
|
|
6404
|
-
}, [skipTransition]);
|
|
6405
|
-
|
|
6406
|
-
const slotsCount = hasClones ? count + 2 : count;
|
|
6407
|
-
const getItemIndex = (slot: number) => (hasClones ? wrapSlideIndex(slot - 1, count) : slot);
|
|
6408
|
-
const isCloneSlot = (slot: number) => hasClones && (slot === 0 || slot === count + 1);
|
|
6409
|
-
const activeIndex = getItemIndex(position);
|
|
6410
|
-
const nextSlot = position + 1 < slotsCount ? position + 1 : -1;
|
|
6411
|
-
const isPlayingSlot = (slot: number) => isFade
|
|
6412
|
-
|| (slot === position && !isCloneSlot(slot))
|
|
6413
|
-
|| slot === nextSlot
|
|
6414
|
-
|| (nextSlot >= 0 && !isCloneSlot(slot) && getItemIndex(slot) === getItemIndex(nextSlot));
|
|
6415
|
-
const isVertical = !isFade && axis === 'ttb';
|
|
6416
|
-
const listStyle: React.CSSProperties | undefined = isFade
|
|
6417
|
-
? undefined
|
|
6418
|
-
: {
|
|
6419
|
-
transform: isVertical
|
|
6420
|
-
? \`translate3d(0, \${-position * 100}%, 0)\`
|
|
6421
|
-
: \`translate3d(\${-position * 100}%, 0, 0)\`,
|
|
6422
|
-
transition: skipTransition ? 'none' : \`transform \${SLIDER_TRANSITION_MS}ms \${SLIDER_EASING}\`,
|
|
6423
|
-
};
|
|
6424
|
-
|
|
6425
|
-
return (
|
|
6426
|
-
<div className={\`\${P}-item-slider\`}>
|
|
6427
|
-
<div
|
|
6428
|
-
className={\`\${P}-item-slider-list\${isFade ? \` \${P}-item-slider-list-fade\` : ''}\${isVertical ? \` \${P}-item-slider-list-vertical\` : ''}\`}
|
|
6429
|
-
style={listStyle}
|
|
6430
|
-
>
|
|
6431
|
-
{Array.from({ length: slotsCount }, (_, slot) => {
|
|
6432
|
-
const itemIndex = getItemIndex(slot);
|
|
6433
|
-
const isClone = isCloneSlot(slot);
|
|
6434
|
-
const isShown = isFade ? itemIndex === activeIndex : slot === position;
|
|
6435
|
-
return (
|
|
6436
|
-
<div
|
|
6437
|
-
key={isClone ? \`clone-\${slot === 0 ? 'start' : 'end'}\` : \`slide-\${itemIndex}\`}
|
|
6438
|
-
className={\`\${P}-item-slide \${GRID_SLIDE_CLASS}\${isFade && isShown ? \` \${P}-item-slide-active\` : ''}\${isPlayingSlot(slot) ? \` \${GRID_SLIDE_PLAYING_CLASS}\` : ''}\`}
|
|
6439
|
-
aria-hidden={isShown ? undefined : true}
|
|
6440
|
-
>
|
|
6441
|
-
{slides[itemIndex]}
|
|
6442
|
-
</div>
|
|
6443
|
-
);
|
|
6444
|
-
})}
|
|
6445
|
-
</div>
|
|
6446
|
-
</div>
|
|
6447
|
-
);
|
|
6366
|
+
if (video.closest('.splide--fade, .splide__slide.is-active:not(.splide__slide--clone), .splide__slide.is-next')) return true;
|
|
6367
|
+
const slide = video.closest<HTMLElement>('.splide__slide');
|
|
6368
|
+
if (!slide || slide.classList.contains('splide__slide--clone')) return false;
|
|
6369
|
+
const slideIndex = slide.dataset.slideIndex;
|
|
6370
|
+
const upcomingSlide = slide.parentElement?.querySelector<HTMLElement>('.splide__slide.is-next');
|
|
6371
|
+
return slideIndex !== undefined && upcomingSlide?.dataset.slideIndex === slideIndex;
|
|
6448
6372
|
}
|
|
6449
6373
|
|
|
6450
6374
|
function GridMediaItem({
|
|
@@ -6452,7 +6376,7 @@ function GridMediaItem({
|
|
|
6452
6376
|
className,
|
|
6453
6377
|
style,
|
|
6454
6378
|
hasLightbox,
|
|
6455
|
-
|
|
6379
|
+
isSplideSlide = false,
|
|
6456
6380
|
onMediaClick,
|
|
6457
6381
|
}: {
|
|
6458
6382
|
media: GridMedia;
|
|
@@ -6460,7 +6384,7 @@ function GridMediaItem({
|
|
|
6460
6384
|
style: React.CSSProperties;
|
|
6461
6385
|
/** An embed then plays here as a silent loop, and as it was set to in the lightbox. */
|
|
6462
6386
|
hasLightbox: boolean;
|
|
6463
|
-
|
|
6387
|
+
isSplideSlide?: boolean;
|
|
6464
6388
|
onMediaClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
6465
6389
|
}) {
|
|
6466
6390
|
if (isEmbedMedia(media)) {
|
|
@@ -6492,7 +6416,7 @@ function GridMediaItem({
|
|
|
6492
6416
|
playsInline: true,
|
|
6493
6417
|
onClick: onMediaClick,
|
|
6494
6418
|
};
|
|
6495
|
-
return
|
|
6419
|
+
return isSplideSlide
|
|
6496
6420
|
? <video {...videoProps} preload='none' />
|
|
6497
6421
|
: <LazyVideo {...videoProps} autoPlay />;
|
|
6498
6422
|
}
|
|
@@ -6521,7 +6445,7 @@ function GridItemMediaWrapper({
|
|
|
6521
6445
|
children: React.ReactNode;
|
|
6522
6446
|
}) {
|
|
6523
6447
|
const [wrapper, setWrapper] = useState<HTMLDivElement | null>(null);
|
|
6524
|
-
useLazyVideos(wrapper, { autoPlay: true, selector:
|
|
6448
|
+
useLazyVideos(wrapper, { autoPlay: true, selector: SPLIDE_SLIDE_VIDEOS, shouldPlay: shouldPlaySlideVideo });
|
|
6525
6449
|
|
|
6526
6450
|
return (
|
|
6527
6451
|
<div ref={setWrapper} className={className} style={style}>
|
|
@@ -7422,108 +7346,11 @@ function resolveLightboxImageDisplay(
|
|
|
7422
7346
|
return value?.display === 'cover' ? 'cover' : 'fit';
|
|
7423
7347
|
}
|
|
7424
7348
|
|
|
7425
|
-
function getCustomGridSpanWidth(layout: CustomGridLayout, span: number): number {
|
|
7426
|
-
return layout.columnWidth * span + layout.gutterWidth * Math.max(0, span - 1);
|
|
7427
|
-
}
|
|
7428
|
-
|
|
7429
|
-
type CustomGridSlot = {
|
|
7430
|
-
column: number;
|
|
7431
|
-
span: number;
|
|
7432
|
-
width: number;
|
|
7433
|
-
top: number;
|
|
7434
|
-
height: number;
|
|
7435
|
-
gridColumn: string;
|
|
7436
|
-
};
|
|
7437
|
-
|
|
7438
|
-
function getCustomGridBlocksBottom(layout: CustomGridLayout): number {
|
|
7439
|
-
return layout.blocks.reduce((bottom, block) => Math.max(bottom, Math.max(0, block.top) + Math.max(0, block.height)), 0);
|
|
7440
|
-
}
|
|
7441
|
-
|
|
7442
|
-
function getCustomGridVerticalGap(layout: CustomGridLayout): number {
|
|
7443
|
-
if (typeof layout.verticalGap === 'number') return Math.max(0, layout.verticalGap);
|
|
7444
|
-
return Math.max(0, (layout.repeatHeight ?? 0) - getCustomGridBlocksBottom(layout));
|
|
7445
|
-
}
|
|
7446
|
-
|
|
7447
|
-
function getCustomGridSlot(layout: CustomGridLayout, index: number): CustomGridSlot {
|
|
7448
|
-
const block = layout.blocks[index % layout.blocks.length];
|
|
7449
|
-
const span = Math.min(Math.max(1, Math.round(block.span)), layout.columnsCount);
|
|
7450
|
-
const column = Math.min(Math.max(0, Math.round(block.column)), layout.columnsCount - span);
|
|
7451
|
-
return {
|
|
7452
|
-
column,
|
|
7453
|
-
span,
|
|
7454
|
-
width: getCustomGridSpanWidth(layout, span),
|
|
7455
|
-
top: Math.max(0, block.top),
|
|
7456
|
-
height: Math.max(0, block.height),
|
|
7457
|
-
gridColumn: \`\${column + 1} / span \${span}\`,
|
|
7458
|
-
};
|
|
7459
|
-
}
|
|
7460
|
-
|
|
7461
|
-
const EDGE_TOLERANCE = 1e-6;
|
|
7462
|
-
|
|
7463
|
-
function getCustomGridRows(layout: CustomGridLayout, entriesCount: number, entryHeights?: number[]) {
|
|
7464
|
-
const beat = layout.beat ?? 0;
|
|
7465
|
-
const onBeats = beat > 0 && !!entryHeights;
|
|
7466
|
-
const snapUp = (value: number) => Math.ceil(value / beat - 1e-3) * beat;
|
|
7467
|
-
const tracks: (number | 'auto')[] = [];
|
|
7468
|
-
const gridRows: string[] = [];
|
|
7469
|
-
const verticalGap = getCustomGridVerticalGap(layout);
|
|
7470
|
-
for (let groupStart = 0; groupStart < entriesCount; groupStart += layout.blocks.length) {
|
|
7471
|
-
if (groupStart > 0 && verticalGap > 0) tracks.push(verticalGap);
|
|
7472
|
-
const slots = Array.from(
|
|
7473
|
-
{ length: Math.min(layout.blocks.length, entriesCount - groupStart) },
|
|
7474
|
-
(_, index) => getCustomGridSlot(layout, groupStart + index),
|
|
7475
|
-
);
|
|
7476
|
-
const ends = slots.map((slot) => {
|
|
7477
|
-
const under = slots.filter(other => other.column < slot.column + slot.span
|
|
7478
|
-
&& slot.column < other.column + other.span
|
|
7479
|
-
&& other.top >= slot.top + slot.height - EDGE_TOLERANCE);
|
|
7480
|
-
return under.length > 0 ? Math.min(...under.map(other => other.top)) : undefined;
|
|
7481
|
-
});
|
|
7482
|
-
const tops = [0, ...slots.map(slot => slot.top)]
|
|
7483
|
-
.sort((a, b) => a - b)
|
|
7484
|
-
.filter((top, index, sorted) => index === 0 || top - sorted[index - 1] > EDGE_TOLERANCE);
|
|
7485
|
-
const isSame = (a: number, b: number) => Math.abs(a - b) <= EDGE_TOLERANCE;
|
|
7486
|
-
const getTop = (value: number) => tops.findIndex(top => isSame(top, value));
|
|
7487
|
-
const positions: number[] = [];
|
|
7488
|
-
let position = 0;
|
|
7489
|
-
const pushContentTrack = (isEnding: (end: number | undefined) => boolean) => {
|
|
7490
|
-
const ending = slots.flatMap((slot, index) => (isEnding(ends[index]) ? [{ slot, entry: groupStart + index }] : []));
|
|
7491
|
-
if (ending.length === 0) return;
|
|
7492
|
-
if (!onBeats) {
|
|
7493
|
-
tracks.push('auto');
|
|
7494
|
-
return;
|
|
7495
|
-
}
|
|
7496
|
-
const needed = Math.max(...ending.map(({ slot, entry }) => positions[getTop(slot.top)] + (entryHeights[entry] ?? 0)));
|
|
7497
|
-
const track = Math.max(0, snapUp(needed) - position);
|
|
7498
|
-
tracks.push(track);
|
|
7499
|
-
position += track;
|
|
7500
|
-
};
|
|
7501
|
-
const lines = tops.map((top, index) => {
|
|
7502
|
-
if (index > 0) {
|
|
7503
|
-
tracks.push(top - tops[index - 1]);
|
|
7504
|
-
position += top - tops[index - 1];
|
|
7505
|
-
}
|
|
7506
|
-
pushContentTrack(end => end !== undefined && isSame(end, top));
|
|
7507
|
-
positions.push(position);
|
|
7508
|
-
return tracks.length + 1;
|
|
7509
|
-
});
|
|
7510
|
-
pushContentTrack(end => end === undefined);
|
|
7511
|
-
const groupEnd = tracks.length + 1;
|
|
7512
|
-
const getLine = (value: number) => lines[getTop(value)];
|
|
7513
|
-
slots.forEach((slot, index) => {
|
|
7514
|
-
const end = ends[index];
|
|
7515
|
-
gridRows.push(\`\${getLine(slot.top)} / \${end === undefined ? groupEnd : getLine(end)}\`);
|
|
7516
|
-
});
|
|
7517
|
-
}
|
|
7518
|
-
return { tracks, gridRows };
|
|
7519
|
-
}
|
|
7520
|
-
|
|
7521
7349
|
export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, metadata, activeEvent, layoutId, portalId }: GridProps) {
|
|
7522
7350
|
const { prefix: P } = useScopedStyles();
|
|
7523
7351
|
const {
|
|
7524
7352
|
type = 'a',
|
|
7525
7353
|
gridLayout,
|
|
7526
|
-
customGrid,
|
|
7527
7354
|
textBoxWidth = 100,
|
|
7528
7355
|
verticalGap,
|
|
7529
7356
|
entriesCount,
|
|
@@ -7571,69 +7398,62 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7571
7398
|
hover = 'none',
|
|
7572
7399
|
alignEntries = 'off',
|
|
7573
7400
|
align = 'top',
|
|
7574
|
-
textGrowth = 'inside',
|
|
7575
7401
|
} = settings;
|
|
7576
7402
|
|
|
7577
|
-
const
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
titleWordSpacing, titleTextAppearance, titleColor, isEditor, P,
|
|
7595
|
-
]);
|
|
7403
|
+
const resolvedTitleTextStyle: TextStyles = {
|
|
7404
|
+
fontSettings: {
|
|
7405
|
+
fontFamily: titleFontFamily,
|
|
7406
|
+
fontWeight: titleFontSettings?.fontWeight ?? 400,
|
|
7407
|
+
fontStyle: titleFontSettings?.fontStyle ?? 'normal',
|
|
7408
|
+
},
|
|
7409
|
+
fontSize: titleFontSize ?? 0.01,
|
|
7410
|
+
lineHeight: titleLineHeight,
|
|
7411
|
+
letterSpacing: titleLetterSpacing ?? 0,
|
|
7412
|
+
wordSpacing: titleWordSpacing ?? 0,
|
|
7413
|
+
textAppearance: titleTextAppearance,
|
|
7414
|
+
color: titleColor,
|
|
7415
|
+
};
|
|
7416
|
+
const titleTypographyCss = omitTextColors(textStylesToCss(resolvedTitleTextStyle, isEditor));
|
|
7417
|
+
const titleFieldCss = {
|
|
7418
|
+
...titleTypographyCss,
|
|
7419
|
+
} as React.CSSProperties;
|
|
7596
7420
|
|
|
7597
|
-
const
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
subtitleWordSpacing, subtitleTextAppearance, subtitleColor, isEditor, P,
|
|
7615
|
-
]);
|
|
7421
|
+
const resolvedSubtitleTextStyle: TextStyles = {
|
|
7422
|
+
fontSettings: {
|
|
7423
|
+
fontFamily: subtitleFontFamily,
|
|
7424
|
+
fontWeight: subtitleFontSettings?.fontWeight ?? 400,
|
|
7425
|
+
fontStyle: subtitleFontSettings?.fontStyle ?? 'normal',
|
|
7426
|
+
},
|
|
7427
|
+
fontSize: subtitleFontSize ?? 0.01,
|
|
7428
|
+
lineHeight: subtitleLineHeight,
|
|
7429
|
+
letterSpacing: subtitleLetterSpacing ?? 0,
|
|
7430
|
+
wordSpacing: subtitleWordSpacing ?? 0,
|
|
7431
|
+
textAppearance: subtitleTextAppearance,
|
|
7432
|
+
color: subtitleColor,
|
|
7433
|
+
};
|
|
7434
|
+
const subtitleTypographyCss = omitTextColors(textStylesToCss(resolvedSubtitleTextStyle, isEditor));
|
|
7435
|
+
const subtitleFieldCss = {
|
|
7436
|
+
...subtitleTypographyCss,
|
|
7437
|
+
} as React.CSSProperties;
|
|
7616
7438
|
|
|
7617
|
-
const
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7439
|
+
const resolvedLightboxCounterTextStyle: TextStyles = {
|
|
7440
|
+
fontSettings: {
|
|
7441
|
+
fontFamily: lightboxCounterFontFamily,
|
|
7442
|
+
fontWeight: lightboxCounterFontSettings?.fontWeight ?? 400,
|
|
7443
|
+
fontStyle: lightboxCounterFontSettings?.fontStyle ?? 'normal',
|
|
7444
|
+
},
|
|
7445
|
+
fontSize: lightboxCounterFontSize ?? 0.01,
|
|
7446
|
+
lineHeight: lightboxCounterLineHeight,
|
|
7447
|
+
letterSpacing: lightboxCounterLetterSpacing ?? 0,
|
|
7448
|
+
wordSpacing: lightboxCounterWordSpacing ?? 0,
|
|
7449
|
+
textAppearance: lightboxCounterTextAppearance,
|
|
7450
|
+
color: lightboxCounterColor,
|
|
7451
|
+
};
|
|
7452
|
+
const lightboxCounterTypographyCss = omitTextColors(textStylesToCss(resolvedLightboxCounterTextStyle, isEditor));
|
|
7453
|
+
const lightboxCounterFieldCss = {
|
|
7454
|
+
...lightboxCounterTypographyCss,
|
|
7631
7455
|
...getGridTextLeadingVars(lightboxCounterFontSize, lightboxCounterLineHeight, P, isEditor),
|
|
7632
|
-
} as React.CSSProperties
|
|
7633
|
-
lightboxCounterFontFamily, lightboxCounterFontSettings, lightboxCounterFontSize, lightboxCounterLineHeight,
|
|
7634
|
-
lightboxCounterLetterSpacing, lightboxCounterWordSpacing, lightboxCounterTextAppearance, lightboxCounterColor,
|
|
7635
|
-
isEditor, P,
|
|
7636
|
-
]);
|
|
7456
|
+
} as React.CSSProperties;
|
|
7637
7457
|
|
|
7638
7458
|
const titleTextClassName = getGridTextClassName(
|
|
7639
7459
|
titleFontSize,
|
|
@@ -7647,6 +7467,8 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7647
7467
|
\`\${P}-item-subtitle\`,
|
|
7648
7468
|
\`\${P}-text-tight-leading\`,
|
|
7649
7469
|
);
|
|
7470
|
+
const titleTextLeadingVars = getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor);
|
|
7471
|
+
const subtitleTextLeadingVars = getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor);
|
|
7650
7472
|
const lightboxCounterClassName = getGridTextClassName(
|
|
7651
7473
|
lightboxCounterFontSize,
|
|
7652
7474
|
lightboxCounterLineHeight,
|
|
@@ -7654,56 +7476,42 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7654
7476
|
\`\${P}-text-tight-leading\`,
|
|
7655
7477
|
);
|
|
7656
7478
|
|
|
7657
|
-
const colorVars =
|
|
7479
|
+
const colorVars = buildColorVars(P, {
|
|
7658
7480
|
titleColor,
|
|
7659
7481
|
subtitleColor,
|
|
7660
7482
|
lightboxCounterColor,
|
|
7661
|
-
}, COLOR_VAR_MAP, STATE_KEYS)
|
|
7483
|
+
}, COLOR_VAR_MAP, STATE_KEYS);
|
|
7662
7484
|
|
|
7663
7485
|
const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
|
|
7664
7486
|
const showTextOnHover = showText === 'on hover' && (!isEditor || isPreviewMode);
|
|
7665
7487
|
const hoverEffectClass = hover !== 'none' && (!isEditor || isPreviewMode) ? \` \${P}-hover-\${hover}\` : '';
|
|
7666
7488
|
const wrapperStateClasses = \`\${stateClass}\${showTextOnHover ? \` \${P}-show-text-hover\` : ''}\${hoverEffectClass}\`.trim();
|
|
7667
7489
|
|
|
7668
|
-
const
|
|
7669
|
-
const resEntriesCount = customLayout || entriesCount === 0 ? Infinity : entriesCount;
|
|
7670
|
-
const isTextOutside = !!customLayout && textGrowth === 'outside';
|
|
7671
|
-
const itemInnerRefs = useRef<(HTMLDivElement | null)[]>([]);
|
|
7672
|
-
const [customEntryHeights, setCustomEntryHeights] = useState<number[]>([]);
|
|
7490
|
+
const resEntriesCount = entriesCount === 0 ? Infinity : entriesCount;
|
|
7673
7491
|
|
|
7674
|
-
const cropContent =
|
|
7492
|
+
const cropContent = (content ?? []).slice(0, resEntriesCount);
|
|
7675
7493
|
const lightboxMediaToPreload = useMemo(
|
|
7676
7494
|
() => (lightbox === 'on' ? collectGridLightboxMedia(cropContent) : []),
|
|
7677
7495
|
[cropContent, lightbox],
|
|
7678
7496
|
);
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
? lightboxItemsForEntry.findIndex(media => media.assetId === lightboxMedia.assetId)
|
|
7686
|
-
: -1));
|
|
7687
|
-
return { displayItems, lightboxItemsForEntry, lightboxIndexes };
|
|
7688
|
-
}), [cropContent]);
|
|
7689
|
-
|
|
7690
|
-
const size = gridLayout?.entryWidth ?? 0.2;
|
|
7691
|
-
|
|
7692
|
-
const imageDisplaySettings = typeof imageDisplay === 'string' ? { display: imageDisplay } : imageDisplay;
|
|
7693
|
-
const isCover = imageDisplaySettings?.display === 'cover';
|
|
7694
|
-
const ratioValue = imageDisplaySettings?.ratioValue ?? '1:1';
|
|
7695
|
-
const ratioReversed = imageDisplaySettings?.reversed ?? false;
|
|
7497
|
+
|
|
7498
|
+
const size = gridLayout.entryWidth ?? 0.2;
|
|
7499
|
+
|
|
7500
|
+
const isCover = imageDisplay?.display === 'cover';
|
|
7501
|
+
const ratioValue = imageDisplay?.ratioValue ?? '1:1';
|
|
7502
|
+
const ratioReversed = imageDisplay?.reversed ?? false;
|
|
7696
7503
|
const [rW, rH] = ratioValue.split(':').map(Number);
|
|
7697
7504
|
const effW = ratioReversed ? rH : rW;
|
|
7698
7505
|
const effH = ratioReversed ? rW : rH;
|
|
7699
7506
|
const aspectRatio = \`\${effW} / \${effH}\`;
|
|
7700
7507
|
|
|
7701
|
-
const columnsCount = gridLayout
|
|
7508
|
+
const columnsCount = gridLayout.columnsCount;
|
|
7702
7509
|
const entryWidthScaled = scalingValue(size ?? 0, isEditor);
|
|
7703
|
-
const
|
|
7510
|
+
const imageWrapperWidth = entryWidthScaled;
|
|
7511
|
+
const isFitSlider = !isCover && slider !== 'off';
|
|
7704
7512
|
|
|
7705
7513
|
const itemsInLastRow = cropContent.length % columnsCount || columnsCount;
|
|
7706
|
-
const isPartialLastRow =
|
|
7514
|
+
const isPartialLastRow = itemsInLastRow < columnsCount && cropContent.length > 0;
|
|
7707
7515
|
const lastRowStartIndex = cropContent.length - itemsInLastRow;
|
|
7708
7516
|
const lastRowStartColumn = isPartialLastRow
|
|
7709
7517
|
? Math.floor((columnsCount - itemsInLastRow) / 2) + 1
|
|
@@ -7711,21 +7519,19 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7711
7519
|
|
|
7712
7520
|
const imageBorderRadius = imageCorners ? scalingValue(imageCorners, isEditor) : undefined;
|
|
7713
7521
|
|
|
7714
|
-
const
|
|
7715
|
-
width:
|
|
7716
|
-
...(
|
|
7717
|
-
?
|
|
7718
|
-
|
|
7719
|
-
: { flex: '1 1 0%', minHeight: 0, overflow: 'hidden' }
|
|
7720
|
-
: isCover
|
|
7721
|
-
? { aspectRatio, height: 'auto', overflow: 'hidden' }
|
|
7722
|
-
: { height: 'auto' }),
|
|
7522
|
+
const imageWrapperStyle: React.CSSProperties = {
|
|
7523
|
+
width: imageWrapperWidth,
|
|
7524
|
+
...(isCover
|
|
7525
|
+
? { aspectRatio, height: 'auto', overflow: 'hidden' }
|
|
7526
|
+
: { height: 'auto' }),
|
|
7723
7527
|
...(imageBorderRadius ? { borderRadius: imageBorderRadius, overflow: 'hidden' } : {}),
|
|
7724
|
-
}
|
|
7528
|
+
};
|
|
7725
7529
|
|
|
7726
7530
|
const imageWrapperClassName = \`\${P}-item-image-wrapper\${isFitSlider ? \` \${P}-item-image-wrapper-fit-slider\` : ''}\`.trim();
|
|
7727
7531
|
const isTextBeforeImage = type === 'd' || type === 'e' || type === 'f';
|
|
7728
|
-
const shouldAlignEntries =
|
|
7532
|
+
const shouldAlignEntries = alignEntries === 'on';
|
|
7533
|
+
const textBoxWidthStyle = \`calc(\${scalingValue(size ?? 0, isEditor)} * (\${textBoxWidth} / 100))\`;
|
|
7534
|
+
const controlWidthStyle = scalingValue(size * textBoxWidth / 100, isEditor);
|
|
7729
7535
|
|
|
7730
7536
|
const imageRadiusStyle = imageBorderRadius
|
|
7731
7537
|
? { borderRadius: imageBorderRadius, [MEDIA_RADIUS_VAR]: imageBorderRadius } as React.CSSProperties
|
|
@@ -7745,73 +7551,31 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7745
7551
|
width: 'auto',
|
|
7746
7552
|
height: 'auto',
|
|
7747
7553
|
maxWidth: '100%',
|
|
7748
|
-
...(customLayout ? { maxHeight: '100%' } : {}),
|
|
7749
7554
|
...imageRadiusStyle,
|
|
7750
7555
|
};
|
|
7751
7556
|
|
|
7752
|
-
const
|
|
7753
|
-
const customGridWidth = customLayout ? getCustomGridSpanWidth(customLayout, customLayout.columnsCount) : 0;
|
|
7754
|
-
useLayoutEffect(() => {
|
|
7755
|
-
if (!shouldMeasureEntries) {
|
|
7756
|
-
setCustomEntryHeights(prev => (prev.length > 0 ? [] : prev));
|
|
7757
|
-
return;
|
|
7758
|
-
}
|
|
7759
|
-
const wrapper = containerRef.current;
|
|
7760
|
-
const inners = itemInnerRefs.current.slice(0, cropContent.length);
|
|
7761
|
-
const measure = () => {
|
|
7762
|
-
const unit = wrapper && customGridWidth > 0 ? wrapper.offsetWidth / customGridWidth : 0;
|
|
7763
|
-
if (unit <= 0) return;
|
|
7764
|
-
const heights = inners.map(inner => (inner ? inner.offsetHeight / unit : 0));
|
|
7765
|
-
setCustomEntryHeights(prev => (
|
|
7766
|
-
prev.length === heights.length && prev.every((height, index) => Math.abs(height - heights[index]) < 1e-5)
|
|
7767
|
-
? prev
|
|
7768
|
-
: heights
|
|
7769
|
-
));
|
|
7770
|
-
};
|
|
7771
|
-
measure();
|
|
7772
|
-
const ro = new ResizeObserver(measure);
|
|
7773
|
-
if (wrapper) ro.observe(wrapper);
|
|
7774
|
-
inners.forEach(inner => inner && ro.observe(inner));
|
|
7775
|
-
return () => ro.disconnect();
|
|
7776
|
-
}, [shouldMeasureEntries, cropContent.length, customGridWidth, P]);
|
|
7777
|
-
const measuredEntryHeights = shouldMeasureEntries && customEntryHeights.length === cropContent.length
|
|
7778
|
-
? customEntryHeights
|
|
7779
|
-
: undefined;
|
|
7780
|
-
const customRows = useMemo(() => {
|
|
7781
|
-
if (!customLayout) return undefined;
|
|
7782
|
-
const rows = getCustomGridRows(customLayout, cropContent.length, measuredEntryHeights);
|
|
7783
|
-
return {
|
|
7784
|
-
gridRows: rows.gridRows,
|
|
7785
|
-
gridTemplateRows: rows.tracks.length
|
|
7786
|
-
? rows.tracks.map(track => (track === 'auto' ? 'auto' : scalingValue(track, isEditor))).join(' ')
|
|
7787
|
-
: 'auto',
|
|
7788
|
-
};
|
|
7789
|
-
}, [customLayout, cropContent.length, measuredEntryHeights, isEditor]);
|
|
7790
|
-
const customSlots = useMemo(
|
|
7791
|
-
() => (customLayout ? cropContent.map((_, index) => getCustomGridSlot(customLayout, index)) : undefined),
|
|
7792
|
-
[customLayout, cropContent.length],
|
|
7793
|
-
);
|
|
7794
|
-
const wrapperLayoutStyle: React.CSSProperties = customLayout
|
|
7795
|
-
? {
|
|
7796
|
-
gridTemplateColumns: \`repeat(\${customLayout.columnsCount}, \${scalingValue(customLayout.columnWidth, isEditor)})\`,
|
|
7797
|
-
gridTemplateRows: customRows?.gridTemplateRows ?? 'auto',
|
|
7798
|
-
rowGap: 0,
|
|
7799
|
-
columnGap: scalingValue(customLayout.gutterWidth, isEditor),
|
|
7800
|
-
width: scalingValue(getCustomGridSpanWidth(customLayout, customLayout.columnsCount), isEditor),
|
|
7801
|
-
}
|
|
7802
|
-
: {
|
|
7803
|
-
gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
|
|
7804
|
-
rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
|
|
7805
|
-
columnGap: scalingValue(gridLayout?.horizontalGap ?? 0, isEditor),
|
|
7806
|
-
width: scalingValue(gridLayout?.wrapperWidth ?? 0, isEditor),
|
|
7807
|
-
...(shouldAlignEntries
|
|
7808
|
-
? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
|
|
7809
|
-
: {}),
|
|
7810
|
-
};
|
|
7811
|
-
|
|
7557
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
7812
7558
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
7813
7559
|
|
|
7814
|
-
const
|
|
7560
|
+
const resolvedSplideDirection = transition === 'fade'
|
|
7561
|
+
? 'ltr'
|
|
7562
|
+
: direction === 'horizontal'
|
|
7563
|
+
? 'ltr'
|
|
7564
|
+
: direction === 'vertical'
|
|
7565
|
+
? 'ttb'
|
|
7566
|
+
: 'ltr';
|
|
7567
|
+
|
|
7568
|
+
useEffect(() => {
|
|
7569
|
+
const el = containerRef.current;
|
|
7570
|
+
if (!el) return;
|
|
7571
|
+
const ro = new ResizeObserver((entries) => {
|
|
7572
|
+
setContainerWidth(Math.round(entries[0].contentRect.width));
|
|
7573
|
+
});
|
|
7574
|
+
ro.observe(el);
|
|
7575
|
+
return () => ro.disconnect();
|
|
7576
|
+
}, []);
|
|
7577
|
+
|
|
7578
|
+
const lightboxPortalStyle = (() => {
|
|
7815
7579
|
const style: Record<string, string> = { ...(colorVars as Record<string, string>) };
|
|
7816
7580
|
const articleWidth = containerRef.current
|
|
7817
7581
|
? getComputedStyle(containerRef.current).getPropertyValue('--cntrl-article-width').trim()
|
|
@@ -7820,7 +7584,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7820
7584
|
style['--cntrl-article-width'] = articleWidth;
|
|
7821
7585
|
}
|
|
7822
7586
|
return style as React.CSSProperties;
|
|
7823
|
-
};
|
|
7587
|
+
})();
|
|
7824
7588
|
|
|
7825
7589
|
const [lightboxOpen, setLightboxOpen] = useState(false);
|
|
7826
7590
|
const [lightboxItems, setLightboxItems] = useState<GridMedia[]>([]);
|
|
@@ -7859,8 +7623,16 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7859
7623
|
<div style={colorVars}>
|
|
7860
7624
|
<div
|
|
7861
7625
|
ref={containerRef}
|
|
7862
|
-
className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''}
|
|
7863
|
-
style={
|
|
7626
|
+
className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''} \${P}-image-align-\${align} \${wrapperStateClasses}\`.trim()}
|
|
7627
|
+
style={{
|
|
7628
|
+
gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
|
|
7629
|
+
rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
|
|
7630
|
+
columnGap: scalingValue(gridLayout.horizontalGap ?? 0, isEditor),
|
|
7631
|
+
width: scalingValue(gridLayout.wrapperWidth ?? 0, isEditor),
|
|
7632
|
+
...(shouldAlignEntries
|
|
7633
|
+
? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
|
|
7634
|
+
: {}),
|
|
7635
|
+
}}>
|
|
7864
7636
|
{cropContent.map((item: any, index: number) => {
|
|
7865
7637
|
const hasTitle = hasText(item.title);
|
|
7866
7638
|
const hasSubtitle = hasText(item.subtitle);
|
|
@@ -7870,24 +7642,11 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7870
7642
|
const gridColumn = isPartialLastRow && index >= lastRowStartIndex
|
|
7871
7643
|
? \`\${lastRowStartColumn + (index - lastRowStartIndex)}\`
|
|
7872
7644
|
: undefined;
|
|
7873
|
-
const customSlot = customSlots?.[index];
|
|
7874
|
-
const itemSize = customSlot?.width ?? size;
|
|
7875
|
-
const itemWidthScaled = scalingValue(itemSize, isEditor);
|
|
7876
|
-
const textBoxWidthStyle = \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`;
|
|
7877
|
-
const controlWidthStyle = scalingValue(itemSize * textBoxWidth / 100, isEditor);
|
|
7878
|
-
const imageWrapperStyle = getImageWrapperStyle(itemWidthScaled, customSlot);
|
|
7879
|
-
const itemStyle: React.CSSProperties | undefined = customSlot
|
|
7880
|
-
? {
|
|
7881
|
-
gridColumn: customSlot.gridColumn,
|
|
7882
|
-
gridRow: customRows?.gridRows[index],
|
|
7883
|
-
alignSelf: 'start',
|
|
7884
|
-
}
|
|
7885
|
-
: gridColumn && !shouldAlignEntries ? { gridColumn } : undefined;
|
|
7886
7645
|
|
|
7887
7646
|
const typeCTextBlock = isTextBeforeImage ? (
|
|
7888
7647
|
<div className={\`\${P}-item-text-block\`}>
|
|
7889
7648
|
{hasTitle && (
|
|
7890
|
-
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7649
|
+
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}>
|
|
7891
7650
|
{item.title}
|
|
7892
7651
|
</p>
|
|
7893
7652
|
)}
|
|
@@ -7902,7 +7661,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7902
7661
|
/>
|
|
7903
7662
|
)}
|
|
7904
7663
|
{hasSubtitle && (
|
|
7905
|
-
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7664
|
+
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}>
|
|
7906
7665
|
{item.subtitle}
|
|
7907
7666
|
</p>
|
|
7908
7667
|
)}
|
|
@@ -7932,7 +7691,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7932
7691
|
/>
|
|
7933
7692
|
)}
|
|
7934
7693
|
{hasTitle && (
|
|
7935
|
-
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7694
|
+
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}>
|
|
7936
7695
|
{item.title}
|
|
7937
7696
|
</p>
|
|
7938
7697
|
)}
|
|
@@ -7962,7 +7721,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7962
7721
|
/>
|
|
7963
7722
|
)}
|
|
7964
7723
|
{hasSubtitle && (
|
|
7965
|
-
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7724
|
+
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}>
|
|
7966
7725
|
{item.subtitle}
|
|
7967
7726
|
</p>
|
|
7968
7727
|
)}
|
|
@@ -7986,7 +7745,10 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7986
7745
|
</LinkWrapper>
|
|
7987
7746
|
);
|
|
7988
7747
|
|
|
7989
|
-
const
|
|
7748
|
+
const displayItems = getGridDisplayItems(item.gallery);
|
|
7749
|
+
const lightboxItemsForEntry = displayItems
|
|
7750
|
+
.filter(entry => entry.lightboxMedia)
|
|
7751
|
+
.map(entry => entry.lightboxMedia!);
|
|
7990
7752
|
|
|
7991
7753
|
const imageContent = (
|
|
7992
7754
|
<GridItemMediaWrapper className={imageWrapperClassName} style={imageWrapperStyle}>
|
|
@@ -7995,8 +7757,10 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7995
7757
|
: slider === 'off'
|
|
7996
7758
|
?
|
|
7997
7759
|
(() => {
|
|
7998
|
-
const { displayMedia } = displayItems[0];
|
|
7999
|
-
const lightboxIndex =
|
|
7760
|
+
const { displayMedia, lightboxMedia } = displayItems[0];
|
|
7761
|
+
const lightboxIndex = lightboxMedia
|
|
7762
|
+
? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
|
|
7763
|
+
: -1;
|
|
8000
7764
|
return (
|
|
8001
7765
|
<GridMediaItem
|
|
8002
7766
|
media={displayMedia}
|
|
@@ -8024,28 +7788,50 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8024
7788
|
))}
|
|
8025
7789
|
</div>
|
|
8026
7790
|
)}
|
|
8027
|
-
<
|
|
8028
|
-
key={\`\${transition}-\${
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
7791
|
+
<Splide
|
|
7792
|
+
key={\`\${transition}-\${size}-\${direction}-\${sliderTiming}-\${containerWidth}-\${layoutId}\`}
|
|
7793
|
+
className={\`\${P}-item-slider\`}
|
|
7794
|
+
options={{
|
|
7795
|
+
arrows: false,
|
|
7796
|
+
pagination: false,
|
|
7797
|
+
drag: false,
|
|
7798
|
+
perPage: 1,
|
|
7799
|
+
autoplay: true,
|
|
7800
|
+
interval: sliderTiming * 1000,
|
|
7801
|
+
width: '100%',
|
|
7802
|
+
height: '100%',
|
|
7803
|
+
speed: SLIDER_TRANSITION_MS,
|
|
7804
|
+
type: transition === 'fade' ? 'fade' : 'loop',
|
|
7805
|
+
rewind: transition === 'fade',
|
|
7806
|
+
pauseOnHover: false,
|
|
7807
|
+
pauseOnFocus: false,
|
|
7808
|
+
direction: resolvedSplideDirection,
|
|
7809
|
+
}}
|
|
7810
|
+
onMoved={(splide) => {
|
|
7811
|
+
if (direction !== 'random' || transition === 'fade') return;
|
|
7812
|
+
handleRandomSlideMoved(splide);
|
|
7813
|
+
}}
|
|
7814
|
+
>
|
|
7815
|
+
{displayItems.map(({ displayMedia, lightboxMedia }, imgIndex) => {
|
|
7816
|
+
const lightboxIndex = lightboxMedia
|
|
7817
|
+
? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
|
|
7818
|
+
: -1;
|
|
8035
7819
|
return (
|
|
8036
|
-
<
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
7820
|
+
<SplideSlide key={imgIndex} data-slide-index={imgIndex}>
|
|
7821
|
+
<GridMediaItem
|
|
7822
|
+
media={displayMedia}
|
|
7823
|
+
className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
|
|
7824
|
+
style={imageStyle}
|
|
7825
|
+
hasLightbox={lightbox === 'on'}
|
|
7826
|
+
isSplideSlide
|
|
7827
|
+
onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
|
|
7828
|
+
? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
|
|
7829
|
+
: undefined}
|
|
7830
|
+
/>
|
|
7831
|
+
</SplideSlide>
|
|
8046
7832
|
);
|
|
8047
7833
|
})}
|
|
8048
|
-
|
|
7834
|
+
</Splide>
|
|
8049
7835
|
</>
|
|
8050
7836
|
}
|
|
8051
7837
|
</GridItemMediaWrapper>
|
|
@@ -8063,7 +7849,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8063
7849
|
/>
|
|
8064
7850
|
<p
|
|
8065
7851
|
className={titleTextClassName}
|
|
8066
|
-
style={{ width: textBoxWidthStyle, ...
|
|
7852
|
+
style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}
|
|
8067
7853
|
>
|
|
8068
7854
|
{item.title}
|
|
8069
7855
|
</p>
|
|
@@ -8077,7 +7863,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8077
7863
|
/>
|
|
8078
7864
|
<p
|
|
8079
7865
|
className={subtitleTextClassName}
|
|
8080
|
-
style={{ width: textBoxWidthStyle, ...
|
|
7866
|
+
style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}
|
|
8081
7867
|
>
|
|
8082
7868
|
{item.subtitle}
|
|
8083
7869
|
</p>
|
|
@@ -8097,18 +7883,16 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8097
7883
|
<div
|
|
8098
7884
|
key={index}
|
|
8099
7885
|
className={\`\${P}-item\`.trim()}
|
|
8100
|
-
style={
|
|
7886
|
+
style={gridColumn && !shouldAlignEntries ? { gridColumn } : undefined}
|
|
8101
7887
|
>
|
|
8102
7888
|
<div
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
? \`\${P}-item-inner\`
|
|
7889
|
+
className={\`\${isEditMode
|
|
7890
|
+
? \`\${P}-item-inner\`
|
|
8106
7891
|
: \`\${P}-item-inner-hidden\`}\${shouldAlignEntries && isLastRow ? \` \${P}-item-inner-last-row\` : ''}\`.trim()}
|
|
8107
7892
|
style={{
|
|
8108
7893
|
width: (textBoxWidth ?? 0) > 100
|
|
8109
|
-
? \`calc(\${
|
|
8110
|
-
:
|
|
8111
|
-
...(customSlot && !isTextOutside ? { height: scalingValue(customSlot.height, isEditor) } : {}),
|
|
7894
|
+
? \`calc(\${entryWidthScaled} * (\${textBoxWidth} / 100))\`
|
|
7895
|
+
: entryWidthScaled,
|
|
8112
7896
|
...(gridColumn && shouldAlignEntries ? { gridColumn } : {}),
|
|
8113
7897
|
}}
|
|
8114
7898
|
>
|
|
@@ -8154,7 +7938,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8154
7938
|
{(!isEditor || isPreviewMode) && lightboxOpen && typeof document !== 'undefined' && lightbox === 'on' && (() => {
|
|
8155
7939
|
const portalTarget = (portalId ? document.getElementById(portalId) : null) ?? document.body;
|
|
8156
7940
|
return createPortal(
|
|
8157
|
-
<div style={
|
|
7941
|
+
<div style={lightboxPortalStyle} data-selection="none">
|
|
8158
7942
|
<Lightbox
|
|
8159
7943
|
prefix={P}
|
|
8160
7944
|
items={lightboxItems}
|
|
@@ -8191,36 +7975,17 @@ type GridLayoutConfig = {
|
|
|
8191
7975
|
lockedParam?: 'wrapperWidth' | 'entryWidth' | 'horizontalGap' | null;
|
|
8192
7976
|
};
|
|
8193
7977
|
|
|
8194
|
-
type CustomGridBlock = {
|
|
8195
|
-
column: number;
|
|
8196
|
-
span: number;
|
|
8197
|
-
top: number;
|
|
8198
|
-
height: number;
|
|
8199
|
-
};
|
|
8200
|
-
|
|
8201
|
-
type CustomGridLayout = {
|
|
8202
|
-
columnsCount: number;
|
|
8203
|
-
columnWidth: number;
|
|
8204
|
-
gutterWidth: number;
|
|
8205
|
-
maxWidth: number | null;
|
|
8206
|
-
verticalGap?: number;
|
|
8207
|
-
beat?: number;
|
|
8208
|
-
repeatHeight?: number;
|
|
8209
|
-
blocks: CustomGridBlock[];
|
|
8210
|
-
};
|
|
8211
|
-
|
|
8212
7978
|
type GridSettings = {
|
|
8213
7979
|
type: 'a' | 'b' | 'c' | 'd' | 'e' | 'f';
|
|
8214
|
-
gridLayout
|
|
8215
|
-
customGrid?: CustomGridLayout;
|
|
7980
|
+
gridLayout: GridLayoutConfig;
|
|
8216
7981
|
textBoxWidth: number;
|
|
8217
|
-
verticalGap
|
|
8218
|
-
entriesCount
|
|
7982
|
+
verticalGap: number;
|
|
7983
|
+
entriesCount: number;
|
|
8219
7984
|
lightbox: 'on' | 'off';
|
|
8220
|
-
imageDisplay:
|
|
7985
|
+
imageDisplay: {
|
|
8221
7986
|
display: 'fit' | 'cover';
|
|
8222
|
-
ratioValue
|
|
8223
|
-
reversed
|
|
7987
|
+
ratioValue: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
|
|
7988
|
+
reversed: boolean;
|
|
8224
7989
|
};
|
|
8225
7990
|
imageCorners?: number;
|
|
8226
7991
|
lightboxImageDisplay?: 'fit' | 'cover' | { display?: 'fit' | 'cover' };
|
|
@@ -8230,9 +7995,8 @@ type GridSettings = {
|
|
|
8230
7995
|
transition: 'fade' | 'slide',
|
|
8231
7996
|
showText: 'always' | 'on hover';
|
|
8232
7997
|
hover?: 'none' | 'zoom-in' | 'greyscale' | 'scale-down';
|
|
8233
|
-
alignEntries
|
|
7998
|
+
alignEntries: 'on' | 'off';
|
|
8234
7999
|
align?: 'top' | 'center' | 'bottom';
|
|
8235
|
-
textGrowth?: 'inside' | 'outside';
|
|
8236
8000
|
titleMarginTop: number;
|
|
8237
8001
|
subtitleMarginTop: number;
|
|
8238
8002
|
titleColor: string;
|
|
@@ -8279,7 +8043,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
8279
8043
|
};
|
|
8280
8044
|
|
|
8281
8045
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
8282
|
-
`,
|
|
8046
|
+
`, T = `import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
|
|
8283
8047
|
import { CommonComponentProps } from '../props';
|
|
8284
8048
|
import { scalingValue } from '../utils/scalingValue';
|
|
8285
8049
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -8852,7 +8616,7 @@ export function Helix({
|
|
|
8852
8616
|
</>
|
|
8853
8617
|
);
|
|
8854
8618
|
}
|
|
8855
|
-
`,
|
|
8619
|
+
`, R = `import { CommonComponentProps } from '../props';
|
|
8856
8620
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
|
|
8857
8621
|
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
8858
8622
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -11304,7 +11068,7 @@ export function Hive({
|
|
|
11304
11068
|
</>
|
|
11305
11069
|
);
|
|
11306
11070
|
}
|
|
11307
|
-
`,
|
|
11071
|
+
`, M = `import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
|
|
11308
11072
|
import { createPortal } from 'react-dom';
|
|
11309
11073
|
import { CommonComponentProps } from '../props';
|
|
11310
11074
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -12107,7 +11871,7 @@ export type LightboxJournalSettings = {
|
|
|
12107
11871
|
closeIconColor: string;
|
|
12108
11872
|
closeIconHoverColor: string;
|
|
12109
11873
|
};
|
|
12110
|
-
`,
|
|
11874
|
+
`, L = `import { useEffect, useRef, useState, type MouseEvent } from 'react';
|
|
12111
11875
|
import { createPortal } from 'react-dom';
|
|
12112
11876
|
import { CommonComponentProps } from '../props';
|
|
12113
11877
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -12691,7 +12455,7 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
|
|
|
12691
12455
|
</>
|
|
12692
12456
|
);
|
|
12693
12457
|
};
|
|
12694
|
-
`,
|
|
12458
|
+
`, k = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
12695
12459
|
import { createPortal } from 'react-dom';
|
|
12696
12460
|
import { CommonComponentProps } from '../props';
|
|
12697
12461
|
import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -15796,7 +15560,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
|
|
|
15796
15560
|
</>
|
|
15797
15561
|
);
|
|
15798
15562
|
}
|
|
15799
|
-
`,
|
|
15563
|
+
`, A = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
15800
15564
|
import cn from 'classnames';
|
|
15801
15565
|
import { CommonComponentProps } from '../props';
|
|
15802
15566
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -16654,7 +16418,7 @@ type MarqueeProps = {
|
|
|
16654
16418
|
isPreviewMode?: boolean;
|
|
16655
16419
|
isEditMode?: boolean;
|
|
16656
16420
|
} & CommonComponentProps;
|
|
16657
|
-
`,
|
|
16421
|
+
`, N = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
|
|
16658
16422
|
import cn from 'classnames';
|
|
16659
16423
|
import { CommonComponentProps } from '../props';
|
|
16660
16424
|
import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -17597,7 +17361,7 @@ type MarqueeTextProps = {
|
|
|
17597
17361
|
isPreviewMode?: boolean;
|
|
17598
17362
|
isEditMode?: boolean;
|
|
17599
17363
|
} & CommonComponentProps;
|
|
17600
|
-
`,
|
|
17364
|
+
`, H = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
17601
17365
|
import { createPortal } from 'react-dom';
|
|
17602
17366
|
import type React from 'react';
|
|
17603
17367
|
import { CommonComponentProps } from '../props';
|
|
@@ -20079,7 +19843,7 @@ export function Mercury({
|
|
|
20079
19843
|
</>
|
|
20080
19844
|
);
|
|
20081
19845
|
}
|
|
20082
|
-
`,
|
|
19846
|
+
`, O = `import React, { useMemo, useState } from 'react';
|
|
20083
19847
|
import { CommonComponentProps } from '../props';
|
|
20084
19848
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
20085
19849
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -20658,7 +20422,7 @@ const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {
|
|
|
20658
20422
|
};
|
|
20659
20423
|
|
|
20660
20424
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
20661
|
-
`,
|
|
20425
|
+
`, _ = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
20662
20426
|
import type React from 'react';
|
|
20663
20427
|
import { CommonComponentProps } from '../props';
|
|
20664
20428
|
import { scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -21497,7 +21261,7 @@ export function Pretext({ settings, content, isEditor, isPreviewMode, isEditMode
|
|
|
21497
21261
|
</>
|
|
21498
21262
|
);
|
|
21499
21263
|
}
|
|
21500
|
-
`,
|
|
21264
|
+
`, F = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
21501
21265
|
import cn from 'classnames';
|
|
21502
21266
|
import { CommonComponentProps } from '../props';
|
|
21503
21267
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -22125,7 +21889,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
22125
21889
|
</>
|
|
22126
21890
|
);
|
|
22127
21891
|
}
|
|
22128
|
-
`,
|
|
21892
|
+
`, W = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
|
|
22129
21893
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
22130
21894
|
import { CommonComponentProps } from '../props';
|
|
22131
21895
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
@@ -22757,7 +22521,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
22757
22521
|
</>
|
|
22758
22522
|
);
|
|
22759
22523
|
}
|
|
22760
|
-
`,
|
|
22524
|
+
`, D = `import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
22761
22525
|
import cn from 'classnames';
|
|
22762
22526
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
22763
22527
|
import { scalingValue } from '../utils/scalingValue';
|
|
@@ -23939,7 +23703,7 @@ function ArrowIcon({ color, className }: { color: string, className: string }) {
|
|
|
23939
23703
|
</svg>
|
|
23940
23704
|
);
|
|
23941
23705
|
}
|
|
23942
|
-
`,
|
|
23706
|
+
`, B = `import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
23943
23707
|
import cn from 'classnames';
|
|
23944
23708
|
import { CommonComponentProps } from '../props';
|
|
23945
23709
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -24570,7 +24334,7 @@ type TestimonialsSettings = {
|
|
|
24570
24334
|
logoHeight: number;
|
|
24571
24335
|
captionMarginTop: number;
|
|
24572
24336
|
};
|
|
24573
|
-
`,
|
|
24337
|
+
`, z = `import cn from 'classnames';
|
|
24574
24338
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
24575
24339
|
import { CommonComponentProps } from '../props';
|
|
24576
24340
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -25066,7 +24830,7 @@ type TestimonialsSettings = {
|
|
|
25066
24830
|
icon?: string | null;
|
|
25067
24831
|
};
|
|
25068
24832
|
};
|
|
25069
|
-
`,
|
|
24833
|
+
`, V = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
25070
24834
|
import type React from 'react';
|
|
25071
24835
|
import { createPortal } from 'react-dom';
|
|
25072
24836
|
import { CommonComponentProps } from '../props';
|
|
@@ -25599,31 +25363,30 @@ export function Waterfall({
|
|
|
25599
25363
|
</>
|
|
25600
25364
|
);
|
|
25601
25365
|
}
|
|
25602
|
-
`,
|
|
25603
|
-
[
|
|
25604
|
-
[
|
|
25605
|
-
[
|
|
25606
|
-
[
|
|
25607
|
-
[
|
|
25608
|
-
[
|
|
25609
|
-
[
|
|
25610
|
-
[
|
|
25611
|
-
[
|
|
25612
|
-
[
|
|
25613
|
-
[
|
|
25614
|
-
[
|
|
25615
|
-
[
|
|
25616
|
-
[
|
|
25617
|
-
[
|
|
25618
|
-
[
|
|
25619
|
-
[
|
|
25620
|
-
[
|
|
25621
|
-
[
|
|
25622
|
-
[
|
|
25623
|
-
[
|
|
25624
|
-
[
|
|
25625
|
-
[e.id]: G
|
|
25366
|
+
`, U = {
|
|
25367
|
+
[y.id]: S,
|
|
25368
|
+
[b.id]: w,
|
|
25369
|
+
[x.id]: C,
|
|
25370
|
+
[P.id]: $,
|
|
25371
|
+
[v.id]: I,
|
|
25372
|
+
[f.id]: E,
|
|
25373
|
+
[h.id]: T,
|
|
25374
|
+
[p.id]: R,
|
|
25375
|
+
[m.id]: M,
|
|
25376
|
+
[g.id]: L,
|
|
25377
|
+
[u.id]: k,
|
|
25378
|
+
[d.id]: A,
|
|
25379
|
+
[c.id]: N,
|
|
25380
|
+
[l.id]: H,
|
|
25381
|
+
[s.id]: O,
|
|
25382
|
+
[a.id]: _,
|
|
25383
|
+
[r.id]: F,
|
|
25384
|
+
[o.id]: W,
|
|
25385
|
+
[i.id]: D,
|
|
25386
|
+
[t.id]: B,
|
|
25387
|
+
[e.id]: z,
|
|
25388
|
+
[n.id]: V
|
|
25626
25389
|
};
|
|
25627
25390
|
export {
|
|
25628
|
-
|
|
25391
|
+
U as componentSources
|
|
25629
25392
|
};
|