@cntrl-site/components 1.0.118-alpha.9 → 1.0.119
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-Bp8Zmj26.js +1 -0
- package/dist/{ChroniclesComponent-Bf8jxaas.mjs → ChroniclesComponent-D_YAkpJZ.mjs} +444 -514
- package/dist/Components/Grid/Grid.d.ts +7 -27
- package/dist/Components/SimpleButton/SimpleButtonComponent.d.ts +2 -0
- 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/SimpleButton-BrIUFz_a.js +289 -0
- package/dist/{SimpleButton-C-o2W9bS.mjs → SimpleButton-GXckV2Tj.mjs} +198 -141
- package/dist/{components-IX-rNSn-.mjs → components-6CfbAMrX.mjs} +13 -14
- package/dist/{components-QVeWZKot.js → components-DcHbdTvp.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 +311 -633
- package/dist/sources.mjs +351 -674
- package/package.json +1 -1
- package/dist/ChroniclesComponent-XAHXrzRb.js +0 -1
- package/dist/Components/Grid/CustomGridComponent.d.ts +0 -41
- package/dist/ControlSlider-BCkVFl4w.js +0 -1
- package/dist/Grid-Dwn03N-q.mjs +0 -1853
- package/dist/Grid-pyPdnAeI.js +0 -445
- package/dist/SimpleButton-nGEcO2gB.js +0 -243
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-Bp8Zmj26.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';
|
|
@@ -2728,7 +2728,7 @@ export function Burger({
|
|
|
2728
2728
|
</div>
|
|
2729
2729
|
);
|
|
2730
2730
|
}
|
|
2731
|
-
`,
|
|
2731
|
+
`,t=`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
|
+
`,i=`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
|
+
`,o=`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
|
+
`,r=`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,7 +5686,9 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
5686
5686
|
};
|
|
5687
5687
|
|
|
5688
5688
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
5689
|
-
`,
|
|
5689
|
+
`,a=`import { Splide, SplideSlide } from '@splidejs/react-splide';
|
|
5690
|
+
import '@splidejs/react-splide/css/core';
|
|
5691
|
+
import { CommonComponentProps } from '../props';
|
|
5690
5692
|
import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
|
|
5691
5693
|
import {
|
|
5692
5694
|
buildColorVars,
|
|
@@ -5696,7 +5698,7 @@ import {
|
|
|
5696
5698
|
useLazyVideos,
|
|
5697
5699
|
useScopedStyles,
|
|
5698
5700
|
} from '../utils/index';
|
|
5699
|
-
import {
|
|
5701
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
|
|
5700
5702
|
import { createPortal } from 'react-dom';
|
|
5701
5703
|
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
5702
5704
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
@@ -5813,23 +5815,15 @@ function getCSS(P: string): string {
|
|
|
5813
5815
|
width: 100%;
|
|
5814
5816
|
overflow: hidden;
|
|
5815
5817
|
}
|
|
5818
|
+
.\${P}-item-slider .splide__track {
|
|
5819
|
+
overflow: hidden;
|
|
5820
|
+
}
|
|
5816
5821
|
.\${P}-item-image-link {
|
|
5817
5822
|
width: 100%;
|
|
5818
5823
|
display: flex;
|
|
5819
5824
|
flex-direction: column;
|
|
5820
5825
|
align-items: center;
|
|
5821
5826
|
}
|
|
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
|
-
}
|
|
5833
5827
|
.\${P}-item-text-link {
|
|
5834
5828
|
display: flex;
|
|
5835
5829
|
flex-direction: column;
|
|
@@ -5850,47 +5844,18 @@ function getCSS(P: string): string {
|
|
|
5850
5844
|
display: block;
|
|
5851
5845
|
max-width: 100%;
|
|
5852
5846
|
}
|
|
5853
|
-
.\${P}-item-slider
|
|
5854
|
-
|
|
5847
|
+
.\${P}-item-slider,
|
|
5848
|
+
.\${P}-item-slider .splide__track,
|
|
5849
|
+
.\${P}-item-slider .splide__list,
|
|
5850
|
+
.\${P}-item-slider .splide__slide {
|
|
5855
5851
|
width: 100%;
|
|
5856
5852
|
height: 100%;
|
|
5857
|
-
overflow: hidden;
|
|
5858
5853
|
}
|
|
5859
|
-
.\${P}-item-slider
|
|
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%;
|
|
5854
|
+
.\${P}-item-slider .splide__slide {
|
|
5879
5855
|
display: flex;
|
|
5880
5856
|
justify-content: center;
|
|
5881
5857
|
align-items: center;
|
|
5882
5858
|
}
|
|
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
|
-
}
|
|
5894
5859
|
.\${P}-item-title {
|
|
5895
5860
|
white-space: normal;
|
|
5896
5861
|
overflow-wrap: anywhere;
|
|
@@ -6037,13 +6002,13 @@ function getCSS(P: string): string {
|
|
|
6037
6002
|
.\${P}-image-align-bottom .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
|
|
6038
6003
|
align-items: flex-end;
|
|
6039
6004
|
}
|
|
6040
|
-
.\${P}-image-align-top .\${P}-item-slider
|
|
6005
|
+
.\${P}-image-align-top .\${P}-item-slider .splide__slide {
|
|
6041
6006
|
align-items: flex-start;
|
|
6042
6007
|
}
|
|
6043
|
-
.\${P}-image-align-center .\${P}-item-slider
|
|
6008
|
+
.\${P}-image-align-center .\${P}-item-slider .splide__slide {
|
|
6044
6009
|
align-items: center;
|
|
6045
6010
|
}
|
|
6046
|
-
.\${P}-image-align-bottom .\${P}-item-slider
|
|
6011
|
+
.\${P}-image-align-bottom .\${P}-item-slider .splide__slide {
|
|
6047
6012
|
align-items: flex-end;
|
|
6048
6013
|
}
|
|
6049
6014
|
.\${P}-align-entries .\${P}-item {
|
|
@@ -6124,13 +6089,13 @@ function getCSS(P: string): string {
|
|
|
6124
6089
|
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
|
|
6125
6090
|
align-items: flex-end;
|
|
6126
6091
|
}
|
|
6127
|
-
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider
|
|
6092
|
+
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider .splide__slide {
|
|
6128
6093
|
align-items: flex-start;
|
|
6129
6094
|
}
|
|
6130
|
-
.\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider
|
|
6095
|
+
.\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider .splide__slide {
|
|
6131
6096
|
align-items: center;
|
|
6132
6097
|
}
|
|
6133
|
-
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider
|
|
6098
|
+
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider .splide__slide {
|
|
6134
6099
|
align-items: flex-end;
|
|
6135
6100
|
}
|
|
6136
6101
|
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-image-link {
|
|
@@ -6198,9 +6163,27 @@ function pickRandomSlideDirection(): 'ltr' | 'ttb' {
|
|
|
6198
6163
|
return Math.random() < 0.5 ? 'ltr' : 'ttb';
|
|
6199
6164
|
}
|
|
6200
6165
|
|
|
6201
|
-
function
|
|
6202
|
-
|
|
6203
|
-
|
|
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
|
+
});
|
|
6204
6187
|
}
|
|
6205
6188
|
|
|
6206
6189
|
type GridProps = {
|
|
@@ -6240,8 +6223,6 @@ type LightboxProps = {
|
|
|
6240
6223
|
|
|
6241
6224
|
const LIGHTBOX_ANIM_MS = 500;
|
|
6242
6225
|
const SLIDER_TRANSITION_MS = 750;
|
|
6243
|
-
const SLIDER_EASING = 'cubic-bezier(0.25, 1, 0.5, 1)';
|
|
6244
|
-
const SLIDER_DEFAULT_INTERVAL_MS = 5000;
|
|
6245
6226
|
const LIGHTBOX_EASING = 'cubic-bezier(0.22, 1, 0.36, 1)';
|
|
6246
6227
|
const SWIPE_CLOSE_THRESHOLD = 72;
|
|
6247
6228
|
const SWIPE_NAV_THRESHOLD = 50;
|
|
@@ -6331,7 +6312,7 @@ function collectGridLightboxMedia(content: any[]): GridMedia[] {
|
|
|
6331
6312
|
return result;
|
|
6332
6313
|
}
|
|
6333
6314
|
|
|
6334
|
-
|
|
6315
|
+
function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
6335
6316
|
const [pool, setPool] = useState<HTMLDivElement | null>(null);
|
|
6336
6317
|
useLazyVideos(pool, { preload: 'metadata' });
|
|
6337
6318
|
// an embed's player is only ever framed where it shows
|
|
@@ -6370,7 +6351,7 @@ const LightboxMediaPreloadPool = memo(function LightboxMediaPreloadPool({ mediaL
|
|
|
6370
6351
|
))}
|
|
6371
6352
|
</div>
|
|
6372
6353
|
);
|
|
6373
|
-
}
|
|
6354
|
+
}
|
|
6374
6355
|
|
|
6375
6356
|
function unloadVideoElement(video: HTMLVideoElement) {
|
|
6376
6357
|
video.pause();
|
|
@@ -6378,121 +6359,15 @@ function unloadVideoElement(video: HTMLVideoElement) {
|
|
|
6378
6359
|
video.load();
|
|
6379
6360
|
}
|
|
6380
6361
|
|
|
6381
|
-
const
|
|
6382
|
-
const GRID_SLIDE_PLAYING_CLASS = 'cntrl-grid-slide-playing';
|
|
6383
|
-
const GRID_SLIDE_VIDEOS = \`.\${GRID_SLIDE_CLASS} video\`;
|
|
6362
|
+
const SPLIDE_SLIDE_VIDEOS = '.splide__slide video';
|
|
6384
6363
|
|
|
6385
6364
|
function shouldPlaySlideVideo(video: HTMLVideoElement): boolean {
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
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
|
-
);
|
|
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;
|
|
6496
6371
|
}
|
|
6497
6372
|
|
|
6498
6373
|
function GridMediaItem({
|
|
@@ -6500,7 +6375,7 @@ function GridMediaItem({
|
|
|
6500
6375
|
className,
|
|
6501
6376
|
style,
|
|
6502
6377
|
hasLightbox,
|
|
6503
|
-
|
|
6378
|
+
isSplideSlide = false,
|
|
6504
6379
|
onMediaClick,
|
|
6505
6380
|
}: {
|
|
6506
6381
|
media: GridMedia;
|
|
@@ -6508,7 +6383,7 @@ function GridMediaItem({
|
|
|
6508
6383
|
style: React.CSSProperties;
|
|
6509
6384
|
/** An embed then plays here as a silent loop, and as it was set to in the lightbox. */
|
|
6510
6385
|
hasLightbox: boolean;
|
|
6511
|
-
|
|
6386
|
+
isSplideSlide?: boolean;
|
|
6512
6387
|
onMediaClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
6513
6388
|
}) {
|
|
6514
6389
|
if (isEmbedMedia(media)) {
|
|
@@ -6540,7 +6415,7 @@ function GridMediaItem({
|
|
|
6540
6415
|
playsInline: true,
|
|
6541
6416
|
onClick: onMediaClick,
|
|
6542
6417
|
};
|
|
6543
|
-
return
|
|
6418
|
+
return isSplideSlide
|
|
6544
6419
|
? <video {...videoProps} preload='none' />
|
|
6545
6420
|
: <LazyVideo {...videoProps} autoPlay />;
|
|
6546
6421
|
}
|
|
@@ -6569,7 +6444,7 @@ function GridItemMediaWrapper({
|
|
|
6569
6444
|
children: React.ReactNode;
|
|
6570
6445
|
}) {
|
|
6571
6446
|
const [wrapper, setWrapper] = useState<HTMLDivElement | null>(null);
|
|
6572
|
-
useLazyVideos(wrapper, { autoPlay: true, selector:
|
|
6447
|
+
useLazyVideos(wrapper, { autoPlay: true, selector: SPLIDE_SLIDE_VIDEOS, shouldPlay: shouldPlaySlideVideo });
|
|
6573
6448
|
|
|
6574
6449
|
return (
|
|
6575
6450
|
<div ref={setWrapper} className={className} style={style}>
|
|
@@ -7470,149 +7345,11 @@ function resolveLightboxImageDisplay(
|
|
|
7470
7345
|
return value?.display === 'cover' ? 'cover' : 'fit';
|
|
7471
7346
|
}
|
|
7472
7347
|
|
|
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
|
-
/**
|
|
7575
|
-
* Where each entry stands, given the height it takes; the CMS grid builder places its blocks the same way.
|
|
7576
|
-
* A block keeps its drawn distance to the blocks above it in its group; a block with none above it starts at
|
|
7577
|
-
* its drawn top in the group, or, with masonry on, the vertical gap below whatever earlier group reaches
|
|
7578
|
-
* lowest in its columns.
|
|
7579
|
-
*/
|
|
7580
|
-
function placeCustomGridEntries(layout: CustomGridLayout, slots: CustomGridSlot[], heights: number[]) {
|
|
7581
|
-
const groupSize = layout.blocks.length;
|
|
7582
|
-
const verticalGap = getCustomGridVerticalGap(layout);
|
|
7583
|
-
const isMasonry = layout.masonry === 'on';
|
|
7584
|
-
const tops: number[] = [];
|
|
7585
|
-
const placed: { column: number; span: number; bottom: number; group: number }[] = [];
|
|
7586
|
-
const getBottom = (items: typeof placed) => items.reduce((bottom, item) => Math.max(bottom, item.bottom), 0);
|
|
7587
|
-
let groupStart = 0;
|
|
7588
|
-
for (let start = 0; start < slots.length; start += groupSize) {
|
|
7589
|
-
const group = start / groupSize;
|
|
7590
|
-
const entries = Array.from({ length: Math.min(groupSize, slots.length - start) }, (_, index) => start + index)
|
|
7591
|
-
.sort((a, b) => slots[a].top - slots[b].top || a - b);
|
|
7592
|
-
for (const entry of entries) {
|
|
7593
|
-
const slot = slots[entry];
|
|
7594
|
-
const sharesColumns = (other: { column: number; span: number }) => other.column < slot.column + slot.span
|
|
7595
|
-
&& slot.column < other.column + other.span;
|
|
7596
|
-
const above = entries.filter(other => other !== entry && tops[other] !== undefined && sharesColumns(slots[other])
|
|
7597
|
-
&& slots[other].top + slots[other].height <= slot.top + EDGE_TOLERANCE);
|
|
7598
|
-
const earlier = isMasonry ? placed.filter(item => item.group < group && sharesColumns(item)) : [];
|
|
7599
|
-
const candidates = above.map(other => tops[other] + heights[other] + slot.top - (slots[other].top + slots[other].height));
|
|
7600
|
-
if (earlier.length > 0) candidates.push(getBottom(earlier) + verticalGap);
|
|
7601
|
-
if (candidates.length === 0) candidates.push(groupStart + slot.top);
|
|
7602
|
-
tops[entry] = Math.max(...candidates);
|
|
7603
|
-
placed.push({ column: slot.column, span: slot.span, bottom: tops[entry] + heights[entry], group });
|
|
7604
|
-
}
|
|
7605
|
-
groupStart = getBottom(placed) + verticalGap;
|
|
7606
|
-
}
|
|
7607
|
-
return { tops, bottom: getBottom(placed) };
|
|
7608
|
-
}
|
|
7609
|
-
|
|
7610
7348
|
export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, metadata, activeEvent, layoutId, portalId }: GridProps) {
|
|
7611
7349
|
const { prefix: P } = useScopedStyles();
|
|
7612
7350
|
const {
|
|
7613
7351
|
type = 'a',
|
|
7614
7352
|
gridLayout,
|
|
7615
|
-
customGrid,
|
|
7616
7353
|
textBoxWidth = 100,
|
|
7617
7354
|
verticalGap,
|
|
7618
7355
|
entriesCount,
|
|
@@ -7660,69 +7397,62 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7660
7397
|
hover = 'none',
|
|
7661
7398
|
alignEntries = 'off',
|
|
7662
7399
|
align = 'top',
|
|
7663
|
-
textGrowth = 'inside',
|
|
7664
7400
|
} = settings;
|
|
7665
7401
|
|
|
7666
|
-
const
|
|
7667
|
-
|
|
7668
|
-
|
|
7669
|
-
|
|
7670
|
-
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
titleWordSpacing, titleTextAppearance, titleColor, isEditor, P,
|
|
7684
|
-
]);
|
|
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;
|
|
7685
7419
|
|
|
7686
|
-
const
|
|
7687
|
-
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
subtitleWordSpacing, subtitleTextAppearance, subtitleColor, isEditor, P,
|
|
7704
|
-
]);
|
|
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;
|
|
7705
7437
|
|
|
7706
|
-
const
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
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,
|
|
7720
7454
|
...getGridTextLeadingVars(lightboxCounterFontSize, lightboxCounterLineHeight, P, isEditor),
|
|
7721
|
-
} as React.CSSProperties
|
|
7722
|
-
lightboxCounterFontFamily, lightboxCounterFontSettings, lightboxCounterFontSize, lightboxCounterLineHeight,
|
|
7723
|
-
lightboxCounterLetterSpacing, lightboxCounterWordSpacing, lightboxCounterTextAppearance, lightboxCounterColor,
|
|
7724
|
-
isEditor, P,
|
|
7725
|
-
]);
|
|
7455
|
+
} as React.CSSProperties;
|
|
7726
7456
|
|
|
7727
7457
|
const titleTextClassName = getGridTextClassName(
|
|
7728
7458
|
titleFontSize,
|
|
@@ -7736,6 +7466,8 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7736
7466
|
\`\${P}-item-subtitle\`,
|
|
7737
7467
|
\`\${P}-text-tight-leading\`,
|
|
7738
7468
|
);
|
|
7469
|
+
const titleTextLeadingVars = getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor);
|
|
7470
|
+
const subtitleTextLeadingVars = getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor);
|
|
7739
7471
|
const lightboxCounterClassName = getGridTextClassName(
|
|
7740
7472
|
lightboxCounterFontSize,
|
|
7741
7473
|
lightboxCounterLineHeight,
|
|
@@ -7743,59 +7475,42 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7743
7475
|
\`\${P}-text-tight-leading\`,
|
|
7744
7476
|
);
|
|
7745
7477
|
|
|
7746
|
-
const colorVars =
|
|
7478
|
+
const colorVars = buildColorVars(P, {
|
|
7747
7479
|
titleColor,
|
|
7748
7480
|
subtitleColor,
|
|
7749
7481
|
lightboxCounterColor,
|
|
7750
|
-
}, COLOR_VAR_MAP, STATE_KEYS)
|
|
7482
|
+
}, COLOR_VAR_MAP, STATE_KEYS);
|
|
7751
7483
|
|
|
7752
7484
|
const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
|
|
7753
7485
|
const showTextOnHover = showText === 'on hover' && (!isEditor || isPreviewMode);
|
|
7754
7486
|
const hoverEffectClass = hover !== 'none' && (!isEditor || isPreviewMode) ? \` \${P}-hover-\${hover}\` : '';
|
|
7755
7487
|
const wrapperStateClasses = \`\${stateClass}\${showTextOnHover ? \` \${P}-show-text-hover\` : ''}\${hoverEffectClass}\`.trim();
|
|
7756
7488
|
|
|
7757
|
-
const
|
|
7758
|
-
const resEntriesCount = customLayout || entriesCount === 0 ? Infinity : entriesCount;
|
|
7759
|
-
const isTextOutside = !!customLayout && textGrowth === 'outside';
|
|
7760
|
-
const isAutoHeight = customLayout?.cellHeight === 'auto';
|
|
7761
|
-
// entries stand where placeCustomGridEntries puts them rather than on grid rows
|
|
7762
|
-
const isPlacedLayout = isAutoHeight || customLayout?.masonry === 'on';
|
|
7763
|
-
const itemInnerRefs = useRef<(HTMLDivElement | null)[]>([]);
|
|
7764
|
-
const [customEntryHeights, setCustomEntryHeights] = useState<number[]>([]);
|
|
7489
|
+
const resEntriesCount = entriesCount === 0 ? Infinity : entriesCount;
|
|
7765
7490
|
|
|
7766
|
-
const cropContent =
|
|
7491
|
+
const cropContent = (content ?? []).slice(0, resEntriesCount);
|
|
7767
7492
|
const lightboxMediaToPreload = useMemo(
|
|
7768
7493
|
() => (lightbox === 'on' ? collectGridLightboxMedia(cropContent) : []),
|
|
7769
7494
|
[cropContent, lightbox],
|
|
7770
7495
|
);
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
? lightboxItemsForEntry.findIndex(media => media.assetId === lightboxMedia.assetId)
|
|
7778
|
-
: -1));
|
|
7779
|
-
return { displayItems, lightboxItemsForEntry, lightboxIndexes };
|
|
7780
|
-
}), [cropContent]);
|
|
7781
|
-
|
|
7782
|
-
const size = gridLayout?.entryWidth ?? 0.2;
|
|
7783
|
-
|
|
7784
|
-
const imageDisplaySettings = typeof imageDisplay === 'string' ? { display: imageDisplay } : imageDisplay;
|
|
7785
|
-
const isCover = imageDisplaySettings?.display === 'cover';
|
|
7786
|
-
const ratioValue = imageDisplaySettings?.ratioValue ?? '1:1';
|
|
7787
|
-
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;
|
|
7788
7502
|
const [rW, rH] = ratioValue.split(':').map(Number);
|
|
7789
7503
|
const effW = ratioReversed ? rH : rW;
|
|
7790
7504
|
const effH = ratioReversed ? rW : rH;
|
|
7791
7505
|
const aspectRatio = \`\${effW} / \${effH}\`;
|
|
7792
7506
|
|
|
7793
|
-
const columnsCount = gridLayout
|
|
7507
|
+
const columnsCount = gridLayout.columnsCount;
|
|
7794
7508
|
const entryWidthScaled = scalingValue(size ?? 0, isEditor);
|
|
7795
|
-
const
|
|
7509
|
+
const imageWrapperWidth = entryWidthScaled;
|
|
7510
|
+
const isFitSlider = !isCover && slider !== 'off';
|
|
7796
7511
|
|
|
7797
7512
|
const itemsInLastRow = cropContent.length % columnsCount || columnsCount;
|
|
7798
|
-
const isPartialLastRow =
|
|
7513
|
+
const isPartialLastRow = itemsInLastRow < columnsCount && cropContent.length > 0;
|
|
7799
7514
|
const lastRowStartIndex = cropContent.length - itemsInLastRow;
|
|
7800
7515
|
const lastRowStartColumn = isPartialLastRow
|
|
7801
7516
|
? Math.floor((columnsCount - itemsInLastRow) / 2) + 1
|
|
@@ -7803,47 +7518,24 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7803
7518
|
|
|
7804
7519
|
const imageBorderRadius = imageCorners ? scalingValue(imageCorners, isEditor) : undefined;
|
|
7805
7520
|
|
|
7806
|
-
const
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
width: entryWidth,
|
|
7812
|
-
...(slot && isAutoHeight
|
|
7813
|
-
? {
|
|
7814
|
-
// an entry with no media keeps the drawn height, so it can still be seen and filled
|
|
7815
|
-
height: media?.isEmpty ? scalingValue(slot.height, isEditor) : 'auto',
|
|
7816
|
-
flexShrink: 0,
|
|
7817
|
-
overflow: 'hidden',
|
|
7818
|
-
...(media?.aspect && !isFitSlider ? { aspectRatio: \`\${media.aspect}\` } : {}),
|
|
7819
|
-
}
|
|
7820
|
-
: slot
|
|
7821
|
-
? isTextOutside
|
|
7822
|
-
? { height: scalingValue(slot.height, isEditor), flexShrink: 0, overflow: 'hidden' }
|
|
7823
|
-
: { flex: '1 1 0%', minHeight: 0, overflow: 'hidden' }
|
|
7824
|
-
: isCover
|
|
7825
|
-
? { aspectRatio, height: 'auto', overflow: 'hidden' }
|
|
7826
|
-
: { height: 'auto' }),
|
|
7521
|
+
const imageWrapperStyle: React.CSSProperties = {
|
|
7522
|
+
width: imageWrapperWidth,
|
|
7523
|
+
...(isCover
|
|
7524
|
+
? { aspectRatio, height: 'auto', overflow: 'hidden' }
|
|
7525
|
+
: { height: 'auto' }),
|
|
7827
7526
|
...(imageBorderRadius ? { borderRadius: imageBorderRadius, overflow: 'hidden' } : {}),
|
|
7828
|
-
}
|
|
7527
|
+
};
|
|
7829
7528
|
|
|
7830
7529
|
const imageWrapperClassName = \`\${P}-item-image-wrapper\${isFitSlider ? \` \${P}-item-image-wrapper-fit-slider\` : ''}\`.trim();
|
|
7831
7530
|
const isTextBeforeImage = type === 'd' || type === 'e' || type === 'f';
|
|
7832
|
-
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);
|
|
7833
7534
|
|
|
7834
7535
|
const imageRadiusStyle = imageBorderRadius
|
|
7835
7536
|
? { borderRadius: imageBorderRadius, [MEDIA_RADIUS_VAR]: imageBorderRadius } as React.CSSProperties
|
|
7836
7537
|
: {};
|
|
7837
|
-
const imageStyle: React.CSSProperties =
|
|
7838
|
-
? {
|
|
7839
|
-
objectFit: isFitSlider && !isCover ? 'contain' : 'cover',
|
|
7840
|
-
pointerEvents: 'auto',
|
|
7841
|
-
width: '100%',
|
|
7842
|
-
height: '100%',
|
|
7843
|
-
maxWidth: '100%',
|
|
7844
|
-
...imageRadiusStyle,
|
|
7845
|
-
}
|
|
7846
|
-
: isCover
|
|
7538
|
+
const imageStyle: React.CSSProperties = isCover
|
|
7847
7539
|
? {
|
|
7848
7540
|
objectFit: 'cover',
|
|
7849
7541
|
pointerEvents: 'auto',
|
|
@@ -7858,94 +7550,31 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7858
7550
|
width: 'auto',
|
|
7859
7551
|
height: 'auto',
|
|
7860
7552
|
maxWidth: '100%',
|
|
7861
|
-
...(customLayout ? { maxHeight: '100%' } : {}),
|
|
7862
7553
|
...imageRadiusStyle,
|
|
7863
7554
|
};
|
|
7864
7555
|
|
|
7865
|
-
const
|
|
7866
|
-
const customGridWidth = customLayout ? getCustomGridSpanWidth(customLayout, customLayout.columnsCount) : 0;
|
|
7867
|
-
useLayoutEffect(() => {
|
|
7868
|
-
if (!shouldMeasureEntries) {
|
|
7869
|
-
setCustomEntryHeights(prev => (prev.length > 0 ? [] : prev));
|
|
7870
|
-
return;
|
|
7871
|
-
}
|
|
7872
|
-
const wrapper = containerRef.current;
|
|
7873
|
-
const inners = itemInnerRefs.current.slice(0, cropContent.length);
|
|
7874
|
-
const measure = () => {
|
|
7875
|
-
const unit = wrapper && customGridWidth > 0 ? wrapper.offsetWidth / customGridWidth : 0;
|
|
7876
|
-
if (unit <= 0) return;
|
|
7877
|
-
const heights = inners.map(inner => (inner ? inner.offsetHeight / unit : 0));
|
|
7878
|
-
setCustomEntryHeights(prev => (
|
|
7879
|
-
prev.length === heights.length && prev.every((height, index) => Math.abs(height - heights[index]) < 1e-5)
|
|
7880
|
-
? prev
|
|
7881
|
-
: heights
|
|
7882
|
-
));
|
|
7883
|
-
};
|
|
7884
|
-
measure();
|
|
7885
|
-
const ro = new ResizeObserver(measure);
|
|
7886
|
-
if (wrapper) ro.observe(wrapper);
|
|
7887
|
-
inners.forEach(inner => inner && ro.observe(inner));
|
|
7888
|
-
return () => ro.disconnect();
|
|
7889
|
-
}, [shouldMeasureEntries, cropContent.length, customGridWidth, P]);
|
|
7890
|
-
const measuredEntryHeights = shouldMeasureEntries && customEntryHeights.length === cropContent.length
|
|
7891
|
-
? customEntryHeights
|
|
7892
|
-
: undefined;
|
|
7893
|
-
const customRows = useMemo(() => {
|
|
7894
|
-
if (!customLayout) return undefined;
|
|
7895
|
-
const rows = getCustomGridRows(customLayout, cropContent.length, measuredEntryHeights);
|
|
7896
|
-
return {
|
|
7897
|
-
gridRows: rows.gridRows,
|
|
7898
|
-
gridTemplateRows: rows.tracks.length
|
|
7899
|
-
? rows.tracks.map(track => (track === 'auto' ? 'auto' : scalingValue(track, isEditor))).join(' ')
|
|
7900
|
-
: 'auto',
|
|
7901
|
-
};
|
|
7902
|
-
}, [customLayout, cropContent.length, measuredEntryHeights, isEditor]);
|
|
7903
|
-
const customSlots = useMemo(
|
|
7904
|
-
() => (customLayout ? cropContent.map((_, index) => getCustomGridSlot(customLayout, index)) : undefined),
|
|
7905
|
-
[customLayout, cropContent.length],
|
|
7906
|
-
);
|
|
7907
|
-
// the aspect a single media keeps when the cell takes its height
|
|
7908
|
-
const entryMediaAspects = useMemo(
|
|
7909
|
-
() => entriesMedia.map(({ displayItems }) => (
|
|
7910
|
-
isAutoHeight && displayItems.length > 0 ? getGridMediaAspect(displayItems[0].displayMedia) : undefined
|
|
7911
|
-
)),
|
|
7912
|
-
[entriesMedia, isAutoHeight],
|
|
7913
|
-
);
|
|
7914
|
-
const customPlacement = useMemo(() => {
|
|
7915
|
-
if (!customLayout || !customSlots || !isPlacedLayout) return undefined;
|
|
7916
|
-
const beat = customLayout.beat ?? 0;
|
|
7917
|
-
const heights = customSlots.map((slot, index) => {
|
|
7918
|
-
// until the entries are measured, a media that tells its size gives the height it will take
|
|
7919
|
-
const aspects = entriesMedia[index].displayItems.map(({ displayMedia }) => getGridMediaAspect(displayMedia));
|
|
7920
|
-
const known = aspects.filter((aspect): aspect is number => aspect !== undefined);
|
|
7921
|
-
const estimate = isAutoHeight && known.length > 0 ? Math.max(...known.map(aspect => slot.width / aspect)) : slot.height;
|
|
7922
|
-
const height = measuredEntryHeights?.[index] ?? estimate;
|
|
7923
|
-
return beat > 0 ? Math.ceil(height / beat - 1e-3) * beat : height;
|
|
7924
|
-
});
|
|
7925
|
-
return placeCustomGridEntries(customLayout, customSlots, heights);
|
|
7926
|
-
}, [customLayout, customSlots, isPlacedLayout, isAutoHeight, entriesMedia, measuredEntryHeights]);
|
|
7927
|
-
const wrapperLayoutStyle: React.CSSProperties = customLayout
|
|
7928
|
-
? {
|
|
7929
|
-
gridTemplateColumns: \`repeat(\${customLayout.columnsCount}, \${scalingValue(customLayout.columnWidth, isEditor)})\`,
|
|
7930
|
-
gridTemplateRows: customRows?.gridTemplateRows ?? 'auto',
|
|
7931
|
-
rowGap: 0,
|
|
7932
|
-
columnGap: scalingValue(customLayout.gutterWidth, isEditor),
|
|
7933
|
-
width: scalingValue(getCustomGridSpanWidth(customLayout, customLayout.columnsCount), isEditor),
|
|
7934
|
-
...(customPlacement ? { position: 'relative', height: scalingValue(customPlacement.bottom, isEditor) } : {}),
|
|
7935
|
-
}
|
|
7936
|
-
: {
|
|
7937
|
-
gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
|
|
7938
|
-
rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
|
|
7939
|
-
columnGap: scalingValue(gridLayout?.horizontalGap ?? 0, isEditor),
|
|
7940
|
-
width: scalingValue(gridLayout?.wrapperWidth ?? 0, isEditor),
|
|
7941
|
-
...(shouldAlignEntries
|
|
7942
|
-
? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
|
|
7943
|
-
: {}),
|
|
7944
|
-
};
|
|
7945
|
-
|
|
7556
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
7946
7557
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
7947
7558
|
|
|
7948
|
-
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 = (() => {
|
|
7949
7578
|
const style: Record<string, string> = { ...(colorVars as Record<string, string>) };
|
|
7950
7579
|
const articleWidth = containerRef.current
|
|
7951
7580
|
? getComputedStyle(containerRef.current).getPropertyValue('--cntrl-article-width').trim()
|
|
@@ -7954,7 +7583,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7954
7583
|
style['--cntrl-article-width'] = articleWidth;
|
|
7955
7584
|
}
|
|
7956
7585
|
return style as React.CSSProperties;
|
|
7957
|
-
};
|
|
7586
|
+
})();
|
|
7958
7587
|
|
|
7959
7588
|
const [lightboxOpen, setLightboxOpen] = useState(false);
|
|
7960
7589
|
const [lightboxItems, setLightboxItems] = useState<GridMedia[]>([]);
|
|
@@ -7993,8 +7622,16 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7993
7622
|
<div style={colorVars}>
|
|
7994
7623
|
<div
|
|
7995
7624
|
ref={containerRef}
|
|
7996
|
-
className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''}
|
|
7997
|
-
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
|
+
}}>
|
|
7998
7635
|
{cropContent.map((item: any, index: number) => {
|
|
7999
7636
|
const hasTitle = hasText(item.title);
|
|
8000
7637
|
const hasSubtitle = hasText(item.subtitle);
|
|
@@ -8004,40 +7641,11 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8004
7641
|
const gridColumn = isPartialLastRow && index >= lastRowStartIndex
|
|
8005
7642
|
? \`\${lastRowStartColumn + (index - lastRowStartIndex)}\`
|
|
8006
7643
|
: undefined;
|
|
8007
|
-
const customSlot = customSlots?.[index];
|
|
8008
|
-
const itemSize = customSlot?.width ?? size;
|
|
8009
|
-
const itemWidthScaled = scalingValue(itemSize, isEditor);
|
|
8010
|
-
const textBoxWidthStyle = \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`;
|
|
8011
|
-
const controlWidthStyle = scalingValue(itemSize * textBoxWidth / 100, isEditor);
|
|
8012
|
-
const { displayItems, lightboxItemsForEntry, lightboxIndexes } = entriesMedia[index];
|
|
8013
|
-
const mediaAspect = slider === 'off' ? entryMediaAspects[index] : undefined;
|
|
8014
|
-
const imageWrapperStyle = getImageWrapperStyle(
|
|
8015
|
-
itemWidthScaled,
|
|
8016
|
-
customSlot,
|
|
8017
|
-
{ aspect: mediaAspect, isEmpty: displayItems.length === 0 },
|
|
8018
|
-
);
|
|
8019
|
-
const entryImageStyle = isAutoHeight && slider === 'off' && !mediaAspect
|
|
8020
|
-
? { ...imageStyle, height: 'auto' }
|
|
8021
|
-
: imageStyle;
|
|
8022
|
-
const itemStyle: React.CSSProperties | undefined = customSlot && customLayout && customPlacement
|
|
8023
|
-
? {
|
|
8024
|
-
position: 'absolute',
|
|
8025
|
-
left: scalingValue(customSlot.column * (customLayout.columnWidth + customLayout.gutterWidth), isEditor),
|
|
8026
|
-
top: scalingValue(customPlacement.tops[index], isEditor),
|
|
8027
|
-
width: itemWidthScaled,
|
|
8028
|
-
}
|
|
8029
|
-
: customSlot
|
|
8030
|
-
? {
|
|
8031
|
-
gridColumn: customSlot.gridColumn,
|
|
8032
|
-
gridRow: customRows?.gridRows[index],
|
|
8033
|
-
alignSelf: 'start',
|
|
8034
|
-
}
|
|
8035
|
-
: gridColumn && !shouldAlignEntries ? { gridColumn } : undefined;
|
|
8036
7644
|
|
|
8037
7645
|
const typeCTextBlock = isTextBeforeImage ? (
|
|
8038
7646
|
<div className={\`\${P}-item-text-block\`}>
|
|
8039
7647
|
{hasTitle && (
|
|
8040
|
-
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7648
|
+
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}>
|
|
8041
7649
|
{item.title}
|
|
8042
7650
|
</p>
|
|
8043
7651
|
)}
|
|
@@ -8052,7 +7660,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8052
7660
|
/>
|
|
8053
7661
|
)}
|
|
8054
7662
|
{hasSubtitle && (
|
|
8055
|
-
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7663
|
+
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}>
|
|
8056
7664
|
{item.subtitle}
|
|
8057
7665
|
</p>
|
|
8058
7666
|
)}
|
|
@@ -8082,7 +7690,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8082
7690
|
/>
|
|
8083
7691
|
)}
|
|
8084
7692
|
{hasTitle && (
|
|
8085
|
-
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7693
|
+
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}>
|
|
8086
7694
|
{item.title}
|
|
8087
7695
|
</p>
|
|
8088
7696
|
)}
|
|
@@ -8112,7 +7720,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8112
7720
|
/>
|
|
8113
7721
|
)}
|
|
8114
7722
|
{hasSubtitle && (
|
|
8115
|
-
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7723
|
+
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}>
|
|
8116
7724
|
{item.subtitle}
|
|
8117
7725
|
</p>
|
|
8118
7726
|
)}
|
|
@@ -8136,6 +7744,11 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8136
7744
|
</LinkWrapper>
|
|
8137
7745
|
);
|
|
8138
7746
|
|
|
7747
|
+
const displayItems = getGridDisplayItems(item.gallery);
|
|
7748
|
+
const lightboxItemsForEntry = displayItems
|
|
7749
|
+
.filter(entry => entry.lightboxMedia)
|
|
7750
|
+
.map(entry => entry.lightboxMedia!);
|
|
7751
|
+
|
|
8139
7752
|
const imageContent = (
|
|
8140
7753
|
<GridItemMediaWrapper className={imageWrapperClassName} style={imageWrapperStyle}>
|
|
8141
7754
|
{displayItems.length === 0
|
|
@@ -8143,13 +7756,15 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8143
7756
|
: slider === 'off'
|
|
8144
7757
|
?
|
|
8145
7758
|
(() => {
|
|
8146
|
-
const { displayMedia } = displayItems[0];
|
|
8147
|
-
const lightboxIndex =
|
|
7759
|
+
const { displayMedia, lightboxMedia } = displayItems[0];
|
|
7760
|
+
const lightboxIndex = lightboxMedia
|
|
7761
|
+
? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
|
|
7762
|
+
: -1;
|
|
8148
7763
|
return (
|
|
8149
7764
|
<GridMediaItem
|
|
8150
7765
|
media={displayMedia}
|
|
8151
7766
|
className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
|
|
8152
|
-
style={
|
|
7767
|
+
style={imageStyle}
|
|
8153
7768
|
hasLightbox={lightbox === 'on'}
|
|
8154
7769
|
onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
|
|
8155
7770
|
? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
|
|
@@ -8172,28 +7787,50 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8172
7787
|
))}
|
|
8173
7788
|
</div>
|
|
8174
7789
|
)}
|
|
8175
|
-
<
|
|
8176
|
-
key={\`\${transition}-\${
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
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;
|
|
8183
7818
|
return (
|
|
8184
|
-
<
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
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>
|
|
8194
7831
|
);
|
|
8195
7832
|
})}
|
|
8196
|
-
|
|
7833
|
+
</Splide>
|
|
8197
7834
|
</>
|
|
8198
7835
|
}
|
|
8199
7836
|
</GridItemMediaWrapper>
|
|
@@ -8211,7 +7848,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8211
7848
|
/>
|
|
8212
7849
|
<p
|
|
8213
7850
|
className={titleTextClassName}
|
|
8214
|
-
style={{ width: textBoxWidthStyle, ...
|
|
7851
|
+
style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}
|
|
8215
7852
|
>
|
|
8216
7853
|
{item.title}
|
|
8217
7854
|
</p>
|
|
@@ -8225,7 +7862,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8225
7862
|
/>
|
|
8226
7863
|
<p
|
|
8227
7864
|
className={subtitleTextClassName}
|
|
8228
|
-
style={{ width: textBoxWidthStyle, ...
|
|
7865
|
+
style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}
|
|
8229
7866
|
>
|
|
8230
7867
|
{item.subtitle}
|
|
8231
7868
|
</p>
|
|
@@ -8245,18 +7882,16 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8245
7882
|
<div
|
|
8246
7883
|
key={index}
|
|
8247
7884
|
className={\`\${P}-item\`.trim()}
|
|
8248
|
-
style={
|
|
7885
|
+
style={gridColumn && !shouldAlignEntries ? { gridColumn } : undefined}
|
|
8249
7886
|
>
|
|
8250
7887
|
<div
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
? \`\${P}-item-inner\`
|
|
7888
|
+
className={\`\${isEditMode
|
|
7889
|
+
? \`\${P}-item-inner\`
|
|
8254
7890
|
: \`\${P}-item-inner-hidden\`}\${shouldAlignEntries && isLastRow ? \` \${P}-item-inner-last-row\` : ''}\`.trim()}
|
|
8255
7891
|
style={{
|
|
8256
7892
|
width: (textBoxWidth ?? 0) > 100
|
|
8257
|
-
? \`calc(\${
|
|
8258
|
-
:
|
|
8259
|
-
...(customSlot && !isTextOutside && !isAutoHeight ? { height: scalingValue(customSlot.height, isEditor) } : {}),
|
|
7893
|
+
? \`calc(\${entryWidthScaled} * (\${textBoxWidth} / 100))\`
|
|
7894
|
+
: entryWidthScaled,
|
|
8260
7895
|
...(gridColumn && shouldAlignEntries ? { gridColumn } : {}),
|
|
8261
7896
|
}}
|
|
8262
7897
|
>
|
|
@@ -8302,7 +7937,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8302
7937
|
{(!isEditor || isPreviewMode) && lightboxOpen && typeof document !== 'undefined' && lightbox === 'on' && (() => {
|
|
8303
7938
|
const portalTarget = (portalId ? document.getElementById(portalId) : null) ?? document.body;
|
|
8304
7939
|
return createPortal(
|
|
8305
|
-
<div style={
|
|
7940
|
+
<div style={lightboxPortalStyle} data-selection="none">
|
|
8306
7941
|
<Lightbox
|
|
8307
7942
|
prefix={P}
|
|
8308
7943
|
items={lightboxItems}
|
|
@@ -8339,38 +7974,17 @@ type GridLayoutConfig = {
|
|
|
8339
7974
|
lockedParam?: 'wrapperWidth' | 'entryWidth' | 'horizontalGap' | null;
|
|
8340
7975
|
};
|
|
8341
7976
|
|
|
8342
|
-
type CustomGridBlock = {
|
|
8343
|
-
column: number;
|
|
8344
|
-
span: number;
|
|
8345
|
-
top: number;
|
|
8346
|
-
height: number;
|
|
8347
|
-
};
|
|
8348
|
-
|
|
8349
|
-
type CustomGridLayout = {
|
|
8350
|
-
columnsCount: number;
|
|
8351
|
-
columnWidth: number;
|
|
8352
|
-
gutterWidth: number;
|
|
8353
|
-
maxWidth: number | null;
|
|
8354
|
-
verticalGap?: number;
|
|
8355
|
-
beat?: number;
|
|
8356
|
-
repeatHeight?: number;
|
|
8357
|
-
blocks: CustomGridBlock[];
|
|
8358
|
-
cellHeight?: 'manual' | 'auto';
|
|
8359
|
-
masonry?: 'off' | 'on';
|
|
8360
|
-
};
|
|
8361
|
-
|
|
8362
7977
|
type GridSettings = {
|
|
8363
7978
|
type: 'a' | 'b' | 'c' | 'd' | 'e' | 'f';
|
|
8364
|
-
gridLayout
|
|
8365
|
-
customGrid?: CustomGridLayout;
|
|
7979
|
+
gridLayout: GridLayoutConfig;
|
|
8366
7980
|
textBoxWidth: number;
|
|
8367
|
-
verticalGap
|
|
8368
|
-
entriesCount
|
|
7981
|
+
verticalGap: number;
|
|
7982
|
+
entriesCount: number;
|
|
8369
7983
|
lightbox: 'on' | 'off';
|
|
8370
|
-
imageDisplay:
|
|
7984
|
+
imageDisplay: {
|
|
8371
7985
|
display: 'fit' | 'cover';
|
|
8372
|
-
ratioValue
|
|
8373
|
-
reversed
|
|
7986
|
+
ratioValue: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
|
|
7987
|
+
reversed: boolean;
|
|
8374
7988
|
};
|
|
8375
7989
|
imageCorners?: number;
|
|
8376
7990
|
lightboxImageDisplay?: 'fit' | 'cover' | { display?: 'fit' | 'cover' };
|
|
@@ -8380,9 +7994,8 @@ type GridSettings = {
|
|
|
8380
7994
|
transition: 'fade' | 'slide',
|
|
8381
7995
|
showText: 'always' | 'on hover';
|
|
8382
7996
|
hover?: 'none' | 'zoom-in' | 'greyscale' | 'scale-down';
|
|
8383
|
-
alignEntries
|
|
7997
|
+
alignEntries: 'on' | 'off';
|
|
8384
7998
|
align?: 'top' | 'center' | 'bottom';
|
|
8385
|
-
textGrowth?: 'inside' | 'outside';
|
|
8386
7999
|
titleMarginTop: number;
|
|
8387
8000
|
subtitleMarginTop: number;
|
|
8388
8001
|
titleColor: string;
|
|
@@ -22364,6 +21977,8 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
22364
21977
|
|
|
22365
21978
|
const STATE_KEYS = ['hover', 'active'] as const;
|
|
22366
21979
|
|
|
21980
|
+
const isGradient = (value?: string) => !!value && value.includes('gradient(');
|
|
21981
|
+
|
|
22367
21982
|
const ALIGNMENT_MAP = {
|
|
22368
21983
|
left: 'flex-start',
|
|
22369
21984
|
center: 'center',
|
|
@@ -22416,7 +22031,7 @@ function getCSS(P: string): string {
|
|
|
22416
22031
|
box-sizing: border-box;
|
|
22417
22032
|
border-style: solid;
|
|
22418
22033
|
border-color: var(--\${P}-border-color);
|
|
22419
|
-
background
|
|
22034
|
+
background: var(--\${P}-background-color);
|
|
22420
22035
|
color: var(--\${P}-text-color);
|
|
22421
22036
|
-webkit-backdrop-filter: var(--\${P}-backdrop-blur, none);
|
|
22422
22037
|
backdrop-filter: var(--\${P}-backdrop-blur, none);
|
|
@@ -22460,7 +22075,7 @@ function getCSS(P: string): string {
|
|
|
22460
22075
|
content: '';
|
|
22461
22076
|
position: absolute;
|
|
22462
22077
|
inset: 0;
|
|
22463
|
-
background
|
|
22078
|
+
background: var(--\${P}-hover-background-color, var(--\${P}-background-color));
|
|
22464
22079
|
pointer-events: none;
|
|
22465
22080
|
z-index: 0;
|
|
22466
22081
|
transform: scaleY(0);
|
|
@@ -22487,7 +22102,7 @@ a:focus-visible .\${P}-hover-effect-reveal.\${P}-reveal-from-bottom::before,
|
|
|
22487
22102
|
content: '';
|
|
22488
22103
|
position: absolute;
|
|
22489
22104
|
inset: 0;
|
|
22490
|
-
background
|
|
22105
|
+
background: var(--\${P}-hover-background-color, var(--\${P}-background-color));
|
|
22491
22106
|
pointer-events: none;
|
|
22492
22107
|
z-index: 0;
|
|
22493
22108
|
transform: translateX(-100%);
|
|
@@ -22503,7 +22118,7 @@ a:focus-visible .\${P}-hover-effect-swipe::before,
|
|
|
22503
22118
|
.\${P}-wrapper.\${P}-state-hover .\${P}-hover-effect-reveal,
|
|
22504
22119
|
\${effectFocus('swipe')},
|
|
22505
22120
|
.\${P}-wrapper.\${P}-state-hover .\${P}-hover-effect-swipe {
|
|
22506
|
-
background
|
|
22121
|
+
background: var(--\${P}-background-color);
|
|
22507
22122
|
}
|
|
22508
22123
|
.\${P}-hover-effect-content-roll {
|
|
22509
22124
|
position: relative;
|
|
@@ -22565,15 +22180,17 @@ a:focus-visible .\${P}-hover-effect-content-roll .\${P}-content-roll-layer-hover
|
|
|
22565
22180
|
opacity: 1;
|
|
22566
22181
|
}
|
|
22567
22182
|
\${buttonHoverOrFocus} {
|
|
22568
|
-
background
|
|
22183
|
+
background: var(--\${P}-hover-background-color, var(--\${P}-background-color));
|
|
22569
22184
|
color: var(--\${P}-hover-text-color, var(--\${P}-text-color));
|
|
22570
22185
|
border-color: var(--\${P}-hover-border-color, var(--\${P}-border-color));
|
|
22186
|
+
--\${P}-border-fill: var(--\${P}-hover-border-color, var(--\${P}-border-color));
|
|
22571
22187
|
box-shadow: \${hoverBoxShadow};
|
|
22572
22188
|
}
|
|
22573
22189
|
.\${P}-wrapper.\${P}-state-hover .\${P}-button {
|
|
22574
|
-
background
|
|
22190
|
+
background: var(--\${P}-hover-background-color, var(--\${P}-background-color));
|
|
22575
22191
|
color: var(--\${P}-hover-text-color, var(--\${P}-text-color));
|
|
22576
22192
|
border-color: var(--\${P}-hover-border-color, var(--\${P}-border-color));
|
|
22193
|
+
--\${P}-border-fill: var(--\${P}-hover-border-color, var(--\${P}-border-color));
|
|
22577
22194
|
box-shadow: \${hoverBoxShadow};
|
|
22578
22195
|
}
|
|
22579
22196
|
.\${P}-button:focus,
|
|
@@ -22584,17 +22201,61 @@ a:focus-visible:has(.\${P}-button) {
|
|
|
22584
22201
|
}
|
|
22585
22202
|
.\${P}-button:active,
|
|
22586
22203
|
a:active .\${P}-button {
|
|
22587
|
-
background
|
|
22204
|
+
background: var(--\${P}-active-background-color, var(--\${P}-background-color));
|
|
22588
22205
|
color: var(--\${P}-active-text-color, var(--\${P}-text-color));
|
|
22589
22206
|
border-color: var(--\${P}-active-border-color, var(--\${P}-border-color));
|
|
22207
|
+
--\${P}-border-fill: var(--\${P}-active-border-color, var(--\${P}-border-color));
|
|
22590
22208
|
box-shadow: \${activeBoxShadow};
|
|
22591
22209
|
}
|
|
22592
22210
|
.\${P}-wrapper.\${P}-state-active .\${P}-button {
|
|
22593
|
-
background
|
|
22211
|
+
background: var(--\${P}-active-background-color, var(--\${P}-background-color));
|
|
22594
22212
|
color: var(--\${P}-active-text-color, var(--\${P}-text-color));
|
|
22595
22213
|
border-color: var(--\${P}-active-border-color, var(--\${P}-border-color));
|
|
22214
|
+
--\${P}-border-fill: var(--\${P}-active-border-color, var(--\${P}-border-color));
|
|
22596
22215
|
box-shadow: \${activeBoxShadow};
|
|
22597
22216
|
}
|
|
22217
|
+
/* Gradient border: CSS borders can't take gradients with radius, so the transparent border is covered by a masked ring. */
|
|
22218
|
+
.\${P}-border-gradient {
|
|
22219
|
+
position: relative;
|
|
22220
|
+
}
|
|
22221
|
+
.\${P}-border-gradient::after {
|
|
22222
|
+
content: '';
|
|
22223
|
+
position: absolute;
|
|
22224
|
+
inset: calc(var(--\${P}-stroke) * -1);
|
|
22225
|
+
padding: var(--\${P}-stroke);
|
|
22226
|
+
border-radius: inherit;
|
|
22227
|
+
background: var(--\${P}-border-fill, var(--\${P}-border-color));
|
|
22228
|
+
-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
|
|
22229
|
+
-webkit-mask-composite: xor;
|
|
22230
|
+
mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
|
|
22231
|
+
pointer-events: none;
|
|
22232
|
+
z-index: 2;
|
|
22233
|
+
}
|
|
22234
|
+
/* overflow would clip the ring, so these effects clip their moving parts instead */
|
|
22235
|
+
.\${P}-border-gradient.\${P}-hover-effect-reveal,
|
|
22236
|
+
.\${P}-border-gradient.\${P}-hover-effect-swipe,
|
|
22237
|
+
.\${P}-border-gradient.\${P}-hover-effect-content-roll {
|
|
22238
|
+
overflow: visible;
|
|
22239
|
+
}
|
|
22240
|
+
.\${P}-border-gradient.\${P}-hover-effect-reveal::before,
|
|
22241
|
+
.\${P}-border-gradient.\${P}-hover-effect-swipe::before {
|
|
22242
|
+
border-radius: max(0px, calc(var(--\${P}-radius) - var(--\${P}-stroke)));
|
|
22243
|
+
}
|
|
22244
|
+
.\${P}-border-gradient.\${P}-hover-effect-swipe::before {
|
|
22245
|
+
transform: none;
|
|
22246
|
+
clip-path: inset(0 100% 0 0);
|
|
22247
|
+
transition: clip-path 250ms;
|
|
22248
|
+
}
|
|
22249
|
+
.\${P}-border-gradient.\${P}-hover-effect-swipe:hover::before,
|
|
22250
|
+
.\${P}-border-gradient.\${P}-hover-effect-swipe:focus-visible::before,
|
|
22251
|
+
a:focus-visible .\${P}-border-gradient.\${P}-hover-effect-swipe::before,
|
|
22252
|
+
.\${P}-wrapper.\${P}-state-hover .\${P}-border-gradient.\${P}-hover-effect-swipe::before {
|
|
22253
|
+
clip-path: inset(0);
|
|
22254
|
+
}
|
|
22255
|
+
/* clip the roll at the padding edge, where the button itself would have clipped it */
|
|
22256
|
+
.\${P}-border-gradient .\${P}-content-roll-viewport {
|
|
22257
|
+
clip-path: var(--\${P}-roll-clip);
|
|
22258
|
+
}
|
|
22598
22259
|
.\${P}-text {
|
|
22599
22260
|
display: block;
|
|
22600
22261
|
flex: 1;
|
|
@@ -22773,6 +22434,12 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
22773
22434
|
const useContentRoll = hoverEffect === 'content-roll';
|
|
22774
22435
|
const revealHoverActive = hoverEffect === 'reveal' && (!isEditor || isPreviewMode);
|
|
22775
22436
|
|
|
22437
|
+
const hasBorderGradient = stroke > 0 && [borderColor, ...Object.values(stateOverrides ?? {}).map((o) => o?.borderColor)].some(isGradient);
|
|
22438
|
+
const borderGradientClass = hasBorderGradient ? \`\${P}-border-gradient\` : '';
|
|
22439
|
+
const strokeValue = scalingValue(stroke, isEditor);
|
|
22440
|
+
// Browsers draw a border at whole pixels, so the ring uses the same rounded width to line up with it on every side
|
|
22441
|
+
const ringStrokeValue = \`max(1px, round(down, \${strokeValue}, 1px))\`;
|
|
22442
|
+
|
|
22776
22443
|
const isFixedDimensions = dimensions === true;
|
|
22777
22444
|
const resolvedAlignment = type === 'a' ? (alignA ?? alignment) : alignment;
|
|
22778
22445
|
const effectiveAlignment = resolvedAlignment;
|
|
@@ -22814,7 +22481,18 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
22814
22481
|
paddingBottom: scalingValue(padding.bottom, isEditor),
|
|
22815
22482
|
paddingLeft: scalingValue(padding.left, isEditor),
|
|
22816
22483
|
borderRadius: scalingValue(cornerRadius, isEditor),
|
|
22817
|
-
borderWidth:
|
|
22484
|
+
borderWidth: hasBorderGradient ? ringStrokeValue : strokeValue,
|
|
22485
|
+
// Like a CSS border: the background stops at it, and the ring paints over it
|
|
22486
|
+
...(hasBorderGradient ? {
|
|
22487
|
+
[\`--\${P}-stroke\`]: ringStrokeValue,
|
|
22488
|
+
[\`--\${P}-radius\`]: scalingValue(cornerRadius, isEditor),
|
|
22489
|
+
[\`--\${P}-roll-clip\`]: \`inset(\${[padding.top, padding.right, padding.bottom, padding.left].map((value) => \`calc(\${scalingValue(value, isEditor)} * -1)\`).join(' ')})\`,
|
|
22490
|
+
borderColor: 'transparent',
|
|
22491
|
+
backgroundClip: 'padding-box',
|
|
22492
|
+
} : {
|
|
22493
|
+
// A gradient background spans the border box, so it doesn't repeat under a see-through border
|
|
22494
|
+
backgroundOrigin: 'border-box',
|
|
22495
|
+
}),
|
|
22818
22496
|
...(!isIconTextType ? {
|
|
22819
22497
|
justifyContent: ALIGNMENT_MAP[effectiveAlignment],
|
|
22820
22498
|
textAlign: effectiveAlignment,
|
|
@@ -22892,7 +22570,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
22892
22570
|
<div className={\`\${P}-root\`} style={colorVars}>
|
|
22893
22571
|
<div className={\`\${P}-wrapper \${stateClass} \${editingClass}\`.trim()}>
|
|
22894
22572
|
<div
|
|
22895
|
-
className={\`\${P}-button \${hoverEffectClass}\`.trim()}
|
|
22573
|
+
className={\`\${P}-button \${hoverEffectClass} \${borderGradientClass}\`.trim()}
|
|
22896
22574
|
style={buttonStyle}
|
|
22897
22575
|
onMouseEnter={handleRevealMouseEnter}
|
|
22898
22576
|
onMouseLeave={handleRevealMouseLeave}
|
|
@@ -25749,4 +25427,4 @@ export function Waterfall({
|
|
|
25749
25427
|
</>
|
|
25750
25428
|
);
|
|
25751
25429
|
}
|
|
25752
|
-
`,
|
|
25430
|
+
`,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;
|