@cntrl-site/components 1.0.106-alpha.0 → 1.0.107-alpha.1

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.
Files changed (92) hide show
  1. package/dist/ArchivePopup-DMpGP8r2.js +176 -0
  2. package/dist/ArchivePopup-X4EtTAyA.mjs +694 -0
  3. package/dist/ArchivePopupComponent-BTniPIfi.js +1 -0
  4. package/dist/{PretextComponent-j-OsRZTx.mjs → ArchivePopupComponent-GgAT2Avz.mjs} +954 -479
  5. package/dist/ClickGallerie-CYQMgrIr.js +36 -0
  6. package/dist/ClickGallerie-o2U6oyOF.mjs +272 -0
  7. package/dist/Components/ArchivePopup/ArchivePopup.d.ts +154 -0
  8. package/dist/Components/ArchivePopup/ArchivePopupComponent.d.ts +288 -0
  9. package/dist/Components/ClickGallerie/ClickGallerie.d.ts +2 -1
  10. package/dist/Components/Helix/Helix.d.ts +4 -1
  11. package/dist/Components/Hive/Hive.d.ts +4 -1
  12. package/dist/Components/ImageRevealSlider/ImageRevealSlider.d.ts +2 -1
  13. package/dist/Components/List/List.d.ts +6 -2
  14. package/dist/Components/Marquee/Marquee.d.ts +6 -2
  15. package/dist/Components/MarqueeText/MarqueeText.d.ts +2 -1
  16. package/dist/Components/Mercury/Mercury.d.ts +4 -1
  17. package/dist/Components/Waterfall/WaterfallLightbox.d.ts +4 -1
  18. package/dist/Components/utils/EmbedMediaFrame.d.ts +27 -0
  19. package/dist/Components/utils/LinkWrapper.d.ts +16 -0
  20. package/dist/Components/utils/embedMedia.d.ts +40 -0
  21. package/dist/Components/utils/index.d.ts +6 -0
  22. package/dist/{ControlSlider-SiOt22l_.js → ControlSlider-Kkec-i14.js} +1 -1
  23. package/dist/{ControlSlider-pZv7H6BU.mjs → ControlSlider-LcZmviGX.mjs} +1 -1
  24. package/dist/EmbedMediaFrame-DsOTKE4i.js +1 -0
  25. package/dist/EmbedMediaFrame-DwHeOAy5.mjs +164 -0
  26. package/dist/{FAQ-C7823fyi.js → FAQ-BxhMo7T8.js} +1 -1
  27. package/dist/{FAQ-CZ39u4m8.mjs → FAQ-CdwSft5p.mjs} +1 -1
  28. package/dist/Grid-CFHTP3mb.js +378 -0
  29. package/dist/Grid-e-gLfsji.mjs +1590 -0
  30. package/dist/Helix-BpLo9FD3.js +43 -0
  31. package/dist/Helix-CidI3ucE.mjs +324 -0
  32. package/dist/{Hive-D6-R6TwM.mjs → Hive-BsmFHk2i.mjs} +505 -475
  33. package/dist/Hive-D1j6wZpV.js +321 -0
  34. package/dist/ImageRevealSlider-BuukTGAK.js +1 -0
  35. package/dist/{ImageRevealSlider-BdFGyVEP.mjs → ImageRevealSlider-Df9sygk9.mjs} +63 -70
  36. package/dist/{Lightbox-eP9qAZzL.mjs → Lightbox-C_fXsfdz.mjs} +1 -1
  37. package/dist/{Lightbox-CIss_nOG.js → Lightbox-DaunVrkp.js} +1 -1
  38. package/dist/LinkWrapper-Ca84iPtg.js +1 -0
  39. package/dist/LinkWrapper-DZs9hlOn.mjs +13 -0
  40. package/dist/{List-DW7fyJbf.mjs → List-Bh_-l9vD.mjs} +532 -520
  41. package/dist/List-DVvpQ24J.js +377 -0
  42. package/dist/Marquee-DByooiWP.mjs +578 -0
  43. package/dist/Marquee-DfIP-tIN.js +133 -0
  44. package/dist/{MarqueeText-Rzt2fJYt.mjs → MarqueeText-D6FNCe6P.mjs} +115 -114
  45. package/dist/MarqueeText-DsUiV6Zv.js +132 -0
  46. package/dist/Mercury-B-s2Kvuq.js +267 -0
  47. package/dist/Mercury-CCW0Es-s.mjs +1700 -0
  48. package/dist/{RichTextRenderer-B6WtTYlR.mjs → RichTextRenderer-BptwNpbJ.mjs} +10 -9
  49. package/dist/RichTextRenderer-K90Dd7pt.js +1 -0
  50. package/dist/{Slider20-Dm8BeCli.mjs → Slider20-CCzixTiN.mjs} +1 -1
  51. package/dist/{Slider20-C9o2REDl.js → Slider20-fMVeRfgx.js} +1 -1
  52. package/dist/{TestimonialGrid-CPu4qQ6B.mjs → TestimonialGrid-CbsVxSn9.mjs} +1 -1
  53. package/dist/{TestimonialGrid-D4ieiz9e.js → TestimonialGrid-CiCagfBU.js} +1 -1
  54. package/dist/{TestimonialSingle-DLdnAVF7.mjs → TestimonialSingle-BVm3Amrl.mjs} +1 -1
  55. package/dist/{TestimonialSingle-CVu15ZtV.js → TestimonialSingle-BWXynGjv.js} +1 -1
  56. package/dist/Waterfall-3kKioKh2.mjs +1432 -0
  57. package/dist/Waterfall-DII4-WV5.js +288 -0
  58. package/dist/{components-D2LyuDm-.mjs → components-DKuQ8PUa.mjs} +19 -18
  59. package/dist/components-SEwSqFrQ.js +1 -0
  60. package/dist/content/postFieldBindings.d.ts +29 -0
  61. package/dist/elements.js +1 -1
  62. package/dist/elements.mjs +22 -21
  63. package/dist/elements.node.js +1 -1
  64. package/dist/elements.node.mjs +1 -1
  65. package/dist/index.d.ts +3 -1
  66. package/dist/index.js +1 -1
  67. package/dist/index.mjs +52 -15
  68. package/dist/sources.js +1331 -233
  69. package/dist/sources.mjs +1355 -256
  70. package/dist/types/SchemaV1.d.ts +53 -1
  71. package/dist/utils.js +1 -1
  72. package/dist/utils.mjs +30 -20
  73. package/package.json +1 -1
  74. package/dist/ClickGallerie-D7g093HX.js +0 -36
  75. package/dist/ClickGallerie-QSOQjSdv.mjs +0 -271
  76. package/dist/Grid-BBpdl60K.js +0 -374
  77. package/dist/Grid-DS53S_gA.mjs +0 -1576
  78. package/dist/Helix-BPn9V1sg.mjs +0 -315
  79. package/dist/Helix-DcgsCc4D.js +0 -43
  80. package/dist/Hive-n8Fz-j3o.js +0 -321
  81. package/dist/ImageRevealSlider-BBWtFjUF.js +0 -1
  82. package/dist/List-C32WImI3.js +0 -377
  83. package/dist/Marquee-DOIRRCu4.js +0 -133
  84. package/dist/Marquee-O_PDwlIb.mjs +0 -564
  85. package/dist/MarqueeText-DkaO2lQ5.js +0 -132
  86. package/dist/Mercury-C9D10TTT.mjs +0 -1702
  87. package/dist/Mercury-DynO-NxY.js +0 -267
  88. package/dist/PretextComponent-BnsS2zJ6.js +0 -1
  89. package/dist/RichTextRenderer-CIy6yI8U.js +0 -1
  90. package/dist/Waterfall-DC2WQ3GT.js +0 -287
  91. package/dist/Waterfall-Yud2VR62.mjs +0 -1404
  92. package/dist/components-B9Vdjf0w.js +0 -1
