@cntrl-site/components 1.0.102 → 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/dist/ClickGallerie-D7g093HX.js +36 -0
- package/dist/{ClickGallerie-D_O1XhAO.mjs → ClickGallerie-QSOQjSdv.mjs} +92 -91
- package/dist/Components/ClickGallerie/ClickGallerie.d.ts +1 -0
- package/dist/Components/Scale/Scale.d.ts +2 -0
- package/dist/{PretextComponent-C3YFICy8.js → PretextComponent-CGycuNNn.js} +1 -1
- package/dist/{PretextComponent-Ct0newmn.mjs → PretextComponent-DN8cyZ8x.mjs} +19 -10
- package/dist/Scale-Bg3bGICG.js +114 -0
- package/dist/Scale-TnkWtRrs.mjs +409 -0
- package/dist/{components-w-jHX-2U.mjs → components-BFJINCME.mjs} +1 -1
- package/dist/{components-OE3ac1dr.js → components-DTCDEBo0.js} +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +2 -2
- package/dist/elements.node.js +1 -1
- package/dist/elements.node.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +2 -2
- package/dist/sources.js +136 -24
- package/dist/sources.mjs +136 -24
- package/package.json +1 -1
- package/dist/ClickGallerie-M9xdGR1G.js +0 -36
- package/dist/Scale-976sjO8e.js +0 -111
- package/dist/Scale-rLNT4KAk.mjs +0 -345
|
@@ -11,8 +11,8 @@ import { createListTextStylePanelTab as dt, LIST_TEXT_STYLE_PREFIXES as A, apply
|
|
|
11
11
|
import { FAQ as St } from "./FAQ-CZ39u4m8.mjs";
|
|
12
12
|
import { STRIP_TEXT_STYLE_PREFIXES as w, createStripTextStylePanelTab as xt, LightboxStrip as Ft, getStripTextStyleSettingKey as p } from "./LightboxStrip-YspzBP8N.mjs";
|
|
13
13
|
import { LightboxJournal as vt } from "./LightboxJournal-D59ex6wH.mjs";
|
|
14
|
-
import { ClickGallerie as Ct } from "./ClickGallerie-
|
|
15
|
-
import { Scale as Tt } from "./Scale-
|
|
14
|
+
import { ClickGallerie as Ct } from "./ClickGallerie-QSOQjSdv.mjs";
|
|
15
|
+
import { Scale as Tt } from "./Scale-TnkWtRrs.mjs";
|
|
16
16
|
import { SimpleButton as Mt } from "./SimpleButton-C-o2W9bS.mjs";
|
|
17
17
|
import { Waterfall as wt } from "./Waterfall-A0FjM2my.mjs";
|
|
18
18
|
import { Slider20 as Lt } from "./Slider20-Dm8BeCli.mjs";
|
|
@@ -7078,10 +7078,10 @@ const Pe = gt(), Ae = {
|
|
|
7078
7078
|
title: "Target",
|
|
7079
7079
|
display: { type: "toggle-cycle", enum: ["area", "image"] }
|
|
7080
7080
|
},
|
|
7081
|
-
|
|
7081
|
+
origin: {
|
|
7082
7082
|
type: "string",
|
|
7083
7083
|
scope: "common",
|
|
7084
|
-
title: "
|
|
7084
|
+
title: "Origin",
|
|
7085
7085
|
display: { type: "toggle-cycle", enum: ["random", "same", "on Click"] }
|
|
7086
7086
|
},
|
|
7087
7087
|
visible: {
|
|
@@ -7112,7 +7112,7 @@ const Pe = gt(), Ae = {
|
|
|
7112
7112
|
},
|
|
7113
7113
|
cursor: "system",
|
|
7114
7114
|
target: "area",
|
|
7115
|
-
|
|
7115
|
+
origin: "random",
|
|
7116
7116
|
visible: "all",
|
|
7117
7117
|
defaultCursor: null,
|
|
7118
7118
|
hoverCursor: null
|
|
@@ -7158,7 +7158,7 @@ const Pe = gt(), Ae = {
|
|
|
7158
7158
|
"imageSize",
|
|
7159
7159
|
"cursor",
|
|
7160
7160
|
"target",
|
|
7161
|
-
"
|
|
7161
|
+
"origin",
|
|
7162
7162
|
"visible",
|
|
7163
7163
|
"defaultCursor",
|
|
7164
7164
|
"hoverCursor"
|
|
@@ -7174,7 +7174,7 @@ const Pe = gt(), Ae = {
|
|
|
7174
7174
|
"__componentName__",
|
|
7175
7175
|
{ type: "row", title: "", items: ["imageSize"] },
|
|
7176
7176
|
{ type: "row", title: "", items: ["cursor", "target"] },
|
|
7177
|
-
{ type: "row", title: "", items: ["
|
|
7177
|
+
{ type: "row", title: "", items: ["origin", "visible"] },
|
|
7178
7178
|
{ type: "row", title: "Custom Cursor", items: ["defaultCursor", "hoverCursor"] }
|
|
7179
7179
|
]
|
|
7180
7180
|
}
|
|
@@ -7250,20 +7250,28 @@ const Pe = gt(), Ae = {
|
|
|
7250
7250
|
scope: "common",
|
|
7251
7251
|
title: "BG image",
|
|
7252
7252
|
display: { type: "toggle-cycle", enum: ["greyscale", "blur", "as is"] }
|
|
7253
|
+
},
|
|
7254
|
+
origin: {
|
|
7255
|
+
type: "string",
|
|
7256
|
+
scope: "common",
|
|
7257
|
+
title: "Origin",
|
|
7258
|
+
display: { type: "toggle-cycle", enum: ["center", "mouse", "random"] }
|
|
7253
7259
|
}
|
|
7254
7260
|
},
|
|
7255
7261
|
defaults: {
|
|
7256
7262
|
maxWidth: 60,
|
|
7257
7263
|
maxHeight: 60,
|
|
7258
7264
|
transition: 700,
|
|
7259
|
-
bgImage: "greyscale"
|
|
7265
|
+
bgImage: "greyscale",
|
|
7266
|
+
origin: "center"
|
|
7260
7267
|
},
|
|
7261
7268
|
layout: [
|
|
7262
7269
|
"__componentName__",
|
|
7263
7270
|
"maxWidth",
|
|
7264
7271
|
"maxHeight",
|
|
7265
7272
|
"transition",
|
|
7266
|
-
"bgImage"
|
|
7273
|
+
"bgImage",
|
|
7274
|
+
"origin"
|
|
7267
7275
|
]
|
|
7268
7276
|
},
|
|
7269
7277
|
panels: [
|
|
@@ -7275,7 +7283,8 @@ const Pe = gt(), Ae = {
|
|
|
7275
7283
|
layout: [
|
|
7276
7284
|
"__componentName__",
|
|
7277
7285
|
{ type: "row", title: "", items: ["maxWidth", "maxHeight"] },
|
|
7278
|
-
{ type: "row", title: "", items: ["transition", "bgImage"] }
|
|
7286
|
+
{ type: "row", title: "", items: ["transition", "bgImage"] },
|
|
7287
|
+
{ type: "row", title: "", items: ["origin"] }
|
|
7279
7288
|
]
|
|
7280
7289
|
}
|
|
7281
7290
|
],
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),s=require("react"),y=require("classnames"),Kt=require("./useScopedStyles-Bf6yohVQ.js"),Qt=100,Vt=70,m="cubic-bezier(0.86, 0, 0.07, 1)";function Pt(t){return`
|
|
2
|
+
.${t}-wrapper {
|
|
3
|
+
position: relative;
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 100%;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
}
|
|
8
|
+
.${t}-background {
|
|
9
|
+
z-index: 1;
|
|
10
|
+
pointer-events: none;
|
|
11
|
+
}
|
|
12
|
+
.${t}-effect-image {
|
|
13
|
+
width: 100%;
|
|
14
|
+
height: 100%;
|
|
15
|
+
object-fit: cover;
|
|
16
|
+
display: block;
|
|
17
|
+
}
|
|
18
|
+
.${t}-stage {
|
|
19
|
+
position: absolute;
|
|
20
|
+
left: 50%;
|
|
21
|
+
top: 50%;
|
|
22
|
+
transform: translate(-50%, -50%) scale(var(--${t}-stage-scale, 1));
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
}
|
|
25
|
+
.${t}-foreground {
|
|
26
|
+
z-index: 2;
|
|
27
|
+
}
|
|
28
|
+
.${t}-incoming {
|
|
29
|
+
will-change: transform;
|
|
30
|
+
}
|
|
31
|
+
.${t}-incoming-next {
|
|
32
|
+
z-index: 4;
|
|
33
|
+
transition: transform var(--${t}-transition-ms) ${m};
|
|
34
|
+
}
|
|
35
|
+
.${t}-incoming-prev {
|
|
36
|
+
z-index: 4;
|
|
37
|
+
transition: transform var(--${t}-transition-ms) ${m};
|
|
38
|
+
}
|
|
39
|
+
.${t}-outgoing {
|
|
40
|
+
will-change: transform;
|
|
41
|
+
}
|
|
42
|
+
.${t}-outgoing-next {
|
|
43
|
+
z-index: 3;
|
|
44
|
+
transition:
|
|
45
|
+
transform var(--${t}-transition-ms) ${m},
|
|
46
|
+
left var(--${t}-transition-ms) ${m},
|
|
47
|
+
top var(--${t}-transition-ms) ${m};
|
|
48
|
+
}
|
|
49
|
+
.${t}-outgoing-prev {
|
|
50
|
+
z-index: 3;
|
|
51
|
+
transition:
|
|
52
|
+
transform var(--${t}-transition-ms) ${m},
|
|
53
|
+
left var(--${t}-transition-ms) ${m},
|
|
54
|
+
top var(--${t}-transition-ms) ${m};
|
|
55
|
+
}
|
|
56
|
+
.${t}-outgoing-next .${t}-effect-image {
|
|
57
|
+
transition: filter var(--${t}-transition-ms) ${m};
|
|
58
|
+
}
|
|
59
|
+
.${t}-outgoing-prev .${t}-effect-image {
|
|
60
|
+
transition: filter var(--${t}-transition-ms) ${m};
|
|
61
|
+
}
|
|
62
|
+
.${t}-incoming .${t}-effect-image {
|
|
63
|
+
transition: filter var(--${t}-transition-ms) ${m};
|
|
64
|
+
}
|
|
65
|
+
.${t}-background .${t}-effect-image {
|
|
66
|
+
transition: filter var(--${t}-transition-ms) ${m};
|
|
67
|
+
}
|
|
68
|
+
.${t}-snap .${t}-incoming,
|
|
69
|
+
.${t}-snap .${t}-outgoing,
|
|
70
|
+
.${t}-snap .${t}-outgoing .${t}-effect-image,
|
|
71
|
+
.${t}-snap .${t}-incoming .${t}-effect-image {
|
|
72
|
+
transition: none !important;
|
|
73
|
+
}
|
|
74
|
+
.${t}-nav {
|
|
75
|
+
position: absolute;
|
|
76
|
+
top: 0;
|
|
77
|
+
bottom: 0;
|
|
78
|
+
width: 50%;
|
|
79
|
+
z-index: 5;
|
|
80
|
+
margin: 0;
|
|
81
|
+
padding: 0;
|
|
82
|
+
border: none;
|
|
83
|
+
background: none;
|
|
84
|
+
cursor: pointer;
|
|
85
|
+
outline: none;
|
|
86
|
+
-webkit-tap-highlight-color: transparent;
|
|
87
|
+
}
|
|
88
|
+
.${t}-nav-prev {
|
|
89
|
+
left: 0;
|
|
90
|
+
cursor: w-resize;
|
|
91
|
+
}
|
|
92
|
+
.${t}-nav-next {
|
|
93
|
+
right: 0;
|
|
94
|
+
cursor: e-resize;
|
|
95
|
+
}
|
|
96
|
+
.${t}-nav:focus,
|
|
97
|
+
.${t}-nav:focus-visible {
|
|
98
|
+
outline: none;
|
|
99
|
+
}
|
|
100
|
+
.${t}-editor .${t}-nav {
|
|
101
|
+
cursor: default;
|
|
102
|
+
pointer-events: none;
|
|
103
|
+
}
|
|
104
|
+
.${t}-foreground {
|
|
105
|
+
pointer-events: none;
|
|
106
|
+
}
|
|
107
|
+
.${t}-image {
|
|
108
|
+
width: 100%;
|
|
109
|
+
height: 100%;
|
|
110
|
+
object-fit: contain;
|
|
111
|
+
display: block;
|
|
112
|
+
pointer-events: none;
|
|
113
|
+
}
|
|
114
|
+
`}function te(t){return t==="blur"?Vt:t==="greyscale"?Qt:0}function E(t,n=1,l=1){const c=te(t)*Math.max(0,Math.min(1,n));if(t==="greyscale")return`grayscale(${c}%)`;if(t==="blur"){const e=c/4;return e<=0?"none":`blur(${e/Math.max(l,1)}px)`}return"none"}function Tt(t){return t<=1?{backgroundIndex:0,activeIndex:0}:{backgroundIndex:0,activeIndex:1}}function ee(t,n){return n<=1?0:(t-1+n)%n}function ne(t,n=1){return!t||t.height===0?n:t.width/t.height}function ie(t,n,l,c,e){if(t<=0||n<=0)return{widthPercent:c,heightPercent:e};const k=t*c/100,v=n*e/100;let $=k,z=$/l;return z>v&&(z=v,$=z*l),{widthPercent:$/t*100,heightPercent:z/n*100}}function A(t,n){const l=n.widthPercent/2,c=n.heightPercent/2,e=l,k=100-l,v=c,$=100-c;return{x:e>k?50:Math.min(k,Math.max(e,t.x)),y:v>$?50:Math.min($,Math.max(v,t.y))}}function g(){return{x:50,y:50}}function Ct(){return{x:Math.random()*100,y:Math.random()*100}}function Q(t,n,l){if(t<=0||n<=0)return 1;const c=t*l.widthPercent/100,e=n*l.heightPercent/100;return c<=0||e<=0?1:Math.max(t/c,n/e)}function se(t){return{width:`${t.widthPercent}%`,height:`${t.heightPercent}%`}}function Y(t,n,l,c){return{...se(t),left:`${c.x}%`,top:`${c.y}%`,[`--${l}-stage-scale`]:n}}function ae(t,n){[...new Set(t.filter(Boolean))].forEach(c=>{const e=new Image;e.onload=()=>{e.naturalWidth>0&&e.naturalHeight>0&&n(c,{width:e.naturalWidth,height:e.naturalHeight})},e.src=c})}function oe({settings:t,content:n,isEditor:l,isPreviewMode:c}){var ft,$t,xt,vt,pt,St,It,wt;const{prefix:e}=Kt.useScopedStyles(),k=s.useMemo(()=>Pt(e),[e]),{imageSize:v,maxWidth:$,maxHeight:z,transition:Rt=1e3,bgImage:M="greyscale",origin:Ot,position:Et}=t,F=Ot??Et??"center",a=n??[],V=Tt(a.length),[h,P]=s.useState(V.activeIndex),[tt,H]=s.useState(V.backgroundIndex),[j,X]=s.useState(!1),[At,G]=s.useState(!1),[B,q]=s.useState(null),[_,U]=s.useState(null),[Bt,T]=s.useState(0),[qt,C]=s.useState(1),[_t,R]=s.useState("none"),[Ut,N]=s.useState(null),[et,nt]=s.useState("next"),[it,Lt]=s.useState({}),[d,Dt]=s.useState({width:0,height:0}),[W,st]=s.useState({}),O=s.useRef(null),Z=s.useRef(null),L=s.useRef({}),J=!l||!!c,at=v??60,ot=Math.max(10,Math.min(100,$??at)),rt=Math.max(10,Math.min(100,z??at)),K=Math.max(100,Rt),p=s.useCallback(i=>{const o=ne(i?it[i]:void 0);return ie(d.width,d.height,o,ot,rt)},[d.height,d.width,it,rt,ot]);s.useEffect(()=>{const i=Z.current;if(!i)return;const o=new ResizeObserver(([r])=>{const{width:f,height:b}=r.contentRect;Dt({width:f,height:b})});return o.observe(i),()=>o.disconnect()},[]),s.useEffect(()=>{const i=(n??[]).map(o=>{var r;return(r=o.image)==null?void 0:r.assetId}).filter(o=>!!o);ae(i,(o,r)=>{Lt(f=>{var b,D;return((b=f[o])==null?void 0:b.width)===r.width&&((D=f[o])==null?void 0:D.height)===r.height?f:{...f,[o]:r}})})},[n]),s.useEffect(()=>{const{backgroundIndex:i,activeIndex:o}=Tt(a.length);P(o),H(i),X(!1),G(!1),q(null),U(null),T(0),C(1),R("none"),N(null),nt("next")},[a.length,n]),s.useEffect(()=>{const i={};for(let o=0;o<a.length;o+=1)i[o]=F==="random"?Ct():g();L.current=i,st(i)},[a.length,n,F]),s.useEffect(()=>()=>{O.current&&clearTimeout(O.current)},[]);const ct=s.useCallback(i=>{if(F==="random")return Ct();if(F!=="mouse")return g();const o=Z.current;if(!o||!i)return g();const r=o.getBoundingClientRect();return r.width<=0||r.height<=0?g():{x:(i.clientX-r.left)/r.width*100,y:(i.clientY-r.top)/r.height*100}},[F]),lt=s.useCallback((i,o)=>{var Mt,jt,Nt,Ft;if(!J||j||a.length<=1)return;const r=i==="next"?(h+1)%a.length:(h-1+a.length)%a.length,f=p((jt=(Mt=a[h])==null?void 0:Mt.image)==null?void 0:jt.assetId),b=p((Ft=(Nt=a[r])==null?void 0:Nt.image)==null?void 0:Ft.assetId),D=A(L.current[h]??g(),f),bt=A(ct(o),b),yt={...L.current,[r]:bt};L.current=yt,st(yt);const kt=Q(d.width,d.height,f),zt=Q(d.width,d.height,b);O.current&&clearTimeout(O.current),nt(i),G(!0),X(!0),i==="next"?(N(D),q(h),U(r),T(0),C(1),R(E(M,0,1))):(H(ee(r,a.length)),q(r),U(h),T(1),N(g()),C(zt),R(E(M,1,zt))),requestAnimationFrame(()=>{G(!1),requestAnimationFrame(()=>{i==="next"?(T(1),N(g()),C(kt),R(E(M,1,kt))):(T(0),N(bt),C(1),R(E(M,0,1)))})}),O.current=setTimeout(()=>{i==="next"&&H(h),P(r),q(null),U(null),N(null),X(!1)},K)},[h,M,d.height,d.width,p,j,J,a,ct,K]),x=a[h],S=tt!==null?a[tt]:null,I=B!==null?a[B]:null,w=_!==null?a[_]:null,Yt=a.length<=1?0:(h-1+a.length)%a.length,Ht=a.length<=1?0:(h+1)%a.length,ut=p((ft=x==null?void 0:x.image)==null?void 0:ft.assetId),gt=p(($t=I==null?void 0:I.image)==null?void 0:$t.assetId),ht=p((xt=w==null?void 0:w.image)==null?void 0:xt.assetId),dt=p((vt=S==null?void 0:S.image)==null?void 0:vt.assetId),mt=Q(d.width,d.height,dt),Xt=E(M,1,mt),Gt=A(W[h]??g(),ut),Wt=Ut??A(B!==null?W[B]??g():g(),gt),Zt=A(_!==null?W[_]??g():g(),ht),Jt={[`--${e}-transition-ms`]:`${K}ms`};return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:k}}),u.jsxs("div",{ref:Z,className:y(`${e}-wrapper`,At&&`${e}-snap`,l&&!c&&`${e}-editor`),style:Jt,"aria-label":"Zoom gallery",children:[((pt=S==null?void 0:S.image)==null?void 0:pt.assetId)&&u.jsx("div",{className:y(`${e}-stage`,`${e}-background`),style:Y(dt,mt,e,g()),"aria-hidden":"true",children:u.jsx("img",{className:`${e}-effect-image`,src:S.image.assetId,alt:"",style:{filter:Xt}})}),j&&((St=I==null?void 0:I.image)==null?void 0:St.assetId)&&u.jsx("div",{className:y(`${e}-stage`,`${e}-outgoing`,`${e}-outgoing-${et}`),style:Y(gt,qt,e,Wt),"aria-hidden":"true",children:u.jsx("img",{className:`${e}-effect-image`,src:I.image.assetId,alt:"",style:{filter:_t}})}),j&&((It=w==null?void 0:w.image)==null?void 0:It.assetId)&&u.jsx("div",{className:y(`${e}-stage`,`${e}-incoming`,`${e}-incoming-${et}`),style:Y(ht,Bt,e,Zt),"aria-hidden":"true",children:u.jsx("img",{className:`${e}-image`,src:w.image.assetId,alt:""})}),!j&&((wt=x==null?void 0:x.image)==null?void 0:wt.assetId)&&u.jsx("div",{className:y(`${e}-stage`,`${e}-foreground`),style:Y(ut,1,e,Gt),children:u.jsx("img",{className:`${e}-image`,src:x.image.assetId,alt:x.image.name??""})}),J&&a.length>1&&!j&&u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:y(`${e}-nav`,`${e}-nav-prev`),onClick:i=>lt("prev",i),"aria-label":`Show previous image (${Yt+1} of ${a.length})`}),u.jsx("button",{type:"button",className:y(`${e}-nav`,`${e}-nav-next`),onClick:i=>lt("next",i),"aria-label":`Show next image (${Ht+1} of ${a.length})`})]})]})]})}exports.Scale=oe;
|
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import { jsxs as V, Fragment as Bt, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as ee, useState as l, useRef as P, useCallback as tt, useEffect as B } from "react";
|
|
3
|
+
import y from "classnames";
|
|
4
|
+
import { u as ne } from "./useScopedStyles-DhBG3557.mjs";
|
|
5
|
+
const ie = 100, oe = 70, m = "cubic-bezier(0.86, 0, 0.07, 1)";
|
|
6
|
+
function re(t) {
|
|
7
|
+
return `
|
|
8
|
+
.${t}-wrapper {
|
|
9
|
+
position: relative;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
}
|
|
14
|
+
.${t}-background {
|
|
15
|
+
z-index: 1;
|
|
16
|
+
pointer-events: none;
|
|
17
|
+
}
|
|
18
|
+
.${t}-effect-image {
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
object-fit: cover;
|
|
22
|
+
display: block;
|
|
23
|
+
}
|
|
24
|
+
.${t}-stage {
|
|
25
|
+
position: absolute;
|
|
26
|
+
left: 50%;
|
|
27
|
+
top: 50%;
|
|
28
|
+
transform: translate(-50%, -50%) scale(var(--${t}-stage-scale, 1));
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
}
|
|
31
|
+
.${t}-foreground {
|
|
32
|
+
z-index: 2;
|
|
33
|
+
}
|
|
34
|
+
.${t}-incoming {
|
|
35
|
+
will-change: transform;
|
|
36
|
+
}
|
|
37
|
+
.${t}-incoming-next {
|
|
38
|
+
z-index: 4;
|
|
39
|
+
transition: transform var(--${t}-transition-ms) ${m};
|
|
40
|
+
}
|
|
41
|
+
.${t}-incoming-prev {
|
|
42
|
+
z-index: 4;
|
|
43
|
+
transition: transform var(--${t}-transition-ms) ${m};
|
|
44
|
+
}
|
|
45
|
+
.${t}-outgoing {
|
|
46
|
+
will-change: transform;
|
|
47
|
+
}
|
|
48
|
+
.${t}-outgoing-next {
|
|
49
|
+
z-index: 3;
|
|
50
|
+
transition:
|
|
51
|
+
transform var(--${t}-transition-ms) ${m},
|
|
52
|
+
left var(--${t}-transition-ms) ${m},
|
|
53
|
+
top var(--${t}-transition-ms) ${m};
|
|
54
|
+
}
|
|
55
|
+
.${t}-outgoing-prev {
|
|
56
|
+
z-index: 3;
|
|
57
|
+
transition:
|
|
58
|
+
transform var(--${t}-transition-ms) ${m},
|
|
59
|
+
left var(--${t}-transition-ms) ${m},
|
|
60
|
+
top var(--${t}-transition-ms) ${m};
|
|
61
|
+
}
|
|
62
|
+
.${t}-outgoing-next .${t}-effect-image {
|
|
63
|
+
transition: filter var(--${t}-transition-ms) ${m};
|
|
64
|
+
}
|
|
65
|
+
.${t}-outgoing-prev .${t}-effect-image {
|
|
66
|
+
transition: filter var(--${t}-transition-ms) ${m};
|
|
67
|
+
}
|
|
68
|
+
.${t}-incoming .${t}-effect-image {
|
|
69
|
+
transition: filter var(--${t}-transition-ms) ${m};
|
|
70
|
+
}
|
|
71
|
+
.${t}-background .${t}-effect-image {
|
|
72
|
+
transition: filter var(--${t}-transition-ms) ${m};
|
|
73
|
+
}
|
|
74
|
+
.${t}-snap .${t}-incoming,
|
|
75
|
+
.${t}-snap .${t}-outgoing,
|
|
76
|
+
.${t}-snap .${t}-outgoing .${t}-effect-image,
|
|
77
|
+
.${t}-snap .${t}-incoming .${t}-effect-image {
|
|
78
|
+
transition: none !important;
|
|
79
|
+
}
|
|
80
|
+
.${t}-nav {
|
|
81
|
+
position: absolute;
|
|
82
|
+
top: 0;
|
|
83
|
+
bottom: 0;
|
|
84
|
+
width: 50%;
|
|
85
|
+
z-index: 5;
|
|
86
|
+
margin: 0;
|
|
87
|
+
padding: 0;
|
|
88
|
+
border: none;
|
|
89
|
+
background: none;
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
outline: none;
|
|
92
|
+
-webkit-tap-highlight-color: transparent;
|
|
93
|
+
}
|
|
94
|
+
.${t}-nav-prev {
|
|
95
|
+
left: 0;
|
|
96
|
+
cursor: w-resize;
|
|
97
|
+
}
|
|
98
|
+
.${t}-nav-next {
|
|
99
|
+
right: 0;
|
|
100
|
+
cursor: e-resize;
|
|
101
|
+
}
|
|
102
|
+
.${t}-nav:focus,
|
|
103
|
+
.${t}-nav:focus-visible {
|
|
104
|
+
outline: none;
|
|
105
|
+
}
|
|
106
|
+
.${t}-editor .${t}-nav {
|
|
107
|
+
cursor: default;
|
|
108
|
+
pointer-events: none;
|
|
109
|
+
}
|
|
110
|
+
.${t}-foreground {
|
|
111
|
+
pointer-events: none;
|
|
112
|
+
}
|
|
113
|
+
.${t}-image {
|
|
114
|
+
width: 100%;
|
|
115
|
+
height: 100%;
|
|
116
|
+
object-fit: contain;
|
|
117
|
+
display: block;
|
|
118
|
+
pointer-events: none;
|
|
119
|
+
}
|
|
120
|
+
`;
|
|
121
|
+
}
|
|
122
|
+
function ae(t) {
|
|
123
|
+
return t === "blur" ? oe : t === "greyscale" ? ie : 0;
|
|
124
|
+
}
|
|
125
|
+
function E(t, n = 1, c = 1) {
|
|
126
|
+
const s = ae(t) * Math.max(0, Math.min(1, n));
|
|
127
|
+
if (t === "greyscale")
|
|
128
|
+
return `grayscale(${s}%)`;
|
|
129
|
+
if (t === "blur") {
|
|
130
|
+
const e = s / 4;
|
|
131
|
+
return e <= 0 ? "none" : `blur(${e / Math.max(c, 1)}px)`;
|
|
132
|
+
}
|
|
133
|
+
return "none";
|
|
134
|
+
}
|
|
135
|
+
function Et(t) {
|
|
136
|
+
return t <= 1 ? { backgroundIndex: 0, activeIndex: 0 } : { backgroundIndex: 0, activeIndex: 1 };
|
|
137
|
+
}
|
|
138
|
+
function se(t, n) {
|
|
139
|
+
return n <= 1 ? 0 : (t - 1 + n) % n;
|
|
140
|
+
}
|
|
141
|
+
function ce(t, n = 1) {
|
|
142
|
+
return !t || t.height === 0 ? n : t.width / t.height;
|
|
143
|
+
}
|
|
144
|
+
function le(t, n, c, s, e) {
|
|
145
|
+
if (t <= 0 || n <= 0)
|
|
146
|
+
return { widthPercent: s, heightPercent: e };
|
|
147
|
+
const z = t * s / 100, v = n * e / 100;
|
|
148
|
+
let $ = z, M = $ / c;
|
|
149
|
+
return M > v && (M = v, $ = M * c), {
|
|
150
|
+
widthPercent: $ / t * 100,
|
|
151
|
+
heightPercent: M / n * 100
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function _(t, n) {
|
|
155
|
+
const c = n.widthPercent / 2, s = n.heightPercent / 2, e = c, z = 100 - c, v = s, $ = 100 - s;
|
|
156
|
+
return {
|
|
157
|
+
x: e > z ? 50 : Math.min(z, Math.max(e, t.x)),
|
|
158
|
+
y: v > $ ? 50 : Math.min($, Math.max(v, t.y))
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
function g() {
|
|
162
|
+
return { x: 50, y: 50 };
|
|
163
|
+
}
|
|
164
|
+
function _t() {
|
|
165
|
+
return { x: Math.random() * 100, y: Math.random() * 100 };
|
|
166
|
+
}
|
|
167
|
+
function et(t, n, c) {
|
|
168
|
+
if (t <= 0 || n <= 0) return 1;
|
|
169
|
+
const s = t * c.widthPercent / 100, e = n * c.heightPercent / 100;
|
|
170
|
+
return s <= 0 || e <= 0 ? 1 : Math.max(t / s, n / e);
|
|
171
|
+
}
|
|
172
|
+
function ge(t) {
|
|
173
|
+
return {
|
|
174
|
+
width: `${t.widthPercent}%`,
|
|
175
|
+
height: `${t.heightPercent}%`
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function H(t, n, c, s) {
|
|
179
|
+
return {
|
|
180
|
+
...ge(t),
|
|
181
|
+
left: `${s.x}%`,
|
|
182
|
+
top: `${s.y}%`,
|
|
183
|
+
[`--${c}-stage-scale`]: n
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
function ue(t, n) {
|
|
187
|
+
[...new Set(t.filter(Boolean))].forEach((s) => {
|
|
188
|
+
const e = new Image();
|
|
189
|
+
e.onload = () => {
|
|
190
|
+
e.naturalWidth > 0 && e.naturalHeight > 0 && n(s, { width: e.naturalWidth, height: e.naturalHeight });
|
|
191
|
+
}, e.src = s;
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function $e({ settings: t, content: n, isEditor: c, isPreviewMode: s }) {
|
|
195
|
+
var pt, It, wt, St, bt, yt, zt, Mt;
|
|
196
|
+
const { prefix: e } = ne(), z = ee(() => re(e), [e]), {
|
|
197
|
+
imageSize: v,
|
|
198
|
+
maxWidth: $,
|
|
199
|
+
maxHeight: M,
|
|
200
|
+
transition: Ut = 1e3,
|
|
201
|
+
bgImage: k = "greyscale",
|
|
202
|
+
origin: Lt,
|
|
203
|
+
position: jt
|
|
204
|
+
} = t, T = Lt ?? jt ?? "center", o = n ?? [], nt = Et(o.length), [u, it] = l(nt.activeIndex), [ot, X] = l(nt.backgroundIndex), [N, G] = l(!1), [qt, W] = l(!1), [U, L] = l(null), [j, q] = l(null), [Dt, C] = l(0), [Yt, O] = l(1), [Ht, A] = l("none"), [Xt, F] = l(null), [rt, at] = l("next"), [st, Gt] = l({}), [h, Wt] = l({ width: 0, height: 0 }), [Z, ct] = l({}), R = P(null), J = P(null), D = P({}), K = !c || !!s, lt = v ?? 60, gt = Math.max(10, Math.min(100, $ ?? lt)), ut = Math.max(10, Math.min(100, M ?? lt)), Q = Math.max(100, Ut), p = tt((i) => {
|
|
205
|
+
const r = ce(i ? st[i] : void 0);
|
|
206
|
+
return le(
|
|
207
|
+
h.width,
|
|
208
|
+
h.height,
|
|
209
|
+
r,
|
|
210
|
+
gt,
|
|
211
|
+
ut
|
|
212
|
+
);
|
|
213
|
+
}, [h.height, h.width, st, ut, gt]);
|
|
214
|
+
B(() => {
|
|
215
|
+
const i = J.current;
|
|
216
|
+
if (!i) return;
|
|
217
|
+
const r = new ResizeObserver(([a]) => {
|
|
218
|
+
const { width: f, height: b } = a.contentRect;
|
|
219
|
+
Wt({ width: f, height: b });
|
|
220
|
+
});
|
|
221
|
+
return r.observe(i), () => r.disconnect();
|
|
222
|
+
}, []), B(() => {
|
|
223
|
+
const i = (n ?? []).map((r) => {
|
|
224
|
+
var a;
|
|
225
|
+
return (a = r.image) == null ? void 0 : a.assetId;
|
|
226
|
+
}).filter((r) => !!r);
|
|
227
|
+
ue(i, (r, a) => {
|
|
228
|
+
Gt((f) => {
|
|
229
|
+
var b, Y;
|
|
230
|
+
return ((b = f[r]) == null ? void 0 : b.width) === a.width && ((Y = f[r]) == null ? void 0 : Y.height) === a.height ? f : { ...f, [r]: a };
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
}, [n]), B(() => {
|
|
234
|
+
const { backgroundIndex: i, activeIndex: r } = Et(o.length);
|
|
235
|
+
it(r), X(i), G(!1), W(!1), L(null), q(null), C(0), O(1), A("none"), F(null), at("next");
|
|
236
|
+
}, [o.length, n]), B(() => {
|
|
237
|
+
const i = {};
|
|
238
|
+
for (let r = 0; r < o.length; r += 1)
|
|
239
|
+
i[r] = T === "random" ? _t() : g();
|
|
240
|
+
D.current = i, ct(i);
|
|
241
|
+
}, [o.length, n, T]), B(() => () => {
|
|
242
|
+
R.current && clearTimeout(R.current);
|
|
243
|
+
}, []);
|
|
244
|
+
const ht = tt((i) => {
|
|
245
|
+
if (T === "random") return _t();
|
|
246
|
+
if (T !== "mouse") return g();
|
|
247
|
+
const r = J.current;
|
|
248
|
+
if (!r || !i) return g();
|
|
249
|
+
const a = r.getBoundingClientRect();
|
|
250
|
+
return a.width <= 0 || a.height <= 0 ? g() : {
|
|
251
|
+
x: (i.clientX - a.left) / a.width * 100,
|
|
252
|
+
y: (i.clientY - a.top) / a.height * 100
|
|
253
|
+
};
|
|
254
|
+
}, [T]), mt = tt((i, r) => {
|
|
255
|
+
var Ct, Ot, At, Rt;
|
|
256
|
+
if (!K || N || o.length <= 1) return;
|
|
257
|
+
const a = i === "next" ? (u + 1) % o.length : (u - 1 + o.length) % o.length, f = p((Ot = (Ct = o[u]) == null ? void 0 : Ct.image) == null ? void 0 : Ot.assetId), b = p((Rt = (At = o[a]) == null ? void 0 : At.image) == null ? void 0 : Rt.assetId), Y = _(D.current[u] ?? g(), f), kt = _(ht(r), b), Nt = { ...D.current, [a]: kt };
|
|
258
|
+
D.current = Nt, ct(Nt);
|
|
259
|
+
const Ft = et(
|
|
260
|
+
h.width,
|
|
261
|
+
h.height,
|
|
262
|
+
f
|
|
263
|
+
), Tt = et(
|
|
264
|
+
h.width,
|
|
265
|
+
h.height,
|
|
266
|
+
b
|
|
267
|
+
);
|
|
268
|
+
R.current && clearTimeout(R.current), at(i), W(!0), G(!0), i === "next" ? (F(Y), L(u), q(a), C(0), O(1), A(E(k, 0, 1))) : (X(se(a, o.length)), L(a), q(u), C(1), F(g()), O(Tt), A(E(k, 1, Tt))), requestAnimationFrame(() => {
|
|
269
|
+
W(!1), requestAnimationFrame(() => {
|
|
270
|
+
i === "next" ? (C(1), F(g()), O(Ft), A(E(k, 1, Ft))) : (C(0), F(kt), O(1), A(E(k, 0, 1)));
|
|
271
|
+
});
|
|
272
|
+
}), R.current = setTimeout(() => {
|
|
273
|
+
i === "next" && X(u), it(a), L(null), q(null), F(null), G(!1);
|
|
274
|
+
}, Q);
|
|
275
|
+
}, [
|
|
276
|
+
u,
|
|
277
|
+
k,
|
|
278
|
+
h.height,
|
|
279
|
+
h.width,
|
|
280
|
+
p,
|
|
281
|
+
N,
|
|
282
|
+
K,
|
|
283
|
+
o,
|
|
284
|
+
ht,
|
|
285
|
+
Q
|
|
286
|
+
]), x = o[u], I = ot !== null ? o[ot] : null, w = U !== null ? o[U] : null, S = j !== null ? o[j] : null, Zt = o.length <= 1 ? 0 : (u - 1 + o.length) % o.length, Jt = o.length <= 1 ? 0 : (u + 1) % o.length, dt = p((pt = x == null ? void 0 : x.image) == null ? void 0 : pt.assetId), ft = p((It = w == null ? void 0 : w.image) == null ? void 0 : It.assetId), $t = p((wt = S == null ? void 0 : S.image) == null ? void 0 : wt.assetId), xt = p((St = I == null ? void 0 : I.image) == null ? void 0 : St.assetId), vt = et(
|
|
287
|
+
h.width,
|
|
288
|
+
h.height,
|
|
289
|
+
xt
|
|
290
|
+
), Kt = E(k, 1, vt), Qt = _(Z[u] ?? g(), dt), Vt = Xt ?? _(
|
|
291
|
+
U !== null ? Z[U] ?? g() : g(),
|
|
292
|
+
ft
|
|
293
|
+
), Pt = _(
|
|
294
|
+
j !== null ? Z[j] ?? g() : g(),
|
|
295
|
+
$t
|
|
296
|
+
), te = {
|
|
297
|
+
[`--${e}-transition-ms`]: `${Q}ms`
|
|
298
|
+
};
|
|
299
|
+
return /* @__PURE__ */ V(Bt, { children: [
|
|
300
|
+
/* @__PURE__ */ d("style", { dangerouslySetInnerHTML: { __html: z } }),
|
|
301
|
+
/* @__PURE__ */ V(
|
|
302
|
+
"div",
|
|
303
|
+
{
|
|
304
|
+
ref: J,
|
|
305
|
+
className: y(`${e}-wrapper`, qt && `${e}-snap`, c && !s && `${e}-editor`),
|
|
306
|
+
style: te,
|
|
307
|
+
"aria-label": "Zoom gallery",
|
|
308
|
+
children: [
|
|
309
|
+
((bt = I == null ? void 0 : I.image) == null ? void 0 : bt.assetId) && /* @__PURE__ */ d(
|
|
310
|
+
"div",
|
|
311
|
+
{
|
|
312
|
+
className: y(`${e}-stage`, `${e}-background`),
|
|
313
|
+
style: H(xt, vt, e, g()),
|
|
314
|
+
"aria-hidden": "true",
|
|
315
|
+
children: /* @__PURE__ */ d(
|
|
316
|
+
"img",
|
|
317
|
+
{
|
|
318
|
+
className: `${e}-effect-image`,
|
|
319
|
+
src: I.image.assetId,
|
|
320
|
+
alt: "",
|
|
321
|
+
style: { filter: Kt }
|
|
322
|
+
}
|
|
323
|
+
)
|
|
324
|
+
}
|
|
325
|
+
),
|
|
326
|
+
N && ((yt = w == null ? void 0 : w.image) == null ? void 0 : yt.assetId) && /* @__PURE__ */ d(
|
|
327
|
+
"div",
|
|
328
|
+
{
|
|
329
|
+
className: y(
|
|
330
|
+
`${e}-stage`,
|
|
331
|
+
`${e}-outgoing`,
|
|
332
|
+
`${e}-outgoing-${rt}`
|
|
333
|
+
),
|
|
334
|
+
style: H(ft, Yt, e, Vt),
|
|
335
|
+
"aria-hidden": "true",
|
|
336
|
+
children: /* @__PURE__ */ d(
|
|
337
|
+
"img",
|
|
338
|
+
{
|
|
339
|
+
className: `${e}-effect-image`,
|
|
340
|
+
src: w.image.assetId,
|
|
341
|
+
alt: "",
|
|
342
|
+
style: { filter: Ht }
|
|
343
|
+
}
|
|
344
|
+
)
|
|
345
|
+
}
|
|
346
|
+
),
|
|
347
|
+
N && ((zt = S == null ? void 0 : S.image) == null ? void 0 : zt.assetId) && /* @__PURE__ */ d(
|
|
348
|
+
"div",
|
|
349
|
+
{
|
|
350
|
+
className: y(
|
|
351
|
+
`${e}-stage`,
|
|
352
|
+
`${e}-incoming`,
|
|
353
|
+
`${e}-incoming-${rt}`
|
|
354
|
+
),
|
|
355
|
+
style: H($t, Dt, e, Pt),
|
|
356
|
+
"aria-hidden": "true",
|
|
357
|
+
children: /* @__PURE__ */ d(
|
|
358
|
+
"img",
|
|
359
|
+
{
|
|
360
|
+
className: `${e}-image`,
|
|
361
|
+
src: S.image.assetId,
|
|
362
|
+
alt: ""
|
|
363
|
+
}
|
|
364
|
+
)
|
|
365
|
+
}
|
|
366
|
+
),
|
|
367
|
+
!N && ((Mt = x == null ? void 0 : x.image) == null ? void 0 : Mt.assetId) && /* @__PURE__ */ d(
|
|
368
|
+
"div",
|
|
369
|
+
{
|
|
370
|
+
className: y(`${e}-stage`, `${e}-foreground`),
|
|
371
|
+
style: H(dt, 1, e, Qt),
|
|
372
|
+
children: /* @__PURE__ */ d(
|
|
373
|
+
"img",
|
|
374
|
+
{
|
|
375
|
+
className: `${e}-image`,
|
|
376
|
+
src: x.image.assetId,
|
|
377
|
+
alt: x.image.name ?? ""
|
|
378
|
+
}
|
|
379
|
+
)
|
|
380
|
+
}
|
|
381
|
+
),
|
|
382
|
+
K && o.length > 1 && !N && /* @__PURE__ */ V(Bt, { children: [
|
|
383
|
+
/* @__PURE__ */ d(
|
|
384
|
+
"button",
|
|
385
|
+
{
|
|
386
|
+
type: "button",
|
|
387
|
+
className: y(`${e}-nav`, `${e}-nav-prev`),
|
|
388
|
+
onClick: (i) => mt("prev", i),
|
|
389
|
+
"aria-label": `Show previous image (${Zt + 1} of ${o.length})`
|
|
390
|
+
}
|
|
391
|
+
),
|
|
392
|
+
/* @__PURE__ */ d(
|
|
393
|
+
"button",
|
|
394
|
+
{
|
|
395
|
+
type: "button",
|
|
396
|
+
className: y(`${e}-nav`, `${e}-nav-next`),
|
|
397
|
+
onClick: (i) => mt("next", i),
|
|
398
|
+
"aria-label": `Show next image (${Jt + 1} of ${o.length})`
|
|
399
|
+
}
|
|
400
|
+
)
|
|
401
|
+
] })
|
|
402
|
+
]
|
|
403
|
+
}
|
|
404
|
+
)
|
|
405
|
+
] });
|
|
406
|
+
}
|
|
407
|
+
export {
|
|
408
|
+
$e as Scale
|
|
409
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ControlSlider as e } from "./ControlSlider-pZv7H6BU.mjs";
|
|
2
2
|
import { ImageRevealSlider as t } from "./ImageRevealSlider-BdFGyVEP.mjs";
|
|
3
3
|
import { LightboxGallery as i } from "./Lightbox-eP9qAZzL.mjs";
|
|
4
|
-
import { C as o, F as r, O as p, M as n, a as l, T as s, b as a, G as c, H as y, L as g, c as m, d, e as u, S as b, W as h, f, g as v, h as x, i as C, B as S, P as I } from "./PretextComponent-
|
|
4
|
+
import { C as o, F as r, O as p, M as n, a as l, T as s, b as a, G as c, H as y, L as g, c as m, d, e as u, S as b, W as h, f, g as v, h as x, i as C, B as S, P as I } from "./PretextComponent-DN8cyZ8x.mjs";
|
|
5
5
|
const k = {
|
|
6
6
|
element: e,
|
|
7
7
|
id: "control-slider",
|