@cntrl-site/components 1.0.120-alpha.1 → 1.0.120

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/sources.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./ChroniclesComponent-CdhGfFOq.js"),e=`import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./ChroniclesComponent-5ZbqHNpi.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';
@@ -22662,7 +22662,7 @@ type Slider20Props = {
22662
22662
  } & CommonComponentProps;
22663
22663
 
22664
22664
  type Offset = { x: number; y: number };
22665
- type TransitionLayer = { index: number; key: number };
22665
+ type TransitionLayer = { index: number; key: number; isAnimated: boolean };
22666
22666
  type Point = { x: number; y: number };
22667
22667
  type LocalAxes = { ex: Point; ey: Point; det: number };
22668
22668
 
@@ -23103,13 +23103,13 @@ function getCSS(P: string, transitionDurationMs: number, isEditor?: boolean): st
23103
23103
  cursor: pointer;
23104
23104
  z-index: 2;
23105
23105
  }
23106
- .\${P}-transition-fade .\${P}-slide.\${P}-is-layer .\${P}-slider-image {
23106
+ .\${P}-transition-fade .\${P}-slide.\${P}-is-animated .\${P}-slider-image {
23107
23107
  animation: \${P}-fade-in \${transitionDurationMs}ms \${TRANSITION_EASING};
23108
23108
  }
23109
- .\${P}-transition-reveal .\${P}-slide.\${P}-is-layer .\${P}-slider-image {
23109
+ .\${P}-transition-reveal .\${P}-slide.\${P}-is-animated .\${P}-slider-image {
23110
23110
  animation: \${P}-reveal-horizontal \${transitionDurationMs}ms ease;
23111
23111
  }
23112
- .\${P}-transition-reveal-vertical .\${P}-slide.\${P}-is-layer .\${P}-slider-image {
23112
+ .\${P}-transition-reveal-vertical .\${P}-slide.\${P}-is-animated .\${P}-slider-image {
23113
23113
  animation: \${P}-reveal-vertical \${transitionDurationMs}ms ease;
23114
23114
  }
23115
23115
  @keyframes \${P}-fade-in {
@@ -23185,14 +23185,17 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
23185
23185
  const [activeIndex, setActiveIndex] = useState(0);
23186
23186
  // Layers stack bottom to top: each new slide fades or reveals over the ones still animating,
23187
23187
  // which keep their own animation. The same slide can sit in the stack more than once.
23188
- const [transitionLayers, setTransitionLayers] = useState<TransitionLayer[]>([{ index: activeIndex, key: 0 }]);
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
+ ]);
23189
23192
  const topLayer = transitionLayers[transitionLayers.length - 1];
23190
23193
  if (isLayered && topLayer.index !== activeIndex) {
23191
23194
  // Over the limit, drop the oldest layer still animating, never the fully shown bottom one.
23192
23195
  const kept = transitionLayers.length >= MAX_TRANSITION_LAYERS
23193
23196
  ? [transitionLayers[0], ...transitionLayers.slice(2)]
23194
23197
  : transitionLayers;
23195
- setTransitionLayers([...kept, { index: activeIndex, key: topLayer.key + 1 }]);
23198
+ setTransitionLayers([...kept, { index: activeIndex, key: topLayer.key + 1, isAnimated: true }]);
23196
23199
  }
23197
23200
  const handleLayerEnd = (key: number) => {
23198
23201
  // A fully shown layer covers everything under it, so those layers are dropped.
@@ -23227,11 +23230,43 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
23227
23230
  const dragRef = useRef<DragState | null>(null);
23228
23231
  const activePointerIdRef = useRef<number | null>(null);
23229
23232
 
23233
+ const activeIndexRef = useRef(activeIndex);
23234
+ activeIndexRef.current = activeIndex;
23235
+ const revealTargetRef = useRef(activeIndex);
23236
+ const revealTimerRef = useRef<number | null>(null);
23237
+
23230
23238
  const setMoving = useCallback((value: boolean) => {
23231
23239
  isMovingRef.current = value;
23232
23240
  setIsMoving(value);
23233
23241
  }, []);
23234
23242
 
23243
+ // Reveal starts a new layer at most every half transition, so quick clicks never run more
23244
+ // than two reveals at once, evenly spaced. Clicks in between only move the pending target,
23245
+ // which is shown when the next slot opens.
23246
+ const changeLayeredIndex = useCallback((getTarget: (current: number) => number) => {
23247
+ if (!isReveal) {
23248
+ setActiveIndex((prev) => wrapIndex(getTarget(prev), count));
23249
+ return;
23250
+ }
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
+
23266
+ useEffect(() => () => {
23267
+ if (revealTimerRef.current !== null) window.clearTimeout(revealTimerRef.current);
23268
+ }, []);
23269
+
23235
23270
  // Where the track is on screen right now, mid-transition included, in slide units.
23236
23271
  const readVisualPosition = useCallback((): number => {
23237
23272
  const list = listRef.current;
@@ -23270,7 +23305,7 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
23270
23305
  setAnimateDots(true);
23271
23306
  setMoving(true);
23272
23307
  if (!isSlideTransition) {
23273
- setActiveIndex((prev) => wrapIndex(prev + steps, count));
23308
+ changeLayeredIndex((current) => current + steps);
23274
23309
  return;
23275
23310
  }
23276
23311
  moveTrack((visual, shift) => {
@@ -23281,9 +23316,9 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
23281
23316
  const maxDistance = count - 1;
23282
23317
  return Math.min(Math.max(base + steps, Math.ceil(visual - maxDistance)), Math.floor(visual + maxDistance));
23283
23318
  });
23284
- }, [count, isSlideTransition, moveTrack, setMoving]);
23319
+ }, [changeLayeredIndex, count, isSlideTransition, moveTrack, setMoving]);
23285
23320
 
23286
- const goBy = useCallback((step: 1 | -1) => {
23321
+ const goBy =useCallback((step: 1 | -1) => {
23287
23322
  goBySteps(step);
23288
23323
  }, [goBySteps]);
23289
23324
 
@@ -23294,11 +23329,11 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
23294
23329
  setAnimateDots(true);
23295
23330
  setMoving(true);
23296
23331
  if (!isSlideTransition) {
23297
- setActiveIndex(target);
23332
+ changeLayeredIndex(() => target);
23298
23333
  return;
23299
23334
  }
23300
23335
  moveTrack(() => count + target);
23301
- }, [activeIndex, count, isSlideTransition, moveTrack, setMoving]);
23336
+ }, [activeIndex, changeLayeredIndex, count, isSlideTransition, moveTrack, setMoving]);
23302
23337
 
23303
23338
  useEffect(() => {
23304
23339
  if (!isMoving) return;
@@ -23565,7 +23600,7 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
23565
23600
  {isLayered && transitionLayers.map((layer, layerPosition) => (
23566
23601
  <div
23567
23602
  key={\`layer-\${layer.key}\`}
23568
- className={cn(\`\${P}-slide\`, \`\${P}-is-layer\`)}
23603
+ className={cn(\`\${P}-slide\`, \`\${P}-is-layer\`, { [\`\${P}-is-animated\`]: layer.isAnimated })}
23569
23604
  style={{ zIndex: layerPosition + 1 }}
23570
23605
  onAnimationEnd={() => handleLayerEnd(layer.key)}
23571
23606
  >
package/dist/sources.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { W as n, b as e, T as t, g as i, f as o, S as r, P as a, O as s, h as l, a as d, M as c, L as u, d as g, e as m, H as p, i as h, G as f, F as v, c as P, C as x, j as b, B as y } from "./ChroniclesComponent-CQhnb---.mjs";
1
+ import { W as n, b as e, T as t, g as i, f as o, S as r, P as a, O as s, h as l, a as d, M as c, L as u, d as g, e as m, H as p, i as h, G as f, F as v, c as P, C as x, j as b, B as y } from "./ChroniclesComponent-8lhIeord.mjs";
2
2
  const S = `import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
3
3
  import { CommonComponentProps } from '../props';
4
4
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
@@ -22663,7 +22663,7 @@ type Slider20Props = {
22663
22663
  } & CommonComponentProps;
22664
22664
 
22665
22665
  type Offset = { x: number; y: number };
22666
- type TransitionLayer = { index: number; key: number };
22666
+ type TransitionLayer = { index: number; key: number; isAnimated: boolean };
22667
22667
  type Point = { x: number; y: number };
22668
22668
  type LocalAxes = { ex: Point; ey: Point; det: number };
22669
22669
 
@@ -23104,13 +23104,13 @@ function getCSS(P: string, transitionDurationMs: number, isEditor?: boolean): st
23104
23104
  cursor: pointer;
23105
23105
  z-index: 2;
23106
23106
  }
23107
- .\${P}-transition-fade .\${P}-slide.\${P}-is-layer .\${P}-slider-image {
23107
+ .\${P}-transition-fade .\${P}-slide.\${P}-is-animated .\${P}-slider-image {
23108
23108
  animation: \${P}-fade-in \${transitionDurationMs}ms \${TRANSITION_EASING};
23109
23109
  }
23110
- .\${P}-transition-reveal .\${P}-slide.\${P}-is-layer .\${P}-slider-image {
23110
+ .\${P}-transition-reveal .\${P}-slide.\${P}-is-animated .\${P}-slider-image {
23111
23111
  animation: \${P}-reveal-horizontal \${transitionDurationMs}ms ease;
23112
23112
  }
23113
- .\${P}-transition-reveal-vertical .\${P}-slide.\${P}-is-layer .\${P}-slider-image {
23113
+ .\${P}-transition-reveal-vertical .\${P}-slide.\${P}-is-animated .\${P}-slider-image {
23114
23114
  animation: \${P}-reveal-vertical \${transitionDurationMs}ms ease;
23115
23115
  }
23116
23116
  @keyframes \${P}-fade-in {
@@ -23186,14 +23186,17 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
23186
23186
  const [activeIndex, setActiveIndex] = useState(0);
23187
23187
  // Layers stack bottom to top: each new slide fades or reveals over the ones still animating,
23188
23188
  // which keep their own animation. The same slide can sit in the stack more than once.
23189
- const [transitionLayers, setTransitionLayers] = useState<TransitionLayer[]>([{ index: activeIndex, key: 0 }]);
23189
+ // The first slide is shown as is on load, without a transition.
23190
+ const [transitionLayers, setTransitionLayers] = useState<TransitionLayer[]>([
23191
+ { index: activeIndex, key: 0, isAnimated: false },
23192
+ ]);
23190
23193
  const topLayer = transitionLayers[transitionLayers.length - 1];
23191
23194
  if (isLayered && topLayer.index !== activeIndex) {
23192
23195
  // Over the limit, drop the oldest layer still animating, never the fully shown bottom one.
23193
23196
  const kept = transitionLayers.length >= MAX_TRANSITION_LAYERS
23194
23197
  ? [transitionLayers[0], ...transitionLayers.slice(2)]
23195
23198
  : transitionLayers;
23196
- setTransitionLayers([...kept, { index: activeIndex, key: topLayer.key + 1 }]);
23199
+ setTransitionLayers([...kept, { index: activeIndex, key: topLayer.key + 1, isAnimated: true }]);
23197
23200
  }
23198
23201
  const handleLayerEnd = (key: number) => {
23199
23202
  // A fully shown layer covers everything under it, so those layers are dropped.
@@ -23228,11 +23231,43 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
23228
23231
  const dragRef = useRef<DragState | null>(null);
23229
23232
  const activePointerIdRef = useRef<number | null>(null);
23230
23233
 
23234
+ const activeIndexRef = useRef(activeIndex);
23235
+ activeIndexRef.current = activeIndex;
23236
+ const revealTargetRef = useRef(activeIndex);
23237
+ const revealTimerRef = useRef<number | null>(null);
23238
+
23231
23239
  const setMoving = useCallback((value: boolean) => {
23232
23240
  isMovingRef.current = value;
23233
23241
  setIsMoving(value);
23234
23242
  }, []);
23235
23243
 
23244
+ // Reveal starts a new layer at most every half transition, so quick clicks never run more
23245
+ // than two reveals at once, evenly spaced. Clicks in between only move the pending target,
23246
+ // which is shown when the next slot opens.
23247
+ const changeLayeredIndex = useCallback((getTarget: (current: number) => number) => {
23248
+ if (!isReveal) {
23249
+ setActiveIndex((prev) => wrapIndex(getTarget(prev), count));
23250
+ return;
23251
+ }
23252
+ const isWaiting = revealTimerRef.current !== null;
23253
+ const base = isWaiting ? revealTargetRef.current : activeIndexRef.current;
23254
+ revealTargetRef.current = wrapIndex(getTarget(base), count);
23255
+ if (isWaiting) return;
23256
+ const startReveal = (index: number) => {
23257
+ activeIndexRef.current = index;
23258
+ setActiveIndex(index);
23259
+ revealTimerRef.current = window.setTimeout(() => {
23260
+ revealTimerRef.current = null;
23261
+ if (revealTargetRef.current !== activeIndexRef.current) startReveal(revealTargetRef.current);
23262
+ }, transitionDurationMs / 2);
23263
+ };
23264
+ startReveal(revealTargetRef.current);
23265
+ }, [count, isReveal, transitionDurationMs]);
23266
+
23267
+ useEffect(() => () => {
23268
+ if (revealTimerRef.current !== null) window.clearTimeout(revealTimerRef.current);
23269
+ }, []);
23270
+
23236
23271
  // Where the track is on screen right now, mid-transition included, in slide units.
23237
23272
  const readVisualPosition = useCallback((): number => {
23238
23273
  const list = listRef.current;
@@ -23271,7 +23306,7 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
23271
23306
  setAnimateDots(true);
23272
23307
  setMoving(true);
23273
23308
  if (!isSlideTransition) {
23274
- setActiveIndex((prev) => wrapIndex(prev + steps, count));
23309
+ changeLayeredIndex((current) => current + steps);
23275
23310
  return;
23276
23311
  }
23277
23312
  moveTrack((visual, shift) => {
@@ -23282,9 +23317,9 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
23282
23317
  const maxDistance = count - 1;
23283
23318
  return Math.min(Math.max(base + steps, Math.ceil(visual - maxDistance)), Math.floor(visual + maxDistance));
23284
23319
  });
23285
- }, [count, isSlideTransition, moveTrack, setMoving]);
23320
+ }, [changeLayeredIndex, count, isSlideTransition, moveTrack, setMoving]);
23286
23321
 
23287
- const goBy = useCallback((step: 1 | -1) => {
23322
+ const goBy =useCallback((step: 1 | -1) => {
23288
23323
  goBySteps(step);
23289
23324
  }, [goBySteps]);
23290
23325
 
@@ -23295,11 +23330,11 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
23295
23330
  setAnimateDots(true);
23296
23331
  setMoving(true);
23297
23332
  if (!isSlideTransition) {
23298
- setActiveIndex(target);
23333
+ changeLayeredIndex(() => target);
23299
23334
  return;
23300
23335
  }
23301
23336
  moveTrack(() => count + target);
23302
- }, [activeIndex, count, isSlideTransition, moveTrack, setMoving]);
23337
+ }, [activeIndex, changeLayeredIndex, count, isSlideTransition, moveTrack, setMoving]);
23303
23338
 
23304
23339
  useEffect(() => {
23305
23340
  if (!isMoving) return;
@@ -23566,7 +23601,7 @@ export function Slider20({ settings, content, isEditor, isPreviewMode, isEditMod
23566
23601
  {isLayered && transitionLayers.map((layer, layerPosition) => (
23567
23602
  <div
23568
23603
  key={\`layer-\${layer.key}\`}
23569
- className={cn(\`\${P}-slide\`, \`\${P}-is-layer\`)}
23604
+ className={cn(\`\${P}-slide\`, \`\${P}-is-layer\`, { [\`\${P}-is-animated\`]: layer.isAnimated })}
23570
23605
  style={{ zIndex: layerPosition + 1 }}
23571
23606
  onAnimationEnd={() => handleLayerEnd(layer.key)}
23572
23607
  >
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/components",
3
- "version": "1.0.120-alpha.1",
3
+ "version": "1.0.120",
4
4
  "description": "Custom components for control editor and public websites.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -1,273 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),c=require("react"),w=require("classnames"),st=require("./RichTextRenderer-DEFXh5o6.js"),y=require("./scalingValue-CSHYgTZl.js"),Fe=require("./SvgImage-DFlmxAoL.js"),dt=require("./textStylesToCss-CNN3zZTV.js"),ut=require("./useScopedStyles-Bf6yohVQ.js"),pt=500,ft=1,ve="cubic-bezier(0.25, 1, 0.5, 1)",ht=300,mt=40,vt=5,$t=.15,yt=.4,xt=100,z=100,Ve={color:"#000000",hover:"#cccccc"},W={offset:{x:0,y:0},colors:{pagination:"#cccccc",inactive:"#cccccc",background:"#000000"}},wt={s:{paddingY:5,paddingActive:5,borderRadius:9,dot:4,activeDot:8,gapInactive:9,inset:5},m:{paddingY:7,paddingActive:7,borderRadius:17,dot:8,activeDot:20,gapInactive:22,inset:7},l:{paddingY:10,paddingActive:10,borderRadius:29,dot:20,activeDot:38,gapInactive:26,inset:10}},fe={offset:{x:0,y:0},linkColor:"#cccccc"},Ye={sizeType:"drag",value:3},bt="left";function St(e,i){var b,$;const a={fontSettings:{fontFamily:(e==null?void 0:e.titleFontFamily)??"Arial",fontWeight:((b=e==null?void 0:e.titleFontSettings)==null?void 0:b.fontWeight)??400,fontStyle:(($=e==null?void 0:e.titleFontSettings)==null?void 0:$.fontStyle)??"normal"},fontSize:(e==null?void 0:e.titleFontSize)??.02,lineHeight:(e==null?void 0:e.titleLineHeight)??.02,letterSpacing:(e==null?void 0:e.titleLetterSpacing)??0,wordSpacing:(e==null?void 0:e.titleWordSpacing)??0,textAppearance:e==null?void 0:e.titleTextAppearance,textAlign:bt,color:(e==null?void 0:e.titleColor)??"#000000"};return dt.textStylesToCss(a,i)}function _(e,i,a){return`${e}: ${y.scalingValue(i/1440,a)};`}function re(e,i){return i<=0?0:(e%i+i)%i}const gt=3;function he(e,i,a){return a?`translate3d(calc(${-e*100}% + ${i}px), 0, 0)`:`translate3d(0, calc(${-e*100}% + ${i}px), 0)`}function me(e,i){return(Math.floor(e/i)-1)*i}function Xe(e,i){const a=window.getComputedStyle(e);return parseFloat(i?a.width:a.height)||0}function It(e,i){const a=new DOMMatrixReadOnly(window.getComputedStyle(e).transform);return i?a.m41:a.m42}function Ct(e,i){const a=document.createElement("div");a.className=i,a.setAttribute("aria-hidden","true"),e.appendChild(a);const b=(O,q)=>{a.style.transform=`translate(${O}px, ${q}px)`;const F=a.getBoundingClientRect();return{x:F.left,y:F.top}},$=b(0,0),r=b(z,0),E=b(0,z);e.removeChild(a);const g={x:(r.x-$.x)/z,y:(r.y-$.y)/z},l={x:(E.x-$.x)/z,y:(E.y-$.y)/z},G=g.x*l.y-l.x*g.y;return{ex:g,ey:l,det:G}}function kt(e,i,a){const{ex:b,ey:$,det:r}=e;return{x:(i*$.y-a*$.x)/r,y:(b.x*a-b.y*i)/r}}function Tt(e){const i=Math.min(Math.max(e,0),2);return Math.round(pt*Math.pow(4,1-i))}function At(e,i,a){return`
2
- .${e}-wrapper {
3
- position: relative;
4
- width: 100%;
5
- height: 100%;
6
- overflow: visible;
7
- }
8
- .${e}-wrapper:hover .${e}-hover-arrow {
9
- opacity: 1 !important;
10
- }
11
- .${e}-slider-inner {
12
- position: relative;
13
- width: 100%;
14
- height: 100%;
15
- }
16
- .${e}-track {
17
- position: absolute;
18
- top: 0;
19
- left: 0;
20
- width: 100%;
21
- height: 100%;
22
- overflow: hidden;
23
- }
24
- .${e}-axis-probe {
25
- position: absolute;
26
- top: 0;
27
- left: 0;
28
- width: 0;
29
- height: 0;
30
- pointer-events: none;
31
- visibility: hidden;
32
- }
33
- .${e}-track-draggable {
34
- touch-action: pan-y;
35
- }
36
- .${e}-track-draggable-vertical {
37
- touch-action: pan-x;
38
- }
39
- .${e}-track-draggable .${e}-list {
40
- user-select: none;
41
- -webkit-user-select: none;
42
- }
43
- .${e}-track-draggable .${e}-slider-image {
44
- -webkit-user-drag: none;
45
- }
46
- .${e}-list {
47
- position: relative;
48
- width: 100%;
49
- height: 100%;
50
- }
51
- .${e}-list-slide {
52
- display: flex;
53
- flex-direction: row;
54
- will-change: transform;
55
- }
56
- .${e}-list-slide-vertical {
57
- flex-direction: column;
58
- }
59
- .${e}-list-fade {
60
- display: block;
61
- /* Keeps the transition layers' z-index below the arrows, dots and click overlay. */
62
- isolation: isolate;
63
- }
64
- .${e}-slide {
65
- position: relative;
66
- flex: 0 0 100%;
67
- width: 100%;
68
- height: 100%;
69
- }
70
- .${e}-list-fade .${e}-slide {
71
- position: absolute;
72
- top: 0;
73
- left: 0;
74
- opacity: 0;
75
- }
76
- .${e}-list-fade .${e}-slide.${e}-is-layer {
77
- opacity: 1;
78
- }
79
- .${e}-slider-item {
80
- width: 100%;
81
- height: 100%;
82
- display: flex;
83
- position: relative;
84
- }
85
- .${e}-slider-image {
86
- width: 100%;
87
- height: 100%;
88
- object-fit: cover;
89
- }
90
- .${e}-arrow {
91
- position: absolute;
92
- display: flex;
93
- align-items: center;
94
- justify-content: center;
95
- border: none;
96
- background-color: transparent;
97
- top: 50%;
98
- z-index: 3;
99
- padding: 0;
100
- ${_("width",30,a)}
101
- ${_("height",30,a)}
102
- transition: opacity 0.15s ease-in-out;
103
- }
104
- .${e}-arrow-prev {
105
- ${_("left",-20,a)}
106
- transform: translate3d(-50%, -50%, 0);
107
- }
108
- .${e}-arrow-next {
109
- left: unset;
110
- ${_("right",-20,a)}
111
- transform: translate3d(50%, -50%, 0);
112
- }
113
- .${e}-arrow-prev-vertical {
114
- left: 50%;
115
- ${_("top",-20,a)}
116
- transform: translate3d(-50%, -50%, 0);
117
- }
118
- .${e}-arrow-next-vertical {
119
- left: 50%;
120
- right: unset;
121
- top: unset;
122
- ${_("bottom",-20,a)}
123
- transform: translate3d(-50%, 50%, 0);
124
- }
125
- .${e}-arrow-hidden {
126
- opacity: 0;
127
- pointer-events: none;
128
- }
129
- .${e}-hover-arrow {
130
- opacity: 0;
131
- transition: opacity 0.15s ease-in-out;
132
- }
133
- .${e}-hover-arrow:hover {
134
- opacity: 1;
135
- }
136
- .${e}-arrow-inner {
137
- all: unset;
138
- cursor: pointer;
139
- width: 100%;
140
- height: 100%;
141
- }
142
- .${e}-arrow-inner:hover .${e}-arrow-icon path {
143
- fill: var(--arrow-hover-color) !important;
144
- }
145
- .${e}-arrow-img {
146
- position: absolute;
147
- top: 50%;
148
- left: 50%;
149
- transform: translate(-50%, -50%);
150
- }
151
- .${e}-arrow-icon {
152
- width: 100%;
153
- height: 100%;
154
- overflow: visible;
155
- }
156
- .${e}-arrow-icon path {
157
- transition: fill 0.15s ease-in-out;
158
- }
159
- .${e}-mirror {
160
- transform: translate(-50%, -50%) scaleX(-1) !important;
161
- }
162
- .${e}-pagination {
163
- position: absolute;
164
- z-index: 3;
165
- border-radius: 50%;
166
- }
167
- .${e}-pagination-inner {
168
- display: flex;
169
- align-items: center;
170
- box-sizing: border-box;
171
- }
172
- .${e}-pagination-vertical {
173
- flex-direction: column;
174
- }
175
- .${e}-pagination-item {
176
- all: unset;
177
- flex-shrink: 0;
178
- position: relative;
179
- display: flex;
180
- align-items: center;
181
- justify-content: center;
182
- cursor: pointer;
183
- aspect-ratio: 1;
184
- height: auto;
185
- }
186
- .${e}-dot {
187
- border-radius: 50%;
188
- aspect-ratio: 1;
189
- height: auto;
190
- transition: background-color 0.3s ease-in-out;
191
- }
192
- .${e}-animate-dots .${e}-dot {
193
- transition: background-color 0.3s ease-in-out, width 0.3s ease-in-out;
194
- }
195
- .${e}-pagination-inside-bottom {
196
- left: 50%;
197
- transform: translate3d(-50%, 0, 0);
198
- }
199
- .${e}-pagination-inside-left {
200
- top: 50%;
201
- transform: translate3d(0, -50%, 0);
202
- }
203
- .${e}-img-wrapper {
204
- width: 100%;
205
- height: 100%;
206
- }
207
- .${e}-control {
208
- position: relative;
209
- z-index: 2;
210
- width: 100%;
211
- }
212
- .${e}-caption-block {
213
- pointer-events: none;
214
- position: absolute;
215
- top: 100%;
216
- left: 0;
217
- right: 0;
218
- z-index: 1;
219
- }
220
- .${e}-caption-text-wrapper {
221
- position: relative;
222
- width: 100%;
223
- }
224
- .${e}-caption-text {
225
- pointer-events: none;
226
- max-width: 100%;
227
- transition-property: opacity;
228
- transition-timing-function: ease-in-out;
229
- position: absolute;
230
- top: 0;
231
- left: 0;
232
- display: inline-block;
233
- white-space: pre-wrap;
234
- overflow-wrap: break-word;
235
- opacity: 0;
236
- }
237
- .${e}-caption-text.${e}-active {
238
- opacity: 1;
239
- }
240
- .${e}-with-pointer-events {
241
- pointer-events: auto;
242
- }
243
- .${e}-click-overlay {
244
- position: absolute;
245
- top: 0;
246
- left: 0;
247
- width: 100%;
248
- height: 100%;
249
- cursor: pointer;
250
- z-index: 2;
251
- }
252
- .${e}-transition-fade .${e}-slide.${e}-is-layer .${e}-slider-image {
253
- animation: ${e}-fade-in ${i}ms ${ve};
254
- }
255
- .${e}-transition-reveal .${e}-slide.${e}-is-layer .${e}-slider-image {
256
- animation: ${e}-reveal-horizontal ${i}ms ease;
257
- }
258
- .${e}-transition-reveal-vertical .${e}-slide.${e}-is-layer .${e}-slider-image {
259
- animation: ${e}-reveal-vertical ${i}ms ease;
260
- }
261
- @keyframes ${e}-fade-in {
262
- from { opacity: 0; }
263
- to { opacity: 1; }
264
- }
265
- @keyframes ${e}-reveal-horizontal {
266
- from { clip-path: inset(0 100% 0 0); }
267
- to { clip-path: inset(0 0 0 0); }
268
- }
269
- @keyframes ${e}-reveal-vertical {
270
- from { clip-path: inset(100% 0 0 0); }
271
- to { clip-path: inset(0 0 0 0); }
272
- }
273
- `}function Mt({settings:e,content:i,isEditor:a,isPreviewMode:b,isEditMode:$}){const{prefix:r}=ut.useScopedStyles(),E=St(e,a),g=i??[],l=g.length,G=(e==null?void 0:e.trigger)??Ye,O=G.sizeType??"drag",q=G.value??Ye.value,F=(e==null?void 0:e.direction)??"horizontal",ae=(e==null?void 0:e.transition)??"slide",We=typeof(e==null?void 0:e.transitionSpeed)=="number"?e.transitionSpeed:ft,k=Tt(We),Ee=(e==null?void 0:e.nav)??"classic",$e=(e==null?void 0:e.navSize)??"m",u=wt[$e],Ge=typeof(e==null?void 0:e.navUnit)=="number"?e.navUnit:1/1440,m=t=>y.scalingValue(t*Ge,a),ye=(e==null?void 0:e.show)??"always",N=(e==null?void 0:e.controls)??null,xe=typeof(e==null?void 0:e.controlsMaxWidth)=="number"?e.controlsMaxWidth:65/1440,we=typeof(e==null?void 0:e.paddingX)=="number"?e.paddingX:0,be=typeof(e==null?void 0:e.paddingY)=="number"?e.paddingY:0,j=(e==null?void 0:e.controlsColor)??Ve.color,B=(e==null?void 0:e.controlsHoverColor)??Ve.hover,qe=(e==null?void 0:e.navColor)??W.colors.inactive,Be=(e==null?void 0:e.navPaginationColor)??W.colors.pagination,Ue=(e==null?void 0:e.navBackgroundColor)??W.colors.background,Se=(e==null?void 0:e.linkColor)??fe.linkColor,Ke=typeof(e==null?void 0:e.captionMarginTop)=="number"?e.captionMarginTop:0,ge=typeof(e==null?void 0:e.imageCorners)=="number"?e.imageCorners:0,Ze=ge>0?{borderRadius:y.scalingValue(ge,a),isolation:"isolate"}:void 0,s=F==="horizontal",Je=O==="click",ne=O==="drag",Ie=O==="auto"&&(!a||!!b),Ce=!a,v=ae==="slide",ke=ae==="reveal",Te=!v,Qe=Ee==="classic",Pe=ye!=="never"&&xe>0,Ae=ye==="on hover",ie=y.scalingValue(xe,a),U={width:ie,height:ie,maxWidth:ie},I=v&&l>1,[x,K]=c.useState(0),[T,Me]=c.useState([{index:x,key:0}]),Re=T[T.length-1];if(Te&&Re.index!==x){const t=T.length>=mt?[T[0],...T.slice(2)]:T;Me([...t,{index:x,key:Re.key+1}])}const et=t=>{Me(o=>{const d=o.findIndex(p=>p.key===t);return d>0?o.slice(d):o})},Ne=t=>t&&n.jsx("div",{className:`${r}-slider-item`,children:n.jsx("div",{className:`${r}-img-wrapper`,children:n.jsx("img",{className:`${r}-slider-image`,src:t.image.assetId,alt:t.image.name??"",draggable:!1})})}),[L,Z]=c.useState(I?l:0),[je,tt]=c.useState(!1),[le,V]=c.useState(!1),[ot,ce]=c.useState(!1),[rt,A]=c.useState(0),[se,de]=c.useState(!1),[Le,De]=c.useState(!1),ue=c.useRef(!1),Y=c.useRef(L);Y.current=L;const J=c.useRef(null),Q=c.useRef(null),D=c.useRef(null),M=c.useRef(null),R=c.useCallback(t=>{ue.current=t,tt(t)},[]),pe=c.useCallback(()=>{const t=Q.current,o=t?Xe(t,s):0;return!t||o<=0?Y.current:Math.round(-It(t,s)/o*1e3)/1e3},[s]),P=c.useCallback(t=>{const o=pe(),d=me(o,l),p=t(o-d,d),f=Q.current;if(d!==0&&f){const h=f.style.transition;f.style.transition="none",f.style.transform=he(o-d,0,s),f.offsetWidth,f.style.transition=h&&h!=="none"?h:`transform ${k}ms ${ve}`,f.style.transform=he(p,0,s)}Y.current=p,K(re(p,l)),V(!1),Z(p)},[l,s,pe,k]),ee=c.useCallback(t=>{if(!(l<2||t===0)){if(de(!0),R(!0),!v){K(o=>re(o+t,l));return}P((o,d)=>{const p=Y.current-d,f=Math.abs(p-o)<l?p:Math.round(o),h=l-1;return Math.min(Math.max(f+t,Math.ceil(o-h)),Math.floor(o+h))})}},[l,v,P,R]),X=c.useCallback(t=>{ee(t)},[ee]),at=c.useCallback(t=>{if(l<2)return;const o=re(t,l);if(!(o===x&&!ue.current)){if(de(!0),R(!0),!v){K(o);return}P(()=>l+o)}},[x,l,v,P,R]);c.useEffect(()=>{if(!je)return;const t=window.setTimeout(()=>{if(R(!1),!I)return;const o=me(L,l);o!==0&&(V(!0),Z(L-o))},k);return()=>window.clearTimeout(t)},[l,I,je,R,L,k]),c.useEffect(()=>{if(!le)return;let t=0;const o=requestAnimationFrame(()=>{t=requestAnimationFrame(()=>V(!1))});return()=>{cancelAnimationFrame(o),cancelAnimationFrame(t)}},[le]);const te=`${I}:${l}`,ze=c.useRef(te);c.useEffect(()=>{if(ze.current===te)return;ze.current=te;const t=l>0?Math.min(x,l-1):0;D.current=null,M.current=null,ce(!1),A(0),K(t),V(!0),Z(t+(I?l:0))},[x,l,I,te]),c.useEffect(()=>{if(!se)return;const t=window.setTimeout(()=>de(!1),ht);return()=>window.clearTimeout(t)},[se,x]),c.useEffect(()=>{if(!Ie||l<2)return;const t=Math.max(q,.1)*1e3,o=window.setInterval(()=>{Ce&&Le||X(1)},t);return()=>window.clearInterval(o)},[q,l,X,Ie,Le,Ce]);const H=c.useCallback(t=>{const o=D.current;if(!o||o.pointerId!==t.pointerId)return;D.current=null,M.current=null;const d=J.current;if(d!=null&&d.hasPointerCapture(t.pointerId)&&d.releasePointerCapture(t.pointerId),!o.isActive){v&&A(0);return}const f=!(t.timeStamp-o.lastTime>xt)&&Math.abs(o.velocity)>yt,h=o.size>0&&Math.abs(o.offset-o.baseOffset)>o.size*$t;if(ce(!1),!f&&!h){A(0);return}const C=h?o.offset-o.baseOffset:o.velocity;let S=1;h&&o.size>0&&(S=Math.max(1,Math.round(Math.abs(C)/o.size))),A(0),ee(C<0?S:-S)},[ee,v]);c.useEffect(()=>{const t=o=>{M.current===null||o.pointerId!==M.current||H(o)};return window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[H]);const nt=t=>{const o=J.current;if(!ne||l<2||!o||t.pointerType==="mouse"&&t.button!==0)return;ue.current&&R(!1);let d=0;const p=Q.current;if(v&&p){const f=Xe(p,s);if(f>0){const h=pe(),C=I?h-me(h,l):h,S=Math.round(C);d=(S-C)*f,Y.current=S,V(!0),Z(S),A(d)}}o.setPointerCapture(t.pointerId),M.current=t.pointerId,D.current={pointerId:t.pointerId,startClientX:t.clientX,startClientY:t.clientY,axes:Ct(o,`${r}-axis-probe`),size:s?o.offsetWidth:o.offsetHeight,isActive:!1,baseOffset:d,offset:d,lastTime:t.timeStamp,velocity:0}},it=t=>{const o=D.current;if(!o||o.pointerId!==t.pointerId)return;if(t.pointerType==="mouse"&&t.buttons===0){H(t);return}const d=t.clientX-o.startClientX,p=t.clientY-o.startClientY,f=o.axes?kt(o.axes,d,p):{x:d,y:p},h=s?f.x:f.y,C=s?f.y:f.x,S=o.baseOffset+h;if(!o.isActive){if(Math.max(Math.abs(h),Math.abs(C))<vt)return;if(Math.abs(C)>Math.abs(h)){const oe=J.current;oe!=null&&oe.hasPointerCapture(o.pointerId)&&oe.releasePointerCapture(o.pointerId),D.current=null,M.current=null,v&&A(0);return}o.isActive=!0,ce(!0)}const Oe=t.timeStamp-o.lastTime;Oe>0&&(o.velocity=(S-o.offset)/Oe,o.lastTime=t.timeStamp),o.offset=S,v&&A(S)},_e=t=>{H(t)},lt=he(L,rt,s),ct=I?Array.from({length:gt},()=>g).flat():g;return n.jsxs(n.Fragment,{children:[n.jsx("style",{dangerouslySetInnerHTML:{__html:At(r,k,a)}}),n.jsxs("div",{className:w(`${r}-wrapper`,{[`${r}-transition-fade`]:ae==="fade in",[`${r}-transition-reveal`]:ke,[`${r}-transition-reveal-vertical`]:ke&&!s}),"data-active-index":x,onMouseEnter:()=>De(!0),onMouseLeave:()=>De(!1),children:[n.jsxs("div",{className:`${r}-slider-inner`,style:{backgroundColor:"transparent"},children:[n.jsxs("div",{ref:J,className:w(`${r}-track`,{[`${r}-track-draggable`]:ne,[`${r}-track-draggable-vertical`]:ne&&!s}),style:Ze,onPointerDown:nt,onPointerMove:it,onPointerUp:_e,onPointerCancel:_e,onLostPointerCapture:t=>{M.current===t.pointerId&&H(t)},children:[n.jsxs("div",{ref:Q,className:w(`${r}-list`,{[`${r}-list-slide`]:v,[`${r}-list-slide-vertical`]:v&&!s,[`${r}-list-fade`]:!v}),style:v?{transform:lt,transition:ot||le?"none":`transform ${k}ms ${ve}`}:void 0,children:[ct.map((t,o)=>{const d=re(o,l),p=`slide-${Math.floor(o/l)}-${d}`;return n.jsx("div",{className:`${r}-slide`,children:Ne(t)},p)}),Te&&T.map((t,o)=>n.jsx("div",{className:w(`${r}-slide`,`${r}-is-layer`),style:{zIndex:o+1},onAnimationEnd:()=>et(t.key),children:Ne(g[t.index])},`layer-${t.key}`))]}),Je&&n.jsx("div",{className:`${r}-click-overlay`,onClick:()=>X(1)})]}),Pe&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:w(`${r}-arrow`,{[`${r}-arrow-prev`]:s,[`${r}-arrow-prev-vertical`]:!s,[`${r}-hover-arrow`]:Ae}),style:{color:j,"--arrow-hover-color":B,...U},children:n.jsxs("button",{onClick:t=>{t.stopPropagation(),X(-1)},className:`${r}-arrow-inner`,style:{transform:`translate(${y.scalingValue(we,a)}, ${y.scalingValue(be*(s?1:-1),a)}) rotate(${s?"0deg":"90deg"})`},children:[N&&n.jsx(Fe.SvgImage,{url:N,fill:j,hoverFill:B,className:w(`${r}-arrow-img`,`${r}-mirror`),style:U}),!N&&n.jsx(He,{color:j,className:w(`${r}-arrow-icon`,`${r}-arrow-img`,`${r}-mirror`)})]})}),n.jsx("div",{className:w(`${r}-arrow`,{[`${r}-arrow-next`]:s,[`${r}-arrow-next-vertical`]:!s,[`${r}-hover-arrow`]:Ae}),style:{color:j,"--arrow-hover-color":B,...U},children:n.jsxs("button",{className:`${r}-arrow-inner`,onClick:t=>{t.stopPropagation(),X(1)},style:{transform:`translate(${y.scalingValue(we*(s?-1:1),a)}, ${y.scalingValue(be,a)}) rotate(${s?"0deg":"90deg"})`},children:[N&&n.jsx(Fe.SvgImage,{url:N,fill:j,hoverFill:B,className:`${r}-arrow-img`,style:U}),!N&&n.jsx(He,{color:j,className:w(`${r}-arrow-icon`,`${r}-arrow-img`)})]})})]}),Qe&&n.jsx("div",{className:w(`${r}-pagination`,{[`${r}-pagination-inside-bottom`]:s,[`${r}-pagination-inside-left`]:!s}),style:s?{bottom:m(u.inset)}:{left:m(u.inset)},children:n.jsx("div",{className:w(`${r}-pagination-inner`,{[`${r}-pagination-vertical`]:!s,[`${r}-animate-dots`]:se}),style:{backgroundColor:Ue,gap:m(u.gapInactive-u.activeDot+u.dot),...s?{height:m(u.activeDot+u.paddingY*2),paddingTop:m(u.paddingY),paddingBottom:m(u.paddingY),paddingLeft:m(u.paddingActive),paddingRight:m(u.paddingActive)}:{width:m(u.activeDot+u.paddingY*2),paddingLeft:m(u.paddingY),paddingRight:m(u.paddingY),paddingTop:m(u.paddingActive),paddingBottom:m(u.paddingActive)},borderRadius:m(u.borderRadius),transform:`translate(${y.scalingValue(W.offset.x,a)}, ${y.scalingValue(W.offset.y,a)})`},children:g.map((t,o)=>{const d=o===x,p=d?u.activeDot:u.dot;return n.jsx("button",{onClick:()=>at(o),className:`${r}-pagination-item`,style:{width:m(u.activeDot)},children:n.jsx("div",{className:`${r}-dot`,style:{backgroundColor:d?Be:qe,width:m(p)}})},o)})},`${$e}-${F}`)})]}),n.jsxs("div",{className:`${r}-caption-block`,children:[n.jsx("div",{"data-controls":$?"captionMarginTop":void 0,className:$?`${r}-control`:void 0,style:{height:y.scalingValue(Ke,a)}}),n.jsx("div",{className:`${r}-caption-text-wrapper`,children:g.map((t,o)=>n.jsx("div",{className:w(`${r}-caption-text`,{[`${r}-with-pointer-events`]:o===x&&a,[`${r}-active`]:o===x}),style:{...E,width:"max-content",transitionDuration:`${Math.round(k/2)}ms`},children:n.jsx("div",{className:`${r}-caption-text-inner`,style:{"--link-color":Se,"--link-hover-color":Se,position:"relative",top:y.scalingValue(fe.offset.y,a),left:y.scalingValue(fe.offset.x,a)},children:n.jsx(st.RichTextRenderer,{content:t.imageCaption})})},o))})]})]})]})}function He({color:e,className:i}){return n.jsx("svg",{viewBox:"0 0 10 18",className:i,children:n.jsx("g",{id:"Symbols",stroke:"none",strokeWidth:"1",fillRule:"evenodd",children:n.jsx("path",{d:"M-3.70710678,4.29289322 C-3.34662282,3.93240926 -2.77939176,3.90467972 -2.38710056,4.20970461 L-2.29289322,4.29289322 L5,11.585 L12.2928932,4.29289322 C12.6533772,3.93240926 13.2206082,3.90467972 13.6128994,4.20970461 L13.7071068,4.29289322 C14.0675907,4.65337718 14.0953203,5.22060824 13.7902954,5.61289944 L13.7071068,5.70710678 L5.70710678,13.7071068 C5.34662282,14.0675907 4.77939176,14.0953203 4.38710056,13.7902954 L4.29289322,13.7071068 L-3.70710678,5.70710678 C-4.09763107,5.31658249 -4.09763107,4.68341751 -3.70710678,4.29289322 Z",id:"Shape-Copy",fill:e,transform:"translate(5, 9) rotate(-90) translate(-5, -9)"})})})}exports.Slider20=Mt;