@cntrl-site/components 1.0.111 → 1.0.113-alpha.0

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 (60) hide show
  1. package/dist/{Burger-C3yVbQcq.js → Burger-B4kXX9aY.js} +1 -1
  2. package/dist/{Burger-BkVgNMGU.mjs → Burger-DyORh_vF.mjs} +1 -1
  3. package/dist/{ChroniclesComponent-FFenN7yL.js → ChroniclesComponent-B6L-8Gn2.js} +1 -1
  4. package/dist/{ChroniclesComponent-cZLqN307.mjs → ChroniclesComponent-adaAqTy8.mjs} +12 -12
  5. package/dist/Components/PopupMenu/PopupMenu.d.ts +70 -0
  6. package/dist/Components/PopupMenu/PopupMenuComponent.d.ts +578 -0
  7. package/dist/Components/PopupMenu/popupMenuLayout.d.ts +176 -0
  8. package/dist/Components/helpers/SvgImage/loadSvgMaskUrl.d.ts +7 -0
  9. package/dist/{ControlSlider-DqKfaKMG.mjs → ControlSlider-3w-bHQEg.mjs} +1 -1
  10. package/dist/{ControlSlider-C8ckUIDm.js → ControlSlider-DB4nbVLT.js} +1 -1
  11. package/dist/{FAQ-BS-vO0l-.mjs → FAQ-BjLLn81l.mjs} +1 -1
  12. package/dist/{FAQ-Ct0YfqX1.js → FAQ-C5evIqbl.js} +1 -1
  13. package/dist/{Grid-CU1dsdoO.js → Grid-BXUT_Hn6.js} +1 -1
  14. package/dist/{Grid-qbqchSLi.mjs → Grid-Dn44dvgx.mjs} +1 -1
  15. package/dist/{Hive-CzabuuCc.js → Hive-34KvKNsa.js} +1 -1
  16. package/dist/{Hive-DyxYd5eg.mjs → Hive-7xHXyMM1.mjs} +1 -1
  17. package/dist/{HiveLightboxTitles-DhEeFKWs.mjs → HiveLightboxTitles-BCoL46-V.mjs} +1 -1
  18. package/dist/{HiveLightboxTitles-DlyptAaK.js → HiveLightboxTitles-DEeyQGcf.js} +1 -1
  19. package/dist/{Lightbox-DZckgBzK.js → Lightbox-Cb7lyaNt.js} +1 -1
  20. package/dist/{Lightbox-BY99NS14.mjs → Lightbox-DzPqgKP4.mjs} +1 -1
  21. package/dist/{LightboxJournal-DAEZOPDi.js → LightboxJournal-BFF5aKRz.js} +1 -1
  22. package/dist/{LightboxJournal-D59ex6wH.mjs → LightboxJournal-C_q7_s-B.mjs} +1 -1
  23. package/dist/{LightboxStrip-YspzBP8N.mjs → LightboxStrip-BrNj7ipX.mjs} +1 -1
  24. package/dist/{LightboxStrip-BDjI1jyH.js → LightboxStrip-CC2e0_9A.js} +1 -1
  25. package/dist/{Mercury-B-s2Kvuq.js → Mercury-BmhtFYOw.js} +1 -1
  26. package/dist/{Mercury-CCW0Es-s.mjs → Mercury-Q788wrYQ.mjs} +1 -1
  27. package/dist/{OnelinerForm-C2Y_XMCY.js → OnelinerForm-CUmY-bXL.js} +1 -1
  28. package/dist/{OnelinerForm-BEu7_sho.mjs → OnelinerForm-D8WIB9Qy.mjs} +1 -1
  29. package/dist/PopupMenu-BYZy1R1y.js +356 -0
  30. package/dist/PopupMenu-DXWVDnPf.mjs +972 -0
  31. package/dist/{SimpleButton-C-o2W9bS.mjs → SimpleButton-DTpzfmb6.mjs} +1 -1
  32. package/dist/{SimpleButton-nGEcO2gB.js → SimpleButton-DtaCYa3y.js} +1 -1
  33. package/dist/{Slider20-DUi6qwnd.mjs → Slider20-CKngROrc.mjs} +1 -1
  34. package/dist/{Slider20-BOmjDRf2.js → Slider20-q0iGgnE3.js} +1 -1
  35. package/dist/SvgImage-CwRq9-ec.mjs +56 -0
  36. package/dist/SvgImage-_QN8ngad.js +1 -0
  37. package/dist/{TestimonialSingle-DrnyReim.mjs → TestimonialSingle-Bax71Hyo.mjs} +1 -1
  38. package/dist/{TestimonialSingle-BORQom3u.js → TestimonialSingle-CpEUendN.js} +1 -1
  39. package/dist/{Waterfall-DII4-WV5.js → Waterfall-B9YWMhrg.js} +1 -1
  40. package/dist/{Waterfall-3kKioKh2.mjs → Waterfall-znaoynn5.mjs} +1 -1
  41. package/dist/components-Ce8GmbzS.js +1 -0
  42. package/dist/{components-DtO0Ti47.mjs → components-QxlSJUUn.mjs} +638 -30
  43. package/dist/elements.js +1 -1
  44. package/dist/elements.mjs +23 -22
  45. package/dist/elements.node.js +1 -1
  46. package/dist/elements.node.mjs +1 -1
  47. package/dist/index.d.ts +2 -0
  48. package/dist/index.js +1 -1
  49. package/dist/index.mjs +50 -28
  50. package/dist/loadSvgMaskUrl-B6kHUyof.js +1 -0
  51. package/dist/loadSvgMaskUrl-DUhCVvpl.mjs +39 -0
  52. package/dist/sources.js +1 -1
  53. package/dist/sources.mjs +1 -1
  54. package/dist/types/SchemaV1.d.ts +3 -0
  55. package/package.json +1 -1
  56. package/dist/SvgImage-B5mR9y6q.mjs +0 -51
  57. package/dist/SvgImage-DFlmxAoL.js +0 -1
  58. package/dist/components-f82884Bk.js +0 -1
  59. package/dist/loadSvgMaskUrl-DfF7ay6h.js +0 -1
  60. package/dist/loadSvgMaskUrl-xHgGYgPe.mjs +0 -20
