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