@cntrl-site/components 1.0.120 → 1.0.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Burger-C8JIQQwm.mjs → Burger-BKeZH3HS.mjs} +1 -1
- package/dist/{Burger-C_SjPZWp.js → Burger-DxjmS1t5.js} +1 -1
- package/dist/{Chronicles-BNvvaFYY.mjs → Chronicles-BXfNFANB.mjs} +1 -1
- package/dist/{Chronicles-Dj1gvNjE.js → Chronicles-mir8oCdq.js} +1 -1
- package/dist/{ChroniclesComponent-8lhIeord.mjs → ChroniclesComponent-CH-c7QBm.mjs} +18 -35
- package/dist/{ChroniclesComponent-5ZbqHNpi.js → ChroniclesComponent-D425pM5e.js} +1 -1
- package/dist/Components/Slider20/Slider20.d.ts +1 -2
- package/dist/{LightboxJournal-BDUs6T0B.mjs → LightboxJournal-By2sN-Ix.mjs} +1 -1
- package/dist/{LightboxJournal-Bf_rZzmz.js → LightboxJournal-DEQXz8wX.js} +1 -1
- package/dist/{LightboxStrip-Cuhb2fIR.mjs → LightboxStrip-GwaY8uLD.mjs} +1 -1
- package/dist/{LightboxStrip-RA4ABUC-.js → LightboxStrip-XbD9uQKr.js} +1 -1
- package/dist/Slider20-BOmjDRf2.js +272 -0
- package/dist/Slider20-DUi6qwnd.mjs +851 -0
- package/dist/{components-CBJ6asBX.mjs → components-BN4QKcJm.mjs} +1 -1
- package/dist/{components-BHB4G3ma.js → components-QZW1MaQM.js} +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +5 -5
- 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 +168 -213
- package/dist/sources.mjs +167 -212
- package/dist/useLightboxScrollLock-CjSZPvqJ.mjs +18 -0
- package/dist/useLightboxScrollLock-CmwKl-Vu.js +1 -0
- package/package.json +1 -1
- package/dist/Slider20-C2o_EB1I.mjs +0 -872
- package/dist/Slider20-DzxWCTg-.js +0 -273
- package/dist/useLightboxScrollLock-Hf16Eq4g.js +0 -1
- package/dist/useLightboxScrollLock-VQ07s7EJ.mjs +0 -18
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-D425pM5e.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';
|
|
@@ -11067,7 +11067,7 @@ export function Hive({
|
|
|
11067
11067
|
</>
|
|
11068
11068
|
);
|
|
11069
11069
|
}
|
|
11070
|
-
`,
|
|
11070
|
+
`,c=`import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
|
|
11071
11071
|
import { createPortal } from 'react-dom';
|
|
11072
11072
|
import { CommonComponentProps } from '../props';
|
|
11073
11073
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -11870,7 +11870,7 @@ export type LightboxJournalSettings = {
|
|
|
11870
11870
|
closeIconColor: string;
|
|
11871
11871
|
closeIconHoverColor: string;
|
|
11872
11872
|
};
|
|
11873
|
-
`,
|
|
11873
|
+
`,d=`import { useEffect, useRef, useState, type MouseEvent } from 'react';
|
|
11874
11874
|
import { createPortal } from 'react-dom';
|
|
11875
11875
|
import { CommonComponentProps } from '../props';
|
|
11876
11876
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -22598,6 +22598,7 @@ type Slider20Item = {
|
|
|
22598
22598
|
image: {
|
|
22599
22599
|
assetId: string;
|
|
22600
22600
|
name?: string;
|
|
22601
|
+
objectFit?: 'cover' | 'contain';
|
|
22601
22602
|
};
|
|
22602
22603
|
imageCaption: any[];
|
|
22603
22604
|
};
|
|
@@ -22619,7 +22620,6 @@ type Slider20Settings = {
|
|
|
22619
22620
|
trigger?: Slider20Trigger;
|
|
22620
22621
|
direction?: Slider20Direction;
|
|
22621
22622
|
transition?: Slider20Transition;
|
|
22622
|
-
transitionSpeed?: number;
|
|
22623
22623
|
nav?: Slider20Nav;
|
|
22624
22624
|
navSize?: Slider20NavSize;
|
|
22625
22625
|
navUnit?: number;
|
|
@@ -22650,7 +22650,6 @@ type Slider20Settings = {
|
|
|
22650
22650
|
fontVariant?: 'normal' | 'small-caps';
|
|
22651
22651
|
};
|
|
22652
22652
|
captionMarginTop?: number;
|
|
22653
|
-
imageCorners?: number;
|
|
22654
22653
|
};
|
|
22655
22654
|
|
|
22656
22655
|
type Slider20Props = {
|
|
@@ -22662,7 +22661,6 @@ type Slider20Props = {
|
|
|
22662
22661
|
} & CommonComponentProps;
|
|
22663
22662
|
|
|
22664
22663
|
type Offset = { x: number; y: number };
|
|
22665
|
-
type TransitionLayer = { index: number; key: number; isAnimated: boolean };
|
|
22666
22664
|
type Point = { x: number; y: number };
|
|
22667
22665
|
type LocalAxes = { ex: Point; ey: Point; det: number };
|
|
22668
22666
|
|
|
@@ -22680,11 +22678,9 @@ type DragState = {
|
|
|
22680
22678
|
};
|
|
22681
22679
|
|
|
22682
22680
|
const TRANSITION_DURATION_MS = 500;
|
|
22683
|
-
const DEFAULT_TRANSITION_SPEED = 1;
|
|
22684
22681
|
const TRANSITION_EASING = 'cubic-bezier(0.25, 1, 0.5, 1)';
|
|
22685
22682
|
const TRANSITION_BACKGROUND_COLOR: string | null = null;
|
|
22686
22683
|
const DOT_ANIMATION_MS = 300;
|
|
22687
|
-
const MAX_TRANSITION_LAYERS = 40;
|
|
22688
22684
|
const DRAG_START_THRESHOLD_PX = 5;
|
|
22689
22685
|
const DRAG_DISTANCE_RATIO = 0.15;
|
|
22690
22686
|
const DRAG_FLICK_VELOCITY = 0.4;
|
|
@@ -22786,24 +22782,23 @@ function wrapIndex(index: number, count: number): number {
|
|
|
22786
22782
|
return ((index % count) + count) % count;
|
|
22787
22783
|
}
|
|
22788
22784
|
|
|
22789
|
-
|
|
22790
|
-
|
|
22791
|
-
|
|
22792
|
-
|
|
22793
|
-
|
|
22794
|
-
|
|
22795
|
-
|
|
22796
|
-
}
|
|
22797
|
-
|
|
22798
|
-
|
|
22799
|
-
|
|
22800
|
-
|
|
22801
|
-
}
|
|
22802
|
-
|
|
22803
|
-
|
|
22804
|
-
|
|
22805
|
-
|
|
22806
|
-
return parseFloat(isHorizontal ? style.width : style.height) || 0;
|
|
22785
|
+
function advanceTrackPosition(
|
|
22786
|
+
prev: number,
|
|
22787
|
+
step: 1 | -1,
|
|
22788
|
+
count: number,
|
|
22789
|
+
hasClones: boolean,
|
|
22790
|
+
): { position: number; hitBoundary: boolean } {
|
|
22791
|
+
if (!hasClones) {
|
|
22792
|
+
return { position: wrapIndex(prev + step, count), hitBoundary: false };
|
|
22793
|
+
}
|
|
22794
|
+
const next = prev + step;
|
|
22795
|
+
if (next >= 0 && next <= count + 1) {
|
|
22796
|
+
return { position: next, hitBoundary: false };
|
|
22797
|
+
}
|
|
22798
|
+
return {
|
|
22799
|
+
position: step > 0 ? count + 1 : 0,
|
|
22800
|
+
hitBoundary: true,
|
|
22801
|
+
};
|
|
22807
22802
|
}
|
|
22808
22803
|
|
|
22809
22804
|
function readTrackTranslatePx(element: HTMLElement, isHorizontal: boolean): number {
|
|
@@ -22845,13 +22840,7 @@ function toLocalDelta(axes: LocalAxes, dx: number, dy: number): Point {
|
|
|
22845
22840
|
};
|
|
22846
22841
|
}
|
|
22847
22842
|
|
|
22848
|
-
|
|
22849
|
-
function getTransitionDurationMs(speed: number): number {
|
|
22850
|
-
const clamped = Math.min(Math.max(speed, 0), 2);
|
|
22851
|
-
return Math.round(TRANSITION_DURATION_MS * Math.pow(4, 1 - clamped));
|
|
22852
|
-
}
|
|
22853
|
-
|
|
22854
|
-
function getCSS(P: string, transitionDurationMs: number, isEditor?: boolean): string {
|
|
22843
|
+
function getCSS(P: string, isEditor?: boolean): string {
|
|
22855
22844
|
return \`
|
|
22856
22845
|
.\${P}-wrapper {
|
|
22857
22846
|
position: relative;
|
|
@@ -22912,8 +22901,6 @@ function getCSS(P: string, transitionDurationMs: number, isEditor?: boolean): st
|
|
|
22912
22901
|
}
|
|
22913
22902
|
.\${P}-list-fade {
|
|
22914
22903
|
display: block;
|
|
22915
|
-
/* Keeps the transition layers' z-index below the arrows, dots and click overlay. */
|
|
22916
|
-
isolation: isolate;
|
|
22917
22904
|
}
|
|
22918
22905
|
.\${P}-slide {
|
|
22919
22906
|
position: relative;
|
|
@@ -22926,9 +22913,11 @@ function getCSS(P: string, transitionDurationMs: number, isEditor?: boolean): st
|
|
|
22926
22913
|
top: 0;
|
|
22927
22914
|
left: 0;
|
|
22928
22915
|
opacity: 0;
|
|
22916
|
+
transition: opacity \${TRANSITION_DURATION_MS}ms \${TRANSITION_EASING};
|
|
22929
22917
|
}
|
|
22930
|
-
.\${P}-list-fade .\${P}-slide.\${P}-is-
|
|
22918
|
+
.\${P}-list-fade .\${P}-slide.\${P}-is-active {
|
|
22931
22919
|
opacity: 1;
|
|
22920
|
+
z-index: 1;
|
|
22932
22921
|
}
|
|
22933
22922
|
.\${P}-slider-item {
|
|
22934
22923
|
width: 100%;
|
|
@@ -23103,18 +23092,17 @@ function getCSS(P: string, transitionDurationMs: number, isEditor?: boolean): st
|
|
|
23103
23092
|
cursor: pointer;
|
|
23104
23093
|
z-index: 2;
|
|
23105
23094
|
}
|
|
23106
|
-
.\${P}-
|
|
23107
|
-
|
|
23095
|
+
.\${P}-contain {
|
|
23096
|
+
object-fit: contain;
|
|
23108
23097
|
}
|
|
23109
|
-
.\${P}-
|
|
23110
|
-
|
|
23098
|
+
.\${P}-cover {
|
|
23099
|
+
object-fit: cover;
|
|
23111
23100
|
}
|
|
23112
|
-
.\${P}-transition-reveal
|
|
23113
|
-
animation: \${P}-reveal-
|
|
23101
|
+
.\${P}-transition-reveal .\${P}-slide.\${P}-is-active .\${P}-slider-image {
|
|
23102
|
+
animation: \${P}-reveal-horizontal \${TRANSITION_DURATION_MS}ms ease;
|
|
23114
23103
|
}
|
|
23115
|
-
|
|
23116
|
-
|
|
23117
|
-
to { opacity: 1; }
|
|
23104
|
+
.\${P}-transition-reveal-vertical .\${P}-slide.\${P}-is-active .\${P}-slider-image {
|
|
23105
|
+
animation: \${P}-reveal-vertical \${TRANSITION_DURATION_MS}ms ease;
|
|
23118
23106
|
}
|
|
23119
23107
|
@keyframes \${P}-reveal-horizontal {
|
|
23120
23108
|
from { clip-path: inset(0 100% 0 0); }
|
|
@@ -23137,8 +23125,6 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
|
|
|
23137
23125
|
const autoPlayIntervalS = trigger.value ?? DEFAULT_TRIGGER.value;
|
|
23138
23126
|
const direction: Slider20Direction = settings?.direction ?? 'horizontal';
|
|
23139
23127
|
const transition: Slider20Transition = settings?.transition ?? 'slide';
|
|
23140
|
-
const transitionSpeed = typeof settings?.transitionSpeed === 'number' ? settings.transitionSpeed : DEFAULT_TRANSITION_SPEED;
|
|
23141
|
-
const transitionDurationMs = getTransitionDurationMs(transitionSpeed);
|
|
23142
23128
|
const nav: Slider20Nav = settings?.nav ?? 'classic';
|
|
23143
23129
|
const navSize: Slider20NavSize = settings?.navSize ?? 'm';
|
|
23144
23130
|
const navSizeValues = NAV_SIZES[navSize];
|
|
@@ -23156,21 +23142,12 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
|
|
|
23156
23142
|
const navBackgroundColor = settings?.navBackgroundColor ?? PAGINATION.colors.background;
|
|
23157
23143
|
const linkColor = settings?.linkColor ?? IMAGE_CAPTION.linkColor;
|
|
23158
23144
|
const captionMarginTop = typeof settings?.captionMarginTop === 'number' ? settings.captionMarginTop : 0;
|
|
23159
|
-
const imageCorners = typeof settings?.imageCorners === 'number' ? settings.imageCorners : 0;
|
|
23160
|
-
// Rounding the track (not each image) keeps the corners steady while slides move under it.
|
|
23161
|
-
// isolation makes Safari clip the transformed list to the radius.
|
|
23162
|
-
const trackRadiusStyle: React.CSSProperties | undefined = imageCorners > 0
|
|
23163
|
-
? { borderRadius: scalingValue(imageCorners, isEditor), isolation: 'isolate' }
|
|
23164
|
-
: undefined;
|
|
23165
23145
|
const isHorizontal = direction === 'horizontal';
|
|
23166
23146
|
const isClickTrigger = triggerType === 'click';
|
|
23167
23147
|
const isDragTrigger = triggerType === 'drag';
|
|
23168
23148
|
const isAutoPlaying = triggerType === 'auto' && (!isEditor || Boolean(isPreviewMode));
|
|
23169
23149
|
const pauseAutoOnHover = !isEditor;
|
|
23170
23150
|
const isSlideTransition = transition === 'slide';
|
|
23171
|
-
const isReveal = transition === 'reveal';
|
|
23172
|
-
// Fade and reveal draw each new slide as a layer over the previous ones.
|
|
23173
|
-
const isLayered = !isSlideTransition;
|
|
23174
23151
|
const showClassicNav = nav === 'classic';
|
|
23175
23152
|
const showControls = controlsShow !== 'never' && controlsMaxWidth > 0;
|
|
23176
23153
|
const isControlsOnHover = controlsShow === 'on hover';
|
|
@@ -23183,39 +23160,7 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
|
|
|
23183
23160
|
|
|
23184
23161
|
const hasClones = isSlideTransition && count > 1;
|
|
23185
23162
|
const [activeIndex, setActiveIndex] = useState(0);
|
|
23186
|
-
|
|
23187
|
-
// which keep their own animation. The same slide can sit in the stack more than once.
|
|
23188
|
-
// The first slide is shown as is on load, without a transition.
|
|
23189
|
-
const [transitionLayers, setTransitionLayers] = useState<TransitionLayer[]>([
|
|
23190
|
-
{ index: activeIndex, key: 0, isAnimated: false },
|
|
23191
|
-
]);
|
|
23192
|
-
const topLayer = transitionLayers[transitionLayers.length - 1];
|
|
23193
|
-
if (isLayered && topLayer.index !== activeIndex) {
|
|
23194
|
-
// Over the limit, drop the oldest layer still animating, never the fully shown bottom one.
|
|
23195
|
-
const kept = transitionLayers.length >= MAX_TRANSITION_LAYERS
|
|
23196
|
-
? [transitionLayers[0], ...transitionLayers.slice(2)]
|
|
23197
|
-
: transitionLayers;
|
|
23198
|
-
setTransitionLayers([...kept, { index: activeIndex, key: topLayer.key + 1, isAnimated: true }]);
|
|
23199
|
-
}
|
|
23200
|
-
const handleLayerEnd = (key: number) => {
|
|
23201
|
-
// A fully shown layer covers everything under it, so those layers are dropped.
|
|
23202
|
-
setTransitionLayers((layers) => {
|
|
23203
|
-
const position = layers.findIndex((layer) => layer.key === key);
|
|
23204
|
-
return position > 0 ? layers.slice(position) : layers;
|
|
23205
|
-
});
|
|
23206
|
-
};
|
|
23207
|
-
const renderSlideItem = (item: Slider20Item | undefined) => item && (
|
|
23208
|
-
<div className={\`\${P}-slider-item\`}>
|
|
23209
|
-
<div className={\`\${P}-img-wrapper\`}>
|
|
23210
|
-
<img
|
|
23211
|
-
className={\`\${P}-slider-image\`}
|
|
23212
|
-
src={item.image.assetId} alt={item.image.name ?? ''}
|
|
23213
|
-
draggable={false}
|
|
23214
|
-
/>
|
|
23215
|
-
</div>
|
|
23216
|
-
</div>
|
|
23217
|
-
);
|
|
23218
|
-
const [trackPosition, setTrackPosition] = useState(hasClones ? count : 0);
|
|
23163
|
+
const [trackPosition, setTrackPosition] = useState(hasClones ? 1 : 0);
|
|
23219
23164
|
const [isMoving, setIsMoving] = useState(false);
|
|
23220
23165
|
const [skipTransition, setSkipTransition] = useState(false);
|
|
23221
23166
|
const [isDragging, setIsDragging] = useState(false);
|
|
@@ -23225,100 +23170,73 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
|
|
|
23225
23170
|
const isMovingRef = useRef(false);
|
|
23226
23171
|
const trackPositionRef = useRef(trackPosition);
|
|
23227
23172
|
trackPositionRef.current = trackPosition;
|
|
23173
|
+
const pendingAnimatedPositionRef = useRef<number | null>(null);
|
|
23174
|
+
const pendingStepsRef = useRef(0);
|
|
23228
23175
|
const trackRef = useRef<HTMLDivElement | null>(null);
|
|
23229
23176
|
const listRef = useRef<HTMLDivElement | null>(null);
|
|
23230
23177
|
const dragRef = useRef<DragState | null>(null);
|
|
23231
23178
|
const activePointerIdRef = useRef<number | null>(null);
|
|
23232
23179
|
|
|
23233
|
-
const activeIndexRef = useRef(activeIndex);
|
|
23234
|
-
activeIndexRef.current = activeIndex;
|
|
23235
|
-
const revealTargetRef = useRef(activeIndex);
|
|
23236
|
-
const revealTimerRef = useRef<number | null>(null);
|
|
23237
|
-
|
|
23238
23180
|
const setMoving = useCallback((value: boolean) => {
|
|
23239
23181
|
isMovingRef.current = value;
|
|
23240
23182
|
setIsMoving(value);
|
|
23241
23183
|
}, []);
|
|
23242
23184
|
|
|
23243
|
-
|
|
23244
|
-
|
|
23245
|
-
|
|
23246
|
-
|
|
23247
|
-
|
|
23248
|
-
|
|
23185
|
+
const goBySteps = useCallback((steps: number) => {
|
|
23186
|
+
if (count < 2 || steps === 0) return;
|
|
23187
|
+
const direction = steps > 0 ? 1 : -1;
|
|
23188
|
+
const total = Math.abs(steps);
|
|
23189
|
+
setAnimateDots(true);
|
|
23190
|
+
setMoving(true);
|
|
23191
|
+
if (!isSlideTransition) {
|
|
23192
|
+
setActiveIndex((prev) => wrapIndex(prev + steps, count));
|
|
23249
23193
|
return;
|
|
23250
23194
|
}
|
|
23251
|
-
const isWaiting = revealTimerRef.current !== null;
|
|
23252
|
-
const base = isWaiting ? revealTargetRef.current : activeIndexRef.current;
|
|
23253
|
-
revealTargetRef.current = wrapIndex(getTarget(base), count);
|
|
23254
|
-
if (isWaiting) return;
|
|
23255
|
-
const startReveal = (index: number) => {
|
|
23256
|
-
activeIndexRef.current = index;
|
|
23257
|
-
setActiveIndex(index);
|
|
23258
|
-
revealTimerRef.current = window.setTimeout(() => {
|
|
23259
|
-
revealTimerRef.current = null;
|
|
23260
|
-
if (revealTargetRef.current !== activeIndexRef.current) startReveal(revealTargetRef.current);
|
|
23261
|
-
}, transitionDurationMs / 2);
|
|
23262
|
-
};
|
|
23263
|
-
startReveal(revealTargetRef.current);
|
|
23264
|
-
}, [count, isReveal, transitionDurationMs]);
|
|
23265
23195
|
|
|
23266
|
-
|
|
23267
|
-
|
|
23268
|
-
|
|
23196
|
+
let position = trackPositionRef.current;
|
|
23197
|
+
const isOnClone = hasClones && (position === 0 || position === count + 1);
|
|
23198
|
+
const cloneSnapPosition = isOnClone ? activeIndex + 1 : null;
|
|
23269
23199
|
|
|
23270
|
-
|
|
23271
|
-
|
|
23272
|
-
const list = listRef.current;
|
|
23273
|
-
const size = list ? readSlideSizePx(list, isHorizontal) : 0;
|
|
23274
|
-
if (!list || size <= 0) return trackPositionRef.current;
|
|
23275
|
-
// Rounded so a settled track reads as a whole position.
|
|
23276
|
-
return Math.round((-readTrackTranslatePx(list, isHorizontal) / size) * 1000) / 1000;
|
|
23277
|
-
}, [isHorizontal]);
|
|
23278
|
-
|
|
23279
|
-
// Moves the track to \`target\` from wherever it is now. When the visual position is outside
|
|
23280
|
-
// the middle copy, it is first teleported by a whole copy (no visible change), so rapid
|
|
23281
|
-
// navigation never runs off the rendered slides and never snaps mid-animation.
|
|
23282
|
-
const moveTrack = useCallback((getTarget: (visual: number, shift: number) => number) => {
|
|
23283
|
-
const visual = readVisualPosition();
|
|
23284
|
-
const shift = getMiddleCopyShift(visual, count);
|
|
23285
|
-
const target = getTarget(visual - shift, shift);
|
|
23286
|
-
const list = listRef.current;
|
|
23287
|
-
if (shift !== 0 && list) {
|
|
23288
|
-
const transitionValue = list.style.transition;
|
|
23289
|
-
list.style.transition = 'none';
|
|
23290
|
-
list.style.transform = getTrackTranslate(visual - shift, 0, isHorizontal);
|
|
23291
|
-
void list.offsetWidth;
|
|
23292
|
-
list.style.transition = transitionValue && transitionValue !== 'none'
|
|
23293
|
-
? transitionValue
|
|
23294
|
-
: \`transform \${transitionDurationMs}ms \${TRANSITION_EASING}\`;
|
|
23295
|
-
list.style.transform = getTrackTranslate(target, 0, isHorizontal);
|
|
23200
|
+
if (isOnClone) {
|
|
23201
|
+
position = activeIndex + 1;
|
|
23296
23202
|
}
|
|
23297
|
-
trackPositionRef.current = target;
|
|
23298
|
-
setActiveIndex(wrapIndex(target, count));
|
|
23299
|
-
setSkipTransition(false);
|
|
23300
|
-
setTrackPosition(target);
|
|
23301
|
-
}, [count, isHorizontal, readVisualPosition, transitionDurationMs]);
|
|
23302
23203
|
|
|
23303
|
-
|
|
23304
|
-
|
|
23305
|
-
|
|
23306
|
-
|
|
23307
|
-
|
|
23308
|
-
|
|
23204
|
+
let remaining = total;
|
|
23205
|
+
while (remaining > 0) {
|
|
23206
|
+
const result = advanceTrackPosition(position, direction, count, hasClones);
|
|
23207
|
+
position = result.position;
|
|
23208
|
+
remaining -= 1;
|
|
23209
|
+
if (result.hitBoundary) {
|
|
23210
|
+
pendingStepsRef.current = remaining * direction;
|
|
23211
|
+
break;
|
|
23212
|
+
}
|
|
23213
|
+
}
|
|
23214
|
+
|
|
23215
|
+
const appliedSteps = total - remaining;
|
|
23216
|
+
if (appliedSteps > 0) {
|
|
23217
|
+
setActiveIndex((prev) => wrapIndex(prev + appliedSteps * direction, count));
|
|
23218
|
+
}
|
|
23219
|
+
|
|
23220
|
+
trackPositionRef.current = position;
|
|
23221
|
+
|
|
23222
|
+
if (cloneSnapPosition !== null) {
|
|
23223
|
+
trackPositionRef.current = cloneSnapPosition;
|
|
23224
|
+
if (position === cloneSnapPosition) {
|
|
23225
|
+
setSkipTransition(true);
|
|
23226
|
+
setTrackPosition(position);
|
|
23227
|
+
return;
|
|
23228
|
+
}
|
|
23229
|
+
pendingAnimatedPositionRef.current = position;
|
|
23230
|
+
setSkipTransition(true);
|
|
23231
|
+
setTrackPosition(cloneSnapPosition);
|
|
23309
23232
|
return;
|
|
23310
23233
|
}
|
|
23311
|
-
moveTrack((visual, shift) => {
|
|
23312
|
-
// Continue from the previous target so quick clicks add up, but never get more than
|
|
23313
|
-
// count - 1 slides away from what is on screen, which keeps the target inside the copies.
|
|
23314
|
-
const previousTarget = trackPositionRef.current - shift;
|
|
23315
|
-
const base = Math.abs(previousTarget - visual) < count ? previousTarget : Math.round(visual);
|
|
23316
|
-
const maxDistance = count - 1;
|
|
23317
|
-
return Math.min(Math.max(base + steps, Math.ceil(visual - maxDistance)), Math.floor(visual + maxDistance));
|
|
23318
|
-
});
|
|
23319
|
-
}, [changeLayeredIndex, count, isSlideTransition, moveTrack, setMoving]);
|
|
23320
23234
|
|
|
23321
|
-
|
|
23235
|
+
setSkipTransition(false);
|
|
23236
|
+
setTrackPosition(position);
|
|
23237
|
+
}, [activeIndex, count, hasClones, isSlideTransition, setMoving]);
|
|
23238
|
+
|
|
23239
|
+
const goBy = useCallback((step: 1 | -1) => {
|
|
23322
23240
|
goBySteps(step);
|
|
23323
23241
|
}, [goBySteps]);
|
|
23324
23242
|
|
|
@@ -23328,37 +23246,58 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
|
|
|
23328
23246
|
if (target === activeIndex && !isMovingRef.current) return;
|
|
23329
23247
|
setAnimateDots(true);
|
|
23330
23248
|
setMoving(true);
|
|
23331
|
-
|
|
23332
|
-
|
|
23333
|
-
|
|
23249
|
+
setActiveIndex(target);
|
|
23250
|
+
if (isSlideTransition) {
|
|
23251
|
+
const position = target + (hasClones ? 1 : 0);
|
|
23252
|
+
pendingAnimatedPositionRef.current = null;
|
|
23253
|
+
pendingStepsRef.current = 0;
|
|
23254
|
+
trackPositionRef.current = position;
|
|
23255
|
+
setSkipTransition(false);
|
|
23256
|
+
setTrackPosition(position);
|
|
23334
23257
|
}
|
|
23335
|
-
|
|
23336
|
-
}, [activeIndex, changeLayeredIndex, count, isSlideTransition, moveTrack, setMoving]);
|
|
23258
|
+
}, [activeIndex, count, hasClones, isSlideTransition, setMoving]);
|
|
23337
23259
|
|
|
23338
23260
|
useEffect(() => {
|
|
23339
23261
|
if (!isMoving) return;
|
|
23340
23262
|
const timeoutId = window.setTimeout(() => {
|
|
23263
|
+
if (hasClones && (trackPosition === 0 || trackPosition === count + 1)) {
|
|
23264
|
+
pendingAnimatedPositionRef.current = null;
|
|
23265
|
+
setSkipTransition(true);
|
|
23266
|
+
setTrackPosition(activeIndex + 1);
|
|
23267
|
+
return;
|
|
23268
|
+
}
|
|
23341
23269
|
setMoving(false);
|
|
23342
|
-
|
|
23343
|
-
const shift = getMiddleCopyShift(trackPosition, count);
|
|
23344
|
-
if (shift === 0) return;
|
|
23345
|
-
setSkipTransition(true);
|
|
23346
|
-
setTrackPosition(trackPosition - shift);
|
|
23347
|
-
}, transitionDurationMs);
|
|
23270
|
+
}, TRANSITION_DURATION_MS);
|
|
23348
23271
|
return () => window.clearTimeout(timeoutId);
|
|
23349
|
-
}, [count, hasClones, isMoving, setMoving, trackPosition
|
|
23272
|
+
}, [activeIndex, count, hasClones, isMoving, setMoving, trackPosition]);
|
|
23350
23273
|
|
|
23351
23274
|
useEffect(() => {
|
|
23352
23275
|
if (!skipTransition) return;
|
|
23353
23276
|
let innerId = 0;
|
|
23354
23277
|
const outerId = requestAnimationFrame(() => {
|
|
23355
|
-
innerId = requestAnimationFrame(() =>
|
|
23278
|
+
innerId = requestAnimationFrame(() => {
|
|
23279
|
+
const pendingPosition = pendingAnimatedPositionRef.current;
|
|
23280
|
+
pendingAnimatedPositionRef.current = null;
|
|
23281
|
+
const pendingSteps = pendingStepsRef.current;
|
|
23282
|
+
pendingStepsRef.current = 0;
|
|
23283
|
+
setSkipTransition(false);
|
|
23284
|
+
if (pendingPosition !== null) {
|
|
23285
|
+
trackPositionRef.current = pendingPosition;
|
|
23286
|
+
setTrackPosition(pendingPosition);
|
|
23287
|
+
return;
|
|
23288
|
+
}
|
|
23289
|
+
if (pendingSteps !== 0) {
|
|
23290
|
+
goBySteps(pendingSteps);
|
|
23291
|
+
return;
|
|
23292
|
+
}
|
|
23293
|
+
setMoving(false);
|
|
23294
|
+
});
|
|
23356
23295
|
});
|
|
23357
23296
|
return () => {
|
|
23358
23297
|
cancelAnimationFrame(outerId);
|
|
23359
23298
|
cancelAnimationFrame(innerId);
|
|
23360
23299
|
};
|
|
23361
|
-
}, [skipTransition]);
|
|
23300
|
+
}, [goBySteps, setMoving, skipTransition]);
|
|
23362
23301
|
|
|
23363
23302
|
const structureKey = \`\${hasClones}:\${count}\`;
|
|
23364
23303
|
const prevStructureKeyRef = useRef(structureKey);
|
|
@@ -23372,7 +23311,7 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
|
|
|
23372
23311
|
setDragOffset(0);
|
|
23373
23312
|
setActiveIndex(nextIndex);
|
|
23374
23313
|
setSkipTransition(true);
|
|
23375
|
-
setTrackPosition(nextIndex + (hasClones ?
|
|
23314
|
+
setTrackPosition(nextIndex + (hasClones ? 1 : 0));
|
|
23376
23315
|
}, [activeIndex, count, hasClones, structureKey]);
|
|
23377
23316
|
|
|
23378
23317
|
useEffect(() => {
|
|
@@ -23451,23 +23390,31 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
|
|
|
23451
23390
|
if (!isDragTrigger || count < 2 || !track) return;
|
|
23452
23391
|
if (event.pointerType === 'mouse' && event.button !== 0) return;
|
|
23453
23392
|
|
|
23393
|
+
pendingAnimatedPositionRef.current = null;
|
|
23394
|
+
pendingStepsRef.current = 0;
|
|
23395
|
+
|
|
23454
23396
|
if (isMovingRef.current) {
|
|
23455
23397
|
setMoving(false);
|
|
23456
23398
|
}
|
|
23457
23399
|
|
|
23458
|
-
// Freeze the track where it is on screen and drag from there.
|
|
23459
23400
|
let baseOffset = 0;
|
|
23460
23401
|
const list = listRef.current;
|
|
23461
23402
|
if (isSlideTransition && list) {
|
|
23462
|
-
const size =
|
|
23403
|
+
const size = isHorizontal ? list.offsetWidth : list.offsetHeight;
|
|
23463
23404
|
if (size > 0) {
|
|
23464
|
-
const
|
|
23465
|
-
|
|
23466
|
-
const
|
|
23467
|
-
|
|
23468
|
-
|
|
23469
|
-
|
|
23470
|
-
|
|
23405
|
+
const currentPx = readTrackTranslatePx(list, isHorizontal);
|
|
23406
|
+
let syncedPosition = trackPositionRef.current;
|
|
23407
|
+
const isOnClone = hasClones && (syncedPosition === 0 || syncedPosition === count + 1);
|
|
23408
|
+
|
|
23409
|
+
if (isOnClone) {
|
|
23410
|
+
syncedPosition = activeIndex + 1;
|
|
23411
|
+
trackPositionRef.current = syncedPosition;
|
|
23412
|
+
setSkipTransition(true);
|
|
23413
|
+
setTrackPosition(syncedPosition);
|
|
23414
|
+
baseOffset = 0;
|
|
23415
|
+
} else {
|
|
23416
|
+
baseOffset = currentPx + syncedPosition * size;
|
|
23417
|
+
}
|
|
23471
23418
|
setDragOffset(baseOffset);
|
|
23472
23419
|
}
|
|
23473
23420
|
}
|
|
@@ -23533,19 +23480,19 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
|
|
|
23533
23480
|
finishDrag(event);
|
|
23534
23481
|
};
|
|
23535
23482
|
|
|
23536
|
-
const trackTranslate =
|
|
23537
|
-
|
|
23483
|
+
const trackTranslate = isHorizontal
|
|
23484
|
+
? \`translate3d(calc(\${-trackPosition * 100}% + \${dragOffset}px), 0, 0)\`
|
|
23485
|
+
: \`translate3d(0, calc(\${-trackPosition * 100}% + \${dragOffset}px), 0)\`;
|
|
23486
|
+
const slides = hasClones ? [items[count - 1], ...items, items[0]] : items;
|
|
23538
23487
|
|
|
23539
23488
|
return (
|
|
23540
23489
|
<>
|
|
23541
|
-
<style dangerouslySetInnerHTML={{ __html: getCSS(P,
|
|
23490
|
+
<style dangerouslySetInnerHTML={{ __html: getCSS(P, isEditor) }} />
|
|
23542
23491
|
<div
|
|
23543
23492
|
className={cn(\`\${P}-wrapper\`, {
|
|
23544
|
-
[\`\${P}-transition-
|
|
23545
|
-
[\`\${P}-transition-reveal\`]:
|
|
23546
|
-
[\`\${P}-transition-reveal-vertical\`]: isReveal && !isHorizontal,
|
|
23493
|
+
[\`\${P}-transition-reveal\`]: transition === 'reveal',
|
|
23494
|
+
[\`\${P}-transition-reveal-vertical\`]: transition === 'reveal' && !isHorizontal,
|
|
23547
23495
|
})}
|
|
23548
|
-
data-active-index={activeIndex}
|
|
23549
23496
|
onMouseEnter={() => setIsHovered(true)}
|
|
23550
23497
|
onMouseLeave={() => setIsHovered(false)}
|
|
23551
23498
|
>
|
|
@@ -23561,7 +23508,6 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
|
|
|
23561
23508
|
[\`\${P}-track-draggable\`]: isDragTrigger,
|
|
23562
23509
|
[\`\${P}-track-draggable-vertical\`]: isDragTrigger && !isHorizontal,
|
|
23563
23510
|
})}
|
|
23564
|
-
style={trackRadiusStyle}
|
|
23565
23511
|
onPointerDown={handlePointerDown}
|
|
23566
23512
|
onPointerMove={handlePointerMove}
|
|
23567
23513
|
onPointerUp={handlePointerUp}
|
|
@@ -23584,29 +23530,38 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
|
|
|
23584
23530
|
transform: trackTranslate,
|
|
23585
23531
|
transition: isDragging || skipTransition
|
|
23586
23532
|
? 'none'
|
|
23587
|
-
: \`transform \${
|
|
23533
|
+
: \`transform \${TRANSITION_DURATION_MS}ms \${TRANSITION_EASING}\`,
|
|
23588
23534
|
}
|
|
23589
23535
|
: undefined}
|
|
23590
23536
|
>
|
|
23591
23537
|
{slides.map((item, slideIndex) => {
|
|
23592
|
-
const itemIndex = wrapIndex(slideIndex, count);
|
|
23593
|
-
const
|
|
23538
|
+
const itemIndex = hasClones ? wrapIndex(slideIndex - 1, count) : slideIndex;
|
|
23539
|
+
const isClone = hasClones && (slideIndex === 0 || slideIndex === count + 1);
|
|
23540
|
+
const key = isClone
|
|
23541
|
+
? \`clone-\${slideIndex === 0 ? 'start' : 'end'}\`
|
|
23542
|
+
: \`slide-\${itemIndex}\`;
|
|
23594
23543
|
return (
|
|
23595
|
-
<div
|
|
23596
|
-
{
|
|
23544
|
+
<div
|
|
23545
|
+
key={key}
|
|
23546
|
+
className={cn(\`\${P}-slide\`, {
|
|
23547
|
+
[\`\${P}-is-active\`]: !isSlideTransition && itemIndex === activeIndex,
|
|
23548
|
+
})}
|
|
23549
|
+
>
|
|
23550
|
+
<div className={\`\${P}-slider-item\`}>
|
|
23551
|
+
<div className={\`\${P}-img-wrapper\`}>
|
|
23552
|
+
<img
|
|
23553
|
+
className={cn(\`\${P}-slider-image\`, {
|
|
23554
|
+
[\`\${P}-contain\`]: item.image.objectFit === 'contain',
|
|
23555
|
+
[\`\${P}-cover\`]: item.image.objectFit === 'cover'
|
|
23556
|
+
})}
|
|
23557
|
+
src={item.image.assetId} alt={item.image.name ?? ''}
|
|
23558
|
+
draggable={false}
|
|
23559
|
+
/>
|
|
23560
|
+
</div>
|
|
23561
|
+
</div>
|
|
23597
23562
|
</div>
|
|
23598
23563
|
);
|
|
23599
23564
|
})}
|
|
23600
|
-
{isLayered && transitionLayers.map((layer, layerPosition) => (
|
|
23601
|
-
<div
|
|
23602
|
-
key={\`layer-\${layer.key}\`}
|
|
23603
|
-
className={cn(\`\${P}-slide\`, \`\${P}-is-layer\`, { [\`\${P}-is-animated\`]: layer.isAnimated })}
|
|
23604
|
-
style={{ zIndex: layerPosition + 1 }}
|
|
23605
|
-
onAnimationEnd={() => handleLayerEnd(layer.key)}
|
|
23606
|
-
>
|
|
23607
|
-
{renderSlideItem(items[layer.index])}
|
|
23608
|
-
</div>
|
|
23609
|
-
))}
|
|
23610
23565
|
</div>
|
|
23611
23566
|
{isClickTrigger && (
|
|
23612
23567
|
<div
|
|
@@ -23778,7 +23733,7 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
|
|
|
23778
23733
|
style={{
|
|
23779
23734
|
...titleStyle,
|
|
23780
23735
|
width: TITLE_WIDTH_SETTINGS.sizing === 'auto' ? 'max-content' : scalingValue(TITLE_WIDTH_SETTINGS.width, isEditor),
|
|
23781
|
-
transitionDuration: \`\${Math.round(
|
|
23736
|
+
transitionDuration: \`\${Math.round(TRANSITION_DURATION_MS / 2)}ms\`,
|
|
23782
23737
|
}}
|
|
23783
23738
|
>
|
|
23784
23739
|
<div
|
|
@@ -25472,4 +25427,4 @@ export function Waterfall({
|
|
|
25472
25427
|
</>
|
|
25473
25428
|
);
|
|
25474
25429
|
}
|
|
25475
|
-
`,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]:
|
|
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;
|