@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
|
@@ -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;
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { jsxs as Z, Fragment as
|
|
2
|
-
import { useState as y, useRef as
|
|
3
|
-
import { u as
|
|
4
|
-
const
|
|
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
5
|
sizeType: "custom",
|
|
6
6
|
value: 700,
|
|
7
7
|
min: 400,
|
|
8
8
|
max: 700
|
|
9
9
|
};
|
|
10
|
-
function T(
|
|
10
|
+
function T(s, i) {
|
|
11
11
|
return {
|
|
12
|
-
widthPx:
|
|
13
|
-
heightPx:
|
|
12
|
+
widthPx: s,
|
|
13
|
+
heightPx: s * i
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function j(s, i, a, r, t, f) {
|
|
17
17
|
return {
|
|
18
|
-
x: Math.min(Math.max(
|
|
19
|
-
y: Math.min(Math.max(
|
|
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
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function J(
|
|
23
|
-
const { heightPx: t } = T(
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
a,
|
|
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,
|
|
29
28
|
i,
|
|
29
|
+
a,
|
|
30
30
|
t
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
|
-
function Q(
|
|
34
|
-
for (const r of
|
|
33
|
+
function Q(s, i, a) {
|
|
34
|
+
for (const r of a) {
|
|
35
35
|
const { heightPx: t } = T(r.widthPx, r.aspectRatio), f = r.widthPx / 2, d = t / 2;
|
|
36
|
-
if (
|
|
36
|
+
if (s >= r.x - f && s <= r.x + f && i >= r.y - d && i <= r.y + d)
|
|
37
37
|
return !0;
|
|
38
38
|
}
|
|
39
39
|
return !1;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function le(s, i, a, r, t, f, d, g) {
|
|
42
42
|
if (t === "system")
|
|
43
43
|
return "none";
|
|
44
|
-
const
|
|
45
|
-
return R && R.closest("a") ? "none" : Q(
|
|
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
46
|
}
|
|
47
|
-
function K(
|
|
47
|
+
function K(s, i, a) {
|
|
48
48
|
var g;
|
|
49
|
-
const { sizeType: r, value: t, min: f, max: d } =
|
|
50
|
-
return r === "custom" ? t : r === "as is" ? ((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
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function ue(s) {
|
|
53
53
|
return `
|
|
54
|
-
.${
|
|
54
|
+
.${s}-root {
|
|
55
55
|
position: absolute;
|
|
56
56
|
top: 0;
|
|
57
57
|
left: 0;
|
|
@@ -59,12 +59,12 @@ function ce(o) {
|
|
|
59
59
|
height: 100%;
|
|
60
60
|
overflow: hidden;
|
|
61
61
|
}
|
|
62
|
-
.${
|
|
62
|
+
.${s}-wrapper {
|
|
63
63
|
position: absolute;
|
|
64
64
|
transform: translate(-50%, -50%);
|
|
65
65
|
height: auto;
|
|
66
66
|
}
|
|
67
|
-
.${
|
|
67
|
+
.${s}-image {
|
|
68
68
|
display: block;
|
|
69
69
|
width: 100%;
|
|
70
70
|
height: auto;
|
|
@@ -73,11 +73,11 @@ function ce(o) {
|
|
|
73
73
|
user-select: none;
|
|
74
74
|
pointer-events: none;
|
|
75
75
|
}
|
|
76
|
-
.${
|
|
76
|
+
.${s}-link {
|
|
77
77
|
width: 100%;
|
|
78
78
|
display: block;
|
|
79
79
|
}
|
|
80
|
-
.${
|
|
80
|
+
.${s}-cursor {
|
|
81
81
|
position: absolute;
|
|
82
82
|
top: 0;
|
|
83
83
|
left: 0;
|
|
@@ -87,66 +87,67 @@ function ce(o) {
|
|
|
87
87
|
}
|
|
88
88
|
`;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
91
|
-
return new Promise((
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
aspectRatio:
|
|
96
|
-
naturalWidth:
|
|
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
97
|
});
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
},
|
|
98
|
+
}, a.onerror = () => {
|
|
99
|
+
i({ aspectRatio: 1, naturalWidth: 700 });
|
|
100
|
+
}, a.src = s;
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
async function
|
|
104
|
-
const
|
|
105
|
-
|
|
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
106
|
);
|
|
107
|
-
return new Map(
|
|
107
|
+
return new Map(a);
|
|
108
108
|
}
|
|
109
|
-
function
|
|
110
|
-
const { prefix: r } =
|
|
111
|
-
imageSize: P =
|
|
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
112
|
cursor: F = "system",
|
|
113
|
-
target:
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
target: E = "area",
|
|
114
|
+
origin: ee,
|
|
115
|
+
position: te,
|
|
116
|
+
visible: O = "all",
|
|
116
117
|
defaultCursor: B = null,
|
|
117
118
|
hoverCursor: L = null
|
|
118
|
-
} =
|
|
119
|
+
} = s, I = ee ?? te ?? "random", p = i.filter(
|
|
119
120
|
(e) => {
|
|
120
121
|
var n;
|
|
121
122
|
return !!((n = e == null ? void 0 : e.image) != null && n.assetId);
|
|
122
123
|
}
|
|
123
|
-
),
|
|
124
|
+
), ne = se(() => ue(r), [r]), v = ie((e, n, o = d) => {
|
|
124
125
|
if (!t) return;
|
|
125
126
|
const u = t.getBoundingClientRect(), c = e - u.left, l = n - u.top;
|
|
126
127
|
D({ x: c, y: l }), G(
|
|
127
|
-
|
|
128
|
+
le(c, l, o, t, F, E, L, B)
|
|
128
129
|
);
|
|
129
|
-
}, [t, d, F,
|
|
130
|
+
}, [t, d, F, E, L, B]);
|
|
130
131
|
w(() => {
|
|
131
132
|
const e = [
|
|
132
|
-
...p.map((
|
|
133
|
+
...p.map((o) => o.image.assetId),
|
|
133
134
|
B,
|
|
134
135
|
L
|
|
135
|
-
].filter((
|
|
136
|
+
].filter((o) => !!o);
|
|
136
137
|
if (e.length === 0) {
|
|
137
138
|
$.current = /* @__PURE__ */ new Map(), _(!0);
|
|
138
139
|
return;
|
|
139
140
|
}
|
|
140
141
|
let n = !1;
|
|
141
|
-
return _(!1),
|
|
142
|
-
n || ($.current =
|
|
142
|
+
return _(!1), fe(e).then((o) => {
|
|
143
|
+
n || ($.current = o, _(!0));
|
|
143
144
|
}), () => {
|
|
144
145
|
n = !0;
|
|
145
146
|
};
|
|
146
|
-
}, [
|
|
147
|
+
}, [i, B, L]), w(() => {
|
|
147
148
|
if (!t) return;
|
|
148
|
-
const e = (
|
|
149
|
-
|
|
149
|
+
const e = (o) => {
|
|
150
|
+
o.stopPropagation(), k.current = { x: o.clientX, y: o.clientY }, v(o.clientX, o.clientY);
|
|
150
151
|
}, n = () => {
|
|
151
152
|
x && v(k.current.x, k.current.y);
|
|
152
153
|
};
|
|
@@ -158,12 +159,12 @@ function he({ settings: o, content: a = [], isEditor: i }) {
|
|
|
158
159
|
}, [d, t, x, v]), w(() => {
|
|
159
160
|
x || G("none");
|
|
160
161
|
}, [x]);
|
|
161
|
-
const H = (e, n,
|
|
162
|
+
const H = (e, n, o, u = {}) => {
|
|
162
163
|
var C, N;
|
|
163
164
|
if (!((C = e == null ? void 0 : e.image) != null && C.assetId)) return null;
|
|
164
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);
|
|
165
166
|
let m = 0, h = 0;
|
|
166
|
-
return I === "same" ? { x: m, y: h } = J(n,
|
|
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)), {
|
|
167
168
|
id: V.current++,
|
|
168
169
|
assetId: e.image.assetId,
|
|
169
170
|
link: e.link,
|
|
@@ -171,24 +172,24 @@ function he({ settings: o, content: a = [], isEditor: i }) {
|
|
|
171
172
|
x: m,
|
|
172
173
|
y: h,
|
|
173
174
|
xRatio: m / n,
|
|
174
|
-
yRatio: h /
|
|
175
|
+
yRatio: h / o,
|
|
175
176
|
aspectRatio: c,
|
|
176
177
|
widthPx: l
|
|
177
178
|
};
|
|
178
179
|
}, z = () => {
|
|
179
180
|
if (!t) return;
|
|
180
|
-
const e = t.getBoundingClientRect(), n = e.width,
|
|
181
|
-
n === 0 ||
|
|
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) => {
|
|
182
183
|
const l = P.sizeType === "random" ? c.widthPx : K(c.assetId, P, $.current), { heightPx: b } = T(l, c.aspectRatio);
|
|
183
184
|
if (I === "same") {
|
|
184
|
-
const { x: C, y: N } = J(n,
|
|
185
|
+
const { x: C, y: N } = J(n, o, l, c.aspectRatio);
|
|
185
186
|
return { ...c, x: C, y: N, widthPx: l };
|
|
186
187
|
}
|
|
187
|
-
const { x: m, y: h } =
|
|
188
|
+
const { x: m, y: h } = j(
|
|
188
189
|
c.xRatio * n,
|
|
189
|
-
c.yRatio *
|
|
190
|
+
c.yRatio * o,
|
|
190
191
|
n,
|
|
191
|
-
|
|
192
|
+
o,
|
|
192
193
|
l,
|
|
193
194
|
b
|
|
194
195
|
);
|
|
@@ -197,9 +198,9 @@ function he({ settings: o, content: a = [], isEditor: i }) {
|
|
|
197
198
|
};
|
|
198
199
|
w(() => {
|
|
199
200
|
if (!t || p.length === 0 || !W) return;
|
|
200
|
-
const e = t.getBoundingClientRect(), n = e.width,
|
|
201
|
+
const e = t.getBoundingClientRect(), n = e.width, o = e.height, u = H(p[0], n, o);
|
|
201
202
|
u && (g([u]), R(p.length > 1 ? 1 : 0));
|
|
202
|
-
}, [P, I, t,
|
|
203
|
+
}, [P, I, t, i, W]), w(() => {
|
|
203
204
|
if (!t) return;
|
|
204
205
|
z();
|
|
205
206
|
const e = new ResizeObserver(z);
|
|
@@ -207,30 +208,30 @@ function he({ settings: o, content: a = [], isEditor: i }) {
|
|
|
207
208
|
e.disconnect(), window.removeEventListener("resize", z);
|
|
208
209
|
};
|
|
209
210
|
}, [t, I, P, d.length]), w(() => {
|
|
210
|
-
|
|
211
|
-
}, [
|
|
212
|
-
const
|
|
211
|
+
O === "last One" && g((e) => e.length > 0 ? [e[e.length - 1]] : []);
|
|
212
|
+
}, [O]);
|
|
213
|
+
const re = (e) => {
|
|
213
214
|
if (!t || p.length === 0 || !W) return;
|
|
214
|
-
const n = t.getBoundingClientRect(),
|
|
215
|
-
if (
|
|
215
|
+
const n = t.getBoundingClientRect(), o = e.clientX - n.left, u = e.clientY - n.top;
|
|
216
|
+
if (E === "image" && !Q(o, u, d)) return;
|
|
216
217
|
let c = 0, l = 0;
|
|
217
|
-
I === "on Click" ? (c =
|
|
218
|
-
const b = p[
|
|
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 });
|
|
219
220
|
if (!m) return;
|
|
220
|
-
const h =
|
|
221
|
+
const h = O === "all" ? [...d, m] : [m];
|
|
221
222
|
g(h), R((C) => (C + 1) % p.length), v(e.clientX, e.clientY, h);
|
|
222
|
-
},
|
|
223
|
-
return /* @__PURE__ */ Z(
|
|
224
|
-
/* @__PURE__ */ M("style", { dangerouslySetInnerHTML: { __html:
|
|
223
|
+
}, X = F === "custom" && A !== "none";
|
|
224
|
+
return /* @__PURE__ */ Z(oe, { children: [
|
|
225
|
+
/* @__PURE__ */ M("style", { dangerouslySetInnerHTML: { __html: ne } }),
|
|
225
226
|
/* @__PURE__ */ Z(
|
|
226
227
|
"div",
|
|
227
228
|
{
|
|
228
229
|
ref: f,
|
|
229
|
-
onClick:
|
|
230
|
+
onClick: re,
|
|
230
231
|
onMouseEnter: () => q(!0),
|
|
231
232
|
onMouseLeave: () => q(!1),
|
|
232
233
|
className: `${r}-root`,
|
|
233
|
-
style: { cursor:
|
|
234
|
+
style: { cursor: X ? "none" : "default" },
|
|
234
235
|
children: [
|
|
235
236
|
d.map((e) => /* @__PURE__ */ M(
|
|
236
237
|
"div",
|
|
@@ -240,13 +241,13 @@ function he({ settings: o, content: a = [], isEditor: i }) {
|
|
|
240
241
|
top: `${e.y}px`,
|
|
241
242
|
left: `${e.x}px`,
|
|
242
243
|
width: `${e.widthPx}px`,
|
|
243
|
-
cursor:
|
|
244
|
+
cursor: X ? "none" : "default"
|
|
244
245
|
},
|
|
245
|
-
children:
|
|
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` })
|
|
246
247
|
},
|
|
247
248
|
e.id
|
|
248
249
|
)),
|
|
249
|
-
x &&
|
|
250
|
+
x && X && /* @__PURE__ */ M(
|
|
250
251
|
"div",
|
|
251
252
|
{
|
|
252
253
|
className: `${r}-cursor`,
|
|
@@ -266,5 +267,5 @@ function he({ settings: o, content: a = [], isEditor: i }) {
|
|
|
266
267
|
] });
|
|
267
268
|
}
|
|
268
269
|
export {
|
|
269
|
-
|
|
270
|
+
pe as ClickGallerie
|
|
270
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;
|