@jsonpages/core 1.0.56 → 1.0.58
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/jsonpages-core.js
CHANGED
|
@@ -6102,11 +6102,11 @@ const $u = ({ type: e, scope: t, isSelected: r, sectionId: n, sectionIndex: o =
|
|
|
6102
6102
|
className: ge(
|
|
6103
6103
|
"relative w-full",
|
|
6104
6104
|
c && !f && "group cursor-pointer",
|
|
6105
|
-
c && b ? "sticky top-0 z-[60]" : "relative z-0",
|
|
6105
|
+
c && b ? "sticky top-0 z-[60]" : e.type === "header" ? "relative" : "relative z-0",
|
|
6106
6106
|
d && "z-[70]"
|
|
6107
6107
|
),
|
|
6108
6108
|
children: [
|
|
6109
|
-
/* @__PURE__ */ p.jsx("div", { className: "relative z-0", children: /* @__PURE__ */ p.jsx(Hu, { type: e.type, children: h() }) }),
|
|
6109
|
+
/* @__PURE__ */ p.jsx("div", { className: e.type === "header" ? "relative" : "relative z-0", children: /* @__PURE__ */ p.jsx(Hu, { type: e.type, children: h() }) }),
|
|
6110
6110
|
c && !f && /* @__PURE__ */ p.jsx(
|
|
6111
6111
|
$u,
|
|
6112
6112
|
{
|
|
@@ -205,7 +205,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
205
205
|
*
|
|
206
206
|
* This source code is licensed under the ISC license.
|
|
207
207
|
* See the LICENSE file in the root directory of this source tree.
|
|
208
|
-
*/const qd=ye("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);class Jd extends j.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,r){console.error(`[JsonPages] Component Crash [${this.props.type}]:`,t,r)}render(){return this.state.hasError?p.jsxs("div",{className:"p-8 m-4 bg-amber-500/5 border-2 border-dashed border-amber-500/20 rounded-xl flex flex-col items-center text-center gap-3",children:[p.jsx(Xd,{className:"text-amber-500",size:32}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("h4",{className:"text-sm font-bold text-amber-200 uppercase tracking-tight",children:"Component Error"}),p.jsxs("p",{className:"text-xs text-amber-500/70 font-mono",children:["Type: ",this.props.type]})]}),p.jsx("p",{className:"text-xs text-zinc-400 max-w-[280px] leading-relaxed",children:"This section failed to render. Check the console for details or verify the JSON data structure."})]}):this.props.children}}const Qd=({type:e,scope:t,isSelected:r,sectionId:n,sectionIndex:o=0,totalSections:i=0,onReorder:s})=>{const a=typeof o=="number"&&o>0&&s,l=typeof o=="number"&&o<i-1&&s;return p.jsx("div",{"data-jp-section-overlay":!0,"aria-hidden":!0,className:me("absolute inset-0 pointer-events-none transition-all duration-200 z-[50]","border-2 border-transparent group-hover:border-blue-400/50 group-hover:border-dashed",r&&"border-2 border-blue-600 border-solid bg-blue-500/5"),children:p.jsxs("div",{className:me("absolute top-0 right-0 flex flex-nowrap items-center gap-1 pl-1 pr-2 py-1 text-[9px] font-black uppercase tracking-widest transition-opacity pointer-events-auto","bg-blue-600 text-white",r||"group-hover:opacity-100 opacity-0"),children:[s&&n!=null&&p.jsxs("span",{className:"shrink-0 flex items-center gap-0.5",children:[p.jsx("button",{type:"button",onClick:c=>{c.stopPropagation(),a&&s(n,o-1)},disabled:!a,className:"inline-flex items-center justify-center min-w-[18px] min-h-[18px] rounded bg-white/20 hover:bg-white/30 disabled:opacity-30 disabled:pointer-events-none",title:"Move section up","aria-label":"Move section up",children:p.jsx(to,{size:12,strokeWidth:2.5})}),p.jsx("button",{type:"button",onClick:c=>{c.stopPropagation(),l&&s(n,o+2)},disabled:!l,className:"inline-flex items-center justify-center min-w-[18px] min-h-[18px] rounded bg-white/20 hover:bg-white/30 disabled:opacity-30 disabled:pointer-events-none",title:"Move section down","aria-label":"Move section down",children:p.jsx(Hr,{size:12,strokeWidth:2.5})})]}),p.jsx("span",{className:"shrink-0",children:e}),p.jsx("span",{className:"opacity-50 shrink-0",children:"|"}),p.jsx("span",{className:"shrink-0",children:t})]})})},fr=({section:e,menu:t,selectedId:r,reorderable:n,sectionIndex:o,totalSections:i,onReorder:s})=>{var g,x;const{mode:a}=Gi(),{registry:l}=ur(),c=a==="studio",d=c&&r===e.id,u=l[e.type],m=e.type==="header"||e.type==="footer"?"global":"local",f=e.type==="tiptap",v=e.type==="header"&&((g=e.settings)==null?void 0:g.sticky);if(!u)return p.jsxs("div",{className:"p-6 m-4 bg-red-500/10 text-red-400 border border-red-500/20 rounded-lg text-sm font-mono",children:[p.jsx("strong",{children:"Missing Component:"})," ",e.type]});const h=()=>{const k=u;return e.type==="header"&&t?p.jsx(k,{data:e.data,settings:e.settings,menu:t}):p.jsx(k,{data:e.data,settings:e.settings})},b=(x=e.data)==null?void 0:x.anchorId;return p.jsxs("div",{id:b||void 0,"data-section-id":c?e.id:void 0,"data-section-type":c?e.type:void 0,"data-section-scope":c?m:void 0,...c&&d?{"data-jp-selected":!0}:{},className:me("relative w-full",c&&!f&&"group cursor-pointer",c&&v?"sticky top-0 z-[60]":"relative z-0",d&&"z-[70]"),children:[p.jsx("div",{className:"relative z-0",children:p.jsx(Jd,{type:e.type,children:h()})}),c&&!f&&p.jsx(Qd,{type:e.type,scope:m,isSelected:!!d,sectionId:n&&m==="local"?e.id:void 0,sectionIndex:n&&m==="local"?o:void 0,totalSections:n&&m==="local"?i:void 0,onReorder:n&&m==="local"?s:void 0})]})},eu=e=>{j.useEffect(()=>{document.title=e.title;let t=document.querySelector('meta[name="description"]');t||(t=document.createElement("meta"),t.setAttribute("name","description"),document.head.appendChild(t)),t.setAttribute("content",e.description)},[e.title,e.description])},tu="application/json",oo=({pageConfig:e,siteConfig:t,menuConfig:r,selectedId:n,onReorder:o,scrollToSectionId:i,onActiveSectionChange:s})=>{var b,g;eu(e.meta);const[a,l]=j.useState(null),c=j.useRef({}),d=j.useRef(s);d.current=s;const u=x=>{var k;(k=d.current)==null||k.call(d,x)};j.useEffect(()=>{if(!i)return;const x=c.current[i];x&&x.scrollIntoView({behavior:"smooth",block:"center"})},[i]),j.useEffect(()=>{if(!d.current)return;const k=[...t.header?[t.header.id]:[],...e.sections.map(A=>A.id),...t.footer?[t.footer.id]:[]],_=new IntersectionObserver(A=>{A.forEach(D=>{var R;if(D.isIntersecting&&D.intersectionRatio>.5){const F=D.target.getAttribute("data-section-id");F&&((R=d.current)==null||R.call(d,F))}})},{threshold:[0,.5,1],rootMargin:"-20% 0px -20% 0px"});let C=!1;const I=requestAnimationFrame(()=>{C||k.forEach(A=>{const D=c.current[A];D&&_.observe(D)})});return()=>{C=!0,cancelAnimationFrame(I),_.disconnect()}},[e.sections,(b=t.header)==null?void 0:b.id,(g=t.footer)==null?void 0:g.id]);const m=(x,k)=>{x.preventDefault(),x.dataTransfer.dropEffect="move",l(k)},f=()=>{l(null)},v=(x,k)=>{if(x.preventDefault(),l(null),!!o)try{const _=x.dataTransfer.getData(tu),{sectionId:C}=JSON.parse(_);typeof C=="string"&&o(C,k)}catch{}},h=()=>{const x=typeof o=="function",k=e.sections.map((_,C)=>{const I=a===C;return x?p.jsxs("div",{ref:A=>{c.current[_.id]=A},"data-section-id":_.id,style:{position:"relative"},onMouseEnter:()=>u(_.id),children:[p.jsx("div",{"data-jp-drop-zone":!0,style:{position:"absolute",left:0,right:0,top:-1,height:12,zIndex:55,pointerEvents:"auto",backgroundColor:I?"rgba(59, 130, 246, 0.4)":"transparent",borderTop:I?"2px solid rgb(96, 165, 250)":"2px solid transparent"},onDragOver:A=>m(A,C),onDragLeave:f,onDrop:A=>v(A,C)}),p.jsx(fr,{section:_,selectedId:n,reorderable:!0,sectionIndex:C,totalSections:e.sections.length,onReorder:o})]},_.id):p.jsx("div",{ref:A=>{c.current[_.id]=A},"data-section-id":_.id,onMouseEnter:()=>u(_.id),children:p.jsx(fr,{section:_,selectedId:n})},_.id)});if(x&&k.length>0){const _=e.sections.length,C=a===_;k.push(p.jsx("div",{"data-jp-drop-zone":!0,style:{position:"relative",left:0,right:0,height:24,minHeight:24,zIndex:55,pointerEvents:"auto",backgroundColor:C?"rgba(59, 130, 246, 0.4)":"transparent",borderTop:C?"2px solid rgb(96, 165, 250)":"2px solid transparent"},onDragOver:I=>m(I,_),onDragLeave:f,onDrop:I=>v(I,_)},"jp-drop-after-last"))}return k};return p.jsxs("div",{className:"min-h-screen flex flex-col bg-[var(--color-background)]",children:[t.header!=null&&p.jsx("div",{ref:x=>{c.current[t.header.id]=x},"data-section-id":t.header.id,onMouseEnter:()=>u(t.header.id),children:p.jsx(fr,{section:t.header,menu:r.main,selectedId:n})}),p.jsx("main",{className:"flex-1",children:h()}),t.footer!=null&&p.jsx("div",{ref:x=>{c.current[t.footer.id]=x},"data-section-id":t.footer.id,onMouseEnter:()=>u(t.footer.id),children:p.jsx(fr,{section:t.footer,selectedId:n})})]})},Zr=({mode:e,tenantCss:t,adminCss:r,children:n})=>(j.useLayoutEffect(()=>{const o=`jp-theme-${e}`,i=e==="tenant"?t:r;if(!document.getElementById(o)&&i){const s=document.createElement("style");s.id=o,s.innerHTML=i,document.head.appendChild(s)}return()=>{const s=document.getElementById(o);s&&s.remove()}},[e,t,r]),p.jsx(p.Fragment,{children:n}));function ru(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return j.useMemo(()=>n=>{t.forEach(o=>o(n))},t)}const Gr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Mt(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function io(e){return"nodeType"in e}function Le(e){var t,r;return e?Mt(e)?e:io(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function so(e){const{Document:t}=Le(e);return e instanceof t}function hr(e){return Mt(e)?!1:e instanceof Le(e).HTMLElement}function es(e){return e instanceof Le(e).SVGElement}function Ft(e){return e?Mt(e)?e.document:io(e)?so(e)?e:hr(e)||es(e)?e.ownerDocument:document:document:document}const Ke=Gr?j.useLayoutEffect:j.useEffect;function Kr(e){const t=j.useRef(e);return Ke(()=>{t.current=e}),j.useCallback(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.current==null?void 0:t.current(...n)},[])}function nu(){const e=j.useRef(null),t=j.useCallback((n,o)=>{e.current=setInterval(n,o)},[]),r=j.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function pr(e,t){t===void 0&&(t=[e]);const r=j.useRef(e);return Ke(()=>{r.current!==e&&(r.current=e)},t),r}function mr(e,t){const r=j.useRef();return j.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function Xr(e){const t=Kr(e),r=j.useRef(null),n=j.useCallback(o=>{o!==r.current&&(t==null||t(o,r.current)),r.current=o},[]);return[r,n]}function qr(e){const t=j.useRef();return j.useEffect(()=>{t.current=e},[e]),t.current}let ao={};function gr(e,t){return j.useMemo(()=>{if(t)return t;const r=ao[e]==null?0:ao[e]+1;return ao[e]=r,e+"-"+r},[e,t])}function ts(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.reduce((i,s)=>{const a=Object.entries(s);for(const[l,c]of a){const d=i[l];d!=null&&(i[l]=d+e*c)}return i},{...t})}}const Bt=ts(1),br=ts(-1);function ou(e){return"clientX"in e&&"clientY"in e}function Jr(e){if(!e)return!1;const{KeyboardEvent:t}=Le(e.target);return t&&e instanceof t}function iu(e){if(!e)return!1;const{TouchEvent:t}=Le(e.target);return t&&e instanceof t}function Qr(e){if(iu(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return ou(e)?{x:e.clientX,y:e.clientY}:null}const gt=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[gt.Translate.toString(e),gt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),rs="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function su(e){return e.matches(rs)?e:e.querySelector(rs)}const au={display:"none"};function lu(e){let{id:t,value:r}=e;return j.createElement("div",{id:t,style:au},r)}function cu(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return j.createElement("div",{id:t,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function du(){const[e,t]=j.useState("");return{announce:j.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const ns=j.createContext(null);function uu(e){const t=j.useContext(ns);j.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function fu(){const[e]=j.useState(()=>new Set),t=j.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[j.useCallback(n=>{let{type:o,event:i}=n;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const hu={draggable:`
|
|
208
|
+
*/const qd=ye("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);class Jd extends j.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,r){console.error(`[JsonPages] Component Crash [${this.props.type}]:`,t,r)}render(){return this.state.hasError?p.jsxs("div",{className:"p-8 m-4 bg-amber-500/5 border-2 border-dashed border-amber-500/20 rounded-xl flex flex-col items-center text-center gap-3",children:[p.jsx(Xd,{className:"text-amber-500",size:32}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("h4",{className:"text-sm font-bold text-amber-200 uppercase tracking-tight",children:"Component Error"}),p.jsxs("p",{className:"text-xs text-amber-500/70 font-mono",children:["Type: ",this.props.type]})]}),p.jsx("p",{className:"text-xs text-zinc-400 max-w-[280px] leading-relaxed",children:"This section failed to render. Check the console for details or verify the JSON data structure."})]}):this.props.children}}const Qd=({type:e,scope:t,isSelected:r,sectionId:n,sectionIndex:o=0,totalSections:i=0,onReorder:s})=>{const a=typeof o=="number"&&o>0&&s,l=typeof o=="number"&&o<i-1&&s;return p.jsx("div",{"data-jp-section-overlay":!0,"aria-hidden":!0,className:me("absolute inset-0 pointer-events-none transition-all duration-200 z-[50]","border-2 border-transparent group-hover:border-blue-400/50 group-hover:border-dashed",r&&"border-2 border-blue-600 border-solid bg-blue-500/5"),children:p.jsxs("div",{className:me("absolute top-0 right-0 flex flex-nowrap items-center gap-1 pl-1 pr-2 py-1 text-[9px] font-black uppercase tracking-widest transition-opacity pointer-events-auto","bg-blue-600 text-white",r||"group-hover:opacity-100 opacity-0"),children:[s&&n!=null&&p.jsxs("span",{className:"shrink-0 flex items-center gap-0.5",children:[p.jsx("button",{type:"button",onClick:c=>{c.stopPropagation(),a&&s(n,o-1)},disabled:!a,className:"inline-flex items-center justify-center min-w-[18px] min-h-[18px] rounded bg-white/20 hover:bg-white/30 disabled:opacity-30 disabled:pointer-events-none",title:"Move section up","aria-label":"Move section up",children:p.jsx(to,{size:12,strokeWidth:2.5})}),p.jsx("button",{type:"button",onClick:c=>{c.stopPropagation(),l&&s(n,o+2)},disabled:!l,className:"inline-flex items-center justify-center min-w-[18px] min-h-[18px] rounded bg-white/20 hover:bg-white/30 disabled:opacity-30 disabled:pointer-events-none",title:"Move section down","aria-label":"Move section down",children:p.jsx(Hr,{size:12,strokeWidth:2.5})})]}),p.jsx("span",{className:"shrink-0",children:e}),p.jsx("span",{className:"opacity-50 shrink-0",children:"|"}),p.jsx("span",{className:"shrink-0",children:t})]})})},fr=({section:e,menu:t,selectedId:r,reorderable:n,sectionIndex:o,totalSections:i,onReorder:s})=>{var g,x;const{mode:a}=Gi(),{registry:l}=ur(),c=a==="studio",d=c&&r===e.id,u=l[e.type],m=e.type==="header"||e.type==="footer"?"global":"local",f=e.type==="tiptap",v=e.type==="header"&&((g=e.settings)==null?void 0:g.sticky);if(!u)return p.jsxs("div",{className:"p-6 m-4 bg-red-500/10 text-red-400 border border-red-500/20 rounded-lg text-sm font-mono",children:[p.jsx("strong",{children:"Missing Component:"})," ",e.type]});const h=()=>{const k=u;return e.type==="header"&&t?p.jsx(k,{data:e.data,settings:e.settings,menu:t}):p.jsx(k,{data:e.data,settings:e.settings})},b=(x=e.data)==null?void 0:x.anchorId;return p.jsxs("div",{id:b||void 0,"data-section-id":c?e.id:void 0,"data-section-type":c?e.type:void 0,"data-section-scope":c?m:void 0,...c&&d?{"data-jp-selected":!0}:{},className:me("relative w-full",c&&!f&&"group cursor-pointer",c&&v?"sticky top-0 z-[60]":e.type==="header"?"relative":"relative z-0",d&&"z-[70]"),children:[p.jsx("div",{className:e.type==="header"?"relative":"relative z-0",children:p.jsx(Jd,{type:e.type,children:h()})}),c&&!f&&p.jsx(Qd,{type:e.type,scope:m,isSelected:!!d,sectionId:n&&m==="local"?e.id:void 0,sectionIndex:n&&m==="local"?o:void 0,totalSections:n&&m==="local"?i:void 0,onReorder:n&&m==="local"?s:void 0})]})},eu=e=>{j.useEffect(()=>{document.title=e.title;let t=document.querySelector('meta[name="description"]');t||(t=document.createElement("meta"),t.setAttribute("name","description"),document.head.appendChild(t)),t.setAttribute("content",e.description)},[e.title,e.description])},tu="application/json",oo=({pageConfig:e,siteConfig:t,menuConfig:r,selectedId:n,onReorder:o,scrollToSectionId:i,onActiveSectionChange:s})=>{var b,g;eu(e.meta);const[a,l]=j.useState(null),c=j.useRef({}),d=j.useRef(s);d.current=s;const u=x=>{var k;(k=d.current)==null||k.call(d,x)};j.useEffect(()=>{if(!i)return;const x=c.current[i];x&&x.scrollIntoView({behavior:"smooth",block:"center"})},[i]),j.useEffect(()=>{if(!d.current)return;const k=[...t.header?[t.header.id]:[],...e.sections.map(A=>A.id),...t.footer?[t.footer.id]:[]],_=new IntersectionObserver(A=>{A.forEach(D=>{var R;if(D.isIntersecting&&D.intersectionRatio>.5){const F=D.target.getAttribute("data-section-id");F&&((R=d.current)==null||R.call(d,F))}})},{threshold:[0,.5,1],rootMargin:"-20% 0px -20% 0px"});let C=!1;const I=requestAnimationFrame(()=>{C||k.forEach(A=>{const D=c.current[A];D&&_.observe(D)})});return()=>{C=!0,cancelAnimationFrame(I),_.disconnect()}},[e.sections,(b=t.header)==null?void 0:b.id,(g=t.footer)==null?void 0:g.id]);const m=(x,k)=>{x.preventDefault(),x.dataTransfer.dropEffect="move",l(k)},f=()=>{l(null)},v=(x,k)=>{if(x.preventDefault(),l(null),!!o)try{const _=x.dataTransfer.getData(tu),{sectionId:C}=JSON.parse(_);typeof C=="string"&&o(C,k)}catch{}},h=()=>{const x=typeof o=="function",k=e.sections.map((_,C)=>{const I=a===C;return x?p.jsxs("div",{ref:A=>{c.current[_.id]=A},"data-section-id":_.id,style:{position:"relative"},onMouseEnter:()=>u(_.id),children:[p.jsx("div",{"data-jp-drop-zone":!0,style:{position:"absolute",left:0,right:0,top:-1,height:12,zIndex:55,pointerEvents:"auto",backgroundColor:I?"rgba(59, 130, 246, 0.4)":"transparent",borderTop:I?"2px solid rgb(96, 165, 250)":"2px solid transparent"},onDragOver:A=>m(A,C),onDragLeave:f,onDrop:A=>v(A,C)}),p.jsx(fr,{section:_,selectedId:n,reorderable:!0,sectionIndex:C,totalSections:e.sections.length,onReorder:o})]},_.id):p.jsx("div",{ref:A=>{c.current[_.id]=A},"data-section-id":_.id,onMouseEnter:()=>u(_.id),children:p.jsx(fr,{section:_,selectedId:n})},_.id)});if(x&&k.length>0){const _=e.sections.length,C=a===_;k.push(p.jsx("div",{"data-jp-drop-zone":!0,style:{position:"relative",left:0,right:0,height:24,minHeight:24,zIndex:55,pointerEvents:"auto",backgroundColor:C?"rgba(59, 130, 246, 0.4)":"transparent",borderTop:C?"2px solid rgb(96, 165, 250)":"2px solid transparent"},onDragOver:I=>m(I,_),onDragLeave:f,onDrop:I=>v(I,_)},"jp-drop-after-last"))}return k};return p.jsxs("div",{className:"min-h-screen flex flex-col bg-[var(--color-background)]",children:[t.header!=null&&p.jsx("div",{ref:x=>{c.current[t.header.id]=x},"data-section-id":t.header.id,onMouseEnter:()=>u(t.header.id),children:p.jsx(fr,{section:t.header,menu:r.main,selectedId:n})}),p.jsx("main",{className:"flex-1",children:h()}),t.footer!=null&&p.jsx("div",{ref:x=>{c.current[t.footer.id]=x},"data-section-id":t.footer.id,onMouseEnter:()=>u(t.footer.id),children:p.jsx(fr,{section:t.footer,selectedId:n})})]})},Zr=({mode:e,tenantCss:t,adminCss:r,children:n})=>(j.useLayoutEffect(()=>{const o=`jp-theme-${e}`,i=e==="tenant"?t:r;if(!document.getElementById(o)&&i){const s=document.createElement("style");s.id=o,s.innerHTML=i,document.head.appendChild(s)}return()=>{const s=document.getElementById(o);s&&s.remove()}},[e,t,r]),p.jsx(p.Fragment,{children:n}));function ru(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return j.useMemo(()=>n=>{t.forEach(o=>o(n))},t)}const Gr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Mt(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function io(e){return"nodeType"in e}function Le(e){var t,r;return e?Mt(e)?e:io(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function so(e){const{Document:t}=Le(e);return e instanceof t}function hr(e){return Mt(e)?!1:e instanceof Le(e).HTMLElement}function es(e){return e instanceof Le(e).SVGElement}function Ft(e){return e?Mt(e)?e.document:io(e)?so(e)?e:hr(e)||es(e)?e.ownerDocument:document:document:document}const Ke=Gr?j.useLayoutEffect:j.useEffect;function Kr(e){const t=j.useRef(e);return Ke(()=>{t.current=e}),j.useCallback(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.current==null?void 0:t.current(...n)},[])}function nu(){const e=j.useRef(null),t=j.useCallback((n,o)=>{e.current=setInterval(n,o)},[]),r=j.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function pr(e,t){t===void 0&&(t=[e]);const r=j.useRef(e);return Ke(()=>{r.current!==e&&(r.current=e)},t),r}function mr(e,t){const r=j.useRef();return j.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function Xr(e){const t=Kr(e),r=j.useRef(null),n=j.useCallback(o=>{o!==r.current&&(t==null||t(o,r.current)),r.current=o},[]);return[r,n]}function qr(e){const t=j.useRef();return j.useEffect(()=>{t.current=e},[e]),t.current}let ao={};function gr(e,t){return j.useMemo(()=>{if(t)return t;const r=ao[e]==null?0:ao[e]+1;return ao[e]=r,e+"-"+r},[e,t])}function ts(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.reduce((i,s)=>{const a=Object.entries(s);for(const[l,c]of a){const d=i[l];d!=null&&(i[l]=d+e*c)}return i},{...t})}}const Bt=ts(1),br=ts(-1);function ou(e){return"clientX"in e&&"clientY"in e}function Jr(e){if(!e)return!1;const{KeyboardEvent:t}=Le(e.target);return t&&e instanceof t}function iu(e){if(!e)return!1;const{TouchEvent:t}=Le(e.target);return t&&e instanceof t}function Qr(e){if(iu(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return ou(e)?{x:e.clientX,y:e.clientY}:null}const gt=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[gt.Translate.toString(e),gt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),rs="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function su(e){return e.matches(rs)?e:e.querySelector(rs)}const au={display:"none"};function lu(e){let{id:t,value:r}=e;return j.createElement("div",{id:t,style:au},r)}function cu(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return j.createElement("div",{id:t,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function du(){const[e,t]=j.useState("");return{announce:j.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const ns=j.createContext(null);function uu(e){const t=j.useContext(ns);j.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function fu(){const[e]=j.useState(()=>new Set),t=j.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[j.useCallback(n=>{let{type:o,event:i}=n;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const hu={draggable:`
|
|
209
209
|
To pick up a draggable item, press the space bar.
|
|
210
210
|
While dragging, use the arrow keys to move the item.
|
|
211
211
|
Press space again to drop the item in its new position, or press escape to cancel.
|