@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
package/dist/Scale-rLNT4KAk.mjs
DELETED
|
@@ -1,345 +0,0 @@
|
|
|
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
|
-
};
|