@chaibuilder/sdk 1.2.59 → 1.2.60
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/{AddBlocks-MH_fqSRf.cjs → AddBlocks-BtMNa99n.cjs} +1 -1
- package/dist/{AddBlocks-05ZH2Suu.js → AddBlocks-L-3Io1jR.js} +6 -6
- package/dist/CanvasArea-KBfW2Hh3.js +978 -0
- package/dist/CanvasArea-ZNRxUJR7.cjs +59 -0
- package/dist/{CodeEditor-vECReGwz.cjs → CodeEditor-NuzOGqRn.cjs} +1 -1
- package/dist/{CodeEditor-zYBqhBv3.js → CodeEditor-cY6z8D4N.js} +1 -1
- package/dist/{CurrentPage-cOvRmEIZ.js → CurrentPage-XXy2OzNq.js} +3 -3
- package/dist/{CurrentPage-pwDwQsWa.cjs → CurrentPage-ccOL3l6S.cjs} +1 -1
- package/dist/ListTree-8jpTvI-s.cjs +1 -0
- package/dist/{ListTree-0iy8aBgI.js → ListTree-yoltG7gq.js} +2 -2
- package/dist/{PagesPanel-A3du_vDn.js → PagesPanel-XUtE4Aou.js} +4 -4
- package/dist/{PagesPanel-bfNUqq2a.cjs → PagesPanel-t3NlycIl.cjs} +1 -1
- package/dist/{ProjectPanel-92EtwSrh.js → ProjectPanel-3zkDX3az.js} +4 -4
- package/dist/{ProjectPanel-QMaTK2Jx.cjs → ProjectPanel-UClucyIl.cjs} +1 -1
- package/dist/{Settings-3ZuMFtd6.js → Settings-C9AegLbF.js} +2 -2
- package/dist/{Settings-8_Twq9DO.cjs → Settings-GVs7UvAX.cjs} +1 -1
- package/dist/{SidePanels-C8RdCe7y.cjs → SidePanels--qxWuuF-.cjs} +1 -1
- package/dist/{SidePanels-XUVc9jMH.js → SidePanels-Y3z3wyQx.js} +3 -3
- package/dist/{ThemeConfiguration-PvMN3j6h.cjs → ThemeConfiguration-03I3INEI.cjs} +1 -1
- package/dist/{ThemeConfiguration-ab7lbA2y.js → ThemeConfiguration-e_4e_ZcS.js} +1 -1
- package/dist/{Topbar-EkBS5_nt.cjs → Topbar-Yrhyc6IQ.cjs} +1 -1
- package/dist/{Topbar-VdVqOT-8.js → Topbar-lnCz7TLm.js} +2 -2
- package/dist/{UILibrariesPanel-CaGLzB9c.cjs → UILibrariesPanel-LGbh-IZP.cjs} +1 -1
- package/dist/{UILibrariesPanel-raxCToMd.js → UILibrariesPanel-PP4QDQRZ.js} +4 -4
- package/dist/{UnsplashImages-cah1BRL_.cjs → UnsplashImages-5JbDig-S.cjs} +1 -1
- package/dist/{UnsplashImages-alt_doTy.js → UnsplashImages-Y0TGxNbH.js} +1 -1
- package/dist/UploadImages-Dh35M55S.js +134 -0
- package/dist/UploadImages-f6wPPJxc.cjs +1 -0
- package/dist/{add-page-modal-VmIvQ5ug.cjs → add-page-modal-j2foeVKa.cjs} +1 -1
- package/dist/{add-page-modal-OH7DL-Yz.js → add-page-modal-sKH5SHMa.js} +4 -4
- package/dist/{confirm-alert-rYsxlfR4.cjs → confirm-alert-C3wsf6lk.cjs} +1 -1
- package/dist/{confirm-alert-m85JJlQi.js → confirm-alert-pGxJwZ2Q.js} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +2 -2
- package/dist/{delete-page-modal--g92Sj1h.js → delete-page-modal-4Tp_VPx1.js} +3 -3
- package/dist/{delete-page-modal-uSFaC2aS.cjs → delete-page-modal-XObwAnNB.cjs} +1 -1
- package/dist/email.cjs +1 -1
- package/dist/email.js +2 -2
- package/dist/{form-G3PqS2Gc.cjs → form-D9cWMUJ4.cjs} +1 -1
- package/dist/{form-MSL4CDff.js → form-pya-o19L.js} +1 -1
- package/dist/{index-yVCgnTlS.js → index-1teL5Lld.js} +3 -3
- package/dist/{index-4C2qT6ju.cjs → index-849lneVZ.cjs} +1 -1
- package/dist/{index-Phf9F3An.cjs → index-8Fxmy4tt.cjs} +42 -42
- package/dist/{index-uLn8W3eR.js → index-TzLilp-0.js} +99 -100
- package/dist/{index--t_K8Sw6.js → index-ZZTdYO7r.js} +17 -13
- package/dist/{index-0FIxW0gR.cjs → index-cH1CfTbV.cjs} +1 -1
- package/dist/{page-viewer-hBsE440V.js → page-viewer-Q-eOjWmS.js} +7 -7
- package/dist/{page-viewer-yIl2jRO8.cjs → page-viewer-tNzhbu_E.cjs} +1 -1
- package/dist/{project-general-setting-NFCzMKqN.cjs → project-general-setting-9fI_iZ_Q.cjs} +1 -1
- package/dist/{project-general-setting-9AGMKDNq.js → project-general-setting-uDDo2ktT.js} +4 -4
- package/dist/{project-seo-setting-3kFJ77jY.js → project-seo-setting-PXJe5SSV.js} +2 -2
- package/dist/{project-seo-setting-C3ilIIeM.cjs → project-seo-setting-rjrO9KDR.cjs} +1 -1
- package/dist/{single-page-detail-5qDQmlL-.js → single-page-detail-0ipAHwTX.js} +11 -11
- package/dist/{single-page-detail-wwJYm5lF.cjs → single-page-detail-s_kkO9Zj.cjs} +1 -1
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +3 -3
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +42 -42
- package/package.json +1 -1
- package/dist/CanvasArea-NLbaLcFM.cjs +0 -59
- package/dist/CanvasArea-akw7npWW.js +0 -1259
- package/dist/ListTree-Njsk1AzL.cjs +0 -1
- package/dist/UploadImages-5dRETWCo.cjs +0 -1
- package/dist/UploadImages-JqVL_aQd.js +0 -140
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";var ie=Object.defineProperty;var re=(e,t,n)=>t in e?ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var T=(e,t,n)=>(re(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-Z_BpKhVy.cjs"),p=require("react"),l=require("lodash-es"),R=require("@radix-ui/react-icons"),o=require("./index-cH1CfTbV.cjs"),F=require("./index-8Fxmy4tt.cjs"),U=require("react-i18next"),k=require("jotai"),le=require("lucide-react"),Y=require("react-dom"),C=require("prop-types"),ae=require("react-quill"),L=require("./atoms-a0H_593V.cjs"),ce=require("@floating-ui/dom"),V=require("@floating-ui/react-dom"),de=require("@react-hookz/web"),ue=require("flagged"),pe=require("@tailwindcss/typography"),xe=require("@tailwindcss/forms"),me=require("@tailwindcss/aspect-ratio"),ge=require("tailwindcss-palette-generator"),he=require("tailwind-merge"),H=require("./MODIFIERS-mVmfEGgo.cjs"),fe=require("@chaibuilder/runtime"),G=require("lodash"),je=require("react-wrap-balancer"),Ee=require("re-resizable");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("clsx");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("./Functions-N3yhPYKY.cjs");require("tree-model");require("i18next");require("react-hotkeys-hook");require("./index--mLLy7QQ.cjs");const ye=()=>{const{hasUndo:e,hasRedo:t,undo:n,redo:r}=o.useUndoManager();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(o.Button,{disabled:!e(),size:"sm",onClick:n,className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(R.ResetIcon,{})}),s.jsxRuntimeExports.jsx(o.Button,{disabled:!t(),onClick:r,size:"sm",className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(R.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function ke(){const[e,t]=o.useDarkMode();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(R.SunIcon,{className:"size-4 shrink-0"}),s.jsxRuntimeExports.jsx(o.Switch,{id:"dark-mode-switch",checked:e,onCheckedChange:()=>{t(!e)},className:`${e?"bg-violet-600":"bg-violet-300"} relative ml-2 inline-flex h-[20px] w-[40px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,children:s.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${e?"translate-x-5":"translate-x-0"} pointer-events-none -mt-px inline-block h-[18px] w-[20px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`})}),s.jsxRuntimeExports.jsx(F.FaMoon,{className:"size-4 ml-3 shrink-0"})]})}const X=({landscape:e=!1})=>s.jsxRuntimeExports.jsxs("svg",{className:e?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[s.jsxRuntimeExports.jsx("g",{strokeWidth:0}),s.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),s.jsxRuntimeExports.jsx("path",{d:"M10.65 0H2.349a.851.851 0 0 0-.851.852v11.299c0 .47.382.852.851.852h8.3a.851.851 0 0 0 .851-.852V.852A.851.851 0 0 0 10.65 0zM6.599 12.466a.367.367 0 1 1 0-.735.367.367 0 0 1 0 .735zm3.9-1.267H2.5V1h8.001v10.199z",style:{fill:"#000"}})]}),be=[{title:"mobile_xs_title",content:"mobile_xs_content",breakpoint:"xs",icon:s.jsxRuntimeExports.jsx(R.MobileIcon,{}),width:400},{title:"mobile_sm_title",content:"mobile_sm_content",breakpoint:"sm",icon:s.jsxRuntimeExports.jsx(R.MobileIcon,{className:"rotate-90"}),width:640},{title:"tablet_md_title",content:"tablet_md_content",breakpoint:"md",icon:s.jsxRuntimeExports.jsx(X,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:s.jsxRuntimeExports.jsx(X,{landscape:!0}),width:1024},{title:"desktop_xl_title",content:"desktop_xl_content",breakpoint:"xl",icon:s.jsxRuntimeExports.jsx(R.LaptopIcon,{}),width:1420},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",breakpoint:"2xl",icon:s.jsxRuntimeExports.jsx(R.DesktopIcon,{}),width:1920}],Z=({title:e,content:t,currentBreakpoint:n,breakpoint:r,width:c,icon:d,onClick:a})=>{const{t:i}=U.useTranslation();return s.jsxRuntimeExports.jsxs(o.HoverCard,{children:[s.jsxRuntimeExports.jsx(o.HoverCardTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx(o.Button,{onClick:()=>a(c),size:"sm",variant:r===n?"secondary":"ghost",children:d})}),s.jsxRuntimeExports.jsx(o.HoverCardContent,{className:"w-52 border-border",children:s.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:s.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[s.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:i(e)}),s.jsxRuntimeExports.jsx("p",{className:"text-xs",children:i(t)})]})})})]})},ve=()=>{const[,e,t]=o.useCanvasWidth(),[n,r]=o.useSelectedBreakpoints(),{t:c}=U.useTranslation(),d=o.useBuilderProp("breakpoints",be),a=i=>{n.includes(i)?n.length>2&&r(n.filter(u=>u!==i)):r(u=>[...u,i])};return d.length<4?s.jsxRuntimeExports.jsx("div",{className:"flex items-center rounded-md",children:l.map(d,i=>p.createElement(Z,{...i,onClick:t,key:i.breakpoint,currentBreakpoint:e}))}):s.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[l.map(d.filter(i=>l.includes(n,l.toUpper(i.breakpoint))),i=>p.createElement(Z,{...i,onClick:t,key:i.breakpoint,currentBreakpoint:e})),s.jsxRuntimeExports.jsxs(o.DropdownMenu,{children:[s.jsxRuntimeExports.jsx(o.DropdownMenuTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:s.jsxRuntimeExports.jsx(R.DotsVerticalIcon,{className:"scale-90 transform"})})}),s.jsxRuntimeExports.jsxs(o.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[s.jsxRuntimeExports.jsx(o.DropdownMenuLabel,{children:c("Breakpoints")}),s.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),l.map(d,i=>s.jsxRuntimeExports.jsx(o.DropdownMenuCheckboxItem,{disabled:i.breakpoint==="xs",onCheckedChange:()=>a(l.toUpper(i.breakpoint)),checked:l.includes(n,l.toUpper(i.breakpoint)),children:c(i.title)},i.breakpoint))]})]})]})},Re=()=>{const{t:e}=U.useTranslation(),{setNewBlocks:t}=o.useBlocksStoreUndoableActions(),[,n]=o.useSelectedBlockIds(),[,r]=o.useSelectedStylingBlocks(),c=p.useCallback(()=>{t([]),n([]),r([])},[t]);return s.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:s.jsxRuntimeExports.jsxs(o.AlertDialog,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsxs(o.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[s.jsxRuntimeExports.jsx(R.EraserIcon,{})," ",e("clear")]})}),s.jsxRuntimeExports.jsxs(o.AlertDialogContent,{className:"border-border",children:[s.jsxRuntimeExports.jsxs(o.AlertDialogHeader,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogTitle,{children:e("clear_canvas_title")}),s.jsxRuntimeExports.jsx(o.AlertDialogDescription,{children:e("clear_canvas_description")})]}),s.jsxRuntimeExports.jsxs(o.AlertDialogFooter,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogCancel,{children:e("cancel")}),s.jsxRuntimeExports.jsx(o.AlertDialogAction,{onClick:c,children:e("yes")})]})]})]})})},Se=()=>{const[e,t]=k.useAtom(o.aiAssistantActiveAtom);return o.useBuilderProp("askAiCallBack",null)?s.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsxRuntimeExports.jsxs(o.Label,{htmlFor:"ai-assistant",className:"flex items-center gap-x-1 text-sm text-yellow-600",children:[s.jsxRuntimeExports.jsx(le.SparklesIcon,{className:"w-4"}),"AI Assistant"]}),s.jsxRuntimeExports.jsx(o.Switch,{className:"scale-90",checked:e,onCheckedChange:r=>{t(r)},id:"ai-assitantt"})]}):null},Ce=()=>{const e=o.useBuilderProp("darkMode",!0),[t]=o.useCanvasZoom();return s.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[s.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[s.jsxRuntimeExports.jsx(ve,{}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),e?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(ke,{}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"})]}):null,s.jsxRuntimeExports.jsxs("div",{className:"flex w-12 cursor-not-allowed items-center justify-center gap-x-1 space-x-0 font-medium text-gray-400",children:[s.jsxRuntimeExports.jsx(R.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",s.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[l.round(t,0),"%"]})]}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(ye,{})]}),s.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[s.jsxRuntimeExports.jsx(Re,{}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(Se,{})]})]})},we=`<!doctype html>
|
|
2
|
+
<html lang="en" dir="__HTML_DIR__" class="scroll-smooth h-full overflow-y-auto">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"><\/script>
|
|
7
|
+
<style>
|
|
8
|
+
html { height: 100%; overflow:auto; }
|
|
9
|
+
body { height: 100%; }
|
|
10
|
+
.air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
|
|
11
|
+
.air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
|
|
12
|
+
body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
|
|
13
|
+
-moz-user-select: none;-ms-user-select: none; user-select: none; }
|
|
14
|
+
html{
|
|
15
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
16
|
+
scrollbar-width: none; /* Firefox */
|
|
17
|
+
}
|
|
18
|
+
/** IMPORTANT: Make fields content editable in SAFARI */
|
|
19
|
+
[contenteditable] {-webkit-user-select: text;user-select: text;}
|
|
20
|
+
|
|
21
|
+
html::-webkit-scrollbar { width: 0 !important }
|
|
22
|
+
.aspect-auto{aspect-ratio: auto;}
|
|
23
|
+
.aspect-square{aspect-ratio: 1/1;}
|
|
24
|
+
.aspect-video{aspect-ratio: 16/9;}
|
|
25
|
+
.dragging [data-dnd="leaf"] { pointer-events: none; } .dragging [data-dnd="leaf"] * { pointer-events: none; }
|
|
26
|
+
.dragging [data-dnd="ignore"], .dragging [data-dnd="ignore"] * { pointer-events: none; }
|
|
27
|
+
a{ pointer-events: none !important; }
|
|
28
|
+
[contenteditable="true"], [contenteditable="true"] * { cursor: text !important; }
|
|
29
|
+
[contenteditable="true"] {
|
|
30
|
+
outline: none;
|
|
31
|
+
box-shadow: 0 0 0px 4px rgba(36, 150, 255, 0.2);
|
|
32
|
+
-webkit-user-select: text;
|
|
33
|
+
-moz-user-select: text;
|
|
34
|
+
user-select: text;
|
|
35
|
+
}
|
|
36
|
+
.frame-root .frame-content { height: 100%; }
|
|
37
|
+
[data-drop="yes"] { outline: 2px dashed orange !important; outline-offset: -2px }
|
|
38
|
+
[data-dnd="yes"] { pointer-events: auto !important}
|
|
39
|
+
[data-dnd="no"] { pointer-events: none !important; }
|
|
40
|
+
[data-dnd-dragged="yes"] { opacity: 0.6; pointer-events: none; }
|
|
41
|
+
[data-dnd-dragged="no"] { opacity: 1; pointer-events: auto !important; }
|
|
42
|
+
[force-show] { display: block !important; }
|
|
43
|
+
</style>
|
|
44
|
+
<style id="hidden-blocks"></style>
|
|
45
|
+
<style id="selected-block"></style>
|
|
46
|
+
<style id="selected-styling-block"></style>
|
|
47
|
+
<style id="highlighted-block"></style>
|
|
48
|
+
<style id="dragged-block"></style>
|
|
49
|
+
|
|
50
|
+
</head>
|
|
51
|
+
<body class="font-body antialiased h-full">
|
|
52
|
+
<div class="frame-root h-full"></div>
|
|
53
|
+
<script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
|
|
54
|
+
</body>
|
|
55
|
+
</html>`,Ae=e=>{const[t]=o.useCanvasWidth(),[,n]=o.useCanvasZoom(),[r,c]=p.useState({}),d=p.useCallback(()=>{const{width:a,height:i}=e;if(a<t){const u=parseFloat((a/t).toFixed(2).toString());let g={};const h=i*u;i&&(g={height:100+(i-h)/h*100+"%"}),c({position:"relative",top:0,transform:`scale(${u})`,transformOrigin:"top left",...g,maxWidth:"none"}),n(u*100)}else c({}),n(100)},[t,e,n]);return p.useEffect(()=>{d()},[t,e,n,d]),r};let ee,te;typeof document<"u"&&(ee=document);typeof window<"u"&&(te=window);const se=p.createContext({document:ee,window:te}),P=()=>p.useContext(se),{Provider:Be,Consumer:rt}=se;class ne extends p.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return p.Children.only(this.props.children)}}T(ne,"propTypes",{children:C.element.isRequired,contentDidMount:C.func.isRequired,contentDidUpdate:C.func.isRequired});class $ extends p.Component{constructor(n,r){super(n,r);T(this,"setRef",n=>{this.nodeRef.current=n;const{forwardedRef:r}=this.props;typeof r=="function"?r(n):r&&(r.current=n)});T(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});T(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=p.createRef(),this.state={iframeLoaded:!1}}componentDidMount(){this._isMounted=!0,this.getDoc()&&this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded",this.handleLoad)}componentWillUnmount(){this._isMounted=!1,this.nodeRef.current.removeEventListener("DOMContentLoaded",this.handleLoad)}getDoc(){return this.nodeRef.current?this.nodeRef.current.contentDocument:null}getMountTarget(){const n=this.getDoc();return this.props.mountTarget?n.querySelector(this.props.mountTarget):n.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const n=this.getDoc();if(!n)return null;const r=this.props.contentDidMount,c=this.props.contentDidUpdate,d=n.defaultView||n.parentView,a=s.jsxRuntimeExports.jsx(ne,{contentDidMount:r,contentDidUpdate:c,children:s.jsxRuntimeExports.jsx(Be,{value:{document:n,window:d},children:s.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),i=this.getMountTarget();return[Y.createPortal(this.props.head,this.getDoc().head),Y.createPortal(a,i)]}render(){const n={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete n.head,delete n.initialContent,delete n.mountTarget,delete n.contentDidMount,delete n.contentDidUpdate,delete n.forwardedRef,s.jsxRuntimeExports.jsx("iframe",{...n,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}T($,"propTypes",{style:C.object,head:C.node,initialContent:C.string,mountTarget:C.string,contentDidMount:C.func,contentDidUpdate:C.func,children:C.oneOfType([C.element,C.arrayOf(C.element)])}),T($,"defaultProps",{style:{},head:null,children:void 0,mountTarget:void 0,contentDidMount:()=>{},contentDidUpdate:()=>{},initialContent:'<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'});const Ie=p.forwardRef((e,t)=>s.jsxRuntimeExports.jsx($,{...e,forwardedRef:t}));function W(e){const t=window.getComputedStyle(e),n=t.display;if(n==="flex"||n==="inline-flex"){const r=t.flexDirection;return r==="column"||r==="column-reverse"?"vertical":"horizontal"}else if(n==="grid"){const r=t.gridAutoFlow,c=t.gridTemplateRows,d=t.gridTemplateColumns;return r.includes("column")||c.split(" ").length>d.split(" ").length?"vertical":"horizontal"}else if(n==="block"||n==="inline-block")return"vertical";return"horizontal"}let E=null,A=[],q=null,O=null;const Q=(e,t,n)=>{if(!E||!e)return;const r=E==null?void 0:E.getElementById("placeholder"),c=A.map(([u])=>u),d=c.reduce((u,g)=>Math.abs(g-n)<Math.abs(u-n)?g:u,0),a=c.indexOf(d);if(!A[a])return;const i=A[a];r.style.width=t==="vertical"?i[2]+"px":"2px",r.style.height=t==="vertical"?"2px":i[2]+"px",r.style.display="block",t==="vertical"?(r.style.top=i[0]+"px",r.style.left=i[1]+"px"):(r.style.top=i[1]+"px",r.style.left=i[0]+"px")};function _e(e,t){let n=0,r=1/0;return t.forEach((c,d)=>{const a=Math.abs(c[0]-e);a<r&&(r=a,n=d)}),n}const De=e=>{const n=W(e)==="horizontal";A=[],Array.from(e.children).forEach((r,c)=>{if(r.classList.contains("pointer-events-none"))return;const d=n?r.offsetLeft:r.offsetTop,a=n?[r.offsetTop,r.clientHeight]:[r.offsetLeft,r.clientWidth];if(A.push([d,a[0],a[1]]),c===e.children.length-1){const i=n?r.offsetLeft+r.clientWidth:r.offsetTop+r.clientHeight;A.push([i,a[0],a[1]])}})},Te=l.throttle(e=>{var c;const t=e.target,n=W(t),r=(c=E==null?void 0:E.defaultView)==null?void 0:c.scrollY;n==="vertical"?Q(t,n,e.clientY+r):Q(t,n,e.clientX)},0);function J(){const e=E==null?void 0:E.getElementById("placeholder");e.style.display="none",Me("pointer-none"),qe()}function Me(e){(E==null?void 0:E.querySelectorAll(`.${e}`)).forEach(n=>{n.classList.remove(e)})}function qe(){const e=E==null?void 0:E.querySelector('[data-drop="yes"]');e&&e.removeAttribute("data-drop")}const Ne=()=>{const{document:e}=P(),[t,n]=k.useAtom(o.draggingFlagAtom),{addCoreBlock:r}=o.useAddBlock(),[,c]=o.useHighlightBlockId(),[,d]=o.useSelectedBlockIds(),{moveBlocks:a}=o.useBlocksStoreUndoableActions(),[,i]=k.useAtom(o.draggedBlockIdAtom),[u,g]=k.useAtom(L.draggedBlockAtom),[,h]=k.useAtom(L.dropTargetAtom),x=()=>{J(),n(!1),i(""),g(null),h(null),A=[]};return E=e,{isDragging:t,onDragOver:m=>{m.preventDefault(),m.stopPropagation(),Te(m)},onDrop:m=>{var B;q==null||q.classList.remove("drop-target");const f=q,b=W(f)==="vertical"?m.clientY+((B=E==null?void 0:E.defaultView)==null?void 0:B.scrollY):m.clientX;O=_e(b,A);const v=u,S=f.getAttribute("data-block-id");if(v===q){x();return}if(!l.has(v,"_id")){r(v,S==="canvas"?null:S,O),setTimeout(x,300);return}let w=f.getAttribute("data-block-id");w===null&&(w=m.target.parentElement.getAttribute("data-block-id")),a([v._id],w,O),x(),setTimeout(J,300)},onDragEnter:m=>{const f=m,y=f.target;q=y;const b=y.getAttribute("data-block-id");h(b),f.stopPropagation(),f.preventDefault(),A=[],De(y),y.classList.add("drop-target"),n(!0),c(""),d([])}}};function K(e){return e.getAttribute("data-block-id")?e:e.closest("[data-block-id]")}function Le(e){e.container.innerHTML="",e.container.parentNode.removeChild(e.container);var t=document.querySelector(".ql-toolbar");t&&t.parentNode.removeChild(t),e=null}const Fe=()=>{const e=["Heading","Paragraph","Text","Link","Span","Button"],t=o.useUpdateBlocksProps(),[,n]=o.useHighlightBlockId(),[r,c]=k.useAtom(o.inlineEditingActiveAtom);return d=>{var x;if(r)return;const a=K(d.target),i=a.getAttribute("data-block-type");if(!i||!e.includes(i))return;const u=a.cloneNode(!0);a.style.display="none",Array.from(u.attributes).forEach(m=>{m.name!=="class"&&u.removeAttribute(m.name)}),i==="Text"&&(u.style.display="inline-block"),a.parentNode.insertBefore(u,a.nextSibling);const g=new ae.Quill(u,{placeholder:"Type here..."});function h(){const m=g.getText(0,g.getLength());t([a.getAttribute("data-block-id")],{content:m}),a.removeAttribute("style"),u.removeEventListener("blur",h,!0),Le(g),c(""),n("")}u.addEventListener("blur",h,!0),u.addEventListener("keydown",m=>{(m.key==="Enter"||m.key==="Escape")&&h()}),g.focus(),(x=u.querySelector(".ql-clipboard"))==null||x.remove(),c(a.getAttribute("data-block-id"))}},He=()=>{const[,e]=o.useSelectedStylingBlocks(),[t,n]=o.useSelectedBlockIds(),[,r]=o.useHighlightBlockId(),[c]=k.useAtom(o.inlineEditingActiveAtom),[d]=k.useAtom(o.treeRefAtom);return a=>{if(c)return;a.stopPropagation();const i=K(a.target);if(i!=null&&i.getAttribute("data-block-id")&&(i==null?void 0:i.getAttribute("data-block-id"))==="container"){n([]),e([]),r("");return}if(i!=null&&i.getAttribute("data-block-parent")){const u=i.getAttribute("data-style-prop"),g=i.getAttribute("data-style-id"),h=i.getAttribute("data-block-parent");t.includes(h)||d==null||d.closeAll(),e([{id:g,prop:u,blockId:h}]),n([h])}else if(i!=null&&i.getAttribute("data-block-id")){let u=i.getAttribute("data-block-id");t.includes(u)||d==null||d.closeAll(),e([]),n([u])}r("")}},Pe=l.throttle((e,t)=>{const n=K(e.target);n!=null&&n.getAttribute("data-style-id")&&t(n.getAttribute("data-style-id"))},100),Oe=()=>{const[,e]=o.useHighlightBlockId(),[t]=k.useAtom(o.inlineEditingActiveAtom);return n=>{t||Pe(n,e)}},$e=({children:e})=>{const{document:t}=P(),[n]=o.useSelectedBlockIds(),[r,c]=o.useSelectedStylingBlocks();p.useEffect(()=>{setTimeout(()=>{if(!l.isEmpty(r))return;const g=oe(t,l.first(n));if(g){const h=g.getAttribute("data-style-prop");if(h){const x=g.getAttribute("data-style-id"),m=g.getAttribute("data-block-parent");c([{id:x,prop:h,blockId:m}])}}},100)},[t,n,c,r]);const d=Fe(),a=He(),i=Oe(),u=Ne();return s.jsxRuntimeExports.jsx("div",{"data-block-id":"canvas",id:"canvas",onClick:a,onDoubleClick:d,onMouseMove:i,...l.omit(u,"isDragging"),className:"relative mb-5 h-full max-w-full px-1 "+(u.isDragging?"dragging":""),children:e})},oe=(e,t)=>e.querySelector(`[data-block-id="${t}"]`),ze=()=>{const{document:e}=P();return F.useKeyEventWatcher(e),null},Ue=({block:e,label:t})=>{const[,n]=o.useSelectedBlockIds(),[,r]=o.useHighlightBlockId(),[,c]=k.useAtom(L.draggedBlockAtom),d=ue.useFeature("dnd");return s.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:d?"true":"false",onDragStart:a=>{a.dataTransfer.setData("text/plain",JSON.stringify(l.pick(e,["_id","_type","_name"]))),c(e),setTimeout(()=>{n([]),r(null)},200)},children:[s.jsxRuntimeExports.jsx(R.DragHandleDots2Icon,{}),t]})},We=({selectedBlockElement:e,block:t})=>{const n=o.useRemoveBlocks(),r=o.useDuplicateBlocks(),[,c]=o.useSelectedBlockIds(),[,d]=o.useSelectedStylingBlocks(),[a]=k.useAtom(o.inlineEditingActiveAtom),{floatingStyles:i,refs:u,update:g}=V.useFloating({placement:"top-start",middleware:[V.shift(),ce.flip()],elements:{reference:e}});de.useResizeObserver(e,()=>g(),e!==null);const h=l.get(t,"_parent",null),x=l.isEmpty(l.get(t,"_name",""))?l.get(t,"_type",""):l.get(t,"_name","");return!e||!t||a?null:s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:s.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:u.setFloating,style:i,onClick:m=>{m.stopPropagation(),m.preventDefault()},onKeyDown:m=>m.stopPropagation(),className:"z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[s.jsxRuntimeExports.jsx(Ue,{label:x,block:t}),s.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1",children:[h&&s.jsxRuntimeExports.jsx(R.ArrowUpIcon,{className:"hover:scale-105",onClick:()=>{d([]),c([h])}}),o.canDuplicateBlock(l.get(t,"_type",""))?s.jsxRuntimeExports.jsx(R.CopyIcon,{className:"hover:scale-105",onClick:()=>r([t==null?void 0:t._id])}):null,o.canDeleteBlock(l.get(t,"_type",""))?s.jsxRuntimeExports.jsx(R.TrashIcon,{className:"hover:scale-105",onClick:()=>n([t==null?void 0:t._id])}):null]})]})})},Ke=({model:e})=>{const[t]=o.useBrandingOptions(),[n]=o.useSelectedBlockIds(),[r]=o.useDarkMode(),[c]=o.useHighlightBlockId(),[d]=o.useSelectedStylingBlocks(),[a]=k.useAtom(o.draggedBlockIdAtom),{document:i,window:u}=P(),[g]=p.useState(i==null?void 0:i.getElementById("highlighted-block")),[h]=p.useState(i==null?void 0:i.getElementById("selected-block")),[x]=p.useState(i==null?void 0:i.getElementById("selected-styling-block")),[m]=p.useState(i==null?void 0:i.getElementById("dragged-block"));p.useEffect(()=>{r?i==null||i.documentElement.classList.add("dark"):i==null||i.documentElement.classList.remove("dark")},[r,i]);const f=l.get(t,"headingFont","DM Sans"),y=l.get(t,"bodyFont","DM Sans");return p.useEffect(()=>{const b=l.get(t,"primaryColor","#000"),v=l.get(t,"secondaryColor","#FFF"),S=l.get(t,"bodyBgLightColor","#fff"),w=l.get(t,"bodyBgDarkColor","#000"),B=l.get(t,"bodyTextDarkColor","#000"),I=l.get(t,"bodyTextLightColor","#fff"),M=ge([{color:b,name:"primary"},{color:v,name:"secondary"}]),N={"bg-light":S,"bg-dark":w,"text-dark":B,"text-light":I},j=l.get(t,"roundedCorners","0");!u||!u.tailwind||(u.tailwind.config={darkMode:"class",theme:{extend:{container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},fontFamily:{heading:[f],body:[y]},borderRadius:{DEFAULT:`${j||"0"}px`},colors:{...N,...M}}},plugins:[pe,xe,me]})},[t,u,f,y]),p.useEffect(()=>{h&&(h.textContent=`${l.map(n,b=>`[data-block-id="${b}"]`).join(",")}{
|
|
56
|
+
outline: 1px solid ${n.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
|
|
57
|
+
}`)},[n,h]),p.useEffect(()=>{if(!a){m.textContent="";return}m.textContent=`[data-block-id="${a}"]{ pointer-events: none !important; opacity: 0.2 !important}`},[a]),p.useEffect(()=>{g&&(g.textContent=c?`[data-style-id="${c}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[c,n,g]),p.useEffect(()=>{x&&(x.textContent=`${l.map(d,({id:b})=>`[data-style-id="${b}"]`).join(",")}{
|
|
58
|
+
outline: 1px solid #42a1fc !important; outline-offset: -1px;
|
|
59
|
+
}`)},[d,x]),p.useEffect(()=>{const b=l.get(t,"bodyTextLightColor","#64748b"),v=l.get(t,"bodyTextDarkColor","#94a3b8"),S=l.get(t,"bodyBgLightColor","#FFFFFF"),w=l.get(t,"bodyBgDarkColor","#0f172a");i.body.className=`font-body antialiased text-[${b}] bg-[${S}] dark:text-[${v}] dark:bg-[${w}]`},[t,i,e]),e==="page"?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[f&&s.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${f.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),y&&f!==y&&s.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${y.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),f&&s.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${f}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}`})]}):null},Ye=()=>k.useAtom(o.canvasSettingsAtom),Ve=(e,t)=>{const n=["xs","sm","md","lg","xl","2xl"],r=n.indexOf(t),c=e.split(" ");let d=new Array(n.length).fill(!1);for(const a of c){let[i,u]=a.split(":");u||(u=i,i="xs");const g=n.indexOf(i);if(g<=r){const h=["block","flex","inline","inline-block","inline-flex","grid","table"],x=["hidden"];if(h.includes(u))for(let m=g;m<n.length;m++)d[m]=!0;else if(x.includes(u))for(let m=g;m<n.length;m++)d[m]=!1}}return d[r]},Ge=e=>{const t={};return Object.keys(e).forEach(n=>{l.isString(e[n])&&e[n].startsWith(H.SLOT_KEY)&&(t[n]=e[n].replace(H.SLOT_KEY,"").split(","))}),t},Xe=l.memoize(e=>{const t=e.replace(H.STYLES_KEY,"").split(",");return he.twMerge(t[0],t[1])});function Ze(e,t){return l.get(e,`${t}_attrs`,{})}function Qe(e,t){const n={};return Object.keys(e).forEach(r=>{if(l.isString(e[r])&&e[r].startsWith(H.STYLES_KEY)){const c=Xe(e[r]),d=Ze(e,r);n[r]={className:c,"data-style-prop":r,"data-block-parent":e._id,"data-style-id":`${r}-${e._id}`,...d};const a=l.has(d,"x-show")||l.has(d,"x-if");a&&(n.__isHidden=a&&!Ve(c,t))}}),n}function Je(e,t){const n=l.get(e,"_bindings",{});return l.isEmpty(n)?{...e}:(l.each(n,(r,c)=>{l.isString(r)&&l.get(t,r,null)&&(e[c]=l.get(t,r,null))}),e)}function z({blocks:e}){const[t]=o.useBlocksStore(),[n]=k.useAtom(o.xShowBlocksAtom),[r]=k.useAtom(L.draggedBlockAtom),[c]=k.useAtom(L.dropTargetAtom),[,d]=o.useCanvasWidth(),[a]=Ye(),i=p.useCallback(x=>Qe(x,d),[d]),[u]=F.useChaiExternalData(),[g]=k.useAtom(o.inlineEditingActiveAtom),h=p.useCallback(x=>x.reduce((m,f)=>{const y=l.get(a,f,{});return{...m,...y}},{}),[a,t]);return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:p.Children.toArray(e.map((x,m)=>{if(g===x._id)return null;const f=Ge(x),y={};l.isEmpty(f)||Object.keys(f).forEach(M=>{y[M]=p.Children.toArray(f[M].map(N=>s.jsxRuntimeExports.jsx(z,{blocks:[l.find(t,{_id:N})]})))});const b=l.filter(t,{_parent:x._id});y.children=b.length?s.jsxRuntimeExports.jsx(z,{blocks:b}):null;const v=fe.getBlockComponent(x._type),S=l.get(v,"builderComponent",l.get(v,"component",null));if(l.isNull(S))return s.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${x==null?void 0:x._type} not registered -->`});const w=l.has(v,"getBlockStateFrom")?v==null?void 0:v.getBlockStateFrom(x,t):[],B=h(w),I=i(x);return l.get(I,"__isHidden",!1)&&!G.includes(n,x._id)?null:s.jsxRuntimeExports.jsx(p.Suspense,{children:p.createElement(S,{blockProps:{...G.includes(n,x._id)?{"force-show":""}:{},"data-block-id":x._id,"data-block-type":x._type,...r?{"data-dnd":o.canAcceptChildBlock(x._type,r==null?void 0:r._type)?"yes":"no","data-dnd-dragged":r._id===x._id?"yes":"no"}:{},...c===x._id?{"data-drop":"yes"}:{}},index:m,...Je(x,u),...l.omit(I,["__isHidden"]),...y,inBuilder:!0,blockState:B})})}))})}const et=()=>{const[e]=o.useBlocksStore(),t=l.isEmpty(e)?null:s.jsxRuntimeExports.jsx(F.BlocksExternalDataProvider,{children:s.jsxRuntimeExports.jsx(z,{blocks:l.filter(e,n=>l.isEmpty(n._parent))})});return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:t})},tt=(e,t)=>e.querySelector(`[data-style-id="${t}"]`),st=()=>{const[e]=k.useAtom(o.networkModeAtom),[t]=o.usePreviewMode(),[n]=o.useCanvasWidth(),[,r]=o.useSelectedBlockIds(),c=o.useSelectedBlock(),[,d]=o.useHighlightBlockId(),a=p.useRef(null),i=p.useRef(null),[u,g]=p.useState({width:0,height:0}),h=Ae(u),[x,m]=p.useState(0),[f,y]=p.useState([]),[,b]=p.useState([]),[,v]=k.useAtom(o.canvasIframeAtom),[S,w]=o.useSelectedStylingBlocks(),B=o.useBuilderProp("loading",!1),I=o.useBuilderProp("htmlDir","ltr");p.useEffect(()=>{const{clientWidth:j,clientHeight:_}=i.current;g({width:j,height:_}),x===0&&m(j)},[i,n,x]);const M=(j,_=0)=>{const{top:D}=j.getBoundingClientRect();return D+_>=0&&D-_<=window.innerHeight};p.useEffect(()=>{var j,_;if(c&&c.type!=="Multiple"&&a.current){const D=oe(a.current.contentDocument,c._id);D&&(M(D)||(_=(j=a.current)==null?void 0:j.contentWindow)==null||_.scrollTo({top:D.offsetTop,behavior:"smooth"}),y([D]))}},[c]),p.useEffect(()=>{if(!l.isEmpty(S)&&a.current){const j=tt(a.current.contentDocument,l.first(S).id);b(j?[j]:[null])}else b([null])},[S]);const N=p.useMemo(()=>{let j=we;return j=j.replace("__HTML_DIR__",I),e==="offline"&&(j=j.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),j=j.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),j=j.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),j},[e]);return s.jsxRuntimeExports.jsx("div",{onClick:()=>{r([]),w([])},onMouseLeave:()=>setTimeout(()=>d(""),300),className:"relative mx-auto h-full w-full overflow-hidden",style:x>0&&!l.isEmpty(h)?{width:t?"100%":x}:{},ref:i,children:s.jsxRuntimeExports.jsxs(Ie,{contentDidMount:()=>v(a.current),ref:a,id:"canvas-iframe",style:{width:`${n}px`,...h},className:"relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:N,children:[s.jsxRuntimeExports.jsx(ze,{}),s.jsxRuntimeExports.jsx(We,{block:c,selectedBlockElement:l.first(f)}),s.jsxRuntimeExports.jsx(Ke,{model:"page"}),s.jsxRuntimeExports.jsx(je.Provider,{children:s.jsxRuntimeExports.jsx($e,{children:B?s.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"})}):s.jsxRuntimeExports.jsx(et,{})})}),s.jsxRuntimeExports.jsx("br",{}),s.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"pointer-events-none absolute z-[99999] max-w-full bg-green-500 transition-transform"})]})})},nt=p.lazy(()=>Promise.resolve().then(()=>require("./CodeEditor-NuzOGqRn.cjs"))),ot=()=>{const[e]=o.useCodeEditor();return s.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsxRuntimeExports.jsx(Ce,{}),s.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full flex-col overflow-hidden bg-gray-100/40 px-2",children:[s.jsxRuntimeExports.jsx(p.Suspense,{fallback:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"}),children:s.jsxRuntimeExports.jsx(F.ErrorBoundary,{children:s.jsxRuntimeExports.jsx(st,{})})}),e?s.jsxRuntimeExports.jsx(p.Suspense,{fallback:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"}),children:s.jsxRuntimeExports.jsx(Ee.Resizable,{enable:{top:!0,bottom:!1},className:"max-h-[400px] min-h-[200px]",children:s.jsxRuntimeExports.jsx(nt,{})})}):null]})]})};exports.default=ot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),b=require("@monaco-editor/react"),i=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),b=require("@monaco-editor/react"),i=require("./index-cH1CfTbV.cjs"),k=require("react-i18next"),n=require("react"),C=require("@radix-ui/react-icons"),E=require("@react-hookz/web");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("lodash-es");require("./MODIFIERS-mVmfEGgo.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("jotai");require("tree-model");const a=u=>{const s=document.createElement("div");return s.innerHTML=u,s.innerHTML};function R(){const{t:u}=k.useTranslation(),[s,d]=n.useState(!1),[l,x]=n.useState(""),[r,o]=i.useCodeEditor(),[c]=i.useSelectedBlockIds(),q=i.useUpdateBlocksProps(),m=i.useUpdateBlocksPropsRealtime(),p=E.useThrottledCallback(t=>{const h=a(t);m([r.blockId],{[r.blockProp]:h})},[],300),j=n.useCallback(()=>{if(s){const t=a(l);q([r.blockId],{[r.blockProp]:t})}},[s,l]);n.useEffect(()=>{c.includes(r==null?void 0:r.blockId)||(j(),o(null))},[c]);const f=()=>{o(null)};return e.jsxRuntimeExports.jsxs("div",{className:"h-full rounded-t-lg border-t-4 border-black bg-black text-white",children:[e.jsxRuntimeExports.jsx("button",{onClick:f,className:"fixed inset-0 z-[100000] cursor-default bg-gray-400/20"}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100001] h-full w-full flex-col gap-y-1",children:[e.jsxRuntimeExports.jsxs("div",{className:"-mt-1 flex items-center justify-between px-2 py-2",children:[e.jsxRuntimeExports.jsxs("h3",{className:"space-x-3 text-sm font-semibold",children:[e.jsxRuntimeExports.jsx("span",{children:u("HTML Code Editor |")}),e.jsxRuntimeExports.jsx("span",{className:"text-xs text-gray-400",children:u("Scripts will be only executed in preview and live mode.")})]}),e.jsxRuntimeExports.jsx("div",{className:"flex gap-x-2",children:e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>o(null),size:"sm",variant:"destructive",className:"h-6 w-fit",children:e.jsxRuntimeExports.jsx(C.Cross2Icon,{})})})]}),e.jsxRuntimeExports.jsx(b,{onMount:t=>{t.setValue(r.initialCode)},onChange:t=>{d(!0),x(t),p(t)},height:"100%",defaultLanguage:"html",theme:"vs-dark",defaultValue:"",options:{minimap:{enabled:!1}}})]})]})}exports.default=R;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
2
|
import k from "@monaco-editor/react";
|
|
3
|
-
import { $ as C, r as j, am as v, an as g, B as y } from "./index-
|
|
3
|
+
import { $ as C, r as j, am as v, an as g, B as y } from "./index-TzLilp-0.js";
|
|
4
4
|
import { useTranslation as N } from "react-i18next";
|
|
5
5
|
import { useState as a, useCallback as T, useEffect as E } from "react";
|
|
6
6
|
import { Cross2Icon as w } from "@radix-ui/react-icons";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { Q as h, az as f, aA as j, aB as y, aC as v, aD as P } from "./index-
|
|
2
|
+
import { Q as h, az as f, aA as j, aB as y, aC as v, aD as P } from "./index-TzLilp-0.js";
|
|
3
3
|
import { sortBy as C, filter as b, get as w, isEmpty as m, find as n, capitalize as N, map as S } from "lodash-es";
|
|
4
4
|
import { toast as k } from "sonner";
|
|
5
5
|
import { useEffect as p } from "react";
|
|
6
|
-
import { a as B, u as E, c as T, d as z } from "./index-
|
|
6
|
+
import { a as B, u as E, c as T, d as z } from "./index-1teL5Lld.js";
|
|
7
7
|
import { BriefcaseIcon as A } from "lucide-react";
|
|
8
8
|
import { useTranslation as D } from "react-i18next";
|
|
9
9
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
@@ -40,7 +40,7 @@ import "@chaibuilder/runtime";
|
|
|
40
40
|
import "jotai";
|
|
41
41
|
import "@react-hookz/web";
|
|
42
42
|
import "tree-model";
|
|
43
|
-
import "./index
|
|
43
|
+
import "./index-ZZTdYO7r.js";
|
|
44
44
|
import "i18next";
|
|
45
45
|
import "@floating-ui/react-dom";
|
|
46
46
|
import "flagged";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),s=require("./index-cH1CfTbV.cjs"),i=require("lodash-es"),j=require("sonner"),l=require("react"),o=require("./index-849lneVZ.cjs"),p=require("lucide-react"),f=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("./MODIFIERS-mVmfEGgo.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("jotai");require("@react-hookz/web");require("tree-model");require("./index-8Fxmy4tt.cjs");require("i18next");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");require("./index--mLLy7QQ.cjs");require("./html-to-json-ndxaXRT8.cjs");require("himalaya");require("lodash");const E=()=>{const{data:t}=o.useProject(),{data:u,isLoading:x}=o.usePages(),{saveState:d}=s.useSavePage(),m=o.useChangePage(),{t:q}=f.useTranslation(),[n,a]=o.useCurrentPage(),c=i.sortBy(i.filter(u,{type:"STATIC"}),r=>i.get(r,"uuid")===(t==null?void 0:t.homepage)?0:1);l.useEffect(()=>{!i.isEmpty(u)&&t.homepage&&!i.find(u,{uuid:n})&&a(t.homepage)},[n,u,t,a]),l.useEffect(()=>()=>a(null),[a]);const g=r=>{if(d!=="SAVED")j.toast.error(q("You have unsaved changes. Please save before changing the page."));else{const h=i.find(c,{uuid:r});m(h)}};return x||i.isEmpty(n)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 py-1 pr-0 text-gray-700 dark:border-gray-700 dark:bg-gray-800","aria-label":"Breadcrumb",children:e.jsxRuntimeExports.jsxs("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[e.jsxRuntimeExports.jsx("li",{className:"inline-flex items-center",children:e.jsxRuntimeExports.jsxs("div",{className:"inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400",children:[e.jsxRuntimeExports.jsx(p.BriefcaseIcon,{className:"mr-2 h-4 w-4"}),i.capitalize(t.name)]})}),e.jsxRuntimeExports.jsx("li",{"aria-current":"page",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("svg",{className:"mx-1 h-3 w-3 text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:e.jsxRuntimeExports.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),e.jsxRuntimeExports.jsxs(s.Select,{value:n||"",onValueChange:g,children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(s.SelectContent,{className:"z-[999]",children:i.map(c,r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=E;
|