@cntrl-site/components 1.0.115-alpha.0 → 1.0.115

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