@cntrl-site/components 1.0.95 → 1.0.96

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/index.js CHANGED
@@ -2524,7 +2524,6 @@ type MarqueeProps = {
2524
2524
  `:"";return`
2525
2525
  .${e}-wrapper {
2526
2526
  position: relative;
2527
- display: flow-root;
2528
2527
  width: 100%;
2529
2528
  height: auto;
2530
2529
  }
@@ -2633,7 +2632,7 @@ ${o}
2633
2632
  left: -9999px;
2634
2633
  top: 0;
2635
2634
  }
2636
- `}const Gf=30,Ja=3,Xf=12,qf=96,gc=3,sa=.72,Uf=100,Kf=10,Yf=e=>e/Uf,Zf=e=>Math.max(0,e)/Kf,Jf=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")},Qf=(e,t)=>Array.from({length:t*e.length},(n,i)=>e[i%e.length]),io={ctx:void 0},ey=()=>io.ctx!==void 0?io.ctx:typeof document>"u"?(io.ctx=null,io.ctx):(io.ctx=document.createElement("canvas").getContext("2d"),io.ctx),ty=(e,t,n,i)=>{e.style.transform=`translate3d(${t}px, ${n}px, 0) rotate(${i}deg)`},hc=e=>{e.style.transform=""},ny=e=>{if(!e||e==="none")return 0;try{return new DOMMatrixReadOnly(e).m41}catch{return 0}},iy=(e,t)=>{const n=(i,o)=>{if(!i||i===t)return o;const r=o+i.offsetLeft,l=i.offsetParent;return!l||l===i?r:n(l,r)};return n(e,e.offsetWidth/2)},Wu=96,Ou=(e,t,n)=>{if(t<=0||Math.abs(e)<=0||n<2)return null;const i=2*Math.PI/t,o=new Float64Array(n+1),r=new Float64Array(n+1),l=e*t,c=u=>Math.sqrt(1+(l*Math.cos(t*u))**2),d=i/n;return Array.from({length:n},(u,p)=>{const y=p*d,v=y+d;o[p+1]=v,r[p+1]=r[p]+(c(y)+c(v))*.5*d}),{wavelength:i,periodArc:r[n],x:o,s:r}},oy=(e,t)=>{const n=Ou(e,t,Wu);return!n||n.wavelength<=0?1:n.periodArc/n.wavelength},ry=(e,t)=>{if(e.periodArc<=0)return t;const n=t<0?-1:1,i=Math.abs(t),o=Math.floor(i/e.periodArc),r=i-o*e.periodArc,{s:l,x:c}=e,d=(m,g)=>{if(g-m<=1)return[m,g];const x=m+g>>1;return l[x]<=r?d(x,g):d(m,x)},[u,p]=d(0,l.length-1),y=l[p]-l[u],v=y>0?(r-l[u])/y:0;return n*(o*e.wavelength+c[u]+(c[p]-c[u])*v)},ay=(e,t,n,i,o=0)=>{const r=Math.max(0,n),l=e>0?2*Math.PI*r/e:0,c=g=>i+t*Math.sin(l*g),d=g=>t*l*Math.cos(l*g),u=-o,y=e+o-u,v=Math.max(4,Math.ceil(r*4*(y/Math.max(e,1)))),m=Array.from({length:v},(g,x)=>{const b=u+x/v*y,k=u+(x+1)/v*y,f=k-b,S=c(b),W=c(k),U=b+f/3,B=S+d(b)*f/3,P=k-f/3,_=W-d(k)*f/3;return`C${U.toFixed(2)} ${B.toFixed(2)} ${P.toFixed(2)} ${_.toFixed(2)} ${k.toFixed(2)} ${W.toFixed(2)}`});return[`M${u.toFixed(2)} ${c(u).toFixed(2)}`,...m].join(" ")},sy=({item:e,prefix:t,textCss:n,capHeightPx:i,opticalOffsetY:o,imageGapPx:r,isCurve:l})=>{var m;const c=o!==0?{...n,transform:`translateY(${o}px)`}:n,d=i>0?{height:`${i}px`}:{fontSize:n.fontSize,height:`${sa}em`},u=((m=e.image)==null?void 0:m.url)&&a.jsx("img",{src:e.image.url,alt:e.image.name??"",className:`${t}-item-image`,style:d}),p=u&&(l?a.jsx("span",{className:`${t}-item-image-wrap`,"data-marquee-wave-node":!0,children:u}):u),y=l?a.jsx("span",{className:`${t}-text`,style:c,children:Array.from(e.text).map((g,x)=>a.jsx("span",{className:`${t}-glyph`,"data-marquee-wave-node":!0,children:a.jsx("span",{className:`${t}-glyph-inner`,children:g===" "?" ":g})},x))}):a.jsx("span",{className:`${t}-text`,style:c,children:e.text}),v=a.jsxs(a.Fragment,{children:[p,y]});return a.jsx("div",{className:`${t}-item`,"data-marquee-text-item":!0,style:{gap:r},children:e.link?a.jsx("a",{href:e.link,className:`${t}-item-link`,style:{gap:r},children:v}):v})},ly=({settings:e,content:t,isEditor:n,isPreviewMode:i})=>{const{prefix:o}=F.useScopedStyles(),[r,l]=s.useState(0),c=r>0?Math.round(r):0,{speed:d,direction:u,pauseOnHover:p,gap:y,layoutType:v,curveAmplitude:m,curveFrequency:g,textFontFamily:x,textFontSettings:b,textFontSize:k,textLetterSpacing:f,textWordSpacing:S,textTextAppearance:W,textColor:U,backgroundColor:B,ribbonWidth:P}=e,_=P??k,G=v==="curve",$=Yf(m),L=Zf(g),D=s.useMemo(()=>Vf(o,c,G),[o,c,G]),E=s.useMemo(()=>Qt({fontSettings:{fontFamily:x,fontWeight:b.fontWeight,fontStyle:b.fontStyle},letterSpacing:f,wordSpacing:S,fontSize:k,lineHeight:k,textAppearance:W,color:U},n),[x,b,f,S,k,W,U,n]),T=Oe=>F.scalingValue(Oe,n??!1),C=((t==null?void 0:t.length)??0)>0,V=n?!!i:!0,w=C&&(V||!!n),q=Math.max(0,d)*Gf,I=V&&p==="on",[A,j]=s.useState(!1),ie=V?I&&A?"paused":"running":"paused",ae=ie==="running"&&q>0&&c>0,O=c>0&&q>0?c/q*1e3:0,oe=s.useRef(null),N=s.useRef(null),le=s.useRef(null),Q=s.useRef(null),be=s.useRef(null),Pe=s.useRef(null),ye=s.useRef(ae),ce=s.useRef(null),Y=s.useRef(null),se=s.useRef($),pe=s.useRef(L);ye.current=ae,se.current=$,pe.current=L;const[fe,we]=s.useState(0),[Re,ge]=s.useState(0),[xe,Ce]=s.useState(0),[h,K]=s.useState(0),[Z,ne]=s.useState(0),de=s.useMemo(()=>(t??[]).map(Oe=>{var Ae;return`${Oe.text}\0${((Ae=Oe.image)==null?void 0:Ae.url)??""}\0${Oe.link??""}`}).join("\0"),[t]),[z,R]=s.useState(Ja),ee=s.useMemo(()=>{const Oe=t??[];return Oe.length===0||!(V||n)?Oe:Qf(Oe,z)},[t,V,z,n]),te=w?gc:1;s.useLayoutEffect(()=>{R(Ja),l(0)},[de]),s.useLayoutEffect(()=>{var De;const Oe=Pe.current;if(!Oe)return;const Ae=()=>{const Xe=getComputedStyle(Oe),ct=parseFloat(Xe.fontSize)||0;if(ct<=0)return;const he=ey();if(!he){we(ct*sa),ge(0);return}he.font=`${Xe.fontStyle} ${Xe.fontWeight} ${ct}px ${Xe.fontFamily}`;const Ee=he.measureText("H"),nt=Ee.actualBoundingBoxAscent>0?Ee.actualBoundingBoxAscent:ct*sa,pt=Math.max(0,Ee.actualBoundingBoxDescent||0),Ve=Ee.fontBoundingBoxAscent||0,vt=Ee.fontBoundingBoxDescent||0;we(At=>Math.abs(At-nt)>.5?nt:At);const Rt=Ve>0||vt>0?(vt-pt-(Ve-nt))/2:0;ge(At=>Math.abs(At-Rt)>.25?Rt:At)};Ae();const gt=typeof document<"u"?document.fonts:void 0;(De=gt==null?void 0:gt.ready)==null||De.then(Ae).catch(()=>{});const ze=new ResizeObserver(Ae);return ze.observe(Oe),()=>ze.disconnect()},[E.fontFamily,E.fontWeight,E.fontStyle,E.fontSize,E.lineHeight]),s.useLayoutEffect(()=>{if(!w)return;const Oe=oe.current,Ae=Q.current;if(!Oe||!Ae)return;const gt={id:0},ze=()=>{const he=Oe.offsetWidth||Oe.getBoundingClientRect().width,Ee=Ae.offsetWidth||Ae.getBoundingClientRect().width;if(C&&he>0&&Ee>0){const nt=Ee/z;if(nt>0){let pt=he,Ve=Xf;if(G){const Rt=he*se.current,At=pe.current,wt=At>0?2*Math.PI*At/he:0,Vt=oy(Rt,wt);pt=Math.max(he,Vt*he/(gc-1)),Ve=qf}const vt=Math.min(Ve,Math.max(Ja,Math.ceil(pt/nt)+1));if(vt!==z){R(vt);return}}}Ee>0&&l(Ee)},De=()=>{cancelAnimationFrame(gt.id),gt.id=requestAnimationFrame(ze)};De();const Xe=new ResizeObserver(De);Xe.observe(Oe),Xe.observe(Ae);const ct=()=>{document.hidden||De()};return document.addEventListener("visibilitychange",ct),window.addEventListener("pageshow",ct),window.addEventListener("focus",ct),()=>{cancelAnimationFrame(gt.id),Xe.disconnect(),document.removeEventListener("visibilitychange",ct),window.removeEventListener("pageshow",ct),window.removeEventListener("focus",ct)}},[w,de,z,C,fe,G,$,L]),s.useLayoutEffect(()=>{const Oe=be.current;if(!Oe)return;const Ae={id:0},gt=()=>{const De=Oe.offsetHeight;De>0&&ne(Xe=>Math.abs(Xe-De)>.5?De:Xe)};Ae.id=requestAnimationFrame(gt);const ze=new ResizeObserver(()=>{cancelAnimationFrame(Ae.id),Ae.id=requestAnimationFrame(gt)});return ze.observe(Oe),()=>{cancelAnimationFrame(Ae.id),ze.disconnect()}},[_,n]),s.useLayoutEffect(()=>{if(!G){Ce(0),K(0);return}const Oe=oe.current,Ae=Q.current;if(!Oe||!Ae)return;const gt={id:0},ze=()=>{const Xe=Oe.offsetWidth,ct=Ae.offsetHeight;Xe>0&&K(he=>Math.abs(he-Xe)>.5?Xe:he),ct>0&&Ce(he=>Math.abs(he-ct)>.5?ct:he)};gt.id=requestAnimationFrame(ze);const De=new ResizeObserver(()=>{cancelAnimationFrame(gt.id),gt.id=requestAnimationFrame(ze)});return De.observe(Oe),De.observe(Ae),()=>{cancelAnimationFrame(gt.id),De.disconnect()}},[G,de,fe,k,w]),s.useLayoutEffect(()=>{if(!w||c<=0)return;const Oe=le.current;Oe&&Jf(Oe)},[w,c,u,q]),s.useLayoutEffect(()=>{if(!G||!C)return;const Oe=oe.current;if(!Oe)return;const Ae={raf:0,cancelled:!1,lut:null,lutKey:"",itemsCache:[],cacheDirty:!0},gt=()=>{for(const nt of Ae.itemsCache)for(const pt of nt.glyphs)hc(pt.inner)},ze=()=>{const nt=N.current??Oe;Ae.itemsCache=Array.from(Oe.querySelectorAll("[data-marquee-text-item]"),pt=>{const Ve=[];return pt.querySelectorAll("[data-marquee-wave-node]").forEach(vt=>{const Rt=vt.firstElementChild;Rt&&Ve.push({inner:Rt,layoutLocalX:iy(vt,nt)})}),{item:pt,glyphs:Ve}}),Ae.cacheDirty=!1},De=()=>{Ae.cacheDirty&&ze();const pt=(N.current??Oe).offsetWidth||1,Ve=pt*se.current,vt=pe.current,Rt=2*Math.PI*vt/pt,At=`${pt}|${Ve}|${Rt}`;if(At!==Ae.lutKey&&(Ae.lutKey=At,Ae.lut=Ou(Ve,Rt,Wu)),Math.abs(Ve)<=0||Rt<=0){gt();return}const wt=le.current,Vt=wt?ny(getComputedStyle(wt).transform):0,jt=Oe.getBoundingClientRect(),Kt=jt.left,Yt=jt.right,kt=Ae.lut&&Ae.lut.wavelength>0?Math.max(0,(Ae.lut.periodArc/Ae.lut.wavelength-1)*pt):0;for(const{item:Bt,glyphs:rn}of Ae.itemsCache){const xt=Bt.getBoundingClientRect();if(xt.right<Kt||xt.left>Yt+kt){for(const yt of rn)hc(yt.inner);continue}for(const yt of rn){const Me=yt.layoutLocalX+Vt,Qe=Ae.lut?ry(Ae.lut,Me):Me,rt=Rt*Qe,dt=Ve*Math.sin(rt),Pt=Ve*Rt*Math.cos(rt),St=Math.atan(Pt)*(180/Math.PI);ty(yt.inner,Qe-Me,dt,St)}}},Xe=()=>{Ae.cancelled||(Ae.raf=0,De(),ye.current&&!document.hidden&&(Ae.raf=requestAnimationFrame(Xe)))},ct=()=>{Ae.cancelled||Ae.raf||(Ae.raf=requestAnimationFrame(Xe))},he=()=>{Ae.cacheDirty=!0,De(),ct()};ce.current=ct,Y.current=he,De(),ct();const Ee=()=>{if(document.hidden){cancelAnimationFrame(Ae.raf),Ae.raf=0;return}cancelAnimationFrame(Ae.raf),Ae.raf=0,he()};return document.addEventListener("visibilitychange",Ee),window.addEventListener("pageshow",Ee),window.addEventListener("focus",Ee),()=>{Ae.cancelled=!0,ce.current=null,Y.current=null,cancelAnimationFrame(Ae.raf),document.removeEventListener("visibilitychange",Ee),window.removeEventListener("pageshow",Ee),window.removeEventListener("focus",Ee),gt()}},[G,C]),s.useLayoutEffect(()=>{var Oe;!G||!C||(Oe=Y.current)==null||Oe.call(Y)},[G,C,r,de,z,fe,$,L,h]),s.useLayoutEffect(()=>{var Oe;(Oe=ce.current)==null||Oe.call(ce)},[ae,u]);const me=Oe=>{I&&Oe.pointerType==="mouse"&&j(!0)},X=()=>{I&&j(!1)},Ie=G?Math.abs($)*100:0,Se=T(_),J={minHeight:Se,...G?{paddingTop:`${Ie}%`,paddingBottom:`${Ie}%`,marginTop:`-${Ie}%`,marginBottom:`-${Ie}%`}:{}},He={height:Se,...G?{visibility:"hidden"}:{backgroundColor:B}},We={gap:T(y),minHeight:Se},ot=h*$,qe=Math.abs(ot),tt=Z>0?Z:xe,et=Math.max(xe,tt),Ge=qe+et/2,ve=Math.max(tt,1),_e=G&&h>0&&et>0?ay(h,ot,L,Ge,ve):"",Be=qe*2+et,Ze=_e?a.jsx("svg",{className:`${o}-curve-bg`,viewBox:`0 0 ${h} ${Be}`,preserveAspectRatio:"none","aria-hidden":!0,children:a.jsx("path",{d:_e,fill:"none",stroke:B,strokeWidth:tt,strokeLinecap:"butt",strokeLinejoin:"round"})}):null,$e=a.jsx("div",{ref:be,className:`${o}-ribbon`,style:He,"aria-hidden":!0}),Ne={...E,lineHeight:fe>0?`${fe}px`:`${sa}em`},Ue=(Oe,Ae,gt)=>a.jsx(sy,{item:Oe,prefix:o,textCss:Ne,capHeightPx:fe,opticalOffsetY:Re,imageGapPx:T(y),isCurve:G},`${Ae}-${gt}`),Je=a.jsx("span",{ref:Pe,"aria-hidden":!0,className:`${o}-cap-ref`,style:E,children:"H"}),st=`${Math.max(0,O)/1e3}s`,it=w?a.jsx("div",{ref:le,className:`${o}-marquee-track`,"data-direction":u,onPointerEnter:me,onPointerLeave:X,style:{WebkitAnimationDuration:st,animationDuration:st,WebkitAnimationPlayState:ie,animationPlayState:ie},children:Array.from({length:te},(Oe,Ae)=>a.jsx("div",{ref:Ae===0?Q:void 0,className:`${o}-marquee-set`,style:{...We,paddingRight:T(y)},"aria-hidden":Ae>0,children:ee.map((gt,ze)=>Ue(gt,Ae,ze))},`set-${Ae}`))}):a.jsx("div",{ref:Q,className:Ct(`${o}-marquee-set`,`${o}-marquee-static`),style:We,children:t==null?void 0:t.map((Oe,Ae)=>Ue(Oe,0,Ae))});return a.jsxs("div",{ref:oe,className:`${o}-wrapper`,"aria-label":"Marquee text",children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:D}}),Je,a.jsxs("div",{ref:N,className:`${o}-marquee-wrapper`,style:J,children:[$e,Ze,it]})]})},cy=`import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
2635
+ `}const Gf=30,Ja=3,Xf=12,qf=96,gc=3,sa=.72,Uf=100,Kf=10,Yf=e=>e/Uf,Zf=e=>Math.max(0,e)/Kf,Jf=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")},Qf=(e,t)=>Array.from({length:t*e.length},(n,i)=>e[i%e.length]),io={ctx:void 0},ey=()=>io.ctx!==void 0?io.ctx:typeof document>"u"?(io.ctx=null,io.ctx):(io.ctx=document.createElement("canvas").getContext("2d"),io.ctx),ty=(e,t,n,i)=>{e.style.transform=`translate3d(${t}px, ${n}px, 0) rotate(${i}deg)`},hc=e=>{e.style.transform=""},ny=e=>{if(!e||e==="none")return 0;try{return new DOMMatrixReadOnly(e).m41}catch{return 0}},iy=(e,t)=>{const n=(i,o)=>{if(!i||i===t)return o;const r=o+i.offsetLeft,l=i.offsetParent;return!l||l===i?r:n(l,r)};return n(e,e.offsetWidth/2)},Wu=96,Ou=(e,t,n)=>{if(t<=0||Math.abs(e)<=0||n<2)return null;const i=2*Math.PI/t,o=new Float64Array(n+1),r=new Float64Array(n+1),l=e*t,c=u=>Math.sqrt(1+(l*Math.cos(t*u))**2),d=i/n;return Array.from({length:n},(u,p)=>{const y=p*d,v=y+d;o[p+1]=v,r[p+1]=r[p]+(c(y)+c(v))*.5*d}),{wavelength:i,periodArc:r[n],x:o,s:r}},oy=(e,t)=>{const n=Ou(e,t,Wu);return!n||n.wavelength<=0?1:n.periodArc/n.wavelength},ry=(e,t)=>{if(e.periodArc<=0)return t;const n=t<0?-1:1,i=Math.abs(t),o=Math.floor(i/e.periodArc),r=i-o*e.periodArc,{s:l,x:c}=e,d=(m,g)=>{if(g-m<=1)return[m,g];const x=m+g>>1;return l[x]<=r?d(x,g):d(m,x)},[u,p]=d(0,l.length-1),y=l[p]-l[u],v=y>0?(r-l[u])/y:0;return n*(o*e.wavelength+c[u]+(c[p]-c[u])*v)},ay=(e,t,n,i,o=0)=>{const r=Math.max(0,n),l=e>0?2*Math.PI*r/e:0,c=g=>i+t*Math.sin(l*g),d=g=>t*l*Math.cos(l*g),u=-o,y=e+o-u,v=Math.max(4,Math.ceil(r*4*(y/Math.max(e,1)))),m=Array.from({length:v},(g,x)=>{const b=u+x/v*y,k=u+(x+1)/v*y,f=k-b,S=c(b),W=c(k),U=b+f/3,B=S+d(b)*f/3,P=k-f/3,_=W-d(k)*f/3;return`C${U.toFixed(2)} ${B.toFixed(2)} ${P.toFixed(2)} ${_.toFixed(2)} ${k.toFixed(2)} ${W.toFixed(2)}`});return[`M${u.toFixed(2)} ${c(u).toFixed(2)}`,...m].join(" ")},sy=({item:e,prefix:t,textCss:n,capHeightPx:i,opticalOffsetY:o,imageGapPx:r,isCurve:l})=>{var m;const c=o!==0?{...n,transform:`translateY(${o}px)`}:n,d=i>0?{height:`${i}px`}:{fontSize:n.fontSize,height:`${sa}em`},u=((m=e.image)==null?void 0:m.url)&&a.jsx("img",{src:e.image.url,alt:e.image.name??"",className:`${t}-item-image`,style:d}),p=u&&(l?a.jsx("span",{className:`${t}-item-image-wrap`,"data-marquee-wave-node":!0,children:u}):u),y=l?a.jsx("span",{className:`${t}-text`,style:c,children:Array.from(e.text).map((g,x)=>a.jsx("span",{className:`${t}-glyph`,"data-marquee-wave-node":!0,children:a.jsx("span",{className:`${t}-glyph-inner`,children:g===" "?" ":g})},x))}):a.jsx("span",{className:`${t}-text`,style:c,children:e.text}),v=a.jsxs(a.Fragment,{children:[p,y]});return a.jsx("div",{className:`${t}-item`,"data-marquee-text-item":!0,style:{gap:r},children:e.link?a.jsx("a",{href:e.link,className:`${t}-item-link`,style:{gap:r},children:v}):v})},ly=({settings:e,content:t,isEditor:n,isPreviewMode:i})=>{const{prefix:o}=F.useScopedStyles(),[r,l]=s.useState(0),c=r>0?Math.round(r):0,{speed:d,direction:u,pauseOnHover:p,gap:y,layoutType:v,curveAmplitude:m,curveFrequency:g,textFontFamily:x,textFontSettings:b,textFontSize:k,textLetterSpacing:f,textWordSpacing:S,textTextAppearance:W,textColor:U,backgroundColor:B,ribbonWidth:P}=e,_=P??k,G=v==="curve",$=Yf(m),L=Zf(g),D=s.useMemo(()=>Vf(o,c,G),[o,c,G]),E=s.useMemo(()=>Qt({fontSettings:{fontFamily:x,fontWeight:b.fontWeight,fontStyle:b.fontStyle},letterSpacing:f,wordSpacing:S,fontSize:k,lineHeight:k,textAppearance:W,color:U},n),[x,b,f,S,k,W,U,n]),T=Oe=>F.scalingValue(Oe,n??!1),C=((t==null?void 0:t.length)??0)>0,V=n?!!i:!0,w=C&&(V||!!n),q=Math.max(0,d)*Gf,I=V&&p==="on",[A,j]=s.useState(!1),ie=V?I&&A?"paused":"running":"paused",ae=ie==="running"&&q>0&&c>0,O=c>0&&q>0?c/q*1e3:0,oe=s.useRef(null),N=s.useRef(null),le=s.useRef(null),Q=s.useRef(null),be=s.useRef(null),Pe=s.useRef(null),ye=s.useRef(ae),ce=s.useRef(null),Y=s.useRef(null),se=s.useRef($),pe=s.useRef(L);ye.current=ae,se.current=$,pe.current=L;const[fe,we]=s.useState(0),[Re,ge]=s.useState(0),[xe,Ce]=s.useState(0),[h,K]=s.useState(0),[Z,ne]=s.useState(0),de=s.useMemo(()=>(t??[]).map(Oe=>{var Ae;return`${Oe.text}\0${((Ae=Oe.image)==null?void 0:Ae.url)??""}\0${Oe.link??""}`}).join("\0"),[t]),[z,R]=s.useState(Ja),ee=s.useMemo(()=>{const Oe=t??[];return Oe.length===0||!(V||n)?Oe:Qf(Oe,z)},[t,V,z,n]),te=w?gc:1;s.useLayoutEffect(()=>{R(Ja),l(0)},[de]),s.useLayoutEffect(()=>{var De;const Oe=Pe.current;if(!Oe)return;const Ae=()=>{const Xe=getComputedStyle(Oe),ct=parseFloat(Xe.fontSize)||0;if(ct<=0)return;const he=ey();if(!he){we(ct*sa),ge(0);return}he.font=`${Xe.fontStyle} ${Xe.fontWeight} ${ct}px ${Xe.fontFamily}`;const Ee=he.measureText("H"),nt=Ee.actualBoundingBoxAscent>0?Ee.actualBoundingBoxAscent:ct*sa,pt=Math.max(0,Ee.actualBoundingBoxDescent||0),Ve=Ee.fontBoundingBoxAscent||0,vt=Ee.fontBoundingBoxDescent||0;we(At=>Math.abs(At-nt)>.5?nt:At);const Rt=Ve>0||vt>0?(vt-pt-(Ve-nt))/2:0;ge(At=>Math.abs(At-Rt)>.25?Rt:At)};Ae();const gt=typeof document<"u"?document.fonts:void 0;(De=gt==null?void 0:gt.ready)==null||De.then(Ae).catch(()=>{});const ze=new ResizeObserver(Ae);return ze.observe(Oe),()=>ze.disconnect()},[E.fontFamily,E.fontWeight,E.fontStyle,E.fontSize,E.lineHeight]),s.useLayoutEffect(()=>{if(!w)return;const Oe=oe.current,Ae=Q.current;if(!Oe||!Ae)return;const gt={id:0},ze=()=>{const he=Oe.offsetWidth||Oe.getBoundingClientRect().width,Ee=Ae.offsetWidth||Ae.getBoundingClientRect().width;if(C&&he>0&&Ee>0){const nt=Ee/z;if(nt>0){let pt=he,Ve=Xf;if(G){const Rt=he*se.current,At=pe.current,wt=At>0?2*Math.PI*At/he:0,Vt=oy(Rt,wt);pt=Math.max(he,Vt*he/(gc-1)),Ve=qf}const vt=Math.min(Ve,Math.max(Ja,Math.ceil(pt/nt)+1));if(vt!==z){R(vt);return}}}Ee>0&&l(Ee)},De=()=>{cancelAnimationFrame(gt.id),gt.id=requestAnimationFrame(ze)};De();const Xe=new ResizeObserver(De);Xe.observe(Oe),Xe.observe(Ae);const ct=()=>{document.hidden||De()};return document.addEventListener("visibilitychange",ct),window.addEventListener("pageshow",ct),window.addEventListener("focus",ct),()=>{cancelAnimationFrame(gt.id),Xe.disconnect(),document.removeEventListener("visibilitychange",ct),window.removeEventListener("pageshow",ct),window.removeEventListener("focus",ct)}},[w,de,z,C,fe,G,$,L]),s.useLayoutEffect(()=>{const Oe=be.current;if(!Oe)return;const Ae={id:0},gt=()=>{const De=Oe.offsetHeight;De>0&&ne(Xe=>Math.abs(Xe-De)>.5?De:Xe)};Ae.id=requestAnimationFrame(gt);const ze=new ResizeObserver(()=>{cancelAnimationFrame(Ae.id),Ae.id=requestAnimationFrame(gt)});return ze.observe(Oe),()=>{cancelAnimationFrame(Ae.id),ze.disconnect()}},[_,n]),s.useLayoutEffect(()=>{if(!G){Ce(0),K(0);return}const Oe=oe.current,Ae=Q.current;if(!Oe||!Ae)return;const gt={id:0},ze=()=>{const Xe=Oe.offsetWidth,ct=Ae.offsetHeight;Xe>0&&K(he=>Math.abs(he-Xe)>.5?Xe:he),ct>0&&Ce(he=>Math.abs(he-ct)>.5?ct:he)};gt.id=requestAnimationFrame(ze);const De=new ResizeObserver(()=>{cancelAnimationFrame(gt.id),gt.id=requestAnimationFrame(ze)});return De.observe(Oe),De.observe(Ae),()=>{cancelAnimationFrame(gt.id),De.disconnect()}},[G,de,fe,k,w]),s.useLayoutEffect(()=>{if(!w||c<=0)return;const Oe=le.current;Oe&&Jf(Oe)},[w,c,u,q]),s.useLayoutEffect(()=>{if(!G||!C)return;const Oe=oe.current;if(!Oe)return;const Ae={raf:0,cancelled:!1,lut:null,lutKey:"",itemsCache:[],cacheDirty:!0},gt=()=>{for(const nt of Ae.itemsCache)for(const pt of nt.glyphs)hc(pt.inner)},ze=()=>{const nt=N.current??Oe;Ae.itemsCache=Array.from(Oe.querySelectorAll("[data-marquee-text-item]"),pt=>{const Ve=[];return pt.querySelectorAll("[data-marquee-wave-node]").forEach(vt=>{const Rt=vt.firstElementChild;Rt&&Ve.push({inner:Rt,layoutLocalX:iy(vt,nt)})}),{item:pt,glyphs:Ve}}),Ae.cacheDirty=!1},De=()=>{Ae.cacheDirty&&ze();const pt=(N.current??Oe).offsetWidth||1,Ve=pt*se.current,vt=pe.current,Rt=2*Math.PI*vt/pt,At=`${pt}|${Ve}|${Rt}`;if(At!==Ae.lutKey&&(Ae.lutKey=At,Ae.lut=Ou(Ve,Rt,Wu)),Math.abs(Ve)<=0||Rt<=0){gt();return}const wt=le.current,Vt=wt?ny(getComputedStyle(wt).transform):0,jt=Oe.getBoundingClientRect(),Kt=jt.left,Yt=jt.right,kt=Ae.lut&&Ae.lut.wavelength>0?Math.max(0,(Ae.lut.periodArc/Ae.lut.wavelength-1)*pt):0;for(const{item:Bt,glyphs:rn}of Ae.itemsCache){const xt=Bt.getBoundingClientRect();if(xt.right<Kt||xt.left>Yt+kt){for(const yt of rn)hc(yt.inner);continue}for(const yt of rn){const Me=yt.layoutLocalX+Vt,Qe=Ae.lut?ry(Ae.lut,Me):Me,rt=Rt*Qe,dt=Ve*Math.sin(rt),Pt=Ve*Rt*Math.cos(rt),St=Math.atan(Pt)*(180/Math.PI);ty(yt.inner,Qe-Me,dt,St)}}},Xe=()=>{Ae.cancelled||(Ae.raf=0,De(),ye.current&&!document.hidden&&(Ae.raf=requestAnimationFrame(Xe)))},ct=()=>{Ae.cancelled||Ae.raf||(Ae.raf=requestAnimationFrame(Xe))},he=()=>{Ae.cacheDirty=!0,De(),ct()};ce.current=ct,Y.current=he,De(),ct();const Ee=()=>{if(document.hidden){cancelAnimationFrame(Ae.raf),Ae.raf=0;return}cancelAnimationFrame(Ae.raf),Ae.raf=0,he()};return document.addEventListener("visibilitychange",Ee),window.addEventListener("pageshow",Ee),window.addEventListener("focus",Ee),()=>{Ae.cancelled=!0,ce.current=null,Y.current=null,cancelAnimationFrame(Ae.raf),document.removeEventListener("visibilitychange",Ee),window.removeEventListener("pageshow",Ee),window.removeEventListener("focus",Ee),gt()}},[G,C]),s.useLayoutEffect(()=>{var Oe;!G||!C||(Oe=Y.current)==null||Oe.call(Y)},[G,C,r,de,z,fe,$,L,h]),s.useLayoutEffect(()=>{var Oe;(Oe=ce.current)==null||Oe.call(ce)},[ae,u]);const me=Oe=>{I&&Oe.pointerType==="mouse"&&j(!0)},X=()=>{I&&j(!1)},Ie=G?Math.abs($)*100:0,Se=T(_),J={minHeight:Se,...G?{paddingTop:`${Ie}%`,paddingBottom:`${Ie}%`}:{}},He={height:Se,...G?{visibility:"hidden"}:{backgroundColor:B}},We={gap:T(y),minHeight:Se},ot=h*$,qe=Math.abs(ot),tt=Z>0?Z:xe,et=Math.max(xe,tt),Ge=qe+et/2,ve=Math.max(tt,1),_e=G&&h>0&&et>0?ay(h,ot,L,Ge,ve):"",Be=qe*2+et,Ze=_e?a.jsx("svg",{className:`${o}-curve-bg`,viewBox:`0 0 ${h} ${Be}`,preserveAspectRatio:"none","aria-hidden":!0,children:a.jsx("path",{d:_e,fill:"none",stroke:B,strokeWidth:tt,strokeLinecap:"butt",strokeLinejoin:"round"})}):null,$e=a.jsx("div",{ref:be,className:`${o}-ribbon`,style:He,"aria-hidden":!0}),Ne={...E,lineHeight:fe>0?`${fe}px`:`${sa}em`},Ue=(Oe,Ae,gt)=>a.jsx(sy,{item:Oe,prefix:o,textCss:Ne,capHeightPx:fe,opticalOffsetY:Re,imageGapPx:T(y),isCurve:G},`${Ae}-${gt}`),Je=a.jsx("span",{ref:Pe,"aria-hidden":!0,className:`${o}-cap-ref`,style:E,children:"H"}),st=`${Math.max(0,O)/1e3}s`,it=w?a.jsx("div",{ref:le,className:`${o}-marquee-track`,"data-direction":u,onPointerEnter:me,onPointerLeave:X,style:{WebkitAnimationDuration:st,animationDuration:st,WebkitAnimationPlayState:ie,animationPlayState:ie},children:Array.from({length:te},(Oe,Ae)=>a.jsx("div",{ref:Ae===0?Q:void 0,className:`${o}-marquee-set`,style:{...We,paddingRight:T(y)},"aria-hidden":Ae>0,children:ee.map((gt,ze)=>Ue(gt,Ae,ze))},`set-${Ae}`))}):a.jsx("div",{ref:Q,className:Ct(`${o}-marquee-set`,`${o}-marquee-static`),style:We,children:t==null?void 0:t.map((Oe,Ae)=>Ue(Oe,0,Ae))});return a.jsxs("div",{ref:oe,className:`${o}-wrapper`,"aria-label":"Marquee text",children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:D}}),Je,a.jsxs("div",{ref:N,className:`${o}-marquee-wrapper`,style:J,children:[$e,Ze,it]})]})},cy=`import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
2637
2636
  import cn from 'classnames';
