@cntrl-site/components 1.0.118-alpha.3 → 1.0.118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Burger-BkVgNMGU.mjs → Burger-C8JIQQwm.mjs} +330 -307
- package/dist/Burger-C_SjPZWp.js +669 -0
- package/dist/ChroniclesComponent-DkG1aICD.js +1 -0
- package/dist/{ChroniclesComponent-DD3tqNNm.mjs → ChroniclesComponent-kkKhL_qt.mjs} +442 -512
- package/dist/Components/Burger/Burger.d.ts +4 -2
- package/dist/Components/Grid/Grid.d.ts +7 -25
- package/dist/ControlSlider-C8ckUIDm.js +1 -0
- package/dist/{ControlSlider-BBAXRDLP.mjs → ControlSlider-DqKfaKMG.mjs} +3 -2
- package/dist/Grid-C4hO8KCr.js +408 -0
- package/dist/Grid-Dud7PLS9.mjs +1622 -0
- package/dist/{components-BwAmTGJp.mjs → components-BLyOKMdK.mjs} +13 -14
- package/dist/{components-D8RelPGE.js → components-CVetdKi7.js} +1 -1
- package/dist/components.css +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +8 -9
- package/dist/elements.node.js +1 -1
- package/dist/elements.node.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +2 -2
- package/dist/sources.js +286 -522
- package/dist/sources.mjs +326 -563
- package/package.json +1 -1
- package/dist/Burger-C3yVbQcq.js +0 -669
- package/dist/ChroniclesComponent-BMbUwzk6.js +0 -1
- package/dist/Components/Grid/CustomGridComponent.d.ts +0 -41
- package/dist/ControlSlider-BCkVFl4w.js +0 -1
- package/dist/Grid-CUaVUaRa.js +0 -441
- package/dist/Grid-D19xZ_mh.mjs +0 -1800
package/dist/sources.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-DkG1aICD.js"),e=`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,11 +27,12 @@ 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' | 'file';
|
|
31
31
|
value?: string;
|
|
32
32
|
target?: string;
|
|
33
33
|
anchor?: string;
|
|
34
34
|
url?: string;
|
|
35
|
+
download?: string;
|
|
35
36
|
};
|
|
36
37
|
mode?: 'page' | 'url';
|
|
37
38
|
page?: string;
|
|
@@ -256,10 +257,11 @@ function isBlankTarget(target?: string): boolean {
|
|
|
256
257
|
}
|
|
257
258
|
|
|
258
259
|
function getBurgerDest(item: BurgerLink): {
|
|
259
|
-
type: 'url' | 'page' | 'anchor';
|
|
260
|
+
type: 'url' | 'page' | 'anchor' | 'file';
|
|
260
261
|
value: string;
|
|
261
262
|
target?: '_blank';
|
|
262
263
|
anchor?: string;
|
|
264
|
+
download?: string;
|
|
263
265
|
} {
|
|
264
266
|
const dest = item.link;
|
|
265
267
|
if (dest && typeof dest === 'object') {
|
|
@@ -273,8 +275,12 @@ function getBurgerDest(item: BurgerLink): {
|
|
|
273
275
|
if (dest.type === 'page') {
|
|
274
276
|
return { type: 'page', value: dest.value ?? '', target, anchor: dest.anchor };
|
|
275
277
|
}
|
|
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
|
|
276
282
|
if (typeof dest.url === 'string') {
|
|
277
|
-
return { type: 'url', value: dest.url, target };
|
|
283
|
+
return { type: 'url', value: dest.url, target, download: typeof dest.download === 'string' ? dest.download : undefined };
|
|
278
284
|
}
|
|
279
285
|
}
|
|
280
286
|
const target = isBlankTarget(item.openIn) ? '_blank' : undefined;
|
|
@@ -295,12 +301,17 @@ function resolveBurgerLink(item: BurgerLink, pages?: BurgerPageRef[]): {
|
|
|
295
301
|
label: string;
|
|
296
302
|
href: string;
|
|
297
303
|
target?: '_blank';
|
|
304
|
+
download?: string;
|
|
298
305
|
} {
|
|
299
306
|
const label = item.label || 'Link';
|
|
300
307
|
const dest = getBurgerDest(item);
|
|
301
308
|
|
|
302
309
|
if (dest.type === 'url') {
|
|
303
|
-
return { label, href: dest.value, target: dest.target };
|
|
310
|
+
return { label, href: dest.value, target: dest.target, download: dest.download };
|
|
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' };
|
|
304
315
|
}
|
|
305
316
|
if (dest.type === 'anchor') {
|
|
306
317
|
const anchor = dest.value.replace(/^#/, '');
|
|
@@ -912,10 +923,11 @@ function renderTextPaddingControls(
|
|
|
912
923
|
type ColorKeys = 'iconColor' | 'closeButtonColor' | 'linkColor' | 'openLinkColor' | 'compactIconColor' | 'compactLinkColor' | 'compactLogoColor' | 'compactBackgroundColor' | 'openLogoColor' | 'menuBackgroundColor' | 'overlayColor' | 'backgroundColor' | 'logoColor';
|
|
913
924
|
|
|
914
925
|
export type BurgerLinkNavigateEvent = {
|
|
915
|
-
mode: 'page' | 'url';
|
|
926
|
+
mode: 'page' | 'url' | 'file';
|
|
916
927
|
href: string;
|
|
917
928
|
page?: string;
|
|
918
929
|
url?: string;
|
|
930
|
+
file?: string;
|
|
919
931
|
anchor?: string;
|
|
920
932
|
target?: '_blank';
|
|
921
933
|
};
|
|
@@ -1767,6 +1779,28 @@ function findAnchorTarget(hash: string): HTMLElement | null {
|
|
|
1767
1779
|
return target instanceof HTMLElement ? target : null;
|
|
1768
1780
|
}
|
|
1769
1781
|
|
|
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
|
+
|
|
1770
1804
|
function scrollToAnchor(hash: string): boolean {
|
|
1771
1805
|
const target = findAnchorTarget(hash);
|
|
1772
1806
|
if (!target) return false;
|
|
@@ -1800,10 +1834,11 @@ function handleLinkClick(
|
|
|
1800
1834
|
const resolved = resolveBurgerLink(item, pages);
|
|
1801
1835
|
const dest = getBurgerDest(item);
|
|
1802
1836
|
const navigateEvent: BurgerLinkNavigateEvent = {
|
|
1803
|
-
mode: dest.type === 'url'
|
|
1837
|
+
mode: dest.type === 'url' || dest.type === 'file' ? dest.type : 'page',
|
|
1804
1838
|
href: resolved.href || href,
|
|
1805
1839
|
page: dest.type === 'page' ? dest.value : undefined,
|
|
1806
1840
|
url: dest.type === 'url' ? dest.value : undefined,
|
|
1841
|
+
file: dest.type === 'file' ? dest.value : undefined,
|
|
1807
1842
|
anchor: dest.type === 'anchor'
|
|
1808
1843
|
? dest.value.replace(/^#/, '')
|
|
1809
1844
|
: (dest.anchor ?? '').replace(/^#/, ''),
|
|
@@ -1825,6 +1860,14 @@ function handleLinkClick(
|
|
|
1825
1860
|
return;
|
|
1826
1861
|
}
|
|
1827
1862
|
|
|
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
|
+
|
|
1828
1871
|
if (!opensInNewTab && hash && isSameDocumentHref(href) && findAnchorTarget(hash)) {
|
|
1829
1872
|
event.preventDefault();
|
|
1830
1873
|
runAfterClose(() => scrollToAnchor(hash));
|
|
@@ -2430,12 +2473,13 @@ export function Burger({
|
|
|
2430
2473
|
const showOpenNavControls = showControls && isOpen;
|
|
2431
2474
|
|
|
2432
2475
|
const renderOpenNavItems = (linkClassName: string) => items.filter((item) => isVisibleInOpenNav(item, layoutId)).map((item, index) => {
|
|
2433
|
-
const { label, href, target } = resolveBurgerLink(item, pages);
|
|
2476
|
+
const { label, href, target, download } = resolveBurgerLink(item, pages);
|
|
2434
2477
|
const linkNode = href ? (
|
|
2435
2478
|
<a
|
|
2436
2479
|
href={href}
|
|
2437
2480
|
target={target}
|
|
2438
2481
|
rel={target === '_blank' ? 'noopener noreferrer' : undefined}
|
|
2482
|
+
download={download}
|
|
2439
2483
|
className={\`\${linkClassName} \${P}-has-href\`}
|
|
2440
2484
|
onClick={(event) => onNavLinkClick(event, item)}
|
|
2441
2485
|
>
|
|
@@ -2547,7 +2591,7 @@ export function Burger({
|
|
|
2547
2591
|
};
|
|
2548
2592
|
|
|
2549
2593
|
const renderNavLink = (item: BurgerLink, index: number) => {
|
|
2550
|
-
const { label, href, target } = resolveBurgerLink(item, pages);
|
|
2594
|
+
const { label, href, target, download } = resolveBurgerLink(item, pages);
|
|
2551
2595
|
const textContent = (
|
|
2552
2596
|
<span className={navLinkTextClassName} style={navLinkTextStyle}>
|
|
2553
2597
|
{renderMultilineText(label)}
|
|
@@ -2566,6 +2610,7 @@ export function Burger({
|
|
|
2566
2610
|
href={href}
|
|
2567
2611
|
target={target}
|
|
2568
2612
|
rel={target === '_blank' ? 'noopener noreferrer' : undefined}
|
|
2613
|
+
download={download}
|
|
2569
2614
|
className={\`\${P}-nav-link \${P}-has-href\`}
|
|
2570
2615
|
onClick={(event) => onNavLinkClick(event, item)}
|
|
2571
2616
|
>
|
|
@@ -2683,7 +2728,7 @@ export function Burger({
|
|
|
2683
2728
|
</div>
|
|
2684
2729
|
);
|
|
2685
2730
|
}
|
|
2686
|
-
`,
|
|
2731
|
+
`,t=`import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
|
|
2687
2732
|
import { createPortal } from 'react-dom';
|
|
2688
2733
|
import cn from 'classnames';
|
|
2689
2734
|
import { CommonComponentProps } from '../props';
|
|
@@ -3730,7 +3775,7 @@ export function Chronicles({
|
|
|
3730
3775
|
</>
|
|
3731
3776
|
);
|
|
3732
3777
|
}
|
|
3733
|
-
`,
|
|
3778
|
+
`,i=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3734
3779
|
import { CommonComponentProps } from '../props';
|
|
3735
3780
|
import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
|
|
3736
3781
|
|
|
@@ -4259,7 +4304,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
4259
4304
|
</>
|
|
4260
4305
|
);
|
|
4261
4306
|
}
|
|
4262
|
-
`,
|
|
4307
|
+
`,o=`import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4263
4308
|
import cn from 'classnames';
|
|
4264
4309
|
import { CommonComponentProps } from '../props';
|
|
4265
4310
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -5003,7 +5048,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
|
|
|
5003
5048
|
</>
|
|
5004
5049
|
);
|
|
5005
5050
|
}
|
|
5006
|
-
`,
|
|
5051
|
+
`,r=`import React, { useMemo, useState } from 'react';
|
|
5007
5052
|
import { CommonComponentProps } from '../props';
|
|
5008
5053
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
5009
5054
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -5641,7 +5686,9 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
5641
5686
|
};
|
|
5642
5687
|
|
|
5643
5688
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
5644
|
-
`,
|
|
5689
|
+
`,a=`import { Splide, SplideSlide } from '@splidejs/react-splide';
|
|
5690
|
+
import '@splidejs/react-splide/css/core';
|
|
5691
|
+
import { CommonComponentProps } from '../props';
|
|
5645
5692
|
import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
|
|
5646
5693
|
import {
|
|
5647
5694
|
buildColorVars,
|
|
@@ -5651,7 +5698,7 @@ import {
|
|
|
5651
5698
|
useLazyVideos,
|
|
5652
5699
|
useScopedStyles,
|
|
5653
5700
|
} from '../utils/index';
|
|
5654
|
-
import {
|
|
5701
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
|
|
5655
5702
|
import { createPortal } from 'react-dom';
|
|
5656
5703
|
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
5657
5704
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
@@ -5768,19 +5815,15 @@ function getCSS(P: string): string {
|
|
|
5768
5815
|
width: 100%;
|
|
5769
5816
|
overflow: hidden;
|
|
5770
5817
|
}
|
|
5818
|
+
.\${P}-item-slider .splide__track {
|
|
5819
|
+
overflow: hidden;
|
|
5820
|
+
}
|
|
5771
5821
|
.\${P}-item-image-link {
|
|
5772
5822
|
width: 100%;
|
|
5773
5823
|
display: flex;
|
|
5774
5824
|
flex-direction: column;
|
|
5775
5825
|
align-items: center;
|
|
5776
5826
|
}
|
|
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
|
-
}
|
|
5784
5827
|
.\${P}-item-text-link {
|
|
5785
5828
|
display: flex;
|
|
5786
5829
|
flex-direction: column;
|
|
@@ -5801,47 +5844,18 @@ function getCSS(P: string): string {
|
|
|
5801
5844
|
display: block;
|
|
5802
5845
|
max-width: 100%;
|
|
5803
5846
|
}
|
|
5804
|
-
.\${P}-item-slider
|
|
5805
|
-
|
|
5847
|
+
.\${P}-item-slider,
|
|
5848
|
+
.\${P}-item-slider .splide__track,
|
|
5849
|
+
.\${P}-item-slider .splide__list,
|
|
5850
|
+
.\${P}-item-slider .splide__slide {
|
|
5806
5851
|
width: 100%;
|
|
5807
5852
|
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;
|
|
5817
5853
|
}
|
|
5818
|
-
.\${P}-item-slider
|
|
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%;
|
|
5854
|
+
.\${P}-item-slider .splide__slide {
|
|
5830
5855
|
display: flex;
|
|
5831
5856
|
justify-content: center;
|
|
5832
5857
|
align-items: center;
|
|
5833
5858
|
}
|
|
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
|
-
}
|
|
5845
5859
|
.\${P}-item-title {
|
|
5846
5860
|
white-space: normal;
|
|
5847
5861
|
overflow-wrap: anywhere;
|
|
@@ -5988,13 +6002,13 @@ function getCSS(P: string): string {
|
|
|
5988
6002
|
.\${P}-image-align-bottom .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
|
|
5989
6003
|
align-items: flex-end;
|
|
5990
6004
|
}
|
|
5991
|
-
.\${P}-image-align-top .\${P}-item-slider
|
|
6005
|
+
.\${P}-image-align-top .\${P}-item-slider .splide__slide {
|
|
5992
6006
|
align-items: flex-start;
|
|
5993
6007
|
}
|
|
5994
|
-
.\${P}-image-align-center .\${P}-item-slider
|
|
6008
|
+
.\${P}-image-align-center .\${P}-item-slider .splide__slide {
|
|
5995
6009
|
align-items: center;
|
|
5996
6010
|
}
|
|
5997
|
-
.\${P}-image-align-bottom .\${P}-item-slider
|
|
6011
|
+
.\${P}-image-align-bottom .\${P}-item-slider .splide__slide {
|
|
5998
6012
|
align-items: flex-end;
|
|
5999
6013
|
}
|
|
6000
6014
|
.\${P}-align-entries .\${P}-item {
|
|
@@ -6075,13 +6089,13 @@ function getCSS(P: string): string {
|
|
|
6075
6089
|
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
|
|
6076
6090
|
align-items: flex-end;
|
|
6077
6091
|
}
|
|
6078
|
-
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider
|
|
6092
|
+
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider .splide__slide {
|
|
6079
6093
|
align-items: flex-start;
|
|
6080
6094
|
}
|
|
6081
|
-
.\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider
|
|
6095
|
+
.\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider .splide__slide {
|
|
6082
6096
|
align-items: center;
|
|
6083
6097
|
}
|
|
6084
|
-
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider
|
|
6098
|
+
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider .splide__slide {
|
|
6085
6099
|
align-items: flex-end;
|
|
6086
6100
|
}
|
|
6087
6101
|
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-image-link {
|
|
@@ -6149,9 +6163,27 @@ function pickRandomSlideDirection(): 'ltr' | 'ttb' {
|
|
|
6149
6163
|
return Math.random() < 0.5 ? 'ltr' : 'ttb';
|
|
6150
6164
|
}
|
|
6151
6165
|
|
|
6152
|
-
function
|
|
6153
|
-
|
|
6154
|
-
|
|
6166
|
+
function resumeSplideAutoplay(splide: { Components: { Autoplay?: { pause: (stop?: boolean) => void; play: () => void } } }) {
|
|
6167
|
+
const autoplay = splide.Components.Autoplay;
|
|
6168
|
+
if (!autoplay) return;
|
|
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
|
+
});
|
|
6155
6187
|
}
|
|
6156
6188
|
|
|
6157
6189
|
type GridProps = {
|
|
@@ -6191,8 +6223,6 @@ type LightboxProps = {
|
|
|
6191
6223
|
|
|
6192
6224
|
const LIGHTBOX_ANIM_MS = 500;
|
|
6193
6225
|
const SLIDER_TRANSITION_MS = 750;
|
|
6194
|
-
const SLIDER_EASING = 'cubic-bezier(0.25, 1, 0.5, 1)';
|
|
6195
|
-
const SLIDER_DEFAULT_INTERVAL_MS = 5000;
|
|
6196
6226
|
const LIGHTBOX_EASING = 'cubic-bezier(0.22, 1, 0.36, 1)';
|
|
6197
6227
|
const SWIPE_CLOSE_THRESHOLD = 72;
|
|
6198
6228
|
const SWIPE_NAV_THRESHOLD = 50;
|
|
@@ -6282,7 +6312,7 @@ function collectGridLightboxMedia(content: any[]): GridMedia[] {
|
|
|
6282
6312
|
return result;
|
|
6283
6313
|
}
|
|
6284
6314
|
|
|
6285
|
-
|
|
6315
|
+
function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
6286
6316
|
const [pool, setPool] = useState<HTMLDivElement | null>(null);
|
|
6287
6317
|
useLazyVideos(pool, { preload: 'metadata' });
|
|
6288
6318
|
// an embed's player is only ever framed where it shows
|
|
@@ -6321,7 +6351,7 @@ const LightboxMediaPreloadPool = memo(function LightboxMediaPreloadPool({ mediaL
|
|
|
6321
6351
|
))}
|
|
6322
6352
|
</div>
|
|
6323
6353
|
);
|
|
6324
|
-
}
|
|
6354
|
+
}
|
|
6325
6355
|
|
|
6326
6356
|
function unloadVideoElement(video: HTMLVideoElement) {
|
|
6327
6357
|
video.pause();
|
|
@@ -6329,121 +6359,15 @@ function unloadVideoElement(video: HTMLVideoElement) {
|
|
|
6329
6359
|
video.load();
|
|
6330
6360
|
}
|
|
6331
6361
|
|
|
6332
|
-
const
|
|
6333
|
-
const GRID_SLIDE_PLAYING_CLASS = 'cntrl-grid-slide-playing';
|
|
6334
|
-
const GRID_SLIDE_VIDEOS = \`.\${GRID_SLIDE_CLASS} video\`;
|
|
6362
|
+
const SPLIDE_SLIDE_VIDEOS = '.splide__slide video';
|
|
6335
6363
|
|
|
6336
6364
|
function shouldPlaySlideVideo(video: HTMLVideoElement): boolean {
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
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
|
-
);
|
|
6365
|
+
if (video.closest('.splide--fade, .splide__slide.is-active:not(.splide__slide--clone), .splide__slide.is-next')) return true;
|
|
6366
|
+
const slide = video.closest<HTMLElement>('.splide__slide');
|
|
6367
|
+
if (!slide || slide.classList.contains('splide__slide--clone')) return false;
|
|
6368
|
+
const slideIndex = slide.dataset.slideIndex;
|
|
6369
|
+
const upcomingSlide = slide.parentElement?.querySelector<HTMLElement>('.splide__slide.is-next');
|
|
6370
|
+
return slideIndex !== undefined && upcomingSlide?.dataset.slideIndex === slideIndex;
|
|
6447
6371
|
}
|
|
6448
6372
|
|
|
6449
6373
|
function GridMediaItem({
|
|
@@ -6451,7 +6375,7 @@ function GridMediaItem({
|
|
|
6451
6375
|
className,
|
|
6452
6376
|
style,
|
|
6453
6377
|
hasLightbox,
|
|
6454
|
-
|
|
6378
|
+
isSplideSlide = false,
|
|
6455
6379
|
onMediaClick,
|
|
6456
6380
|
}: {
|
|
6457
6381
|
media: GridMedia;
|
|
@@ -6459,7 +6383,7 @@ function GridMediaItem({
|
|
|
6459
6383
|
style: React.CSSProperties;
|
|
6460
6384
|
/** An embed then plays here as a silent loop, and as it was set to in the lightbox. */
|
|
6461
6385
|
hasLightbox: boolean;
|
|
6462
|
-
|
|
6386
|
+
isSplideSlide?: boolean;
|
|
6463
6387
|
onMediaClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
6464
6388
|
}) {
|
|
6465
6389
|
if (isEmbedMedia(media)) {
|
|
@@ -6491,7 +6415,7 @@ function GridMediaItem({
|
|
|
6491
6415
|
playsInline: true,
|
|
6492
6416
|
onClick: onMediaClick,
|
|
6493
6417
|
};
|
|
6494
|
-
return
|
|
6418
|
+
return isSplideSlide
|
|
6495
6419
|
? <video {...videoProps} preload='none' />
|
|
6496
6420
|
: <LazyVideo {...videoProps} autoPlay />;
|
|
6497
6421
|
}
|
|
@@ -6520,7 +6444,7 @@ function GridItemMediaWrapper({
|
|
|
6520
6444
|
children: React.ReactNode;
|
|
6521
6445
|
}) {
|
|
6522
6446
|
const [wrapper, setWrapper] = useState<HTMLDivElement | null>(null);
|
|
6523
|
-
useLazyVideos(wrapper, { autoPlay: true, selector:
|
|
6447
|
+
useLazyVideos(wrapper, { autoPlay: true, selector: SPLIDE_SLIDE_VIDEOS, shouldPlay: shouldPlaySlideVideo });
|
|
6524
6448
|
|
|
6525
6449
|
return (
|
|
6526
6450
|
<div ref={setWrapper} className={className} style={style}>
|
|
@@ -7421,108 +7345,11 @@ function resolveLightboxImageDisplay(
|
|
|
7421
7345
|
return value?.display === 'cover' ? 'cover' : 'fit';
|
|
7422
7346
|
}
|
|
7423
7347
|
|
|
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
|
-
|
|
7520
7348
|
export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, metadata, activeEvent, layoutId, portalId }: GridProps) {
|
|
7521
7349
|
const { prefix: P } = useScopedStyles();
|
|
7522
7350
|
const {
|
|
7523
7351
|
type = 'a',
|
|
7524
7352
|
gridLayout,
|
|
7525
|
-
customGrid,
|
|
7526
7353
|
textBoxWidth = 100,
|
|
7527
7354
|
verticalGap,
|
|
7528
7355
|
entriesCount,
|
|
@@ -7570,69 +7397,62 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7570
7397
|
hover = 'none',
|
|
7571
7398
|
alignEntries = 'off',
|
|
7572
7399
|
align = 'top',
|
|
7573
|
-
textGrowth = 'inside',
|
|
7574
7400
|
} = settings;
|
|
7575
7401
|
|
|
7576
|
-
const
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
titleWordSpacing, titleTextAppearance, titleColor, isEditor, P,
|
|
7594
|
-
]);
|
|
7402
|
+
const resolvedTitleTextStyle: TextStyles = {
|
|
7403
|
+
fontSettings: {
|
|
7404
|
+
fontFamily: titleFontFamily,
|
|
7405
|
+
fontWeight: titleFontSettings?.fontWeight ?? 400,
|
|
7406
|
+
fontStyle: titleFontSettings?.fontStyle ?? 'normal',
|
|
7407
|
+
},
|
|
7408
|
+
fontSize: titleFontSize ?? 0.01,
|
|
7409
|
+
lineHeight: titleLineHeight,
|
|
7410
|
+
letterSpacing: titleLetterSpacing ?? 0,
|
|
7411
|
+
wordSpacing: titleWordSpacing ?? 0,
|
|
7412
|
+
textAppearance: titleTextAppearance,
|
|
7413
|
+
color: titleColor,
|
|
7414
|
+
};
|
|
7415
|
+
const titleTypographyCss = omitTextColors(textStylesToCss(resolvedTitleTextStyle, isEditor));
|
|
7416
|
+
const titleFieldCss = {
|
|
7417
|
+
...titleTypographyCss,
|
|
7418
|
+
} as React.CSSProperties;
|
|
7595
7419
|
|
|
7596
|
-
const
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
subtitleWordSpacing, subtitleTextAppearance, subtitleColor, isEditor, P,
|
|
7614
|
-
]);
|
|
7420
|
+
const resolvedSubtitleTextStyle: TextStyles = {
|
|
7421
|
+
fontSettings: {
|
|
7422
|
+
fontFamily: subtitleFontFamily,
|
|
7423
|
+
fontWeight: subtitleFontSettings?.fontWeight ?? 400,
|
|
7424
|
+
fontStyle: subtitleFontSettings?.fontStyle ?? 'normal',
|
|
7425
|
+
},
|
|
7426
|
+
fontSize: subtitleFontSize ?? 0.01,
|
|
7427
|
+
lineHeight: subtitleLineHeight,
|
|
7428
|
+
letterSpacing: subtitleLetterSpacing ?? 0,
|
|
7429
|
+
wordSpacing: subtitleWordSpacing ?? 0,
|
|
7430
|
+
textAppearance: subtitleTextAppearance,
|
|
7431
|
+
color: subtitleColor,
|
|
7432
|
+
};
|
|
7433
|
+
const subtitleTypographyCss = omitTextColors(textStylesToCss(resolvedSubtitleTextStyle, isEditor));
|
|
7434
|
+
const subtitleFieldCss = {
|
|
7435
|
+
...subtitleTypographyCss,
|
|
7436
|
+
} as React.CSSProperties;
|
|
7615
7437
|
|
|
7616
|
-
const
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7438
|
+
const resolvedLightboxCounterTextStyle: TextStyles = {
|
|
7439
|
+
fontSettings: {
|
|
7440
|
+
fontFamily: lightboxCounterFontFamily,
|
|
7441
|
+
fontWeight: lightboxCounterFontSettings?.fontWeight ?? 400,
|
|
7442
|
+
fontStyle: lightboxCounterFontSettings?.fontStyle ?? 'normal',
|
|
7443
|
+
},
|
|
7444
|
+
fontSize: lightboxCounterFontSize ?? 0.01,
|
|
7445
|
+
lineHeight: lightboxCounterLineHeight,
|
|
7446
|
+
letterSpacing: lightboxCounterLetterSpacing ?? 0,
|
|
7447
|
+
wordSpacing: lightboxCounterWordSpacing ?? 0,
|
|
7448
|
+
textAppearance: lightboxCounterTextAppearance,
|
|
7449
|
+
color: lightboxCounterColor,
|
|
7450
|
+
};
|
|
7451
|
+
const lightboxCounterTypographyCss = omitTextColors(textStylesToCss(resolvedLightboxCounterTextStyle, isEditor));
|
|
7452
|
+
const lightboxCounterFieldCss = {
|
|
7453
|
+
...lightboxCounterTypographyCss,
|
|
7630
7454
|
...getGridTextLeadingVars(lightboxCounterFontSize, lightboxCounterLineHeight, P, isEditor),
|
|
7631
|
-
} as React.CSSProperties
|
|
7632
|
-
lightboxCounterFontFamily, lightboxCounterFontSettings, lightboxCounterFontSize, lightboxCounterLineHeight,
|
|
7633
|
-
lightboxCounterLetterSpacing, lightboxCounterWordSpacing, lightboxCounterTextAppearance, lightboxCounterColor,
|
|
7634
|
-
isEditor, P,
|
|
7635
|
-
]);
|
|
7455
|
+
} as React.CSSProperties;
|
|
7636
7456
|
|
|
7637
7457
|
const titleTextClassName = getGridTextClassName(
|
|
7638
7458
|
titleFontSize,
|
|
@@ -7646,6 +7466,8 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7646
7466
|
\`\${P}-item-subtitle\`,
|
|
7647
7467
|
\`\${P}-text-tight-leading\`,
|
|
7648
7468
|
);
|
|
7469
|
+
const titleTextLeadingVars = getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor);
|
|
7470
|
+
const subtitleTextLeadingVars = getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor);
|
|
7649
7471
|
const lightboxCounterClassName = getGridTextClassName(
|
|
7650
7472
|
lightboxCounterFontSize,
|
|
7651
7473
|
lightboxCounterLineHeight,
|
|
@@ -7653,56 +7475,42 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7653
7475
|
\`\${P}-text-tight-leading\`,
|
|
7654
7476
|
);
|
|
7655
7477
|
|
|
7656
|
-
const colorVars =
|
|
7478
|
+
const colorVars = buildColorVars(P, {
|
|
7657
7479
|
titleColor,
|
|
7658
7480
|
subtitleColor,
|
|
7659
7481
|
lightboxCounterColor,
|
|
7660
|
-
}, COLOR_VAR_MAP, STATE_KEYS)
|
|
7482
|
+
}, COLOR_VAR_MAP, STATE_KEYS);
|
|
7661
7483
|
|
|
7662
7484
|
const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
|
|
7663
7485
|
const showTextOnHover = showText === 'on hover' && (!isEditor || isPreviewMode);
|
|
7664
7486
|
const hoverEffectClass = hover !== 'none' && (!isEditor || isPreviewMode) ? \` \${P}-hover-\${hover}\` : '';
|
|
7665
7487
|
const wrapperStateClasses = \`\${stateClass}\${showTextOnHover ? \` \${P}-show-text-hover\` : ''}\${hoverEffectClass}\`.trim();
|
|
7666
7488
|
|
|
7667
|
-
const
|
|
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[]>([]);
|
|
7489
|
+
const resEntriesCount = entriesCount === 0 ? Infinity : entriesCount;
|
|
7672
7490
|
|
|
7673
|
-
const cropContent =
|
|
7491
|
+
const cropContent = (content ?? []).slice(0, resEntriesCount);
|
|
7674
7492
|
const lightboxMediaToPreload = useMemo(
|
|
7675
7493
|
() => (lightbox === 'on' ? collectGridLightboxMedia(cropContent) : []),
|
|
7676
7494
|
[cropContent, lightbox],
|
|
7677
7495
|
);
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
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;
|
|
7496
|
+
|
|
7497
|
+
const size = gridLayout.entryWidth ?? 0.2;
|
|
7498
|
+
|
|
7499
|
+
const isCover = imageDisplay?.display === 'cover';
|
|
7500
|
+
const ratioValue = imageDisplay?.ratioValue ?? '1:1';
|
|
7501
|
+
const ratioReversed = imageDisplay?.reversed ?? false;
|
|
7695
7502
|
const [rW, rH] = ratioValue.split(':').map(Number);
|
|
7696
7503
|
const effW = ratioReversed ? rH : rW;
|
|
7697
7504
|
const effH = ratioReversed ? rW : rH;
|
|
7698
7505
|
const aspectRatio = \`\${effW} / \${effH}\`;
|
|
7699
7506
|
|
|
7700
|
-
const columnsCount = gridLayout
|
|
7507
|
+
const columnsCount = gridLayout.columnsCount;
|
|
7701
7508
|
const entryWidthScaled = scalingValue(size ?? 0, isEditor);
|
|
7702
|
-
const
|
|
7509
|
+
const imageWrapperWidth = entryWidthScaled;
|
|
7510
|
+
const isFitSlider = !isCover && slider !== 'off';
|
|
7703
7511
|
|
|
7704
7512
|
const itemsInLastRow = cropContent.length % columnsCount || columnsCount;
|
|
7705
|
-
const isPartialLastRow =
|
|
7513
|
+
const isPartialLastRow = itemsInLastRow < columnsCount && cropContent.length > 0;
|
|
7706
7514
|
const lastRowStartIndex = cropContent.length - itemsInLastRow;
|
|
7707
7515
|
const lastRowStartColumn = isPartialLastRow
|
|
7708
7516
|
? Math.floor((columnsCount - itemsInLastRow) / 2) + 1
|
|
@@ -7710,21 +7518,19 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7710
7518
|
|
|
7711
7519
|
const imageBorderRadius = imageCorners ? scalingValue(imageCorners, isEditor) : undefined;
|
|
7712
7520
|
|
|
7713
|
-
const
|
|
7714
|
-
width:
|
|
7715
|
-
...(
|
|
7716
|
-
?
|
|
7717
|
-
|
|
7718
|
-
: { flex: '1 1 0%', minHeight: 0, overflow: 'hidden' }
|
|
7719
|
-
: isCover
|
|
7720
|
-
? { aspectRatio, height: 'auto', overflow: 'hidden' }
|
|
7721
|
-
: { height: 'auto' }),
|
|
7521
|
+
const imageWrapperStyle: React.CSSProperties = {
|
|
7522
|
+
width: imageWrapperWidth,
|
|
7523
|
+
...(isCover
|
|
7524
|
+
? { aspectRatio, height: 'auto', overflow: 'hidden' }
|
|
7525
|
+
: { height: 'auto' }),
|
|
7722
7526
|
...(imageBorderRadius ? { borderRadius: imageBorderRadius, overflow: 'hidden' } : {}),
|
|
7723
|
-
}
|
|
7527
|
+
};
|
|
7724
7528
|
|
|
7725
7529
|
const imageWrapperClassName = \`\${P}-item-image-wrapper\${isFitSlider ? \` \${P}-item-image-wrapper-fit-slider\` : ''}\`.trim();
|
|
7726
7530
|
const isTextBeforeImage = type === 'd' || type === 'e' || type === 'f';
|
|
7727
|
-
const shouldAlignEntries =
|
|
7531
|
+
const shouldAlignEntries = alignEntries === 'on';
|
|
7532
|
+
const textBoxWidthStyle = \`calc(\${scalingValue(size ?? 0, isEditor)} * (\${textBoxWidth} / 100))\`;
|
|
7533
|
+
const controlWidthStyle = scalingValue(size * textBoxWidth / 100, isEditor);
|
|
7728
7534
|
|
|
7729
7535
|
const imageRadiusStyle = imageBorderRadius
|
|
7730
7536
|
? { borderRadius: imageBorderRadius, [MEDIA_RADIUS_VAR]: imageBorderRadius } as React.CSSProperties
|
|
@@ -7744,73 +7550,31 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7744
7550
|
width: 'auto',
|
|
7745
7551
|
height: 'auto',
|
|
7746
7552
|
maxWidth: '100%',
|
|
7747
|
-
...(customLayout ? { maxHeight: '100%' } : {}),
|
|
7748
7553
|
...imageRadiusStyle,
|
|
7749
7554
|
};
|
|
7750
7555
|
|
|
7751
|
-
const
|
|
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));
|
|
7774
|
-
return () => ro.disconnect();
|
|
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
|
-
};
|
|
7810
|
-
|
|
7556
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
7811
7557
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
7812
7558
|
|
|
7813
|
-
const
|
|
7559
|
+
const resolvedSplideDirection = transition === 'fade'
|
|
7560
|
+
? 'ltr'
|
|
7561
|
+
: direction === 'horizontal'
|
|
7562
|
+
? 'ltr'
|
|
7563
|
+
: direction === 'vertical'
|
|
7564
|
+
? 'ttb'
|
|
7565
|
+
: 'ltr';
|
|
7566
|
+
|
|
7567
|
+
useEffect(() => {
|
|
7568
|
+
const el = containerRef.current;
|
|
7569
|
+
if (!el) return;
|
|
7570
|
+
const ro = new ResizeObserver((entries) => {
|
|
7571
|
+
setContainerWidth(Math.round(entries[0].contentRect.width));
|
|
7572
|
+
});
|
|
7573
|
+
ro.observe(el);
|
|
7574
|
+
return () => ro.disconnect();
|
|
7575
|
+
}, []);
|
|
7576
|
+
|
|
7577
|
+
const lightboxPortalStyle = (() => {
|
|
7814
7578
|
const style: Record<string, string> = { ...(colorVars as Record<string, string>) };
|
|
7815
7579
|
const articleWidth = containerRef.current
|
|
7816
7580
|
? getComputedStyle(containerRef.current).getPropertyValue('--cntrl-article-width').trim()
|
|
@@ -7819,7 +7583,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7819
7583
|
style['--cntrl-article-width'] = articleWidth;
|
|
7820
7584
|
}
|
|
7821
7585
|
return style as React.CSSProperties;
|
|
7822
|
-
};
|
|
7586
|
+
})();
|
|
7823
7587
|
|
|
7824
7588
|
const [lightboxOpen, setLightboxOpen] = useState(false);
|
|
7825
7589
|
const [lightboxItems, setLightboxItems] = useState<GridMedia[]>([]);
|
|
@@ -7858,8 +7622,16 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7858
7622
|
<div style={colorVars}>
|
|
7859
7623
|
<div
|
|
7860
7624
|
ref={containerRef}
|
|
7861
|
-
className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''}
|
|
7862
|
-
style={
|
|
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
|
+
}}>
|
|
7863
7635
|
{cropContent.map((item: any, index: number) => {
|
|
7864
7636
|
const hasTitle = hasText(item.title);
|
|
7865
7637
|
const hasSubtitle = hasText(item.subtitle);
|
|
@@ -7869,24 +7641,11 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7869
7641
|
const gridColumn = isPartialLastRow && index >= lastRowStartIndex
|
|
7870
7642
|
? \`\${lastRowStartColumn + (index - lastRowStartIndex)}\`
|
|
7871
7643
|
: 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;
|
|
7885
7644
|
|
|
7886
7645
|
const typeCTextBlock = isTextBeforeImage ? (
|
|
7887
7646
|
<div className={\`\${P}-item-text-block\`}>
|
|
7888
7647
|
{hasTitle && (
|
|
7889
|
-
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7648
|
+
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}>
|
|
7890
7649
|
{item.title}
|
|
7891
7650
|
</p>
|
|
7892
7651
|
)}
|
|
@@ -7901,7 +7660,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7901
7660
|
/>
|
|
7902
7661
|
)}
|
|
7903
7662
|
{hasSubtitle && (
|
|
7904
|
-
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7663
|
+
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}>
|
|
7905
7664
|
{item.subtitle}
|
|
7906
7665
|
</p>
|
|
7907
7666
|
)}
|
|
@@ -7931,7 +7690,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7931
7690
|
/>
|
|
7932
7691
|
)}
|
|
7933
7692
|
{hasTitle && (
|
|
7934
|
-
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7693
|
+
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}>
|
|
7935
7694
|
{item.title}
|
|
7936
7695
|
</p>
|
|
7937
7696
|
)}
|
|
@@ -7961,7 +7720,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7961
7720
|
/>
|
|
7962
7721
|
)}
|
|
7963
7722
|
{hasSubtitle && (
|
|
7964
|
-
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7723
|
+
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}>
|
|
7965
7724
|
{item.subtitle}
|
|
7966
7725
|
</p>
|
|
7967
7726
|
)}
|
|
@@ -7985,7 +7744,10 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7985
7744
|
</LinkWrapper>
|
|
7986
7745
|
);
|
|
7987
7746
|
|
|
7988
|
-
const
|
|
7747
|
+
const displayItems = getGridDisplayItems(item.gallery);
|
|
7748
|
+
const lightboxItemsForEntry = displayItems
|
|
7749
|
+
.filter(entry => entry.lightboxMedia)
|
|
7750
|
+
.map(entry => entry.lightboxMedia!);
|
|
7989
7751
|
|
|
7990
7752
|
const imageContent = (
|
|
7991
7753
|
<GridItemMediaWrapper className={imageWrapperClassName} style={imageWrapperStyle}>
|
|
@@ -7994,8 +7756,10 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7994
7756
|
: slider === 'off'
|
|
7995
7757
|
?
|
|
7996
7758
|
(() => {
|
|
7997
|
-
const { displayMedia } = displayItems[0];
|
|
7998
|
-
const lightboxIndex =
|
|
7759
|
+
const { displayMedia, lightboxMedia } = displayItems[0];
|
|
7760
|
+
const lightboxIndex = lightboxMedia
|
|
7761
|
+
? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
|
|
7762
|
+
: -1;
|
|
7999
7763
|
return (
|
|
8000
7764
|
<GridMediaItem
|
|
8001
7765
|
media={displayMedia}
|
|
@@ -8023,28 +7787,50 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8023
7787
|
))}
|
|
8024
7788
|
</div>
|
|
8025
7789
|
)}
|
|
8026
|
-
<
|
|
8027
|
-
key={\`\${transition}-\${
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
7790
|
+
<Splide
|
|
7791
|
+
key={\`\${transition}-\${size}-\${direction}-\${sliderTiming}-\${containerWidth}-\${layoutId}\`}
|
|
7792
|
+
className={\`\${P}-item-slider\`}
|
|
7793
|
+
options={{
|
|
7794
|
+
arrows: false,
|
|
7795
|
+
pagination: false,
|
|
7796
|
+
drag: false,
|
|
7797
|
+
perPage: 1,
|
|
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;
|
|
8034
7818
|
return (
|
|
8035
|
-
<
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
7819
|
+
<SplideSlide key={imgIndex} data-slide-index={imgIndex}>
|
|
7820
|
+
<GridMediaItem
|
|
7821
|
+
media={displayMedia}
|
|
7822
|
+
className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
|
|
7823
|
+
style={imageStyle}
|
|
7824
|
+
hasLightbox={lightbox === 'on'}
|
|
7825
|
+
isSplideSlide
|
|
7826
|
+
onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
|
|
7827
|
+
? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
|
|
7828
|
+
: undefined}
|
|
7829
|
+
/>
|
|
7830
|
+
</SplideSlide>
|
|
8045
7831
|
);
|
|
8046
7832
|
})}
|
|
8047
|
-
|
|
7833
|
+
</Splide>
|
|
8048
7834
|
</>
|
|
8049
7835
|
}
|
|
8050
7836
|
</GridItemMediaWrapper>
|
|
@@ -8062,7 +7848,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8062
7848
|
/>
|
|
8063
7849
|
<p
|
|
8064
7850
|
className={titleTextClassName}
|
|
8065
|
-
style={{ width: textBoxWidthStyle, ...
|
|
7851
|
+
style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}
|
|
8066
7852
|
>
|
|
8067
7853
|
{item.title}
|
|
8068
7854
|
</p>
|
|
@@ -8076,7 +7862,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8076
7862
|
/>
|
|
8077
7863
|
<p
|
|
8078
7864
|
className={subtitleTextClassName}
|
|
8079
|
-
style={{ width: textBoxWidthStyle, ...
|
|
7865
|
+
style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}
|
|
8080
7866
|
>
|
|
8081
7867
|
{item.subtitle}
|
|
8082
7868
|
</p>
|
|
@@ -8096,18 +7882,16 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8096
7882
|
<div
|
|
8097
7883
|
key={index}
|
|
8098
7884
|
className={\`\${P}-item\`.trim()}
|
|
8099
|
-
style={
|
|
7885
|
+
style={gridColumn && !shouldAlignEntries ? { gridColumn } : undefined}
|
|
8100
7886
|
>
|
|
8101
7887
|
<div
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
? \`\${P}-item-inner\`
|
|
7888
|
+
className={\`\${isEditMode
|
|
7889
|
+
? \`\${P}-item-inner\`
|
|
8105
7890
|
: \`\${P}-item-inner-hidden\`}\${shouldAlignEntries && isLastRow ? \` \${P}-item-inner-last-row\` : ''}\`.trim()}
|
|
8106
7891
|
style={{
|
|
8107
7892
|
width: (textBoxWidth ?? 0) > 100
|
|
8108
|
-
? \`calc(\${
|
|
8109
|
-
:
|
|
8110
|
-
...(customSlot && !isTextOutside ? { height: scalingValue(customSlot.height, isEditor) } : {}),
|
|
7893
|
+
? \`calc(\${entryWidthScaled} * (\${textBoxWidth} / 100))\`
|
|
7894
|
+
: entryWidthScaled,
|
|
8111
7895
|
...(gridColumn && shouldAlignEntries ? { gridColumn } : {}),
|
|
8112
7896
|
}}
|
|
8113
7897
|
>
|
|
@@ -8153,7 +7937,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8153
7937
|
{(!isEditor || isPreviewMode) && lightboxOpen && typeof document !== 'undefined' && lightbox === 'on' && (() => {
|
|
8154
7938
|
const portalTarget = (portalId ? document.getElementById(portalId) : null) ?? document.body;
|
|
8155
7939
|
return createPortal(
|
|
8156
|
-
<div style={
|
|
7940
|
+
<div style={lightboxPortalStyle} data-selection="none">
|
|
8157
7941
|
<Lightbox
|
|
8158
7942
|
prefix={P}
|
|
8159
7943
|
items={lightboxItems}
|
|
@@ -8190,36 +7974,17 @@ type GridLayoutConfig = {
|
|
|
8190
7974
|
lockedParam?: 'wrapperWidth' | 'entryWidth' | 'horizontalGap' | null;
|
|
8191
7975
|
};
|
|
8192
7976
|
|
|
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
|
-
|
|
8211
7977
|
type GridSettings = {
|
|
8212
7978
|
type: 'a' | 'b' | 'c' | 'd' | 'e' | 'f';
|
|
8213
|
-
gridLayout
|
|
8214
|
-
customGrid?: CustomGridLayout;
|
|
7979
|
+
gridLayout: GridLayoutConfig;
|
|
8215
7980
|
textBoxWidth: number;
|
|
8216
|
-
verticalGap
|
|
8217
|
-
entriesCount
|
|
7981
|
+
verticalGap: number;
|
|
7982
|
+
entriesCount: number;
|
|
8218
7983
|
lightbox: 'on' | 'off';
|
|
8219
|
-
imageDisplay:
|
|
7984
|
+
imageDisplay: {
|
|
8220
7985
|
display: 'fit' | 'cover';
|
|
8221
|
-
ratioValue
|
|
8222
|
-
reversed
|
|
7986
|
+
ratioValue: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
|
|
7987
|
+
reversed: boolean;
|
|
8223
7988
|
};
|
|
8224
7989
|
imageCorners?: number;
|
|
8225
7990
|
lightboxImageDisplay?: 'fit' | 'cover' | { display?: 'fit' | 'cover' };
|
|
@@ -8229,9 +7994,8 @@ type GridSettings = {
|
|
|
8229
7994
|
transition: 'fade' | 'slide',
|
|
8230
7995
|
showText: 'always' | 'on hover';
|
|
8231
7996
|
hover?: 'none' | 'zoom-in' | 'greyscale' | 'scale-down';
|
|
8232
|
-
alignEntries
|
|
7997
|
+
alignEntries: 'on' | 'off';
|
|
8233
7998
|
align?: 'top' | 'center' | 'bottom';
|
|
8234
|
-
textGrowth?: 'inside' | 'outside';
|
|
8235
7999
|
titleMarginTop: number;
|
|
8236
8000
|
subtitleMarginTop: number;
|
|
8237
8001
|
titleColor: string;
|
|
@@ -25598,4 +25362,4 @@ export function Waterfall({
|
|
|
25598
25362
|
</>
|
|
25599
25363
|
);
|
|
25600
25364
|
}
|
|
25601
|
-
`,
|
|
25365
|
+
`,w={[n.BurgerComponent.id]:e,[n.ChroniclesComponent.id]:t,[n.ClickGallerieComponent.id]:i,[n.FAQComponent.id]:o,[n.FormComponent.id]:r,[n.GridComponent.id]:a,[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=w;
|