@cntrl-site/components 1.0.115-alpha.1 → 1.0.115-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Components/PopupMenu/PopupMenu.d.ts +4 -3
- package/dist/Components/PopupMenu/PopupMenuComponent.d.ts +0 -4
- package/dist/Components/PopupMenu/popupMenuLayout.d.ts +45 -18
- package/dist/Components/PopupMenu/popupMenuSnap.d.ts +61 -0
- package/dist/PopupMenu-CYdDyzEt.mjs +1372 -0
- package/dist/PopupMenu-Di1fHgho.js +409 -0
- package/dist/{components-DH803b-9.mjs → components-BopipeiL.mjs} +6 -8
- package/dist/{components-DCG0h7Jb.js → components-Bs6FhVOA.js} +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +1 -1
- package/dist/elements.node.js +1 -1
- package/dist/elements.node.mjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +40 -34
- package/package.json +1 -1
- package/dist/PopupMenu-Ct6PbiJq.js +0 -369
- package/dist/PopupMenu-DGVvx5AW.mjs +0 -1067
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
"use strict";const x=require("react/jsx-runtime"),$=require("react"),ao=require("react-dom"),me=require("./scalingValue-CSHYgTZl.js"),so=require("./useScopedStyles-Bf6yohVQ.js"),ce=require("./EmbedMediaFrame-DsOTKE4i.js"),lo=require("./useLightboxScrollLock-Hf16Eq4g.js"),co=require("./textStylesToCss-CNN3zZTV.js"),uo=require("./RichTextRenderer-DEFXh5o6.js"),ho=require("./SvgImage-_QN8ngad.js"),ge=60,$e=900/1440,be=["left","center","right"],Ft={columns:12,columnWidth:99/1440,gutter:20/1440};function ve(t,e=Ft){const o=l=>typeof l=="number"&&Number.isFinite(l),r=(l,...h)=>h.find(o)??l,i=t.gridLayout??{},s=Math.max(0,r(e.gutter,i.horizontalGap,t.gridGutter));return{columns:Math.max(1,Math.round(r(e.columns,i.columnsCount,t.gridColumns))),columnWidth:Math.max(0,r(e.columnWidth,i.entryWidth,t.gridColumnWidth)),gutter:s,rowGap:Math.max(0,r(s,t.verticalGap))}}function tt(t){return t.rowGap??t.gutter}function Gt(t){const e=t.popupHeight;return Math.min(100,Math.max(0,typeof e=="number"&&Number.isFinite(e)?e:ge))}function xe(t,e=$e){return Gt(t)/100*e}function po(t){return be.includes(t.popupAlign)?t.popupAlign:"center"}function ye(t,e){var i;const o=(i=t.gridLayout)==null?void 0:i.wrapperWidth,r=e.columns*e.columnWidth+(e.columns-1)*e.gutter;return typeof o=="number"&&Number.isFinite(o)&&o>0?Math.max(o,r):r>0?r:1}function Me(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)}}function kt(t){const e=Math.max(1,Math.floor(t.columns));return t.columnWidth>0?t.columnWidth:Math.max(0,(1-(e-1)*t.gutter)/e)}function H(t){const e=Math.max(1,Math.floor(t.columns));return e*kt(t)+(e-1)*t.gutter}function Dt(t){const e=Math.max(1,Math.floor(t.columns)),o=kt(t),r=o+t.gutter;return Array.from({length:e},(i,s)=>[U(s*r),U(s*r+o)]).flat()}function St(t,e,o,r,i){const s=kt(t),l={left:U(e*(s+t.gutter)),width:U(o*s+Math.max(0,o-1)*t.gutter),top:r};return i===void 0?l:{...l,height:i}}function Rt(){return 8/1440}function we(t){const e=Math.max(1,Math.floor(t.columns));return St(t,0,Math.min(e,Math.max(1,Math.round(e/4))),0)}function ke(t){const e=t;return typeof e.left=="number"&&Number.isFinite(e.left)&&typeof e.width=="number"&&Number.isFinite(e.width)}function Se(t,e){if(ke(t))return t;const o=Math.max(1,Math.floor(e.columns)),r=Math.min(o,Math.max(1,Math.round(t.span??1))),i=Math.min(Math.max(0,Math.round(t.column??0)),o-r);return St(e,i,r,t.top,typeof t.height=="number"?t.height:void 0)}function Re(t){return t.placements.every(ke)?t:{...t,placements:t.placements.map(e=>Se(e,t.grid))}}const Ee={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 Le(t,e,o,r,i=Ee){const s=go(o),l=Math.max(1,Math.floor(e.columns)),h=[];let u=0,d=new Array(l).fill(!1);const n={};for(const w of t){const p=n[w]??(n[w]=mo(i.span[w]??i.span.text,l,s));let g=ue(d,p);const I=d.some(Boolean);(g.length===0||I&&s()<i.breakChance)&&(u+=1,d=new Array(l).fill(!1),g=ue(d,p));const j=g[Math.floor(s()*g.length)];for(let M=Math.max(0,j-1);M<Math.min(l,j+p+1);M++)d[M]=!0;h.push({column:j,span:p,row:u})}const m=u+1,R={...e,columns:l};return{seed:o,grid:R,placements:h.map(({column:w,span:p,row:g})=>St(R,w,p,_e(e,g*r/m,r)))}}function _e(t,e,o=1/0){const r=t.beat??0,i=Math.max(0,o),s=r>0?Math.round(e/r)*r:e,l=s<=i?s:r>0?Math.floor(i/r+1e-9)*r:i;return Math.round(Math.max(0,l)*1e6)/1e6}function Ut(t){return t.beat&&t.beat>0?t.beat:8/1440}function fo(t,e,o=1/0){const r=t.beat??0,i=Ut(t),s=r>0?Math.round(e/r)*r:e,l=s<=o?s:r>0?Math.floor(o/r+1e-9)*r:o;return U(Math.max(i,l))}function Ie(t,e){const o=(r,i)=>Math.abs(r-i)<1e-9;return Math.floor(t.columns)===Math.floor(e.columns)&&o(t.columnWidth,e.columnWidth)&&o(t.gutter,e.gutter)&&o(tt(t),tt(e))&&o(t.beat??0,e.beat??0)}function Ce(t,e){const o={...e,columns:Math.max(1,Math.floor(e.columns))};if(Ie(t.grid,o))return t;const r=H(t.grid),i=H(o),s=r>0?i/r:1,l=t.placements.map(h=>{const u=U(Math.min(i,Math.max(Rt(),h.width*s))),d=U(Math.min(Math.max(0,h.left*s),i-u));return h.height===void 0?{left:d,width:u,top:h.top}:{left:d,width:u,top:h.top,height:h.height}});return{...t,grid:o,placements:l}}function U(t){return Math.round(t*1e6)/1e6}function Ne(t,e,o,r,i){return t.left<o.left+o.width-1e-9&&o.left<t.left+t.width-1e-9&&t.top<o.top+r+i-1e-9&&o.top<t.top+e+i-1e-9}function Ae(t,e,o,r,i){const s=t.placements[e];return s?ze(t,e,{...s,left:o,top:r},i):null}function Te(t,e,o,r){if(!t.placements[e])return null;const i=H(t.grid),s=Math.min(Rt(),i),l=Ut(t.grid),h=Math.min(Math.max(0,o.left),i-s),u=Math.min(Math.max(s,o.width),i-h),d=Math.min(Math.max(0,o.top),r?Math.max(0,r.height-l):1/0),n=o.height===void 0?void 0:Math.min(Math.max(l,o.height),r?Math.max(l,r.height-d):1/0);return ze(t,e,n===void 0?{left:h,width:u,top:d}:{left:h,width:u,top:d,height:n},r)}function ze(t,e,o,r){const i=tt(t.grid),s=H(t.grid),l=U(Math.min(Math.max(o.width,Math.min(Rt(),s)),s)),h=o.height??(r==null?void 0:r.heights[e])??0,u={left:U(Math.min(Math.max(0,o.left),s-l)),width:l,top:U(Math.min(Math.max(0,o.top),r?Math.max(0,r.height-h):1/0)),...o.height===void 0?{}:{height:U(o.height)}};return r&&t.placements.some((d,n)=>n!==e&&Ne(u,h,d,r.heights[n]??0,i))?null:{...t,edited:!0,placements:t.placements.map((d,n)=>n===e?u:d)}}function Be(t,e){const o=H(t.grid),r=Dt(t.grid).filter((p,g)=>g%2===0),i=tt(t.grid),s=t.grid.beat??0,l=e.height,h=t.placements.map((p,g)=>e.heights[g]??0),u=[...t.placements],d=u.map((p,g)=>g).sort((p,g)=>u[p].top-u[g].top||p-g),n=[],m=(p,g)=>{let{top:I}=p;for(let j=!0,M=0;j&&M<=n.length;M++){j=!1;for(const A of n){const y=u[A];if(!Ne({...p,top:I},g,y,h[A],i))continue;const E=y.top+h[A]+i,b=s>0?U(Math.ceil(E/s-1e-9)*s):Math.ceil(E*1e6-1e-6)/1e6;b<=I||(I=b,j=!0)}}return I},R=(p,g)=>p+g>l+1e-9;let w=!1;for(const p of d){const g=u[p];let I={left:g.left,top:m(g,h[p])};if(I.top!==g.top&&R(I.top,h[p])){const j=r.filter(A=>A+g.width<=o+1e-9).sort((A,y)=>Math.abs(A-g.left)-Math.abs(y-g.left)||A-y);let M=null;for(const A of j){const y=m({...g,left:A},h[p]);!R(y,h[p])&&(!M||y<M.top-1e-9)&&(M={left:A,top:y})}M&&(I=M)}(I.left!==g.left||I.top!==g.top)&&(u[p]={...u[p],...I},w=!0),n.push(p)}return w?{...t,placements:u}:t}function mo(t,e,o){const r=Math.max(1,Math.round(t.min*e)),i=Math.max(r,Math.round(t.max*e));return Math.min(e,r+Math.floor(o()*(i-r+1)))}function ue(t,e){const o=[];for(let r=0;r+e<=t.length;r++){let i=!0;for(let s=r;s<r+e;s++)if(t[s]){i=!1;break}i&&o.push(r)}return o}function go(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 he=5,gt=t=>Array.from(new Set(t.map(e=>Math.round(e*1e6)/1e6)));function $o(t,e){const o=t.beat||tt(t);if(!(o>0))return[];const r=[];for(let i=1;i*o<=e+1e-9;i++)r.push(i*o);return r}function bo(t,e,o,r=[]){const i=H(t.grid),s=tt(t.grid),l=t.grid.beat??0,h=[0,i/2,i,...Dt(t.grid)],u=[0,o.height];if(l>0)for(let n=l;n<o.height;n+=l)u.push(n);const d=$o(t.grid,o.height);return t.placements.forEach((n,m)=>{if(m===e)return;const R=n.height??o.heights[m]??0;h.push(n.left,n.left+n.width/2,n.left+n.width),u.push(n.top,n.top+R/2,n.top+R),s>0&&u.push(n.top-s,n.top+R+s);const w=r[m];typeof w=="number"&&d.push(n.top+w)}),{xs:gt(h),ys:gt(u.filter(n=>n>=0)),baselines:gt(d)}}function Mt(t,e,o){let r=null;for(const i of t)for(const s of e){const l=s-i;Math.abs(l)<=o&&(r===null||Math.abs(l)<Math.abs(r))&&(r=l)}return r}function vo(t,e){return t===null?e:e===null?t:Math.abs(e)<Math.abs(t)?e:t}function je(t,e){const o=(r,i)=>i.filter(s=>r.some(l=>Math.abs(l-s)<1e-5));return{xs:gt(o(t.xs,e.xs)),ys:gt([...o(t.ys,e.ys),...o(t.baselines??[],e.baselines??[])])}}function xo(t,e,o,r,i,s,l,h,u){const{width:d}=t;let n=t.left+o,m=t.top+r;const R=typeof u=="number";return n+=Mt([n,n+d/2,n+d],i.xs,s.x)??0,m+=vo(Mt([m,m+e/2,m+e],i.ys,s.y),R?Mt([m+u],i.baselines??[],s.y):null)??0,n=Math.min(Math.max(0,n),Math.max(0,l-d)),m=Math.min(Math.max(0,m),Math.max(0,h-e)),{placement:{...t,left:n,top:m},guides:je({xs:[n,n+d/2,n+d],ys:[m,m+e/2,m+e],baselines:R?[m+u]:[]},i)}}function yo(t,e,o,r,i,s,l,h,u,d,{keepRatio:n=!1,fromCenter:m=!1}={}){const R=Math.min(Rt(),h),w=o.includes("left"),p=o.includes("right"),g=o.includes("top"),I=o.includes("bottom"),j=w||p,M=g||I,A=t.left+t.width/2,y=t.top+e/2;let E=t.left,b=t.left+t.width,C=t.top,T=t.top+e;const q=(S,G,F)=>S+(Mt([S],G,F)??0);let V=!1,Z=!1;if(w){const S=t.left+r;E=q(S,s.xs,l.x),V=E!==S,m&&(b=2*A-E)}else if(p){const S=t.left+t.width+r;b=q(S,s.xs,l.x),V=b!==S,m&&(E=2*A-b)}if(g){const S=t.top+i;C=q(S,s.ys,l.y),Z=C!==S,m&&(T=2*y-C)}else if(I){const S=t.top+e+i;T=q(S,s.ys,l.y),Z=T!==S,m&&(C=2*y-T)}if(n&&j&&M&&t.width>0&&e>0){const S=t.width/e,G=Math.abs(b-E),F=Math.abs(T-C);if(V!==Z?V:Math.abs(G/t.width-1)>=Math.abs(F/e-1)){const O=G/S;m?[C,T]=[y-O/2,y+O/2]:g?C=T-O:T=C+O}else{const O=F*S;m?[E,b]=[A-O/2,A+O/2]:w?E=b-O:b=E+O}}const $t=(S,G,F,et,O)=>G-S>=F?[S,G]:m?[O-F/2,O+F/2]:et?[G-F,G]:[S,S+F];j&&([E,b]=$t(E,b,R,w,A)),M&&([C,T]=$t(C,T,d,g,y)),E=Math.max(0,E),b=Math.min(h,Math.max(E+R,b)),C=Math.max(0,C),M&&(T=Math.min(Math.max(u,C+d),Math.max(C+d,T)));const at={left:E,width:b-E,top:C},st=M?T-C:t.height;return st!==void 0&&(at.height=st),{placement:at,guides:je({xs:j?m||n?[E,b]:[w?E:b]:[],ys:M?m||n?[C,T]:[g?C:T]:[]},s)}}const P=300,Mo=3e3,Ht=["slide down","slide up","fade","scale","none"],wo="slide down";function ko(t){const e=t.popupTransition;return Ht.includes(e)?e:wo}const Oe=["burger","plus","icon","text"],So=24/1440,We=["--cntrl-article-top","--cntrl-article-left","--cntrl-article-width","--cntrl-viewport-height"];function Ro(t){const e=getComputedStyle(t);return Object.fromEntries(We.map(o=>[o,e.getPropertyValue(o).trim()]).filter(([,o])=>o))}function Eo(t){const e=getComputedStyle(t).getPropertyValue("--cntrl-article-width").trim();if(!e)return t;let o=t;for(let r=o.parentElement;r&&getComputedStyle(r).getPropertyValue("--cntrl-article-width").trim()===e;r=r.parentElement)o=r;return o}const Lo=["top","right","bottom","left","top-left","top-right","bottom-right","bottom-left"],_o=["right","left"],Io=["top","right","bottom","left"],Co=["right","left"],No=3;function Ot(t,e,o){const{start:r,startHeight:i,handle:s,lines:l,measure:h,unitX:u,unitY:d}=e,n=(o.x-e.origin.x)/u,m=(o.y-e.origin.y)/d,R={x:he/u,y:he/d},w=H(t.grid),p=s?yo(r,i,s,n,m,l,R,w,h.height,Ut(t.grid),{keepRatio:o.shiftKey,fromCenter:o.altKey}):xo(r,i,n,m,l,R,w,h.height,e.baseline);return{...e,pointer:o,placement:p.placement,guides:p.guides}}function de(t,e){return{...e,heights:e.heights.map((o,r)=>{var i;return((i=t.placements[r])==null?void 0:i.height)??o})}}function Ao(t,e){return t.left===e.left&&t.width===e.width&&t.top===e.top&&t.height===e.height}function To(t){const o=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode:s=>{var l;return(l=s.textContent)!=null&&l.trim()?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}).nextNode();if(!(o!=null&&o.parentNode))return null;const r=document.createElement("span");r.style.cssText="display:inline-block;width:0;height:0;margin:0;padding:0;border:0;vertical-align:baseline",o.parentNode.insertBefore(r,o);const i=r.getBoundingClientRect().bottom;return r.remove(),i-t.getBoundingClientRect().top}const zo={leftRight:'<g fill="none" transform="translate(7 8)"><path fill-rule="evenodd" clip-rule="evenodd" d="m7 0v6.006h-1.021v-3.466l-5.979 5.472 5.979 5.461v-3.478h1.021v6.005h.02 3.961v-6.006h1.058v3.467l5.961-5.473-5.961-5.461v3.478h-1.058v-6.005z" fill="#fff"/><path d="m16.34 7.989-3.32-3.223v2.254h-3.02v-5.96h-.019v-.02h-1.941v6h-3.06v-2.28l-3.32 3.251 3.32 3.224v-2.254h3.06v6h.02 1.921.019v-6h3.02v2.259z" fill="#000"/></g>',topBottom:'<g fill="none" transform="translate(8 7)"><path fill-rule="evenodd" clip-rule="evenodd" d="m7.988 0-5.461 5.962h3.478v1.038h-6.005v.019 3.942.02h6.005v1.058h-3.466l5.472 5.961 5.462-5.961h-3.478v-1.058h6.005v-3.981h-6.006v-1.038h3.467z" fill="#fff"/><path d="m14.961 8.02h-5.981v-3.039h2.26l-3.251-3.32-3.223 3.32h2.254v3.039h-5.98-.02v1.96h.02 6v3.04h-2.28l3.251 3.32 3.223-3.32h-2.253v-3.04h5.98.02v-1.96z" fill="#000"/></g>',diagonalRight:'<g fill="none" transform="translate(9 9)"><path fill-rule="evenodd" clip-rule="evenodd" d="m9.743 7.087-4.072 4.068 2.829 2.828-8.473-.013-.013-8.47 2.841 2.842 4.075-4.068 1.414-1.415-2.844-2.842h8.486v8.484l-2.83-2.827z" fill="#fff"/><path d="m8.683 6.733-4.427 4.424 1.828 1.828-5.056-.016-.014-5.054 1.842 1.841 4.428-4.422 2.474-2.475-1.844-1.843h5.073v5.071l-1.83-1.828z" fill="#000"/></g>',diagonalLeft:'<g fill="none" transform="translate(9 9)"><path fill-rule="evenodd" clip-rule="evenodd" d="m4.257 7.087 4.072 4.068-2.829 2.828 8.473-.013.013-8.47-2.841 2.842-4.075-4.068-1.414-1.415 2.844-2.842h-8.486v8.484l2.829-2.827z" fill="#fff"/><path d="m5.317 6.733 4.427 4.424-1.828 1.828 5.056-.016.014-5.054-1.842 1.841-4.428-4.422-2.474-2.475 1.844-1.843h-5.073v5.071l1.83-1.828z" fill="#000"/></g>'},Bo={leftRight:"ew-resize",topBottom:"ns-resize",diagonalRight:"nesw-resize",diagonalLeft:"nwse-resize"},K=Object.fromEntries(Object.entries(zo).map(([t,e])=>{const o=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" fill="none">${e}</svg>`;return[t,`url("data:image/svg+xml,${encodeURIComponent(o)}") 16 16, ${Bo[t]}`]})),pe=40;function fe(t,e){return e.handle?Te(t,e.index,e.placement,e.measure):Ae(t,e.index,e.placement.left,e.placement.top,e.measure)}function jo(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 ${P}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 ${P}ms ease, opacity ${P}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 ${P}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 ${P}ms ease, transform ${P}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 cell, which every block shares: its left and width a share of the grid's width, its top from a spacer above
|
|
147
|
+
it. The cell is as tall as the popup at least, and as tall as the lowest block reaches where that is further,
|
|
148
|
+
the popup scrolling down to it */
|
|
149
|
+
.${t}-grid {
|
|
150
|
+
position: relative;
|
|
151
|
+
display: grid;
|
|
152
|
+
grid-template-columns: minmax(0, 1fr);
|
|
153
|
+
grid-template-rows: auto;
|
|
154
|
+
min-height: 100%;
|
|
155
|
+
}
|
|
156
|
+
/* the lines a block being moved or resized has snapped to, as the article draws them */
|
|
157
|
+
.${t}-snaps {
|
|
158
|
+
position: absolute;
|
|
159
|
+
inset: 0;
|
|
160
|
+
z-index: 4;
|
|
161
|
+
pointer-events: none;
|
|
162
|
+
}
|
|
163
|
+
.${t}-snap {
|
|
164
|
+
position: absolute;
|
|
165
|
+
background-color: rgba(255, 48, 0, 0.7);
|
|
166
|
+
}
|
|
167
|
+
.${t}-snap-x {
|
|
168
|
+
top: 0;
|
|
169
|
+
bottom: 0;
|
|
170
|
+
width: 1px;
|
|
171
|
+
transform: translateX(-0.5px);
|
|
172
|
+
}
|
|
173
|
+
.${t}-snap-y {
|
|
174
|
+
left: 0;
|
|
175
|
+
right: 0;
|
|
176
|
+
height: 1px;
|
|
177
|
+
transform: translateY(-0.5px);
|
|
178
|
+
}
|
|
179
|
+
/* the grid the blocks snap to, drawn as the article's is while a block is moved or resized: a hairline at both
|
|
180
|
+
edges of every column, and one across every beat from the popup's top, or, with no beat, every vertical gap */
|
|
181
|
+
.${t}-guides {
|
|
182
|
+
position: absolute;
|
|
183
|
+
inset: 0;
|
|
184
|
+
z-index: 2;
|
|
185
|
+
display: grid;
|
|
186
|
+
grid-template-rows: minmax(0, 1fr);
|
|
187
|
+
pointer-events: none;
|
|
188
|
+
opacity: 0;
|
|
189
|
+
transition: opacity 200ms ease;
|
|
190
|
+
--${t}-guide-color: var(--cntrl-grid-color, rgba(255, 92, 2, 0.45));
|
|
191
|
+
}
|
|
192
|
+
.${t}-guides-shown {
|
|
193
|
+
opacity: 1;
|
|
194
|
+
}
|
|
195
|
+
.${t}-guides-beats {
|
|
196
|
+
background-image: repeating-linear-gradient(
|
|
197
|
+
to bottom,
|
|
198
|
+
var(--${t}-guide-color) 0 1px,
|
|
199
|
+
transparent 1px var(--${t}-beat)
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
.${t}-guide {
|
|
203
|
+
grid-row: 1;
|
|
204
|
+
box-shadow: inset 1px 0 var(--${t}-guide-color), inset -1px 0 var(--${t}-guide-color);
|
|
205
|
+
}
|
|
206
|
+
/* the block and, on the canvas, the handles it is resized by, which sit on its edges outside any scroller */
|
|
207
|
+
.${t}-frame {
|
|
208
|
+
position: relative;
|
|
209
|
+
display: flex;
|
|
210
|
+
flex-direction: column;
|
|
211
|
+
flex: none;
|
|
212
|
+
min-width: 0;
|
|
213
|
+
min-height: 0;
|
|
214
|
+
}
|
|
215
|
+
.${t}-slot {
|
|
216
|
+
display: flex;
|
|
217
|
+
flex-direction: column;
|
|
218
|
+
grid-area: 1 / 1;
|
|
219
|
+
min-width: 0;
|
|
220
|
+
min-height: 0;
|
|
221
|
+
pointer-events: none;
|
|
222
|
+
}
|
|
223
|
+
.${t}-spacer {
|
|
224
|
+
flex: none;
|
|
225
|
+
}
|
|
226
|
+
.${t}-block {
|
|
227
|
+
flex: none;
|
|
228
|
+
min-width: 0;
|
|
229
|
+
pointer-events: auto;
|
|
230
|
+
}
|
|
231
|
+
/* the text's box runs from the first line's cap height to the last line's baseline, where the browser can
|
|
232
|
+
trim it: a title lines up with the top of an image beside it, and the block is no taller than its text */
|
|
233
|
+
.${t}-block.${t}-block-text,
|
|
234
|
+
.${t}-block.${t}-block-listA,
|
|
235
|
+
.${t}-block.${t}-block-listB {
|
|
236
|
+
text-box: trim-both cap alphabetic;
|
|
237
|
+
}
|
|
238
|
+
.${t}-block-title {
|
|
239
|
+
color: var(--${t}-title-color);
|
|
240
|
+
}
|
|
241
|
+
.${t}-block-text {
|
|
242
|
+
color: var(--${t}-text-color);
|
|
243
|
+
}
|
|
244
|
+
.${t}-block-text a {
|
|
245
|
+
color: inherit;
|
|
246
|
+
}
|
|
247
|
+
.${t}-block-listA .${t}-block-text {
|
|
248
|
+
color: var(--${t}-list-a-color, var(--${t}-text-color));
|
|
249
|
+
}
|
|
250
|
+
.${t}-block-listB .${t}-block-text {
|
|
251
|
+
color: var(--${t}-list-b-color, var(--${t}-text-color));
|
|
252
|
+
}
|
|
253
|
+
.${t}-block-listA .${t}-block-text a,
|
|
254
|
+
.${t}-block-listB .${t}-block-text a {
|
|
255
|
+
text-decoration: none;
|
|
256
|
+
}
|
|
257
|
+
.${t}-block-listA .${t}-block-text a:hover,
|
|
258
|
+
.${t}-block-listB .${t}-block-text a:hover {
|
|
259
|
+
text-decoration: underline;
|
|
260
|
+
}
|
|
261
|
+
.${t}-images {
|
|
262
|
+
display: grid;
|
|
263
|
+
}
|
|
264
|
+
/* every image takes the same cell, so the block is as tall as its tallest image and keeps still as they change */
|
|
265
|
+
.${t}-image {
|
|
266
|
+
display: block;
|
|
267
|
+
grid-area: 1 / 1;
|
|
268
|
+
width: 100%;
|
|
269
|
+
height: auto;
|
|
270
|
+
object-fit: cover;
|
|
271
|
+
}
|
|
272
|
+
/* a block resized to a height: its images fill it, cut to it */
|
|
273
|
+
.${t}-block-sized .${t}-images {
|
|
274
|
+
height: 100%;
|
|
275
|
+
grid-template-rows: minmax(0, 100%);
|
|
276
|
+
}
|
|
277
|
+
.${t}-block-sized .${t}-image {
|
|
278
|
+
height: 100%;
|
|
279
|
+
}
|
|
280
|
+
.${t}-image {
|
|
281
|
+
transition: opacity 800ms ease-in-out;
|
|
282
|
+
}
|
|
283
|
+
.${t}-image-hidden {
|
|
284
|
+
opacity: 0;
|
|
285
|
+
}
|
|
286
|
+
@media (prefers-reduced-motion: reduce) {
|
|
287
|
+
.${t}-image {
|
|
288
|
+
transition: none;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
.${t}-grid-editable .${t}-block {
|
|
292
|
+
cursor: default;
|
|
293
|
+
touch-action: none;
|
|
294
|
+
user-select: none;
|
|
295
|
+
}
|
|
296
|
+
.${t}-grid-editable .${t}-block * {
|
|
297
|
+
pointer-events: none;
|
|
298
|
+
}
|
|
299
|
+
.${t}-slot-dragged {
|
|
300
|
+
z-index: 1;
|
|
301
|
+
}
|
|
302
|
+
/* the editor's chrome, as an article's items have it: a 2px outline on the block the pointer is over, a hairline
|
|
303
|
+
border round the one selected, vermilion for text and grey for images, and the handles it is resized by */
|
|
304
|
+
.${t}-frame::before,
|
|
305
|
+
.${t}-box {
|
|
306
|
+
content: '';
|
|
307
|
+
position: absolute;
|
|
308
|
+
inset: 0;
|
|
309
|
+
z-index: 2;
|
|
310
|
+
box-sizing: border-box;
|
|
311
|
+
pointer-events: none;
|
|
312
|
+
}
|
|
313
|
+
.${t}-grid-editable:not(.${t}-grid-busy) .${t}-frame:not(.${t}-frame-selected):hover::before {
|
|
314
|
+
box-shadow: inset 0 0 0 1px #FF4400, 0 0 0 1px #FF4400;
|
|
315
|
+
}
|
|
316
|
+
.${t}-box {
|
|
317
|
+
border: 0.5px solid var(--${t}-box-color, #ACACAC);
|
|
318
|
+
}
|
|
319
|
+
.${t}-grid-editable .${t}-block-invalid {
|
|
320
|
+
opacity: 0.5;
|
|
321
|
+
}
|
|
322
|
+
.${t}-box-invalid {
|
|
323
|
+
border-style: dashed;
|
|
324
|
+
}
|
|
325
|
+
/* the side a handle reshapes the block by, as a structured block's: while its handle is pointed at or dragged, the
|
|
326
|
+
block's edge thickens to 5px out of a 1px line, and thins back after. A corner thickens both sides it moves */
|
|
327
|
+
.${t}-edge {
|
|
328
|
+
position: absolute;
|
|
329
|
+
z-index: 3;
|
|
330
|
+
background-color: #FF5C02;
|
|
331
|
+
pointer-events: none;
|
|
332
|
+
opacity: 0;
|
|
333
|
+
transition: opacity 0.15s ease, transform 0.15s ease;
|
|
334
|
+
}
|
|
335
|
+
.${t}-edge-left,
|
|
336
|
+
.${t}-edge-right {
|
|
337
|
+
top: 0;
|
|
338
|
+
bottom: 0;
|
|
339
|
+
width: 5px;
|
|
340
|
+
transform: scaleX(0.2);
|
|
341
|
+
}
|
|
342
|
+
.${t}-edge-left { left: -2.5px; }
|
|
343
|
+
.${t}-edge-right { right: -2.5px; }
|
|
344
|
+
.${t}-edge-top,
|
|
345
|
+
.${t}-edge-bottom {
|
|
346
|
+
left: 0;
|
|
347
|
+
right: 0;
|
|
348
|
+
height: 5px;
|
|
349
|
+
transform: scaleY(0.2);
|
|
350
|
+
}
|
|
351
|
+
.${t}-edge-top { top: -2.5px; }
|
|
352
|
+
.${t}-edge-bottom { bottom: -2.5px; }
|
|
353
|
+
.${t}-frame:has(> .${t}-handle-left:hover, > .${t}-handle-top-left:hover, > .${t}-handle-bottom-left:hover) > .${t}-edge-left,
|
|
354
|
+
.${t}-frame:has(> .${t}-handle-right:hover, > .${t}-handle-top-right:hover, > .${t}-handle-bottom-right:hover) > .${t}-edge-right,
|
|
355
|
+
.${t}-frame:has(> .${t}-handle-top:hover, > .${t}-handle-top-left:hover, > .${t}-handle-top-right:hover) > .${t}-edge-top,
|
|
356
|
+
.${t}-frame:has(> .${t}-handle-bottom:hover, > .${t}-handle-bottom-left:hover, > .${t}-handle-bottom-right:hover) > .${t}-edge-bottom,
|
|
357
|
+
.${t}-edge-shown {
|
|
358
|
+
opacity: 1;
|
|
359
|
+
transform: none;
|
|
360
|
+
}
|
|
361
|
+
@media (prefers-reduced-motion: reduce) {
|
|
362
|
+
.${t}-edge {
|
|
363
|
+
transition: none;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
/* a handle is an 11px strip along an edge, or a 22px square on a corner, centred on it and drawn by the edge it
|
|
367
|
+
thickens alone; on a block under 40px, outside it, so that the block is still there to be taken */
|
|
368
|
+
.${t}-handle {
|
|
369
|
+
position: absolute;
|
|
370
|
+
z-index: 3;
|
|
371
|
+
pointer-events: auto;
|
|
372
|
+
touch-action: none;
|
|
373
|
+
}
|
|
374
|
+
.${t}-handle-left,
|
|
375
|
+
.${t}-handle-right {
|
|
376
|
+
top: 50%;
|
|
377
|
+
width: 11px;
|
|
378
|
+
height: max(0px, calc(100% - 22px));
|
|
379
|
+
}
|
|
380
|
+
.${t}-handle-top,
|
|
381
|
+
.${t}-handle-bottom {
|
|
382
|
+
left: 50%;
|
|
383
|
+
width: max(0px, calc(100% - 22px));
|
|
384
|
+
height: 11px;
|
|
385
|
+
}
|
|
386
|
+
.${t}-handle-top-left,
|
|
387
|
+
.${t}-handle-top-right,
|
|
388
|
+
.${t}-handle-bottom-right,
|
|
389
|
+
.${t}-handle-bottom-left {
|
|
390
|
+
width: 22px;
|
|
391
|
+
height: 22px;
|
|
392
|
+
}
|
|
393
|
+
.${t}-handle-right { right: 0; transform: translate(50%, -50%); cursor: ${K.leftRight}; }
|
|
394
|
+
.${t}-handle-left { left: 0; transform: translate(-50%, -50%); cursor: ${K.leftRight}; }
|
|
395
|
+
.${t}-handle-top { top: 0; transform: translate(-50%, -50%); cursor: ${K.topBottom}; }
|
|
396
|
+
.${t}-handle-bottom { bottom: 0; transform: translate(-50%, 50%); cursor: ${K.topBottom}; }
|
|
397
|
+
.${t}-handle-top-left { top: 0; left: 0; transform: translate(-50%, -50%); cursor: ${K.diagonalLeft}; }
|
|
398
|
+
.${t}-handle-top-right { top: 0; right: 0; transform: translate(50%, -50%); cursor: ${K.diagonalRight}; }
|
|
399
|
+
.${t}-handle-bottom-right { bottom: 0; right: 0; transform: translate(50%, 50%); cursor: ${K.diagonalLeft}; }
|
|
400
|
+
.${t}-handle-bottom-left { bottom: 0; left: 0; transform: translate(-50%, 50%); cursor: ${K.diagonalRight}; }
|
|
401
|
+
.${t}-handles-outer .${t}-handle-right { transform: translate(100%, -50%); }
|
|
402
|
+
.${t}-handles-outer .${t}-handle-left { transform: translate(-100%, -50%); }
|
|
403
|
+
.${t}-handles-outer .${t}-handle-top { transform: translate(-50%, -100%); }
|
|
404
|
+
.${t}-handles-outer .${t}-handle-bottom { transform: translate(-50%, 100%); }
|
|
405
|
+
.${t}-handles-outer .${t}-handle-top-left { transform: translate(-100%, -100%); }
|
|
406
|
+
.${t}-handles-outer .${t}-handle-top-right { transform: translate(100%, -100%); }
|
|
407
|
+
.${t}-handles-outer .${t}-handle-bottom-right { transform: translate(100%, 100%); }
|
|
408
|
+
.${t}-handles-outer .${t}-handle-bottom-left { transform: translate(-100%, 100%); }
|
|
409
|
+
`}function mt(t,e,o,r){const i=u=>t[`${e}${u}`]??(r?t[`${r}${u}`]:void 0),s=u=>{const d=i(u);return d===void 0?void 0:me.scalingValue(d,o)},l=i("FontSettings"),h=i("TextAppearance");return{fontFamily:co.normalizeFontFamilyCssValue(i("FontFamily")),fontWeight:l==null?void 0:l.fontWeight,fontStyle:l==null?void 0:l.fontStyle,fontSize:s("FontSize"),lineHeight:s("LineHeight"),letterSpacing:s("LetterSpacing"),wordSpacing:s("WordSpacing"),textTransform:h==null?void 0:h.textTransform,textDecoration:h==null?void 0:h.textDecoration,fontVariant:h==null?void 0:h.fontVariant}}function wt(t){const e=t.type??"text";return e==="list"?"listA":e}function Oo(t,e,o,r){return t!=null&&t.grid&&Array.isArray(t.placements)&&t.placements.every(i=>typeof(i==null?void 0:i.top)=="number")?Wo(Ce(Re(t),r),e):Le(e.map(wt),r,1,o)}function Wo(t,e){const o=(r,i)=>r.height!==void 0&&e[i]&&wt(e[i])!=="image";return t.placements.some(o)?{...t,placements:t.placements.map((r,i)=>{if(!o(r,i))return r;const{height:s,...l}=r;return l})}:t}function Fo(t,e){const o=(r,i)=>Math.abs(r-i)<1e-4;return o(t.height,e.height)&&t.heights.length===e.heights.length&&t.heights.every((r,i)=>o(r,e.heights[i]))}function Wt(t,e){const o=t.placements[e];if(!o)return we(t.grid);const r=H(t.grid),i=Math.min(o.width,r),s={left:Math.min(Math.max(0,o.left),r-i),width:i,top:o.top};return typeof o.height=="number"?{...s,height:o.height}:s}function Fe({settings:t,content:e=[],isEditor:o,isEditMode:r,isPreviewMode:i,portalId:s,currentState:l,unavailableStates:h=[],onOpenChange:u,onUpdateSettings:d}){var ae,se;const{prefix:n}=so.useScopedStyles(),m=$.useMemo(()=>jo(n),[n]),[R,w]=$.useState(!1),[p,g]=$.useState(!1),[I,j]=$.useState(!1),M=!!(o&&!i),A=M&&l==="open"&&!h.includes("open"),y=A||!M&&R,E=ko(t);lo.useLightboxScrollLock(y&&!M),$.useEffect(()=>{u==null||u(y)},[y,u]),$.useEffect(()=>{if(y){g(!0);return}j(!1);const a=window.setTimeout(()=>g(!1),E==="none"?0:P);return()=>window.clearTimeout(a)},[y,E]),$.useEffect(()=>{if(!y||!p)return;const a=ut.current;a&&getComputedStyle(a.querySelector("[role=dialog]")??a).opacity;const c=requestAnimationFrame(()=>j(!0));return()=>cancelAnimationFrame(c)},[y,p]),$.useEffect(()=>{if(!y||M)return;const a=c=>{c.key==="Escape"&&w(!1)};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[y,M]);const b=a=>me.scalingValue(a??0,o),C=xe(t),T=(ae=t.menuLayout)==null?void 0:ae.grid,q=ve(t,T!=null&&T.columnWidth?T:Ft),V=`min(100%, ${b(ye(t,q))})`,Z=b(t.popupOffset),$t={left:`calc(0px + ${Z})`,center:`calc((100% - ${V}) / 2 + ${Z})`,right:`calc(100% - ${V} + ${Z})`}[po(t)],{columns:at,columnWidth:st,gutter:S,rowGap:G}=q,F=$.useMemo(()=>({columns:at,columnWidth:st,gutter:S,rowGap:G}),[at,st,S,G]),[et,O]=$.useState(null),Xt=et&&et.from===t.menuLayout?et.layout:t.menuLayout;$.useEffect(()=>{O(a=>a&&a.from!==t.menuLayout?null:a)},[t.menuLayout]);const lt=$.useMemo(()=>Oo(Xt,e,C,F),[Xt,e,C,F]),[Et,Ge]=$.useState(null),ot=$.useMemo(()=>Et?de(lt,Et):null,[lt,Et]),z=$.useMemo(()=>ot?Be(lt,ot):lt,[lt,ot]),{columns:ct,gutter:Lt,columnWidth:_t}=z.grid,De=ct*_t+(ct-1)*Lt,bt=_t>0?{gridTemplateColumns:`repeat(${ct}, minmax(0, ${b(_t)}))`,columnGap:b(Lt),width:`min(100%, ${b(De)})`,marginInline:"auto"}:{gridTemplateColumns:`repeat(${ct}, minmax(0, 1fr))`,columnGap:b(Lt)},Ue={width:bt.width,marginInline:bt.marginInline},Vt=H(z.grid),It=a=>`${a/(Vt||1)*100}%`,Yt=t.triggerLabel||"Menu",vt=Me(t.triggerPadding),nt=t.triggerType==="icon"&&!t.triggerIcon?"burger":t.triggerType??"text",He=mt(t,"trigger",o),Xe=mt(t,"title",o),Ve={text:mt(t,"text",o),listA:mt(t,"listA",o,"text"),listB:mt(t,"listB",o,"text")},J=((se=t.stateOverrides)==null?void 0:se.open)??{},Kt={[`--${n}-trigger-bg`]:t.barBackgroundColor,[`--${n}-trigger-color`]:(y?J.triggerColor:void 0)??t.triggerColor,[`--${n}-overlay-color`]:J.overlayColor??t.overlayColor,[`--${n}-overlay-blur`]:t.overlayBlur?`blur(${b(t.overlayBlur)})`:void 0,[`--${n}-popup-bg`]:J.popupBackgroundColor??t.popupBackgroundColor,[`--${n}-title-color`]:J.titleColor??t.titleColor,[`--${n}-text-color`]:J.textColor??t.textColor,[`--${n}-list-a-color`]:J.listAColor??t.listAColor,[`--${n}-list-b-color`]:J.listBColor??t.listBColor},qt=$.useRef(null),[Ye,Zt]=$.useState(void 0);$.useLayoutEffect(()=>{const a=qt.current;if(!p||!o||!a){Zt(void 0);return}const c=()=>Zt(_=>{const B=Ro(a);return _&&We.every(k=>_[k]===B[k])?_:B});if(c(),typeof ResizeObserver>"u")return;const f=new ResizeObserver(c);f.observe(a);const L=new MutationObserver(c),v=Eo(a);return v!==a&&(f.observe(v),L.observe(v,{attributes:!0,attributeFilter:["style"]})),()=>{f.disconnect(),L.disconnect()}},[p,o]);const ut=$.useRef(null),Jt=$.useRef(null),Qt=$.useRef(null),Ct=$.useRef(null),ht=$.useRef([]),[W,Ke]=$.useState(null),dt=$.useRef(null),rt=a=>{dt.current=a,Ke(a)},Q=$.useRef(null),X=!!(A&&r&&d),qe=W?fe(z,W):null,[Nt,At]=$.useState(null),Ze=X&&Nt!==null&&Nt<e.length?Nt:null,[Tt,Je]=$.useState(0);$.useEffect(()=>{X||(Q.current=null,rt(null),At(null),O(null))},[X]);const[zt,Pt]=$.useState(null);$.useLayoutEffect(()=>{const a=Jt.current;if(!p||!a){Pt(null);return}const c=()=>{const L=ut.current;if(!L)return;const v=L.getBoundingClientRect(),_=a.getBoundingClientRect(),B={top:_.top-v.top,left:_.left-v.left,width:_.width,height:_.height};Pt(k=>k&&k.top===B.top&&k.left===B.left&&k.width===B.width&&k.height===B.height?k:B)};c();const f=new ResizeObserver(c);return f.observe(a),window.addEventListener("resize",c),window.addEventListener("scroll",c,{capture:!0,passive:!0}),()=>{f.disconnect(),window.removeEventListener("resize",c),window.removeEventListener("scroll",c,{capture:!0})}},[p]),$.useLayoutEffect(()=>{const a=Qt.current,c=Ct.current;if(!p||!a||!c)return;const f=()=>{var B;const v=(B=ut.current)==null?void 0:B.getBoundingClientRect().width;if(!v)return;const _={height:a.getBoundingClientRect().height/v,heights:e.map((k,it)=>{var Y;return(((Y=ht.current[it])==null?void 0:Y.getBoundingClientRect().height)??0)/v})};Ge(k=>k&&Fo(k,_)?k:_),Je(v)};f();const L=new ResizeObserver(f);return L.observe(a),L.observe(c),ht.current.slice(0,e.length).forEach(v=>v&&L.observe(v)),()=>L.disconnect()},[p,e]);const Qe=(a,c,f)=>{!X||!z.placements[c]||a.button!==0||(a.preventDefault(),a.stopPropagation(),a.currentTarget.setPointerCapture(a.pointerId),Q.current={index:c,handle:f,pointerId:a.pointerId,origin:{x:a.clientX,y:a.clientY}},At(c))},Pe=({index:a,handle:c,pointerId:f,origin:L},v)=>{var yt;const _=Ct.current;if(!_||!z.placements[a])return null;const B=_.getBoundingClientRect(),k=((yt=ut.current)==null?void 0:yt.getBoundingClientRect().width)||1,it=B.width/(Vt||1)||k,Y=Wt(z,a),pt=de(z,{height:B.height/k,heights:e.map((ft,N)=>{var D;return(((D=ht.current[N])==null?void 0:D.getBoundingClientRect().height)??0)/k})}),xt=e.map((ft,N)=>{const D=ht.current[N];if(!D||wt(ft)==="image")return null;const le=To(D);return le===null?null:le/k});return Ot(z,{index:a,pointerId:f,handle:c,origin:L,unitX:it,unitY:k,start:Y,startHeight:Y.height??pt.heights[a]??0,placement:Y,measure:pt,baseline:xt[a]??null,lines:bo(z,a,pt,xt),guides:{xs:[],ys:[]},pointer:v},v)},to=a=>{const c={x:a.clientX,y:a.clientY,shiftKey:a.shiftKey,altKey:a.altKey},f=dt.current;if(f){if(a.pointerId!==f.pointerId)return;a.stopPropagation(),rt(Ot(z,f,c));return}const L=Q.current;if(!L||a.pointerId!==L.pointerId||(a.stopPropagation(),Math.hypot(c.x-L.origin.x,c.y-L.origin.y)<No))return;Q.current=null;const v=Pe(L,c);v&&rt(v)},eo=()=>{Q.current=null,rt(null)},te=$.useRef(()=>{});te.current=a=>{const c=dt.current;c!=null&&c.handle&&rt(Ot(z,c,a))};const ee=!!W;$.useEffect(()=>{if(!ee)return;const a=c=>{if(c.key!=="Shift"&&c.key!=="Alt")return;const f=dt.current;f!=null&&f.handle&&(c.preventDefault(),te.current({...f.pointer,shiftKey:c.shiftKey,altKey:c.altKey}))};return window.addEventListener("keydown",a),window.addEventListener("keyup",a),()=>{window.removeEventListener("keydown",a),window.removeEventListener("keyup",a)}},[ee]);const oo=a=>{var v;if(((v=Q.current)==null?void 0:v.pointerId)===a.pointerId){a.stopPropagation(),Q.current=null;return}const c=dt.current;if(!c||a.pointerId!==c.pointerId)return;a.stopPropagation();const f=fe(z,c),L=f==null?void 0:f.placements[c.index];f&&L&&!Ao(L,Wt(z,c.index))&&oe(f),rt(null)},oe=a=>{O({layout:a,from:t.menuLayout}),d==null||d({...t,menuLayout:a})},no=(a,c)=>{a.stopPropagation();const f=z.placements[c];if(!X||!f||f.height===void 0)return;const{height:L,...v}=f;oe({...z,edited:!0,placements:z.placements.map((_,B)=>B===c?v:_)})},Bt=()=>w(!1),ro=a=>{!M&&a.target.closest("a")&&Bt()},io=(a,c)=>{const f=wt(a),L=(a.images??[]).filter(N=>N==null?void 0:N.assetId),v=(W==null?void 0:W.index)===c,_=v?W.placement:Wt(z,c),B=_.height!==void 0,k=Ze===c,it=v&&!qe,Y=f==="image"?Lo:_o,pt=(_.height??(ot==null?void 0:ot.heights[c])??0)*Tt,xt=_.width*Tt,yt=Tt>0&&(xt<pe||f==="image"&&pt<pe),ft=N=>({onPointerDown:D=>Qe(D,c,N),onPointerMove:to,onPointerUp:oo,onPointerCancel:eo});return x.jsxs("div",{className:`${n}-slot${v?` ${n}-slot-dragged`:""}`,style:{marginLeft:It(_.left),width:It(_.width)},children:[x.jsx("div",{className:`${n}-spacer`,style:{height:b(_.top)}}),x.jsxs("div",{className:[`${n}-frame`,k?`${n}-frame-selected`:"",k&&yt?`${n}-handles-outer`:""].filter(Boolean).join(" "),children:[x.jsxs("div",{ref:N=>{ht.current[c]=N},className:[`${n}-block ${n}-block-${f}`,B?`${n}-block-sized`:"",v?`${n}-block-dragged`:"",it?`${n}-block-invalid`:""].filter(Boolean).join(" "),style:B?{height:b(_.height)}:void 0,...X?ft(null):{},children:[a.title&&f!=="image"?x.jsx("div",{className:`${n}-block-title`,style:{...Xe,marginBottom:b(t.titleGap)},children:a.title}):null,f==="image"?x.jsx(Do,{prefix:n,images:L,isRunning:y,radius:b(t.imageRadius)}):x.jsx("div",{className:`${n}-block-text`,style:Ve[f],children:x.jsx(uo.RichTextRenderer,{content:Array.isArray(a.text)?a.text:[]})})]}),k?x.jsx("div",{className:`${n}-box${it?` ${n}-box-invalid`:""}`,style:{[`--${n}-box-color`]:f==="image"?"#ACACAC":"#FF4400"},"aria-hidden":!0}):null,k?(f==="image"?Io:Co).map(N=>{var D;return x.jsx("div",{className:`${n}-edge ${n}-edge-${N}${v&&((D=W.handle)!=null&&D.includes(N))?` ${n}-edge-shown`:""}`,"aria-hidden":!0},N)}):null,k?Y.map(N=>x.jsx("div",{className:`${n}-handle ${n}-handle-${N}`,"aria-hidden":!0,...ft(N),onDoubleClick:N.includes("top")||N.includes("bottom")?D=>no(D,c):void 0},N)):null]})]},c)},ne={...nt==="text"?He:void 0,padding:[vt.top,vt.right,vt.bottom,vt.left].map(a=>b(a)).join(" "),[`--${n}-icon-size`]:b(t.triggerIconSize??So)},re=nt==="text"?Yt:x.jsx("span",{className:`${n}-icon ${n}-icon-${nt}`,"aria-hidden":!0,children:nt==="icon"?x.jsx(ho.SvgImage,{url:t.triggerIcon,fill:`var(--${n}-trigger-color)`,hoverFill:`var(--${n}-trigger-color)`,className:`${n}-icon-picture`}):Array.from({length:nt==="burger"?3:2},(a,c)=>x.jsx("span",{className:`${n}-icon-line`},c))}),jt=z.grid.beat||tt(z.grid),ie=p?x.jsxs("div",{ref:ut,"data-selection":"none",className:[`${n}-overlay`,`${n}-transition-${E.replace(" ","-")}`,o?`${n}-overlay-editor`:"",I?`${n}-overlay-active`:""].filter(Boolean).join(" "),style:{...Ye,...Kt},"aria-hidden":!I,onPointerDown:X?a=>{a.target.closest(`.${n}-frame`)||At(null)}:void 0,children:[x.jsx("button",{type:"button",className:`${n}-backdrop`,"aria-label":"Close menu",tabIndex:-1,onClick:M?void 0:Bt}),x.jsx("div",{ref:Qt,className:`${n}-card`,role:"dialog","aria-modal":"true","aria-label":t.triggerLabel||"Menu",onClick:ro,style:{top:b(t.popupOffsetTop),height:`${Gt(t)}%`,left:$t,width:V,borderRadius:b(t.popupRadius)},children:x.jsxs("div",{ref:Ct,className:`${n}-grid${X?` ${n}-grid-editable`:""}${W?` ${n}-grid-busy`:""}`,style:Ue,children:[e.map(io),W&&(W.guides.xs.length>0||W.guides.ys.length>0)?x.jsxs("div",{className:`${n}-snaps`,"aria-hidden":!0,children:[W.guides.xs.map(a=>x.jsx("div",{className:`${n}-snap ${n}-snap-x`,style:{left:It(a)}},`x${a}`)),W.guides.ys.map(a=>x.jsx("div",{className:`${n}-snap ${n}-snap-y`,style:{top:b(a)}},`y${a}`))]}):null,X?x.jsx("div",{className:`${n}-guides${jt>0?` ${n}-guides-beats`:""}${W?` ${n}-guides-shown`:""}`,style:{gridTemplateColumns:bt.gridTemplateColumns,columnGap:bt.columnGap,[`--${n}-beat`]:jt>0?b(jt):void 0},"aria-hidden":!0,children:Array.from({length:ct},(a,c)=>x.jsx("div",{className:`${n}-guide`},c))}):null]})}),zt?x.jsx("button",{type:"button",className:[`${n}-button ${n}-close`,I?`${n}-button-open`:"",M?`${n}-close-inert`:""].filter(Boolean).join(" "),style:{...ne,...zt},"aria-label":"Close menu","aria-expanded":y,tabIndex:I?void 0:-1,onClick:M?void 0:Bt,children:re}):null]}):null;return x.jsxs("div",{ref:qt,className:`${n}-root`,style:Kt,"data-edit-mode":r?"":void 0,children:[x.jsx("style",{dangerouslySetInnerHTML:{__html:m}}),x.jsx("button",{ref:Jt,type:"button",className:[`${n}-button`,y?`${n}-button-open`:"",zt?`${n}-button-hidden`:""].filter(Boolean).join(" "),style:ne,"aria-expanded":y,"aria-label":nt==="text"?void 0:Yt,onClick:M?void 0:()=>w(a=>!a),children:re}),ie&&typeof document<"u"?ao.createPortal(ie,(s?document.getElementById(s):null)??document.body):null]})}function Go(t){return t.type==="video"?!0:t.type?!1:/\.(mp4|webm|ogg|mov)(\?|$)/i.test(t.name||t.assetId)}function Do({prefix:t,images:e,isRunning:o,radius:r}){const[i,s]=$.useState(0),l=$.useRef([]),h=e.length;return $.useEffect(()=>{if(!o||h<2){s(0);return}const u=window.setInterval(()=>s(d=>(d+1)%h),Mo);return()=>window.clearInterval(u)},[o,h]),$.useEffect(()=>{l.current.slice(0,h).forEach((u,d)=>{var n;u&&(o&&d===i%h?(n=u.play())==null||n.catch(()=>{}):u.pause())})},[o,i,h,e]),x.jsx("div",{className:`${t}-images`,children:e.map((u,d)=>{const n=d===i%h,m=`${t}-image${n?"":` ${t}-image-hidden`}`,R={borderRadius:r};return ce.isEmbedMedia(u)?x.jsx(ce.EmbedMediaFrame,{className:m,media:u,fit:"cover",lazy:!1,silentLoop:!0,"aria-hidden":!n,style:R},d):Go(u)?x.jsx("video",{ref:w=>{l.current[d]=w},className:m,src:u.assetId,autoPlay:o&&n,muted:!0,loop:!0,playsInline:!0,"aria-hidden":!n,style:R},d):x.jsx("img",{className:m,src:u.assetId,alt:u.name??"","aria-hidden":!n,style:R},d)})})}const Uo=Object.freeze(Object.defineProperty({__proto__:null,POPUP_MENU_TRANSITIONS:Ht,POPUP_MENU_TRIGGER_TYPES:Oe,PopupMenu:Fe},Symbol.toStringTag,{value:"Module"}));exports.DEFAULT_POPUP_MENU_GRID=Ft;exports.DEFAULT_POPUP_MENU_HEIGHT=ge;exports.DEFAULT_POPUP_MENU_VIEWPORT_RATIO=$e;exports.POPUP_MENU_ALIGNS=be;exports.POPUP_MENU_TRANSITIONS=Ht;exports.POPUP_MENU_TRIGGER_TYPES=Oe;exports.PopupMenu=Fe;exports.PopupMenu$1=Uo;exports.defaultPopupMenuLayoutRules=Ee;exports.fitPopupMenuLayoutToGrid=Ce;exports.generatePopupMenuLayout=Le;exports.getDefaultPopupMenuPlacement=we;exports.getPopupMenuColumnEdges=Dt;exports.getPopupMenuColumnWidth=kt;exports.getPopupMenuColumnsPlacement=St;exports.getPopupMenuGrid=ve;exports.getPopupMenuGridWidth=H;exports.getPopupMenuHeight=xe;exports.getPopupMenuHeightPercent=Gt;exports.getPopupMenuSides=Me;exports.getPopupMenuWidth=ye;exports.isSamePopupMenuGrid=Ie;exports.movePopupMenuBlock=Ae;exports.normalizePopupMenuLayout=Re;exports.resizePopupMenuBlock=Te;exports.settlePopupMenuLayout=Be;exports.snapPopupMenuHeight=fo;exports.snapPopupMenuTop=_e;exports.toPopupMenuPlacement=Se;
|
|
@@ -2,7 +2,7 @@ import { ControlSlider as a } from "./ControlSlider-3w-bHQEg.mjs";
|
|
|
2
2
|
import { ImageRevealSlider as s } from "./ImageRevealSlider-DifEXySR.mjs";
|
|
3
3
|
import { LightboxGallery as c } from "./Lightbox-DzPqgKP4.mjs";
|
|
4
4
|
import { C as y, F as g, O as m, M as u, a as d, T as b, b as h, G as f, H as v, L as x, c as S, d as C, e as I, S as k, W as T, f as A, g as j, h as F, i as B, B as w, P as E, j as z } from "./ChroniclesComponent-DRf1Xd9_.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { x as P, P as M, y as L, z as G } from "./PopupMenu-CYdDyzEt.mjs";
|
|
6
6
|
const O = {
|
|
7
7
|
element: a,
|
|
8
8
|
id: "control-slider",
|
|
@@ -2224,11 +2224,10 @@ const r = {
|
|
|
2224
2224
|
settings: {
|
|
2225
2225
|
sizing: "auto",
|
|
2226
2226
|
properties: {
|
|
2227
|
+
// the blocks' placements, set by moving and resizing them on the canvas; it has no control in the panel
|
|
2227
2228
|
menuLayout: {
|
|
2228
2229
|
type: "object",
|
|
2229
|
-
scope: "layout"
|
|
2230
|
-
title: "Layout",
|
|
2231
|
-
display: { type: "popup-menu-layout" }
|
|
2230
|
+
scope: "layout"
|
|
2232
2231
|
},
|
|
2233
2232
|
// the popup's own grid, which its blocks are placed, moved and resized on, centred inside its padding. Set as
|
|
2234
2233
|
// Catalogue's is: columns of the Entry width with the Gutter between them, within the Width, any one of the
|
|
@@ -2279,7 +2278,7 @@ const r = {
|
|
|
2279
2278
|
type: "string",
|
|
2280
2279
|
scope: "common",
|
|
2281
2280
|
title: "Trigger",
|
|
2282
|
-
enum: [...
|
|
2281
|
+
enum: [...L],
|
|
2283
2282
|
display: { type: "radio-group" }
|
|
2284
2283
|
},
|
|
2285
2284
|
// the text shown by a text trigger, and every trigger's accessible name
|
|
@@ -2330,7 +2329,7 @@ const r = {
|
|
|
2330
2329
|
type: "string",
|
|
2331
2330
|
scope: "layout",
|
|
2332
2331
|
title: "Align",
|
|
2333
|
-
enum: [...
|
|
2332
|
+
enum: [...M],
|
|
2334
2333
|
display: { type: "align-group", direction: "horizontal" }
|
|
2335
2334
|
},
|
|
2336
2335
|
popupOffset: {
|
|
@@ -2572,8 +2571,7 @@ const r = {
|
|
|
2572
2571
|
{ type: "row", items: ["titleGap", "imageRadius"] },
|
|
2573
2572
|
{ type: "row", items: ["overlayBlur", "popupTransition"] },
|
|
2574
2573
|
{ type: "row", title: "Grid", items: [{ type: "group", title: "", items: ["gridLayout"] }] },
|
|
2575
|
-
"verticalGap"
|
|
2576
|
-
"menuLayout"
|
|
2574
|
+
"verticalGap"
|
|
2577
2575
|
]
|
|
2578
2576
|
},
|
|
2579
2577
|
{
|