@cntrl-site/components 1.0.104 → 1.0.105
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/utils/observeIntersection.d.ts +4 -0
- package/dist/Components/utils/useLazyVideos.d.ts +0 -3
- package/dist/{Grid-Bq6bk2AQ.js → Grid-BBpdl60K.js} +1 -1
- package/dist/{Grid-B2_o1dvz.mjs → Grid-DS53S_gA.mjs} +2 -2
- package/dist/{Helix-BrKQzGX5.mjs → Helix-BPn9V1sg.mjs} +1 -1
- package/dist/{Helix-B7rxlvKq.js → Helix-DcgsCc4D.js} +1 -1
- package/dist/{Hive-BusARSOi.mjs → Hive-D6-R6TwM.mjs} +2 -2
- package/dist/{Hive-Dh5nKPGm.js → Hive-n8Fz-j3o.js} +1 -1
- package/dist/{LazyVideo-D8eVYFyw.mjs → LazyVideo-CdAWymKO.mjs} +1 -1
- package/dist/{LazyVideo-Cn_vmMq8.js → LazyVideo-imbU18js.js} +1 -1
- package/dist/Marquee-DOIRRCu4.js +133 -0
- package/dist/{Marquee-CdtAqhQE.mjs → Marquee-O_PDwlIb.mjs} +55 -54
- package/dist/MarqueeText-DkaO2lQ5.js +132 -0
- package/dist/MarqueeText-Rzt2fJYt.mjs +517 -0
- package/dist/{Mercury-BRqlbk4i.mjs → Mercury-C9D10TTT.mjs} +1 -1
- package/dist/{Mercury-C-O2VGkK.js → Mercury-DynO-NxY.js} +1 -1
- package/dist/{PretextComponent-D5P0AjnL.js → PretextComponent-BnsS2zJ6.js} +1 -1
- package/dist/{PretextComponent-s4DDfmzY.mjs → PretextComponent-j-OsRZTx.mjs} +7 -7
- package/dist/{Waterfall-fdiHR0Rc.js → Waterfall-DC2WQ3GT.js} +1 -1
- package/dist/{Waterfall-DKuh4bnv.mjs → Waterfall-Yud2VR62.mjs} +2 -2
- package/dist/{components-DzNixU7Q.js → components-B9Vdjf0w.js} +1 -1
- package/dist/{components-Yf9Zjska.mjs → components-D2LyuDm-.mjs} +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +7 -7
- package/dist/elements.node.js +1 -1
- package/dist/elements.node.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +2 -2
- package/dist/observeIntersection-B0f3L2iK.mjs +23 -0
- package/dist/observeIntersection-DxGj9Ctt.js +1 -0
- package/dist/sources.js +24 -12
- package/dist/sources.mjs +28 -16
- package/dist/useLazyVideos-CdCbc2j0.js +1 -0
- package/dist/useLazyVideos-CxXyEjRQ.mjs +52 -0
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +1 -1
- package/package.json +1 -1
- package/dist/Marquee-DUN8wUax.js +0 -133
- package/dist/MarqueeText-4Rip_sQX.mjs +0 -515
- package/dist/MarqueeText-E6OubMOG.js +0 -132
- package/dist/useLazyVideos-BbgdvELi.js +0 -1
- package/dist/useLazyVideos-CZLyNolX.mjs +0 -72
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),s=require("react"),At=require("classnames"),Et=require("./scalingValue-CSHYgTZl.js"),Mt=require("./useScopedStyles-Bf6yohVQ.js"),Ct=require("./textStylesToCss-CNN3zZTV.js"),Rt=require("./observeIntersection-DxGj9Ctt.js");function kt(e,r,o){const c=r>0?`${r}px`:"0px",a=o?`
|
|
2
|
+
.${e}-item-image-wrap {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex: 0 0 auto;
|
|
5
|
+
align-items: center;
|
|
6
|
+
}
|
|
7
|
+
.${e}-glyph {
|
|
8
|
+
display: inline-block;
|
|
9
|
+
}
|
|
10
|
+
.${e}-glyph-inner {
|
|
11
|
+
display: inline-block;
|
|
12
|
+
transform-origin: 50% 50%;
|
|
13
|
+
backface-visibility: hidden;
|
|
14
|
+
-webkit-backface-visibility: hidden;
|
|
15
|
+
}
|
|
16
|
+
.${e}-item-image {
|
|
17
|
+
transform-origin: 50% 50%;
|
|
18
|
+
backface-visibility: hidden;
|
|
19
|
+
-webkit-backface-visibility: hidden;
|
|
20
|
+
}
|
|
21
|
+
`:"";return`
|
|
22
|
+
.${e}-wrapper {
|
|
23
|
+
position: relative;
|
|
24
|
+
width: 100%;
|
|
25
|
+
height: auto;
|
|
26
|
+
}
|
|
27
|
+
.${e}-marquee-wrapper {
|
|
28
|
+
position: relative;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
overflow-x: clip;
|
|
31
|
+
overflow-y: visible;
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: auto;
|
|
34
|
+
}
|
|
35
|
+
.${e}-curve-bg {
|
|
36
|
+
position: absolute;
|
|
37
|
+
left: 0;
|
|
38
|
+
top: 0;
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: 100%;
|
|
41
|
+
overflow: visible;
|
|
42
|
+
pointer-events: none;
|
|
43
|
+
z-index: 0;
|
|
44
|
+
}
|
|
45
|
+
.${e}-ribbon {
|
|
46
|
+
position: absolute;
|
|
47
|
+
left: 0;
|
|
48
|
+
top: 50%;
|
|
49
|
+
width: 100%;
|
|
50
|
+
transform: translateY(-50%);
|
|
51
|
+
pointer-events: none;
|
|
52
|
+
z-index: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@keyframes ${e}-marquee-left {
|
|
56
|
+
from { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }
|
|
57
|
+
to { -webkit-transform: translate3d(-${c}, 0, 0); transform: translate3d(-${c}, 0, 0); }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@keyframes ${e}-marquee-right {
|
|
61
|
+
from { -webkit-transform: translate3d(-${c}, 0, 0); transform: translate3d(-${c}, 0, 0); }
|
|
62
|
+
to { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.${e}-marquee-track {
|
|
66
|
+
display: flex;
|
|
67
|
+
flex-direction: row;
|
|
68
|
+
width: max-content;
|
|
69
|
+
backface-visibility: hidden;
|
|
70
|
+
-webkit-backface-visibility: hidden;
|
|
71
|
+
flex-wrap: nowrap;
|
|
72
|
+
-webkit-animation-timing-function: linear;
|
|
73
|
+
animation-timing-function: linear;
|
|
74
|
+
-webkit-animation-iteration-count: infinite;
|
|
75
|
+
animation-iteration-count: infinite;
|
|
76
|
+
position: relative;
|
|
77
|
+
z-index: 1;
|
|
78
|
+
}
|
|
79
|
+
.${e}-marquee-track[data-direction="left"] {
|
|
80
|
+
-webkit-animation-name: ${e}-marquee-left;
|
|
81
|
+
animation-name: ${e}-marquee-left;
|
|
82
|
+
}
|
|
83
|
+
.${e}-marquee-track[data-direction="right"] {
|
|
84
|
+
-webkit-animation-name: ${e}-marquee-right;
|
|
85
|
+
animation-name: ${e}-marquee-right;
|
|
86
|
+
}
|
|
87
|
+
.${e}-marquee-set {
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-direction: row;
|
|
90
|
+
align-items: center;
|
|
91
|
+
flex: 0 0 auto;
|
|
92
|
+
position: relative;
|
|
93
|
+
z-index: 1;
|
|
94
|
+
}
|
|
95
|
+
.${e}-marquee-static {
|
|
96
|
+
justify-content: center;
|
|
97
|
+
overflow-x: auto;
|
|
98
|
+
}
|
|
99
|
+
.${e}-item {
|
|
100
|
+
position: relative;
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: row;
|
|
103
|
+
align-items: center;
|
|
104
|
+
flex: 0 0 auto;
|
|
105
|
+
white-space: nowrap;
|
|
106
|
+
}
|
|
107
|
+
.${e}-item-link {
|
|
108
|
+
display: flex;
|
|
109
|
+
flex-direction: row;
|
|
110
|
+
align-items: center;
|
|
111
|
+
text-decoration: none;
|
|
112
|
+
color: inherit;
|
|
113
|
+
}
|
|
114
|
+
.${e}-item-image {
|
|
115
|
+
display: block;
|
|
116
|
+
width: auto;
|
|
117
|
+
flex: 0 0 auto;
|
|
118
|
+
object-fit: contain;
|
|
119
|
+
}
|
|
120
|
+
.${e}-text {
|
|
121
|
+
display: inline-block;
|
|
122
|
+
}
|
|
123
|
+
${a}
|
|
124
|
+
.${e}-cap-ref {
|
|
125
|
+
position: absolute;
|
|
126
|
+
visibility: hidden;
|
|
127
|
+
pointer-events: none;
|
|
128
|
+
white-space: nowrap;
|
|
129
|
+
left: -9999px;
|
|
130
|
+
top: 0;
|
|
131
|
+
}
|
|
132
|
+
`}const qt=30,we=3,Lt=12,Ft=96,Ve=3,ce=.72,Tt=100,_t=10,Wt=e=>e/Tt,Nt=e=>Math.max(0,e)/_t,jt=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")},Bt=(e,r)=>Array.from({length:r*e.length},(o,c)=>e[c%e.length]),U={ctx:void 0},Ht=()=>U.ctx!==void 0?U.ctx:typeof document>"u"?(U.ctx=null,U.ctx):(U.ctx=document.createElement("canvas").getContext("2d"),U.ctx),Ot=(e,r,o,c)=>{e.style.transform=`translate3d(${r}px, ${o}px, 0) rotate(${c}deg)`},Ye=e=>{e.style.transform=""},Pt=e=>{if(!e||e==="none")return 0;try{return new DOMMatrixReadOnly(e).m41}catch{return 0}},zt=(e,r)=>{const o=(c,a)=>{if(!c||c===r)return a;const m=a+c.offsetLeft,u=c.offsetParent;return!u||u===c?m:o(u,m)};return o(e,e.offsetWidth/2)},Ke=96,Qe=(e,r,o)=>{if(r<=0||Math.abs(e)<=0||o<2)return null;const c=2*Math.PI/r,a=new Float64Array(o+1),m=new Float64Array(o+1),u=e*r,l=d=>Math.sqrt(1+(u*Math.cos(r*d))**2),$=c/o;return Array.from({length:o},(d,R)=>{const v=R*$,E=v+$;a[R+1]=E,m[R+1]=m[R]+(l(v)+l(E))*.5*$}),{wavelength:c,periodArc:m[o],x:a,s:m}},Dt=(e,r)=>{const o=Qe(e,r,Ke);return!o||o.wavelength<=0?1:o.periodArc/o.wavelength},It=(e,r)=>{if(e.periodArc<=0)return r;const o=r<0?-1:1,c=Math.abs(r),a=Math.floor(c/e.periodArc),m=c-a*e.periodArc,{s:u,x:l}=e,$=(q,S)=>{if(S-q<=1)return[q,S];const L=q+S>>1;return u[L]<=m?$(L,S):$(q,L)},[d,R]=$(0,u.length-1),v=u[R]-u[d],E=v>0?(m-u[d])/v:0;return o*(a*e.wavelength+l[d]+(l[R]-l[d])*E)},Ut=(e,r,o,c,a=0)=>{const m=Math.max(0,o),u=e>0?2*Math.PI*m/e:0,l=S=>c+r*Math.sin(u*S),$=S=>r*u*Math.cos(u*S),d=-a,v=e+a-d,E=Math.max(4,Math.ceil(m*4*(v/Math.max(e,1)))),q=Array.from({length:E},(S,L)=>{const W=d+L/E*v,F=d+(L+1)/E*v,j=F-W,J=l(W),X=l(F),Z=W+j/3,ee=J+$(W)*j/3,ue=F-j/3,te=X-$(F)*j/3;return`C${Z.toFixed(2)} ${ee.toFixed(2)} ${ue.toFixed(2)} ${te.toFixed(2)} ${F.toFixed(2)} ${X.toFixed(2)}`});return[`M${d.toFixed(2)} ${l(d).toFixed(2)}`,...q].join(" ")},Xt=({item:e,prefix:r,textCss:o,capHeightPx:c,opticalOffsetY:a,imageGapPx:m,isCurve:u})=>{var q;const l=a!==0?{...o,transform:`translateY(${a}px)`}:o,$=c>0?{height:`${c}px`}:{fontSize:o.fontSize,height:`${ce}em`},d=((q=e.image)==null?void 0:q.assetId)&&f.jsx("img",{src:e.image.assetId,alt:e.image.name??"",className:`${r}-item-image`,style:$}),R=d&&(u?f.jsx("span",{className:`${r}-item-image-wrap`,"data-marquee-wave-node":!0,children:d}):d),v=u?f.jsx("span",{className:`${r}-text`,style:l,children:Array.from(e.text).map((S,L)=>f.jsx("span",{className:`${r}-glyph`,"data-marquee-wave-node":!0,children:f.jsx("span",{className:`${r}-glyph-inner`,children:S===" "?" ":S})},L))}):f.jsx("span",{className:`${r}-text`,style:l,children:e.text}),E=f.jsxs(f.Fragment,{children:[R,v]});return f.jsx("div",{className:`${r}-item`,"data-marquee-text-item":!0,style:{gap:m},children:e.link?f.jsx("a",{href:e.link,className:`${r}-item-link`,style:{gap:m},children:E}):E})},Vt=({settings:e,content:r,isEditor:o,isPreviewMode:c})=>{const{prefix:a}=Mt.useScopedStyles(),[m,u]=s.useState(0),l=m>0?Math.round(m):0,{speed:$,direction:d,pauseOnHover:R,gap:v,layoutType:E,curveAmplitude:q,curveFrequency:S,textFontFamily:L,textFontSettings:W,textFontSize:F,textLetterSpacing:j,textWordSpacing:J,textTextAppearance:X,textColor:Z,backgroundColor:ee,ribbonWidth:ue}=e,te=ue??F,b=E==="curve",P=Wt(q),V=Nt(S),Ge=s.useMemo(()=>kt(a,l,b),[a,l,b]),B=s.useMemo(()=>Ct.textStylesToCss({fontSettings:{fontFamily:L,fontWeight:W.fontWeight,fontStyle:W.fontStyle},letterSpacing:j,wordSpacing:J,fontSize:F,lineHeight:F,textAppearance:X,color:Z},o),[L,W,j,J,F,X,Z,o]),ne=t=>Et.scalingValue(t,o??!1),H=((r==null?void 0:r.length)??0)>0,Y=o?!!c:!0,O=H&&(Y||!!o),re=Math.max(0,$)*qt,le=Y&&R==="on",[Je,$e]=s.useState(!1),de=Y?le&&Je?"paused":"running":"paused",fe=de==="running"&&re>0&&l>0,Ze=l>0&&re>0?l/re*1e3:0,oe=s.useRef(null),me=s.useRef(null),he=s.useRef(null),ie=s.useRef(null),Se=s.useRef(null),Ae=s.useRef(null),Ee=s.useRef(fe),K=s.useRef(null),Q=s.useRef(null),pe=s.useRef(P),ge=s.useRef(V);Ee.current=fe,pe.current=P,ge.current=V;const[z,Me]=s.useState(0),[et,Ce]=s.useState(0),[Re,ke]=s.useState(0),[G,qe]=s.useState(0),[Le,tt]=s.useState(0),se=s.useMemo(()=>(r??[]).map(t=>{var i;return`${t.text}\0${((i=t.image)==null?void 0:i.assetId)??""}\0${t.link??""}`}).join("\0"),[r]),[D,Fe]=s.useState(we),nt=s.useMemo(()=>{const t=r??[];return t.length===0||!(Y||o)?t:Bt(t,D)},[r,Y,D,o]),rt=O?Ve:1;s.useLayoutEffect(()=>{Fe(we),u(0)},[se]),s.useLayoutEffect(()=>{var y;const t=Ae.current;if(!t)return;const i=()=>{const p=getComputedStyle(t),g=parseFloat(p.fontSize)||0;if(g<=0)return;const h=Ht();if(!h){Me(g*ce),Ce(0);return}h.font=`${p.fontStyle} ${p.fontWeight} ${g}px ${p.fontFamily}`;const M=h.measureText("H"),T=M.actualBoundingBoxAscent>0?M.actualBoundingBoxAscent:g*ce,N=Math.max(0,M.actualBoundingBoxDescent||0),k=M.fontBoundingBoxAscent||0,C=M.fontBoundingBoxDescent||0;Me(x=>Math.abs(x-T)>.5?T:x);const A=k>0||C>0?(C-N-(k-T))/2:0;Ce(x=>Math.abs(x-A)>.25?A:x)};i();const n=typeof document<"u"?document.fonts:void 0;(y=n==null?void 0:n.ready)==null||y.then(i).catch(()=>{});const w=new ResizeObserver(i);return w.observe(t),()=>w.disconnect()},[B.fontFamily,B.fontWeight,B.fontStyle,B.fontSize,B.lineHeight]),s.useLayoutEffect(()=>{if(!O)return;const t=oe.current,i=ie.current;if(!t||!i)return;const n={id:0},w=()=>{const h=t.offsetWidth||t.getBoundingClientRect().width,M=i.offsetWidth||i.getBoundingClientRect().width;if(H&&h>0&&M>0){const T=M/D;if(T>0){let N=h,k=Lt;if(b){const A=h*pe.current,x=ge.current,I=x>0?2*Math.PI*x/h:0,_=Dt(A,I);N=Math.max(h,_*h/(Ve-1)),k=Ft}const C=Math.min(k,Math.max(we,Math.ceil(N/T)+1));if(C!==D){Fe(C);return}}}M>0&&u(M)},y=()=>{cancelAnimationFrame(n.id),n.id=requestAnimationFrame(w)};y();const p=new ResizeObserver(y);p.observe(t),p.observe(i);const g=()=>{document.hidden||y()};return document.addEventListener("visibilitychange",g),window.addEventListener("pageshow",g),window.addEventListener("focus",g),()=>{cancelAnimationFrame(n.id),p.disconnect(),document.removeEventListener("visibilitychange",g),window.removeEventListener("pageshow",g),window.removeEventListener("focus",g)}},[O,se,D,H,z,b,P,V]),s.useLayoutEffect(()=>{const t=Se.current;if(!t)return;const i={id:0},n=()=>{const y=t.offsetHeight;y>0&&tt(p=>Math.abs(p-y)>.5?y:p)};i.id=requestAnimationFrame(n);const w=new ResizeObserver(()=>{cancelAnimationFrame(i.id),i.id=requestAnimationFrame(n)});return w.observe(t),()=>{cancelAnimationFrame(i.id),w.disconnect()}},[te,o]),s.useLayoutEffect(()=>{if(!b){ke(0),qe(0);return}const t=oe.current,i=ie.current;if(!t||!i)return;const n={id:0},w=()=>{const p=t.offsetWidth,g=i.offsetHeight;p>0&&qe(h=>Math.abs(h-p)>.5?p:h),g>0&&ke(h=>Math.abs(h-g)>.5?g:h)};n.id=requestAnimationFrame(w);const y=new ResizeObserver(()=>{cancelAnimationFrame(n.id),n.id=requestAnimationFrame(w)});return y.observe(t),y.observe(i),()=>{cancelAnimationFrame(n.id),y.disconnect()}},[b,se,z,F,O]),s.useLayoutEffect(()=>{if(!O||l<=0)return;const t=he.current;t&&jt(t)},[O,l,d,re]),s.useLayoutEffect(()=>{if(!b||!H)return;const t=oe.current;if(!t)return;const i=typeof IntersectionObserver<"u",n={raf:0,cancelled:!1,isOnScreen:!i,lut:null,lutKey:"",itemsCache:[],cacheDirty:!0},w=()=>{for(const C of n.itemsCache)for(const A of C.glyphs)Ye(A.inner)},y=()=>{const C=me.current??t;n.itemsCache=Array.from(t.querySelectorAll("[data-marquee-text-item]"),A=>{const x=[];return A.querySelectorAll("[data-marquee-wave-node]").forEach(I=>{const _=I.firstElementChild;_&&x.push({inner:_,layoutLocalX:zt(I,C)})}),{item:A,glyphs:x}}),n.cacheDirty=!1},p=()=>{n.cacheDirty&&y();const A=(me.current??t).offsetWidth||1,x=A*pe.current,I=ge.current,_=2*Math.PI*I/A,Oe=`${A}|${x}|${_}`;if(Oe!==n.lutKey&&(n.lutKey=Oe,n.lut=Qe(x,_,Ke)),Math.abs(x)<=0||_<=0){w();return}const Pe=he.current,gt=Pe?Pt(getComputedStyle(Pe).transform):0,ze=t.getBoundingClientRect(),xt=ze.left,yt=ze.right,vt=n.lut&&n.lut.wavelength>0?Math.max(0,(n.lut.periodArc/n.lut.wavelength-1)*A):0;for(const{item:bt,glyphs:De}of n.itemsCache){const Ie=bt.getBoundingClientRect();if(Ie.right<xt||Ie.left>yt+vt){for(const ae of De)Ye(ae.inner);continue}for(const ae of De){const be=ae.layoutLocalX+gt,Ue=n.lut?It(n.lut,be):be,Xe=_*Ue,wt=x*Math.sin(Xe),$t=x*_*Math.cos(Xe),St=Math.atan($t)*(180/Math.PI);Ot(ae.inner,Ue-be,wt,St)}}},g=()=>{n.cancelled||(n.raf=0,p(),Ee.current&&n.isOnScreen&&!document.hidden&&(n.raf=requestAnimationFrame(g)))},h=()=>{n.cancelled||n.raf||!n.isOnScreen||(n.raf=requestAnimationFrame(g))},M=()=>{cancelAnimationFrame(n.raf),n.raf=0},T=()=>{n.cacheDirty=!0,n.isOnScreen&&(p(),h())};K.current=h,Q.current=T,p(),h();const N=i?Rt.observeIntersection(t,"0px",C=>{n.isOnScreen=C,C?T():M()}):null,k=()=>{M(),document.hidden||T()};return document.addEventListener("visibilitychange",k),window.addEventListener("pageshow",k),window.addEventListener("focus",k),()=>{n.cancelled=!0,K.current=null,Q.current=null,N==null||N(),cancelAnimationFrame(n.raf),document.removeEventListener("visibilitychange",k),window.removeEventListener("pageshow",k),window.removeEventListener("focus",k),w()}},[b,H]),s.useLayoutEffect(()=>{var t;!b||!H||(t=Q.current)==null||t.call(Q)},[b,H,m,se,D,z,P,V,G]),s.useLayoutEffect(()=>{var t;(t=K.current)==null||t.call(K)},[fe,d]);const ot=t=>{le&&t.pointerType==="mouse"&&$e(!0)},it=()=>{le&&$e(!1)},Te=b?Math.abs(P)*100:0,xe=ne(te),st={minHeight:xe,...b?{paddingTop:`${Te}%`,paddingBottom:`${Te}%`}:{}},at={height:xe,...b?{visibility:"hidden"}:{backgroundColor:ee}},_e={gap:ne(v),minHeight:xe},We=G*P,Ne=Math.abs(We),ye=Le>0?Le:Re,ve=Math.max(Re,ye),ct=Ne+ve/2,ut=Math.max(ye,1),je=b&&G>0&&ve>0?Ut(G,We,V,ct,ut):"",lt=Ne*2+ve,dt=je?f.jsx("svg",{className:`${a}-curve-bg`,viewBox:`0 0 ${G} ${lt}`,preserveAspectRatio:"none","aria-hidden":!0,children:f.jsx("path",{d:je,fill:"none",stroke:ee,strokeWidth:ye,strokeLinecap:"butt",strokeLinejoin:"round"})}):null,ft=f.jsx("div",{ref:Se,className:`${a}-ribbon`,style:at,"aria-hidden":!0}),mt={...B,lineHeight:z>0?`${z}px`:`${ce}em`},Be=(t,i,n)=>f.jsx(Xt,{item:t,prefix:a,textCss:mt,capHeightPx:z,opticalOffsetY:et,imageGapPx:ne(v),isCurve:b},`${i}-${n}`),ht=f.jsx("span",{ref:Ae,"aria-hidden":!0,className:`${a}-cap-ref`,style:B,children:"H"}),He=`${Math.max(0,Ze)/1e3}s`,pt=O?f.jsx("div",{ref:he,className:`${a}-marquee-track`,"data-direction":d,onPointerEnter:ot,onPointerLeave:it,style:{WebkitAnimationDuration:He,animationDuration:He,WebkitAnimationPlayState:de,animationPlayState:de},children:Array.from({length:rt},(t,i)=>f.jsx("div",{ref:i===0?ie:void 0,className:`${a}-marquee-set`,style:{..._e,paddingRight:ne(v)},"aria-hidden":i>0,children:nt.map((n,w)=>Be(n,i,w))},`set-${i}`))}):f.jsx("div",{ref:ie,className:At(`${a}-marquee-set`,`${a}-marquee-static`),style:_e,children:r==null?void 0:r.map((t,i)=>Be(t,0,i))});return f.jsxs("div",{ref:oe,className:`${a}-wrapper`,"aria-label":"Marquee text",children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:Ge}}),ht,f.jsxs("div",{ref:me,className:`${a}-marquee-wrapper`,style:st,children:[ft,dt,pt]})]})};exports.MarqueeText=Vt;
|
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
import { jsx as g, jsxs as Ce, Fragment as Et } from "react/jsx-runtime";
|
|
2
|
+
import { useState as H, useMemo as ue, useRef as L, useLayoutEffect as W } from "react";
|
|
3
|
+
import Rt from "classnames";
|
|
4
|
+
import { s as qt } from "./scalingValue-C9JH5L6O.mjs";
|
|
5
|
+
import { u as Ft } from "./useScopedStyles-DhBG3557.mjs";
|
|
6
|
+
import { t as Lt } from "./textStylesToCss-05Mn6I_2.mjs";
|
|
7
|
+
import { o as Tt } from "./observeIntersection-B0f3L2iK.mjs";
|
|
8
|
+
function _t(e, r, o) {
|
|
9
|
+
const s = r > 0 ? `${r}px` : "0px", a = o ? `
|
|
10
|
+
.${e}-item-image-wrap {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex: 0 0 auto;
|
|
13
|
+
align-items: center;
|
|
14
|
+
}
|
|
15
|
+
.${e}-glyph {
|
|
16
|
+
display: inline-block;
|
|
17
|
+
}
|
|
18
|
+
.${e}-glyph-inner {
|
|
19
|
+
display: inline-block;
|
|
20
|
+
transform-origin: 50% 50%;
|
|
21
|
+
backface-visibility: hidden;
|
|
22
|
+
-webkit-backface-visibility: hidden;
|
|
23
|
+
}
|
|
24
|
+
.${e}-item-image {
|
|
25
|
+
transform-origin: 50% 50%;
|
|
26
|
+
backface-visibility: hidden;
|
|
27
|
+
-webkit-backface-visibility: hidden;
|
|
28
|
+
}
|
|
29
|
+
` : "";
|
|
30
|
+
return `
|
|
31
|
+
.${e}-wrapper {
|
|
32
|
+
position: relative;
|
|
33
|
+
width: 100%;
|
|
34
|
+
height: auto;
|
|
35
|
+
}
|
|
36
|
+
.${e}-marquee-wrapper {
|
|
37
|
+
position: relative;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
overflow-x: clip;
|
|
40
|
+
overflow-y: visible;
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: auto;
|
|
43
|
+
}
|
|
44
|
+
.${e}-curve-bg {
|
|
45
|
+
position: absolute;
|
|
46
|
+
left: 0;
|
|
47
|
+
top: 0;
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: 100%;
|
|
50
|
+
overflow: visible;
|
|
51
|
+
pointer-events: none;
|
|
52
|
+
z-index: 0;
|
|
53
|
+
}
|
|
54
|
+
.${e}-ribbon {
|
|
55
|
+
position: absolute;
|
|
56
|
+
left: 0;
|
|
57
|
+
top: 50%;
|
|
58
|
+
width: 100%;
|
|
59
|
+
transform: translateY(-50%);
|
|
60
|
+
pointer-events: none;
|
|
61
|
+
z-index: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@keyframes ${e}-marquee-left {
|
|
65
|
+
from { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }
|
|
66
|
+
to { -webkit-transform: translate3d(-${s}, 0, 0); transform: translate3d(-${s}, 0, 0); }
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@keyframes ${e}-marquee-right {
|
|
70
|
+
from { -webkit-transform: translate3d(-${s}, 0, 0); transform: translate3d(-${s}, 0, 0); }
|
|
71
|
+
to { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.${e}-marquee-track {
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-direction: row;
|
|
77
|
+
width: max-content;
|
|
78
|
+
backface-visibility: hidden;
|
|
79
|
+
-webkit-backface-visibility: hidden;
|
|
80
|
+
flex-wrap: nowrap;
|
|
81
|
+
-webkit-animation-timing-function: linear;
|
|
82
|
+
animation-timing-function: linear;
|
|
83
|
+
-webkit-animation-iteration-count: infinite;
|
|
84
|
+
animation-iteration-count: infinite;
|
|
85
|
+
position: relative;
|
|
86
|
+
z-index: 1;
|
|
87
|
+
}
|
|
88
|
+
.${e}-marquee-track[data-direction="left"] {
|
|
89
|
+
-webkit-animation-name: ${e}-marquee-left;
|
|
90
|
+
animation-name: ${e}-marquee-left;
|
|
91
|
+
}
|
|
92
|
+
.${e}-marquee-track[data-direction="right"] {
|
|
93
|
+
-webkit-animation-name: ${e}-marquee-right;
|
|
94
|
+
animation-name: ${e}-marquee-right;
|
|
95
|
+
}
|
|
96
|
+
.${e}-marquee-set {
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-direction: row;
|
|
99
|
+
align-items: center;
|
|
100
|
+
flex: 0 0 auto;
|
|
101
|
+
position: relative;
|
|
102
|
+
z-index: 1;
|
|
103
|
+
}
|
|
104
|
+
.${e}-marquee-static {
|
|
105
|
+
justify-content: center;
|
|
106
|
+
overflow-x: auto;
|
|
107
|
+
}
|
|
108
|
+
.${e}-item {
|
|
109
|
+
position: relative;
|
|
110
|
+
display: flex;
|
|
111
|
+
flex-direction: row;
|
|
112
|
+
align-items: center;
|
|
113
|
+
flex: 0 0 auto;
|
|
114
|
+
white-space: nowrap;
|
|
115
|
+
}
|
|
116
|
+
.${e}-item-link {
|
|
117
|
+
display: flex;
|
|
118
|
+
flex-direction: row;
|
|
119
|
+
align-items: center;
|
|
120
|
+
text-decoration: none;
|
|
121
|
+
color: inherit;
|
|
122
|
+
}
|
|
123
|
+
.${e}-item-image {
|
|
124
|
+
display: block;
|
|
125
|
+
width: auto;
|
|
126
|
+
flex: 0 0 auto;
|
|
127
|
+
object-fit: contain;
|
|
128
|
+
}
|
|
129
|
+
.${e}-text {
|
|
130
|
+
display: inline-block;
|
|
131
|
+
}
|
|
132
|
+
${a}
|
|
133
|
+
.${e}-cap-ref {
|
|
134
|
+
position: absolute;
|
|
135
|
+
visibility: hidden;
|
|
136
|
+
pointer-events: none;
|
|
137
|
+
white-space: nowrap;
|
|
138
|
+
left: -9999px;
|
|
139
|
+
top: 0;
|
|
140
|
+
}
|
|
141
|
+
`;
|
|
142
|
+
}
|
|
143
|
+
const Wt = 30, Se = 3, Nt = 12, Bt = 96, Ge = 3, de = 0.72, Ht = 100, Ot = 10, zt = (e) => e / Ht, Pt = (e) => Math.max(0, e) / Ot, Dt = (e) => {
|
|
144
|
+
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");
|
|
145
|
+
}, It = (e, r) => Array.from({ length: r * e.length }, (o, s) => e[s % e.length]), j = { ctx: void 0 }, Ut = () => j.ctx !== void 0 ? j.ctx : typeof document > "u" ? (j.ctx = null, j.ctx) : (j.ctx = document.createElement("canvas").getContext("2d"), j.ctx), Xt = (e, r, o, s) => {
|
|
146
|
+
e.style.transform = `translate3d(${r}px, ${o}px, 0) rotate(${s}deg)`;
|
|
147
|
+
}, Je = (e) => {
|
|
148
|
+
e.style.transform = "";
|
|
149
|
+
}, Vt = (e) => {
|
|
150
|
+
if (!e || e === "none") return 0;
|
|
151
|
+
try {
|
|
152
|
+
return new DOMMatrixReadOnly(e).m41;
|
|
153
|
+
} catch {
|
|
154
|
+
return 0;
|
|
155
|
+
}
|
|
156
|
+
}, jt = (e, r) => {
|
|
157
|
+
const o = (s, a) => {
|
|
158
|
+
if (!s || s === r) return a;
|
|
159
|
+
const d = a + s.offsetLeft, c = s.offsetParent;
|
|
160
|
+
return !c || c === s ? d : o(c, d);
|
|
161
|
+
};
|
|
162
|
+
return o(e, e.offsetWidth / 2);
|
|
163
|
+
}, Ze = 96, et = (e, r, o) => {
|
|
164
|
+
if (r <= 0 || Math.abs(e) <= 0 || o < 2) return null;
|
|
165
|
+
const s = 2 * Math.PI / r, a = new Float64Array(o + 1), d = new Float64Array(o + 1), c = e * r, l = (u) => Math.sqrt(1 + (c * Math.cos(r * u)) ** 2), w = s / o;
|
|
166
|
+
return Array.from({ length: o }, (u, k) => {
|
|
167
|
+
const x = k * w, S = x + w;
|
|
168
|
+
a[k + 1] = S, d[k + 1] = d[k] + (l(x) + l(S)) * 0.5 * w;
|
|
169
|
+
}), { wavelength: s, periodArc: d[o], x: a, s: d };
|
|
170
|
+
}, Yt = (e, r) => {
|
|
171
|
+
const o = et(e, r, Ze);
|
|
172
|
+
return !o || o.wavelength <= 0 ? 1 : o.periodArc / o.wavelength;
|
|
173
|
+
}, Kt = (e, r) => {
|
|
174
|
+
if (e.periodArc <= 0) return r;
|
|
175
|
+
const o = r < 0 ? -1 : 1, s = Math.abs(r), a = Math.floor(s / e.periodArc), d = s - a * e.periodArc, { s: c, x: l } = e, w = (R, $) => {
|
|
176
|
+
if ($ - R <= 1) return [R, $];
|
|
177
|
+
const q = R + $ >> 1;
|
|
178
|
+
return c[q] <= d ? w(q, $) : w(R, q);
|
|
179
|
+
}, [u, k] = w(0, c.length - 1), x = c[k] - c[u], S = x > 0 ? (d - c[u]) / x : 0;
|
|
180
|
+
return o * (a * e.wavelength + l[u] + (l[k] - l[u]) * S);
|
|
181
|
+
}, Qt = (e, r, o, s, a = 0) => {
|
|
182
|
+
const d = Math.max(0, o), c = e > 0 ? 2 * Math.PI * d / e : 0, l = ($) => s + r * Math.sin(c * $), w = ($) => r * c * Math.cos(c * $), u = -a, x = e + a - u, S = Math.max(4, Math.ceil(d * 4 * (x / Math.max(e, 1)))), R = Array.from({ length: S }, ($, q) => {
|
|
183
|
+
const N = u + q / S * x, F = u + (q + 1) / S * x, O = F - N, ee = l(N), Y = l(F), te = N + O / 3, ne = ee + w(N) * O / 3, me = F - O / 3, re = Y - w(F) * O / 3;
|
|
184
|
+
return `C${te.toFixed(2)} ${ne.toFixed(2)} ${me.toFixed(2)} ${re.toFixed(2)} ${F.toFixed(2)} ${Y.toFixed(2)}`;
|
|
185
|
+
});
|
|
186
|
+
return [`M${u.toFixed(2)} ${l(u).toFixed(2)}`, ...R].join(" ");
|
|
187
|
+
}, Gt = ({ item: e, prefix: r, textCss: o, capHeightPx: s, opticalOffsetY: a, imageGapPx: d, isCurve: c }) => {
|
|
188
|
+
var R;
|
|
189
|
+
const l = a !== 0 ? { ...o, transform: `translateY(${a}px)` } : o, w = s > 0 ? { height: `${s}px` } : { fontSize: o.fontSize, height: `${de}em` }, u = ((R = e.image) == null ? void 0 : R.assetId) && /* @__PURE__ */ g(
|
|
190
|
+
"img",
|
|
191
|
+
{
|
|
192
|
+
src: e.image.assetId,
|
|
193
|
+
alt: e.image.name ?? "",
|
|
194
|
+
className: `${r}-item-image`,
|
|
195
|
+
style: w
|
|
196
|
+
}
|
|
197
|
+
), k = u && (c ? /* @__PURE__ */ g("span", { className: `${r}-item-image-wrap`, "data-marquee-wave-node": !0, children: u }) : u), x = c ? /* @__PURE__ */ g("span", { className: `${r}-text`, style: l, children: Array.from(e.text).map(($, q) => /* @__PURE__ */ g("span", { className: `${r}-glyph`, "data-marquee-wave-node": !0, children: /* @__PURE__ */ g("span", { className: `${r}-glyph-inner`, children: $ === " " ? " " : $ }) }, q)) }) : /* @__PURE__ */ g("span", { className: `${r}-text`, style: l, children: e.text }), S = /* @__PURE__ */ Ce(Et, { children: [
|
|
198
|
+
k,
|
|
199
|
+
x
|
|
200
|
+
] });
|
|
201
|
+
return /* @__PURE__ */ g("div", { className: `${r}-item`, "data-marquee-text-item": !0, style: { gap: d }, children: e.link ? /* @__PURE__ */ g("a", { href: e.link, className: `${r}-item-link`, style: { gap: d }, children: S }) : S });
|
|
202
|
+
}, an = ({ settings: e, content: r, isEditor: o, isPreviewMode: s }) => {
|
|
203
|
+
const { prefix: a } = Ft(), [d, c] = H(0), l = d > 0 ? Math.round(d) : 0, {
|
|
204
|
+
speed: w,
|
|
205
|
+
direction: u,
|
|
206
|
+
pauseOnHover: k,
|
|
207
|
+
gap: x,
|
|
208
|
+
layoutType: S,
|
|
209
|
+
curveAmplitude: R,
|
|
210
|
+
curveFrequency: $,
|
|
211
|
+
textFontFamily: q,
|
|
212
|
+
textFontSettings: N,
|
|
213
|
+
textFontSize: F,
|
|
214
|
+
textLetterSpacing: O,
|
|
215
|
+
textWordSpacing: ee,
|
|
216
|
+
textTextAppearance: Y,
|
|
217
|
+
textColor: te,
|
|
218
|
+
backgroundColor: ne,
|
|
219
|
+
ribbonWidth: me
|
|
220
|
+
} = e, re = me ?? F, y = S === "curve", I = zt(R), K = Pt($), tt = ue(() => _t(a, l, y), [a, l, y]), z = ue(() => Lt({
|
|
221
|
+
fontSettings: {
|
|
222
|
+
fontFamily: q,
|
|
223
|
+
fontWeight: N.fontWeight,
|
|
224
|
+
fontStyle: N.fontStyle
|
|
225
|
+
},
|
|
226
|
+
letterSpacing: O,
|
|
227
|
+
wordSpacing: ee,
|
|
228
|
+
fontSize: F,
|
|
229
|
+
lineHeight: F,
|
|
230
|
+
textAppearance: Y,
|
|
231
|
+
color: te
|
|
232
|
+
}, o), [q, N, O, ee, F, Y, te, o]), oe = (t) => qt(t, o ?? !1), P = ((r == null ? void 0 : r.length) ?? 0) > 0, Q = o ? !!s : !0, D = P && (Q || !!o), ie = Math.max(0, w) * Wt, fe = Q && k === "on", [nt, Me] = H(!1), he = Q ? fe && nt ? "paused" : "running" : "paused", pe = he === "running" && ie > 0 && l > 0, rt = l > 0 && ie > 0 ? l / ie * 1e3 : 0, ae = L(null), ge = L(null), ve = L(null), se = L(null), ke = L(null), Ee = L(null), Re = L(pe), G = L(null), J = L(null), xe = L(I), ye = L(K);
|
|
233
|
+
Re.current = pe, xe.current = I, ye.current = K;
|
|
234
|
+
const [U, qe] = H(0), [ot, Fe] = H(0), [Le, Te] = H(0), [Z, _e] = H(0), [We, it] = H(0), ce = ue(
|
|
235
|
+
() => (r ?? []).map((t) => {
|
|
236
|
+
var i;
|
|
237
|
+
return `${t.text}\0${((i = t.image) == null ? void 0 : i.assetId) ?? ""}\0${t.link ?? ""}`;
|
|
238
|
+
}).join("\0"),
|
|
239
|
+
[r]
|
|
240
|
+
), [X, Ne] = H(Se), at = ue(() => {
|
|
241
|
+
const t = r ?? [];
|
|
242
|
+
return t.length === 0 || !(Q || o) ? t : It(t, X);
|
|
243
|
+
}, [r, Q, X, o]), st = D ? Ge : 1;
|
|
244
|
+
W(() => {
|
|
245
|
+
Ne(Se), c(0);
|
|
246
|
+
}, [ce]), W(() => {
|
|
247
|
+
var v;
|
|
248
|
+
const t = Ee.current;
|
|
249
|
+
if (!t) return;
|
|
250
|
+
const i = () => {
|
|
251
|
+
const f = getComputedStyle(t), h = parseFloat(f.fontSize) || 0;
|
|
252
|
+
if (h <= 0) return;
|
|
253
|
+
const m = Ut();
|
|
254
|
+
if (!m) {
|
|
255
|
+
qe(h * de), Fe(0);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
m.font = `${f.fontStyle} ${f.fontWeight} ${h}px ${f.fontFamily}`;
|
|
259
|
+
const C = m.measureText("H"), T = C.actualBoundingBoxAscent > 0 ? C.actualBoundingBoxAscent : h * de, B = Math.max(0, C.actualBoundingBoxDescent || 0), E = C.fontBoundingBoxAscent || 0, M = C.fontBoundingBoxDescent || 0;
|
|
260
|
+
qe((p) => Math.abs(p - T) > 0.5 ? T : p);
|
|
261
|
+
const A = E > 0 || M > 0 ? (M - B - (E - T)) / 2 : 0;
|
|
262
|
+
Fe((p) => Math.abs(p - A) > 0.25 ? A : p);
|
|
263
|
+
};
|
|
264
|
+
i();
|
|
265
|
+
const n = typeof document < "u" ? document.fonts : void 0;
|
|
266
|
+
(v = n == null ? void 0 : n.ready) == null || v.then(i).catch(() => {
|
|
267
|
+
});
|
|
268
|
+
const b = new ResizeObserver(i);
|
|
269
|
+
return b.observe(t), () => b.disconnect();
|
|
270
|
+
}, [z.fontFamily, z.fontWeight, z.fontStyle, z.fontSize, z.lineHeight]), W(() => {
|
|
271
|
+
if (!D) return;
|
|
272
|
+
const t = ae.current, i = se.current;
|
|
273
|
+
if (!t || !i) return;
|
|
274
|
+
const n = { id: 0 }, b = () => {
|
|
275
|
+
const m = t.offsetWidth || t.getBoundingClientRect().width, C = i.offsetWidth || i.getBoundingClientRect().width;
|
|
276
|
+
if (P && m > 0 && C > 0) {
|
|
277
|
+
const T = C / X;
|
|
278
|
+
if (T > 0) {
|
|
279
|
+
let B = m, E = Nt;
|
|
280
|
+
if (y) {
|
|
281
|
+
const A = m * xe.current, p = ye.current, V = p > 0 ? 2 * Math.PI * p / m : 0, _ = Yt(A, V);
|
|
282
|
+
B = Math.max(m, _ * m / (Ge - 1)), E = Bt;
|
|
283
|
+
}
|
|
284
|
+
const M = Math.min(
|
|
285
|
+
E,
|
|
286
|
+
Math.max(Se, Math.ceil(B / T) + 1)
|
|
287
|
+
);
|
|
288
|
+
if (M !== X) {
|
|
289
|
+
Ne(M);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
C > 0 && c(C);
|
|
295
|
+
}, v = () => {
|
|
296
|
+
cancelAnimationFrame(n.id), n.id = requestAnimationFrame(b);
|
|
297
|
+
};
|
|
298
|
+
v();
|
|
299
|
+
const f = new ResizeObserver(v);
|
|
300
|
+
f.observe(t), f.observe(i);
|
|
301
|
+
const h = () => {
|
|
302
|
+
document.hidden || v();
|
|
303
|
+
};
|
|
304
|
+
return document.addEventListener("visibilitychange", h), window.addEventListener("pageshow", h), window.addEventListener("focus", h), () => {
|
|
305
|
+
cancelAnimationFrame(n.id), f.disconnect(), document.removeEventListener("visibilitychange", h), window.removeEventListener("pageshow", h), window.removeEventListener("focus", h);
|
|
306
|
+
};
|
|
307
|
+
}, [D, ce, X, P, U, y, I, K]), W(() => {
|
|
308
|
+
const t = ke.current;
|
|
309
|
+
if (!t) return;
|
|
310
|
+
const i = { id: 0 }, n = () => {
|
|
311
|
+
const v = t.offsetHeight;
|
|
312
|
+
v > 0 && it((f) => Math.abs(f - v) > 0.5 ? v : f);
|
|
313
|
+
};
|
|
314
|
+
i.id = requestAnimationFrame(n);
|
|
315
|
+
const b = new ResizeObserver(() => {
|
|
316
|
+
cancelAnimationFrame(i.id), i.id = requestAnimationFrame(n);
|
|
317
|
+
});
|
|
318
|
+
return b.observe(t), () => {
|
|
319
|
+
cancelAnimationFrame(i.id), b.disconnect();
|
|
320
|
+
};
|
|
321
|
+
}, [re, o]), W(() => {
|
|
322
|
+
if (!y) {
|
|
323
|
+
Te(0), _e(0);
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
const t = ae.current, i = se.current;
|
|
327
|
+
if (!t || !i) return;
|
|
328
|
+
const n = { id: 0 }, b = () => {
|
|
329
|
+
const f = t.offsetWidth, h = i.offsetHeight;
|
|
330
|
+
f > 0 && _e((m) => Math.abs(m - f) > 0.5 ? f : m), h > 0 && Te((m) => Math.abs(m - h) > 0.5 ? h : m);
|
|
331
|
+
};
|
|
332
|
+
n.id = requestAnimationFrame(b);
|
|
333
|
+
const v = new ResizeObserver(() => {
|
|
334
|
+
cancelAnimationFrame(n.id), n.id = requestAnimationFrame(b);
|
|
335
|
+
});
|
|
336
|
+
return v.observe(t), v.observe(i), () => {
|
|
337
|
+
cancelAnimationFrame(n.id), v.disconnect();
|
|
338
|
+
};
|
|
339
|
+
}, [y, ce, U, F, D]), W(() => {
|
|
340
|
+
if (!D || l <= 0) return;
|
|
341
|
+
const t = ve.current;
|
|
342
|
+
t && Dt(t);
|
|
343
|
+
}, [D, l, u, ie]), W(() => {
|
|
344
|
+
if (!y || !P) return;
|
|
345
|
+
const t = ae.current;
|
|
346
|
+
if (!t) return;
|
|
347
|
+
const i = typeof IntersectionObserver < "u", n = {
|
|
348
|
+
raf: 0,
|
|
349
|
+
cancelled: !1,
|
|
350
|
+
isOnScreen: !i,
|
|
351
|
+
lut: null,
|
|
352
|
+
lutKey: "",
|
|
353
|
+
itemsCache: [],
|
|
354
|
+
cacheDirty: !0
|
|
355
|
+
}, b = () => {
|
|
356
|
+
for (const M of n.itemsCache)
|
|
357
|
+
for (const A of M.glyphs) Je(A.inner);
|
|
358
|
+
}, v = () => {
|
|
359
|
+
const M = ge.current ?? t;
|
|
360
|
+
n.itemsCache = Array.from(
|
|
361
|
+
t.querySelectorAll("[data-marquee-text-item]"),
|
|
362
|
+
(A) => {
|
|
363
|
+
const p = [];
|
|
364
|
+
return A.querySelectorAll("[data-marquee-wave-node]").forEach((V) => {
|
|
365
|
+
const _ = V.firstElementChild;
|
|
366
|
+
_ && p.push({
|
|
367
|
+
inner: _,
|
|
368
|
+
layoutLocalX: jt(V, M)
|
|
369
|
+
});
|
|
370
|
+
}), { item: A, glyphs: p };
|
|
371
|
+
}
|
|
372
|
+
), n.cacheDirty = !1;
|
|
373
|
+
}, f = () => {
|
|
374
|
+
n.cacheDirty && v();
|
|
375
|
+
const A = (ge.current ?? t).offsetWidth || 1, p = A * xe.current, V = ye.current, _ = 2 * Math.PI * V / A, Ue = `${A}|${p}|${_}`;
|
|
376
|
+
if (Ue !== n.lutKey && (n.lutKey = Ue, n.lut = et(p, _, Ze)), Math.abs(p) <= 0 || _ <= 0) {
|
|
377
|
+
b();
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
const Xe = ve.current, bt = Xe ? Vt(getComputedStyle(Xe).transform) : 0, Ve = t.getBoundingClientRect(), wt = Ve.left, $t = Ve.right, At = n.lut && n.lut.wavelength > 0 ? Math.max(0, (n.lut.periodArc / n.lut.wavelength - 1) * A) : 0;
|
|
381
|
+
for (const { item: St, glyphs: je } of n.itemsCache) {
|
|
382
|
+
const Ye = St.getBoundingClientRect();
|
|
383
|
+
if (Ye.right < wt || Ye.left > $t + At) {
|
|
384
|
+
for (const le of je) Je(le.inner);
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
for (const le of je) {
|
|
388
|
+
const Ae = le.layoutLocalX + bt, Ke = n.lut ? Kt(n.lut, Ae) : Ae, Qe = _ * Ke, Ct = p * Math.sin(Qe), Mt = p * _ * Math.cos(Qe), kt = Math.atan(Mt) * (180 / Math.PI);
|
|
389
|
+
Xt(le.inner, Ke - Ae, Ct, kt);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}, h = () => {
|
|
393
|
+
n.cancelled || (n.raf = 0, f(), Re.current && n.isOnScreen && !document.hidden && (n.raf = requestAnimationFrame(h)));
|
|
394
|
+
}, m = () => {
|
|
395
|
+
n.cancelled || n.raf || !n.isOnScreen || (n.raf = requestAnimationFrame(h));
|
|
396
|
+
}, C = () => {
|
|
397
|
+
cancelAnimationFrame(n.raf), n.raf = 0;
|
|
398
|
+
}, T = () => {
|
|
399
|
+
n.cacheDirty = !0, n.isOnScreen && (f(), m());
|
|
400
|
+
};
|
|
401
|
+
G.current = m, J.current = T, f(), m();
|
|
402
|
+
const B = i ? Tt(t, "0px", (M) => {
|
|
403
|
+
n.isOnScreen = M, M ? T() : C();
|
|
404
|
+
}) : null, E = () => {
|
|
405
|
+
C(), document.hidden || T();
|
|
406
|
+
};
|
|
407
|
+
return document.addEventListener("visibilitychange", E), window.addEventListener("pageshow", E), window.addEventListener("focus", E), () => {
|
|
408
|
+
n.cancelled = !0, G.current = null, J.current = null, B == null || B(), cancelAnimationFrame(n.raf), document.removeEventListener("visibilitychange", E), window.removeEventListener("pageshow", E), window.removeEventListener("focus", E), b();
|
|
409
|
+
};
|
|
410
|
+
}, [y, P]), W(() => {
|
|
411
|
+
var t;
|
|
412
|
+
!y || !P || (t = J.current) == null || t.call(J);
|
|
413
|
+
}, [y, P, d, ce, X, U, I, K, Z]), W(() => {
|
|
414
|
+
var t;
|
|
415
|
+
(t = G.current) == null || t.call(G);
|
|
416
|
+
}, [pe, u]);
|
|
417
|
+
const ct = (t) => {
|
|
418
|
+
fe && t.pointerType === "mouse" && Me(!0);
|
|
419
|
+
}, lt = () => {
|
|
420
|
+
fe && Me(!1);
|
|
421
|
+
}, Be = y ? Math.abs(I) * 100 : 0, be = oe(re), ut = {
|
|
422
|
+
minHeight: be,
|
|
423
|
+
...y ? { paddingTop: `${Be}%`, paddingBottom: `${Be}%` } : {}
|
|
424
|
+
}, dt = {
|
|
425
|
+
height: be,
|
|
426
|
+
...y ? { visibility: "hidden" } : { backgroundColor: ne }
|
|
427
|
+
}, He = {
|
|
428
|
+
gap: oe(x),
|
|
429
|
+
minHeight: be
|
|
430
|
+
}, Oe = Z * I, ze = Math.abs(Oe), we = We > 0 ? We : Le, $e = Math.max(Le, we), mt = ze + $e / 2, ft = Math.max(we, 1), Pe = y && Z > 0 && $e > 0 ? Qt(
|
|
431
|
+
Z,
|
|
432
|
+
Oe,
|
|
433
|
+
K,
|
|
434
|
+
mt,
|
|
435
|
+
ft
|
|
436
|
+
) : "", ht = ze * 2 + $e, pt = Pe ? /* @__PURE__ */ g(
|
|
437
|
+
"svg",
|
|
438
|
+
{
|
|
439
|
+
className: `${a}-curve-bg`,
|
|
440
|
+
viewBox: `0 0 ${Z} ${ht}`,
|
|
441
|
+
preserveAspectRatio: "none",
|
|
442
|
+
"aria-hidden": !0,
|
|
443
|
+
children: /* @__PURE__ */ g(
|
|
444
|
+
"path",
|
|
445
|
+
{
|
|
446
|
+
d: Pe,
|
|
447
|
+
fill: "none",
|
|
448
|
+
stroke: ne,
|
|
449
|
+
strokeWidth: we,
|
|
450
|
+
strokeLinecap: "butt",
|
|
451
|
+
strokeLinejoin: "round"
|
|
452
|
+
}
|
|
453
|
+
)
|
|
454
|
+
}
|
|
455
|
+
) : null, gt = /* @__PURE__ */ g("div", { ref: ke, className: `${a}-ribbon`, style: dt, "aria-hidden": !0 }), vt = {
|
|
456
|
+
...z,
|
|
457
|
+
lineHeight: U > 0 ? `${U}px` : `${de}em`
|
|
458
|
+
}, De = (t, i, n) => /* @__PURE__ */ g(
|
|
459
|
+
Gt,
|
|
460
|
+
{
|
|
461
|
+
item: t,
|
|
462
|
+
prefix: a,
|
|
463
|
+
textCss: vt,
|
|
464
|
+
capHeightPx: U,
|
|
465
|
+
opticalOffsetY: ot,
|
|
466
|
+
imageGapPx: oe(x),
|
|
467
|
+
isCurve: y
|
|
468
|
+
},
|
|
469
|
+
`${i}-${n}`
|
|
470
|
+
), xt = /* @__PURE__ */ g("span", { ref: Ee, "aria-hidden": !0, className: `${a}-cap-ref`, style: z, children: "H" }), Ie = `${Math.max(0, rt) / 1e3}s`, yt = D ? /* @__PURE__ */ g(
|
|
471
|
+
"div",
|
|
472
|
+
{
|
|
473
|
+
ref: ve,
|
|
474
|
+
className: `${a}-marquee-track`,
|
|
475
|
+
"data-direction": u,
|
|
476
|
+
onPointerEnter: ct,
|
|
477
|
+
onPointerLeave: lt,
|
|
478
|
+
style: {
|
|
479
|
+
WebkitAnimationDuration: Ie,
|
|
480
|
+
animationDuration: Ie,
|
|
481
|
+
WebkitAnimationPlayState: he,
|
|
482
|
+
animationPlayState: he
|
|
483
|
+
},
|
|
484
|
+
children: Array.from({ length: st }, (t, i) => /* @__PURE__ */ g(
|
|
485
|
+
"div",
|
|
486
|
+
{
|
|
487
|
+
ref: i === 0 ? se : void 0,
|
|
488
|
+
className: `${a}-marquee-set`,
|
|
489
|
+
style: { ...He, paddingRight: oe(x) },
|
|
490
|
+
"aria-hidden": i > 0,
|
|
491
|
+
children: at.map((n, b) => De(n, i, b))
|
|
492
|
+
},
|
|
493
|
+
`set-${i}`
|
|
494
|
+
))
|
|
495
|
+
}
|
|
496
|
+
) : /* @__PURE__ */ g(
|
|
497
|
+
"div",
|
|
498
|
+
{
|
|
499
|
+
ref: se,
|
|
500
|
+
className: Rt(`${a}-marquee-set`, `${a}-marquee-static`),
|
|
501
|
+
style: He,
|
|
502
|
+
children: r == null ? void 0 : r.map((t, i) => De(t, 0, i))
|
|
503
|
+
}
|
|
504
|
+
);
|
|
505
|
+
return /* @__PURE__ */ Ce("div", { ref: ae, className: `${a}-wrapper`, "aria-label": "Marquee text", children: [
|
|
506
|
+
/* @__PURE__ */ g("style", { dangerouslySetInnerHTML: { __html: tt } }),
|
|
507
|
+
xt,
|
|
508
|
+
/* @__PURE__ */ Ce("div", { ref: ge, className: `${a}-marquee-wrapper`, style: ut, children: [
|
|
509
|
+
gt,
|
|
510
|
+
pt,
|
|
511
|
+
yt
|
|
512
|
+
] })
|
|
513
|
+
] });
|
|
514
|
+
};
|
|
515
|
+
export {
|
|
516
|
+
an as MarqueeText
|
|
517
|
+
};
|
|
@@ -6,7 +6,7 @@ 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
|
-
import { L as Pe } from "./LazyVideo-
|
|
9
|
+
import { L as Pe } from "./LazyVideo-CdAWymKO.mjs";
|
|
10
10
|
const It = 300 / 1440, tn = 8 / 1440, st = 4e-3;
|
|
11
11
|
function en(t) {
|
|
12
12
|
return `calc(var(--cntrl-article-width, 100vw) * ${t / 1440})`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),a=require("react"),Ve=require("react-dom"),at=require("./scalingValue-CSHYgTZl.js"),_e=require("./buildColorVars-CE2D5cQV.js"),Be=require("./useScopedStyles-Bf6yohVQ.js"),wt=require("./textStylesToCss-CNN3zZTV.js"),Ge=require("./SvgImage-DFlmxAoL.js"),qe=require("./LazyVideo-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),a=require("react"),Ve=require("react-dom"),at=require("./scalingValue-CSHYgTZl.js"),_e=require("./buildColorVars-CE2D5cQV.js"),Be=require("./useScopedStyles-Bf6yohVQ.js"),wt=require("./textStylesToCss-CNN3zZTV.js"),Ge=require("./SvgImage-DFlmxAoL.js"),qe=require("./LazyVideo-imbU18js.js"),bt=300/1440,Xe=8/1440,lt=.004;function Ke(t){return`calc(var(--cntrl-article-width, 100vw) * ${t/1440})`}function Qt(t,e,o,r){return e!==void 0&&e<(t??.01)?`${o} ${r}`:o}function Pt(t,e,o,r,l="title-leading-gap"){const h=t??.01;return e===void 0||e>=h?{}:{[`--${o}-${l}`]:at.scalingValue((h-e)/2,r)}}function Ue(t){return`
|
|
2
2
|
.${t}-wrapper {
|
|
3
3
|
box-sizing: border-box;
|
|
4
4
|
display: flex;
|