@@ -0,0 +1,36 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),u=require("react"),te=require("./useScopedStyles-Bf6yohVQ.js"),ne=require("./LinkWrapper-Ca84iPtg.js"),se={sizeType:"custom",value:700,min:400,max:700};function z(r,i){return{widthPx:r,heightPx:r*i}}function F(r,i,a,o,t,h){return{x:Math.min(Math.max(r,t/2),a-t/2),y:Math.min(Math.max(i,h/2),o-h/2)}}function A(r,i,a,o){const{heightPx:t}=z(a,o);return F(r/2,i/2,r,i,a,t)}function Z(r,i,a){for(const o of a){const{heightPx:t}=z(o.widthPx,o.aspectRatio),h=o.widthPx/2,f=t/2;if(r>=o.x-h&&r<=o.x+h&&i>=o.y-f&&i<=o.y+f)return!0}return!1}function re(r,i,a,o,t,h,f,p){if(t==="system")return"none";const P=o.getBoundingClientRect(),R=document.elementFromPoint(P.left+r,P.top+i);return R&&R.closest("a")?"none":Z(r,i,a)||h==="area"?f??"none":p??"none"}function H(r,i,a){var p;const{sizeType:o,value:t,min:h,max:f}=i;return o==="custom"?t:o==="as is"?((p=a.get(r))==null?void 0:p.naturalWidth)??t:Math.round(Math.random()*(f-h)+h)}function oe(r){return`
2
+ .${r}-root {
3
+ position: absolute;
4
+ top: 0;
5
+ left: 0;
6
+ width: 100%;
7
+ height: 100%;
8
+ overflow: hidden;
9
+ }
10
+ .${r}-wrapper {
11
+ position: absolute;
12
+ transform: translate(-50%, -50%);
13
+ height: auto;
14
+ }
15
+ .${r}-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
+ .${r}-link {
25
+ width: 100%;
26
+ display: block;
27
+ }
28
+ .${r}-cursor {
29
+ position: absolute;
30
+ top: 0;
31
+ left: 0;
32
+ pointer-events: none;
33
+ width: 32px;
34
+ height: 32px;
35
+ }
36
+ `}function ie(r){return new Promise(i=>{const a=new Image;a.onload=()=>{i({aspectRatio:a.naturalHeight/a.naturalWidth,naturalWidth:a.naturalWidth})},a.onerror=()=>{i({aspectRatio:1,naturalWidth:700})},a.src=r})}async function ae(r){const i=[...new Set(r.filter(Boolean))],a=await Promise.all(i.map(async o=>[o,await ie(o)]));return new Map(a)}function ce({settings:r,content:i=[],isEditor:a}){const{prefix:o}=te.useScopedStyles(),[t,h]=u.useState(null),[f,p]=u.useState([]),[P,R]=u.useState(0),J=u.useRef(0),[X,K]=u.useState({x:0,y:0}),[Y,_]=u.useState("none"),M=u.useRef({x:0,y:0}),[w,G]=u.useState(!1),[W,N]=u.useState(!1),S=u.useRef(new Map),{imageSize:k=se,cursor:T="system",target:$="area",origin:Q,position:V,visible:q="all",defaultCursor:b=null,hoverCursor:L=null}=r,I=Q??V??"random",x=i.filter(e=>{var n;return!!((n=e==null?void 0:e.image)!=null&&n.assetId)}),D=u.useMemo(()=>oe(o),[o]),v=u.useCallback((e,n,s=f)=>{if(!t)return;const d=t.getBoundingClientRect(),c=e-d.left,l=n-d.top;K({x:c,y:l}),_(re(c,l,s,t,T,$,L,b))},[t,f,T,$,L,b]);u.useEffect(()=>{const e=[...x.map(s=>s.image.assetId),b,L].filter(s=>!!s);if(e.length===0){S.current=new Map,N(!0);return}let n=!1;return N(!1),ae(e).then(s=>{n||(S.current=s,N(!0))}),()=>{n=!0}},[i,b,L]),u.useEffect(()=>{if(!t)return;const e=s=>{s.stopPropagation(),M.current={x:s.clientX,y:s.clientY},v(s.clientX,s.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]),u.useEffect(()=>{!t||!w||v(M.current.x,M.current.y)},[f,t,w,v]),u.useEffect(()=>{w||_("none")},[w]);const U=(e,n,s,d={})=>{var C,B;if(!((C=e==null?void 0:e.image)!=null&&C.assetId))return null;const c=((B=S.current.get(e.image.assetId))==null?void 0:B.aspectRatio)??1,l=H(e.image.assetId,k,S.current),{heightPx:E}=z(l,c);let m=0,g=0;return I==="same"?{x:m,y:g}=A(n,s,l,c):(m=d.x??Math.random()*n,g=d.y??Math.random()*s,{x:m,y:g}=F(m,g,n,s,l,E)),{id:J.current++,assetId:e.image.assetId,link:e.link,name:e.image.name,x:m,y:g,xRatio:m/n,yRatio:g/s,aspectRatio:c,widthPx:l}},j=()=>{if(!t)return;const e=t.getBoundingClientRect(),n=e.width,s=e.height;n===0||s===0||p(d=>d.length===0?d:d.map(c=>{const l=k.sizeType==="random"?c.widthPx:H(c.assetId,k,S.current),{heightPx:E}=z(l,c.aspectRatio);if(I==="same"){const{x:C,y:B}=A(n,s,l,c.aspectRatio);return{...c,x:C,y:B,widthPx:l}}const{x:m,y:g}=F(c.xRatio*n,c.yRatio*s,n,s,l,E);return{...c,x:m,y:g,widthPx:l}}))};u.useEffect(()=>{if(!t||x.length===0||!W)return;const e=t.getBoundingClientRect(),n=e.width,s=e.height,d=U(x[0],n,s);d&&(p([d]),R(x.length>1?1:0))},[k,I,t,i,W]),u.useEffect(()=>{if(!t)return;j();const e=new ResizeObserver(j);return e.observe(t),window.addEventListener("resize",j),()=>{e.disconnect(),window.removeEventListener("resize",j)}},[t,I,k,f.length]),u.useEffect(()=>{q==="last One"&&p(e=>e.length>0?[e[e.length-1]]:[])},[q]);const ee=e=>{if(!t||x.length===0||!W)return;const n=t.getBoundingClientRect(),s=e.clientX-n.left,d=e.clientY-n.top;if($==="image"&&!Z(s,d,f))return;let c=0,l=0;I==="on Click"?(c=s,l=d):I==="same"?(c=n.width/2,l=n.height/2):(c=Math.random()*n.width,l=Math.random()*n.height);const E=x[P%x.length],m=U(E,n.width,n.height,{x:c,y:l});if(!m)return;const g=q==="all"?[...f,m]:[m];p(g),R(C=>(C+1)%x.length),v(e.clientX,e.clientY,g)},O=T==="custom"&&Y!=="none";return y.jsxs(y.Fragment,{children:[y.jsx("style",{dangerouslySetInnerHTML:{__html:D}}),y.jsxs("div",{ref:h,onClick:ee,onMouseEnter:()=>G(!0),onMouseLeave:()=>G(!1),className:`${o}-root`,style:{cursor:O?"none":"default"},children:[f.map(e=>y.jsx("div",{className:`${o}-wrapper`,style:{top:`${e.y}px`,left:`${e.x}px`,width:`${e.widthPx}px`,cursor:O?"none":"default"},children:y.jsx(ne.LinkWrapper,{link:$==="area"?e.link:void 0,className:`${o}-link`,children:y.jsx("img",{src:e.assetId,alt:e.name,className:`${o}-image`})})},e.id)),w&&O&&y.jsx("div",{className:`${o}-cursor`,style:{left:`${X.x}px`,top:`${X.y}px`,transform:"translate(-50%, -50%)",backgroundImage:`url('${Y}')`,backgroundSize:"cover",backgroundPosition:"center"}})]})]})}exports.ClickGallerie=ce;
@@ -0,0 +1,272 @@
1
+ import { jsxs as Z, Fragment as oe, jsx as b } from "react/jsx-runtime";
2
+ import { useState as y, useRef as _, useMemo as se, useCallback as ie, useEffect as w } from "react";
3
+ import { u as ae } from "./useScopedStyles-DhBG3557.mjs";
4
+ import { L as ce } from "./LinkWrapper-DZs9hlOn.mjs";
5
+ const le = {
6
+ sizeType: "custom",
7
+ value: 700,
8
+ min: 400,
9
+ max: 700
10
+ };
11
+ function W(o, i) {
12
+ return {
13
+ widthPx: o,
14
+ heightPx: o * i
15
+ };
16
+ }
17
+ function j(o, i, a, s, t, m) {
18
+ return {
19
+ x: Math.min(Math.max(o, t / 2), a - t / 2),
20
+ y: Math.min(Math.max(i, m / 2), s - m / 2)
21
+ };
22
+ }
23
+ function J(o, i, a, s) {
24
+ const { heightPx: t } = W(a, s);
25
+ return j(
26
+ o / 2,
27
+ i / 2,
28
+ o,
29
+ i,
30
+ a,
31
+ t
32
+ );
33
+ }
34
+ function Q(o, i, a) {
35
+ for (const s of a) {
36
+ const { heightPx: t } = W(s.widthPx, s.aspectRatio), m = s.widthPx / 2, d = t / 2;
37
+ if (o >= s.x - m && o <= s.x + m && i >= s.y - d && i <= s.y + d)
38
+ return !0;
39
+ }
40
+ return !1;
41
+ }
42
+ function ue(o, i, a, s, t, m, d, g) {
43
+ if (t === "system")
44
+ return "none";
45
+ const S = s.getBoundingClientRect(), M = document.elementFromPoint(S.left + o, S.top + i);
46
+ return M && M.closest("a") ? "none" : Q(o, i, a) || m === "area" ? d ?? "none" : g ?? "none";
47
+ }
48
+ function K(o, i, a) {
49
+ var g;
50
+ const { sizeType: s, value: t, min: m, max: d } = i;
51
+ return s === "custom" ? t : s === "as is" ? ((g = a.get(o)) == null ? void 0 : g.naturalWidth) ?? t : Math.round(Math.random() * (d - m) + m);
52
+ }
53
+ function de(o) {
54
+ return `
55
+ .${o}-root {
56
+ position: absolute;
57
+ top: 0;
58
+ left: 0;
59
+ width: 100%;
60
+ height: 100%;
61
+ overflow: hidden;
62
+ }
63
+ .${o}-wrapper {
64
+ position: absolute;
65
+ transform: translate(-50%, -50%);
66
+ height: auto;
67
+ }
68
+ .${o}-image {
69
+ display: block;
70
+ width: 100%;
71
+ height: auto;
72
+ object-fit: cover;
73
+ position: relative;
74
+ user-select: none;
75
+ pointer-events: none;
76
+ }
77
+ .${o}-link {
78
+ width: 100%;
79
+ display: block;
80
+ }
81
+ .${o}-cursor {
82
+ position: absolute;
83
+ top: 0;
84
+ left: 0;
85
+ pointer-events: none;
86
+ width: 32px;
87
+ height: 32px;
88
+ }
89
+ `;
90
+ }
91
+ function me(o) {
92
+ return new Promise((i) => {
93
+ const a = new Image();
94
+ a.onload = () => {
95
+ i({
96
+ aspectRatio: a.naturalHeight / a.naturalWidth,
97
+ naturalWidth: a.naturalWidth
98
+ });
99
+ }, a.onerror = () => {
100
+ i({ aspectRatio: 1, naturalWidth: 700 });
101
+ }, a.src = o;
102
+ });
103
+ }
104
+ async function fe(o) {
105
+ const i = [...new Set(o.filter(Boolean))], a = await Promise.all(
106
+ i.map(async (s) => [s, await me(s)])
107
+ );
108
+ return new Map(a);
109
+ }
110
+ function ye({ settings: o, content: i = [], isEditor: a }) {
111
+ const { prefix: s } = ae(), [t, m] = y(null), [d, g] = y([]), [S, M] = y(0), V = _(0), [U, D] = y({ x: 0, y: 0 }), [A, G] = y("none"), R = _({ x: 0, y: 0 }), [x, q] = y(!1), [T, F] = y(!1), k = _(/* @__PURE__ */ new Map()), {
112
+ imageSize: P = le,
113
+ cursor: O = "system",
114
+ target: E = "area",
115
+ origin: ee,
116
+ position: te,
117
+ visible: X = "all",
118
+ defaultCursor: L = null,
119
+ hoverCursor: B = null
120
+ } = o, I = ee ?? te ?? "random", p = i.filter(
121
+ (e) => {
122
+ var n;
123
+ return !!((n = e == null ? void 0 : e.image) != null && n.assetId);
124
+ }
125
+ ), ne = se(() => de(s), [s]), v = ie((e, n, r = d) => {
126
+ if (!t) return;
127
+ const u = t.getBoundingClientRect(), c = e - u.left, l = n - u.top;
128
+ D({ x: c, y: l }), G(
129
+ ue(c, l, r, t, O, E, B, L)
130
+ );
131
+ }, [t, d, O, E, B, L]);
132
+ w(() => {
133
+ const e = [
134
+ ...p.map((r) => r.image.assetId),
135
+ L,
136
+ B
137
+ ].filter((r) => !!r);
138
+ if (e.length === 0) {
139
+ k.current = /* @__PURE__ */ new Map(), F(!0);
140
+ return;
141
+ }
142
+ let n = !1;
143
+ return F(!1), fe(e).then((r) => {
144
+ n || (k.current = r, F(!0));
145
+ }), () => {
146
+ n = !0;
147
+ };
148
+ }, [i, L, B]), w(() => {
149
+ if (!t) return;
150
+ const e = (r) => {
151
+ r.stopPropagation(), R.current = { x: r.clientX, y: r.clientY }, v(r.clientX, r.clientY);
152
+ }, n = () => {
153
+ x && v(R.current.x, R.current.y);
154
+ };
155
+ return t.addEventListener("mousemove", e), window.addEventListener("scroll", n, !0), () => {
156
+ t.removeEventListener("mousemove", e), window.removeEventListener("scroll", n, !0);
157
+ };
158
+ }, [t, x, v]), w(() => {
159
+ !t || !x || v(R.current.x, R.current.y);
160
+ }, [d, t, x, v]), w(() => {
161
+ x || G("none");
162
+ }, [x]);
163
+ const H = (e, n, r, u = {}) => {
164
+ var C, N;
165
+ if (!((C = e == null ? void 0 : e.image) != null && C.assetId)) return null;
166
+ const c = ((N = k.current.get(e.image.assetId)) == null ? void 0 : N.aspectRatio) ?? 1, l = K(e.image.assetId, P, k.current), { heightPx: $ } = W(l, c);
167
+ let f = 0, h = 0;
168
+ return I === "same" ? { x: f, y: h } = J(n, r, l, c) : (f = u.x ?? Math.random() * n, h = u.y ?? Math.random() * r, { x: f, y: h } = j(f, h, n, r, l, $)), {
169
+ id: V.current++,
170
+ assetId: e.image.assetId,
171
+ link: e.link,
172
+ name: e.image.name,
173
+ x: f,
174
+ y: h,
175
+ xRatio: f / n,
176
+ yRatio: h / r,
177
+ aspectRatio: c,
178
+ widthPx: l
179
+ };
180
+ }, z = () => {
181
+ if (!t) return;
182
+ const e = t.getBoundingClientRect(), n = e.width, r = e.height;
183
+ n === 0 || r === 0 || g((u) => u.length === 0 ? u : u.map((c) => {
184
+ const l = P.sizeType === "random" ? c.widthPx : K(c.assetId, P, k.current), { heightPx: $ } = W(l, c.aspectRatio);
185
+ if (I === "same") {
186
+ const { x: C, y: N } = J(n, r, l, c.aspectRatio);
187
+ return { ...c, x: C, y: N, widthPx: l };
188
+ }
189
+ const { x: f, y: h } = j(
190
+ c.xRatio * n,
191
+ c.yRatio * r,
192
+ n,
193
+ r,
194
+ l,
195
+ $
196
+ );
197
+ return { ...c, x: f, y: h, widthPx: l };
198
+ }));
199
+ };
200
+ w(() => {
201
+ if (!t || p.length === 0 || !T) return;
202
+ const e = t.getBoundingClientRect(), n = e.width, r = e.height, u = H(p[0], n, r);
203
+ u && (g([u]), M(p.length > 1 ? 1 : 0));
204
+ }, [P, I, t, i, T]), w(() => {
205
+ if (!t) return;
206
+ z();
207
+ const e = new ResizeObserver(z);
208
+ return e.observe(t), window.addEventListener("resize", z), () => {
209
+ e.disconnect(), window.removeEventListener("resize", z);
210
+ };
211
+ }, [t, I, P, d.length]), w(() => {
212
+ X === "last One" && g((e) => e.length > 0 ? [e[e.length - 1]] : []);
213
+ }, [X]);
214
+ const re = (e) => {
215
+ if (!t || p.length === 0 || !T) return;
216
+ const n = t.getBoundingClientRect(), r = e.clientX - n.left, u = e.clientY - n.top;
217
+ if (E === "image" && !Q(r, u, d)) return;
218
+ let c = 0, l = 0;
219
+ I === "on Click" ? (c = r, l = u) : I === "same" ? (c = n.width / 2, l = n.height / 2) : (c = Math.random() * n.width, l = Math.random() * n.height);
220
+ const $ = p[S % p.length], f = H($, n.width, n.height, { x: c, y: l });
221
+ if (!f) return;
222
+ const h = X === "all" ? [...d, f] : [f];
223
+ g(h), M((C) => (C + 1) % p.length), v(e.clientX, e.clientY, h);
224
+ }, Y = O === "custom" && A !== "none";
225
+ return /* @__PURE__ */ Z(oe, { children: [
226
+ /* @__PURE__ */ b("style", { dangerouslySetInnerHTML: { __html: ne } }),
227
+ /* @__PURE__ */ Z(
228
+ "div",
229
+ {
230
+ ref: m,
231
+ onClick: re,
232
+ onMouseEnter: () => q(!0),
233
+ onMouseLeave: () => q(!1),
234
+ className: `${s}-root`,
235
+ style: { cursor: Y ? "none" : "default" },
236
+ children: [
237
+ d.map((e) => /* @__PURE__ */ b(
238
+ "div",
239
+ {
240
+ className: `${s}-wrapper`,
241
+ style: {
242
+ top: `${e.y}px`,
243
+ left: `${e.x}px`,
244
+ width: `${e.widthPx}px`,
245
+ cursor: Y ? "none" : "default"
246
+ },
247
+ children: /* @__PURE__ */ b(ce, { link: E === "area" ? e.link : void 0, className: `${s}-link`, children: /* @__PURE__ */ b("img", { src: e.assetId, alt: e.name, className: `${s}-image` }) })
248
+ },
249
+ e.id
250
+ )),
251
+ x && Y && /* @__PURE__ */ b(
252
+ "div",
253
+ {
254
+ className: `${s}-cursor`,
255
+ style: {
256
+ left: `${U.x}px`,
257
+ top: `${U.y}px`,
258
+ transform: "translate(-50%, -50%)",
259
+ backgroundImage: `url('${A}')`,
260
+ backgroundSize: "cover",
261
+ backgroundPosition: "center"
262
+ }
263
+ }
264
+ )
265
+ ]
266
+ }
267
+ )
268
+ ] });
269
+ }
270
+ export {
271
+ ye as ClickGallerie
272
+ };
@@ -0,0 +1,154 @@
1
+ import { CommonComponentProps } from '../props';
2
+ import { TextStyles } from '../utils/textStylesToCss';
3
+ type ArchivePopupMedia = {
4
+ assetId: string;
5
+ name?: string;
6
+ type?: 'image' | 'video';
7
+ objectFit?: 'cover' | 'contain';
8
+ };
9
+ /** Columns count the group column too, so the least is the group and its title. */
10
+ export declare const ARCHIVE_POPUP_MIN_COLUMNS = 2;
11
+ export declare const ARCHIVE_POPUP_MAX_COLUMNS = 5;
12
+ /** The fields of the columns after the title, in order; `columns` decides how many of them a row shows. */
13
+ export declare const ARCHIVE_POPUP_EXTRA_TITLE_KEYS: readonly ["title2", "title3", "title4"];
14
+ /** Every column but the last has a width of its own, like Programme's; the last takes what is left of the row. */
15
+ export declare const ARCHIVE_POPUP_COLUMN_WIDTH_KEYS: readonly ["column1Width", "column2Width", "column3Width", "column4Width"];
16
+ type ArchivePopupColumnWidthKey = typeof ARCHIVE_POPUP_COLUMN_WIDTH_KEYS[number];
17
+ /**
18
+ * Where A's panel sits on the screen, as `left`/`top` of the screen and of the panel alike, so 0% is flush with
19
+ * one edge and 100% with the other. Named like Mercury's title position; center comes first because the editor
20
+ * puts the first value into a popup saved before there was a position, and those were centred.
21
+ */
22
+ declare const PANEL_POSITION_OFFSETS: {
23
+ readonly center: {
24
+ readonly x: "50%";
25
+ readonly y: "50%";
26
+ };
27
+ readonly 'left-top': {
28
+ readonly x: "0%";
29
+ readonly y: "0%";
30
+ };
31
+ readonly 'top-center': {
32
+ readonly x: "50%";
33
+ readonly y: "0%";
34
+ };
35
+ readonly 'top-right': {
36
+ readonly x: "100%";
37
+ readonly y: "0%";
38
+ };
39
+ readonly 'left-center': {
40
+ readonly x: "0%";
41
+ readonly y: "50%";
42
+ };
43
+ readonly 'right-center': {
44
+ readonly x: "100%";
45
+ readonly y: "50%";
46
+ };
47
+ readonly 'left-bottom': {
48
+ readonly x: "0%";
49
+ readonly y: "100%";
50
+ };
51
+ readonly 'bottom-center': {
52
+ readonly x: "50%";
53
+ readonly y: "100%";
54
+ };
55
+ readonly 'right-bottom': {
56
+ readonly x: "100%";
57
+ readonly y: "100%";
58
+ };
59
+ };
60
+ export type ArchivePopupPanelPosition = keyof typeof PANEL_POSITION_OFFSETS;
61
+ export declare const ARCHIVE_POPUP_PANEL_POSITIONS: ArchivePopupPanelPosition[];
62
+ /** Each column of a row has a text style of its own, the group column's being `column1`. */
63
+ export declare const ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES: readonly ["column1", "column2", "column3", "column4", "column5"];
64
+ type ArchivePopupColumnStylePrefix = typeof ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES[number];
65
+ type ArchivePopupTitle = any[] | string;
66
+ export type ArchivePopupContentItem = {
67
+ group?: string;
68
+ /** Rich text, so parts of a title can be linked; a plain string is still shown as is. */
69
+ title?: ArchivePopupTitle;
70
+ title2?: ArchivePopupTitle;
71
+ title3?: ArchivePopupTitle;
72
+ title4?: ArchivePopupTitle;
73
+ image?: ArchivePopupMedia;
74
+ };
75
+ type FontSettings = {
76
+ fontWeight: number;
77
+ fontStyle: string;
78
+ };
79
+ type Padding = {
80
+ top: number;
81
+ right: number;
82
+ bottom: number;
83
+ left: number;
84
+ };
85
+ /** A text style as settings hold it, each field under the name of what it styles, e.g. `triggerFontSize`. */
86
+ type TextStyleFields = {
87
+ FontFamily?: string;
88
+ FontSettings?: FontSettings;
89
+ FontSize?: number;
90
+ LineHeight?: number;
91
+ LetterSpacing?: number;
92
+ WordSpacing?: number;
93
+ TextAlign?: TextStyles['textAlign'];
94
+ TextAppearance?: TextStyles['textAppearance'];
95
+ };
96
+ type PrefixedTextStyle<Prefix extends string> = {
97
+ [Key in keyof TextStyleFields as `${Prefix}${Key}`]?: TextStyleFields[Key];
98
+ };
99
+ type ArchivePopupSettings = PrefixedTextStyle<'trigger'> & PrefixedTextStyle<ArchivePopupColumnStylePrefix> & PrefixedTextStyle<'list'> & {
100
+ /** `a` opens from a label; `b` is always open, in place on the page. */
101
+ type?: 'a' | 'b';
102
+ triggerLabel?: string;
103
+ closeLabel?: string;
104
+ /** Every column of a row, the group column included. */
105
+ columns?: number;
106
+ columnGap?: number;
107
+ column1Width?: number;
108
+ column2Width?: number;
109
+ column3Width?: number;
110
+ column4Width?: number;
111
+ /** A only: B's panel stays where it is placed on the page. */
112
+ panelPosition?: string;
113
+ panelWidth?: number;
114
+ panelPadding?: Padding;
115
+ panelRadius?: number;
116
+ groupGap?: number;
117
+ triggerColor?: string;
118
+ triggerHoverColor?: string;
119
+ closeColor?: string;
120
+ closeHoverColor?: string;
121
+ panelColor?: string;
122
+ textColor?: string;
123
+ textHoverColor?: string;
124
+ overlayColor?: string;
125
+ };
126
+ type ArchivePopupProps = {
127
+ settings: ArchivePopupSettings;
128
+ content?: ArchivePopupContentItem[];
129
+ isEditor?: boolean;
130
+ isEditMode?: boolean;
131
+ isPreviewMode?: boolean;
132
+ activeEvent?: string;
133
+ portalId?: string;
134
+ } & CommonComponentProps;
135
+ export type ArchivePopupRow = {
136
+ item: ArchivePopupContentItem;
137
+ index: number;
138
+ };
139
+ export type ArchivePopupGroup = {
140
+ label: string;
141
+ rows: ArchivePopupRow[];
142
+ };
143
+ type ColumnLayoutSettings = Pick<ArchivePopupSettings, 'columns' | 'columnGap' | 'panelWidth' | 'panelPadding'> & Partial<Record<ArchivePopupColumnWidthKey, number>>;
144
+ export declare function getArchivePopupEqualColumnWidths(settings: ColumnLayoutSettings): Partial<Record<ArchivePopupColumnWidthKey, number>>;
145
+ /**
146
+ * Every column's width, the last taking what the others leave. A column with no width of its own gets an equal share,
147
+ * and widths that no longer fit, after the panel narrows or a column is added, shrink together until they do.
148
+ */
149
+ export declare function resolveArchivePopupColumnWidths(settings: ColumnLayoutSettings): number[];
150
+ /** Like Programme, a new column count starts the columns over at equal widths. */
151
+ export declare function applyArchivePopupColumnCountChange(nextSettings: Record<string, any>, prevSettings: Record<string, any>): Record<string, any>;
152
+ export declare function groupArchiveRows(items: ArchivePopupContentItem[]): ArchivePopupGroup[];
153
+ export declare function ArchivePopup({ settings, content, isEditor, isEditMode, isPreviewMode, activeEvent, portalId, currentState, unavailableStates, }: ArchivePopupProps): import("react/jsx-runtime").JSX.Element;
154
+ export {};