@cntrl-site/components 1.0.118-alpha.1 → 1.0.118-alpha.3
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-C8JIQQwm.mjs → Burger-BkVgNMGU.mjs} +307 -330
- package/dist/Burger-C3yVbQcq.js +669 -0
- package/dist/ChroniclesComponent-BMbUwzk6.js +1 -0
- package/dist/{ChroniclesComponent-kkKhL_qt.mjs → ChroniclesComponent-DD3tqNNm.mjs} +512 -442
- package/dist/Components/Burger/Burger.d.ts +2 -4
- package/dist/Components/Grid/CustomGridComponent.d.ts +41 -0
- package/dist/Components/Grid/Grid.d.ts +25 -7
- package/dist/{ControlSlider-DqKfaKMG.mjs → ControlSlider-BBAXRDLP.mjs} +2 -3
- package/dist/ControlSlider-BCkVFl4w.js +1 -0
- package/dist/Grid-CUaVUaRa.js +441 -0
- package/dist/Grid-D19xZ_mh.mjs +1800 -0
- package/dist/{components-BLyOKMdK.mjs → components-BwAmTGJp.mjs} +14 -13
- package/dist/{components-CVetdKi7.js → components-D8RelPGE.js} +1 -1
- package/dist/components.css +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +9 -8
- 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 +522 -286
- package/dist/sources.mjs +563 -326
- package/package.json +1 -1
- package/dist/Burger-C_SjPZWp.js +0 -669
- package/dist/ChroniclesComponent-DkG1aICD.js +0 -1
- package/dist/ControlSlider-C8ckUIDm.js +0 -1
- package/dist/Grid-C4hO8KCr.js +0 -408
- package/dist/Grid-Dud7PLS9.mjs +0 -1622
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-DD3tqNNm.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,12 +28,11 @@ 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';
|
|
32
32
|
value?: string;
|
|
33
33
|
target?: string;
|
|
34
34
|
anchor?: string;
|
|
35
35
|
url?: string;
|
|
36
|
-
download?: string;
|
|
37
36
|
};
|
|
38
37
|
mode?: 'page' | 'url';
|
|
39
38
|
page?: string;
|
|
@@ -258,11 +257,10 @@ function isBlankTarget(target?: string): boolean {
|
|
|
258
257
|
}
|
|
259
258
|
|
|
260
259
|
function getBurgerDest(item: BurgerLink): {
|
|
261
|
-
type: 'url' | 'page' | 'anchor'
|
|
260
|
+
type: 'url' | 'page' | 'anchor';
|
|
262
261
|
value: string;
|
|
263
262
|
target?: '_blank';
|
|
264
263
|
anchor?: string;
|
|
265
|
-
download?: string;
|
|
266
264
|
} {
|
|
267
265
|
const dest = item.link;
|
|
268
266
|
if (dest && typeof dest === 'object') {
|
|
@@ -276,12 +274,8 @@ function getBurgerDest(item: BurgerLink): {
|
|
|
276
274
|
if (dest.type === 'page') {
|
|
277
275
|
return { type: 'page', value: dest.value ?? '', target, anchor: dest.anchor };
|
|
278
276
|
}
|
|
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
|
|
283
277
|
if (typeof dest.url === 'string') {
|
|
284
|
-
return { type: 'url', value: dest.url, target
|
|
278
|
+
return { type: 'url', value: dest.url, target };
|
|
285
279
|
}
|
|
286
280
|
}
|
|
287
281
|
const target = isBlankTarget(item.openIn) ? '_blank' : undefined;
|
|
@@ -302,17 +296,12 @@ function resolveBurgerLink(item: BurgerLink, pages?: BurgerPageRef[]): {
|
|
|
302
296
|
label: string;
|
|
303
297
|
href: string;
|
|
304
298
|
target?: '_blank';
|
|
305
|
-
download?: string;
|
|
306
299
|
} {
|
|
307
300
|
const label = item.label || 'Link';
|
|
308
301
|
const dest = getBurgerDest(item);
|
|
309
302
|
|
|
310
303
|
if (dest.type === 'url') {
|
|
311
|
-
return { label, href: dest.value, target: dest.target
|
|
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' };
|
|
304
|
+
return { label, href: dest.value, target: dest.target };
|
|
316
305
|
}
|
|
317
306
|
if (dest.type === 'anchor') {
|
|
318
307
|
const anchor = dest.value.replace(/^#/, '');
|
|
@@ -924,11 +913,10 @@ function renderTextPaddingControls(
|
|
|
924
913
|
type ColorKeys = 'iconColor' | 'closeButtonColor' | 'linkColor' | 'openLinkColor' | 'compactIconColor' | 'compactLinkColor' | 'compactLogoColor' | 'compactBackgroundColor' | 'openLogoColor' | 'menuBackgroundColor' | 'overlayColor' | 'backgroundColor' | 'logoColor';
|
|
925
914
|
|
|
926
915
|
export type BurgerLinkNavigateEvent = {
|
|
927
|
-
mode: 'page' | 'url'
|
|
916
|
+
mode: 'page' | 'url';
|
|
928
917
|
href: string;
|
|
929
918
|
page?: string;
|
|
930
919
|
url?: string;
|
|
931
|
-
file?: string;
|
|
932
920
|
anchor?: string;
|
|
933
921
|
target?: '_blank';
|
|
934
922
|
};
|
|
@@ -1780,28 +1768,6 @@ function findAnchorTarget(hash: string): HTMLElement | null {
|
|
|
1780
1768
|
return target instanceof HTMLElement ? target : null;
|
|
1781
1769
|
}
|
|
1782
1770
|
|
|
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
|
-
|
|
1805
1771
|
function scrollToAnchor(hash: string): boolean {
|
|
1806
1772
|
const target = findAnchorTarget(hash);
|
|
1807
1773
|
if (!target) return false;
|
|
@@ -1835,11 +1801,10 @@ function handleLinkClick(
|
|
|
1835
1801
|
const resolved = resolveBurgerLink(item, pages);
|
|
1836
1802
|
const dest = getBurgerDest(item);
|
|
1837
1803
|
const navigateEvent: BurgerLinkNavigateEvent = {
|
|
1838
|
-
mode: dest.type === 'url'
|
|
1804
|
+
mode: dest.type === 'url' ? 'url' : 'page',
|
|
1839
1805
|
href: resolved.href || href,
|
|
1840
1806
|
page: dest.type === 'page' ? dest.value : undefined,
|
|
1841
1807
|
url: dest.type === 'url' ? dest.value : undefined,
|
|
1842
|
-
file: dest.type === 'file' ? dest.value : undefined,
|
|
1843
1808
|
anchor: dest.type === 'anchor'
|
|
1844
1809
|
? dest.value.replace(/^#/, '')
|
|
1845
1810
|
: (dest.anchor ?? '').replace(/^#/, ''),
|
|
@@ -1861,14 +1826,6 @@ function handleLinkClick(
|
|
|
1861
1826
|
return;
|
|
1862
1827
|
}
|
|
1863
1828
|
|
|
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
|
-
|
|
1872
1829
|
if (!opensInNewTab && hash && isSameDocumentHref(href) && findAnchorTarget(hash)) {
|
|
1873
1830
|
event.preventDefault();
|
|
1874
1831
|
runAfterClose(() => scrollToAnchor(hash));
|
|
@@ -2474,13 +2431,12 @@ export function Burger({
|
|
|
2474
2431
|
const showOpenNavControls = showControls && isOpen;
|
|
2475
2432
|
|
|
2476
2433
|
const renderOpenNavItems = (linkClassName: string) => items.filter((item) => isVisibleInOpenNav(item, layoutId)).map((item, index) => {
|
|
2477
|
-
const { label, href, target
|
|
2434
|
+
const { label, href, target } = resolveBurgerLink(item, pages);
|
|
2478
2435
|
const linkNode = href ? (
|
|
2479
2436
|
<a
|
|
2480
2437
|
href={href}
|
|
2481
2438
|
target={target}
|
|
2482
2439
|
rel={target === '_blank' ? 'noopener noreferrer' : undefined}
|
|
2483
|
-
download={download}
|
|
2484
2440
|
className={\`\${linkClassName} \${P}-has-href\`}
|
|
2485
2441
|
onClick={(event) => onNavLinkClick(event, item)}
|
|
2486
2442
|
>
|
|
@@ -2592,7 +2548,7 @@ export function Burger({
|
|
|
2592
2548
|
};
|
|
2593
2549
|
|
|
2594
2550
|
const renderNavLink = (item: BurgerLink, index: number) => {
|
|
2595
|
-
const { label, href, target
|
|
2551
|
+
const { label, href, target } = resolveBurgerLink(item, pages);
|
|
2596
2552
|
const textContent = (
|
|
2597
2553
|
<span className={navLinkTextClassName} style={navLinkTextStyle}>
|
|
2598
2554
|
{renderMultilineText(label)}
|
|
@@ -2611,7 +2567,6 @@ export function Burger({
|
|
|
2611
2567
|
href={href}
|
|
2612
2568
|
target={target}
|
|
2613
2569
|
rel={target === '_blank' ? 'noopener noreferrer' : undefined}
|
|
2614
|
-
download={download}
|
|
2615
2570
|
className={\`\${P}-nav-link \${P}-has-href\`}
|
|
2616
2571
|
onClick={(event) => onNavLinkClick(event, item)}
|
|
2617
2572
|
>
|
|
@@ -2729,7 +2684,7 @@ export function Burger({
|
|
|
2729
2684
|
</div>
|
|
2730
2685
|
);
|
|
2731
2686
|
}
|
|
2732
|
-
`,
|
|
2687
|
+
`, $ = `import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
|
|
2733
2688
|
import { createPortal } from 'react-dom';
|
|
2734
2689
|
import cn from 'classnames';
|
|
2735
2690
|
import { CommonComponentProps } from '../props';
|
|
@@ -3776,7 +3731,7 @@ export function Chronicles({
|
|
|
3776
3731
|
</>
|
|
3777
3732
|
);
|
|
3778
3733
|
}
|
|
3779
|
-
`,
|
|
3734
|
+
`, I = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3780
3735
|
import { CommonComponentProps } from '../props';
|
|
3781
3736
|
import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
|
|
3782
3737
|
|
|
@@ -4305,7 +4260,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
4305
4260
|
</>
|
|
4306
4261
|
);
|
|
4307
4262
|
}
|
|
4308
|
-
`,
|
|
4263
|
+
`, E = `import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4309
4264
|
import cn from 'classnames';
|
|
4310
4265
|
import { CommonComponentProps } from '../props';
|
|
4311
4266
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -5049,7 +5004,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
|
|
|
5049
5004
|
</>
|
|
5050
5005
|
);
|
|
5051
5006
|
}
|
|
5052
|
-
`,
|
|
5007
|
+
`, T = `import React, { useMemo, useState } from 'react';
|
|
5053
5008
|
import { CommonComponentProps } from '../props';
|
|
5054
5009
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
5055
5010
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -5687,9 +5642,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
5687
5642
|
};
|
|
5688
5643
|
|
|
5689
5644
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
5690
|
-
`,
|
|
5691
|
-
import '@splidejs/react-splide/css/core';
|
|
5692
|
-
import { CommonComponentProps } from '../props';
|
|
5645
|
+
`, n = `import { CommonComponentProps } from '../props';
|
|
5693
5646
|
import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
|
|
5694
5647
|
import {
|
|
5695
5648
|
buildColorVars,
|
|
@@ -5699,7 +5652,7 @@ import {
|
|
|
5699
5652
|
useLazyVideos,
|
|
5700
5653
|
useScopedStyles,
|
|
5701
5654
|
} from '../utils/index';
|
|
5702
|
-
import { useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
|
|
5655
|
+
import { memo, useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
|
|
5703
5656
|
import { createPortal } from 'react-dom';
|
|
5704
5657
|
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
5705
5658
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
@@ -5816,15 +5769,19 @@ function getCSS(P: string): string {
|
|
|
5816
5769
|
width: 100%;
|
|
5817
5770
|
overflow: hidden;
|
|
5818
5771
|
}
|
|
5819
|
-
.\${P}-item-slider .splide__track {
|
|
5820
|
-
overflow: hidden;
|
|
5821
|
-
}
|
|
5822
5772
|
.\${P}-item-image-link {
|
|
5823
5773
|
width: 100%;
|
|
5824
5774
|
display: flex;
|
|
5825
5775
|
flex-direction: column;
|
|
5826
5776
|
align-items: center;
|
|
5827
5777
|
}
|
|
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
|
+
}
|
|
5828
5785
|
.\${P}-item-text-link {
|
|
5829
5786
|
display: flex;
|
|
5830
5787
|
flex-direction: column;
|
|
@@ -5845,18 +5802,47 @@ function getCSS(P: string): string {
|
|
|
5845
5802
|
display: block;
|
|
5846
5803
|
max-width: 100%;
|
|
5847
5804
|
}
|
|
5848
|
-
.\${P}-item-slider
|
|
5849
|
-
|
|
5850
|
-
.\${P}-item-slider .splide__list,
|
|
5851
|
-
.\${P}-item-slider .splide__slide {
|
|
5805
|
+
.\${P}-item-slider {
|
|
5806
|
+
position: relative;
|
|
5852
5807
|
width: 100%;
|
|
5853
5808
|
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;
|
|
5854
5818
|
}
|
|
5855
|
-
.\${P}-item-slider
|
|
5819
|
+
.\${P}-item-slider-list-vertical {
|
|
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%;
|
|
5856
5831
|
display: flex;
|
|
5857
5832
|
justify-content: center;
|
|
5858
5833
|
align-items: center;
|
|
5859
5834
|
}
|
|
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
|
+
}
|
|
5860
5846
|
.\${P}-item-title {
|
|
5861
5847
|
white-space: normal;
|
|
5862
5848
|
overflow-wrap: anywhere;
|
|
@@ -6003,13 +5989,13 @@ function getCSS(P: string): string {
|
|
|
6003
5989
|
.\${P}-image-align-bottom .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
|
|
6004
5990
|
align-items: flex-end;
|
|
6005
5991
|
}
|
|
6006
|
-
.\${P}-image-align-top .\${P}-item-slider
|
|
5992
|
+
.\${P}-image-align-top .\${P}-item-slider .\${P}-item-slide {
|
|
6007
5993
|
align-items: flex-start;
|
|
6008
5994
|
}
|
|
6009
|
-
.\${P}-image-align-center .\${P}-item-slider
|
|
5995
|
+
.\${P}-image-align-center .\${P}-item-slider .\${P}-item-slide {
|
|
6010
5996
|
align-items: center;
|
|
6011
5997
|
}
|
|
6012
|
-
.\${P}-image-align-bottom .\${P}-item-slider
|
|
5998
|
+
.\${P}-image-align-bottom .\${P}-item-slider .\${P}-item-slide {
|
|
6013
5999
|
align-items: flex-end;
|
|
6014
6000
|
}
|
|
6015
6001
|
.\${P}-align-entries .\${P}-item {
|
|
@@ -6090,13 +6076,13 @@ function getCSS(P: string): string {
|
|
|
6090
6076
|
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
|
|
6091
6077
|
align-items: flex-end;
|
|
6092
6078
|
}
|
|
6093
|
-
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider
|
|
6079
|
+
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
|
|
6094
6080
|
align-items: flex-start;
|
|
6095
6081
|
}
|
|
6096
|
-
.\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider
|
|
6082
|
+
.\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
|
|
6097
6083
|
align-items: center;
|
|
6098
6084
|
}
|
|
6099
|
-
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider
|
|
6085
|
+
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
|
|
6100
6086
|
align-items: flex-end;
|
|
6101
6087
|
}
|
|
6102
6088
|
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-image-link {
|
|
@@ -6164,27 +6150,9 @@ function pickRandomSlideDirection(): 'ltr' | 'ttb' {
|
|
|
6164
6150
|
return Math.random() < 0.5 ? 'ltr' : 'ttb';
|
|
6165
6151
|
}
|
|
6166
6152
|
|
|
6167
|
-
function
|
|
6168
|
-
|
|
6169
|
-
|
|
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
|
-
});
|
|
6153
|
+
function wrapSlideIndex(index: number, count: number): number {
|
|
6154
|
+
if (count <= 0) return 0;
|
|
6155
|
+
return ((index % count) + count) % count;
|
|
6188
6156
|
}
|
|
6189
6157
|
|
|
6190
6158
|
type GridProps = {
|
|
@@ -6224,6 +6192,8 @@ type LightboxProps = {
|
|
|
6224
6192
|
|
|
6225
6193
|
const LIGHTBOX_ANIM_MS = 500;
|
|
6226
6194
|
const SLIDER_TRANSITION_MS = 750;
|
|
6195
|
+
const SLIDER_EASING = 'cubic-bezier(0.25, 1, 0.5, 1)';
|
|
6196
|
+
const SLIDER_DEFAULT_INTERVAL_MS = 5000;
|
|
6227
6197
|
const LIGHTBOX_EASING = 'cubic-bezier(0.22, 1, 0.36, 1)';
|
|
6228
6198
|
const SWIPE_CLOSE_THRESHOLD = 72;
|
|
6229
6199
|
const SWIPE_NAV_THRESHOLD = 50;
|
|
@@ -6313,7 +6283,7 @@ function collectGridLightboxMedia(content: any[]): GridMedia[] {
|
|
|
6313
6283
|
return result;
|
|
6314
6284
|
}
|
|
6315
6285
|
|
|
6316
|
-
function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
6286
|
+
const LightboxMediaPreloadPool = memo(function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
6317
6287
|
const [pool, setPool] = useState<HTMLDivElement | null>(null);
|
|
6318
6288
|
useLazyVideos(pool, { preload: 'metadata' });
|
|
6319
6289
|
// an embed's player is only ever framed where it shows
|
|
@@ -6352,7 +6322,7 @@ function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
|
6352
6322
|
))}
|
|
6353
6323
|
</div>
|
|
6354
6324
|
);
|
|
6355
|
-
}
|
|
6325
|
+
});
|
|
6356
6326
|
|
|
6357
6327
|
function unloadVideoElement(video: HTMLVideoElement) {
|
|
6358
6328
|
video.pause();
|
|
@@ -6360,15 +6330,121 @@ function unloadVideoElement(video: HTMLVideoElement) {
|
|
|
6360
6330
|
video.load();
|
|
6361
6331
|
}
|
|
6362
6332
|
|
|
6363
|
-
const
|
|
6333
|
+
const GRID_SLIDE_CLASS = 'cntrl-grid-slide';
|
|
6334
|
+
const GRID_SLIDE_PLAYING_CLASS = 'cntrl-grid-slide-playing';
|
|
6335
|
+
const GRID_SLIDE_VIDEOS = \`.\${GRID_SLIDE_CLASS} video\`;
|
|
6364
6336
|
|
|
6365
6337
|
function shouldPlaySlideVideo(video: HTMLVideoElement): boolean {
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6338
|
+
return video.closest(\`.\${GRID_SLIDE_PLAYING_CLASS}\`) !== null;
|
|
6339
|
+
}
|
|
6340
|
+
|
|
6341
|
+
type GridEntrySliderProps = {
|
|
6342
|
+
prefix: string;
|
|
6343
|
+
slides: React.ReactNode[];
|
|
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
|
+
);
|
|
6372
6448
|
}
|
|
6373
6449
|
|
|
6374
6450
|
function GridMediaItem({
|
|
@@ -6376,7 +6452,7 @@ function GridMediaItem({
|
|
|
6376
6452
|
className,
|
|
6377
6453
|
style,
|
|
6378
6454
|
hasLightbox,
|
|
6379
|
-
|
|
6455
|
+
isSliderSlide = false,
|
|
6380
6456
|
onMediaClick,
|
|
6381
6457
|
}: {
|
|
6382
6458
|
media: GridMedia;
|
|
@@ -6384,7 +6460,7 @@ function GridMediaItem({
|
|
|
6384
6460
|
style: React.CSSProperties;
|
|
6385
6461
|
/** An embed then plays here as a silent loop, and as it was set to in the lightbox. */
|
|
6386
6462
|
hasLightbox: boolean;
|
|
6387
|
-
|
|
6463
|
+
isSliderSlide?: boolean;
|
|
6388
6464
|
onMediaClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
6389
6465
|
}) {
|
|
6390
6466
|
if (isEmbedMedia(media)) {
|
|
@@ -6416,7 +6492,7 @@ function GridMediaItem({
|
|
|
6416
6492
|
playsInline: true,
|
|
6417
6493
|
onClick: onMediaClick,
|
|
6418
6494
|
};
|
|
6419
|
-
return
|
|
6495
|
+
return isSliderSlide
|
|
6420
6496
|
? <video {...videoProps} preload='none' />
|
|
6421
6497
|
: <LazyVideo {...videoProps} autoPlay />;
|
|
6422
6498
|
}
|
|
@@ -6445,7 +6521,7 @@ function GridItemMediaWrapper({
|
|
|
6445
6521
|
children: React.ReactNode;
|
|
6446
6522
|
}) {
|
|
6447
6523
|
const [wrapper, setWrapper] = useState<HTMLDivElement | null>(null);
|
|
6448
|
-
useLazyVideos(wrapper, { autoPlay: true, selector:
|
|
6524
|
+
useLazyVideos(wrapper, { autoPlay: true, selector: GRID_SLIDE_VIDEOS, shouldPlay: shouldPlaySlideVideo });
|
|
6449
6525
|
|
|
6450
6526
|
return (
|
|
6451
6527
|
<div ref={setWrapper} className={className} style={style}>
|
|
@@ -7346,11 +7422,108 @@ function resolveLightboxImageDisplay(
|
|
|
7346
7422
|
return value?.display === 'cover' ? 'cover' : 'fit';
|
|
7347
7423
|
}
|
|
7348
7424
|
|
|
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
|
+
|
|
7349
7521
|
export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, metadata, activeEvent, layoutId, portalId }: GridProps) {
|
|
7350
7522
|
const { prefix: P } = useScopedStyles();
|
|
7351
7523
|
const {
|
|
7352
7524
|
type = 'a',
|
|
7353
7525
|
gridLayout,
|
|
7526
|
+
customGrid,
|
|
7354
7527
|
textBoxWidth = 100,
|
|
7355
7528
|
verticalGap,
|
|
7356
7529
|
entriesCount,
|
|
@@ -7398,62 +7571,69 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7398
7571
|
hover = 'none',
|
|
7399
7572
|
alignEntries = 'off',
|
|
7400
7573
|
align = 'top',
|
|
7574
|
+
textGrowth = 'inside',
|
|
7401
7575
|
} = settings;
|
|
7402
7576
|
|
|
7403
|
-
const
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7577
|
+
const titleTextStyle = useMemo(() => ({
|
|
7578
|
+
...omitTextColors(textStylesToCss({
|
|
7579
|
+
fontSettings: {
|
|
7580
|
+
fontFamily: titleFontFamily,
|
|
7581
|
+
fontWeight: titleFontSettings?.fontWeight ?? 400,
|
|
7582
|
+
fontStyle: titleFontSettings?.fontStyle ?? 'normal',
|
|
7583
|
+
},
|
|
7584
|
+
fontSize: titleFontSize ?? 0.01,
|
|
7585
|
+
lineHeight: titleLineHeight,
|
|
7586
|
+
letterSpacing: titleLetterSpacing ?? 0,
|
|
7587
|
+
wordSpacing: titleWordSpacing ?? 0,
|
|
7588
|
+
textAppearance: titleTextAppearance,
|
|
7589
|
+
color: titleColor,
|
|
7590
|
+
}, isEditor)),
|
|
7591
|
+
...getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor),
|
|
7592
|
+
} as React.CSSProperties), [
|
|
7593
|
+
titleFontFamily, titleFontSettings, titleFontSize, titleLineHeight, titleLetterSpacing,
|
|
7594
|
+
titleWordSpacing, titleTextAppearance, titleColor, isEditor, P,
|
|
7595
|
+
]);
|
|
7420
7596
|
|
|
7421
|
-
const
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7597
|
+
const subtitleTextStyle = useMemo(() => ({
|
|
7598
|
+
...omitTextColors(textStylesToCss({
|
|
7599
|
+
fontSettings: {
|
|
7600
|
+
fontFamily: subtitleFontFamily,
|
|
7601
|
+
fontWeight: subtitleFontSettings?.fontWeight ?? 400,
|
|
7602
|
+
fontStyle: subtitleFontSettings?.fontStyle ?? 'normal',
|
|
7603
|
+
},
|
|
7604
|
+
fontSize: subtitleFontSize ?? 0.01,
|
|
7605
|
+
lineHeight: subtitleLineHeight,
|
|
7606
|
+
letterSpacing: subtitleLetterSpacing ?? 0,
|
|
7607
|
+
wordSpacing: subtitleWordSpacing ?? 0,
|
|
7608
|
+
textAppearance: subtitleTextAppearance,
|
|
7609
|
+
color: subtitleColor,
|
|
7610
|
+
}, isEditor)),
|
|
7611
|
+
...getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor),
|
|
7612
|
+
} as React.CSSProperties), [
|
|
7613
|
+
subtitleFontFamily, subtitleFontSettings, subtitleFontSize, subtitleLineHeight, subtitleLetterSpacing,
|
|
7614
|
+
subtitleWordSpacing, subtitleTextAppearance, subtitleColor, isEditor, P,
|
|
7615
|
+
]);
|
|
7438
7616
|
|
|
7439
|
-
const
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
const lightboxCounterFieldCss = {
|
|
7454
|
-
...lightboxCounterTypographyCss,
|
|
7617
|
+
const lightboxCounterFieldCss = useMemo(() => ({
|
|
7618
|
+
...omitTextColors(textStylesToCss({
|
|
7619
|
+
fontSettings: {
|
|
7620
|
+
fontFamily: lightboxCounterFontFamily,
|
|
7621
|
+
fontWeight: lightboxCounterFontSettings?.fontWeight ?? 400,
|
|
7622
|
+
fontStyle: lightboxCounterFontSettings?.fontStyle ?? 'normal',
|
|
7623
|
+
},
|
|
7624
|
+
fontSize: lightboxCounterFontSize ?? 0.01,
|
|
7625
|
+
lineHeight: lightboxCounterLineHeight,
|
|
7626
|
+
letterSpacing: lightboxCounterLetterSpacing ?? 0,
|
|
7627
|
+
wordSpacing: lightboxCounterWordSpacing ?? 0,
|
|
7628
|
+
textAppearance: lightboxCounterTextAppearance,
|
|
7629
|
+
color: lightboxCounterColor,
|
|
7630
|
+
}, isEditor)),
|
|
7455
7631
|
...getGridTextLeadingVars(lightboxCounterFontSize, lightboxCounterLineHeight, P, isEditor),
|
|
7456
|
-
} as React.CSSProperties
|
|
7632
|
+
} as React.CSSProperties), [
|
|
7633
|
+
lightboxCounterFontFamily, lightboxCounterFontSettings, lightboxCounterFontSize, lightboxCounterLineHeight,
|
|
7634
|
+
lightboxCounterLetterSpacing, lightboxCounterWordSpacing, lightboxCounterTextAppearance, lightboxCounterColor,
|
|
7635
|
+
isEditor, P,
|
|
7636
|
+
]);
|
|
7457
7637
|
|
|
7458
7638
|
const titleTextClassName = getGridTextClassName(
|
|
7459
7639
|
titleFontSize,
|
|
@@ -7467,8 +7647,6 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7467
7647
|
\`\${P}-item-subtitle\`,
|
|
7468
7648
|
\`\${P}-text-tight-leading\`,
|
|
7469
7649
|
);
|
|
7470
|
-
const titleTextLeadingVars = getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor);
|
|
7471
|
-
const subtitleTextLeadingVars = getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor);
|
|
7472
7650
|
const lightboxCounterClassName = getGridTextClassName(
|
|
7473
7651
|
lightboxCounterFontSize,
|
|
7474
7652
|
lightboxCounterLineHeight,
|
|
@@ -7476,42 +7654,56 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7476
7654
|
\`\${P}-text-tight-leading\`,
|
|
7477
7655
|
);
|
|
7478
7656
|
|
|
7479
|
-
const colorVars = buildColorVars(P, {
|
|
7657
|
+
const colorVars = useMemo(() => buildColorVars(P, {
|
|
7480
7658
|
titleColor,
|
|
7481
7659
|
subtitleColor,
|
|
7482
7660
|
lightboxCounterColor,
|
|
7483
|
-
}, COLOR_VAR_MAP, STATE_KEYS);
|
|
7661
|
+
}, COLOR_VAR_MAP, STATE_KEYS), [P, titleColor, subtitleColor, lightboxCounterColor]);
|
|
7484
7662
|
|
|
7485
7663
|
const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
|
|
7486
7664
|
const showTextOnHover = showText === 'on hover' && (!isEditor || isPreviewMode);
|
|
7487
7665
|
const hoverEffectClass = hover !== 'none' && (!isEditor || isPreviewMode) ? \` \${P}-hover-\${hover}\` : '';
|
|
7488
7666
|
const wrapperStateClasses = \`\${stateClass}\${showTextOnHover ? \` \${P}-show-text-hover\` : ''}\${hoverEffectClass}\`.trim();
|
|
7489
7667
|
|
|
7490
|
-
const
|
|
7668
|
+
const customLayout = customGrid && Array.isArray(customGrid.blocks) && customGrid.blocks.length > 0 ? customGrid : undefined;
|
|
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[]>([]);
|
|
7491
7673
|
|
|
7492
|
-
const cropContent = (content ?? []).slice(0, resEntriesCount);
|
|
7674
|
+
const cropContent = useMemo<any[]>(() => (content ?? []).slice(0, resEntriesCount), [content, resEntriesCount]);
|
|
7493
7675
|
const lightboxMediaToPreload = useMemo(
|
|
7494
7676
|
() => (lightbox === 'on' ? collectGridLightboxMedia(cropContent) : []),
|
|
7495
7677
|
[cropContent, lightbox],
|
|
7496
7678
|
);
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7679
|
+
const entriesMedia = useMemo(() => cropContent.map((item: any) => {
|
|
7680
|
+
const displayItems = getGridDisplayItems(item.gallery);
|
|
7681
|
+
const lightboxItemsForEntry = displayItems
|
|
7682
|
+
.filter(entry => entry.lightboxMedia)
|
|
7683
|
+
.map(entry => entry.lightboxMedia!);
|
|
7684
|
+
const lightboxIndexes = displayItems.map(({ lightboxMedia }) => (lightboxMedia
|
|
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;
|
|
7503
7696
|
const [rW, rH] = ratioValue.split(':').map(Number);
|
|
7504
7697
|
const effW = ratioReversed ? rH : rW;
|
|
7505
7698
|
const effH = ratioReversed ? rW : rH;
|
|
7506
7699
|
const aspectRatio = \`\${effW} / \${effH}\`;
|
|
7507
7700
|
|
|
7508
|
-
const columnsCount = gridLayout
|
|
7701
|
+
const columnsCount = gridLayout?.columnsCount ?? 1;
|
|
7509
7702
|
const entryWidthScaled = scalingValue(size ?? 0, isEditor);
|
|
7510
|
-
const
|
|
7511
|
-
const isFitSlider = !isCover && slider !== 'off';
|
|
7703
|
+
const isFitSlider = !customLayout && !isCover && slider !== 'off';
|
|
7512
7704
|
|
|
7513
7705
|
const itemsInLastRow = cropContent.length % columnsCount || columnsCount;
|
|
7514
|
-
const isPartialLastRow = itemsInLastRow < columnsCount && cropContent.length > 0;
|
|
7706
|
+
const isPartialLastRow = !customLayout && itemsInLastRow < columnsCount && cropContent.length > 0;
|
|
7515
7707
|
const lastRowStartIndex = cropContent.length - itemsInLastRow;
|
|
7516
7708
|
const lastRowStartColumn = isPartialLastRow
|
|
7517
7709
|
? Math.floor((columnsCount - itemsInLastRow) / 2) + 1
|
|
@@ -7519,19 +7711,21 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7519
7711
|
|
|
7520
7712
|
const imageBorderRadius = imageCorners ? scalingValue(imageCorners, isEditor) : undefined;
|
|
7521
7713
|
|
|
7522
|
-
const
|
|
7523
|
-
width:
|
|
7524
|
-
...(
|
|
7525
|
-
?
|
|
7526
|
-
|
|
7714
|
+
const getImageWrapperStyle = (entryWidth: string, slot?: CustomGridSlot): React.CSSProperties => ({
|
|
7715
|
+
width: entryWidth,
|
|
7716
|
+
...(slot
|
|
7717
|
+
? isTextOutside
|
|
7718
|
+
? { height: scalingValue(slot.height, isEditor), flexShrink: 0, overflow: 'hidden' }
|
|
7719
|
+
: { flex: '1 1 0%', minHeight: 0, overflow: 'hidden' }
|
|
7720
|
+
: isCover
|
|
7721
|
+
? { aspectRatio, height: 'auto', overflow: 'hidden' }
|
|
7722
|
+
: { height: 'auto' }),
|
|
7527
7723
|
...(imageBorderRadius ? { borderRadius: imageBorderRadius, overflow: 'hidden' } : {}),
|
|
7528
|
-
};
|
|
7724
|
+
});
|
|
7529
7725
|
|
|
7530
7726
|
const imageWrapperClassName = \`\${P}-item-image-wrapper\${isFitSlider ? \` \${P}-item-image-wrapper-fit-slider\` : ''}\`.trim();
|
|
7531
7727
|
const isTextBeforeImage = type === 'd' || type === 'e' || type === 'f';
|
|
7532
|
-
const shouldAlignEntries = alignEntries === 'on';
|
|
7533
|
-
const textBoxWidthStyle = \`calc(\${scalingValue(size ?? 0, isEditor)} * (\${textBoxWidth} / 100))\`;
|
|
7534
|
-
const controlWidthStyle = scalingValue(size * textBoxWidth / 100, isEditor);
|
|
7728
|
+
const shouldAlignEntries = !customLayout && alignEntries === 'on';
|
|
7535
7729
|
|
|
7536
7730
|
const imageRadiusStyle = imageBorderRadius
|
|
7537
7731
|
? { borderRadius: imageBorderRadius, [MEDIA_RADIUS_VAR]: imageBorderRadius } as React.CSSProperties
|
|
@@ -7551,31 +7745,73 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7551
7745
|
width: 'auto',
|
|
7552
7746
|
height: 'auto',
|
|
7553
7747
|
maxWidth: '100%',
|
|
7748
|
+
...(customLayout ? { maxHeight: '100%' } : {}),
|
|
7554
7749
|
...imageRadiusStyle,
|
|
7555
7750
|
};
|
|
7556
7751
|
|
|
7557
|
-
const
|
|
7558
|
-
const
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7752
|
+
const shouldMeasureEntries = (customLayout?.beat ?? 0) > 0;
|
|
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));
|
|
7575
7775
|
return () => ro.disconnect();
|
|
7576
|
-
}, []);
|
|
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
|
+
};
|
|
7577
7811
|
|
|
7578
|
-
const
|
|
7812
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
7813
|
+
|
|
7814
|
+
const getLightboxPortalStyle = (): React.CSSProperties => {
|
|
7579
7815
|
const style: Record<string, string> = { ...(colorVars as Record<string, string>) };
|
|
7580
7816
|
const articleWidth = containerRef.current
|
|
7581
7817
|
? getComputedStyle(containerRef.current).getPropertyValue('--cntrl-article-width').trim()
|
|
@@ -7584,7 +7820,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7584
7820
|
style['--cntrl-article-width'] = articleWidth;
|
|
7585
7821
|
}
|
|
7586
7822
|
return style as React.CSSProperties;
|
|
7587
|
-
}
|
|
7823
|
+
};
|
|
7588
7824
|
|
|
7589
7825
|
const [lightboxOpen, setLightboxOpen] = useState(false);
|
|
7590
7826
|
const [lightboxItems, setLightboxItems] = useState<GridMedia[]>([]);
|
|
@@ -7623,16 +7859,8 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7623
7859
|
<div style={colorVars}>
|
|
7624
7860
|
<div
|
|
7625
7861
|
ref={containerRef}
|
|
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
|
-
}}>
|
|
7862
|
+
className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''}\${customLayout ? \` \${P}-custom-layout\` : ''}\${isTextOutside ? \` \${P}-text-outside\` : ''} \${P}-image-align-\${align} \${wrapperStateClasses}\`.trim()}
|
|
7863
|
+
style={wrapperLayoutStyle}>
|
|
7636
7864
|
{cropContent.map((item: any, index: number) => {
|
|
7637
7865
|
const hasTitle = hasText(item.title);
|
|
7638
7866
|
const hasSubtitle = hasText(item.subtitle);
|
|
@@ -7642,11 +7870,24 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7642
7870
|
const gridColumn = isPartialLastRow && index >= lastRowStartIndex
|
|
7643
7871
|
? \`\${lastRowStartColumn + (index - lastRowStartIndex)}\`
|
|
7644
7872
|
: 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;
|
|
7645
7886
|
|
|
7646
7887
|
const typeCTextBlock = isTextBeforeImage ? (
|
|
7647
7888
|
<div className={\`\${P}-item-text-block\`}>
|
|
7648
7889
|
{hasTitle && (
|
|
7649
|
-
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7890
|
+
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleTextStyle }}>
|
|
7650
7891
|
{item.title}
|
|
7651
7892
|
</p>
|
|
7652
7893
|
)}
|
|
@@ -7661,7 +7902,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7661
7902
|
/>
|
|
7662
7903
|
)}
|
|
7663
7904
|
{hasSubtitle && (
|
|
7664
|
-
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7905
|
+
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}>
|
|
7665
7906
|
{item.subtitle}
|
|
7666
7907
|
</p>
|
|
7667
7908
|
)}
|
|
@@ -7691,7 +7932,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7691
7932
|
/>
|
|
7692
7933
|
)}
|
|
7693
7934
|
{hasTitle && (
|
|
7694
|
-
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7935
|
+
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleTextStyle }}>
|
|
7695
7936
|
{item.title}
|
|
7696
7937
|
</p>
|
|
7697
7938
|
)}
|
|
@@ -7721,7 +7962,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7721
7962
|
/>
|
|
7722
7963
|
)}
|
|
7723
7964
|
{hasSubtitle && (
|
|
7724
|
-
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7965
|
+
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}>
|
|
7725
7966
|
{item.subtitle}
|
|
7726
7967
|
</p>
|
|
7727
7968
|
)}
|
|
@@ -7745,10 +7986,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7745
7986
|
</LinkWrapper>
|
|
7746
7987
|
);
|
|
7747
7988
|
|
|
7748
|
-
const displayItems =
|
|
7749
|
-
const lightboxItemsForEntry = displayItems
|
|
7750
|
-
.filter(entry => entry.lightboxMedia)
|
|
7751
|
-
.map(entry => entry.lightboxMedia!);
|
|
7989
|
+
const { displayItems, lightboxItemsForEntry, lightboxIndexes } = entriesMedia[index];
|
|
7752
7990
|
|
|
7753
7991
|
const imageContent = (
|
|
7754
7992
|
<GridItemMediaWrapper className={imageWrapperClassName} style={imageWrapperStyle}>
|
|
@@ -7757,10 +7995,8 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7757
7995
|
: slider === 'off'
|
|
7758
7996
|
?
|
|
7759
7997
|
(() => {
|
|
7760
|
-
const { displayMedia
|
|
7761
|
-
const lightboxIndex =
|
|
7762
|
-
? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
|
|
7763
|
-
: -1;
|
|
7998
|
+
const { displayMedia } = displayItems[0];
|
|
7999
|
+
const lightboxIndex = lightboxIndexes[0];
|
|
7764
8000
|
return (
|
|
7765
8001
|
<GridMediaItem
|
|
7766
8002
|
media={displayMedia}
|
|
@@ -7788,50 +8024,28 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7788
8024
|
))}
|
|
7789
8025
|
</div>
|
|
7790
8026
|
)}
|
|
7791
|
-
<
|
|
7792
|
-
key={\`\${transition}-\${
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
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;
|
|
8027
|
+
<GridEntrySlider
|
|
8028
|
+
key={\`\${transition}-\${itemSize}-\${direction}-\${sliderTiming}-\${layoutId}-\${displayItems.length}\`}
|
|
8029
|
+
prefix={P}
|
|
8030
|
+
isFade={transition === 'fade'}
|
|
8031
|
+
direction={direction}
|
|
8032
|
+
intervalMs={sliderTiming * 1000}
|
|
8033
|
+
slides={displayItems.map(({ displayMedia }, imgIndex) => {
|
|
8034
|
+
const lightboxIndex = lightboxIndexes[imgIndex];
|
|
7819
8035
|
return (
|
|
7820
|
-
<
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
/>
|
|
7831
|
-
</SplideSlide>
|
|
8036
|
+
<GridMediaItem
|
|
8037
|
+
media={displayMedia}
|
|
8038
|
+
className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
|
|
8039
|
+
style={imageStyle}
|
|
8040
|
+
hasLightbox={lightbox === 'on'}
|
|
8041
|
+
isSliderSlide
|
|
8042
|
+
onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
|
|
8043
|
+
? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
|
|
8044
|
+
: undefined}
|
|
8045
|
+
/>
|
|
7832
8046
|
);
|
|
7833
8047
|
})}
|
|
7834
|
-
|
|
8048
|
+
/>
|
|
7835
8049
|
</>
|
|
7836
8050
|
}
|
|
7837
8051
|
</GridItemMediaWrapper>
|
|
@@ -7849,7 +8063,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7849
8063
|
/>
|
|
7850
8064
|
<p
|
|
7851
8065
|
className={titleTextClassName}
|
|
7852
|
-
style={{ width: textBoxWidthStyle, ...
|
|
8066
|
+
style={{ width: textBoxWidthStyle, ...titleTextStyle }}
|
|
7853
8067
|
>
|
|
7854
8068
|
{item.title}
|
|
7855
8069
|
</p>
|
|
@@ -7863,7 +8077,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7863
8077
|
/>
|
|
7864
8078
|
<p
|
|
7865
8079
|
className={subtitleTextClassName}
|
|
7866
|
-
style={{ width: textBoxWidthStyle, ...
|
|
8080
|
+
style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}
|
|
7867
8081
|
>
|
|
7868
8082
|
{item.subtitle}
|
|
7869
8083
|
</p>
|
|
@@ -7883,16 +8097,18 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7883
8097
|
<div
|
|
7884
8098
|
key={index}
|
|
7885
8099
|
className={\`\${P}-item\`.trim()}
|
|
7886
|
-
style={
|
|
8100
|
+
style={itemStyle}
|
|
7887
8101
|
>
|
|
7888
8102
|
<div
|
|
7889
|
-
|
|
7890
|
-
|
|
8103
|
+
ref={(el) => { itemInnerRefs.current[index] = el; }}
|
|
8104
|
+
className={\`\${isEditMode
|
|
8105
|
+
? \`\${P}-item-inner\`
|
|
7891
8106
|
: \`\${P}-item-inner-hidden\`}\${shouldAlignEntries && isLastRow ? \` \${P}-item-inner-last-row\` : ''}\`.trim()}
|
|
7892
8107
|
style={{
|
|
7893
8108
|
width: (textBoxWidth ?? 0) > 100
|
|
7894
|
-
? \`calc(\${
|
|
7895
|
-
:
|
|
8109
|
+
? \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`
|
|
8110
|
+
: itemWidthScaled,
|
|
8111
|
+
...(customSlot && !isTextOutside ? { height: scalingValue(customSlot.height, isEditor) } : {}),
|
|
7896
8112
|
...(gridColumn && shouldAlignEntries ? { gridColumn } : {}),
|
|
7897
8113
|
}}
|
|
7898
8114
|
>
|
|
@@ -7938,7 +8154,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7938
8154
|
{(!isEditor || isPreviewMode) && lightboxOpen && typeof document !== 'undefined' && lightbox === 'on' && (() => {
|
|
7939
8155
|
const portalTarget = (portalId ? document.getElementById(portalId) : null) ?? document.body;
|
|
7940
8156
|
return createPortal(
|
|
7941
|
-
<div style={
|
|
8157
|
+
<div style={getLightboxPortalStyle()} data-selection="none">
|
|
7942
8158
|
<Lightbox
|
|
7943
8159
|
prefix={P}
|
|
7944
8160
|
items={lightboxItems}
|
|
@@ -7975,17 +8191,36 @@ type GridLayoutConfig = {
|
|
|
7975
8191
|
lockedParam?: 'wrapperWidth' | 'entryWidth' | 'horizontalGap' | null;
|
|
7976
8192
|
};
|
|
7977
8193
|
|
|
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
|
+
|
|
7978
8212
|
type GridSettings = {
|
|
7979
8213
|
type: 'a' | 'b' | 'c' | 'd' | 'e' | 'f';
|
|
7980
|
-
gridLayout
|
|
8214
|
+
gridLayout?: GridLayoutConfig;
|
|
8215
|
+
customGrid?: CustomGridLayout;
|
|
7981
8216
|
textBoxWidth: number;
|
|
7982
|
-
verticalGap
|
|
7983
|
-
entriesCount
|
|
8217
|
+
verticalGap?: number;
|
|
8218
|
+
entriesCount?: number;
|
|
7984
8219
|
lightbox: 'on' | 'off';
|
|
7985
|
-
imageDisplay: {
|
|
8220
|
+
imageDisplay: 'fit' | 'cover' | {
|
|
7986
8221
|
display: 'fit' | 'cover';
|
|
7987
|
-
ratioValue
|
|
7988
|
-
reversed
|
|
8222
|
+
ratioValue?: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
|
|
8223
|
+
reversed?: boolean;
|
|
7989
8224
|
};
|
|
7990
8225
|
imageCorners?: number;
|
|
7991
8226
|
lightboxImageDisplay?: 'fit' | 'cover' | { display?: 'fit' | 'cover' };
|
|
@@ -7995,8 +8230,9 @@ type GridSettings = {
|
|
|
7995
8230
|
transition: 'fade' | 'slide',
|
|
7996
8231
|
showText: 'always' | 'on hover';
|
|
7997
8232
|
hover?: 'none' | 'zoom-in' | 'greyscale' | 'scale-down';
|
|
7998
|
-
alignEntries
|
|
8233
|
+
alignEntries?: 'on' | 'off';
|
|
7999
8234
|
align?: 'top' | 'center' | 'bottom';
|
|
8235
|
+
textGrowth?: 'inside' | 'outside';
|
|
8000
8236
|
titleMarginTop: number;
|
|
8001
8237
|
subtitleMarginTop: number;
|
|
8002
8238
|
titleColor: string;
|
|
@@ -8043,7 +8279,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
8043
8279
|
};
|
|
8044
8280
|
|
|
8045
8281
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
8046
|
-
`,
|
|
8282
|
+
`, R = `import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
|
|
8047
8283
|
import { CommonComponentProps } from '../props';
|
|
8048
8284
|
import { scalingValue } from '../utils/scalingValue';
|
|
8049
8285
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -8616,7 +8852,7 @@ export function Helix({
|
|
|
8616
8852
|
</>
|
|
8617
8853
|
);
|
|
8618
8854
|
}
|
|
8619
|
-
`,
|
|
8855
|
+
`, M = `import { CommonComponentProps } from '../props';
|
|
8620
8856
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
|
|
8621
8857
|
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
8622
8858
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -11068,7 +11304,7 @@ export function Hive({
|
|
|
11068
11304
|
</>
|
|
11069
11305
|
);
|
|
11070
11306
|
}
|
|
11071
|
-
`,
|
|
11307
|
+
`, L = `import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
|
|
11072
11308
|
import { createPortal } from 'react-dom';
|
|
11073
11309
|
import { CommonComponentProps } from '../props';
|
|
11074
11310
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -11871,7 +12107,7 @@ export type LightboxJournalSettings = {
|
|
|
11871
12107
|
closeIconColor: string;
|
|
11872
12108
|
closeIconHoverColor: string;
|
|
11873
12109
|
};
|
|
11874
|
-
`,
|
|
12110
|
+
`, k = `import { useEffect, useRef, useState, type MouseEvent } from 'react';
|
|
11875
12111
|
import { createPortal } from 'react-dom';
|
|
11876
12112
|
import { CommonComponentProps } from '../props';
|
|
11877
12113
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -12455,7 +12691,7 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
|
|
|
12455
12691
|
</>
|
|
12456
12692
|
);
|
|
12457
12693
|
};
|
|
12458
|
-
`,
|
|
12694
|
+
`, A = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
12459
12695
|
import { createPortal } from 'react-dom';
|
|
12460
12696
|
import { CommonComponentProps } from '../props';
|
|
12461
12697
|
import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -15560,7 +15796,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
|
|
|
15560
15796
|
</>
|
|
15561
15797
|
);
|
|
15562
15798
|
}
|
|
15563
|
-
`,
|
|
15799
|
+
`, N = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
15564
15800
|
import cn from 'classnames';
|
|
15565
15801
|
import { CommonComponentProps } from '../props';
|
|
15566
15802
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -16418,7 +16654,7 @@ type MarqueeProps = {
|
|
|
16418
16654
|
isPreviewMode?: boolean;
|
|
16419
16655
|
isEditMode?: boolean;
|
|
16420
16656
|
} & CommonComponentProps;
|
|
16421
|
-
`,
|
|
16657
|
+
`, H = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
|
|
16422
16658
|
import cn from 'classnames';
|
|
16423
16659
|
import { CommonComponentProps } from '../props';
|
|
16424
16660
|
import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -17361,7 +17597,7 @@ type MarqueeTextProps = {
|
|
|
17361
17597
|
isPreviewMode?: boolean;
|
|
17362
17598
|
isEditMode?: boolean;
|
|
17363
17599
|
} & CommonComponentProps;
|
|
17364
|
-
`,
|
|
17600
|
+
`, O = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
17365
17601
|
import { createPortal } from 'react-dom';
|
|
17366
17602
|
import type React from 'react';
|
|
17367
17603
|
import { CommonComponentProps } from '../props';
|
|
@@ -19843,7 +20079,7 @@ export function Mercury({
|
|
|
19843
20079
|
</>
|
|
19844
20080
|
);
|
|
19845
20081
|
}
|
|
19846
|
-
`,
|
|
20082
|
+
`, _ = `import React, { useMemo, useState } from 'react';
|
|
19847
20083
|
import { CommonComponentProps } from '../props';
|
|
19848
20084
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
19849
20085
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -20422,7 +20658,7 @@ const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {
|
|
|
20422
20658
|
};
|
|
20423
20659
|
|
|
20424
20660
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
20425
|
-
`,
|
|
20661
|
+
`, F = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
20426
20662
|
import type React from 'react';
|
|
20427
20663
|
import { CommonComponentProps } from '../props';
|
|
20428
20664
|
import { scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -21261,7 +21497,7 @@ export function Pretext({ settings, content, isEditor, isPreviewMode, isEditMode
|
|
|
21261
21497
|
</>
|
|
21262
21498
|
);
|
|
21263
21499
|
}
|
|
21264
|
-
`,
|
|
21500
|
+
`, W = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
21265
21501
|
import cn from 'classnames';
|
|
21266
21502
|
import { CommonComponentProps } from '../props';
|
|
21267
21503
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -21889,7 +22125,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
21889
22125
|
</>
|
|
21890
22126
|
);
|
|
21891
22127
|
}
|
|
21892
|
-
`,
|
|
22128
|
+
`, D = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
|
|
21893
22129
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
21894
22130
|
import { CommonComponentProps } from '../props';
|
|
21895
22131
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
@@ -22521,7 +22757,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
22521
22757
|
</>
|
|
22522
22758
|
);
|
|
22523
22759
|
}
|
|
22524
|
-
`,
|
|
22760
|
+
`, B = `import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
22525
22761
|
import cn from 'classnames';
|
|
22526
22762
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
22527
22763
|
import { scalingValue } from '../utils/scalingValue';
|
|
@@ -23703,7 +23939,7 @@ function ArrowIcon({ color, className }: { color: string, className: string }) {
|
|
|
23703
23939
|
</svg>
|
|
23704
23940
|
);
|
|
23705
23941
|
}
|
|
23706
|
-
`,
|
|
23942
|
+
`, z = `import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
23707
23943
|
import cn from 'classnames';
|
|
23708
23944
|
import { CommonComponentProps } from '../props';
|
|
23709
23945
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -24334,7 +24570,7 @@ type TestimonialsSettings = {
|
|
|
24334
24570
|
logoHeight: number;
|
|
24335
24571
|
captionMarginTop: number;
|
|
24336
24572
|
};
|
|
24337
|
-
`,
|
|
24573
|
+
`, V = `import cn from 'classnames';
|
|
24338
24574
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
24339
24575
|
import { CommonComponentProps } from '../props';
|
|
24340
24576
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -24830,7 +25066,7 @@ type TestimonialsSettings = {
|
|
|
24830
25066
|
icon?: string | null;
|
|
24831
25067
|
};
|
|
24832
25068
|
};
|
|
24833
|
-
`,
|
|
25069
|
+
`, G = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
24834
25070
|
import type React from 'react';
|
|
24835
25071
|
import { createPortal } from 'react-dom';
|
|
24836
25072
|
import { CommonComponentProps } from '../props';
|
|
@@ -25363,30 +25599,31 @@ export function Waterfall({
|
|
|
25363
25599
|
</>
|
|
25364
25600
|
);
|
|
25365
25601
|
}
|
|
25366
|
-
`,
|
|
25367
|
-
[
|
|
25368
|
-
[
|
|
25369
|
-
[
|
|
25370
|
-
[
|
|
25371
|
-
[
|
|
25372
|
-
[
|
|
25373
|
-
[
|
|
25374
|
-
[
|
|
25375
|
-
[
|
|
25376
|
-
[
|
|
25377
|
-
[
|
|
25378
|
-
[
|
|
25379
|
-
[
|
|
25380
|
-
[
|
|
25381
|
-
[
|
|
25382
|
-
[
|
|
25383
|
-
[
|
|
25384
|
-
[
|
|
25385
|
-
[
|
|
25386
|
-
[
|
|
25387
|
-
[
|
|
25388
|
-
[
|
|
25602
|
+
`, K = {
|
|
25603
|
+
[C.id]: w,
|
|
25604
|
+
[S.id]: $,
|
|
25605
|
+
[y.id]: I,
|
|
25606
|
+
[b.id]: n,
|
|
25607
|
+
[x.id]: E,
|
|
25608
|
+
[P.id]: T,
|
|
25609
|
+
[v.id]: n,
|
|
25610
|
+
[f.id]: R,
|
|
25611
|
+
[h.id]: M,
|
|
25612
|
+
[p.id]: L,
|
|
25613
|
+
[m.id]: k,
|
|
25614
|
+
[g.id]: A,
|
|
25615
|
+
[u.id]: N,
|
|
25616
|
+
[d.id]: H,
|
|
25617
|
+
[c.id]: O,
|
|
25618
|
+
[l.id]: _,
|
|
25619
|
+
[s.id]: F,
|
|
25620
|
+
[a.id]: W,
|
|
25621
|
+
[r.id]: D,
|
|
25622
|
+
[o.id]: B,
|
|
25623
|
+
[i.id]: z,
|
|
25624
|
+
[t.id]: V,
|
|
25625
|
+
[e.id]: G
|
|
25389
25626
|
};
|
|
25390
25627
|
export {
|
|
25391
|
-
|
|
25628
|
+
K as componentSources
|
|
25392
25629
|
};
|