@chaibuilder/sdk 1.2.48 → 1.2.49
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-cX8vIt0V.js → AddBlocks-JCSA6hLF.js} +8 -8
- package/dist/{AddBlocks-_fhhS7Lm.cjs → AddBlocks-JiIeMTE-.cjs} +1 -1
- package/dist/{CanvasArea-N3rYeBJV.cjs → CanvasArea-K_d6ORTZ.cjs} +1 -1
- package/dist/{CanvasArea-HRipTJFS.js → CanvasArea-c3xbVSoY.js} +13 -13
- package/dist/{ChaiBuilderEditor-dKHRL-Es.js → ChaiBuilderEditor-F2yUJQdt.js} +1533 -1528
- package/dist/{ChaiBuilderEditor-EtQOC5uy.cjs → ChaiBuilderEditor-lqHQcnh3.cjs} +25 -25
- package/dist/{CurrentPage-U8ms8Hs7.js → CurrentPage--lDu6fB9.js} +2 -2
- package/dist/{CurrentPage-9FijxWbn.cjs → CurrentPage-DnQKF1wT.cjs} +1 -1
- package/dist/{ListTree-OgLdyfQs.js → ListTree-7DWSal1i.js} +120 -111
- package/dist/ListTree-HVFqaM0-.cjs +1 -0
- package/dist/{PagesPanel-MsUBq9Xx.js → PagesPanel-D1TOGyVE.js} +3 -3
- package/dist/{PagesPanel-8Cd6UYsh.cjs → PagesPanel-pIFhxLGC.cjs} +1 -1
- package/dist/{ProjectPanel-hsZG_Btj.js → ProjectPanel-PdvQsrbk.js} +3 -3
- package/dist/{ProjectPanel-KmnXPfxx.cjs → ProjectPanel-t7s3-URx.cjs} +1 -1
- package/dist/Settings-WevLeOpk.cjs +1 -0
- package/dist/{Settings-WcLqIeQy.js → Settings-aEcWAB0x.js} +268 -263
- package/dist/{SidePanels-6zRgfZpi.cjs → SidePanels-mavyE3q_.cjs} +1 -1
- package/dist/{SidePanels-PmCljlnf.js → SidePanels-uym8wfA0.js} +103 -110
- package/dist/{ThemeConfiguration-mkbFdePB.js → ThemeConfiguration-7J_Qt53c.js} +5 -5
- package/dist/{ThemeConfiguration-pt7TTAty.cjs → ThemeConfiguration-F-_ieF8J.cjs} +1 -1
- package/dist/{Topbar-FPywhpub.js → Topbar-DkbE0ccQ.js} +1 -1
- package/dist/{Topbar--m1E08Jl.cjs → Topbar-FjX_5927.cjs} +1 -1
- package/dist/UILibrariesPanel-3cSqwsMi.js +196 -0
- package/dist/UILibrariesPanel-qsjCsv10.cjs +1 -0
- package/dist/{UnsplashImages-Yu0msAD8.cjs → UnsplashImages-5skIflMr.cjs} +1 -1
- package/dist/{UnsplashImages-7uAXYHPH.js → UnsplashImages-owPv8UfV.js} +3 -3
- package/dist/{UploadImages-jS51ZcPG.cjs → UploadImages-olCKp-66.cjs} +1 -1
- package/dist/{UploadImages-5M0Q27R-.js → UploadImages-zGp0fN1z.js} +1 -1
- package/dist/{add-page-modal-KAbflupJ.cjs → add-page-modal-JE2NTOKQ.cjs} +1 -1
- package/dist/{add-page-modal-6o7MAbq-.js → add-page-modal-pOnhQNMH.js} +3 -3
- package/dist/{confirm-alert-dow0GlxC.cjs → confirm-alert-GTawvuT8.cjs} +1 -1
- package/dist/{confirm-alert-jL0z_gFv.js → confirm-alert-lbkop3bB.js} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-U5_JYYp7.js → delete-page-modal-3OWHRhV4.js} +2 -2
- package/dist/{delete-page-modal-EDQZneVM.cjs → delete-page-modal-S42VXCGh.cjs} +1 -1
- package/dist/email.cjs +1 -1
- package/dist/email.js +1 -1
- package/dist/{form-Sgpl2fXL.js → form-CetbKOxf.js} +5 -5
- package/dist/{form-KBtrnNWh.cjs → form-Rqiu0P7V.cjs} +1 -1
- package/dist/{functions-7ybAMUuA.js → functions-WB3m-mfN.js} +6 -7
- package/dist/functions-fujiWLsg.cjs +1 -0
- package/dist/{index-po-naEa5.js → index-Mzvi8sMV.js} +2 -2
- package/dist/{index-HjN7LtDT.cjs → index-SZn6KcOd.cjs} +1 -1
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.ts +1 -1
- package/dist/lib.js +17 -18
- package/dist/{page-viewer-nLRRk7DR.js → page-viewer-7iyxGntn.js} +8 -8
- package/dist/{page-viewer-PfZEbcDZ.cjs → page-viewer-fFmRhZs3.cjs} +1 -1
- package/dist/{project-general-setting-HO6zeum2.cjs → project-general-setting-0HJ_qyW3.cjs} +1 -1
- package/dist/{project-general-setting-D1UJdZ2D.js → project-general-setting-tHdsXTwH.js} +7 -7
- package/dist/{project-seo-setting-gT9N1tnB.cjs → project-seo-setting-Ln9aX7b5.cjs} +1 -1
- package/dist/{project-seo-setting-VIZWEMRk.js → project-seo-setting-zEBZ91Xk.js} +2 -2
- package/dist/render.cjs +1 -1
- package/dist/render.js +68 -68
- package/dist/{single-page-detail-To8TcpgJ.cjs → single-page-detail-H0heOB33.cjs} +1 -1
- package/dist/{single-page-detail-lQ8fujC5.js → single-page-detail-RBfdbTs3.js} +4 -4
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +2 -2
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +31 -31
- package/dist/{useCanvasSettings-UzjYHFG5.js → useCanvasSettings-2YhM5XKu.js} +1 -1
- package/dist/{useCanvasSettings-7BXlDuLG.cjs → useCanvasSettings-tDzAqXUt.cjs} +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +1 -1
- package/package.json +1 -1
- package/dist/ListTree-jOvHpo3_.cjs +0 -1
- package/dist/Settings-xVjTnVSf.cjs +0 -1
- package/dist/UILibrariesPanel-HhHGcexY.cjs +0 -1
- package/dist/UILibrariesPanel-VrA2X4LO.js +0 -145
- package/dist/functions-yvRwasT2.cjs +0 -1
|
@@ -1 +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"),S=require("jotai"),u=require("lodash-es"),s=require("./ChaiBuilderEditor-EtQOC5uy.cjs"),E=require("lucide-react"),_=require("@chaibuilder/runtime"),v=require("react-i18next"),q=require("./index-gi1LIOCw.cjs"),x=require("./STRINGS-gPz7CUOk.cjs"),D=require("./Functions-N3yhPYKY.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("i18next");require("flagged");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("tree-model");require("./utils-K3Zk762G.cjs");require("tailwind-merge");require("@radix-ui/react-toggle");require("class-variance-authority");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-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-quill");require("react-hotkeys-hook");const I=({provider:t,onClose:a})=>{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?"":a(),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(s.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(q.JsonView,{data:l,shouldExpandNode:q.allExpanded,style:{...q.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:a,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}",a)}}),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 P=()=>{const{t}=v.useTranslation(),a=i.useMemo(()=>_.getChaiDataProviders(),[]),[o,l]=s.usePageDataProviders(),[,p]=S.useAtom(s.builderSaveStateAtom),[m,d]=i.useState(u.filter(a,r=>u.map(o,"providerKey").includes(r.providerKey))),[b,h]=i.useState(""),[N,f]=i.useState(null),y=u.filter(a.map(r=>u.map(m,"providerKey").includes(r.providerKey)?null:{value:r.providerKey,label:r.name}),r=>!u.isNull(r)),w=r=>{const j=u.find(a,{providerKey:r});d(n=>[...n,j]),l(n=>[...n,{providerKey:j.providerKey,args:{}}]),h(""),p("UNSAVED")},g=r=>{d(j=>u.filter(j,n=>n.providerKey!==r.providerKey)),l(j=>u.filter(j,n=>n.providerKey!==r.providerKey)),p("UNSAVED")},c=r=>f(r);return u.isEmpty(a)?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:()=>c(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(I,{onClose:()=>f(null),provider:N})]})]})},L=i.memo(()=>{const{t}=v.useTranslation(),a={"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,{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(a).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(a[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))})]})})]})]})}),B=i.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-_fhhS7Lm.cjs"))),k=i.lazy(()=>Promise.resolve().then(()=>require("./ListTree-jOvHpo3_.cjs"))),O=i.lazy(()=>Promise.resolve().then(()=>require("./ThemeConfiguration-pt7TTAty.cjs"))),A=i.lazy(()=>Promise.resolve().then(()=>require("./ChaiBuilderEditor-EtQOC5uy.cjs")).then(t=>t.ImagesPanel)),U=i.lazy(()=>Promise.resolve().then(()=>require("./UILibrariesPanel-HhHGcexY.cjs")));let C=null;const z=()=>{const t=s.useBuilderProp("sideBarComponents.top",[]),a=s.useBuilderProp("sideBarComponents.bottom",[]),[o,l]=S.useAtom(s.activePanelAtom),[p,m]=i.useState(o),[d,b]=i.useState(null),{t:h}=v.useTranslation(),N=s.useBuilderProp("uiLibraries",[]),f=_.useChaiBlocks(),y=u.values(f).find(n=>n.category==="custom")!==void 0,w=N.length>0||y,g={"add-blocks":B,[x.OUTLINE_KEY]:k,"theme-configuration":O,images:A,"ui-libraries":U};u.each(t,({name:n,panel:T})=>{g[n]=T});const c=n=>{clearTimeout(C),o!==x.OUTLINE_KEY&&n===x.OUTLINE_KEY?C=setTimeout(()=>l(x.OUTLINE_KEY),500):m(n),l(n)},r=s.useBuilderProp("dataBindingSupport",!1);function j(){const n=setTimeout(()=>{d&&(c(x.OUTLINE_KEY),clearTimeout(d))},500);b(n)}return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[o!==x.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{onMouseEnter:j,onClick:()=>c(x.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:()=>c("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:()=>c("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:()=>c("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:()=>c(x.OUTLINE_KEY),size:"sm",variant:o===x.OUTLINE_KEY?"default":"outline",children:e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>c("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:T})=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>c(n),size:"sm",className:"w-10",variant:o===n?"default":"outline",children:e.jsxRuntimeExports.jsx(T,{})})})))]}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2",children:[e.jsxRuntimeExports.jsx(L,{}),i.Children.toArray(a.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))]})]}),o!==x.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:D.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(u.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:x.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:x.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:x.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(P,{})})]}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:x.OUTLINE_KEY,className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsx(s.TabsList,{className:"mx-1 grid h-10 grid-cols-1",children:e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:x.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"mr-2 h-3"})," ",h("Outline")]})}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:x.OUTLINE_KEY,className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(k)})]})})})})]})};exports.default=z;
|
|
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"),S=require("jotai"),c=require("lodash-es"),s=require("./ChaiBuilderEditor-lqHQcnh3.cjs"),E=require("lucide-react"),D=require("@chaibuilder/runtime"),v=require("react-i18next"),T=require("./index-gi1LIOCw.cjs"),a=require("./STRINGS-gPz7CUOk.cjs"),P=require("./Functions-N3yhPYKY.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("i18next");require("flagged");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("tree-model");require("./utils-K3Zk762G.cjs");require("tailwind-merge");require("@radix-ui/react-toggle");require("class-variance-authority");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-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-quill");require("react-hotkeys-hook");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(s.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 I({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 K=()=>{const{t}=v.useTranslation(),x=i.useMemo(()=>D.getChaiDataProviders(),[]),[o,l]=s.usePageDataProviders(),[,p]=S.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(I,{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})]})]})},L=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,{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))})]})})]})]})}),B=i.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-JiIeMTE-.cjs"))),k=i.lazy(()=>Promise.resolve().then(()=>require("./ListTree-HVFqaM0-.cjs"))),A=i.lazy(()=>Promise.resolve().then(()=>require("./ThemeConfiguration-F-_ieF8J.cjs"))),O=i.lazy(()=>Promise.resolve().then(()=>require("./ChaiBuilderEditor-lqHQcnh3.cjs")).then(t=>t.ImagesPanel)),U=i.lazy(()=>Promise.resolve().then(()=>require("./UILibrariesPanel-qsjCsv10.cjs")));let C=null;const z=()=>{const t=s.useBuilderProp("sideBarComponents.top",[]),x=s.useBuilderProp("sideBarComponents.bottom",[]),[o,l]=S.useAtom(s.activePanelAtom),[p,m]=i.useState(o),[d,b]=i.useState(null),{t:h}=v.useTranslation(),N=s.useBuilderProp("uiLibraries",[]),f=D.useChaiBlocks(),y=c.values(f).find(n=>n.category==="custom")!==void 0,w=N.length>0||y,g={"add-blocks":B,[a.OUTLINE_KEY]:k,"theme-configuration":A,images:O,"ui-libraries":U};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(L,{}),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:P.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(K,{})})]}):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=z;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { KeyboardIcon as
|
|
3
|
-
import f, { useState as
|
|
4
|
-
import { useAtom as
|
|
5
|
-
import { filter as
|
|
6
|
-
import { Z as
|
|
7
|
-
import { ListTreeIcon as
|
|
2
|
+
import { KeyboardIcon as R, PlusIcon as S, Component2Icon as J } from "@radix-ui/react-icons";
|
|
3
|
+
import f, { useState as h, useEffect as Z, useMemo as W, memo as Y, lazy as j, Suspense as y } from "react";
|
|
4
|
+
import { useAtom as M } from "jotai";
|
|
5
|
+
import { filter as N, map as K, isNull as $, find as q, isEmpty as G, values as Q, each as X, get as ee } from "lodash-es";
|
|
6
|
+
import { Z as O, _ as H, $ as U, a0 as F, a1 as se, a2 as re, A as ae, a as ie, b as te, c as le, d as oe, e as ne, f as ce, g as de, a3 as me, a4 as xe, a5 as he, a6 as ue, a7 as pe, a8 as fe, a9 as je, aa as B, ab as ve, ac as ge, ad as be, ae as ye, af as E, h as w, ag as Ne, B as x, ah as z, ai as we, aj as ke, ak as L, al as I } from "./ChaiBuilderEditor-F2yUJQdt.js";
|
|
7
|
+
import { ListTreeIcon as A, PaletteIcon as Ce, DatabaseIcon as De } from "lucide-react";
|
|
8
8
|
import { getChaiDataProviders as Te, useChaiBlocks as _e } from "@chaibuilder/runtime";
|
|
9
9
|
import { useTranslation as v } from "react-i18next";
|
|
10
10
|
import { J as Ae, a as Pe, d as Se } from "./index-e0c8PmRQ.js";
|
|
11
|
-
import { O as
|
|
11
|
+
import { O as o } from "./STRINGS--j49GZJP.js";
|
|
12
12
|
import { c as Ke } from "./Functions-7jnEwJyw.js";
|
|
13
13
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
14
14
|
import "clsx";
|
|
@@ -44,23 +44,23 @@ import "@radix-ui/react-context-menu";
|
|
|
44
44
|
import "react-icons-picker";
|
|
45
45
|
import "react-quill";
|
|
46
46
|
import "react-hotkeys-hook";
|
|
47
|
-
const Be = ({ provider: s, onClose:
|
|
48
|
-
const { t:
|
|
49
|
-
return
|
|
50
|
-
s && (s.mockFn ? s.mockFn : s.dataFn)().then((c) =>
|
|
51
|
-
}, [s]), s ? /* @__PURE__ */ e.jsx(
|
|
52
|
-
/* @__PURE__ */ e.jsxs(
|
|
53
|
-
/* @__PURE__ */ e.jsxs(
|
|
54
|
-
|
|
47
|
+
const Be = ({ provider: s, onClose: l }) => {
|
|
48
|
+
const { t: i } = v(), [t, u] = h(null);
|
|
49
|
+
return Z(() => {
|
|
50
|
+
s && (s.mockFn ? s.mockFn : s.dataFn)().then((c) => u(c));
|
|
51
|
+
}, [s]), s ? /* @__PURE__ */ e.jsx(O, { onOpenChange: (d) => d ? "" : l(), defaultOpen: !0, children: /* @__PURE__ */ e.jsxs(H, { children: [
|
|
52
|
+
/* @__PURE__ */ e.jsxs(U, { children: [
|
|
53
|
+
/* @__PURE__ */ e.jsxs(F, { children: [
|
|
54
|
+
i("data_provider"),
|
|
55
55
|
": ",
|
|
56
56
|
s.name
|
|
57
57
|
] }),
|
|
58
|
-
/* @__PURE__ */ e.jsx(
|
|
58
|
+
/* @__PURE__ */ e.jsx(se, { children: s.description })
|
|
59
59
|
] }),
|
|
60
|
-
/* @__PURE__ */ e.jsx(
|
|
60
|
+
/* @__PURE__ */ e.jsx(re, { children: /* @__PURE__ */ e.jsx(
|
|
61
61
|
Ae,
|
|
62
62
|
{
|
|
63
|
-
data:
|
|
63
|
+
data: t,
|
|
64
64
|
shouldExpandNode: Pe,
|
|
65
65
|
style: {
|
|
66
66
|
...Se,
|
|
@@ -74,53 +74,53 @@ const Be = ({ provider: s, onClose: o }) => {
|
|
|
74
74
|
};
|
|
75
75
|
function Ee({
|
|
76
76
|
children: s,
|
|
77
|
-
name:
|
|
78
|
-
onRemove:
|
|
77
|
+
name: l,
|
|
78
|
+
onRemove: i
|
|
79
79
|
}) {
|
|
80
|
-
const { t
|
|
81
|
-
return /* @__PURE__ */ e.jsxs(
|
|
82
|
-
/* @__PURE__ */ e.jsx(
|
|
83
|
-
/* @__PURE__ */ e.jsxs(
|
|
84
|
-
/* @__PURE__ */ e.jsxs(
|
|
80
|
+
const { t } = v();
|
|
81
|
+
return /* @__PURE__ */ e.jsxs(ae, { children: [
|
|
82
|
+
/* @__PURE__ */ e.jsx(ie, { asChild: !0, children: s }),
|
|
83
|
+
/* @__PURE__ */ e.jsxs(te, { children: [
|
|
84
|
+
/* @__PURE__ */ e.jsxs(le, { children: [
|
|
85
85
|
/* @__PURE__ */ e.jsx(
|
|
86
|
-
|
|
86
|
+
oe,
|
|
87
87
|
{
|
|
88
|
-
dangerouslySetInnerHTML: { __html:
|
|
88
|
+
dangerouslySetInnerHTML: { __html: t("remove_provider_confirmation").replace("{name}", l) }
|
|
89
89
|
}
|
|
90
90
|
),
|
|
91
|
-
/* @__PURE__ */ e.jsx(
|
|
91
|
+
/* @__PURE__ */ e.jsx(ne, { children: t("remove_provider_warning") })
|
|
92
92
|
] }),
|
|
93
|
-
/* @__PURE__ */ e.jsxs(
|
|
94
|
-
/* @__PURE__ */ e.jsx(
|
|
95
|
-
/* @__PURE__ */ e.jsx(
|
|
93
|
+
/* @__PURE__ */ e.jsxs(ce, { children: [
|
|
94
|
+
/* @__PURE__ */ e.jsx(de, { children: t("cancel") }),
|
|
95
|
+
/* @__PURE__ */ e.jsx(me, { onClick: i, className: "bg-red-600 hover:bg-red-700", children: t("remove") })
|
|
96
96
|
] })
|
|
97
97
|
] })
|
|
98
98
|
] });
|
|
99
99
|
}
|
|
100
100
|
const ze = () => {
|
|
101
|
-
const { t: s } = v(),
|
|
102
|
-
|
|
103
|
-
), [k, p] =
|
|
104
|
-
|
|
105
|
-
(r) =>
|
|
101
|
+
const { t: s } = v(), l = W(() => Te(), []), [i, t] = xe(), [, u] = M(he), [d, c] = h(
|
|
102
|
+
N(l, (r) => K(i, "providerKey").includes(r.providerKey))
|
|
103
|
+
), [k, p] = h(""), [C, g] = h(null), D = N(
|
|
104
|
+
l.map((r) => K(d, "providerKey").includes(r.providerKey) ? null : { value: r.providerKey, label: r.name }),
|
|
105
|
+
(r) => !$(r)
|
|
106
106
|
), T = (r) => {
|
|
107
|
-
const m =
|
|
108
|
-
c((a) => [...a, m]),
|
|
107
|
+
const m = q(l, { providerKey: r });
|
|
108
|
+
c((a) => [...a, m]), t((a) => [...a, { providerKey: m.providerKey, args: {} }]), p(""), u("UNSAVED");
|
|
109
109
|
}, b = (r) => {
|
|
110
|
-
c((m) =>
|
|
110
|
+
c((m) => N(m, (a) => a.providerKey !== r.providerKey)), t((m) => N(m, (a) => a.providerKey !== r.providerKey)), u("UNSAVED");
|
|
111
111
|
}, n = (r) => g(r);
|
|
112
|
-
return
|
|
112
|
+
return G(l) ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
|
|
113
113
|
s("no_data_providers"),
|
|
114
114
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
115
115
|
/* @__PURE__ */ e.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: s("learn_more") })
|
|
116
116
|
] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "px-1", children: [
|
|
117
117
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
118
118
|
/* @__PURE__ */ e.jsx("label", { children: /* @__PURE__ */ e.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: s("add_data_providers") }) }),
|
|
119
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(
|
|
120
|
-
/* @__PURE__ */ e.jsx(
|
|
121
|
-
/* @__PURE__ */ e.jsxs(
|
|
122
|
-
/* @__PURE__ */ e.jsx(
|
|
123
|
-
D.map((r) => /* @__PURE__ */ e.jsx(
|
|
119
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(ue, { value: k, onValueChange: (r) => T(r), children: [
|
|
120
|
+
/* @__PURE__ */ e.jsx(pe, { className: "w-full", children: /* @__PURE__ */ e.jsx(fe, { placeholder: s("select_provider") }) }),
|
|
121
|
+
/* @__PURE__ */ e.jsxs(je, { children: [
|
|
122
|
+
/* @__PURE__ */ e.jsx(B, { value: "", children: s("choose") }),
|
|
123
|
+
D.map((r) => /* @__PURE__ */ e.jsx(B, { value: r.value, children: r.label }, r.value))
|
|
124
124
|
] })
|
|
125
125
|
] }) }),
|
|
126
126
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
@@ -200,64 +200,64 @@ const ze = () => {
|
|
|
200
200
|
/* @__PURE__ */ e.jsx(Be, { onClose: () => g(null), provider: C })
|
|
201
201
|
] })
|
|
202
202
|
] });
|
|
203
|
-
}, Le =
|
|
204
|
-
const { t: s } = v(),
|
|
203
|
+
}, Le = Y(() => {
|
|
204
|
+
const { t: s } = v(), l = {
|
|
205
205
|
"ctrl + Z": "Undo",
|
|
206
206
|
"ctrl + Y": "Redo",
|
|
207
207
|
"ctrl + D": "Duplicate"
|
|
208
|
-
},
|
|
208
|
+
}, i = {
|
|
209
209
|
// "ctrl + /": "Rename block",
|
|
210
210
|
"ctrl + S": "Save page",
|
|
211
211
|
esc: "Deselect blocks",
|
|
212
212
|
del: "Delete block"
|
|
213
213
|
};
|
|
214
|
-
return /* @__PURE__ */ e.jsxs(
|
|
215
|
-
/* @__PURE__ */ e.jsx(
|
|
216
|
-
/* @__PURE__ */ e.jsx(
|
|
217
|
-
/* @__PURE__ */ e.jsx(
|
|
214
|
+
return /* @__PURE__ */ e.jsxs(O, { children: [
|
|
215
|
+
/* @__PURE__ */ e.jsx(ve, { children: /* @__PURE__ */ e.jsxs(ge, { children: [
|
|
216
|
+
/* @__PURE__ */ e.jsx(be, { children: /* @__PURE__ */ e.jsx("div", { className: "flex w-10 items-center justify-center", children: /* @__PURE__ */ e.jsx(R, {}) }) }),
|
|
217
|
+
/* @__PURE__ */ e.jsx(ye, { children: /* @__PURE__ */ e.jsx("p", { children: s("Keyboard shortcuts") }) })
|
|
218
218
|
] }) }),
|
|
219
|
-
/* @__PURE__ */ e.jsxs(
|
|
220
|
-
/* @__PURE__ */ e.jsx(
|
|
219
|
+
/* @__PURE__ */ e.jsxs(H, { className: "sm:max-w-[525px]", children: [
|
|
220
|
+
/* @__PURE__ */ e.jsx(U, { children: /* @__PURE__ */ e.jsx(F, { children: s("Keyboard shortcuts") }) }),
|
|
221
221
|
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-2", children: [
|
|
222
|
-
/* @__PURE__ */ e.jsx("div", { className: "mr-8 flex flex-col space-y-2 border-r border-gray-200", children: Object.keys(
|
|
223
|
-
/* @__PURE__ */ e.jsx(
|
|
224
|
-
/* @__PURE__ */ e.jsx("div", { children: s(
|
|
225
|
-
] },
|
|
226
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col space-y-2", children: Object.keys(
|
|
227
|
-
/* @__PURE__ */ e.jsx(
|
|
228
|
-
/* @__PURE__ */ e.jsx("div", { children: s(
|
|
229
|
-
] },
|
|
222
|
+
/* @__PURE__ */ e.jsx("div", { className: "mr-8 flex flex-col space-y-2 border-r border-gray-200", children: Object.keys(l).map((t) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
223
|
+
/* @__PURE__ */ e.jsx(E, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(t) }),
|
|
224
|
+
/* @__PURE__ */ e.jsx("div", { children: s(l[t]) })
|
|
225
|
+
] }, t)) }),
|
|
226
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col space-y-2", children: Object.keys(i).map((t) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
227
|
+
/* @__PURE__ */ e.jsx(E, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(t) }),
|
|
228
|
+
/* @__PURE__ */ e.jsx("div", { children: s(i[t]) })
|
|
229
|
+
] }, t)) })
|
|
230
230
|
] }) })
|
|
231
231
|
] })
|
|
232
232
|
] });
|
|
233
|
-
}),
|
|
234
|
-
let
|
|
233
|
+
}), Ie = j(() => import("./AddBlocks-JCSA6hLF.js")), P = j(() => import("./ListTree-7DWSal1i.js")), Ve = j(() => import("./ThemeConfiguration-7J_Qt53c.js")), Me = j(() => import("./ChaiBuilderEditor-F2yUJQdt.js").then((s) => s.cs)), Oe = j(() => import("./UILibrariesPanel-3cSqwsMi.js"));
|
|
234
|
+
let V = null;
|
|
235
235
|
const Bs = () => {
|
|
236
|
-
const s = w("sideBarComponents.top", []),
|
|
237
|
-
"add-blocks":
|
|
238
|
-
[
|
|
239
|
-
"theme-configuration":
|
|
236
|
+
const s = w("sideBarComponents.top", []), l = w("sideBarComponents.bottom", []), [i, t] = M(Ne), [u, d] = h(i), [c, k] = h(null), { t: p } = v(), C = w("uiLibraries", []), g = _e(), D = Q(g).find((a) => a.category === "custom") !== void 0, T = C.length > 0 || D, b = {
|
|
237
|
+
"add-blocks": Ie,
|
|
238
|
+
[o]: P,
|
|
239
|
+
"theme-configuration": Ve,
|
|
240
240
|
images: Me,
|
|
241
241
|
"ui-libraries": Oe
|
|
242
242
|
};
|
|
243
|
-
|
|
243
|
+
X(s, ({ name: a, panel: _ }) => {
|
|
244
244
|
b[a] = _;
|
|
245
245
|
});
|
|
246
246
|
const n = (a) => {
|
|
247
|
-
clearTimeout(
|
|
247
|
+
clearTimeout(V), i !== o && a === o ? V = setTimeout(() => t(o), 500) : d(a), t(a);
|
|
248
248
|
}, r = w("dataBindingSupport", !1);
|
|
249
249
|
function m() {
|
|
250
250
|
const a = setTimeout(() => {
|
|
251
|
-
c && (n(
|
|
251
|
+
c && (n(o), clearTimeout(c));
|
|
252
252
|
}, 500);
|
|
253
253
|
k(a);
|
|
254
254
|
}
|
|
255
255
|
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex", children: [
|
|
256
|
-
|
|
256
|
+
i !== o ? /* @__PURE__ */ e.jsx(
|
|
257
257
|
"div",
|
|
258
258
|
{
|
|
259
259
|
onMouseEnter: m,
|
|
260
|
-
onClick: () => n(
|
|
260
|
+
onClick: () => n(o),
|
|
261
261
|
className: "fixed inset-0 z-[50] bg-black/20"
|
|
262
262
|
}
|
|
263
263
|
) : null,
|
|
@@ -269,8 +269,8 @@ const Bs = () => {
|
|
|
269
269
|
{
|
|
270
270
|
onClick: () => n("add-blocks"),
|
|
271
271
|
size: "sm",
|
|
272
|
-
variant:
|
|
273
|
-
children: /* @__PURE__ */ e.jsx(
|
|
272
|
+
variant: i === "add-blocks" ? "default" : "outline",
|
|
273
|
+
children: /* @__PURE__ */ e.jsx(S, { className: "text-xl" })
|
|
274
274
|
}
|
|
275
275
|
),
|
|
276
276
|
/* @__PURE__ */ e.jsx(
|
|
@@ -278,8 +278,8 @@ const Bs = () => {
|
|
|
278
278
|
{
|
|
279
279
|
onClick: () => n("ui-libraries"),
|
|
280
280
|
size: "sm",
|
|
281
|
-
variant:
|
|
282
|
-
children: /* @__PURE__ */ e.jsx(
|
|
281
|
+
variant: i === "ui-libraries" ? "default" : "outline",
|
|
282
|
+
children: /* @__PURE__ */ e.jsx(J, { className: "text-xl" })
|
|
283
283
|
}
|
|
284
284
|
)
|
|
285
285
|
] }) : /* @__PURE__ */ e.jsx(
|
|
@@ -287,17 +287,17 @@ const Bs = () => {
|
|
|
287
287
|
{
|
|
288
288
|
onClick: () => n("add-blocks"),
|
|
289
289
|
size: "sm",
|
|
290
|
-
variant:
|
|
291
|
-
children: /* @__PURE__ */ e.jsx(
|
|
290
|
+
variant: i === "add-blocks" ? "default" : "outline",
|
|
291
|
+
children: /* @__PURE__ */ e.jsx(S, { className: "text-xl" })
|
|
292
292
|
}
|
|
293
293
|
),
|
|
294
294
|
/* @__PURE__ */ e.jsx(
|
|
295
295
|
x,
|
|
296
296
|
{
|
|
297
|
-
onClick: () => n(
|
|
297
|
+
onClick: () => n(o),
|
|
298
298
|
size: "sm",
|
|
299
|
-
variant:
|
|
300
|
-
children: /* @__PURE__ */ e.jsx(
|
|
299
|
+
variant: i === o ? "default" : "outline",
|
|
300
|
+
children: /* @__PURE__ */ e.jsx(A, { className: "w-4" })
|
|
301
301
|
}
|
|
302
302
|
),
|
|
303
303
|
/* @__PURE__ */ e.jsx(
|
|
@@ -305,18 +305,18 @@ const Bs = () => {
|
|
|
305
305
|
{
|
|
306
306
|
onClick: () => n("theme-configuration"),
|
|
307
307
|
size: "sm",
|
|
308
|
-
variant:
|
|
308
|
+
variant: i === "theme-configuration" ? "default" : "outline",
|
|
309
309
|
children: /* @__PURE__ */ e.jsx(Ce, { className: "w-4 max-w-[40px] text-xs" })
|
|
310
310
|
}
|
|
311
311
|
),
|
|
312
312
|
f.Children.toArray(
|
|
313
|
-
s.map(({ name: a, icon: _ }) => /* @__PURE__ */ e.jsx(
|
|
313
|
+
s.map(({ name: a, icon: _ }) => /* @__PURE__ */ e.jsx(y, { fallback: /* @__PURE__ */ e.jsx(z, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(
|
|
314
314
|
x,
|
|
315
315
|
{
|
|
316
316
|
onClick: () => n(a),
|
|
317
317
|
size: "sm",
|
|
318
318
|
className: "w-10",
|
|
319
|
-
variant:
|
|
319
|
+
variant: i === a ? "default" : "outline",
|
|
320
320
|
children: /* @__PURE__ */ e.jsx(_, {})
|
|
321
321
|
}
|
|
322
322
|
) }))
|
|
@@ -325,16 +325,16 @@ const Bs = () => {
|
|
|
325
325
|
/* @__PURE__ */ e.jsxs("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2", children: [
|
|
326
326
|
/* @__PURE__ */ e.jsx(Le, {}),
|
|
327
327
|
f.Children.toArray(
|
|
328
|
-
|
|
328
|
+
l.map((a) => /* @__PURE__ */ e.jsx(y, { fallback: /* @__PURE__ */ e.jsx(z, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(a, {}) }))
|
|
329
329
|
)
|
|
330
330
|
] })
|
|
331
331
|
] }),
|
|
332
|
-
|
|
332
|
+
i !== o ? /* @__PURE__ */ e.jsx(
|
|
333
333
|
"div",
|
|
334
334
|
{
|
|
335
335
|
className: "absolute left-14 z-[50] h-[100vh] w-fit translate-x-0 border-r bg-background transition-all duration-500 ease-in-out",
|
|
336
336
|
children: /* @__PURE__ */ e.jsx(
|
|
337
|
-
|
|
337
|
+
y,
|
|
338
338
|
{
|
|
339
339
|
fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-2 bg-white p-4", children: [
|
|
340
340
|
/* @__PURE__ */ e.jsx("div", { className: "h-6 w-1/2 bg-gray-300" }),
|
|
@@ -350,7 +350,7 @@ const Bs = () => {
|
|
|
350
350
|
onMouseEnter: () => {
|
|
351
351
|
c && clearTimeout(c);
|
|
352
352
|
},
|
|
353
|
-
children: f.createElement(
|
|
353
|
+
children: f.createElement(ee(b, i, () => /* @__PURE__ */ e.jsx("div", {})))
|
|
354
354
|
}
|
|
355
355
|
)
|
|
356
356
|
}
|
|
@@ -358,42 +358,35 @@ const Bs = () => {
|
|
|
358
358
|
}
|
|
359
359
|
) : null,
|
|
360
360
|
/* @__PURE__ */ e.jsx("div", { className: "h-full w-60 border-r p-1", children: /* @__PURE__ */ e.jsx(
|
|
361
|
-
|
|
361
|
+
y,
|
|
362
362
|
{
|
|
363
363
|
fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-2 p-4", children: [
|
|
364
364
|
/* @__PURE__ */ e.jsx("div", { className: "h-6 w-1/2 bg-gray-300" }),
|
|
365
365
|
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" }),
|
|
366
366
|
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" })
|
|
367
367
|
] }),
|
|
368
|
-
children: r ? /* @__PURE__ */ e.jsxs(
|
|
369
|
-
/* @__PURE__ */ e.jsxs(
|
|
370
|
-
/* @__PURE__ */ e.jsxs(
|
|
371
|
-
/* @__PURE__ */ e.jsx(
|
|
368
|
+
children: r ? /* @__PURE__ */ e.jsxs(we, { defaultValue: o, className: "flex h-full w-full flex-col py-1", children: [
|
|
369
|
+
/* @__PURE__ */ e.jsxs(ke, { className: "mx-1 grid h-10 grid-cols-2", children: [
|
|
370
|
+
/* @__PURE__ */ e.jsxs(L, { value: o, children: [
|
|
371
|
+
/* @__PURE__ */ e.jsx(A, { className: "mr-2 h-3" }),
|
|
372
372
|
" ",
|
|
373
373
|
p("Outline")
|
|
374
374
|
] }),
|
|
375
|
-
/* @__PURE__ */ e.jsxs(
|
|
375
|
+
/* @__PURE__ */ e.jsxs(L, { value: "data-provider", children: [
|
|
376
376
|
/* @__PURE__ */ e.jsx(De, { className: "mr-2 w-3" }),
|
|
377
377
|
p("Data")
|
|
378
378
|
] })
|
|
379
379
|
] }),
|
|
380
|
-
/* @__PURE__ */ e.jsx(
|
|
381
|
-
/* @__PURE__ */ e.jsx(
|
|
382
|
-
] }) : /* @__PURE__ */ e.
|
|
383
|
-
/* @__PURE__ */ e.
|
|
384
|
-
/* @__PURE__ */ e.jsx(
|
|
380
|
+
/* @__PURE__ */ e.jsx(I, { value: o, className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children: f.createElement(P) }),
|
|
381
|
+
/* @__PURE__ */ e.jsx(I, { value: "data-provider", className: "flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(ze, {}) })
|
|
382
|
+
] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
383
|
+
/* @__PURE__ */ e.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: [
|
|
384
|
+
/* @__PURE__ */ e.jsx(A, { className: "mr-2 h-3" }),
|
|
385
385
|
" ",
|
|
386
386
|
p("Outline")
|
|
387
|
-
] })
|
|
388
|
-
/* @__PURE__ */ e.jsx(
|
|
389
|
-
|
|
390
|
-
{
|
|
391
|
-
value: t,
|
|
392
|
-
className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",
|
|
393
|
-
children: f.createElement(K)
|
|
394
|
-
}
|
|
395
|
-
)
|
|
396
|
-
] }) })
|
|
387
|
+
] }),
|
|
388
|
+
/* @__PURE__ */ e.jsx("div", { className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden pt-2", children: f.createElement(P) })
|
|
389
|
+
] })
|
|
397
390
|
}
|
|
398
391
|
) })
|
|
399
392
|
] });
|
|
@@ -2,7 +2,7 @@ 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, F as w,
|
|
5
|
+
import { h as T, F as w, by as D } from "./ChaiBuilderEditor-F2yUJQdt.js";
|
|
6
6
|
import { y as f, c as P, f as a } from "./controls-VTdJhdSz.js";
|
|
7
7
|
import { debounce as R, noop as F, isEqual as M } from "lodash-es";
|
|
8
8
|
import { useTranslation as L } from "react-i18next";
|
|
@@ -121,8 +121,8 @@ const E = ({ value: u, onChange: e, id: p, onBlur: m }) => {
|
|
|
121
121
|
bodyFont: h,
|
|
122
122
|
headingFont: b,
|
|
123
123
|
primaryColor: x,
|
|
124
|
-
bodyTextDarkColor:
|
|
125
|
-
bodyTextLightColor:
|
|
124
|
+
bodyTextDarkColor: y,
|
|
125
|
+
bodyTextLightColor: C,
|
|
126
126
|
bodyBgDarkColor: S,
|
|
127
127
|
secondaryColor: B,
|
|
128
128
|
bodyBgLightColor: O,
|
|
@@ -154,7 +154,7 @@ const E = ({ value: u, onChange: e, id: p, onBlur: m }) => {
|
|
|
154
154
|
}),
|
|
155
155
|
bodyTextLightColor: a({
|
|
156
156
|
title: "Text color",
|
|
157
|
-
default:
|
|
157
|
+
default: y
|
|
158
158
|
}),
|
|
159
159
|
bodyBgDarkColor: a({
|
|
160
160
|
title: "Background (Dark mode)",
|
|
@@ -162,7 +162,7 @@ const E = ({ value: u, onChange: e, id: p, onBlur: m }) => {
|
|
|
162
162
|
}),
|
|
163
163
|
bodyTextDarkColor: a({
|
|
164
164
|
title: "Text color(Dark mode)",
|
|
165
|
-
default:
|
|
165
|
+
default: C
|
|
166
166
|
})
|
|
167
167
|
});
|
|
168
168
|
const n = {
|
|
@@ -1 +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("./ChaiBuilderEditor-
|
|
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("./ChaiBuilderEditor-lqHQcnh3.cjs"),r=require("./controls-jWJDao88.cjs"),f=require("lodash-es"),k=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("./STRINGS-gPz7CUOk.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("tree-model");require("./utils-K3Zk762G.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");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-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-quill");require("react-hotkeys-hook");require("lucide-react");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 q=P(B),T=({value:t,onChange:e,id:i,onBlur:l})=>{const n=f.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})})})},x=[{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",f.noop),[e,i]=p.useBrandingOptions(),[l]=p.useBlocksContainer(),n=q.useRef(e),{t:v}=k.useTranslation();q.useEffect(()=>()=>{f.isEqual(e,n.current)||t(n.current)},[]);const u=({formData:o},d)=>{d&&(i(o),n.current=o)},{bodyFont:g,headingFont:b,primaryColor:h,bodyTextDarkColor:y,bodyTextLightColor:C,bodyBgDarkColor:S,secondaryColor:j,bodyBgLightColor:O,roundedCorners:R}=e;let s={headingFont:r.y({title:"Heading font",default:b,options:x}),bodyFont:r.y({title:"Body font",default:g,options:x}),roundedCorners:r.c({title:"Rounded Corner",default:parseInt(R||5,10)}),primaryColor:r.f({title:"Primary",default:h}),secondaryColor:r.f({title:"Secondary",default:j})};l||(s={...s,bodyBgLightColor:r.f({title:"Background",default:O}),bodyTextLightColor:r.f({title:"Text color",default:y}),bodyBgDarkColor:r.f({title:"Background (Dark mode)",default:S}),bodyTextDarkColor:r.f({title:"Text color(Dark mode)",default:C})});const c={type:"object",properties:{}},m={};return Object.keys(s).forEach(o=>{const d=s[o];return c.properties||(c.properties={}),c.properties[o]=d.schema,m[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:m,schema:c,formData:e,validator:N,onChange:u})})]})};exports.default=D;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
2
|
import o, { useMemo as h, Suspense as c } from "react";
|
|
3
3
|
import { FontFamilyIcon as j, EyeOpenIcon as g } from "@radix-ui/react-icons";
|
|
4
|
-
import { h as r, a6 as f, a7 as v, a8 as b, a9 as N, am as S, an as w, aa as l, V as y, B as p, ao as C, E as B, ah as m, ap as A } from "./ChaiBuilderEditor-
|
|
4
|
+
import { h as r, a6 as f, a7 as v, a8 as b, a9 as N, am as S, an as w, aa as l, V as y, B as p, ao as C, E as B, ah as m, ap as A } from "./ChaiBuilderEditor-F2yUJQdt.js";
|
|
5
5
|
import { useTranslation as x } from "react-i18next";
|
|
6
6
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
7
7
|
import "clsx";
|
|
@@ -1 +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("./ChaiBuilderEditor-
|
|
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("./ChaiBuilderEditor-lqHQcnh3.cjs"),l=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("lodash-es");require("./STRINGS-gPz7CUOk.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("tree-model");require("./utils-K3Zk762G.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");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-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-quill");require("react-hotkeys-hook");require("lucide-react");const p=()=>r.useBuilderProp("languages",["en"]),m=()=>p().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"})]})})]})}),j=()=>{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(r.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})},d=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},h=()=>{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(m,{}),e.jsxRuntimeExports.jsx(d,{}),e.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),x?e.jsxRuntimeExports.jsx(j,{}):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=h;
|