@@ -0,0 +1,356 @@
1
+ "use strict";const b=require("react/jsx-runtime"),g=require("react"),we=require("react-dom"),Dt=require("./scalingValue-CSHYgTZl.js"),ke=require("./useScopedStyles-Bf6yohVQ.js"),_e=require("./useLightboxScrollLock-Hf16Eq4g.js"),Ce=require("./textStylesToCss-CNN3zZTV.js"),Se=require("./RichTextRenderer-DEFXh5o6.js"),Te=require("./SvgImage-_QN8ngad.js"),Ut=60,Wt=900/1440,Ht=["left","center","right"],ft={columns:12,columnWidth:99/1440,gutter:20/1440};function Yt(t,e=ft){const o=c=>typeof c=="number"&&Number.isFinite(c),n=(c,...s)=>s.find(o)??c,r=t.gridLayout??{},u=Math.max(0,n(e.gutter,r.horizontalGap,t.gridGutter));return{columns:Math.max(1,Math.round(n(e.columns,r.columnsCount,t.gridColumns))),columnWidth:Math.max(0,n(e.columnWidth,r.entryWidth,t.gridColumnWidth)),gutter:u,rowGap:Math.max(0,n(u,t.verticalGap))}}function K(t){return t.rowGap??t.gutter}function $t(t){const e=t.popupHeight;return Math.min(100,Math.max(0,typeof e=="number"&&Number.isFinite(e)?e:Ut))}function Vt(t,e=Wt){return $t(t)/100*e}function qt(t){return Ht.includes(t.popupAlign)?t.popupAlign:"center"}function Xt(t,e){var r;const o=(r=t.gridLayout)==null?void 0:r.wrapperWidth,n=e.columns*e.columnWidth+(e.columns-1)*e.gutter;return typeof o=="number"&&Number.isFinite(o)&&o>0?Math.max(o,n):n>0?n:1}function Zt(t){if(typeof t=="number")return{top:t,right:t,bottom:t,left:t};const e=o=>typeof o=="number"&&Number.isFinite(o)?Math.max(0,o):0;return{top:e(t==null?void 0:t.top),right:e(t==null?void 0:t.right),bottom:e(t==null?void 0:t.bottom),left:e(t==null?void 0:t.left)}}const Kt={span:{text:{min:1/4,max:5/12},image:{min:1/6,max:1/3},listA:{min:1/6,max:1/4},listB:{min:1/6,max:1/4}},breakChance:.25};function Jt(t,e,o,n,r=Kt){const u=Ne(o),c=Math.max(1,Math.floor(e.columns)),s=[];let d=0,f=new Array(c).fill(!1);const x={};for(const L of t){const m=x[L]??(x[L]=Re(r.span[L]??r.span.text,c,u));let p=jt(f,m);const v=f.some(Boolean);(p.length===0||v&&u()<r.breakChance)&&(d+=1,f=new Array(c).fill(!1),p=jt(f,m));const N=p[Math.floor(u()*p.length)];for(let E=Math.max(0,N-1);E<Math.min(c,N+m+1);E++)f[E]=!0;s.push({column:N,span:m,row:d})}const a=d+1;return{seed:o,grid:{...e,columns:c},placements:s.map(({column:L,span:m,row:p})=>({column:L,span:m,top:H(e,p*n/a,n)}))}}function Ie(){return Math.floor(Math.random()*2147483647)}function H(t,e,o=1/0){const n=t.beat??0,r=Math.max(0,o),u=n>0?Math.round(e/n)*n:e,c=u<=r?u:n>0?Math.floor(r/n+1e-9)*n:r;return Math.round(Math.max(0,c)*1e6)/1e6}function bt(t){return t.beat&&t.beat>0?t.beat:8/1440}function J(t,e,o=1/0){const n=t.beat??0,r=bt(t),u=n>0?Math.round(e/n)*n:e,c=u<=o?u:n>0?Math.floor(o/n+1e-9)*n:o;return te(Math.max(r,c))}function Qt(t,e){const o=(n,r)=>Math.abs(n-r)<1e-9;return Math.floor(t.columns)===Math.floor(e.columns)&&o(t.columnWidth,e.columnWidth)&&o(t.gutter,e.gutter)&&o(K(t),K(e))&&o(t.beat??0,e.beat??0)}function Pt(t,e){const o={...e,columns:Math.max(1,Math.floor(e.columns))};if(Qt(t.grid,o))return t;const n=Math.max(1,Math.floor(t.grid.columns)),r=o.columns,u=s=>n===r?s:Math.round(s*r/n),c=t.placements.map(s=>{const d=Math.min(r,Math.max(1,u(s.span))),f=Math.min(Math.max(0,u(s.column)),r-d),x=H(o,s.top);return s.height===void 0?{column:f,span:d,top:x}:{column:f,span:d,top:x,height:J(o,s.height)}});return{...t,grid:o,placements:c}}function te(t){return Math.round(t*1e6)/1e6}function ee(t,e,o,n,r){return t.column<o.column+o.span&&o.column<t.column+t.span&&t.top<o.top+n+r-1e-9&&o.top<t.top+e+r-1e-9}function oe(t,e,o,n,r){const u=t.placements[e];return u?re(t,e,{...u,column:o,top:n},r):null}function ne(t,e,o,n){if(!t.placements[e])return null;const{columns:r}=t.grid,u=Math.min(Math.max(0,o.column),r-1),c=Math.min(Math.max(1,o.span),r-u),s=H(t.grid,o.top,n?n.height-bt(t.grid):1/0),d=o.height===void 0?void 0:J(t.grid,o.height,n?n.height-s:1/0);return re(t,e,d===void 0?{column:u,span:c,top:s}:{column:u,span:c,top:s,height:d},n)}function re(t,e,o,n){const{columns:r}=t.grid,u=K(t.grid),c=Math.min(o.span,r);if(c<1||o.column<0||o.column+c>r)return null;const s=o.height??(n==null?void 0:n.heights[e])??0,d={column:o.column,span:c,top:H(t.grid,o.top,n?n.height-s:1/0),...o.height===void 0?{}:{height:o.height}};return n&&t.placements.some((f,x)=>x!==e&&ee(d,s,f,n.heights[x]??0,u))?null:{...t,edited:!0,placements:t.placements.map((f,x)=>x===e?d:f)}}function ie(t,e){const{columns:o}=t.grid,n=K(t.grid),r=t.grid.beat??0,u=e.height,c=t.placements.map((m,p)=>e.heights[p]??0),s=[...t.placements],d=s.map((m,p)=>p).sort((m,p)=>s[m].top-s[p].top||m-p),f=[],x=(m,p)=>{let{top:v}=m;for(let N=!0,E=0;N&&E<=f.length;E++){N=!1;for(const A of f){const w=s[A];if(!ee({...m,top:v},p,w,c[A],n))continue;const R=w.top+c[A]+n,S=r>0?te(Math.ceil(R/r-1e-9)*r):Math.ceil(R*1e6-1e-6)/1e6;S<=v||(v=S,N=!0)}}return v},a=(m,p)=>m+p>u+1e-9;let L=!1;for(const m of d){const p=s[m];let v={column:p.column,top:x(p,c[m])};if(v.top!==p.top&&a(v.top,c[m])){const N=Math.min(p.span,o),E=Array.from({length:Math.max(0,o-N+1)},(w,R)=>R).sort((w,R)=>Math.abs(w-p.column)-Math.abs(R-p.column)||w-R);let A=null;for(const w of E){const R=x({...p,column:w},c[m]);!a(R,c[m])&&(!A||R<A.top-1e-9)&&(A={column:w,top:R})}A&&(v=A)}(v.column!==p.column||v.top!==p.top)&&(s[m]={...s[m],...v},L=!0),f.push(m)}return L?{...t,placements:s}:t}function Re(t,e,o){const n=Math.max(1,Math.round(t.min*e)),r=Math.max(n,Math.round(t.max*e));return Math.min(e,n+Math.floor(o()*(r-n+1)))}function jt(t,e){const o=[];for(let n=0;n+e<=t.length;n++){let r=!0;for(let u=n;u<n+e;u++)if(t[u]){r=!1;break}r&&o.push(n)}return o}function Ne(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let o=e;return o=Math.imul(o^o>>>15,o|1),o^=o+Math.imul(o^o>>>7,o|61),((o^o>>>14)>>>0)/4294967296}}const W=300,Ae=3e3,xt=["slide down","slide up","fade","scale","none"],Le="slide down";function Ee(t){const e=t.popupTransition;return xt.includes(e)?e:Le}const ae=["burger","plus","image","text"],ze=24/1440,Be=["--cntrl-article-top","--cntrl-article-left","--cntrl-article-width","--cntrl-viewport-height"],Ge=["top","right","bottom","left","top-left","top-right","bottom-right","bottom-left"],je=["right","left"];function Ft(t,e){return{...e,heights:e.heights.map((o,n)=>{var r;return((r=t.placements[n])==null?void 0:r.height)??o})}}function Fe(t,e){return t.column===e.column&&t.span===e.span&&t.top===e.top&&t.height===e.height}function Ot(t,e){return e.handle?ne(t,e.index,e.placement,e.measure):oe(t,e.index,e.placement.column,e.placement.top,e.measure)}function Oe(t){return`
2
+ /* the element is the trigger alone, placed and sized on the page as any other element; the popup opens over the page */
3
+ .${t}-root {
4
+ position: relative;
5
+ width: 100%;
6
+ height: 100%;
7
+ box-sizing: border-box;
8
+ }
9
+ /* fills the element's box, its icon or text centred in it inside its padding */
10
+ .${t}-button {
11
+ all: unset;
12
+ box-sizing: border-box;
13
+ display: flex;
14
+ align-items: center;
15
+ justify-content: center;
16
+ width: 100%;
17
+ height: 100%;
18
+ cursor: pointer;
19
+ white-space: nowrap;
20
+ color: var(--${t}-trigger-color);
21
+ background-color: var(--${t}-trigger-bg);
22
+ }
23
+ /* an icon trigger's lines, as thick as a twelfth of it and a pixel at least, drawn in the trigger's colour */
24
+ .${t}-icon {
25
+ position: relative;
26
+ display: block;
27
+ flex: none;
28
+ width: var(--${t}-icon-size);
29
+ height: var(--${t}-icon-size);
30
+ --${t}-icon-stroke: max(1px, calc(var(--${t}-icon-size) / 12));
31
+ transition: transform ${W}ms ease;
32
+ }
33
+ .${t}-icon-line {
34
+ position: absolute;
35
+ left: 0;
36
+ width: 100%;
37
+ height: var(--${t}-icon-stroke);
38
+ top: calc(50% - var(--${t}-icon-stroke) / 2);
39
+ background-color: currentColor;
40
+ transition: transform ${W}ms ease, opacity ${W}ms ease;
41
+ }
42
+ /* three lines, the outer two meeting in the middle and crossing as the popup opens, the middle one fading */
43
+ .${t}-icon-burger .${t}-icon-line:nth-child(1) { transform: translateY(calc(var(--${t}-icon-size) * -0.3)) rotate(0deg) scaleX(1); }
44
+ .${t}-icon-burger .${t}-icon-line:nth-child(3) { transform: translateY(calc(var(--${t}-icon-size) * 0.3)) rotate(0deg) scaleX(1); }
45
+ .${t}-button-open .${t}-icon-burger .${t}-icon-line:nth-child(1) { transform: translateY(0) rotate(45deg) scaleX(1); }
46
+ .${t}-button-open .${t}-icon-burger .${t}-icon-line:nth-child(2) { opacity: 0; transform: scaleX(0); }
47
+ .${t}-button-open .${t}-icon-burger .${t}-icon-line:nth-child(3) { transform: translateY(0) rotate(-45deg) scaleX(1); }
48
+ /* a plus, turned an eighth as the popup opens, into a cross */
49
+ .${t}-icon-plus .${t}-icon-line:nth-child(2) { transform: rotate(90deg); }
50
+ .${t}-button-open .${t}-icon-plus { transform: rotate(45deg); }
51
+ /* the user's image, fitted to the icon's size: an SVG tinted with the trigger's colour, anything else as it is */
52
+ .${t}-icon-picture {
53
+ display: block;
54
+ width: 100%;
55
+ height: 100%;
56
+ }
57
+ @media (prefers-reduced-motion: reduce) {
58
+ .${t}-icon,
59
+ .${t}-icon-line {
60
+ transition: none;
61
+ }
62
+ }
63
+ .${t}-button:focus-visible {
64
+ outline: 1px solid currentColor;
65
+ outline-offset: 2px;
66
+ }
67
+ /* the popup opens over the whole screen, out of the element's box (it is portalled out of it); in the editor, over
68
+ the whole article as it is drawn on the canvas */
69
+ .${t}-overlay {
70
+ position: fixed;
71
+ inset: 0;
72
+ z-index: 9997;
73
+ pointer-events: none;
74
+ overflow: hidden;
75
+ }
76
+ .${t}-overlay-editor {
77
+ inset: auto;
78
+ top: var(--cntrl-article-top, 0);
79
+ left: var(--cntrl-article-left, 0);
80
+ width: var(--cntrl-article-width, 100vw);
81
+ height: var(--cntrl-viewport-height, 100vh);
82
+ }
83
+ .${t}-overlay-active {
84
+ pointer-events: auto;
85
+ }
86
+ .${t}-backdrop {
87
+ all: unset;
88
+ position: absolute;
89
+ inset: 0;
90
+ background-color: var(--${t}-overlay-color);
91
+ /* the page behind blurred, the blur fading in and out with the overlay's colour */
92
+ -webkit-backdrop-filter: var(--${t}-overlay-blur, none);
93
+ backdrop-filter: var(--${t}-overlay-blur, none);
94
+ opacity: 0;
95
+ transition: opacity ${W}ms ease;
96
+ }
97
+ .${t}-card {
98
+ position: absolute;
99
+ box-sizing: border-box;
100
+ /* content reaching below the popup's bottom scrolls, within the popup alone */
101
+ overflow-x: hidden;
102
+ overflow-y: auto;
103
+ overscroll-behavior: contain;
104
+ background-color: var(--${t}-popup-bg);
105
+ opacity: 0;
106
+ transition: opacity ${W}ms ease, transform ${W}ms ease;
107
+ }
108
+ /* where the popup comes in from and goes back to, by its transition; it fades in and out with each, and 'none'
109
+ shows and hides the popup and its overlay at once */
110
+ .${t}-transition-slide-down .${t}-card {
111
+ transform: translateY(24px);
112
+ }
113
+ .${t}-transition-slide-up .${t}-card {
114
+ transform: translateY(-24px);
115
+ }
116
+ .${t}-transition-scale .${t}-card {
117
+ transform: scale(0.95);
118
+ }
119
+ .${t}-transition-none .${t}-backdrop,
120
+ .${t}-transition-none .${t}-card {
121
+ transition: none;
122
+ }
123
+ @media (prefers-reduced-motion: reduce) {
124
+ .${t}-overlay .${t}-card {
125
+ transform: none;
126
+ }
127
+ }
128
+ .${t}-overlay-active .${t}-backdrop,
129
+ .${t}-overlay-active .${t}-card {
130
+ opacity: 1;
131
+ transform: none;
132
+ }
133
+ /* one row, which every block shares: its column from the grid, its height from a spacer above it. The row is
134
+ as tall as the popup at least, and as tall as the lowest block reaches where that is further, the popup
135
+ scrolling down to it */
136
+ .${t}-grid {
137
+ position: relative;
138
+ display: grid;
139
+ grid-template-rows: auto;
140
+ min-height: 100%;
141
+ }
142
+ /* the grid the blocks snap to, drawn as the article's is while a block is moved or resized: a hairline at both
143
+ edges of every column, and one across every beat from the popup's top, or, with no beat, every vertical gap */
144
+ .${t}-guides {
145
+ position: absolute;
146
+ inset: 0;
147
+ z-index: 2;
148
+ display: grid;
149
+ grid-template-rows: minmax(0, 1fr);
150
+ pointer-events: none;
151
+ opacity: 0;
152
+ transition: opacity 200ms ease;
153
+ --${t}-guide-color: var(--cntrl-grid-color, rgba(255, 92, 2, 0.45));
154
+ }
155
+ .${t}-guides-shown {
156
+ opacity: 1;
157
+ }
158
+ .${t}-guides-beats {
159
+ background-image: repeating-linear-gradient(
160
+ to bottom,
161
+ var(--${t}-guide-color) 0 1px,
162
+ transparent 1px var(--${t}-beat)
163
+ );
164
+ }
165
+ .${t}-guide {
166
+ grid-row: 1;
167
+ box-shadow: inset 1px 0 var(--${t}-guide-color), inset -1px 0 var(--${t}-guide-color);
168
+ }
169
+ /* the block and, on the canvas, the handles it is resized by, which sit on its edges outside any scroller */
170
+ .${t}-frame {
171
+ position: relative;
172
+ display: flex;
173
+ flex-direction: column;
174
+ flex: none;
175
+ min-width: 0;
176
+ min-height: 0;
177
+ }
178
+ .${t}-slot {
179
+ display: flex;
180
+ flex-direction: column;
181
+ grid-row: 1;
182
+ min-width: 0;
183
+ min-height: 0;
184
+ pointer-events: none;
185
+ }
186
+ .${t}-spacer {
187
+ flex: none;
188
+ }
189
+ .${t}-block {
190
+ flex: none;
191
+ min-width: 0;
192
+ pointer-events: auto;
193
+ }
194
+ /* the text's box runs from the first line's cap height to the last line's baseline, where the browser can
195
+ trim it: a title lines up with the top of an image beside it, and the block is no taller than its text */
196
+ .${t}-block.${t}-block-text,
197
+ .${t}-block.${t}-block-listA,
198
+ .${t}-block.${t}-block-listB {
199
+ text-box: trim-both cap alphabetic;
200
+ }
201
+ .${t}-block-title {
202
+ color: var(--${t}-title-color);
203
+ }
204
+ .${t}-block-text {
205
+ color: var(--${t}-text-color);
206
+ }
207
+ .${t}-block-text a {
208
+ color: inherit;
209
+ }
210
+ .${t}-block-listA .${t}-block-text {
211
+ color: var(--${t}-list-a-color, var(--${t}-text-color));
212
+ }
213
+ .${t}-block-listB .${t}-block-text {
214
+ color: var(--${t}-list-b-color, var(--${t}-text-color));
215
+ }
216
+ .${t}-block-listA .${t}-block-text a,
217
+ .${t}-block-listB .${t}-block-text a {
218
+ text-decoration: none;
219
+ }
220
+ .${t}-block-listA .${t}-block-text a:hover,
221
+ .${t}-block-listB .${t}-block-text a:hover {
222
+ text-decoration: underline;
223
+ }
224
+ .${t}-images {
225
+ display: grid;
226
+ }
227
+ /* every image takes the same cell, so the block is as tall as its tallest image and keeps still as they change */
228
+ .${t}-image {
229
+ display: block;
230
+ grid-area: 1 / 1;
231
+ width: 100%;
232
+ height: auto;
233
+ object-fit: cover;
234
+ }
235
+ /* a block resized to a height: its images fill it, cut to it */
236
+ .${t}-block-sized .${t}-images {
237
+ height: 100%;
238
+ grid-template-rows: minmax(0, 100%);
239
+ }
240
+ .${t}-block-sized .${t}-image {
241
+ height: 100%;
242
+ }
243
+ .${t}-image {
244
+ transition: opacity 800ms ease-in-out;
245
+ }
246
+ .${t}-image-hidden {
247
+ opacity: 0;
248
+ }
249
+ @media (prefers-reduced-motion: reduce) {
250
+ .${t}-image {
251
+ transition: none;
252
+ }
253
+ }
254
+ .${t}-grid-editable .${t}-block {
255
+ cursor: grab;
256
+ touch-action: none;
257
+ user-select: none;
258
+ }
259
+ .${t}-grid-editable .${t}-block * {
260
+ pointer-events: none;
261
+ }
262
+ .${t}-slot-dragged {
263
+ z-index: 1;
264
+ }
265
+ .${t}-grid-editable .${t}-block-dragged {
266
+ cursor: grabbing;
267
+ outline: 1px solid #FF5C02;
268
+ outline-offset: 2px;
269
+ }
270
+ .${t}-grid-editable .${t}-frame:hover > .${t}-block:not(.${t}-block-dragged) {
271
+ outline: 1px solid rgba(255, 92, 2, 0.4);
272
+ outline-offset: 2px;
273
+ }
274
+ .${t}-grid-editable .${t}-block-invalid {
275
+ opacity: 0.5;
276
+ outline-style: dashed;
277
+ }
278
+ /* edges are a bar that grows from the block's edge as the pointer comes to it, as a structured block's do;
279
+ corners a small square */
280
+ .${t}-handle {
281
+ position: absolute;
282
+ z-index: 3;
283
+ pointer-events: auto;
284
+ touch-action: none;
285
+ }
286
+ .${t}-handle::after {
287
+ content: '';
288
+ position: absolute;
289
+ box-sizing: border-box;
290
+ opacity: 0;
291
+ transition: opacity 150ms ease, transform 150ms ease;
292
+ }
293
+ .${t}-handle-left,
294
+ .${t}-handle-right {
295
+ top: 0;
296
+ bottom: 0;
297
+ width: 10px;
298
+ cursor: ew-resize;
299
+ }
300
+ .${t}-handle-left { left: -5px; }
301
+ .${t}-handle-right { right: -5px; }
302
+ .${t}-handle-top,
303
+ .${t}-handle-bottom {
304
+ left: 0;
305
+ right: 0;
306
+ height: 10px;
307
+ cursor: ns-resize;
308
+ }
309
+ .${t}-handle-top { top: -5px; }
310
+ .${t}-handle-bottom { bottom: -5px; }
311
+ .${t}-handle-left::after,
312
+ .${t}-handle-right::after {
313
+ top: 0;
314
+ bottom: 0;
315
+ left: 3px;
316
+ width: 4px;
317
+ background-color: #FF5C02;
318
+ transform: scaleX(0.25);
319
+ }
320
+ .${t}-handle-top::after,
321
+ .${t}-handle-bottom::after {
322
+ left: 0;
323
+ right: 0;
324
+ top: 3px;
325
+ height: 4px;
326
+ background-color: #FF5C02;
327
+ transform: scaleY(0.25);
328
+ }
329
+ .${t}-handle-top-left,
330
+ .${t}-handle-top-right,
331
+ .${t}-handle-bottom-right,
332
+ .${t}-handle-bottom-left {
333
+ width: 12px;
334
+ height: 12px;
335
+ }
336
+ .${t}-handle-top-left { top: -6px; left: -6px; cursor: nwse-resize; }
337
+ .${t}-handle-bottom-right { bottom: -6px; right: -6px; cursor: nwse-resize; }
338
+ .${t}-handle-top-right { top: -6px; right: -6px; cursor: nesw-resize; }
339
+ .${t}-handle-bottom-left { bottom: -6px; left: -6px; cursor: nesw-resize; }
340
+ .${t}-handle-top-left::after,
341
+ .${t}-handle-top-right::after,
342
+ .${t}-handle-bottom-right::after,
343
+ .${t}-handle-bottom-left::after {
344
+ inset: 3px;
345
+ background-color: #ffffff;
346
+ border: 1px solid #FF5C02;
347
+ }
348
+ .${t}-frame:hover > .${t}-handle::after {
349
+ opacity: 0.6;
350
+ }
351
+ .${t}-handle:hover::after,
352
+ .${t}-handle-active::after {
353
+ opacity: 1;
354
+ transform: none;
355
+ }
356
+ `}function Z(t,e,o,n){const r=d=>t[`${e}${d}`]??(n?t[`${n}${d}`]:void 0),u=d=>{const f=r(d);return f===void 0?void 0:Dt.scalingValue(f,o)},c=r("FontSettings"),s=r("TextAppearance");return{fontFamily:Ce.normalizeFontFamilyCssValue(r("FontFamily")),fontWeight:c==null?void 0:c.fontWeight,fontStyle:c==null?void 0:c.fontStyle,fontSize:u("FontSize"),lineHeight:u("LineHeight"),letterSpacing:u("LetterSpacing"),wordSpacing:u("WordSpacing"),textTransform:s==null?void 0:s.textTransform,textDecoration:s==null?void 0:s.textDecoration,fontVariant:s==null?void 0:s.fontVariant}}function vt(t){const e=t.type??"text";return e==="list"?"listA":e}function De(t,e,o,n){return t!=null&&t.grid&&Array.isArray(t.placements)&&t.placements.every(r=>typeof(r==null?void 0:r.top)=="number")?Ue(Pt(t,n),e):Jt(e.map(vt),n,1,o)}function Ue(t,e){const o=(n,r)=>n.height!==void 0&&e[r]&&vt(e[r])!=="image";return t.placements.some(o)?{...t,placements:t.placements.map((n,r)=>{if(!o(n,r))return n;const{height:u,...c}=n;return c})}:t}function We(t,e){const o=(n,r)=>Math.abs(n-r)<1e-4;return o(t.height,e.height)&&t.heights.length===e.heights.length&&t.heights.every((n,r)=>o(n,e.heights[r]))}function gt(t,e){const{columns:o}=t.grid,n=t.placements[e];if(!n)return{column:0,span:Math.min(o,Math.max(1,Math.round(o/4))),top:0};const r=Math.min(n.span,o),u={column:Math.min(n.column,o-r),span:r,top:n.top};return typeof n.height=="number"?{...u,height:n.height}:u}function le({settings:t,content:e=[],isEditor:o,isEditMode:n,isPreviewMode:r,layoutId:u,portalId:c,currentState:s,unavailableStates:d=[],onOpenChange:f,onUpdateSettings:x}){var zt,Bt;const{prefix:a}=ke.useScopedStyles(),L=g.useMemo(()=>Oe(a),[a]),[m,p]=g.useState(!1),[v,N]=g.useState(!1),[E,A]=g.useState(!1),w=!!(o&&!r),R=w&&s==="open"&&!d.includes("open"),S=R||!w&&m,rt=Ee(t);_e.useLightboxScrollLock(S&&!w),g.useEffect(()=>{f==null||f(S)},[S,f]),g.useEffect(()=>{p(!1)},[u]),g.useEffect(()=>{if(S){N(!0);return}A(!1);const i=window.setTimeout(()=>N(!1),rt==="none"?0:W);return()=>window.clearTimeout(i)},[S,rt]),g.useEffect(()=>{if(!S||!v)return;const i=tt.current;i&&getComputedStyle(i.querySelector("[role=dialog]")??i).opacity;const l=requestAnimationFrame(()=>A(!0));return()=>cancelAnimationFrame(l)},[S,v]),g.useEffect(()=>{if(!S||w)return;const i=l=>{l.key==="Escape"&&p(!1)};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[S,w]);const T=i=>Dt.scalingValue(i??0,o),Mt=Vt(t),Q=(zt=t.menuLayout)==null?void 0:zt.grid,yt=Yt(t,Q!=null&&Q.columnWidth?Q:ft),it=`min(100%, ${T(Xt(t,yt))})`,at=T(t.popupOffset),ce={left:`calc(0px + ${at})`,center:`calc((100% - ${it}) / 2 + ${at})`,right:`calc(100% - ${it} + ${at})`}[qt(t)],{columns:wt,columnWidth:kt,gutter:_t,rowGap:Ct}=yt,St=g.useMemo(()=>({columns:wt,columnWidth:kt,gutter:_t,rowGap:Ct}),[wt,kt,_t,Ct]),q=g.useMemo(()=>De(t.menuLayout,e,Mt,St),[t.menuLayout,e,Mt,St]),[lt,se]=g.useState(null),ct=g.useMemo(()=>lt?Ft(q,lt):null,[q,lt]),k=g.useMemo(()=>ct?ie(q,ct):q,[q,ct]),{columns:j,gutter:st,columnWidth:ut}=k.grid,ue=j*ut+(j-1)*st,pt=ut>0?{gridTemplateColumns:`repeat(${j}, minmax(0, ${T(ut)}))`,columnGap:T(st),width:`min(100%, ${T(ue)})`,marginInline:"auto"}:{gridTemplateColumns:`repeat(${j}, minmax(0, 1fr))`,columnGap:T(st)},Tt=t.triggerLabel||"Menu",P=Zt(t.triggerPadding),Y=t.triggerType==="image"&&!t.triggerIcon?"burger":t.triggerType??"text",pe=Z(t,"trigger",o),he=Z(t,"title",o),de={text:Z(t,"text",o),listA:Z(t,"listA",o,"text"),listB:Z(t,"listB",o,"text")},O=((Bt=t.stateOverrides)==null?void 0:Bt.open)??{},It={[`--${a}-trigger-bg`]:t.barBackgroundColor,[`--${a}-trigger-color`]:(S?O.triggerColor:void 0)??t.triggerColor,[`--${a}-overlay-color`]:O.overlayColor??t.overlayColor,[`--${a}-overlay-blur`]:t.overlayBlur?`blur(${T(t.overlayBlur)})`:void 0,[`--${a}-popup-bg`]:O.popupBackgroundColor??t.popupBackgroundColor,[`--${a}-title-color`]:O.titleColor??t.titleColor,[`--${a}-text-color`]:O.textColor??t.textColor,[`--${a}-list-a-color`]:O.listAColor??t.listAColor,[`--${a}-list-b-color`]:O.listBColor??t.listBColor},Rt=g.useRef(null),me=g.useMemo(()=>{const i=Rt.current;if(!v||!o||!i)return;const l=getComputedStyle(i);return Object.fromEntries(Be.map(h=>[h,l.getPropertyValue(h).trim()]).filter(([,h])=>h))},[v,o]),tt=g.useRef(null),Nt=g.useRef(null),ht=g.useRef(null),X=g.useRef([]),[B,ge]=g.useState(null),dt=g.useRef(null),V=i=>{dt.current=i,ge(i)},F=!!(R&&n&&x),fe=B?Ot(k,B):null;g.useEffect(()=>{F||V(null)},[F]),g.useLayoutEffect(()=>{const i=Nt.current,l=ht.current;if(!v||!i||!l)return;const h=()=>{var I;const M=(I=tt.current)==null?void 0:I.getBoundingClientRect().width;if(!M)return;const y={height:i.getBoundingClientRect().height/M,heights:e.map((C,z)=>{var $;return((($=X.current[z])==null?void 0:$.getBoundingClientRect().height)??0)/M})};se(C=>C&&We(C,y)?C:y)};h();const _=new ResizeObserver(h);return _.observe(i),_.observe(l),X.current.slice(0,e.length).forEach(M=>M&&_.observe(M)),()=>_.disconnect()},[v,e]);const At=()=>{const i=ht.current,l=i.getBoundingClientRect(),h=i.offsetWidth?l.width/i.offsetWidth:1,_=(parseFloat(getComputedStyle(i).columnGap)||0)*h;return{area:l,gap:_,pitch:(l.width+_)/j}},$e=(i,l,h)=>{var z,$;if(!F||!k.placements[l]||i.button!==0)return;i.preventDefault(),i.stopPropagation(),i.currentTarget.setPointerCapture(i.pointerId);const{area:_,pitch:M}=At(),y=((z=X.current[l])==null?void 0:z.getBoundingClientRect())??i.currentTarget.getBoundingClientRect(),I=(($=tt.current)==null?void 0:$.getBoundingClientRect().width)||1,C=gt(k,l);V({index:l,pointerId:i.pointerId,handle:h,grabColumn:Math.min(Math.max(Math.floor((i.clientX-_.left)/M)-C.column,0),C.span-1),grabY:i.clientY-y.top,unit:I,start:C,placement:C,measure:Ft(k,{height:_.height/I,heights:e.map((D,et)=>{var G;return(((G=X.current[et])==null?void 0:G.getBoundingClientRect().height)??0)/I})})})},be=i=>{const l=dt.current;if(!l||i.pointerId!==l.pointerId)return;i.stopPropagation();const{area:h,gap:_,pitch:M}=At(),{start:y,measure:I,handle:C}=l,z=I.height;if(!C){V({...l,placement:{...y,column:Math.min(Math.max(Math.floor((i.clientX-h.left)/M)-l.grabColumn,0),j-y.span),top:H(k.grid,(i.clientY-l.grabY-h.top)/l.unit,z-I.heights[l.index])}});return}const $=i.clientX-h.left,D=(i.clientY-h.top)/l.unit,et=y.column+y.span;let{column:G,span:ot,top:U}=y,nt=y.height;if(C.includes("left")&&(G=Math.min(Math.max(Math.round($/M),0),et-1),ot=et-G),C.includes("right")&&(ot=Math.min(Math.max(Math.round(($+_)/M),G+1),j)-G),C.includes("top")){const Gt=y.top+(y.height??I.heights[l.index]??0);U=H(k.grid,D,Gt-bt(k.grid)),nt=J(k.grid,Gt-U,z-U)}C.includes("bottom")&&(nt=J(k.grid,D-U,z-U)),V({...l,placement:nt===void 0?{column:G,span:ot,top:U}:{column:G,span:ot,top:U,height:nt}})},xe=i=>{const l=dt.current;if(!l||i.pointerId!==l.pointerId)return;i.stopPropagation();const h=Ot(k,l),_=h==null?void 0:h.placements[l.index];h&&_&&!Fe(_,gt(k,l.index))&&(x==null||x({...t,menuLayout:h})),V(null)},ve=(i,l)=>{i.stopPropagation();const h=k.placements[l];if(!F||!h||h.height===void 0)return;const{height:_,...M}=h;x==null||x({...t,menuLayout:{...k,edited:!0,placements:k.placements.map((y,I)=>I===l?M:y)}})},Lt=()=>p(!1),Me=i=>{!w&&i.target.closest("a")&&Lt()},ye=(i,l)=>{const h=vt(i),_=(i.images??[]).filter($=>$==null?void 0:$.assetId),M=(B==null?void 0:B.index)===l,y=M?B.placement:gt(k,l),I=y.height!==void 0,C=F&&(!B||M),z=$=>({onPointerDown:D=>$e(D,l,$),onPointerMove:be,onPointerUp:xe,onPointerCancel:()=>V(null)});return b.jsxs("div",{className:`${a}-slot${M?` ${a}-slot-dragged`:""}`,style:{gridColumn:`${y.column+1} / span ${y.span}`},children:[b.jsx("div",{className:`${a}-spacer`,style:{height:T(y.top)}}),b.jsxs("div",{className:`${a}-frame`,children:[b.jsxs("div",{ref:$=>{X.current[l]=$},className:[`${a}-block ${a}-block-${h}`,I?`${a}-block-sized`:"",M?`${a}-block-dragged`:"",M&&!fe?`${a}-block-invalid`:""].filter(Boolean).join(" "),style:I?{height:T(y.height)}:void 0,...F?z(null):{},children:[i.title&&h!=="image"?b.jsx("div",{className:`${a}-block-title`,style:{...he,marginBottom:T(t.titleGap)},children:i.title}):null,h==="image"?b.jsx(He,{prefix:a,images:_,isRunning:S,radius:T(t.imageRadius)}):b.jsx("div",{className:`${a}-block-text`,style:de[h],children:b.jsx(Se.RichTextRenderer,{content:Array.isArray(i.text)?i.text:[]})})]}),C?(h==="image"?Ge:je).map($=>b.jsx("div",{className:`${a}-handle ${a}-handle-${$}${M&&B.handle===$?` ${a}-handle-active`:""}`,"aria-hidden":!0,...z($),onDoubleClick:$.includes("top")||$.includes("bottom")?D=>ve(D,l):void 0},$)):null]})]},l)},mt=k.grid.beat||K(k.grid),Et=v?b.jsxs("div",{ref:tt,"data-selection":"none",className:[`${a}-overlay`,`${a}-transition-${rt.replace(" ","-")}`,o?`${a}-overlay-editor`:"",E?`${a}-overlay-active`:""].filter(Boolean).join(" "),style:{...me,...It},"aria-hidden":!E,children:[b.jsx("button",{type:"button",className:`${a}-backdrop`,"aria-label":"Close menu",tabIndex:-1,onClick:w?void 0:Lt}),b.jsx("div",{ref:Nt,className:`${a}-card`,role:"dialog","aria-modal":"true","aria-label":t.triggerLabel||"Menu",onClick:Me,style:{top:T(t.popupOffsetTop),height:`${$t(t)}%`,left:ce,width:it,borderRadius:T(t.popupRadius)},children:b.jsxs("div",{ref:ht,className:`${a}-grid${F?` ${a}-grid-editable`:""}`,style:pt,children:[e.map(ye),F?b.jsx("div",{className:`${a}-guides${mt>0?` ${a}-guides-beats`:""}${B?` ${a}-guides-shown`:""}`,style:{gridTemplateColumns:pt.gridTemplateColumns,columnGap:pt.columnGap,[`--${a}-beat`]:mt>0?T(mt):void 0},"aria-hidden":!0,children:Array.from({length:j},(i,l)=>b.jsx("div",{className:`${a}-guide`},l))}):null]})})]}):null;return b.jsxs("div",{ref:Rt,className:`${a}-root`,style:It,"data-edit-mode":n?"":void 0,children:[b.jsx("style",{dangerouslySetInnerHTML:{__html:L}}),b.jsx("button",{type:"button",className:`${a}-button${S?` ${a}-button-open`:""}`,style:{...Y==="text"?pe:void 0,padding:[P.top,P.right,P.bottom,P.left].map(i=>T(i)).join(" "),[`--${a}-icon-size`]:T(t.triggerIconSize??ze)},"aria-expanded":S,"aria-label":Y==="text"?void 0:Tt,onClick:w?void 0:()=>p(i=>!i),children:Y==="text"?Tt:b.jsx("span",{className:`${a}-icon ${a}-icon-${Y}`,"aria-hidden":!0,children:Y==="image"?b.jsx(Te.SvgImage,{url:t.triggerIcon,fill:`var(--${a}-trigger-color)`,hoverFill:`var(--${a}-trigger-color)`,className:`${a}-icon-picture`}):Array.from({length:Y==="burger"?3:2},(i,l)=>b.jsx("span",{className:`${a}-icon-line`},l))})}),Et&&typeof document<"u"?we.createPortal(Et,(c?document.getElementById(c):null)??document.body):null]})}function He({prefix:t,images:e,isRunning:o,radius:n}){const[r,u]=g.useState(0),c=e.length;return g.useEffect(()=>{if(!o||c<2){u(0);return}const s=window.setInterval(()=>u(d=>(d+1)%c),Ae);return()=>window.clearInterval(s)},[o,c]),b.jsx("div",{className:`${t}-images`,children:e.map((s,d)=>b.jsx("img",{className:`${t}-image${d===r%c?"":` ${t}-image-hidden`}`,src:s.assetId,alt:s.name??"","aria-hidden":d!==r%c,style:{borderRadius:n}},d))})}const Ye=Object.freeze(Object.defineProperty({__proto__:null,POPUP_MENU_TRANSITIONS:xt,POPUP_MENU_TRIGGER_TYPES:ae,PopupMenu:le},Symbol.toStringTag,{value:"Module"}));exports.DEFAULT_POPUP_MENU_GRID=ft;exports.DEFAULT_POPUP_MENU_HEIGHT=Ut;exports.DEFAULT_POPUP_MENU_VIEWPORT_RATIO=Wt;exports.POPUP_MENU_ALIGNS=Ht;exports.POPUP_MENU_TRANSITIONS=xt;exports.POPUP_MENU_TRIGGER_TYPES=ae;exports.PopupMenu=le;exports.PopupMenu$1=Ye;exports.defaultPopupMenuLayoutRules=Kt;exports.fitPopupMenuLayoutToGrid=Pt;exports.generatePopupMenuLayout=Jt;exports.getPopupMenuAlign=qt;exports.getPopupMenuGrid=Yt;exports.getPopupMenuHeight=Vt;exports.getPopupMenuHeightPercent=$t;exports.getPopupMenuSides=Zt;exports.getPopupMenuWidth=Xt;exports.isSamePopupMenuGrid=Qt;exports.movePopupMenuBlock=oe;exports.randomPopupMenuSeed=Ie;exports.resizePopupMenuBlock=ne;exports.settlePopupMenuLayout=ie;exports.snapPopupMenuHeight=J;exports.snapPopupMenuTop=H;