@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.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./ChroniclesComponent-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./ChroniclesComponent-BMbUwzk6.js"),t=`import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
|
|
2
2
|
import { CommonComponentProps } from '../props';
|
|
3
3
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
4
4
|
import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
|
|
@@ -27,12 +27,11 @@ type BurgerShowInValue = string | Record<string, string>;
|
|
|
27
27
|
|
|
28
28
|
type BurgerLink = {
|
|
29
29
|
link?: {
|
|
30
|
-
type?: 'url' | 'page' | 'anchor'
|
|
30
|
+
type?: 'url' | 'page' | 'anchor';
|
|
31
31
|
value?: string;
|
|
32
32
|
target?: string;
|
|
33
33
|
anchor?: string;
|
|
34
34
|
url?: string;
|
|
35
|
-
download?: string;
|
|
36
35
|
};
|
|
37
36
|
mode?: 'page' | 'url';
|
|
38
37
|
page?: string;
|
|
@@ -257,11 +256,10 @@ function isBlankTarget(target?: string): boolean {
|
|
|
257
256
|
}
|
|
258
257
|
|
|
259
258
|
function getBurgerDest(item: BurgerLink): {
|
|
260
|
-
type: 'url' | 'page' | 'anchor'
|
|
259
|
+
type: 'url' | 'page' | 'anchor';
|
|
261
260
|
value: string;
|
|
262
261
|
target?: '_blank';
|
|
263
262
|
anchor?: string;
|
|
264
|
-
download?: string;
|
|
265
263
|
} {
|
|
266
264
|
const dest = item.link;
|
|
267
265
|
if (dest && typeof dest === 'object') {
|
|
@@ -275,12 +273,8 @@ function getBurgerDest(item: BurgerLink): {
|
|
|
275
273
|
if (dest.type === 'page') {
|
|
276
274
|
return { type: 'page', value: dest.value ?? '', target, anchor: dest.anchor };
|
|
277
275
|
}
|
|
278
|
-
if (dest.type === 'file') {
|
|
279
|
-
return { type: 'file', value: dest.value ?? '' };
|
|
280
|
-
}
|
|
281
|
-
// a published file link comes as its file's url, with the name to download it under
|
|
282
276
|
if (typeof dest.url === 'string') {
|
|
283
|
-
return { type: 'url', value: dest.url, target
|
|
277
|
+
return { type: 'url', value: dest.url, target };
|
|
284
278
|
}
|
|
285
279
|
}
|
|
286
280
|
const target = isBlankTarget(item.openIn) ? '_blank' : undefined;
|
|
@@ -301,17 +295,12 @@ function resolveBurgerLink(item: BurgerLink, pages?: BurgerPageRef[]): {
|
|
|
301
295
|
label: string;
|
|
302
296
|
href: string;
|
|
303
297
|
target?: '_blank';
|
|
304
|
-
download?: string;
|
|
305
298
|
} {
|
|
306
299
|
const label = item.label || 'Link';
|
|
307
300
|
const dest = getBurgerDest(item);
|
|
308
301
|
|
|
309
302
|
if (dest.type === 'url') {
|
|
310
|
-
return { label, href: dest.value, target: dest.target
|
|
311
|
-
}
|
|
312
|
-
if (dest.type === 'file') {
|
|
313
|
-
// only the editor sees a file by its id, and downloads it through onLinkNavigate, right on the click
|
|
314
|
-
return { label, href: dest.value ? '#' : '', target: '_blank' };
|
|
303
|
+
return { label, href: dest.value, target: dest.target };
|
|
315
304
|
}
|
|
316
305
|
if (dest.type === 'anchor') {
|
|
317
306
|
const anchor = dest.value.replace(/^#/, '');
|
|
@@ -923,11 +912,10 @@ function renderTextPaddingControls(
|
|
|
923
912
|
type ColorKeys = 'iconColor' | 'closeButtonColor' | 'linkColor' | 'openLinkColor' | 'compactIconColor' | 'compactLinkColor' | 'compactLogoColor' | 'compactBackgroundColor' | 'openLogoColor' | 'menuBackgroundColor' | 'overlayColor' | 'backgroundColor' | 'logoColor';
|
|
924
913
|
|
|
925
914
|
export type BurgerLinkNavigateEvent = {
|
|
926
|
-
mode: 'page' | 'url'
|
|
915
|
+
mode: 'page' | 'url';
|
|
927
916
|
href: string;
|
|
928
917
|
page?: string;
|
|
929
918
|
url?: string;
|
|
930
|
-
file?: string;
|
|
931
919
|
anchor?: string;
|
|
932
920
|
target?: '_blank';
|
|
933
921
|
};
|
|
@@ -1779,28 +1767,6 @@ function findAnchorTarget(hash: string): HTMLElement | null {
|
|
|
1779
1767
|
return target instanceof HTMLElement ? target : null;
|
|
1780
1768
|
}
|
|
1781
1769
|
|
|
1782
|
-
// the file is on the cdn, another origin, where the download attribute alone opens it instead
|
|
1783
|
-
function downloadFile(url: string, name: string) {
|
|
1784
|
-
fetch(url)
|
|
1785
|
-
.then((response) => {
|
|
1786
|
-
if (!response.ok) throw new Error(\`Could not download \${url}: \${response.status}\`);
|
|
1787
|
-
return response.blob();
|
|
1788
|
-
})
|
|
1789
|
-
.then((blob) => {
|
|
1790
|
-
const objectUrl = URL.createObjectURL(blob);
|
|
1791
|
-
const link = document.createElement('a');
|
|
1792
|
-
link.href = objectUrl;
|
|
1793
|
-
link.download = name || decodeURIComponent(url.split('?')[0].split('/').pop() ?? '');
|
|
1794
|
-
document.body.appendChild(link);
|
|
1795
|
-
link.click();
|
|
1796
|
-
link.remove();
|
|
1797
|
-
window.setTimeout(() => URL.revokeObjectURL(objectUrl), 0);
|
|
1798
|
-
})
|
|
1799
|
-
.catch(() => {
|
|
1800
|
-
window.location.assign(url);
|
|
1801
|
-
});
|
|
1802
|
-
}
|
|
1803
|
-
|
|
1804
1770
|
function scrollToAnchor(hash: string): boolean {
|
|
1805
1771
|
const target = findAnchorTarget(hash);
|
|
1806
1772
|
if (!target) return false;
|
|
@@ -1834,11 +1800,10 @@ function handleLinkClick(
|
|
|
1834
1800
|
const resolved = resolveBurgerLink(item, pages);
|
|
1835
1801
|
const dest = getBurgerDest(item);
|
|
1836
1802
|
const navigateEvent: BurgerLinkNavigateEvent = {
|
|
1837
|
-
mode: dest.type === 'url'
|
|
1803
|
+
mode: dest.type === 'url' ? 'url' : 'page',
|
|
1838
1804
|
href: resolved.href || href,
|
|
1839
1805
|
page: dest.type === 'page' ? dest.value : undefined,
|
|
1840
1806
|
url: dest.type === 'url' ? dest.value : undefined,
|
|
1841
|
-
file: dest.type === 'file' ? dest.value : undefined,
|
|
1842
1807
|
anchor: dest.type === 'anchor'
|
|
1843
1808
|
? dest.value.replace(/^#/, '')
|
|
1844
1809
|
: (dest.anchor ?? '').replace(/^#/, ''),
|
|
@@ -1860,14 +1825,6 @@ function handleLinkClick(
|
|
|
1860
1825
|
return;
|
|
1861
1826
|
}
|
|
1862
1827
|
|
|
1863
|
-
const download = item ? getBurgerDest(item).download : undefined;
|
|
1864
|
-
if (download !== undefined && href && !event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey) {
|
|
1865
|
-
event.preventDefault();
|
|
1866
|
-
downloadFile(href, download);
|
|
1867
|
-
onClose();
|
|
1868
|
-
return;
|
|
1869
|
-
}
|
|
1870
|
-
|
|
1871
1828
|
if (!opensInNewTab && hash && isSameDocumentHref(href) && findAnchorTarget(hash)) {
|
|
1872
1829
|
event.preventDefault();
|
|
1873
1830
|
runAfterClose(() => scrollToAnchor(hash));
|
|
@@ -2473,13 +2430,12 @@ export function Burger({
|
|
|
2473
2430
|
const showOpenNavControls = showControls && isOpen;
|
|
2474
2431
|
|
|
2475
2432
|
const renderOpenNavItems = (linkClassName: string) => items.filter((item) => isVisibleInOpenNav(item, layoutId)).map((item, index) => {
|
|
2476
|
-
const { label, href, target
|
|
2433
|
+
const { label, href, target } = resolveBurgerLink(item, pages);
|
|
2477
2434
|
const linkNode = href ? (
|
|
2478
2435
|
<a
|
|
2479
2436
|
href={href}
|
|
2480
2437
|
target={target}
|
|
2481
2438
|
rel={target === '_blank' ? 'noopener noreferrer' : undefined}
|
|
2482
|
-
download={download}
|
|
2483
2439
|
className={\`\${linkClassName} \${P}-has-href\`}
|
|
2484
2440
|
onClick={(event) => onNavLinkClick(event, item)}
|
|
2485
2441
|
>
|
|
@@ -2591,7 +2547,7 @@ export function Burger({
|
|
|
2591
2547
|
};
|
|
2592
2548
|
|
|
2593
2549
|
const renderNavLink = (item: BurgerLink, index: number) => {
|
|
2594
|
-
const { label, href, target
|
|
2550
|
+
const { label, href, target } = resolveBurgerLink(item, pages);
|
|
2595
2551
|
const textContent = (
|
|
2596
2552
|
<span className={navLinkTextClassName} style={navLinkTextStyle}>
|
|
2597
2553
|
{renderMultilineText(label)}
|
|
@@ -2610,7 +2566,6 @@ export function Burger({
|
|
|
2610
2566
|
href={href}
|
|
2611
2567
|
target={target}
|
|
2612
2568
|
rel={target === '_blank' ? 'noopener noreferrer' : undefined}
|
|
2613
|
-
download={download}
|
|
2614
2569
|
className={\`\${P}-nav-link \${P}-has-href\`}
|
|
2615
2570
|
onClick={(event) => onNavLinkClick(event, item)}
|
|
2616
2571
|
>
|
|
@@ -2728,7 +2683,7 @@ export function Burger({
|
|
|
2728
2683
|
</div>
|
|
2729
2684
|
);
|
|
2730
2685
|
}
|
|
2731
|
-
`,
|
|
2686
|
+
`,i=`import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
|
|
2732
2687
|
import { createPortal } from 'react-dom';
|
|
2733
2688
|
import cn from 'classnames';
|
|
2734
2689
|
import { CommonComponentProps } from '../props';
|
|
@@ -3775,7 +3730,7 @@ export function Chronicles({
|
|
|
3775
3730
|
</>
|
|
3776
3731
|
);
|
|
3777
3732
|
}
|
|
3778
|
-
`,
|
|
3733
|
+
`,o=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3779
3734
|
import { CommonComponentProps } from '../props';
|
|
3780
3735
|
import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
|
|
3781
3736
|
|
|
@@ -4304,7 +4259,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
4304
4259
|
</>
|
|
4305
4260
|
);
|
|
4306
4261
|
}
|
|
4307
|
-
`,
|
|
4262
|
+
`,r=`import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4308
4263
|
import cn from 'classnames';
|
|
4309
4264
|
import { CommonComponentProps } from '../props';
|
|
4310
4265
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -5048,7 +5003,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
|
|
|
5048
5003
|
</>
|
|
5049
5004
|
);
|
|
5050
5005
|
}
|
|
5051
|
-
`,
|
|
5006
|
+
`,a=`import React, { useMemo, useState } from 'react';
|
|
5052
5007
|
import { CommonComponentProps } from '../props';
|
|
5053
5008
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
5054
5009
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -5686,9 +5641,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
5686
5641
|
};
|
|
5687
5642
|
|
|
5688
5643
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
5689
|
-
`,
|
|
5690
|
-
import '@splidejs/react-splide/css/core';
|
|
5691
|
-
import { CommonComponentProps } from '../props';
|
|
5644
|
+
`,e=`import { CommonComponentProps } from '../props';
|
|
5692
5645
|
import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
|
|
5693
5646
|
import {
|
|
5694
5647
|
buildColorVars,
|
|
@@ -5698,7 +5651,7 @@ import {
|
|
|
5698
5651
|
useLazyVideos,
|
|
5699
5652
|
useScopedStyles,
|
|
5700
5653
|
} from '../utils/index';
|
|
5701
|
-
import { useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
|
|
5654
|
+
import { memo, useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
|
|
5702
5655
|
import { createPortal } from 'react-dom';
|
|
5703
5656
|
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
5704
5657
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
@@ -5815,15 +5768,19 @@ function getCSS(P: string): string {
|
|
|
5815
5768
|
width: 100%;
|
|
5816
5769
|
overflow: hidden;
|
|
5817
5770
|
}
|
|
5818
|
-
.\${P}-item-slider .splide__track {
|
|
5819
|
-
overflow: hidden;
|
|
5820
|
-
}
|
|
5821
5771
|
.\${P}-item-image-link {
|
|
5822
5772
|
width: 100%;
|
|
5823
5773
|
display: flex;
|
|
5824
5774
|
flex-direction: column;
|
|
5825
5775
|
align-items: center;
|
|
5826
5776
|
}
|
|
5777
|
+
.\${P}-custom-layout .\${P}-item-image-link {
|
|
5778
|
+
flex: 1 1 0%;
|
|
5779
|
+
min-height: 0;
|
|
5780
|
+
}
|
|
5781
|
+
.\${P}-custom-layout.\${P}-text-outside .\${P}-item-image-link {
|
|
5782
|
+
flex: none;
|
|
5783
|
+
}
|
|
5827
5784
|
.\${P}-item-text-link {
|
|
5828
5785
|
display: flex;
|
|
5829
5786
|
flex-direction: column;
|
|
@@ -5844,18 +5801,47 @@ function getCSS(P: string): string {
|
|
|
5844
5801
|
display: block;
|
|
5845
5802
|
max-width: 100%;
|
|
5846
5803
|
}
|
|
5847
|
-
.\${P}-item-slider
|
|
5848
|
-
|
|
5849
|
-
.\${P}-item-slider .splide__list,
|
|
5850
|
-
.\${P}-item-slider .splide__slide {
|
|
5804
|
+
.\${P}-item-slider {
|
|
5805
|
+
position: relative;
|
|
5851
5806
|
width: 100%;
|
|
5852
5807
|
height: 100%;
|
|
5808
|
+
overflow: hidden;
|
|
5809
|
+
}
|
|
5810
|
+
.\${P}-item-slider-list {
|
|
5811
|
+
position: relative;
|
|
5812
|
+
display: flex;
|
|
5813
|
+
flex-direction: row;
|
|
5814
|
+
width: 100%;
|
|
5815
|
+
height: 100%;
|
|
5816
|
+
will-change: transform;
|
|
5853
5817
|
}
|
|
5854
|
-
.\${P}-item-slider
|
|
5818
|
+
.\${P}-item-slider-list-vertical {
|
|
5819
|
+
flex-direction: column;
|
|
5820
|
+
}
|
|
5821
|
+
.\${P}-item-slider-list-fade {
|
|
5822
|
+
display: block;
|
|
5823
|
+
will-change: auto;
|
|
5824
|
+
}
|
|
5825
|
+
.\${P}-item-slide {
|
|
5826
|
+
position: relative;
|
|
5827
|
+
flex: 0 0 100%;
|
|
5828
|
+
width: 100%;
|
|
5829
|
+
height: 100%;
|
|
5855
5830
|
display: flex;
|
|
5856
5831
|
justify-content: center;
|
|
5857
5832
|
align-items: center;
|
|
5858
5833
|
}
|
|
5834
|
+
.\${P}-item-slider-list-fade .\${P}-item-slide {
|
|
5835
|
+
position: absolute;
|
|
5836
|
+
top: 0;
|
|
5837
|
+
left: 0;
|
|
5838
|
+
opacity: 0;
|
|
5839
|
+
transition: opacity \${SLIDER_TRANSITION_MS}ms \${SLIDER_EASING};
|
|
5840
|
+
}
|
|
5841
|
+
.\${P}-item-slider-list-fade .\${P}-item-slide-active {
|
|
5842
|
+
opacity: 1;
|
|
5843
|
+
z-index: 1;
|
|
5844
|
+
}
|
|
5859
5845
|
.\${P}-item-title {
|
|
5860
5846
|
white-space: normal;
|
|
5861
5847
|
overflow-wrap: anywhere;
|
|
@@ -6002,13 +5988,13 @@ function getCSS(P: string): string {
|
|
|
6002
5988
|
.\${P}-image-align-bottom .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
|
|
6003
5989
|
align-items: flex-end;
|
|
6004
5990
|
}
|
|
6005
|
-
.\${P}-image-align-top .\${P}-item-slider
|
|
5991
|
+
.\${P}-image-align-top .\${P}-item-slider .\${P}-item-slide {
|
|
6006
5992
|
align-items: flex-start;
|
|
6007
5993
|
}
|
|
6008
|
-
.\${P}-image-align-center .\${P}-item-slider
|
|
5994
|
+
.\${P}-image-align-center .\${P}-item-slider .\${P}-item-slide {
|
|
6009
5995
|
align-items: center;
|
|
6010
5996
|
}
|
|
6011
|
-
.\${P}-image-align-bottom .\${P}-item-slider
|
|
5997
|
+
.\${P}-image-align-bottom .\${P}-item-slider .\${P}-item-slide {
|
|
6012
5998
|
align-items: flex-end;
|
|
6013
5999
|
}
|
|
6014
6000
|
.\${P}-align-entries .\${P}-item {
|
|
@@ -6089,13 +6075,13 @@ function getCSS(P: string): string {
|
|
|
6089
6075
|
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
|
|
6090
6076
|
align-items: flex-end;
|
|
6091
6077
|
}
|
|
6092
|
-
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider
|
|
6078
|
+
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
|
|
6093
6079
|
align-items: flex-start;
|
|
6094
6080
|
}
|
|
6095
|
-
.\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider
|
|
6081
|
+
.\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
|
|
6096
6082
|
align-items: center;
|
|
6097
6083
|
}
|
|
6098
|
-
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider
|
|
6084
|
+
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
|
|
6099
6085
|
align-items: flex-end;
|
|
6100
6086
|
}
|
|
6101
6087
|
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-image-link {
|
|
@@ -6163,27 +6149,9 @@ function pickRandomSlideDirection(): 'ltr' | 'ttb' {
|
|
|
6163
6149
|
return Math.random() < 0.5 ? 'ltr' : 'ttb';
|
|
6164
6150
|
}
|
|
6165
6151
|
|
|
6166
|
-
function
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
autoplay.pause(false);
|
|
6170
|
-
autoplay.play();
|
|
6171
|
-
}
|
|
6172
|
-
|
|
6173
|
-
function handleRandomSlideMoved(splide: {
|
|
6174
|
-
options: { direction?: string };
|
|
6175
|
-
Components: { Autoplay?: { pause: (stop?: boolean) => void; play: () => void } };
|
|
6176
|
-
}) {
|
|
6177
|
-
const next = pickRandomSlideDirection();
|
|
6178
|
-
if (splide.options.direction !== next) {
|
|
6179
|
-
splide.options = { ...splide.options, direction: next };
|
|
6180
|
-
}
|
|
6181
|
-
|
|
6182
|
-
requestAnimationFrame(() => {
|
|
6183
|
-
requestAnimationFrame(() => {
|
|
6184
|
-
resumeSplideAutoplay(splide);
|
|
6185
|
-
});
|
|
6186
|
-
});
|
|
6152
|
+
function wrapSlideIndex(index: number, count: number): number {
|
|
6153
|
+
if (count <= 0) return 0;
|
|
6154
|
+
return ((index % count) + count) % count;
|
|
6187
6155
|
}
|
|
6188
6156
|
|
|
6189
6157
|
type GridProps = {
|
|
@@ -6223,6 +6191,8 @@ type LightboxProps = {
|
|
|
6223
6191
|
|
|
6224
6192
|
const LIGHTBOX_ANIM_MS = 500;
|
|
6225
6193
|
const SLIDER_TRANSITION_MS = 750;
|
|
6194
|
+
const SLIDER_EASING = 'cubic-bezier(0.25, 1, 0.5, 1)';
|
|
6195
|
+
const SLIDER_DEFAULT_INTERVAL_MS = 5000;
|
|
6226
6196
|
const LIGHTBOX_EASING = 'cubic-bezier(0.22, 1, 0.36, 1)';
|
|
6227
6197
|
const SWIPE_CLOSE_THRESHOLD = 72;
|
|
6228
6198
|
const SWIPE_NAV_THRESHOLD = 50;
|
|
@@ -6312,7 +6282,7 @@ function collectGridLightboxMedia(content: any[]): GridMedia[] {
|
|
|
6312
6282
|
return result;
|
|
6313
6283
|
}
|
|
6314
6284
|
|
|
6315
|
-
function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
6285
|
+
const LightboxMediaPreloadPool = memo(function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
6316
6286
|
const [pool, setPool] = useState<HTMLDivElement | null>(null);
|
|
6317
6287
|
useLazyVideos(pool, { preload: 'metadata' });
|
|
6318
6288
|
// an embed's player is only ever framed where it shows
|
|
@@ -6351,7 +6321,7 @@ function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
|
6351
6321
|
))}
|
|
6352
6322
|
</div>
|
|
6353
6323
|
);
|
|
6354
|
-
}
|
|
6324
|
+
});
|
|
6355
6325
|
|
|
6356
6326
|
function unloadVideoElement(video: HTMLVideoElement) {
|
|
6357
6327
|
video.pause();
|
|
@@ -6359,15 +6329,121 @@ function unloadVideoElement(video: HTMLVideoElement) {
|
|
|
6359
6329
|
video.load();
|
|
6360
6330
|
}
|
|
6361
6331
|
|
|
6362
|
-
const
|
|
6332
|
+
const GRID_SLIDE_CLASS = 'cntrl-grid-slide';
|
|
6333
|
+
const GRID_SLIDE_PLAYING_CLASS = 'cntrl-grid-slide-playing';
|
|
6334
|
+
const GRID_SLIDE_VIDEOS = \`.\${GRID_SLIDE_CLASS} video\`;
|
|
6363
6335
|
|
|
6364
6336
|
function shouldPlaySlideVideo(video: HTMLVideoElement): boolean {
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6337
|
+
return video.closest(\`.\${GRID_SLIDE_PLAYING_CLASS}\`) !== null;
|
|
6338
|
+
}
|
|
6339
|
+
|
|
6340
|
+
type GridEntrySliderProps = {
|
|
6341
|
+
prefix: string;
|
|
6342
|
+
slides: React.ReactNode[];
|
|
6343
|
+
isFade: boolean;
|
|
6344
|
+
direction: GridSettings['direction'];
|
|
6345
|
+
intervalMs: number;
|
|
6346
|
+
};
|
|
6347
|
+
|
|
6348
|
+
function GridEntrySlider({ prefix: P, slides, isFade, direction, intervalMs }: GridEntrySliderProps) {
|
|
6349
|
+
const count = slides.length;
|
|
6350
|
+
const hasClones = !isFade && count > 1;
|
|
6351
|
+
const isRandom = !isFade && direction === 'random';
|
|
6352
|
+
const delayMs = Number.isFinite(intervalMs) && intervalMs > 0 ? intervalMs : SLIDER_DEFAULT_INTERVAL_MS;
|
|
6353
|
+
const [position, setPosition] = useState(hasClones ? 1 : 0);
|
|
6354
|
+
const [axis, setAxis] = useState<'ltr' | 'ttb'>(!isFade && direction === 'vertical' ? 'ttb' : 'ltr');
|
|
6355
|
+
const [isMoving, setIsMoving] = useState(false);
|
|
6356
|
+
const [skipTransition, setSkipTransition] = useState(false);
|
|
6357
|
+
const [cycle, setCycle] = useState(0);
|
|
6358
|
+
const isMovingRef = useRef(false);
|
|
6359
|
+
|
|
6360
|
+
useEffect(() => {
|
|
6361
|
+
if (count < 2) return;
|
|
6362
|
+
const timeoutId = window.setTimeout(() => {
|
|
6363
|
+
if (isMovingRef.current) {
|
|
6364
|
+
setCycle(prev => prev + 1);
|
|
6365
|
+
return;
|
|
6366
|
+
}
|
|
6367
|
+
isMovingRef.current = true;
|
|
6368
|
+
setIsMoving(true);
|
|
6369
|
+
setSkipTransition(false);
|
|
6370
|
+
setPosition(prev => (hasClones ? prev + 1 : wrapSlideIndex(prev + 1, count)));
|
|
6371
|
+
if (!isRandom) setCycle(prev => prev + 1);
|
|
6372
|
+
}, delayMs);
|
|
6373
|
+
return () => window.clearTimeout(timeoutId);
|
|
6374
|
+
}, [count, cycle, delayMs, hasClones, isRandom]);
|
|
6375
|
+
|
|
6376
|
+
useEffect(() => {
|
|
6377
|
+
if (!isMoving) return;
|
|
6378
|
+
const timeoutId = window.setTimeout(() => {
|
|
6379
|
+
const isOnClone = hasClones && position === count + 1;
|
|
6380
|
+
const nextAxis = isRandom ? pickRandomSlideDirection() : axis;
|
|
6381
|
+
if (isOnClone || nextAxis !== axis) {
|
|
6382
|
+
setSkipTransition(true);
|
|
6383
|
+
if (isOnClone) setPosition(1);
|
|
6384
|
+
setAxis(nextAxis);
|
|
6385
|
+
}
|
|
6386
|
+
isMovingRef.current = false;
|
|
6387
|
+
setIsMoving(false);
|
|
6388
|
+
if (isRandom) setCycle(prev => prev + 1);
|
|
6389
|
+
}, SLIDER_TRANSITION_MS);
|
|
6390
|
+
return () => window.clearTimeout(timeoutId);
|
|
6391
|
+
}, [axis, count, hasClones, isMoving, isRandom, position]);
|
|
6392
|
+
|
|
6393
|
+
useEffect(() => {
|
|
6394
|
+
if (!skipTransition) return;
|
|
6395
|
+
let innerId = 0;
|
|
6396
|
+
const outerId = requestAnimationFrame(() => {
|
|
6397
|
+
innerId = requestAnimationFrame(() => setSkipTransition(false));
|
|
6398
|
+
});
|
|
6399
|
+
return () => {
|
|
6400
|
+
cancelAnimationFrame(outerId);
|
|
6401
|
+
cancelAnimationFrame(innerId);
|
|
6402
|
+
};
|
|
6403
|
+
}, [skipTransition]);
|
|
6404
|
+
|
|
6405
|
+
const slotsCount = hasClones ? count + 2 : count;
|
|
6406
|
+
const getItemIndex = (slot: number) => (hasClones ? wrapSlideIndex(slot - 1, count) : slot);
|
|
6407
|
+
const isCloneSlot = (slot: number) => hasClones && (slot === 0 || slot === count + 1);
|
|
6408
|
+
const activeIndex = getItemIndex(position);
|
|
6409
|
+
const nextSlot = position + 1 < slotsCount ? position + 1 : -1;
|
|
6410
|
+
const isPlayingSlot = (slot: number) => isFade
|
|
6411
|
+
|| (slot === position && !isCloneSlot(slot))
|
|
6412
|
+
|| slot === nextSlot
|
|
6413
|
+
|| (nextSlot >= 0 && !isCloneSlot(slot) && getItemIndex(slot) === getItemIndex(nextSlot));
|
|
6414
|
+
const isVertical = !isFade && axis === 'ttb';
|
|
6415
|
+
const listStyle: React.CSSProperties | undefined = isFade
|
|
6416
|
+
? undefined
|
|
6417
|
+
: {
|
|
6418
|
+
transform: isVertical
|
|
6419
|
+
? \`translate3d(0, \${-position * 100}%, 0)\`
|
|
6420
|
+
: \`translate3d(\${-position * 100}%, 0, 0)\`,
|
|
6421
|
+
transition: skipTransition ? 'none' : \`transform \${SLIDER_TRANSITION_MS}ms \${SLIDER_EASING}\`,
|
|
6422
|
+
};
|
|
6423
|
+
|
|
6424
|
+
return (
|
|
6425
|
+
<div className={\`\${P}-item-slider\`}>
|
|
6426
|
+
<div
|
|
6427
|
+
className={\`\${P}-item-slider-list\${isFade ? \` \${P}-item-slider-list-fade\` : ''}\${isVertical ? \` \${P}-item-slider-list-vertical\` : ''}\`}
|
|
6428
|
+
style={listStyle}
|
|
6429
|
+
>
|
|
6430
|
+
{Array.from({ length: slotsCount }, (_, slot) => {
|
|
6431
|
+
const itemIndex = getItemIndex(slot);
|
|
6432
|
+
const isClone = isCloneSlot(slot);
|
|
6433
|
+
const isShown = isFade ? itemIndex === activeIndex : slot === position;
|
|
6434
|
+
return (
|
|
6435
|
+
<div
|
|
6436
|
+
key={isClone ? \`clone-\${slot === 0 ? 'start' : 'end'}\` : \`slide-\${itemIndex}\`}
|
|
6437
|
+
className={\`\${P}-item-slide \${GRID_SLIDE_CLASS}\${isFade && isShown ? \` \${P}-item-slide-active\` : ''}\${isPlayingSlot(slot) ? \` \${GRID_SLIDE_PLAYING_CLASS}\` : ''}\`}
|
|
6438
|
+
aria-hidden={isShown ? undefined : true}
|
|
6439
|
+
>
|
|
6440
|
+
{slides[itemIndex]}
|
|
6441
|
+
</div>
|
|
6442
|
+
);
|
|
6443
|
+
})}
|
|
6444
|
+
</div>
|
|
6445
|
+
</div>
|
|
6446
|
+
);
|
|
6371
6447
|
}
|
|
6372
6448
|
|
|
6373
6449
|
function GridMediaItem({
|
|
@@ -6375,7 +6451,7 @@ function GridMediaItem({
|
|
|
6375
6451
|
className,
|
|
6376
6452
|
style,
|
|
6377
6453
|
hasLightbox,
|
|
6378
|
-
|
|
6454
|
+
isSliderSlide = false,
|
|
6379
6455
|
onMediaClick,
|
|
6380
6456
|
}: {
|
|
6381
6457
|
media: GridMedia;
|
|
@@ -6383,7 +6459,7 @@ function GridMediaItem({
|
|
|
6383
6459
|
style: React.CSSProperties;
|
|
6384
6460
|
/** An embed then plays here as a silent loop, and as it was set to in the lightbox. */
|
|
6385
6461
|
hasLightbox: boolean;
|
|
6386
|
-
|
|
6462
|
+
isSliderSlide?: boolean;
|
|
6387
6463
|
onMediaClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
6388
6464
|
}) {
|
|
6389
6465
|
if (isEmbedMedia(media)) {
|
|
@@ -6415,7 +6491,7 @@ function GridMediaItem({
|
|
|
6415
6491
|
playsInline: true,
|
|
6416
6492
|
onClick: onMediaClick,
|
|
6417
6493
|
};
|
|
6418
|
-
return
|
|
6494
|
+
return isSliderSlide
|
|
6419
6495
|
? <video {...videoProps} preload='none' />
|
|
6420
6496
|
: <LazyVideo {...videoProps} autoPlay />;
|
|
6421
6497
|
}
|
|
@@ -6444,7 +6520,7 @@ function GridItemMediaWrapper({
|
|
|
6444
6520
|
children: React.ReactNode;
|
|
6445
6521
|
}) {
|
|
6446
6522
|
const [wrapper, setWrapper] = useState<HTMLDivElement | null>(null);
|
|
6447
|
-
useLazyVideos(wrapper, { autoPlay: true, selector:
|
|
6523
|
+
useLazyVideos(wrapper, { autoPlay: true, selector: GRID_SLIDE_VIDEOS, shouldPlay: shouldPlaySlideVideo });
|
|
6448
6524
|
|
|
6449
6525
|
return (
|
|
6450
6526
|
<div ref={setWrapper} className={className} style={style}>
|
|
@@ -7345,11 +7421,108 @@ function resolveLightboxImageDisplay(
|
|
|
7345
7421
|
return value?.display === 'cover' ? 'cover' : 'fit';
|
|
7346
7422
|
}
|
|
7347
7423
|
|
|
7424
|
+
function getCustomGridSpanWidth(layout: CustomGridLayout, span: number): number {
|
|
7425
|
+
return layout.columnWidth * span + layout.gutterWidth * Math.max(0, span - 1);
|
|
7426
|
+
}
|
|
7427
|
+
|
|
7428
|
+
type CustomGridSlot = {
|
|
7429
|
+
column: number;
|
|
7430
|
+
span: number;
|
|
7431
|
+
width: number;
|
|
7432
|
+
top: number;
|
|
7433
|
+
height: number;
|
|
7434
|
+
gridColumn: string;
|
|
7435
|
+
};
|
|
7436
|
+
|
|
7437
|
+
function getCustomGridBlocksBottom(layout: CustomGridLayout): number {
|
|
7438
|
+
return layout.blocks.reduce((bottom, block) => Math.max(bottom, Math.max(0, block.top) + Math.max(0, block.height)), 0);
|
|
7439
|
+
}
|
|
7440
|
+
|
|
7441
|
+
function getCustomGridVerticalGap(layout: CustomGridLayout): number {
|
|
7442
|
+
if (typeof layout.verticalGap === 'number') return Math.max(0, layout.verticalGap);
|
|
7443
|
+
return Math.max(0, (layout.repeatHeight ?? 0) - getCustomGridBlocksBottom(layout));
|
|
7444
|
+
}
|
|
7445
|
+
|
|
7446
|
+
function getCustomGridSlot(layout: CustomGridLayout, index: number): CustomGridSlot {
|
|
7447
|
+
const block = layout.blocks[index % layout.blocks.length];
|
|
7448
|
+
const span = Math.min(Math.max(1, Math.round(block.span)), layout.columnsCount);
|
|
7449
|
+
const column = Math.min(Math.max(0, Math.round(block.column)), layout.columnsCount - span);
|
|
7450
|
+
return {
|
|
7451
|
+
column,
|
|
7452
|
+
span,
|
|
7453
|
+
width: getCustomGridSpanWidth(layout, span),
|
|
7454
|
+
top: Math.max(0, block.top),
|
|
7455
|
+
height: Math.max(0, block.height),
|
|
7456
|
+
gridColumn: \`\${column + 1} / span \${span}\`,
|
|
7457
|
+
};
|
|
7458
|
+
}
|
|
7459
|
+
|
|
7460
|
+
const EDGE_TOLERANCE = 1e-6;
|
|
7461
|
+
|
|
7462
|
+
function getCustomGridRows(layout: CustomGridLayout, entriesCount: number, entryHeights?: number[]) {
|
|
7463
|
+
const beat = layout.beat ?? 0;
|
|
7464
|
+
const onBeats = beat > 0 && !!entryHeights;
|
|
7465
|
+
const snapUp = (value: number) => Math.ceil(value / beat - 1e-3) * beat;
|
|
7466
|
+
const tracks: (number | 'auto')[] = [];
|
|
7467
|
+
const gridRows: string[] = [];
|
|
7468
|
+
const verticalGap = getCustomGridVerticalGap(layout);
|
|
7469
|
+
for (let groupStart = 0; groupStart < entriesCount; groupStart += layout.blocks.length) {
|
|
7470
|
+
if (groupStart > 0 && verticalGap > 0) tracks.push(verticalGap);
|
|
7471
|
+
const slots = Array.from(
|
|
7472
|
+
{ length: Math.min(layout.blocks.length, entriesCount - groupStart) },
|
|
7473
|
+
(_, index) => getCustomGridSlot(layout, groupStart + index),
|
|
7474
|
+
);
|
|
7475
|
+
const ends = slots.map((slot) => {
|
|
7476
|
+
const under = slots.filter(other => other.column < slot.column + slot.span
|
|
7477
|
+
&& slot.column < other.column + other.span
|
|
7478
|
+
&& other.top >= slot.top + slot.height - EDGE_TOLERANCE);
|
|
7479
|
+
return under.length > 0 ? Math.min(...under.map(other => other.top)) : undefined;
|
|
7480
|
+
});
|
|
7481
|
+
const tops = [0, ...slots.map(slot => slot.top)]
|
|
7482
|
+
.sort((a, b) => a - b)
|
|
7483
|
+
.filter((top, index, sorted) => index === 0 || top - sorted[index - 1] > EDGE_TOLERANCE);
|
|
7484
|
+
const isSame = (a: number, b: number) => Math.abs(a - b) <= EDGE_TOLERANCE;
|
|
7485
|
+
const getTop = (value: number) => tops.findIndex(top => isSame(top, value));
|
|
7486
|
+
const positions: number[] = [];
|
|
7487
|
+
let position = 0;
|
|
7488
|
+
const pushContentTrack = (isEnding: (end: number | undefined) => boolean) => {
|
|
7489
|
+
const ending = slots.flatMap((slot, index) => (isEnding(ends[index]) ? [{ slot, entry: groupStart + index }] : []));
|
|
7490
|
+
if (ending.length === 0) return;
|
|
7491
|
+
if (!onBeats) {
|
|
7492
|
+
tracks.push('auto');
|
|
7493
|
+
return;
|
|
7494
|
+
}
|
|
7495
|
+
const needed = Math.max(...ending.map(({ slot, entry }) => positions[getTop(slot.top)] + (entryHeights[entry] ?? 0)));
|
|
7496
|
+
const track = Math.max(0, snapUp(needed) - position);
|
|
7497
|
+
tracks.push(track);
|
|
7498
|
+
position += track;
|
|
7499
|
+
};
|
|
7500
|
+
const lines = tops.map((top, index) => {
|
|
7501
|
+
if (index > 0) {
|
|
7502
|
+
tracks.push(top - tops[index - 1]);
|
|
7503
|
+
position += top - tops[index - 1];
|
|
7504
|
+
}
|
|
7505
|
+
pushContentTrack(end => end !== undefined && isSame(end, top));
|
|
7506
|
+
positions.push(position);
|
|
7507
|
+
return tracks.length + 1;
|
|
7508
|
+
});
|
|
7509
|
+
pushContentTrack(end => end === undefined);
|
|
7510
|
+
const groupEnd = tracks.length + 1;
|
|
7511
|
+
const getLine = (value: number) => lines[getTop(value)];
|
|
7512
|
+
slots.forEach((slot, index) => {
|
|
7513
|
+
const end = ends[index];
|
|
7514
|
+
gridRows.push(\`\${getLine(slot.top)} / \${end === undefined ? groupEnd : getLine(end)}\`);
|
|
7515
|
+
});
|
|
7516
|
+
}
|
|
7517
|
+
return { tracks, gridRows };
|
|
7518
|
+
}
|
|
7519
|
+
|
|
7348
7520
|
export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, metadata, activeEvent, layoutId, portalId }: GridProps) {
|
|
7349
7521
|
const { prefix: P } = useScopedStyles();
|
|
7350
7522
|
const {
|
|
7351
7523
|
type = 'a',
|
|
7352
7524
|
gridLayout,
|
|
7525
|
+
customGrid,
|
|
7353
7526
|
textBoxWidth = 100,
|
|
7354
7527
|
verticalGap,
|
|
7355
7528
|
entriesCount,
|
|
@@ -7397,62 +7570,69 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7397
7570
|
hover = 'none',
|
|
7398
7571
|
alignEntries = 'off',
|
|
7399
7572
|
align = 'top',
|
|
7573
|
+
textGrowth = 'inside',
|
|
7400
7574
|
} = settings;
|
|
7401
7575
|
|
|
7402
|
-
const
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7576
|
+
const titleTextStyle = useMemo(() => ({
|
|
7577
|
+
...omitTextColors(textStylesToCss({
|
|
7578
|
+
fontSettings: {
|
|
7579
|
+
fontFamily: titleFontFamily,
|
|
7580
|
+
fontWeight: titleFontSettings?.fontWeight ?? 400,
|
|
7581
|
+
fontStyle: titleFontSettings?.fontStyle ?? 'normal',
|
|
7582
|
+
},
|
|
7583
|
+
fontSize: titleFontSize ?? 0.01,
|
|
7584
|
+
lineHeight: titleLineHeight,
|
|
7585
|
+
letterSpacing: titleLetterSpacing ?? 0,
|
|
7586
|
+
wordSpacing: titleWordSpacing ?? 0,
|
|
7587
|
+
textAppearance: titleTextAppearance,
|
|
7588
|
+
color: titleColor,
|
|
7589
|
+
}, isEditor)),
|
|
7590
|
+
...getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor),
|
|
7591
|
+
} as React.CSSProperties), [
|
|
7592
|
+
titleFontFamily, titleFontSettings, titleFontSize, titleLineHeight, titleLetterSpacing,
|
|
7593
|
+
titleWordSpacing, titleTextAppearance, titleColor, isEditor, P,
|
|
7594
|
+
]);
|
|
7419
7595
|
|
|
7420
|
-
const
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7596
|
+
const subtitleTextStyle = useMemo(() => ({
|
|
7597
|
+
...omitTextColors(textStylesToCss({
|
|
7598
|
+
fontSettings: {
|
|
7599
|
+
fontFamily: subtitleFontFamily,
|
|
7600
|
+
fontWeight: subtitleFontSettings?.fontWeight ?? 400,
|
|
7601
|
+
fontStyle: subtitleFontSettings?.fontStyle ?? 'normal',
|
|
7602
|
+
},
|
|
7603
|
+
fontSize: subtitleFontSize ?? 0.01,
|
|
7604
|
+
lineHeight: subtitleLineHeight,
|
|
7605
|
+
letterSpacing: subtitleLetterSpacing ?? 0,
|
|
7606
|
+
wordSpacing: subtitleWordSpacing ?? 0,
|
|
7607
|
+
textAppearance: subtitleTextAppearance,
|
|
7608
|
+
color: subtitleColor,
|
|
7609
|
+
}, isEditor)),
|
|
7610
|
+
...getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor),
|
|
7611
|
+
} as React.CSSProperties), [
|
|
7612
|
+
subtitleFontFamily, subtitleFontSettings, subtitleFontSize, subtitleLineHeight, subtitleLetterSpacing,
|
|
7613
|
+
subtitleWordSpacing, subtitleTextAppearance, subtitleColor, isEditor, P,
|
|
7614
|
+
]);
|
|
7437
7615
|
|
|
7438
|
-
const
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
const lightboxCounterFieldCss = {
|
|
7453
|
-
...lightboxCounterTypographyCss,
|
|
7616
|
+
const lightboxCounterFieldCss = useMemo(() => ({
|
|
7617
|
+
...omitTextColors(textStylesToCss({
|
|
7618
|
+
fontSettings: {
|
|
7619
|
+
fontFamily: lightboxCounterFontFamily,
|
|
7620
|
+
fontWeight: lightboxCounterFontSettings?.fontWeight ?? 400,
|
|
7621
|
+
fontStyle: lightboxCounterFontSettings?.fontStyle ?? 'normal',
|
|
7622
|
+
},
|
|
7623
|
+
fontSize: lightboxCounterFontSize ?? 0.01,
|
|
7624
|
+
lineHeight: lightboxCounterLineHeight,
|
|
7625
|
+
letterSpacing: lightboxCounterLetterSpacing ?? 0,
|
|
7626
|
+
wordSpacing: lightboxCounterWordSpacing ?? 0,
|
|
7627
|
+
textAppearance: lightboxCounterTextAppearance,
|
|
7628
|
+
color: lightboxCounterColor,
|
|
7629
|
+
}, isEditor)),
|
|
7454
7630
|
...getGridTextLeadingVars(lightboxCounterFontSize, lightboxCounterLineHeight, P, isEditor),
|
|
7455
|
-
} as React.CSSProperties
|
|
7631
|
+
} as React.CSSProperties), [
|
|
7632
|
+
lightboxCounterFontFamily, lightboxCounterFontSettings, lightboxCounterFontSize, lightboxCounterLineHeight,
|
|
7633
|
+
lightboxCounterLetterSpacing, lightboxCounterWordSpacing, lightboxCounterTextAppearance, lightboxCounterColor,
|
|
7634
|
+
isEditor, P,
|
|
7635
|
+
]);
|
|
7456
7636
|
|
|
7457
7637
|
const titleTextClassName = getGridTextClassName(
|
|
7458
7638
|
titleFontSize,
|
|
@@ -7466,8 +7646,6 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7466
7646
|
\`\${P}-item-subtitle\`,
|
|
7467
7647
|
\`\${P}-text-tight-leading\`,
|
|
7468
7648
|
);
|
|
7469
|
-
const titleTextLeadingVars = getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor);
|
|
7470
|
-
const subtitleTextLeadingVars = getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor);
|
|
7471
7649
|
const lightboxCounterClassName = getGridTextClassName(
|
|
7472
7650
|
lightboxCounterFontSize,
|
|
7473
7651
|
lightboxCounterLineHeight,
|
|
@@ -7475,42 +7653,56 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7475
7653
|
\`\${P}-text-tight-leading\`,
|
|
7476
7654
|
);
|
|
7477
7655
|
|
|
7478
|
-
const colorVars = buildColorVars(P, {
|
|
7656
|
+
const colorVars = useMemo(() => buildColorVars(P, {
|
|
7479
7657
|
titleColor,
|
|
7480
7658
|
subtitleColor,
|
|
7481
7659
|
lightboxCounterColor,
|
|
7482
|
-
}, COLOR_VAR_MAP, STATE_KEYS);
|
|
7660
|
+
}, COLOR_VAR_MAP, STATE_KEYS), [P, titleColor, subtitleColor, lightboxCounterColor]);
|
|
7483
7661
|
|
|
7484
7662
|
const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
|
|
7485
7663
|
const showTextOnHover = showText === 'on hover' && (!isEditor || isPreviewMode);
|
|
7486
7664
|
const hoverEffectClass = hover !== 'none' && (!isEditor || isPreviewMode) ? \` \${P}-hover-\${hover}\` : '';
|
|
7487
7665
|
const wrapperStateClasses = \`\${stateClass}\${showTextOnHover ? \` \${P}-show-text-hover\` : ''}\${hoverEffectClass}\`.trim();
|
|
7488
7666
|
|
|
7489
|
-
const
|
|
7667
|
+
const customLayout = customGrid && Array.isArray(customGrid.blocks) && customGrid.blocks.length > 0 ? customGrid : undefined;
|
|
7668
|
+
const resEntriesCount = customLayout || entriesCount === 0 ? Infinity : entriesCount;
|
|
7669
|
+
const isTextOutside = !!customLayout && textGrowth === 'outside';
|
|
7670
|
+
const itemInnerRefs = useRef<(HTMLDivElement | null)[]>([]);
|
|
7671
|
+
const [customEntryHeights, setCustomEntryHeights] = useState<number[]>([]);
|
|
7490
7672
|
|
|
7491
|
-
const cropContent = (content ?? []).slice(0, resEntriesCount);
|
|
7673
|
+
const cropContent = useMemo<any[]>(() => (content ?? []).slice(0, resEntriesCount), [content, resEntriesCount]);
|
|
7492
7674
|
const lightboxMediaToPreload = useMemo(
|
|
7493
7675
|
() => (lightbox === 'on' ? collectGridLightboxMedia(cropContent) : []),
|
|
7494
7676
|
[cropContent, lightbox],
|
|
7495
7677
|
);
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7678
|
+
const entriesMedia = useMemo(() => cropContent.map((item: any) => {
|
|
7679
|
+
const displayItems = getGridDisplayItems(item.gallery);
|
|
7680
|
+
const lightboxItemsForEntry = displayItems
|
|
7681
|
+
.filter(entry => entry.lightboxMedia)
|
|
7682
|
+
.map(entry => entry.lightboxMedia!);
|
|
7683
|
+
const lightboxIndexes = displayItems.map(({ lightboxMedia }) => (lightboxMedia
|
|
7684
|
+
? lightboxItemsForEntry.findIndex(media => media.assetId === lightboxMedia.assetId)
|
|
7685
|
+
: -1));
|
|
7686
|
+
return { displayItems, lightboxItemsForEntry, lightboxIndexes };
|
|
7687
|
+
}), [cropContent]);
|
|
7688
|
+
|
|
7689
|
+
const size = gridLayout?.entryWidth ?? 0.2;
|
|
7690
|
+
|
|
7691
|
+
const imageDisplaySettings = typeof imageDisplay === 'string' ? { display: imageDisplay } : imageDisplay;
|
|
7692
|
+
const isCover = imageDisplaySettings?.display === 'cover';
|
|
7693
|
+
const ratioValue = imageDisplaySettings?.ratioValue ?? '1:1';
|
|
7694
|
+
const ratioReversed = imageDisplaySettings?.reversed ?? false;
|
|
7502
7695
|
const [rW, rH] = ratioValue.split(':').map(Number);
|
|
7503
7696
|
const effW = ratioReversed ? rH : rW;
|
|
7504
7697
|
const effH = ratioReversed ? rW : rH;
|
|
7505
7698
|
const aspectRatio = \`\${effW} / \${effH}\`;
|
|
7506
7699
|
|
|
7507
|
-
const columnsCount = gridLayout
|
|
7700
|
+
const columnsCount = gridLayout?.columnsCount ?? 1;
|
|
7508
7701
|
const entryWidthScaled = scalingValue(size ?? 0, isEditor);
|
|
7509
|
-
const
|
|
7510
|
-
const isFitSlider = !isCover && slider !== 'off';
|
|
7702
|
+
const isFitSlider = !customLayout && !isCover && slider !== 'off';
|
|
7511
7703
|
|
|
7512
7704
|
const itemsInLastRow = cropContent.length % columnsCount || columnsCount;
|
|
7513
|
-
const isPartialLastRow = itemsInLastRow < columnsCount && cropContent.length > 0;
|
|
7705
|
+
const isPartialLastRow = !customLayout && itemsInLastRow < columnsCount && cropContent.length > 0;
|
|
7514
7706
|
const lastRowStartIndex = cropContent.length - itemsInLastRow;
|
|
7515
7707
|
const lastRowStartColumn = isPartialLastRow
|
|
7516
7708
|
? Math.floor((columnsCount - itemsInLastRow) / 2) + 1
|
|
@@ -7518,19 +7710,21 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7518
7710
|
|
|
7519
7711
|
const imageBorderRadius = imageCorners ? scalingValue(imageCorners, isEditor) : undefined;
|
|
7520
7712
|
|
|
7521
|
-
const
|
|
7522
|
-
width:
|
|
7523
|
-
...(
|
|
7524
|
-
?
|
|
7525
|
-
|
|
7713
|
+
const getImageWrapperStyle = (entryWidth: string, slot?: CustomGridSlot): React.CSSProperties => ({
|
|
7714
|
+
width: entryWidth,
|
|
7715
|
+
...(slot
|
|
7716
|
+
? isTextOutside
|
|
7717
|
+
? { height: scalingValue(slot.height, isEditor), flexShrink: 0, overflow: 'hidden' }
|
|
7718
|
+
: { flex: '1 1 0%', minHeight: 0, overflow: 'hidden' }
|
|
7719
|
+
: isCover
|
|
7720
|
+
? { aspectRatio, height: 'auto', overflow: 'hidden' }
|
|
7721
|
+
: { height: 'auto' }),
|
|
7526
7722
|
...(imageBorderRadius ? { borderRadius: imageBorderRadius, overflow: 'hidden' } : {}),
|
|
7527
|
-
};
|
|
7723
|
+
});
|
|
7528
7724
|
|
|
7529
7725
|
const imageWrapperClassName = \`\${P}-item-image-wrapper\${isFitSlider ? \` \${P}-item-image-wrapper-fit-slider\` : ''}\`.trim();
|
|
7530
7726
|
const isTextBeforeImage = type === 'd' || type === 'e' || type === 'f';
|
|
7531
|
-
const shouldAlignEntries = alignEntries === 'on';
|
|
7532
|
-
const textBoxWidthStyle = \`calc(\${scalingValue(size ?? 0, isEditor)} * (\${textBoxWidth} / 100))\`;
|
|
7533
|
-
const controlWidthStyle = scalingValue(size * textBoxWidth / 100, isEditor);
|
|
7727
|
+
const shouldAlignEntries = !customLayout && alignEntries === 'on';
|
|
7534
7728
|
|
|
7535
7729
|
const imageRadiusStyle = imageBorderRadius
|
|
7536
7730
|
? { borderRadius: imageBorderRadius, [MEDIA_RADIUS_VAR]: imageBorderRadius } as React.CSSProperties
|
|
@@ -7550,31 +7744,73 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7550
7744
|
width: 'auto',
|
|
7551
7745
|
height: 'auto',
|
|
7552
7746
|
maxWidth: '100%',
|
|
7747
|
+
...(customLayout ? { maxHeight: '100%' } : {}),
|
|
7553
7748
|
...imageRadiusStyle,
|
|
7554
7749
|
};
|
|
7555
7750
|
|
|
7556
|
-
const
|
|
7557
|
-
const
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7751
|
+
const shouldMeasureEntries = (customLayout?.beat ?? 0) > 0;
|
|
7752
|
+
const customGridWidth = customLayout ? getCustomGridSpanWidth(customLayout, customLayout.columnsCount) : 0;
|
|
7753
|
+
useLayoutEffect(() => {
|
|
7754
|
+
if (!shouldMeasureEntries) {
|
|
7755
|
+
setCustomEntryHeights(prev => (prev.length > 0 ? [] : prev));
|
|
7756
|
+
return;
|
|
7757
|
+
}
|
|
7758
|
+
const wrapper = containerRef.current;
|
|
7759
|
+
const inners = itemInnerRefs.current.slice(0, cropContent.length);
|
|
7760
|
+
const measure = () => {
|
|
7761
|
+
const unit = wrapper && customGridWidth > 0 ? wrapper.offsetWidth / customGridWidth : 0;
|
|
7762
|
+
if (unit <= 0) return;
|
|
7763
|
+
const heights = inners.map(inner => (inner ? inner.offsetHeight / unit : 0));
|
|
7764
|
+
setCustomEntryHeights(prev => (
|
|
7765
|
+
prev.length === heights.length && prev.every((height, index) => Math.abs(height - heights[index]) < 1e-5)
|
|
7766
|
+
? prev
|
|
7767
|
+
: heights
|
|
7768
|
+
));
|
|
7769
|
+
};
|
|
7770
|
+
measure();
|
|
7771
|
+
const ro = new ResizeObserver(measure);
|
|
7772
|
+
if (wrapper) ro.observe(wrapper);
|
|
7773
|
+
inners.forEach(inner => inner && ro.observe(inner));
|
|
7574
7774
|
return () => ro.disconnect();
|
|
7575
|
-
}, []);
|
|
7775
|
+
}, [shouldMeasureEntries, cropContent.length, customGridWidth, P]);
|
|
7776
|
+
const measuredEntryHeights = shouldMeasureEntries && customEntryHeights.length === cropContent.length
|
|
7777
|
+
? customEntryHeights
|
|
7778
|
+
: undefined;
|
|
7779
|
+
const customRows = useMemo(() => {
|
|
7780
|
+
if (!customLayout) return undefined;
|
|
7781
|
+
const rows = getCustomGridRows(customLayout, cropContent.length, measuredEntryHeights);
|
|
7782
|
+
return {
|
|
7783
|
+
gridRows: rows.gridRows,
|
|
7784
|
+
gridTemplateRows: rows.tracks.length
|
|
7785
|
+
? rows.tracks.map(track => (track === 'auto' ? 'auto' : scalingValue(track, isEditor))).join(' ')
|
|
7786
|
+
: 'auto',
|
|
7787
|
+
};
|
|
7788
|
+
}, [customLayout, cropContent.length, measuredEntryHeights, isEditor]);
|
|
7789
|
+
const customSlots = useMemo(
|
|
7790
|
+
() => (customLayout ? cropContent.map((_, index) => getCustomGridSlot(customLayout, index)) : undefined),
|
|
7791
|
+
[customLayout, cropContent.length],
|
|
7792
|
+
);
|
|
7793
|
+
const wrapperLayoutStyle: React.CSSProperties = customLayout
|
|
7794
|
+
? {
|
|
7795
|
+
gridTemplateColumns: \`repeat(\${customLayout.columnsCount}, \${scalingValue(customLayout.columnWidth, isEditor)})\`,
|
|
7796
|
+
gridTemplateRows: customRows?.gridTemplateRows ?? 'auto',
|
|
7797
|
+
rowGap: 0,
|
|
7798
|
+
columnGap: scalingValue(customLayout.gutterWidth, isEditor),
|
|
7799
|
+
width: scalingValue(getCustomGridSpanWidth(customLayout, customLayout.columnsCount), isEditor),
|
|
7800
|
+
}
|
|
7801
|
+
: {
|
|
7802
|
+
gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
|
|
7803
|
+
rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
|
|
7804
|
+
columnGap: scalingValue(gridLayout?.horizontalGap ?? 0, isEditor),
|
|
7805
|
+
width: scalingValue(gridLayout?.wrapperWidth ?? 0, isEditor),
|
|
7806
|
+
...(shouldAlignEntries
|
|
7807
|
+
? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
|
|
7808
|
+
: {}),
|
|
7809
|
+
};
|
|
7576
7810
|
|
|
7577
|
-
const
|
|
7811
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
7812
|
+
|
|
7813
|
+
const getLightboxPortalStyle = (): React.CSSProperties => {
|
|
7578
7814
|
const style: Record<string, string> = { ...(colorVars as Record<string, string>) };
|
|
7579
7815
|
const articleWidth = containerRef.current
|
|
7580
7816
|
? getComputedStyle(containerRef.current).getPropertyValue('--cntrl-article-width').trim()
|
|
@@ -7583,7 +7819,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7583
7819
|
style['--cntrl-article-width'] = articleWidth;
|
|
7584
7820
|
}
|
|
7585
7821
|
return style as React.CSSProperties;
|
|
7586
|
-
}
|
|
7822
|
+
};
|
|
7587
7823
|
|
|
7588
7824
|
const [lightboxOpen, setLightboxOpen] = useState(false);
|
|
7589
7825
|
const [lightboxItems, setLightboxItems] = useState<GridMedia[]>([]);
|
|
@@ -7622,16 +7858,8 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7622
7858
|
<div style={colorVars}>
|
|
7623
7859
|
<div
|
|
7624
7860
|
ref={containerRef}
|
|
7625
|
-
className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''} \${P}-image-align-\${align} \${wrapperStateClasses}\`.trim()}
|
|
7626
|
-
style={
|
|
7627
|
-
gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
|
|
7628
|
-
rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
|
|
7629
|
-
columnGap: scalingValue(gridLayout.horizontalGap ?? 0, isEditor),
|
|
7630
|
-
width: scalingValue(gridLayout.wrapperWidth ?? 0, isEditor),
|
|
7631
|
-
...(shouldAlignEntries
|
|
7632
|
-
? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
|
|
7633
|
-
: {}),
|
|
7634
|
-
}}>
|
|
7861
|
+
className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''}\${customLayout ? \` \${P}-custom-layout\` : ''}\${isTextOutside ? \` \${P}-text-outside\` : ''} \${P}-image-align-\${align} \${wrapperStateClasses}\`.trim()}
|
|
7862
|
+
style={wrapperLayoutStyle}>
|
|
7635
7863
|
{cropContent.map((item: any, index: number) => {
|
|
7636
7864
|
const hasTitle = hasText(item.title);
|
|
7637
7865
|
const hasSubtitle = hasText(item.subtitle);
|
|
@@ -7641,11 +7869,24 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7641
7869
|
const gridColumn = isPartialLastRow && index >= lastRowStartIndex
|
|
7642
7870
|
? \`\${lastRowStartColumn + (index - lastRowStartIndex)}\`
|
|
7643
7871
|
: undefined;
|
|
7872
|
+
const customSlot = customSlots?.[index];
|
|
7873
|
+
const itemSize = customSlot?.width ?? size;
|
|
7874
|
+
const itemWidthScaled = scalingValue(itemSize, isEditor);
|
|
7875
|
+
const textBoxWidthStyle = \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`;
|
|
7876
|
+
const controlWidthStyle = scalingValue(itemSize * textBoxWidth / 100, isEditor);
|
|
7877
|
+
const imageWrapperStyle = getImageWrapperStyle(itemWidthScaled, customSlot);
|
|
7878
|
+
const itemStyle: React.CSSProperties | undefined = customSlot
|
|
7879
|
+
? {
|
|
7880
|
+
gridColumn: customSlot.gridColumn,
|
|
7881
|
+
gridRow: customRows?.gridRows[index],
|
|
7882
|
+
alignSelf: 'start',
|
|
7883
|
+
}
|
|
7884
|
+
: gridColumn && !shouldAlignEntries ? { gridColumn } : undefined;
|
|
7644
7885
|
|
|
7645
7886
|
const typeCTextBlock = isTextBeforeImage ? (
|
|
7646
7887
|
<div className={\`\${P}-item-text-block\`}>
|
|
7647
7888
|
{hasTitle && (
|
|
7648
|
-
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7889
|
+
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleTextStyle }}>
|
|
7649
7890
|
{item.title}
|
|
7650
7891
|
</p>
|
|
7651
7892
|
)}
|
|
@@ -7660,7 +7901,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7660
7901
|
/>
|
|
7661
7902
|
)}
|
|
7662
7903
|
{hasSubtitle && (
|
|
7663
|
-
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7904
|
+
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}>
|
|
7664
7905
|
{item.subtitle}
|
|
7665
7906
|
</p>
|
|
7666
7907
|
)}
|
|
@@ -7690,7 +7931,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7690
7931
|
/>
|
|
7691
7932
|
)}
|
|
7692
7933
|
{hasTitle && (
|
|
7693
|
-
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7934
|
+
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleTextStyle }}>
|
|
7694
7935
|
{item.title}
|
|
7695
7936
|
</p>
|
|
7696
7937
|
)}
|
|
@@ -7720,7 +7961,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7720
7961
|
/>
|
|
7721
7962
|
)}
|
|
7722
7963
|
{hasSubtitle && (
|
|
7723
|
-
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7964
|
+
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}>
|
|
7724
7965
|
{item.subtitle}
|
|
7725
7966
|
</p>
|
|
7726
7967
|
)}
|
|
@@ -7744,10 +7985,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7744
7985
|
</LinkWrapper>
|
|
7745
7986
|
);
|
|
7746
7987
|
|
|
7747
|
-
const displayItems =
|
|
7748
|
-
const lightboxItemsForEntry = displayItems
|
|
7749
|
-
.filter(entry => entry.lightboxMedia)
|
|
7750
|
-
.map(entry => entry.lightboxMedia!);
|
|
7988
|
+
const { displayItems, lightboxItemsForEntry, lightboxIndexes } = entriesMedia[index];
|
|
7751
7989
|
|
|
7752
7990
|
const imageContent = (
|
|
7753
7991
|
<GridItemMediaWrapper className={imageWrapperClassName} style={imageWrapperStyle}>
|
|
@@ -7756,10 +7994,8 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7756
7994
|
: slider === 'off'
|
|
7757
7995
|
?
|
|
7758
7996
|
(() => {
|
|
7759
|
-
const { displayMedia
|
|
7760
|
-
const lightboxIndex =
|
|
7761
|
-
? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
|
|
7762
|
-
: -1;
|
|
7997
|
+
const { displayMedia } = displayItems[0];
|
|
7998
|
+
const lightboxIndex = lightboxIndexes[0];
|
|
7763
7999
|
return (
|
|
7764
8000
|
<GridMediaItem
|
|
7765
8001
|
media={displayMedia}
|
|
@@ -7787,50 +8023,28 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7787
8023
|
))}
|
|
7788
8024
|
</div>
|
|
7789
8025
|
)}
|
|
7790
|
-
<
|
|
7791
|
-
key={\`\${transition}-\${
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
autoplay: true,
|
|
7799
|
-
interval: sliderTiming * 1000,
|
|
7800
|
-
width: '100%',
|
|
7801
|
-
height: '100%',
|
|
7802
|
-
speed: SLIDER_TRANSITION_MS,
|
|
7803
|
-
type: transition === 'fade' ? 'fade' : 'loop',
|
|
7804
|
-
rewind: transition === 'fade',
|
|
7805
|
-
pauseOnHover: false,
|
|
7806
|
-
pauseOnFocus: false,
|
|
7807
|
-
direction: resolvedSplideDirection,
|
|
7808
|
-
}}
|
|
7809
|
-
onMoved={(splide) => {
|
|
7810
|
-
if (direction !== 'random' || transition === 'fade') return;
|
|
7811
|
-
handleRandomSlideMoved(splide);
|
|
7812
|
-
}}
|
|
7813
|
-
>
|
|
7814
|
-
{displayItems.map(({ displayMedia, lightboxMedia }, imgIndex) => {
|
|
7815
|
-
const lightboxIndex = lightboxMedia
|
|
7816
|
-
? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
|
|
7817
|
-
: -1;
|
|
8026
|
+
<GridEntrySlider
|
|
8027
|
+
key={\`\${transition}-\${itemSize}-\${direction}-\${sliderTiming}-\${layoutId}-\${displayItems.length}\`}
|
|
8028
|
+
prefix={P}
|
|
8029
|
+
isFade={transition === 'fade'}
|
|
8030
|
+
direction={direction}
|
|
8031
|
+
intervalMs={sliderTiming * 1000}
|
|
8032
|
+
slides={displayItems.map(({ displayMedia }, imgIndex) => {
|
|
8033
|
+
const lightboxIndex = lightboxIndexes[imgIndex];
|
|
7818
8034
|
return (
|
|
7819
|
-
<
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
/>
|
|
7830
|
-
</SplideSlide>
|
|
8035
|
+
<GridMediaItem
|
|
8036
|
+
media={displayMedia}
|
|
8037
|
+
className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
|
|
8038
|
+
style={imageStyle}
|
|
8039
|
+
hasLightbox={lightbox === 'on'}
|
|
8040
|
+
isSliderSlide
|
|
8041
|
+
onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
|
|
8042
|
+
? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
|
|
8043
|
+
: undefined}
|
|
8044
|
+
/>
|
|
7831
8045
|
);
|
|
7832
8046
|
})}
|
|
7833
|
-
|
|
8047
|
+
/>
|
|
7834
8048
|
</>
|
|
7835
8049
|
}
|
|
7836
8050
|
</GridItemMediaWrapper>
|
|
@@ -7848,7 +8062,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7848
8062
|
/>
|
|
7849
8063
|
<p
|
|
7850
8064
|
className={titleTextClassName}
|
|
7851
|
-
style={{ width: textBoxWidthStyle, ...
|
|
8065
|
+
style={{ width: textBoxWidthStyle, ...titleTextStyle }}
|
|
7852
8066
|
>
|
|
7853
8067
|
{item.title}
|
|
7854
8068
|
</p>
|
|
@@ -7862,7 +8076,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7862
8076
|
/>
|
|
7863
8077
|
<p
|
|
7864
8078
|
className={subtitleTextClassName}
|
|
7865
|
-
style={{ width: textBoxWidthStyle, ...
|
|
8079
|
+
style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}
|
|
7866
8080
|
>
|
|
7867
8081
|
{item.subtitle}
|
|
7868
8082
|
</p>
|
|
@@ -7882,16 +8096,18 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7882
8096
|
<div
|
|
7883
8097
|
key={index}
|
|
7884
8098
|
className={\`\${P}-item\`.trim()}
|
|
7885
|
-
style={
|
|
8099
|
+
style={itemStyle}
|
|
7886
8100
|
>
|
|
7887
8101
|
<div
|
|
7888
|
-
|
|
7889
|
-
|
|
8102
|
+
ref={(el) => { itemInnerRefs.current[index] = el; }}
|
|
8103
|
+
className={\`\${isEditMode
|
|
8104
|
+
? \`\${P}-item-inner\`
|
|
7890
8105
|
: \`\${P}-item-inner-hidden\`}\${shouldAlignEntries && isLastRow ? \` \${P}-item-inner-last-row\` : ''}\`.trim()}
|
|
7891
8106
|
style={{
|
|
7892
8107
|
width: (textBoxWidth ?? 0) > 100
|
|
7893
|
-
? \`calc(\${
|
|
7894
|
-
:
|
|
8108
|
+
? \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`
|
|
8109
|
+
: itemWidthScaled,
|
|
8110
|
+
...(customSlot && !isTextOutside ? { height: scalingValue(customSlot.height, isEditor) } : {}),
|
|
7895
8111
|
...(gridColumn && shouldAlignEntries ? { gridColumn } : {}),
|
|
7896
8112
|
}}
|
|
7897
8113
|
>
|
|
@@ -7937,7 +8153,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7937
8153
|
{(!isEditor || isPreviewMode) && lightboxOpen && typeof document !== 'undefined' && lightbox === 'on' && (() => {
|
|
7938
8154
|
const portalTarget = (portalId ? document.getElementById(portalId) : null) ?? document.body;
|
|
7939
8155
|
return createPortal(
|
|
7940
|
-
<div style={
|
|
8156
|
+
<div style={getLightboxPortalStyle()} data-selection="none">
|
|
7941
8157
|
<Lightbox
|
|
7942
8158
|
prefix={P}
|
|
7943
8159
|
items={lightboxItems}
|
|
@@ -7974,17 +8190,36 @@ type GridLayoutConfig = {
|
|
|
7974
8190
|
lockedParam?: 'wrapperWidth' | 'entryWidth' | 'horizontalGap' | null;
|
|
7975
8191
|
};
|
|
7976
8192
|
|
|
8193
|
+
type CustomGridBlock = {
|
|
8194
|
+
column: number;
|
|
8195
|
+
span: number;
|
|
8196
|
+
top: number;
|
|
8197
|
+
height: number;
|
|
8198
|
+
};
|
|
8199
|
+
|
|
8200
|
+
type CustomGridLayout = {
|
|
8201
|
+
columnsCount: number;
|
|
8202
|
+
columnWidth: number;
|
|
8203
|
+
gutterWidth: number;
|
|
8204
|
+
maxWidth: number | null;
|
|
8205
|
+
verticalGap?: number;
|
|
8206
|
+
beat?: number;
|
|
8207
|
+
repeatHeight?: number;
|
|
8208
|
+
blocks: CustomGridBlock[];
|
|
8209
|
+
};
|
|
8210
|
+
|
|
7977
8211
|
type GridSettings = {
|
|
7978
8212
|
type: 'a' | 'b' | 'c' | 'd' | 'e' | 'f';
|
|
7979
|
-
gridLayout
|
|
8213
|
+
gridLayout?: GridLayoutConfig;
|
|
8214
|
+
customGrid?: CustomGridLayout;
|
|
7980
8215
|
textBoxWidth: number;
|
|
7981
|
-
verticalGap
|
|
7982
|
-
entriesCount
|
|
8216
|
+
verticalGap?: number;
|
|
8217
|
+
entriesCount?: number;
|
|
7983
8218
|
lightbox: 'on' | 'off';
|
|
7984
|
-
imageDisplay: {
|
|
8219
|
+
imageDisplay: 'fit' | 'cover' | {
|
|
7985
8220
|
display: 'fit' | 'cover';
|
|
7986
|
-
ratioValue
|
|
7987
|
-
reversed
|
|
8221
|
+
ratioValue?: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
|
|
8222
|
+
reversed?: boolean;
|
|
7988
8223
|
};
|
|
7989
8224
|
imageCorners?: number;
|
|
7990
8225
|
lightboxImageDisplay?: 'fit' | 'cover' | { display?: 'fit' | 'cover' };
|
|
@@ -7994,8 +8229,9 @@ type GridSettings = {
|
|
|
7994
8229
|
transition: 'fade' | 'slide',
|
|
7995
8230
|
showText: 'always' | 'on hover';
|
|
7996
8231
|
hover?: 'none' | 'zoom-in' | 'greyscale' | 'scale-down';
|
|
7997
|
-
alignEntries
|
|
8232
|
+
alignEntries?: 'on' | 'off';
|
|
7998
8233
|
align?: 'top' | 'center' | 'bottom';
|
|
8234
|
+
textGrowth?: 'inside' | 'outside';
|
|
7999
8235
|
titleMarginTop: number;
|
|
8000
8236
|
subtitleMarginTop: number;
|
|
8001
8237
|
titleColor: string;
|
|
@@ -25362,4 +25598,4 @@ export function Waterfall({
|
|
|
25362
25598
|
</>
|
|
25363
25599
|
);
|
|
25364
25600
|
}
|
|
25365
|
-
`,
|
|
25601
|
+
`,C={[n.BurgerComponent.id]:t,[n.ChroniclesComponent.id]:i,[n.ClickGallerieComponent.id]:o,[n.CustomGridComponent.id]:e,[n.FAQComponent.id]:r,[n.FormComponent.id]:a,[n.GridComponent.id]:e,[n.HelixComponent.id]:s,[n.HiveComponent.id]:l,[n.LightboxJournalComponent.id]:c,[n.LightboxStripComponent.id]:d,[n.ListComponent.id]:u,[n.MarqueeComponent.id]:g,[n.MarqueeTextComponent.id]:m,[n.MercuryComponent.id]:p,[n.OnelinerFormComponent.id]:h,[n.PretextComponent.id]:f,[n.ScaleComponent.id]:v,[n.SimpleButtonComponent.id]:P,[n.Slider20Component.id]:x,[n.TestimonialGridComponent.id]:b,[n.TestimonialSingleComponent.id]:y,[n.WaterfallComponent.id]:S};exports.componentSources=C;
|