@cntrl-site/components 1.0.119 → 1.0.120-alpha.0
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/{ChroniclesComponent-D_YAkpJZ.mjs → ChroniclesComponent-CeaJBqKz.mjs} +590 -511
- package/dist/ChroniclesComponent-DK6L2w5h.js +1 -0
- package/dist/Components/Grid/CustomGridComponent.d.ts +41 -0
- package/dist/Components/Grid/Grid.d.ts +31 -7
- package/dist/{ControlSlider-DqKfaKMG.mjs → ControlSlider-BBAXRDLP.mjs} +2 -3
- package/dist/ControlSlider-BCkVFl4w.js +1 -0
- package/dist/Grid-By7t2l11.js +445 -0
- package/dist/Grid-If8uE2Sy.mjs +1865 -0
- package/dist/{components-DcHbdTvp.js → components-Cp5lKUwh.js} +1 -1
- package/dist/{components-6CfbAMrX.mjs → components-DoYrYUvq.mjs} +14 -13
- package/dist/components.css +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +8 -7
- 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 +643 -236
- package/dist/sources.mjs +684 -276
- package/package.json +1 -1
- package/dist/ChroniclesComponent-Bp8Zmj26.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-DK6L2w5h.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';
|
|
@@ -2728,7 +2728,7 @@ export function Burger({
|
|
|
2728
2728
|
</div>
|
|
2729
2729
|
);
|
|
2730
2730
|
}
|
|
2731
|
-
`,
|
|
2731
|
+
`,i=`import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
|
|
2732
2732
|
import { createPortal } from 'react-dom';
|
|
2733
2733
|
import cn from 'classnames';
|
|
2734
2734
|
import { CommonComponentProps } from '../props';
|
|
@@ -3775,7 +3775,7 @@ export function Chronicles({
|
|
|
3775
3775
|
</>
|
|
3776
3776
|
);
|
|
3777
3777
|
}
|
|
3778
|
-
`,
|
|
3778
|
+
`,o=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3779
3779
|
import { CommonComponentProps } from '../props';
|
|
3780
3780
|
import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
|
|
3781
3781
|
|
|
@@ -4304,7 +4304,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
4304
4304
|
</>
|
|
4305
4305
|
);
|
|
4306
4306
|
}
|
|
4307
|
-
`,
|
|
4307
|
+
`,r=`import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4308
4308
|
import cn from 'classnames';
|
|
4309
4309
|
import { CommonComponentProps } from '../props';
|
|
4310
4310
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -5048,7 +5048,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
|
|
|
5048
5048
|
</>
|
|
5049
5049
|
);
|
|
5050
5050
|
}
|
|
5051
|
-
`,
|
|
5051
|
+
`,a=`import React, { useMemo, useState } from 'react';
|
|
5052
5052
|
import { CommonComponentProps } from '../props';
|
|
5053
5053
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
5054
5054
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -5686,9 +5686,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
5686
5686
|
};
|
|
5687
5687
|
|
|
5688
5688
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
5689
|
-
`,
|
|
5690
|
-
import '@splidejs/react-splide/css/core';
|
|
5691
|
-
import { CommonComponentProps } from '../props';
|
|
5689
|
+
`,e=`import { CommonComponentProps } from '../props';
|
|
5692
5690
|
import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
|
|
5693
5691
|
import {
|
|
5694
5692
|
buildColorVars,
|
|
@@ -5698,7 +5696,7 @@ import {
|
|
|
5698
5696
|
useLazyVideos,
|
|
5699
5697
|
useScopedStyles,
|
|
5700
5698
|
} from '../utils/index';
|
|
5701
|
-
import { useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
|
|
5699
|
+
import { memo, useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
|
|
5702
5700
|
import { createPortal } from 'react-dom';
|
|
5703
5701
|
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
5704
5702
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
@@ -5815,15 +5813,23 @@ function getCSS(P: string): string {
|
|
|
5815
5813
|
width: 100%;
|
|
5816
5814
|
overflow: hidden;
|
|
5817
5815
|
}
|
|
5818
|
-
.\${P}-item-slider .splide__track {
|
|
5819
|
-
overflow: hidden;
|
|
5820
|
-
}
|
|
5821
5816
|
.\${P}-item-image-link {
|
|
5822
5817
|
width: 100%;
|
|
5823
5818
|
display: flex;
|
|
5824
5819
|
flex-direction: column;
|
|
5825
5820
|
align-items: center;
|
|
5826
5821
|
}
|
|
5822
|
+
.\${P}-custom-layout .\${P}-item-image-link {
|
|
5823
|
+
flex: 1 1 0%;
|
|
5824
|
+
min-height: 0;
|
|
5825
|
+
}
|
|
5826
|
+
.\${P}-custom-layout.\${P}-text-outside .\${P}-item-image-link,
|
|
5827
|
+
.\${P}-custom-layout.\${P}-auto-height .\${P}-item-image-link {
|
|
5828
|
+
flex: none;
|
|
5829
|
+
}
|
|
5830
|
+
.\${P}-auto-height .\${P}-item-image-wrapper-fit-slider > .\${P}-item-image-wrapper-sizer :is(img, video) {
|
|
5831
|
+
width: 100%;
|
|
5832
|
+
}
|
|
5827
5833
|
.\${P}-item-text-link {
|
|
5828
5834
|
display: flex;
|
|
5829
5835
|
flex-direction: column;
|
|
@@ -5844,18 +5850,47 @@ function getCSS(P: string): string {
|
|
|
5844
5850
|
display: block;
|
|
5845
5851
|
max-width: 100%;
|
|
5846
5852
|
}
|
|
5847
|
-
.\${P}-item-slider
|
|
5848
|
-
|
|
5849
|
-
.\${P}-item-slider .splide__list,
|
|
5850
|
-
.\${P}-item-slider .splide__slide {
|
|
5853
|
+
.\${P}-item-slider {
|
|
5854
|
+
position: relative;
|
|
5851
5855
|
width: 100%;
|
|
5852
5856
|
height: 100%;
|
|
5857
|
+
overflow: hidden;
|
|
5853
5858
|
}
|
|
5854
|
-
.\${P}-item-slider
|
|
5859
|
+
.\${P}-item-slider-list {
|
|
5860
|
+
position: relative;
|
|
5861
|
+
display: flex;
|
|
5862
|
+
flex-direction: row;
|
|
5863
|
+
width: 100%;
|
|
5864
|
+
height: 100%;
|
|
5865
|
+
will-change: transform;
|
|
5866
|
+
}
|
|
5867
|
+
.\${P}-item-slider-list-vertical {
|
|
5868
|
+
flex-direction: column;
|
|
5869
|
+
}
|
|
5870
|
+
.\${P}-item-slider-list-fade {
|
|
5871
|
+
display: block;
|
|
5872
|
+
will-change: auto;
|
|
5873
|
+
}
|
|
5874
|
+
.\${P}-item-slide {
|
|
5875
|
+
position: relative;
|
|
5876
|
+
flex: 0 0 100%;
|
|
5877
|
+
width: 100%;
|
|
5878
|
+
height: 100%;
|
|
5855
5879
|
display: flex;
|
|
5856
5880
|
justify-content: center;
|
|
5857
5881
|
align-items: center;
|
|
5858
5882
|
}
|
|
5883
|
+
.\${P}-item-slider-list-fade .\${P}-item-slide {
|
|
5884
|
+
position: absolute;
|
|
5885
|
+
top: 0;
|
|
5886
|
+
left: 0;
|
|
5887
|
+
opacity: 0;
|
|
5888
|
+
transition: opacity \${SLIDER_TRANSITION_MS}ms \${SLIDER_EASING};
|
|
5889
|
+
}
|
|
5890
|
+
.\${P}-item-slider-list-fade .\${P}-item-slide-active {
|
|
5891
|
+
opacity: 1;
|
|
5892
|
+
z-index: 1;
|
|
5893
|
+
}
|
|
5859
5894
|
.\${P}-item-title {
|
|
5860
5895
|
white-space: normal;
|
|
5861
5896
|
overflow-wrap: anywhere;
|
|
@@ -6002,13 +6037,13 @@ function getCSS(P: string): string {
|
|
|
6002
6037
|
.\${P}-image-align-bottom .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
|
|
6003
6038
|
align-items: flex-end;
|
|
6004
6039
|
}
|
|
6005
|
-
.\${P}-image-align-top .\${P}-item-slider
|
|
6040
|
+
.\${P}-image-align-top .\${P}-item-slider .\${P}-item-slide {
|
|
6006
6041
|
align-items: flex-start;
|
|
6007
6042
|
}
|
|
6008
|
-
.\${P}-image-align-center .\${P}-item-slider
|
|
6043
|
+
.\${P}-image-align-center .\${P}-item-slider .\${P}-item-slide {
|
|
6009
6044
|
align-items: center;
|
|
6010
6045
|
}
|
|
6011
|
-
.\${P}-image-align-bottom .\${P}-item-slider
|
|
6046
|
+
.\${P}-image-align-bottom .\${P}-item-slider .\${P}-item-slide {
|
|
6012
6047
|
align-items: flex-end;
|
|
6013
6048
|
}
|
|
6014
6049
|
.\${P}-align-entries .\${P}-item {
|
|
@@ -6089,13 +6124,13 @@ function getCSS(P: string): string {
|
|
|
6089
6124
|
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
|
|
6090
6125
|
align-items: flex-end;
|
|
6091
6126
|
}
|
|
6092
|
-
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider
|
|
6127
|
+
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
|
|
6093
6128
|
align-items: flex-start;
|
|
6094
6129
|
}
|
|
6095
|
-
.\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider
|
|
6130
|
+
.\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
|
|
6096
6131
|
align-items: center;
|
|
6097
6132
|
}
|
|
6098
|
-
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider
|
|
6133
|
+
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
|
|
6099
6134
|
align-items: flex-end;
|
|
6100
6135
|
}
|
|
6101
6136
|
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-image-link {
|
|
@@ -6163,27 +6198,9 @@ function pickRandomSlideDirection(): 'ltr' | 'ttb' {
|
|
|
6163
6198
|
return Math.random() < 0.5 ? 'ltr' : 'ttb';
|
|
6164
6199
|
}
|
|
6165
6200
|
|
|
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
|
-
});
|
|
6201
|
+
function wrapSlideIndex(index: number, count: number): number {
|
|
6202
|
+
if (count <= 0) return 0;
|
|
6203
|
+
return ((index % count) + count) % count;
|
|
6187
6204
|
}
|
|
6188
6205
|
|
|
6189
6206
|
type GridProps = {
|
|
@@ -6223,6 +6240,8 @@ type LightboxProps = {
|
|
|
6223
6240
|
|
|
6224
6241
|
const LIGHTBOX_ANIM_MS = 500;
|
|
6225
6242
|
const SLIDER_TRANSITION_MS = 750;
|
|
6243
|
+
const SLIDER_EASING = 'cubic-bezier(0.25, 1, 0.5, 1)';
|
|
6244
|
+
const SLIDER_DEFAULT_INTERVAL_MS = 5000;
|
|
6226
6245
|
const LIGHTBOX_EASING = 'cubic-bezier(0.22, 1, 0.36, 1)';
|
|
6227
6246
|
const SWIPE_CLOSE_THRESHOLD = 72;
|
|
6228
6247
|
const SWIPE_NAV_THRESHOLD = 50;
|
|
@@ -6312,7 +6331,7 @@ function collectGridLightboxMedia(content: any[]): GridMedia[] {
|
|
|
6312
6331
|
return result;
|
|
6313
6332
|
}
|
|
6314
6333
|
|
|
6315
|
-
function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
6334
|
+
const LightboxMediaPreloadPool = memo(function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
6316
6335
|
const [pool, setPool] = useState<HTMLDivElement | null>(null);
|
|
6317
6336
|
useLazyVideos(pool, { preload: 'metadata' });
|
|
6318
6337
|
// an embed's player is only ever framed where it shows
|
|
@@ -6351,7 +6370,7 @@ function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
|
6351
6370
|
))}
|
|
6352
6371
|
</div>
|
|
6353
6372
|
);
|
|
6354
|
-
}
|
|
6373
|
+
});
|
|
6355
6374
|
|
|
6356
6375
|
function unloadVideoElement(video: HTMLVideoElement) {
|
|
6357
6376
|
video.pause();
|
|
@@ -6359,15 +6378,121 @@ function unloadVideoElement(video: HTMLVideoElement) {
|
|
|
6359
6378
|
video.load();
|
|
6360
6379
|
}
|
|
6361
6380
|
|
|
6362
|
-
const
|
|
6381
|
+
const GRID_SLIDE_CLASS = 'cntrl-grid-slide';
|
|
6382
|
+
const GRID_SLIDE_PLAYING_CLASS = 'cntrl-grid-slide-playing';
|
|
6383
|
+
const GRID_SLIDE_VIDEOS = \`.\${GRID_SLIDE_CLASS} video\`;
|
|
6363
6384
|
|
|
6364
6385
|
function shouldPlaySlideVideo(video: HTMLVideoElement): boolean {
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6386
|
+
return video.closest(\`.\${GRID_SLIDE_PLAYING_CLASS}\`) !== null;
|
|
6387
|
+
}
|
|
6388
|
+
|
|
6389
|
+
type GridEntrySliderProps = {
|
|
6390
|
+
prefix: string;
|
|
6391
|
+
slides: React.ReactNode[];
|
|
6392
|
+
isFade: boolean;
|
|
6393
|
+
direction: GridSettings['direction'];
|
|
6394
|
+
intervalMs: number;
|
|
6395
|
+
};
|
|
6396
|
+
|
|
6397
|
+
function GridEntrySlider({ prefix: P, slides, isFade, direction, intervalMs }: GridEntrySliderProps) {
|
|
6398
|
+
const count = slides.length;
|
|
6399
|
+
const hasClones = !isFade && count > 1;
|
|
6400
|
+
const isRandom = !isFade && direction === 'random';
|
|
6401
|
+
const delayMs = Number.isFinite(intervalMs) && intervalMs > 0 ? intervalMs : SLIDER_DEFAULT_INTERVAL_MS;
|
|
6402
|
+
const [position, setPosition] = useState(hasClones ? 1 : 0);
|
|
6403
|
+
const [axis, setAxis] = useState<'ltr' | 'ttb'>(!isFade && direction === 'vertical' ? 'ttb' : 'ltr');
|
|
6404
|
+
const [isMoving, setIsMoving] = useState(false);
|
|
6405
|
+
const [skipTransition, setSkipTransition] = useState(false);
|
|
6406
|
+
const [cycle, setCycle] = useState(0);
|
|
6407
|
+
const isMovingRef = useRef(false);
|
|
6408
|
+
|
|
6409
|
+
useEffect(() => {
|
|
6410
|
+
if (count < 2) return;
|
|
6411
|
+
const timeoutId = window.setTimeout(() => {
|
|
6412
|
+
if (isMovingRef.current) {
|
|
6413
|
+
setCycle(prev => prev + 1);
|
|
6414
|
+
return;
|
|
6415
|
+
}
|
|
6416
|
+
isMovingRef.current = true;
|
|
6417
|
+
setIsMoving(true);
|
|
6418
|
+
setSkipTransition(false);
|
|
6419
|
+
setPosition(prev => (hasClones ? prev + 1 : wrapSlideIndex(prev + 1, count)));
|
|
6420
|
+
if (!isRandom) setCycle(prev => prev + 1);
|
|
6421
|
+
}, delayMs);
|
|
6422
|
+
return () => window.clearTimeout(timeoutId);
|
|
6423
|
+
}, [count, cycle, delayMs, hasClones, isRandom]);
|
|
6424
|
+
|
|
6425
|
+
useEffect(() => {
|
|
6426
|
+
if (!isMoving) return;
|
|
6427
|
+
const timeoutId = window.setTimeout(() => {
|
|
6428
|
+
const isOnClone = hasClones && position === count + 1;
|
|
6429
|
+
const nextAxis = isRandom ? pickRandomSlideDirection() : axis;
|
|
6430
|
+
if (isOnClone || nextAxis !== axis) {
|
|
6431
|
+
setSkipTransition(true);
|
|
6432
|
+
if (isOnClone) setPosition(1);
|
|
6433
|
+
setAxis(nextAxis);
|
|
6434
|
+
}
|
|
6435
|
+
isMovingRef.current = false;
|
|
6436
|
+
setIsMoving(false);
|
|
6437
|
+
if (isRandom) setCycle(prev => prev + 1);
|
|
6438
|
+
}, SLIDER_TRANSITION_MS);
|
|
6439
|
+
return () => window.clearTimeout(timeoutId);
|
|
6440
|
+
}, [axis, count, hasClones, isMoving, isRandom, position]);
|
|
6441
|
+
|
|
6442
|
+
useEffect(() => {
|
|
6443
|
+
if (!skipTransition) return;
|
|
6444
|
+
let innerId = 0;
|
|
6445
|
+
const outerId = requestAnimationFrame(() => {
|
|
6446
|
+
innerId = requestAnimationFrame(() => setSkipTransition(false));
|
|
6447
|
+
});
|
|
6448
|
+
return () => {
|
|
6449
|
+
cancelAnimationFrame(outerId);
|
|
6450
|
+
cancelAnimationFrame(innerId);
|
|
6451
|
+
};
|
|
6452
|
+
}, [skipTransition]);
|
|
6453
|
+
|
|
6454
|
+
const slotsCount = hasClones ? count + 2 : count;
|
|
6455
|
+
const getItemIndex = (slot: number) => (hasClones ? wrapSlideIndex(slot - 1, count) : slot);
|
|
6456
|
+
const isCloneSlot = (slot: number) => hasClones && (slot === 0 || slot === count + 1);
|
|
6457
|
+
const activeIndex = getItemIndex(position);
|
|
6458
|
+
const nextSlot = position + 1 < slotsCount ? position + 1 : -1;
|
|
6459
|
+
const isPlayingSlot = (slot: number) => isFade
|
|
6460
|
+
|| (slot === position && !isCloneSlot(slot))
|
|
6461
|
+
|| slot === nextSlot
|
|
6462
|
+
|| (nextSlot >= 0 && !isCloneSlot(slot) && getItemIndex(slot) === getItemIndex(nextSlot));
|
|
6463
|
+
const isVertical = !isFade && axis === 'ttb';
|
|
6464
|
+
const listStyle: React.CSSProperties | undefined = isFade
|
|
6465
|
+
? undefined
|
|
6466
|
+
: {
|
|
6467
|
+
transform: isVertical
|
|
6468
|
+
? \`translate3d(0, \${-position * 100}%, 0)\`
|
|
6469
|
+
: \`translate3d(\${-position * 100}%, 0, 0)\`,
|
|
6470
|
+
transition: skipTransition ? 'none' : \`transform \${SLIDER_TRANSITION_MS}ms \${SLIDER_EASING}\`,
|
|
6471
|
+
};
|
|
6472
|
+
|
|
6473
|
+
return (
|
|
6474
|
+
<div className={\`\${P}-item-slider\`}>
|
|
6475
|
+
<div
|
|
6476
|
+
className={\`\${P}-item-slider-list\${isFade ? \` \${P}-item-slider-list-fade\` : ''}\${isVertical ? \` \${P}-item-slider-list-vertical\` : ''}\`}
|
|
6477
|
+
style={listStyle}
|
|
6478
|
+
>
|
|
6479
|
+
{Array.from({ length: slotsCount }, (_, slot) => {
|
|
6480
|
+
const itemIndex = getItemIndex(slot);
|
|
6481
|
+
const isClone = isCloneSlot(slot);
|
|
6482
|
+
const isShown = isFade ? itemIndex === activeIndex : slot === position;
|
|
6483
|
+
return (
|
|
6484
|
+
<div
|
|
6485
|
+
key={isClone ? \`clone-\${slot === 0 ? 'start' : 'end'}\` : \`slide-\${itemIndex}\`}
|
|
6486
|
+
className={\`\${P}-item-slide \${GRID_SLIDE_CLASS}\${isFade && isShown ? \` \${P}-item-slide-active\` : ''}\${isPlayingSlot(slot) ? \` \${GRID_SLIDE_PLAYING_CLASS}\` : ''}\`}
|
|
6487
|
+
aria-hidden={isShown ? undefined : true}
|
|
6488
|
+
>
|
|
6489
|
+
{slides[itemIndex]}
|
|
6490
|
+
</div>
|
|
6491
|
+
);
|
|
6492
|
+
})}
|
|
6493
|
+
</div>
|
|
6494
|
+
</div>
|
|
6495
|
+
);
|
|
6371
6496
|
}
|
|
6372
6497
|
|
|
6373
6498
|
function GridMediaItem({
|
|
@@ -6375,7 +6500,7 @@ function GridMediaItem({
|
|
|
6375
6500
|
className,
|
|
6376
6501
|
style,
|
|
6377
6502
|
hasLightbox,
|
|
6378
|
-
|
|
6503
|
+
isSliderSlide = false,
|
|
6379
6504
|
onMediaClick,
|
|
6380
6505
|
}: {
|
|
6381
6506
|
media: GridMedia;
|
|
@@ -6383,7 +6508,7 @@ function GridMediaItem({
|
|
|
6383
6508
|
style: React.CSSProperties;
|
|
6384
6509
|
/** An embed then plays here as a silent loop, and as it was set to in the lightbox. */
|
|
6385
6510
|
hasLightbox: boolean;
|
|
6386
|
-
|
|
6511
|
+
isSliderSlide?: boolean;
|
|
6387
6512
|
onMediaClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
6388
6513
|
}) {
|
|
6389
6514
|
if (isEmbedMedia(media)) {
|
|
@@ -6415,7 +6540,7 @@ function GridMediaItem({
|
|
|
6415
6540
|
playsInline: true,
|
|
6416
6541
|
onClick: onMediaClick,
|
|
6417
6542
|
};
|
|
6418
|
-
return
|
|
6543
|
+
return isSliderSlide
|
|
6419
6544
|
? <video {...videoProps} preload='none' />
|
|
6420
6545
|
: <LazyVideo {...videoProps} autoPlay />;
|
|
6421
6546
|
}
|
|
@@ -6444,7 +6569,7 @@ function GridItemMediaWrapper({
|
|
|
6444
6569
|
children: React.ReactNode;
|
|
6445
6570
|
}) {
|
|
6446
6571
|
const [wrapper, setWrapper] = useState<HTMLDivElement | null>(null);
|
|
6447
|
-
useLazyVideos(wrapper, { autoPlay: true, selector:
|
|
6572
|
+
useLazyVideos(wrapper, { autoPlay: true, selector: GRID_SLIDE_VIDEOS, shouldPlay: shouldPlaySlideVideo });
|
|
6448
6573
|
|
|
6449
6574
|
return (
|
|
6450
6575
|
<div ref={setWrapper} className={className} style={style}>
|
|
@@ -7345,11 +7470,169 @@ function resolveLightboxImageDisplay(
|
|
|
7345
7470
|
return value?.display === 'cover' ? 'cover' : 'fit';
|
|
7346
7471
|
}
|
|
7347
7472
|
|
|
7473
|
+
function getCustomGridSpanWidth(layout: CustomGridLayout, span: number): number {
|
|
7474
|
+
return layout.columnWidth * span + layout.gutterWidth * Math.max(0, span - 1);
|
|
7475
|
+
}
|
|
7476
|
+
|
|
7477
|
+
type CustomGridSlot = {
|
|
7478
|
+
column: number;
|
|
7479
|
+
span: number;
|
|
7480
|
+
width: number;
|
|
7481
|
+
top: number;
|
|
7482
|
+
height: number;
|
|
7483
|
+
gridColumn: string;
|
|
7484
|
+
};
|
|
7485
|
+
|
|
7486
|
+
function getCustomGridBlocksBottom(layout: CustomGridLayout): number {
|
|
7487
|
+
return layout.blocks.reduce((bottom, block) => Math.max(bottom, Math.max(0, block.top) + Math.max(0, block.height)), 0);
|
|
7488
|
+
}
|
|
7489
|
+
|
|
7490
|
+
function getCustomGridVerticalGap(layout: CustomGridLayout): number {
|
|
7491
|
+
if (typeof layout.verticalGap === 'number') return Math.max(0, layout.verticalGap);
|
|
7492
|
+
return Math.max(0, (layout.repeatHeight ?? 0) - getCustomGridBlocksBottom(layout));
|
|
7493
|
+
}
|
|
7494
|
+
|
|
7495
|
+
function getCustomGridSlot(layout: CustomGridLayout, index: number): CustomGridSlot {
|
|
7496
|
+
const block = layout.blocks[index % layout.blocks.length];
|
|
7497
|
+
const span = Math.min(Math.max(1, Math.round(block.span)), layout.columnsCount);
|
|
7498
|
+
const column = Math.min(Math.max(0, Math.round(block.column)), layout.columnsCount - span);
|
|
7499
|
+
return {
|
|
7500
|
+
column,
|
|
7501
|
+
span,
|
|
7502
|
+
width: getCustomGridSpanWidth(layout, span),
|
|
7503
|
+
top: Math.max(0, block.top),
|
|
7504
|
+
height: Math.max(0, block.height),
|
|
7505
|
+
gridColumn: \`\${column + 1} / span \${span}\`,
|
|
7506
|
+
};
|
|
7507
|
+
}
|
|
7508
|
+
|
|
7509
|
+
const EDGE_TOLERANCE = 1e-6;
|
|
7510
|
+
|
|
7511
|
+
function getCustomGridRows(layout: CustomGridLayout, entriesCount: number, entryHeights?: number[]) {
|
|
7512
|
+
const beat = layout.beat ?? 0;
|
|
7513
|
+
const onBeats = beat > 0 && !!entryHeights;
|
|
7514
|
+
const snapUp = (value: number) => Math.ceil(value / beat - 1e-3) * beat;
|
|
7515
|
+
const tracks: (number | 'auto')[] = [];
|
|
7516
|
+
const gridRows: string[] = [];
|
|
7517
|
+
const verticalGap = getCustomGridVerticalGap(layout);
|
|
7518
|
+
for (let groupStart = 0; groupStart < entriesCount; groupStart += layout.blocks.length) {
|
|
7519
|
+
if (groupStart > 0 && verticalGap > 0) tracks.push(verticalGap);
|
|
7520
|
+
const slots = Array.from(
|
|
7521
|
+
{ length: Math.min(layout.blocks.length, entriesCount - groupStart) },
|
|
7522
|
+
(_, index) => getCustomGridSlot(layout, groupStart + index),
|
|
7523
|
+
);
|
|
7524
|
+
const ends = slots.map((slot) => {
|
|
7525
|
+
const under = slots.filter(other => other.column < slot.column + slot.span
|
|
7526
|
+
&& slot.column < other.column + other.span
|
|
7527
|
+
&& other.top >= slot.top + slot.height - EDGE_TOLERANCE);
|
|
7528
|
+
return under.length > 0 ? Math.min(...under.map(other => other.top)) : undefined;
|
|
7529
|
+
});
|
|
7530
|
+
const tops = [0, ...slots.map(slot => slot.top)]
|
|
7531
|
+
.sort((a, b) => a - b)
|
|
7532
|
+
.filter((top, index, sorted) => index === 0 || top - sorted[index - 1] > EDGE_TOLERANCE);
|
|
7533
|
+
const isSame = (a: number, b: number) => Math.abs(a - b) <= EDGE_TOLERANCE;
|
|
7534
|
+
const getTop = (value: number) => tops.findIndex(top => isSame(top, value));
|
|
7535
|
+
const positions: number[] = [];
|
|
7536
|
+
let position = 0;
|
|
7537
|
+
const pushContentTrack = (isEnding: (end: number | undefined) => boolean) => {
|
|
7538
|
+
const ending = slots.flatMap((slot, index) => (isEnding(ends[index]) ? [{ slot, entry: groupStart + index }] : []));
|
|
7539
|
+
if (ending.length === 0) return;
|
|
7540
|
+
if (!onBeats) {
|
|
7541
|
+
tracks.push('auto');
|
|
7542
|
+
return;
|
|
7543
|
+
}
|
|
7544
|
+
const needed = Math.max(...ending.map(({ slot, entry }) => positions[getTop(slot.top)] + (entryHeights[entry] ?? 0)));
|
|
7545
|
+
const track = Math.max(0, snapUp(needed) - position);
|
|
7546
|
+
tracks.push(track);
|
|
7547
|
+
position += track;
|
|
7548
|
+
};
|
|
7549
|
+
const lines = tops.map((top, index) => {
|
|
7550
|
+
if (index > 0) {
|
|
7551
|
+
tracks.push(top - tops[index - 1]);
|
|
7552
|
+
position += top - tops[index - 1];
|
|
7553
|
+
}
|
|
7554
|
+
pushContentTrack(end => end !== undefined && isSame(end, top));
|
|
7555
|
+
positions.push(position);
|
|
7556
|
+
return tracks.length + 1;
|
|
7557
|
+
});
|
|
7558
|
+
pushContentTrack(end => end === undefined);
|
|
7559
|
+
const groupEnd = tracks.length + 1;
|
|
7560
|
+
const getLine = (value: number) => lines[getTop(value)];
|
|
7561
|
+
slots.forEach((slot, index) => {
|
|
7562
|
+
const end = ends[index];
|
|
7563
|
+
gridRows.push(\`\${getLine(slot.top)} / \${end === undefined ? groupEnd : getLine(end)}\`);
|
|
7564
|
+
});
|
|
7565
|
+
}
|
|
7566
|
+
return { tracks, gridRows };
|
|
7567
|
+
}
|
|
7568
|
+
|
|
7569
|
+
function getGridMediaAspect(media: GridMedia): number | undefined {
|
|
7570
|
+
if (isEmbedMedia(media)) return getEmbedAspect(media);
|
|
7571
|
+
return media.width && media.height && media.width > 0 && media.height > 0 ? media.width / media.height : undefined;
|
|
7572
|
+
}
|
|
7573
|
+
|
|
7574
|
+
function placeCustomGridRows(layout: CustomGridLayout, slots: CustomGridSlot[], heights: number[]) {
|
|
7575
|
+
const groupSize = layout.blocks.length;
|
|
7576
|
+
const verticalGap = getCustomGridVerticalGap(layout);
|
|
7577
|
+
const rowTops = slots.slice(0, groupSize)
|
|
7578
|
+
.map(slot => slot.top)
|
|
7579
|
+
.sort((a, b) => a - b)
|
|
7580
|
+
.filter((top, index, sorted) => index === 0 || top - sorted[index - 1] > EDGE_TOLERANCE);
|
|
7581
|
+
const tops: number[] = [];
|
|
7582
|
+
let top = 0;
|
|
7583
|
+
let bottom = 0;
|
|
7584
|
+
for (let start = 0; start < slots.length; start += groupSize) {
|
|
7585
|
+
for (const rowTop of rowTops) {
|
|
7586
|
+
const entries = Array.from({ length: Math.min(groupSize, slots.length - start) }, (_, index) => start + index)
|
|
7587
|
+
.filter(entry => Math.abs(slots[entry].top - rowTop) <= EDGE_TOLERANCE);
|
|
7588
|
+
if (entries.length === 0) continue;
|
|
7589
|
+
entries.forEach((entry) => {
|
|
7590
|
+
tops[entry] = top;
|
|
7591
|
+
});
|
|
7592
|
+
bottom = Math.max(...entries.map(entry => top + heights[entry]));
|
|
7593
|
+
top = bottom + verticalGap;
|
|
7594
|
+
}
|
|
7595
|
+
}
|
|
7596
|
+
return { tops, bottom };
|
|
7597
|
+
}
|
|
7598
|
+
|
|
7599
|
+
function placeCustomGridEntries(layout: CustomGridLayout, slots: CustomGridSlot[], heights: number[]) {
|
|
7600
|
+
if (layout.gridType === 'rows') return placeCustomGridRows(layout, slots, heights);
|
|
7601
|
+
const groupSize = layout.blocks.length;
|
|
7602
|
+
const verticalGap = getCustomGridVerticalGap(layout);
|
|
7603
|
+
const isMasonry = layout.masonry === 'on';
|
|
7604
|
+
const tops: number[] = [];
|
|
7605
|
+
const placed: { column: number; span: number; bottom: number; group: number }[] = [];
|
|
7606
|
+
const getBottom = (items: typeof placed) => items.reduce((bottom, item) => Math.max(bottom, item.bottom), 0);
|
|
7607
|
+
let groupStart = 0;
|
|
7608
|
+
for (let start = 0; start < slots.length; start += groupSize) {
|
|
7609
|
+
const group = start / groupSize;
|
|
7610
|
+
const entries = Array.from({ length: Math.min(groupSize, slots.length - start) }, (_, index) => start + index)
|
|
7611
|
+
.sort((a, b) => slots[a].top - slots[b].top || a - b);
|
|
7612
|
+
for (const entry of entries) {
|
|
7613
|
+
const slot = slots[entry];
|
|
7614
|
+
const sharesColumns = (other: { column: number; span: number }) => other.column < slot.column + slot.span
|
|
7615
|
+
&& slot.column < other.column + other.span;
|
|
7616
|
+
const above = entries.filter(other => other !== entry && tops[other] !== undefined && sharesColumns(slots[other])
|
|
7617
|
+
&& slots[other].top + slots[other].height <= slot.top + EDGE_TOLERANCE);
|
|
7618
|
+
const earlier = isMasonry ? placed.filter(item => item.group < group && sharesColumns(item)) : [];
|
|
7619
|
+
const candidates = above.map(other => tops[other] + heights[other] + slot.top - (slots[other].top + slots[other].height));
|
|
7620
|
+
if (earlier.length > 0) candidates.push(getBottom(earlier) + verticalGap);
|
|
7621
|
+
if (candidates.length === 0) candidates.push(groupStart + slot.top);
|
|
7622
|
+
tops[entry] = Math.max(...candidates);
|
|
7623
|
+
placed.push({ column: slot.column, span: slot.span, bottom: tops[entry] + heights[entry], group });
|
|
7624
|
+
}
|
|
7625
|
+
groupStart = getBottom(placed) + verticalGap;
|
|
7626
|
+
}
|
|
7627
|
+
return { tops, bottom: getBottom(placed) };
|
|
7628
|
+
}
|
|
7629
|
+
|
|
7348
7630
|
export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, metadata, activeEvent, layoutId, portalId }: GridProps) {
|
|
7349
7631
|
const { prefix: P } = useScopedStyles();
|
|
7350
7632
|
const {
|
|
7351
7633
|
type = 'a',
|
|
7352
7634
|
gridLayout,
|
|
7635
|
+
customGrid,
|
|
7353
7636
|
textBoxWidth = 100,
|
|
7354
7637
|
verticalGap,
|
|
7355
7638
|
entriesCount,
|
|
@@ -7397,62 +7680,69 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7397
7680
|
hover = 'none',
|
|
7398
7681
|
alignEntries = 'off',
|
|
7399
7682
|
align = 'top',
|
|
7683
|
+
textGrowth = 'inside',
|
|
7400
7684
|
} = settings;
|
|
7401
7685
|
|
|
7402
|
-
const
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7686
|
+
const titleTextStyle = useMemo(() => ({
|
|
7687
|
+
...omitTextColors(textStylesToCss({
|
|
7688
|
+
fontSettings: {
|
|
7689
|
+
fontFamily: titleFontFamily,
|
|
7690
|
+
fontWeight: titleFontSettings?.fontWeight ?? 400,
|
|
7691
|
+
fontStyle: titleFontSettings?.fontStyle ?? 'normal',
|
|
7692
|
+
},
|
|
7693
|
+
fontSize: titleFontSize ?? 0.01,
|
|
7694
|
+
lineHeight: titleLineHeight,
|
|
7695
|
+
letterSpacing: titleLetterSpacing ?? 0,
|
|
7696
|
+
wordSpacing: titleWordSpacing ?? 0,
|
|
7697
|
+
textAppearance: titleTextAppearance,
|
|
7698
|
+
color: titleColor,
|
|
7699
|
+
}, isEditor)),
|
|
7700
|
+
...getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor),
|
|
7701
|
+
} as React.CSSProperties), [
|
|
7702
|
+
titleFontFamily, titleFontSettings, titleFontSize, titleLineHeight, titleLetterSpacing,
|
|
7703
|
+
titleWordSpacing, titleTextAppearance, titleColor, isEditor, P,
|
|
7704
|
+
]);
|
|
7419
7705
|
|
|
7420
|
-
const
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7706
|
+
const subtitleTextStyle = useMemo(() => ({
|
|
7707
|
+
...omitTextColors(textStylesToCss({
|
|
7708
|
+
fontSettings: {
|
|
7709
|
+
fontFamily: subtitleFontFamily,
|
|
7710
|
+
fontWeight: subtitleFontSettings?.fontWeight ?? 400,
|
|
7711
|
+
fontStyle: subtitleFontSettings?.fontStyle ?? 'normal',
|
|
7712
|
+
},
|
|
7713
|
+
fontSize: subtitleFontSize ?? 0.01,
|
|
7714
|
+
lineHeight: subtitleLineHeight,
|
|
7715
|
+
letterSpacing: subtitleLetterSpacing ?? 0,
|
|
7716
|
+
wordSpacing: subtitleWordSpacing ?? 0,
|
|
7717
|
+
textAppearance: subtitleTextAppearance,
|
|
7718
|
+
color: subtitleColor,
|
|
7719
|
+
}, isEditor)),
|
|
7720
|
+
...getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor),
|
|
7721
|
+
} as React.CSSProperties), [
|
|
7722
|
+
subtitleFontFamily, subtitleFontSettings, subtitleFontSize, subtitleLineHeight, subtitleLetterSpacing,
|
|
7723
|
+
subtitleWordSpacing, subtitleTextAppearance, subtitleColor, isEditor, P,
|
|
7724
|
+
]);
|
|
7437
7725
|
|
|
7438
|
-
const
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
const lightboxCounterFieldCss = {
|
|
7453
|
-
...lightboxCounterTypographyCss,
|
|
7726
|
+
const lightboxCounterFieldCss = useMemo(() => ({
|
|
7727
|
+
...omitTextColors(textStylesToCss({
|
|
7728
|
+
fontSettings: {
|
|
7729
|
+
fontFamily: lightboxCounterFontFamily,
|
|
7730
|
+
fontWeight: lightboxCounterFontSettings?.fontWeight ?? 400,
|
|
7731
|
+
fontStyle: lightboxCounterFontSettings?.fontStyle ?? 'normal',
|
|
7732
|
+
},
|
|
7733
|
+
fontSize: lightboxCounterFontSize ?? 0.01,
|
|
7734
|
+
lineHeight: lightboxCounterLineHeight,
|
|
7735
|
+
letterSpacing: lightboxCounterLetterSpacing ?? 0,
|
|
7736
|
+
wordSpacing: lightboxCounterWordSpacing ?? 0,
|
|
7737
|
+
textAppearance: lightboxCounterTextAppearance,
|
|
7738
|
+
color: lightboxCounterColor,
|
|
7739
|
+
}, isEditor)),
|
|
7454
7740
|
...getGridTextLeadingVars(lightboxCounterFontSize, lightboxCounterLineHeight, P, isEditor),
|
|
7455
|
-
} as React.CSSProperties
|
|
7741
|
+
} as React.CSSProperties), [
|
|
7742
|
+
lightboxCounterFontFamily, lightboxCounterFontSettings, lightboxCounterFontSize, lightboxCounterLineHeight,
|
|
7743
|
+
lightboxCounterLetterSpacing, lightboxCounterWordSpacing, lightboxCounterTextAppearance, lightboxCounterColor,
|
|
7744
|
+
isEditor, P,
|
|
7745
|
+
]);
|
|
7456
7746
|
|
|
7457
7747
|
const titleTextClassName = getGridTextClassName(
|
|
7458
7748
|
titleFontSize,
|
|
@@ -7466,8 +7756,6 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7466
7756
|
\`\${P}-item-subtitle\`,
|
|
7467
7757
|
\`\${P}-text-tight-leading\`,
|
|
7468
7758
|
);
|
|
7469
|
-
const titleTextLeadingVars = getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor);
|
|
7470
|
-
const subtitleTextLeadingVars = getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor);
|
|
7471
7759
|
const lightboxCounterClassName = getGridTextClassName(
|
|
7472
7760
|
lightboxCounterFontSize,
|
|
7473
7761
|
lightboxCounterLineHeight,
|
|
@@ -7475,42 +7763,58 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7475
7763
|
\`\${P}-text-tight-leading\`,
|
|
7476
7764
|
);
|
|
7477
7765
|
|
|
7478
|
-
const colorVars = buildColorVars(P, {
|
|
7766
|
+
const colorVars = useMemo(() => buildColorVars(P, {
|
|
7479
7767
|
titleColor,
|
|
7480
7768
|
subtitleColor,
|
|
7481
7769
|
lightboxCounterColor,
|
|
7482
|
-
}, COLOR_VAR_MAP, STATE_KEYS);
|
|
7770
|
+
}, COLOR_VAR_MAP, STATE_KEYS), [P, titleColor, subtitleColor, lightboxCounterColor]);
|
|
7483
7771
|
|
|
7484
7772
|
const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
|
|
7485
7773
|
const showTextOnHover = showText === 'on hover' && (!isEditor || isPreviewMode);
|
|
7486
7774
|
const hoverEffectClass = hover !== 'none' && (!isEditor || isPreviewMode) ? \` \${P}-hover-\${hover}\` : '';
|
|
7487
7775
|
const wrapperStateClasses = \`\${stateClass}\${showTextOnHover ? \` \${P}-show-text-hover\` : ''}\${hoverEffectClass}\`.trim();
|
|
7488
7776
|
|
|
7489
|
-
const
|
|
7777
|
+
const customLayout = customGrid && Array.isArray(customGrid.blocks) && customGrid.blocks.length > 0 ? customGrid : undefined;
|
|
7778
|
+
const resEntriesCount = customLayout || entriesCount === 0 ? Infinity : entriesCount;
|
|
7779
|
+
const isTextOutside = !!customLayout && (customLayout.textGrowth ?? textGrowth) === 'outside';
|
|
7780
|
+
const isAutoHeight = customLayout?.cellHeight === 'auto';
|
|
7781
|
+
const isPlacedLayout = isAutoHeight || customLayout?.masonry === 'on';
|
|
7782
|
+
const itemInnerRefs = useRef<(HTMLDivElement | null)[]>([]);
|
|
7783
|
+
const [customEntryHeights, setCustomEntryHeights] = useState<number[]>([]);
|
|
7490
7784
|
|
|
7491
|
-
const cropContent = (content ?? []).slice(0, resEntriesCount);
|
|
7785
|
+
const cropContent = useMemo<any[]>(() => (content ?? []).slice(0, resEntriesCount), [content, resEntriesCount]);
|
|
7492
7786
|
const lightboxMediaToPreload = useMemo(
|
|
7493
7787
|
() => (lightbox === 'on' ? collectGridLightboxMedia(cropContent) : []),
|
|
7494
7788
|
[cropContent, lightbox],
|
|
7495
7789
|
);
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7790
|
+
const entriesMedia = useMemo(() => cropContent.map((item: any) => {
|
|
7791
|
+
const displayItems = getGridDisplayItems(item.gallery);
|
|
7792
|
+
const lightboxItemsForEntry = displayItems
|
|
7793
|
+
.filter(entry => entry.lightboxMedia)
|
|
7794
|
+
.map(entry => entry.lightboxMedia!);
|
|
7795
|
+
const lightboxIndexes = displayItems.map(({ lightboxMedia }) => (lightboxMedia
|
|
7796
|
+
? lightboxItemsForEntry.findIndex(media => media.assetId === lightboxMedia.assetId)
|
|
7797
|
+
: -1));
|
|
7798
|
+
return { displayItems, lightboxItemsForEntry, lightboxIndexes };
|
|
7799
|
+
}), [cropContent]);
|
|
7800
|
+
|
|
7801
|
+
const size = gridLayout?.entryWidth ?? 0.2;
|
|
7802
|
+
|
|
7803
|
+
const imageDisplaySettings = typeof imageDisplay === 'string' ? { display: imageDisplay } : imageDisplay;
|
|
7804
|
+
const isCover = (customLayout?.mediaDisplay ?? imageDisplaySettings?.display) === 'cover';
|
|
7805
|
+
const ratioValue = imageDisplaySettings?.ratioValue ?? '1:1';
|
|
7806
|
+
const ratioReversed = imageDisplaySettings?.reversed ?? false;
|
|
7502
7807
|
const [rW, rH] = ratioValue.split(':').map(Number);
|
|
7503
7808
|
const effW = ratioReversed ? rH : rW;
|
|
7504
7809
|
const effH = ratioReversed ? rW : rH;
|
|
7505
7810
|
const aspectRatio = \`\${effW} / \${effH}\`;
|
|
7506
7811
|
|
|
7507
|
-
const columnsCount = gridLayout
|
|
7812
|
+
const columnsCount = gridLayout?.columnsCount ?? 1;
|
|
7508
7813
|
const entryWidthScaled = scalingValue(size ?? 0, isEditor);
|
|
7509
|
-
const
|
|
7510
|
-
const isFitSlider = !isCover && slider !== 'off';
|
|
7814
|
+
const isFitSlider = slider !== 'off' && (customLayout ? isAutoHeight : !isCover);
|
|
7511
7815
|
|
|
7512
7816
|
const itemsInLastRow = cropContent.length % columnsCount || columnsCount;
|
|
7513
|
-
const isPartialLastRow = itemsInLastRow < columnsCount && cropContent.length > 0;
|
|
7817
|
+
const isPartialLastRow = !customLayout && itemsInLastRow < columnsCount && cropContent.length > 0;
|
|
7514
7818
|
const lastRowStartIndex = cropContent.length - itemsInLastRow;
|
|
7515
7819
|
const lastRowStartColumn = isPartialLastRow
|
|
7516
7820
|
? Math.floor((columnsCount - itemsInLastRow) / 2) + 1
|
|
@@ -7518,24 +7822,46 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7518
7822
|
|
|
7519
7823
|
const imageBorderRadius = imageCorners ? scalingValue(imageCorners, isEditor) : undefined;
|
|
7520
7824
|
|
|
7521
|
-
const
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7825
|
+
const getImageWrapperStyle = (
|
|
7826
|
+
entryWidth: string,
|
|
7827
|
+
slot?: CustomGridSlot,
|
|
7828
|
+
media?: { aspect?: number; isEmpty: boolean },
|
|
7829
|
+
): React.CSSProperties => ({
|
|
7830
|
+
width: entryWidth,
|
|
7831
|
+
...(slot && isAutoHeight
|
|
7832
|
+
? {
|
|
7833
|
+
height: media?.isEmpty ? scalingValue(slot.height, isEditor) : 'auto',
|
|
7834
|
+
flexShrink: 0,
|
|
7835
|
+
overflow: 'hidden',
|
|
7836
|
+
...(media?.aspect && !isFitSlider ? { aspectRatio: \`\${media.aspect}\` } : {}),
|
|
7837
|
+
}
|
|
7838
|
+
: slot
|
|
7839
|
+
? isTextOutside
|
|
7840
|
+
? { height: scalingValue(slot.height, isEditor), flexShrink: 0, overflow: 'hidden' }
|
|
7841
|
+
: { flex: '1 1 0%', minHeight: 0, overflow: 'hidden' }
|
|
7842
|
+
: isCover
|
|
7843
|
+
? { aspectRatio, height: 'auto', overflow: 'hidden' }
|
|
7844
|
+
: { height: 'auto' }),
|
|
7526
7845
|
...(imageBorderRadius ? { borderRadius: imageBorderRadius, overflow: 'hidden' } : {}),
|
|
7527
|
-
};
|
|
7846
|
+
});
|
|
7528
7847
|
|
|
7529
7848
|
const imageWrapperClassName = \`\${P}-item-image-wrapper\${isFitSlider ? \` \${P}-item-image-wrapper-fit-slider\` : ''}\`.trim();
|
|
7530
7849
|
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);
|
|
7850
|
+
const shouldAlignEntries = !customLayout && alignEntries === 'on';
|
|
7534
7851
|
|
|
7535
7852
|
const imageRadiusStyle = imageBorderRadius
|
|
7536
7853
|
? { borderRadius: imageBorderRadius, [MEDIA_RADIUS_VAR]: imageBorderRadius } as React.CSSProperties
|
|
7537
7854
|
: {};
|
|
7538
|
-
const imageStyle: React.CSSProperties =
|
|
7855
|
+
const imageStyle: React.CSSProperties = isAutoHeight
|
|
7856
|
+
? {
|
|
7857
|
+
objectFit: isFitSlider && !isCover ? 'contain' : 'cover',
|
|
7858
|
+
pointerEvents: 'auto',
|
|
7859
|
+
width: '100%',
|
|
7860
|
+
height: '100%',
|
|
7861
|
+
maxWidth: '100%',
|
|
7862
|
+
...imageRadiusStyle,
|
|
7863
|
+
}
|
|
7864
|
+
: isCover
|
|
7539
7865
|
? {
|
|
7540
7866
|
objectFit: 'cover',
|
|
7541
7867
|
pointerEvents: 'auto',
|
|
@@ -7550,31 +7876,92 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7550
7876
|
width: 'auto',
|
|
7551
7877
|
height: 'auto',
|
|
7552
7878
|
maxWidth: '100%',
|
|
7879
|
+
...(customLayout ? { maxHeight: '100%' } : {}),
|
|
7553
7880
|
...imageRadiusStyle,
|
|
7554
7881
|
};
|
|
7555
7882
|
|
|
7556
|
-
const
|
|
7557
|
-
const
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7883
|
+
const shouldMeasureEntries = (customLayout?.beat ?? 0) > 0 || isPlacedLayout;
|
|
7884
|
+
const customGridWidth = customLayout ? getCustomGridSpanWidth(customLayout, customLayout.columnsCount) : 0;
|
|
7885
|
+
useLayoutEffect(() => {
|
|
7886
|
+
if (!shouldMeasureEntries) {
|
|
7887
|
+
setCustomEntryHeights(prev => (prev.length > 0 ? [] : prev));
|
|
7888
|
+
return;
|
|
7889
|
+
}
|
|
7890
|
+
const wrapper = containerRef.current;
|
|
7891
|
+
const inners = itemInnerRefs.current.slice(0, cropContent.length);
|
|
7892
|
+
const measure = () => {
|
|
7893
|
+
const unit = wrapper && customGridWidth > 0 ? wrapper.offsetWidth / customGridWidth : 0;
|
|
7894
|
+
if (unit <= 0) return;
|
|
7895
|
+
const heights = inners.map(inner => (inner ? inner.offsetHeight / unit : 0));
|
|
7896
|
+
setCustomEntryHeights(prev => (
|
|
7897
|
+
prev.length === heights.length && prev.every((height, index) => Math.abs(height - heights[index]) < 1e-5)
|
|
7898
|
+
? prev
|
|
7899
|
+
: heights
|
|
7900
|
+
));
|
|
7901
|
+
};
|
|
7902
|
+
measure();
|
|
7903
|
+
const ro = new ResizeObserver(measure);
|
|
7904
|
+
if (wrapper) ro.observe(wrapper);
|
|
7905
|
+
inners.forEach(inner => inner && ro.observe(inner));
|
|
7574
7906
|
return () => ro.disconnect();
|
|
7575
|
-
}, []);
|
|
7907
|
+
}, [shouldMeasureEntries, cropContent.length, customGridWidth, P]);
|
|
7908
|
+
const measuredEntryHeights = shouldMeasureEntries && customEntryHeights.length === cropContent.length
|
|
7909
|
+
? customEntryHeights
|
|
7910
|
+
: undefined;
|
|
7911
|
+
const customRows = useMemo(() => {
|
|
7912
|
+
if (!customLayout) return undefined;
|
|
7913
|
+
const rows = getCustomGridRows(customLayout, cropContent.length, measuredEntryHeights);
|
|
7914
|
+
return {
|
|
7915
|
+
gridRows: rows.gridRows,
|
|
7916
|
+
gridTemplateRows: rows.tracks.length
|
|
7917
|
+
? rows.tracks.map(track => (track === 'auto' ? 'auto' : scalingValue(track, isEditor))).join(' ')
|
|
7918
|
+
: 'auto',
|
|
7919
|
+
};
|
|
7920
|
+
}, [customLayout, cropContent.length, measuredEntryHeights, isEditor]);
|
|
7921
|
+
const customSlots = useMemo(
|
|
7922
|
+
() => (customLayout ? cropContent.map((_, index) => getCustomGridSlot(customLayout, index)) : undefined),
|
|
7923
|
+
[customLayout, cropContent.length],
|
|
7924
|
+
);
|
|
7925
|
+
const entryMediaAspects = useMemo(
|
|
7926
|
+
() => entriesMedia.map(({ displayItems }) => (
|
|
7927
|
+
isAutoHeight && displayItems.length > 0 ? getGridMediaAspect(displayItems[0].displayMedia) : undefined
|
|
7928
|
+
)),
|
|
7929
|
+
[entriesMedia, isAutoHeight],
|
|
7930
|
+
);
|
|
7931
|
+
const customPlacement = useMemo(() => {
|
|
7932
|
+
if (!customLayout || !customSlots || !isPlacedLayout) return undefined;
|
|
7933
|
+
const beat = customLayout.beat ?? 0;
|
|
7934
|
+
const heights = customSlots.map((slot, index) => {
|
|
7935
|
+
const aspects = entriesMedia[index].displayItems.map(({ displayMedia }) => getGridMediaAspect(displayMedia));
|
|
7936
|
+
const known = aspects.filter((aspect): aspect is number => aspect !== undefined);
|
|
7937
|
+
const estimate = isAutoHeight && known.length > 0 ? Math.max(...known.map(aspect => slot.width / aspect)) : slot.height;
|
|
7938
|
+
const height = measuredEntryHeights?.[index] ?? estimate;
|
|
7939
|
+
return beat > 0 ? Math.ceil(height / beat - 1e-3) * beat : height;
|
|
7940
|
+
});
|
|
7941
|
+
return placeCustomGridEntries(customLayout, customSlots, heights);
|
|
7942
|
+
}, [customLayout, customSlots, isPlacedLayout, isAutoHeight, entriesMedia, measuredEntryHeights]);
|
|
7943
|
+
const wrapperLayoutStyle: React.CSSProperties = customLayout
|
|
7944
|
+
? {
|
|
7945
|
+
gridTemplateColumns: \`repeat(\${customLayout.columnsCount}, \${scalingValue(customLayout.columnWidth, isEditor)})\`,
|
|
7946
|
+
gridTemplateRows: customRows?.gridTemplateRows ?? 'auto',
|
|
7947
|
+
rowGap: 0,
|
|
7948
|
+
columnGap: scalingValue(customLayout.gutterWidth, isEditor),
|
|
7949
|
+
width: scalingValue(getCustomGridSpanWidth(customLayout, customLayout.columnsCount), isEditor),
|
|
7950
|
+
...(customPlacement ? { position: 'relative', height: scalingValue(customPlacement.bottom, isEditor) } : {}),
|
|
7951
|
+
}
|
|
7952
|
+
: {
|
|
7953
|
+
gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
|
|
7954
|
+
rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
|
|
7955
|
+
columnGap: scalingValue(gridLayout?.horizontalGap ?? 0, isEditor),
|
|
7956
|
+
width: scalingValue(gridLayout?.wrapperWidth ?? 0, isEditor),
|
|
7957
|
+
...(shouldAlignEntries
|
|
7958
|
+
? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
|
|
7959
|
+
: {}),
|
|
7960
|
+
};
|
|
7576
7961
|
|
|
7577
|
-
const
|
|
7962
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
7963
|
+
|
|
7964
|
+
const getLightboxPortalStyle = (): React.CSSProperties => {
|
|
7578
7965
|
const style: Record<string, string> = { ...(colorVars as Record<string, string>) };
|
|
7579
7966
|
const articleWidth = containerRef.current
|
|
7580
7967
|
? getComputedStyle(containerRef.current).getPropertyValue('--cntrl-article-width').trim()
|
|
@@ -7583,7 +7970,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7583
7970
|
style['--cntrl-article-width'] = articleWidth;
|
|
7584
7971
|
}
|
|
7585
7972
|
return style as React.CSSProperties;
|
|
7586
|
-
}
|
|
7973
|
+
};
|
|
7587
7974
|
|
|
7588
7975
|
const [lightboxOpen, setLightboxOpen] = useState(false);
|
|
7589
7976
|
const [lightboxItems, setLightboxItems] = useState<GridMedia[]>([]);
|
|
@@ -7622,16 +8009,8 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7622
8009
|
<div style={colorVars}>
|
|
7623
8010
|
<div
|
|
7624
8011
|
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
|
-
}}>
|
|
8012
|
+
className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''}\${customLayout ? \` \${P}-custom-layout\` : ''}\${isTextOutside ? \` \${P}-text-outside\` : ''}\${isAutoHeight ? \` \${P}-auto-height\` : ''} \${P}-image-align-\${customLayout ? 'top' : align} \${wrapperStateClasses}\`.trim()}
|
|
8013
|
+
style={wrapperLayoutStyle}>
|
|
7635
8014
|
{cropContent.map((item: any, index: number) => {
|
|
7636
8015
|
const hasTitle = hasText(item.title);
|
|
7637
8016
|
const hasSubtitle = hasText(item.subtitle);
|
|
@@ -7641,11 +8020,40 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7641
8020
|
const gridColumn = isPartialLastRow && index >= lastRowStartIndex
|
|
7642
8021
|
? \`\${lastRowStartColumn + (index - lastRowStartIndex)}\`
|
|
7643
8022
|
: undefined;
|
|
8023
|
+
const customSlot = customSlots?.[index];
|
|
8024
|
+
const itemSize = customSlot?.width ?? size;
|
|
8025
|
+
const itemWidthScaled = scalingValue(itemSize, isEditor);
|
|
8026
|
+
const textBoxWidthStyle = \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`;
|
|
8027
|
+
const controlWidthStyle = scalingValue(itemSize * textBoxWidth / 100, isEditor);
|
|
8028
|
+
const { displayItems, lightboxItemsForEntry, lightboxIndexes } = entriesMedia[index];
|
|
8029
|
+
const mediaAspect = slider === 'off' ? entryMediaAspects[index] : undefined;
|
|
8030
|
+
const imageWrapperStyle = getImageWrapperStyle(
|
|
8031
|
+
itemWidthScaled,
|
|
8032
|
+
customSlot,
|
|
8033
|
+
{ aspect: mediaAspect, isEmpty: displayItems.length === 0 },
|
|
8034
|
+
);
|
|
8035
|
+
const entryImageStyle = isAutoHeight && slider === 'off' && !mediaAspect
|
|
8036
|
+
? { ...imageStyle, height: 'auto' }
|
|
8037
|
+
: imageStyle;
|
|
8038
|
+
const itemStyle: React.CSSProperties | undefined = customSlot && customLayout && customPlacement
|
|
8039
|
+
? {
|
|
8040
|
+
position: 'absolute',
|
|
8041
|
+
left: scalingValue(customSlot.column * (customLayout.columnWidth + customLayout.gutterWidth), isEditor),
|
|
8042
|
+
top: scalingValue(customPlacement.tops[index], isEditor),
|
|
8043
|
+
width: itemWidthScaled,
|
|
8044
|
+
}
|
|
8045
|
+
: customSlot
|
|
8046
|
+
? {
|
|
8047
|
+
gridColumn: customSlot.gridColumn,
|
|
8048
|
+
gridRow: customRows?.gridRows[index],
|
|
8049
|
+
alignSelf: 'start',
|
|
8050
|
+
}
|
|
8051
|
+
: gridColumn && !shouldAlignEntries ? { gridColumn } : undefined;
|
|
7644
8052
|
|
|
7645
8053
|
const typeCTextBlock = isTextBeforeImage ? (
|
|
7646
8054
|
<div className={\`\${P}-item-text-block\`}>
|
|
7647
8055
|
{hasTitle && (
|
|
7648
|
-
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
8056
|
+
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleTextStyle }}>
|
|
7649
8057
|
{item.title}
|
|
7650
8058
|
</p>
|
|
7651
8059
|
)}
|
|
@@ -7660,7 +8068,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7660
8068
|
/>
|
|
7661
8069
|
)}
|
|
7662
8070
|
{hasSubtitle && (
|
|
7663
|
-
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
8071
|
+
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}>
|
|
7664
8072
|
{item.subtitle}
|
|
7665
8073
|
</p>
|
|
7666
8074
|
)}
|
|
@@ -7690,7 +8098,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7690
8098
|
/>
|
|
7691
8099
|
)}
|
|
7692
8100
|
{hasTitle && (
|
|
7693
|
-
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
8101
|
+
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleTextStyle }}>
|
|
7694
8102
|
{item.title}
|
|
7695
8103
|
</p>
|
|
7696
8104
|
)}
|
|
@@ -7720,7 +8128,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7720
8128
|
/>
|
|
7721
8129
|
)}
|
|
7722
8130
|
{hasSubtitle && (
|
|
7723
|
-
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
8131
|
+
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}>
|
|
7724
8132
|
{item.subtitle}
|
|
7725
8133
|
</p>
|
|
7726
8134
|
)}
|
|
@@ -7744,11 +8152,6 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7744
8152
|
</LinkWrapper>
|
|
7745
8153
|
);
|
|
7746
8154
|
|
|
7747
|
-
const displayItems = getGridDisplayItems(item.gallery);
|
|
7748
|
-
const lightboxItemsForEntry = displayItems
|
|
7749
|
-
.filter(entry => entry.lightboxMedia)
|
|
7750
|
-
.map(entry => entry.lightboxMedia!);
|
|
7751
|
-
|
|
7752
8155
|
const imageContent = (
|
|
7753
8156
|
<GridItemMediaWrapper className={imageWrapperClassName} style={imageWrapperStyle}>
|
|
7754
8157
|
{displayItems.length === 0
|
|
@@ -7756,15 +8159,13 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7756
8159
|
: slider === 'off'
|
|
7757
8160
|
?
|
|
7758
8161
|
(() => {
|
|
7759
|
-
const { displayMedia
|
|
7760
|
-
const lightboxIndex =
|
|
7761
|
-
? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
|
|
7762
|
-
: -1;
|
|
8162
|
+
const { displayMedia } = displayItems[0];
|
|
8163
|
+
const lightboxIndex = lightboxIndexes[0];
|
|
7763
8164
|
return (
|
|
7764
8165
|
<GridMediaItem
|
|
7765
8166
|
media={displayMedia}
|
|
7766
8167
|
className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
|
|
7767
|
-
style={
|
|
8168
|
+
style={entryImageStyle}
|
|
7768
8169
|
hasLightbox={lightbox === 'on'}
|
|
7769
8170
|
onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
|
|
7770
8171
|
? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
|
|
@@ -7787,50 +8188,28 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7787
8188
|
))}
|
|
7788
8189
|
</div>
|
|
7789
8190
|
)}
|
|
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;
|
|
8191
|
+
<GridEntrySlider
|
|
8192
|
+
key={\`\${transition}-\${itemSize}-\${direction}-\${sliderTiming}-\${layoutId}-\${displayItems.length}\`}
|
|
8193
|
+
prefix={P}
|
|
8194
|
+
isFade={transition === 'fade'}
|
|
8195
|
+
direction={direction}
|
|
8196
|
+
intervalMs={sliderTiming * 1000}
|
|
8197
|
+
slides={displayItems.map(({ displayMedia }, imgIndex) => {
|
|
8198
|
+
const lightboxIndex = lightboxIndexes[imgIndex];
|
|
7818
8199
|
return (
|
|
7819
|
-
<
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
/>
|
|
7830
|
-
</SplideSlide>
|
|
8200
|
+
<GridMediaItem
|
|
8201
|
+
media={displayMedia}
|
|
8202
|
+
className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
|
|
8203
|
+
style={imageStyle}
|
|
8204
|
+
hasLightbox={lightbox === 'on'}
|
|
8205
|
+
isSliderSlide
|
|
8206
|
+
onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
|
|
8207
|
+
? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
|
|
8208
|
+
: undefined}
|
|
8209
|
+
/>
|
|
7831
8210
|
);
|
|
7832
8211
|
})}
|
|
7833
|
-
|
|
8212
|
+
/>
|
|
7834
8213
|
</>
|
|
7835
8214
|
}
|
|
7836
8215
|
</GridItemMediaWrapper>
|
|
@@ -7848,7 +8227,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7848
8227
|
/>
|
|
7849
8228
|
<p
|
|
7850
8229
|
className={titleTextClassName}
|
|
7851
|
-
style={{ width: textBoxWidthStyle, ...
|
|
8230
|
+
style={{ width: textBoxWidthStyle, ...titleTextStyle }}
|
|
7852
8231
|
>
|
|
7853
8232
|
{item.title}
|
|
7854
8233
|
</p>
|
|
@@ -7862,7 +8241,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7862
8241
|
/>
|
|
7863
8242
|
<p
|
|
7864
8243
|
className={subtitleTextClassName}
|
|
7865
|
-
style={{ width: textBoxWidthStyle, ...
|
|
8244
|
+
style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}
|
|
7866
8245
|
>
|
|
7867
8246
|
{item.subtitle}
|
|
7868
8247
|
</p>
|
|
@@ -7882,16 +8261,18 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7882
8261
|
<div
|
|
7883
8262
|
key={index}
|
|
7884
8263
|
className={\`\${P}-item\`.trim()}
|
|
7885
|
-
style={
|
|
8264
|
+
style={itemStyle}
|
|
7886
8265
|
>
|
|
7887
8266
|
<div
|
|
7888
|
-
|
|
7889
|
-
|
|
8267
|
+
ref={(el) => { itemInnerRefs.current[index] = el; }}
|
|
8268
|
+
className={\`\${isEditMode
|
|
8269
|
+
? \`\${P}-item-inner\`
|
|
7890
8270
|
: \`\${P}-item-inner-hidden\`}\${shouldAlignEntries && isLastRow ? \` \${P}-item-inner-last-row\` : ''}\`.trim()}
|
|
7891
8271
|
style={{
|
|
7892
8272
|
width: (textBoxWidth ?? 0) > 100
|
|
7893
|
-
? \`calc(\${
|
|
7894
|
-
:
|
|
8273
|
+
? \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`
|
|
8274
|
+
: itemWidthScaled,
|
|
8275
|
+
...(customSlot && !isTextOutside && !isAutoHeight ? { height: scalingValue(customSlot.height, isEditor) } : {}),
|
|
7895
8276
|
...(gridColumn && shouldAlignEntries ? { gridColumn } : {}),
|
|
7896
8277
|
}}
|
|
7897
8278
|
>
|
|
@@ -7937,7 +8318,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7937
8318
|
{(!isEditor || isPreviewMode) && lightboxOpen && typeof document !== 'undefined' && lightbox === 'on' && (() => {
|
|
7938
8319
|
const portalTarget = (portalId ? document.getElementById(portalId) : null) ?? document.body;
|
|
7939
8320
|
return createPortal(
|
|
7940
|
-
<div style={
|
|
8321
|
+
<div style={getLightboxPortalStyle()} data-selection="none">
|
|
7941
8322
|
<Lightbox
|
|
7942
8323
|
prefix={P}
|
|
7943
8324
|
items={lightboxItems}
|
|
@@ -7974,17 +8355,42 @@ type GridLayoutConfig = {
|
|
|
7974
8355
|
lockedParam?: 'wrapperWidth' | 'entryWidth' | 'horizontalGap' | null;
|
|
7975
8356
|
};
|
|
7976
8357
|
|
|
8358
|
+
type CustomGridBlock = {
|
|
8359
|
+
column: number;
|
|
8360
|
+
span: number;
|
|
8361
|
+
top: number;
|
|
8362
|
+
height: number;
|
|
8363
|
+
};
|
|
8364
|
+
|
|
8365
|
+
type CustomGridLayout = {
|
|
8366
|
+
columnsCount: number;
|
|
8367
|
+
columnWidth: number;
|
|
8368
|
+
gutterWidth: number;
|
|
8369
|
+
maxWidth: number | null;
|
|
8370
|
+
verticalGap?: number;
|
|
8371
|
+
beat?: number;
|
|
8372
|
+
repeatHeight?: number;
|
|
8373
|
+
blocks: CustomGridBlock[];
|
|
8374
|
+
gridType?: 'masonry' | 'stacked' | 'rows' | 'freeform';
|
|
8375
|
+
cellHeight?: 'manual' | 'auto';
|
|
8376
|
+
masonry?: 'off' | 'on';
|
|
8377
|
+
rows?: number;
|
|
8378
|
+
mediaDisplay?: 'fit' | 'cover';
|
|
8379
|
+
textGrowth?: 'inside' | 'outside';
|
|
8380
|
+
};
|
|
8381
|
+
|
|
7977
8382
|
type GridSettings = {
|
|
7978
8383
|
type: 'a' | 'b' | 'c' | 'd' | 'e' | 'f';
|
|
7979
|
-
gridLayout
|
|
8384
|
+
gridLayout?: GridLayoutConfig;
|
|
8385
|
+
customGrid?: CustomGridLayout;
|
|
7980
8386
|
textBoxWidth: number;
|
|
7981
|
-
verticalGap
|
|
7982
|
-
entriesCount
|
|
8387
|
+
verticalGap?: number;
|
|
8388
|
+
entriesCount?: number;
|
|
7983
8389
|
lightbox: 'on' | 'off';
|
|
7984
|
-
imageDisplay: {
|
|
8390
|
+
imageDisplay: 'fit' | 'cover' | {
|
|
7985
8391
|
display: 'fit' | 'cover';
|
|
7986
|
-
ratioValue
|
|
7987
|
-
reversed
|
|
8392
|
+
ratioValue?: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
|
|
8393
|
+
reversed?: boolean;
|
|
7988
8394
|
};
|
|
7989
8395
|
imageCorners?: number;
|
|
7990
8396
|
lightboxImageDisplay?: 'fit' | 'cover' | { display?: 'fit' | 'cover' };
|
|
@@ -7994,8 +8400,9 @@ type GridSettings = {
|
|
|
7994
8400
|
transition: 'fade' | 'slide',
|
|
7995
8401
|
showText: 'always' | 'on hover';
|
|
7996
8402
|
hover?: 'none' | 'zoom-in' | 'greyscale' | 'scale-down';
|
|
7997
|
-
alignEntries
|
|
8403
|
+
alignEntries?: 'on' | 'off';
|
|
7998
8404
|
align?: 'top' | 'center' | 'bottom';
|
|
8405
|
+
textGrowth?: 'inside' | 'outside';
|
|
7999
8406
|
titleMarginTop: number;
|
|
8000
8407
|
subtitleMarginTop: number;
|
|
8001
8408
|
titleColor: string;
|
|
@@ -25427,4 +25834,4 @@ export function Waterfall({
|
|
|
25427
25834
|
</>
|
|
25428
25835
|
);
|
|
25429
25836
|
}
|
|
25430
|
-
`,
|
|
25837
|
+
`,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;
|