@cntrl-site/components 1.0.101 → 1.0.102
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/README.md +25 -1
- package/dist/Burger-C6jI6C1c.js +661 -0
- package/dist/Burger-EMSn7TPB.mjs +1807 -0
- package/dist/ClickGallerie-D_O1XhAO.mjs +270 -0
- package/dist/ClickGallerie-M9xdGR1G.js +36 -0
- package/dist/Components/Burger/BurgerComponent.d.ts +0 -1
- package/dist/Components/ClickGallerie/ClickGallerieComponent.d.ts +0 -1
- package/dist/Components/FAQ/FAQComponent.d.ts +0 -1
- package/dist/Components/Form/FormComponent.d.ts +0 -1
- package/dist/Components/Grid/GridComponent.d.ts +0 -1
- package/dist/Components/Helix/HelixComponent.d.ts +0 -1
- package/dist/Components/Hive/HiveComponent.d.ts +0 -1
- package/dist/Components/LightboxJournal/LightboxJournalComponent.d.ts +0 -1
- package/dist/Components/LightboxStrip/LightboxStripComponent.d.ts +0 -1
- package/dist/Components/List/ListComponent.d.ts +0 -1
- package/dist/Components/Marquee/MarqueeComponent.d.ts +0 -1
- package/dist/Components/MarqueeText/MarqueeTextComponent.d.ts +0 -1
- package/dist/Components/Mercury/MercuryComponent.d.ts +0 -1
- package/dist/Components/OnelinerForm/OnelinerFormComponent.d.ts +0 -1
- package/dist/Components/Pretext/PretextComponent.d.ts +0 -1
- package/dist/Components/Scale/ScaleComponent.d.ts +0 -1
- package/dist/Components/SimpleButton/SimpleButtonComponent.d.ts +0 -1
- package/dist/Components/Slider20/Slider20Component.d.ts +0 -1
- package/dist/Components/TestimonialGrid/TestimonialGridComponent.d.ts +0 -1
- package/dist/Components/TestimonialSingle/TestimonialSingleComponent.d.ts +0 -1
- package/dist/Components/Waterfall/WaterfallComponent.d.ts +0 -1
- package/dist/ControlSlider-SiOt22l_.js +1 -0
- package/dist/ControlSlider-pZv7H6BU.mjs +334 -0
- package/dist/FAQ-C7823fyi.js +166 -0
- package/dist/FAQ-CZ39u4m8.mjs +588 -0
- package/dist/Form-BX5_41nb.mjs +472 -0
- package/dist/Form-Dn-6A1He.js +153 -0
- package/dist/Grid-CemGhf3F.js +374 -0
- package/dist/Grid-cfQsXW3b.mjs +1553 -0
- package/dist/Helix-2Vr-9WBa.js +43 -0
- package/dist/Helix-BmkAKT1G.mjs +315 -0
- package/dist/Hive-BC6zQBsv.js +321 -0
- package/dist/Hive-BGMWinrW.mjs +1425 -0
- package/dist/HiveLightboxTitles-DhEeFKWs.mjs +507 -0
- package/dist/HiveLightboxTitles-DlyptAaK.js +1 -0
- package/dist/ImageRevealSlider-BBWtFjUF.js +1 -0
- package/dist/ImageRevealSlider-BdFGyVEP.mjs +184 -0
- package/dist/Lightbox-CIss_nOG.js +1 -0
- package/dist/Lightbox-eP9qAZzL.mjs +665 -0
- package/dist/LightboxJournal-D59ex6wH.mjs +1613 -0
- package/dist/LightboxJournal-DAEZOPDi.js +523 -0
- package/dist/LightboxStrip-BDjI1jyH.js +386 -0
- package/dist/LightboxStrip-YspzBP8N.mjs +1574 -0
- package/dist/List-C32WImI3.js +377 -0
- package/dist/List-DW7fyJbf.mjs +1891 -0
- package/dist/Marquee-BYClHHws.mjs +551 -0
- package/dist/Marquee-vmHaTGIP.js +133 -0
- package/dist/MarqueeText-4Rip_sQX.mjs +515 -0
- package/dist/MarqueeText-E6OubMOG.js +132 -0
- package/dist/Mercury-BwF_XW2w.js +267 -0
- package/dist/Mercury-DuKJQ1Zo.mjs +1701 -0
- package/dist/OnelinerForm-BEu7_sho.mjs +434 -0
- package/dist/OnelinerForm-C2Y_XMCY.js +194 -0
- package/dist/Pretext-10CcyP1E.mjs +2762 -0
- package/dist/Pretext-DvQ3xsni.js +231 -0
- package/dist/PretextComponent-C3YFICy8.js +1 -0
- package/dist/PretextComponent-Ct0newmn.mjs +11624 -0
- package/dist/RichTextRenderer-B6WtTYlR.mjs +32 -0
- package/dist/RichTextRenderer-CIy6yI8U.js +1 -0
- package/dist/Scale-976sjO8e.js +111 -0
- package/dist/Scale-rLNT4KAk.mjs +345 -0
- package/dist/SimpleButton-C-o2W9bS.mjs +451 -0
- package/dist/SimpleButton-nGEcO2gB.js +243 -0
- package/dist/Slider20-C9o2REDl.js +272 -0
- package/dist/Slider20-Dm8BeCli.mjs +851 -0
- package/dist/SvgImage-B5mR9y6q.mjs +51 -0
- package/dist/SvgImage-DFlmxAoL.js +1 -0
- package/dist/TestimonialGrid-CPu4qQ6B.mjs +492 -0
- package/dist/TestimonialGrid-D4ieiz9e.js +90 -0
- package/dist/TestimonialSingle-CVu15ZtV.js +125 -0
- package/dist/TestimonialSingle-DLdnAVF7.mjs +391 -0
- package/dist/Waterfall-A0FjM2my.mjs +1400 -0
- package/dist/Waterfall-DnPDHbCL.js +287 -0
- package/dist/buildColorVars-CE2D5cQV.js +1 -0
- package/dist/buildColorVars-CLyWQm5K.mjs +21 -0
- package/dist/components-OE3ac1dr.js +1 -0
- package/dist/components-w-jHX-2U.mjs +2053 -0
- package/dist/components.css +1 -1
- package/dist/elements.d.ts +7 -0
- package/dist/elements.js +1 -0
- package/dist/elements.mjs +63 -0
- package/dist/elements.node.d.ts +6 -0
- package/dist/elements.node.js +1 -0
- package/dist/elements.node.mjs +21 -0
- package/dist/forking.d.ts +1 -0
- package/dist/formFieldValidation-DZl2KVaF.js +1 -0
- package/dist/formFieldValidation-DvihFrq5.mjs +21 -0
- package/dist/getColorAlpha-BVBY0N5x.mjs +39 -0
- package/dist/getColorAlpha-CoSseoCn.js +1 -0
- package/dist/getImageRect-BQhQXvT8.js +1 -0
- package/dist/getImageRect-CBMhFNHM.mjs +109 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -28862
- package/dist/index.mjs +16 -62473
- package/dist/loadSvgMaskUrl-DfF7ay6h.js +1 -0
- package/dist/loadSvgMaskUrl-xHgGYgPe.mjs +20 -0
- package/dist/panelAvailability-D179wwJx.mjs +27 -0
- package/dist/panelAvailability-DnOe0rQ4.js +1 -0
- package/dist/react-splide.esm-CabaEmHi.js +6 -0
- package/dist/react-splide.esm-DQqds4PL.mjs +1750 -0
- package/dist/readTestimonialTextMeasure-BIXpGFEt.mjs +13 -0
- package/dist/readTestimonialTextMeasure-CEPaB4Sy.js +1 -0
- package/dist/scalingValue-C9JH5L6O.mjs +6 -0
- package/dist/scalingValue-CSHYgTZl.js +1 -0
- package/dist/sources.d.ts +1 -0
- package/dist/sources.js +23753 -0
- package/dist/sources.mjs +23779 -0
- package/dist/textStylesToCss-05Mn6I_2.mjs +32 -0
- package/dist/textStylesToCss-CNN3zZTV.js +1 -0
- package/dist/types/Component.d.ts +0 -1
- package/dist/useLightboxScrollLock-Hf16Eq4g.js +1 -0
- package/dist/useLightboxScrollLock-VQ07s7EJ.mjs +18 -0
- package/dist/useLightboxSwipeDismiss-Br9uE5G0.js +1 -0
- package/dist/useLightboxSwipeDismiss-SGv6Ra33.mjs +95 -0
- package/dist/useScopedStyles-Bf6yohVQ.js +1 -0
- package/dist/useScopedStyles-DhBG3557.mjs +11 -0
- package/dist/utils-033j3qNL.js +1 -0
- package/dist/utils-FxC9rcxw.mjs +247 -0
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +17 -11
- package/package.json +31 -2
- package/dist/index-2JTNRDR1.js +0 -1
- package/dist/index-DA8t6EZ4.mjs +0 -255
- package/dist/panelAvailability-CgSic84c.mjs +0 -126
- package/dist/panelAvailability-D8c7cdbu.js +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as o, Fragment as a } from "react/jsx-runtime";
|
|
2
|
+
import { n as m } from "./textStylesToCss-05Mn6I_2.mjs";
|
|
3
|
+
const l = "RichTextRenderer-module__link___BWeZ2", u = {
|
|
4
|
+
link: l
|
|
5
|
+
};
|
|
6
|
+
function s(t) {
|
|
7
|
+
return t != null && t.length ? t.some((e) => e.type === "link" ? s(e.children) : !!e.text) : !1;
|
|
8
|
+
}
|
|
9
|
+
const f = ({ content: t }) => {
|
|
10
|
+
const e = (i) => i.map((n, r) => n.type === "link" ? /* @__PURE__ */ o("a", { className: u.link, href: n.value, target: n.target, children: e(n.children) }, r) : /* @__PURE__ */ o("span", { style: x(n), children: n.text }, r));
|
|
11
|
+
return /* @__PURE__ */ o(a, { children: t.map((i, n) => {
|
|
12
|
+
const r = i.children;
|
|
13
|
+
return /* @__PURE__ */ o("div", { children: s(r) ? e(r) : " " }, n);
|
|
14
|
+
}) });
|
|
15
|
+
};
|
|
16
|
+
function x(t) {
|
|
17
|
+
return {
|
|
18
|
+
...t.fontFamily && { fontFamily: m(t.fontFamily) },
|
|
19
|
+
...t.fontWeight && { fontWeight: t.fontWeight },
|
|
20
|
+
...t.fontStyle && { fontStyle: t.fontStyle },
|
|
21
|
+
...t.textDecoration && { textDecoration: t.textDecoration },
|
|
22
|
+
...t.textTransform && { textTransform: t.textTransform },
|
|
23
|
+
...t.fontVariant && { fontVariant: t.fontVariant },
|
|
24
|
+
...t.verticalAlign && {
|
|
25
|
+
verticalAlign: t.verticalAlign,
|
|
26
|
+
lineHeight: "0px"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
f as R
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const i=require("react/jsx-runtime"),a=require("./textStylesToCss-CNN3zZTV.js"),u="RichTextRenderer-module__link___BWeZ2",x={link:u};function s(t){return t!=null&&t.length?t.some(n=>n.type==="link"?s(n.children):!!n.text):!1}const c=({content:t})=>{const n=o=>o.map((e,r)=>e.type==="link"?i.jsx("a",{className:x.link,href:e.value,target:e.target,children:n(e.children)},r):i.jsx("span",{style:l(e),children:e.text},r));return i.jsx(i.Fragment,{children:t.map((o,e)=>{const r=o.children;return i.jsx("div",{children:s(r)?n(r):" "},e)})})};function l(t){return{...t.fontFamily&&{fontFamily:a.normalizeFontFamilyCssValue(t.fontFamily)},...t.fontWeight&&{fontWeight:t.fontWeight},...t.fontStyle&&{fontStyle:t.fontStyle},...t.textDecoration&&{textDecoration:t.textDecoration},...t.textTransform&&{textTransform:t.textTransform},...t.fontVariant&&{fontVariant:t.fontVariant},...t.verticalAlign&&{verticalAlign:t.verticalAlign,lineHeight:"0px"}}}exports.RichTextRenderer=c;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("react"),w=require("classnames"),Fe=require("./useScopedStyles-Bf6yohVQ.js"),Te=100,Me=70,m="cubic-bezier(0.86, 0, 0.07, 1)";function Ce(e){return`
|
|
2
|
+
.${e}-wrapper {
|
|
3
|
+
position: relative;
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 100%;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
}
|
|
8
|
+
.${e}-background {
|
|
9
|
+
position: absolute;
|
|
10
|
+
inset: 0;
|
|
11
|
+
z-index: 1;
|
|
12
|
+
pointer-events: none;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
}
|
|
15
|
+
.${e}-effect-image {
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
object-fit: cover;
|
|
19
|
+
display: block;
|
|
20
|
+
}
|
|
21
|
+
.${e}-stage {
|
|
22
|
+
position: absolute;
|
|
23
|
+
left: 50%;
|
|
24
|
+
top: 50%;
|
|
25
|
+
transform: translate(-50%, -50%) scale(var(--${e}-stage-scale, 1));
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
}
|
|
28
|
+
.${e}-foreground {
|
|
29
|
+
z-index: 2;
|
|
30
|
+
}
|
|
31
|
+
.${e}-incoming {
|
|
32
|
+
will-change: transform;
|
|
33
|
+
}
|
|
34
|
+
.${e}-incoming-next {
|
|
35
|
+
z-index: 4;
|
|
36
|
+
transition: transform var(--${e}-transition-ms) ${m};
|
|
37
|
+
}
|
|
38
|
+
.${e}-incoming-prev {
|
|
39
|
+
z-index: 4;
|
|
40
|
+
transition: transform var(--${e}-transition-ms) ${m};
|
|
41
|
+
}
|
|
42
|
+
.${e}-outgoing {
|
|
43
|
+
will-change: transform;
|
|
44
|
+
}
|
|
45
|
+
.${e}-outgoing-next {
|
|
46
|
+
z-index: 3;
|
|
47
|
+
transition: transform var(--${e}-transition-ms) ${m};
|
|
48
|
+
}
|
|
49
|
+
.${e}-outgoing-prev {
|
|
50
|
+
z-index: 3;
|
|
51
|
+
transition: transform var(--${e}-transition-ms) ${m};
|
|
52
|
+
}
|
|
53
|
+
.${e}-outgoing-next .${e}-effect-image {
|
|
54
|
+
transition: filter var(--${e}-transition-ms) ${m};
|
|
55
|
+
}
|
|
56
|
+
.${e}-outgoing-prev .${e}-effect-image {
|
|
57
|
+
transition: filter var(--${e}-transition-ms) ${m};
|
|
58
|
+
}
|
|
59
|
+
.${e}-incoming .${e}-effect-image {
|
|
60
|
+
transition: filter var(--${e}-transition-ms) ${m};
|
|
61
|
+
}
|
|
62
|
+
.${e}-background .${e}-effect-image {
|
|
63
|
+
transition: filter var(--${e}-transition-ms) ${m};
|
|
64
|
+
}
|
|
65
|
+
.${e}-snap .${e}-incoming,
|
|
66
|
+
.${e}-snap .${e}-outgoing,
|
|
67
|
+
.${e}-snap .${e}-outgoing .${e}-effect-image,
|
|
68
|
+
.${e}-snap .${e}-incoming .${e}-effect-image {
|
|
69
|
+
transition: none !important;
|
|
70
|
+
}
|
|
71
|
+
.${e}-nav {
|
|
72
|
+
position: absolute;
|
|
73
|
+
top: 0;
|
|
74
|
+
bottom: 0;
|
|
75
|
+
width: 50%;
|
|
76
|
+
z-index: 5;
|
|
77
|
+
margin: 0;
|
|
78
|
+
padding: 0;
|
|
79
|
+
border: none;
|
|
80
|
+
background: none;
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
outline: none;
|
|
83
|
+
-webkit-tap-highlight-color: transparent;
|
|
84
|
+
}
|
|
85
|
+
.${e}-nav-prev {
|
|
86
|
+
left: 0;
|
|
87
|
+
cursor: w-resize;
|
|
88
|
+
}
|
|
89
|
+
.${e}-nav-next {
|
|
90
|
+
right: 0;
|
|
91
|
+
cursor: e-resize;
|
|
92
|
+
}
|
|
93
|
+
.${e}-nav:focus,
|
|
94
|
+
.${e}-nav:focus-visible {
|
|
95
|
+
outline: none;
|
|
96
|
+
}
|
|
97
|
+
.${e}-editor .${e}-nav {
|
|
98
|
+
cursor: default;
|
|
99
|
+
pointer-events: none;
|
|
100
|
+
}
|
|
101
|
+
.${e}-foreground {
|
|
102
|
+
pointer-events: none;
|
|
103
|
+
}
|
|
104
|
+
.${e}-image {
|
|
105
|
+
width: 100%;
|
|
106
|
+
height: 100%;
|
|
107
|
+
object-fit: contain;
|
|
108
|
+
display: block;
|
|
109
|
+
pointer-events: none;
|
|
110
|
+
}
|
|
111
|
+
`}function Re(e){return e==="blur"?Me:e==="greyscale"?Te:0}function T(e,n=1,l=1){const c=Re(e)*Math.max(0,Math.min(1,n));if(e==="greyscale")return`grayscale(${c}%)`;if(e==="blur"){const t=c/4;return t<=0?"none":`blur(${t/Math.max(l,1)}px)`}return"none"}function ue(e){return e<=1?{backgroundIndex:0,activeIndex:0}:{backgroundIndex:0,activeIndex:1}}function Ae(e,n){return n<=1?0:(e-1+n)%n}function Ee(e,n=1){return!e||e.height===0?n:e.width/e.height}function Oe(e,n,l,c,t){if(e<=0||n<=0)return{widthPercent:c,heightPercent:t};const E=e*c/100,M=n*t/100;let y=E,p=y/l;return p>M&&(p=M,y=p*l),{widthPercent:y/e*100,heightPercent:p/n*100}}function de(e,n,l){if(e<=0||n<=0)return 1;const c=e*l.widthPercent/100,t=n*l.heightPercent/100;return c<=0||t<=0?1:Math.max(e/c,n/t)}function fe(e){return{width:`${e.widthPercent}%`,height:`${e.heightPercent}%`}}function he(e,n,l){return{...fe(e),[`--${l}-stage-scale`]:n}}function qe(e,n){[...new Set(e.filter(Boolean))].forEach(c=>{const t=new Image;t.onload=()=>{t.naturalWidth>0&&t.naturalHeight>0&&n(c,{width:t.naturalWidth,height:t.naturalHeight})},t.src=c})}function Be({settings:e,content:n,isEditor:l,isPreviewMode:c}){var ee,te,ne,ie,se,ae,re;const{prefix:t}=Fe.useScopedStyles(),E=s.useMemo(()=>Ce(t),[t]),{imageSize:M,maxWidth:y,maxHeight:p,transition:me=1e3,bgImage:S="greyscale"}=e,i=n??[],L=ue(i.length),[g,D]=s.useState(L.activeIndex),[G,O]=s.useState(L.backgroundIndex),[I,q]=s.useState(!1),[$e,B]=s.useState(!1),[H,C]=s.useState(null),[W,R]=s.useState(null),[xe,z]=s.useState(0),[ve,k]=s.useState(1),[pe,j]=s.useState("none"),[Y,Z]=s.useState("next"),[J,Se]=s.useState({}),[u,Ie]=s.useState({width:0,height:0}),N=s.useRef(null),K=s.useRef(null),_=!l||!!c,Q=M??60,V=Math.max(10,Math.min(100,y??Q)),X=Math.max(10,Math.min(100,p??Q)),U=Math.max(100,me),be=T(S),b=s.useCallback(o=>{const a=Ee(o?J[o]:void 0);return Oe(u.width,u.height,a,V,X)},[u.height,u.width,J,X,V]);s.useEffect(()=>{const o=K.current;if(!o)return;const a=new ResizeObserver(([d])=>{const{width:f,height:v}=d.contentRect;Ie({width:f,height:v})});return a.observe(o),()=>a.disconnect()},[]),s.useEffect(()=>{const o=(n??[]).map(a=>{var d;return(d=a.image)==null?void 0:d.assetId}).filter(a=>!!a);qe(o,(a,d)=>{Se(f=>{var v,F;return((v=f[a])==null?void 0:v.width)===d.width&&((F=f[a])==null?void 0:F.height)===d.height?f:{...f,[a]:d}})})},[n]),s.useEffect(()=>{const{backgroundIndex:o,activeIndex:a}=ue(i.length);D(a),O(o),q(!1),B(!1),C(null),R(null),z(0),k(1),j("none"),Z("next")},[i.length,n]),s.useEffect(()=>()=>{N.current&&clearTimeout(N.current)},[]);const P=s.useCallback(o=>{var oe,ce,le,ge;if(!_||I||i.length<=1)return;const a=o==="next"?(g+1)%i.length:(g-1+i.length)%i.length,d=b((ce=(oe=i[g])==null?void 0:oe.image)==null?void 0:ce.assetId),f=b((ge=(le=i[a])==null?void 0:le.image)==null?void 0:ge.assetId),v=de(u.width,u.height,d),F=de(u.width,u.height,f);N.current&&clearTimeout(N.current),Z(o),B(!0),q(!0),o==="next"?(C(g),R(a),z(0),k(1),j(T(S,0,1))):(O(Ae(a,i.length)),C(a),R(g),z(1),k(F),j(T(S,1,F))),requestAnimationFrame(()=>{B(!1),requestAnimationFrame(()=>{o==="next"?(z(1),k(v),j(T(S,1,v))):(z(0),k(1),j(T(S,0,1)))})}),N.current=setTimeout(()=>{o==="next"&&O(g),D(a),C(null),R(null),q(!1)},U)},[g,S,u.height,u.width,b,I,_,i,U]),h=i[g],A=G!==null?i[G]:null,$=H!==null?i[H]:null,x=W!==null?i[W]:null,we=i.length<=1?0:(g-1+i.length)%i.length,ye=i.length<=1?0:(g+1)%i.length,ze=b((ee=h==null?void 0:h.image)==null?void 0:ee.assetId),ke=b((te=$==null?void 0:$.image)==null?void 0:te.assetId),je=b((ne=x==null?void 0:x.image)==null?void 0:ne.assetId),Ne={[`--${t}-transition-ms`]:`${U}ms`};return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:E}}),r.jsxs("div",{ref:K,className:w(`${t}-wrapper`,$e&&`${t}-snap`,l&&!c&&`${t}-editor`),style:Ne,"aria-label":"Zoom gallery",children:[((ie=A==null?void 0:A.image)==null?void 0:ie.assetId)&&r.jsx("div",{className:`${t}-background`,"aria-hidden":"true",children:r.jsx("img",{className:`${t}-effect-image`,src:A.image.assetId,alt:"",style:{filter:be}})}),I&&((se=$==null?void 0:$.image)==null?void 0:se.assetId)&&r.jsx("div",{className:w(`${t}-stage`,`${t}-outgoing`,`${t}-outgoing-${Y}`),style:he(ke,ve,t),"aria-hidden":"true",children:r.jsx("img",{className:`${t}-effect-image`,src:$.image.assetId,alt:"",style:{filter:pe}})}),I&&((ae=x==null?void 0:x.image)==null?void 0:ae.assetId)&&r.jsx("div",{className:w(`${t}-stage`,`${t}-incoming`,`${t}-incoming-${Y}`),style:he(je,xe,t),"aria-hidden":"true",children:r.jsx("img",{className:`${t}-image`,src:x.image.assetId,alt:""})}),!I&&((re=h==null?void 0:h.image)==null?void 0:re.assetId)&&r.jsx("div",{className:w(`${t}-stage`,`${t}-foreground`),style:fe(ze),children:r.jsx("img",{className:`${t}-image`,src:h.image.assetId,alt:h.image.name??""})}),_&&i.length>1&&!I&&r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:w(`${t}-nav`,`${t}-nav-prev`),onClick:()=>P("prev"),"aria-label":`Show previous image (${we+1} of ${i.length})`}),r.jsx("button",{type:"button",className:w(`${t}-nav`,`${t}-nav-next`),onClick:()=>P("next"),"aria-label":`Show next image (${ye+1} of ${i.length})`})]})]})]})}exports.Scale=Be;
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import { jsxs as D, Fragment as de, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as Be, useState as c, useRef as me, useCallback as fe, useEffect as E } from "react";
|
|
3
|
+
import S from "classnames";
|
|
4
|
+
import { u as Ee } from "./useScopedStyles-DhBG3557.mjs";
|
|
5
|
+
const Oe = 100, _e = 70, f = "cubic-bezier(0.86, 0, 0.07, 1)";
|
|
6
|
+
function Ue(e) {
|
|
7
|
+
return `
|
|
8
|
+
.${e}-wrapper {
|
|
9
|
+
position: relative;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
}
|
|
14
|
+
.${e}-background {
|
|
15
|
+
position: absolute;
|
|
16
|
+
inset: 0;
|
|
17
|
+
z-index: 1;
|
|
18
|
+
pointer-events: none;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
}
|
|
21
|
+
.${e}-effect-image {
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
object-fit: cover;
|
|
25
|
+
display: block;
|
|
26
|
+
}
|
|
27
|
+
.${e}-stage {
|
|
28
|
+
position: absolute;
|
|
29
|
+
left: 50%;
|
|
30
|
+
top: 50%;
|
|
31
|
+
transform: translate(-50%, -50%) scale(var(--${e}-stage-scale, 1));
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
}
|
|
34
|
+
.${e}-foreground {
|
|
35
|
+
z-index: 2;
|
|
36
|
+
}
|
|
37
|
+
.${e}-incoming {
|
|
38
|
+
will-change: transform;
|
|
39
|
+
}
|
|
40
|
+
.${e}-incoming-next {
|
|
41
|
+
z-index: 4;
|
|
42
|
+
transition: transform var(--${e}-transition-ms) ${f};
|
|
43
|
+
}
|
|
44
|
+
.${e}-incoming-prev {
|
|
45
|
+
z-index: 4;
|
|
46
|
+
transition: transform var(--${e}-transition-ms) ${f};
|
|
47
|
+
}
|
|
48
|
+
.${e}-outgoing {
|
|
49
|
+
will-change: transform;
|
|
50
|
+
}
|
|
51
|
+
.${e}-outgoing-next {
|
|
52
|
+
z-index: 3;
|
|
53
|
+
transition: transform var(--${e}-transition-ms) ${f};
|
|
54
|
+
}
|
|
55
|
+
.${e}-outgoing-prev {
|
|
56
|
+
z-index: 3;
|
|
57
|
+
transition: transform var(--${e}-transition-ms) ${f};
|
|
58
|
+
}
|
|
59
|
+
.${e}-outgoing-next .${e}-effect-image {
|
|
60
|
+
transition: filter var(--${e}-transition-ms) ${f};
|
|
61
|
+
}
|
|
62
|
+
.${e}-outgoing-prev .${e}-effect-image {
|
|
63
|
+
transition: filter var(--${e}-transition-ms) ${f};
|
|
64
|
+
}
|
|
65
|
+
.${e}-incoming .${e}-effect-image {
|
|
66
|
+
transition: filter var(--${e}-transition-ms) ${f};
|
|
67
|
+
}
|
|
68
|
+
.${e}-background .${e}-effect-image {
|
|
69
|
+
transition: filter var(--${e}-transition-ms) ${f};
|
|
70
|
+
}
|
|
71
|
+
.${e}-snap .${e}-incoming,
|
|
72
|
+
.${e}-snap .${e}-outgoing,
|
|
73
|
+
.${e}-snap .${e}-outgoing .${e}-effect-image,
|
|
74
|
+
.${e}-snap .${e}-incoming .${e}-effect-image {
|
|
75
|
+
transition: none !important;
|
|
76
|
+
}
|
|
77
|
+
.${e}-nav {
|
|
78
|
+
position: absolute;
|
|
79
|
+
top: 0;
|
|
80
|
+
bottom: 0;
|
|
81
|
+
width: 50%;
|
|
82
|
+
z-index: 5;
|
|
83
|
+
margin: 0;
|
|
84
|
+
padding: 0;
|
|
85
|
+
border: none;
|
|
86
|
+
background: none;
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
outline: none;
|
|
89
|
+
-webkit-tap-highlight-color: transparent;
|
|
90
|
+
}
|
|
91
|
+
.${e}-nav-prev {
|
|
92
|
+
left: 0;
|
|
93
|
+
cursor: w-resize;
|
|
94
|
+
}
|
|
95
|
+
.${e}-nav-next {
|
|
96
|
+
right: 0;
|
|
97
|
+
cursor: e-resize;
|
|
98
|
+
}
|
|
99
|
+
.${e}-nav:focus,
|
|
100
|
+
.${e}-nav:focus-visible {
|
|
101
|
+
outline: none;
|
|
102
|
+
}
|
|
103
|
+
.${e}-editor .${e}-nav {
|
|
104
|
+
cursor: default;
|
|
105
|
+
pointer-events: none;
|
|
106
|
+
}
|
|
107
|
+
.${e}-foreground {
|
|
108
|
+
pointer-events: none;
|
|
109
|
+
}
|
|
110
|
+
.${e}-image {
|
|
111
|
+
width: 100%;
|
|
112
|
+
height: 100%;
|
|
113
|
+
object-fit: contain;
|
|
114
|
+
display: block;
|
|
115
|
+
pointer-events: none;
|
|
116
|
+
}
|
|
117
|
+
`;
|
|
118
|
+
}
|
|
119
|
+
function Le(e) {
|
|
120
|
+
return e === "blur" ? _e : e === "greyscale" ? Oe : 0;
|
|
121
|
+
}
|
|
122
|
+
function M(e, n = 1, o = 1) {
|
|
123
|
+
const r = Le(e) * Math.max(0, Math.min(1, n));
|
|
124
|
+
if (e === "greyscale")
|
|
125
|
+
return `grayscale(${r}%)`;
|
|
126
|
+
if (e === "blur") {
|
|
127
|
+
const t = r / 4;
|
|
128
|
+
return t <= 0 ? "none" : `blur(${t / Math.max(o, 1)}px)`;
|
|
129
|
+
}
|
|
130
|
+
return "none";
|
|
131
|
+
}
|
|
132
|
+
function $e(e) {
|
|
133
|
+
return e <= 1 ? { backgroundIndex: 0, activeIndex: 0 } : { backgroundIndex: 0, activeIndex: 1 };
|
|
134
|
+
}
|
|
135
|
+
function je(e, n) {
|
|
136
|
+
return n <= 1 ? 0 : (e - 1 + n) % n;
|
|
137
|
+
}
|
|
138
|
+
function qe(e, n = 1) {
|
|
139
|
+
return !e || e.height === 0 ? n : e.width / e.height;
|
|
140
|
+
}
|
|
141
|
+
function De(e, n, o, r, t) {
|
|
142
|
+
if (e <= 0 || n <= 0)
|
|
143
|
+
return { widthPercent: r, heightPercent: t };
|
|
144
|
+
const O = e * r / 100, A = n * t / 100;
|
|
145
|
+
let y = O, p = y / o;
|
|
146
|
+
return p > A && (p = A, y = p * o), {
|
|
147
|
+
widthPercent: y / e * 100,
|
|
148
|
+
heightPercent: p / n * 100
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function xe(e, n, o) {
|
|
152
|
+
if (e <= 0 || n <= 0) return 1;
|
|
153
|
+
const r = e * o.widthPercent / 100, t = n * o.heightPercent / 100;
|
|
154
|
+
return r <= 0 || t <= 0 ? 1 : Math.max(e / r, n / t);
|
|
155
|
+
}
|
|
156
|
+
function pe(e) {
|
|
157
|
+
return {
|
|
158
|
+
width: `${e.widthPercent}%`,
|
|
159
|
+
height: `${e.heightPercent}%`
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function ve(e, n, o) {
|
|
163
|
+
return {
|
|
164
|
+
...pe(e),
|
|
165
|
+
[`--${o}-stage-scale`]: n
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function Ge(e, n) {
|
|
169
|
+
[...new Set(e.filter(Boolean))].forEach((r) => {
|
|
170
|
+
const t = new Image();
|
|
171
|
+
t.onload = () => {
|
|
172
|
+
t.naturalWidth > 0 && t.naturalHeight > 0 && n(r, { width: t.naturalWidth, height: t.naturalHeight });
|
|
173
|
+
}, t.src = r;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
function Je({ settings: e, content: n, isEditor: o, isPreviewMode: r }) {
|
|
177
|
+
var ne, ie, ae, se, re, oe, ce;
|
|
178
|
+
const { prefix: t } = Ee(), O = Be(() => Ue(t), [t]), {
|
|
179
|
+
imageSize: A,
|
|
180
|
+
maxWidth: y,
|
|
181
|
+
maxHeight: p,
|
|
182
|
+
transition: Ie = 1e3,
|
|
183
|
+
bgImage: I = "greyscale"
|
|
184
|
+
} = e, i = n ?? [], G = $e(i.length), [g, H] = c(G.activeIndex), [W, _] = c(G.backgroundIndex), [w, U] = c(!1), [we, L] = c(!1), [Y, C] = c(null), [Z, R] = c(null), [be, z] = c(0), [Se, k] = c(1), [ye, N] = c("none"), [J, K] = c("next"), [Q, ze] = c({}), [u, ke] = c({ width: 0, height: 0 }), F = me(null), V = me(null), j = !o || !!r, X = A ?? 60, P = Math.max(10, Math.min(100, y ?? X)), ee = Math.max(10, Math.min(100, p ?? X)), q = Math.max(100, Ie), Ne = M(I), b = fe((s) => {
|
|
185
|
+
const a = qe(s ? Q[s] : void 0);
|
|
186
|
+
return De(
|
|
187
|
+
u.width,
|
|
188
|
+
u.height,
|
|
189
|
+
a,
|
|
190
|
+
P,
|
|
191
|
+
ee
|
|
192
|
+
);
|
|
193
|
+
}, [u.height, u.width, Q, ee, P]);
|
|
194
|
+
E(() => {
|
|
195
|
+
const s = V.current;
|
|
196
|
+
if (!s) return;
|
|
197
|
+
const a = new ResizeObserver(([h]) => {
|
|
198
|
+
const { width: m, height: v } = h.contentRect;
|
|
199
|
+
ke({ width: m, height: v });
|
|
200
|
+
});
|
|
201
|
+
return a.observe(s), () => a.disconnect();
|
|
202
|
+
}, []), E(() => {
|
|
203
|
+
const s = (n ?? []).map((a) => {
|
|
204
|
+
var h;
|
|
205
|
+
return (h = a.image) == null ? void 0 : h.assetId;
|
|
206
|
+
}).filter((a) => !!a);
|
|
207
|
+
Ge(s, (a, h) => {
|
|
208
|
+
ze((m) => {
|
|
209
|
+
var v, T;
|
|
210
|
+
return ((v = m[a]) == null ? void 0 : v.width) === h.width && ((T = m[a]) == null ? void 0 : T.height) === h.height ? m : { ...m, [a]: h };
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
}, [n]), E(() => {
|
|
214
|
+
const { backgroundIndex: s, activeIndex: a } = $e(i.length);
|
|
215
|
+
H(a), _(s), U(!1), L(!1), C(null), R(null), z(0), k(1), N("none"), K("next");
|
|
216
|
+
}, [i.length, n]), E(() => () => {
|
|
217
|
+
F.current && clearTimeout(F.current);
|
|
218
|
+
}, []);
|
|
219
|
+
const te = fe((s) => {
|
|
220
|
+
var le, ge, ue, he;
|
|
221
|
+
if (!j || w || i.length <= 1) return;
|
|
222
|
+
const a = s === "next" ? (g + 1) % i.length : (g - 1 + i.length) % i.length, h = b((ge = (le = i[g]) == null ? void 0 : le.image) == null ? void 0 : ge.assetId), m = b((he = (ue = i[a]) == null ? void 0 : ue.image) == null ? void 0 : he.assetId), v = xe(u.width, u.height, h), T = xe(u.width, u.height, m);
|
|
223
|
+
F.current && clearTimeout(F.current), K(s), L(!0), U(!0), s === "next" ? (C(g), R(a), z(0), k(1), N(M(I, 0, 1))) : (_(je(a, i.length)), C(a), R(g), z(1), k(T), N(M(I, 1, T))), requestAnimationFrame(() => {
|
|
224
|
+
L(!1), requestAnimationFrame(() => {
|
|
225
|
+
s === "next" ? (z(1), k(v), N(M(I, 1, v))) : (z(0), k(1), N(M(I, 0, 1)));
|
|
226
|
+
});
|
|
227
|
+
}), F.current = setTimeout(() => {
|
|
228
|
+
s === "next" && _(g), H(a), C(null), R(null), U(!1);
|
|
229
|
+
}, q);
|
|
230
|
+
}, [
|
|
231
|
+
g,
|
|
232
|
+
I,
|
|
233
|
+
u.height,
|
|
234
|
+
u.width,
|
|
235
|
+
b,
|
|
236
|
+
w,
|
|
237
|
+
j,
|
|
238
|
+
i,
|
|
239
|
+
q
|
|
240
|
+
]), d = i[g], B = W !== null ? i[W] : null, $ = Y !== null ? i[Y] : null, x = Z !== null ? i[Z] : null, Fe = i.length <= 1 ? 0 : (g - 1 + i.length) % i.length, Te = i.length <= 1 ? 0 : (g + 1) % i.length, Me = b((ne = d == null ? void 0 : d.image) == null ? void 0 : ne.assetId), Ae = b((ie = $ == null ? void 0 : $.image) == null ? void 0 : ie.assetId), Ce = b((ae = x == null ? void 0 : x.image) == null ? void 0 : ae.assetId), Re = {
|
|
241
|
+
[`--${t}-transition-ms`]: `${q}ms`
|
|
242
|
+
};
|
|
243
|
+
return /* @__PURE__ */ D(de, { children: [
|
|
244
|
+
/* @__PURE__ */ l("style", { dangerouslySetInnerHTML: { __html: O } }),
|
|
245
|
+
/* @__PURE__ */ D(
|
|
246
|
+
"div",
|
|
247
|
+
{
|
|
248
|
+
ref: V,
|
|
249
|
+
className: S(`${t}-wrapper`, we && `${t}-snap`, o && !r && `${t}-editor`),
|
|
250
|
+
style: Re,
|
|
251
|
+
"aria-label": "Zoom gallery",
|
|
252
|
+
children: [
|
|
253
|
+
((se = B == null ? void 0 : B.image) == null ? void 0 : se.assetId) && /* @__PURE__ */ l("div", { className: `${t}-background`, "aria-hidden": "true", children: /* @__PURE__ */ l(
|
|
254
|
+
"img",
|
|
255
|
+
{
|
|
256
|
+
className: `${t}-effect-image`,
|
|
257
|
+
src: B.image.assetId,
|
|
258
|
+
alt: "",
|
|
259
|
+
style: { filter: Ne }
|
|
260
|
+
}
|
|
261
|
+
) }),
|
|
262
|
+
w && ((re = $ == null ? void 0 : $.image) == null ? void 0 : re.assetId) && /* @__PURE__ */ l(
|
|
263
|
+
"div",
|
|
264
|
+
{
|
|
265
|
+
className: S(
|
|
266
|
+
`${t}-stage`,
|
|
267
|
+
`${t}-outgoing`,
|
|
268
|
+
`${t}-outgoing-${J}`
|
|
269
|
+
),
|
|
270
|
+
style: ve(Ae, Se, t),
|
|
271
|
+
"aria-hidden": "true",
|
|
272
|
+
children: /* @__PURE__ */ l(
|
|
273
|
+
"img",
|
|
274
|
+
{
|
|
275
|
+
className: `${t}-effect-image`,
|
|
276
|
+
src: $.image.assetId,
|
|
277
|
+
alt: "",
|
|
278
|
+
style: { filter: ye }
|
|
279
|
+
}
|
|
280
|
+
)
|
|
281
|
+
}
|
|
282
|
+
),
|
|
283
|
+
w && ((oe = x == null ? void 0 : x.image) == null ? void 0 : oe.assetId) && /* @__PURE__ */ l(
|
|
284
|
+
"div",
|
|
285
|
+
{
|
|
286
|
+
className: S(
|
|
287
|
+
`${t}-stage`,
|
|
288
|
+
`${t}-incoming`,
|
|
289
|
+
`${t}-incoming-${J}`
|
|
290
|
+
),
|
|
291
|
+
style: ve(Ce, be, t),
|
|
292
|
+
"aria-hidden": "true",
|
|
293
|
+
children: /* @__PURE__ */ l(
|
|
294
|
+
"img",
|
|
295
|
+
{
|
|
296
|
+
className: `${t}-image`,
|
|
297
|
+
src: x.image.assetId,
|
|
298
|
+
alt: ""
|
|
299
|
+
}
|
|
300
|
+
)
|
|
301
|
+
}
|
|
302
|
+
),
|
|
303
|
+
!w && ((ce = d == null ? void 0 : d.image) == null ? void 0 : ce.assetId) && /* @__PURE__ */ l(
|
|
304
|
+
"div",
|
|
305
|
+
{
|
|
306
|
+
className: S(`${t}-stage`, `${t}-foreground`),
|
|
307
|
+
style: pe(Me),
|
|
308
|
+
children: /* @__PURE__ */ l(
|
|
309
|
+
"img",
|
|
310
|
+
{
|
|
311
|
+
className: `${t}-image`,
|
|
312
|
+
src: d.image.assetId,
|
|
313
|
+
alt: d.image.name ?? ""
|
|
314
|
+
}
|
|
315
|
+
)
|
|
316
|
+
}
|
|
317
|
+
),
|
|
318
|
+
j && i.length > 1 && !w && /* @__PURE__ */ D(de, { children: [
|
|
319
|
+
/* @__PURE__ */ l(
|
|
320
|
+
"button",
|
|
321
|
+
{
|
|
322
|
+
type: "button",
|
|
323
|
+
className: S(`${t}-nav`, `${t}-nav-prev`),
|
|
324
|
+
onClick: () => te("prev"),
|
|
325
|
+
"aria-label": `Show previous image (${Fe + 1} of ${i.length})`
|
|
326
|
+
}
|
|
327
|
+
),
|
|
328
|
+
/* @__PURE__ */ l(
|
|
329
|
+
"button",
|
|
330
|
+
{
|
|
331
|
+
type: "button",
|
|
332
|
+
className: S(`${t}-nav`, `${t}-nav-next`),
|
|
333
|
+
onClick: () => te("next"),
|
|
334
|
+
"aria-label": `Show next image (${Te + 1} of ${i.length})`
|
|
335
|
+
}
|
|
336
|
+
)
|
|
337
|
+
] })
|
|
338
|
+
]
|
|
339
|
+
}
|
|
340
|
+
)
|
|
341
|
+
] });
|
|
342
|
+
}
|
|
343
|
+
export {
|
|
344
|
+
Je as Scale
|
|
345
|
+
};
|