@cntrl-site/components 1.0.103 → 1.0.104
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/Components/helpers/LazyVideo/LazyVideo.d.ts +4 -0
- package/dist/Components/utils/index.d.ts +1 -0
- package/dist/Components/utils/useLazyVideos.d.ts +15 -0
- package/dist/Grid-B2_o1dvz.mjs +1576 -0
- package/dist/Grid-Bq6bk2AQ.js +374 -0
- package/dist/{Helix-2Vr-9WBa.js → Helix-B7rxlvKq.js} +2 -2
- package/dist/{Helix-BmkAKT1G.mjs → Helix-BrKQzGX5.mjs} +53 -53
- package/dist/{Hive-BGMWinrW.mjs → Hive-BusARSOi.mjs} +114 -111
- package/dist/Hive-Dh5nKPGm.js +321 -0
- package/dist/LazyVideo-Cn_vmMq8.js +1 -0
- package/dist/LazyVideo-D8eVYFyw.mjs +15 -0
- package/dist/Marquee-CdtAqhQE.mjs +563 -0
- package/dist/Marquee-DUN8wUax.js +133 -0
- package/dist/{Mercury-DuKJQ1Zo.mjs → Mercury-BRqlbk4i.mjs} +55 -54
- package/dist/Mercury-C-O2VGkK.js +267 -0
- package/dist/{PretextComponent-CGycuNNn.js → PretextComponent-D5P0AjnL.js} +1 -1
- package/dist/{PretextComponent-DN8cyZ8x.mjs → PretextComponent-s4DDfmzY.mjs} +6 -6
- package/dist/{Waterfall-A0FjM2my.mjs → Waterfall-DKuh4bnv.mjs} +299 -295
- package/dist/Waterfall-fdiHR0Rc.js +287 -0
- package/dist/{components-DTCDEBo0.js → components-DzNixU7Q.js} +1 -1
- package/dist/{components-BFJINCME.mjs → components-Yf9Zjska.mjs} +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +6 -6
- 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 +125 -49
- package/dist/sources.mjs +129 -53
- package/dist/useLazyVideos-BbgdvELi.js +1 -0
- package/dist/useLazyVideos-CZLyNolX.mjs +72 -0
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +14 -12
- package/package.json +5 -3
- package/dist/Grid-CemGhf3F.js +0 -374
- package/dist/Grid-cfQsXW3b.mjs +0 -1553
- package/dist/Hive-BC6zQBsv.js +0 -321
- package/dist/Marquee-BYClHHws.mjs +0 -551
- package/dist/Marquee-vmHaTGIP.js +0 -133
- package/dist/Mercury-BwF_XW2w.js +0 -267
- package/dist/Waterfall-DnPDHbCL.js +0 -287
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react/jsx-runtime"),i=require("react"),P=require("classnames"),Re=require("./scalingValue-CSHYgTZl.js"),qe=require("./useScopedStyles-Bf6yohVQ.js"),_=require("./useLazyVideos-BbgdvELi.js");function Ce(e,n){const r=n>0?`${n}px`:"0px";return`
|
|
2
|
+
.${e}-marquee-wrapper {
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: auto;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@keyframes ${e}-marquee-left {
|
|
9
|
+
from { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }
|
|
10
|
+
to { -webkit-transform: translate3d(-${r}, 0, 0); transform: translate3d(-${r}, 0, 0); }
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@keyframes ${e}-marquee-right {
|
|
14
|
+
from { -webkit-transform: translate3d(-${r}, 0, 0); transform: translate3d(-${r}, 0, 0); }
|
|
15
|
+
to { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.${e}-marquee-track {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: row;
|
|
21
|
+
width: max-content;
|
|
22
|
+
will-change: transform;
|
|
23
|
+
backface-visibility: hidden;
|
|
24
|
+
-webkit-backface-visibility: hidden;
|
|
25
|
+
flex-wrap: nowrap;
|
|
26
|
+
-webkit-animation-timing-function: linear;
|
|
27
|
+
animation-timing-function: linear;
|
|
28
|
+
-webkit-animation-iteration-count: infinite;
|
|
29
|
+
animation-iteration-count: infinite;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.${e}-marquee-track[data-direction="left"] {
|
|
33
|
+
-webkit-animation-name: ${e}-marquee-left;
|
|
34
|
+
animation-name: ${e}-marquee-left;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.${e}-marquee-track[data-direction="right"] {
|
|
38
|
+
-webkit-animation-name: ${e}-marquee-right;
|
|
39
|
+
animation-name: ${e}-marquee-right;
|
|
40
|
+
}
|
|
41
|
+
.${e}-marquee-row {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: row;
|
|
44
|
+
align-items: flex-start;
|
|
45
|
+
}
|
|
46
|
+
.${e}-marquee-set {
|
|
47
|
+
flex: 0 0 auto;
|
|
48
|
+
}
|
|
49
|
+
.${e}-marquee-static {
|
|
50
|
+
justify-content: center;
|
|
51
|
+
overflow-x: auto;
|
|
52
|
+
}
|
|
53
|
+
.${e}-marquee-card {
|
|
54
|
+
position: relative;
|
|
55
|
+
flex: 0 0 auto;
|
|
56
|
+
align-self: flex-start;
|
|
57
|
+
}
|
|
58
|
+
.${e}-wrapper {
|
|
59
|
+
position: relative;
|
|
60
|
+
width: 100%;
|
|
61
|
+
height: 100%;
|
|
62
|
+
order: 1;
|
|
63
|
+
}
|
|
64
|
+
.${e}-cover {
|
|
65
|
+
position: absolute;
|
|
66
|
+
width: 100%;
|
|
67
|
+
height: 100%;
|
|
68
|
+
top: 0;
|
|
69
|
+
left: 0;
|
|
70
|
+
}
|
|
71
|
+
.${e}-elements-overlay {
|
|
72
|
+
position: relative;
|
|
73
|
+
inset: 0;
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
pointer-events: none;
|
|
77
|
+
}
|
|
78
|
+
.${e}-control {
|
|
79
|
+
position: relative;
|
|
80
|
+
z-index: 2;
|
|
81
|
+
width: 100%;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.${e}-marquee-link {
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
justify-content: center;
|
|
88
|
+
align-items: center;
|
|
89
|
+
width: 100%;
|
|
90
|
+
height: 100%;
|
|
91
|
+
text-decoration: none;
|
|
92
|
+
color: inherit;
|
|
93
|
+
}
|
|
94
|
+
.${e}-marquee-link-contain {
|
|
95
|
+
width: auto;
|
|
96
|
+
height: auto;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.${e}-control::before {
|
|
100
|
+
content: "";
|
|
101
|
+
position: absolute;
|
|
102
|
+
top: 0;
|
|
103
|
+
left: 0;
|
|
104
|
+
width: 100%;
|
|
105
|
+
height: 100%;
|
|
106
|
+
min-height: 20px;
|
|
107
|
+
pointer-events: auto;
|
|
108
|
+
z-index: 10;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.${e}-gap-control {
|
|
112
|
+
position: relative;
|
|
113
|
+
z-index: 2;
|
|
114
|
+
pointer-events: auto;
|
|
115
|
+
height: 100%;
|
|
116
|
+
}
|
|
117
|
+
.${e}-image-hover-brightness img,
|
|
118
|
+
.${e}-image-hover-brightness video {
|
|
119
|
+
transition: filter 0.3s ease;
|
|
120
|
+
}
|
|
121
|
+
.${e}-image-hover-brightness:hover img,
|
|
122
|
+
.${e}-image-hover-brightness:hover video {
|
|
123
|
+
filter: brightness(1.25);
|
|
124
|
+
}
|
|
125
|
+
.${e}-image-hover-grayscale img,
|
|
126
|
+
.${e}-image-hover-grayscale video {
|
|
127
|
+
transition: filter 0.3s ease;
|
|
128
|
+
}
|
|
129
|
+
.${e}-image-hover-grayscale:hover img,
|
|
130
|
+
.${e}-image-hover-grayscale:hover video {
|
|
131
|
+
filter: grayscale(100%);
|
|
132
|
+
}
|
|
133
|
+
`}const Se=30,Ee=20,se=3,ke=12,Ne=32,Me=3,Ae=250,_e=.5,We=e=>{e.style.setProperty("animation-name","none"),e.style.setProperty("-webkit-animation-name","none"),e.offsetHeight,e.style.removeProperty("animation-name"),e.style.removeProperty("-webkit-animation-name")},Ve=(e,n)=>Array.from({length:n},()=>e).flat(),je=e=>typeof e=="string"?{display:e.toLowerCase()==="cover"?"cover":"fit",ratioValue:"16:9",reversed:!1}:{display:(typeof(e==null?void 0:e.display)=="string"?e.display.toLowerCase():"")==="cover"?"cover":"fit",ratioValue:(e==null?void 0:e.ratioValue)??"16:9",reversed:(e==null?void 0:e.reversed)??!1},ye=e=>e.reduce((n,r)=>n+(r.offsetWidth||r.getBoundingClientRect().width),0),pe=(e,n)=>{if(n<=0||e.children.length<n)return 0;const r=e.children[0],f=e.children[n-1];if(!r||!f)return 0;const p=getComputedStyle(e),d=Number.parseFloat(p.columnGap||p.gap||"0")||0,b=f.getBoundingClientRect().right-r.getBoundingClientRect().left;if(b>0)return b;const q=Array.from({length:n},(w,W)=>e.children[W]),m=ye(q);return m<=0?0:m+d*Math.max(0,n-1)},Ie=e=>{const n=e.getBoundingClientRect().width;if(n>0)return n;const r=e.offsetWidth;if(r>0)return r;const f=ye(Array.from(e.children));if(f<=0)return 0;const p=getComputedStyle(e),d=Number.parseFloat(p.columnGap||p.gap||"0")||0,b=Number.parseFloat(p.paddingRight)||0;return f+d*Math.max(0,e.children.length-1)+b},Te=(e,n)=>{const r=n.getBoundingClientRect(),f=e.getBoundingClientRect();return f.right>r.left&&f.left<r.right},Le=(e,n)=>{const r=e.querySelectorAll(`[data-marquee-item-index="${n}"]`);return Array.from(r).some(f=>Te(f,e))},Oe=e=>{if(e.type==="video")return!0;if(e.type==="image")return!1;const n=e.name??"";return/\.(mp4|webm|ogg|mov)(\?|$)/i.test(n)?!0:/\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.assetId??"")},He=e=>e?e instanceof HTMLVideoElement?e.readyState>=1:e.complete:!1,Be=({item:e,prefix:n,imageFit:r,imageMaxWidth:f,imageMaxHeight:p,cornerRadius:d,imageHoverClass:b,isFirstSet:q,scaled:m,onFirstSetImageDone:w})=>{var N,M,O,H;const W=i.useRef(null),F=!!((N=e.image)!=null&&N.assetId&&Oe(e.image));i.useLayoutEffect(()=>{q&&He(W.current)&&(w==null||w())},[q,(M=e.image)==null?void 0:M.assetId,w]);const T=r.display==="cover",S=r.ratioValue??"1:1",G=r.reversed??!1,[X,C]=S.split(":").map(Number),D=(G?C:X)/(G?X:C),E=f/D,K=E>p?p:E,V=E>p?p*D:f,J=m(V),k=m(K),Z={borderRadius:m(d)},x=T?{pointerEvents:"auto",display:"block",width:"100%",height:"100%",objectFit:"cover",...Z}:{pointerEvents:"auto",display:"block",width:"auto",height:"auto",maxWidth:m(f),maxHeight:m(p),objectFit:"contain",...Z},j=((O=e.image)==null?void 0:O.assetId)&&(F?v.jsx("video",{ref:I=>{W.current=I},src:e.image.assetId,style:x,muted:!0,loop:!0,playsInline:!0,preload:"none",onLoadedMetadata:q?w:void 0,onError:q?w:void 0}):v.jsx("img",{ref:I=>{W.current=I},src:e.image.assetId,alt:((H=e.image)==null?void 0:H.name)??"",style:x,onLoad:q?w:void 0,onError:q?w:void 0}));return v.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"start",...T?{width:J}:{width:"max-content",maxWidth:m(f),minWidth:0}},children:v.jsx("div",{className:b,style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",flexShrink:0,...T?{width:J,height:k,overflow:"hidden",...Z}:{width:"max-content",maxWidth:m(f),height:m(p)}},children:j&&e.link?v.jsx("a",{href:e.link,target:"_self",rel:"noopener noreferrer",className:P(`${n}-marquee-link`,!T&&`${n}-marquee-link-contain`),children:j}):j})})},ze=({settings:e,content:n,isEditor:r,isPreviewMode:f,isEditMode:p})=>{const{prefix:d}=qe.useScopedStyles(),[b,q]=i.useState(0),m=b>0?Math.round(b):0,w=i.useMemo(()=>Ce(d,m),[d,m]),{speed:W,direction:F,pauseOnHover:T,gap:S,imageMaxWidth:G,imageMaxHeight:X,hoverEffect:C,cornerRadius:ce=0}=e,L=i.useMemo(()=>je(e.imageFit),[e.imageFit]),D=L.display!=="cover",E=(n==null?void 0:n.length)??0,K=!!p,V=!r||!!f,J=V&&C!=="off"&&C!=="randomize"?`${d}-image-hover-${C}`:void 0,k=r?!!f:!0,x=((n==null?void 0:n.length)??0)>0&&(k||!!r),j=Math.max(0,W)*Se,N=t=>Re.scalingValue(t,r??!1),M=i.useRef(null),O=i.useRef(null),H=i.useRef(null),[I,le]=i.useState(0),ee=k&&T==="on",[ve,ue]=i.useState(!1),[B,te]=i.useState({}),ne=i.useRef(B);ne.current=B;const re=i.useRef(null),ae=i.useRef(0),Q=i.useRef(null),de=i.useMemo(()=>(n??[]).map(t=>{var a;return((a=t.image)==null?void 0:a.assetId)??""}).join("\0"),[n]),[z,fe]=i.useState(se),ie=i.useMemo(()=>{const t=n??[];return t.length===0||!(k||!!r)?t:Ve(t,z)},[n,k,z,r]),me=i.useMemo(()=>(n??[]).filter(t=>{var a;return!!((a=t.image)!=null&&a.assetId)}).length,[n]),he=x?Me:1;i.useLayoutEffect(()=>{ae.current=0,te({}),re.current=null,fe(se),q(0)},[de]),i.useEffect(()=>{if(!V||C!=="randomize")return;const t=M.current;if(!t)return;const a=c=>{te(l=>{const y=Array.from(c).filter(g=>g in l&&!Le(t,g));if(y.length===0)return l;const h={...l};return y.forEach(g=>{delete h[g]}),h})},o=new IntersectionObserver(c=>{const l=new Set;for(const y of c){const h=y.target.dataset.marqueeItemIndex,g=h!==void 0?Number(h):NaN;Number.isNaN(g)||l.add(g)}l.size>0&&a(l)},{root:t,threshold:0});Object.keys(B).forEach(c=>{const l=Number(c);t.querySelectorAll(`[data-marquee-item-index="${l}"]`).forEach(y=>o.observe(y))});const u={current:0},s=()=>{const c=Object.keys(ne.current);c.length!==0&&(a(c.map(Number)),u.current=requestAnimationFrame(s))};return Object.keys(ne.current).length>0&&(u.current=requestAnimationFrame(s)),()=>{cancelAnimationFrame(u.current),o.disconnect()}},[C,B,V]),i.useEffect(()=>{const t=M.current;if(!t||typeof IntersectionObserver>"u")return;let a=!1,o=!1,u;const s=()=>{const h=t.querySelectorAll("video");if(!a){h.forEach(_.pauseVideo);return}const g=t.getBoundingClientRect(),A=g.width*_e;h.forEach($=>{const Y=$.getBoundingClientRect(),U=Y.right>g.left&&Y.left<g.right;Y.right>g.left-A&&Y.left<g.right+A?_.raisePreload($,"auto"):D&&_.raisePreload($,"metadata"),o&&U?$.paused&&_.playVideo($):_.pauseVideo($)})},c=()=>{a&&u===void 0?u=setInterval(s,Ae):!a&&u!==void 0&&(clearInterval(u),u=void 0),s()},l=_.observeIntersection(t,_.NEAR_VIEWPORT_MARGIN,h=>{a=h,c()}),y=_.observeIntersection(t,"0px",h=>{o=h,c()});return()=>{l(),y(),clearInterval(u)}},[x,D]),i.useLayoutEffect(()=>{if(!x)return;const t=M.current,a=H.current;if(!t||!a)return;const o={current:0},u=()=>{const l=t.getBoundingClientRect().width||t.offsetWidth,y=Ie(a),h=re.current,g=typeof h=="number"&&Math.abs(h-y)<=.25;re.current=y;let A=z,$=0;if((k||r)&&E>0&&l>0){const R=pe(a,E);if(R>=Ne){$=R;const oe=Math.min(ke,Math.max(se,Math.ceil(l/R)+1));A=oe,oe!==z&&fe(oe)}}const U=A!==z&&$>0?$*A:y>0?y:$>0?$*A:(()=>{const R=pe(a,E);return R>0?R*A:0})();U>0?q(R=>R<=0?U:!g||Math.round(R)===Math.round(U)?R:U):!g&&b<=0&&(cancelAnimationFrame(o.current),o.current=requestAnimationFrame(u))},s=()=>{cancelAnimationFrame(o.current),o.current=requestAnimationFrame(u)};Q.current=s,s();const c=new ResizeObserver(s);return c.observe(t),c.observe(a),()=>{Q.current=null,cancelAnimationFrame(o.current),c.disconnect()}},[k,x,b,de,z,E,r]),i.useLayoutEffect(()=>{if(!x||m<=0)return;const t=O.current;t&&We(t)},[x,m,F,j]),i.useLayoutEffect(()=>{if(!x||b<=0){le(0);return}const t=O.current,a=H.current;if(!t||!a)return;const o=()=>{const s=t.offsetHeight||t.getBoundingClientRect().height,c=Array.from(a.children).reduce((y,h)=>Math.max(y,h.offsetHeight||h.getBoundingClientRect().height),0),l=s>0?s:c;le(l>0?l:0)};o();const u=new ResizeObserver(o);return u.observe(t),u.observe(a),()=>u.disconnect()},[x,he,ie,r,S,G,X,b,L,B]),i.useLayoutEffect(()=>{if(!r||!K||!x||typeof window>"u")return;const t=requestAnimationFrame(()=>{window.dispatchEvent(new Event("scroll"))});return()=>cancelAnimationFrame(t)},[r,K,x,F,b,I,S,ie]);const be=()=>{ee&&ue(!0)},xe=()=>{ee&&ue(!1)},we=i.useCallback(()=>{var t;ae.current=Math.min(me,ae.current+1),(t=Q.current)==null||t.call(Q)},[me]),$e=i.useCallback((t,a)=>{te(o=>{const u=o[t]??a,s=(n??[]).filter(l=>l!==u);if(s.length===0)return o;const c=s[Math.floor(Math.random()*s.length)];return{...o,[t]:c}})},[n]),ge=(t,a,o,u)=>{const s=V&&C==="randomize"&&L.display==="cover"?B[o]??t:t,c=`max(${N(S)}, ${Ee}px)`,l=`calc(-0.5 * (${c} + ${N(S)}))`;return v.jsxs("div",{className:`${d}-marquee-card`,"data-marquee-item-index":o,onMouseEnter:V&&C==="randomize"&&L.display==="cover"?()=>$e(o,t):void 0,children:[v.jsx(Be,{item:s,prefix:d,imageFit:L,imageMaxWidth:G,imageMaxHeight:X,cornerRadius:ce,imageHoverClass:J,isEditor:r,isFirstSet:u,scaled:N,onFirstSetImageDone:we}),K&&v.jsx("div",{"data-controls":"gap","data-controls-axis":"x",className:`${d}-gap-control`,style:{position:"absolute",top:0,right:l,width:c,height:"100%"}})]},`${a}-${o}`)};if(x){const t=k?ee&&ve?"paused":"running":"paused",a=m>0&&j>0?m/j*1e3:0,o=`${Math.max(0,a)/1e3}s`;return v.jsxs("div",{ref:M,className:P(`${d}-wrapper`,`${d}-marquee-wrapper`),"aria-label":"Marquee",style:I>0?{height:I}:void 0,children:[v.jsx("style",{dangerouslySetInnerHTML:{__html:w}}),v.jsx("div",{ref:O,className:`${d}-marquee-track`,"data-direction":F,onMouseEnter:be,onMouseLeave:xe,style:{WebkitAnimationDuration:o,animationDuration:o,WebkitAnimationPlayState:t,animationPlayState:t},children:Array.from({length:he},(u,s)=>v.jsx("div",{ref:s===0?H:void 0,className:P(`${d}-marquee-row`,`${d}-marquee-set`),style:{gap:N(S),paddingRight:N(S)},"aria-hidden":s>0,children:ie.map((c,l)=>ge(c,s,l,s===0&&l<E))},`set-${s}`))})]})}return v.jsxs("div",{ref:M,className:`${d}-wrapper`,children:[v.jsx("style",{dangerouslySetInnerHTML:{__html:w}}),v.jsx("div",{className:P(`${d}-marquee-row`,`${d}-marquee-static`),style:{gap:N(S),transform:"none"},"aria-label":"Marquee",children:n==null?void 0:n.map((t,a)=>ge(t,0,a))},"marquee-static")]})};exports.Marquee=ze;
|
|
@@ -6,8 +6,9 @@ import { b as qe } from "./buildColorVars-CLyWQm5K.mjs";
|
|
|
6
6
|
import { u as Je } from "./useScopedStyles-DhBG3557.mjs";
|
|
7
7
|
import { o as ne, t as oe } from "./textStylesToCss-05Mn6I_2.mjs";
|
|
8
8
|
import { S as Qe } from "./SvgImage-B5mR9y6q.mjs";
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
import { L as Pe } from "./LazyVideo-D8eVYFyw.mjs";
|
|
10
|
+
const It = 300 / 1440, tn = 8 / 1440, st = 4e-3;
|
|
11
|
+
function en(t) {
|
|
11
12
|
return `calc(var(--cntrl-article-width, 100vw) * ${t / 1440})`;
|
|
12
13
|
}
|
|
13
14
|
function ie(t, e, n, i) {
|
|
@@ -19,7 +20,7 @@ function re(t, e, n, i, l = "title-leading-gap") {
|
|
|
19
20
|
[`--${n}-${l}`]: dt((d - e) / 2, i)
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
+
function nn(t) {
|
|
23
24
|
return `
|
|
24
25
|
.${t}-wrapper {
|
|
25
26
|
box-sizing: border-box;
|
|
@@ -27,7 +28,7 @@ function en(t) {
|
|
|
27
28
|
flex-direction: column;
|
|
28
29
|
position: relative;
|
|
29
30
|
width: 100%;
|
|
30
|
-
min-height: ${
|
|
31
|
+
min-height: ${en(48)};
|
|
31
32
|
}
|
|
32
33
|
.${t}-single-title-layer {
|
|
33
34
|
position: absolute;
|
|
@@ -299,11 +300,11 @@ const ze = {
|
|
|
299
300
|
"bottom-center": { horizontal: "center", vertical: "bottom" },
|
|
300
301
|
"right-bottom": { horizontal: "right", vertical: "bottom" }
|
|
301
302
|
};
|
|
302
|
-
function
|
|
303
|
+
function on(t) {
|
|
303
304
|
return t in ze;
|
|
304
305
|
}
|
|
305
|
-
function
|
|
306
|
-
if (t &&
|
|
306
|
+
function rn(t) {
|
|
307
|
+
if (t && on(t))
|
|
307
308
|
return t;
|
|
308
309
|
switch (t) {
|
|
309
310
|
case "center-top":
|
|
@@ -333,32 +334,32 @@ function on(t) {
|
|
|
333
334
|
function se(t) {
|
|
334
335
|
return ze[t];
|
|
335
336
|
}
|
|
336
|
-
const
|
|
337
|
+
const ln = "rgba(28,31,34,0.9)", ct = 500, vt = "cubic-bezier(0.22, 1, 0.36, 1)", an = 72, cn = 50, sn = {
|
|
337
338
|
titleColor: "title-color",
|
|
338
339
|
descriptionColor: "description-color",
|
|
339
340
|
lightboxCounterColor: "lightbox-counter-color"
|
|
340
|
-
},
|
|
341
|
-
function
|
|
341
|
+
}, dn = [];
|
|
342
|
+
function hn(t) {
|
|
342
343
|
if (!Array.isArray(t) || t.length === 0) return !1;
|
|
343
344
|
const e = t[0];
|
|
344
345
|
return e !== null && typeof e == "object" && "media" in e && Array.isArray(e.media);
|
|
345
346
|
}
|
|
346
|
-
function
|
|
347
|
+
function pn(t) {
|
|
347
348
|
const [e, n] = t.media;
|
|
348
349
|
return n != null && n.assetId ? n : e != null && e.assetId ? e : null;
|
|
349
350
|
}
|
|
350
|
-
function
|
|
351
|
+
function un(t) {
|
|
351
352
|
const [e] = t.media;
|
|
352
353
|
return e != null && e.assetId ? e : null;
|
|
353
354
|
}
|
|
354
|
-
function
|
|
355
|
+
function fn(t) {
|
|
355
356
|
if (!Array.isArray(t) || t.length === 0) return [];
|
|
356
|
-
if (
|
|
357
|
+
if (hn(t)) {
|
|
357
358
|
const e = [];
|
|
358
359
|
for (const n of t) {
|
|
359
|
-
const i =
|
|
360
|
+
const i = pn(n);
|
|
360
361
|
if (!i) continue;
|
|
361
|
-
const l =
|
|
362
|
+
const l = un(n);
|
|
362
363
|
e.push({
|
|
363
364
|
displayMedia: i,
|
|
364
365
|
lightboxMedia: l != null && l.assetId ? l : null
|
|
@@ -374,18 +375,18 @@ function un(t) {
|
|
|
374
375
|
function ae(t) {
|
|
375
376
|
return t.type === "video";
|
|
376
377
|
}
|
|
377
|
-
function
|
|
378
|
+
function gn(t) {
|
|
378
379
|
t.pause(), t.removeAttribute("src"), t.load();
|
|
379
380
|
}
|
|
380
381
|
function jt(t) {
|
|
381
382
|
const e = t.getBoundingClientRect();
|
|
382
383
|
return { width: e.width, height: e.height, left: e.left, top: e.top };
|
|
383
384
|
}
|
|
384
|
-
function
|
|
385
|
+
function mn(t) {
|
|
385
386
|
return t instanceof HTMLVideoElement ? { width: t.videoWidth, height: t.videoHeight } : { width: t.naturalWidth, height: t.naturalHeight };
|
|
386
387
|
}
|
|
387
|
-
const
|
|
388
|
-
function
|
|
388
|
+
const vn = 1140 / 1440;
|
|
389
|
+
function yn(t) {
|
|
389
390
|
return typeof t == "string" ? {
|
|
390
391
|
display: t.toLowerCase() === "cover" ? "cover" : "fit",
|
|
391
392
|
ratioValue: "2:3",
|
|
@@ -396,14 +397,14 @@ function vn(t) {
|
|
|
396
397
|
reversed: (t == null ? void 0 : t.reversed) ?? !1
|
|
397
398
|
};
|
|
398
399
|
}
|
|
399
|
-
function
|
|
400
|
+
function xn(t) {
|
|
400
401
|
const e = t.ratioValue ?? "1:1", n = t.reversed ?? !1, [i, l] = e.split(":").map(Number);
|
|
401
402
|
return `${n ? l : i} / ${n ? i : l}`;
|
|
402
403
|
}
|
|
403
|
-
function
|
|
404
|
+
function $n(t) {
|
|
404
405
|
return typeof t == "string" ? t === "cover" ? "cover" : "fit" : (t == null ? void 0 : t.display) === "cover" ? "cover" : "fit";
|
|
405
406
|
}
|
|
406
|
-
function
|
|
407
|
+
function wn({
|
|
407
408
|
src: t,
|
|
408
409
|
phase: e,
|
|
409
410
|
mediaRef: n,
|
|
@@ -417,7 +418,7 @@ function $n({
|
|
|
417
418
|
const a = n.current;
|
|
418
419
|
if (a)
|
|
419
420
|
return () => {
|
|
420
|
-
|
|
421
|
+
gn(a);
|
|
421
422
|
};
|
|
422
423
|
}, [t, n]), /* @__PURE__ */ r(
|
|
423
424
|
"video",
|
|
@@ -435,10 +436,10 @@ function $n({
|
|
|
435
436
|
}
|
|
436
437
|
);
|
|
437
438
|
}
|
|
438
|
-
const
|
|
439
|
-
function
|
|
439
|
+
const bn = "https://cdn.cntrl.site/component-assets/defaultCloseIcon.svg", Sn = 4e-3;
|
|
440
|
+
function Cn({
|
|
440
441
|
prefix: t,
|
|
441
|
-
closeIcon: e =
|
|
442
|
+
closeIcon: e = bn,
|
|
442
443
|
closeIconMaxWidth: n = 0.0125,
|
|
443
444
|
closeIconColor: i = "#FFFFFF",
|
|
444
445
|
closeIconHoverColor: l = "#999999",
|
|
@@ -451,7 +452,7 @@ function Sn({
|
|
|
451
452
|
onClose: y
|
|
452
453
|
}) {
|
|
453
454
|
if (!e) return null;
|
|
454
|
-
const I = dt(n, p), K = dt(d, p), R = dt(o, p), D = dt(Math.max(o,
|
|
455
|
+
const I = dt(n, p), K = dt(d, p), R = dt(o, p), D = dt(Math.max(o, Sn), p);
|
|
455
456
|
return /* @__PURE__ */ C(
|
|
456
457
|
"div",
|
|
457
458
|
{
|
|
@@ -553,7 +554,7 @@ function Sn({
|
|
|
553
554
|
}
|
|
554
555
|
);
|
|
555
556
|
}
|
|
556
|
-
function
|
|
557
|
+
function Tn({
|
|
557
558
|
prefix: t,
|
|
558
559
|
items: e,
|
|
559
560
|
index: n,
|
|
@@ -595,7 +596,7 @@ function Cn({
|
|
|
595
596
|
j(jt(c));
|
|
596
597
|
return;
|
|
597
598
|
}
|
|
598
|
-
const { width: G, height: lt } =
|
|
599
|
+
const { width: G, height: lt } = mn(f);
|
|
599
600
|
if (!G || !lt) {
|
|
600
601
|
j(jt(c));
|
|
601
602
|
return;
|
|
@@ -642,7 +643,7 @@ function Cn({
|
|
|
642
643
|
const b = E.current;
|
|
643
644
|
b && j(jt(b)), v < 0 ? h() : a();
|
|
644
645
|
}, O = (v) => {
|
|
645
|
-
if (Math.abs(v) >
|
|
646
|
+
if (Math.abs(v) > cn && e.length > 1) {
|
|
646
647
|
z(v);
|
|
647
648
|
return;
|
|
648
649
|
}
|
|
@@ -675,7 +676,7 @@ function Cn({
|
|
|
675
676
|
if (b && v === "horizontal")
|
|
676
677
|
O(g.current), S();
|
|
677
678
|
else if (b && v === "vertical")
|
|
678
|
-
if (w.current >
|
|
679
|
+
if (w.current > an) {
|
|
679
680
|
const tt = window.innerHeight;
|
|
680
681
|
w.current = tt, Xt(!0), $t(tt), k("closing");
|
|
681
682
|
} else
|
|
@@ -840,7 +841,7 @@ function Cn({
|
|
|
840
841
|
}
|
|
841
842
|
),
|
|
842
843
|
u && Q && (wt ? /* @__PURE__ */ r(
|
|
843
|
-
|
|
844
|
+
wn,
|
|
844
845
|
{
|
|
845
846
|
src: Q.assetId,
|
|
846
847
|
phase: $,
|
|
@@ -903,7 +904,7 @@ function Cn({
|
|
|
903
904
|
)
|
|
904
905
|
] }),
|
|
905
906
|
/* @__PURE__ */ r(
|
|
906
|
-
|
|
907
|
+
Cn,
|
|
907
908
|
{
|
|
908
909
|
prefix: t,
|
|
909
910
|
closeIcon: K,
|
|
@@ -936,7 +937,7 @@ function Te({
|
|
|
936
937
|
showControls: h = !1,
|
|
937
938
|
onMediaClick: s
|
|
938
939
|
}) {
|
|
939
|
-
const y = `${t}-gallery-${ae(e) ? "video" : "image"}`, I = d.display === "cover", K =
|
|
940
|
+
const y = `${t}-gallery-${ae(e) ? "video" : "image"}`, I = d.display === "cover", K = xn(d), R = (g) => dt(g, o ?? !1), D = n ?? It, A = l ? { width: "100%", maxWidth: "100%" } : { width: R(D), maxWidth: "100%" }, V = i ? { borderRadius: R(i) } : {}, ht = {
|
|
940
941
|
...A,
|
|
941
942
|
...I ? { aspectRatio: K, height: "auto", overflow: "hidden" } : {},
|
|
942
943
|
...V
|
|
@@ -962,7 +963,7 @@ function Te({
|
|
|
962
963
|
g.stopPropagation(), s();
|
|
963
964
|
} : void 0
|
|
964
965
|
}, N = Math.max(p, st), w = ae(e) ? /* @__PURE__ */ r(
|
|
965
|
-
|
|
966
|
+
Pe,
|
|
966
967
|
{
|
|
967
968
|
...W,
|
|
968
969
|
src: e.assetId,
|
|
@@ -1007,7 +1008,7 @@ function Te({
|
|
|
1007
1008
|
)
|
|
1008
1009
|
] });
|
|
1009
1010
|
}
|
|
1010
|
-
function
|
|
1011
|
+
function In({
|
|
1011
1012
|
P: t,
|
|
1012
1013
|
layoutType: e,
|
|
1013
1014
|
galleryWidthStyle: n,
|
|
@@ -1076,7 +1077,7 @@ function Tn({
|
|
|
1076
1077
|
)
|
|
1077
1078
|
] });
|
|
1078
1079
|
}
|
|
1079
|
-
function
|
|
1080
|
+
function Ln(t) {
|
|
1080
1081
|
switch (t) {
|
|
1081
1082
|
case "fade":
|
|
1082
1083
|
case "retype":
|
|
@@ -1256,12 +1257,12 @@ function Ne(t, e, n) {
|
|
|
1256
1257
|
}
|
|
1257
1258
|
return n;
|
|
1258
1259
|
}
|
|
1259
|
-
function
|
|
1260
|
+
function Nn(t) {
|
|
1260
1261
|
const e = Ne(t, "--cntrl-viewport-height", window.innerHeight), n = Ne(t, "--cntrl-article-top", 0);
|
|
1261
1262
|
return { top: n, height: e, centerY: n + e / 2 };
|
|
1262
1263
|
}
|
|
1263
|
-
function
|
|
1264
|
-
const { vertical: i } = se(e), { top: l, height: d, centerY: o } =
|
|
1264
|
+
function kn(t, e, n) {
|
|
1265
|
+
const { vertical: i } = se(e), { top: l, height: d, centerY: o } = Nn(n);
|
|
1265
1266
|
if (i === "top") {
|
|
1266
1267
|
const a = n && parseFloat(getComputedStyle(n).top) || l;
|
|
1267
1268
|
return Math.abs(t.top - a);
|
|
@@ -1271,11 +1272,11 @@ function Nn(t, e, n) {
|
|
|
1271
1272
|
const p = t.top + t.height / 2;
|
|
1272
1273
|
return Math.abs(p - o);
|
|
1273
1274
|
}
|
|
1274
|
-
function
|
|
1275
|
+
function zn(t, e, n) {
|
|
1275
1276
|
const i = Array.from({ length: e }, (o, p) => {
|
|
1276
1277
|
const a = t.current[p];
|
|
1277
1278
|
if (!a) return 0;
|
|
1278
|
-
const h = a.getBoundingClientRect(), s =
|
|
1279
|
+
const h = a.getBoundingClientRect(), s = kn(h, n, a);
|
|
1279
1280
|
return Math.exp(-(s * s) / (2 * Le * Le));
|
|
1280
1281
|
});
|
|
1281
1282
|
let l = 0, d = -1;
|
|
@@ -1283,7 +1284,7 @@ function kn(t, e, n) {
|
|
|
1283
1284
|
o > d && (d = o, l = p);
|
|
1284
1285
|
}), { opacities: i, dominantIndex: l };
|
|
1285
1286
|
}
|
|
1286
|
-
function
|
|
1287
|
+
function Mn(t, e, n) {
|
|
1287
1288
|
const i = M([]), [{ opacities: l, dominantIndex: d }, o] = B(() => ({
|
|
1288
1289
|
opacities: Array.from({ length: t }, (a, h) => h === 0 ? 1 : 0),
|
|
1289
1290
|
dominantIndex: 0
|
|
@@ -1298,7 +1299,7 @@ function zn(t, e, n) {
|
|
|
1298
1299
|
}
|
|
1299
1300
|
let a = 0;
|
|
1300
1301
|
const h = () => {
|
|
1301
|
-
o(
|
|
1302
|
+
o(zn(i, t, n));
|
|
1302
1303
|
}, s = () => {
|
|
1303
1304
|
a || (a = window.requestAnimationFrame(() => {
|
|
1304
1305
|
a = 0, h();
|
|
@@ -1332,7 +1333,7 @@ function ke(t, e) {
|
|
|
1332
1333
|
return () => window.clearInterval(h);
|
|
1333
1334
|
}, [e, t]), n;
|
|
1334
1335
|
}
|
|
1335
|
-
function
|
|
1336
|
+
function jn({
|
|
1336
1337
|
settings: t,
|
|
1337
1338
|
content: e,
|
|
1338
1339
|
isEditor: n,
|
|
@@ -1341,7 +1342,7 @@ function Bn({
|
|
|
1341
1342
|
portalId: d
|
|
1342
1343
|
}) {
|
|
1343
1344
|
var $e, we;
|
|
1344
|
-
const { prefix: o } = Je(), p = Ce(() =>
|
|
1345
|
+
const { prefix: o } = Je(), p = Ce(() => nn(o), [o]), a = e ?? [], h = (t == null ? void 0 : t.wrapperWidth) ?? 1, s = (t == null ? void 0 : t.type) ?? "a", y = (t == null ? void 0 : t.imgWidth) ?? It, I = (t == null ? void 0 : t.titleWidth) ?? vn, K = yn(t == null ? void 0 : t.imageDisplay), R = (t == null ? void 0 : t.cornerRadius) ?? tn, D = rn(t == null ? void 0 : t.position), { horizontal: A, vertical: V } = se(D), ht = (t == null ? void 0 : t.titleTopPadding) ?? 0, pt = (t == null ? void 0 : t.titleBottomPadding) ?? 0, E = (t == null ? void 0 : t.titleLeftPadding) ?? 0, W = (t == null ? void 0 : t.titleRightPadding) ?? 0, N = (t == null ? void 0 : t.titleDescriptionPadding) ?? 0, w = Ln(t == null ? void 0 : t.transition), g = (t == null ? void 0 : t.lightbox) ?? "on", x = s === "b", U = w === "fade" || w === "retype", { setTitleRef: H, dominantIndex: Y } = Mn(a.length, U, D), q = (($e = a[Y]) == null ? void 0 : $e.title) ?? "", u = ((we = a[Y]) == null ? void 0 : we.description) ?? "", j = ke(q, w === "retype"), $ = ke(u, w === "retype"), k = w === "fade" || w === "retype", et = w === "retype" ? j : q, $t = w === "retype" ? $ : u, Mt = x ? void 0 : { width: dt(y, n ?? !1) }, nt = g === "on" && (!n || i || l), T = l ?? !1, ot = (t == null ? void 0 : t.galleryPaddingRight) ?? 0, it = (t == null ? void 0 : t.galleryPaddingLeft) ?? 0, J = (t == null ? void 0 : t.galleryPaddingBetween) ?? 0, m = (L) => dt(L, n ?? !1), Rt = {
|
|
1345
1346
|
width: m(I)
|
|
1346
1347
|
}, Q = s === "a" ? ot : it, wt = x ? { width: "100%" } : {
|
|
1347
1348
|
width: `calc(100% - ${m(y)} - ${m(Q)})`,
|
|
@@ -1436,7 +1437,7 @@ function Bn({
|
|
|
1436
1437
|
titleColor: z ?? "#000000",
|
|
1437
1438
|
descriptionColor: de ?? "#000000",
|
|
1438
1439
|
lightboxCounterColor: he ?? "#DEDDDD"
|
|
1439
|
-
},
|
|
1440
|
+
}, sn, dn), Pt = M(null), [Ot, _t] = B(!1), [Bt, Xe] = B([]), [Ke, te] = B(0), xe = yt((L, _) => {
|
|
1440
1441
|
nt && (Xe(L), te(_), _t(!0));
|
|
1441
1442
|
}, [nt]), Ue = yt(() => {
|
|
1442
1443
|
_t(!1);
|
|
@@ -1509,7 +1510,7 @@ function Bn({
|
|
|
1509
1510
|
}
|
|
1510
1511
|
) }),
|
|
1511
1512
|
a.map((L, _) => {
|
|
1512
|
-
const Tt =
|
|
1513
|
+
const Tt = fn(L.gallery), be = _ < a.length - 1, Vt = Tt.filter((at) => at.lightboxMedia).map((at) => at.lightboxMedia), Se = {
|
|
1513
1514
|
P: o,
|
|
1514
1515
|
position: D,
|
|
1515
1516
|
titleRef: H(_),
|
|
@@ -1622,7 +1623,7 @@ function Bn({
|
|
|
1622
1623
|
}
|
|
1623
1624
|
),
|
|
1624
1625
|
Tt.length > 0 && /* @__PURE__ */ r(
|
|
1625
|
-
|
|
1626
|
+
In,
|
|
1626
1627
|
{
|
|
1627
1628
|
P: o,
|
|
1628
1629
|
layoutType: s,
|
|
@@ -1668,12 +1669,12 @@ function Bn({
|
|
|
1668
1669
|
const L = (d ? document.getElementById(d) : null) ?? document.body;
|
|
1669
1670
|
return Ze(
|
|
1670
1671
|
/* @__PURE__ */ r("div", { style: Ye, "data-selection": "none", children: /* @__PURE__ */ r(
|
|
1671
|
-
|
|
1672
|
+
Tn,
|
|
1672
1673
|
{
|
|
1673
1674
|
prefix: o,
|
|
1674
1675
|
items: Bt,
|
|
1675
1676
|
index: Ke,
|
|
1676
|
-
imageDisplay:
|
|
1677
|
+
imageDisplay: $n(t.lightboxImageDisplay),
|
|
1677
1678
|
isEditor: n,
|
|
1678
1679
|
isPreviewMode: i,
|
|
1679
1680
|
isEditMode: l,
|
|
@@ -1688,7 +1689,7 @@ function Bn({
|
|
|
1688
1689
|
onNext: () => te((_) => (_ + 1) % Bt.length),
|
|
1689
1690
|
counterClassName: Ge,
|
|
1690
1691
|
counterStyle: je,
|
|
1691
|
-
backgroundColor: t.backgroundColor ??
|
|
1692
|
+
backgroundColor: t.backgroundColor ?? ln
|
|
1692
1693
|
}
|
|
1693
1694
|
) }),
|
|
1694
1695
|
L
|
|
@@ -1697,5 +1698,5 @@ function Bn({
|
|
|
1697
1698
|
] });
|
|
1698
1699
|
}
|
|
1699
1700
|
export {
|
|
1700
|
-
|
|
1701
|
+
jn as Mercury
|
|
1701
1702
|
};
|