2638
2637
  import { CommonComponentProps } from '../props';
2639
2638
  import { scalingValue } from '../utils/scalingValue';
@@ -2666,7 +2665,6 @@ function getCSS(P: string, setWidthPx: number, isCurve: boolean): string {
2666
2665
  return \`
2667
2666
  .\${P}-wrapper {
2668
2667
  position: relative;
2669
- display: flow-root;
2670
2668
  width: 100%;
2671
2669
  height: auto;
2672
2670
  }
@@ -3403,12 +3401,7 @@ export const MarqueeText = ({ settings, content, isEditor, isPreviewMode }: Marq
3403
3401
  const bandStyle: CSSProperties = {
3404
3402
  minHeight: ribbonHeightCss,
3405
3403
  ...(isCurveLayout
3406
- ? {
3407
- paddingTop: \`\${curvePaddingPercent}%\`,
3408
- paddingBottom: \`\${curvePaddingPercent}%\`,
3409
- marginTop: \`-\${curvePaddingPercent}%\`,
3410
- marginBottom: \`-\${curvePaddingPercent}%\`,
3411
- }
3404
+ ? { paddingTop: \`\${curvePaddingPercent}%\`, paddingBottom: \`\${curvePaddingPercent}%\` }
3412
3405
  : {}),
3413
3406
  };
3414
3407
  const ribbonStyle: CSSProperties = {
package/dist/index.mjs CHANGED
@@ -10069,7 +10069,6 @@ function ry(e, t, n) {
10069
10069
  return `
10070
10070
  .${e}-wrapper {
10071
10071
  position: relative;
10072
- display: flow-root;
10073
10072
  width: 100%;
10074
10073
  height: auto;
10075
10074
  }
@@ -10459,12 +10458,7 @@ const ay = 30, cl = 3, ly = 12, sy = 96, Pc = 3, ya = 0.72, cy = 100, dy = 10, u
10459
10458
  P && z(!1);
10460
10459
  }, Me = V ? Math.abs(S) * 100 : 0, $e = C(F), Q = {
10461
10460
  minHeight: $e,
10462
- ...V ? {
10463
- paddingTop: `${Me}%`,
10464
- paddingBottom: `${Me}%`,
10465
- marginTop: `-${Me}%`,
10466
- marginBottom: `-${Me}%`
10467
- } : {}
10461
+ ...V ? { paddingTop: `${Me}%`, paddingBottom: `${Me}%` } : {}
10468
10462
  }, Be = {
10469
10463
  height: $e,
10470
10464
  ...V ? { visibility: "hidden" } : { backgroundColor: D }
@@ -10588,7 +10582,6 @@ function getCSS(P: string, setWidthPx: number, isCurve: boolean): string {
10588
10582
  return \`
10589
10583
  .\${P}-wrapper {
10590
10584
  position: relative;
10591
- display: flow-root;
10592
10585
  width: 100%;
10593
10586
  height: auto;
10594
10587
  }
@@ -11325,12 +11318,7 @@ export const MarqueeText = ({ settings, content, isEditor, isPreviewMode }: Marq
11325
11318
  const bandStyle: CSSProperties = {
11326
11319
  minHeight: ribbonHeightCss,
11327
11320
  ...(isCurveLayout
11328
- ? {
11329
- paddingTop: \`\${curvePaddingPercent}%\`,
11330
- paddingBottom: \`\${curvePaddingPercent}%\`,
11331
- marginTop: \`-\${curvePaddingPercent}%\`,
11332
- marginBottom: \`-\${curvePaddingPercent}%\`,
11333
- }
11321
+ ? { paddingTop: \`\${curvePaddingPercent}%\`, paddingBottom: \`\${curvePaddingPercent}%\` }
11334
11322
  : {}),
11335
11323
  };
11336
11324
  const ribbonStyle: CSSProperties = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/components",
3
- "version": "1.0.95",
3
+ "version": "1.0.96",
4
4
  "description": "Custom components for control editor and public websites.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",