@chaibuilder/sdk 1.2.56 → 1.2.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/{AddBlocks-HeYXoex4.js → AddBlocks-05ZH2Suu.js} +46 -50
- package/dist/AddBlocks-MH_fqSRf.cjs +1 -0
- package/dist/CanvasArea-7nhpzTI-.cjs +59 -0
- package/dist/{CanvasArea-CqILE5PR.js → CanvasArea-kMGTLtCw.js} +409 -394
- package/dist/CodeEditor-vECReGwz.cjs +1 -0
- package/dist/{CodeEditor-kxV5RCpd.js → CodeEditor-zYBqhBv3.js} +33 -39
- package/dist/{CurrentPage-IrFGAb7n.js → CurrentPage-VksVpchp.js} +26 -25
- package/dist/CurrentPage-caSpOhR9.cjs +1 -0
- package/dist/{ListTree-0n_G8NJx.js → ListTree-0iy8aBgI.js} +82 -65
- package/dist/ListTree-Njsk1AzL.cjs +1 -0
- package/dist/{PagesPanel-RYBf0Yct.js → PagesPanel-2AEsdqhe.js} +20 -19
- package/dist/PagesPanel-tb0qtxz4.cjs +1 -0
- package/dist/{ProjectPanel-Zagx6l3Q.js → ProjectPanel-IHFBvE5H.js} +25 -24
- package/dist/ProjectPanel-gmBUq2NI.cjs +1 -0
- package/dist/{Settings-RLDTFFf8.js → Settings-r9IvIq0G.js} +405 -396
- package/dist/Settings-uVLt1oiz.cjs +1 -0
- package/dist/{SidePanels-ao969pMV.js → SidePanels-2fD5UfH5.js} +89 -88
- package/dist/SidePanels-rhTLiLy6.cjs +1 -0
- package/dist/ThemeConfiguration-PvMN3j6h.cjs +1 -0
- package/dist/{ThemeConfiguration-S7yArRMp.js → ThemeConfiguration-ab7lbA2y.js} +18 -24
- package/dist/Topbar-1JTIu0uN.cjs +1 -0
- package/dist/{Topbar-B8u0whpc.js → Topbar-x4gslZ4T.js} +39 -38
- package/dist/UILibrariesPanel-CaGLzB9c.cjs +1 -0
- package/dist/UILibrariesPanel-raxCToMd.js +216 -0
- package/dist/{UnsplashImages-wWRifkCp.js → UnsplashImages-alt_doTy.js} +42 -47
- package/dist/UnsplashImages-cah1BRL_.cjs +1 -0
- package/dist/UploadImages-5dRETWCo.cjs +1 -0
- package/dist/{UploadImages-lUvZhW_j.js → UploadImages-JqVL_aQd.js} +32 -38
- package/dist/add-page-modal-9e6JkoxV.cjs +1 -0
- package/dist/{add-page-modal-04b4l2zu.js → add-page-modal-DbmbwG7V.js} +29 -28
- package/dist/{confirm-alert-FX5030eR.js → confirm-alert-m85JJlQi.js} +15 -21
- package/dist/confirm-alert-rYsxlfR4.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +44 -43
- package/dist/delete-page-modal-YtRcj7eK.cjs +1 -0
- package/dist/{delete-page-modal-1u9CyAIP.js → delete-page-modal-nIBA3zCg.js} +22 -21
- package/dist/email.cjs +1 -1
- package/dist/email.js +19 -19
- package/dist/form-G3PqS2Gc.cjs +1 -0
- package/dist/{form-HRdEJjVq.js → form-MSL4CDff.js} +3 -3
- package/dist/{html-to-json-OnIZDDXw.js → html-to-json-_01DXd-a.js} +37 -36
- package/dist/html-to-json-ndxaXRT8.cjs +1 -0
- package/dist/index-0FIxW0gR.cjs +1 -0
- package/dist/index-5IJnVFyU.cjs +206 -0
- package/dist/index-7zSzDmAA.cjs +1 -0
- package/dist/{index-vfmO3y2d.js → index-b4Wjumon.js} +19 -19
- package/dist/{ChaiBuilderEditor-tkzS851D.js → index-grcmKbfu.js} +14660 -17763
- package/dist/index-uLn8W3eR.js +3145 -0
- package/dist/lib.cjs +2 -2
- package/dist/lib.js +17 -16
- package/dist/mockServiceWorker.js +18 -10
- package/dist/page-viewer-JySaivSD.cjs +1 -0
- package/dist/{page-viewer-dcb3u4OV.js → page-viewer-QxHe6m6V.js} +27 -26
- package/dist/project-general-setting-FqXwffxC.cjs +1 -0
- package/dist/{project-general-setting--sS34seu.js → project-general-setting-nSzmnyIU.js} +23 -22
- package/dist/{project-seo-setting-8tc3I-0M.js → project-seo-setting-3kFJ77jY.js} +20 -26
- package/dist/project-seo-setting-C3ilIIeM.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.js +104 -102
- package/dist/single-page-detail-F5J53NCW.cjs +1 -0
- package/dist/{single-page-detail-tP2pfgBp.js → single-page-detail-uSK1ExCH.js} +26 -25
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +19 -18
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +144 -150
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +164 -107
- package/package.json +1 -1
- package/dist/AddBlocks-VHoZezjj.cjs +0 -1
- package/dist/CanvasArea-137WY3Wx.cjs +0 -56
- package/dist/ChaiBuilderEditor-aY8flOgX.cjs +0 -206
- package/dist/CodeEditor-R2jKe97T.cjs +0 -1
- package/dist/CurrentPage-PjrVzHXR.cjs +0 -1
- package/dist/ListTree-C6oCXZDV.cjs +0 -1
- package/dist/PagesPanel-lIC3kYmS.cjs +0 -1
- package/dist/ProjectPanel-0Siyi5YS.cjs +0 -1
- package/dist/Settings-6QRVcl16.cjs +0 -1
- package/dist/SidePanels-j1EFsBlK.cjs +0 -1
- package/dist/ThemeConfiguration-q1471P7b.cjs +0 -1
- package/dist/Topbar-ogFKKDbx.cjs +0 -1
- package/dist/UILibrariesPanel-cm9CFWxc.cjs +0 -1
- package/dist/UILibrariesPanel-tcfz2ELp.js +0 -196
- package/dist/UnsplashImages-E2L3YDJI.cjs +0 -1
- package/dist/UploadImages-s-eeaGiS.cjs +0 -1
- package/dist/add-page-modal-eroF20lO.cjs +0 -1
- package/dist/confirm-alert-XuxEzG-V.cjs +0 -1
- package/dist/delete-page-modal-pgh7sdfg.cjs +0 -1
- package/dist/form-Z4IRWj0o.cjs +0 -1
- package/dist/html-to-json-rauxDBi6.cjs +0 -1
- package/dist/index-bt7EhwLh.cjs +0 -1
- package/dist/page-viewer-O960kM2x.cjs +0 -1
- package/dist/project-general-setting-lIvNs-Vq.cjs +0 -1
- package/dist/project-seo-setting-MIlAuqcc.cjs +0 -1
- package/dist/single-page-detail-0Z_hvd_j.cjs +0 -1
- package/dist/useCanvasSettings-R0h03UfD.cjs +0 -1
- package/dist/useCanvasSettings-rEZHbw3s.js +0 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),R=require("@radix-ui/react-icons"),i=require("react"),D=require("jotai"),c=require("lodash-es"),s=require("./index-0FIxW0gR.cjs"),E=require("lucide-react"),S=require("@chaibuilder/runtime"),v=require("react-i18next"),T=require("./index-gi1LIOCw.cjs"),P=require("./index-5IJnVFyU.cjs"),a=require("./MODIFIERS-mVmfEGgo.cjs"),I=require("./Functions-N3yhPYKY.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.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("@react-hookz/web");require("tree-model");require("i18next");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");require("./index--mLLy7QQ.cjs");const _=({provider:t,onClose:x})=>{const{t:o}=v.useTranslation(),[l,p]=i.useState(null);return i.useEffect(()=>{t&&(t.mockFn?t.mockFn:t.dataFn)().then(d=>p(d))},[t]),t?e.jsxRuntimeExports.jsx(s.Dialog,{onOpenChange:m=>m?"":x(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(s.DialogContent,{children:[e.jsxRuntimeExports.jsxs(s.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(s.DialogTitle,{children:[o("data_provider"),": ",t.name]}),e.jsxRuntimeExports.jsx(s.DialogDescription,{children:t.description})]}),e.jsxRuntimeExports.jsx(P.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(T.JsonView,{data:l,shouldExpandNode:T.allExpanded,style:{...T.defaultStyles,container:"max-h-[80vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",stringValue:"text-orange-600",label:"text-green-900 font-semibold pr-1 tracking-wider"}})})]})}):null};function K({children:t,name:x,onRemove:o}){const{t:l}=v.useTranslation();return e.jsxRuntimeExports.jsxs(s.AlertDialog,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTrigger,{asChild:!0,children:t}),e.jsxRuntimeExports.jsxs(s.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(s.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTitle,{dangerouslySetInnerHTML:{__html:l("remove_provider_confirmation").replace("{name}",x)}}),e.jsxRuntimeExports.jsx(s.AlertDialogDescription,{children:l("remove_provider_warning")})]}),e.jsxRuntimeExports.jsxs(s.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogCancel,{children:l("cancel")}),e.jsxRuntimeExports.jsx(s.AlertDialogAction,{onClick:o,className:"bg-red-600 hover:bg-red-700",children:l("remove")})]})]})]})}const L=()=>{const{t}=v.useTranslation(),x=i.useMemo(()=>S.getChaiDataProviders(),[]),[o,l]=s.usePageDataProviders(),[,p]=D.useAtom(s.builderSaveStateAtom),[m,d]=i.useState(c.filter(x,r=>c.map(o,"providerKey").includes(r.providerKey))),[b,h]=i.useState(""),[N,f]=i.useState(null),y=c.filter(x.map(r=>c.map(m,"providerKey").includes(r.providerKey)?null:{value:r.providerKey,label:r.name}),r=>!c.isNull(r)),w=r=>{const j=c.find(x,{providerKey:r});d(n=>[...n,j]),l(n=>[...n,{providerKey:j.providerKey,args:{}}]),h(""),p("UNSAVED")},g=r=>{d(j=>c.filter(j,n=>n.providerKey!==r.providerKey)),l(j=>c.filter(j,n=>n.providerKey!==r.providerKey)),p("UNSAVED")},u=r=>f(r);return c.isEmpty(x)?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("p",{className:"mb-1.5 p-4 text-xs text-gray-500",children:[t("no_data_providers"),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:t("learn_more")})]})}):e.jsxRuntimeExports.jsxs("div",{className:"px-1",children:[e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("label",{children:e.jsxRuntimeExports.jsx("p",{className:"mb-1.5 text-xs text-gray-500",children:t("add_data_providers")})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:e.jsxRuntimeExports.jsxs(s.Select,{value:b,onValueChange:r=>w(r),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:t("select_provider")})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:t("choose")}),y.map(r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.value,children:r.label},r.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${m.length?"block":"hidden"}`,children:[e.jsxRuntimeExports.jsxs("p",{className:"flex-1 pb-1.5 pt-4 text-xs font-medium text-gray-500",children:[t("page_data_providers"),":"]}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:m.map(r=>e.jsxRuntimeExports.jsxs("div",{className:"w-full rounded-lg border bg-card text-card-foreground shadow-sm","data-v0-t":"card",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-1.5 px-4 pt-4",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",{className:"font-medium leading-4",children:r.name}),e.jsxRuntimeExports.jsx("p",{className:"pt-1 text-xs text-gray-400",children:r.description})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between p-2 py-2",children:[e.jsxRuntimeExports.jsxs("button",{onClick:()=>u(r),className:"inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-blue-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2 h-4 w-4",children:[e.jsxRuntimeExports.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),e.jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),t("view_data")]}),e.jsxRuntimeExports.jsx(K,{onRemove:()=>g(r),name:r.name,children:e.jsxRuntimeExports.jsxs("button",{className:"inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2 h-4 w-4",children:[e.jsxRuntimeExports.jsx("path",{d:"M3 6h18"}),e.jsxRuntimeExports.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),e.jsxRuntimeExports.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]}),t("remove")]})})]})]},r.providerKey))}),e.jsxRuntimeExports.jsx(_,{onClose:()=>f(null),provider:N})]})]})},B=i.memo(()=>{const{t}=v.useTranslation(),x={"ctrl + Z":"Undo","ctrl + Y":"Redo","ctrl + D":"Duplicate"},o={"ctrl + S":"Save page",esc:"Deselect blocks",del:"Delete block"};return e.jsxRuntimeExports.jsxs(s.Dialog,{children:[e.jsxRuntimeExports.jsx(s.DialogTrigger,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("div",{className:"flex w-10 items-center justify-center",children:e.jsxRuntimeExports.jsx(R.KeyboardIcon,{})})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:t("Keyboard shortcuts")})})]})}),e.jsxRuntimeExports.jsxs(s.DialogContent,{className:"sm:max-w-[525px]",children:[e.jsxRuntimeExports.jsx(s.DialogHeader,{children:e.jsxRuntimeExports.jsx(s.DialogTitle,{children:t("Keyboard shortcuts")})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2",children:[e.jsxRuntimeExports.jsx("div",{className:"mr-8 flex flex-col space-y-2 border-r border-gray-200",children:Object.keys(x).map(l=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(s.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:t(l)}),e.jsxRuntimeExports.jsx("div",{children:t(x[l])})]},l))}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-2",children:Object.keys(o).map(l=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(s.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:t(l)}),e.jsxRuntimeExports.jsx("div",{children:t(o[l])})]},l))})]})})]})]})}),A=i.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-MH_fqSRf.cjs"))),k=i.lazy(()=>Promise.resolve().then(()=>require("./ListTree-Njsk1AzL.cjs"))),O=i.lazy(()=>Promise.resolve().then(()=>require("./ThemeConfiguration-PvMN3j6h.cjs"))),U=i.lazy(()=>Promise.resolve().then(()=>require("./index-0FIxW0gR.cjs")).then(t=>t.ImagesPanel)),z=i.lazy(()=>Promise.resolve().then(()=>require("./UILibrariesPanel-CaGLzB9c.cjs")));let C=null;const Y=()=>{const t=s.useBuilderProp("sideBarComponents.top",[]),x=s.useBuilderProp("sideBarComponents.bottom",[]),[o,l]=D.useAtom(s.activePanelAtom),[p,m]=i.useState(o),[d,b]=i.useState(null),{t:h}=v.useTranslation(),N=s.useBuilderProp("uiLibraries",[]),f=S.useChaiBlocks(),y=c.values(f).find(n=>n.category==="custom")!==void 0,w=N.length>0||y,g={"add-blocks":A,[a.OUTLINE_KEY]:k,"theme-configuration":O,images:U,"ui-libraries":z};c.each(t,({name:n,panel:q})=>{g[n]=q});const u=n=>{clearTimeout(C),o!==a.OUTLINE_KEY&&n===a.OUTLINE_KEY?C=setTimeout(()=>l(a.OUTLINE_KEY),500):m(n),l(n)},r=s.useBuilderProp("dataBindingSupport",!1);function j(){const n=setTimeout(()=>{d&&(u(a.OUTLINE_KEY),clearTimeout(d))},500);b(n)}return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[o!==a.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{onMouseEnter:j,onClick:()=>u(a.OUTLINE_KEY),className:"fixed inset-0 z-[50] bg-black/20"}):null,e.jsxRuntimeExports.jsxs("div",{className:"z-[100] flex h-full w-fit flex-col items-center justify-between border-b border-r border-border bg-background pt-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2",children:[w?e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1 rounded-md bg-gray-200 p-1",children:[e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u("add-blocks"),size:"sm",variant:o==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(R.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u("ui-libraries"),size:"sm",variant:o==="ui-libraries"?"default":"outline",children:e.jsxRuntimeExports.jsx(R.Component2Icon,{className:"text-xl"})})]}):e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u("add-blocks"),size:"sm",variant:o==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(R.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u(a.OUTLINE_KEY),size:"sm",variant:o===a.OUTLINE_KEY?"default":"outline",children:e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u("theme-configuration"),size:"sm",variant:o==="theme-configuration"?"default":"outline",children:e.jsxRuntimeExports.jsx(E.PaletteIcon,{className:"w-4 max-w-[40px] text-xs"})}),i.Children.toArray(t.map(({name:n,icon:q})=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u(n),size:"sm",className:"w-10",variant:o===n?"default":"outline",children:e.jsxRuntimeExports.jsx(q,{})})})))]}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2",children:[e.jsxRuntimeExports.jsx(B,{}),i.Children.toArray(x.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))]})]}),o!==a.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{className:"absolute left-14 z-[50] h-[100vh] w-fit translate-x-0 border-r bg-background transition-all duration-500 ease-in-out",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 bg-white p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsx("div",{className:I.cn("relative z-[100] h-full max-h-full overflow-y-auto overflow-x-hidden border-r bg-background p-1 shadow-md"),onMouseEnter:()=>{d&&clearTimeout(d)},children:i.createElement(c.get(g,o,()=>e.jsxRuntimeExports.jsx("div",{})))})})}):null,e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:r?e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:a.OUTLINE_KEY,className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(s.TabsList,{className:"mx-1 grid h-10 grid-cols-2",children:[e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:a.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"mr-2 h-3"})," ",h("Outline")]}),e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(E.DatabaseIcon,{className:"mr-2 w-3"}),h("Data")]})]}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:a.OUTLINE_KEY,className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(k)}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(L,{})})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"sticky top-0 -m-1 flex h-fit items-center justify-center border-b bg-gray-100 py-2 pb-[9px] text-sm",children:[e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"mr-2 h-3"})," ",h("Outline")]}),e.jsxRuntimeExports.jsx("div",{className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden pt-2",children:i.createElement(k)})]})})})]})};exports.default=Y;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./jsx-runtime-Z_BpKhVy.cjs"),B=require("react"),N=require("@rjsf/validator-ajv8"),E=require("@rjsf/core"),p=require("./index-0FIxW0gR.cjs"),r=require("./controls-rRZhz0vu.cjs"),m=require("lodash-es"),k=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");function P(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const l=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const f=P(B),T=({value:t,onChange:e,id:i,onBlur:l})=>{const n=m.debounce(e,200),v=u=>n(u.target.value);return a.jsxRuntimeExports.jsx("div",{className:"mt-1.5 flex items-center gap-x-3",children:a.jsxRuntimeExports.jsx("div",{className:"flex w-3/5 flex-col",children:a.jsxRuntimeExports.jsx("input",{type:"color",className:"text-xs p-0",value:t,onBlur:({target:{value:u}})=>l(i,u),onChange:v})})})},g=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"},{title:"Bebas Neue",value:"Bebas Neue"},{title:"Manrope",value:"Manrope"}],D=()=>{const t=p.useBuilderProp("onSaveBrandingOptions",m.noop),[e,i]=p.useBrandingOptions(),[l]=p.useBlocksContainer(),n=f.useRef(e),{t:v}=k.useTranslation();f.useEffect(()=>()=>{m.isEqual(e,n.current)||t(n.current)},[]);const u=({formData:o},d)=>{d&&(i(o),n.current=o)},{bodyFont:q,headingFont:b,primaryColor:h,bodyTextDarkColor:y,bodyTextLightColor:C,bodyBgDarkColor:S,secondaryColor:j,bodyBgLightColor:O,roundedCorners:R}=e;let s={headingFont:r.f({title:"Heading font",default:b,options:g}),bodyFont:r.f({title:"Body font",default:q,options:g}),roundedCorners:r.y({title:"Rounded Corner",default:parseInt(R||5,10)}),primaryColor:r.s({title:"Primary",default:h}),secondaryColor:r.s({title:"Secondary",default:j})};l||(s={...s,bodyBgLightColor:r.s({title:"Background",default:O}),bodyTextLightColor:r.s({title:"Text color",default:y}),bodyBgDarkColor:r.s({title:"Background (Dark mode)",default:S}),bodyTextDarkColor:r.s({title:"Text color(Dark mode)",default:C})});const c={type:"object",properties:{}},x={};return Object.keys(s).forEach(o=>{const d=s[o];return c.properties||(c.properties={}),c.properties[o]=d.schema,x[o]=d.uiSchema,!0}),a.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-60 select-none flex-col",children:[a.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:a.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:v("Theme Configuration")})}),a.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:a.jsxRuntimeExports.jsx(E,{widgets:{color:T},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:x,schema:c,formData:e,validator:N,onChange:u})})]})};exports.default=D;
|
|
@@ -2,27 +2,17 @@ import { j as t } from "./jsx-runtime-WbnYoNE9.js";
|
|
|
2
2
|
import * as c from "react";
|
|
3
3
|
import j from "@rjsf/validator-ajv8";
|
|
4
4
|
import k from "@rjsf/core";
|
|
5
|
-
import { h as T,
|
|
5
|
+
import { h as T, X as w, bH as D } from "./index-uLn8W3eR.js";
|
|
6
6
|
import { f, y as P, s as a } from "./controls-yjgoZzB6.js";
|
|
7
7
|
import { debounce as R, noop as M, isEqual as F } from "lodash-es";
|
|
8
8
|
import { useTranslation as L } from "react-i18next";
|
|
9
9
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
10
|
-
import "clsx";
|
|
11
|
-
import "react-dom";
|
|
12
|
-
import "@radix-ui/react-scroll-area";
|
|
13
|
-
import "@floating-ui/react-dom";
|
|
14
|
-
import "jotai";
|
|
15
|
-
import "i18next";
|
|
16
|
-
import "flagged";
|
|
17
|
-
import "./MODIFIERS-fd5XOmum.js";
|
|
18
|
-
import "./Functions-7jnEwJyw.js";
|
|
19
|
-
import "tailwind-merge";
|
|
20
|
-
import "@chaibuilder/runtime";
|
|
21
|
-
import "@react-hookz/web";
|
|
22
|
-
import "tree-model";
|
|
23
|
-
import "./utils-VpVqnC9m.js";
|
|
24
10
|
import "@radix-ui/react-toggle";
|
|
25
11
|
import "class-variance-authority";
|
|
12
|
+
import "./utils-VpVqnC9m.js";
|
|
13
|
+
import "./MODIFIERS-fd5XOmum.js";
|
|
14
|
+
import "clsx";
|
|
15
|
+
import "tailwind-merge";
|
|
26
16
|
import "@radix-ui/react-switch";
|
|
27
17
|
import "@radix-ui/react-slot";
|
|
28
18
|
import "@radix-ui/react-accordion";
|
|
@@ -30,6 +20,7 @@ import "@radix-ui/react-icons";
|
|
|
30
20
|
import "@radix-ui/react-alert-dialog";
|
|
31
21
|
import "@radix-ui/react-dialog";
|
|
32
22
|
import "@radix-ui/react-label";
|
|
23
|
+
import "@radix-ui/react-scroll-area";
|
|
33
24
|
import "@radix-ui/react-tabs";
|
|
34
25
|
import "@radix-ui/react-tooltip";
|
|
35
26
|
import "@radix-ui/react-popover";
|
|
@@ -42,10 +33,13 @@ import "@radix-ui/react-toast";
|
|
|
42
33
|
import "cmdk";
|
|
43
34
|
import "@radix-ui/react-context-menu";
|
|
44
35
|
import "react-icons-picker";
|
|
36
|
+
import "react-dom";
|
|
45
37
|
import "react-quill";
|
|
46
|
-
import "
|
|
47
|
-
import "
|
|
48
|
-
import "
|
|
38
|
+
import "./Functions-7jnEwJyw.js";
|
|
39
|
+
import "@chaibuilder/runtime";
|
|
40
|
+
import "jotai";
|
|
41
|
+
import "@react-hookz/web";
|
|
42
|
+
import "tree-model";
|
|
49
43
|
const E = ({ value: u, onChange: e, id: p, onBlur: m }) => {
|
|
50
44
|
const i = R(e, 200), d = (l) => i(l.target.value);
|
|
51
45
|
return /* @__PURE__ */ t.jsx("div", { className: "mt-1.5 flex items-center gap-x-3", children: /* @__PURE__ */ t.jsx("div", { className: "flex w-3/5 flex-col", children: /* @__PURE__ */ t.jsx(
|
|
@@ -110,7 +104,7 @@ const E = ({ value: u, onChange: e, id: p, onBlur: m }) => {
|
|
|
110
104
|
{ title: "Suranna", value: "Suranna" },
|
|
111
105
|
{ title: "Bebas Neue", value: "Bebas Neue" },
|
|
112
106
|
{ title: "Manrope", value: "Manrope" }
|
|
113
|
-
],
|
|
107
|
+
], Ot = () => {
|
|
114
108
|
const u = T("onSaveBrandingOptions", M), [e, p] = w(), [m] = D(), i = c.useRef(e), { t: d } = L();
|
|
115
109
|
c.useEffect(() => () => {
|
|
116
110
|
F(e, i.current) || u(i.current);
|
|
@@ -121,8 +115,8 @@ const E = ({ value: u, onChange: e, id: p, onBlur: m }) => {
|
|
|
121
115
|
bodyFont: h,
|
|
122
116
|
headingFont: b,
|
|
123
117
|
primaryColor: x,
|
|
124
|
-
bodyTextDarkColor:
|
|
125
|
-
bodyTextLightColor:
|
|
118
|
+
bodyTextDarkColor: C,
|
|
119
|
+
bodyTextLightColor: y,
|
|
126
120
|
bodyBgDarkColor: S,
|
|
127
121
|
secondaryColor: B,
|
|
128
122
|
bodyBgLightColor: O,
|
|
@@ -154,7 +148,7 @@ const E = ({ value: u, onChange: e, id: p, onBlur: m }) => {
|
|
|
154
148
|
}),
|
|
155
149
|
bodyTextLightColor: a({
|
|
156
150
|
title: "Text color",
|
|
157
|
-
default:
|
|
151
|
+
default: C
|
|
158
152
|
}),
|
|
159
153
|
bodyBgDarkColor: a({
|
|
160
154
|
title: "Background (Dark mode)",
|
|
@@ -162,7 +156,7 @@ const E = ({ value: u, onChange: e, id: p, onBlur: m }) => {
|
|
|
162
156
|
}),
|
|
163
157
|
bodyTextDarkColor: a({
|
|
164
158
|
title: "Text color(Dark mode)",
|
|
165
|
-
default:
|
|
159
|
+
default: y
|
|
166
160
|
})
|
|
167
161
|
});
|
|
168
162
|
const n = {
|
|
@@ -193,5 +187,5 @@ const E = ({ value: u, onChange: e, id: p, onBlur: m }) => {
|
|
|
193
187
|
] });
|
|
194
188
|
};
|
|
195
189
|
export {
|
|
196
|
-
|
|
190
|
+
Ot as default
|
|
197
191
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),n=require("react"),a=require("@radix-ui/react-icons"),r=require("./index-0FIxW0gR.cjs"),p=require("./index-5IJnVFyU.cjs"),l=require("react-i18next");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("@react-hookz/web");require("tree-model");require("i18next");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");require("lucide-react");require("./index--mLLy7QQ.cjs");const m=()=>r.useBuilderProp("languages",["en"]),j=()=>m().length===1?null:e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(r.Select,{children:[e.jsxRuntimeExports.jsx(r.SelectTrigger,{className:"w-[150px] border-0",children:e.jsxRuntimeExports.jsx(r.SelectValue,{placeholder:e.jsxRuntimeExports.jsxs("span",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(a.FontFamilyIcon,{className:"h-4 w-4"})," English(US)"]})})}),e.jsxRuntimeExports.jsx(r.SelectContent,{children:e.jsxRuntimeExports.jsxs(r.SelectGroup,{children:[e.jsxRuntimeExports.jsx(r.SelectLabel,{children:"Fruits"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"apple",children:"Apple"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"banana",children:"Banana"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"blueberry",children:"Blueberry"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"grapes",children:"Grapes"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"pineapple",children:"Pineapple"})]})})]})}),d=()=>{const{savePage:u,saveState:s}=r.useSavePage(),{t:i}=l.useTranslation(),x=r.useBuilderProp("hideSaveButton",!1),t=n.useMemo(()=>{switch(s){case"SAVING":return"animate-pulse bg-gray-300 text-gray-900";case"SAVED":return"bg-green-500 text-white hover:bg-green-600 hover:text-white";default:return"bg-gray-200 text-gray-500 hover:bg-gray-100"}},[s]);if(x)return null;const o=e.jsxRuntimeExports.jsxs(r.Button,{disabled:s==="SAVING",onClick:c=>{c.preventDefault(),u()},className:`flex h-auto w-fit items-center gap-x-2 rounded-full p-1.5 px-3 ${t}`,size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(p.FaCircleCheck,{className:"text-lg"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:s==="SAVING"?"Saving...":i(s==="SAVED"?"Saved":"Unsaved")})]});return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:o})},h=function(){const s=r.useBuilderProp("previewComponent"),[,i]=r.usePreviewMode(),{t:x}=l.useTranslation();return s?e.jsxRuntimeExports.jsxs(r.Button,{onClick:t=>{t.preventDefault(),i(!0)},className:"flex h-auto w-fit items-center gap-x-2 rounded-full bg-gray-200 px-3 py-1",size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(a.EyeOpenIcon,{className:"text-xs"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:x("Preview")})]}):null},q=()=>{const u=r.useBuilderProp("topBarComponents.left",[]),s=r.useBuilderProp("topBarComponents.center",[]),i=r.useBuilderProp("topBarComponents.right",[]),x=r.useBuilderProp("editable",!0);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2 font-bold",children:n.Children.toArray(u.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:n.Children.toArray(s.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(j,{}),e.jsxRuntimeExports.jsx(h,{}),e.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),x?e.jsxRuntimeExports.jsx(d,{}):null,n.Children.toArray(i.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))]})]})};exports.default=q;
|
|
@@ -1,32 +1,24 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import
|
|
3
|
-
import { FontFamilyIcon as j, EyeOpenIcon as
|
|
4
|
-
import { h as r,
|
|
2
|
+
import l, { useMemo as h, Suspense as c } from "react";
|
|
3
|
+
import { FontFamilyIcon as j, EyeOpenIcon as f } from "@radix-ui/react-icons";
|
|
4
|
+
import { h as r, az as g, aA as v, aB as S, aC as b, aO as N, aP as C, aD as o, Q as w, B as p, q as y, S as m, aQ as B } from "./index-uLn8W3eR.js";
|
|
5
|
+
import { F as A } from "./index-grcmKbfu.js";
|
|
5
6
|
import { useTranslation as x } from "react-i18next";
|
|
6
7
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
7
|
-
import "
|
|
8
|
-
import "
|
|
9
|
-
import "
|
|
10
|
-
import "@floating-ui/react-dom";
|
|
11
|
-
import "jotai";
|
|
12
|
-
import "i18next";
|
|
13
|
-
import "flagged";
|
|
8
|
+
import "@radix-ui/react-toggle";
|
|
9
|
+
import "class-variance-authority";
|
|
10
|
+
import "./utils-VpVqnC9m.js";
|
|
14
11
|
import "lodash-es";
|
|
15
12
|
import "./MODIFIERS-fd5XOmum.js";
|
|
16
|
-
import "
|
|
13
|
+
import "clsx";
|
|
17
14
|
import "tailwind-merge";
|
|
18
|
-
import "@chaibuilder/runtime";
|
|
19
|
-
import "@react-hookz/web";
|
|
20
|
-
import "tree-model";
|
|
21
|
-
import "./utils-VpVqnC9m.js";
|
|
22
|
-
import "@radix-ui/react-toggle";
|
|
23
|
-
import "class-variance-authority";
|
|
24
15
|
import "@radix-ui/react-switch";
|
|
25
16
|
import "@radix-ui/react-slot";
|
|
26
17
|
import "@radix-ui/react-accordion";
|
|
27
18
|
import "@radix-ui/react-alert-dialog";
|
|
28
19
|
import "@radix-ui/react-dialog";
|
|
29
20
|
import "@radix-ui/react-label";
|
|
21
|
+
import "@radix-ui/react-scroll-area";
|
|
30
22
|
import "@radix-ui/react-tabs";
|
|
31
23
|
import "@radix-ui/react-tooltip";
|
|
32
24
|
import "@radix-ui/react-popover";
|
|
@@ -39,13 +31,22 @@ import "@radix-ui/react-toast";
|
|
|
39
31
|
import "cmdk";
|
|
40
32
|
import "@radix-ui/react-context-menu";
|
|
41
33
|
import "react-icons-picker";
|
|
34
|
+
import "react-dom";
|
|
42
35
|
import "react-quill";
|
|
36
|
+
import "./Functions-7jnEwJyw.js";
|
|
37
|
+
import "@chaibuilder/runtime";
|
|
38
|
+
import "jotai";
|
|
39
|
+
import "@react-hookz/web";
|
|
40
|
+
import "tree-model";
|
|
41
|
+
import "i18next";
|
|
42
|
+
import "@floating-ui/react-dom";
|
|
43
|
+
import "flagged";
|
|
43
44
|
import "react-hotkeys-hook";
|
|
44
45
|
import "lucide-react";
|
|
45
46
|
import "./index-VBXQixVm.js";
|
|
46
|
-
const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(
|
|
47
|
+
const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(g, { children: [
|
|
47
48
|
/* @__PURE__ */ e.jsx(v, { className: "w-[150px] border-0", children: /* @__PURE__ */ e.jsx(
|
|
48
|
-
|
|
49
|
+
S,
|
|
49
50
|
{
|
|
50
51
|
placeholder: /* @__PURE__ */ e.jsxs("span", { className: "flex items-center", children: [
|
|
51
52
|
/* @__PURE__ */ e.jsx(j, { className: "h-4 w-4" }),
|
|
@@ -53,16 +54,16 @@ const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
53
54
|
] })
|
|
54
55
|
}
|
|
55
56
|
) }),
|
|
56
|
-
/* @__PURE__ */ e.jsx(
|
|
57
|
-
/* @__PURE__ */ e.jsx(
|
|
58
|
-
/* @__PURE__ */ e.jsx(
|
|
59
|
-
/* @__PURE__ */ e.jsx(
|
|
60
|
-
/* @__PURE__ */ e.jsx(
|
|
61
|
-
/* @__PURE__ */ e.jsx(
|
|
62
|
-
/* @__PURE__ */ e.jsx(
|
|
57
|
+
/* @__PURE__ */ e.jsx(b, { children: /* @__PURE__ */ e.jsxs(N, { children: [
|
|
58
|
+
/* @__PURE__ */ e.jsx(C, { children: "Fruits" }),
|
|
59
|
+
/* @__PURE__ */ e.jsx(o, { value: "apple", children: "Apple" }),
|
|
60
|
+
/* @__PURE__ */ e.jsx(o, { value: "banana", children: "Banana" }),
|
|
61
|
+
/* @__PURE__ */ e.jsx(o, { value: "blueberry", children: "Blueberry" }),
|
|
62
|
+
/* @__PURE__ */ e.jsx(o, { value: "grapes", children: "Grapes" }),
|
|
63
|
+
/* @__PURE__ */ e.jsx(o, { value: "pineapple", children: "Pineapple" })
|
|
63
64
|
] }) })
|
|
64
|
-
] }) }),
|
|
65
|
-
const { savePage: n, saveState: t } =
|
|
65
|
+
] }) }), I = () => {
|
|
66
|
+
const { savePage: n, saveState: t } = w(), { t: a } = x(), i = r("hideSaveButton", !1), s = h(() => {
|
|
66
67
|
switch (t) {
|
|
67
68
|
case "SAVING":
|
|
68
69
|
return "animate-pulse bg-gray-300 text-gray-900";
|
|
@@ -85,14 +86,14 @@ const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
85
86
|
size: "sm",
|
|
86
87
|
variant: "outline",
|
|
87
88
|
children: [
|
|
88
|
-
/* @__PURE__ */ e.jsx(
|
|
89
|
+
/* @__PURE__ */ e.jsx(A, { className: "text-lg" }),
|
|
89
90
|
/* @__PURE__ */ e.jsx("span", { className: "text-sm", children: t === "SAVING" ? "Saving..." : a(t === "SAVED" ? "Saved" : "Unsaved") })
|
|
90
91
|
]
|
|
91
92
|
}
|
|
92
93
|
);
|
|
93
94
|
return /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: u });
|
|
94
|
-
},
|
|
95
|
-
const t = r("previewComponent"), [, a] =
|
|
95
|
+
}, V = function() {
|
|
96
|
+
const t = r("previewComponent"), [, a] = y(), { t: i } = x();
|
|
96
97
|
return t ? /* @__PURE__ */ e.jsxs(
|
|
97
98
|
p,
|
|
98
99
|
{
|
|
@@ -103,7 +104,7 @@ const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
103
104
|
size: "sm",
|
|
104
105
|
variant: "outline",
|
|
105
106
|
children: [
|
|
106
|
-
/* @__PURE__ */ e.jsx(
|
|
107
|
+
/* @__PURE__ */ e.jsx(f, { className: "text-xs" }),
|
|
107
108
|
/* @__PURE__ */ e.jsx("span", { className: "text-sm", children: i("Preview") })
|
|
108
109
|
]
|
|
109
110
|
}
|
|
@@ -111,18 +112,18 @@ const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
111
112
|
}, we = () => {
|
|
112
113
|
const n = r("topBarComponents.left", []), t = r("topBarComponents.center", []), a = r("topBarComponents.right", []), i = r("editable", !0);
|
|
113
114
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
|
|
114
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2 font-bold", children:
|
|
115
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2 font-bold", children: l.Children.toArray(
|
|
115
116
|
n.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
116
117
|
) }) }),
|
|
117
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children:
|
|
118
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: l.Children.toArray(
|
|
118
119
|
t.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
119
120
|
) }),
|
|
120
121
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
121
122
|
/* @__PURE__ */ e.jsx(k, {}),
|
|
122
|
-
/* @__PURE__ */ e.jsx(
|
|
123
|
-
/* @__PURE__ */ e.jsx(
|
|
124
|
-
i ? /* @__PURE__ */ e.jsx(
|
|
125
|
-
|
|
123
|
+
/* @__PURE__ */ e.jsx(V, {}),
|
|
124
|
+
/* @__PURE__ */ e.jsx(B, { orientation: "vertical" }),
|
|
125
|
+
i ? /* @__PURE__ */ e.jsx(I, {}) : null,
|
|
126
|
+
l.Children.toArray(
|
|
126
127
|
a.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
127
128
|
)
|
|
128
129
|
] })
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("lodash-es"),j=require("react"),s=require("./index-0FIxW0gR.cjs"),N=require("@chaibuilder/runtime"),S=require("lucide-react"),g=require("jotai"),y=require("./Functions-N3yhPYKY.cjs"),w=require("@radix-ui/react-icons"),I=require("./MODIFIERS-mVmfEGgo.cjs"),C=require("react-i18next"),L=require("flagged"),T=require("./atoms-a0H_593V.cjs"),A=require("clsx");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");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("@react-hookz/web");require("tree-model");function P(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const u in t)if(u!=="default"){const l=Object.getOwnPropertyDescriptor(t,u);Object.defineProperty(o,u,l.get?l:{enumerable:!0,get:()=>t[u]})}}return o.default=t,Object.freeze(o)}const O=P(j);function D({uiLibraries:t,library:o,setLibrary:u}){var m;const[l,x]=O.useState(!1),{t:n}=C.useTranslation();return o?e.jsxRuntimeExports.jsxs(s.Popover,{open:l,onOpenChange:x,children:[e.jsxRuntimeExports.jsx(s.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("span",{children:n("Choose Library")}),e.jsxRuntimeExports.jsxs(s.Button,{variant:"outline",size:"sm",role:"combobox","aria-expanded":l,className:"w-[200px] justify-between",children:[o?(m=t.find(c=>c.uuid===o))==null?void 0:m.name:n("Select library"),e.jsxRuntimeExports.jsx(w.CaretSortIcon,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})]})}),e.jsxRuntimeExports.jsx(s.PopoverContent,{className:"w-[200px] p-0",children:e.jsxRuntimeExports.jsxs(s.Command,{children:[e.jsxRuntimeExports.jsx(s.CommandInput,{placeholder:"Search library...",className:"h-9"}),e.jsxRuntimeExports.jsxs(s.CommandList,{children:[e.jsxRuntimeExports.jsx(s.CommandEmpty,{children:"No library found."}),e.jsxRuntimeExports.jsx(s.CommandGroup,{children:t.map(c=>e.jsxRuntimeExports.jsxs(s.CommandItem,{value:c.uuid,onSelect:p=>{u(p),x(!1)},children:[c.name,e.jsxRuntimeExports.jsx(w.CheckIcon,{className:y.cn("ml-auto h-4 w-4",o===c.uuid?"opacity-100":"opacity-0")})]},c.uuid))})]})]})})]}):null}const _=({block:t,closePopover:o,library:u})=>{const[l,x]=j.useState(!1),n=s.useBuilderProp("getUILibraryBlock",r.noop),{addCoreBlock:m,addPredefinedBlock:c}=s.useAddBlock(),[p,h]=s.useSelectedBlockIds(),[,E]=s.useHighlightBlockId(),[,q]=g.useAtom(T.draggedBlockAtom),b=L.useFeature("dnd"),R=i=>{const a=r.has(i,"styles_attrs.data-page-section");return i._type==="Box"&&a},d=j.useCallback(async i=>{if(i.stopPropagation(),r.has(t,"component")){m(t,r.first(p)),o();return}x(!0);const a=await n(u,t);let f=r.first(p);R(r.first(a))&&(f=null),r.isEmpty(a)||c(N.syncBlocksWithDefaults(a),f),o()},[t]),k=async i=>{const a=await n(u,t);let f=r.first(p);if(R(r.first(a))&&(f=null),!r.isEmpty(a)){const B={blocks:a,uiLibrary:!0,parent:f};if(i.dataTransfer.setData("text/plain",JSON.stringify(B)),t.preview){const v=new Image;v.src=t.preview,v.onload=()=>{i.dataTransfer.setDragImage(v,0,0)}}else i.dataTransfer.setDragImage(new Image,0,0);q(B),setTimeout(()=>{h([]),E(null),o()},200)}};return e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("div",{onClick:l?()=>{}:d,draggable:!0,onDragStart:k,className:A("relative mt-2 cursor-pointer overflow-hidden rounded-md border border-gray-300 bg-white duration-200 hover:border-blue-500 hover:shadow-xl",b?"cursor-grab":"cursor-pointer"),children:[l&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black/70",children:[e.jsxRuntimeExports.jsx(S.Loader,{className:"animate-spin",size:15,color:"white"}),e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),t.preview?e.jsxRuntimeExports.jsx("img",{src:t.preview,className:"min-h-[25px] w-full rounded-md",alt:t.name}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:t.name})})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:t.name})})]})},M=g.atom({}),U=t=>{const[o,u]=g.useAtom(M),l=s.useBuilderProp("getUILibraryBlocks",r.noop),x=r.get(o,`${t==null?void 0:t.uuid}.blocks`,[]),n=r.get(o,`${t==null?void 0:t.uuid}.loading`,!1);return j.useEffect(()=>{(async()=>{if(n||x.length>0)return;u(c=>({...c,[t==null?void 0:t.uuid]:{loading:!0,blocks:[]}}));const m=await l(t);u(c=>({...c,[t==null?void 0:t.uuid]:{loading:!1,blocks:m||[]}}))})()},[t,x,n]),{data:x,isLoading:n}},z=s.atomWithStorage("_selectedLibrary",null),F=()=>{const[t,o]=g.useAtom(z),u=s.useBuilderProp("uiLibraries",[]),l=N.useChaiBlocks(),x=r.values(l).filter(i=>i.category==="custom"),n=u.find(i=>i.uuid===t)||r.first(u),{data:m,isLoading:c}=U(n),p=r.groupBy([...m,...x],"group"),[h,E]=j.useState("Hero"),[,q]=g.useAtom(s.activePanelAtom),b=r.get(p,h,[]),{t:R}=C.useTranslation(),d=j.useRef(null),k=i=>{d.current&&(clearTimeout(d.current),d.current=null),d.current=setTimeout(()=>{d.current&&E(i)},300)};return c?e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-full w-full"}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full w-[460px] flex-col overflow-hidden bg-background",children:[n!=null&&n.uuid?e.jsxRuntimeExports.jsx("div",{className:"sticky top-0 flex h-fit flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"flex w-full flex-col items-baseline truncate px-1 text-sm font-semibold xl:flex-col",children:e.jsxRuntimeExports.jsx(D,{library:n==null?void 0:n.uuid,setLibrary:o,uiLibraries:u})})})}):null,e.jsxRuntimeExports.jsxs("div",{className:"flex h-[95%] border-t border-gray-300 pt-2",children:[e.jsxRuntimeExports.jsx("div",{className:"flex h-full w-40 flex-col gap-1 px-1",children:j.Children.toArray(r.map(p,(i,a)=>e.jsxRuntimeExports.jsxs("div",{onMouseEnter:()=>k(a),onMouseLeave:()=>clearTimeout(d.current),onClick:()=>E(a),className:y.cn("flex w-full cursor-pointer items-center justify-between rounded-md p-1 text-sm transition-all ease-in-out hover:bg-gray-200",a===h?"bg-blue-500 text-white hover:bg-blue-600":""),children:[e.jsxRuntimeExports.jsx("span",{children:r.capitalize(a)}),e.jsxRuntimeExports.jsx(w.CaretRightIcon,{className:"ml-2 h-5 w-5"})]},a)))}),e.jsxRuntimeExports.jsxs(s.ScrollArea,{onMouseEnter:()=>d.current?clearTimeout(d.current):null,className:"z-10 -mt-2 flex h-full max-h-full w-[300px] flex-col gap-2 border-l border-gray-300 transition-all ease-linear",children:[e.jsxRuntimeExports.jsx("div",{className:"sticky top-0 z-30 border-b border-gray-300 bg-gray-200 p-2 text-[9px] font-light leading-3 text-gray-500",children:R("Click on a block to add it to the page")}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-2 px-2",children:j.Children.toArray(b.map(i=>e.jsxRuntimeExports.jsx(_,{block:i,library:n,closePopover:()=>q(I.OUTLINE_KEY)})))}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("br",{})]})]})]})})},G=()=>e.jsxRuntimeExports.jsx(F,{});exports.default=G;
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
+
import { noop as S, has as y, first as p, isEmpty as I, get as B, values as P, groupBy as D, map as U, capitalize as _ } from "lodash-es";
|
|
3
|
+
import * as R from "react";
|
|
4
|
+
import L, { useState as T, useCallback as z, useEffect as G, useRef as O } from "react";
|
|
5
|
+
import { b8 as H, b9 as M, B as F, ba as J, bb as W, bc as $, bd as K, be as Y, bf as q, bg as Q, h as N, a2 as V, r as X, ad as Z, aF as ee, aG as te, aH as se, o as oe, aJ as re, S as ae, br as ne } from "./index-uLn8W3eR.js";
|
|
6
|
+
import { syncBlocksWithDefaults as ie, useChaiBlocks as le } from "@chaibuilder/runtime";
|
|
7
|
+
import { Loader as ce } from "lucide-react";
|
|
8
|
+
import { useAtom as j, atom as de } from "jotai";
|
|
9
|
+
import { c as A } from "./Functions-7jnEwJyw.js";
|
|
10
|
+
import { CaretSortIcon as me, CheckIcon as ue, CaretRightIcon as pe } from "@radix-ui/react-icons";
|
|
11
|
+
import { O as xe } from "./MODIFIERS-fd5XOmum.js";
|
|
12
|
+
import { useTranslation as E } from "react-i18next";
|
|
13
|
+
import { useFeature as fe } from "flagged";
|
|
14
|
+
import { d as he } from "./atoms-ZOWyNoiC.js";
|
|
15
|
+
import ge from "clsx";
|
|
16
|
+
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
17
|
+
import "@radix-ui/react-toggle";
|
|
18
|
+
import "class-variance-authority";
|
|
19
|
+
import "./utils-VpVqnC9m.js";
|
|
20
|
+
import "tailwind-merge";
|
|
21
|
+
import "@radix-ui/react-switch";
|
|
22
|
+
import "@radix-ui/react-slot";
|
|
23
|
+
import "@radix-ui/react-accordion";
|
|
24
|
+
import "@radix-ui/react-alert-dialog";
|
|
25
|
+
import "@radix-ui/react-dialog";
|
|
26
|
+
import "@radix-ui/react-label";
|
|
27
|
+
import "@radix-ui/react-scroll-area";
|
|
28
|
+
import "@radix-ui/react-tabs";
|
|
29
|
+
import "@radix-ui/react-tooltip";
|
|
30
|
+
import "@radix-ui/react-popover";
|
|
31
|
+
import "@radix-ui/react-menubar";
|
|
32
|
+
import "@radix-ui/react-hover-card";
|
|
33
|
+
import "@radix-ui/react-select";
|
|
34
|
+
import "@radix-ui/react-dropdown-menu";
|
|
35
|
+
import "@radix-ui/react-separator";
|
|
36
|
+
import "@radix-ui/react-toast";
|
|
37
|
+
import "cmdk";
|
|
38
|
+
import "@radix-ui/react-context-menu";
|
|
39
|
+
import "react-icons-picker";
|
|
40
|
+
import "react-dom";
|
|
41
|
+
import "react-quill";
|
|
42
|
+
import "@react-hookz/web";
|
|
43
|
+
import "tree-model";
|
|
44
|
+
function je({
|
|
45
|
+
uiLibraries: t,
|
|
46
|
+
library: n,
|
|
47
|
+
setLibrary: i
|
|
48
|
+
}) {
|
|
49
|
+
var m;
|
|
50
|
+
const [d, l] = R.useState(!1), { t: s } = E();
|
|
51
|
+
return n ? /* @__PURE__ */ e.jsxs(H, { open: d, onOpenChange: l, children: [
|
|
52
|
+
/* @__PURE__ */ e.jsx(M, { asChild: !0, children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
53
|
+
/* @__PURE__ */ e.jsx("span", { children: s("Choose Library") }),
|
|
54
|
+
/* @__PURE__ */ e.jsxs(
|
|
55
|
+
F,
|
|
56
|
+
{
|
|
57
|
+
variant: "outline",
|
|
58
|
+
size: "sm",
|
|
59
|
+
role: "combobox",
|
|
60
|
+
"aria-expanded": d,
|
|
61
|
+
className: "w-[200px] justify-between",
|
|
62
|
+
children: [
|
|
63
|
+
n ? (m = t.find((a) => a.uuid === n)) == null ? void 0 : m.name : s("Select library"),
|
|
64
|
+
/* @__PURE__ */ e.jsx(me, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] }) }),
|
|
69
|
+
/* @__PURE__ */ e.jsx(J, { className: "w-[200px] p-0", children: /* @__PURE__ */ e.jsxs(W, { children: [
|
|
70
|
+
/* @__PURE__ */ e.jsx($, { placeholder: "Search library...", className: "h-9" }),
|
|
71
|
+
/* @__PURE__ */ e.jsxs(K, { children: [
|
|
72
|
+
/* @__PURE__ */ e.jsx(Y, { children: "No library found." }),
|
|
73
|
+
/* @__PURE__ */ e.jsx(q, { children: t.map((a) => /* @__PURE__ */ e.jsxs(
|
|
74
|
+
Q,
|
|
75
|
+
{
|
|
76
|
+
value: a.uuid,
|
|
77
|
+
onSelect: (u) => {
|
|
78
|
+
i(u), l(!1);
|
|
79
|
+
},
|
|
80
|
+
children: [
|
|
81
|
+
a.name,
|
|
82
|
+
/* @__PURE__ */ e.jsx(
|
|
83
|
+
ue,
|
|
84
|
+
{
|
|
85
|
+
className: A("ml-auto h-4 w-4", n === a.uuid ? "opacity-100" : "opacity-0")
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
a.uuid
|
|
91
|
+
)) })
|
|
92
|
+
] })
|
|
93
|
+
] }) })
|
|
94
|
+
] }) : null;
|
|
95
|
+
}
|
|
96
|
+
const be = ({
|
|
97
|
+
block: t,
|
|
98
|
+
closePopover: n,
|
|
99
|
+
library: i
|
|
100
|
+
}) => {
|
|
101
|
+
const [d, l] = T(!1), s = N("getUILibraryBlock", S), { addCoreBlock: m, addPredefinedBlock: a } = V(), [u, f] = X(), [, h] = Z(), [, b] = j(he), k = fe("dnd"), g = (o) => {
|
|
102
|
+
const r = y(o, "styles_attrs.data-page-section");
|
|
103
|
+
return o._type === "Box" && r;
|
|
104
|
+
}, c = z(
|
|
105
|
+
async (o) => {
|
|
106
|
+
if (o.stopPropagation(), y(t, "component")) {
|
|
107
|
+
m(t, p(u)), n();
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
l(!0);
|
|
111
|
+
const r = await s(i, t);
|
|
112
|
+
let x = p(u);
|
|
113
|
+
g(p(r)) && (x = null), I(r) || a(ie(r), x), n();
|
|
114
|
+
},
|
|
115
|
+
[t]
|
|
116
|
+
), w = async (o) => {
|
|
117
|
+
const r = await s(i, t);
|
|
118
|
+
let x = p(u);
|
|
119
|
+
if (g(p(r)) && (x = null), !I(r)) {
|
|
120
|
+
const C = { blocks: r, uiLibrary: !0, parent: x };
|
|
121
|
+
if (o.dataTransfer.setData("text/plain", JSON.stringify(C)), t.preview) {
|
|
122
|
+
const v = new Image();
|
|
123
|
+
v.src = t.preview, v.onload = () => {
|
|
124
|
+
o.dataTransfer.setDragImage(v, 0, 0);
|
|
125
|
+
};
|
|
126
|
+
} else
|
|
127
|
+
o.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
128
|
+
b(C), setTimeout(() => {
|
|
129
|
+
f([]), h(null), n();
|
|
130
|
+
}, 200);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
return /* @__PURE__ */ e.jsxs(ee, { children: [
|
|
134
|
+
/* @__PURE__ */ e.jsx(te, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
135
|
+
"div",
|
|
136
|
+
{
|
|
137
|
+
onClick: d ? () => {
|
|
138
|
+
} : c,
|
|
139
|
+
draggable: !0,
|
|
140
|
+
onDragStart: w,
|
|
141
|
+
className: ge(
|
|
142
|
+
"relative mt-2 cursor-pointer overflow-hidden rounded-md border border-gray-300 bg-white duration-200 hover:border-blue-500 hover:shadow-xl",
|
|
143
|
+
k ? "cursor-grab" : "cursor-pointer"
|
|
144
|
+
),
|
|
145
|
+
children: [
|
|
146
|
+
d && /* @__PURE__ */ e.jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black/70", children: [
|
|
147
|
+
/* @__PURE__ */ e.jsx(ce, { className: "animate-spin", size: 15, color: "white" }),
|
|
148
|
+
/* @__PURE__ */ e.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
|
|
149
|
+
] }),
|
|
150
|
+
t.preview ? /* @__PURE__ */ e.jsx("img", { src: t.preview, className: "min-h-[25px] w-full rounded-md", alt: t.name }) : /* @__PURE__ */ e.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200", children: /* @__PURE__ */ e.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: t.name }) })
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
) }),
|
|
154
|
+
/* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsx("p", { children: t.name }) })
|
|
155
|
+
] });
|
|
156
|
+
}, ke = de({}), we = (t) => {
|
|
157
|
+
const [n, i] = j(ke), d = N("getUILibraryBlocks", S), l = B(n, `${t == null ? void 0 : t.uuid}.blocks`, []), s = B(n, `${t == null ? void 0 : t.uuid}.loading`, !1);
|
|
158
|
+
return G(() => {
|
|
159
|
+
(async () => {
|
|
160
|
+
if (s || l.length > 0)
|
|
161
|
+
return;
|
|
162
|
+
i((a) => ({ ...a, [t == null ? void 0 : t.uuid]: { loading: !0, blocks: [] } }));
|
|
163
|
+
const m = await d(t);
|
|
164
|
+
i((a) => ({ ...a, [t == null ? void 0 : t.uuid]: { loading: !1, blocks: m || [] } }));
|
|
165
|
+
})();
|
|
166
|
+
}, [t, l, s]), { data: l, isLoading: s };
|
|
167
|
+
}, ve = oe("_selectedLibrary", null), Be = () => {
|
|
168
|
+
const [t, n] = j(ve), i = N("uiLibraries", []), d = le(), l = P(d).filter((o) => o.category === "custom"), s = i.find((o) => o.uuid === t) || p(i), { data: m, isLoading: a } = we(s), u = D([...m, ...l], "group"), [f, h] = T("Hero"), [, b] = j(re), k = B(u, f, []), { t: g } = E(), c = O(null), w = (o) => {
|
|
169
|
+
c.current && (clearTimeout(c.current), c.current = null), c.current = setTimeout(() => {
|
|
170
|
+
c.current && h(o);
|
|
171
|
+
}, 300);
|
|
172
|
+
};
|
|
173
|
+
return a ? /* @__PURE__ */ e.jsx(ae, { className: "h-full w-full" }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full max-h-full w-[460px] flex-col overflow-hidden bg-background", children: [
|
|
174
|
+
s != null && s.uuid ? /* @__PURE__ */ e.jsx("div", { className: "sticky top-0 flex h-fit flex-col", children: /* @__PURE__ */ e.jsx("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: /* @__PURE__ */ e.jsx("h1", { className: "flex w-full flex-col items-baseline truncate px-1 text-sm font-semibold xl:flex-col", children: /* @__PURE__ */ e.jsx(je, { library: s == null ? void 0 : s.uuid, setLibrary: n, uiLibraries: i }) }) }) }) : null,
|
|
175
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex h-[95%] border-t border-gray-300 pt-2", children: [
|
|
176
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex h-full w-40 flex-col gap-1 px-1", children: L.Children.toArray(
|
|
177
|
+
U(u, (o, r) => /* @__PURE__ */ e.jsxs(
|
|
178
|
+
"div",
|
|
179
|
+
{
|
|
180
|
+
onMouseEnter: () => w(r),
|
|
181
|
+
onMouseLeave: () => clearTimeout(c.current),
|
|
182
|
+
onClick: () => h(r),
|
|
183
|
+
className: A(
|
|
184
|
+
"flex w-full cursor-pointer items-center justify-between rounded-md p-1 text-sm transition-all ease-in-out hover:bg-gray-200",
|
|
185
|
+
r === f ? "bg-blue-500 text-white hover:bg-blue-600" : ""
|
|
186
|
+
),
|
|
187
|
+
children: [
|
|
188
|
+
/* @__PURE__ */ e.jsx("span", { children: _(r) }),
|
|
189
|
+
/* @__PURE__ */ e.jsx(pe, { className: "ml-2 h-5 w-5" })
|
|
190
|
+
]
|
|
191
|
+
},
|
|
192
|
+
r
|
|
193
|
+
))
|
|
194
|
+
) }),
|
|
195
|
+
/* @__PURE__ */ e.jsxs(
|
|
196
|
+
ne,
|
|
197
|
+
{
|
|
198
|
+
onMouseEnter: () => c.current ? clearTimeout(c.current) : null,
|
|
199
|
+
className: "z-10 -mt-2 flex h-full max-h-full w-[300px] flex-col gap-2 border-l border-gray-300 transition-all ease-linear",
|
|
200
|
+
children: [
|
|
201
|
+
/* @__PURE__ */ e.jsx("div", { className: "sticky top-0 z-30 border-b border-gray-300 bg-gray-200 p-2 text-[9px] font-light leading-3 text-gray-500", children: g("Click on a block to add it to the page") }),
|
|
202
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col gap-2 px-2", children: L.Children.toArray(
|
|
203
|
+
k.map((o) => /* @__PURE__ */ e.jsx(be, { block: o, library: s, closePopover: () => b(xe) }))
|
|
204
|
+
) }),
|
|
205
|
+
/* @__PURE__ */ e.jsx("br", {}),
|
|
206
|
+
/* @__PURE__ */ e.jsx("br", {}),
|
|
207
|
+
/* @__PURE__ */ e.jsx("br", {})
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
)
|
|
211
|
+
] })
|
|
212
|
+
] }) });
|
|
213
|
+
}, ut = () => /* @__PURE__ */ e.jsx(Be, {});
|
|
214
|
+
export {
|
|
215
|
+
ut as default
|
|
216
|
+
};
|