@cntrl-site/components 1.0.101 → 1.0.103
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-D7g093HX.js +36 -0
- package/dist/ClickGallerie-QSOQjSdv.mjs +271 -0
- package/dist/Components/Burger/BurgerComponent.d.ts +0 -1
- package/dist/Components/ClickGallerie/ClickGallerie.d.ts +1 -0
- 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/Scale.d.ts +2 -0
- 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-CGycuNNn.js +1 -0
- package/dist/PretextComponent-DN8cyZ8x.mjs +11633 -0
- package/dist/RichTextRenderer-B6WtTYlR.mjs +32 -0
- package/dist/RichTextRenderer-CIy6yI8U.js +1 -0
- package/dist/Scale-Bg3bGICG.js +114 -0
- package/dist/Scale-TnkWtRrs.mjs +409 -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-BFJINCME.mjs +2053 -0
- package/dist/components-DTCDEBo0.js +1 -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 +23865 -0
- package/dist/sources.mjs +23891 -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,36 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react/jsx-runtime"),l=require("react"),te=require("./useScopedStyles-Bf6yohVQ.js"),ne={sizeType:"custom",value:700,min:400,max:700};function z(o,a){return{widthPx:o,heightPx:o*a}}function q(o,a,i,s,t,h){return{x:Math.min(Math.max(o,t/2),i-t/2),y:Math.min(Math.max(a,h/2),s-h/2)}}function A(o,a,i,s){const{heightPx:t}=z(i,s);return q(o/2,a/2,o,a,i,t)}function Z(o,a,i){for(const s of i){const{heightPx:t}=z(s.widthPx,s.aspectRatio),h=s.widthPx/2,f=t/2;if(o>=s.x-h&&o<=s.x+h&&a>=s.y-f&&a<=s.y+f)return!0}return!1}function se(o,a,i,s,t,h,f,p){if(t==="system")return"none";const P=s.getBoundingClientRect(),R=document.elementFromPoint(P.left+o,P.top+a);return R&&R.closest("a")?"none":Z(o,a,i)||h==="area"?f??"none":p??"none"}function H(o,a,i){var p;const{sizeType:s,value:t,min:h,max:f}=a;return s==="custom"?t:s==="as is"?((p=i.get(o))==null?void 0:p.naturalWidth)??t:Math.round(Math.random()*(f-h)+h)}function re(o){return`
|
|
2
|
+
.${o}-root {
|
|
3
|
+
position: absolute;
|
|
4
|
+
top: 0;
|
|
5
|
+
left: 0;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
}
|
|
10
|
+
.${o}-wrapper {
|
|
11
|
+
position: absolute;
|
|
12
|
+
transform: translate(-50%, -50%);
|
|
13
|
+
height: auto;
|
|
14
|
+
}
|
|
15
|
+
.${o}-image {
|
|
16
|
+
display: block;
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: auto;
|
|
19
|
+
object-fit: cover;
|
|
20
|
+
position: relative;
|
|
21
|
+
user-select: none;
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
}
|
|
24
|
+
.${o}-link {
|
|
25
|
+
width: 100%;
|
|
26
|
+
display: block;
|
|
27
|
+
}
|
|
28
|
+
.${o}-cursor {
|
|
29
|
+
position: absolute;
|
|
30
|
+
top: 0;
|
|
31
|
+
left: 0;
|
|
32
|
+
pointer-events: none;
|
|
33
|
+
width: 32px;
|
|
34
|
+
height: 32px;
|
|
35
|
+
}
|
|
36
|
+
`}function oe(o){return new Promise(a=>{const i=new Image;i.onload=()=>{a({aspectRatio:i.naturalHeight/i.naturalWidth,naturalWidth:i.naturalWidth})},i.onerror=()=>{a({aspectRatio:1,naturalWidth:700})},i.src=o})}async function ae(o){const a=[...new Set(o.filter(Boolean))],i=await Promise.all(a.map(async s=>[s,await oe(s)]));return new Map(i)}function ie({settings:o,content:a=[],isEditor:i}){const{prefix:s}=te.useScopedStyles(),[t,h]=l.useState(null),[f,p]=l.useState([]),[P,R]=l.useState(0),J=l.useRef(0),[F,K]=l.useState({x:0,y:0}),[X,Y]=l.useState("none"),M=l.useRef({x:0,y:0}),[w,G]=l.useState(!1),[N,T]=l.useState(!1),S=l.useRef(new Map),{imageSize:k=ne,cursor:O="system",target:$="area",origin:Q,position:V,visible:W="all",defaultCursor:b=null,hoverCursor:j=null}=o,I=Q??V??"random",y=a.filter(e=>{var n;return!!((n=e==null?void 0:e.image)!=null&&n.assetId)}),D=l.useMemo(()=>re(s),[s]),v=l.useCallback((e,n,r=f)=>{if(!t)return;const d=t.getBoundingClientRect(),c=e-d.left,u=n-d.top;K({x:c,y:u}),Y(se(c,u,r,t,O,$,j,b))},[t,f,O,$,j,b]);l.useEffect(()=>{const e=[...y.map(r=>r.image.assetId),b,j].filter(r=>!!r);if(e.length===0){S.current=new Map,T(!0);return}let n=!1;return T(!1),ae(e).then(r=>{n||(S.current=r,T(!0))}),()=>{n=!0}},[a,b,j]),l.useEffect(()=>{if(!t)return;const e=r=>{r.stopPropagation(),M.current={x:r.clientX,y:r.clientY},v(r.clientX,r.clientY)},n=()=>{w&&v(M.current.x,M.current.y)};return t.addEventListener("mousemove",e),window.addEventListener("scroll",n,!0),()=>{t.removeEventListener("mousemove",e),window.removeEventListener("scroll",n,!0)}},[t,w,v]),l.useEffect(()=>{!t||!w||v(M.current.x,M.current.y)},[f,t,w,v]),l.useEffect(()=>{w||Y("none")},[w]);const U=(e,n,r,d={})=>{var C,L;if(!((C=e==null?void 0:e.image)!=null&&C.assetId))return null;const c=((L=S.current.get(e.image.assetId))==null?void 0:L.aspectRatio)??1,u=H(e.image.assetId,k,S.current),{heightPx:E}=z(u,c);let m=0,g=0;return I==="same"?{x:m,y:g}=A(n,r,u,c):(m=d.x??Math.random()*n,g=d.y??Math.random()*r,{x:m,y:g}=q(m,g,n,r,u,E)),{id:J.current++,assetId:e.image.assetId,link:e.link,name:e.image.name,x:m,y:g,xRatio:m/n,yRatio:g/r,aspectRatio:c,widthPx:u}},B=()=>{if(!t)return;const e=t.getBoundingClientRect(),n=e.width,r=e.height;n===0||r===0||p(d=>d.length===0?d:d.map(c=>{const u=k.sizeType==="random"?c.widthPx:H(c.assetId,k,S.current),{heightPx:E}=z(u,c.aspectRatio);if(I==="same"){const{x:C,y:L}=A(n,r,u,c.aspectRatio);return{...c,x:C,y:L,widthPx:u}}const{x:m,y:g}=q(c.xRatio*n,c.yRatio*r,n,r,u,E);return{...c,x:m,y:g,widthPx:u}}))};l.useEffect(()=>{if(!t||y.length===0||!N)return;const e=t.getBoundingClientRect(),n=e.width,r=e.height,d=U(y[0],n,r);d&&(p([d]),R(y.length>1?1:0))},[k,I,t,a,N]),l.useEffect(()=>{if(!t)return;B();const e=new ResizeObserver(B);return e.observe(t),window.addEventListener("resize",B),()=>{e.disconnect(),window.removeEventListener("resize",B)}},[t,I,k,f.length]),l.useEffect(()=>{W==="last One"&&p(e=>e.length>0?[e[e.length-1]]:[])},[W]);const ee=e=>{if(!t||y.length===0||!N)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left,d=e.clientY-n.top;if($==="image"&&!Z(r,d,f))return;let c=0,u=0;I==="on Click"?(c=r,u=d):I==="same"?(c=n.width/2,u=n.height/2):(c=Math.random()*n.width,u=Math.random()*n.height);const E=y[P%y.length],m=U(E,n.width,n.height,{x:c,y:u});if(!m)return;const g=W==="all"?[...f,m]:[m];p(g),R(C=>(C+1)%y.length),v(e.clientX,e.clientY,g)},_=O==="custom"&&X!=="none";return x.jsxs(x.Fragment,{children:[x.jsx("style",{dangerouslySetInnerHTML:{__html:D}}),x.jsxs("div",{ref:h,onClick:ee,onMouseEnter:()=>G(!0),onMouseLeave:()=>G(!1),className:`${s}-root`,style:{cursor:_?"none":"default"},children:[f.map(e=>x.jsx("div",{className:`${s}-wrapper`,style:{top:`${e.y}px`,left:`${e.x}px`,width:`${e.widthPx}px`,cursor:_?"none":"default"},children:$==="area"&&e.link?x.jsx("a",{href:e.link,target:"_blank",rel:"noreferrer",className:`${s}-link`,children:x.jsx("img",{src:e.assetId,alt:e.name,className:`${s}-image`})}):x.jsx("img",{src:e.assetId,alt:e.name,className:`${s}-image`})},e.id)),w&&_&&x.jsx("div",{className:`${s}-cursor`,style:{left:`${F.x}px`,top:`${F.y}px`,transform:"translate(-50%, -50%)",backgroundImage:`url('${X}')`,backgroundSize:"cover",backgroundPosition:"center"}})]})]})}exports.ClickGallerie=ie;
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { jsxs as Z, Fragment as oe, jsx as M } from "react/jsx-runtime";
|
|
2
|
+
import { useState as y, useRef as Y, useMemo as se, useCallback as ie, useEffect as w } from "react";
|
|
3
|
+
import { u as ae } from "./useScopedStyles-DhBG3557.mjs";
|
|
4
|
+
const ce = {
|
|
5
|
+
sizeType: "custom",
|
|
6
|
+
value: 700,
|
|
7
|
+
min: 400,
|
|
8
|
+
max: 700
|
|
9
|
+
};
|
|
10
|
+
function T(s, i) {
|
|
11
|
+
return {
|
|
12
|
+
widthPx: s,
|
|
13
|
+
heightPx: s * i
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function j(s, i, a, r, t, f) {
|
|
17
|
+
return {
|
|
18
|
+
x: Math.min(Math.max(s, t / 2), a - t / 2),
|
|
19
|
+
y: Math.min(Math.max(i, f / 2), r - f / 2)
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function J(s, i, a, r) {
|
|
23
|
+
const { heightPx: t } = T(a, r);
|
|
24
|
+
return j(
|
|
25
|
+
s / 2,
|
|
26
|
+
i / 2,
|
|
27
|
+
s,
|
|
28
|
+
i,
|
|
29
|
+
a,
|
|
30
|
+
t
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function Q(s, i, a) {
|
|
34
|
+
for (const r of a) {
|
|
35
|
+
const { heightPx: t } = T(r.widthPx, r.aspectRatio), f = r.widthPx / 2, d = t / 2;
|
|
36
|
+
if (s >= r.x - f && s <= r.x + f && i >= r.y - d && i <= r.y + d)
|
|
37
|
+
return !0;
|
|
38
|
+
}
|
|
39
|
+
return !1;
|
|
40
|
+
}
|
|
41
|
+
function le(s, i, a, r, t, f, d, g) {
|
|
42
|
+
if (t === "system")
|
|
43
|
+
return "none";
|
|
44
|
+
const S = r.getBoundingClientRect(), R = document.elementFromPoint(S.left + s, S.top + i);
|
|
45
|
+
return R && R.closest("a") ? "none" : Q(s, i, a) || f === "area" ? d ?? "none" : g ?? "none";
|
|
46
|
+
}
|
|
47
|
+
function K(s, i, a) {
|
|
48
|
+
var g;
|
|
49
|
+
const { sizeType: r, value: t, min: f, max: d } = i;
|
|
50
|
+
return r === "custom" ? t : r === "as is" ? ((g = a.get(s)) == null ? void 0 : g.naturalWidth) ?? t : Math.round(Math.random() * (d - f) + f);
|
|
51
|
+
}
|
|
52
|
+
function ue(s) {
|
|
53
|
+
return `
|
|
54
|
+
.${s}-root {
|
|
55
|
+
position: absolute;
|
|
56
|
+
top: 0;
|
|
57
|
+
left: 0;
|
|
58
|
+
width: 100%;
|
|
59
|
+
height: 100%;
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
}
|
|
62
|
+
.${s}-wrapper {
|
|
63
|
+
position: absolute;
|
|
64
|
+
transform: translate(-50%, -50%);
|
|
65
|
+
height: auto;
|
|
66
|
+
}
|
|
67
|
+
.${s}-image {
|
|
68
|
+
display: block;
|
|
69
|
+
width: 100%;
|
|
70
|
+
height: auto;
|
|
71
|
+
object-fit: cover;
|
|
72
|
+
position: relative;
|
|
73
|
+
user-select: none;
|
|
74
|
+
pointer-events: none;
|
|
75
|
+
}
|
|
76
|
+
.${s}-link {
|
|
77
|
+
width: 100%;
|
|
78
|
+
display: block;
|
|
79
|
+
}
|
|
80
|
+
.${s}-cursor {
|
|
81
|
+
position: absolute;
|
|
82
|
+
top: 0;
|
|
83
|
+
left: 0;
|
|
84
|
+
pointer-events: none;
|
|
85
|
+
width: 32px;
|
|
86
|
+
height: 32px;
|
|
87
|
+
}
|
|
88
|
+
`;
|
|
89
|
+
}
|
|
90
|
+
function de(s) {
|
|
91
|
+
return new Promise((i) => {
|
|
92
|
+
const a = new Image();
|
|
93
|
+
a.onload = () => {
|
|
94
|
+
i({
|
|
95
|
+
aspectRatio: a.naturalHeight / a.naturalWidth,
|
|
96
|
+
naturalWidth: a.naturalWidth
|
|
97
|
+
});
|
|
98
|
+
}, a.onerror = () => {
|
|
99
|
+
i({ aspectRatio: 1, naturalWidth: 700 });
|
|
100
|
+
}, a.src = s;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
async function fe(s) {
|
|
104
|
+
const i = [...new Set(s.filter(Boolean))], a = await Promise.all(
|
|
105
|
+
i.map(async (r) => [r, await de(r)])
|
|
106
|
+
);
|
|
107
|
+
return new Map(a);
|
|
108
|
+
}
|
|
109
|
+
function pe({ settings: s, content: i = [], isEditor: a }) {
|
|
110
|
+
const { prefix: r } = ae(), [t, f] = y(null), [d, g] = y([]), [S, R] = y(0), V = Y(0), [U, D] = y({ x: 0, y: 0 }), [A, G] = y("none"), k = Y({ x: 0, y: 0 }), [x, q] = y(!1), [W, _] = y(!1), $ = Y(/* @__PURE__ */ new Map()), {
|
|
111
|
+
imageSize: P = ce,
|
|
112
|
+
cursor: F = "system",
|
|
113
|
+
target: E = "area",
|
|
114
|
+
origin: ee,
|
|
115
|
+
position: te,
|
|
116
|
+
visible: O = "all",
|
|
117
|
+
defaultCursor: B = null,
|
|
118
|
+
hoverCursor: L = null
|
|
119
|
+
} = s, I = ee ?? te ?? "random", p = i.filter(
|
|
120
|
+
(e) => {
|
|
121
|
+
var n;
|
|
122
|
+
return !!((n = e == null ? void 0 : e.image) != null && n.assetId);
|
|
123
|
+
}
|
|
124
|
+
), ne = se(() => ue(r), [r]), v = ie((e, n, o = d) => {
|
|
125
|
+
if (!t) return;
|
|
126
|
+
const u = t.getBoundingClientRect(), c = e - u.left, l = n - u.top;
|
|
127
|
+
D({ x: c, y: l }), G(
|
|
128
|
+
le(c, l, o, t, F, E, L, B)
|
|
129
|
+
);
|
|
130
|
+
}, [t, d, F, E, L, B]);
|
|
131
|
+
w(() => {
|
|
132
|
+
const e = [
|
|
133
|
+
...p.map((o) => o.image.assetId),
|
|
134
|
+
B,
|
|
135
|
+
L
|
|
136
|
+
].filter((o) => !!o);
|
|
137
|
+
if (e.length === 0) {
|
|
138
|
+
$.current = /* @__PURE__ */ new Map(), _(!0);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
let n = !1;
|
|
142
|
+
return _(!1), fe(e).then((o) => {
|
|
143
|
+
n || ($.current = o, _(!0));
|
|
144
|
+
}), () => {
|
|
145
|
+
n = !0;
|
|
146
|
+
};
|
|
147
|
+
}, [i, B, L]), w(() => {
|
|
148
|
+
if (!t) return;
|
|
149
|
+
const e = (o) => {
|
|
150
|
+
o.stopPropagation(), k.current = { x: o.clientX, y: o.clientY }, v(o.clientX, o.clientY);
|
|
151
|
+
}, n = () => {
|
|
152
|
+
x && v(k.current.x, k.current.y);
|
|
153
|
+
};
|
|
154
|
+
return t.addEventListener("mousemove", e), window.addEventListener("scroll", n, !0), () => {
|
|
155
|
+
t.removeEventListener("mousemove", e), window.removeEventListener("scroll", n, !0);
|
|
156
|
+
};
|
|
157
|
+
}, [t, x, v]), w(() => {
|
|
158
|
+
!t || !x || v(k.current.x, k.current.y);
|
|
159
|
+
}, [d, t, x, v]), w(() => {
|
|
160
|
+
x || G("none");
|
|
161
|
+
}, [x]);
|
|
162
|
+
const H = (e, n, o, u = {}) => {
|
|
163
|
+
var C, N;
|
|
164
|
+
if (!((C = e == null ? void 0 : e.image) != null && C.assetId)) return null;
|
|
165
|
+
const c = ((N = $.current.get(e.image.assetId)) == null ? void 0 : N.aspectRatio) ?? 1, l = K(e.image.assetId, P, $.current), { heightPx: b } = T(l, c);
|
|
166
|
+
let m = 0, h = 0;
|
|
167
|
+
return I === "same" ? { x: m, y: h } = J(n, o, l, c) : (m = u.x ?? Math.random() * n, h = u.y ?? Math.random() * o, { x: m, y: h } = j(m, h, n, o, l, b)), {
|
|
168
|
+
id: V.current++,
|
|
169
|
+
assetId: e.image.assetId,
|
|
170
|
+
link: e.link,
|
|
171
|
+
name: e.image.name,
|
|
172
|
+
x: m,
|
|
173
|
+
y: h,
|
|
174
|
+
xRatio: m / n,
|
|
175
|
+
yRatio: h / o,
|
|
176
|
+
aspectRatio: c,
|
|
177
|
+
widthPx: l
|
|
178
|
+
};
|
|
179
|
+
}, z = () => {
|
|
180
|
+
if (!t) return;
|
|
181
|
+
const e = t.getBoundingClientRect(), n = e.width, o = e.height;
|
|
182
|
+
n === 0 || o === 0 || g((u) => u.length === 0 ? u : u.map((c) => {
|
|
183
|
+
const l = P.sizeType === "random" ? c.widthPx : K(c.assetId, P, $.current), { heightPx: b } = T(l, c.aspectRatio);
|
|
184
|
+
if (I === "same") {
|
|
185
|
+
const { x: C, y: N } = J(n, o, l, c.aspectRatio);
|
|
186
|
+
return { ...c, x: C, y: N, widthPx: l };
|
|
187
|
+
}
|
|
188
|
+
const { x: m, y: h } = j(
|
|
189
|
+
c.xRatio * n,
|
|
190
|
+
c.yRatio * o,
|
|
191
|
+
n,
|
|
192
|
+
o,
|
|
193
|
+
l,
|
|
194
|
+
b
|
|
195
|
+
);
|
|
196
|
+
return { ...c, x: m, y: h, widthPx: l };
|
|
197
|
+
}));
|
|
198
|
+
};
|
|
199
|
+
w(() => {
|
|
200
|
+
if (!t || p.length === 0 || !W) return;
|
|
201
|
+
const e = t.getBoundingClientRect(), n = e.width, o = e.height, u = H(p[0], n, o);
|
|
202
|
+
u && (g([u]), R(p.length > 1 ? 1 : 0));
|
|
203
|
+
}, [P, I, t, i, W]), w(() => {
|
|
204
|
+
if (!t) return;
|
|
205
|
+
z();
|
|
206
|
+
const e = new ResizeObserver(z);
|
|
207
|
+
return e.observe(t), window.addEventListener("resize", z), () => {
|
|
208
|
+
e.disconnect(), window.removeEventListener("resize", z);
|
|
209
|
+
};
|
|
210
|
+
}, [t, I, P, d.length]), w(() => {
|
|
211
|
+
O === "last One" && g((e) => e.length > 0 ? [e[e.length - 1]] : []);
|
|
212
|
+
}, [O]);
|
|
213
|
+
const re = (e) => {
|
|
214
|
+
if (!t || p.length === 0 || !W) return;
|
|
215
|
+
const n = t.getBoundingClientRect(), o = e.clientX - n.left, u = e.clientY - n.top;
|
|
216
|
+
if (E === "image" && !Q(o, u, d)) return;
|
|
217
|
+
let c = 0, l = 0;
|
|
218
|
+
I === "on Click" ? (c = o, l = u) : I === "same" ? (c = n.width / 2, l = n.height / 2) : (c = Math.random() * n.width, l = Math.random() * n.height);
|
|
219
|
+
const b = p[S % p.length], m = H(b, n.width, n.height, { x: c, y: l });
|
|
220
|
+
if (!m) return;
|
|
221
|
+
const h = O === "all" ? [...d, m] : [m];
|
|
222
|
+
g(h), R((C) => (C + 1) % p.length), v(e.clientX, e.clientY, h);
|
|
223
|
+
}, X = F === "custom" && A !== "none";
|
|
224
|
+
return /* @__PURE__ */ Z(oe, { children: [
|
|
225
|
+
/* @__PURE__ */ M("style", { dangerouslySetInnerHTML: { __html: ne } }),
|
|
226
|
+
/* @__PURE__ */ Z(
|
|
227
|
+
"div",
|
|
228
|
+
{
|
|
229
|
+
ref: f,
|
|
230
|
+
onClick: re,
|
|
231
|
+
onMouseEnter: () => q(!0),
|
|
232
|
+
onMouseLeave: () => q(!1),
|
|
233
|
+
className: `${r}-root`,
|
|
234
|
+
style: { cursor: X ? "none" : "default" },
|
|
235
|
+
children: [
|
|
236
|
+
d.map((e) => /* @__PURE__ */ M(
|
|
237
|
+
"div",
|
|
238
|
+
{
|
|
239
|
+
className: `${r}-wrapper`,
|
|
240
|
+
style: {
|
|
241
|
+
top: `${e.y}px`,
|
|
242
|
+
left: `${e.x}px`,
|
|
243
|
+
width: `${e.widthPx}px`,
|
|
244
|
+
cursor: X ? "none" : "default"
|
|
245
|
+
},
|
|
246
|
+
children: E === "area" && e.link ? /* @__PURE__ */ M("a", { href: e.link, target: "_blank", rel: "noreferrer", className: `${r}-link`, children: /* @__PURE__ */ M("img", { src: e.assetId, alt: e.name, className: `${r}-image` }) }) : /* @__PURE__ */ M("img", { src: e.assetId, alt: e.name, className: `${r}-image` })
|
|
247
|
+
},
|
|
248
|
+
e.id
|
|
249
|
+
)),
|
|
250
|
+
x && X && /* @__PURE__ */ M(
|
|
251
|
+
"div",
|
|
252
|
+
{
|
|
253
|
+
className: `${r}-cursor`,
|
|
254
|
+
style: {
|
|
255
|
+
left: `${U.x}px`,
|
|
256
|
+
top: `${U.y}px`,
|
|
257
|
+
transform: "translate(-50%, -50%)",
|
|
258
|
+
backgroundImage: `url('${A}')`,
|
|
259
|
+
backgroundSize: "cover",
|
|
260
|
+
backgroundPosition: "center"
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
)
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
)
|
|
267
|
+
] });
|
|
268
|
+
}
|
|
269
|
+
export {
|
|
270
|
+
pe as ClickGallerie
|
|
271
|
+
};
|
|
@@ -16,6 +16,7 @@ type ClickGallerieSettings = {
|
|
|
16
16
|
imageSize?: ImageSizeSettings;
|
|
17
17
|
cursor?: 'system' | 'custom';
|
|
18
18
|
target?: 'area' | 'image';
|
|
19
|
+
origin?: 'random' | 'same' | 'on Click';
|
|
19
20
|
position?: 'random' | 'same' | 'on Click';
|
|
20
21
|
visible?: 'all' | 'last One';
|
|
21
22
|
defaultCursor?: string | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),g=require("react"),L=require("./react-splide.esm-CabaEmHi.js");;/* empty css */const d=require("classnames"),M=require("./RichTextRenderer-CIy6yI8U.js"),s=require("./scalingValue-CSHYgTZl.js"),k=require("./SvgImage-DFlmxAoL.js"),U=require("./textStylesToCss-CNN3zZTV.js"),H="ControlSlider-module__wrapper___sHEkd",Y="ControlSlider-module__hoverArrow___A-dOH",K="ControlSlider-module__sliderItem___QQSkR",Q="ControlSlider-module__sliderImage___9hRl-",Z="ControlSlider-module__arrow___05ghY",G="ControlSlider-module__arrowVertical___tBfVN",J="ControlSlider-module__nextArrow___-30Yc",X="ControlSlider-module__arrowInner___aEra3",E="ControlSlider-module__arrowIcon___S4ztF",ee="ControlSlider-module__arrowImg___2dwJW",te="ControlSlider-module__mirror___brd6U",oe="ControlSlider-module__pagination___bicLF",ne="ControlSlider-module__paginationInner___bT-P-",ie="ControlSlider-module__paginationVertical___zYqKw",re="ControlSlider-module__paginationItem___nTRbk",le="ControlSlider-module__dot___p1Qun",ae="ControlSlider-module__activeDot___LHFaj",se="ControlSlider-module__paginationInsideBottom___R3FWn",ce="ControlSlider-module__paginationInsideTop___V-qb-",de="ControlSlider-module__paginationOutsideBottom___14w8D",_e="ControlSlider-module__paginationOutsideTop___SCLqB",me="ControlSlider-module__paginationInsideLeft___yOBRZ",ge="ControlSlider-module__paginationInsideRight___Rtt3o",pe="ControlSlider-module__paginationOutsideLeft___lahaw",ue="ControlSlider-module__paginationOutsideRight___EtuQa",he="ControlSlider-module__imgWrapper___UjEgB",fe="ControlSlider-module__captionBlock___dJ6-j",Ce="ControlSlider-module__captionTextWrapper___HFlpf",Se="ControlSlider-module__captionText___uGBVc",ve="ControlSlider-module__active___WZK4G",we="ControlSlider-module__withPointerEvents___t-18M",Ie="ControlSlider-module__topLeftAlignment___zjnGM",xe="ControlSlider-module__topCenterAlignment___gD1xW",Ae="ControlSlider-module__topRightAlignment___NMapS",ye="ControlSlider-module__middleLeftAlignment___OnUrY",Re="ControlSlider-module__middleCenterAlignment___Tdkl0",be="ControlSlider-module__middleRightAlignment___wEbfX",je="ControlSlider-module__bottomLeftAlignment___cTP2-",Le="ControlSlider-module__bottomCenterAlignment___c54fB",ke="ControlSlider-module__bottomRightAlignment___kEwrz",Ve="ControlSlider-module__clickOverlay___DZA28",Te="ControlSlider-module__contain___pLyq7",Oe="ControlSlider-module__cover___KdDat",e={wrapper:H,hoverArrow:Y,sliderItem:K,sliderImage:Q,arrow:Z,arrowVertical:G,nextArrow:J,arrowInner:X,arrowIcon:E,arrowImg:ee,mirror:te,pagination:oe,paginationInner:ne,paginationVertical:ie,paginationItem:re,dot:le,activeDot:ae,paginationInsideBottom:se,paginationInsideTop:ce,paginationOutsideBottom:de,paginationOutsideTop:_e,paginationInsideLeft:me,paginationInsideRight:ge,paginationOutsideLeft:pe,paginationOutsideRight:ue,imgWrapper:he,captionBlock:fe,captionTextWrapper:Ce,captionText:Se,active:ve,withPointerEvents:we,topLeftAlignment:Ie,topCenterAlignment:xe,topRightAlignment:Ae,middleLeftAlignment:ye,middleCenterAlignment:Re,middleRightAlignment:be,bottomLeftAlignment:je,bottomCenterAlignment:Le,bottomRightAlignment:ke,clickOverlay:Ve,contain:Te,cover:Oe},Ne={"top-left":e.topLeftAlignment,"top-center":e.topCenterAlignment,"top-right":e.topRightAlignment,"middle-left":e.middleLeftAlignment,"middle-center":e.middleCenterAlignment,"middle-right":e.middleRightAlignment,"bottom-left":e.bottomLeftAlignment,"bottom-center":e.bottomCenterAlignment,"bottom-right":e.bottomRightAlignment};function ze({settings:p,content:u,styles:T,isEditor:l}){const[_,O]=g.useState(null),{widthSettings:I,fontSettings:v,letterSpacing:N,textAlign:z,wordSpacing:B,fontSizeLineHeight:x,textAppearance:w,color:W}=T.imageCaption??{},[m,F]=g.useState(void 0),[C,q]=g.useState(null),[S,D]=g.useState(0),[$,P]=g.useState(0),{direction:n,transition:a,controls:o,pagination:i,imageCaption:h,triggers:f}=p,A=g.useRef(a.type),{x:y,y:R}=p.controls.offset,b=r=>{_&&_.go(r)};return g.useEffect(()=>{if(!C)return;const r=new ResizeObserver(c=>{if(!_)return;const[j]=c;F({width:Math.round(j.contentRect.width),height:Math.round(j.contentRect.height)})});return r.observe(C),()=>r.unobserve(C)},[C]),g.useEffect(()=>{!_||A.current===a.type||(P(r=>r+1),A.current=a.type)},[a.type]),t.jsx("div",{className:d(e.wrapper,{[e.editor]:l}),ref:q,children:t.jsxs("div",{className:e.sliderInner,style:{width:m?m.width:"100%",height:m?m.height:"100%",backgroundColor:a.backgroundColor&&a.type==="fade in"?a.backgroundColor:"transparent"},children:[p.imageCaption.isActive&&t.jsx("div",{className:d(e.captionBlock),children:t.jsx("div",{className:e.captionTextWrapper,children:u.map((r,c)=>t.jsx("div",{className:d(e.captionText,Ne[h.alignment],{[e.withPointerEvents]:c===S&&l,[e.active]:c===S}),style:{fontFamily:U.normalizeFontFamilyCssValue(v.fontFamily),fontWeight:v.fontWeight,fontStyle:v.fontStyle,width:I.sizing==="auto"?"max-content":s.scalingValue(I.width,l),letterSpacing:s.scalingValue(N,l),wordSpacing:s.scalingValue(B,l),textAlign:z,fontSize:s.scalingValue(x.fontSize,l),lineHeight:s.scalingValue(x.lineHeight,l),textTransform:w.textTransform??"none",textDecoration:w.textDecoration??"none",fontVariant:w.fontVariant??"normal",color:W,transitionDuration:a.duration?`${Math.round(parseInt(a.duration)/2)}ms`:"500ms"},children:t.jsx("div",{"data-styles":"imageCaption",className:e.captionTextInner,style:{"--link-hover-color":h.linkHoverColor,"--link-color":h.linkColor,position:"relative",top:s.scalingValue(h.offset.y,l),left:s.scalingValue(h.offset.x,l)},children:t.jsx(M.RichTextRenderer,{content:r.imageCaption})})},c))})}),t.jsx(L.Splide2,{onMove:r=>{D(r.index)},ref:O,options:{arrows:!1,speed:a.duration?parseInt(a.duration):500,autoplay:f.autoPlay!==null,...f.autoPlay!==null&&{interval:parseInt(f.autoPlay)*1e3},direction:n==="horiz"||a.type==="fade in"?"ltr":"ttb",pagination:!1,drag:f.triggersList.drag,perPage:1,width:m?m.width:"100%",height:m?m.height:"100%",type:a.type==="fade in"?"fade":"loop",rewind:!0},children:u.map((r,c)=>t.jsx(L.SplideSlide,{children:t.jsx("div",{className:e.sliderItem,children:t.jsx("div",{className:e.imgWrapper,children:t.jsx("img",{className:d(e.sliderImage,{[e.contain]:r.image.objectFit==="contain",[e.cover]:r.image.objectFit==="cover"}),src:r.image.assetId,alt:r.image.name??""})})})},c))},$),o.isActive&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:d(e.arrow,{[e.arrowVertical]:n==="vert",[e.hoverArrow]:o.show==="on hover"}),style:{color:o.color,"--arrow-hover-color":o.hover},children:t.jsxs("button",{onClick:()=>{b("-1")},className:e.arrowInner,style:{transform:`translate(${s.scalingValue(y,l)}, ${s.scalingValue(R*(n==="horiz"?1:-1),l)}) scale(${p.controls.scale/100}) rotate(${n==="horiz"?"0deg":"90deg"})`},children:[o.arrowsImgUrl&&t.jsx(k.SvgImage,{url:o.arrowsImgUrl,fill:o.color,hoverFill:o.hover,className:d(e.arrowImg,e.mirror)}),!o.arrowsImgUrl&&t.jsx(V,{color:o.color,className:d(e.arrowIcon,e.arrowImg,e.mirror)})]})}),t.jsx("div",{className:d(e.arrow,e.nextArrow,{[e.arrowVertical]:n==="vert",[e.hoverArrow]:o.show==="on hover"}),style:{color:o.color,"--arrow-hover-color":o.hover},children:t.jsxs("button",{className:e.arrowInner,onClick:()=>b("+1"),style:{transform:`translate(${s.scalingValue(y*(n==="horiz"?-1:1),l)}, ${s.scalingValue(R,l)}) scale(${p.controls.scale/100}) rotate(${n==="horiz"?"0deg":"90deg"})`},children:[o.arrowsImgUrl&&t.jsx(k.SvgImage,{url:o.arrowsImgUrl,fill:o.color,hoverFill:o.hover,className:e.arrowImg}),!o.arrowsImgUrl&&t.jsx(V,{color:o.color,className:d(e.arrowIcon,e.arrowImg)})]})})]}),f.triggersList.click&&t.jsx("div",{className:e.clickOverlay,onClick:()=>{_&&_.go("+1")}}),i.isActive&&t.jsx("div",{className:d(e.pagination,{[e.paginationInsideBottom]:i.position==="inside-1"&&n==="horiz",[e.paginationInsideTop]:i.position==="inside-2"&&n==="horiz",[e.paginationOutsideBottom]:i.position==="outside-1"&&n==="horiz",[e.paginationOutsideTop]:i.position==="outside-2"&&n==="horiz",[e.paginationInsideLeft]:i.position==="inside-1"&&n==="vert",[e.paginationInsideRight]:i.position==="inside-2"&&n==="vert",[e.paginationOutsideLeft]:i.position==="outside-1"&&n==="vert",[e.paginationOutsideRight]:i.position==="outside-2"&&n==="vert",[e.paginationVertical]:n==="vert"}),children:t.jsx("div",{className:e.paginationInner,style:{backgroundColor:i.colors[2],transform:`scale(${i.scale/100}) translate(${s.scalingValue(i.offset.x,l)}, ${s.scalingValue(i.offset.y,l)}) rotate(${n==="horiz"?"0deg":"90deg"})`},children:u.map((r,c)=>t.jsx("button",{onClick:()=>{_&&_.go(c)},className:d(e.paginationItem),children:t.jsx("div",{className:d(e.dot,{[e.activeDot]:c===S}),style:{backgroundColor:c===S?i.colors[0]:i.colors[1],"--pagination-hover-color":i.hover}})},c))})})]})})}function V({color:p,className:u}){return t.jsx("svg",{viewBox:"0 0 10 18",className:u,children:t.jsx("g",{id:"Symbols",stroke:"none",strokeWidth:"1",fillRule:"evenodd",children:t.jsx("path",{d:"M-3.70710678,4.29289322 C-3.34662282,3.93240926 -2.77939176,3.90467972 -2.38710056,4.20970461 L-2.29289322,4.29289322 L5,11.585 L12.2928932,4.29289322 C12.6533772,3.93240926 13.2206082,3.90467972 13.6128994,4.20970461 L13.7071068,4.29289322 C14.0675907,4.65337718 14.0953203,5.22060824 13.7902954,5.61289944 L13.7071068,5.70710678 L5.70710678,13.7071068 C5.34662282,14.0675907 4.77939176,14.0953203 4.38710056,13.7902954 L4.29289322,13.7071068 L-3.70710678,5.70710678 C-4.09763107,5.31658249 -4.09763107,4.68341751 -3.70710678,4.29289322 Z",id:"Shape-Copy",fill:p,transform:"translate(5, 9) rotate(-90) translate(-5, -9)"})})})}exports.ControlSlider=ze;
|