@cntrl-site/components 1.0.106-alpha.0 → 1.0.107-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/ClickGallerie-CYQMgrIr.js +36 -0
- package/dist/ClickGallerie-o2U6oyOF.mjs +272 -0
- package/dist/Components/ClickGallerie/ClickGallerie.d.ts +2 -1
- package/dist/Components/Helix/Helix.d.ts +4 -1
- package/dist/Components/Hive/Hive.d.ts +4 -1
- package/dist/Components/ImageRevealSlider/ImageRevealSlider.d.ts +2 -1
- package/dist/Components/List/List.d.ts +6 -2
- package/dist/Components/Marquee/Marquee.d.ts +6 -2
- package/dist/Components/MarqueeText/MarqueeText.d.ts +2 -1
- package/dist/Components/Mercury/Mercury.d.ts +4 -1
- package/dist/Components/Waterfall/WaterfallLightbox.d.ts +4 -1
- package/dist/Components/utils/EmbedMediaFrame.d.ts +27 -0
- package/dist/Components/utils/LinkWrapper.d.ts +16 -0
- package/dist/Components/utils/embedMedia.d.ts +40 -0
- package/dist/Components/utils/index.d.ts +6 -0
- package/dist/{ControlSlider-SiOt22l_.js → ControlSlider-Kkec-i14.js} +1 -1
- package/dist/{ControlSlider-pZv7H6BU.mjs → ControlSlider-LcZmviGX.mjs} +1 -1
- package/dist/EmbedMediaFrame-DsOTKE4i.js +1 -0
- package/dist/EmbedMediaFrame-DwHeOAy5.mjs +164 -0
- package/dist/{FAQ-C7823fyi.js → FAQ-BxhMo7T8.js} +1 -1
- package/dist/{FAQ-CZ39u4m8.mjs → FAQ-CdwSft5p.mjs} +1 -1
- package/dist/Grid-CFHTP3mb.js +378 -0
- package/dist/Grid-e-gLfsji.mjs +1590 -0
- package/dist/Helix-BpLo9FD3.js +43 -0
- package/dist/Helix-CidI3ucE.mjs +324 -0
- package/dist/{Hive-D6-R6TwM.mjs → Hive-BsmFHk2i.mjs} +505 -475
- package/dist/Hive-D1j6wZpV.js +321 -0
- package/dist/ImageRevealSlider-BuukTGAK.js +1 -0
- package/dist/{ImageRevealSlider-BdFGyVEP.mjs → ImageRevealSlider-Df9sygk9.mjs} +63 -70
- package/dist/{Lightbox-eP9qAZzL.mjs → Lightbox-C_fXsfdz.mjs} +1 -1
- package/dist/{Lightbox-CIss_nOG.js → Lightbox-DaunVrkp.js} +1 -1
- package/dist/LinkWrapper-Ca84iPtg.js +1 -0
- package/dist/LinkWrapper-DZs9hlOn.mjs +13 -0
- package/dist/{List-DW7fyJbf.mjs → List-Bh_-l9vD.mjs} +532 -520
- package/dist/List-DVvpQ24J.js +377 -0
- package/dist/Marquee-DByooiWP.mjs +578 -0
- package/dist/Marquee-DfIP-tIN.js +133 -0
- package/dist/{MarqueeText-Rzt2fJYt.mjs → MarqueeText-D6FNCe6P.mjs} +115 -114
- package/dist/MarqueeText-DsUiV6Zv.js +132 -0
- package/dist/Mercury-B-s2Kvuq.js +267 -0
- package/dist/Mercury-CCW0Es-s.mjs +1700 -0
- package/dist/PretextComponent-Dnbenstn.js +1 -0
- package/dist/{PretextComponent-j-OsRZTx.mjs → PretextComponent-OygSO3fr.mjs} +312 -269
- package/dist/{RichTextRenderer-B6WtTYlR.mjs → RichTextRenderer-BptwNpbJ.mjs} +10 -9
- package/dist/RichTextRenderer-K90Dd7pt.js +1 -0
- package/dist/{Slider20-Dm8BeCli.mjs → Slider20-CCzixTiN.mjs} +1 -1
- package/dist/{Slider20-C9o2REDl.js → Slider20-fMVeRfgx.js} +1 -1
- package/dist/{TestimonialGrid-CPu4qQ6B.mjs → TestimonialGrid-CbsVxSn9.mjs} +1 -1
- package/dist/{TestimonialGrid-D4ieiz9e.js → TestimonialGrid-CiCagfBU.js} +1 -1
- package/dist/{TestimonialSingle-DLdnAVF7.mjs → TestimonialSingle-BVm3Amrl.mjs} +1 -1
- package/dist/{TestimonialSingle-CVu15ZtV.js → TestimonialSingle-BWXynGjv.js} +1 -1
- package/dist/Waterfall-3kKioKh2.mjs +1432 -0
- package/dist/Waterfall-DII4-WV5.js +288 -0
- package/dist/{components-D2LyuDm-.mjs → components-BRmbflgg.mjs} +15 -15
- package/dist/components-nvbH4l0S.js +1 -0
- package/dist/content/postFieldBindings.d.ts +29 -0
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +16 -16
- package/dist/elements.node.js +1 -1
- package/dist/elements.node.mjs +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +52 -15
- package/dist/sources.js +312 -212
- package/dist/sources.mjs +312 -212
- package/dist/types/SchemaV1.d.ts +53 -1
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +30 -20
- package/package.json +1 -1
- package/dist/ClickGallerie-D7g093HX.js +0 -36
- package/dist/ClickGallerie-QSOQjSdv.mjs +0 -271
- package/dist/Grid-BBpdl60K.js +0 -374
- package/dist/Grid-DS53S_gA.mjs +0 -1576
- package/dist/Helix-BPn9V1sg.mjs +0 -315
- package/dist/Helix-DcgsCc4D.js +0 -43
- package/dist/Hive-n8Fz-j3o.js +0 -321
- package/dist/ImageRevealSlider-BBWtFjUF.js +0 -1
- package/dist/List-C32WImI3.js +0 -377
- package/dist/Marquee-DOIRRCu4.js +0 -133
- package/dist/Marquee-O_PDwlIb.mjs +0 -564
- package/dist/MarqueeText-DkaO2lQ5.js +0 -132
- package/dist/Mercury-C9D10TTT.mjs +0 -1702
- package/dist/Mercury-DynO-NxY.js +0 -267
- package/dist/PretextComponent-BnsS2zJ6.js +0 -1
- package/dist/RichTextRenderer-CIy6yI8U.js +0 -1
- package/dist/Waterfall-DC2WQ3GT.js +0 -287
- package/dist/Waterfall-Yud2VR62.mjs +0 -1404
- package/dist/components-B9Vdjf0w.js +0 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),f=require("react"),ce=require("./scalingValue-CSHYgTZl.js"),xe=require("./useScopedStyles-Bf6yohVQ.js"),B=require("./EmbedMediaFrame-DsOTKE4i.js"),Ie=require("./LazyVideo-imbU18js.js"),Ee=10,Oe=400,Re=1,Se=1120/1440,Te=140/1440,_e=550/1440,Fe=13,Ae=4,Ne=38/100,we=28/100,le=2.8,$e=.9,ue=.22,De=.5,Ce=1,He=1.5,Le=0,Pe=.85;function ge(e){return`
|
|
2
|
+
.${e}-wrapper {
|
|
3
|
+
position: relative;
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
isolation: isolate;
|
|
7
|
+
contain: layout paint;
|
|
8
|
+
}
|
|
9
|
+
.${e}-item {
|
|
10
|
+
position: absolute;
|
|
11
|
+
left: 0;
|
|
12
|
+
width: var(--helix-base-w);
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
transform-origin: center center;
|
|
15
|
+
}
|
|
16
|
+
.${e}-item-cover {
|
|
17
|
+
height: var(--helix-base-h);
|
|
18
|
+
}
|
|
19
|
+
.${e}-media {
|
|
20
|
+
display: block;
|
|
21
|
+
width: 100%;
|
|
22
|
+
max-width: 100%;
|
|
23
|
+
height: auto;
|
|
24
|
+
vertical-align: top;
|
|
25
|
+
user-select: none;
|
|
26
|
+
pointer-events: none;
|
|
27
|
+
}
|
|
28
|
+
.${e}-cover {
|
|
29
|
+
display: block;
|
|
30
|
+
width: 100%;
|
|
31
|
+
height: 100%;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
position: relative;
|
|
34
|
+
}
|
|
35
|
+
.${e}-cover .${e}-media {
|
|
36
|
+
position: absolute;
|
|
37
|
+
inset: 0;
|
|
38
|
+
width: 100%;
|
|
39
|
+
height: 100%;
|
|
40
|
+
object-fit: cover;
|
|
41
|
+
object-position: center;
|
|
42
|
+
}
|
|
43
|
+
`}function de(e){return Number(e.toFixed(4))}function ie(e,t,o,r){const s=(typeof e=="string"?Number(e):e)??t;return Number.isFinite(s)?Math.min(r,Math.max(o,Math.round(s))):t}function q(e,t,o=0,r=9999){const s=(typeof e=="string"?Number(e):e)??t;return Number.isFinite(s)?Math.min(r,Math.max(o,s)):t}function Ue(e){return typeof e=="string"?{display:e.toLowerCase()==="cover"?"cover":"fit",ratioValue:"2:3",reversed:!1}:{display:(typeof(e==null?void 0:e.display)=="string"?e.display.toLowerCase():"")==="cover"?"cover":"fit",ratioValue:(e==null?void 0:e.ratioValue)??"2:3",reversed:(e==null?void 0:e.reversed)??!1}}function je(e){const[t,o]=e.ratioValue.split(":").map(Number),r=e.reversed?o:t;return(e.reversed?t:o)/r}function ze(e){return B.isEmbedMedia(e)?!1:e.type==="video"?!0:e.type==="image"?!1:/\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.name??"")||/\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.assetId??"")}function me(e,t){return(1-e)/(1-e*Math.cos(t))}function We(e){let t=0;for(let o=0;o<360;o+=1){const r=o*Math.PI/180;t=Math.max(t,Math.abs(Math.sin(r)*me(e,r)))}return t||1}function Ve(e,t){return e?1:1+ue*(.35+t)}function qe(e,t,o,r){const n=t*Ve(o,r);return Math.max(0,(e-n)/2)}function Be(e,t,o){const r=me(e,o);return{offset:Math.sin(o)*r/t,scale:r}}function Ge(e,t,o){return e/2+t*o}function ke(e,t,o){return`translate(calc(${e(t)} - var(--helix-base-w) / 2), -50%) scale(${de(o)})`}function Xe(e){return Math.round(e*1e3)}function fe(e,t,o){const r=Math.cos(e),n=Math.cos(Pe*Math.PI/2);if(r>=n)return o;const s=(r+1)/(n+1);return de(t+(o-t)*s)}function Je(e){return fe(e,De,Ce)}function Ye(e){return fe(e,He,Le)}function Ze(e,t){if(!t)return"none";const o=Ye(e);return o<=0?"none":`blur(${o}px)`}function ae(e,t){const o=t*Math.PI*2,{offset:r,scale:n}=Be(e.depthFactor,e.spreadFactor,o),s=Ge(e.width,e.orbitRadius,r);return{transform:ke(e.scaled,s,n),zIndex:Xe(n),opacity:Je(o),filter:Ze(o,e.blurEnabled)}}function he(e,t){return(e%t+t)%t}function Ke(e,t){return G(e,t)/t}function G(e,t){return he(e,t)}function Qe(e,t){return Math.floor(e/t)}function et(e,t,o,r){return Qe(e,t)*o+G(e,t)*r}function se(e){const t=Math.sin(e*12.9898)*43758.5453;return t-Math.floor(t)}function L(e){const t=e%1;return t<0?t+1:t}function tt(e,t,o){const r=t/le,n=o==="left"?-e*r:e*r;return L(n)}function ot({settings:e,content:t,isEditor:o,isPreviewMode:r}){const{prefix:n}=xe.useScopedStyles(),s=f.useRef(null),x=q((e==null?void 0:e.width)??(e==null?void 0:e.spread)??(e==null?void 0:e.wrapperWidth),Se),T=q(e==null?void 0:e.imageWidth,Te),P=q(e==null?void 0:e.turnHeight,_e),p=ie(e==null?void 0:e.itemsPerTurn,Fe,3,40),g=ie(e==null?void 0:e.turns,Ae,1,30),_=Math.min($e,Math.max(0,Ne)),O=Math.min(1,Math.max(0,we)),F=Math.max(0,(e==null?void 0:e.speed)??le),U=(e==null?void 0:e.direction)==="left"?"left":"right",k=(e==null?void 0:e.playback)==="scroll"?"scroll":"autoplay",X=(e==null?void 0:e.cornerRadius)??0,J=(e==null?void 0:e.blur)!=="off",Y=f.useMemo(()=>Ue(e==null?void 0:e.imageDisplay),[e==null?void 0:e.imageDisplay]),b=Y.display==="cover",v=i=>ce.scalingValue(i,o??!1),Z=f.useMemo(()=>We(_),[_]),K=f.useMemo(()=>qe(x,T,b,O),[x,T,b,O]),Q=f.useMemo(()=>ge(n),[n]),j=f.useMemo(()=>({scaled:i=>ce.scalingValue(i,o??!1),width:x,orbitRadius:K,depthFactor:_,spreadFactor:Z,blurEnabled:J}),[o,x,K,_,Z,J]),ee=f.useRef([]),R=f.useRef(0),A=f.useMemo(()=>(t??[]).filter(i=>{var u;return!!((u=i.image)!=null&&u.assetId)}),[t]),z=P/p,pe=T*je(Y),be=Math.min(Oe,g*p),N=Re*p,te=be+N*2,ve=Math.max(0,g-1)*P+(p-1)*z,oe=F>0,w=k==="scroll"&&oe,$=k==="autoplay"&&oe&&(o?!!r:!0),re=$?360/(F*Ee):0,ne=A.length===0?0:te,W=f.useMemo(()=>Array.from({length:ne},(i,u)=>Ke(u-N,p)),[ne,N,p]);f.useEffect(()=>{if(!$&&!w)return;const i=s.current;if(!i)return;const u=c=>{R.current=c,W.forEach((l,E)=>{const h=ee.current[E];if(!h)return;const m=ae(j,L(l+c));h.style.transform=m.transform,h.style.zIndex=String(m.zIndex),h.style.opacity=String(m.opacity),h.style.filter=m.filter})};if(w){const c=i.ownerDocument.defaultView??window,l=()=>{const h=i.getBoundingClientRect(),m=c.innerHeight||i.ownerDocument.documentElement.clientHeight,M=m+h.height;if(M<=0)return;const H=Math.min(1,Math.max(0,(m-h.top)/M));u(tt(H,F,U))};l(),c.addEventListener("scroll",l,{passive:!0,capture:!0}),c.addEventListener("resize",l);const E=new ResizeObserver(l);return E.observe(i),()=>{c.removeEventListener("scroll",l,{capture:!0}),c.removeEventListener("resize",l),E.disconnect()}}const I=U==="left"?-1:1;let y=null,d=null;const S=c=>{if(d!==null){const l=(c-d)/1e3/re*I;R.current=L(R.current+l)}d=c,u(R.current),y=requestAnimationFrame(S)},V=()=>{y===null&&(d=null,y=requestAnimationFrame(S))},D=()=>{y!==null&&cancelAnimationFrame(y),y=null},C=new IntersectionObserver(([c])=>{c!=null&&c.isIntersecting?V():D()});return C.observe(i),()=>{D(),C.disconnect()}},[$,w,W,j,re,F,U]);const ye=$||w?R.current:0;return A.length===0?a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:Q}}),a.jsx("div",{className:`${n}-wrapper`,style:{width:v(x)}})]}):a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:Q}}),a.jsx("div",{ref:s,className:`${n}-wrapper`,style:{width:v(x),height:v(ve)},children:Array.from({length:te},(i,u)=>{const I=u-N,d=A[he(I,A.length)].image,S=G(I,p),V=W[u],D=et(I,p,P,z),C=O===0?0:(se(S+7.3)-.5)*O*z,c=b?1:1+(se(S+3.1)-.5)*2*ue*(.35+O),l=T*c,E={"--helix-base-w":v(l),...b?{"--helix-base-h":v(pe)}:{}},h={top:v(D+C),...E,...ae(j,L(V+ye))},m=X>0?{borderRadius:v(X)}:{},M=b?{...m,width:"100%",height:"100%",objectFit:"cover",objectPosition:"center"}:m,H=B.isEmbedMedia(d)?a.jsx(B.EmbedMediaFrame,{className:`${n}-media`,style:b?{...M,position:"absolute",inset:0}:M,media:d,fit:b?"cover":"contain"}):ze(d)?a.jsx(Ie.LazyVideo,{className:`${n}-media`,style:M,src:d.assetId,muted:!0,loop:!0,autoPlay:!0,playsInline:!0}):a.jsx("img",{className:`${n}-media`,style:M,src:d.assetId,alt:d.name??"",loading:"lazy",decoding:"async"});return a.jsx("div",{ref:Me=>{ee.current[u]=Me},className:b?`${n}-item ${n}-item-cover`:`${n}-item`,style:h,children:b?a.jsx("div",{className:`${n}-cover`,style:m,children:H}):H},`${g}-${p}-${I}`)})})]})}exports.Helix=ot;
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { jsxs as ce, Fragment as ie, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as V, useMemo as M, useEffect as xe } from "react";
|
|
3
|
+
import { s as ae } from "./scalingValue-C9JH5L6O.mjs";
|
|
4
|
+
import { u as Re } from "./useScopedStyles-DhBG3557.mjs";
|
|
5
|
+
import { i as de, E as Te } from "./EmbedMediaFrame-DwHeOAy5.mjs";
|
|
6
|
+
import { L as _e } from "./LazyVideo-CdAWymKO.mjs";
|
|
7
|
+
const Se = 10, Fe = 400, Ae = 1, Ne = 1120 / 1440, we = 140 / 1440, $e = 550 / 1440, De = 13, Ce = 4, Le = 38 / 100, He = 28 / 100, fe = 2.8, Pe = 0.9, me = 0.22, Ue = 0.5, ge = 1, ze = 1.5, We = 0, Be = 0.85;
|
|
8
|
+
function Ge(e) {
|
|
9
|
+
return `
|
|
10
|
+
.${e}-wrapper {
|
|
11
|
+
position: relative;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
isolation: isolate;
|
|
15
|
+
contain: layout paint;
|
|
16
|
+
}
|
|
17
|
+
.${e}-item {
|
|
18
|
+
position: absolute;
|
|
19
|
+
left: 0;
|
|
20
|
+
width: var(--helix-base-w);
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
transform-origin: center center;
|
|
23
|
+
}
|
|
24
|
+
.${e}-item-cover {
|
|
25
|
+
height: var(--helix-base-h);
|
|
26
|
+
}
|
|
27
|
+
.${e}-media {
|
|
28
|
+
display: block;
|
|
29
|
+
width: 100%;
|
|
30
|
+
max-width: 100%;
|
|
31
|
+
height: auto;
|
|
32
|
+
vertical-align: top;
|
|
33
|
+
user-select: none;
|
|
34
|
+
pointer-events: none;
|
|
35
|
+
}
|
|
36
|
+
.${e}-cover {
|
|
37
|
+
display: block;
|
|
38
|
+
width: 100%;
|
|
39
|
+
height: 100%;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
position: relative;
|
|
42
|
+
}
|
|
43
|
+
.${e}-cover .${e}-media {
|
|
44
|
+
position: absolute;
|
|
45
|
+
inset: 0;
|
|
46
|
+
width: 100%;
|
|
47
|
+
height: 100%;
|
|
48
|
+
object-fit: cover;
|
|
49
|
+
object-position: center;
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
function he(e) {
|
|
54
|
+
return Number(e.toFixed(4));
|
|
55
|
+
}
|
|
56
|
+
function se(e, t, o, r) {
|
|
57
|
+
const a = (typeof e == "string" ? Number(e) : e) ?? t;
|
|
58
|
+
return Number.isFinite(a) ? Math.min(r, Math.max(o, Math.round(a))) : t;
|
|
59
|
+
}
|
|
60
|
+
function j(e, t, o = 0, r = 9999) {
|
|
61
|
+
const a = (typeof e == "string" ? Number(e) : e) ?? t;
|
|
62
|
+
return Number.isFinite(a) ? Math.min(r, Math.max(o, a)) : t;
|
|
63
|
+
}
|
|
64
|
+
function Ve(e) {
|
|
65
|
+
return typeof e == "string" ? {
|
|
66
|
+
display: e.toLowerCase() === "cover" ? "cover" : "fit",
|
|
67
|
+
ratioValue: "2:3",
|
|
68
|
+
reversed: !1
|
|
69
|
+
} : {
|
|
70
|
+
display: (typeof (e == null ? void 0 : e.display) == "string" ? e.display.toLowerCase() : "") === "cover" ? "cover" : "fit",
|
|
71
|
+
ratioValue: (e == null ? void 0 : e.ratioValue) ?? "2:3",
|
|
72
|
+
reversed: (e == null ? void 0 : e.reversed) ?? !1
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function je(e) {
|
|
76
|
+
const [t, o] = e.ratioValue.split(":").map(Number), r = e.reversed ? o : t;
|
|
77
|
+
return (e.reversed ? t : o) / r;
|
|
78
|
+
}
|
|
79
|
+
function ke(e) {
|
|
80
|
+
return de(e) ? !1 : e.type === "video" ? !0 : e.type === "image" ? !1 : /\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.name ?? "") || /\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.assetId ?? "");
|
|
81
|
+
}
|
|
82
|
+
function pe(e, t) {
|
|
83
|
+
return (1 - e) / (1 - e * Math.cos(t));
|
|
84
|
+
}
|
|
85
|
+
function Xe(e) {
|
|
86
|
+
let t = 0;
|
|
87
|
+
for (let o = 0; o < 360; o += 1) {
|
|
88
|
+
const r = o * Math.PI / 180;
|
|
89
|
+
t = Math.max(t, Math.abs(Math.sin(r) * pe(e, r)));
|
|
90
|
+
}
|
|
91
|
+
return t || 1;
|
|
92
|
+
}
|
|
93
|
+
function Je(e, t) {
|
|
94
|
+
return e ? 1 : 1 + me * (0.35 + t);
|
|
95
|
+
}
|
|
96
|
+
function Ye(e, t, o, r) {
|
|
97
|
+
const n = t * Je(o, r);
|
|
98
|
+
return Math.max(0, (e - n) / 2);
|
|
99
|
+
}
|
|
100
|
+
function Ze(e, t, o) {
|
|
101
|
+
const r = pe(e, o);
|
|
102
|
+
return {
|
|
103
|
+
offset: Math.sin(o) * r / t,
|
|
104
|
+
scale: r
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function qe(e, t, o) {
|
|
108
|
+
return e / 2 + t * o;
|
|
109
|
+
}
|
|
110
|
+
function Ke(e, t, o) {
|
|
111
|
+
return `translate(calc(${e(t)} - var(--helix-base-w) / 2), -50%) scale(${he(o)})`;
|
|
112
|
+
}
|
|
113
|
+
function Qe(e) {
|
|
114
|
+
return Math.round(e * 1e3);
|
|
115
|
+
}
|
|
116
|
+
function be(e, t, o) {
|
|
117
|
+
const r = Math.cos(e), n = Math.cos(Be * Math.PI / 2);
|
|
118
|
+
if (r >= n)
|
|
119
|
+
return o;
|
|
120
|
+
const a = (r + 1) / (n + 1);
|
|
121
|
+
return he(t + (o - t) * a);
|
|
122
|
+
}
|
|
123
|
+
function et(e) {
|
|
124
|
+
return be(e, Ue, ge);
|
|
125
|
+
}
|
|
126
|
+
function tt(e) {
|
|
127
|
+
return be(e, ze, We);
|
|
128
|
+
}
|
|
129
|
+
function ot(e, t) {
|
|
130
|
+
if (!t) return "none";
|
|
131
|
+
const o = tt(e);
|
|
132
|
+
return o <= 0 ? "none" : `blur(${o}px)`;
|
|
133
|
+
}
|
|
134
|
+
function le(e, t) {
|
|
135
|
+
const o = t * Math.PI * 2, { offset: r, scale: n } = Ze(e.depthFactor, e.spreadFactor, o), a = qe(e.width, e.orbitRadius, r);
|
|
136
|
+
return {
|
|
137
|
+
transform: Ke(e.scaled, a, n),
|
|
138
|
+
zIndex: Qe(n),
|
|
139
|
+
opacity: et(o),
|
|
140
|
+
filter: ot(o, e.blurEnabled)
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function ve(e, t) {
|
|
144
|
+
return (e % t + t) % t;
|
|
145
|
+
}
|
|
146
|
+
function rt(e, t) {
|
|
147
|
+
return k(e, t) / t;
|
|
148
|
+
}
|
|
149
|
+
function k(e, t) {
|
|
150
|
+
return ve(e, t);
|
|
151
|
+
}
|
|
152
|
+
function nt(e, t) {
|
|
153
|
+
return Math.floor(e / t);
|
|
154
|
+
}
|
|
155
|
+
function ct(e, t, o, r) {
|
|
156
|
+
return nt(e, t) * o + k(e, t) * r;
|
|
157
|
+
}
|
|
158
|
+
function ue(e) {
|
|
159
|
+
const t = Math.sin(e * 12.9898) * 43758.5453;
|
|
160
|
+
return t - Math.floor(t);
|
|
161
|
+
}
|
|
162
|
+
function H(e) {
|
|
163
|
+
const t = e % 1;
|
|
164
|
+
return t < 0 ? t + 1 : t;
|
|
165
|
+
}
|
|
166
|
+
function it(e, t, o) {
|
|
167
|
+
const r = t / fe, n = o === "left" ? -e * r : e * r;
|
|
168
|
+
return H(n);
|
|
169
|
+
}
|
|
170
|
+
function ht({
|
|
171
|
+
settings: e,
|
|
172
|
+
content: t,
|
|
173
|
+
isEditor: o,
|
|
174
|
+
isPreviewMode: r
|
|
175
|
+
}) {
|
|
176
|
+
const { prefix: n } = Re(), a = V(null), I = j(
|
|
177
|
+
(e == null ? void 0 : e.width) ?? (e == null ? void 0 : e.spread) ?? (e == null ? void 0 : e.wrapperWidth),
|
|
178
|
+
Ne
|
|
179
|
+
), _ = j(e == null ? void 0 : e.imageWidth, we), P = j(e == null ? void 0 : e.turnHeight, $e), m = se(e == null ? void 0 : e.itemsPerTurn, De, 3, 40), U = se(e == null ? void 0 : e.turns, Ce, 1, 30), S = Math.min(Pe, Math.max(0, Le)), x = Math.min(1, Math.max(0, He)), F = Math.max(0, (e == null ? void 0 : e.speed) ?? fe), g = (e == null ? void 0 : e.direction) === "left" ? "left" : "right", X = (e == null ? void 0 : e.playback) === "scroll" ? "scroll" : "autoplay", J = (e == null ? void 0 : e.cornerRadius) ?? 0, Y = (e == null ? void 0 : e.blur) !== "off", Z = M(() => Ve(e == null ? void 0 : e.imageDisplay), [e == null ? void 0 : e.imageDisplay]), h = Z.display === "cover", b = (i) => ae(i, o ?? !1), q = M(() => Xe(S), [S]), K = M(
|
|
180
|
+
() => Ye(I, _, h, x),
|
|
181
|
+
[I, _, h, x]
|
|
182
|
+
), Q = M(() => Ge(n), [n]), z = M(
|
|
183
|
+
() => ({
|
|
184
|
+
scaled: (i) => ae(i, o ?? !1),
|
|
185
|
+
width: I,
|
|
186
|
+
orbitRadius: K,
|
|
187
|
+
depthFactor: S,
|
|
188
|
+
spreadFactor: q,
|
|
189
|
+
blurEnabled: Y
|
|
190
|
+
}),
|
|
191
|
+
[o, I, K, S, q, Y]
|
|
192
|
+
), ee = V([]), R = V(0), A = M(
|
|
193
|
+
() => (t ?? []).filter((i) => {
|
|
194
|
+
var l;
|
|
195
|
+
return !!((l = i.image) != null && l.assetId);
|
|
196
|
+
}),
|
|
197
|
+
[t]
|
|
198
|
+
), W = P / m, ye = _ * je(Z), Me = Math.min(Fe, U * m), N = Ae * m, te = Me + N * 2, Ie = Math.max(0, U - 1) * P + (m - 1) * W, oe = F > 0, w = X === "scroll" && oe, $ = X === "autoplay" && oe && (o ? !!r : !0), re = $ ? 360 / (F * Se) : 0, ne = A.length === 0 ? 0 : te, B = M(
|
|
199
|
+
() => Array.from({ length: ne }, (i, l) => rt(l - N, m)),
|
|
200
|
+
[ne, N, m]
|
|
201
|
+
);
|
|
202
|
+
xe(() => {
|
|
203
|
+
if (!$ && !w) return;
|
|
204
|
+
const i = a.current;
|
|
205
|
+
if (!i) return;
|
|
206
|
+
const l = (c) => {
|
|
207
|
+
R.current = c, B.forEach((s, O) => {
|
|
208
|
+
const f = ee.current[O];
|
|
209
|
+
if (!f) return;
|
|
210
|
+
const d = le(z, H(s + c));
|
|
211
|
+
f.style.transform = d.transform, f.style.zIndex = String(d.zIndex), f.style.opacity = String(d.opacity), f.style.filter = d.filter;
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
if (w) {
|
|
215
|
+
const c = i.ownerDocument.defaultView ?? window, s = () => {
|
|
216
|
+
const f = i.getBoundingClientRect(), d = c.innerHeight || i.ownerDocument.documentElement.clientHeight, y = d + f.height;
|
|
217
|
+
if (y <= 0) return;
|
|
218
|
+
const L = Math.min(1, Math.max(0, (d - f.top) / y));
|
|
219
|
+
l(it(L, F, g));
|
|
220
|
+
};
|
|
221
|
+
s(), c.addEventListener("scroll", s, { passive: !0, capture: !0 }), c.addEventListener("resize", s);
|
|
222
|
+
const O = new ResizeObserver(s);
|
|
223
|
+
return O.observe(i), () => {
|
|
224
|
+
c.removeEventListener("scroll", s, { capture: !0 }), c.removeEventListener("resize", s), O.disconnect();
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
const E = g === "left" ? -1 : 1;
|
|
228
|
+
let v = null, u = null;
|
|
229
|
+
const T = (c) => {
|
|
230
|
+
if (u !== null) {
|
|
231
|
+
const s = (c - u) / 1e3 / re * E;
|
|
232
|
+
R.current = H(R.current + s);
|
|
233
|
+
}
|
|
234
|
+
u = c, l(R.current), v = requestAnimationFrame(T);
|
|
235
|
+
}, G = () => {
|
|
236
|
+
v === null && (u = null, v = requestAnimationFrame(T));
|
|
237
|
+
}, D = () => {
|
|
238
|
+
v !== null && cancelAnimationFrame(v), v = null;
|
|
239
|
+
}, C = new IntersectionObserver(([c]) => {
|
|
240
|
+
c != null && c.isIntersecting ? G() : D();
|
|
241
|
+
});
|
|
242
|
+
return C.observe(i), () => {
|
|
243
|
+
D(), C.disconnect();
|
|
244
|
+
};
|
|
245
|
+
}, [$, w, B, z, re, F, g]);
|
|
246
|
+
const Ee = $ || w ? R.current : 0;
|
|
247
|
+
return A.length === 0 ? /* @__PURE__ */ ce(ie, { children: [
|
|
248
|
+
/* @__PURE__ */ p("style", { dangerouslySetInnerHTML: { __html: Q } }),
|
|
249
|
+
/* @__PURE__ */ p("div", { className: `${n}-wrapper`, style: { width: b(I) } })
|
|
250
|
+
] }) : /* @__PURE__ */ ce(ie, { children: [
|
|
251
|
+
/* @__PURE__ */ p("style", { dangerouslySetInnerHTML: { __html: Q } }),
|
|
252
|
+
/* @__PURE__ */ p(
|
|
253
|
+
"div",
|
|
254
|
+
{
|
|
255
|
+
ref: a,
|
|
256
|
+
className: `${n}-wrapper`,
|
|
257
|
+
style: {
|
|
258
|
+
width: b(I),
|
|
259
|
+
height: b(Ie)
|
|
260
|
+
},
|
|
261
|
+
children: Array.from({ length: te }, (i, l) => {
|
|
262
|
+
const E = l - N, u = A[ve(E, A.length)].image, T = k(E, m), G = B[l], D = ct(E, m, P, W), C = x === 0 ? 0 : (ue(T + 7.3) - 0.5) * x * W, c = h ? 1 : 1 + (ue(T + 3.1) - 0.5) * 2 * me * (0.35 + x), s = _ * c, O = {
|
|
263
|
+
"--helix-base-w": b(s),
|
|
264
|
+
...h ? { "--helix-base-h": b(ye) } : {}
|
|
265
|
+
}, f = {
|
|
266
|
+
top: b(D + C),
|
|
267
|
+
...O,
|
|
268
|
+
...le(z, H(G + Ee))
|
|
269
|
+
}, d = J > 0 ? { borderRadius: b(J) } : {}, y = h ? {
|
|
270
|
+
...d,
|
|
271
|
+
width: "100%",
|
|
272
|
+
height: "100%",
|
|
273
|
+
objectFit: "cover",
|
|
274
|
+
objectPosition: "center"
|
|
275
|
+
} : d, L = de(u) ? /* @__PURE__ */ p(
|
|
276
|
+
Te,
|
|
277
|
+
{
|
|
278
|
+
className: `${n}-media`,
|
|
279
|
+
style: h ? { ...y, position: "absolute", inset: 0 } : y,
|
|
280
|
+
media: u,
|
|
281
|
+
fit: h ? "cover" : "contain"
|
|
282
|
+
}
|
|
283
|
+
) : ke(u) ? /* @__PURE__ */ p(
|
|
284
|
+
_e,
|
|
285
|
+
{
|
|
286
|
+
className: `${n}-media`,
|
|
287
|
+
style: y,
|
|
288
|
+
src: u.assetId,
|
|
289
|
+
muted: !0,
|
|
290
|
+
loop: !0,
|
|
291
|
+
autoPlay: !0,
|
|
292
|
+
playsInline: !0
|
|
293
|
+
}
|
|
294
|
+
) : /* @__PURE__ */ p(
|
|
295
|
+
"img",
|
|
296
|
+
{
|
|
297
|
+
className: `${n}-media`,
|
|
298
|
+
style: y,
|
|
299
|
+
src: u.assetId,
|
|
300
|
+
alt: u.name ?? "",
|
|
301
|
+
loading: "lazy",
|
|
302
|
+
decoding: "async"
|
|
303
|
+
}
|
|
304
|
+
);
|
|
305
|
+
return /* @__PURE__ */ p(
|
|
306
|
+
"div",
|
|
307
|
+
{
|
|
308
|
+
ref: (Oe) => {
|
|
309
|
+
ee.current[l] = Oe;
|
|
310
|
+
},
|
|
311
|
+
className: h ? `${n}-item ${n}-item-cover` : `${n}-item`,
|
|
312
|
+
style: f,
|
|
313
|
+
children: h ? /* @__PURE__ */ p("div", { className: `${n}-cover`, style: d, children: L }) : L
|
|
314
|
+
},
|
|
315
|
+
`${U}-${m}-${E}`
|
|
316
|
+
);
|
|
317
|
+
})
|
|
318
|
+
}
|
|
319
|
+
)
|
|
320
|
+
] });
|
|
321
|
+
}
|
|
322
|
+
export {
|
|
323
|
+
ht as Helix
|
|
324
|
+
};
|