@cntrl-site/components 1.0.90 → 1.0.92
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 +3 -4
- package/dist/index.mjs +4 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -23438,7 +23438,7 @@ export function Mercury({
|
|
|
23438
23438
|
object-fit: cover;
|
|
23439
23439
|
object-position: center;
|
|
23440
23440
|
}
|
|
23441
|
-
`}function hp(e){return Number(e.toFixed(4))}function md(e,t,n,i){const r=(typeof e=="string"?Number(e):e)??t;return Number.isFinite(r)?Math.min(i,Math.max(n,Math.round(r))):t}function Ss(e,t,n=0,i=9999){const r=(typeof e=="string"?Number(e):e)??t;return Number.isFinite(r)?Math.min(i,Math.max(n,r)):t}function $w(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 Cw(e){const[t,n]=e.ratioValue.split(":").map(Number),i=e.reversed?n:t;return(e.reversed?t:n)/i}function Tw(e){return e.type==="video"?!0:e.type==="image"?!1:/\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.name??"")||/\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.url??"")}function fp(e,t){return(1-e)/(1-e*Math.cos(t))}function Lw(e){let t=0;for(let n=0;n<360;n+=1){const i=n*Math.PI/180;t=Math.max(t,Math.abs(Math.sin(i)*fp(e,i)))}return t||1}function Pw(e,t){return e?1:1+gp*(.35+t)}function Iw(e,t,n,i){const o=t*Pw(n,i);return Math.max(0,(e-o)/2)}function Rw(e,t,n){const i=fp(e,n);return{offset:Math.sin(n)*i/t,scale:i}}function kw(e,t,n){return e/2+t*n}function Ew(e,t,n){return`translate(calc(${e(t)} - var(--helix-base-w) / 2), -50%) scale(${hp(n)})`}function Mw(e){return Math.round(e*1e3)}function yp(e,t,n){const i=Math.cos(e),o=Math.cos(Sw*Math.PI/2);if(i>=o)return n;const r=(i+1)/(o+1);return hp(t+(n-t)*r)}function Aw(e){return yp(e,yw,vw)}function Fw(e){return yp(e,xw,bw)}function Nw(e,t){if(!t)return"none";const n=Fw(e);return n<=0?"none":`blur(${n}px)`}function gd(e,t){const n=t*Math.PI*2,{offset:i,scale:o}=Rw(e.depthFactor,e.spreadFactor,n),r=kw(e.width,e.orbitRadius,i);return{transform:Ew(e.scaled,r,o),zIndex:Mw(o),opacity:Aw(n),filter:Nw(n,e.blurEnabled)}}function vp(e,t){return(e%t+t)%t}function _w(e,t){return zl(e,t)/t}function zl(e,t){return vp(e,t)}function Hw(e,t){return Math.floor(e/t)}function Ww(e,t,n,i){return Hw(e,t)*n+zl(e,t)*i}function hd(e){const t=Math.sin(e*12.9898)*43758.5453;return t-Math.floor(t)}function da(e){const t=e%1;return t<0?t+1:t}function Ow(e,t,n){const i=t/mp,o=n==="left"?-e*i:e*i;return da(o)}function Dw({settings:e,content:t,isEditor:n,isPreviewMode:i}){const{prefix:o}=N.useScopedStyles(),r=s.useRef(null),l=Ss((e==null?void 0:e.width)??(e==null?void 0:e.spread)??(e==null?void 0:e.wrapperWidth),cw),c=Ss(e==null?void 0:e.imageWidth,dw),d=Ss(e==null?void 0:e.turnHeight,uw),u=md(e==null?void 0:e.itemsPerTurn,pw,3,40),p=md(e==null?void 0:e.turns,mw,1,30),y=Math.min(fw,Math.max(0,gw)),v=Math.min(1,Math.max(0,hw)),m=Math.max(0,(e==null?void 0:e.speed)??mp),g=(e==null?void 0:e.direction)==="left"?"left":"right",b=(e==null?void 0:e.playback)==="scroll"?"scroll":"autoplay",S=(e==null?void 0:e.cornerRadius)??0,A=(e==null?void 0:e.blur)!=="off",f=s.useMemo(()=>$w(e==null?void 0:e.imageDisplay),[e==null?void 0:e.imageDisplay]),w=f.display==="cover",G=_=>N.scalingValue(_,n??!1),q=s.useMemo(()=>Lw(y),[y]),E=s.useMemo(()=>Iw(l,c,w,v),[l,c,w,v]),P=s.useMemo(()=>ww(o),[o]),M=s.useMemo(()=>({scaled:_=>N.scalingValue(_,n??!1),width:l,orbitRadius:E,depthFactor:y,spreadFactor:q,blurEnabled:A}),[n,l,E,y,q,A]),X=s.useRef([]),$=s.useRef(0),T=s.useMemo(()=>(t??[]).filter(_=>{var le;return!!((le=_.image)!=null&&le.url)}),[t]),O=d/u,F=c*Cw(f),L=Math.min(sw,p*u),C=lw*u,j=L+C*2,Y=Math.max(0,p-1)*d+(u-1)*O,R=m>0,H=b==="scroll"&&R,D=b==="autoplay"&&R&&(n?!!i:!0),Q=D?360/(m*aw):0,ae=T.length===0?0:j,z=s.useMemo(()=>Array.from({length:ae},(_,le)=>_w(le-C,u)),[ae,C,u]);s.useEffect(()=>{if(!D&&!H)return;const _=r.current;if(!_)return;const le=de=>{$.current=de,z.forEach((ve,$e)=>{const ke=X.current[$e];if(!ke)return;const he=gd(M,da(ve+de));ke.style.transform=he.transform,ke.style.zIndex=String(he.zIndex),ke.style.opacity=String(he.opacity),ke.style.filter=he.filter})};if(H){const de=()=>{const $e=_.getBoundingClientRect(),ke=window.innerHeight||document.documentElement.clientHeight,he=ke+$e.height;if(he<=0)return;const Se=Math.min(1,Math.max(0,(ke-$e.top)/he));le(Ow(Se,m,g))};de(),window.addEventListener("scroll",de,{passive:!0}),window.addEventListener("resize",de);const ve=new ResizeObserver(de);return ve.observe(_),()=>{window.removeEventListener("scroll",de),window.removeEventListener("resize",de),ve.disconnect()}}const te=g==="left"?-1:1;let fe=null,Pe=null;const xe=de=>{if(Pe!==null){const ve=(de-Pe)/1e3/Q*te;$.current=da($.current+ve)}Pe=de,le($.current),fe=requestAnimationFrame(xe)},ue=()=>{fe===null&&(Pe=null,fe=requestAnimationFrame(xe))},K=()=>{fe!==null&&cancelAnimationFrame(fe),fe=null},se=new IntersectionObserver(([de])=>{de!=null&&de.isIntersecting?ue():K()});return se.observe(_),()=>{K(),se.disconnect()}},[D,H,z,M,Q,m,g]);const re=D||H?$.current:0;return T.length===0?a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:P}}),a.jsx("div",{className:`${o}-wrapper`,style:{width:G(l)
|
|
23441
|
+
`}function hp(e){return Number(e.toFixed(4))}function md(e,t,n,i){const r=(typeof e=="string"?Number(e):e)??t;return Number.isFinite(r)?Math.min(i,Math.max(n,Math.round(r))):t}function Ss(e,t,n=0,i=9999){const r=(typeof e=="string"?Number(e):e)??t;return Number.isFinite(r)?Math.min(i,Math.max(n,r)):t}function $w(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 Cw(e){const[t,n]=e.ratioValue.split(":").map(Number),i=e.reversed?n:t;return(e.reversed?t:n)/i}function Tw(e){return e.type==="video"?!0:e.type==="image"?!1:/\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.name??"")||/\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.url??"")}function fp(e,t){return(1-e)/(1-e*Math.cos(t))}function Lw(e){let t=0;for(let n=0;n<360;n+=1){const i=n*Math.PI/180;t=Math.max(t,Math.abs(Math.sin(i)*fp(e,i)))}return t||1}function Pw(e,t){return e?1:1+gp*(.35+t)}function Iw(e,t,n,i){const o=t*Pw(n,i);return Math.max(0,(e-o)/2)}function Rw(e,t,n){const i=fp(e,n);return{offset:Math.sin(n)*i/t,scale:i}}function kw(e,t,n){return e/2+t*n}function Ew(e,t,n){return`translate(calc(${e(t)} - var(--helix-base-w) / 2), -50%) scale(${hp(n)})`}function Mw(e){return Math.round(e*1e3)}function yp(e,t,n){const i=Math.cos(e),o=Math.cos(Sw*Math.PI/2);if(i>=o)return n;const r=(i+1)/(o+1);return hp(t+(n-t)*r)}function Aw(e){return yp(e,yw,vw)}function Fw(e){return yp(e,xw,bw)}function Nw(e,t){if(!t)return"none";const n=Fw(e);return n<=0?"none":`blur(${n}px)`}function gd(e,t){const n=t*Math.PI*2,{offset:i,scale:o}=Rw(e.depthFactor,e.spreadFactor,n),r=kw(e.width,e.orbitRadius,i);return{transform:Ew(e.scaled,r,o),zIndex:Mw(o),opacity:Aw(n),filter:Nw(n,e.blurEnabled)}}function vp(e,t){return(e%t+t)%t}function _w(e,t){return zl(e,t)/t}function zl(e,t){return vp(e,t)}function Hw(e,t){return Math.floor(e/t)}function Ww(e,t,n,i){return Hw(e,t)*n+zl(e,t)*i}function hd(e){const t=Math.sin(e*12.9898)*43758.5453;return t-Math.floor(t)}function da(e){const t=e%1;return t<0?t+1:t}function Ow(e,t,n){const i=t/mp,o=n==="left"?-e*i:e*i;return da(o)}function Dw({settings:e,content:t,isEditor:n,isPreviewMode:i}){const{prefix:o}=N.useScopedStyles(),r=s.useRef(null),l=Ss((e==null?void 0:e.width)??(e==null?void 0:e.spread)??(e==null?void 0:e.wrapperWidth),cw),c=Ss(e==null?void 0:e.imageWidth,dw),d=Ss(e==null?void 0:e.turnHeight,uw),u=md(e==null?void 0:e.itemsPerTurn,pw,3,40),p=md(e==null?void 0:e.turns,mw,1,30),y=Math.min(fw,Math.max(0,gw)),v=Math.min(1,Math.max(0,hw)),m=Math.max(0,(e==null?void 0:e.speed)??mp),g=(e==null?void 0:e.direction)==="left"?"left":"right",b=(e==null?void 0:e.playback)==="scroll"?"scroll":"autoplay",S=(e==null?void 0:e.cornerRadius)??0,A=(e==null?void 0:e.blur)!=="off",f=s.useMemo(()=>$w(e==null?void 0:e.imageDisplay),[e==null?void 0:e.imageDisplay]),w=f.display==="cover",G=_=>N.scalingValue(_,n??!1),q=s.useMemo(()=>Lw(y),[y]),E=s.useMemo(()=>Iw(l,c,w,v),[l,c,w,v]),P=s.useMemo(()=>ww(o),[o]),M=s.useMemo(()=>({scaled:_=>N.scalingValue(_,n??!1),width:l,orbitRadius:E,depthFactor:y,spreadFactor:q,blurEnabled:A}),[n,l,E,y,q,A]),X=s.useRef([]),$=s.useRef(0),T=s.useMemo(()=>(t??[]).filter(_=>{var le;return!!((le=_.image)!=null&&le.url)}),[t]),O=d/u,F=c*Cw(f),L=Math.min(sw,p*u),C=lw*u,j=L+C*2,Y=Math.max(0,p-1)*d+(u-1)*O,R=m>0,H=b==="scroll"&&R,D=b==="autoplay"&&R&&(n?!!i:!0),Q=D?360/(m*aw):0,ae=T.length===0?0:j,z=s.useMemo(()=>Array.from({length:ae},(_,le)=>_w(le-C,u)),[ae,C,u]);s.useEffect(()=>{if(!D&&!H)return;const _=r.current;if(!_)return;const le=de=>{$.current=de,z.forEach((ve,$e)=>{const ke=X.current[$e];if(!ke)return;const he=gd(M,da(ve+de));ke.style.transform=he.transform,ke.style.zIndex=String(he.zIndex),ke.style.opacity=String(he.opacity),ke.style.filter=he.filter})};if(H){const de=()=>{const $e=_.getBoundingClientRect(),ke=window.innerHeight||document.documentElement.clientHeight,he=ke+$e.height;if(he<=0)return;const Se=Math.min(1,Math.max(0,(ke-$e.top)/he));le(Ow(Se,m,g))};de(),window.addEventListener("scroll",de,{passive:!0}),window.addEventListener("resize",de);const ve=new ResizeObserver(de);return ve.observe(_),()=>{window.removeEventListener("scroll",de),window.removeEventListener("resize",de),ve.disconnect()}}const te=g==="left"?-1:1;let fe=null,Pe=null;const xe=de=>{if(Pe!==null){const ve=(de-Pe)/1e3/Q*te;$.current=da($.current+ve)}Pe=de,le($.current),fe=requestAnimationFrame(xe)},ue=()=>{fe===null&&(Pe=null,fe=requestAnimationFrame(xe))},K=()=>{fe!==null&&cancelAnimationFrame(fe),fe=null},se=new IntersectionObserver(([de])=>{de!=null&&de.isIntersecting?ue():K()});return se.observe(_),()=>{K(),se.disconnect()}},[D,H,z,M,Q,m,g]);const re=D||H?$.current:0;return T.length===0?a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:P}}),a.jsx("div",{className:`${o}-wrapper`,style:{width:G(l)}})]}):a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:P}}),a.jsx("div",{ref:r,className:`${o}-wrapper`,style:{width:G(l),height:G(Y)},children:Array.from({length:j},(_,le)=>{const te=le-C,Pe=T[vp(te,T.length)].image,xe=zl(te,u),ue=z[le],K=Ww(te,u,d,O),se=v===0?0:(hd(xe+7.3)-.5)*v*O,de=w?1:1+(hd(xe+3.1)-.5)*2*gp*(.35+v),ve=c*de,$e={"--helix-base-w":G(ve),...w?{"--helix-base-h":G(F)}:{}},ke={top:G(K+se),...$e,...gd(M,da(ue+re))},he=S>0?{borderRadius:G(S)}:{},Se=w?{...he,width:"100%",height:"100%",objectFit:"cover",objectPosition:"center"}:he,Te=Tw(Pe)?a.jsx("video",{className:`${o}-media`,style:Se,src:Pe.url,muted:!0,loop:!0,autoPlay:!0,playsInline:!0,preload:"auto"}):a.jsx("img",{className:`${o}-media`,style:Se,src:Pe.url,alt:Pe.name??"",loading:"lazy",decoding:"async"});return a.jsx("div",{ref:h=>{X.current[le]=h},className:w?`${o}-item ${o}-item-cover`:`${o}-item`,style:ke,children:w?a.jsx("div",{className:`${o}-cover`,style:he,children:Te}):Te},`${p}-${u}-${te}`)})})]})}const zw=`import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
|
|
23442
23442
|
import { CommonComponentProps } from '../props';
|
|
23443
23443
|
import { scalingValue } from '../utils/scalingValue';
|
|
23444
23444
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -23903,7 +23903,7 @@ export function Helix({
|
|
|
23903
23903
|
return (
|
|
23904
23904
|
<>
|
|
23905
23905
|
<style dangerouslySetInnerHTML={{ __html: scopedCss }} />
|
|
23906
|
-
<div className={\`\${P}-wrapper\`} style={{ width: scaled(width)
|
|
23906
|
+
<div className={\`\${P}-wrapper\`} style={{ width: scaled(width) }} />
|
|
23907
23907
|
</>
|
|
23908
23908
|
);
|
|
23909
23909
|
}
|
|
@@ -23916,8 +23916,7 @@ export function Helix({
|
|
|
23916
23916
|
className={\`\${P}-wrapper\`}
|
|
23917
23917
|
style={{
|
|
23918
23918
|
width: scaled(width),
|
|
23919
|
-
height: scaled(wrapperHeight)
|
|
23920
|
-
marginInline: 'auto',
|
|
23919
|
+
height: scaled(wrapperHeight)
|
|
23921
23920
|
}}
|
|
23922
23921
|
>
|
|
23923
23922
|
{Array.from({ length: totalItems }, (_, index) => {
|
package/dist/index.mjs
CHANGED
|
@@ -51196,7 +51196,7 @@ function t$({
|
|
|
51196
51196
|
const le = W || N ? S.current : 0;
|
|
51197
51197
|
return C.length === 0 ? /* @__PURE__ */ Y(ft, { children: [
|
|
51198
51198
|
/* @__PURE__ */ l("style", { dangerouslySetInnerHTML: { __html: L } }),
|
|
51199
|
-
/* @__PURE__ */ l("div", { className: `${o}-wrapper`, style: { width: V(a)
|
|
51199
|
+
/* @__PURE__ */ l("div", { className: `${o}-wrapper`, style: { width: V(a) } })
|
|
51200
51200
|
] }) : /* @__PURE__ */ Y(ft, { children: [
|
|
51201
51201
|
/* @__PURE__ */ l("style", { dangerouslySetInnerHTML: { __html: L } }),
|
|
51202
51202
|
/* @__PURE__ */ l(
|
|
@@ -51206,8 +51206,7 @@ function t$({
|
|
|
51206
51206
|
className: `${o}-wrapper`,
|
|
51207
51207
|
style: {
|
|
51208
51208
|
width: V(a),
|
|
51209
|
-
height: V(Z)
|
|
51210
|
-
marginInline: "auto"
|
|
51209
|
+
height: V(Z)
|
|
51211
51210
|
},
|
|
51212
51211
|
children: Array.from({ length: z }, (F, de) => {
|
|
51213
51212
|
const ie = de - $, ke = C[Ap(ie, C.length)].image, we = Qs(ie, d), me = O[de], U = QS(ie, d, c, H), ce = y === 0 ? 0 : (Id(we + 7.3) - 0.5) * y * H, pe = w ? 1 : 1 + (Id(we + 3.1) - 0.5) * 2 * Rp * (0.35 + y), be = s * pe, Le = {
|
|
@@ -51728,7 +51727,7 @@ export function Helix({
|
|
|
51728
51727
|
return (
|
|
51729
51728
|
<>
|
|
51730
51729
|
<style dangerouslySetInnerHTML={{ __html: scopedCss }} />
|
|
51731
|
-
<div className={\`\${P}-wrapper\`} style={{ width: scaled(width)
|
|
51730
|
+
<div className={\`\${P}-wrapper\`} style={{ width: scaled(width) }} />
|
|
51732
51731
|
</>
|
|
51733
51732
|
);
|
|
51734
51733
|
}
|
|
@@ -51741,8 +51740,7 @@ export function Helix({
|
|
|
51741
51740
|
className={\`\${P}-wrapper\`}
|
|
51742
51741
|
style={{
|
|
51743
51742
|
width: scaled(width),
|
|
51744
|
-
height: scaled(wrapperHeight)
|
|
51745
|
-
marginInline: 'auto',
|
|
51743
|
+
height: scaled(wrapperHeight)
|
|
51746
51744
|
}}
|
|
51747
51745
|
>
|
|
51748
51746
|
{Array.from({ length: totalItems }, (_, index) => {
|